/* app.css — CarePortal
 *
 * Frosted glass on a white page, lit by faint blush light; pink accents.
 * Names of people are set in Newsreader; everything else in Instrument Sans.
 * Hierarchy comes from glass weight: the hero is the heaviest pane,
 * panels are lighter, rows inside panels are bare with hairline rules.
 */

/* ── Tokens ─────────────────────────────────────────────────────────── */
:root {
    --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
    --sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

    /* White page, pink accents. The washes are faint blush light behind the glass. */
    --sky: #ffffff;
    --wash-1: #ffd6e8;   /* blush */
    --wash-2: #f6dcff;   /* orchid */
    --wash-3: #ffe4d6;   /* peach */
    --wash-4: #ffe3f0;   /* rose */

    --ink: #2a1420;
    --ink-2: #4e3341;
    --muted: #8b6476;
    --hair: rgba(110, 30, 70, 0.09);
    --hair-strong: rgba(110, 30, 70, 0.17);

    --accent: #db2777;
    --accent-hover: #be185d;
    --accent-ink: #ffffff;
    --accent-soft: rgba(219, 39, 119, 0.09);
    --focus: rgba(219, 39, 119, 0.38);

    --warn: #9a5a06;
    --warn-bg: rgba(242, 178, 76, 0.18);
    --warn-edge: rgba(201, 132, 23, 0.42);
    --danger: #c0262d;
    --danger-soft: rgba(192, 38, 45, 0.09);

    --glass: rgba(255, 255, 255, 0.6);
    --glass-strong: rgba(255, 255, 255, 0.8);
    --glass-input: rgba(255, 255, 255, 0.78);
    --glass-edge: rgba(255, 255, 255, 0.95);
    --glass-shine: rgba(255, 255, 255, 1);
    --glass-shadow: 0 1px 0 var(--glass-shine) inset, 0 0 0 1px rgba(219, 39, 119, 0.05), 0 20px 50px -28px rgba(160, 30, 90, 0.3), 0 2px 6px -2px rgba(160, 30, 90, 0.07);
    --menu-bg: rgba(255, 255, 255, 0.92);
    --blur: blur(22px) saturate(1.4);

    --ev-appointment: #2563eb;
    --ev-medication: #db2777;
    --ev-family: #7c3aed;
    --ev-financial: #c98417;
    --ev-deadline: #b91c1c;
    --ev-task: #0d9488;
    --ev-meal: #ea580c;
    --ev-sleep: #6366f1;
    --ev-activity: #0891b2;
    --ev-routine: #8b5e3c;
    --ok: #16a34a;
    --series-1: #db2777;
    --series-2: #2563eb;

    --r-s: 10px;
    --r-m: 16px;
    --r-l: 22px;
    --r-xl: 30px;
    --pill: 999px;
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    --page: 76rem;
}

:root[data-theme="dark"] {
    --sky: #150a10;
    --wash-1: #4a1230;
    --wash-2: #2c1340;
    --wash-3: #3e2016;
    --wash-4: #3a0f2a;
    --ink: #fbe9f2;
    --ink-2: #e2c4d3;
    --muted: #b88aa1;
    --hair: rgba(255, 255, 255, 0.08);
    --hair-strong: rgba(255, 255, 255, 0.16);
    --accent: #f472b6;
    --accent-hover: #f9a8d4;
    --accent-ink: #3d0a22;
    --accent-soft: rgba(244, 114, 182, 0.15);
    --focus: rgba(244, 114, 182, 0.5);
    --warn: #f4bb5e;
    --warn-bg: rgba(242, 178, 76, 0.13);
    --warn-edge: rgba(242, 178, 76, 0.42);
    --danger: #ff8a8a;
    --danger-soft: rgba(255, 138, 138, 0.13);
    --glass: rgba(255, 255, 255, 0.055);
    --glass-strong: rgba(255, 255, 255, 0.085);
    --glass-input: rgba(0, 0, 0, 0.24);
    --glass-edge: rgba(255, 255, 255, 0.12);
    --glass-shine: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 1px 0 var(--glass-shine) inset, 0 24px 60px -30px rgba(0, 0, 0, 0.8);
    --menu-bg: rgba(36, 16, 27, 0.9);
    --ev-appointment: #60a5fa;
    --ev-medication: #f472b6;
    --ev-family: #c4a1ff;
    --ev-financial: #f4bb5e;
    --ev-deadline: #ff8a8a;
    --ev-task: #5eead4;
    --ev-meal: #fb923c;
    --ev-sleep: #a5b4fc;
    --ev-activity: #67e8f9;
    --ev-routine: #d6a77a;
    --ok: #4ade80;
    --series-1: #ec4899;
    --series-2: #3b82f6;
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
    --sky: #150a10;
        --wash-1: #4a1230;
        --wash-2: #2c1340;
        --wash-3: #3e2016;
        --wash-4: #3a0f2a;
        --ink: #fbe9f2;
        --ink-2: #e2c4d3;
        --muted: #b88aa1;
        --hair: rgba(255, 255, 255, 0.08);
        --hair-strong: rgba(255, 255, 255, 0.16);
        --accent: #f472b6;
        --accent-hover: #f9a8d4;
        --accent-ink: #3d0a22;
        --accent-soft: rgba(244, 114, 182, 0.15);
        --focus: rgba(244, 114, 182, 0.5);
        --warn: #f4bb5e;
        --warn-bg: rgba(242, 178, 76, 0.13);
        --warn-edge: rgba(242, 178, 76, 0.42);
        --danger: #ff8a8a;
        --danger-soft: rgba(255, 138, 138, 0.13);
        --glass: rgba(255, 255, 255, 0.055);
        --glass-strong: rgba(255, 255, 255, 0.085);
        --glass-input: rgba(0, 0, 0, 0.24);
        --glass-edge: rgba(255, 255, 255, 0.12);
        --glass-shine: rgba(255, 255, 255, 0.08);
        --glass-shadow: 0 1px 0 var(--glass-shine) inset, 0 24px 60px -30px rgba(0, 0, 0, 0.8);
        --menu-bg: rgba(36, 16, 27, 0.9);
        --ev-appointment: #60a5fa;
        --ev-medication: #f472b6;
        --ev-family: #c4a1ff;
        --ev-financial: #f4bb5e;
        --ev-deadline: #ff8a8a;
        --ev-task: #5eead4;
        --ev-meal: #fb923c;
        --ev-sleep: #a5b4fc;
        --ev-activity: #67e8f9;
        --ev-routine: #d6a77a;
        --ok: #4ade80;
        --series-1: #ec4899;
        --series-2: #3b82f6;
        color-scheme: dark;
    }
}

/* ── Base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }
body {
    margin: 0;
    min-height: 100vh;
    font: 400 1rem/1.55 var(--sans);
    color: var(--ink);
    background: var(--sky);
    -webkit-font-smoothing: antialiased;
}
body::before {
    content: "";
    position: fixed;
    inset: -10vmax;
    z-index: -1;
    background:
        radial-gradient(38vmax 32vmax at 12% 8%, var(--wash-1), transparent 70%),
        radial-gradient(34vmax 30vmax at 92% 14%, var(--wash-2), transparent 70%),
        radial-gradient(40vmax 30vmax at 78% 92%, var(--wash-3), transparent 70%),
        radial-gradient(30vmax 26vmax at 6% 86%, var(--wash-4), transparent 70%),
        radial-gradient(26vmax 22vmax at 48% 52%, color-mix(in srgb, var(--wash-1) 55%, transparent), transparent 70%);
    filter: saturate(1.05);
}
h1, h2, h3, p, dl, dd, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration-color: var(--hair-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }

[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; }
.skip:focus { left: 12px; padding: 8px 14px; background: var(--glass-strong); border-radius: var(--r-s); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript { padding: 40px; text-align: center; }

.ico { width: 1.1em; height: 1.1em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── Glass ──────────────────────────────────────────────────────────── */
.glass {
    background: var(--glass);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    border: 1px solid var(--glass-edge);
    box-shadow: var(--glass-shadow);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .glass { background: var(--glass-strong); }
}

/* ── Type ───────────────────────────────────────────────────────────── */
.display {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.1rem);
    line-height: 1.12;
    letter-spacing: -0.01em;
    font-optical-sizing: auto;
}
.display-l { font-size: clamp(2rem, 1.5rem + 2vw, 2.9rem); }
.display-xl { font-size: clamp(2.4rem, 1.6rem + 3.4vw, 4.1rem); line-height: 1.02; letter-spacing: -0.02em; }
.lede { font-size: 1.125rem; color: var(--ink-2); max-width: 62ch; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.label { font-size: 0.8125rem; font-weight: 500; color: var(--muted); }
.section-title { font-family: var(--serif); font-weight: 400; font-size: 1.5rem; letter-spacing: -0.005em; }
.panel-title { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Layout ─────────────────────────────────────────────────────────── */
.view { outline: none; min-height: calc(100vh - 120px); }
.page { width: min(var(--page), 100% - 32px); margin: 0 auto; padding: 28px 0 96px; display: grid; gap: 24px; align-content: start; }
.page.narrow { width: min(46rem, 100% - 32px); }
.page-head { display: grid; gap: 8px; padding: 12px 4px 4px; }
.block { display: grid; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr)); gap: 20px; align-items: start; }
.row-gap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row-gap.end { justify-content: flex-end; }
.stack { display: grid; gap: 12px; }
.stack > .btn { justify-self: start; }
.grow { flex: 1; min-width: 0; }
.span-all { grid-column: 1 / -1; }
.section-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.section-head > :first-child { margin-right: auto; }
.empty { color: var(--muted); padding: 10px 0; }
.empty-page { text-align: left; padding-top: 12vh; }

.panel { border-radius: var(--r-l); padding: 20px 22px; display: grid; gap: 14px; align-content: start; min-width: 0; }
.hero { border-radius: var(--r-xl); padding: clamp(22px, 3vw, 36px); background: var(--glass-strong); }

