/* ==========================================================================
   Performance Suite — Design System
   Shared by the customer portal, the store and the admin console.
   Structure: 1 Tokens · 2 Fonts · 3 Base · 4 Layout shells · 5 Components
              6 Portal pages · 7 Utilities · 8 Responsive
   ========================================================================== */

/* 1. Tokens ------------------------------------------------------------- */
:root {
  color-scheme: dark;
  --bg: #07090e;
  --bg-raised: #0a0e15;
  --surface: #0f141d;
  --surface-2: #141a26;
  --surface-3: #1a2131;
  --surface-4: #212a3c;
  --line: rgba(148, 163, 184, .13);
  --line-strong: rgba(148, 163, 184, .24);
  --text: #eef2f8;
  --text-2: #aeb8c9;
  --muted: #6f7b92;
  --accent: #36f0c2;
  --accent-2: #22cfa5;
  --accent-ink: #03241b;
  --accent-soft: rgba(54, 240, 194, .12);
  --accent-line: rgba(54, 240, 194, .35);
  --accent-glow: rgba(54, 240, 194, .32);
  --violet: #b7a0ff;
  --violet-soft: rgba(183, 160, 255, .14);
  --violet-line: rgba(183, 160, 255, .38);
  --blue: #6fa9ff;
  --blue-soft: rgba(111, 169, 255, .14);
  --amber: #ffc65a;
  --amber-soft: rgba(255, 198, 90, .14);
  --amber-line: rgba(255, 198, 90, .38);
  --red: #ff6d7f;
  --red-soft: rgba(255, 109, 127, .13);
  --red-line: rgba(255, 109, 127, .4);
  --green: #46e39a;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, .035) inset, 0 10px 30px -12px rgba(0, 0, 0, .6);
  --shadow-pop: 0 20px 50px -10px rgba(0, 0, 0, .7), 0 0 0 1px var(--line-strong);
  --font-ui: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar-w: 256px;
  --topbar-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* 2. Fonts (self-hosted, OFL) ------------------------------------------- */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("./fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("./fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("./fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("./fonts/inter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 500; font-display: swap; src: url("./fonts/space-grotesk-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 600; font-display: swap; src: url("./fonts/space-grotesk-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 700; font-display: swap; src: url("./fonts/space-grotesk-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("./fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("./fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("./fonts/jetbrains-mono-latin-600-normal.woff2") format("woff2"); }

/* 3. Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--text);
  font: 14px/1.55 var(--font-ui);
  font-feature-settings: "cv11", "ss01", "tnum";
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(54, 240, 194, .09), transparent 60%),
    radial-gradient(700px 400px at 100% 0%, rgba(111, 169, 255, .07), transparent 60%),
    linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px);
  background-size: auto, auto, 48px 48px, 48px 48px;
  -webkit-mask-image: linear-gradient(#000 0, #000 55%, transparent 100%);
  mask-image: linear-gradient(#000 0, #000 55%, transparent 100%);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); letter-spacing: -.02em; line-height: 1.15; color: var(--text); }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0 0 12px; color: var(--text-2); }
p:last-child { margin-bottom: 0; }
small { color: var(--muted); font-size: 12px; }
code, kbd, .mono { font-family: var(--font-mono); font-size: .92em; }
code { color: #d9e6f5; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
::selection { background: rgba(54, 240, 194, .3); }
img, svg, video, iframe { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* 4. Layout shells -------------------------------------------------------- */
.wrap { width: min(1240px, calc(100% - 48px)); margin-inline: auto; }

/* 4a. Public header (store, legacy, order pages) */
.site-header { position: sticky; top: 0; z-index: 40; background: rgba(7, 9, 14, .82); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.site-header .nav { height: var(--topbar-h); display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #5cf5d0, #1fb892); color: var(--accent-ink); font-weight: 800; font-size: 16px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08) inset, 0 6px 18px -6px var(--accent-glow); }
.brand small { display: block; color: var(--muted); font: 600 10px/1 var(--font-ui); letter-spacing: .14em; text-transform: uppercase; margin-top: 3px; }
.nav-links { display: flex; align-items: center; gap: 2px; margin-left: 8px; }
.nav-links a { padding: 8px 12px; border-radius: 8px; color: var(--text-2); font-weight: 500; font-size: 13.5px; }
.nav-links a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-links a.active { color: var(--text); background: var(--surface-3); box-shadow: 0 0 0 1px var(--line) inset; }
.discord-link { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.nav-links .discord-link { color: #aebdff; }
.discord-link .ico { flex: none; }
.auth-brand-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.auth-brand-row .discord-link { margin-top: 4px; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-right form { margin: 0; }
.site-footer { margin-top: 64px; padding: 28px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--text-2); }

/* 4b. App shell (portal dashboard + admin console) */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--bg-raised); border-right: 1px solid var(--line); overflow-y: auto; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.sidebar-brand .brand { font-size: 15px; }
.sidebar-nav { padding: 12px 10px; display: grid; gap: 2px; align-content: start; }
.nav-group { padding: 14px 10px 6px; color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.nav-group:first-child { padding-top: 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); font: 500 13.5px/1.2 var(--font-ui); text-align: left; cursor: pointer; text-decoration: none; transition: background .15s var(--ease), color .15s var(--ease); }
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: linear-gradient(90deg, rgba(54, 240, 194, .14), rgba(54, 240, 194, .04)); color: var(--text); box-shadow: inset 2px 0 0 var(--accent), 0 0 0 1px rgba(54, 240, 194, .12) inset; }
.nav-item .ico { display: grid; place-items: center; width: 20px; height: 20px; color: var(--muted); flex: none; }
.nav-item.active .ico { color: var(--accent); }
.nav-item .count { margin-left: auto; min-width: 22px; padding: 2px 7px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); font: 600 11px/1.4 var(--font-mono); text-align: center; }
.nav-item .count.warn { background: var(--amber-soft); color: var(--amber); }
.nav-item .ext { margin-left: auto; color: var(--muted); font-size: 11px; }
.sidebar-foot { margin-top: auto; padding: 14px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.user-chip .avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--surface-4), var(--surface-3)); color: var(--accent); font: 700 13px var(--font-display); flex: none; }
.user-chip .who { min-width: 0; line-height: 1.25; }
.user-chip .who strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .who small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip form { margin-left: auto; }
.sys-state { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.sys-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), 0 0 12px var(--accent-glow); }

.main { min-width: 0; padding: 0 32px 64px; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; min-height: var(--topbar-h); padding: 12px 0; margin: 0 0 22px; background: rgba(7, 9, 14, .86); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.topbar .crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.topbar .crumbs a { color: var(--muted); }
.topbar .crumbs span::before { content: "/"; margin-right: 8px; color: var(--line-strong); }
.topbar h1 { font-size: 20px; }
.topbar .spacer { flex: 1; }
.topbar .actions { display: flex; align-items: center; gap: 8px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 4px 0 22px; }
.page-head h1 { font-size: 26px; }
.page-head p { margin: 6px 0 0; color: var(--text-2); max-width: 720px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 18px; height: 2px; background: var(--accent); border-radius: 2px; }
.eyebrow.plain::before { display: none; }

/* Burger for narrow screens */
.menu-toggle { display: none; }

/* 5. Components ----------------------------------------------------------- */
/* 5a. Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 22px; }
.card.tight { padding: 16px 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card.flush .card-head { padding: 18px 20px 0; }
.card-head h2 { font-size: 16px; }
.card-head p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.card-head .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: none; }
.card + .card { margin-top: 18px; }
.stack { display: grid; gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
.grid-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.grid-aside-left { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 18px; align-items: start; }
.span-all { grid-column: 1 / -1; }
.hero-card { position: relative; overflow: hidden; background: linear-gradient(135deg, #111a26, #0d1219 60%); }
.hero-card::after { content: ""; position: absolute; inset: -40% -20% auto auto; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(closest-side, rgba(54, 240, 194, .18), transparent); pointer-events: none; }
.hero-card > * { position: relative; }

/* 5b. KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpis.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpi { position: relative; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-card); overflow: hidden; }
.kpi .label { display: block; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.kpi .value { display: block; margin-top: 8px; font: 700 28px/1.1 var(--font-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 14px; color: var(--muted); font-family: var(--font-ui); font-weight: 500; margin-left: 4px; letter-spacing: 0; }
.kpi .sub { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.kpi.good .value { color: var(--accent); }
.kpi.warn .value { color: var(--amber); }
.kpi.danger .value { color: var(--red); }
.kpi.violet .value { color: var(--violet); }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; }
.kpi.good::before { background: var(--accent); }
.kpi.warn::before { background: var(--amber); }
.kpi.danger::before { background: var(--red); }
.kpi.violet::before { background: var(--violet); }

/* 5c. Buttons */
.btn, button, input[type="submit"] { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-xs); background: var(--surface-2); color: var(--text); font: 600 13px/1.2 var(--font-ui); letter-spacing: .005em; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s var(--ease), border-color .15s var(--ease), transform .12s var(--ease), box-shadow .15s var(--ease); }
.btn:hover, button:hover { background: var(--surface-3); border-color: rgba(148, 163, 184, .4); text-decoration: none; }
.btn:active, button:active { transform: translateY(1px); }
.btn.primary, button.primary { background: linear-gradient(180deg, #4df3cb, #27d8ad); border-color: transparent; color: var(--accent-ink); box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset, 0 8px 22px -8px var(--accent-glow); }
.btn.primary:hover, button.primary:hover { background: linear-gradient(180deg, #62f6d2, #33e0b6); box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset, 0 10px 28px -8px var(--accent-glow); }
.btn.ghost, button.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover, button.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger, button.danger { background: var(--red-soft); border-color: var(--red-line); color: #ffb3bc; }
.btn.danger:hover, button.danger:hover { background: rgba(255, 109, 127, .22); }
.btn.violet, button.violet { background: var(--violet-soft); border-color: var(--violet-line); color: #d9ccff; }
.btn.sm, button.sm { min-height: 30px; padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn.xs, button.xs { min-height: 26px; padding: 2px 8px; font-size: 11.5px; border-radius: 6px; }
.btn.lg, button.lg { min-height: 46px; padding: 10px 20px; font-size: 14px; border-radius: var(--radius-sm); }
.btn.full, button.full { width: 100%; }
.btn.icon, button.icon { padding: 0; width: 34px; min-height: 34px; }
button:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none; }
.btn-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn-row form { margin: 0; display: contents; }

/* 5d. Forms */
form { margin: 0; }
label { display: block; margin: 0 0 6px; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { margin: 0; }
.field .hint { color: var(--muted); font-size: 12px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]):not([type="submit"]), select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-xs); background: var(--bg-raised); color: var(--text); font: 500 13.5px/1.4 var(--font-ui); transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--muted); font-weight: 400; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[readonly] { color: var(--text-2); background: var(--surface-2); }
input[type="file"] { width: 100%; padding: 8px 10px; border: 1px dashed var(--line-strong); border-radius: var(--radius-xs); background: var(--bg-raised); color: var(--text-2); font: 500 13px var(--font-ui); }
input[type="file"]::file-selector-button { margin-right: 10px; padding: 5px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface-2); color: var(--text); font: 600 12px var(--font-ui); cursor: pointer; }
input[type="number"] { font-variant-numeric: tabular-nums; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
input[type="color"] { width: 40px; height: 32px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg-raised); }
select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; cursor: pointer; }
textarea { min-height: 120px; resize: vertical; font-family: var(--font-mono); font-size: 12.5px; }
.check { display: flex; align-items: center; gap: 9px; margin: 0; color: var(--text-2); font-weight: 500; font-size: 13px; cursor: pointer; }
.check input { flex: none; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; }
.inline-form .field { flex: 1; min-width: 0; margin: 0; }
.inline-form > input { flex: 1; min-width: 0; }
.inline-form button, .inline-form .btn { flex: none; }
.input-group { display: flex; }
.input-group input { border-radius: var(--radius-xs) 0 0 var(--radius-xs); }
.input-group button { border-radius: 0 var(--radius-xs) var(--radius-xs) 0; margin-left: -1px; }
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg-raised); gap: 2px; }
.seg a, .seg button, .seg label { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 4px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font: 600 12.5px var(--font-ui); cursor: pointer; white-space: nowrap; margin: 0; }
.seg a:hover, .seg button:hover, .seg label:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.seg .active, .seg input:checked + span { color: var(--text); background: var(--surface-3); box-shadow: 0 0 0 1px var(--line-strong) inset; }
.seg .count { padding: 0 6px; border-radius: 99px; background: var(--surface-4); color: var(--text-2); font: 600 10.5px/1.6 var(--font-mono); }
.seg .active .count { background: var(--accent-soft); color: var(--accent); }
.seg label input { position: absolute; opacity: 0; pointer-events: none; }
.seg label span { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px; margin: -4px -12px; border-radius: 7px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.choice { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-xs); background: var(--bg-raised); cursor: pointer; margin: 0; font-weight: 500; color: var(--text); transition: border-color .15s var(--ease), background .15s var(--ease); }
.choice:hover { border-color: var(--line-strong); }
.choice:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
.choice input { margin-top: 2px; }
.choice small { display: block; color: var(--muted); font-family: var(--font-mono); font-size: 11px; margin-top: 2px; }
.choice.locked { opacity: .65; cursor: not-allowed; }
.choice.locked input { cursor: not-allowed; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-xs); padding: 12px 14px; margin: 0 0 14px; }
legend { padding: 0 6px; color: var(--muted); font-size: 12px; font-weight: 600; }

/* 5e. Badges / status */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border: 1px solid var(--line-strong); border-radius: 99px; background: var(--surface-2); color: var(--text-2); font-size: 11.5px; font-weight: 600; white-space: nowrap; line-height: 1.4; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.plain::before { display: none; }
.badge.ok { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.badge.warn { color: var(--amber); border-color: var(--amber-line); background: var(--amber-soft); }
.badge.danger { color: var(--red); border-color: var(--red-line); background: var(--red-soft); }
.badge.info { color: var(--blue); border-color: rgba(111, 169, 255, .4); background: var(--blue-soft); }
.badge.violet { color: var(--violet); border-color: var(--violet-line); background: var(--violet-soft); }
.badge.muted { color: var(--muted); }
.badge.muted::before { opacity: .5; }
.tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font: 600 11px/1.5 var(--font-ui); letter-spacing: .02em; white-space: nowrap; }
.tag.violet { background: var(--violet-soft); color: var(--violet); }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.blue { background: var(--blue-soft); color: var(--blue); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.mono { font-family: var(--font-mono); font-weight: 500; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.dot.warn { background: var(--amber); }
.dot.danger { background: var(--red); }

/* 5f. Alerts */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-2); margin: 0 0 18px; }
.alert::before { content: "i"; flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-4); color: var(--text); font: 700 12px var(--font-mono); margin-top: 1px; }
.alert.error { border-color: var(--red-line); background: var(--red-soft); color: #ffd1d7; }
.alert.error::before { content: "!"; background: var(--red); color: #2a070c; }
.alert.success { border-color: var(--accent-line); background: var(--accent-soft); color: #c9fff0; }
.alert.success::before { content: "✓"; background: var(--accent); color: var(--accent-ink); }
.alert.warn { border-color: var(--amber-line); background: var(--amber-soft); color: #ffe7b8; }
.alert.warn::before { content: "!"; background: var(--amber); color: #2b1d00; }
.alert a { font-weight: 600; }
.alert .body { flex: 1; }
.alert .body strong { color: var(--text); }

/* 5g. Tables */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-raised); }
.card.flush .table-wrap { border: 0; border-radius: 0; }
.card .table-wrap + * { margin-top: 14px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
.data-table th { position: sticky; top: 0; z-index: 2; padding: 10px 14px; background: var(--surface-2); color: var(--muted); text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--text-2); font-size: 13px; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: rgba(255, 255, 255, .022); }
.data-table td strong { color: var(--text); font-weight: 600; }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table td.nowrap, .data-table .nowrap { white-space: nowrap; }
.data-table td.actions-cell { text-align: right; white-space: nowrap; }
.data-table .empty td { padding: 32px 14px; text-align: center; color: var(--muted); }
.data-table tr.selected td { background: rgba(54, 240, 194, .06); }
.data-table .sub { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.data-table .mono { color: var(--text-2); }
.scroll-y { max-height: 62vh; overflow: auto; }
.row-check { width: 16px; height: 16px; }

/* Key display (masked secret with reveal/copy) */
.key { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.key code { padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: #dbe7f6; font-size: 12px; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.key code.masked { letter-spacing: .08em; }
.key .btn.xs { border-color: transparent; background: transparent; color: var(--muted); padding: 0 5px; min-height: 24px; }
.key .btn.xs:hover { color: var(--text); background: var(--surface-3); }
.key-stack { display: grid; gap: 6px; }
.badges { display: flex; gap: 5px; flex-wrap: wrap; }

/* Progress bars */
.bar { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--blue)); }
.bar-row { display: grid; grid-template-columns: 140px minmax(80px, 1fr) 48px; gap: 12px; align-items: center; font-size: 13px; }
.bar-row strong { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row span:last-child { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }
.bar-rows { display: grid; gap: 10px; }

/* Definition lists / info grids */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 18px; }
.info-grid div { display: grid; gap: 3px; }
.info-grid > div > span { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.info-grid strong { color: var(--text); font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }

/* Lists */
.list { display: grid; gap: 8px; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-raised); }
.list-item .ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface-3); color: var(--accent); font: 700 14px var(--font-display); flex: none; }
.list-item .body { flex: 1; min-width: 0; }
.list-item .body strong { display: block; color: var(--text); }
.list-item .body small { display: block; }
.list-item .actions { display: flex; gap: 8px; flex: none; }
.timeline { display: grid; gap: 10px; }
.timeline > div { position: relative; padding-left: 16px; border-left: 2px solid var(--surface-4); }
.timeline > div::before { content: ""; position: absolute; left: -5px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.timeline strong { display: block; color: var(--text); font-weight: 600; font-size: 13px; }
.timeline small { display: block; }

/* Menus (details-based dropdowns) */
details.menu { position: relative; display: inline-block; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > .menu-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 220px; padding: 6px; border-radius: var(--radius-sm); background: var(--surface-2); box-shadow: var(--shadow-pop); display: grid; gap: 2px; }
details.menu .menu-panel button, details.menu .menu-panel a.btn { width: 100%; justify-content: flex-start; border-color: transparent; background: transparent; font-weight: 500; }
details.menu .menu-panel button:hover, details.menu .menu-panel a.btn:hover { background: var(--surface-3); }
details.menu .menu-panel hr { margin: 4px 0; }
details.menu .menu-panel .menu-inline { display: flex; gap: 6px; padding: 4px; }
details.menu .menu-panel .menu-inline input { width: 76px; min-height: 32px; padding: 4px 8px; }
details.menu .menu-panel .menu-inline button { width: auto; }
details.menu .menu-panel .danger { color: var(--red); }
details.menu .menu-panel .danger:hover { background: var(--red-soft); }

/* Collapsible sections */
details.disclosure { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-raised); }
details.disclosure > summary { display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; list-style: none; color: var(--text); font-weight: 600; font-size: 13.5px; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s var(--ease); margin-left: 2px; }
details.disclosure[open] > summary::before { transform: rotate(45deg); }
details.disclosure > summary small { margin-left: auto; }
details.disclosure > .disclosure-body { padding: 4px 16px 16px; border-top: 1px solid var(--line); }
details.disclosure.danger { border-color: var(--red-line); }
details.disclosure.danger > summary { color: #ffb3bc; }

/* Tabs (in-page) */
.tabs-bar { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs-bar a, .tabs-bar button { position: relative; padding: 10px 14px; border: 0; background: transparent; color: var(--text-2); font: 600 13px var(--font-ui); cursor: pointer; white-space: nowrap; border-radius: 0; min-height: 0; }
.tabs-bar a:hover, .tabs-bar button:hover { color: var(--text); background: transparent; text-decoration: none; }
.tabs-bar a.active, .tabs-bar button.active { color: var(--text); }
.tabs-bar a.active::after, .tabs-bar button.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; }
.tabs-bar .count { margin-left: 6px; padding: 0 6px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); font: 600 10.5px/1.6 var(--font-mono); }
.tabs-bar .active .count { background: var(--accent-soft); color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Toolbar */
.toolbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-raised); margin-bottom: 14px; }
.toolbar .field { margin: 0; min-width: 160px; }
.toolbar .field.grow { flex: 1; min-width: 220px; }
.toolbar .field label { font-size: 11px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.toolbar .spacer { flex: 1; }
.toolbar input, .toolbar select { min-height: 36px; }

/* Bulk action bar */
.bulk-bar { position: sticky; bottom: 14px; z-index: 15; display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding: 12px 14px; border: 1px solid var(--accent-line); border-radius: var(--radius-sm); background: rgba(15, 20, 29, .96); backdrop-filter: blur(14px); box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .7); }
.bulk-bar .count { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; white-space: nowrap; }
.bulk-bar .field { margin: 0; min-width: 150px; }
.bulk-bar .field label { font-size: 11px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.bulk-bar input, .bulk-bar select { min-height: 36px; }
.bulk-bar .spacer { flex: 1; }

/* Secret reveal panel (new keys / temp passwords) */
.secret-panel { border: 1px solid var(--amber-line); background: linear-gradient(135deg, rgba(255, 198, 90, .1), rgba(255, 198, 90, .03)); }
.secret-panel h2 { color: #ffe3b0; }
.secret-list { display: grid; gap: 6px; margin: 14px 0; }
.secret-list code { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg-raised); color: #fff1d6; font-size: 13px; overflow-wrap: anywhere; }
.secret-list code .btn { flex: none; }

/* Empty states */
.empty-state { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; color: var(--text-2); font-weight: 600; margin-bottom: 4px; }
.empty-state .btn { margin-top: 14px; }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0; }
.step { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-xs); background: var(--bg-raised); color: var(--muted); font-size: 12.5px; }
.step strong { display: block; color: var(--text-2); font-size: 13px; }
.step.done { border-color: var(--accent-line); background: var(--accent-soft); }
.step.done strong { color: var(--accent); }
.step.current { border-color: var(--amber-line); background: var(--amber-soft); }
.step.current strong { color: var(--amber); }

/* 6. Portal pages ---------------------------------------------------------- */
/* 6a. Auth (sign in / register) */
.auth { position: relative; min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.auth-page { display: flex; flex-direction: column; }
.auth-page .auth { flex: 1; min-height: 0; }
.auth-page .site-footer { margin-top: 0; }
.auth-copy { display: flex; flex-direction: column; justify-content: center; padding: 64px clamp(32px, 6vw, 96px); position: relative; overflow: hidden; }
.auth-copy::before { content: ""; position: absolute; inset: 0; background: radial-gradient(700px 500px at 20% 30%, rgba(54, 240, 194, .14), transparent 60%), radial-gradient(500px 400px at 90% 90%, rgba(111, 169, 255, .12), transparent 60%); pointer-events: none; }
.auth-copy > * { position: relative; }
.auth-copy .brand { margin-bottom: 48px; }
.auth-copy h1 { font-size: clamp(38px, 4.6vw, 60px); line-height: 1.02; letter-spacing: -.035em; margin: 14px 0 18px; }
.auth-copy h1 em { font-style: normal; color: var(--accent); }
.auth-copy .lede { font-size: 16px; line-height: 1.6; max-width: 520px; color: var(--text-2); }
.benefits { list-style: none; margin: 34px 0 0; padding: 0; display: grid; gap: 14px; max-width: 540px; }
.benefits li { display: flex; gap: 14px; align-items: flex-start; }
.benefits .check-ico { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-weight: 700; box-shadow: 0 0 0 1px var(--accent-line) inset; }
.benefits strong { display: block; color: var(--text); font-weight: 600; }
.benefits small { font-size: 12.5px; }
.trust-row { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 44px; color: var(--muted); font-size: 12px; }
.trust-row span { display: inline-flex; align-items: center; gap: 7px; }
.trust-row span::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.auth-side { display: grid; place-items: center; padding: 48px 32px; border-left: 1px solid var(--line); background: rgba(10, 14, 21, .6); }
.auth-card { width: min(440px, 100%); padding: 0; overflow: hidden; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 6px; gap: 4px; background: var(--bg-raised); border-bottom: 1px solid var(--line); }
.auth-tabs a { padding: 10px; border-radius: 8px; text-align: center; color: var(--muted); font-weight: 600; font-size: 13px; }
.auth-tabs a:hover { text-decoration: none; color: var(--text); }
.auth-tabs a.active { background: var(--surface-3); color: var(--text); box-shadow: 0 0 0 1px var(--line) inset; }
.auth-panel { padding: 28px; }
.auth-panel h2 { font-size: 22px; margin-bottom: 4px; }
.auth-panel > p { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.auth-panel .field { margin-bottom: 14px; }
.auth-panel .links { display: flex; justify-content: space-between; align-items: center; margin: 2px 0 18px; font-size: 12.5px; }
.auth-note { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; color: var(--muted); font-size: 12px; }
.auth-note::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* 6b. Reset password (centered) */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.center-card { width: min(460px, 100%); }
.center-card .brand { justify-content: center; width: 100%; margin-bottom: 22px; }
.center-card .card { padding: 30px; }
.center-card h1 { font-size: 24px; margin: 8px 0 6px; }
.center-card .back { display: inline-block; margin-top: 18px; color: var(--text-2); font-size: 13px; }

/* 6c. Portal dashboard specifics */
.attention { display: grid; gap: 8px; }
.attention-item { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-xs); background: var(--bg-raised); font-size: 13px; }
.attention-item .dot { flex: none; }
.attention-item strong { color: var(--text); }
.attention-item a { margin-left: auto; white-space: nowrap; }
.download-card { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-raised); }
.download-card .ico { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 14px; background: linear-gradient(135deg, var(--surface-4), var(--surface-2)); color: var(--accent); box-shadow: 0 0 0 1px var(--line) inset; }
.download-card strong { display: block; color: var(--text); font-size: 15px; font-family: var(--font-display); }
.download-card small { display: block; margin-top: 3px; }
.download-card .meta { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.legacy-page { padding-top: 40px; }
.legacy-page .page-head { margin-bottom: 26px; }
.legacy-card { max-width: 720px; }

/* 7. Utilities -------------------------------------------------------------- */
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.good { color: var(--accent); }
.warn-text { color: var(--amber); }
.danger-text { color: var(--red); }
.violet-text { color: var(--violet); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 14px; }
.mt-3 { margin-top: 22px; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 14px; }
.mb-3 { margin-bottom: 22px; }
.flex { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.right { margin-left: auto; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.section-spacer { margin-top: 18px; }
.w-100 { width: 100px; }
.w-140 { width: 140px; }
.max-520 { max-width: 520px; }
.max-680 { max-width: 680px; }
.hide-js { display: none; }

/* 8. Responsive -------------------------------------------------------------- */
@media (max-width: 1280px) {
  .kpis.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .grid-sidebar, .grid-aside-left { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-copy { padding: 48px 28px 24px; }
  .auth-side { border-left: 0; border-top: 1px solid var(--line); padding: 32px 20px 56px; }
}
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 60; transform: translateX(-102%); transition: transform .2s var(--ease); box-shadow: 0 0 60px rgba(0, 0, 0, .7); }
  .sidebar.open { transform: none; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 59; background: rgba(0, 0, 0, .5); }
  .menu-toggle { display: inline-flex; }
  .main { padding: 0 16px 48px; }
  .kpis, .kpis.six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .wrap { width: min(1240px, calc(100% - 32px)); }
  .site-header .nav { gap: 12px; }
  .nav-links { overflow-x: auto; }
  .download-card { grid-template-columns: 44px 1fr; }
  .download-card .actions { grid-column: 1 / -1; }
  .steps { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 100px 1fr 40px; }
}
@media (max-width: 600px) {
  .kpis, .kpis.six { grid-template-columns: 1fr 1fr; }
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .topbar h1 { font-size: 17px; }
  .site-footer .wrap { flex-direction: column; }
  .nav-right .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
.small-note { color: var(--muted); font-size: 12.5px; }
.is-copied { color: var(--accent) !important; }
.data-table th.actions-cell { text-align: right; }
.field { align-content: start; }
@media (max-width: 600px) {
  .topbar .crumbs a, .topbar .crumbs span::before { display: none; }
  .topbar .actions .btn:not(.primary) { display: none; }
  .topbar .actions .btn.discord-link { display: inline-flex; }
  .topbar .actions .btn.discord-link span { display: none; }
  .card-head { flex-wrap: wrap; }
  .tab-head .actions, .page-head .actions { width: 100%; }
  .seg { flex-wrap: wrap; }
}
@media (max-width: 600px) {
  .site-header .nav { flex-wrap: wrap; height: auto; padding: 10px 0; row-gap: 8px; }
  .site-header .nav-links { order: 3; width: 100%; margin-left: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .site-header .nav-right .btn.ghost { display: none; }
  .brand small { display: none; }
}
