/* Nova Maison design system */
:root {
  --bg: #FAF8F5;
  --primary: #E8C5C8;
  --secondary: #C89F9C;
  --text: #2C2C2C;
  --accent: #C5A059;

  --surface: #FFFFFF;
  --surface-2: #FDFBF9;
  --border: #E9E2DC;
  --border-strong: #D9CEC6;
  --muted: #6F6A66;           /* 4.8:1 on --bg */
  --muted-2: #8A837E;
  --success: #5F8A76;
  --success-bg: #E7F1EB;
  --warning: #9A6A1E;
  --warning-bg: #FBF0DC;
  --warning-text: #8A5D16;        /* 5.0:1 on --warning-bg */
  --danger: #A24B4B;
  --danger-bg: #F8E8E6;
  --info-bg: #EDF2F6;

  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 6px 20px rgba(80, 60, 50, 0.07);
  --shadow-strong: 0 18px 50px rgba(60, 45, 40, 0.18);
  --t: 180ms ease;
  --header-h: 64px;
  --nav-h: calc(66px + env(safe-area-inset-bottom, 0px));
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 1.55rem; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
a { color: var(--text); text-decoration-color: var(--secondary); }
ul { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.icon { display: inline-flex; flex: none; align-items: center; justify-content: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-header {
  position: sticky; top: 0; z-index: 30;
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 16px 0;
  display: flex; align-items: center; gap: 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  background: var(--primary); color: var(--text);
  display: grid; place-items: center;
}
.brand-name { font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; }
.header-title { font-size: 0.95rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-spacer { flex: 1; }
.sync-indicator {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; font-size: 0.74rem; color: var(--muted); white-space: nowrap;
  padding: 6px 9px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
}
.sync-indicator .icon { color: var(--success); }
.sync-indicator.offline .icon { color: var(--muted-2); }
.sync-indicator.warn .icon { color: var(--warning); }
.sync-indicator small { color: var(--muted-2); }

.app-main {
  flex: 1; width: 100%; max-width: 1100px;
  margin: 0 auto; padding: 20px 16px calc(var(--nav-h) + 24px);
}
.page-head { margin-bottom: 18px; }
.page-head p { color: var(--muted); font-size: 0.92rem; margin-top: 4px; }

/* Sidebar (desktop / tablet) */
.sidebar { display: none; }
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  height: var(--nav-h); padding-bottom: env(safe-area-inset-bottom, 0px);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.bottom-nav button {
  border: 0; background: none; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; color: var(--muted);
  font-size: 0.7rem; min-height: 60px;
}
.bottom-nav button.active { color: var(--text); }
.bottom-nav button.active .icon { color: var(--secondary); }

/* ---------- Cards & lists ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.card.tight { padding: 12px 14px; }
.card.soft { background: var(--surface-2); }
.card-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-title-row h2, .card-title-row h3 { flex: 1; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.section-title { display: flex; align-items: center; gap: 8px; margin: 22px 2px 10px; }
.section-title h2 { flex: 1; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px;
  border-bottom: 1px solid var(--border); min-height: 56px;
}
.list-item:last-child { border-bottom: 0; }
.list-item[role=button] { cursor: pointer; border-radius: 10px; transition: background var(--t); }
.list-item[role=button]:hover { background: var(--surface-2); }
.list-item-body { flex: 1; min-width: 0; }
.list-item-leading, .list-item-trailing:not(.btn-row), .list-item-secondary, .list-item-actions { display: contents; }
.list-item-title { font-weight: 600; min-width: 0; overflow-wrap: break-word; word-break: normal; }
.list-item-sub { color: var(--muted); font-size: 0.82rem; margin-top: 2px; min-width: 0; overflow-wrap: break-word; word-break: normal; }
.list-item.done .list-item-title { text-decoration: line-through; color: var(--muted); }
.avatar {
  display: inline-grid; place-items: center; flex: none;
  border-radius: 50%; background: var(--avatar, var(--primary));
  color: var(--text); font-weight: 700; border: 2px solid rgba(255,255,255,.7);
}
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 10px; font-size: 0.8rem; color: var(--muted);
}
.chip.success { background: var(--success-bg); color: var(--success); border-color: transparent; }
.chip.warning { background: var(--warning-bg); color: var(--warning-text); border-color: transparent; }
.chip.danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.badge { display: inline-flex; align-items: center; justify-content: center; line-height: 1; font-size: 0.72rem; padding: 3px 8px; border-radius: 999px; font-weight: 600; }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.warning { background: var(--warning-bg); color: var(--warning-text); }
.badge.success { background: var(--success-bg); color: var(--success); }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.info-line { font-size: 0.78rem; color: var(--muted); display: flex; gap: 6px; align-items: flex-start; }

/* ---------- Buttons ---------- */
.btn {
  min-height: 44px; padding: 0 18px; border-radius: 13px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform var(--t), background var(--t), box-shadow var(--t);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--text); }
.btn.primary:hover { background: #E2B7BB; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.btn.small { min-height: 44px; padding: 0 12px; font-size: 0.85rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn {
  min-width: 44px; min-height: 44px; border-radius: 12px; border: 0;
  background: transparent; display: inline-grid; place-items: center; color: var(--muted);
  transition: background var(--t), color var(--t);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 0.86rem; font-weight: 600; margin-bottom: 6px; }
.field-hint { display: block; color: var(--muted); font-size: 0.76rem; margin-top: 4px; }
.input {
  width: 100%; min-height: 46px; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: 12px;
  background: var(--surface); font-size: 16px;
  transition: border-color var(--t), box-shadow var(--t);
}
.input:focus { border-color: var(--secondary); box-shadow: 0 0 0 3px rgba(200,159,156,.18); outline: none; }
textarea.input { resize: vertical; min-height: 80px; }
.check-field { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check-field input { width: 22px; height: 22px; accent-color: var(--secondary); flex: none; }
/* 44px hit area with a compact 20px visual box (WCAG 2.2 target-size). */
.checkbox {
  appearance: none; -webkit-appearance: none;
  width: 44px; height: 44px; margin: -11px; flex: none;
  position: relative; background: transparent; border: 0; cursor: pointer;
}
.checkbox::before {
  content: ''; position: absolute; top: 12px; left: 12px;
  width: 20px; height: 20px; border: 2px solid var(--border-strong);
  border-radius: 5px; background: var(--surface);
}
.checkbox:checked::before { background: var(--secondary); border-color: var(--secondary); }
.checkbox:checked::after {
  content: '✓'; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -58%); color: #fff;
  font-size: 16px; font-weight: 700; line-height: 1;
}
.checkbox:focus-visible::before { outline: 3px solid var(--primary); outline-offset: 2px; }
.form-grid { display: grid; gap: 0 12px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-error { color: var(--danger); font-size: .85rem; margin: 6px 0 0; }
.required-note { color: var(--muted); font-size: .75rem; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.swatch.selected { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface) inset; }
.weekday-picker, .season-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.weekday-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--surface); font-weight: 600;
}
.weekday-btn.selected { background: var(--primary); border-color: var(--primary); }
.season-btn { min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface); }
.season-btn.selected { background: var(--primary); border-color: var(--primary); }
.segmented { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); padding: 4px; border-radius: 13px; overflow-x: auto; }
.segment {
  flex: 1; white-space: nowrap; min-height: 44px; padding: 0 12px; border: 0;
  background: transparent; border-radius: 10px; color: var(--muted); font-size: .86rem; font-weight: 600;
}
.segment.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tabs { display: flex; gap: 4px; background: var(--surface); border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab {
  border: 0; background: transparent; padding: 10px 14px; min-height: 44px;
  color: var(--muted); font-weight: 600; white-space: nowrap; border-bottom: 2px solid transparent;
}
.tab.active { color: var(--text); border-bottom-color: var(--secondary); }

/* ---------- Modal / bottom sheet ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(44, 44, 44, .38);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0; animation: fade var(--t);
}
.modal {
  background: var(--surface); width: 100%; max-height: 92vh; overflow: auto;
  border-radius: 24px 24px 0 0; box-shadow: var(--shadow-strong);
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  animation: slideUp 220ms ease;
}
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.modal-head h2 { flex: 1; font-size: 1.2rem; }
.modal-form { display: block; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.modal-message { color: var(--muted); padding: 6px 0 12px; }

/* ---------- Snackbar / banner ---------- */
.snackbar {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav-h) + 12px); z-index: 120;
  background: var(--text); color: #fff; border-radius: 14px; padding: 12px 14px;
  display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-strong);
  opacity: 0; transform: translateY(20px); pointer-events: none; transition: opacity var(--t), transform var(--t);
}
.snackbar.visible { opacity: 1; transform: none; pointer-events: auto; }
.snack-action { margin-left: auto; background: none; border: 0; color: #F3C9CC; font-weight: 700; min-height: 44px; padding: 0 8px; }
.banner {
  position: fixed; left: 12px; right: 12px; top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 8px); z-index: 90;
  background: var(--warning-bg); color: var(--warning-text); border: 1px solid #EAD3A6;
  border-radius: 14px; padding: 10px 12px; display: none; align-items: center; gap: 10px; box-shadow: var(--shadow);
}
.banner.visible { display: flex; }
.banner .btn { margin-left: auto; }
.banner .btn-row { margin-left: auto; }
.sync-sheet-overlay {
  position: fixed; inset: 0; z-index: 130; background: rgba(0, 0, 0, 0.35);
  display: flex; align-items: flex-end; justify-content: center;
}
.sync-sheet {
  width: 100%; max-width: 480px; background: var(--surface);
  border-radius: 20px 20px 0 0; padding: 16px; box-shadow: var(--shadow-strong);
}
.sync-sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sync-sheet p { margin: 10px 0; }

