:root {
  color-scheme: light dark;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-raised: #ffffff;
  --text: #172033;
  --muted: #64748b;
  --soft: #e8eef6;
  --border: #dbe4ef;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-soft: #eaf2ff;
  --green: #16a34a;
  --green-soft: #e9f8ee;
  --amber: #d97706;
  --amber-soft: #fff4df;
  --coral: #ea6b50;
  --coral-soft: #fff0ec;
  --violet: #7c3aed;
  --violet-soft: #f1eaff;
  --danger: #dc2626;
  --danger-soft: #fff0f0;
  --nav-bg: #111827;
  --nav-panel: #1e293b;
  --nav-text: #f8fafc;
  --nav-muted: #94a3b8;
  --shadow: 0 12px 32px rgba(15, 23, 42, .07);
  --shadow-soft: 0 4px 16px rgba(15, 23, 42, .05);
  --radius: 18px;
  --radius-control: 12px;
}

html[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #182235;
  --surface-2: #111827;
  --surface-raised: #1e293b;
  --text: #f8fafc;
  --muted: #9aabc0;
  --soft: #273449;
  --border: #334155;
  --accent-soft: rgba(59, 130, 246, .15);
  --green-soft: rgba(34, 197, 94, .14);
  --amber-soft: rgba(245, 158, 11, .15);
  --coral-soft: rgba(249, 115, 86, .14);
  --violet-soft: rgba(139, 92, 246, .15);
  --danger-soft: rgba(239, 68, 68, .14);
  --shadow: 0 14px 34px rgba(2, 6, 23, .28);
  --shadow-soft: 0 5px 18px rgba(2, 6, 23, .2);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    --bg: #0f172a;
    --surface: #182235;
    --surface-2: #111827;
    --surface-raised: #1e293b;
    --text: #f8fafc;
    --muted: #9aabc0;
    --soft: #273449;
    --border: #334155;
    --accent-soft: rgba(59, 130, 246, .15);
    --green-soft: rgba(34, 197, 94, .14);
    --amber-soft: rgba(245, 158, 11, .15);
    --coral-soft: rgba(249, 115, 86, .14);
    --violet-soft: rgba(139, 92, 246, .15);
    --danger-soft: rgba(239, 68, 68, .14);
    --shadow: 0 14px 34px rgba(2, 6, 23, .28);
    --shadow-soft: 0 5px 18px rgba(2, 6, 23, .2);
  }
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { min-height: 100vh; margin: 0; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 16px; line-height: 1.45; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
svg { width: 20px; height: 20px; stroke-width: 2; }

* { scrollbar-width: thin; scrollbar-color: #8291a6 transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #8291a6; border: 2px solid transparent; border-radius: 999px; background-clip: padding-box; }

:focus-visible { outline: 3px solid rgba(59, 130, 246, .35); outline-offset: 2px; }
.desktop-only { display: none !important; }

.sidebar { display: none; }
.app-shell { width: 100%; min-height: 100vh; }
.page-content { width: min(100%, 1180px); margin: 0 auto; padding: 20px 16px calc(100px + env(safe-area-inset-bottom)); }
.mobile-header { position: sticky; z-index: 40; top: 0; min-height: 62px; padding: 9px 16px; display: flex; align-items: center; justify-content: space-between; background: color-mix(in srgb, var(--bg) 88%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent); backdrop-filter: blur(18px); }
.mobile-brand { min-width: 0; display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 15px; font-weight: 750; }
.mobile-brand img { width: 40px; height: 40px; border-radius: 11px; box-shadow: var(--shadow-soft); }
.mobile-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 38px; height: 38px; flex: 0 0 38px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; text-decoration: none; }

.bottom-nav { position: fixed; z-index: 80; inset: auto 0 0; min-height: calc(68px + env(safe-area-inset-bottom)); padding: 6px 6px env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr); background: color-mix(in srgb, var(--surface) 94%, transparent); border-top: 1px solid var(--border); box-shadow: 0 -8px 28px rgba(15,23,42,.06); backdrop-filter: blur(18px); }
.bottom-nav a { min-width: 0; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 12px; color: var(--muted); font-size: 11px; font-weight: 700; text-decoration: none; }
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a.active { color: var(--accent); background: var(--accent-soft); }

