/* HomeCare look: spruce ink, cool mist canvas, one marigold accent reserved for "do this now".
   Display face: Bricolage Grotesque. Text face: Figtree. Signature: the visit "time card". */
@font-face { font-family:"Bricolage Grotesque"; src:url(/fonts/bricolage-grotesque.woff2) format("woff2"); font-weight:400 800; font-display:swap; }
@font-face { font-family:"Figtree"; src:url(/fonts/figtree.woff2) format("woff2"); font-weight:400 800; font-display:swap; }

:root {
  --bg:#edf1ef; --surface:#ffffff; --surface-2:#f5f8f6; --ink:#10231f; --muted:#5a6b66; --line:#dde5e1;
  --brand:#0f5247; --brand-strong:#0b3f37; --brand-ink:#ffffff; --tint:#dcefe7; --tint-ink:#0b3f37;
  --spruce:#10231f; --spruce-2:#183630; --on-spruce:#eaf3ef; --on-spruce-muted:#a9c2b9;
  --gold:#f0b24a; --gold-strong:#e59f2b; --gold-ink:#2a1c03;
  --ok:#12714a; --ok-bg:#dff3e8; --warn:#8a5206; --warn-bg:#fcefd6; --bad:#b3261e; --bad-bg:#fbe5e2; --info:#2f4f7f; --info-bg:#e6edf6;
  --shadow-sm:0 1px 2px rgba(16,35,31,.06); --shadow:0 1px 2px rgba(16,35,31,.05), 0 10px 30px -12px rgba(16,35,31,.18); --shadow-lg:0 24px 60px -20px rgba(16,35,31,.35);
  --radius:18px; --nav-w:256px;
  --display:"Bricolage Grotesque", "Figtree", ui-sans-serif, system-ui, sans-serif; --text:"Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:#0b1513; --surface:#132220; --surface-2:#182b28; --ink:#e8f1ee; --muted:#9db3ac; --line:#24393a;
    --brand:#58cdb0; --brand-strong:#7ddcc4; --brand-ink:#05231d; --tint:#17362f; --tint-ink:#a9ecd9;
    --spruce:#0f211e; --spruce-2:#17332e; --on-spruce:#eaf3ef; --on-spruce-muted:#9db3ac;
    --ok:#6fd9a4; --ok-bg:#143325; --warn:#f3be6c; --warn-bg:#3b2b10; --bad:#ff9288; --bad-bg:#401c19; --info:#aac4f2; --info-bg:#1b2a44;
    --shadow-sm:0 1px 2px rgba(0,0,0,.4); --shadow:0 1px 2px rgba(0,0,0,.4), 0 12px 32px -12px rgba(0,0,0,.6); --shadow-lg:0 24px 60px -20px rgba(0,0,0,.8);
  }
}
* { box-sizing:border-box; }
[hidden] { display:none !important; }
html { -webkit-text-size-adjust:100%; }
body { margin:0; font:16px/1.5 var(--text); background:var(--bg); color:var(--ink); -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility; }
h1,h2,h3,h4 { margin:0; font-family:var(--display); line-height:1.12; letter-spacing:-.022em; text-wrap:balance; }
h1 { font-size:32px; font-weight:700; } h2 { font-size:20px; font-weight:650; } h3 { font-size:16.5px; font-weight:650; letter-spacing:-.01em; }
p { margin:0; } a { color:var(--brand); text-underline-offset:3px; }
.ic { display:inline-flex; flex:none; } .ic svg { display:block; }
.muted { color:var(--muted); } .small { font-size:14px; } .tiny { font-size:12.5px; } .strong { font-weight:650; }
.num { font-variant-numeric:tabular-nums; }
.eyebrow { font-size:12.5px; font-weight:700; letter-spacing:.09em; text-transform:uppercase; color:var(--muted); }
.stack { display:flex; flex-direction:column; gap:16px; } .stack.tight { gap:8px; } .stack.loose { gap:28px; }
.row { display:flex; align-items:center; gap:12px; } .row.wrap { flex-wrap:wrap; } .between { justify-content:space-between; } .grow { flex:1; min-width:0; } .end { justify-content:flex-end; }
.truncate { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* shell */
.shell { min-height:100dvh; }
.sidebar { position:fixed; inset:0 auto 0 0; width:var(--nav-w); background:var(--spruce); color:var(--on-spruce); display:flex; flex-direction:column; padding:22px 14px 16px; gap:2px; z-index:30; overflow-y:auto;
  --ink:var(--on-spruce); --muted:var(--on-spruce-muted); --line:rgba(255,255,255,.14); --surface:rgba(255,255,255,.06); --surface-2:rgba(255,255,255,.1); --tint:rgba(255,255,255,.12); --tint-ink:#ffffff; --info-bg:rgba(255,255,255,.12); --info:#d7e6e0; }
.brand { display:flex; align-items:center; gap:11px; padding:2px 10px 22px; font-family:var(--display); font-weight:700; font-size:20px; letter-spacing:-.03em; }
.brand .logo { width:36px; height:36px; border-radius:11px; background:var(--gold); color:var(--gold-ink); display:grid; place-items:center; }
.navlink { position:relative; display:flex; align-items:center; gap:12px; padding:10px 12px; border-radius:11px; color:var(--on-spruce-muted); text-decoration:none; font-weight:600; font-size:15px; min-height:44px; transition:background .15s, color .15s; }
@media (hover:hover) { .navlink:hover { background:rgba(255,255,255,.07); color:#fff; } }
.navlink.on { background:rgba(255,255,255,.11); color:#fff; }
.navlink.on::before { content:""; position:absolute; left:-14px; top:10px; bottom:10px; width:4px; border-radius:0 4px 4px 0; background:var(--gold); }
.sidebar .spacer { flex:1; min-height:16px; }
.sidebar .avatar { background:rgba(255,255,255,.14); color:#fff; }
.content { margin-left:var(--nav-w); padding:40px clamp(16px,4vw,56px) 72px; }
.content > .page { max-width:1140px; margin:0 auto; }
.page > * { animation:rise .32s cubic-bezier(.2,.7,.2,1) both; }
@keyframes rise { from { opacity:0; transform:translateY(6px); } }
.topbar, .scrim, .tabbar { display:none; }
.pagehead { display:flex; align-items:flex-end; justify-content:space-between; gap:16px; flex-wrap:wrap; margin-bottom:28px; }
.pagehead .sub { color:var(--muted); margin-top:6px; font-size:16.5px; }

/* caregiver layout: one column with a floating tab bar */
.shell.simple .content { margin-left:0; padding:24px 16px calc(112px + env(safe-area-inset-bottom)); }
.shell.simple .content > .page { max-width:540px; }
.shell.simple .tabbar, .shell .tabbar.staff { display:grid; grid-auto-flow:column; grid-auto-columns:1fr; gap:4px; position:fixed; left:50%; transform:translateX(-50%); bottom:calc(12px + env(safe-area-inset-bottom)); width:min(516px,calc(100vw - 24px));
  background:color-mix(in srgb,var(--surface) 88%,transparent); backdrop-filter:blur(16px) saturate(1.4); -webkit-backdrop-filter:blur(16px) saturate(1.4); border:1px solid var(--line); border-radius:22px; padding:6px; z-index:30; box-shadow:var(--shadow-lg); }
.tabbar a, .tabbar button { display:flex; flex-direction:column; align-items:center; gap:2px; padding:6px 4px; border:0; background:none; font:inherit; border-radius:16px; color:var(--muted); text-decoration:none; font-size:11.5px; font-weight:650; min-height:52px; justify-content:center; cursor:pointer; transition:background .15s, color .15s; }
.tabbar .on { color:var(--on-spruce); background:var(--spruce); }
.shell .tabbar.staff { z-index:24; }
@media (min-width: 900px) { .shell .tabbar.staff { display:none; } }
.dayview, .phone-only { display:none; }
@media (max-width: 899px) {
  .shell:not(.simple) .content { padding-bottom:calc(112px + env(safe-area-inset-bottom)); }
  .dayview { display:block; } .page .week { display:none; }
}
.daystrip { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:6px; }
.daystrip button { min-width:0; display:flex; flex-direction:column; align-items:center; gap:1px; padding:8px 0; min-height:74px; border:1px solid var(--line); border-radius:14px; background:var(--surface); color:var(--ink); font:inherit; cursor:pointer; box-shadow:var(--shadow-sm); }
.daystrip .dnum { font-family:var(--display); font-size:21px; font-weight:700; letter-spacing:-.02em; line-height:1.15; }
.daystrip .today .dnum { color:var(--brand); }
.daystrip button[aria-pressed=true] { background:var(--spruce); border-color:var(--spruce); color:var(--on-spruce); }
.daystrip button[aria-pressed=true] .muted, .daystrip button[aria-pressed=true] .dnum { color:inherit; }
.daystrip .tiny { font-size:11px; white-space:nowrap; }
.shiftbar { width:4px; align-self:stretch; border-radius:4px; background:var(--brand); flex:none; }
.shiftbar.completed { background:var(--ok); } .shiftbar.missed { background:var(--bad); } .shiftbar.in_progress { background:var(--gold-strong); } .shiftbar.cancelled { background:var(--line); }
@media (max-width: 700px) {
  .phone-only { display:block; } .desktop-only { display:none; }
  .filters > select { max-width:none !important; flex:1 1 150px; }
  /* tables become stacked rows: first column is the title, the rest label: value */
  .tablewrap table, .tablewrap tbody, .tablewrap tr, .tablewrap td { display:block; width:100%; }
  .tablewrap thead { display:none; }
  .tablewrap tr { padding:12px 18px; border-bottom:1px solid var(--line); }
  .tablewrap tr:last-child { border-bottom:0; }
  .tablewrap td { border:0; padding:3px 0; display:flex; justify-content:space-between; align-items:center; gap:16px; text-align:right; }
  .tablewrap td::before { content:attr(data-label); color:var(--muted); font-size:13px; font-weight:600; text-align:left; flex:none; }
  .tablewrap td:first-child { font-weight:650; font-size:16px; text-align:left; padding-bottom:6px; }
  .tablewrap td:first-child::before, .tablewrap td[data-label=""]::before { display:none; }
  .tablewrap tr.click:hover td { background:none; } .tablewrap tr.click:hover { background:var(--surface-2); }
}

@media (max-width: 899px) {
  .shell:not(.simple) .sidebar { transform:translateX(-100%); transition:transform .22s ease; box-shadow:var(--shadow-lg); }
  .shell:not(.simple).navopen .sidebar { transform:none; }
  .shell:not(.simple).navopen .scrim { display:block; position:fixed; inset:0; background:rgba(8,18,16,.5); z-index:25; }
  .shell:not(.simple) .content { margin-left:0; padding-top:80px; }
  .shell:not(.simple) .topbar { display:flex; align-items:center; gap:10px; position:fixed; inset:0 0 auto 0; height:58px; padding:0 10px; background:color-mix(in srgb,var(--surface) 90%,transparent); backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px); border-bottom:1px solid var(--line); z-index:20; font-family:var(--display); font-weight:700; font-size:18px; letter-spacing:-.02em; }
}
@media (max-width: 560px) {
  h1 { font-size:27px; }
  .card { padding:18px; }
  .item { padding:14px 16px; } .item:has(> .btn) { flex-wrap:wrap; } .item > .grow { min-width:120px; } .item > .btn { margin-left:auto; }
  .stat .value { font-size:30px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition:none !important; animation:none !important; } }

/* surfaces */
.card { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:22px; box-shadow:var(--shadow); }
.card.flat { box-shadow:none; background:var(--surface-2); }
.card.pad0 { padding:0; overflow:hidden; }
.card .cardhead { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.grid { display:grid; gap:18px; } .grid.c2 { grid-template-columns:repeat(auto-fit,minmax(300px,1fr)); }
/* stats: one joined strip with hairline dividers instead of separate tiles */
.grid.c4 { grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:1px; background:var(--line); border:1px solid var(--line); border-radius:var(--radius); overflow:hidden; box-shadow:var(--shadow); }
.grid.c4 > .card { border:0; border-radius:0; box-shadow:none; padding:20px 22px; }
.stat .label { color:var(--muted); font-size:13.5px; font-weight:600; }
.stat .value { font-family:var(--display); font-size:38px; font-weight:700; letter-spacing:-.035em; font-variant-numeric:tabular-nums; line-height:1.05; margin-top:6px; }
.empty { text-align:center; color:var(--muted); padding:36px 16px; }
.empty .ic { width:56px; height:56px; border-radius:50%; background:var(--surface-2); display:inline-grid; place-items:center; color:var(--muted); margin-bottom:10px; }
.list > * + * { border-top:1px solid var(--line); }
.item { display:flex; align-items:center; gap:14px; padding:15px 22px; text-decoration:none; color:inherit; width:100%; background:none; border:0; text-align:left; font:inherit; min-height:64px; transition:background .12s; }
a.item:hover, button.item:hover { background:var(--surface-2); cursor:pointer; }
button.card.item { background:var(--surface); border:1px solid var(--line); transition:transform .15s, box-shadow .15s, border-color .15s; }
button.card.item:hover { transform:translateY(-2px); border-color:var(--brand); background:var(--surface); }
.avatar { width:42px; height:42px; border-radius:14px; display:grid; place-items:center; font-family:var(--display); font-weight:700; font-size:15px; flex:none; background:var(--tint); color:var(--tint-ink); }
.avatar.lg { width:64px; height:64px; border-radius:20px; font-size:23px; }
.badge { display:inline-flex; align-items:center; gap:6px; padding:3px 10px; border-radius:99px; font-size:12.5px; font-weight:700; background:var(--surface-2); color:var(--muted); white-space:nowrap; }
.badge::before { content:""; width:6px; height:6px; border-radius:50%; background:currentColor; opacity:.9; }
.badge.ok { background:var(--ok-bg); color:var(--ok); } .badge.warn { background:var(--warn-bg); color:var(--warn); }
.badge.bad { background:var(--bad-bg); color:var(--bad); } .badge.info { background:var(--info-bg); color:var(--info); }
.note { display:flex; gap:10px; padding:13px 15px; border-radius:14px; background:var(--info-bg); color:var(--info); font-size:14.5px; }
.note.warn { background:var(--warn-bg); color:var(--warn); } .note.bad { background:var(--bad-bg); color:var(--bad); } .note.ok { background:var(--ok-bg); color:var(--ok); }
.kv { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:16px 24px; }
.kv dt { color:var(--muted); font-size:12.5px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; } .kv dd { margin:3px 0 0; overflow-wrap:anywhere; }
dl { margin:0; }

/* the visit time card (caregiver home and visit in progress) */
.ticket { background:var(--spruce); color:var(--on-spruce); border-radius:26px; box-shadow:var(--shadow-lg); background-image:radial-gradient(120% 90% at 100% 0%, var(--spruce-2), transparent 60%); }
.ticket a { color:inherit; }
.ticket-top { padding:24px 24px 22px; display:flex; flex-direction:column; gap:14px; }
.ticket .eyebrow { color:var(--gold); }
.ticket h1, .ticket h2 { font-size:30px; font-weight:700; }
.ticket-time { font-family:var(--display); font-size:54px; font-weight:700; letter-spacing:-.045em; line-height:1; font-variant-numeric:tabular-nums; display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; }
.ticket-time small { font-family:var(--text); font-size:16px; font-weight:600; letter-spacing:0; color:var(--on-spruce-muted); }
.ticket-meta { display:flex; flex-direction:column; gap:8px; color:var(--on-spruce-muted); font-size:15.5px; }
.ticket-meta .row { gap:10px; }
.ticket-cut { position:relative; margin:0 20px; border-top:2px dashed rgba(255,255,255,.22); }
.ticket-cut::before, .ticket-cut::after { content:""; position:absolute; top:-13px; width:24px; height:24px; border-radius:50%; background:var(--bg); }
.ticket-cut::before { left:-32px; } .ticket-cut::after { right:-32px; }
.ticket-bottom { padding:20px 24px 24px; color:var(--on-spruce-muted); font-size:14.5px; }
.timer { font-family:var(--display); font-size:64px; font-weight:700; font-variant-numeric:tabular-nums; letter-spacing:-.045em; line-height:1; }

/* controls */
button { font:inherit; }
.btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; font-weight:650; font-size:15.5px; padding:10px 16px; border-radius:13px; border:1px solid var(--line); background:var(--surface); color:var(--ink); cursor:pointer; min-height:44px; text-decoration:none; white-space:nowrap; box-shadow:var(--shadow-sm); transition:background .15s, border-color .15s, transform .08s, box-shadow .15s; }
.btn:hover { background:var(--surface-2); border-color:color-mix(in srgb,var(--line) 60%,var(--ink)); }
.btn:active { transform:scale(.98); }
.btn.primary { background:var(--brand); color:var(--brand-ink); border-color:var(--brand); box-shadow:0 1px 2px rgba(16,35,31,.2), inset 0 1px 0 rgba(255,255,255,.14); } .btn.primary:hover { background:var(--brand-strong); border-color:var(--brand-strong); }
.btn.cta { background:var(--gold); color:var(--gold-ink); border-color:var(--gold); box-shadow:0 10px 24px -10px rgba(240,178,74,.7), inset 0 1px 0 rgba(255,255,255,.35); } .btn.cta:hover { background:var(--gold-strong); border-color:var(--gold-strong); }
.btn.danger { color:var(--bad); } .btn.ghost { border-color:transparent; background:transparent; box-shadow:none; } .btn.ghost:hover { background:var(--surface-2); }
.btn.big { width:100%; min-height:62px; font-family:var(--display); font-size:21px; font-weight:700; letter-spacing:-.02em; border-radius:18px; }
.btn.icon { padding:10px; min-width:44px; }
.btn:disabled, .btn[aria-busy=true] { opacity:.55; cursor:not-allowed; }
:focus-visible { outline:3px solid color-mix(in srgb,var(--gold) 85%,transparent); outline-offset:2px; }
label.lbl, .lbl { display:block; font-size:13.5px; font-weight:650; margin-bottom:6px; }
.hint { font-size:13.5px; color:var(--muted); margin-top:5px; }
input, select, textarea { width:100%; font:inherit; padding:11px 13px; border:1px solid var(--line); border-radius:13px; background:var(--surface); color:var(--ink); min-height:46px; transition:border-color .15s, box-shadow .15s; }
input:hover, select:hover, textarea:hover { border-color:color-mix(in srgb,var(--line) 50%,var(--muted)); }
input:focus, select:focus, textarea:focus { outline:none; border-color:var(--brand); box-shadow:0 0 0 4px color-mix(in srgb,var(--brand) 18%,transparent); }
input::placeholder, textarea::placeholder { color:var(--muted); opacity:.75; }
textarea { min-height:96px; resize:vertical; }
input[type=checkbox] { width:22px; height:22px; min-height:0; accent-color:var(--brand); flex:none; padding:0; box-shadow:none; }
.fields { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:16px; }
.fields .full { grid-column:1/-1; }
.search { position:relative; max-width:380px; flex:1; min-width:200px; } .search input { padding-left:42px; border-radius:99px; } .search .ic { position:absolute; left:14px; top:13px; color:var(--muted); }
.chips { display:flex; gap:8px; flex-wrap:wrap; }
.chip { padding:8px 14px; border-radius:99px; border:1px solid var(--line); background:var(--surface); font-weight:650; font-size:14px; cursor:pointer; min-height:40px; color:var(--ink); transition:background .12s, color .12s; }
.chip[aria-pressed=true] { background:var(--spruce); border-color:var(--spruce); color:var(--on-spruce); }
.viewswitch { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:3px; padding:3px; border-radius:14px; background:color-mix(in srgb,var(--line) 70%,transparent); }
.viewswitch button { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; min-height:52px; padding:6px 2px; border:0; border-radius:11px; background:transparent; color:var(--muted); font-weight:650; font-size:12.5px; cursor:pointer; transition:background .15s, color .15s; }
.viewswitch button[aria-pressed=true] { background:var(--surface); color:var(--ink); box-shadow:var(--shadow-sm); cursor:default; }
.sidebar .viewswitch button[aria-pressed=true] { background:var(--gold); color:var(--gold-ink); }
.err { color:var(--bad); font-weight:600; font-size:14.5px; }
.checkrow { display:flex; align-items:center; gap:14px; padding:15px 16px; border:1px solid var(--line); border-radius:16px; background:var(--surface); cursor:pointer; min-height:62px; box-shadow:var(--shadow-sm); transition:border-color .15s, background .15s; }
.checkrow:has(input:checked) { border-color:var(--brand); background:var(--tint); box-shadow:none; }
.tabs { display:inline-flex; gap:4px; background:color-mix(in srgb,var(--line) 55%,transparent); border-radius:14px; padding:4px; overflow-x:auto; max-width:100%; margin-bottom:22px; }
.tabs button { background:none; border:0; padding:9px 16px; font-weight:650; font-size:14.5px; color:var(--muted); cursor:pointer; border-radius:10px; white-space:nowrap; min-height:40px; transition:background .15s, color .15s; }
.tabs button[aria-selected=true] { color:var(--ink); background:var(--surface); box-shadow:var(--shadow-sm); }

/* tables */
.tablewrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; font-size:14.5px; }
th { text-align:left; padding:12px 18px; color:var(--muted); font-weight:700; font-size:12px; letter-spacing:.07em; text-transform:uppercase; border-bottom:1px solid var(--line); white-space:nowrap; }
td { padding:14px 18px; border-bottom:1px solid var(--line); vertical-align:middle; }
tr:last-child td { border-bottom:0; }
tr.click { cursor:pointer; } tr.click:hover td { background:var(--surface-2); }
td.r, th.r { text-align:right; font-variant-numeric:tabular-nums; }

/* schedule week */
.week { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:10px; }
.day { background:var(--surface); border:1px solid var(--line); border-radius:16px; padding:10px; min-height:170px; display:flex; flex-direction:column; gap:8px; box-shadow:var(--shadow-sm); }
.day.today { border-color:var(--spruce); box-shadow:0 0 0 1px var(--spruce) inset, var(--shadow); }
.day .dhead { display:flex; justify-content:space-between; align-items:baseline; font-family:var(--display); font-weight:700; font-size:15px; padding:2px 2px 4px; }
.day .dhead .muted { font-family:var(--text); font-weight:600; font-size:13px; }
.shift { display:block; width:100%; text-align:left; border:0; border-left:3px solid var(--brand); background:var(--tint); color:var(--tint-ink); border-radius:10px; padding:8px 10px; font:inherit; font-size:13px; cursor:pointer; transition:transform .12s, box-shadow .12s; }
.shift:hover { transform:translateY(-1px); box-shadow:var(--shadow-sm); }
.shift.completed { border-left-color:var(--ok); background:var(--ok-bg); color:var(--ok); } .shift.missed { border-left-color:var(--bad); background:var(--bad-bg); color:var(--bad); }
.shift.in_progress { border-left-color:var(--gold-strong); background:var(--warn-bg); color:var(--warn); } .shift.cancelled { border-left-color:var(--line); background:var(--surface-2); color:var(--muted); text-decoration:line-through; }
@media (max-width: 1100px) { .week { grid-template-columns:1fr; } .day { min-height:0; } }

/* dialogs & toasts */
dialog { border:0; padding:0; border-radius:24px; background:var(--surface); color:var(--ink); width:min(560px,calc(100vw - 24px)); max-height:calc(100dvh - 24px); box-shadow:var(--shadow-lg); }
dialog[open] { animation:pop .2s cubic-bezier(.2,.8,.2,1); }
@keyframes pop { from { opacity:0; transform:translateY(10px) scale(.98); } }
dialog.wide { width:min(840px,calc(100vw - 24px)); }
dialog::backdrop { background:rgba(8,18,16,.55); backdrop-filter:blur(3px); }
.dlg { display:flex; flex-direction:column; max-height:calc(100dvh - 24px); }
.dlg header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:20px 22px 14px; }
.dlg header h2 { font-size:22px; }
.dlg .body { padding:6px 22px 22px; overflow-y:auto; display:flex; flex-direction:column; gap:16px; }
.dlg footer { display:flex; justify-content:flex-end; gap:10px; padding:14px 22px; border-top:1px solid var(--line); background:var(--surface-2); flex-wrap:wrap; border-radius:0 0 24px 24px; }
@media (max-width: 560px) {
  /* dialogs become bottom sheets */
  dialog, dialog.wide { width:100%; max-width:100%; margin:auto 0 0; border-radius:24px 24px 0 0; max-height:92dvh; }
  dialog[open] { animation:sheet .26s cubic-bezier(.2,.8,.2,1); }
  .dlg { max-height:92dvh; }
  .dlg footer { border-radius:0; padding-bottom:calc(14px + env(safe-area-inset-bottom)); }
  .dlg footer > .btn { flex:1 1 auto; } .dlg footer > .grow { display:none; } .dlg footer > .row { width:100%; } .dlg footer > .row > .btn { flex:1 1 auto; }
}
@keyframes sheet { from { transform:translateY(40px); opacity:.6; } }
.toasts { position:fixed; left:50%; transform:translateX(-50%); bottom:calc(104px + env(safe-area-inset-bottom)); display:flex; flex-direction:column; gap:8px; z-index:100; width:min(440px,calc(100vw - 24px)); }
.toast { background:var(--spruce); color:var(--on-spruce); padding:13px 16px; border-radius:16px; font-weight:600; box-shadow:var(--shadow-lg); display:flex; gap:10px; align-items:flex-start; animation:rise .25s ease both; }
.toast .ic { color:var(--gold); margin-top:1px; }
.toast.warn { background:var(--warn-bg); color:var(--warn); } .toast.bad { background:var(--bad-bg); color:var(--bad); }
.toast.warn .ic, .toast.bad .ic { color:inherit; }

/* sign-in and demo landing */
.login { min-height:100dvh; display:grid; grid-template-columns:minmax(0,1.05fr) minmax(0,1fr); }
.login .pitch { background:var(--spruce); color:var(--on-spruce); padding:clamp(28px,5vw,64px); display:flex; flex-direction:column; justify-content:space-between; gap:40px; background-image:radial-gradient(90% 70% at 100% 0%, var(--spruce-2), transparent 65%); }
.login .pitch h1 { font-size:clamp(40px,5.2vw,68px); font-weight:700; letter-spacing:-.04em; line-height:1; }
.login .pitch h1 em { font-style:normal; color:var(--gold); }
.login .pitch p { color:var(--on-spruce-muted); font-size:18px; max-width:34ch; }
.login .pitch .brand { padding:0; }
.login .pitch ul { list-style:none; margin:0; padding:0; display:grid; gap:12px; color:var(--on-spruce); font-weight:550; }
.login .pitch li { display:flex; gap:12px; align-items:center; } .login .pitch li .ic { color:var(--gold); }
.login .side { display:grid; place-items:center; padding:32px 16px; }
.login .box { width:min(440px,100%); }
@media (max-width: 860px) { .login { grid-template-columns:1fr; } .login .pitch { gap:24px; padding:28px 20px 32px; } .login .pitch ul { display:none; } .login .pitch h1 { font-size:40px; } .login .side { padding:24px 16px 40px; place-items:start center; } }

/* misc */
canvas.sig { width:100%; height:150px; border:2px dashed var(--line); border-radius:16px; background:#fff; touch-action:none; display:block; }
img.sigimg { max-width:100%; height:90px; background:#fff; border:1px solid var(--line); border-radius:12px; object-fit:contain; }
.secret { font-family:ui-monospace,Consolas,monospace; font-size:17px; letter-spacing:.08em; padding:14px; background:var(--surface-2); border:1px dashed var(--line); border-radius:14px; overflow-wrap:anywhere; user-select:all; }
.skel { height:92px; border-radius:var(--radius); background:linear-gradient(90deg,var(--surface) 0%,var(--surface-2) 50%,var(--surface) 100%); background-size:200% 100%; animation:sh 1.2s infinite linear; border:1px solid var(--line); }
@keyframes sh { to { background-position:-200% 0; } }
.sr { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }

@media print {
  .sidebar, .topbar, .tabbar, .toasts, .noprint { display:none !important; }
  .content { margin:0 !important; padding:0 !important; } body { background:#fff; }
  .card, .grid.c4 { box-shadow:none; break-inside:avoid; } .page > * { animation:none; }
  body:has(dialog[open]) .shell { display:none; }
  dialog[open] { position:static; width:100%; max-height:none; box-shadow:none; animation:none; } .dlg, .dlg .body { max-height:none; overflow:visible; }
}