/* ── Navigation ─────────────────────────────────────────────────────── */
.nav { position: sticky; top: 0; z-index: 40; padding: 12px 16px 0; }
.nav-bar {
    width: min(var(--page), 100%);
    margin: 0 auto;
    border-radius: var(--pill);
    padding: 6px 8px 6px 18px;
    display: flex; align-items: center; gap: 12px;
    background: var(--glass-strong);
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-family: var(--serif); font-size: 1.2rem; text-decoration: none; margin-right: 8px; white-space: nowrap; }
.brand-mark { width: 18px; height: 18px; border-radius: 50%; border: 4px solid var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.nav-links { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-link {
    padding: 7px 14px; border-radius: var(--pill); text-decoration: none; white-space: nowrap;
    color: var(--ink-2); background: none; border: 0; cursor: pointer; font-weight: 500; font-size: 0.9375rem;
}
.nav-link:hover { background: var(--accent-soft); color: var(--ink); }
.nav-link[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.nav-actions { display: flex; align-items: center; gap: 4px; }
.icon-btn, .avatar-btn {
    position: relative; display: grid; place-items: center; width: 38px; height: 38px;
    border-radius: 50%; border: 0; background: none; cursor: pointer; color: var(--ink-2);
}
.icon-btn:hover, .avatar-btn:hover { background: var(--accent-soft); }
.badge {
    position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px;
    border-radius: var(--pill); background: var(--accent); color: var(--accent-ink);
    font-size: 0.6875rem; font-weight: 600; display: grid; place-items: center;
}

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 18px; border-radius: var(--pill); border: 1px solid transparent;
    background: var(--accent); color: var(--accent-ink); font-weight: 500; font-size: 0.9375rem;
    text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: background 0.15s, transform 0.1s, opacity 0.15s;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.is-busy { opacity: 0.7; cursor: progress; }
.btn-sm { padding: 6px 13px; font-size: 0.875rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-quiet { background: var(--glass-input); color: var(--ink); border-color: var(--hair-strong); }
.btn-quiet:hover { background: var(--glass-strong); }
.btn-text { background: none; color: var(--muted); padding: 4px 8px; border-radius: var(--r-s); }
.btn-text:hover { background: var(--accent-soft); color: var(--ink); }
.btn-text.danger:hover, .btn-text.danger.is-armed { color: var(--danger); background: var(--danger-soft); }
.btn.is-armed:not(.btn-text) { background: var(--danger); color: #fff; }
.btn-warn { background: var(--warn); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger); filter: brightness(1.08); }
.record-actions { display: flex; gap: 6px; width: 100%; justify-content: flex-end; }
.btn-delete { background: none; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-delete:hover { background: var(--danger-soft); }
.btn-delete.is-armed { background: var(--danger); color: #fff; }
@media (max-width: 640px) { .record-actions { justify-content: flex-start; } }
.icon-btn-chip { width: 32px; height: 32px; border: 1px solid var(--hair-strong); background: var(--glass-input); }
:root[data-theme="dark"] .btn-warn { color: #241500; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-warn { color: #241500; } }
.btn-warn:hover { background: var(--warn); filter: brightness(1.08); }

/* ── Avatars, chips, dots ───────────────────────────────────────────── */
.avatar {
    display: inline-grid; place-items: center; flex: none; overflow: hidden; border-radius: 50%;
    background: linear-gradient(140deg, var(--wash-1), var(--wash-2));
    color: var(--accent-hover); font-weight: 600; border: 1px solid var(--glass-edge);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-s { width: 28px; height: 28px; font-size: 0.6875rem; }
.avatar-m { width: 38px; height: 38px; font-size: 0.8125rem; }
.avatar-l { width: 52px; height: 52px; font-size: 1.05rem; font-family: var(--serif); font-weight: 500; }
.avatar-xl { width: clamp(64px, 9vw, 96px); height: clamp(64px, 9vw, 96px); font-size: clamp(1.4rem, 2.6vw, 2rem); font-family: var(--serif); font-weight: 400; }

.chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
    border-radius: var(--pill); border: 1px solid var(--hair-strong);
    background: var(--glass-input); font-size: 0.875rem; font-weight: 500; white-space: nowrap;
    color: var(--ink-2);
}
button.chip { cursor: pointer; }
button.chip:hover { border-color: var(--accent); color: var(--ink); }
.kind-chips button.chip::after, button.chip-add::after { display: none; }
button.chip::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); opacity: 0.55; margin-left: 2px; }
.chip-sm { padding: 3px 10px; font-size: 0.8125rem; }
.chip-role { background: none; }
.chip-warn { color: var(--warn); border-color: var(--warn-edge); background: var(--warn-bg); }
.chip-ok { color: var(--accent); border-color: transparent; background: var(--accent-soft); margin-left: 8px; }
.chip-vis { color: var(--muted); }
.chip-x { border: 0; background: none; padding: 0; cursor: pointer; color: var(--muted); display: grid; }
.chip.ed-saving { opacity: 0.6; }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; background: var(--muted); }
.dot-appointment { background: var(--ev-appointment); }
.dot-medication { background: var(--ev-medication); }
.dot-family_visit { background: var(--ev-family); }
.dot-financial { background: var(--ev-financial); }
.dot-deadline { background: var(--ev-deadline); }
.dot-task { background: var(--ev-task); }
.dot-meal { background: var(--ev-meal); }
.dot-sleep { background: var(--ev-sleep); }
.dot-activity { background: var(--ev-activity); }
.dot-routine { background: var(--ev-routine); }
.dot-danger { background: var(--danger); }
.dot-medication { box-shadow: 0 0 0 2px var(--accent-soft); }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-muted { background: var(--hair-strong); }

/* ── Inline editing ─────────────────────────────────────────────────
 * Editable text looks like text. On hover it gains a soft wash and a
 * dotted rule; while editing it becomes a glass field in place.        */
.ed:not(.ed-static) {
    cursor: text;
    border-radius: 6px;
    padding: 0 3px;
    margin: 0 -3px;
    background-image: linear-gradient(to right, var(--hair-strong) 40%, transparent 0);
    background-size: 5px 1px;
    background-repeat: repeat-x;
    background-position: 0 100%;
    transition: background-color 0.15s, box-shadow 0.15s;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}
.ed:not(.ed-static):hover { background-color: var(--accent-soft); background-image: linear-gradient(to right, var(--accent) 40%, transparent 0); }
.ed.ed-on {
    background: var(--glass-input);
    background-image: none;
    box-shadow: 0 0 0 2px var(--focus);
    outline: none;
    cursor: text;
}
.ed-empty::before { content: attr(data-placeholder); color: var(--muted); font-style: normal; }
.ed-empty.ed-on::before { content: ""; }
.ed-hide { display: none; }
.ed-longtext { white-space: pre-wrap; display: inline-block; min-width: 4ch; }
p.ed-longtext, h1.ed, h3.ed { display: block; }
.ed-saving { opacity: 0.55; }
.ed-saved { box-shadow: 0 0 0 2px var(--accent-soft); background-color: var(--accent-soft); }
.ed-control {
    font: inherit; color: inherit; padding: 2px 6px; margin: -3px 0;
    border-radius: 8px; border: 1px solid var(--accent); background: var(--glass-strong);
    box-shadow: 0 0 0 3px var(--focus); max-width: 100%;
}
.display .ed-control, h1 .ed-control { font-size: 0.6em; }
.is-overdue { color: var(--danger); }

/* ── Menus ──────────────────────────────────────────────────────────── */
.menu {
    position: absolute; z-index: 80; min-width: 200px; max-width: min(360px, 100vw - 24px);
    padding: 6px; border-radius: var(--r-m);
    background: var(--menu-bg);
    -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6);
    border: 1px solid var(--glass-edge);
    box-shadow: 0 18px 48px -12px rgba(0, 0, 0, 0.28);
    animation: pop 0.14s var(--ease);
    display: grid; gap: 1px;
}
.menu-wide { min-width: 300px; }
.menu hr { border: 0; border-top: 1px solid var(--hair); margin: 5px 4px; }
.menu-heading { padding: 6px 10px 4px; font-size: 0.8125rem; color: var(--muted); font-weight: 500; }
.menu-item {
    display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
    padding: 8px 10px; border: 0; border-radius: 10px; background: none; cursor: pointer; font-size: 0.9375rem;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--accent-soft); outline: none; }
.menu-item.is-current { font-weight: 600; }
.menu-item.is-current::after { content: "✓"; margin-left: auto; color: var(--accent); }
.menu-item.danger { color: var(--danger); }
.menu-hint { margin-left: auto; color: var(--muted); font-size: 0.8125rem; padding-left: 12px; text-align: right; }
.menu-item.is-current .menu-hint { margin-left: 8px; }
.menu-check { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 10px; cursor: pointer; font-size: 0.9375rem; }
.menu-check:hover { background: var(--accent-soft); }
.menu-check input { accent-color: var(--accent); width: 16px; height: 16px; }
.menu-people { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 8px; }
.menu-add { padding: 4px 6px 6px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }

/* ── Forms ──────────────────────────────────────────────────────────── */
.input {
    width: 100%; min-width: 0; padding: 10px 14px; border-radius: 12px;
    border: 1px solid var(--hair-strong); background: var(--glass-input);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.input::placeholder { color: var(--muted); }
.input-sm { padding: 6px 10px; font-size: 0.875rem; width: auto; }
select.input { cursor: pointer; }
textarea.input { resize: vertical; line-height: 1.5; }
.field { display: grid; gap: 6px; font-size: 0.875rem; font-weight: 500; color: var(--ink-2); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr)); gap: 14px; }
.form-error { color: var(--danger); font-size: 0.9rem; }
.check { accent-color: var(--accent); width: 18px; height: 18px; cursor: pointer; flex: none; }
.check-line { display: flex; gap: 8px; align-items: center; font-size: 0.9rem; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 12px; }
legend { display: flex; align-items: center; gap: 8px; font-weight: 600; padding: 0; margin-bottom: 10px; width: 100%; }
legend .chip { margin-left: auto; font-weight: 500; }

.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.quick > .input { flex: 1 1 10rem; }
.quick > .btn { flex: none; }
.quick-stack { display: grid; grid-template-columns: 1fr auto; }
.quick-stack > .input:first-child { grid-column: 1 / -1; }
.quick-wrap { padding-top: 4px; }
.quick-wrap > .input:first-child { flex: 2 1 14rem; }

.switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--muted); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 30px; height: 18px; border-radius: var(--pill); background: var(--hair-strong); position: relative; transition: background 0.15s; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform 0.18s var(--ease); }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(12px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--focus); }

.choices { display: grid; gap: 8px; }
.choice { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--hair-strong); cursor: pointer; background: var(--glass-input); }
.choice:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.choice input { accent-color: var(--accent); }

