/* Shiva Mealtrain stylesheet.
   Built from the Shiva Mealtrain design system (Olive palette): https://claude.ai/artifact/Jx2AspapdTUoGMuCcYBq8J
   1. Fonts (self-hosted, SIL OFL 1.1; see public/fonts/LICENSE.md)
   2. Tokens: Olive light on :root, Olive dark under prefers-color-scheme
   3. Components (class prefix sm-) */

/* ---------- 1. Fonts ---------- */
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-next-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-next-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/fraunces-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/fraunces-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- 2. Tokens ---------- */
:root {
  color-scheme: light dark;
  --color-surface: #f7f5ee;
  --color-surface-raised: #fffefa;
  --color-surface-sunken: #edeadf;
  --color-border: #dcd8c8;
  --color-border-strong: #7f7c6a;
  --color-text: #24281f;
  --color-text-muted: #535848;
  --color-accent: #525d27;
  --color-accent-hover: #454f1f;
  --color-accent-soft: #e7ebd5;
  --color-on-accent: #fffefa;
  --color-slot-open: #7a560f;
  --color-slot-open-soft: #f5e9cc;
  --color-slot-claimed: #5f6055;
  --color-slot-claimed-soft: #eae8de;
  --color-success: #386339;
  --color-success-soft: #e1ecdc;
  --color-warning: #8e4a14;
  --color-warning-soft: #f6e3d1;
  --color-error: #9e2f28;
  --color-error-soft: #f6dfdb;
  --color-focus: #24281f;
  --color-link: var(--color-accent);
  --font-heading: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px #24281f0f;
  --shadow-md: 0 2px 6px #24281f0f, 0 8px 24px -8px #24281f1f;
  --focus-ring: 0 0 0 2px #f7f5ee, 0 0 0 5px #24281f;
  --font-size-small: 1rem;
  --font-size-body: 1.125rem;
  --font-size-body-lg: 1.25rem;
  --font-size-subheading: 1.375rem;
  --font-size-heading: 1.625rem;
  --font-size-title: 2rem;
  --font-size-display: clamp(2.5rem, 2rem + 2vw, 3rem);
  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-body: 1.6;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --border-hairline: 1px;
  --border-control: 1.5px;
  --border-emphasis: 2px;
  --duration-fast: 120ms;
  --duration-base: 200ms;
  --duration-slow: 320ms;
  --ease-calm: cubic-bezier(0.25, 0.1, 0.25, 1);
  --size-tap: 48px;
  --size-control: 56px;
  --size-icon: 20px;
  --size-measure: 38rem;
  --size-page: 68rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-surface: #1b1d17;
    --color-surface-raised: #24271f;
    --color-surface-sunken: #151711;
    --color-border: #363a2d;
    --color-border-strong: #82856f;
    --color-text: #efeee4;
    --color-text-muted: #c0c1ae;
    --color-accent: #bcc67e;
    --color-accent-hover: #ccd593;
    --color-accent-soft: #2f3420;
    --color-on-accent: #1b1d17;
    --color-slot-open: #e3c178;
    --color-slot-open-soft: #37301a;
    --color-slot-claimed: #bdbbaa;
    --color-slot-claimed-soft: #292b23;
    --color-success: #a2cb9d;
    --color-success-soft: #1f2e1e;
    --color-warning: #eaa874;
    --color-warning-soft: #3a2716;
    --color-error: #f2a097;
    --color-error-soft: #3d201d;
    --color-focus: #efeee4;
    --shadow-sm: 0 1px 2px #00000066;
    --shadow-md: 0 8px 24px -8px #000000b3;
    --focus-ring: 0 0 0 2px #1b1d17, 0 0 0 5px #efeee4;
  }
}

/* ---------- 3. Components ---------- */

/* Shiva Mealtrain — components. Plain CSS on top of the tokens; no framework.
   Class prefix: sm-. Every value comes from a token. */

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

