@font-face { font-family: 'Lato'; src: url('/fonts/lato-400.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Lato'; src: url('/fonts/lato-700.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Lato'; src: url('/fonts/lato-900.woff2') format('woff2'); font-weight: 900; font-style: normal; font-display: swap; }

/* ClaimBuddy portal palette: blue #1c77ba, coral #f3717c, and the blue-to-coral gradient. */
:root {
  --paper: #f8f9fa;
  --surface: #ffffff;
  --ink: #1f2a37;
  --ink-2: #5f6b78;
  --ink-3: #8a949e;
  --line: #e1e6ec;
  --brand: #1c77ba;
  --brand-ink: #ffffff;
  --brand-soft: #e6f0f8;
  --coral: #f3717c;
  --coral-soft: #fdebed;
  --coral-ink: #a8343f;
  --warn-soft: #fff3da;
  --warn-ink: #8a5a00;
  --in: #16875a;
  --in-soft: #e3f3eb;
  --out: #d23c48;
  --out-soft: #fbe7e9;
  --grad: linear-gradient(90deg, #1c77ba 0%, #f3717c 100%);
  --grad-hero: linear-gradient(155deg, #1c77ba 0%, #f3717c 100%);
  --shadow: 0 6px 24px rgba(28, 60, 100, 0.1);
  --font: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1720;
    --surface: #17212c;
    --ink: #e9eef3;
    --ink-2: #a6b1bc;
    --ink-3: #75818d;
    --line: #273443;
    --brand: #5aa8e3;
    --brand-ink: #0f1720;
    --brand-soft: #142c42;
    --coral: #ff8d97;
    --coral-soft: #3a1d22;
    --coral-ink: #ffb3ba;
    --warn-soft: #3a2c10;
    --warn-ink: #ffd58a;
    --in: #4ccb8d;
    --in-soft: #12332a;
    --out: #ff7b85;
    --out-soft: #3c1b20;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.15; }
img { max-width: 100%; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.noscript { padding: 24px; }
.boot { min-height: 100dvh; }
.cb-blue { color: #1c77ba; }
.cb-coral { color: #f3717c; }

:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }

/* ---------- Frame ---------- */

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
.wrap { width: 100%; max-width: 520px; margin: 0 auto; padding: 0 20px; }
.wrap.wide { max-width: 1160px; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 20px 6px;
  max-width: 1160px; margin: 0 auto;
}
.wordmark {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none;
  font-weight: 900; font-size: 21px; letter-spacing: -0.01em;
}
.logo-badge {
  display: grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 8px rgba(28, 60, 100, 0.16);
}
.logo-badge img { width: 72%; height: auto; display: block; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
  font-weight: 700; font-size: 15px; text-decoration: none;
}

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; gap: 4px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .tabs {
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  }
}
.tabs a {
  flex: 1; max-width: 116px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 4px; border-radius: 12px;
  color: var(--ink-3); text-decoration: none; font-size: 13px; font-weight: 700;
}
.tabs a svg { width: 24px; height: 24px; }
.tabs a[aria-current='page'] { color: var(--brand); }

.banner {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: var(--ink); color: var(--paper); font-weight: 700; font-size: 15px; text-align: center;
}
.banner button {
  border: 0; border-radius: 999px; padding: 4px 12px;
  background: var(--paper); color: var(--ink); font-weight: 700; cursor: pointer;
}

/* ---------- Buttons and fields ---------- */

.btn {
  appearance: none; border: 0; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 22px; border-radius: 999px;
  background: var(--grad); color: #fff;
  font-weight: 700; font-size: 17px; line-height: 1.2; text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--brand-soft); color: var(--brand); }
.btn.quiet { background: transparent; color: var(--brand); }
.btn.danger { background: var(--out); color: #fff; }
.btn.small { min-height: 38px; padding: 7px 15px; font-size: 15px; }
.btn[disabled] { opacity: 0.55; cursor: default; transform: none; }
.btn svg { width: 20px; height: 20px; }

.field { display: grid; gap: 6px; margin: 0 0 16px; }
.field > label, .field > .label { font-weight: 700; font-size: 15px; }
.hint { font-size: 14px; color: var(--ink-2); margin: 0; }
.input, select.input {
  width: 100%; min-height: 50px; padding: 11px 14px;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--surface); font-size: 17px;
}
.input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.input.big { font-size: 21px; letter-spacing: 0.03em; font-weight: 700; }
.prefixed { display: flex; align-items: stretch; }
.prefixed .prefix {
  display: grid; place-items: center; padding: 0 12px;
  border: 1.5px solid var(--line); border-right: 0; border-radius: 12px 0 0 12px;
  background: var(--paper); color: var(--ink-2); font-weight: 700; font-size: 18px;
}
.prefixed .input { border-radius: 0 12px 12px 0; }
.form-error { color: var(--out); font-weight: 700; margin: -4px 0 14px; }

.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice label {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 9px 14px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--surface); font-weight: 700;
}
.choice input { accent-color: var(--brand); margin: 0; }
.choice label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }

/* ---------- Login ---------- */

.login { min-height: 100vh; min-height: 100dvh; max-width: 460px; margin: 0 auto; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.login-hero {
  position: relative; overflow: hidden;
  padding: calc(40px + env(safe-area-inset-top)) 28px 78px;
  background: var(--grad-hero); color: #fff;
}
@media (min-width: 461px) { .login-hero { border-radius: 0 0 28px 28px; } }
.login-hero::before, .login-hero::after {
  content: ''; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, 0.1); pointer-events: none;
}
.login-hero::before { width: 240px; height: 240px; right: -70px; top: -80px; }
.login-hero::after { width: 160px; height: 160px; left: -60px; bottom: -70px; }
.login-hero .logo-badge { width: 72px; height: 72px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18); }
.login-hero h1 { margin: 18px 0 6px; font-size: 44px; font-weight: 900; letter-spacing: -0.02em; }
.login-hero .lede { margin: 0; font-size: 18px; opacity: 0.95; max-width: 30ch; }
.login-card {
  position: relative; margin: -44px 16px 0; padding: 22px 20px 20px;
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow);
}
.login-card .btn { width: 100%; margin-top: 4px; }
.login-foot { margin: 22px 0 0; text-align: center; font-size: 14px; color: var(--ink-2); }
.login-foot strong { font-weight: 900; }
.login .note { margin: 18px 16px 0; }
.login-plain { padding: calc(48px + env(safe-area-inset-top)) 24px 24px; }
.login-plain h1 { font-size: 40px; font-weight: 900; margin: 16px 0 8px; }

.note {
  margin-top: 26px; padding: 16px 18px; border-radius: 16px;
  background: var(--brand-soft); color: var(--ink); font-size: 15px;
}
.note strong { display: block; margin-bottom: 4px; font-size: 16px; }
.note ol { margin: 6px 0 0; padding-left: 20px; }
.note li { margin: 3px 0; }
.note .btn { margin-top: 10px; }

/* ---------- Home ---------- */

.today-date { margin: 10px 0 0; color: var(--ink-2); font-size: 17px; }
.clock {
  margin: 0; line-height: 0.95;
  font-size: clamp(60px, 19vw, 84px); font-weight: 900;
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
}
.clock small { margin-left: 8px; font-size: 0.3em; font-weight: 700; letter-spacing: 0; color: var(--ink-2); }

.dial {
  position: relative; display: grid; place-items: center;
  width: min(76vw, 292px); aspect-ratio: 1 / 1; margin: 26px auto 6px; padding: 0;
  border: 0; border-radius: 50%; background: none; color: var(--ink);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.dial[disabled] { cursor: default; }
.dial:focus-visible { outline-offset: 8px; }
.dial svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.dial .zone { fill: var(--surface); stroke: var(--brand); stroke-width: 3.5; }
.dial .rim { fill: none; stroke: var(--line); stroke-width: 1; }
.dial .centre { fill: var(--ink-3); }
.dial .halo { fill: var(--coral); opacity: 0.24; }
.dial .me { fill: var(--coral); stroke: var(--surface); stroke-width: 3; }
.dial .sweep { fill: none; stroke: var(--brand); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 90 600; transform-box: fill-box; transform-origin: center; }
.dial[data-tone='idle'] .zone { stroke-dasharray: 7 8; }
.dial[data-tone='busy'] .zone { stroke: var(--line); }
.dial[data-tone='busy'] .sweep { animation: sweep 1.2s linear infinite; }
.dial[data-tone='inside'] .zone { stroke: var(--in); }
.dial[data-tone='outside'] .zone { stroke: var(--out); stroke-dasharray: 7 8; }
.dial[data-tone='checked'] .zone { fill: var(--brand-soft); stroke: var(--brand); }
.dial[data-tone='success'] .zone { fill: var(--in-soft); stroke: var(--in); }
.dial[data-tone='device'] .zone { fill: var(--coral-soft); stroke: var(--coral); stroke-dasharray: 2 7; stroke-linecap: round; }
.dial[data-tone='success'] .dial-text { animation: stamp 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.dial-text { position: relative; display: grid; gap: 6px; padding: 0 17%; text-align: center; pointer-events: none; }
.dial-label { font-size: 30px; font-weight: 900; line-height: 1.05; letter-spacing: -0.01em; }
.dial[data-tone='success'] .dial-label { color: var(--in); }
.dial[data-tone='device'] .dial-label { color: var(--coral-ink); font-size: 26px; }
.dial-sub { font-size: 15px; color: var(--ink-2); line-height: 1.3; }
.dial-big { font-size: 40px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; letter-spacing: -0.02em; }
.dial-big small { margin-left: 4px; font-size: 0.4em; font-weight: 700; letter-spacing: 0; color: var(--ink-2); }
.dial-icon { display: grid; place-items: center; color: var(--coral-ink); }
.dial-icon svg { width: 46px; height: 46px; }

@keyframes sweep { to { transform: rotate(360deg); } }
@keyframes stamp { from { transform: scale(1.35); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .dial[data-tone='busy'] .sweep { animation: none; stroke-dasharray: 3 9; }
  .dial[data-tone='success'] .dial-text { animation: none; }
}

.status { margin: 6px auto 0; max-width: 32ch; text-align: center; }
.status h2 { margin: 0; font-size: 22px; font-weight: 900; letter-spacing: -0.01em; }
.status p { margin: 6px 0 0; color: var(--ink-2); }
.status.bad h2 { color: var(--out); }
.status.good h2 { color: var(--in); }
.status.device h2 { color: var(--coral-ink); }
.status .error-text { color: var(--out); font-weight: 700; }
.actions { display: grid; gap: 10px; max-width: 340px; margin: 18px auto 0; }
.actions .btn { width: 100%; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 34px 0 6px; }
.section-head h2 { margin: 0; font-size: 19px; font-weight: 900; }
.section-head span, .section-head a { color: var(--ink-2); font-size: 15px; }

.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.row .main { min-width: 0; }
.row .main strong { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .main > span { display: block; color: var(--ink-2); font-size: 15px; }
.row .end { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .end small { display: block; font-weight: 400; font-size: 13px; color: var(--ink-2); }
.kind {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--brand-soft); color: var(--brand);
}
.kind svg { width: 19px; height: 19px; }
.kind.hospital { background: var(--coral-soft); color: var(--coral-ink); }
.kind.other { background: var(--paper); color: var(--ink-2); border: 1px solid var(--line); }
.thumb { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--line); display: block; }

.tag {
  display: inline-block; padding: 1px 9px; border-radius: 999px;
  font-size: 13px; font-weight: 700; line-height: 1.6; white-space: nowrap;
  background: var(--paper); color: var(--ink-2); border: 1px solid var(--line);
}
.tag.warn { background: var(--warn-soft); color: var(--warn-ink); border-color: transparent; }
.tag.bad { background: var(--out-soft); color: var(--out); border-color: transparent; }
.tag.good { background: var(--in-soft); color: var(--in); border-color: transparent; }
.tag.live { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

.empty { color: var(--ink-2); padding: 14px 0; margin: 0; }
.day-total { color: var(--ink-2); font-size: 15px; }

/* ---------- Profile ---------- */

.profile h1 { font-size: 30px; font-weight: 900; margin: 10px 0 2px; }
.facts { list-style: none; margin: 18px 0 0; padding: 0; border-top: 1px solid var(--line); }
.facts li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.facts li span:first-child { color: var(--ink-2); }
.facts li span:last-child { text-align: right; font-weight: 700; }
.panel {
  margin: 22px 0 0; padding: 18px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line);
}
.panel h2 { margin: 0 0 12px; font-size: 19px; font-weight: 900; }

/* ---------- Admin ---------- */

.admin-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.page-title { margin: 0; font-size: 32px; font-weight: 900; letter-spacing: -0.02em; }
.subnav { display: flex; gap: 6px; overflow-x: auto; margin: 14px -20px 18px; padding: 0 20px 2px; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a {
  flex: none; padding: 8px 16px; border-radius: 999px; text-decoration: none;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 700;
}
.subnav a[aria-current='page'] { background: var(--grad); border-color: transparent; color: #fff; }

.stats {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px;
  margin: 4px 0 8px; background: var(--line); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
}
.stat { background: var(--surface); padding: 14px 16px; }
.stat b { display: block; font-size: 32px; font-weight: 900; line-height: 1.05; font-variant-numeric: tabular-nums; color: var(--brand); }
.stat b small { font-size: 0.55em; font-weight: 700; color: var(--ink-2); }
.stat span { color: var(--ink-2); font-size: 14px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.columns { display: grid; gap: 0 36px; }
@media (min-width: 980px) { .columns { grid-template-columns: 1.4fr 1fr; } }

.filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; align-items: end; }
.filters .field { margin: 0; }
.filters .field label { font-size: 14px; }
.filters .input { min-height: 44px; font-size: 16px; padding: 8px 10px; }
.filters .wide-cell { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; }
@media (min-width: 980px) {
  .filters { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .filters .wide-cell { grid-column: auto / span 5; }
}

.table-wrap { margin-top: 16px; overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 10px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 14px; font-weight: 700; color: var(--ink-2); background: var(--paper); }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; }
td.wrapcell { white-space: normal; min-width: 180px; }
td .thumb { width: 36px; height: 36px; }

.list-card { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.list-card > li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.list-card .line1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.list-card .line1 strong { font-size: 17px; font-weight: 700; }
.list-card .meta { color: var(--ink-2); font-size: 15px; margin-top: 3px; }
.list-card .btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.list-card .inactive strong { color: var(--ink-3); }

.card-form { margin: 6px 0 22px; padding: 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.card-form h2 { margin: 0 0 14px; font-size: 20px; font-weight: 900; }
.grid2 { display: grid; gap: 0 14px; }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.form-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.coords-preview { font-variant-numeric: tabular-nums; font-weight: 700; }
.callout { margin: 6px 0 22px; padding: 16px 18px; border-radius: 16px; background: var(--in-soft); color: var(--ink); }
.callout p { margin: 0 0 10px; }
.callout .btn { margin-right: 8px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0 0 14px; }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 8px 16px; font-weight: 700; color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed='true'] { background: var(--brand); color: var(--brand-ink); }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 40;
  transform: translateX(-50%); max-width: calc(100% - 32px);
  padding: 12px 18px; border-radius: 14px; background: var(--ink); color: var(--paper);
  font-weight: 700; box-shadow: 0 6px 24px rgba(20, 30, 50, 0.25);
}

.wrap > .page-title:first-child { margin-top: 10px; }

/* Wide screens (admins on a laptop): navigation moves into the header. */
@media (min-width: 900px) {
  .screen { padding-bottom: 48px; }
  .top-row {
    display: flex; align-items: center; justify-content: space-between;
    max-width: 1160px; margin: 0 auto; padding: 0 20px;
  }
  .top-row .top { margin: 0; padding-left: 0; padding-right: 0; }
  .top-row .avatar { display: none; }
  .tabs {
    position: static; justify-content: flex-end; gap: 2px;
    padding: calc(14px + env(safe-area-inset-top)) 0 6px;
    border: 0; background: transparent;
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .tabs a { flex: none; max-width: none; flex-direction: row; gap: 7px; padding: 8px 13px; font-size: 15px; }
  .tabs a svg { width: 20px; height: 20px; }
  .tabs a[aria-current='page'] { background: var(--brand-soft); }
  .toast { bottom: 32px; }
}