/* ── Rows and lists ─────────────────────────────────────────────────── */
.rows { display: grid; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 11px 0; border-top: 1px solid var(--hair); min-width: 0; }
.row:first-child { border-top: 0; }
.row > .grow { flex: 1 1 9rem; }
.row-link a { text-decoration: none; }
.row-link:hover { background: linear-gradient(90deg, transparent, var(--accent-soft), transparent); }
.money { font-variant-numeric: tabular-nums; font-weight: 500; }

.facts { display: grid; grid-template-columns: minmax(8rem, auto) 1fr; gap: 9px 16px; align-items: start; }
.facts dt { padding-top: 2px; }
.facts dt { color: var(--muted); font-size: 0.875rem; }
.facts dd { min-width: 0; overflow-wrap: anywhere; }

.more summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; padding: 4px 0; list-style: none; display: flex; align-items: center; gap: 6px; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s; }
.more[open] summary::before { transform: rotate(45deg); }
.more[open] > :not(summary) { margin-top: 12px; }

/* tasks */
.tasks { display: grid; }
.task { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-top: 1px solid var(--hair); }
.task:first-child { border-top: 0; }
.task .check { margin-top: 3px; }
.task-title { font-weight: 500; }
.task.is-done .task-title { text-decoration: line-through; color: var(--muted); }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 0.8125rem; color: var(--muted); margin-top: 2px; }
.task-meta a { color: var(--ink-2); }
.task > .btn-text { opacity: 0; transition: opacity 0.15s; }
.task:hover > .btn-text, .task > .btn-text:focus-visible, .task > .btn-text.is-armed { opacity: 1; }

/* events */
.events { display: grid; }
.event { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--hair); flex-wrap: wrap; }
.event:first-child { border-top: 0; }
.event-when { font-variant-numeric: tabular-nums; font-size: 0.875rem; color: var(--ink-2); min-width: 9.5rem; }
.event-title { font-weight: 500; }
.event.is-done .event-title { text-decoration: line-through; color: var(--muted); }
.event > .btn-text { opacity: 0; }
.event:hover > .btn-text, .event > .btn-text:focus-visible, .event > .btn-text.is-armed { opacity: 1; }
.day + .day { margin-top: 10px; }
.day-label { font-size: 0.8125rem; font-weight: 600; color: var(--muted); padding-bottom: 2px; }

/* people + homes */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr)); gap: 14px; }
.person, .home-card, .shop-card {
    display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px;
    border-radius: var(--r-l); text-decoration: none; transition: transform 0.15s var(--ease), background 0.15s;
}
.person:hover, .home-card:hover, .shop-card:hover { background: var(--glass-strong); transform: translateY(-1px); }
.person .grow { display: grid; gap: 3px; }
.person-name { font-family: var(--serif); font-size: 1.3rem; line-height: 1.2; }
.person.is-inactive { opacity: 0.7; }
.homes, .shops { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr)); gap: 14px; }
.home-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); flex: none; }
.home-ico .ico { width: 22px; height: 22px; }
.home-ico-l { width: 64px; height: 64px; border-radius: 20px; }
.home-ico-l .ico { width: 30px; height: 30px; }
.start .quick { margin-top: 4px; }

/* ── Heroes ─────────────────────────────────────────────────────────── */
.home-hero, .shop-hero { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.home-hero .grow, .shop-hero .grow { display: grid; gap: 8px; }
.facts-inline { display: flex; flex-wrap: wrap; gap: 6px 20px; color: var(--ink-2); }
.about { color: var(--ink-2); max-width: 70ch; }
.hero-side { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }

/* The patient hero is the heaviest pane on the site. */
.patient-hero { display: grid; gap: 22px; position: relative; overflow: hidden; }
.patient-hero::after {
    content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
    background: radial-gradient(60% 90% at 0% 0%, var(--glass-shine), transparent 60%);
    opacity: 0.55;
}
.patient-hero > * { position: relative; z-index: 1; }
.hero-top { display: flex; gap: clamp(14px, 2.5vw, 24px); align-items: center; flex-wrap: wrap; }
.hero-top > .grow { flex: 1 1 16rem; }
.hero-top .hero-side { align-self: flex-start; }
.name { overflow-wrap: anywhere; }
.goes-by { margin-top: 6px; font-family: var(--serif); font-style: italic; font-size: 1.15rem; color: var(--ink-2); }
.facts-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 14px 24px; padding-top: 18px; border-top: 1px solid var(--hair); }
.facts-row dt { font-size: 0.8125rem; color: var(--muted); margin-bottom: 2px; }
.facts-row dd { font-weight: 500; }
.flags { display: flex; flex-wrap: wrap; gap: 8px; }
.flag { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: var(--pill); background: var(--glass-input); border: 1px solid var(--hair-strong); font-weight: 500; font-size: 0.9375rem; }
.flag-warn { background: var(--warn-bg); border-color: var(--warn-edge); color: var(--warn); }
.about-wrap { display: grid; gap: 6px; max-width: 72ch; }
.about-wrap .about { font-family: var(--serif); font-size: 1.15rem; line-height: 1.6; }

/* ── Patient layout ─────────────────────────────────────────────────── */
.patient-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.col-main, .col-side { display: grid; gap: 20px; min-width: 0; }
@media (max-width: 980px) { .patient-grid { grid-template-columns: 1fr; } }

/* Developer acknowledgement — inline, not a popup */
.dev-strip {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    padding: 14px 16px 14px 18px;
    border-radius: var(--r-l);
    background: linear-gradient(100deg, var(--warn-bg), transparent 85%), var(--glass);
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    border: 1px solid var(--warn-edge);
    box-shadow: 0 1px 0 var(--glass-shine) inset, 0 16px 40px -24px rgba(154, 90, 6, 0.55);
    animation: strip-in 0.4s var(--ease);
    transition: opacity 0.25s, transform 0.25s var(--ease);
}
.dev-strip .grow { flex: 1 1 22rem; }
.dev-strip-ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--warn-bg); color: var(--warn); flex: none; }
.dev-strip-title { font-weight: 600; color: var(--warn); }
.dev-strip p:not(.dev-strip-title) { font-size: 0.9375rem; color: var(--ink-2); max-width: 75ch; }
.dev-strip.is-acked { opacity: 0; transform: translateY(-6px); }
@keyframes strip-in { from { opacity: 0; transform: translateY(-8px); } }
.veiled { filter: blur(3px); opacity: 0.55; pointer-events: none; user-select: none; }
.ghost-block { min-height: 160px; }
.ghost-block.tall { min-height: 320px; }

/* Notes */
.composer { display: grid; border-radius: var(--r-m); border: 1px solid var(--hair-strong); background: var(--glass-input); overflow: hidden; transition: border-color 0.15s, box-shadow 0.15s; }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.composer-text { border: 0; background: none; border-radius: 0; box-shadow: none !important; padding: 14px 16px; }
.composer-bar { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-top: 1px solid var(--hair); }
.composer-bar .btn { margin-left: auto; }
.hint-keys { margin-left: auto; }
.hint-keys + .btn { margin-left: 0; }
@media (hover: none) { .hint-keys { display: none; } .composer-bar .btn { margin-left: auto; } }
.note-list { display: grid; }
.note { padding: 16px 0 16px 16px; border-top: 1px solid var(--hair); position: relative; display: grid; gap: 8px; }
.note::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 3px; border-radius: 3px; background: var(--hair-strong); }
.note.vis-provider_only::before { background: var(--ev-financial); }
.note.vis-care_team_visible::before { background: var(--ev-appointment); }
.note.vis-family_visible::before { background: var(--ok); }
.note-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.note-by { font-weight: 600; font-size: 0.9375rem; }
.note-body { font-size: 1rem; line-height: 1.6; }
.note-history { display: grid; gap: 10px; padding: 12px 14px; border-radius: var(--r-m); background: var(--glass-input); }
.note-old p:last-child { color: var(--ink-2); white-space: pre-wrap; }

/* Protected */
.protected { border-color: var(--hair-strong); }
.secret-slot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.secret { letter-spacing: 0.12em; color: var(--muted); font-variant-numeric: tabular-nums; }
.secret.is-empty { letter-spacing: 0; font-size: 0.9rem; }
.secret-open { font-variant-numeric: tabular-nums; font-weight: 500; }

/* Activity */
.activity { display: grid; gap: 0; }
.activity li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--hair); font-size: 0.9rem; }
.activity li:first-child { border-top: 0; }
.activity li.is-sensitive strong { color: var(--warn); }
.activity-panel summary { cursor: pointer; list-style: none; }
.activity-panel summary::-webkit-details-marker { display: none; }

/* Admission */
.admit { gap: 22px; }

/* ── Landing + auth ─────────────────────────────────────────────────── */
.landing { gap: 56px; padding-top: 6vh; }
.landing-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr); gap: 48px; align-items: center; }
.landing-copy { display: grid; gap: 22px; }
@media (max-width: 860px) { .landing-grid { grid-template-columns: 1fr; } }
.hero-sample { border-radius: var(--r-xl); padding: 26px; display: grid; gap: 16px; transform: rotate(1.2deg); background: var(--glass-strong); }
.sample-head { display: flex; gap: 14px; align-items: center; }
.sample-name { font-family: var(--serif); font-size: 1.6rem; line-height: 1.1; }
.sample-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--hair); }
.sample-list li span:last-child { margin-left: auto; font-size: 0.875rem; }
.sample-note { margin: 0; display: grid; gap: 4px; }
.sample-note blockquote { margin: 0; font-family: var(--serif); font-size: 1.1rem; font-style: italic; line-height: 1.5; }
.landing-points { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr)); gap: 28px; padding-top: 28px; border-top: 1px solid var(--hair); }
.landing-points h2 { font-family: var(--serif); font-weight: 400; font-size: 1.35rem; margin-bottom: 6px; }
.landing-foot { font-size: 0.9375rem; }
.auth { justify-items: center; padding-top: 7vh; }
.auth-card { width: min(26rem, 100%); border-radius: var(--r-xl); padding: 32px; display: grid; gap: 16px; background: var(--glass-strong); }

