/* CoupleNotes · Soft Nursery design system.
   Tokens first (light, then dark), then layout, then components. Category and list colours are
   applied through .cat-* / .list-* classes that set --tint and --tone, so a chip, a tag and a
   tile of the same category always match. */

:root {
    --bg: #F6F1FF;
    --surface: #FFFFFF;
    --surface-2: #EFE8FF;
    --ink: #2E2645;
    --ink-2: #5F5679;
    --line: #E5DCF7;
    --primary: #5B3FD0;
    --primary-ink: #4A2FBF;
    --on-primary: #FFFFFF;
    --primary-muted: #B3A6E3;
    --shadow: 0 4px 16px rgba(90, 64, 170, 0.08);
    --shadow-lift: 0 10px 28px rgba(90, 64, 170, 0.16);
    --scrim: rgba(46, 38, 69, 0.42);
    --tag-on-tint: rgba(255, 255, 255, 0.72);

    --new-dot: #E8436E;
    --new-ink: #9E1F4A;
    --new-bg: #FFE4EC;
    --alex-bg: #EFE8FF;
    --sam-bg: #FFEADF;
    --lock-ink: #4B2E91;
    --late: #A3331F;
    --late-bg: #FFF6F3;
    --ok: #2F7D55;
    --ok-ink: #1F6142;
    --ok-bg: #E6F4EC;
    --heart: #E8436E;
    --handle: #DCD2F3;

    --date-tint: #FFE3D3;   --date-ink: #8A3B12;
    --gift-tint: #DCEBFF;   --gift-ink: #1F4A8A;
    --memory-tint: #D9F2E4; --memory-ink: #1E6B45;
    --love-tint: #FFDFE8;   --love-ink: #8C1D45;

    --groceries-tint: #FFF1C7; --groceries-ink: #7A5300;
    --pharmacy-tint: #D3F1F1;  --pharmacy-ink: #145C5C;
    --home-tint: #EFE8FF;      --home-ink: #4B2E91;
    --other-tint: #F1EEF6;     --other-ink: #4A4458;

    --font-display: 'Fredoka', 'Nunito', system-ui, sans-serif;
    --font-body: 'Nunito', system-ui, sans-serif;
    --font-hand: 'Caveat', 'Segoe Print', cursive;

    --sidebar-w: 248px;
    --tabbar-h: 72px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #16122A;
        --surface: #221C3B;
        --surface-2: #2E2752;
        --ink: #F3EFFF;
        --ink-2: #BDB4DA;
        --line: #3A325E;
        --primary: #B6A5FF;
        --primary-ink: #CFC4FF;
        --on-primary: #1A1238;
        --primary-muted: #4D4478;
        --shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
        --shadow-lift: 0 10px 28px rgba(0, 0, 0, 0.45);
        --scrim: rgba(5, 3, 15, 0.62);
        --tag-on-tint: rgba(0, 0, 0, 0.25);
        --new-dot: #FF7FA3;
        --new-ink: #FFB3CA;
        --new-bg: #4D2034;
        --alex-bg: #3A2F66;
        --sam-bg: #4A3226;
        --lock-ink: #D3C6FF;
        --late: #FFA191;
        --late-bg: #3A1F24;
        --ok: #7FD3A6;
        --ok-ink: #A6E6C3;
        --ok-bg: #1B3A2B;
        --handle: #3A325E;

        --date-tint: #4A2C1E;   --date-ink: #FFC7A8;
        --gift-tint: #1D2F50;   --gift-ink: #AECDFF;
        --memory-tint: #173D2D; --memory-ink: #A3E6C3;
        --love-tint: #4D2034;   --love-ink: #FFB3CA;

        --groceries-tint: #463A12; --groceries-ink: #FFE08A;
        --pharmacy-tint: #143A3A;  --pharmacy-ink: #9FE3E3;
        --home-tint: #2E2752;      --home-ink: #D3C6FF;
        --other-tint: #2B2738;     --other-ink: #D9D3E8;
        color-scheme: dark;
    }
}