body {
  margin: 0;
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--font-size-body);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Type helpers ---------- */
.sm-h-display, .sm-h-title, .sm-h-heading, .sm-h-sub {
  font-family: var(--font-heading);
  font-variation-settings: "SOFT" 50;
  margin: 0;
  text-wrap: balance;
}
.sm-h-display { font-size: var(--font-size-display); line-height: var(--leading-tight); font-weight: var(--weight-medium); letter-spacing: -0.01em; }
.sm-h-title   { font-size: var(--font-size-title); line-height: var(--leading-tight); font-weight: var(--weight-medium); }
.sm-h-heading { font-size: var(--font-size-heading); line-height: var(--leading-snug); font-weight: var(--weight-semibold); }
.sm-h-sub     { font-size: var(--font-size-subheading); line-height: var(--leading-snug); font-weight: var(--weight-semibold); }
.sm-lead  { font-size: var(--font-size-body-lg); line-height: 1.6; margin: 0; }
.sm-p     { margin: 0; }
.sm-small { font-size: var(--font-size-small); line-height: 1.5; }
.sm-muted { color: var(--color-text-muted); }
.sm-eyebrow { font-size: var(--font-size-small); color: var(--color-text-muted); margin: 0; }
.sm-link {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  border-radius: 4px;
}
.sm-link:hover { text-decoration-thickness: 2px; }
.sm-link:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring); }

/* ---------- Wordmark ---------- */
.sm-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.28em;
  font-family: var(--font-heading);
  font-variation-settings: "SOFT" 100, "opsz" 36;
  font-weight: var(--weight-semibold);
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.012em;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
}
.sm-wordmark-b { color: var(--color-accent); font-weight: var(--weight-medium); }
.sm-wordmark--mono .sm-wordmark-b { color: inherit; }
.sm-wordmark--lower { text-transform: lowercase; font-weight: var(--weight-medium); letter-spacing: 0; }
.sm-wordmark--stacked { flex-direction: column; align-items: flex-start; gap: 0; line-height: 0.95; }
.sm-wordmark-tag {
  display: block;
  font-family: var(--font-body);
  font-size: var(--font-size-small);
  font-weight: var(--weight-regular);
  letter-spacing: 0;
  color: var(--color-text-muted);
  margin-top: var(--space-3);
}

/* ---------- Buttons ---------- */
.sm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--size-control);
  min-width: var(--size-tap);
  padding: 0 var(--space-5);
  border: var(--border-control) solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--font-size-body);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-calm), border-color var(--duration-fast) var(--ease-calm), color var(--duration-fast) var(--ease-calm);
}
.sm-btn:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring); }
.sm-btn svg { width: var(--size-icon); height: var(--size-icon); flex: none; }
.sm-btn--primary { background: var(--color-accent); color: var(--color-on-accent); }
.sm-btn--primary:hover { background: var(--color-accent-hover); }
.sm-btn--secondary { background: var(--color-surface-raised); color: var(--color-text); border-color: var(--color-border-strong); }
.sm-btn--secondary:hover { background: var(--color-surface-sunken); }
.sm-btn--quiet { background: transparent; color: var(--color-accent); padding: 0 var(--space-3); }
.sm-btn--quiet:hover { background: var(--color-accent-soft); }
.sm-btn--block { display: flex; width: 100%; }
.sm-btn--sm { min-height: var(--size-tap); padding: 0 var(--space-4); }
.sm-btn[disabled], .sm-btn[aria-disabled="true"] {
  background: var(--color-surface-sunken);
  color: var(--color-text-muted);
  border-color: var(--color-border);
  cursor: not-allowed;
}

/* ---------- Form fields ---------- */
.sm-field { display: flex; flex-direction: column; gap: var(--space-2); }
.sm-label { font-size: var(--font-size-body); font-weight: var(--weight-semibold); line-height: var(--leading-snug); }
.sm-optional { font-weight: var(--weight-regular); color: var(--color-text-muted); }
.sm-hint { font-size: var(--font-size-small); line-height: 1.5; color: var(--color-text-muted); margin: 0; }
.sm-input, .sm-textarea, .sm-select select {
  width: 100%;
  min-height: var(--size-control);
  padding: 0 var(--space-4);
  background: var(--color-surface-raised);
  color: var(--color-text);
  border: var(--border-control) solid var(--color-border-strong);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--font-size-body);
  line-height: var(--leading-snug);
  transition: border-color var(--duration-fast) var(--ease-calm);
}
.sm-textarea { padding: var(--space-3) var(--space-4); min-height: 128px; line-height: var(--leading-body); resize: vertical; }
.sm-input::placeholder, .sm-textarea::placeholder { color: var(--color-text-muted); }
.sm-input:hover, .sm-textarea:hover, .sm-select select:hover { border-color: var(--color-text-muted); }
.sm-input:focus-visible, .sm-textarea:focus-visible, .sm-select select:focus-visible {
  outline: 2px solid transparent;
  border-color: var(--color-text);
  box-shadow: var(--focus-ring);
}
.sm-field--error .sm-input, .sm-field--error .sm-textarea, .sm-field--error .sm-select select {
  border-color: var(--color-error);
  border-width: var(--border-emphasis);
}
.sm-error-msg {
  display: flex; gap: var(--space-2); align-items: flex-start;
  margin: 0; font-size: var(--font-size-small); line-height: 1.5; font-weight: var(--weight-semibold);
  color: var(--color-error);
}
.sm-error-msg svg { width: var(--size-icon); height: var(--size-icon); flex: none; margin-top: 2px; }