/* ── Shop ───────────────────────────────────────────────────────────── */
.shop-mine { text-decoration: none; }
.shop-mine:hover { background: var(--glass-strong); }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: var(--pill); width: fit-content; background: var(--glass); border: 1px solid var(--glass-edge); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.tab { padding: 7px 16px; border-radius: var(--pill); text-decoration: none; font-weight: 500; color: var(--ink-2); font-size: 0.9375rem; }
.tab:hover { background: var(--accent-soft); }
.tab[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.bag[hidden] { display: none; }
.bag-count { min-width: 20px; height: 20px; border-radius: var(--pill); background: var(--accent); color: var(--accent-ink); font-size: 0.75rem; display: grid; place-items: center; padding: 0 5px; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(16.5rem, 100%), 1fr)); gap: 18px; }
.product { border-radius: var(--r-l); overflow: hidden; display: grid; grid-template-rows: auto 1fr; }
.product.is-hidden .product-img { opacity: 0.5; }
.product-img { aspect-ratio: 4 / 3; display: grid; place-items: center; position: relative; color: var(--muted); background: linear-gradient(140deg, color-mix(in srgb, var(--wash-1) 60%, transparent), color-mix(in srgb, var(--wash-3) 60%, transparent)); }
.product-img img { width: 100%; height: 100%; object-fit: cover; }
.product-img .ico { width: 30px; height: 30px; opacity: 0.6; }
.img-btn { position: absolute; bottom: 10px; left: 10px; padding: 5px 11px; border-radius: var(--pill); border: 1px solid var(--glass-edge); background: var(--menu-bg); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); font-size: 0.8125rem; cursor: pointer; opacity: 0; transition: opacity 0.15s; }
.img-btn-x { left: auto; right: 10px; padding: 5px; display: grid; }
.product:hover .img-btn, .img-btn:focus-visible { opacity: 1; }
@media (hover: none) { .img-btn { opacity: 1; } }
.product-body { padding: 16px 18px 18px; display: grid; gap: 8px; align-content: start; }
.product-name { font-family: var(--serif); font-weight: 400; font-size: 1.3rem; line-height: 1.2; }
.product-price { font-weight: 600; font-variant-numeric: tabular-nums; }
.product-desc { color: var(--ink-2); font-size: 0.9375rem; }
.product-admin { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 8px; border-top: 1px solid var(--hair); color: var(--muted); }
.product-ghost { border-style: dashed; border-color: var(--hair-strong); }
.product-ghost .product-img { background: none; border-bottom: 1px dashed var(--hair-strong); }
.checkout { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr)); gap: 20px; align-items: start; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; padding-top: 12px; border-top: 1px solid var(--hair); font-variant-numeric: tabular-nums; }
.totals dd { text-align: right; }
.totals .total { font-weight: 600; font-size: 1.1rem; padding-top: 6px; }
.narrow-panel { width: min(30rem, 100%); }
.instructions { white-space: pre-wrap; font: inherit; margin: 0; padding: 14px 16px; border-radius: var(--r-m); background: var(--glass-input); border: 1px solid var(--hair-strong); }
.pay-box { border-color: var(--warn-edge); }
.center-panel { text-align: center; justify-items: center; padding: 36px; }

/* ── Modal ──────────────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px;
    background: color-mix(in srgb, var(--sky) 35%, transparent);
    -webkit-backdrop-filter: blur(10px) saturate(1.2); backdrop-filter: blur(10px) saturate(1.2);
    animation: fade-in 0.18s var(--ease);
}
.modal-backdrop.out { opacity: 0; transition: opacity 0.18s; }
.modal {
    width: min(34rem, 100%); max-height: min(86vh, 900px); display: grid; grid-template-rows: auto 1fr;
    border-radius: var(--r-xl); background: var(--glass-strong); overflow: hidden;
    box-shadow: var(--glass-shadow), 0 40px 100px -30px rgba(120, 20, 70, 0.45);
    animation: rise 0.24s var(--ease);
}
.modal-wide { width: min(48rem, 100%); }
.modal-head { display: flex; gap: 12px; align-items: flex-start; padding: 22px 22px 12px 26px; border-bottom: 1px solid var(--hair); }
.modal-head .display { font-size: 1.6rem; }
.modal-body { overflow-y: auto; padding: 18px 26px 26px; display: grid; gap: 16px; align-content: start; overscroll-behavior: contain; }
body.has-modal { overflow: hidden; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(0.985); } }

/* ── Tabs on the person page ────────────────────────────────────────── */
.tabs-scroll { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs-scroll::-webkit-scrollbar { display: none; }
.tabs-scroll .tab { white-space: nowrap; }
.tab-body { display: grid; gap: 20px; }
.span-2 { grid-column: 1 / -1; }
.about-panel .about { font-family: var(--serif); font-size: 1.15rem; line-height: 1.6; }

/* ── Notes preview ──────────────────────────────────────────────────── */
.note-preview { display: grid; gap: 4px; }
.clamp-4:not(.ed-on) { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.read-more { justify-self: start; color: var(--accent); }
.modal .note-list .note:first-child { border-top: 0; }

/* ── Schedule form ──────────────────────────────────────────────────── */
.sched-form { display: grid; gap: 18px; }
.kind-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 8px; }
.kind {
    display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 11px 12px; border-radius: 14px;
    border: 1px solid var(--hair-strong); background: var(--glass-input); cursor: pointer;
}
.kind span:last-child { display: grid; gap: 1px; }
.kind .dot { margin-top: 7px; }
.kind:hover { border-color: var(--accent); }
.kind.is-on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--glass-strong); }

/* ── Items (calendar day, schedule detail) ──────────────────────────── */
.items { display: grid; }
.item { display: grid; gap: 8px; padding: 14px 0; border-top: 1px solid var(--hair); }
.item:first-child { border-top: 0; padding-top: 0; }
.item.is-done .item-head strong { text-decoration: line-through; color: var(--muted); }
.item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.item-time { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 0.9rem; min-width: 4.5rem; }
.facts-tight { gap: 4px 14px; }
.dose-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dose-actions .input { flex: 1 1 10rem; }
.instructions-inline { padding: 8px 12px; border-radius: 12px; background: var(--accent-soft); }
.done-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 0.875rem; color: var(--muted); cursor: pointer; }

/* ── Calendar ───────────────────────────────────────────────────────── */
.cal { gap: 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { font-size: 0.75rem; font-weight: 600; color: var(--muted); text-align: center; padding: 4px 0; }
.cal-cell {
    position: relative; min-height: 104px; display: flex; flex-direction: column; gap: 4px; padding: 7px 7px 6px;
    border: 1px solid transparent; border-radius: 12px; background: var(--glass-input); text-align: left; cursor: pointer; min-width: 0;
    transition: border-color 0.12s, background 0.12s;
}
.cal-cell:hover { border-color: var(--accent); background: var(--glass-strong); }
.cal-cell.is-out { opacity: 0.45; }
.cal-cell.is-today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-cell.is-today .cal-date { background: var(--accent); color: var(--accent-ink); }
.cal-date { font-size: 0.8125rem; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-flag { position: absolute; top: 7px; right: 7px; min-width: 18px; height: 18px; border-radius: var(--pill); background: var(--danger); color: #fff; font-size: 0.6875rem; font-weight: 600; display: grid; place-items: center; padding: 0 4px; }
.cal-items { display: grid; gap: 2px; min-width: 0; }
.cal-item { display: flex; align-items: center; gap: 5px; font-size: 0.75rem; min-width: 0; color: var(--ink-2); }
.cal-item .dot { width: 6px; height: 6px; box-shadow: none; }
.cal-item-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-item.is-done .cal-item-t { text-decoration: line-through; color: var(--muted); }
.cal-more { font-size: 0.6875rem; color: var(--muted); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.8125rem; color: var(--muted); }
.cal-legend > span { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 720px) {
    .cal-cell { min-height: 58px; padding: 5px; }
    .cal-items { display: flex; flex-wrap: wrap; gap: 3px; }
    .cal-item-t, .cal-more { display: none; }
    .cal-flag { top: auto; bottom: 4px; right: 4px; min-width: 15px; height: 15px; font-size: 0.625rem; }
}

/* ── Health ─────────────────────────────────────────────────────────── */
.adls { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr)); gap: 4px 22px; }
.adl { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--hair); }
.adl-name { font-weight: 500; }
.adl > .ed, .adl > .tiny { grid-column: 1 / -1; }
.tiny { font-size: 0.75rem; }
.strong { font-weight: 600; }
.is-faded { opacity: 0.6; }
.plain { display: grid; gap: 4px; }
.sub-title { font-size: 0.9375rem; font-weight: 600; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--hair); }
.panel-title + .sub-title { border-top: 0; padding-top: 0; margin-top: 0; }