/* ---------- Empty states ---------- */
.empty-state { text-align: center; padding: 34px 20px; color: var(--muted); }
.empty-illustration { color: var(--secondary); opacity: .85; margin-bottom: 8px; }
.empty-state h2 { color: var(--text); margin-bottom: 4px; }
.empty-state p { max-width: 340px; margin: 0 auto 16px; font-size: .9rem; }

/* ---------- Progress & stats ---------- */
.progress { height: 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.progress-fill { height: 100%; background: var(--secondary); border-radius: inherit; transition: width var(--t), background var(--t); }
.progress.tone-warning .progress-fill { background: #D9A441; }
.progress.tone-danger .progress-fill { background: var(--danger); }
.progress.tone-success .progress-fill { background: var(--success); }
.ring { width: 74px; height: 74px; flex: none; }
.ring circle { fill: none; stroke-width: 8; }
.ring .track { stroke: var(--surface-2); }
.ring .value { stroke: var(--secondary); stroke-linecap: round; transition: stroke-dashoffset var(--t); }
.stat { text-align: center; }
.stat .value { font-size: 1.35rem; font-weight: 700; }
.stat .label { font-size: .76rem; color: var(--muted); }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.balance-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-2); margin-top: 12px; }
.balance-bar .in { background: var(--success); }
.balance-bar .out { background: var(--secondary); }