.sm-select { position: relative; }
.sm-select select { appearance: none; -webkit-appearance: none; padding-right: var(--space-7); cursor: pointer; }
.sm-select::after {
  content: "";
  position: absolute; right: 22px; top: 50%;
  width: 10px; height: 10px;
  border-right: 2px solid var(--color-text);
  border-bottom: 2px solid var(--color-text);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* Checkbox: the whole row is the tap target */
.sm-check {
  display: flex; align-items: flex-start; gap: var(--space-3);
  min-height: var(--size-tap); padding: var(--space-3) 0;
  cursor: pointer;
}
.sm-check input {
  appearance: none; -webkit-appearance: none;
  flex: none; position: relative;
  width: 26px; height: 26px; margin: 0;
  background: var(--color-surface-raised);
  border: var(--border-control) solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-calm);
}
.sm-check input:checked { background: var(--color-accent); border-color: var(--color-accent); }
.sm-check input:checked::after {
  content: ""; position: absolute; left: 8px; top: 3px;
  width: 7px; height: 13px;
  border-right: 2.5px solid var(--color-on-accent);
  border-bottom: 2.5px solid var(--color-on-accent);
  transform: rotate(45deg);
}
.sm-check input:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring); }
.sm-check-text { display: flex; flex-direction: column; gap: 2px; padding-top: 0; }

/* Toggle: a switch with its state written out, never colour alone */
.sm-toggle {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: var(--size-tap); padding: var(--space-2) 0;
  cursor: pointer;
}
.sm-toggle-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sm-toggle input {
  appearance: none; -webkit-appearance: none;
  order: 3; flex: none; position: relative;
  width: 52px; height: 32px; margin: 0;
  background: var(--color-surface-sunken);
  border: var(--border-control) solid var(--color-border-strong);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background-color var(--duration-base) var(--ease-calm), border-color var(--duration-base) var(--ease-calm);
}
.sm-toggle input::before {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 23px; height: 23px; border-radius: var(--radius-full);
  background: var(--color-text-muted);
  transition: left var(--duration-base) var(--ease-calm), background-color var(--duration-base) var(--ease-calm);
}
.sm-toggle input:checked { background: var(--color-accent); border-color: var(--color-accent); }
.sm-toggle input:checked::before { left: 23px; background: var(--color-on-accent); }
.sm-toggle input:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring); }
.sm-toggle-state { order: 2; font-size: var(--font-size-small); font-weight: var(--weight-semibold); color: var(--color-text-muted); min-width: 2em; text-align: right; }
.sm-toggle-state::after { content: "Off"; }
.sm-toggle:has(input:checked) .sm-toggle-state { color: var(--color-text); }
.sm-toggle:has(input:checked) .sm-toggle-state::after { content: "On"; }

/* ---------- Status tag ---------- */
.sm-tag {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 30px; padding: 2px var(--space-3) 2px var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-small); font-weight: var(--weight-semibold); line-height: 1.3;
  background: var(--color-surface-sunken); color: var(--color-text);
  white-space: nowrap;
}
.sm-tag svg { width: 18px; height: 18px; flex: none; }
.sm-tag--open    { background: var(--color-slot-open-soft);    color: var(--color-slot-open); }
.sm-tag--claimed { background: var(--color-slot-claimed-soft); color: var(--color-slot-claimed); }
.sm-tag--success { background: var(--color-success-soft); color: var(--color-success); }
.sm-tag--warning { background: var(--color-warning-soft); color: var(--color-warning); }
.sm-tag--error   { background: var(--color-error-soft);   color: var(--color-error); }

