/* Layout: a sign-in card, then one scannable column of call cards grouped by
   time zone under a sticky bar that carries progress, search and filters. */
:root {
  --bg: #EEF2F8;
  --surface: #FFFFFF;
  --sunk: #E2E8F3;
  --ink: #0F1F3D;
  --muted: #55627F;
  --line: #CCD6E7;
  --accent: #1F5FBF;
  --on-accent: #FFFFFF;
  --gold: #7C5F0C;
  --gold-fill: #C9A227;
  --ok: #156B45;
  --ok-bg: #DCF1E6;
  --warn: #8C4D09;
  --warn-bg: #FAE9CF;
  --bad: #A3271F;
  --bad-bg: #F7DCD9;
  --info: #1B4F9E;
  --info-bg: #DCE8FA;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0A1426; --surface: #121F3A; --sunk: #0E1930; --ink: #E7ECF7; --muted: #9AA8C6;
    --line: #27375C; --accent: #74A7F7; --on-accent: #08142B; --gold: #E2BF55; --gold-fill: #C9A227;
    --ok: #63CC98; --ok-bg: #123A2A; --warn: #F0AD62; --warn-bg: #3F2B10; --bad: #F2948B; --bad-bg: #431A17;
    --info: #9DC0FA; --info-bg: #17305B; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.45; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
.wrap { max-width: 760px; margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Loading and sign-in */
.boot { margin: 0; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; color: var(--muted); }
.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top, 0px)) 16px 24px; }
.gate-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px 22px 22px; display: grid; gap: 14px; box-shadow: 0 12px 32px rgba(15, 31, 61, 0.10); }
.gate-mark { width: 46px; height: 46px; border-radius: 12px; background: #0F1F3D; color: #C9A227; display: grid; place-items: center; border: 1px solid #27375C; }
.gate-card h1 { font-size: 24px; }
.gate-sub { margin: -6px 0 2px; color: var(--muted); }
.gate-card form { display: grid; gap: 12px; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 66px; }
.pw-toggle { position: absolute; right: 4px; top: 4px; height: 32px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer; }
.hint { margin: -4px 0 0; font-size: 13px; color: var(--muted); }
.gate-msg { margin: 0; min-height: 1.45em; font-size: 14px; font-weight: 600; color: var(--bad); }
.gate-msg[data-tone="info"] { color: var(--muted); font-weight: 500; }

/* Sticky bar */
.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.bar .wrap { padding-block: 12px 10px; display: grid; gap: 8px; }
.bar-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.brand { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
h1 { font-family: var(--font-display); font-size: 22px; line-height: 1.15; margin: 0; text-wrap: balance; }
.save { font-size: 12px; color: var(--muted); white-space: nowrap; }
.save[data-state="error"] { color: var(--bad); font-weight: 600; }
.progress { height: 8px; border-radius: 99px; background: var(--sunk); overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--gold-fill); border-radius: 99px; transition: width 0.3s ease; }
@media (prefers-reduced-motion: reduce) { .progress-fill { transition: none; } }
.stats { margin: 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stats strong { color: var(--ink); }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search { flex: 1 1 200px; min-width: 0; height: 40px; padding: 0 12px; font-size: 16px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.chips { display: flex; gap: 6px; }
.chip { height: 40px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }

main.wrap { padding-block: 16px 48px; display: grid; gap: 16px; }
.notice { margin: 0; padding: 12px 14px; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn); font-size: 14px; font-weight: 500; }
.empty { margin: 0; padding: 28px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
#list { display: grid; gap: 16px; }
#list:empty { display: none; }

details.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
details.panel > summary { cursor: pointer; padding: 12px 14px; font-weight: 600; list-style-position: inside; }
details.panel > .panel-body { padding: 0 14px 14px; display: grid; gap: 10px; }
.script-line { margin: 0; }
.script-line b { display: block; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.rule { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--bad-bg); color: var(--bad); font-weight: 600; font-size: 14px; }

/* Groups */
.group { display: grid; gap: 8px; }
.group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; padding-top: 4px; }
.group-head h2 { font-family: var(--font-display); font-size: 17px; margin: 0; }
.group-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.clock { margin-left: auto; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--sunk); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.clock[data-open="true"] { background: var(--ok-bg); color: var(--ok); }
.cards { display: grid; gap: 8px; }

/* Card */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 10px; }
.card[data-called="true"] { background: var(--sunk); }
.card-top { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }
.check { width: 28px; height: 28px; margin: 2px 0 0; accent-color: var(--accent); cursor: pointer; }
.who { min-width: 0; display: grid; gap: 2px; }
.company-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.company { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.person { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.person b { color: var(--ink); font-weight: 600; }
.badge { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 99px; background: var(--info-bg); color: var(--info); white-space: nowrap; }
.badge[data-tone="ok"] { background: var(--ok-bg); color: var(--ok); }
.badge[data-tone="warn"] { background: var(--warn-bg); color: var(--warn); }
.badge[data-tone="bad"] { background: var(--bad-bg); color: var(--bad); }
.phone-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.tel { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); text-decoration: none; }
.tel-none { font-size: 15px; font-weight: 600; color: var(--ink); }
.phone-note { font-size: 12px; color: var(--muted); }
.copy { height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: transparent; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.field { display: grid; gap: 3px; min-width: 0; }
.field > span:first-child { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.field select, .field input, .field textarea { width: 100%; min-width: 0; font-size: 16px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.field select, .field input { height: 40px; }
.field textarea { min-height: 64px; resize: vertical; line-height: 1.4; }
.field-wide { grid-column: 1 / -1; }
.card-foot { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 12px; color: var(--muted); }
.stamp { font-variant-numeric: tabular-nums; }
.stamp[data-on="true"] { color: var(--ok); font-weight: 600; }
details.more { font-size: 13px; color: var(--muted); }
details.more > summary { cursor: pointer; font-weight: 600; }
.more-body { display: grid; gap: 6px; padding-top: 6px; overflow-wrap: anywhere; }
.more-body span b { color: var(--ink); font-weight: 600; }
.remove { justify-self: start; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--bad); font-size: 13px; font-weight: 600; cursor: pointer; }

/* Forms */
.add-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.primary { height: 42px; padding: 0 18px; border-radius: 8px; border: 0; background: var(--accent); color: var(--on-accent); font-weight: 700; cursor: pointer; justify-self: start; }
.primary.wide { width: 100%; height: 46px; justify-self: stretch; font-size: 16px; }
.ghost { height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--ink); font-weight: 600; cursor: pointer; }
.form-msg { margin: 0; font-size: 13px; color: var(--muted); }
.account-form { display: grid; gap: 10px; }
.account-out { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding-top: 12px; border-top: 1px solid var(--line); }
[disabled] { opacity: 0.6; cursor: not-allowed; }