/* ---------- Planner ---------- */
.week-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.week-nav .range { flex: 1; text-align: center; font-weight: 700; }
.day-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; scroll-snap-type: x proximity; }
.day-pill {
  min-width: 64px; min-height: 72px; border-radius: 16px; border: 1px solid var(--border);
  background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; scroll-snap-align: start; flex: none;
}
.day-pill .dow { font-size: .72rem; color: var(--muted); text-transform: capitalize; }
.day-pill .dom { font-size: 1.25rem; font-weight: 700; }
.day-pill .count { font-size: .65rem; color: var(--muted); }
.day-pill.active { background: var(--primary); border-color: var(--primary); }
.day-pill.active .dow, .day-pill.active .count { color: var(--text); }
.day-pill.today .dom { text-decoration: underline; text-underline-offset: 3px; }
.planner-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.planner-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; min-height: 180px; }
.planner-col.today { border-color: var(--secondary); box-shadow: inset 0 0 0 1px var(--secondary); }
.planner-col h3 { font-size: .78rem; color: var(--muted); margin-bottom: 8px; text-transform: capitalize; }
.planner-item { border-radius: 10px; background: var(--surface-2); padding: 8px; margin-bottom: 6px; font-size: .8rem; border-left: 3px solid var(--secondary); }
.planner-item .time { color: var(--muted); font-size: .72rem; }
.planner-item .name { overflow-wrap: break-word; word-break: normal; }
.agenda-item { display: flex; align-items: flex-start; gap: 10px; }
.agenda-item .time { color: var(--muted); font-size: .8rem; min-width: 42px; }
.agenda-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--secondary); flex: none; }