/* ---------- Notice ---------- */
.sm-notice {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-4) var(--space-5) var(--space-4) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface-sunken);
  color: var(--color-text);
}
.sm-notice > svg { width: 24px; height: 24px; flex: none; margin-top: 2px; color: var(--color-text-muted); }
.sm-notice-body { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.sm-notice-title { font-weight: var(--weight-semibold); margin: 0; }
.sm-notice--success { background: var(--color-success-soft); }
.sm-notice--success > svg, .sm-notice--success .sm-notice-title { color: var(--color-success); }
.sm-notice--warning { background: var(--color-warning-soft); }
.sm-notice--warning > svg, .sm-notice--warning .sm-notice-title { color: var(--color-warning); }
.sm-notice--error { background: var(--color-error-soft); }
.sm-notice--error > svg, .sm-notice--error .sm-notice-title { color: var(--color-error); }
.sm-fade-in { animation: sm-fade var(--duration-slow) var(--ease-calm) both; }
@keyframes sm-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Meal slot card ---------- */
.sm-slot {
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
}
.sm-slot-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.sm-slot-meal { margin: 0; font-size: var(--font-size-body); font-weight: var(--weight-semibold); line-height: var(--leading-snug); }
.sm-slot-when { margin: 0; font-size: var(--font-size-small); color: var(--color-text-muted); }
/* Open: an empty place at the table — dashed edge, raised, with an action */
.sm-slot--open {
  background: var(--color-surface-raised);
  border: var(--border-emphasis) dashed var(--color-slot-open);
}
/* Claimed: settled — recessed, solid hairline, shows who and what */
.sm-slot--claimed {
  background: var(--color-surface-sunken);
  border: var(--border-hairline) solid var(--color-border);
}
.sm-slot-bringing { margin: 0; }
.sm-slot-bringing b { font-weight: var(--weight-semibold); }
.sm-slot-who { margin: 0; font-size: var(--font-size-small); color: var(--color-text-muted); }

/* ---------- Header & footer ---------- */
/* Page gutter: 16px on phones, up to 32px on wide screens. */
:root { --gutter: clamp(var(--space-4), 4vw, var(--space-6)); }

.sm-header {
  background: var(--color-surface-raised);
  border-bottom: var(--border-hairline) solid var(--color-border);
}
.sm-header-inner {
  max-width: 1200px; margin: 0 auto;
  min-height: 80px; padding: 14px var(--gutter);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-5);
}
.sm-header .sm-wordmark { font-size: clamp(22px, 20px + 0.5vw, 26px); padding: var(--space-2) 0; border-radius: 4px; }
.sm-header .sm-wordmark:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring); }
.sm-nav { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-right: calc(-1 * var(--space-4)); }
.sm-nav form { margin: 0; display: contents; }
.sm-nav a, .sm-nav button {
  display: inline-flex; align-items: center; min-height: var(--size-tap); padding: 0 var(--space-4);
  border: 0; border-radius: var(--radius-md); background: transparent; cursor: pointer;
  font: inherit; color: var(--color-accent); font-weight: var(--weight-semibold); text-decoration: none;
  transition: color var(--duration-fast) var(--ease-calm);
}
.sm-nav a:hover, .sm-nav button:hover { color: var(--color-accent-hover); }
.sm-nav a:focus-visible, .sm-nav button:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring); }
@media (max-width: 30rem) {
  .sm-nav { margin-left: calc(-1 * var(--space-3)); margin-right: 0; gap: 0; }
  .sm-nav a, .sm-nav button { padding: 0 var(--space-3); }
}

.sm-footer {
  padding: var(--space-7) var(--gutter) 40px;
  background: var(--color-surface-sunken);
  border-top: var(--border-hairline) solid var(--color-border);
  font-size: var(--font-size-small); color: var(--color-text-muted); line-height: 1.5;
}
.sm-footer-inner {
  max-width: 1136px; margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-5) var(--space-7);
}
.sm-footer-links { display: flex; flex-wrap: wrap; gap: 0 28px; margin: 0; padding: 0; list-style: none; }
.sm-footer-links a {
  display: inline-flex; align-items: center; min-height: var(--size-tap);
  color: var(--color-text); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.sm-footer-links a:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring); border-radius: 4px; }