.page-header { margin: 2px 0 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.page-header h1 { margin: 1px 0 2px; font-size: clamp(1.65rem, 7vw, 2.35rem); line-height: 1.13; letter-spacing: -.035em; }
.page-header p { margin: 0; color: var(--muted); }
.eyebrow { margin: 0 0 3px !important; color: var(--accent) !important; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }

.card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-soft); padding: 18px; }
.card h2 { margin: 0; font-size: 1.05rem; letter-spacing: -.015em; }
.card p { color: var(--muted); }
.card-link { display: block; color: inherit; text-decoration: none; transition: transform .18s ease, box-shadow .18s ease; }
.card-link:active { transform: scale(.985); }
.section-heading { margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-heading > div { min-width: 0; display: flex; align-items: center; gap: 11px; }
.section-heading > div > div { min-width: 0; }
.section-heading p { margin: 2px 0 0; font-size: 13px; }
.section-heading > a { color: var(--accent); font-size: 13px; font-weight: 750; text-decoration: none; }
.section-icon { width: 38px; height: 38px; flex: 0 0 38px; display: inline-grid; place-items: center; border-radius: 11px; }
.section-icon svg { width: 19px; height: 19px; }
.section-icon.blue { color: var(--accent); background: var(--accent-soft); }
.section-icon.green { color: var(--green); background: var(--green-soft); }
.section-icon.amber { color: var(--amber); background: var(--amber-soft); }
.section-icon.coral { color: var(--coral); background: var(--coral-soft); }
.section-icon.violet { color: var(--violet); background: var(--violet-soft); }

.primary-button, .secondary-button, .text-button, .icon-button, .today-button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border-radius: var(--radius-control); border: 1px solid transparent; cursor: pointer; color: #fff; background: var(--accent); font-weight: 750; text-decoration: none; }
.primary-button:hover { background: var(--accent-hover); }
.secondary-button { color: var(--text); background: var(--surface-raised); border-color: var(--border); }
.text-button { min-height: 40px; padding: 0 8px; color: var(--accent); background: transparent; }
.icon-button { width: 44px; height: 44px; min-height: 44px; flex: 0 0 44px; padding: 0; color: var(--muted); background: var(--surface-raised); border-color: var(--border); }
.compact-button { min-width: 46px; padding-inline: 12px; }
.compact-button span { display: none; }

input, select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-control); }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.14); }
label { display: grid; gap: 7px; color: var(--muted); font-size: 14px; font-weight: 650; }
label > span { font-size: 12px; font-weight: 500; }
.stack-form { display: grid; gap: 11px; }
.stack-form .primary-button, .stack-form > .secondary-button { width: 100%; margin-top: 5px; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.span-full { grid-column: 1 / -1; }
.inline-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.inline-form input, .inline-form select { flex: 1 1 150px; }
.optional-fields { border: 1px solid var(--border); border-radius: 13px; background: var(--surface-2); }
.optional-fields summary, .settings-details summary { padding: 12px 14px; color: var(--accent); font-size: 14px; font-weight: 750; cursor: pointer; }
.optional-fields[open] { padding-bottom: 12px; }
.optional-fields[open] > :not(summary) { margin: 8px 12px 0; }
.checkbox-row { display: flex; align-items: center; }
.checkbox-row input { width: 20px; min-height: 20px; }

.flash-stack, .auth-flashes { position: fixed; z-index: 120; inset: 12px 12px auto; display: grid; gap: 8px; }
.flash { min-height: 48px; padding: 11px 13px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-radius: 13px; border: 1px solid var(--border); background: var(--surface-raised); box-shadow: var(--shadow); }
.flash-success { color: var(--green); border-color: color-mix(in srgb, var(--green) 35%, var(--border)); }
.flash-error { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.flash button { width: 34px; height: 34px; display: grid; place-items: center; border: 0; color: currentColor; background: transparent; cursor: pointer; }

.dashboard-grid { display: grid; gap: 14px; }
.timeline-list { display: grid; gap: 5px; }
.timeline-row { min-height: 58px; display: grid; grid-template-columns: 12px 1fr 24px; align-items: center; gap: 11px; padding: 8px 4px; border-bottom: 1px solid var(--soft); }
.timeline-row:last-child { border-bottom: 0; }
.timeline-row > svg { color: var(--muted); }
.timeline-row div { min-width: 0; }
.timeline-row strong, .timeline-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline-row small { margin-top: 2px; color: var(--muted); font-size: 13px; }
.member-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--member-color); box-shadow: 0 0 0 4px color-mix(in srgb, var(--member-color) 18%, transparent); }
.event-dot { --member-color: var(--accent); }
.dinner-card { position: relative; overflow: hidden; }
.dinner-card::after { content: ""; position: absolute; width: 120px; height: 120px; right: -48px; bottom: -60px; border-radius: 50%; background: var(--amber-soft); }
.dinner-main { position: relative; z-index: 1; min-height: 72px; display: flex; flex-direction: column; justify-content: center; }
.dinner-main small { color: var(--muted); }
.dinner-main strong { margin-top: 3px; font-size: 1.45rem; letter-spacing: -.025em; }
.quick-inline { position: relative; z-index: 2; display: flex; gap: 8px; }
.quick-inline input { min-width: 0; }
.quick-inline button { width: 46px; height: 46px; flex: 0 0 46px; display: grid; place-items: center; border: 0; border-radius: 12px; background: var(--accent); color: white; cursor: pointer; }
.shopping-card .big-number { display: block; font-size: 2.4rem; line-height: 1; }
.shopping-card > span { color: var(--muted); font-size: 14px; }
.shopping-card > p { margin: 14px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.mini-list { display: grid; }
.mini-list form { min-height: 47px; display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 8px; border-bottom: 1px solid var(--soft); }
.mini-list form:last-child { border-bottom: 0; }
.check-button { width: 36px; height: 36px; display: grid; place-items: center; color: var(--green); background: transparent; border: 0; cursor: pointer; }
.mini-list small { color: var(--muted); }
.attention-list, .coming-list { display: grid; }
.attention-list a { min-height: 51px; display: grid; grid-template-columns: 24px 1fr 18px; align-items: center; gap: 10px; border-bottom: 1px solid var(--soft); color: var(--text); text-decoration: none; }
.attention-list a:last-child { border: 0; }
.attention-list a > svg:first-child { color: var(--amber); }
.attention-list a > svg:last-child { width: 17px; color: var(--muted); }
.coming-list a { min-height: 65px; display: grid; grid-template-columns: 44px 1fr; align-items: center; gap: 11px; border-bottom: 1px solid var(--soft); text-decoration: none; }
.coming-list a:last-child { border: 0; }
.coming-list a > div > strong, .coming-list a > div > small { display: block; }
.coming-list a > div > small { color: var(--muted); font-size: 13px; }
.date-chip { width: 42px; height: 48px; display: grid; place-content: center; text-align: center; border-radius: 11px; color: var(--accent); background: var(--accent-soft); line-height: 1; }
.date-chip strong { font-size: 17px; }
.date-chip small { margin-top: 4px; font-size: 10px; text-transform: uppercase; }
.calm-empty { min-height: 112px; display: grid; place-items: center; align-content: center; gap: 7px; color: var(--muted); text-align: center; }
.calm-empty.compact { min-height: 68px; }
.calm-empty p, .calm-empty h2 { margin: 0; }
.floating-action { position: fixed; z-index: 70; right: 18px; bottom: calc(78px + env(safe-area-inset-bottom)); width: 54px; height: 54px; display: grid; place-items: center; border: 0; border-radius: 17px; background: var(--accent); color: white; box-shadow: 0 12px 28px rgba(37,99,235,.32); cursor: pointer; }
.floating-action svg { width: 25px; height: 25px; }

.app-dialog { width: min(calc(100% - 24px), 590px); max-height: calc(100dvh - 28px); padding: 18px; color: var(--text); background: var(--surface-raised); border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 24px 80px rgba(2,6,23,.3); }
.app-dialog::backdrop { background: rgba(2,6,23,.6); backdrop-filter: blur(3px); }
.dialog-header, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-header { margin-bottom: 18px; }
.dialog-header h2 { margin: 0; }
.dialog-actions { margin-top: 4px; justify-content: flex-end; }
.quick-action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-action-grid a { min-height: 128px; padding: 14px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; border: 1px solid var(--border); border-radius: 15px; background: var(--surface-2); text-decoration: none; }
.quick-action-grid strong { margin-top: 10px; }
.quick-action-grid small { margin-top: 2px; color: var(--muted); }

.calendar-toolbar, .week-switcher { margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.segmented { padding: 3px; display: inline-flex; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); }
.segmented a { min-height: 38px; padding: 0 11px; display: grid; place-items: center; border-radius: 9px; color: var(--muted); font-size: 13px; font-weight: 750; text-decoration: none; }
.segmented a.active { color: var(--accent); background: var(--accent-soft); }
.date-navigation, .week-switcher { display: flex; align-items: center; gap: 7px; }
.today-button, .week-switcher > a:not(.icon-button) { min-height: 42px; padding: 0 10px; color: var(--text); background: var(--surface); border-color: var(--border); font-size: 13px; text-decoration: none; }
.calendar-days { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 88vw); gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
.day-column { padding: 15px; scroll-snap-align: start; box-shadow: none; }
.day-column > header { min-height: 50px; display: flex; align-items: flex-start; justify-content: space-between; }
.day-column > header small { color: var(--muted); font-size: 13px; }
.day-column > header h2 { margin-top: 1px; font-size: 1.2rem; }
.today-pill { padding: 5px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 750; }
.day-items { display: grid; gap: 8px; }
.calendar-item { position: relative; min-height: 64px; padding: 10px; display: grid; grid-template-columns: 28px 1fr auto; align-items: flex-start; gap: 8px; border: 1px solid var(--border); border-left: 4px solid var(--item-color, var(--accent)); border-radius: 12px; background: var(--surface-2); }
.calendar-item > svg { margin-top: 2px; color: var(--item-color, var(--accent)); }
.calendar-item div { min-width: 0; }
.calendar-item strong, .calendar-item small { display: block; }
.calendar-item small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.calendar-item form button, .shopping-item button, .task-row button { border: 0; background: transparent; cursor: pointer; }
.calendar-item form button { width: 34px; height: 34px; display: grid; place-items: center; color: var(--muted); }
.person-pill { display: inline-flex; align-items: center; gap: 5px; margin: 6px 5px 0 0; padding: 3px 7px; border-radius: 999px; background: var(--soft); color: var(--muted); font-size: 11px; }
.person-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--member-color); }
.work-schedule { margin-top: 16px; }
.weekday-picker, .member-picker { margin: 0; padding: 0; border: 0; }
.weekday-picker legend, .member-picker legend { margin-bottom: 8px; color: var(--muted); font-size: 13px; font-weight: 650; }
.weekday-picker { display: flex; gap: 7px; }
.weekday-picker label input, .member-picker label input { position: absolute; opacity: 0; pointer-events: none; }
.weekday-picker label span { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 11px; color: var(--muted); background: var(--surface-2); cursor: pointer; }
.weekday-picker label input:checked + span { color: white; border-color: var(--accent); background: var(--accent); }
.member-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.member-picker label span { padding: 8px 11px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); cursor: pointer; }
.member-picker label span::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--member-color); }
.member-picker label input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.month-card { padding: 12px; overflow-x: auto; }
.month-heading { padding: 5px 5px 14px; }
.month-weekdays, .month-grid { min-width: 680px; display: grid; grid-template-columns: repeat(7, 1fr); }
.month-weekdays span { padding: 7px; color: var(--muted); font-size: 12px; text-align: center; }
.month-day { min-height: 96px; padding: 7px; display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--border); border-left: 1px solid var(--border); color: var(--text); text-decoration: none; }
.month-day:nth-child(7n) { border-right: 1px solid var(--border); }
.month-day strong { font-size: 13px; }
.month-day span { overflow: hidden; padding: 3px 5px; border-radius: 5px; background: color-mix(in srgb, var(--item-color, var(--accent)) 14%, transparent); color: var(--text); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.month-day span.event { --item-color: var(--accent); }
.month-day.today { background: var(--accent-soft); }
.month-day.empty { background: var(--surface-2); }

.meal-week { display: grid; gap: 9px; }
.meal-day { min-height: 76px; padding: 10px 11px; display: grid; grid-template-columns: 56px 1fr 42px; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow-soft); }
.meal-day.today { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); box-shadow: inset 4px 0 var(--accent), var(--shadow-soft); }
.meal-date { display: grid; justify-items: center; line-height: 1.1; }
.meal-date small { color: var(--muted); font-size: 11px; }
.meal-date strong { margin-top: 4px; font-size: 18px; }
.meal-entry { min-width: 0; }
.meal-entry input { min-height: 42px; padding: 6px 0; border: 0; background: transparent; font-size: 17px; font-weight: 720; }
.meal-entry input:focus { box-shadow: none; }
.meal-entry small { display: block; color: var(--muted); font-size: 11px; }
.meal-day > button { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 11px; background: var(--accent-soft); color: var(--accent); cursor: pointer; }
.recent-meals { margin-top: 16px; }
.meal-chips, .shift-list { display: flex; flex-wrap: wrap; gap: 8px; }
.meal-chips button, .shift-list > span { min-height: 40px; padding: 8px 11px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text); cursor: pointer; }
.meal-chips svg { width: 16px; color: var(--amber); }

