:root {
    color-scheme: light;
    --ink: #1e293b;
    --muted: #64748b;
    --green: #1e40af;
    --green-dark: #1e3a8a;
    --cream: #fff;
    --line: rgba(30, 64, 175, .12);
    --white: #f8fafc;
}

[data-theme="dark"] {
    color-scheme: dark;
    --ink: #f8fafc;
    --muted: #94a3b8;
    --green: #fff;
    --green-dark: #e2e8f0;
    --cream: #0f172a;
    --line: rgba(255, 255, 255, .15);
    --white: #1e293b;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--cream);
    color: var(--ink);
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .4rem; font-size: clamp(2rem, 5vw, 3rem); line-height: 1.15; }
h2 { margin-bottom: .65rem; font-size: 1.2rem; }
.auth-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.card {
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--white);
    box-shadow: 0 12px 36px rgba(40, 65, 48, .06);
}
.auth-card { width: min(100%, 440px); padding: clamp(24px, 6vw, 40px); }
.brand { color: var(--green-dark); font-size: 1.3rem; font-weight: 750; }
.eyebrow { margin: 26px 0 8px; color: var(--green); font-size: .85rem; font-weight: 700; letter-spacing: .04em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.form { display: grid; gap: 10px; margin: 26px 0 18px; }
.form label { margin-top: 5px; font-size: .92rem; font-weight: 650; }
.form input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 13px 14px;
    color: var(--ink);
    font: inherit;
}
.form input:focus { outline: 3px solid rgba(76, 128, 99, .18); border-color: var(--green); }
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border: 0;
    border-radius: 12px;
    padding: 11px 18px;
    background: var(--green);
    color: white;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.button:hover { background: var(--green-dark); }
