/* Command Center design system.
   Tokens on :root (dark by default), light theme via prefers-color-scheme or [data-theme=light].
   Component classes are documented in docs/UI_KIT.md. */

:root {
  --bg: #0b0d12;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, rgba(124, 92, 255, 0.10), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(255, 77, 141, 0.07), transparent 60%);
  --surface: #12151c;
  --surface-2: #181c25;
  --surface-3: #1f2430;
  --border: #252b38;
  --border-strong: #343b4c;
  --text: #e8eaf0;
  --text-2: #b9bfcc;
  --muted: #8a91a3;
  --faint: #5d6476;
  --accent: #8b6cff;
  --accent-2: #ff4d8d;
  --accent-soft: rgba(139, 108, 255, 0.16);
  --accent-grad: linear-gradient(135deg, #8b6cff 0%, #c25cff 50%, #ff4d8d 100%);
  --on-accent: #ffffff;
  --success: #2fd27a;
  --success-soft: rgba(47, 210, 122, 0.14);
  --warning: #f5b841;
  --warning-soft: rgba(245, 184, 65, 0.15);
  --danger: #ff5a6a;
  --danger-soft: rgba(255, 90, 106, 0.14);
  --info: #4ea1ff;
  --info-soft: rgba(78, 161, 255, 0.14);
  --yt: #ff0033;
  --ig: #dd2a7b;
  --ig-grad: linear-gradient(45deg, #f58529 0%, #dd2a7b 50%, #8134af 100%);
  --tt: #25f4ee;
  --tt-2: #fe2c55;
  --fb: #1877f2;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
  --ring: 0 0 0 3px rgba(139, 108, 255, 0.35);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar-w: 232px;
  --topbar-h: 60px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg: #f5f6f9;
    --bg-grad: radial-gradient(1200px 600px at 10% -10%, rgba(124, 92, 255, 0.08), transparent 60%),
      radial-gradient(900px 500px at 110% 10%, rgba(255, 77, 141, 0.06), transparent 60%);
    --surface: #ffffff;
    --surface-2: #f6f7fa;
    --surface-3: #eceef3;
    --border: #e3e6ed;
    --border-strong: #cfd4de;
    --text: #12151c;
    --text-2: #394050;
    --muted: #5f6678;
    --faint: #9097a8;
    --accent: #6d4dff;
    --accent-soft: rgba(109, 77, 255, 0.1);
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.06);
    --shadow-lg: 0 20px 60px rgba(16, 24, 40, 0.18);
    --ring: 0 0 0 3px rgba(109, 77, 255, 0.25);
    --tt: #0fb5b0;
    --success: #15803d;
    --warning: #a16207;
    --danger: #d92d20;
    --info: #2563eb;
    color-scheme: light;
  }
}
:root[data-theme='light'] {
  --bg: #f5f6f9;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, rgba(124, 92, 255, 0.08), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(255, 77, 141, 0.06), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f6f7fa;
  --surface-3: #eceef3;
  --border: #e3e6ed;
  --border-strong: #cfd4de;
  --text: #12151c;
  --text-2: #394050;
  --muted: #5f6678;
  --faint: #9097a8;
  --accent: #6d4dff;
  --accent-soft: rgba(109, 77, 255, 0.1);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 20px 60px rgba(16, 24, 40, 0.18);
  --ring: 0 0 0 3px rgba(109, 77, 255, 0.25);
  --tt: #0fb5b0;
  --success: #15803d;
  --warning: #a16207;
  --danger: #d92d20;
  --info: #2563eb;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 650; }
h4 { font-size: 13px; font-weight: 650; color: var(--text-2); }
p { margin: 0 0 8px; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
code { background: var(--surface-3); padding: 1px 6px; border-radius: 6px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: none; box-shadow: var(--ring); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ---------- boot + auth ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-mark { width: 44px; height: 44px; border-radius: 14px; background: var(--accent-grad); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(0.9); opacity: 0.6; } 50% { transform: scale(1); opacity: 1; } }

.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-lg); }
.auth-card h1 { margin: 16px 0 6px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); text-decoration: none !important; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent-grad); position: relative; flex: none; box-shadow: 0 6px 18px rgba(139, 108, 255, 0.35); }
.logo-mark::after { content: ''; position: absolute; inset: 8px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, 0.92); }