.sm-footer .sm-wordmark { font-size: 20px; }

/* ---------- Layout & screen pieces ---------- */
.sm-main { padding: var(--space-6) var(--space-4) var(--space-7); display: flex; flex-direction: column; gap: var(--space-7); max-width: var(--size-measure); margin: 0 auto; }
.sm-stack-2 { display: flex; flex-direction: column; gap: var(--space-2); }
.sm-stack-3 { display: flex; flex-direction: column; gap: var(--space-3); }
.sm-stack-4 { display: flex; flex-direction: column; gap: var(--space-4); }
.sm-stack-5 { display: flex; flex-direction: column; gap: var(--space-5); }
.sm-stack-6 { display: flex; flex-direction: column; gap: var(--space-6); }
.sm-row { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.sm-back {
  display: inline-flex; align-items: center; gap: var(--space-1);
  min-height: var(--size-tap); align-self: flex-start;
  color: var(--color-link); font-weight: var(--weight-semibold); text-decoration: none; border-radius: 4px;
}
.sm-back svg { width: var(--size-icon); height: var(--size-icon); }
.sm-back:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring); }
.sm-panel {
  padding: var(--space-5);
  background: var(--color-surface-raised);
  border: var(--border-hairline) solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.sm-panel--quiet { background: transparent; box-shadow: none; }
.sm-rule { border: 0; border-top: var(--border-hairline) solid var(--color-border); margin: 0; }
.sm-signoff { margin: 0; font-family: var(--font-heading); font-variation-settings: "SOFT" 100; font-size: var(--font-size-body-lg); }

/* Definition list for delivery details */
.sm-details { display: flex; flex-direction: column; gap: var(--space-4); margin: 0; }
.sm-details div { display: flex; gap: var(--space-3); align-items: flex-start; }
.sm-details svg { width: 22px; height: 22px; flex: none; margin-top: 3px; color: var(--color-text-muted); }
.sm-details dt { font-size: var(--font-size-small); color: var(--color-text-muted); }
.sm-details dd { margin: 0; }

/* Plain list with hairline separators (dietary notes) */
.sm-list { list-style: none; margin: 0; padding: 0; }
.sm-list li { padding: var(--space-3) 0; border-top: var(--border-hairline) solid var(--color-border); }
.sm-list li:first-child { border-top: 0; padding-top: 0; }

/* ---------- Homepage (design canvas option D). Not in the design system yet. ---------- */
.sm-home { display: block; }
.sm-home-hero {
  padding: clamp(var(--space-7), 8vw, 112px) var(--gutter) clamp(56px, 8vw, 120px);
  display: flex; flex-direction: column; align-items: center; gap: clamp(40px, 5vw, 56px);
}
.sm-home-hero-text { max-width: 820px; display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center; }
.sm-home-h1 {
  margin: 0;
  font-family: var(--font-heading); font-variation-settings: "SOFT" 50;
  font-size: clamp(2.5rem, 1.75rem + 3vw, 4rem); line-height: 1.06; font-weight: var(--weight-medium); letter-spacing: -0.015em;
  text-wrap: balance;
}
.sm-home-lead { margin: 0; max-width: 640px; font-size: clamp(1.25rem, 1.15rem + 0.4vw, 1.375rem); line-height: 1.55; color: var(--color-text-muted); text-wrap: pretty; }

/* Two doors: organize, or send a meal */
.sm-doors { width: 100%; max-width: 1000px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: var(--space-5); }
.sm-door {
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px;
  padding: clamp(var(--space-5), 3vw, 36px);
  background: var(--color-surface-raised);
  border: var(--border-hairline) solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.sm-door-title {
  margin: 0;
  font-family: var(--font-heading); font-variation-settings: "SOFT" 50;
  font-size: clamp(1.5rem, 1.35rem + 0.6vw, 1.75rem); line-height: 1.2; font-weight: var(--weight-semibold);
}
.sm-door .sm-btn { margin-top: 10px; padding: 0 28px; }
@media (max-width: 40rem) { .sm-door .sm-btn { align-self: stretch; } }

/* Full-width band (How it works) */
.sm-band {
  padding: clamp(var(--space-7), 7vw, 88px) var(--gutter);
  background: var(--color-surface-raised);
  border-top: var(--border-hairline) solid var(--color-border);
  border-bottom: var(--border-hairline) solid var(--color-border);
}
.sm-band-inner { max-width: 1136px; margin: 0 auto; display: flex; flex-direction: column; gap: clamp(var(--space-6), 4vw, 56px); }
.sm-band-title {
  margin: 0;
  font-family: var(--font-heading); font-variation-settings: "SOFT" 50;
  font-size: clamp(1.75rem, 1.55rem + 0.8vw, 2.125rem); line-height: 1.2; font-weight: var(--weight-medium);
}
.sm-two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: clamp(40px, 5vw, 56px) clamp(40px, 7vw, 96px); }
.sm-how { display: flex; flex-direction: column; gap: var(--space-5); }
.sm-how-title {
  margin: 0; padding-bottom: var(--space-4);
  border-bottom: var(--border-hairline) solid var(--color-border);
  font-size: var(--font-size-subheading); line-height: 1.3; font-weight: var(--weight-semibold);
}
.sm-how-steps { list-style: none; margin: 0; padding: 0; counter-reset: sm-step; display: flex; flex-direction: column; gap: 20px; }
.sm-how-steps li { counter-increment: sm-step; display: flex; gap: var(--space-4); }
.sm-how-steps li::before {
  content: counter(sm-step);
  flex: none; width: 28px;
  font-family: var(--font-heading); font-size: 26px; line-height: 1.1;
  color: var(--color-accent);
}

/* Closing: setting this up for someone else */
.sm-home-closing {
  max-width: calc(760px + 2 * var(--gutter)); margin: 0 auto;
  padding: clamp(var(--space-7), 7vw, 88px) var(--gutter) clamp(56px, 8vw, 104px);
  display: flex; flex-direction: column; align-items: center; gap: var(--space-4); text-align: center;
}
.sm-home-closing-title {
  margin: 0;
  font-family: var(--font-heading); font-variation-settings: "SOFT" 50;
  font-size: clamp(1.625rem, 1.45rem + 0.6vw, 1.875rem); line-height: 1.25; font-weight: var(--weight-medium);
}
.sm-home-closing-text { margin: 0; font-size: var(--font-size-body-lg); color: var(--color-text-muted); text-wrap: pretty; }
.sm-home-closing-link { margin-top: var(--space-2); display: inline-flex; align-items: center; min-height: var(--size-tap); font-weight: var(--weight-semibold); }

/* ---------- Organizer setup (/start). Not in the design system yet. ---------- */
/* Four-segment progress under "Step 2 of 4"; the words carry the meaning, the bar repeats it. */
.sm-steps-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-1); }
.sm-steps-bar span { height: 6px; border-radius: var(--radius-full); background: var(--color-surface-sunken); border: var(--border-hairline) solid var(--color-border-strong); }
.sm-steps-bar span.is-done { background: var(--color-accent); border-color: var(--color-accent); }
/* One day's meal checkboxes */
.sm-day-pick { margin: 0; padding: 0; border: 0; min-width: 0; }
.sm-day-pick legend { padding: 0; margin-bottom: var(--space-2); }
.sm-day-pick-note { margin-left: var(--space-2); font-family: var(--font-body); font-size: var(--font-size-small); font-weight: var(--weight-regular); color: var(--color-text-muted); }
.sm-check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0 var(--space-4); }
.sm-h-sub-optional { font-family: var(--font-body); font-size: var(--font-size-body); }
.sm-input--short { max-width: 10rem; }
/* The family passcode, easy to read aloud */
.sm-passcode { font-size: var(--font-size-subheading); font-weight: var(--weight-semibold); letter-spacing: 0.02em; }
/* Components set display (e.g. .sm-btn), so [hidden] needs to win. */
[hidden] { display: none !important; }
.sm-error-text { color: var(--color-error); font-weight: var(--weight-semibold); }
/* Keeps line breaks people typed (addresses, the family's message). */
.sm-pre-line { white-space: pre-line; overflow-wrap: anywhere; }