/* ── Medications ────────────────────────────────────────────────────── */
.doses { display: grid; }
.dose { display: flex; align-items: center; gap: 14px; padding: 11px 0; border-top: 1px solid var(--hair); flex-wrap: wrap; }
.dose:first-child { border-top: 0; }
.dose-time { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 4.8rem; }
.dose.is-late .dose-time { color: var(--danger); }
.dose.is-done .strong { color: var(--muted); }
.dose-given { color: var(--ok); }
.dose-refused { color: var(--warn); border-color: var(--warn-edge); }
.prn { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--hair); }
.dose-summary { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 14px; background: var(--accent-soft); text-decoration: none; color: var(--accent-hover); font-weight: 500; justify-self: start; }
.med { gap: 12px; }
.med-head { display: flex; gap: 12px; align-items: flex-start; }
.med-ico { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.med-name { font-family: var(--serif); font-weight: 400; font-size: 1.35rem; line-height: 1.2; }
.med-instr { padding: 10px 14px; border-radius: 14px; background: var(--accent-soft); display: grid; gap: 2px; }
.med-sched { display: grid; gap: 6px; justify-items: start; }
.med-foot { padding-top: 10px; border-top: 1px solid var(--hair); }
.add-med { border-style: dashed; border-color: var(--hair-strong); }

/* ── Vitals ─────────────────────────────────────────────────────────── */
.kind-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.is-on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.record-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.record-form .input { flex: 1 1 8rem; }
.record-form input[type=number] { flex: 0 1 9rem; }
.record-form .slash { color: var(--muted); font-size: 1.2rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(10rem, 100%), 1fr)); gap: 12px; }
.tile { border-radius: var(--r-l); padding: 14px 16px; display: grid; gap: 2px; align-content: start; }
.tile-v { font-family: var(--serif); font-size: 2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile-u { font-family: var(--sans); font-size: 0.875rem; color: var(--muted); }
.tile.is-out { border-color: var(--warn-edge); background: linear-gradient(160deg, var(--warn-bg), transparent 70%), var(--glass); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(30rem, 100%), 1fr)); gap: 20px; }
.chart { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; touch-action: pan-y; }
.chart-grid { stroke: var(--hair); stroke-width: 1; }
.chart-tick { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.chart-band { fill: var(--accent-soft); }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-line.s1 { stroke: var(--series-1); }
.chart-line.s2 { stroke: var(--series-2); }
.chart-dot { stroke: var(--glass-strong); stroke-width: 2; }
.chart-dot.s1 { fill: var(--series-1); }
.chart-dot.s2 { fill: var(--series-2); }
.chart-label { fill: var(--ink-2); font-size: 11px; font-weight: 600; font-family: var(--sans); }
.chart-cross { stroke: var(--hair-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tip { position: absolute; top: 0; transform: translateX(-50%); pointer-events: none; padding: 8px 12px; border-radius: 12px; background: var(--menu-bg); border: 1px solid var(--glass-edge); box-shadow: 0 10px 30px -10px rgba(0,0,0,.3); font-size: 0.875rem; white-space: nowrap; z-index: 2; }
.chart-legend { display: flex; gap: 14px; font-size: 0.8125rem; color: var(--ink-2); margin-bottom: 4px; }
.chart-legend > span, .chart-tip p { display: inline-flex; align-items: center; gap: 6px; }
.chart-tip p { display: flex; }
.key { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.key.s1 { background: var(--series-1); }
.key.s2 { background: var(--series-2); }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.log { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.log th { text-align: left; font-weight: 500; color: var(--muted); font-size: 0.8125rem; padding: 6px 8px; border-bottom: 1px solid var(--hair-strong); }
.log td { padding: 8px; border-bottom: 1px solid var(--hair); vertical-align: baseline; white-space: nowrap; }
.log td.num { font-variant-numeric: tabular-nums; }
.log .btn-text { opacity: 0; }
.log tr:hover .btn-text, .log .btn-text:focus-visible, .log .btn-text.is-armed { opacity: 1; }

/* ── Supplies ───────────────────────────────────────────────────────── */
.supplies { display: grid; }
.supply { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--hair); flex-wrap: wrap; }
.supply:first-child { border-top: 0; }
.supply .grow { flex: 1 1 12rem; }
.supply > .btn-text { opacity: 0; }
.supply:hover > .btn-text, .supply > .btn-text.is-armed, .supply > .btn-text:focus-visible { opacity: 1; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--hair-strong); border-radius: var(--pill); background: var(--glass-input); }
.stepper-b { width: 34px; height: 34px; border: 0; background: none; cursor: pointer; font-size: 1.15rem; color: var(--accent); border-radius: 50%; }
.stepper-b:hover { background: var(--accent-soft); }
.stepper-n { min-width: 2.6rem; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.chip-add { border-style: dashed; }
.low-list { display: grid; gap: 4px; padding-top: 12px; border-top: 1px solid var(--hair); }
.low-list a { color: var(--warn); }
a.flag { text-decoration: none; }

/* ── Team ───────────────────────────────────────────────────────────── */
.member { align-items: flex-start; }
.member > .grow { flex: 1 1 calc(100% - 60px); }
.member > .chip, .member > .switch, .member > .btn-text { margin-left: 50px; }
.member > .chip ~ .chip, .member > .chip ~ .switch, .member > .chip ~ .btn-text, .member > .switch ~ .btn-text { margin-left: 0; }
.quick-team { display: grid; grid-template-columns: 1fr 1fr; }
.quick-team > .btn { justify-self: start; }
.chip-duty { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.quick-team > .input:first-child { grid-column: 1 / -1; }

/* ── Sign in + security ─────────────────────────────────────────────── */
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.8125rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--hair-strong); }
.soon { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; background: var(--accent-soft); color: var(--ink-2); font-size: 0.875rem; }
.soon-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.35; } }
.is-collapsed { display: none; }
.code-input { font-variant-numeric: tabular-nums; letter-spacing: 0.15em; font-size: 1.1rem; }
.steps { padding-left: 1.2em; list-style: decimal; display: grid; gap: 4px; color: var(--ink-2); }
.totp-setup { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.qr { border-radius: 14px; background: #fff; padding: 8px; border: 1px solid var(--hair-strong); }
.secret-key { font-size: 0.95rem; letter-spacing: 0.06em; padding: 8px 12px; border-radius: 10px; background: var(--glass-input); border: 1px solid var(--hair-strong); word-break: break-all; }
.codes { margin: 0; padding: 14px 16px; border-radius: 14px; background: var(--glass-input); border: 1px solid var(--hair-strong); font-size: 1rem; line-height: 1.8; columns: 2; }

/* ── Segmented control ──────────────────────────────────────────────── */
.seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 18px; background: var(--glass-input); border: 1px solid var(--hair-strong); max-width: 100%; }
.seg-b { border: 0; background: none; padding: 6px 13px; border-radius: var(--pill); cursor: pointer; font-size: 0.875rem; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.seg-b:hover { background: var(--accent-soft); }
.seg-b.is-on { background: var(--accent); color: var(--accent-ink); }
.tab-body > .seg, .field > .seg, .stack > .seg, .complete > .seg { justify-self: start; }

/* ── Repeat builder ─────────────────────────────────────────────────── */
.sub-box { display: grid; gap: 12px; padding: 14px 16px; border-radius: var(--r-m); background: var(--glass-input); border: 1px solid var(--hair); }
.rule { display: grid; gap: 14px; }
.rule-summary { padding: 9px 12px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-hover); font-weight: 500; font-size: 0.9375rem; }
.inline-q { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.9375rem; }
.input-num { width: 5.5rem; flex: none; padding: 7px 10px; }
.input-time { width: auto; padding: 6px 8px; }
.times { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.time-chip { display: inline-flex; align-items: center; gap: 2px; }
.day-picks { display: flex; gap: 6px; flex-wrap: wrap; }
.day-pick { width: 44px; height: 36px; border-radius: 12px; border: 1px solid var(--hair-strong); background: var(--glass-input); cursor: pointer; font-weight: 500; font-size: 0.8125rem; }
.day-pick.is-on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ── Completing ─────────────────────────────────────────────────────── */
.complete { padding: 12px 14px; border-radius: var(--r-m); background: var(--accent-soft); }
.complete .input { background: var(--glass-strong); }
.item-actions { padding-top: 4px; border-top: 1px dashed var(--hair); }
.item.st-cancelled .item-head strong { text-decoration: line-through; color: var(--muted); }
.st-done .dot, .st-partial .dot { box-shadow: none; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.link-btn:hover .occ-title, button.dose-time.link-btn:hover { color: var(--accent); }

/* ── Today list ─────────────────────────────────────────────────────── */
.occs { display: grid; }
.occ { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--hair); }
.occ:first-child { border-top: 0; }
.occ-main { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 12px; }
.occ-time { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 0.875rem; min-width: 4.6rem; }
.occ-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.occ-cam { color: var(--muted); display: inline-flex; }
.occ.is-done .occ-title { color: var(--muted); }
.occ.is-late .occ-time { color: var(--danger); font-weight: 600; }
.occ.is-cancelled .occ-title { text-decoration: line-through; color: var(--muted); }
.later-label { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--hair); }
.progress { width: 90px; height: 8px; border-radius: var(--pill); background: var(--hair); overflow: hidden; flex: none; }
.progress-bar { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

/* ── Photos ─────────────────────────────────────────────────────────── */
.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.photo { position: relative; width: 72px; height: 72px; border-radius: 12px; overflow: hidden; border: 1px solid var(--glass-edge); padding: 0; cursor: pointer; background: var(--glass-input); box-shadow: 0 4px 12px -6px rgba(120, 20, 70, 0.3); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
.photo.is-pending { cursor: default; }
.photo-x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; cursor: pointer; }
.photo-x .ico { width: 12px; height: 12px; }
.picker { display: grid; gap: 8px; justify-items: start; }
.viewer { margin: 0; display: grid; gap: 10px; }
.viewer img { width: 100%; max-height: 62vh; object-fit: contain; border-radius: var(--r-m); background: var(--glass-input); }
.viewer figcaption { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: baseline; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.gallery-item { margin: 0; display: grid; gap: 6px; }
.photo-l { width: 100%; height: auto; aspect-ratio: 1; }

/* ── Daily logs ─────────────────────────────────────────────────────── */
.day-groups { display: grid; gap: 16px; }
.day-group { display: grid; gap: 2px; }
.log { display: grid; }
.log-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--hair); }
.log-row:first-child { border-top: 0; }
.log-row > .dot { margin-top: 8px; }
.log-row .grow { display: grid; gap: 4px; }
.log-meta { display: grid; justify-items: end; gap: 2px; text-align: right; }
.log-meta .btn-text { opacity: 0; }
.log-row:hover .log-meta .btn-text, .log-meta .btn-text.is-armed, .log-meta .btn-text:focus-visible { opacity: 1; }
@media (hover: none) { .log-meta .btn-text { opacity: 1; } }
.sleep-now { justify-items: start; background: linear-gradient(160deg, color-mix(in srgb, var(--ev-sleep) 14%, transparent), transparent 70%), var(--glass); }
.chart-bar { fill: var(--series-1); }
.chart-bar:hover { opacity: 0.85; }
.chart-target { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.5; }

/* ── Milestones ─────────────────────────────────────────────────────── */
.milestone { gap: 10px; }
.milestone.is-reached { background: linear-gradient(160deg, color-mix(in srgb, var(--ok) 10%, transparent), transparent 60%), var(--glass); }
.ms-ico { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.is-reached .ms-ico { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.ms-title { font-family: var(--serif); font-weight: 400; font-size: 1.25rem; line-height: 1.25; }
.preset-groups { display: grid; gap: 14px; margin-top: 10px; }
.preset-group { display: grid; gap: 6px; }

/* ── Toasts ─────────────────────────────────────────────────────────── */
.toasts { position: fixed; bottom: max(20px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; justify-items: center; width: min(28rem, 100% - 24px); pointer-events: none; }
.toast {
    pointer-events: auto; display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 18px;
    border-radius: var(--pill); background: var(--ink); color: var(--sky); font-size: 0.9375rem; font-weight: 500;
    box-shadow: 0 16px 40px -14px rgba(0, 0, 0, 0.45);
    animation: toast-in 0.22s var(--ease);
    transition: opacity 0.3s, transform 0.3s var(--ease);
}
.toast:not(:has(.toast-action)) { padding-right: 18px; }
.toast-error { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }
.toast-action { border: 0; background: rgba(255, 255, 255, 0.16); color: inherit; padding: 5px 12px; border-radius: var(--pill); cursor: pointer; font-weight: 600; }
:root[data-theme="dark"] .toast-action { background: rgba(0,0,0,.12); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ── Small screens ──────────────────────────────────────────────────── */
.tabbar, .sheet-grip, .phone-only, .menu-scrim { display: none; }
table.log { display: table; }

/* Touch: everything you tap is at least ~40px, nothing hides behind hover. */
@media (pointer: coarse) {
    .btn { min-height: 44px; }
    .btn-sm { min-height: 40px; padding: 8px 15px; }
    .btn-text { min-height: 40px; padding: 8px 10px; }
    button.chip, a.chip { min-height: 36px; padding: 6px 13px; }
    button.chip.chip-sm { min-height: 34px; }
    .seg-b { padding: 9px 15px; min-height: 38px; }
    .day-pick { width: 46px; height: 44px; }
    .stepper-b { width: 42px; height: 42px; }
    .icon-btn, .avatar-btn { width: 44px; height: 44px; }
    .check, .menu-check input { width: 22px; height: 22px; }
    .menu-item { padding: 12px 12px; min-height: 46px; }
    .menu-check { padding: 11px 12px; }
    .switch-track { width: 40px; height: 24px; }
    .switch-track::after { width: 20px; height: 20px; }
    .switch input:checked + .switch-track::after { transform: translateX(16px); }
    .switch { min-height: 40px; }
    .photo-x { width: 30px; height: 30px; }
    .kind { padding: 13px 12px; }
    .link-btn { min-height: 40px; }
    .task .check { margin-top: 1px; }
    .ed:not(.ed-static) { padding-block: 5px; background-position: 0 calc(100% - 5px); }
    .read-more, .more summary { min-height: 40px; display: inline-flex; align-items: center; }
    .tab { padding: 10px 16px; }
}
@media (hover: none) {
    .task > .btn-text, .event > .btn-text, .supply > .btn-text, .log .btn-text, .log-meta .btn-text, .img-btn { opacity: 1; }
    .person:hover, .home-card:hover, .shop-card:hover { transform: none; }
}

@media (max-width: 640px) {
    /* iOS zooms into any field under 16px; keep every field at 16px. */
    .input, .input-sm, .input-num, .input-time, .ed-control, select, textarea, input { font-size: 16px; }
    .display .ed-control, h1 .ed-control { font-size: 16px; }

    /* Top bar: brand + bell, theme, account. Main links move to the tab bar. */
    .nav { padding: max(8px, env(safe-area-inset-top)) 10px 0; }
    .nav-bar { padding: 4px 4px 4px 14px; gap: 6px; }
    .brand { font-size: 0; gap: 0; margin-right: 0; }
    .brand-mark { width: 20px; height: 20px; }
    .nav-link { padding: 7px 11px; }
    body.has-tabbar .nav-links { display: none; }
    body.has-tabbar .brand { font-size: 1.15rem; gap: 9px; margin-right: auto; }
    body.has-tabbar .nav-bar { justify-content: space-between; }

    .tabbar {
        display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px;
        position: fixed; left: 10px; right: 10px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 45;
        padding: 5px; border-radius: 24px; background: var(--glass-strong);
        box-shadow: var(--glass-shadow), 0 18px 40px -18px rgba(120, 20, 70, 0.4);
    }
    .tabbar-item {
        display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 52px; padding: 6px 2px 5px;
        border: 0; border-radius: 19px; background: none; cursor: pointer;
        color: var(--muted); text-decoration: none; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.01em;
        -webkit-tap-highlight-color: transparent;
    }
    .tabbar-item .ico { width: 22px; height: 22px; }
    .tabbar-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
    .tabbar-item[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
    .tabbar-item:active { transform: scale(0.96); }
    /* While typing, the bar gets out of the keyboard's way. */
    /* Slides away while typing and comes back a moment after, so a tap on
       Save right after typing never lands on the bar instead. */
    .tabbar { transition: transform 0.22s var(--ease) 0.35s, opacity 0.22s 0.35s; }
    body:has(input:focus, textarea:focus, select:focus, [contenteditable="true"]:focus) .tabbar {
        transform: translateY(calc(100% + 30px)); opacity: 0; pointer-events: none; transition-delay: 0s;
    }
    body.has-tabbar .page { padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
    body.has-tabbar .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }

    /* Page frame */
    .page { padding-top: 16px; gap: 16px; width: calc(100% - 20px); }
    .page-head { padding: 6px 4px 0; }
    .lede { font-size: 1.0625rem; }
    .panel { padding: 16px; gap: 12px; border-radius: 22px; }
    .panel > * { min-width: 0; }
    .hero { padding: 18px; border-radius: 24px; }
    .grid-2, .charts, .checkout { gap: 16px; }
    .phone-only { display: grid; }
    .phone-hide { display: none !important; }
    .section-title { font-size: 1.35rem; }

    /* Modals are sheets from the bottom: grab bar, swipe down, sticky Save. */
    .modal-backdrop { padding: 0; place-items: end stretch; }
    .modal, .modal-wide { width: 100%; max-height: 94dvh; border-radius: 26px 26px 0 0; transition: transform 0.22s var(--ease); }
    .modal-head { position: relative; padding: 22px 10px 10px 18px; touch-action: none; }
    .modal-head .display { font-size: 1.35rem; }
    .sheet-grip { display: block; position: absolute; top: 8px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: var(--hair-strong); }
    .modal-body { padding: 14px 16px calc(20px + env(safe-area-inset-bottom)); }
    .modal-body .row-gap.end:last-child {
        position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom)); z-index: 2;
        margin: 0 -16px calc(-20px - env(safe-area-inset-bottom)); padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
        background: linear-gradient(to bottom, transparent, var(--glass-strong) 22%);
    }
    .row-gap.end > .btn:only-child, .row-gap.end > .btn-lg { flex: 1; }
    .menu-scrim { display: block; position: fixed; inset: 0; z-index: 79; background: color-mix(in srgb, var(--sky) 40%, transparent); animation: fade-in 0.15s; }
    .menu.menu-sheet {
        position: fixed; left: 8px; right: 8px; top: auto !important; bottom: calc(8px + env(safe-area-inset-bottom)); max-width: none; min-width: 0;
        max-height: 70dvh; overflow-y: auto; padding: 8px; border-radius: 22px; animation: sheet-up 0.2s var(--ease);
    }
    .menu-sheet .menu-cancel { justify-content: center; font-weight: 600; margin-top: 6px; border-top: 1px solid var(--hair); border-radius: 0 0 14px 14px; }
    .menu-sheet .menu-heading { text-align: center; }

    /* Lists */
    .facts { grid-template-columns: minmax(6rem, 36%) minmax(0, 1fr); gap: 10px 14px; }
    .facts dt { font-size: 0.8125rem; line-height: 1.35; padding-top: 3px; }
    .event { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 1px 12px; align-items: center; }
    .event > .dot { grid-row: 1 / span 2; align-self: start; margin-top: 7px; }
    .event-when { grid-column: 2; grid-row: 1; min-width: 0; font-size: 0.8125rem; }
    .event > .grow { grid-column: 2; grid-row: 2; }
    .event > :nth-child(4) { grid-column: 3; grid-row: 1 / span 2; }
    .event > :nth-child(n+5) { grid-column: 2 / -1; justify-self: start; }
    /* Signed out: brand, Shop, theme and Sign in. Pages carry their own "Create account". */
    body:not(.has-tabbar) .brand { font-size: 1.1rem; gap: 8px; margin-right: auto; }
    body:not(.has-tabbar) .nav-links { flex: none; }
    .nav-cta { display: none; }
    body:not(.has-tabbar) .nav-actions .nav-link[aria-current="page"] { display: none; }
    .hero-sample { transform: none; }
    .row:not(.member) > .grow { flex-basis: 100%; }

    /* Person page */
    .hero-top { flex-wrap: nowrap; align-items: flex-start; gap: 14px; display: grid; grid-template-columns: auto minmax(0, 1fr); }
    .hero-top .hero-side { grid-column: 1 / -1; order: 0; width: 100%; justify-content: flex-start; }
    .patient-hero { gap: 16px; }
    .patient-hero .avatar-xl { width: 52px; height: 52px; font-size: 1.15rem; margin-top: 4px; }
    .patient-hero .display-xl { font-size: clamp(1.9rem, 8.5vw, 2.4rem); }
    .goes-by { font-size: 1.05rem; margin-top: 2px; }
    .facts-row { grid-template-columns: 1fr 1fr; gap: 12px 16px; padding-top: 14px; }
    .flag { font-size: 0.875rem; padding: 7px 12px; }
    .tabs-scroll {
        position: sticky; top: calc(62px + env(safe-area-inset-top)); z-index: 30; width: auto; max-width: none;
        margin: 0 -10px; border-radius: 0; border-left: 0; border-right: 0; padding: 6px 10px;
        background: var(--glass-strong);
        -webkit-mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 22px), transparent);
        mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 22px), transparent);
    }
    .tabs:not(.tabs-scroll) { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
    .record-actions { justify-content: flex-start; }
    .record-actions .btn { flex: 1; }

    /* Today checklist: time above the title, the action stays put. */
    .occ { align-items: center; gap: 10px; padding: 8px 0; }
    .occ > .dot { align-self: flex-start; margin-top: 9px; }
    .occ-main { flex-direction: column; align-items: flex-start; gap: 0; padding: 2px 0; }
    .occ-time { min-width: 0; font-size: 0.8125rem; }
    .occ-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
    .occ > .btn, .occ > .chip { flex: none; }
    .section-head .btn-sm { padding-inline: 12px; }
    .dose-summary { justify-self: stretch; }

    /* Doses: time + medicine on top, the buttons in a full row below. */
    .dose { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; align-items: start; }
    .dose-time { min-width: 4.4rem; padding-top: 1px; }
    .dose > .row-gap { grid-column: 1 / -1; gap: 8px; }
    .dose > .row-gap > .btn { flex: 1; }
    .med-name { font-size: 1.2rem; }
    .med-head { flex-wrap: wrap; }

    /* Readings table becomes stacked cards. */
    .table-wrap { overflow: visible; margin: 0; }
    table.log, table.log tbody { display: block; }
    table.log thead { display: none; }
    table.log tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--hair); }
    table.log td { padding: 0; border: 0; white-space: normal; min-width: 0; }
    table.log td:nth-child(2) { grid-row: 1; grid-column: 1; font-weight: 600; }
    table.log td:nth-child(3) { grid-row: 1; grid-column: 2; text-align: right; }
    table.log td:nth-child(1) { grid-row: 2; grid-column: 1; font-size: 0.875rem; color: var(--ink-2); }
    table.log td:nth-child(5) { grid-row: 2; grid-column: 2; text-align: right; }
    table.log td:nth-child(4) { grid-row: 3; grid-column: 1; font-size: 0.9rem; align-self: center; }
    table.log td:nth-child(6) { grid-row: 3; grid-column: 2; justify-self: end; margin-right: -10px; }
    table.log td:nth-child(6):empty { display: none; }

    /* Vitals + daily tiles sit two across. */
    .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .tile { padding: 12px 14px; border-radius: 18px; }
    .tile-v { font-size: 1.65rem; }
    .record-form .input { flex: 1 1 100%; }
    .record-form input[type=number] { flex: 1 1 6rem; }
    .record-form .btn { flex: 1 1 100%; }

    /* Daily logs: details under the title instead of squeezed beside it. */
    .log-row { flex-wrap: wrap; gap: 4px 12px; }
    .log-row > .grow { flex: 1 1 calc(100% - 30px); }
    .log-meta { justify-items: start; text-align: left; grid-auto-flow: column; align-items: center; gap: 4px; margin-left: 20px; }
    .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .gallery-item figcaption, .gallery-item .small { font-size: 0.75rem; }

    /* Forms */
    .fields { grid-template-columns: 1fr; gap: 12px; }
    .kind-choices { grid-template-columns: 1fr 1fr; gap: 8px; }
    .kind { padding: 11px 10px; gap: 8px; }
    .kind .muted { font-size: 0.8125rem; }
    .seg { display: flex; width: 100%; }
    .seg-b { flex: 1 1 auto; text-align: center; }
    .inline-q .input-num { width: 5rem; }
    .day-picks { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; width: 100%; }
    .day-pick { width: auto; }
    .quick > .input { flex: 1 1 100%; }
    .quick > .btn { flex: 1 1 auto; }
    .quick-team { grid-template-columns: 1fr 1fr; }
    .quick-team > .btn { grid-column: 1 / -1; }
    .composer-bar { flex-wrap: wrap; }
    .totp-setup { justify-content: center; }
    .codes { columns: 1; }

    /* Calendar: big tap targets, dots instead of words. */
    .cal-head { gap: 8px; }
    .cal-head .display { font-size: 1.5rem; }
    .cal-grid { gap: 3px; }
    .cal-cell { min-height: 54px; padding: 5px 4px; align-items: center; border-radius: 12px; }
    .cal-date { width: 26px; height: 26px; font-size: 0.875rem; }
    .cal-items { justify-content: center; }
    .cal-legend { gap: 6px 12px; font-size: 0.75rem; }
    .item-head { gap: 6px 10px; }
    .complete { padding: 12px; }

    /* Shop */
    .products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .product-body { padding: 12px; gap: 6px; }
    .product-name { font-size: 1.05rem; }
    .product-desc { font-size: 0.875rem; }
    .auth-card { padding: 24px 20px; }
    .center-panel { padding: 24px 18px; }
    .home-hero, .shop-hero { gap: 14px; }
    .home-ico-l { width: 52px; height: 52px; border-radius: 16px; }

    /* Toasts span the screen */
    .toast { border-radius: 18px; width: 100%; justify-content: space-between; }
}
@media (max-width: 340px) {
    .kind-choices { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
    .products { grid-template-columns: 1fr; }
    .tabbar-item { font-size: 0.625rem; }
}
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (pointer: coarse) {
    .check-line { min-height: 40px; }
    .task-meta a, .low-list a, .facts-row dd a { display: inline-block; padding-block: 6px; margin-block: -6px; }
}
@media (max-width: 640px) {
    .quick-stack { grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); }
    .quick-stack > .btn { grid-column: 1 / -1; }
    .row.member > .grow { flex: 1 1 calc(100% - 60px); }
    .member > .chip, .member > .switch, .member > .btn-text { margin-left: 50px; }
}
@media (max-width: 720px) {
    .cal-flag { display: none; }
    .cal-cell.has-late .cal-date { box-shadow: 0 0 0 2px var(--danger); color: var(--danger); }
    .cal-cell.is-today.has-late .cal-date { color: var(--accent-ink); }
}
@media (max-width: 640px) {
    .cal-head .row-gap { width: 100%; flex-wrap: nowrap; gap: 4px; justify-content: flex-end; }
    .cal-head .row-gap > .chip { margin-right: auto; max-width: 46%; overflow: hidden; text-overflow: ellipsis; }
}
/* On a phone, tabs other than Overview keep the name and safety flags up top
   and drop the rest, so the tab's own content starts on the first screen. */