/* ---------- Meals grid ---------- */
.meal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.meal-col { min-width: 0; }
.meal-slot { border: 1px dashed var(--border-strong); border-radius: 12px; padding: 8px; min-height: 74px; margin-bottom: 8px; background: var(--surface); cursor: pointer; }
.meal-slot.filled { border-style: solid; background: var(--surface-2); }
.meal-slot .label { font-size: .66rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.meal-slot .title { font-size: .82rem; font-weight: 600; overflow-wrap: break-word; word-break: normal; }

/* ---------- Misc ---------- */
.alert-item { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; margin-bottom: 8px; background: var(--surface-2); }
.alert-item .icon { color: var(--warning); }
.alert-item.danger .icon { color: var(--danger); }
.alert-item .text { flex: 1; font-size: .88rem; }
.quick-add { display: flex; gap: 8px; margin-bottom: 14px; }
.quick-add .input { flex: 1; }
.collapsed summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--muted); }
.plus-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.plus-tile {
  border: 1px solid var(--border); border-radius: 18px; background: var(--surface);
  min-height: 104px; padding: 12px; display: flex; flex-direction: column; gap: 8px;
  align-items: flex-start; justify-content: center; text-align: left; box-shadow: var(--shadow);
}
.plus-tile .icon { color: var(--secondary); }
.plus-tile span { font-size: .82rem; font-weight: 600; }
.plus-tile:hover { background: var(--surface-2); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.filter-chip { min-height: 44px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); }
.filter-chip.active { background: var(--primary); border-color: var(--primary); font-weight: 600; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.welcome { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 28px; }
.welcome-logo { width: 96px; height: 96px; border-radius: 28px; background: var(--primary); display: grid; place-items: center; box-shadow: var(--shadow); margin-bottom: 22px; }
.welcome h1 { font-size: 1.9rem; margin-bottom: 10px; }
.welcome p { color: var(--muted); max-width: 420px; margin-bottom: 28px; }
.welcome .btn { min-width: 220px; }
.storage-alert { margin: 16px; padding: 16px; border-radius: 16px; background: var(--danger-bg); color: var(--danger); }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }

/* ---------- Tablet 768–1023 ---------- */
@media (min-width: 768px) {
  .app-shell { flex-direction: row; }
  .app-header { position: fixed; left: 76px; right: 0; top: 0; height: var(--header-h); padding: 0 22px; }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px; position: fixed; top: 0; bottom: 0; left: 0; width: 76px;
    padding: 14px 8px; background: var(--surface); border-right: 1px solid var(--border); z-index: 50;
    overflow-y: auto;
  }
  .sidebar .brand-mark { margin: 0 auto 14px; width: 44px; height: 44px; }
  .sidebar button.nav-item {
    width: 60px; min-height: 56px; border: 0; border-radius: 14px; background: transparent;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--muted); font-size: .58rem; text-align: center;
  }
  .sidebar button.nav-item.active { background: var(--primary); color: var(--text); }
  .bottom-nav { display: none; }
  .app-main { margin-left: 76px; padding: calc(var(--header-h) + 22px) 22px 60px; max-width: 1100px; }
  .modal-overlay { align-items: center; padding: 20px; }
  .modal { border-radius: 24px; max-width: 560px; padding: 22px; }
  .snackbar { left: auto; right: 22px; bottom: 22px; min-width: 320px; }
  .banner { left: 96px; right: 22px; }
  .sync-sheet-overlay { align-items: center; }
  .sync-sheet { border-radius: 20px; }
  .plus-grid { grid-template-columns: repeat(3, 1fr); }
  .meal-grid { display: block; }
  .meal-col { display: grid; grid-template-columns: 110px 1fr 1fr; gap: 8px; align-items: start; margin-bottom: 8px; }
  .meal-col > h2 { font-size: .8rem; text-transform: capitalize; padding-top: 10px; }
  .meal-slot { margin-bottom: 0; }
}
@media (min-width: 900px) {
  .planner-day-strip { display: none; }
}
@media (max-width: 899px) {
  .planner-grid { display: none; }
}