/* Search results (/find): each result is one big tappable card */
.sm-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.sm-result {
  display: flex; flex-direction: column; gap: var(--space-1);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface-raised);
  border: var(--border-hairline) solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  color: var(--color-text); text-decoration: none;
  transition: border-color var(--duration-fast) var(--ease-calm);
}
.sm-result:hover { border-color: var(--color-border-strong); }
.sm-result:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring); }
.sm-result-name {
  font-family: var(--font-heading); font-variation-settings: "SOFT" 50;
  font-size: var(--font-size-subheading); font-weight: var(--weight-semibold); line-height: var(--leading-snug);
  color: var(--color-accent);
}

/* Time zone line in the shiva form: one sentence, opens to a select */
.sm-tz > summary { list-style: none; cursor: pointer; font-size: var(--font-size-small); color: var(--color-text-muted); padding: var(--space-2) 0; border-radius: 4px; }
.sm-tz > summary::-webkit-details-marker { display: none; }
.sm-tz > summary:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring); }
.sm-tz[open] > summary { margin-bottom: var(--space-3); }

/* About page: portrait beside the text, stacked on phones */
.sm-about-who { display: grid; grid-template-columns: 1fr; gap: var(--space-5); align-items: start; }
@media (min-width: 34rem) { .sm-about-who { grid-template-columns: 9rem 1fr; } }
.sm-portrait { display: block; width: 9rem; max-width: 60%; }
.sm-portrait img { display: block; width: 100%; height: auto; }
/* The photo has a white background: multiply takes on the page colour in light mode. */
.sm-portrait img { mix-blend-mode: multiply; }
@media (prefers-color-scheme: dark) {
  /* Multiply would darken the face on a dark page, so give the photo its own light card instead. */
  .sm-portrait { padding: var(--space-2); background: #ffffff; border-radius: var(--radius-lg); }
  .sm-portrait img { mix-blend-mode: normal; }
}

/* Plain bulleted lists for reading pages (privacy, about) */
.sm-prose-list { margin: 0; padding-left: 1.25em; display: flex; flex-direction: column; gap: var(--space-3); }
.sm-prose-list li::marker { color: var(--color-text-muted); }
.sm-prose-list b, .sm-p b { font-weight: var(--weight-semibold); }

/* ---------- Stats (/admin/stats). Single-series marks in the accent; all text in text tokens. ---------- */
.sm-stack-1 { display: flex; flex-direction: column; gap: var(--space-1); }
.sm-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: var(--space-3); margin: 0; }
.sm-tile { padding: var(--space-4); background: var(--color-surface-raised); border: var(--border-hairline) solid var(--color-border); border-radius: var(--radius-lg); display: flex; flex-direction: column; gap: var(--space-1); }
.sm-tile dt { font-size: var(--font-size-small); color: var(--color-text-muted); }
.sm-tile dd { margin: 0; font-size: var(--font-size-heading); font-weight: var(--weight-semibold); line-height: 1.2; color: var(--color-text); }
.sm-tile-of { font-size: var(--font-size-small); font-weight: var(--weight-regular); color: var(--color-text-muted); }