.cat-date { --tint: var(--date-tint); --tone: var(--date-ink); }
.cat-gift { --tint: var(--gift-tint); --tone: var(--gift-ink); }
.cat-memory { --tint: var(--memory-tint); --tone: var(--memory-ink); }
.cat-love { --tint: var(--love-tint); --tone: var(--love-ink); }
.list-groceries { --tint: var(--groceries-tint); --tone: var(--groceries-ink); }
.list-pharmacy { --tint: var(--pharmacy-tint); --tone: var(--pharmacy-ink); }
.list-home { --tint: var(--home-tint); --tone: var(--home-ink); }
.list-other { --tint: var(--other-tint); --tone: var(--other-ink); }

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
a { color: var(--primary-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }

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

.display { font-family: var(--font-display); font-weight: 600; }
.hand { font-family: var(--font-hand); font-weight: 700; }
.hand--accent { color: var(--primary); font-size: 1.1em; margin-left: 6px; }
.meta { font-size: 14px; color: var(--ink-2); }
.eyebrow { font-size: 15px; font-weight: 700; color: var(--ink-2); }
.accent { color: var(--primary); }
.late { color: var(--late); }
.ok { color: var(--ok); }

.sr-only, .sr-only-focusable:not(:focus) {
    position: absolute !important;
    width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Shell ---------- */

.app-shell { min-height: 100vh; display: flex; }
.app-main { flex: 1; min-width: 0; }

.sidebar { display: none; }

.tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 30;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 6px 12px env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tabbar__link {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 56px;
    color: var(--ink-2);
    text-decoration: none;
    font-size: 13px; font-weight: 700; line-height: 1.15; text-align: center;
}
.tabbar__icon { width: 56px; height: 30px; border-radius: 15px; display: flex; align-items: center; justify-content: center; }
.tabbar__link.active { color: var(--primary); font-weight: 800; }
.tabbar__link.active .tabbar__icon { background: var(--surface-2); }

@media (min-width: 900px) {
    .tabbar { display: none; }
    .sidebar {
        display: flex; flex-direction: column; gap: 24px;
        width: var(--sidebar-w); flex-shrink: 0;
        height: 100vh; position: sticky; top: 0;
        padding: 28px 20px;
    }
    .sidebar__brand { display: flex; align-items: center; gap: 12px; }
    .sidebar__names { font-size: 20px; line-height: 1.15; }
    .sidebar__nav { display: flex; flex-direction: column; gap: 6px; }
    .sidebar__link {
        min-height: 48px; padding: 0 14px; border-radius: 16px;
        display: flex; align-items: center; gap: 12px;
        color: var(--ink-2); text-decoration: none;
        font-family: var(--font-display); font-size: 17px; font-weight: 500;
    }
    .sidebar__link:hover { background: var(--surface-2); color: var(--ink); }
    .sidebar__link.active { background: var(--surface); color: var(--primary-ink); font-weight: 600; box-shadow: var(--shadow); }
}

.page { max-width: 760px; margin: 0 auto; padding: 20px 20px calc(var(--tabbar-h) + 40px); }
.page--with-capture { padding-bottom: calc(var(--tabbar-h) + 132px); }
.page--narrow { max-width: 520px; }
@media (min-width: 900px) {
    .page { padding: 32px 32px 48px; }
    .page--with-capture { padding-bottom: 140px; }
}

/* ---------- Auth pages (Identity) ---------- */

.auth-shell { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 32px 16px 48px; gap: 16px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--ink); text-decoration: none; font-size: 26px; }
.auth-card { width: 100%; max-width: 560px; background: var(--surface); border-radius: 28px; padding: 28px 24px; box-shadow: var(--shadow); }
.auth-card h1 { font-family: var(--font-display); font-weight: 600; font-size: 28px; margin-bottom: 8px; }
.auth-card h2, .auth-card h3 { font-family: var(--font-display); font-weight: 500; font-size: 18px; color: var(--ink-2); margin-bottom: 12px; }
.auth-card hr { display: none; }
.auth-card .btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); border-radius: 26px; font-family: var(--font-display); font-weight: 600; min-height: 52px; }
.auth-card .form-control { border-radius: 16px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); }
.auth-card .form-control:focus { border-color: var(--primary); box-shadow: none; }
.auth-card .col-lg-6, .auth-card .col-lg-4, .auth-card .col-md-4, .auth-card .col-md-6 { width: 100%; max-width: 100%; flex: 1 1 100%; margin-left: 0; }