.shopping-add { margin-bottom: 14px; display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.shopping-add .primary-button span { display: none; }
.shopping-add details { grid-column: 1 / -1; }
.shopping-list { padding: 8px 14px; }
.shopping-items { display: grid; }
.shopping-item { min-height: 62px; display: grid; grid-template-columns: 42px 1fr 34px; align-items: center; gap: 8px; border-bottom: 1px solid var(--soft); }
.shopping-item:last-child { border-bottom: 0; }
.shopping-check { width: 42px; height: 42px; display: grid; place-items: center; color: var(--accent); }
.shopping-item > div { min-width: 0; }
.shopping-item strong, .shopping-item small { display: block; }
.shopping-item small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.shopping-item.checked { opacity: .58; }
.shopping-item.checked strong { text-decoration: line-through; }
.added-by { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); background: var(--soft); font-size: 11px; font-weight: 800; }
.shopping-empty { min-height: 270px; }
.sync-note { margin: 10px 4px 0; display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 11px; }
.sync-note svg { width: 13px; height: 13px; }

.filter-tabs { margin-bottom: 14px; display: flex; gap: 5px; overflow-x: auto; }
.filter-tabs a { min-height: 42px; padding: 0 14px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); background: var(--surface); font-size: 13px; font-weight: 750; text-decoration: none; white-space: nowrap; }
.filter-tabs a.active { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--accent-soft); }
.task-list { padding: 5px 15px; }
.task-row { min-height: 72px; padding: 10px 0; display: grid; grid-template-columns: 42px 1fr 38px; align-items: flex-start; gap: 9px; border-bottom: 1px solid var(--soft); }
.task-row:last-child { border: 0; }
.task-check { width: 42px; height: 42px; display: grid; place-items: center; color: var(--green); }
.task-row > div { min-width: 0; padding-top: 9px; }
.task-row > div > p { margin: 2px 0 0; }
.task-row > div > small { display: block; margin-top: 6px; color: var(--muted); }
.task-row.completed > div > strong { text-decoration: line-through; color: var(--muted); }
.row-action { width: 38px; height: 42px; display: grid; place-items: center; color: var(--muted); }
.row-action svg { width: 17px; }
.due { margin: 5px 6px 0 0; display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 11px; }
.due svg { width: 12px; height: 12px; }
.due.overdue { color: var(--danger); }