@media (max-width: 640px) {
    .patient-hero.is-compact { gap: 12px; padding: 14px 16px; }
    .patient-hero.is-compact .facts-row, .patient-hero.is-compact .hero-side { display: none; }
    .patient-hero.is-compact .display-xl { font-size: 1.6rem; }
    .patient-hero.is-compact .avatar-xl { width: 40px; height: 40px; font-size: 0.95rem; margin-top: 2px; }
    .patient-hero.is-compact .goes-by { font-size: 0.95rem; }
    .patient-hero.is-compact .flags { gap: 6px; }
    .patient-hero.is-compact .flag { padding: 5px 11px; font-size: 0.8125rem; }
}
.num-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); gap: 10px; }
.num-field { display: grid; gap: 4px; font-size: 0.8125rem; font-weight: 500; color: var(--ink-2); }
.num-field .input-num { width: 100%; }
@media (max-width: 640px) { .num-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
    body:has(input:focus, textarea:focus, select:focus, [contenteditable="true"]:focus) .toasts { bottom: max(14px, env(safe-area-inset-bottom)); }
}
/* No 300ms double-tap delay, no grey flash on tap; :active gives the feedback. */
button, a, label, select, input, .chip, .cal-cell, .seg-b { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
@media (pointer: coarse) {
    .cal-cell:active, .person:active, .home-card:active, .kind:active, .link-btn:active { background: var(--accent-soft); }
}

/* ── Timestamps ─────────────────────────────────────────────────────── */
.stamp {
    display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 0; max-width: 100%;
    border: 0; background: none; padding: 2px 0; margin: 0; font: inherit; font-size: 0.8125rem; line-height: 1.45;
    color: var(--muted); text-align: left; cursor: pointer; border-radius: 6px;
}
.stamp > span + span::before { content: "·"; margin: 0 6px; color: var(--hair-strong); }
.stamp:hover .st-at, .stamp:focus-visible .st-at { color: var(--accent); }
.stamp .st-at { color: var(--ink-2); font-weight: 500; font-variant-numeric: tabular-nums; }
.stamp .is-warn, .stamp .st-edited { color: var(--warn); font-weight: 500; }
.stamp .st-live { color: var(--ok); }
.log-row .stamp { margin-top: 2px; }
.occ-stamp { display: flex; flex-wrap: wrap; gap: 0; font-size: 0.75rem; color: var(--muted); font-weight: 400; }
.occ-stamp > span + span::before { content: "·"; margin: 0 5px; color: var(--hair-strong); }
.occ-stamp .is-warn { color: var(--warn); font-weight: 500; }
.occ-main { flex-wrap: wrap; }
.occ-main .occ-stamp { flex-basis: 100%; }
.dose-history { gap: 10px; }
.dose-history li { display: grid; gap: 0; }
.is-warn { color: var(--warn); }

/* "Just now / Earlier" */
.when-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.when-now { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 500; }
.when-now::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 7px; vertical-align: 1px; animation: breathe 2.4s ease-in-out infinite; }
.when-earlier { gap: 6px; }
.field.when { gap: 8px; }
.record-form > .when { flex: 1 1 100%; }
.complete .when .input { background: var(--glass-strong); }

