/* ============================================================================
   HourBust — design system
   Shared tokens + primitives used by the landing page, auth, user panel and
   the admin console, so the whole product reads as one thing.
   ========================================================================= */

:root {
  /* ── Surfaces ─────────────────────────────────────────────────────────── */
  --bg:            #05080E;
  --bg-soft:       #080D16;
  --surface:       #0D1320;
  --surface-2:     #121B2A;
  --surface-3:     #182337;
  --surface-4:     #1F2C44;
  --border:        #1E2A3E;
  --border-strong: #2C3D58;

  /* ── Text ─────────────────────────────────────────────────────────────── */
  --text:   #E9F0FA;
  --text-2: #9EB2CE;
  --text-3: #66799A;

  /* ── Accents ──────────────────────────────────────────────────────────── */
  --mint:   #3DDC97;
  --cyan:   #22D3EE;
  --violet: #7C5CFF;
  --amber:  #FFB454;
  --rose:   #FF5D6C;
  --blue:   #59A9FF;

  --accent:     var(--mint);
  --accent-ink: #032015;

  --grad:       linear-gradient(120deg, #3DDC97 0%, #22D3EE 52%, #7C5CFF 100%);
  --grad-warm:  linear-gradient(120deg, #FFB454 0%, #FF5D6C 100%);
  --grad-text:  linear-gradient(100deg, #8FFFC8 0%, #6BE7FF 45%, #B9A6FF 100%);

  /* ── Effects ──────────────────────────────────────────────────────────── */
  --ring:       0 0 0 3px rgba(61, 220, 151, .22);
  --ring-blue:  0 0 0 3px rgba(34, 211, 238, .20);
  --shadow-sm:  0 2px 8px rgba(0, 0, 0, .25);
  --shadow:     0 12px 34px rgba(2, 6, 14, .55);
  --shadow-lg:  0 30px 80px rgba(2, 6, 14, .70);
  --glow-mint:  0 10px 34px -8px rgba(61, 220, 151, .45);

  --radius-xs: 8px;
  --radius-sm: 11px;
  --radius:    16px;
  --radius-lg: 22px;
  --radius-xl: 30px;

  --ease: cubic-bezier(.22, .68, .28, 1);
  --dur: .18s;

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  font-synthesis: none;
  color-scheme: dark;
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.022em; line-height: 1.15; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; }
[hidden] { display: none !important; }

::selection { background: rgba(61, 220, 151, .28); color: #fff; }

:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--surface-4) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: content-box; }

/* ── Text helpers ──────────────────────────────────────────────────────── */
.muted   { color: var(--text-2); }
.muted-2 { color: var(--text-3); }
.mono    { font-family: var(--mono); }
.nums    { font-variant-numeric: tabular-nums; }
.gradient-text {
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.eyebrow {
  font-size: .7rem; font-weight: 800; letter-spacing: .16em;
  text-transform: uppercase; color: var(--text-3);
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── Icons ─────────────────────────────────────────────────────────────────
   Every glyph in the product is an inline SVG from the sprite in icons.js —
   there is no emoji anywhere, so the UI looks the same on Windows, macOS and
   Linux. Strokes inherit `currentColor`, so an icon always matches its text. */
.ico {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -.16em; pointer-events: none;
}
.ico--xs { width: 12px; height: 12px; stroke-width: 1.8; }
.ico--sm { width: 14px; height: 14px; stroke-width: 1.7; }
.ico--md { width: 18px; height: 18px; }
.ico--lg { width: 21px; height: 21px; stroke-width: 1.55; }
.ico--xl { width: 26px; height: 26px; stroke-width: 1.45; }
.ico--2xl { width: 34px; height: 34px; stroke-width: 1.35; }
.ico--spin { animation: spin 1s linear infinite; }

/* Icon-only controls: keep the glyph optically centred. */
.btn > .ico:only-child { margin: 0 -2px; }

/* ── Steam capsule artwork ─────────────────────────────────────────────────
   Real cover art, served from our own /img/app cache. The monogram sits
   underneath and shows through whenever the image is missing or still in
   flight, so a tile is never empty and never shifts the layout. */
.gart {
  position: relative; overflow: hidden; flex: none;
  display: grid; place-items: center;
  width: 44px; aspect-ratio: 231 / 87; border-radius: 5px;
  background:
    radial-gradient(120% 140% at 20% 0%, rgba(255,255,255,.07), transparent 60%),
    linear-gradient(150deg, var(--surface-3), var(--surface-2));
  border: 1px solid rgba(255,255,255,.07);
}
.gart > i {
  font-style: normal; font-weight: 800; font-size: .56rem; line-height: 1;
  letter-spacing: .02em; color: var(--text-2); user-select: none;
}
.gart > img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; border-radius: inherit;
  animation: art-in .26s var(--ease) both;
}
@keyframes art-in { from { opacity: 0; transform: scale(1.03); } }
.gart--xs { width: 32px; border-radius: 4px; }
.gart--xs > i { font-size: .48rem; }
.gart--lg { width: 66px; border-radius: 7px; }
.gart--lg > i { font-size: .72rem; }
.gart--tile { width: 100%; border-radius: 10px; }
.gart--tile > i { font-size: 1rem; }

/* Overlapping stack of covers, used where a row lists several games. Each cover
   keeps ~28px visible — enough of the capsule to recognise the game. */
.gart-stack { display: flex; align-items: center; }
.gart-stack .gart { width: 40px; box-shadow: -3px 0 0 -1px var(--surface); }
.gart-stack .gart + .gart { margin-left: -12px; }
.gart-stack__more {
  margin-left: 8px; padding: 2px 7px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border);
  font-size: .68rem; font-weight: 750;
  color: var(--text-3); font-variant-numeric: tabular-nums;
}

/* ── Brand ─────────────────────────────────────────────────────────────── */
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand__mark {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  background: var(--grad); display: grid; place-items: center;
  box-shadow: var(--glow-mint);
  position: relative; overflow: hidden;
}
/* Dark ink on the mint gradient tile, and a heavier stroke so the mark reads at 20px. */
.brand__mark svg { width: 20px; height: 20px; color: var(--accent-ink); stroke-width: 2.5; }
.brand__name {
  font-weight: 800; font-size: 1.06rem; letter-spacing: -.03em;
}
.brand__name b { font-weight: 800; }
.brand__tag { color: var(--text-3); font-size: .78rem; letter-spacing: 0; }
.brand--lg .brand__mark { width: 46px; height: 46px; border-radius: 13px; }
.brand--lg .brand__mark svg { width: 26px; height: 26px; }
.brand--lg .brand__name { font-size: 1.35rem; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--btn-bg); color: var(--btn-fg);
  font-size: .9rem; font-weight: 650; letter-spacing: -.01em;
  white-space: nowrap; position: relative;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), filter var(--dur);
}
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.99); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.btn--primary {
  background: var(--grad); color: var(--accent-ink);
  border-color: transparent; box-shadow: var(--glow-mint);
  font-weight: 750;
}
.btn--primary:hover { filter: brightness(1.08) saturate(1.05); box-shadow: 0 14px 40px -8px rgba(61,220,151,.55); }