.sm-table { width: 100%; border-collapse: collapse; font-size: var(--font-size-small); }
.sm-table th, .sm-table td { padding: var(--space-2) var(--space-3); border-bottom: var(--border-hairline) solid var(--color-border); text-align: left; }
.sm-table thead th { color: var(--color-text-muted); font-weight: var(--weight-semibold); }
.sm-table tbody th { font-weight: var(--weight-regular); }
.sm-table td { text-align: right; font-variant-numeric: tabular-nums; }
.sm-table thead th:not(:first-child) { text-align: right; }
.sm-table--compact { margin-top: var(--space-3); }
/* Text tables (e.g. "Already coming"): reading text, left-aligned, top-aligned rows. */
.sm-table--text { font-size: var(--font-size-body); }
.sm-table--text th, .sm-table--text td { padding: var(--space-3) var(--space-3) var(--space-3) 0; vertical-align: top; text-align: left; }
.sm-table--text thead th { font-size: var(--font-size-small); }
.sm-table--text thead th:not(:first-child) { text-align: left; }
.sm-table--text tbody th { width: 8.5rem; white-space: nowrap; }
.sm-table--text td { font-variant-numeric: normal; }
.sm-table-day { display: block; font-weight: var(--weight-semibold); }
.sm-table-sub { display: block; font-size: var(--font-size-small); color: var(--color-text-muted); }