/* ---------- Page header ---------- */

.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.page-header__text { display: flex; flex-direction: column; min-width: 0; }
.page-title { font-size: 30px; line-height: 1.1; margin-top: 2px; }

.new-pill {
    align-self: flex-start;
    display: inline-flex; align-items: center; gap: 7px;
    min-height: 44px; margin: 4px 0 -4px -2px; padding: 0 14px 0 12px;
    border: 0; border-radius: 22px;
    background: var(--new-bg); color: var(--new-ink);
    font-size: 14px; font-weight: 800; text-decoration: none;
}
.new-pill.is-on { background: var(--new-dot); color: #FFFFFF; }
.new-pill.is-on .dot { background: #FFFFFF; }
.dot { width: 8px; height: 8px; border-radius: 4px; background: var(--new-dot); flex-shrink: 0; }

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }

/* ---------- Search & chips ---------- */

.search {
    display: flex; align-items: center; gap: 10px;
    height: 48px; padding: 0 16px;
    background: var(--surface); border-radius: 24px; box-shadow: var(--shadow);
    color: var(--ink-2);
}
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 16px; font-weight: 600; color: var(--ink); }
.search:focus-within { outline: 3px solid var(--primary); outline-offset: 2px; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 12px 20px 4px; margin: 0 -20px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
    flex-shrink: 0; display: inline-flex; align-items: center; gap: 7px;
    height: 44px; padding: 0 14px 0 12px;
    border: 0; border-radius: 22px;
    background: var(--tint); color: var(--tone);
    font-family: var(--font-display); font-size: 15px; font-weight: 500; white-space: nowrap;
}
.chip__count { font-family: var(--font-body); font-size: 13px; font-weight: 800; opacity: 0.85; }
.chip.is-on { background: var(--tone); color: var(--tint); }
.chip--all { --tint: var(--surface); --tone: var(--primary-ink); box-shadow: var(--shadow); }
.chip--all.is-on { background: var(--primary); color: var(--on-primary); box-shadow: none; }

/* ---------- Sections ---------- */

.section-title { font-size: 30px; line-height: 1.1; margin: 18px 4px 6px; }
.section-title--small { font-size: 28px; margin-top: 16px; }
.section-title--flush { margin: 0 0 8px; }
.section-title.late { color: var(--late); }
.section-title.done { color: var(--ok); }
.section-hint { display: flex; align-items: center; gap: 6px; margin: -2px 4px 8px; }

.carousel { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; padding: 6px 20px 14px; margin: 0 -20px; }
.carousel::-webkit-scrollbar { display: none; }
.carousel--bleed { padding: 2px 14px 8px; margin: 0 -14px; }

/* ---------- Notes ---------- */

.tag {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px 4px 8px; border-radius: 12px;
    background: var(--tint); color: var(--tone);
    font-family: var(--font-display); font-size: 13px; font-weight: 600;
}
.tag--on-tint { background: var(--tag-on-tint); }

.kept-card {
    flex-shrink: 0; width: 240px; min-height: 168px;
    padding: 14px 16px; border-radius: 24px;
    background: var(--tint); color: var(--ink);
    display: flex; flex-direction: column; gap: 8px;
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
    position: relative;
}
.kept-card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kept-card__body { flex: 1; font-size: 16px; font-weight: 700; line-height: 1.35; }
.kept-card__meta { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--tone); }
.kept-card .new-flag { color: var(--tone); }

.love-title { font-size: 26px; line-height: 1; color: var(--tone); }