/* The full story sheet */
.timeline { display: grid; gap: 0; position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--hair-strong); }
.tl-row { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 2px 14px; padding: 8px 0; position: relative; }
.tl-row::before { content: ""; position: absolute; left: -18px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--glass-strong); }
.tl-row.is-warn::before { background: var(--warn); }
.tl-row dt { color: var(--muted); font-size: 0.875rem; padding-top: 1px; }
.tl-row dd { display: grid; gap: 2px; }
.tl-row.is-warn dd > p:first-child + p { color: var(--warn); }
.changes { display: grid; gap: 10px; }
.changes li { padding: 10px 12px; border-radius: 12px; background: var(--glass-input); display: grid; gap: 2px; }

/* ── Staff habits ───────────────────────────────────────────────────── */
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 0.9rem; justify-self: start; }
.back-link:hover { color: var(--ink); }
.habits > .seg { justify-self: start; }
.habit-tiles { grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr)); }
.staff-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(22rem, 100%), 1fr)); gap: 16px; align-items: start; }
.staff-head { display: flex; align-items: center; gap: 12px; }
.staff-count { display: grid; justify-items: end; line-height: 1.1; }
.staff-count strong { font-family: var(--serif); font-weight: 400; font-size: 1.8rem; }
.meters { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.meter { display: grid; gap: 5px; }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.875rem; color: var(--ink-2); }
.meter-top strong { font-size: 1.15rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.meter-top strong.is-warn { color: var(--warn); }
.meter-bar { width: 100%; }
.progress-bar.is-warn { background: var(--warn); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; padding-top: 12px; border-top: 1px solid var(--hair); }
.stat dt { font-size: 0.8125rem; color: var(--muted); }
.stat dd { font-weight: 600; font-variant-numeric: tabular-nums; }
.stat dd.is-warn { color: var(--warn); }
.staff-card > .btn { justify-self: start; }
.change-row .grow { min-width: 0; }
@media (max-width: 640px) {
    .habit-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .habit-tiles .tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
    .tl-row { grid-template-columns: 1fr; }
    .stats { gap: 10px 12px; }
}

/* ══════════════════════════════════════════════════════════════════════
   Simple view: Up next, the quick sheet, "Log something"
   Big targets, one clear action per row, exact times, calm colours.
   ══════════════════════════════════════════════════════════════════════ */
.upnext { gap: 18px; }
.upnext-head { display: grid; gap: 2px; padding: 8px 4px 0; }
.upnext-body { gap: 22px; }
.up-title { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin: 0 4px 10px; }
.upnext-now .up-title { font-size: 1.05rem; letter-spacing: 0; text-transform: none; color: var(--ink); }
.who-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -10px; padding: 2px 10px 4px; }
.who-chips::-webkit-scrollbar { display: none; }
.who-chip { min-height: 40px; padding: 8px 16px; font-size: 0.9375rem; flex: none; }
.who-chip::after { display: none !important; }

