:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e3e6eb;
  --border-strong: #cfd5dd;
  --text: #16202e;
  --muted: #5d6878;
  --faint: #8b95a3;
  --brand: #0f766e;
  --brand-600: #0d6660;
  --brand-50: #e7f5f3;
  --ok: #15803d;      --ok-bg: #e8f6ec;
  --warn: #b45309;    --warn-bg: #fdf3e3;
  --danger: #b91c1c;  --danger-bg: #fdecec;
  --info: #1d4ed8;    --info-bg: #eaf0fe;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.text-danger { color: var(--danger); }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1320px; margin: 0 auto; padding: 0 20px; height: 60px; display: flex; align-items: center; gap: 18px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 750; font-size: 1.15rem; color: var(--text); letter-spacing: -.02em; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; }
.nav { display: flex; gap: 2px; flex: 1; }
.nav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); font-weight: 550; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--brand-50); color: var(--brand); }
.user-menu { display: flex; align-items: center; gap: 10px; }
.user-menu form { margin: 0; }
main { max-width: 1120px; margin: 0 auto; padding: 26px 20px 64px; }
main.wide { max-width: 1320px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin-top: 4px; }
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 10px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .topbar-inner { gap: 10px; height: auto; padding-block: 10px; flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .user-menu .user-name { display: none; }
}

/* ---------- patient switcher & menus ---------- */
.switcher { position: relative; }
.switcher summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-weight: 600; max-width: 240px; }
.switcher summary::-webkit-details-marker, .menu summary::-webkit-details-marker { display: none; }
.switcher-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caret { color: var(--faint); font-size: .8rem; }
.switcher-menu, .menu-list { position: absolute; top: calc(100% + 6px); left: 0; min-width: 260px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(16, 24, 40, .12); padding: 6px; z-index: 30; }
.switcher-menu a, .menu-list a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--text); line-height: 1.3; }
.switcher-menu a:hover, .menu-list a:hover { background: var(--surface-2); text-decoration: none; }
.switcher-menu a.active { background: var(--brand-50); }
.switcher-add { border-top: 1px solid var(--border); margin-top: 4px; border-radius: 0 !important; color: var(--brand) !important; font-weight: 600; }
.menu { position: relative; }
.menu summary { list-style: none; }
.menu-right .menu-list { left: auto; right: 0; }
.menu-icon { color: var(--brand); display: grid; }
.menu-form { padding: 14px; min-width: 280px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.card-body { padding: 14px 18px; }
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty .btn { margin-top: 14px; }
.danger-zone { margin-top: 20px; border-color: #f3c7c7; }
.danger-zone h2 { color: var(--danger); }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; line-height: 1.2; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .4; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #126b33; }
.btn-danger { color: var(--danger); border-color: #f3c7c7; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: .82rem; border-radius: 7px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; color: var(--faint); font: inherit; text-decoration: underline; cursor: pointer; }
.inline { display: inline; margin: 0; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-weight: 600; font-size: .88rem; }
.hint { color: var(--faint); font-size: .8rem; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.fields .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .fields { grid-template-columns: 1fr; } }

input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number],
input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: 9px; font: inherit; color: inherit; background: #fff;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 118, 110, .15); }
input[type=range] { width: 100%; accent-color: var(--brand); }
.check { display: flex; align-items: flex-start; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; margin-top: 3px; accent-color: var(--brand); flex: none; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; font-size: .9rem; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.qty { display: flex; gap: 6px; }
.qty input[type=number] { max-width: 110px; }
.range-labels { display: flex; justify-content: space-between; font-size: .72rem; color: var(--faint); }

.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 10px; padding: 3px; gap: 3px; background: var(--surface-2); flex-wrap: wrap; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; padding: 6px 14px; border-radius: 7px; font-weight: 600; font-size: .88rem; color: var(--muted); cursor: pointer; }
.segmented input:checked + span { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.segmented input:focus-visible + span { box-shadow: 0 0 0 3px rgba(15, 118, 110, .25); }
.segmented-lg span { padding: 8px 18px; }

.day-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.day-picker label { position: relative; }
.day-picker input { position: absolute; opacity: 0; }
.day-picker span { display: inline-block; min-width: 44px; text-align: center; padding: 7px 8px; border: 1px solid var(--border-strong); border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .85rem; color: var(--muted); user-select: none; }
.day-picker input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.times-list { display: flex; flex-direction: column; gap: 8px; }
.time-row { display: flex; gap: 8px; align-items: center; }
.time-row input { max-width: 170px; }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches label { position: relative; cursor: pointer; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 28px; height: 28px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--border-strong); }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--text); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; vertical-align: middle; }

