:root {
  --ink: #16213A;
  --ink-2: #34445E;
  --muted: #4A5872;
  --paper: #F3F5F8;
  --card: #FFFFFF;
  --line: #DDE3EC;
  --line-2: #C9D2DF;
  --blue: #1F5FD1;
  --blue-ink: #16408F;
  --blue-tint: #DFE9FB;
  --amber: #E8943A;
  --amber-ink: #7A3B00;
  --amber-tint: #FBE7D2;
  --side: #16213A;
  --side-ink: #C9D4E8;
  --side-on: #2C3D63;
  --danger: #A12A1E;
  --danger-tint: #FBE3E0;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #E8EDF6; --ink-2: #C9D4E8; --muted: #A9B6CE; --paper: #0F1729; --card: #17213A;
    --line: #2A3755; --line-2: #3A4A6B; --blue: #6E9BEA; --blue-ink: #A9C4F5; --blue-tint: #1E2F55;
    --amber-ink: #F2B877; --amber-tint: #3A2A17; --side: #0B1222; --side-on: #22325A;
    --danger: #F2A49B; --danger-tint: #3A1C19; color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--paper); }
body { font: 400 16px/1.5 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); }
h1, h2 { font-family: 'Bricolage Grotesque', 'Figtree', system-ui, sans-serif; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(28px, 4vw, 40px); }
h2 { font-size: 20px; }
p { margin: 0; }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.boot { padding: 48px; color: var(--muted); }

/* Buttons and fields */
.btn { min-height: 44px; padding: 0 18px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0B1222; } }
.btn.danger { color: var(--danger); }
.btn.link { border: 0; background: none; color: var(--blue); padding: 0 4px; min-height: 44px; }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 15px; }
.field .hint { font-size: 14px; color: var(--muted); }
.field input, .field select, .field textarea { min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--card); }
.field textarea { min-height: 96px; resize: vertical; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.msg { border-radius: 8px; padding: 12px 14px; font-size: 15px; }
.msg.error { background: var(--danger-tint); color: var(--danger); }
.msg.ok { background: var(--blue-tint); color: var(--blue-ink); }

/* Signed-out screens */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 440px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 32px; display: flex; flex-direction: column; gap: 20px; }
.brand { font-family: 'Bricolage Grotesque', system-ui, sans-serif; font-weight: 700; font-size: 20px; }
.muted { color: var(--muted); }

/* Signed-in shell */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; }
.side { flex: 1 1 220px; background: var(--side); color: var(--side-ink); padding: 28px 16px; display: flex; flex-direction: column; gap: 6px; }
.side .brand { color: #fff; padding: 0 12px 20px; }
.side a { color: var(--side-ink); text-decoration: none; padding: 0 12px; min-height: 44px; display: flex; align-items: center; border-radius: 8px; }
.side a[aria-current="page"] { background: var(--side-on); color: #fff; }
.side .who { margin-top: auto; padding: 20px 12px 0; font-size: 14px; display: flex; flex-direction: column; gap: 8px; }
.side .who .btn { background: transparent; color: var(--side-ink); border-color: #3A4A6B; }
.side select { min-height: 44px; border-radius: 8px; padding: 0 8px; background: var(--side-on); color: #fff; border: 0; }
.main { flex: 999 1 560px; min-width: 0; padding: 32px; }
.main > .inner { max-width: 960px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.list { display: flex; flex-direction: column; }
.list > .item { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding: 14px 0; border-top: 1px solid var(--line); }
.list > .item:first-child { border-top: 0; }
.tag { font-size: 13px; font-weight: 600; border-radius: 6px; padding: 3px 9px; background: var(--blue-tint); color: var(--blue-ink); }
.tag.amber { background: var(--amber-tint); color: var(--amber-ink); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.copybox { display: flex; gap: 8px; flex-wrap: wrap; }
.copybox input { flex: 1 1 260px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--paper); font-size: 14px; }
@media (max-width: 640px) { .main { padding: 20px 16px; } .auth-card { padding: 24px; } }