.btn--soft {
  background: rgba(61,220,151,.10); color: var(--mint);
  border-color: rgba(61,220,151,.28);
}
.btn--soft:hover { background: rgba(61,220,151,.17); }

.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }

.btn--outline { background: transparent; border-color: var(--border-strong); }
.btn--outline:hover { background: var(--surface-2); }

.btn--danger { color: var(--rose); border-color: rgba(255,93,108,.32); background: rgba(255,93,108,.09); }
.btn--danger:hover { background: rgba(255,93,108,.18); border-color: rgba(255,93,108,.5); }

.btn--warn { color: var(--amber); border-color: rgba(255,180,84,.32); background: rgba(255,180,84,.09); }
.btn--warn:hover { background: rgba(255,180,84,.18); }

.btn--lg { padding: 14px 26px; font-size: 1rem; border-radius: var(--radius); }
.btn--sm { padding: 7px 11px; font-size: .8rem; border-radius: var(--radius-xs); gap: 6px; }
/* Icon-only small buttons: pull the padding in and give the glyph a little more
   room, so a row of them reads as a toolbar rather than a row of dots. */
.btn--sm > .ico:only-child { margin: 0 -3px; width: 16px; height: 16px; stroke-width: 1.65; }
.btn--xs { padding: 5px 9px; font-size: .74rem; border-radius: 7px; gap: 5px; }
.btn--block { width: 100%; }
.btn--icon { padding: 8px; width: 36px; height: 36px; }

