/* MegaLicenses dashboard — clean refresh */
:root{
  color-scheme:dark;
  --bg:#0a0d14;--surface:#10141d;--surface-2:#151a25;--surface-3:#1b2130;--hover:#1a2030;
  --line:#1e2533;--line-strong:#2a3346;
  --text:#eef1f7;--text-2:#b4bccc;--muted:#8791a5;--muted2:#667085;
  --accent:#7c8cff;--accent-strong:#6577f5;--accent-soft:rgba(124,140,255,.12);--accent-line:rgba(124,140,255,.32);
  --good:#4cd1a1;--bad:#f27d8c;--warn:#f0bb68;
  --radius:12px;--radius-sm:8px;--shadow:0 20px 60px rgba(0,0,0,.45);
  --font:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  --mono:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,monospace;
}
*{box-sizing:border-box}
html{min-height:100%;background:var(--bg);-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--text);font:14px/1.55 var(--font);-webkit-font-smoothing:antialiased}
button,input,select,textarea{font:inherit}button{cursor:pointer}button:disabled{opacity:.45;cursor:not-allowed}
button,input,select,textarea{outline-color:var(--accent)}
a{color:var(--accent)}h1,h2,h3,p{margin:0}
h1{font-size:26px;line-height:1.2;letter-spacing:-.6px;font-weight:650}
h2{font-size:17px;letter-spacing:-.2px;font-weight:620}h3{font-size:15px;font-weight:620}small{font-size:12px}
.hidden{display:none!important}.subtle{color:var(--muted2);font-size:12px}.muted{color:var(--muted)}
.eyebrow{font-size:11px;font-weight:650;letter-spacing:.08em;text-transform:uppercase;color:var(--accent);margin-bottom:8px}
::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-thumb{background:#252d3e;border-radius:10px;border:2px solid var(--bg)}::-webkit-scrollbar-track{background:transparent}

/* Layout */
.workspace{display:flex;min-height:100vh}
.sidebar{width:248px;flex:none;background:var(--surface);border-right:1px solid var(--line);display:flex;flex-direction:column;position:sticky;top:0;max-height:100vh;min-height:100vh;padding:22px 14px 14px;overflow-y:auto}
.main-column{min-width:0;flex:1;display:flex;flex-direction:column}
.topbar{height:64px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center;padding:0 36px;background:rgba(10,13,20,.85);backdrop-filter:blur(10px);position:sticky;top:0;z-index:10}
.main-content{padding:36px 36px 72px;max-width:1400px;width:100%;margin:0 auto}

/* Brand */
.brand{display:flex;align-items:center;gap:10px;font-weight:700;font-size:17px;letter-spacing:-.4px;padding:0 8px;white-space:nowrap}
.brand-accent{color:var(--accent)}
.brand-symbol{display:grid;place-items:center;width:30px;height:30px;border-radius:9px;position:relative;background:linear-gradient(135deg,#9aa6ff,#6577f5);color:#0e1330;font-size:18px;font-weight:900;letter-spacing:-3px;padding-right:3px}
.brand-dot{width:4px;height:4px;background:#fff;border-radius:50%;position:absolute;top:7px;right:6px}
.brand.large{font-size:20px;padding:0}.brand.large .brand-symbol{width:36px;height:36px}

/* Sidebar */
.workspace-switch{border:1px solid var(--line);border-radius:10px;background:var(--surface-2);padding:9px 10px;display:flex;align-items:center;gap:10px;margin:26px 0 24px}
.workspace-square{display:grid;place-items:center;background:var(--accent-soft);border:1px solid var(--accent-line);color:#c9d1ff;border-radius:8px;width:30px;height:30px;font-size:11px;font-weight:700}
.workspace-details{display:flex;flex-direction:column;flex:1;min-width:0;line-height:1.3}
.workspace-details strong{font-size:13px;font-weight:600}.workspace-details small{font-size:11px;color:var(--muted2)}
.workspace-chevron{color:var(--muted2)}
.sidebar-category{color:var(--muted2);font-size:11px;font-weight:650;letter-spacing:.08em;padding:0 10px;margin-bottom:8px}
.secondary-category{margin-top:26px}
.nav{display:flex;flex-direction:column;gap:2px}
.nav-item{display:flex;gap:12px;align-items:center;text-align:left;width:100%;border:0;background:transparent;color:var(--muted);padding:9px 10px;border-radius:8px;font-size:13.5px;font-weight:520;transition:background .15s,color .15s;position:relative}
.nav-item:hover{background:var(--hover);color:var(--text)}
.nav-item.selected{background:var(--accent-soft);color:#dfe4ff}
.nav-item.selected:before{content:"";position:absolute;left:-14px;top:9px;bottom:9px;width:3px;border-radius:0 3px 3px 0;background:var(--accent)}
.nav-icon{width:18px;height:18px;display:inline-flex;align-items:center;justify-content:center;flex:none;color:currentColor;opacity:.85}
.nav-icon svg{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.nav-item.selected .nav-icon{opacity:1;color:var(--accent)}
.sidebar-spacer{flex:1;min-height:20px}
.sidebar-help{padding:14px;border:1px solid var(--line);border-radius:10px;background:var(--surface-2);margin:0 0 14px}
.sidebar-help strong{font-size:12.5px;font-weight:600}.sidebar-help p{font-size:12px;line-height:1.6;color:var(--muted);margin-top:6px}
.help-shield{float:right;color:var(--accent);font-size:18px}
.profile{width:100%;display:flex;align-items:center;gap:10px;padding:12px 8px 2px;background:transparent;border:0;border-top:1px solid var(--line);text-align:left;color:var(--text)}
.avatar{width:32px;height:32px;display:grid;place-items:center;border-radius:50%;background:var(--accent-soft);border:1px solid var(--accent-line);color:#cfd6ff;font-weight:650;font-size:13px}
.avatar.small{width:30px;height:30px;font-size:12px}
.profile-copy{display:flex;flex-direction:column;flex:1;line-height:1.3}.profile-copy strong{font-size:13px;font-weight:600}.profile-copy small{color:var(--muted2)}
.logout-icon{font-size:17px;color:var(--muted)}.profile:hover .logout-icon{color:var(--text)}

/* Topbar */
.breadcrumb{display:flex;align-items:center;gap:10px;font-size:13px;color:var(--muted2)}
.breadcrumb strong{color:var(--text);font-weight:600}.crumb-divider{color:#363f52}
.top-actions{display:flex;align-items:center;gap:16px}
.api-status{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--muted)}
.status-led{display:inline-block;flex:none;width:7px;height:7px;border-radius:100%;background:var(--good);box-shadow:0 0 0 3px rgba(76,209,161,.16)}
.top-separator{height:20px;width:1px;background:var(--line)}

/* Page header */
.page-header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:28px}
.page-header p{font-size:14px;color:var(--muted);margin-top:6px}
.page-header-right{display:flex;gap:8px;align-items:center}
.section-heading{display:flex;justify-content:space-between;align-items:center;margin:36px 0 16px}
.section-heading h2{font-size:17px}.section-heading .muted{font-size:12px}

/* Buttons */
.button{border:1px solid var(--line-strong);display:inline-flex;align-items:center;justify-content:center;gap:8px;background:var(--surface-2);color:var(--text);padding:9px 14px;min-height:36px;border-radius:8px;font-size:13px;font-weight:560;transition:background .15s,border-color .15s,transform .05s;text-decoration:none;white-space:nowrap}
.button:hover{background:var(--surface-3);border-color:#3a4560}.button:active{transform:translateY(1px)}
.button.primary{border-color:transparent;background:var(--accent-strong);color:#fff}.button.primary:hover{background:#7586ff}
.button.danger{color:#ffb6c0;background:rgba(242,125,140,.1);border-color:rgba(242,125,140,.35)}.button.danger:hover{background:rgba(242,125,140,.18)}
.button.small{padding:6px 11px;min-height:30px;font-size:12px}
.button.ghost{background:transparent;border-color:var(--line-strong);color:var(--text-2)}.button.ghost:hover{background:var(--hover);color:var(--text)}
.button.full{width:100%}.button .plus{font-size:17px;line-height:0}
.icon-button{display:grid;place-items:center;width:30px;height:30px;border-radius:8px;background:transparent;color:var(--muted);border:1px solid var(--line);font-size:13px;transition:.15s}
.icon-button:hover{color:var(--text);background:var(--hover);border-color:var(--line-strong)}

/* Cards */
.stat-card,.panel,.product-card,.setting-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius)}
.stats-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin-bottom:24px}
.stat-card{padding:20px;min-height:132px;position:relative;overflow:hidden}
.stat-header{display:flex;justify-content:space-between;align-items:center;font-size:13px;color:var(--muted);font-weight:500}
.stat-icon{width:30px;height:30px;background:var(--accent-soft);display:grid;place-items:center;border-radius:8px;font-size:15px;color:var(--accent)}
.stat-number{font-size:30px;letter-spacing:-.8px;font-weight:650;margin-top:14px;line-height:1.1}
.stat-footer{color:var(--muted2);font-size:12px;margin-top:8px}.stat-footer strong{color:var(--good);font-weight:600}
.two-cols{display:grid;grid-template-columns:1.25fr 1fr;gap:16px}
.panel{min-width:0;padding:22px}
.panel-title{display:flex;justify-content:space-between;align-items:center}.panel-title h2{font-size:15px}
.panel-subtitle{font-size:13px;color:var(--muted);margin-top:4px}
.chart{height:200px;display:flex;align-items:flex-end;gap:14px;padding-top:30px}
.chart-group{display:flex;align-items:center;flex-direction:column;justify-content:flex-end;flex:1;gap:10px;height:100%;min-width:0}
.chart-bar-track{width:min(40px,100%);flex:1;display:flex;align-items:flex-end;background:rgba(124,140,255,.04);border-radius:6px}
.chart-bar{width:100%;border-radius:6px;background:linear-gradient(0deg,#5d6fe6,#97a3ff);min-height:3px}
.chart-day{font-size:11px;color:var(--muted2)}
.activity-list{margin-top:14px}
.activity-row{display:flex;align-items:center;gap:12px;padding:12px 0;border-bottom:1px solid var(--line)}.activity-row:last-child{border-bottom:0}
.activity-mark{width:30px;height:30px;flex:none;display:grid;place-items:center;border-radius:8px;background:var(--surface-3);color:var(--muted)}
.activity-info{min-width:0;flex:1}.activity-info strong{font-size:13px;font-weight:600;display:block}.activity-info small{font-size:12px;color:var(--muted2)}
.activity-time{font-size:12px;color:var(--muted2);white-space:nowrap}
.quick-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin-top:16px}
.quick-item{border:1px solid var(--line);border-radius:var(--radius);padding:18px;background:var(--surface);text-align:left;color:var(--text);transition:.15s;min-height:110px}
.quick-item:hover{border-color:var(--accent-line);background:var(--surface-2);transform:translateY(-1px)}
.quick-item .quick-icon{width:30px;height:30px;border-radius:8px;background:var(--accent-soft);color:var(--accent);display:grid;place-items:center;font-size:15px;margin-bottom:12px}
.quick-item strong{font-size:14px;display:block;font-weight:600}.quick-item small{color:var(--muted);display:block;margin-top:3px;font-size:12.5px}

/* Products */
.products-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:16px}
.product-card{padding:20px;min-height:210px;display:flex;flex-direction:column;transition:border-color .15s}
.product-card:hover{border-color:var(--line-strong)}
.product-top{display:flex;justify-content:space-between;align-items:flex-start}
.product-logo{display:grid;place-items:center;width:38px;height:38px;border-radius:10px;background:var(--accent-soft);border:1px solid var(--accent-line);color:#cfd6ff;font-size:16px;font-weight:700}
.product-card h3{font-size:15px;margin-top:14px}
.product-card .product-slug{font-size:12px;color:var(--muted2);margin-top:1px;font-family:var(--mono)}
.product-description{font-size:13px;color:var(--muted);min-height:34px;margin:10px 0;line-height:1.6}
.product-bottom{border-top:1px solid var(--line);margin-top:auto;padding-top:14px;display:flex;justify-content:space-between;align-items:center;gap:8px}
.product-bottom .muted{font-size:12px}.product-buttons{display:flex;gap:6px}
.product-id-line{display:flex;gap:8px;align-items:center;padding:6px 6px 6px 10px;margin-top:10px;border:1px solid var(--line);border-radius:8px;background:var(--bg);min-width:0}
.product-id-line span{font-size:11px;color:var(--muted2);white-space:nowrap}
.product-id-line code{font:11px var(--mono);color:#b9c3ff;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}
.product-id-line .icon-button{width:26px;height:26px;flex:none;font-size:12px;border-color:transparent}
.store-label{margin-top:10px;font-size:12px}.shop-live{color:var(--good);font-weight:600}
.shop-preview{height:140px;display:grid;place-items:center;border-radius:10px;background:linear-gradient(135deg,#1a2136,#121828);color:var(--accent);font-size:44px;overflow:hidden;border:1px solid var(--line)}
.shop-preview img{width:100%;height:100%;object-fit:contain}

/* Pills */
.pill{display:inline-flex;align-items:center;gap:6px;border:1px solid transparent;border-radius:999px;padding:3px 10px;font-size:11px;font-weight:600}
.pill:before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor}
.pill.active{background:rgba(76,209,161,.1);color:var(--good);border-color:rgba(76,209,161,.25)}
.pill.suspended{background:rgba(240,187,104,.1);color:var(--warn);border-color:rgba(240,187,104,.28)}
.pill.revoked,.pill.disabled,.pill.expired{background:rgba(242,125,140,.1);color:var(--bad);border-color:rgba(242,125,140,.28)}

/* Forms & toolbar */
.toolbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:16px}
.search-wrap{flex:1;min-width:200px;position:relative}
.search-wrap .magnifier{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:var(--muted2);font-size:16px;pointer-events:none}
.search-wrap input{padding-left:36px!important}
.control,input,select,textarea{background:var(--bg);border:1px solid var(--line-strong);border-radius:8px;color:var(--text);width:100%;padding:9px 12px;font-size:13px;outline:none;transition:border-color .15s,box-shadow .15s}
input::placeholder,textarea::placeholder{color:var(--muted2)}
.control:focus,input:focus,select:focus,textarea:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
input:disabled,select:disabled,textarea:disabled{opacity:.55}
.toolbar select{width:auto;min-width:160px}
label{font-size:13px;color:var(--text-2);font-weight:550;display:flex;flex-direction:column;gap:6px}label .subtle{font-weight:400}
textarea{resize:vertical;min-height:88px}
.stack-16{display:flex;flex-direction:column;gap:16px}
.field-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.form-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:22px}
.modal-hint{color:var(--muted2);font-size:12px;margin-top:6px;font-weight:400}

/* Tables */
.table-wrap{overflow-x:auto;border:1px solid var(--line);border-radius:var(--radius);background:var(--surface)}
table{width:100%;border-collapse:collapse;text-align:left;white-space:nowrap}
th{color:var(--muted2);background:var(--surface-2);font-size:11px;font-weight:650;letter-spacing:.06em;text-transform:uppercase;padding:12px 18px}
td{padding:14px 18px;border-top:1px solid var(--line);font-size:13px;color:var(--text-2)}
tbody tr{transition:background .12s}tr:hover td{background:rgba(255,255,255,.015)}
td strong{color:var(--text);font-weight:600}
.cell-detail{font-size:12px;color:var(--muted2);margin-top:2px}
.key-mono{font:12px var(--mono);color:#aeb9ff}
.table-actions{display:flex;gap:6px;justify-content:flex-end}
.pagination{display:flex;justify-content:space-between;align-items:center;color:var(--muted);font-size:13px;margin-top:14px}
.pagination-actions{display:flex;gap:6px}.pagination .button{min-height:30px;padding:5px 11px}

/* Empty state, notes, settings */
.empty-state{padding:56px 20px;text-align:center;border:1px dashed var(--line-strong);background:var(--surface);border-radius:var(--radius)}
.empty-graphic{width:52px;height:52px;margin:0 auto 16px;display:grid;place-items:center;background:var(--accent-soft);border-radius:14px;font-size:24px;color:var(--accent)}
.empty-state h3{font-size:16px}.empty-state p{font-size:13px;color:var(--muted);margin:8px auto 18px;max-width:420px}
.setting-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.setting-card{padding:22px}.setting-card p{color:var(--muted);font-size:13px;margin:8px 0 18px;line-height:1.6}.setting-card .button{margin-top:4px}
.note{padding:12px 14px;border:1px solid var(--line-strong);background:var(--surface-2);border-radius:8px;color:var(--text-2);font-size:13px;line-height:1.65}
.note.warning{border-color:rgba(240,187,104,.35);background:rgba(240,187,104,.07);color:#efcf98}
.note.danger{border-color:rgba(242,125,140,.35);background:rgba(242,125,140,.07);color:#f2a5af}
.divider{height:1px;background:var(--line);margin:20px 0}
.inline-code{padding:2px 6px;border-radius:5px;background:var(--surface-3);color:#cbd3ff;font:12px var(--mono)}
.feature-meta{font-size:12px;color:var(--muted2);margin-bottom:6px}
.card-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:16px}
.loader{display:flex;align-items:center;justify-content:center;padding:80px;color:var(--muted)}

/* Luau protection */
.protect-layout{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;align-items:start}
.code-editor{width:100%;height:min(53vh,470px);min-height:300px;resize:vertical;margin-top:14px;background:var(--bg);color:#d6e0ff;border:1px solid var(--line-strong);border-radius:10px;padding:16px;font:12.5px/1.65 var(--mono);tab-size:4}
.protect-actions{display:flex;align-items:end;justify-content:space-between;gap:14px;flex-wrap:wrap;margin-top:14px}
.protect-actions label{flex:1;min-width:190px}.protect-actions .card-actions{margin:0}
.upload-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-top:16px}
.upload-row .button{cursor:pointer;min-height:34px;margin:0}
.upload-row .file-input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}

/* Dialog */
.dialog-root{position:fixed;inset:0;z-index:40;display:grid;place-items:center;padding:20px}
.dialog-shade{position:absolute;inset:0;background:rgba(4,6,12,.72);backdrop-filter:blur(6px)}
.dialog{position:relative;width:min(560px,100%);max-height:min(90vh,900px);overflow:auto;background:var(--surface);border:1px solid var(--line-strong);border-radius:16px;box-shadow:var(--shadow)}
.dialog-header{padding:22px 24px 18px;display:flex;justify-content:space-between;align-items:start;border-bottom:1px solid var(--line)}
.dialog-header .eyebrow{margin-bottom:4px}.dialog-header h2{font-size:19px}
.dialog-body{padding:22px 24px 26px}
.secret-block{background:var(--bg);border:1px solid var(--accent-line);border-radius:10px;padding:16px;overflow-wrap:anywhere;font:12.5px/1.8 var(--mono);color:#c8d1ff;margin:14px 0}
.secret-list{max-height:300px;overflow:auto}.secret-list div+div{border-top:1px solid var(--line);padding-top:10px;margin-top:10px}
.error-text{color:#ffb0b9;background:rgba(242,125,140,.1);border:1px solid rgba(242,125,140,.3);border-radius:8px;padding:9px 12px;font-size:13px}

/* Login */
.login-screen{min-height:100vh;display:grid;place-items:center;padding:24px;position:relative;isolation:isolate}
.login-backdrop{z-index:-1;position:absolute;inset:0;background:radial-gradient(ellipse 60% 45% at 50% 0%,rgba(101,119,245,.2),transparent 70%),var(--bg)}
.login-card{width:min(420px,100%);border:1px solid var(--line-strong);background:rgba(16,20,29,.92);border-radius:18px;padding:36px 34px 26px;box-shadow:var(--shadow)}
.login-heading{margin:34px 0 26px}.login-heading h1{font-size:26px}.login-heading p{margin-top:8px;color:var(--muted);font-size:14px}
.login-card input{min-height:42px}.login-card .button{min-height:42px;justify-content:space-between;padding:0 16px;margin-top:4px}
.login-footer{margin-top:28px;display:flex;align-items:center;justify-content:center;gap:10px;font-size:12px;color:var(--muted2)}
.footer-divider{width:3px;height:3px;border-radius:50%;background:#4a5468}

/* Toast */
#toast{position:fixed;bottom:22px;right:22px;z-index:70;background:var(--surface-3);border:1px solid var(--line-strong);box-shadow:var(--shadow);border-radius:10px;padding:11px 16px;color:var(--text);font-size:13px;max-width:390px;display:none}
#toast.visible{display:block}#toast.bad{border-color:rgba(242,125,140,.5);color:#ffbcc5}
.mobile-menu{display:none;border:0;color:var(--text);background:transparent;font-size:20px}

/* Responsive */
@media(max-width:1190px){.sidebar{width:226px}.main-content{padding:30px 24px}.topbar{padding:0 24px}.stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.two-cols{grid-template-columns:1fr}}
@media(max-width:980px){.protect-layout{grid-template-columns:1fr}.code-editor{height:320px}}
@media(max-width:780px){
  .sidebar{position:fixed;left:0;top:0;bottom:0;z-index:30;transform:translateX(-100%);transition:transform .2s;box-shadow:var(--shadow)}
  .sidebar.open{transform:translateX(0)}
  .topbar{height:58px;padding:0 16px}.mobile-menu{display:block;margin-right:12px}
  .top-actions .api-status,.top-separator{display:none}
  .main-content{padding:24px 16px 60px}.page-header h1{font-size:23px}
  .page-header-right{flex-wrap:wrap;justify-content:flex-end}
  .stats-grid{gap:10px;margin-bottom:16px}.stat-card{padding:16px;min-height:120px}.stat-number{font-size:25px}
  .quick-grid,.setting-grid,.products-grid{grid-template-columns:1fr}
  .toolbar select{flex:1;min-width:0}.dialog-body{padding:20px}.dialog-header{padding:18px 20px}.login-card{padding:28px 24px}
}
@media(max-width:460px){.stats-grid{grid-template-columns:1fr 1fr}.stat-card{padding:13px}.stat-header{font-size:11px}.stat-icon{width:26px;height:26px}.field-row{grid-template-columns:1fr}.top-actions{gap:9px}.stat-footer{font-size:11px}}