.settings-grid { display: grid; gap: 14px; }
.settings-section > .stack-form { margin-top: 10px; }
.settings-details { margin-top: 16px; border-top: 1px solid var(--soft); }
.settings-details summary { padding-inline: 0; }
.settings-details form { margin-top: 7px; }
.member-list, .membership-list { display: grid; gap: 7px; }
.member-list > div, .membership-list > div { min-height: 52px; display: flex; align-items: center; gap: 10px; }
.member-list strong, .member-list small, .membership-list strong, .membership-list small { display: block; }
.member-list small, .membership-list small { color: var(--muted); font-size: 12px; }
.member-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--member-color); font-weight: 800; }
.shift-list > span { cursor: default; }
.shift-list > span > i { width: 8px; height: 8px; border-radius: 50%; background: var(--shift-color); }
.shift-list small { color: var(--muted); }
.invite-form { margin-top: 16px; }
.text-link { display: inline-block; margin-top: 14px; color: var(--accent); font-weight: 700; text-decoration: none; }
.text-link.centered { display: block; text-align: center; }
.invite-reveal { margin-bottom: 14px; display: grid; grid-template-columns: 38px 1fr; gap: 12px; border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.invite-reveal h2, .invite-reveal p { margin: 0; }
.invite-reveal code { display: block; margin-top: 10px; overflow-wrap: anywhere; color: var(--accent); font-size: 15px; }
.invite-reveal > button { grid-column: 1 / -1; }

.menu-list { display: grid; gap: 10px; }
.menu-list > a { min-height: 74px; padding: 12px 14px; display: grid; grid-template-columns: 42px 1fr 20px; align-items: center; gap: 11px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-soft); text-decoration: none; }
.menu-list strong, .menu-list small { display: block; }
.menu-list small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.menu-list > a > svg { color: var(--muted); }
.mobile-logout { margin-top: 18px; }
.mobile-logout button { width: 100%; }