.icon-btn {
  background: transparent; border: 1px solid transparent; color: var(--text-3);
  cursor: pointer; padding: 7px; border-radius: var(--radius-xs);
  display: inline-grid; place-items: center; line-height: 1;
  transition: var(--dur) var(--ease);
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); border-color: var(--border); }

.link {
  color: var(--mint); font-weight: 600; cursor: pointer;
  border-bottom: 1px solid transparent; transition: border-color var(--dur);
}
.link:hover { border-bottom-color: currentColor; }

/* ── Segmented control / tabs ──────────────────────────────────────────── */
.seg {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px;
}
.seg__btn {
  background: transparent; border: none; color: var(--text-3); cursor: pointer;
  padding: 6px 13px; border-radius: 8px; font-weight: 700; font-size: .82rem;
  transition: var(--dur) var(--ease); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
}
.seg__btn:hover { color: var(--text-2); }
.seg__btn.active { background: var(--surface-4); color: var(--text); box-shadow: var(--shadow-sm); }
.seg__btn .count {
  font-size: .7rem; padding: 1px 6px; border-radius: 99px;
  background: rgba(255,255,255,.07); color: inherit; font-variant-numeric: tabular-nums;
}

/* ── Fields ────────────────────────────────────────────────────────────── */
.field { display: block; margin-bottom: 15px; }
.field > span, .field__label {
  display: block; font-size: .8rem; font-weight: 650; color: var(--text-2); margin-bottom: 7px;
}
.field .hint { display: block; font-weight: 400; color: var(--text-3); font-size: .76rem; margin-top: 6px; }
.field--row { display: flex; align-items: center; gap: 10px; }

input, select, textarea {
  width: 100%; font-family: inherit; font-size: .92rem; color: var(--text);
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 13px;
  transition: border-color var(--dur), box-shadow var(--dur), background var(--dur);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--mint); box-shadow: var(--ring); background: var(--bg);
}
input[readonly] { color: var(--text-2); background: var(--surface); cursor: default; }
textarea { resize: vertical; min-height: 68px; line-height: 1.5; }
select {
  appearance: none; cursor: pointer; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239EB2CE' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 15px;
}
input[type="number"] { -moz-appearance: textfield; }

/* Bare checkboxes (log auto-scroll and friends). The native control paints an
   out-of-palette blue, so it gets the same treatment as every other field.
   Declared above `.toggle input`, which must keep hiding its own checkbox. */
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 17px; height: 17px; flex: none; padding: 0; cursor: pointer;
  border-radius: 5px; background: var(--surface-3); border: 1px solid var(--border-strong);
  display: inline-grid; place-items: center; vertical-align: -.22em;
}
input[type="checkbox"]:hover { border-color: var(--mint); }
input[type="checkbox"]:checked { background: var(--grad); border-color: transparent; }
input[type="checkbox"]:checked::after {
  content: ""; width: 4px; height: 8px; margin-top: -2px;
  border: solid var(--accent-ink); border-width: 0 2.2px 2.2px 0;
  transform: rotate(45deg);
}

.input-group { display: flex; gap: 8px; }
.input-group input { flex: 1; }

.form-error {
  background: rgba(255,93,108,.10); border: 1px solid rgba(255,93,108,.32);
  color: #FFB3BA; padding: 10px 13px; border-radius: var(--radius-sm);
  font-size: .85rem; margin-bottom: 13px;
}
.form-ok {
  background: rgba(61,220,151,.10); border: 1px solid rgba(61,220,151,.30);
  color: #9CF3CB; padding: 10px 13px; border-radius: var(--radius-sm);
  font-size: .85rem; margin-bottom: 13px;
}