/* ---------- shell ---------- */
.shell { 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; gap: 4px; padding: 16px 12px; border-right: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: blur(12px); overflow-y: auto; z-index: 20; }
.sidebar .logo { padding: 4px 8px 16px; font-size: 15px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); padding: 6px 10px 4px; font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--text-2); font-weight: 500; text-decoration: none !important; transition: background 0.12s, color 0.12s; position: relative; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--text); }
.nav-item.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent-grad); }
.nav-item .icon { width: 18px; height: 18px; flex: none; opacity: 0.9; }
.nav-item .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.nav-item .count.muted { background: var(--surface-3); color: var(--text-2); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.team-dots { display: flex; gap: 6px; padding: 4px 8px; flex-wrap: wrap; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 15; height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 24px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(14px); }
.topbar .title { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.topbar .menu-btn { display: none; }
.content { padding: 24px; max-width: 1400px; width: 100%; margin: 0 auto; }
.content.wide { max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin: 4px 0 0; }

.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.live-dot.on { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }

.searchbox { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); min-width: 220px; cursor: pointer; }
.searchbox kbd { margin-left: auto; }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border-strong); color: var(--muted); background: var(--surface); }

@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow-lg); background: var(--surface); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .scrim { display: block; }
  .topbar .menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .searchbox { min-width: 0; }
  .searchbox .label, .searchbox kbd { display: none; }
}
.scrim { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 19; }