/* ---------- flash ---------- */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.flash { padding: 11px 14px; border-radius: 10px; font-weight: 500; border: 1px solid transparent; }
.flash-success { background: var(--ok-bg); color: #14532d; border-color: #bfe5cb; }
.flash-error { background: var(--danger-bg); color: #7f1d1d; border-color: #f5c2c2; }
.flash-info { background: var(--info-bg); color: #1e3a8a; border-color: #c9d7fb; }
.alert-allergy { background: var(--danger-bg); color: #7f1d1d; border: 1px solid #f5c2c2; border-radius: 10px; padding: 10px 14px; font-size: .9rem; margin-bottom: 18px; }
.warn-box { background: var(--warn-bg); color: #78350f; border: 1px solid #f3d9a8; border-radius: 10px; padding: 10px 12px; font-size: .88rem; }

/* ---------- badges, tags, avatars ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 650; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-done { background: var(--ok-bg); color: var(--ok); }
.badge-skipped { background: var(--surface-2); color: var(--muted); }
.badge-due { background: var(--warn-bg); color: var(--warn); }
.badge-missed { background: var(--danger-bg); color: var(--danger); }
.badge-upcoming { background: var(--info-bg); color: var(--info); }
.badge-prn { background: #f3eefe; color: #6d28d9; }
.badge-paused { background: var(--surface-2); color: var(--faint); }
.badge-symptom { background: #fff1f2; color: #be123c; }
.badge-role { background: var(--brand-50); color: var(--brand); }
.badge-role::before { display: none; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: .75rem; font-weight: 550; }
.tag-group { color: #374151; }
.schedule-pills { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }

.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .8rem; flex: none; }
.avatar-sm { width: 28px; height: 28px; font-size: .7rem; }
.c-teal { background: #0f766e; } .c-indigo { background: #4f46e5; } .c-rose { background: #e11d48; } .c-amber { background: #d97706; }
.c-emerald { background: #059669; } .c-violet { background: #7c3aed; } .c-sky { background: #0284c7; } .c-orange { background: #ea580c; }
.c-slate { background: #64748b; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.stat .num { font-size: 1.5rem; font-weight: 750; letter-spacing: -.02em; }
.stat .lbl { color: var(--muted); font-size: .8rem; font-weight: 550; }
.stat.done .num { color: var(--ok); } .stat.due .num { color: var(--warn); } .stat.missed .num { color: var(--danger); }
.stat.upcoming .num { color: var(--info); } .stat.symptom .num { color: #be123c; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.meter { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }

/* ---------- view controls ---------- */
.view-toggle { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.view-toggle a { padding: 6px 14px; border-radius: 7px; font-weight: 600; font-size: .88rem; color: var(--muted); }
.view-toggle a:hover { text-decoration: none; color: var(--text); }
.view-toggle a.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.date-nav { display: flex; align-items: center; gap: 6px; }
.date-nav .btn { padding: 7px 11px; }
.date-nav form { margin: 0; }
.date-nav input[type=date] { padding: 7px 10px; }

/* ---------- chips (logged entries & scheduled slots) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip-entry { display: inline-flex; align-items: baseline; gap: 3px; padding: 2px 7px; border-radius: 6px; font-size: .8rem; line-height: 1.35;
  color: var(--c); background: color-mix(in srgb, var(--c) 10%, white); border: 1px solid color-mix(in srgb, var(--c) 28%, white); white-space: nowrap; }
.chip-entry strong { font-weight: 700; }
.chip-entry:hover { text-decoration: none; background: color-mix(in srgb, var(--c) 18%, white); }
.chip-entry.is-skipped { text-decoration: line-through; opacity: .7; }
.note-dot { font-size: .72rem; opacity: .8; }
.chip-slot { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 6px; font: inherit; font-size: .78rem; line-height: 1.4;
  border: 1px dashed var(--border-strong); color: var(--faint); background: transparent; white-space: nowrap; cursor: default; }
button.chip-slot { cursor: pointer; }
.chip-slot.is-missed { border-color: #f1a7a7; color: var(--danger); background: #fff7f7; font-weight: 600; }
.chip-slot.is-missed.is-optional { border-color: var(--border-strong); color: var(--muted); background: transparent; font-weight: 500; }
.chip-slot.is-due { border-color: #f0c77f; color: var(--warn); background: #fffaf0; font-weight: 600; }
.chip-slot.demo { cursor: default; }

/* ---------- day view timeline ---------- */
.timeline { overflow: hidden; }
.hour { display: grid; grid-template-columns: 64px 1fr; border-bottom: 1px solid var(--border); min-height: 40px; }
.hour:last-child { border-bottom: 0; }
.hour-label { padding: 10px 0 0 14px; font-size: .78rem; font-weight: 650; color: var(--faint); }
.hour-body { padding: 6px 12px 6px 0; display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.hour.is-empty .hour-body { min-height: 28px; }
.hour.is-now { background: linear-gradient(90deg, #f0fdfa, transparent 60%); }
.hour.is-now .hour-label { color: var(--brand); }
.hour.is-now .hour-label::after { content: " now"; font-weight: 500; }
.slot { display: flex; gap: 12px; align-items: center; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); border-left: 4px solid var(--c); background: var(--surface); }
.slot-main { flex: 1; min-width: 0; }
.slot-title { font-weight: 650; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.slot-meta { color: var(--muted); font-size: .84rem; }
.slot-note { font-size: .84rem; color: var(--muted); font-style: italic; margin-top: 2px; }
.slot-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.slot.is-done, .slot.is-skipped { background: #fbfcfd; }
.slot.is-done .slot-title, .slot.is-skipped .slot-title { color: var(--muted); }
.slot.is-missed { background: #fff9f9; }
.slot.is-due { background: #fffcf4; }
.slot.is-optional { border-left-style: dashed; }
@media (max-width: 640px) {
  .slot { flex-wrap: wrap; }
  .slot-actions { justify-content: flex-start; }
  .hour { grid-template-columns: 52px 1fr; }
}
.side-row { display: flex; gap: 10px; align-items: flex-start; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.side-row:last-child { border-bottom: 0; }
.side-row .swatch { margin-top: 6px; }
.side-title { font-weight: 600; }
.note { padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.note p { white-space: pre-line; }

/* ---------- week sheet ---------- */
.legend-hint { margin: -8px 0 12px; gap: 8px; }
/* The grid scrolls inside a box that fits under the sticky top bar (60px), so its header rows stay pinned
   while scrolling down the week. */
.sheet-wrap { overflow: auto; max-height: calc(100vh - 84px); max-height: calc(100dvh - 84px); scroll-margin-top: 72px; overscroll-behavior-x: contain; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); }
.sheet { width: 100%; border-collapse: collapse; font-size: .85rem; }
.sheet th, .sheet td { border: 1px solid var(--border); padding: 5px 7px; vertical-align: top; text-align: left; }
.sheet thead th { position: sticky; top: 0; background: #f8f9fb; z-index: 2; }
.sheet thead tr + tr th { top: var(--head-row-1, 0px); }  /* second header row pins under the first (set in app.js) */
.sheet thead tr:last-child th, .sheet thead th[rowspan] { box-shadow: inset 0 -2px 0 var(--border-strong); }
.sheet-group { font-weight: 750; text-align: center !important; text-transform: uppercase; letter-spacing: .02em; font-size: .78rem; color: #1f2937; white-space: nowrap; }
.sheet-items { font-size: .78rem; font-weight: 400; background: #fff !important; min-width: 120px; }
.sheet-items .req { font-weight: 700; }
.sheet-items .opt { font-style: italic; }
.sheet .req { font-weight: 700; }
.sheet .opt { font-style: italic; }
.sheet-date { width: 64px; font-weight: 650; background: #f8f9fb; white-space: nowrap; }
.sheet-date a { color: var(--text); }
.sheet-date span { color: var(--muted); font-weight: 500; }
.today-pill { display: inline-block; margin-top: 4px; font-size: .68rem; background: var(--brand); color: #fff; border-radius: 99px; padding: 0 7px; }
.sheet-block { width: 74px; font-weight: 550; color: var(--muted); background: #fbfbfc; white-space: nowrap; }
.sheet-day { border-top: 2px solid #9aa3af; }
.sheet-day tr:first-child > * { border-top: 2px solid #9aa3af; }
.sheet-day.is-today .sheet-date, .sheet-day.is-today .sheet-block { background: #ecfdf8; }
.sheet-day.is-future td { background: #fcfcfd; }
.sheet-cell { min-width: 120px; height: 34px; }
.sheet-cell > * { margin: 1px 2px 1px 0; }
.sheet-cell.clickable { cursor: cell; }
.sheet-cell.clickable:hover { background: #f6fbfa; box-shadow: inset 0 0 0 1px #99d5cb; }
.row-flag .sheet-block { color: var(--danger); }
.row-flag .sheet-block::after { content: " ●"; font-size: .7rem; }
.week-notes { margin-top: 20px; }
.notes-list { margin: 0 0 12px; padding-left: 18px; }
.notes-list li { margin-bottom: 6px; }
.note-form { display: flex; gap: 8px; }
.note-form select { max-width: 130px; }
.preview { overflow: hidden; }
.sheet-mini { font-size: .8rem; }
.sheet-mini .sheet-cell { min-width: 0; }
/* Day grid: one column per item, so narrower cells and a Time column that stays put while scrolling sideways. */
.sheet-dayview .sheet-cell, .sheet-dayview .sheet-items { min-width: 92px; }
.sheet-dayview .sheet-block { position: sticky; left: 0; z-index: 1; }
.sheet-dayview thead .sheet-block { z-index: 3; }
.sheet-dayview tr.is-now .sheet-block { background: #ecfdf8; color: var(--brand); }
.sheet-dayview tr.is-now td { background: #f7fdfb; }
/* Medication reference */
.ref-filter { width: 220px; }
.ref-table th { background: #f8f9fb; }
.ref-table td { padding: 7px 9px; }
.ref-cat { font-weight: 650; font-size: .78rem; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; color: #1f2937; }
.ref-name { font-weight: 600; min-width: 170px; }
.ref-name a { color: var(--text); }
.ref-name .swatch { margin-right: 4px; }
.ref-notes { min-width: 180px; white-space: pre-line; }
.ref-table tr.is-paused td:not(.ref-cat) { opacity: .55; }
.ref-empty { padding: 12px; margin: 0; }
.side-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 20px; align-items: start; }

/* ---------- dialog ---------- */
.dialog { border: 0; padding: 0; border-radius: 16px; width: min(560px, calc(100vw - 24px)); box-shadow: 0 24px 60px rgba(16, 24, 40, .25); }
.dialog::backdrop { background: rgba(15, 23, 42, .35); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.dialog-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: #fafbfc; border-radius: 0 0 16px 16px; }

/* ---------- plan ---------- */
.group-card { overflow: visible; }
.group-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 10px 18px; border-radius: var(--radius) var(--radius) 0 0; border-bottom: 1px solid var(--border); }
.group-head h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .02em; }
.group-foot { padding: 10px 18px; border-top: 1px solid var(--border); font-size: .88rem; font-weight: 600; }
.item-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--border); }
.item-row:last-of-type { border-bottom: 0; }
.item-row.paused { opacity: .55; }
.item-row .req { font-weight: 700; }
.item-row .opt { font-style: italic; font-weight: 550; }
.item-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; flex: none; }
.item-actions .btn { padding: 4px 8px; }
.onboarding { margin-bottom: 20px; background: linear-gradient(135deg, #f0fdfa, #fff); border-color: #b7e4dc; }
.steps { margin: 12px 0 16px; padding-left: 20px; }
.steps li { margin-bottom: 8px; color: var(--muted); }
.steps li strong { color: var(--text); }
.steps li.done { text-decoration: line-through; text-decoration-color: var(--faint); }
.steps li.done::marker { content: "✓  "; color: var(--ok); }
.blocks-table { width: 100%; border-collapse: collapse; }
.blocks-table th { text-align: left; font-size: .75rem; color: var(--muted); font-weight: 600; padding-bottom: 4px; }
.blocks-table td { padding: 3px 4px 3px 0; }
.blocks-table input { padding: 6px 8px; font-size: .88rem; }

/* ---------- team ---------- */
.member-row { display: flex; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.member-row:last-child { border-bottom: 0; }
.member-row select { width: auto; padding: 5px 8px; font-size: .85rem; }
.role-options { display: flex; flex-direction: column; gap: 8px; }
.role-option { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-weight: 400 !important; }
.role-option input { margin-top: 4px; accent-color: var(--brand); }
.role-option:has(input:checked) { border-color: var(--brand); background: var(--brand-50); }
.invite-created { margin-bottom: 20px; border-color: #99d5cb; background: #f0fdfa; }
.activity { list-style: none; margin: 0; padding: 6px 18px 12px; font-size: .88rem; }
.activity li { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.activity li:last-child { border-bottom: 0; }

/* ---------- welcome ---------- */
.welcome { max-width: 760px; margin: 10px auto 0; }
.welcome .lead { font-size: 1.08rem; margin: 6px 0 20px; }
.who-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.who-option { display: flex; gap: 12px; padding: 16px; border: 1px solid var(--border-strong); border-radius: 12px; cursor: pointer; }
.who-option span { display: flex; flex-direction: column; gap: 4px; }
.who-option input { accent-color: var(--brand); margin-top: 4px; }
.who-option:has(input:checked) { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 1px var(--brand); }
.who-option.disabled { opacity: .5; cursor: default; }
@media (max-width: 640px) { .who-options { grid-template-columns: 1fr; } }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
.data th, .data td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; background: #fafbfc; }
.data tbody tr:hover { background: #fafbfc; }
.data .notes { max-width: 300px; color: var(--muted); font-size: .88rem; }
.filters { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.filters .field label { font-size: .78rem; }
@media (max-width: 900px) { .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); }

/* ---------- auth & landing ---------- */
.auth-wrap { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 420px; padding: 32px; }
.auth-card h1 { font-size: 1.45rem; margin-bottom: 6px; }
.auth-card form { margin-top: 22px; display: flex; flex-direction: column; gap: 16px; }
.auth-foot { margin-top: 18px; text-align: center; color: var(--muted); font-size: .9rem; }
.hero { max-width: 1120px; margin: 0 auto; padding: 72px 20px 40px; display: grid; grid-template-columns: 1fr 1.1fr; gap: 44px; align-items: center; }
.hero h1 { font-size: 2.7rem; letter-spacing: -.03em; line-height: 1.08; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero p.lead { font-size: 1.1rem; color: var(--muted); margin: 18px 0 28px; max-width: 520px; }
.hero .btn { padding: 12px 20px; font-size: 1rem; }
.features { max-width: 1120px; margin: 0 auto; padding: 20px 20px 70px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature { padding: 22px; }
.feature h3 { margin: 12px 0 6px; }
.feature p { color: var(--muted); font-size: .93rem; }
.med-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; }
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 44px; }
  .hero h1 { font-size: 2.1rem; }
  .features { grid-template-columns: 1fr; }
}
.site-foot { text-align: center; color: var(--faint); font-size: .8rem; padding: 0 20px 32px; }
.site-foot-links { display: flex; justify-content: center; gap: 18px; margin-bottom: 8px; font-size: .85rem; }
.site-foot-links a { color: var(--muted); }

/* ---------- about, help, contact ---------- */
.info-page { max-width: 760px; margin: 0 auto; }
.prose > * + * { margin-top: 12px; }
.prose h2 { margin-top: 24px; }
.prose > h2:first-child { margin-top: 0; }
.prose ul, .faq ul { margin: 0; padding-left: 20px; }
.prose li + li, .faq li + li { margin-top: 6px; }
.info-next { margin-top: 16px; }
.help-section + .help-section { margin-top: 28px; }
.help-section h2 { margin-bottom: 10px; }
.faq details + details { border-top: 1px solid var(--border); }
.faq summary { padding: 14px 18px; cursor: pointer; font-weight: 600; }
.faq summary:hover { background: var(--surface-2); }
.faq details > :not(summary) { padding: 0 18px 16px; color: var(--muted); }
.faq details > ul { padding-left: 38px; }
.contact-email { font-size: 1.1rem; font-weight: 600; }

/* ---------- print: the week sheet on landscape paper ---------- */
@media print {
  @page { size: landscape; margin: 10mm; }
  body { background: #fff; font-size: 11px; }
  .topbar, .site-foot, .no-print, .flashes, .legend-hint, dialog, .note-form { display: none !important; }
  main, main.wide { max-width: none; padding: 0; }
  .sheet-wrap { overflow: visible; max-height: none; box-shadow: none; border: 0; }
  .sheet { font-size: 9.5px; }
  .sheet thead th { position: static; }
  .sheet-group, .ref-cat, .swatch, .chip-entry, .chip-slot, .sheet-day.is-today .sheet-date { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .alert-allergy { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .card { box-shadow: none; }
  .chip-slot:not(.is-missed) { display: none; }
}
.blocks-table td:first-child { width: 36%; }
.blocks-table input[type=time] { min-width: 0; padding: 6px 4px; }