.note-list { display: flex; flex-direction: column; gap: 10px; }
.note-card {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 14px; border-radius: 22px;
    background: var(--surface); box-shadow: var(--shadow);
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
    position: relative;
}
.note-card .blob { flex-shrink: 0; }
.note-card__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.note-card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.note-card__body { font-size: 16px; font-weight: 600; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.note-card__meta { display: flex; flex-wrap: wrap; column-gap: 10px; row-gap: 2px; font-size: 14px; font-weight: 600; color: var(--ink-2); }

.new-flag { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 800; color: var(--new-ink); flex-shrink: 0; }
.seen-flag { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; color: var(--ink-2); flex-shrink: 0; }
.lock-flag { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; color: var(--lock-ink); }

.mini-btn { position: absolute; top: 8px; right: 8px; min-height: 36px; padding: 0 12px; border: 0; border-radius: 18px; background: var(--surface); color: var(--primary-ink); font-size: 13px; font-weight: 800; box-shadow: var(--shadow); }

@media (min-width: 900px) {
    .note-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; gap: 14px; }
    .chips, .carousel { flex-wrap: wrap; overflow: visible; margin: 0; padding-left: 0; padding-right: 0; }
}

/* ---------- Capture bar ---------- */

.capture-wrap {
    position: fixed; z-index: 25;
    left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 8px 12px;
    background: var(--bg);
}
@media (min-width: 900px) {
    .capture-wrap { left: var(--sidebar-w); bottom: 0; padding: 12px 32px 20px; }
}
.capture-wrap > * { max-width: 736px; margin-left: auto; margin-right: auto; }

.capture {
    display: flex; align-items: center; gap: 6px;
    padding: 6px; border-radius: 28px;
    background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.capture__category {
    flex-shrink: 0; height: 44px; padding: 0 8px 0 10px;
    display: inline-flex; align-items: center; gap: 3px;
    border: 1.5px dashed var(--tone); border-radius: 16px;
    background: var(--tint); color: var(--tone);
}
.capture__field { flex: 1; min-width: 0; display: flex; }
.capture__field--padded { padding-left: 10px; }
.capture__field input { flex: 1; min-width: 0; height: 44px; border: 0; outline: none; background: transparent; font-size: 16px; font-weight: 600; color: var(--ink); }
.capture:focus-within { outline: 3px solid var(--primary); outline-offset: 2px; }

.capture-menu {
    width: 270px; margin: 0 0 8px; padding: 12px;
    border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-lift);
    display: flex; flex-direction: column; gap: 4px;
}
.capture-wrap > .capture-menu { margin-left: 0; }
.capture-menu__title { padding: 0 6px 6px; font-weight: 800; }
.capture-menu__item {
    min-height: 48px; padding: 6px 8px; border: 0; border-radius: 14px; background: transparent;
    display: flex; align-items: center; gap: 10px; text-align: left; font-size: 16px; font-weight: 700;
}
.capture-menu__item[aria-pressed="true"] { background: var(--surface-2); }
.capture-menu__item > span:nth-child(2) { flex: 1; }
.tile { width: 36px; height: 36px; flex-shrink: 0; border-radius: 12px; background: var(--tint); color: var(--tone); display: flex; align-items: center; justify-content: center; }

.parse-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 8px 6px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.parse-preview strong { color: var(--ink); }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 8px 18px;
    border: 0; border-radius: 24px;
    font-family: var(--font-display); font-size: 16px; font-weight: 600; text-decoration: none;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.55; }
.btn--primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 6px 16px rgba(91, 63, 208, 0.25); }
.btn--soft { background: var(--surface); color: var(--primary-ink); box-shadow: var(--shadow); }
.btn--ok { background: var(--ok-bg); color: var(--ok-ink); font-family: var(--font-body); font-size: 15px; font-weight: 800; }
.btn--block { width: 100%; min-height: 56px; border-radius: 28px; font-size: 18px; }
.btn--big { min-height: 56px; padding: 10px 26px; border-radius: 28px; font-size: 18px; }
.btn--grow { flex: 1; min-height: 56px; border-radius: 28px; font-size: 18px; }