.admin-stats { margin-bottom: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.admin-stats section span, .admin-stats section strong { display: block; }
.admin-stats section span { color: var(--muted); font-size: 13px; }
.admin-stats section strong { margin-top: 6px; font-size: 1.7rem; }
.admin-stats .healthy { display: flex; align-items: center; gap: 5px; color: var(--green); font-size: 1rem; }
.version-pill { padding: 6px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 800; }
.system-events { display: grid; }
.system-events > div { min-height: 47px; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--soft); font-size: 13px; }
.system-events > div:last-child { border: 0; }
.system-events .success { color: var(--green); }
.system-events .failed { color: var(--danger); }
.system-events small { color: var(--muted); }
.narrow-page { width: min(100%, 640px); margin: 0 auto; }
.error-card { min-height: 360px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.error-card h1 { margin: 6px 0; }
.error-card p:not(.eyebrow) { max-width: 420px; }
.error-card .primary-button { margin-top: 10px; }

.auth-page { min-height: 100vh; display: block; background: radial-gradient(circle at 50% 0%, rgba(59,130,246,.14), transparent 38%), #0b1220; color: #f8fafc; }
.auth-shell { min-height: 100vh; padding: 24px 16px; display: grid; place-items: center; }
.auth-card { width: min(100%, 500px); padding: 26px 22px; border: 1px solid rgba(148,163,184,.18); border-radius: 20px; background: #111827; box-shadow: 0 24px 70px rgba(2,6,23,.42); }
.auth-brand { padding-bottom: 22px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(148,163,184,.14); color: white; text-decoration: none; }
.auth-brand img { width: 48px; height: 48px; border-radius: 12px; }
.auth-brand small, .auth-brand strong { display: block; }
.auth-brand small { color: #94a3b8; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.auth-brand strong { font-size: 18px; }
.auth-intro { padding: 24px 0 18px; }
.auth-intro h1 { margin: 0 0 6px; font-size: 1.7rem; letter-spacing: -.03em; }
.auth-intro p { margin: 0; color: #94a3b8; }
.auth-card label { color: #cbd5e1; }
.auth-card input, .auth-card select, .auth-card textarea { color: #f8fafc; background: #0f172a; border-color: #334155; }
.auth-card .optional-fields { background: #0f172a; border-color: #334155; }
.auth-foot { margin: 20px 0 0; color: #94a3b8; text-align: center; font-size: 14px; }
.auth-foot a { color: #93c5fd; font-weight: 700; }
.auth-flashes { color: var(--text); }

@media (min-width: 600px) {
  .page-content { padding-inline: 24px; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-grid, .settings-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-grid .span-2 { grid-column: 1 / -1; }
  .compact-button span { display: inline; }
  .shopping-add .primary-button span { display: inline; }
  .meal-day { grid-template-columns: 74px 1fr 46px; }
  .invite-reveal { grid-template-columns: 38px 1fr auto; align-items: center; }
  .invite-reveal > button { grid-column: auto; }
  .auth-card { padding: 32px; }
}

@media (min-width: 920px) {
  body { display: flex; }
  .mobile-header, .bottom-nav, .floating-action, .mobile-logout { display: none; }
  .desktop-only { display: inline-flex !important; }
  .sidebar { position: sticky; top: 0; width: 246px; height: 100vh; flex: 0 0 246px; padding: 22px 18px; display: flex; flex-direction: column; overflow-y: auto; color: var(--nav-text); background: var(--nav-bg); border-right: 1px solid #1f2937; }
  .brand { display: flex; align-items: center; gap: 12px; color: white; text-decoration: none; }
  .brand img { width: 48px; height: 48px; border-radius: 12px; }
  .brand span strong, .brand span small { display: block; }
  .brand span strong { font-size: 18px; }
  .brand span small { color: var(--nav-muted); font-size: 12px; }
  .household-name, .household-switcher { margin: 22px 0 18px; padding: 12px; border: 1px solid #334155; border-radius: 13px; background: #182235; }
  .household-name small, .household-name strong { display: block; }
  .household-name small, .household-switcher label { color: var(--nav-muted); font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
  .household-name strong { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
  .household-switcher { display: grid; gap: 6px; }
  .household-switcher select { min-height: 34px; padding: 4px 6px; color: var(--nav-text); background: #111827; border-color: #334155; font-size: 13px; }
  .desktop-nav { display: grid; gap: 4px; }
  .nav-label { margin: 3px 12px 4px; color: #64748b; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
  .nav-label.nav-secondary { margin-top: 16px; }
  .desktop-nav a { min-height: 45px; padding: 8px 12px; display: flex; align-items: center; gap: 11px; border-radius: 12px; color: var(--nav-muted); font-size: 14px; font-weight: 650; text-decoration: none; transition: color .17s, background .17s, transform .17s; }
  .desktop-nav a:hover { color: white; background: var(--nav-panel); transform: translateX(2px); }
  .desktop-nav a.active { color: white; background: rgba(59,130,246,.16); }
  .desktop-nav a.active svg { color: #60a5fa; }
  .desktop-nav svg { width: 19px; height: 19px; }
  .sidebar-user { margin-top: auto; padding-top: 16px; display: grid; grid-template-columns: 38px 1fr 40px; align-items: center; gap: 9px; border-top: 1px solid rgba(148,163,184,.14); }
  .sidebar-user strong, .sidebar-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar-user strong { font-size: 13px; }
  .sidebar-user small { color: var(--nav-muted); font-size: 11px; }
  .sidebar-user .icon-button { width: 40px; height: 40px; min-height: 40px; color: var(--nav-muted); background: transparent; border-color: transparent; }
  .app-shell { flex: 1; min-width: 0; }
  .page-content { padding: 34px 36px 60px; }
  .page-header { margin-bottom: 26px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: 18px; }
  .dashboard-grid .span-2 { grid-column: 1 / -1; }
  .card { padding: 20px; }
  .today-card { min-height: 200px; }
  .calendar-days { grid-auto-flow: initial; grid-template-columns: repeat(7, minmax(0, 1fr)); overflow: visible; }
  .calendar-days.single-day { grid-template-columns: minmax(0, 720px); }
  .day-column { min-width: 0; }
  .calendar-item { grid-template-columns: 22px 1fr; }
  .calendar-item form { grid-column: 2; }
  .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
  .admin-stats { grid-template-columns: repeat(3, 1fr); }
  .flash-stack { inset: 18px 22px auto auto; width: min(390px, calc(100% - 44px)); }
}

@media (min-width: 1180px) {
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .today-card { grid-column: 1 / -1; }
  .calendar-days { gap: 9px; }
  .day-column { padding: 12px; }
}

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