/* F3 Admin Desktop v3 — shared shell. Flat violet actions, no decorative glows. */

:root {
  --bg-primary: #0b0e14;
  --bg-secondary: #10131a;
  --bg-tertiary: #1a1f2b;
  --surface: #0b0e14;
  --surface-container: #12151c;
  --surface-container-high: #1c2230;
  --card-bg: #161a24;
  --card-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f4f7fb;
  --text-secondary: #c5ceda;
  --text-muted: #8b97a8;
  --on-surface: #f4f7fb;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.12);
  --ai-purple: #7c3aed;
  --primary: #7c3aed;
  --brand-pink: #ff3ea5;
  --brand-cyan: #22d3ee;
  --sidebar-width: 248px;
  --topbar-height: 64px;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14.5px;
}

h2 { font-size: 28px; letter-spacing: -0.03em; }
h3 { color: var(--text-primary); font-size: 15px; }

.btn-primary,
.btn-brand {
  background: #7c3aed;
  color: #fff;
  border-radius: 10px;
  box-shadow: none;
  filter: none;
}
.btn-primary:hover,
.btn-brand:hover {
  background: #6d28d9;
  box-shadow: none;
  filter: none;
}
.btn-ghost { border-radius: 10px; }
.btn:focus-visible,
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #c4b5fd;
  outline-offset: 2px;
}

#login-screen::before,
#login-screen::after { display: none; }
.login-box {
  background: #161a24;
  backdrop-filter: none;
  box-shadow: none;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.login-brand img { height: 36px; width: auto; }
.login-brand h1 { margin: 0; }

#app { background: var(--bg-primary); }

aside {
  width: var(--sidebar-width);
  background: #10131a;
  backdrop-filter: none;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  padding: 18px 12px 16px;
  overflow: auto;
}
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
}
.brand-lockup img { height: 32px; width: auto; display: block; }
.brand-lockup strong {
  display: block;
  font-family: var(--font-heading);
  font-size: 16px;
  letter-spacing: -0.03em;
}
.brand-lockup span { color: var(--text-muted); font-size: 12px; }

.nav-label {
  margin: 14px 10px 6px;
  color: #6d7888;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
aside nav a {
  border: 1px solid transparent;
  border-radius: 10px;
  color: #b7c0ce;
  min-height: 40px;
}
aside nav a.active {
  background: #7c3aed;
  color: #fff;
  border-color: transparent;
}
aside nav a .nav-icon { width: 18px; opacity: 0.9; }

.workspace {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(11, 14, 20, 0.92);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar-title { font-family: var(--font-heading); font-weight: 650; font-size: 15px; }
.top-meta { display: flex; align-items: center; gap: 14px; color: var(--text-muted); font-size: 13px; min-width: 0; flex-wrap: wrap; justify-content: flex-end; }
.who-chip b { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }
.beta-pill, .who-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--text-secondary);
}
.beta-pill { color: #f9a8d4; border-color: rgba(255, 62, 165, 0.35); }
.who-chip b { color: var(--text-primary); font-weight: 600; }
.nav-toggle { display: none; }

main {
  margin-left: 0;
  max-width: none;
  padding: 28px 32px 48px;
}

.section-header { align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.section-header .sub, .page-sub {
  color: var(--text-muted);
  font-size: 13.5px;
  margin-top: 4px;
  max-width: 720px;
}
.stat-cards { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.stat-card {
  background: #161a24;
  backdrop-filter: none;
  border-radius: 16px;
  box-shadow: none;
}
.stat-card::after { display: none; }
.stat-card:hover { transform: none; box-shadow: none; }
.stat-card .stat-value { font-size: 30px; color: var(--text-primary); }
.stat-card.face .stat-value,
.stat-card.food .stat-value,
.stat-card.fashion .stat-value,
.stat-card.ai .stat-value { color: var(--text-primary); }
.stat-card .stat-label { color: #9aa6b6; }

.table-wrap, .panel, .chart-card, .quiz-attempt, .modal, #toast {
  background: #161a24;
  backdrop-filter: none;
  box-shadow: none;
}
.table-wrap { overflow: auto; }
table { min-width: 720px; }
.table-wrap th:last-child,
.table-wrap td:last-child {
  position: sticky;
  right: 0;
  background: #161a24;
  box-shadow: -8px 0 12px rgba(0, 0, 0, 0.25);
}
th { background: #121722; position: sticky; top: 0; }
tbody tr.clickable:focus-visible { outline: 2px solid #c4b5fd; }

.dash-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  margin-bottom: 16px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 12px;
}
.bar-row { display: grid; grid-template-columns: 140px 1fr auto; gap: 10px; align-items: center; margin: 10px 0; font-size: 13px; }
.bar-track { height: 10px; background: #121722; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: #7c3aed; }
.bar-fill.pink { background: #ff3ea5; }
.bar-fill.cyan { background: #22d3ee; }
.unavailable {
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 18px;
  color: var(--text-secondary);
  background: #12151c;
}
.queue-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.queue-item {
  text-align: left;
  background: #12151c;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px;
  color: var(--text-primary);
}
.queue-item strong { display: block; font-size: 22px; font-family: var(--font-heading); }
.drawer-root { position: fixed; inset: 0; z-index: 40; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(640px, 100%);
  background: #12151c;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  overflow: auto;
  padding: 20px 20px 40px;
}
.user-cell { display: flex; gap: 10px; align-items: center; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #312e81; color: #fff; font-size: 11px; font-weight: 700; flex: none;
}
.cell-sub { color: var(--text-muted); font-size: 12px; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button[aria-selected="true"] { background: #7c3aed; color: #fff; }

@media (max-width: 1440px) {
  main { padding: 24px; }
}
@media (max-width: 1100px) {
  .nav-toggle { display: inline-flex; }
  aside {
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }
  #app.nav-open aside { transform: none; }
  .workspace { margin-left: 0; }
  .dash-grid, .queue-grid, .chart-grid, .grid2 { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar input[type=text] { width: 100%; }
  table { min-width: 640px; }
}
@media (max-width: 768px) {
  aside { width: min(280px, 86vw); padding: 18px 12px 16px; }
  aside .logo span, aside nav a { font-size: 14px; }
  aside nav a { justify-content: flex-start; padding: 10px 12px; }
  aside .whoami { display: block; }
  main { margin-left: 0; max-width: none; padding: 16px; }
  .topbar { padding: 0 12px; }
  .payout-queue-table { display: none; }
  .payout-cards { display: grid; gap: 12px; }
}

/* Round 4: wide content (tables, stat rows) stays inside its card and scrolls there,
   instead of widening the whole page. Grid and flex children default to min-width:auto,
   which lets a 720px table push a 1fr column (and the page) past the viewport. */
.dash-grid > *,
.chart-grid > *,
.grid2 > *,
.queue-grid > * { min-width: 0; }
.panel, .chart-card { min-width: 0; max-width: 100%; }
.queue-item { overflow-wrap: anywhere; }
.chart-card.full { flex-wrap: wrap; }
.chart-card canvas { max-width: 100%; }
