:root {
  --bg: #f7f7fa;
  --panel: #ffffff;
  --line: #e5e7eb;
  --text: #191919;
  --muted: #777b84;
  --purple: #7629df;
  --purple2: #a86dea;
  --red: #ef4444;
  --green: #17a673;
  --shadow: 0 6px 22px rgba(22, 28, 45, .07);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Arial, sans-serif; color: var(--text); background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { display: grid; grid-template-columns: 268px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 5; }
.profile-mini { display: flex; gap: 13px; align-items: center; padding: 24px; border-bottom: 1px solid var(--line); }
.profile-mini strong, .profile-mini small { display: block; }
.profile-mini small, .owner-chip small { color: var(--muted); margin-top: 3px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; background: linear-gradient(135deg, var(--purple), #bc54e5); overflow: hidden; background-size: cover; background-position: center; }
.avatar.large { width: 100px; height: 100px; font-size: 30px; }
nav { padding: 14px 12px; display: grid; gap: 4px; }
nav button { border: 0; background: transparent; text-align: left; padding: 13px 14px; border-radius: 13px; display: flex; align-items: center; gap: 12px; color: #333; font-weight: 650; }
nav button span { width: 20px; text-align: center; font-size: 19px; }
nav button:hover { background: #f6f0ff; }
nav button.active { color: #fff; background: linear-gradient(135deg, var(--purple), #8127e9); box-shadow: var(--shadow); }
.sidebar-footer { margin-top: auto; padding: 14px; border-top: 1px solid var(--line); }
.owner-chip { background: #f3f3f5; border-radius: 14px; padding: 12px; display: grid; margin-bottom: 9px; }
.logout { border: 0; background: transparent; padding: 12px; font-weight: 650; }
.main-content { padding: 36px 34px 64px; min-width: 0; }
.page { display: none; max-width: 1200px; margin: 0 auto; }
.page.active { display: block; }
.page-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.page-title h1 { margin: 0; font-size: 34px; line-height: 1.1; }
.page-title p { margin: 7px 0 0; color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 16px; padding: 24px; margin-bottom: 22px; }
.panel h2 { margin: 0 0 20px; font-size: 25px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stats-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); padding: 24px; display: flex; gap: 15px; align-items: center; min-height: 106px; }
.stat-icon { width: 54px; height: 54px; border-radius: 13px; display: grid; place-items: center; background: #f3eaff; color: var(--purple); font-size: 25px; }
.stat-card small { color: var(--muted); display: block; margin-bottom: 4px; }
.stat-card strong { font-size: 28px; }
.quick-start ol { color: #6d6f78; line-height: 2; padding-left: 20px; }
.btn { border: 1px solid var(--line); border-radius: 10px; padding: 11px 17px; font-weight: 750; background: #fff; color: #222; }
.btn.primary { color: #fff; border-color: var(--purple); background: linear-gradient(135deg, var(--purple), #8a2be2); }
.btn.danger { color: #fff; border-color: var(--red); background: var(--red); }
.btn.success { color: #fff; border-color: var(--green); background: var(--green); }
.btn.ghost { background: #fff; }
.btn.wide { width: 100%; }
.stack-form { display: grid; gap: 15px; }
.stack-form label { font-weight: 650; display: grid; gap: 7px; }
.stack-form input, .stack-form select, .stack-form textarea, .search { width: 100%; border: 1px solid var(--line); background: #fafafa; border-radius: 11px; padding: 13px 14px; outline: 0; }
.stack-form input:focus, .stack-form select:focus, .stack-form textarea:focus, .search:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(118, 41, 223, .12); }
.stack-form small { color: var(--muted); font-weight: 500; }
.profile-upload { display: flex; align-items: center; gap: 18px; }
.grow { flex: 1; display: grid; gap: 10px; }
.upload-btn { text-align: center; }
.search { margin-bottom: 15px; background: #fff; }
.filter-row { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-row button { border: 1px solid var(--line); background: #fff; border-radius: 11px; padding: 9px 14px; }
.filter-row button.active { background: var(--purple); border-color: var(--purple); color: #fff; }
.list-stack { display: grid; gap: 12px; }
.list-card { background: #fff; border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); padding: 17px; }
.license-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.license-main { min-width: 0; }
.license-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.license-top code { font-weight: 800; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 800; }
.badge.active, .badge.license_validated, .badge.login_success { color: #fff; background: var(--purple); }
.badge.banned, .badge.license_rejected, .badge.login_failed { color: #fff; background: var(--red); }
.badge.expired { color: #6b7280; background: #eceef1; }
.license-sub, .muted { color: var(--muted); margin-top: 7px; }
.license-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.activity-card { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start; }
.activity-card time { color: var(--muted); font-size: 13px; }
.activity-card p { margin: 8px 0 0; }
.runtime-card h3 { margin: 0 0 5px; }
.runtime-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; margin-top: 15px; }
.runtime-grid div { min-width: 0; }
.runtime-grid small { color: var(--muted); display: block; }
.runtime-grid code { word-break: break-word; }
.modal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.72); padding: 18px; z-index: 30; }
.modal.hidden, .hidden { display: none !important; }
.modal-card { width: min(500px, 100%); max-height: 92vh; overflow: auto; background: #fff; border-radius: 16px; padding: 26px; position: relative; box-shadow: 0 30px 80px rgba(0,0,0,.28); }
.modal-card h2 { margin-top: 0; }
.modal-close { position: absolute; top: 15px; right: 17px; background: transparent; border: 0; font-size: 24px; }
.generated { margin-top: 18px; border-radius: 13px; padding: 14px; background: #f5efff; border: 1px dashed var(--purple); display: grid; gap: 8px; }
.generated code { font-size: 19px; font-weight: 900; color: var(--purple); word-break: break-all; }
.toast { position: fixed; right: 22px; bottom: 22px; padding: 13px 18px; border-radius: 11px; color: #fff; background: #111827; opacity: 0; transform: translateY(15px); pointer-events: none; transition: .2s; z-index: 50; }
.toast.show { opacity: 1; transform: translateY(0); }
.mobile-header { display: none; }
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 10%, #e9d7ff, transparent 38%), #f7f7fa; }
.login-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); box-shadow: 0 26px 70px rgba(73, 30, 126, .14); border-radius: 20px; padding: 32px; }
.login-card .brand-mark { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-weight: 900; color: #fff; background: linear-gradient(135deg, var(--purple), #bd55e5); }
.login-card h1 { margin-bottom: 6px; }
.login-card > p { color: var(--muted); margin-top: 0; }
.form-error { min-height: 18px; color: var(--red); font-size: 14px; }
.empty { text-align: center; padding: 34px; color: var(--muted); background: #fff; border: 1px dashed var(--line); border-radius: 14px; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -285px; width: 268px; transition: .22s; box-shadow: 12px 0 45px rgba(0,0,0,.16); }
  .sidebar.open { left: 0; }
  .mobile-header { display: flex; align-items: center; gap: 12px; margin: -12px -8px 22px; }
  .mobile-header button { border: 0; background: #fff; border-radius: 10px; padding: 8px 12px; font-size: 20px; }
  .main-content { padding: 24px 16px 54px; }
  .stats-grid, .stats-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .license-card { align-items: flex-start; flex-direction: column; }
  .license-actions { justify-content: flex-start; }
  .runtime-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .stats-grid, .stats-grid.compact { grid-template-columns: 1fr; }
  .page-title { flex-direction: column; }
  .profile-upload { align-items: flex-start; flex-direction: column; }
  .activity-card { grid-template-columns: 1fr; }
}
.reseller-info { border-left: 4px solid var(--purple); }
.reseller-info p { margin: 8px 0 0; color: var(--muted); line-height: 1.6; }
.toast[data-type="error"] { background: var(--red); }
.license-scope { margin-top: 7px; }

.product-filter-bar{display:flex;align-items:center;gap:12px;margin:0 0 14px;padding:12px 14px;background:#fff;border:1px solid var(--line);border-radius:13px}
.product-filter-bar b{font-size:13px}
.product-select{min-width:180px;border:1px solid var(--line);background:#fff;border-radius:10px;padding:10px 12px;outline:0}
.product-select:focus{border-color:var(--purple);box-shadow:0 0 0 3px rgba(118,41,223,.10)}
.product-badge{display:inline-flex;align-items:center;border-radius:999px;padding:5px 9px;font-size:11px;font-weight:850;color:#fff;background:#4f46e5}
.product-permission-box{border:1px solid var(--line);border-radius:12px;padding:13px;margin:0}
.product-permission-box legend{font-weight:750;padding:0 6px}
.product-check-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:6px 0 8px}
.product-check{display:flex!important;grid-template-columns:none!important;flex-direction:row!important;align-items:center;gap:8px;padding:9px;border:1px solid var(--line);border-radius:10px;background:#fafafa;font-size:13px}
.product-check input{width:auto!important;margin:0}
.product-access-list{display:flex;flex-wrap:wrap;gap:5px;margin-top:7px}
@media(max-width:560px){.product-check-grid{grid-template-columns:1fr}.product-filter-bar{align-items:stretch;flex-direction:column}.product-select{width:100%}}