.icon-btn {
    width: 44px; height: 44px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 22px; background: transparent; color: var(--ink-2);
}
.icon-btn--primary { background: var(--primary); color: var(--on-primary); }
.icon-btn--primary:disabled { background: var(--primary-muted); }
.icon-btn--soft { background: var(--surface-2); color: var(--primary-ink); }
.icon-btn--raised { background: var(--surface); color: var(--primary-ink); box-shadow: var(--shadow); }
.icon-btn--small { width: 36px; height: 36px; margin: -8px -4px -8px 0; }

.text-btn { min-height: 44px; padding: 0 10px; border: 0; background: transparent; color: var(--primary-ink); font-size: 15px; font-weight: 800; }
.text-btn--danger { color: var(--late); }

.take-btn {
    flex-shrink: 0; max-width: 128px; min-height: 44px; padding: 6px 12px;
    border: 1.5px dashed var(--primary); border-radius: 22px;
    background: var(--bg); color: var(--primary-ink);
    font-family: var(--font-display); font-size: 14px; font-weight: 600; line-height: 1.15;
}

/* ---------- Toast ---------- */

.toast {
    position: fixed; z-index: 60;
    left: 50%; transform: translateX(-50%);
    bottom: calc(var(--tabbar-h) + 96px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 32px);
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px; border-radius: 20px;
    background: var(--ink); color: var(--bg);
    font-size: 15px; font-weight: 700; box-shadow: var(--shadow-lift);
    animation: toast-in 0.18s ease-out;
}
.toast--high { bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); }
.toast__heart { color: #FF6B8A; }
@media (min-width: 900px) { .toast, .toast--high { bottom: 104px; margin-left: calc(var(--sidebar-w) / 2); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- Sheet ---------- */

.sheet-backdrop {
    position: fixed; inset: 0; z-index: 50;
    background: var(--scrim);
    display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
    width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
    background: var(--surface); color: var(--ink);
    border-radius: 32px 32px 0 0;
    padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
    animation: sheet-in 0.2s ease-out;
}
@media (min-width: 700px) {
    .sheet-backdrop { align-items: center; }
    .sheet { border-radius: 28px; padding-bottom: 24px; }
    .sheet__handle { display: none; }
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0.6; } }
.sheet__handle { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 10px; }
.sheet__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sheet__title { font-family: var(--font-display); font-size: 24px; font-weight: 600; }
.sheet__body { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Forms ---------- */

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field__label { font-size: 14px; font-weight: 800; color: var(--ink-2); padding: 0; }
.field input, .field textarea, .field select, .inline-form input {
    border: 2px solid var(--line); border-radius: 16px;
    padding: 12px 14px; min-height: 50px;
    background: var(--bg); color: var(--ink);
    font-size: 16px; font-weight: 600; outline: none; resize: vertical;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--primary); }
.field--inline { flex-direction: row; align-items: center; gap: 10px; margin-top: 10px; }
.field--inline input { width: auto; }
.field--grow { flex: 1; min-width: 200px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 10px 0 6px; }
.form-error { color: var(--late); font-weight: 700; font-size: 15px; }
.form-ok { color: var(--ok); font-weight: 700; font-size: 15px; }
.form-actions { display: flex; align-items: center; gap: 10px; }

.tile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pick-tile {
    min-height: 52px; padding: 6px 10px;
    display: flex; align-items: center; gap: 8px; text-align: left;
    border: 2px solid var(--line); border-radius: 16px;
    background: var(--surface); color: var(--tone);
    font-family: var(--font-display); font-size: 15px; font-weight: 500; line-height: 1.15;
}
.pick-tile.is-on { background: var(--tint); border-color: var(--tone); }
.pick-tile__icon { width: 36px; height: 36px; flex-shrink: 0; border-radius: 12px; background: var(--tint); display: flex; align-items: center; justify-content: center; }

.radio-card { display: flex; flex-direction: column; border: 2px solid var(--line); border-radius: 20px; overflow: hidden; }
.radio-card__row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px; cursor: pointer; }
.radio-card__row + .radio-card__row { border-top: 1px solid var(--line); }
.radio-card__row.is-on { background: var(--surface-2); }
.radio-card__row input { width: 20px; height: 20px; accent-color: var(--primary); flex-shrink: 0; }
.radio-card__text { display: flex; flex-direction: column; gap: 2px; }
.radio-card__label { display: inline-flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 800; }

.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); grid-auto-flow: column; gap: 4px; padding: 4px; border-radius: 24px; background: var(--surface-2); }
.seg__btn { min-height: 44px; padding: 4px 6px; border: 0; border-radius: 20px; background: transparent; color: var(--ink-2); font-size: 14px; font-weight: 800; line-height: 1.15; text-align: center; }
.seg__btn.is-on { background: var(--surface); color: var(--primary-ink); box-shadow: 0 2px 8px rgba(90, 64, 170, 0.18); }