/* ---------- Desktop ---------- */
@media (min-width: 1024px) {
  .sidebar { width: 224px; padding: 18px 12px; }
  .sidebar .brand { margin: 0 8px 22px; }
  .sidebar button.nav-item {
    width: 100%; min-height: 46px; flex-direction: row; justify-content: flex-start;
    gap: 12px; padding: 0 14px; font-size: .88rem; text-align: left;
  }
  .sidebar button.nav-item .icon { width: 21px; }
  .sidebar .nav-label { display: inline; flex: 1; min-width: 0; text-align: left; }
  .app-header { left: 224px; }
  .app-main { margin-left: 224px; padding-left: 30px; padding-right: 30px; }
  .banner { left: 244px; }
  .grid.two.desktop-split { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); }
}
@media (max-width: 1023px) {
  .sidebar .brand-name, .sidebar .nav-label { display: none; }
}
@media (max-width: 767px) {
  .header-title { display: none; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .form-grid.two { grid-template-columns: 1fr; }
  .plus-grid { grid-template-columns: repeat(2, 1fr); }
  .sync-indicator small, .sync-indicator .sync-label { display: none; }
  .meal-grid { display: block; }
  .meal-col { margin-bottom: 12px; }
  .meal-col > h2 { font-size: .8rem; text-transform: capitalize; margin-bottom: 6px; }
  .meal-slot { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; }
  .meal-slot .title { text-align: right; }
}
@media (max-width: 640px) {
  .list-item {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center; column-gap: 8px; row-gap: 6px;
  }
  .list-item .list-item-leading, .list-item .list-item-trailing.btn-row { display: contents; }
  .list-item > .list-item-leading > * { grid-column: 1; grid-row: 1; min-width: 0; }
  .list-item > .list-item-body { grid-column: 2; grid-row: 1; min-width: 0; }
  .list-item:has(> .list-item-leading:empty) > .list-item-body { grid-column: 1 / 3; }
  .list-item > .list-item-trailing > .list-item-actions {
    grid-column: 3; grid-row: 1; display: flex; align-items: center;
    justify-content: flex-end; flex-wrap: wrap; gap: 6px;
  }
  .list-item > .list-item-trailing > .list-item-secondary {
    grid-column: 1 / -1; grid-row: 2; display: flex; align-items: center;
    justify-content: flex-start; flex-wrap: wrap; gap: 6px; min-width: 0;
  }
  .list-item-title, .list-item-sub, .list-item-secondary { min-width: 0; overflow-wrap: break-word; word-break: normal; }
  .list-item > .input { min-width: 0; flex: 1; }

  .stat-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat { min-width: 0; }
  .stat .value { white-space: nowrap; font-size: clamp(0.95rem, 4.3vw, 1.5rem); font-variant-numeric: tabular-nums; }
  .stat .label { min-width: 0; overflow-wrap: break-word; word-break: normal; }

  .tabs, .segmented, .planner-day-strip {
    scrollbar-width: none; -ms-overflow-style: none;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 10px, #000 calc(100% - 10px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 10px, #000 calc(100% - 10px), transparent);
  }
  .tabs::-webkit-scrollbar, .segmented::-webkit-scrollbar, .planner-day-strip::-webkit-scrollbar { display: none; }
  .tab { padding: 8px 10px; font-size: 0.82rem; }
  .segment { padding: 0 8px; font-size: 0.8rem; }
  .tab.active { border-bottom: 2px solid var(--secondary); }

  .meal-slot { display: block; width: 100%; min-height: 52px; }
  .meal-slot .title { text-align: left; }
  .cuisine-day-strip { display: none; }
}
@media (max-width: 480px) {
  .week-nav {
    display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px;
    grid-template-areas: "back range next" "today today today";
    column-gap: 8px; row-gap: 8px;
  }
  .week-nav > :nth-child(1) { grid-area: back; }
  .week-nav > .range { grid-area: range; text-align: center; min-width: 0; overflow-wrap: break-word; word-break: normal; }
  .week-nav > .btn.small { grid-area: today; justify-self: center; min-width: 120px; }
  .week-nav > :nth-child(4) { grid-area: next; }
  .week-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .week-actions .btn { width: 100%; }
}
@media (min-width: 360px) and (max-width: 480px) {
  .planner-day-strip { gap: 4px; overflow-x: visible; }
  .planner-day-strip .day-pill { flex: 1 1 0; min-width: 40px; width: auto; min-height: 64px; padding: 4px 2px; border-radius: 12px; }
  .day-pill .dow { font-size: 0.62rem; }
  .day-pill .dom { font-size: 1rem; }
  .day-pill .count { font-size: 0.58rem; }
}
@media (max-width: 380px) {
  .app-main { padding-left: 12px; padding-right: 12px; }
  .plus-grid { gap: 8px; }
}
@media (max-width: 340px) {
  .stat-row { grid-template-columns: 1fr; }
  .stat { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; text-align: left; }
  .stat .label { flex: none; }
}

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