/* Toggle switch */
.toggle { position: relative; width: 44px; height: 25px; flex: none; display: inline-block; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .track {
  position: absolute; inset: 0; border-radius: 99px; cursor: pointer;
  background: var(--surface-4); border: 1px solid var(--border-strong); transition: var(--dur) var(--ease);
}
.toggle .track::before {
  content: ""; position: absolute; width: 19px; height: 19px; left: 2px; top: 2px;
  background: var(--text-3); border-radius: 50%; transition: var(--dur) var(--ease);
}
.toggle input:checked + .track { background: var(--grad); border-color: transparent; }
.toggle input:checked + .track::before { transform: translateX(19px); background: #fff; }
.toggle input:focus-visible + .track { box-shadow: var(--ring); }

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.switch-row:last-child { border-bottom: none; }
.switch-row__text { min-width: 0; }
.switch-row__text strong { display: block; font-size: .9rem; font-weight: 650; }
.switch-row__text span { font-size: .78rem; color: var(--text-3); }

/* ── Surfaces ──────────────────────────────────────────────────────────── */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.panel--pad { padding: 20px; }

.glass {
  background: linear-gradient(180deg, rgba(24,35,55,.72), rgba(13,19,32,.86));
  border: 1px solid rgba(255,255,255,.07);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
}

.section-title {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 800;
  color: var(--text-3); margin: 22px 0 12px; padding-top: 18px;
  border-top: 1px solid var(--border);
}
.section-title:first-child { border-top: none; padding-top: 0; margin-top: 0; }
/* Section heading with a switch on the right (games + card farming). */
.section-title--row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.inline-switch {
  display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
  text-transform: none; letter-spacing: 0; font-size: .8rem; font-weight: 650; color: var(--text-2);
}
.inline-switch > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.inline-switch:hover { color: var(--text); }

.divider { height: 1px; background: var(--border); border: 0; margin: 18px 0; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }

/* ── Badges / pills / chips ────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  font-size: .74rem; font-weight: 750; padding: 4px 10px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  letter-spacing: -.005em;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.badge--online        { color: var(--mint);   border-color: rgba(61,220,151,.38);  background: rgba(61,220,151,.11); }
.badge--connecting    { color: var(--blue);   border-color: rgba(89,169,255,.38);  background: rgba(89,169,255,.11); }
.badge--awaiting_code { color: var(--amber);  border-color: rgba(255,180,84,.38);  background: rgba(255,180,84,.12); }
.badge--blocked       { color: var(--amber);  border-color: rgba(255,180,84,.28);  background: rgba(255,180,84,.08); }
.badge--error         { color: var(--rose);   border-color: rgba(255,93,108,.38);  background: rgba(255,93,108,.11); }
.badge--offline       { color: var(--text-3); }
.badge--admin         { color: var(--violet); border-color: rgba(124,92,255,.42);  background: rgba(124,92,255,.13); }
.badge--user          { color: var(--text-2); }
.badge--banned        { color: var(--rose);   border-color: rgba(255,93,108,.42);  background: rgba(255,93,108,.13); }
.badge--free          { color: var(--mint);   border-color: rgba(61,220,151,.42);  background: rgba(61,220,151,.12); }
.badge--online .dot { animation: pulse-dot 1.8s var(--ease) infinite; }
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(61,220,151,.55); }
  55%      { box-shadow: 0 0 0 5px rgba(61,220,151,0); }
}

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--border); border-radius: 99px; padding: 3px 9px;
  font-size: .74rem; color: var(--text-2);
}
.pill--on { color: var(--mint); border-color: rgba(61,220,151,.3); background: rgba(61,220,151,.07); }

.chip {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 99px; padding: 4px 11px; font-size: .8rem;
  transition: border-color var(--dur), background var(--dur);
}
.chip:has(.gart) { padding: 3px 11px 3px 3px; gap: 8px; }
.chip:hover { border-color: var(--border-strong); }
.chip .gart { border-radius: 99px; width: 38px; }
.chip__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
.chip--custom { border-color: rgba(124,92,255,.38); background: rgba(124,92,255,.08); }
.chip__tag { font-size: .63rem; color: var(--cyan); text-transform: uppercase; font-weight: 800; letter-spacing: .04em; }
.chip--custom .chip__tag { color: var(--violet); }
.chip__x {
  cursor: pointer; color: var(--text-3); display: inline-grid; place-items: center;
  border-radius: 50%; padding: 2px; margin-right: -3px; transition: color var(--dur), background var(--dur);
}
.chip__x:hover { color: var(--rose); background: rgba(255,93,108,.14); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.avatar {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  display: grid; place-items: center; font-weight: 800; font-size: .85rem;
  background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text-2);
  text-transform: uppercase;
}
.avatar--admin { background: rgba(124,92,255,.16); border-color: rgba(124,92,255,.4); color: #C3B2FF; }
.avatar--sm { width: 27px; height: 27px; border-radius: 8px; font-size: .72rem; }

/* ── KPI tiles ─────────────────────────────────────────────────────────── */
.kpi-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.kpi {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 17px 18px;
  transition: border-color var(--dur), transform var(--dur) var(--ease);
}
.kpi:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.kpi::after {
  content: ""; position: absolute; inset: -40% 55% 40% -10%;
  background: radial-gradient(circle at 30% 40%, var(--kpi-glow, rgba(61,220,151,.16)), transparent 68%);
  pointer-events: none;
}
.kpi__head { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; position: relative; }
.kpi__icon {
  width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: var(--kpi-icon-bg, rgba(61,220,151,.13)); color: var(--kpi-icon, var(--mint));
  font-size: .95rem;
}
.kpi__label { font-size: .76rem; font-weight: 700; color: var(--text-2); letter-spacing: -.005em; }
.kpi__value {
  font-size: 1.95rem; font-weight: 800; letter-spacing: -.045em; line-height: 1;
  font-variant-numeric: tabular-nums; position: relative;
}
.kpi__value small { font-size: .85rem; font-weight: 650; color: var(--text-3); letter-spacing: 0; }
.kpi__foot { margin-top: 9px; font-size: .76rem; color: var(--text-3); position: relative; }
.kpi__foot .up { color: var(--mint); font-weight: 700; }
.kpi--mint   { --kpi-glow: rgba(61,220,151,.18);  --kpi-icon: var(--mint);   --kpi-icon-bg: rgba(61,220,151,.13); }
.kpi--cyan   { --kpi-glow: rgba(34,211,238,.16);  --kpi-icon: var(--cyan);   --kpi-icon-bg: rgba(34,211,238,.13); }
.kpi--violet { --kpi-glow: rgba(124,92,255,.18);  --kpi-icon: var(--violet); --kpi-icon-bg: rgba(124,92,255,.15); }
.kpi--amber  { --kpi-glow: rgba(255,180,84,.15);  --kpi-icon: var(--amber);  --kpi-icon-bg: rgba(255,180,84,.13); }
.kpi--rose   { --kpi-glow: rgba(255,93,108,.15);  --kpi-icon: var(--rose);   --kpi-icon-bg: rgba(255,93,108,.13); }

/* ── Meter / progress ──────────────────────────────────────────────────── */
.meter { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter__fill { height: 100%; border-radius: 99px; background: var(--grad); transition: width .4s var(--ease); }
.meter__fill--warn { background: var(--grad-warm); }
.meter__fill--full { background: linear-gradient(120deg, #FF5D6C, #FF8A5B); }

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-wrap {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
}
.table-scroll { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .87rem; min-width: 780px; }
table.tbl th {
  text-align: left; font-size: .7rem; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-3); padding: 12px 14px;
  background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
table.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tbody tr { transition: background var(--dur); }
table.tbl tbody tr:hover { background: rgba(255,255,255,.022); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl td.right, table.tbl th.right { text-align: right; }
table.tbl td.actions { white-space: nowrap; }
table.tbl td.actions .btn { margin-left: 5px; }
.cell-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-user__name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-user__sub { font-size: .74rem; color: var(--text-3); }

/* ── Empty / loading states ────────────────────────────────────────────── */
.empty-state {
  text-align: center; color: var(--text-2); padding: 54px 24px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  background: rgba(255,255,255,.012);
}
.empty-state__icon {
  width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 16px;
  display: grid; place-items: center; color: var(--text-3);
  background: var(--surface-2); border: 1px solid var(--border);
}
.empty-state__title { font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-state__text { font-size: .88rem; max-width: 380px; margin: 0 auto 18px; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: var(--radius-xs);
}
@keyframes shimmer { to { background-position: -200% 0; } }

.spinner {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 2px solid rgba(255,255,255,.16); border-top-color: var(--mint);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── App shell (panel + admin) ─────────────────────────────────────────── */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.app::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 520px at 88% -12%, rgba(124,92,255,.13), transparent 62%),
    radial-gradient(760px 460px at 4% -6%,  rgba(61,220,151,.10), transparent 58%),
    var(--bg);
}

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px;
  background: rgba(8,13,22,.82);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border-bottom: 1px solid var(--border);
}
.topbar__nav { display: flex; align-items: center; gap: 3px; margin-left: 10px; }
.topbar__link {
  padding: 7px 13px; border-radius: 9px; font-size: .87rem; font-weight: 650;
  color: var(--text-3); transition: var(--dur) var(--ease);
}
.topbar__link:hover { color: var(--text); background: var(--surface-2); }
.topbar__link.active { color: var(--text); background: var(--surface-3); }
.topbar__spacer { flex: 1; }
.topbar__actions { display: flex; align-items: center; gap: 8px; }
.topbar__user {
  display: flex; align-items: center; gap: 9px; padding: 5px 11px 5px 6px;
  border: 1px solid var(--border); border-radius: 99px; background: var(--surface-2);
}
.topbar__user b { font-size: .84rem; font-weight: 700; }

.main { width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px 22px 72px; flex: 1; }
.main--wide { max-width: 1480px; }
.main__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.main__head h1 { font-size: 1.55rem; }
.main__head .sub { color: var(--text-3); font-size: .88rem; margin-top: 5px; }
.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar__search { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.toolbar__search input { padding-left: 36px; }
/* The magnifier is a background image rather than a text glyph, so it renders
   identically everywhere and never inherits the input's font. */
.toolbar__search::before {
  content: ""; position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; pointer-events: none; opacity: .85;
  background: no-repeat center / contain
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2366799A' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='10.9' cy='10.9' r='6.2'/%3E%3Cpath d='m15.6 15.6 4.4 4.4'/%3E%3C/svg%3E");
}

/* ── Quota strip ───────────────────────────────────────────────────────── */
.quota {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 15px 18px; margin-bottom: 20px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(61,220,151,.06), rgba(124,92,255,.05));
}
.quota__label { font-size: .78rem; color: var(--text-2); font-weight: 650; }
.quota__value { font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.quota__bar { flex: 1; min-width: 160px; }
.quota__note { font-size: .78rem; color: var(--text-3); }

/* ── Account cards ─────────────────────────────────────────────────────── */
.accounts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }

.card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;      /* actions sink to the bottom edge */
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 17px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur), transform var(--dur) var(--ease), box-shadow var(--dur);
}
.card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: var(--status-color, var(--border-strong));
}
.card::after {
  content: ""; position: absolute; top: -50%; right: -30%; width: 60%; height: 100%;
  background: radial-gradient(circle at 60% 40%, var(--status-glow, transparent), transparent 70%);
  pointer-events: none;
}
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 11px; }
.card__title { min-width: 0; }
.card__name { font-weight: 750; font-size: 1.04rem; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__user { color: var(--text-3); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__stats { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 15px 0; }
.stat {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 13px;
}
.stat__label { font-size: .68rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .07em; font-weight: 750; }
.stat__value { font-size: 1.16rem; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 3px; letter-spacing: -.03em; }
.stat__value.accent { color: var(--mint); }
.card__section-label { font-size: .68rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; font-weight: 750; margin: 6px 0 7px; }
.card__section-label .ico { vertical-align: -2px; margin-right: 3px; color: var(--cyan); }
/* Card-farming counters, in place of the manual "Игры N / 32" line. */
.farm { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 9px; font-size: .78rem; color: var(--text-3); }
.farm__stat b { color: var(--text-2); font-weight: 800; font-variant-numeric: tabular-nums; margin-left: 3px; }
.farm__stat b.accent { color: var(--mint); }
.meta-line { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; margin-top: 11px; }
.card__actions { display: flex; gap: 6px; padding-top: 15px; flex-wrap: wrap; }
.card__actions .btn { flex: 1 1 auto; }
/* Cards in a row stretch to the tallest one. The slack goes above the status
   line — after the games list, where it reads as room for more games — instead
   of between the status line and the buttons. */
.card__msg { font-size: .8rem; color: var(--text-3); margin-top: auto; padding-top: 10px; min-height: 1em; }
.card__msg.error { color: var(--rose); }

.guard-box {
  margin-top: 13px; padding: 13px;
  background: rgba(255,180,84,.07); border: 1px solid rgba(255,180,84,.3);
  border-radius: var(--radius-sm);
}
.guard-box__title {
  display: flex; align-items: center; gap: 7px;
  font-size: .82rem; font-weight: 750; color: var(--amber); margin-bottom: 8px;
}
.guard-box__row { display: flex; gap: 7px; }
.guard-box input {
  text-align: center; letter-spacing: .34em; text-transform: uppercase;
  font-weight: 800; font-family: var(--mono);
}

.playtime { display: flex; flex-direction: column; margin-top: 2px; }
.playtime__row {
  display: flex; justify-content: space-between; gap: 12px; font-size: .82rem;
  padding: 5px 0; border-bottom: 1px solid rgba(30,42,62,.6);
}
.playtime__row:last-child { border-bottom: none; }
.playtime__name { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.playtime__val { font-weight: 750; font-variant-numeric: tabular-nums; flex: none; color: var(--mint); }

/* ── Modal ─────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(3,6,12,.72); backdrop-filter: blur(5px);
  display: grid; place-items: start center; padding: 40px 16px 0; overflow-y: auto;
  animation: fade .16s var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 540px; margin-bottom: 40px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  animation: pop .2s var(--ease);
}
.modal--wide { max-width: 760px; }
.modal--narrow { max-width: 420px; }
@keyframes pop { from { transform: translateY(14px) scale(.975); opacity: 0; } }
.modal__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2;
  background: var(--surface); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal__head .sub { font-size: .8rem; color: var(--text-3); margin-top: 3px; font-weight: 400; }
.modal__body { padding: 22px; }
/* Sticky action bar. The backdrop's bottom padding is 0 on purpose — with it,
   the bar pinned 40px short of the viewport and form fields peeked out below. */
.modal__foot {
  display: flex; gap: 10px; justify-content: flex-end; align-items: center;
  padding: 16px 22px; border-top: 1px solid var(--border);
  position: sticky; bottom: 0; background: var(--surface);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.modal__foot .spacer { flex: 1; }

/* ── Games picker ──────────────────────────────────────────────────────── */
.picker { position: relative; }
.picker__results {
  position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 5px);
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); max-height: 268px; overflow-y: auto; box-shadow: var(--shadow);
}
.picker__item {
  padding: 10px 13px; cursor: pointer; display: flex; align-items: center; gap: 9px; font-size: .88rem;
}
.picker__item:hover, .picker__item.active { background: var(--surface-4); }
.picker__item .gart { width: 40px; }
.picker__item .appid { color: var(--text-3); font-size: .74rem; margin-left: auto; font-family: var(--mono); }
.picker__add { color: var(--mint); font-weight: 650; }
.picker__head {
  position: sticky; top: 0; z-index: 1;
  padding: 9px 13px 7px; font-size: .69rem; font-weight: 800;
  letter-spacing: .09em; text-transform: uppercase; color: var(--text-3);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.picker__meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 9px; font-size: .77rem; color: var(--text-3); }
.selected-games { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; min-height: 8px; }
/* Card farming picks the games itself — the manual picker stays visible but dead. */
.picker.is-locked { opacity: .4; pointer-events: none; filter: saturate(.4); }
.auto-note {
  display: flex; gap: 9px; margin-top: 12px; padding: 11px 13px;
  background: rgba(89,169,255,.07); border: 1px solid rgba(89,169,255,.26);
  border-radius: var(--radius-sm); font-size: .81rem; color: var(--text-2); line-height: 1.5;
}
.auto-note .ico { color: var(--blue); flex: none; margin-top: 2px; }
.auto-note [data-auto-empty] { color: var(--amber); font-weight: 700; }

/* ── Toasts ────────────────────────────────────────────────────────────── */
.toast-root {
  position: fixed; right: 18px; bottom: 18px; z-index: 80;
  display: flex; flex-direction: column; gap: 9px; max-width: min(380px, 92vw);
}
.toast {
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-left: 3px solid var(--mint); padding: 12px 15px;
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  font-size: .87rem; animation: slidein .22s var(--ease);
}
.toast--error { border-left-color: var(--rose); }
.toast--info  { border-left-color: var(--blue); }
.toast--warn  { border-left-color: var(--amber); }
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } }

/* ── Drawer (logs) ─────────────────────────────────────────────────────── */
.drawer { position: fixed; inset: 0; z-index: 70; }
.drawer__backdrop { position: absolute; inset: 0; background: rgba(3,6,12,.6); backdrop-filter: blur(3px); }
.drawer__panel {
  position: absolute; right: 0; top: 0; height: 100%; width: min(600px, 96vw);
  background: var(--surface); border-left: 1px solid var(--border-strong);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  animation: slidepanel .24s var(--ease);
}
@keyframes slidepanel { from { transform: translateX(40px); opacity: .5; } }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 17px 20px; border-bottom: 1px solid var(--border); }
.drawer__controls { display: flex; gap: 9px; padding: 13px 20px; border-bottom: 1px solid var(--border); }
.drawer__controls select { max-width: 52%; }
.logs-body { flex: 1; overflow-y: auto; padding: 13px 20px; font-family: var(--mono); font-size: .79rem; }
.log-line { padding: 4px 0; border-bottom: 1px solid rgba(30,42,62,.55); display: flex; gap: 9px; }
.log-line time { color: var(--text-3); flex: none; }
.log-line .lvl { flex: none; font-weight: 800; width: 56px; }
.log-line .lvl.info    { color: var(--blue); }
.log-line .lvl.success { color: var(--mint); }
.log-line .lvl.warn    { color: var(--amber); }
.log-line .lvl.error   { color: var(--rose); }
.log-line .lvl.text    { color: var(--text-3); }
.log-line .msg { word-break: break-word; }

