/* One type scale, one spacing scale, three control sizes. Everything on every page uses these. */
:root {
  --t-12: 12px; --t-14: 14px; --t-16: 16px; --t-20: 20px; --t-28: 28px;
  --s-4: 4px; --s-8: 8px; --s-16: 16px; --s-24: 24px; --s-32: 32px; --s-48: 48px;
  --control: 36px; --badge: 24px; --radius: 8px;
  --bg: #f6f6f7; --surface: #ffffff; --line: #e4e4e7; --text: #18181b; --muted: #6b6b73;
  --accent: #2f5bea; --accent-text: #ffffff;
  --good: #16794c; --good-bg: #e3f4ec; --wait: #8a5a00; --wait-bg: #fbefd5; --bad: #b3261e; --bad-bg: #fbe4e2; --idle: #55555c; --idle-bg: #ececef;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113; --surface: #1a1a1d; --line: #2c2c31; --text: #ededf0; --muted: #9a9aa3;
    --accent: #7c9cff; --accent-text: #0d1020;
    --good: #6fd3a3; --good-bg: #16302499; --wait: #e9be62; --wait-bg: #3a2e1299; --bad: #f2938c; --bad-bg: #3d1a1899; --idle: #b1b1ba; --idle-bg: #2a2a2f;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 400 var(--t-14)/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: var(--t-28); line-height: 1.2; font-weight: 650; margin: 0 0 var(--s-24); }
h2 { font-size: var(--t-20); line-height: 1.3; font-weight: 600; margin: 0 0 var(--s-16); }
h3 { font-size: var(--t-16); line-height: 1.4; font-weight: 600; margin: 0 0 var(--s-8); }
p { margin: 0 0 var(--s-8); }
.muted { color: var(--muted); }
.small { font-size: var(--t-12); }

.shell { display: grid; grid-template-columns: 208px 1fr; min-height: 100vh; }
.nav { background: var(--surface); border-right: 1px solid var(--line); padding: var(--s-24) var(--s-16); position: sticky; top: 0; height: 100vh; }
.nav .brand { font-size: var(--t-16); font-weight: 650; padding: 0 var(--s-8); margin-bottom: var(--s-24); }
.nav a { display: flex; justify-content: space-between; align-items: center; height: var(--control); padding: 0 var(--s-8); border-radius: var(--radius); color: var(--text); }
.nav a:hover { background: var(--bg); text-decoration: none; }
.nav a.on { background: var(--bg); font-weight: 600; }
.nav form { margin-top: var(--s-24); padding: 0 var(--s-8); }
.main { padding: var(--s-32); max-width: 1280px; width: 100%; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s-16); margin-bottom: var(--s-16); }
.grid { display: grid; gap: var(--s-16); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: var(--s-8); align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: var(--s-8); }
.section { margin-bottom: var(--s-32); }

.stat .n { font-size: var(--t-28); font-weight: 650; line-height: 1.2; }
.stat .l { color: var(--muted); font-size: var(--t-12); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: var(--t-12); font-weight: 600; color: var(--muted); padding: var(--s-8); border-bottom: 1px solid var(--line); }
td { padding: var(--s-8); border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }

.badge { display: inline-flex; align-items: center; height: var(--badge); padding: 0 var(--s-8); border-radius: 999px; font-size: var(--t-12); font-weight: 600; white-space: nowrap; }
.badge.good { color: var(--good); background: var(--good-bg); }
.badge.wait { color: var(--wait); background: var(--wait-bg); }
.badge.bad { color: var(--bad); background: var(--bad-bg); }
.badge.idle { color: var(--idle); background: var(--idle-bg); }

button, .btn, input, select, textarea { font: inherit; color: inherit; }
button, .btn { display: inline-flex; align-items: center; justify-content: center; height: var(--control); padding: 0 var(--s-16); border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; white-space: nowrap; }
button:hover, .btn:hover { border-color: var(--muted); text-decoration: none; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { color: var(--bad); }
input, select, textarea { height: var(--control); padding: 0 var(--s-8); border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); width: 100%; }
textarea { height: auto; min-height: 72px; padding: var(--s-8); line-height: 1.5; }
input[type=checkbox] { width: 16px; height: 16px; padding: 0; }
input[type=file] { padding: var(--s-4); }
label { display: block; font-size: var(--t-12); font-weight: 600; color: var(--muted); margin-bottom: var(--s-4); }
label.check { display: inline-flex; gap: var(--s-8); align-items: center; font-size: var(--t-14); font-weight: 400; color: var(--text); margin: 0; }
.field { min-width: 0; }
form.inline { display: inline; }
details > summary { cursor: pointer; font-weight: 600; height: var(--control); display: flex; align-items: center; }
details[open] > summary { margin-bottom: var(--s-8); }

.flash { background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); padding: var(--s-16); margin-bottom: var(--s-24); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--idle-bg); object-fit: cover; }
video.vertical { width: 100%; aspect-ratio: 9 / 16; background: #000; border-radius: var(--radius); }
video.wide { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); }
.clip { display: grid; grid-template-columns: 180px 1fr; gap: var(--s-16); }
.words { display: flex; flex-wrap: wrap; gap: var(--s-4); }
.words .word { display: inline-flex; align-items: center; gap: var(--s-4); }
.words input[data-i] { width: auto; min-width: 32px; field-sizing: content; }
.words input.bg { color: var(--muted); text-decoration: line-through; }
pre { background: var(--bg); border-radius: var(--radius); padding: var(--s-16); overflow: auto; font-size: var(--t-12); margin: 0; }
.login { max-width: 360px; margin: 15vh auto; padding: var(--s-16); }

/* phone approval */
.phone { max-width: 480px; margin: 0 auto; padding: var(--s-16); }
.phone .actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-8); }
.phone button { height: 48px; width: 100%; }
.preview { position: relative; }
.preview .zone { position: absolute; left: 0; right: 0; pointer-events: none; background: rgba(255, 60, 60, 0.18); display: none; }
.preview.zones .zone { display: block; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: var(--s-16); }
  .nav .links { display: flex; flex-wrap: wrap; gap: var(--s-4); }
  .nav .brand, .nav form { display: none; }
  .main { padding: var(--s-16); }
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; }
  .clip { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; }
}