.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { min-height: 44px; padding: 0 14px; border: 2px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 800; }
.pill.is-on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.pill--dashed { min-height: 38px; border-style: dashed; color: var(--primary-ink); font-size: 14px; }

.days { display: flex; justify-content: space-between; gap: 4px; margin-top: 10px; }
.day { width: 44px; height: 44px; border: 2px solid var(--line); border-radius: 22px; background: var(--surface); font-family: var(--font-display); font-size: 16px; font-weight: 600; }
.day.is-on { background: var(--surface-2); border-color: var(--primary); color: var(--primary-ink); }

.settings { display: flex; flex-direction: column; border: 2px solid var(--line); border-radius: 20px; overflow: hidden; }
.settings__row {
    display: flex; align-items: center; gap: 12px;
    min-height: 58px; padding: 8px 14px;
    border: 0; background: var(--surface); text-align: left; width: 100%;
}
.settings__row + .settings__row { border-top: 1px solid var(--line); }
.settings__text { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.settings__label { font-size: 16px; font-weight: 800; }
.settings__input { border: 0; background: transparent; color: var(--primary-ink); font-weight: 700; text-align: right; max-width: 55%; min-height: 44px; }

.switch { width: 52px; height: 32px; flex-shrink: 0; padding: 3px; border-radius: 16px; background: var(--line); display: flex; transition: background 0.15s; }
.switch span { width: 26px; height: 26px; border-radius: 13px; background: #FFFFFF; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.15s; }
.switch.is-on { background: var(--primary); }
.switch.is-on span { transform: translateX(20px); }

.stepper { display: inline-flex; align-items: center; gap: 4px; padding: 2px; border: 2px solid var(--line); border-radius: 26px; align-self: flex-start; margin-bottom: 8px; }
.stepper__value { min-width: 56px; text-align: center; font-family: var(--font-display); font-size: 22px; font-weight: 600; }

/* ---------- Fridge (Home & lists) ---------- */

.fridge {
    position: relative;
    margin: 8px -8px 0; padding: 14px 14px 20px;
    border-radius: 32px; background: var(--surface);
    box-shadow: 0 -2px 0 var(--line), var(--shadow-lift);
}
.fridge__handle { position: absolute; top: 22px; right: -5px; width: 8px; height: 72px; border-radius: 4px; background: var(--handle); }

.summary {
    position: relative; margin: 10px 2px 4px; padding: 16px;
    border-radius: 22px; background: var(--love-tint); color: var(--love-ink);
    display: flex; align-items: center; gap: 12px;
}
.summary__title { font-family: var(--font-display); font-size: 17px; font-weight: 600; line-height: 1.2; }
.summary__sub { font-size: 14px; font-weight: 700; }
.magnet { position: absolute; top: -9px; width: 22px; height: 22px; border-radius: 11px; box-shadow: 0 2px 0 rgba(46, 38, 69, 0.15), inset -3px -3px 0 rgba(0, 0, 0, 0.08); }
.magnet--pink { left: 18px; background: #E8436E; }
.magnet--lilac { right: 18px; background: #B9A2FF; }

.list-card {
    position: relative; flex-shrink: 0;
    width: 148px; min-height: 112px; padding: 12px 14px;
    border: 0; border-radius: 22px;
    background: var(--tint); color: var(--tone);
    display: flex; flex-direction: column; gap: 6px; text-decoration: none; text-align: left;
}
.list-card__magnet { position: absolute; top: -6px; right: 16px; width: 18px; height: 18px; border-radius: 9px; background: var(--tone); box-shadow: 0 2px 0 rgba(46, 38, 69, 0.15); }
.list-card__icon { width: 36px; height: 36px; border-radius: 12px; background: var(--tag-on-tint); display: flex; align-items: center; justify-content: center; }
.list-card__name { font-family: var(--font-display); font-size: 17px; font-weight: 600; line-height: 1.15; }
.list-card__count { font-size: 14px; font-weight: 800; }
.list-card--new { --tint: transparent; --tone: var(--primary-ink); width: 116px; border: 2px dashed var(--primary-muted); align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 600; }

.rows { display: flex; flex-direction: column; gap: 8px; }
.lrow {
    display: flex; align-items: center; gap: 2px;
    min-height: 64px; padding: 8px 8px 8px 2px;
    border: 1px solid var(--line); border-radius: 20px;
    background: var(--surface);
}
.lrow--late { background: var(--late-bg); }
.lrow--done { background: transparent; border-style: dashed; }
.lrow--basket { min-height: 52px; background: transparent; border: 0; }
.lrow--flash { background: var(--tint); transition: background 0.4s; }
.lrow__main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.lrow__main--button { border: 0; background: transparent; padding: 4px 0; text-align: left; min-height: 48px; justify-content: center; }
.lrow__title { border: 0; background: transparent; padding: 0; text-align: left; font-size: 16px; font-weight: 800; line-height: 1.3; color: var(--ink); }
.lrow__title--static { cursor: inherit; }
.lrow__title--struck { flex: 1; color: var(--ink-2); text-decoration: line-through; }
.lrow__meta { display: flex; flex-wrap: wrap; align-items: center; column-gap: 10px; row-gap: 2px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.lrow__meta > span { display: inline-flex; align-items: center; gap: 4px; }
.lrow__meta .turns { color: var(--lock-ink); }

.check { width: 44px; height: 44px; flex-shrink: 0; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; }
.check__box { width: 26px; height: 26px; border-radius: 9px; border: 2.5px solid var(--primary-muted); background: var(--surface); display: flex; align-items: center; justify-content: center; color: #FFFFFF; }
.check--late .check__box { border-color: var(--late); }
.check--list .check__box { border-color: var(--tone); }
.check--done .check__box { background: var(--ok); border-color: var(--ok); }
.check:hover .check__box { border-color: var(--primary); }

.who-btn { min-width: 48px; height: 48px; flex-shrink: 0; padding: 0 2px; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; }
.who-btn__second { margin-left: -16px; display: flex; }

.link-chip {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 36px; margin-top: 2px; padding: 4px 10px 4px 8px;
    border-radius: 18px; background: var(--tint); color: var(--tone);
    font-size: 14px; font-weight: 800; text-decoration: none;
}

.thanks-btn {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 36px; margin-top: 4px; padding: 0 12px 0 10px;
    border: 1.5px solid #F2B8C8; border-radius: 18px;
    background: var(--surface); color: var(--love-ink);
    font-size: 14px; font-weight: 800;
}
.thanks-btn svg { color: var(--heart); }
.thanks-btn.is-on { background: var(--love-tint); }

/* ---------- Shopping list ---------- */

.list-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.list-header__icon { width: 54px; height: 54px; flex-shrink: 0; border-radius: 18px; background: var(--tint); color: var(--tone); display: flex; align-items: center; justify-content: center; }
.list-header__text { flex: 1; min-width: 0; }

.linked-chore { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 20px; background: var(--bg); }
.linked-chore__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.linked-chore__title { font-weight: 800; color: var(--ink); text-decoration: none; }

.suggest { margin-top: 12px; padding: 10px 6px 12px 14px; border: 1.5px dashed var(--line); border-radius: 20px; display: flex; flex-direction: column; gap: 6px; }
.suggest--soft { border: 0; background: var(--bg); padding: 12px 14px; }
.suggest__head { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 800; color: var(--ink-2); }
.suggest__head span { flex: 1; }
.suggest__title { font-size: 26px; line-height: 1; }
.suggest__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.list-ink { color: var(--tone); }

.qty-chip {
    min-height: 44px; padding: 0 12px 0 10px;
    display: inline-flex; align-items: center; gap: 6px;
    border: 0; border-radius: 22px; background: var(--tint); color: var(--tone);
    font-size: 15px; font-weight: 800;
}
.qty-chip__freq { font-size: 13px; font-weight: 700; opacity: 0.85; }
.qty-pill { padding: 1px 8px; border-radius: 10px; background: var(--tint); color: var(--tone); font-weight: 800; }

.basket-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.basket-head .section-title { margin-bottom: 4px; }

.danger-zone { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 8px; margin-top: 24px; }

.trips { display: flex; flex-direction: column; gap: 8px; }
.trip { border: 2px solid var(--line); border-radius: 20px; overflow: hidden; }
.trip.is-on { border-color: var(--primary); background: var(--bg); }
.trip__head { width: 100%; min-height: 64px; padding: 10px 14px; border: 0; background: transparent; display: flex; align-items: center; gap: 12px; text-align: left; }
.trip__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.trip__preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trip__lines { padding: 0 14px 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.radio-dot { width: 22px; height: 22px; flex-shrink: 0; border-radius: 11px; border: 2px solid var(--ink-2); }
.trip.is-on .radio-dot { border-color: var(--primary); box-shadow: inset 0 0 0 4px var(--bg), inset 0 0 0 11px var(--primary); }

.pick-chip {
    min-height: 44px; padding: 0 12px 0 10px;
    display: inline-flex; align-items: center; gap: 6px;
    border: 2px solid var(--line); border-radius: 22px;
    background: var(--surface); color: var(--tone);
    font-size: 15px; font-weight: 800;
}
.pick-chip.is-on { background: var(--tint); border-color: var(--tone); }
.pick-chip--onlist { border-style: dashed; background: var(--bg); color: var(--ink-2); }

/* ---------- Us & join ---------- */

.card { background: var(--surface); border-radius: 24px; padding: 20px; box-shadow: var(--shadow); margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.partner { display: flex; align-items: center; gap: 12px; }
.partner__name { font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.pending { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: var(--bg); }
.pending__text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.account-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.account-actions form { margin: 0; }

.join { align-items: center; text-align: center; padding: 32px 24px; margin-top: 24px; gap: 14px; }
.join__title { font-size: 36px; line-height: 1.05; }
.join__actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; }

/* ---------- Empty & loading ---------- */

.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 20px; text-align: center; color: var(--ink-2); }
.empty--compact { padding: 20px 12px; }
.empty__title { font-size: 34px; line-height: 1.05; color: var(--ink); }
.empty p { max-width: 320px; font-size: 16px; font-weight: 600; }
.empty .btn { margin-top: 8px; }

.skeleton-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.skeleton { height: 88px; border-radius: 22px; background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Blazor error UI ---------- */

#blazor-error-ui {
    display: none; position: fixed; z-index: 1000; left: 0; right: 0; bottom: 0;
    padding: 12px 20px; background: var(--late-bg); color: var(--late); font-weight: 700;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.2);
}
#blazor-error-ui .reload { margin-left: 8px; }
#blazor-error-ui .dismiss { float: right; border: 0; background: transparent; color: inherit; font-size: 20px; }

.blazor-error-boundary { padding: 16px; border-radius: 16px; background: var(--late-bg); color: var(--late); }
.blazor-error-boundary::after { content: "Something went wrong here."; }

.validation-message, .text-danger { color: var(--late); }