.ev-meal { --c: var(--ev-meal); } .ev-medication { --c: var(--ev-medication); } .ev-sleep { --c: var(--ev-sleep); }
.ev-activity { --c: var(--ev-activity); } .ev-routine { --c: var(--ev-routine); } .ev-appointment { --c: var(--ev-appointment); }
.ev-family_visit { --c: var(--ev-family); } .ev-financial { --c: var(--ev-financial); } .ev-deadline { --c: var(--ev-deadline); }
.next-ico { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; flex: none;
    color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 14%, transparent); }
.next-ico .ico { width: 24px; height: 24px; }
.next-ico.sm { width: 36px; height: 36px; border-radius: 12px; }
.next-ico.sm .ico { width: 19px; height: 19px; }
.next-text { display: grid; gap: 1px; min-width: 0; flex: 1; text-align: left; }
.next-title { font-weight: 600; font-size: 1.0625rem; line-height: 1.3; }
.next-meta { display: flex; flex-wrap: wrap; gap: 0; color: var(--muted); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.next-meta > span + span::before { content: "·"; margin: 0 6px; color: var(--hair-strong); }
.next-meta .is-late, .next-meta.is-late { color: var(--danger); font-weight: 600; }

.next-cards { display: grid; gap: 10px; }
.next-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 10px; border-radius: 22px; }
.next-card.is-late { border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.next-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; border: 0; background: none; padding: 4px; text-align: left; cursor: pointer; border-radius: 16px; color: inherit; font: inherit; min-height: 56px; }
.next-go { min-height: 48px; min-width: 84px; padding: 10px 18px; font-size: 1rem; font-weight: 600; flex: none; }
.next-go.is-late { background: var(--danger); }

.next-rows { display: grid; gap: 0; border-radius: 22px; overflow: hidden; background: var(--glass); border: 1px solid var(--glass-edge);
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.next-rows > li + li { border-top: 1px solid var(--hair); }
.next-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 10px 14px; border: 0; background: none; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.next-row > .ico { color: var(--muted); flex: none; }
.next-row:active, .next-main:active, .pick-row:active, .tile-btn:active { background: var(--accent-soft); }
.next-time { min-width: 4.6rem; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-2); }
.next-row .next-title { font-size: 1rem; font-weight: 500; }
.task-row .check { width: 26px; height: 26px; }

.upnext-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.upnext-actions .btn { min-height: 56px; border-radius: 18px; }
.low-banner { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 18px; text-decoration: none; color: var(--warn); background: var(--warn-bg); border: 1px solid var(--warn-edge); font-weight: 500; }
.done-today summary { font-size: 1rem; color: var(--ink-2); font-weight: 500; }
.upnext-foot { display: grid; justify-items: center; gap: 8px; padding-top: 8px; }

.fab { display: none; }
html[data-view="simple"] .fab {
    display: inline-flex; align-items: center; gap: 6px; position: fixed; z-index: 44;
    right: max(16px, env(safe-area-inset-right)); bottom: calc(24px + env(safe-area-inset-bottom));
    min-height: 56px; padding: 0 22px 0 18px; border: 0; border-radius: 28px; cursor: pointer;
    background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; font-size: 1.0625rem;
    box-shadow: 0 14px 30px -10px color-mix(in srgb, var(--accent) 70%, transparent);
}
html[data-view="simple"] .fab .ico { width: 22px; height: 22px; }
body.has-modal .fab { display: none; }
@media (max-width: 640px) {
    html[data-view="simple"] .fab { bottom: calc(86px + env(safe-area-inset-bottom)); transition: transform 0.22s var(--ease) 0.35s, opacity 0.22s 0.35s; }
    body:has(input:focus, textarea:focus, select:focus) .fab { transform: translateY(160px); opacity: 0; transition-delay: 0s; }
    .upnext-head .display { font-size: 2rem; }
}

/* "Log something" steps */
.step-q { font-size: 1.15rem; font-weight: 600; }
.back-step { justify-self: start; margin-left: -8px; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr)); gap: 10px; }
.tile-btn { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 72px; padding: 12px 14px; border-radius: 18px;
    border: 1px solid var(--hair-strong); background: var(--glass-input); cursor: pointer; text-align: left; color: inherit; font: inherit; }
.tile-btn:hover { border-color: var(--accent); }
.tile-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); flex: none; }
.tile-ico .ico { width: 22px; height: 22px; }
.pick-list { display: grid; gap: 8px; }
.pick-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 10px 14px; border-radius: 18px; border: 1px solid var(--hair-strong); background: var(--glass-input); cursor: pointer; color: inherit; font: inherit; text-align: left; }
.modal .glass.panel { background: none; border: 0; box-shadow: none; padding: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
.modal .glass.panel > .panel-title { display: none; }

/* The quick sheet */
.complete.simple { background: none; padding: 0; gap: 18px; }
.complete.simple .field > span:first-child { font-size: 1rem; font-weight: 600; color: var(--ink); }
.complete.simple .input { background: var(--glass-input); }
.complete.simple .row-gap.end .btn { flex: 1; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.preset { min-height: 44px; padding: 8px 16px; font-size: 1rem; font-variant-numeric: tabular-nums; }
.preset::after { display: none !important; }
.alt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.add-details summary { font-size: 1rem; color: var(--ink-2); }
.more-options { justify-self: center; }
.modal .med-instr { gap: 4px; }
.page { grid-template-columns: minmax(0, 1fr); }
.upnext-actions .btn { white-space: normal; text-align: center; line-height: 1.2; padding-inline: 12px; }
.tabbar-log { color: var(--accent) !important; }
.tabbar-plus { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); margin-top: -4px;
    box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--accent) 80%, transparent); }
.tabbar-plus .ico { width: 20px !important; height: 20px !important; }
/* On a phone the bar's "Log" does the job; the floating button is for bigger screens. */
@media (max-width: 640px) { html[data-view="simple"] .fab { display: none; } }

/* ── Home: people, feed, joining ────────────────────────────────────── */
.people-strip { display: grid; gap: 10px; }
.person-chip { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 20px; text-decoration: none; min-height: 68px; }
.person-chip > .ico { color: var(--muted); }
.upnext-actions.one { grid-template-columns: 1fr; }
.open-record { justify-self: stretch; min-height: 48px; border-radius: 16px; }
.feed-section { display: grid; gap: 12px; }
.feed-day { display: grid; gap: 6px; }
.feed-day + .feed-day { margin-top: 10px; }
.feed-date { font-size: 0.875rem; font-weight: 600; color: var(--ink-2); margin: 0 4px; }
.feed { display: grid; border-radius: 20px; overflow: hidden; background: var(--glass); border: 1px solid var(--glass-edge);
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.panel .feed { background: none; border: 0; border-radius: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
.feed-item { display: flex; gap: 12px; padding: 12px 14px; align-items: flex-start; }
.feed-item + .feed-item { border-top: 1px solid var(--hair); }
.panel .feed-item { padding-inline: 0; }
.feed-body { display: grid; gap: 3px; min-width: 0; flex: 1; }
.feed-title { font-weight: 600; text-decoration: none; color: var(--ink); line-height: 1.35; }
.feed-title:hover { color: var(--accent); }
.feed-text { color: var(--ink-2); font-size: 0.9375rem; overflow-wrap: anywhere; }
.feed-text.is-note { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; font-family: var(--serif); font-size: 1.02rem; line-height: 1.5; }
.feed-meta { color: var(--muted); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.feed-live { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: var(--pill); background: var(--accent-soft); color: var(--accent); font-size: 0.75rem; font-weight: 600; vertical-align: 2px; }
.feed-item .photos { margin-top: 4px; }
.feed-more { justify-self: center; }
.join-panel { gap: 12px; border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.join-name { font-family: var(--serif); font-size: 2rem; color: var(--accent); overflow-wrap: anywhere; user-select: all; }
.join-actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 640px) { .join-actions .btn { flex: 1 1 100%; } }
/* Calendar on phones: the chosen day listed under the month */
.cal-cell.is-selected { background: var(--accent-soft); border-color: var(--accent); }
.cal-agenda { display: grid; gap: 10px; padding-top: 6px; }
.agenda-title { font-size: 1.1rem; font-weight: 600; }
.cal-agenda .next-rows { background: var(--glass-input); }
.cal-agenda .is-cancelled .next-title { text-decoration: line-through; color: var(--muted); }
.next-time.is-overdue { color: var(--danger); }
.chip-late { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.cal-agenda > .btn { justify-self: start; }
.section-picker { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 10px 14px; border-radius: 20px; cursor: pointer; text-align: left; color: inherit; font: inherit;
    position: sticky; top: calc(64px + env(safe-area-inset-top)); z-index: 30; background: var(--glass-strong); }
.section-picker .next-meta { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.picker-all { display: inline-flex; align-items: center; gap: 2px; color: var(--accent); font-weight: 600; font-size: 0.9375rem; white-space: nowrap; }
.section-list .tile-btn { text-decoration: none; }
.tile-btn.is-on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
@media (max-width: 640px) { .product-ghost { grid-column: 1 / -1; } .product-ghost .product-img { aspect-ratio: 3 / 1; } }

/* Swipe to delete */
.swipe-row {
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
}
.swipe-content {
    position: relative;
    z-index: 2;
    background: var(--sky); /* Match your app background */
    transition: transform 0.2s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.swipe-action {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    background: var(--danger);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    width: 90px;
    z-index: 1;
    font-weight: 600;
    border-radius: var(--r-m); /* Match your card radius */
}