/* ---------- layout utilities ---------- */
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.gap-0 { gap: 0; } .gap-4 { gap: 4px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.grid { display: grid; gap: 16px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-auto-sm { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.split { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
.split-wide { display: grid; gap: 20px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .split, .split-wide { grid-template-columns: minmax(0, 1fr); } .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12px; } .tiny { font-size: 11px; }
.strong { font-weight: 650; } .center { text-align: center; } .right { text-align: right; }
.nowrap { white-space: nowrap; } .ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pre { white-space: pre-wrap; word-break: break-word; }
@media (max-width: 720px) { .hide-sm { display: none !important; } }
@media (min-width: 721px) { .show-sm { display: none !important; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-body { padding: 16px; }
.card-foot { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
.card.hover { transition: border-color 0.12s, transform 0.12s; cursor: pointer; }
.card.hover:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.card.selected { border-color: var(--accent); box-shadow: var(--ring); }
.card.glow { position: relative; }
.card.glow::before { content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; background: var(--accent-grad); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item.clickable { cursor: pointer; }
.list-item.clickable:hover { background: var(--surface-2); }

/* KPI tiles */
.stat { padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.stat .label { font-size: 12px; color: var(--muted); font-weight: 550; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: 12px; font-weight: 600; }
.delta.up { color: var(--success); } .delta.down { color: var(--danger); }

/* ---------- buttons ---------- */
.btn { --b-bg: var(--surface-2); --b-fg: var(--text); --b-bd: var(--border); display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--b-bd); background: var(--b-bg); color: var(--b-fg); font: 600 13px/1 var(--font); cursor: pointer; white-space: nowrap; transition: background 0.12s, border-color 0.12s, transform 0.06s, opacity 0.12s; text-decoration: none !important; user-select: none; }
.btn:hover { --b-bg: var(--surface-3); --b-bd: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.disabled { opacity: 0.5; pointer-events: none; }
.btn .icon { width: 16px; height: 16px; }
.btn.primary { --b-bg: var(--accent); --b-fg: var(--on-accent); --b-bd: transparent; background: var(--accent-grad); box-shadow: 0 6px 18px rgba(139, 108, 255, 0.28); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.success { --b-bg: var(--success); --b-fg: #04210f; --b-bd: transparent; }
.btn.danger { --b-bg: var(--danger-soft); --b-fg: var(--danger); --b-bd: transparent; }
.btn.danger:hover { --b-bg: var(--danger); --b-fg: #fff; }
.btn.ghost { --b-bg: transparent; --b-bd: transparent; }
.btn.ghost:hover { --b-bg: var(--surface-2); --b-bd: transparent; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.xs { height: 24px; padding: 0 8px; font-size: 11px; border-radius: 7px; gap: 5px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 14px; border-radius: 12px; }
.btn.icon-only { width: 36px; padding: 0; }
.btn.sm.icon-only { width: 30px; }
.btn.xs.icon-only { width: 24px; }
.btn.block { width: 100%; }
.btn .spinner { width: 14px; height: 14px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: 10px 0 0 10px; }
.btn-group .btn:last-child { border-radius: 0 10px 10px 0; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > label, .label { font-size: 12px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.field .hint { font-size: 12px; color: var(--muted); }
.field .error { font-size: 12px; color: var(--danger); }
.input, .textarea, .select { width: 100%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 9px 12px; font: 14px/1.4 var(--font); transition: border-color 0.12s, box-shadow 0.12s; }
.input:hover, .textarea:hover, .select:hover { border-color: var(--border-strong); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input.invalid, .textarea.invalid { border-color: var(--danger); }
.textarea { min-height: 96px; resize: vertical; }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a91a3' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input.sm, .select.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.select.sm { padding-right: 28px; background-position: right 9px center; }
.counter { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.counter.over { color: var(--danger); font-weight: 700; }
.counter.near { color: var(--warning); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 36px; height: 20px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: background 0.15s; position: relative; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-2); transition: transform 0.15s, background 0.15s; }
.switch input:checked + .track { background: var(--accent); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + .track { box-shadow: var(--ring); }
.tag-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 6px 8px; min-height: 40px; }
.tag-input:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.tag-input input { flex: 1; min-width: 100px; background: transparent; border: 0; color: var(--text); font: 14px var(--font); outline: none; padding: 3px 4px; }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--muted); font: 600 12px var(--font); padding: 6px 12px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); transition: border-color 0.12s, background 0.12s; cursor: pointer; }
.dropzone.over, .dropzone:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }

/* ---------- pills, badges, chips ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 11px; font-weight: 650; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.success { background: var(--success-soft); color: var(--success); }
.pill.warning { background: var(--warning-soft); color: var(--warning); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.outline { background: transparent; border: 1px solid var(--border-strong); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 550; border: 1px solid transparent; cursor: default; }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; display: inline-flex; opacity: 0.7; }
.chip button:hover { opacity: 1; }
.chip.clickable { cursor: pointer; }
.chip.clickable:hover { border-color: var(--border-strong); }
.chip.on { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }
.plat { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 7px; color: #fff; flex: none; }
.plat svg { width: 13px; height: 13px; }
.plat.youtube { background: var(--yt); }
.plat.instagram { background: var(--ig-grad); }
.plat.tiktok { background: #000; box-shadow: inset -2px 0 0 var(--tt-2), inset 2px 0 0 var(--tt); }
.plat.facebook { background: var(--fb); }
.plat.lg { width: 32px; height: 32px; border-radius: 10px; }
.plat.lg svg { width: 18px; height: 18px; }
.plat.sm { width: 18px; height: 18px; border-radius: 6px; }
.plat.sm svg { width: 11px; height: 11px; }
.plat.off { filter: grayscale(1); opacity: 0.35; }

.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-size: 14px; flex: none; background: var(--surface-3); position: relative; }
.avatar.sm { width: 22px; height: 22px; font-size: 11px; }
.avatar.lg { width: 40px; height: 40px; font-size: 20px; }
.avatar.xl { width: 56px; height: 56px; font-size: 28px; }
.avatar .presence { position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--surface); background: var(--faint); }
.avatar .presence.on { background: var(--success); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); font-weight: 650; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; color: var(--muted); font: 600 13px var(--font); padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(5, 6, 10, 0.6); backdrop-filter: blur(4px); display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 16px; animation: fade 0.12s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(0.99); } to { opacity: 1; transform: none; } }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: rise 0.16s ease; }
.modal.wide { max-width: 920px; }
.modal.xwide { max-width: 1200px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); }
.drawer-wrap { position: fixed; inset: 0; z-index: 90; background: rgba(5, 6, 10, 0.45); animation: fade 0.12s ease; }
.drawer { position: absolute; right: 0; top: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slidein 0.18s ease; }
.drawer.wide { width: min(880px, 100vw); }
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.toasts { position: fixed; right: 16px; bottom: calc(16px + var(--toast-offset, 0px)); z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
/* While a drawer or dialog is open, keep toasts clear of its footer buttons. */
body:has(.drawer-wrap, .overlay) .toasts { bottom: 88px; }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: rise 0.18s ease; font-size: 13px; }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }
.menu { position: absolute; z-index: 50; min-width: 180px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; animation: rise 0.1s ease; }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; border: 0; background: none; color: var(--text); font: 500 13px var(--font); cursor: pointer; text-align: left; text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--surface-2); }
.menu .danger { color: var(--danger); }
.menu hr { margin: 6px 0; }
.palette { width: 100%; max-width: 620px; align-self: start; margin-top: 10vh; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; animation: rise 0.14s ease; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); font: 16px var(--font); padding: 16px 18px; outline: none; }
.palette .results { max-height: 50vh; overflow-y: auto; padding: 6px; }
.palette .result { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; cursor: pointer; }
.palette .result.on, .palette .result:hover { background: var(--accent-soft); }
.palette .group { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); padding: 10px 12px 4px; font-weight: 600; }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty .icon-wrap { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.empty .icon-wrap .icon { width: 24px; height: 24px; }
.empty h3 { color: var(--text); }
.empty p { max-width: 420px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin 0.7s linear infinite; display: inline-block; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; min-height: 14px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.icon { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }
.icon.sm { width: 14px; height: 14px; } .icon.lg { width: 22px; height: 22px; }
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }
.callout.info { background: var(--info-soft); border-color: transparent; }
.callout.warning { background: var(--warning-soft); border-color: transparent; }
.callout.danger { background: var(--danger-soft); border-color: transparent; }
.callout.success { background: var(--success-soft); border-color: transparent; }
.callout.accent { background: var(--accent-soft); border-color: transparent; }
.kbd-hint { font-size: 11px; color: var(--faint); }
.progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress > div { height: 100%; background: var(--accent-grad); border-radius: 3px; transition: width 0.2s; }
.thumb { position: relative; border-radius: 10px; overflow: hidden; background: var(--surface-3); aspect-ratio: 1; display: grid; place-items: center; color: var(--faint); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb .badge { position: absolute; right: 6px; bottom: 6px; background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 11px; font-weight: 650; padding: 2px 6px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.thumb .badge.tl { left: 6px; top: 6px; right: auto; bottom: auto; }
.thumb.contain img, .thumb.contain video { object-fit: contain; }
.checker { background-image: linear-gradient(45deg, var(--surface-3) 25%, transparent 25%), linear-gradient(-45deg, var(--surface-3) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--surface-3) 75%), linear-gradient(-45deg, transparent 75%, var(--surface-3) 75%); background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0; }
.md p { margin: 0 0 6px; } .md p:last-child { margin-bottom: 0; }
.md .mention { color: var(--accent); font-weight: 650; background: var(--accent-soft); padding: 0 4px; border-radius: 5px; }
.md .ref { white-space: nowrap; font-family: var(--mono); font-size: 0.9em; background: var(--surface-3); padding: 0 5px; border-radius: 5px; color: var(--text); }
.md ul { margin: 4px 0; padding-left: 20px; }
.md pre { background: var(--surface-3); padding: 10px; border-radius: 8px; overflow-x: auto; font-family: var(--mono); font-size: 12px; }
.gradient-text { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.status-line { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }

/* ---------- finish by hand (#/kit) ---------- */
.kit { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.kit-head { display: flex; align-items: center; gap: 12px; }
.kit-head h1 { font-size: 22px; margin: 0; }
.kit-list { display: flex; flex-direction: column; gap: 8px; }
.kit-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: inherit; text-decoration: none; }
.kit-row:hover { border-color: var(--accent); }
.kit-media { display: flex; flex-direction: column; gap: 12px; }
.kit-file video, .kit-file img { display: block; width: 100%; max-height: 60vh; object-fit: contain; background: #000; border-radius: 12px; margin-bottom: 8px; }
.kit-cover img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.kit-text { white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.5; user-select: all; }
.kit-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.kit-settings { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.kit form { display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 720px) { .kit-head h1 { font-size: 19px; } }
.table th.num, .table td.num { text-align: right; }