/* ── Auth pages ────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100dvh; display: grid; grid-template-columns: 1.05fr .95fr;
  position: relative;
}
.auth-page::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(820px 520px at 78% 8%, rgba(124,92,255,.16), transparent 62%),
    radial-gradient(700px 460px at 10% 88%, rgba(61,220,151,.12), transparent 60%),
    var(--bg);
}
.auth-aside {
  padding: 40px 46px; display: flex; flex-direction: column; justify-content: space-between;
  border-right: 1px solid var(--border);
  background: linear-gradient(160deg, rgba(18,27,42,.6), rgba(5,8,14,.2));
}
.auth-aside__body { max-width: 440px; margin: auto 0; }
.auth-aside h2 { font-size: 2.1rem; letter-spacing: -.038em; margin-bottom: 14px; }
.auth-aside p { color: var(--text-2); font-size: .98rem; }
.auth-perks { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 13px; }
.auth-perks li { display: flex; gap: 12px; align-items: flex-start; font-size: .92rem; }
.auth-perks .tick {
  width: 22px; height: 22px; border-radius: 7px; flex: none; display: grid; place-items: center;
  background: rgba(61,220,151,.14); color: var(--mint);
  border: 1px solid rgba(61,220,151,.28); margin-top: 1px;
}
.auth-perks .tick .ico { width: 13px; height: 13px; stroke-width: 2.4; }
.auth-perks b { font-weight: 700; }
.auth-perks span { color: var(--text-3); }

.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 1.55rem; margin-bottom: 7px; }
.auth-card .lead { color: var(--text-3); font-size: .89rem; margin-bottom: 26px; }
.auth-card form { margin-top: 4px; }
.auth-switch { margin-top: 22px; text-align: center; font-size: .87rem; color: var(--text-3); }
.auth-back { display: inline-flex; align-items: center; gap: 7px; font-size: .84rem; color: var(--text-3); margin-bottom: 26px; }
.auth-back:hover { color: var(--text); }
.pw-strength { display: flex; gap: 4px; margin-top: 8px; }
.pw-strength i { height: 3px; flex: 1; border-radius: 99px; background: var(--surface-4); transition: background var(--dur); }
.pw-strength.s1 i:nth-child(1) { background: var(--rose); }
.pw-strength.s2 i:nth-child(-n+2) { background: var(--amber); }
.pw-strength.s3 i:nth-child(-n+3) { background: var(--cyan); }
.pw-strength.s4 i { background: var(--mint); }

/* ── Demo banner ───────────────────────────────────────────────────────── */
.demo-banner {
  background: repeating-linear-gradient(45deg, rgba(255,180,84,.15) 0 12px, rgba(255,180,84,.07) 12px 24px);
  color: var(--amber); text-align: center; padding: 8px; font-size: .79rem;
  font-weight: 750; border-bottom: 1px solid rgba(255,180,84,.3); letter-spacing: .01em;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}
@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .topbar { padding: 10px 14px; gap: 8px; }
  .topbar__nav { margin-left: 2px; }
  .topbar__link { padding: 6px 10px; font-size: .82rem; }
  .topbar__user b { display: none; }
  .main { padding: 20px 14px 60px; }
  .main__head h1 { font-size: 1.32rem; }
  .accounts-grid { grid-template-columns: 1fr; }
  .row-2, .row-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .kpi { padding: 14px; }
  .kpi__value { font-size: 1.6rem; }
  .modal__body, .modal__head, .modal__foot { padding-left: 16px; padding-right: 16px; }
  .toast-root { right: 12px; left: 12px; bottom: 12px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}