.text-link { display: inline-block; margin-top: 8px; font-weight: 650; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px max(24px, calc((100vw - 1080px) / 2)); background: white; border-bottom: 1px solid var(--line); }
.topbar nav { display: flex; align-items: center; gap: 20px; }
.site-nav { flex-wrap: wrap; justify-content: flex-end; gap: 12px 16px !important; }
.nav-group { position: relative; }
.nav-group summary { color: var(--green-dark); cursor: pointer; font-weight: 600; list-style: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after { content: " ▾"; font-size: .8em; }
.nav-group > div { position: absolute; z-index: 20; top: calc(100% + 8px); left: 0; display: grid; min-width: 170px; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: 0 10px 24px rgba(40,65,48,.12); }
.inline-form { display: inline-flex; margin: 0; }
.link-button { border: 0; padding: 0; background: none; color: var(--green-dark); font: inherit; cursor: pointer; }
.link-button:hover { text-decoration: underline; }
.form-error { border: 1px solid #e7b9b0; border-radius: 10px; padding: 12px 14px; background: #fff4f1; color: #8d3424; }
.form-error ul { margin: 0; padding-left: 20px; }
.notice { border-radius: 10px; padding: 12px 14px; background: #eaf3eb; color: var(--green-dark); }
.panel { margin-top: 20px; padding: 22px; }
.member-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.member-list li { display: flex; align-items: center; gap: 16px; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 12px 0; }
.member-list li:last-child { border-bottom: 0; }
.role { min-width: 100px; color: var(--muted); }
.role-form, .invite-row { display: flex; align-items: center; gap: 8px; }
.role-form select, .invite-row input { min-height: 40px; border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; background: white; color: var(--ink); font: inherit; }
.invite-row input { flex: 1; min-width: 0; }
.button-small { min-height: 38px; padding: 7px 12px; font-size: .9rem; }
.button-secondary { border: 1px solid var(--line); background: white; color: var(--ink); }
.button-secondary:hover { background: #f1f5ef; }
.button-danger { border: 1px solid #e7b9b0; background: #fff4f1; color: #8d3424; }
.button-danger:hover { background: #fce3dd; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.filter-tabs { display: flex; gap: 8px; margin: 22px 0; overflow-x: auto; border-bottom: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
.filter-tabs a { flex: 0 0 auto; padding: 10px 14px; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.filter-tabs a.active { color: var(--green-dark); border-bottom-color: var(--green); font-weight: 700; }
.task-list { display: grid; gap: 12px; }
.task-row { display: flex; justify-content: space-between; gap: 18px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.task-row.task-overdue { border-left: 5px solid #c74736; background: #fff8f6; }
.task-row.task-important { box-shadow: inset 0 0 0 1px #e2b34a; }
.task-main { min-width: 0; flex: 1; }
.task-title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.task-title { color: var(--ink); font-size: 1.05rem; font-weight: 700; }
.task-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 5px; color: var(--muted); font-size: .9rem; }
.important-badge, .overdue-badge { border-radius: 999px; padding: 2px 8px; font-size: .76rem; font-weight: 700; }
.important-badge { background: #fff1c9; color: #815b00; }
.overdue-badge, .text-overdue { color: #a63224; }
.overdue-badge { background: #ffe3dd; }
.task-checklist { display: flex; flex-wrap: wrap; gap: 5px 16px; margin: 8px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: .88rem; }
.checklist-done { text-decoration: line-through; }
.task-actions { display: flex; align-items: flex-start; gap: 7px; }
.task-actions form { display: inline-flex; }
.today-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.today-grid .card:last-child { grid-column: 1 / -1; }
.quick-task { margin-bottom: 18px; }
.quick-task-form { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(180px, .65fr) auto; align-items: center; gap: 10px; }
.quick-task-form input, .quick-task-form select, .task-edit-form input:not([type=checkbox]), .task-edit-form textarea, .task-edit-form select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px 12px;
    color: var(--ink);
    background: white;
    font: inherit;
}
.task-edit-form { gap: 10px; }
.task-edit-form label { margin-top: 4px; font-weight: 650; }
.task-edit-form .checkbox-label, .checklist-edit-row label { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.task-edit-form input[type=checkbox], .checklist-edit-row input[type=checkbox] { width: auto; }
.checklist-editor { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.checklist-editor legend { padding: 0 6px; font-weight: 700; }
#checklist-items { display: grid; gap: 8px; }
.checklist-edit-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.narrow-page { max-width: 720px; }
.rotate-invite-form { margin-top: 12px; }
.event-section { margin-top: 24px; }
.event-section > h2 { margin-bottom: 12px; }
.event-filter-form { display: flex; align-items: center; gap: 10px; margin: 20px 0; }
.event-filter-form label { font-weight: 650; }
.event-filter-form select { border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; background: white; color: var(--ink); font: inherit; }
.event-row { display: flex; align-items: flex-start; gap: 12px; padding: 15px 16px; margin-bottom: 10px; background: white; border: 1px solid var(--line); border-left: 5px solid #a5a5a5; border-radius: 12px; }
.event-birthday { border-left-color: #7b4aa1; }
.event-vacation { border-left-color: #e0a62e; }
.event-row.event-section { border-left-color: #286aa6; }
.event-other { border-left-color: #8290bb; }
.event-type-mark { font-size: 1.25rem; }
.event-content { flex: 1; min-width: 0; }
.event-title-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.event-type-label { display: inline-block; border-radius: 999px; padding: 2px 8px; background: #f0f2ee; color: var(--muted); font-size: .78rem; }
.event-date, .event-participants, .event-description { margin: 5px 0 0; color: var(--muted); font-size: .9rem; }
.event-actions { display: flex; gap: 7px; }
.event-actions form { display: inline-flex; }
.past-events summary { cursor: pointer; }
.past-events summary h2 { display: inline-block; margin: 0 0 0 5px; }
.upcoming-event-list { margin: 12px 0; padding: 0; list-style: none; }
.upcoming-event-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.event-type-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #8290bb; }
.event-type-dot.event-birthday { background: #7b4aa1; }
.event-type-dot.event-vacation { background: #e0a62e; }
.event-type-dot.event-section { background: #286aa6; }
.event-type-dot.event-other { background: #8290bb; }
.calendar-page { max-width: 1200px; }
.calendar-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.calendar-heading h1 { margin: 0; }
.calendar-navigation { display: flex; flex-wrap: wrap; gap: 8px; }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 18px 0 10px; color: var(--muted); font-size: .88rem; }
.calendar-legend span { display: inline-flex; align-items: center; gap: 7px; }
.calendar-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #8290bb; }
.calendar-legend .legend-birthday::before { background: #7b4aa1; }
.calendar-legend .legend-vacation::before { background: #e0a62e; }
.calendar-legend .legend-section::before { background: #286aa6; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.calendar-weekday { padding: 9px 6px; text-align: center; font-weight: 700; color: var(--muted); background: #f5f7f2; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.calendar-day { min-height: 112px; padding: 7px; background: white; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.calendar-day.outside-month { background: #f8f9f7; color: #999; }
.calendar-day.calendar-today { box-shadow: inset 0 0 0 2px var(--green); }
.calendar-day-number { display: inline-flex; align-items: center; justify-content: center; width: 27px; height: 27px; border-radius: 50%; font-weight: 700; color: var(--ink); }
.calendar-day-events { display: grid; gap: 4px; margin-top: 5px; }
.calendar-event { display: block; overflow: hidden; padding: 3px 5px; border-radius: 5px; background: #e9ebf4; color: #39456e; font-size: .77rem; text-overflow: ellipsis; white-space: nowrap; }
.calendar-event.event-birthday { background: #eee5f5; color: #512c70; }
.calendar-event.event-vacation { background: #fff2d3; color: #805b12; }
.calendar-event.event-section { background: #e2eff9; color: #17476f; }
.calendar-event.event-other { background: #e9ebf4; color: #39456e; }
.calendar-more { font-size: .78rem; font-weight: 700; }
.morning-digest { margin-top: 18px; }
.reminder-panel { margin: 14px 0; }
.reminder-row, .shopping-preview-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.reminder-row:last-child, .shopping-preview-row:last-child { border-bottom: 0; }
.reminder-row > div { display: grid; gap: 4px; }
.shopping-add-form { display: grid; grid-template-columns: 1fr 220px auto; gap: 10px; }
.shopping-add-form input, .shopping-add-form select { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; color: var(--ink); background: white; font: inherit; }
.favorite-list { display: grid; gap: 8px; padding-left: 20px; }
.favorite-list li { padding-left: 3px; }
.favorite-list li span { margin-left: 10px; }
.shopping-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 8px 0; border: 1px solid var(--line); border-radius: 11px; background: white; }
.shopping-row { min-width: 0; }
.shopping-row.shopping-bought { background: #f6f7f5; color: var(--muted); }
.shopping-toggle { display: flex; }
.shopping-check { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: white; color: var(--green-dark); cursor: pointer; font-size: 1.1rem; }
.shopping-item-info { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.shopping-bought .shopping-item-info strong { text-decoration: line-through; }
.plan-banner { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 16px 0; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; }
.trial-banner { background: #fff5cf; border-color: #e7ca68; color: #614b04; }
.free-banner { background: #f0f1ef; color: #4d514c; }
.billing-page { max-width: 920px; }
.current-plan-card { margin: 20px 0; }
.billing-plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.billing-plans .card { display: flex; flex-direction: column; align-items: flex-start; }
.billing-plans .button { margin-top: auto; }
.plan-price { margin: 0; font-size: 2rem; font-weight: 750; }
.plan-price span { font-size: 1rem; font-weight: 400; color: var(--muted); }
.test-activation { margin-top: 18px; }
.assistant-panel { display: grid; gap: 10px; }
.assistant-panel label { margin-top: 4px; font-weight: 650; }
.assistant-panel select, .assistant-panel textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; color: var(--ink); background: white; font: inherit; }
.assistant-answer { margin-top: 18px; }
.assistant-answer-text { white-space: pre-wrap; line-height: 1.6; }
.assistant-shopping-options { display: grid; gap: 8px; margin: 14px 0; }
.assistant-shopping-options label { display: flex; align-items: center; gap: 8px; }
.assistant-shopping-options input { width: auto; }
.assistant-answer .button { margin-top: 12px; }
.status-select, .sos-form input { min-height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; background: white; color: var(--ink); font: inherit; }
.sos-panel { border-color: #f0d6d0; }
.sos-form { display: flex; flex-wrap: wrap; gap: 10px; }
.sos-form input { flex: 1; min-width: 180px; }
.button-sos { background: #b94b3e; }
.button-sos:hover { background: #96372c; }
.sos-alert { margin-top: 12px; border: 1px solid #e5aaa1; border-left: 5px solid #b94b3e; border-radius: 12px; padding: 14px; background: #fff5f2; }
.sos-alert p { margin: 5px 0 10px; }
.location-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 0; }
.location-controls select { min-height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; background: white; color: var(--ink); font: inherit; }
.location-map { width: 100%; height: min(55vh, 480px); min-height: 280px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #eaf0e8; }
.photo-task-panel > div[hidden] { display: none; }
#photo-task-panel { display: grid; gap: 8px; max-width: 560px; margin-top: 12px; }
#photo-task-panel[hidden] { display: none; }
#photo-task-panel input { min-width: 0; min-height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; background: var(--white); color: var(--ink); font: inherit; }
.tasks-page .task-proof-upload { display: grid; justify-items: start; gap: 8px; width: min(100%, 280px); min-width: 0; }
.tasks-page .task-proof-upload label { display: grid; gap: 5px; min-width: 0; }
.tasks-page .task-proof-upload input[type="file"] { display: block; max-width: 100%; min-width: 0; }
.archive-page { max-width: 980px; }
.archive-page > h1 { margin-bottom: 8px; }
.archive-form { display: grid; gap: 12px; }
.archive-form label { display: grid; gap: 5px; font-weight: 650; }
.archive-form input:not([type=file]), .archive-form select, .archive-form textarea, .archive-filter {
    width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
    background: white; color: var(--ink); font: inherit;
}
.archive-form textarea { resize: vertical; }
.archive-list { display: grid; gap: 14px; margin-top: 16px; }
.archive-card { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.archive-card h2 { margin-bottom: 6px; }
.brain-page .archive-card { min-width: 0; overflow-wrap: anywhere; }
.brain-page .archive-card h2 { overflow-wrap: anywhere; }
.archive-detail { margin: 12px 0; }
.archive-detail p, .pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.archive-photo { display: block; max-width: min(100%, 600px); max-height: 420px; margin: 12px 0; border-radius: 12px; object-fit: contain; }
.archive-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.archive-filter { max-width: 420px; }
.security-notice { border: 1px solid #e7ca68; background: #fff8d9; color: #614b04; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field-row > * { min-width: 0; }
.recipe-tags { color: var(--green-dark); font-weight: 650; }
.timeline-list .archive-card { border-left: 4px solid var(--green); }
.decisions-page .decision-list { display: grid; gap: 14px; margin-top: 18px; }
.decision-page .archive-card, .decisions-page .archive-card { padding: 20px; }
.decisions-page .archive-card h3 { margin: 14px 0 6px; }
.poll-option { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 9px 0; }
.poll-winner { color: var(--green-dark); font-weight: 750; }
.check-label { display: flex !important; grid-template-columns: auto 1fr; align-items: center; gap: 9px !important; }
.check-label input { width: 18px; height: 18px; }
.poll-notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0; }
.household-page .household-list { display: grid; gap: 14px; margin-top: 18px; }
.money-summary { display: grid; gap: 6px; }
.money-summary p { margin: 0; }
.net-balance { font-weight: 700; color: var(--green-dark); }
.over-budget { border-color: #d46b5b; background: #fff7f5; }
.goal-achieved { border-color: var(--green); background: #f1f8f1; }
.household-page progress { display: block; width: 100%; height: 16px; margin: 12px 0; accent-color: var(--green); }
.expense-list, .deposit-list { display: grid; gap: 5px; margin: 12px 0; }
.expense-list p, .deposit-list p { margin: 0; }
.inline-expense-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-top: 12px; }
.inline-expense-form label { display: grid; gap: 4px; flex: 1; min-width: 140px; }
.inline-expense-form input { min-height: 40px; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; font: inherit; }
.menu-weekbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 20px 0; }
.menu-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.menu-cell { display: grid; align-content: start; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.menu-cell h3 { margin: 0 0 4px; font-size: 1rem; }
.menu-cell input, .menu-cell select { width: 100%; min-width: 0; min-height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: white; font: inherit; }
.menu-actions { margin-top: 16px; }
.money-notice, .goal-notice { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.today-warm-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin: 20px 0; }
.today-warm-grid .panel { margin-top: 0; }
.today-page .quick-task-form input,
.today-page .quick-task-form select,
.today-page #photo-task-panel input {
    min-width: 0;
    background: var(--white);
    color: var(--ink);
}
.compact-form { margin-top: 14px; }
.countdown-list { display: grid; gap: 6px; padding-left: 20px; }
.manual-countdown-row, .debt-entry { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.load-indicator { border-left: 8px solid var(--green); border-radius: 8px; padding: 13px 15px; font-size: 1.1rem; font-weight: 750; background: #eff7ef; }
.load-yellow { border-color: #d9a92b; background: #fff9e5; color: #765b12; }
.load-red { border-color: #c74d43; background: #fff1ef; color: #862f29; }
.chore-notice, .photo-reminder { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.warm-page .warm-list { display: grid; gap: 14px; margin-top: 18px; }
.gratitude-card { border-left: 4px solid var(--green); }
.gratitude-text { font-size: 1.1rem; white-space: pre-wrap; }
.photo-week-card .archive-photo { width: 100%; max-width: 720px; max-height: 560px; object-fit: contain; background: #f4f4f1; }
.idea-card select { min-height: 40px; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: white; font: inherit; }
.member-checks { border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.member-checks > div { display: flex; flex-wrap: wrap; gap: 12px; }
.member-checks label { display: flex; align-items: center; gap: 6px; }
.chore-card { border-left: 4px solid var(--green); }
.debt-details { margin-top: 10px; }
.debt-details summary { cursor: pointer; color: var(--green-dark); }
.wishlist-card, .preference-card, .announcement-card { border-left: 4px solid var(--green); }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-heading h2 { margin: 0; }
.priority-high { color: #a8322b; font-weight: 700; }
.priority-medium { color: #765b12; }
.reservation { padding: 8px 10px; border-radius: 8px; background: #f1f5ef; }
.reservation-surprise { background: #fff3dc; color: #795b1a; }
.reservation-reserved, .reservation-mine { background: #eaf4e9; color: #2e6337; }
.preferences-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(250px,1fr)); gap: 14px; margin: 16px 0; }
.allergy-line { font-weight: 700; color: #a8322b; }
.announcement-urgent { border-color: #c63e35; background: #fff1ef; }
.announcement-warning { border-color: #d6a629; background: #fff9e6; }
.announcement-info { border-color: var(--green); }
.announcement-text { font-size: 1.05rem; }
.calendar-day-events .event-partner::after { content: " · партнёр"; font-size: .75em; }
.event-from-partner::after { content: " · семья партнёров"; font-size: .75em; }
@media (max-width: 720px) { .preferences-grid { grid-template-columns: 1fr; } }
.page { width: min(100% - 40px, 1080px); margin: 48px auto; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 28px 0; }
.grid .card { min-height: 170px; padding: 22px; }
.note { margin-top: 24px; }
@media (max-width: 720px) {
    .grid { grid-template-columns: 1fr; }
    .grid .card { min-height: 120px; }
    .page { margin-top: 32px; }
    .member-list li { flex-wrap: wrap; }
    .role-form { width: 100%; }
    .invite-row { align-items: stretch; flex-direction: column; }
    .page-heading, .task-row { align-items: stretch; flex-direction: column; }
    .task-actions { flex-wrap: wrap; }
    .today-grid { grid-template-columns: 1fr; }
    .today-grid .card:last-child { grid-column: auto; }
    .quick-task-form { grid-template-columns: 1fr; }
    .calendar-day { min-height: 76px; padding: 4px; }
    .calendar-event { font-size: .68rem; }
    .calendar-day-events { gap: 2px; }
    .event-row { flex-wrap: wrap; }
    .event-actions { width: 100%; }
    .event-filter-form { flex-wrap: wrap; }
    .shopping-add-form { grid-template-columns: 1fr; }
    .shopping-row { flex-wrap: wrap; align-items: flex-start; }
    .shopping-row .shopping-item-info { flex: 1 1 calc(100% - 48px); }
    .shopping-row > form:not(.shopping-toggle) { margin-left: 46px; }
    .reminder-row, .shopping-preview-row { align-items: flex-start; }
    .plan-banner { align-items: flex-start; flex-direction: column; }
    .billing-plans { grid-template-columns: 1fr; }
    .topbar { flex-wrap: wrap; }
    .site-nav { justify-content: flex-start; gap: 10px 14px !important; }
    .nav-group > div { left: auto; right: 0; }
    .field-row { grid-template-columns: 1fr; }
    .menu-grid { grid-template-columns: 1fr; }
    .menu-weekbar { flex-wrap: wrap; }
    .today-warm-grid { grid-template-columns: 1fr; }
}
@media print {
  body:has(.shopping-page) { background:#fff!important; color:#000!important; font-size:20pt; }
  .topbar,.shopping-page nav,.shopping-page form:not(.shopping-toggle),.shopping-page .no-print,.shopping-page button { display:none!important; }
  .shopping-page .shopping-toggle { display:block!important; margin:0!important; }
  .shopping-page .shopping-toggle button { display:inline-block!important; border:1px solid #000!important; background:#fff!important; color:#000!important; font-size:24pt!important; }
  .shopping-page,.shopping-page .card,.shopping-page .panel { max-width:none!important; width:100%!important; margin:0!important; padding:0!important; box-shadow:none!important; border:0!important; }
  .shopping-page li,.shopping-page .shopping-item,.shopping-page label { font-size:20pt!important; padding:.4em 0!important; color:#000!important; }
  .shopping-page input[type=checkbox] { width:1.2em;height:1.2em; }
  * { print-color-adjust:exact; }
}

/* iCook-inspired responsive shell, theme palette and navigation. */
html { scroll-padding-top: 72px; }
body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
body, .card, .topbar, .bottom-bar, .site-drawer, input, select, textarea, button {
    transition: background-color .25s ease, color .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.topbar.site-header {
    position: sticky;
    z-index: 90;
    top: 0;
    min-height: 60px;
    height: 60px;
    padding: 0 max(16px, calc((100vw - 1180px) / 2));
    background: rgba(255,255,255,.96);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 4px 24px rgba(30,64,175,.08);
    backdrop-filter: blur(16px);
    transform: translateY(0);
    transition: transform .32s ease, background-color .25s ease;
}
.topbar.site-header.is-scroll-hidden { transform: translateY(-110%); }
.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #1e3a8a;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: clamp(19px, 3.5vw, 26px);
    font-weight: 850;
    letter-spacing: .01em;
    line-height: 1;
    text-shadow: 0 0 8px rgba(30,64,175,.35), 0 0 20px rgba(30,64,175,.2);
}
.site-brand:hover { text-decoration: none; }
.site-brand img {
    display: block;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border: 1px solid rgba(30,64,175,.18);
    border-radius: 12px;
    background: #05070d;
    object-fit: cover;
    box-shadow: 0 0 10px rgba(30,64,175,.32);
}
.site-nav-overlay {
    position: fixed;
    z-index: 998;
    inset: 0;
    background: rgba(15,23,42,.4);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
}
.site-nav-overlay.is-open { opacity: 1; pointer-events: auto; }
.site-drawer {
    position: fixed;
    z-index: 999;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    width: min(340px, 88vw);
    padding: 20px 16px max(16px, env(safe-area-inset-bottom));
    overflow: hidden;
    color: #1e293b;
    background: #f8fafc;
    border-right: 1px solid rgba(30,64,175,.12);
    box-shadow: 4px 0 30px rgba(0,0,0,.12);
    transform: translateX(-105%);
    transition: transform .35s cubic-bezier(.25,.8,.25,1), background-color .25s ease;
}
.site-drawer.is-open { transform: translateX(0); }
.drawer-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    margin-bottom: 12px;
    padding: 0 4px 12px;
    border-bottom: 1px solid var(--line);
    color: #1e3a8a;
    font-size: 19px;
}
.drawer-heading img {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #05070d;
    object-fit: cover;
}
.drawer-close {
    width: 38px;
    height: 38px;
    margin-left: auto;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}
.drawer-close:hover { background: var(--line); color: var(--ink); }
.drawer-links {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 0 2px 12px;
}
.drawer-section {
    margin: 18px 10px 6px;
    color: var(--muted);
    font-size: .73rem;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.drawer-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    margin: 2px 0;
    padding: 9px 11px;
    border-radius: 12px;
    color: var(--ink);
    font-size: .94rem;
    font-weight: 650;
    text-decoration: none;
    transition: background .2s ease, color .2s ease, transform .2s ease;
}
.drawer-link > span {
    display: inline-grid;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    place-items: center;
    color: #1e40af;
    font-size: 17px;
    font-weight: 800;
}
.drawer-link:hover, .drawer-link:focus-visible, .drawer-link[aria-current="page"] {
    background: rgba(30,64,175,.10);
    color: #1e3a8a;
    text-decoration: none;
    transform: translateX(3px);
}
.drawer-logout { margin: 10px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.drawer-logout button {
    width: 100%;
    min-height: 44px;
    padding: 9px 12px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #b42318;
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}
.drawer-logout button:hover { background: rgba(180,35,24,.08); }
.bottom-bar {
    position: fixed;
    z-index: 100;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(8px, 3vw, 24px);
    min-height: calc(64px + env(safe-area-inset-bottom));
    padding: 4px 12px max(4px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255,255,255,.96);
    box-shadow: 0 -4px 24px rgba(30,64,175,.08);
    backdrop-filter: blur(16px);
}
.dock-button {
    display: inline-grid;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #1e3a8a;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.dock-button:hover, .dock-button:focus-visible, .dock-button[aria-current="page"] {
    background: rgba(30,64,175,.10);
    color: #1e40af;
    text-decoration: none;
    box-shadow: 0 0 12px rgba(30,64,175,.12);
}
.dock-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-sun { display: none; }
html.site-nav-open, html.site-nav-open body { overflow: hidden; }

[data-theme="dark"] body { background: var(--cream); color: var(--ink); }
[data-theme="dark"] a { color: #e2e8f0; }
[data-theme="dark"] .topbar.site-header,
[data-theme="dark"] .bottom-bar { background: rgba(15,23,42,.97); border-color: var(--line); box-shadow: 0 4px 26px rgba(0,0,0,.24); }
[data-theme="dark"] .site-brand { color: #fff; text-shadow: 0 0 10px rgba(255,255,255,.55), 0 0 25px rgba(255,255,255,.24); }
[data-theme="dark"] .site-brand img { border-color: rgba(255,255,255,.22); box-shadow: 0 0 12px rgba(255,255,255,.2); }
[data-theme="dark"] .site-drawer { color: #f8fafc; background: #1e293b; border-color: var(--line); }
[data-theme="dark"] .drawer-heading { color: #e2e8f0; border-color: var(--line); }
[data-theme="dark"] .drawer-link { color: #f8fafc; }
[data-theme="dark"] .drawer-link > span { color: #e2e8f0; }
[data-theme="dark"] .drawer-link:hover,
[data-theme="dark"] .drawer-link:focus-visible,
[data-theme="dark"] .drawer-link[aria-current="page"] { color: #fff; background: rgba(255,255,255,.12); box-shadow: 0 0 12px rgba(255,255,255,.12); }
[data-theme="dark"] .dock-button { color: #e2e8f0; }
[data-theme="dark"] .dock-button:hover,
[data-theme="dark"] .dock-button:focus-visible,
[data-theme="dark"] .dock-button[aria-current="page"] { color: #fff; background: rgba(255,255,255,.12); box-shadow: 0 0 12px rgba(255,255,255,.12); }
[data-theme="dark"] .theme-moon { display: none; }
[data-theme="dark"] .theme-sun { display: block; }
[data-theme="dark"] .button { background: #e2e8f0; color: #0f172a; }
[data-theme="dark"] .button:hover { background: #fff; color: #0f172a; }
[data-theme="dark"] .button-secondary { background: #1e293b; color: #f8fafc; border-color: var(--line); }
[data-theme="dark"] .card,
[data-theme="dark"] .task-row,
[data-theme="dark"] .event-row,
[data-theme="dark"] .calendar-day,
[data-theme="dark"] .menu-cell,
[data-theme="dark"] .archive-card,
[data-theme="dark"] .shopping-row,
[data-theme="dark"] .quick-task-form,
[data-theme="dark"] .role-form select,
[data-theme="dark"] .invite-row input,
[data-theme="dark"] .event-filter-form select,
[data-theme="dark"] .shopping-add-form input,
[data-theme="dark"] .shopping-add-form select,
[data-theme="dark"] .assistant-panel select,
[data-theme="dark"] .assistant-panel textarea,
[data-theme="dark"] .status-select,
[data-theme="dark"] .sos-form input,
[data-theme="dark"] .location-controls select,
[data-theme="dark"] .archive-form input:not([type=file]),
[data-theme="dark"] .archive-form select,
[data-theme="dark"] .archive-form textarea,
[data-theme="dark"] .archive-filter,
[data-theme="dark"] .menu-cell input,
[data-theme="dark"] .menu-cell select,
[data-theme="dark"] .idea-card select,
[data-theme="dark"] .inline-expense-form input,
[data-theme="dark"] .role-form select,
[data-theme="dark"] .invite-row input {
    background-color: #1e293b;
    color: #f8fafc;
    border-color: var(--line);
}
[data-theme="dark"] .form input,
[data-theme="dark"] input:not([type=checkbox]):not([type=radio]),
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    border-color: var(--line);
    background-color: var(--white);
    color: #f8fafc;
    color-scheme: dark;
}
[data-theme="dark"] .shopping-check { background: #1e293b; color: #e2e8f0; border-color: var(--line); }
[data-theme="dark"] .calendar-weekday,
[data-theme="dark"] .calendar-day.outside-month { background: #172338; color: #94a3b8; }
[data-theme="dark"] .form-error { background: #3b2027; color: #fecaca; border-color: #71343d; }
[data-theme="dark"] .notice { background: #1b3540; color: #dbeafe; }
[data-theme="dark"] .security-notice,
[data-theme="dark"] .trial-banner,
[data-theme="dark"] .load-yellow,
[data-theme="dark"] .reservation-surprise { background: #3a321d; color: #f8e6a3; }
[data-theme="dark"] .free-banner { background: #263449; color: #e2e8f0; }
[data-theme="dark"] .load-indicator,
[data-theme="dark"] .goal-achieved,
[data-theme="dark"] .reservation,
[data-theme="dark"] .reservation-reserved,
[data-theme="dark"] .reservation-mine { background: #1c3440; color: #dbeafe; }
[data-theme="dark"] .over-budget,
[data-theme="dark"] .announcement-urgent,
[data-theme="dark"] .sos-alert { background: #3a2229; color: #fecaca; }
[data-theme="dark"] .announcement-warning,
[data-theme="dark"] .load-red { background: #3a321d; color: #f8e6a3; }
[data-theme="dark"] .calendar-event { background: #334155; color: #e2e8f0; }
[data-theme="dark"] .calendar-event.event-birthday { background: #3a2b4a; color: #e9d5ff; }
[data-theme="dark"] .calendar-event.event-vacation { background: #3a321d; color: #f8e6a3; }
[data-theme="dark"] .calendar-event.event-section { background: #1e3a52; color: #bfdbfe; }
[data-theme="dark"] .task-row.task-overdue { background: #3a2229; }
[data-theme="dark"] .shopping-row.shopping-bought { background: #172338; }
[data-theme="dark"] .button-danger { background: #3a2229; color: #fecaca; border-color: #71343d; }
[data-theme="dark"] .nav-group > div { background: #1e293b; border-color: var(--line); }
[data-theme="dark"] .nav-group summary,
[data-theme="dark"] .link-button { color: #e2e8f0; }

@media (max-width: 720px) {
    body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
    .topbar.site-header { padding: 0 14px; }
    .site-brand img { width: 36px; height: 36px; flex-basis: 36px; }
    .bottom-bar { justify-content: space-around; gap: 2px; padding-right: 7px; padding-left: 7px; }
    .dock-button { width: 42px; height: 42px; flex-basis: 42px; }
    .site-drawer { width: min(340px, 88vw); }
}
@media (prefers-reduced-motion: reduce) {
    .topbar.site-header, .site-nav-overlay, .site-drawer, .drawer-link { transition: none; }
}
@media print {
    .site-nav-overlay, .site-drawer, .topbar.site-header, .bottom-bar { display: none !important; }
    body { padding-bottom: 0; }
}
