/* Theme tokens — BOTH blocks, verbatim from the platform style brief. Every screen reads these; never a hardcoded white/black. */
:root {
  --radius: 0.625rem;
  --sab: env(safe-area-inset-bottom, 0px);
  --background: #eef0f3; --foreground: #1a1d24;
  --surface: #f6f7f9; --card: #ffffff; --card-foreground: #1a1d24;
  --popover: #ffffff; --popover-foreground: #1a1d24;
  --text-heading: #0d0f14; --text-body: #3a3e47;
  --text-secondary: #4e5360; --text-tertiary: #5f6573; --text-placeholder: #6f7481;
  --primary: #0e7c9c; --primary-foreground: #ffffff; --primary-text: #0a647e;
  --secondary: #eef0f3; --secondary-foreground: #3a3e47;
  --muted: #e4e7eb; --muted-foreground: #6b7080;
  --accent: #e4e7eb; --accent-foreground: #3a3e47;
  --destructive: #ef4444; --destructive-foreground: #ffffff;
  --border: #e0e3e7; --border-subtle: #e9ecef; --border-strong: #d2d6db;
  --input: #dce0e4; --input-background: #eef0f3; --ring: #0e7c9c;
  --sidebar: #e4e7eb; --sidebar-foreground: #1a1d24;
  --sidebar-primary: #0e7c9c; --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: rgba(14,124,156,0.10); --sidebar-accent-foreground: #0a647e;
  --sidebar-border: #dce0e4; --sidebar-ring: #0e7c9c;
}
.dark {
  --background: #191a1e; --foreground: #d4d4d8;
  --surface: #1c1d21; --card: #1f2024; --card-foreground: #d4d4d8;
  --popover: #1f2024; --popover-foreground: #d4d4d8;
  --text-heading: #f4f4f5; --text-body: #d4d4d8;
  --text-secondary: #a1a1aa; --text-tertiary: #a1a1aa; --text-placeholder: #8a8e99;
  --primary: #5ccbe8; --primary-foreground: #0b2b33; --primary-text: #5ccbe8;
  --secondary: #2d2e33; --secondary-foreground: #d4d4d8;
  --muted: #2d2e33; --muted-foreground: #71717a;
  --accent: #2d2e33; --accent-foreground: #d4d4d8;
  --destructive: #ef4444; --destructive-foreground: #ffffff;
  --border: #2d2e33; --border-subtle: #252629; --border-strong: #3a3c42;
  --input: #3a3b40; --input-background: #1f2024; --ring: #5ccbe8;
  --sidebar: #232429; --sidebar-foreground: #d4d4d8;
  --sidebar-primary: #5ccbe8; --sidebar-primary-foreground: #0b2b33;
  --sidebar-accent: rgba(92,203,232,0.14); --sidebar-accent-foreground: #e8e8ec;
  --sidebar-border: #31323a; --sidebar-ring: #5ccbe8;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--background); color: var(--foreground);
  font: 15px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 0 14px calc(24px + var(--sab, 0px));
}
main { max-width: 640px; margin: 0 auto; }
h1 { font-size: 17px; font-weight: 600; color: var(--text-heading); margin: 18px 0 8px; }
p { margin: 0 0 8px; color: var(--text-body); }
.muted { color: var(--text-secondary); }
.card { background: var(--card); color: var(--card-foreground); border: .5px solid var(--border); border-radius: var(--radius); padding: 16px; margin-top: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 16px; border-radius: var(--radius); border: .5px solid var(--border); background: var(--secondary); color: var(--secondary-foreground); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: var(--primary-foreground); border-color: transparent; }
.input { width: 100%; min-height: 40px; padding: 8px 12px; border-radius: var(--radius); border: .5px solid var(--input); background: var(--input-background); color: var(--foreground); font: inherit; }
.input:focus { outline: 2px solid var(--ring); outline-offset: 1px; }
.empty { text-align: center; padding: 28px 12px; color: var(--text-secondary); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gear { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 18px; color: var(--text-secondary); text-decoration: none; font-size: 18px; }
.gear:hover { background: var(--muted); }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 12px 0 6px; margin-top: 10px; border-radius: 18px; color: var(--text-secondary); text-decoration: none; font-weight: 500; }
.back:hover { background: var(--muted); color: var(--text-heading); }

/* Selects: our own arrow, never the browser's (it sticks to the border in the clients). */
select, select.input {
  appearance: none; -webkit-appearance: none;
  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='%235f6573' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 12px;
  padding-right: 36px; cursor: pointer;
}
.dark select, .dark select.input {
  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='%23a1a1aa' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

/* Checkboxes and radios are drawn by us and big enough to tap with a finger. */
:root { --cb-size: 24px; --cb-box: 22px; --cb-tick: 14px; }
input[type=checkbox] {
  appearance: none; -webkit-appearance: none; width: var(--cb-size); height: var(--cb-size);
  border: 0; padding: 0; border-radius: 6px; cursor: pointer; flex: none;
  background-image: linear-gradient(var(--card), var(--card)), linear-gradient(var(--border-strong), var(--border-strong));
  background-size: calc(var(--cb-box) - 3px) calc(var(--cb-box) - 3px), var(--cb-box) var(--cb-box);
  background-position: center; background-repeat: no-repeat;
}
input[type=checkbox]:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"), linear-gradient(var(--primary), var(--primary));
  background-size: var(--cb-tick) var(--cb-tick), var(--cb-box) var(--cb-box);
}
input[type=radio] {
  appearance: none; -webkit-appearance: none; width: var(--cb-size); height: var(--cb-size);
  border: 0; padding: 0; cursor: pointer; flex: none;
  background-image: radial-gradient(circle, transparent 0 8px, var(--border-strong) 8px 10px, transparent 10px);
  background-size: var(--cb-box) var(--cb-box); background-position: center; background-repeat: no-repeat;
}
input[type=radio]:checked {
  background-image: radial-gradient(circle, var(--primary) 0 5px, transparent 5px), radial-gradient(circle, transparent 0 8px, var(--primary) 8px 10px, transparent 10px);
  background-size: var(--cb-box) var(--cb-box); background-position: center; background-repeat: no-repeat;
}
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* The phone: targets a finger can hit, fields that do not zoom the page. */
@media (max-width: 640px) {
  :root { --cb-size: 44px; --cb-box: 22px; --cb-tick: 15px; }
  .btn, .btn-sm, .input, .back, .gear { min-height: 44px; }
  .gear { width: 44px; height: 44px; }
  input, select, textarea { font-size: 16px; }
}