/* Column chart: bars <=24px, 2px surface gap, 4px rounded top, square at the baseline. */
.sm-chart { position: relative; margin: 0; padding: var(--space-4) var(--space-4) var(--space-2); background: var(--color-surface-raised); border: var(--border-hairline) solid var(--color-border); border-radius: var(--radius-lg); }
.sm-chart-max { position: absolute; top: var(--space-2); left: var(--space-4); font-size: 13px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.sm-columns { list-style: none; margin: var(--space-4) 0 0; padding: 0; height: 160px; display: flex; align-items: flex-end; gap: 2px; border-bottom: var(--border-hairline) solid var(--color-border-strong); }
.sm-columns li { position: relative; flex: 1 1 0; max-width: 24px; height: 100%; display: flex; align-items: flex-end; justify-content: center; border-radius: 4px 4px 0 0; outline: none; }
.sm-column { display: block; width: 100%; background: var(--color-accent); border-radius: 4px 4px 0 0; }
.sm-columns li:focus-visible { box-shadow: var(--focus-ring); }
/* Tooltip: on hover and keyboard focus, from the bar's own label. */
.sm-columns li:hover::after, .sm-columns li:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + var(--space-2)); left: 50%; transform: translateX(-50%);
  padding: var(--space-1) var(--space-2); white-space: nowrap; z-index: 1;
  background: var(--color-text); color: var(--color-surface); border-radius: var(--radius-sm); font-size: 13px; font-weight: var(--weight-semibold);
  pointer-events: none;
}
.sm-columns li:first-child:hover::after, .sm-columns li:first-child:focus-visible::after { left: 0; transform: none; }
.sm-columns li:last-child:hover::after, .sm-columns li:last-child:focus-visible::after { left: auto; right: 0; transform: none; }
.sm-chart-axis { display: flex; justify-content: space-between; margin-top: var(--space-1); font-size: 13px; color: var(--color-text-muted); }

/* Horizontal bars by page type, values at the tip. */
.sm-hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.sm-hbars li { display: grid; grid-template-columns: minmax(7rem, 11rem) 1fr 3.5rem; align-items: center; gap: var(--space-3); font-size: var(--font-size-small); }
.sm-hbar-track { display: block; height: 16px; }
.sm-hbar { display: block; height: 100%; background: var(--color-accent); border-radius: 0 4px 4px 0; }
.sm-hbar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--color-text); }

/* Read-only summary of saved details (manage page) */
.sm-summary { display: flex; flex-direction: column; gap: var(--space-3); margin: 0; }
.sm-summary dt { font-size: var(--font-size-small); color: var(--color-text-muted); }
.sm-summary dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.sm-visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* A day in the meal list */
.sm-day { display: flex; flex-direction: column; gap: var(--space-3); }
.sm-day-note { margin: 0; font-size: var(--font-size-small); color: var(--color-text-muted); }

/* Progress: always a sentence, the bar only reinforces it */
.sm-progress { display: flex; flex-direction: column; gap: var(--space-2); }
.sm-progress-bar { height: 8px; border-radius: var(--radius-full); background: var(--color-surface-sunken); border: var(--border-hairline) solid var(--color-border-strong); overflow: hidden; }
.sm-progress-bar span { display: block; height: 100%; background: var(--color-accent); }

/* Dashboard rows */
.sm-rows { list-style: none; margin: 0; padding: 0; border: var(--border-hairline) solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface-raised); overflow: hidden; }
.sm-rows li { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4) var(--space-4) var(--space-3); border-top: var(--border-hairline) solid var(--color-border); }
.sm-rows li:first-child { border-top: 0; }
.sm-rows .sm-row-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.sm-rows .sm-row-actions { display: flex; gap: var(--space-1); margin-left: calc(-1 * var(--space-3)); }

.sm-copy-field { display: flex; gap: var(--space-2); }
.sm-copy-field .sm-input { flex: 1; min-width: 0; background: var(--color-surface-sunken); }

