/* =========================================================================
   Lana Personal Chef — shared styles for the client and chef portals.
   Layout: single centred column (max 1080px); booking page splits into
   form + sticky summary on wide screens, stacks on phones.
   No external fonts or CDNs (keeps the Content-Security-Policy strict).
   ========================================================================= */
:root {
  --bg: #F6F5F2;
  --surface: #FFFFFF;
  --ink: #1E1B1D;
  --muted: #6A6368;
  --line: #E2DEE0;
  --accent: #5A2D52;        /* eggplant */
  --accent-ink: #FFFFFF;
  --accent-soft: #F1E8EF;
  --herb: #4F6B2A;          /* success / done */
  --herb-soft: #E8EFDD;
  --warn: #9A5B00;
  --warn-soft: #FBEFD9;
  --danger: #A12B2B;
  --danger-soft: #F9E3E3;
  --info: #2C5A85;
  --info-soft: #E3ECF5;
  --f-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151314; --surface: #1F1C1E; --ink: #EEE9EC; --muted: #A79EA4; --line: #353034;
    --accent: #D9A6CD; --accent-ink: #241320; --accent-soft: #3A2636;
    --herb: #A9C77E; --herb-soft: #26301B; --warn: #F0B860; --warn-soft: #3A2C14;
    --danger: #F08C8C; --danger-soft: #3D1E1E; --info: #8FB8E6; --info-soft: #1C2A3A;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--f-body); }
h1, h2, h3 { font-family: var(--f-display); font-weight: 600; line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.wrap { max-width: 1080px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.mono, .num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.eyebrow { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; color: var(--muted); }

/* ---------- Header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-block: 12px; }
.brand { font-family: var(--f-display); font-size: 1.3rem; font-weight: 600; text-decoration: none; color: var(--ink); }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a, .nav button { padding: 7px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .92rem; background: none; border: 0; cursor: pointer; }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
main { padding-block: 28px 80px; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.card.tight { padding: 14px 16px; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 10px 16px; font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--danger); }
.btn.good { background: var(--herb); border-color: var(--herb); color: var(--surface); }
.btn.sm { padding: 6px 11px; font-size: .875rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.linkish { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font-weight: 600; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: .9rem; min-width: 0; }
.field input, .field select, .field textarea { font-weight: 400; font-size: 1rem; border: 1px solid var(--line); background: var(--bg); border-radius: 9px; padding: 10px 12px; width: 100%; min-width: 0; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .82rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.error { color: var(--danger); font-size: .9rem; font-weight: 500; }
.notice { border-radius: 10px; padding: 12px 14px; font-size: .92rem; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.info { background: var(--info-soft); color: var(--info); }
.notice.good { background: var(--herb-soft); color: var(--herb); }
.notice.danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- Pills (status) ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-requested { background: var(--warn-soft); color: var(--warn); }
.st-confirmed { background: var(--info-soft); color: var(--info); }
.st-groceries_ready { background: var(--accent-soft); color: var(--accent); }
.st-completed { background: var(--herb-soft); color: var(--herb); }
.st-cancelled { background: var(--line); color: var(--muted); }
.pay-paid { background: var(--herb-soft); color: var(--herb); }
.pay-unpaid { background: var(--line); color: var(--muted); }
.pay-refunded { background: var(--danger-soft); color: var(--danger); }

/* ---------- Hero + how it works ---------- */
.hero { display: grid; gap: 14px; max-width: 62ch; margin-bottom: 28px; }
.hero p { font-size: 1.08rem; color: var(--muted); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 32px; counter-reset: step; }
.steps li { list-style: none; counter-increment: step; display: grid; gap: 4px; padding-top: 12px; border-top: 2px solid var(--accent); }
.steps li::before { content: "Step " counter(step); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--accent); }
.steps { padding: 0; margin-top: 0; }

/* ---------- Booking layout ---------- */
.book-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 24px; align-items: start; }
@media (max-width: 880px) { .book-layout { grid-template-columns: minmax(0, 1fr); } }
.section-title { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.section-title .n { font-family: var(--f-mono); color: var(--accent); font-size: .85rem; }

/* Calendar */
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .dow { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: center; font-weight: 700; }
.cal button { aspect-ratio: 1; max-width: 100%; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-variant-numeric: tabular-nums; font-weight: 600; }
.cal button:disabled { background: transparent; border-color: transparent; color: var(--muted); opacity: .45; cursor: not-allowed; text-decoration: line-through; }
.cal button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.cal .blank { visibility: hidden; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.chip span { display: block; border: 1px solid var(--line); border-radius: 9px; padding: 8px 14px; background: var(--surface); font-weight: 600; }
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Dishes */
.course { display: grid; gap: 10px; }
.course + .course { margin-top: 18px; }
.dishes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.dish { position: relative; border: 1px solid var(--line); border-radius: 11px; padding: 14px; background: var(--surface); display: grid; gap: 6px; align-content: start; }
.dish.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.dish label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-weight: 700; }
.dish input[type=checkbox] { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--accent); flex: none; }
.dish .meta { display: flex; justify-content: space-between; gap: 8px; font-size: .85rem; color: var(--muted); }
.dish .servings { display: flex; align-items: center; gap: 8px; font-size: .85rem; }
.dish .servings input { width: 64px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.tag { font-size: .72rem; color: var(--herb); font-weight: 600; }

/* Summary */
.summary { position: sticky; top: 76px; display: grid; gap: 10px; }
@media (max-width: 880px) { .summary { position: static; } }
.summary .line { display: flex; justify-content: space-between; gap: 10px; font-size: .93rem; }
.summary .line span:first-child { min-width: 0; overflow-wrap: anywhere; }
.summary .total { font-size: 1.2rem; font-weight: 700; border-top: 1px solid var(--line); padding-top: 10px; }

/* Grocery list */
.grocery-section h3 { font-family: var(--f-body); font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 14px 0 6px; }
.grocery-item { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.grocery-item input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--herb); flex: none; }
.grocery-item .name { flex: 1; min-width: 0; }
.grocery-item.done .name { text-decoration: line-through; color: var(--muted); }
.grocery-item .qty { font-family: var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress div { height: 100%; background: var(--herb); transition: width .2s; }

/* Status timeline */
.timeline { display: flex; gap: 6px; flex-wrap: wrap; padding: 0; margin: 0; list-style: none; }
.timeline li { flex: 1 1 120px; border-top: 3px solid var(--line); padding-top: 6px; font-size: .82rem; color: var(--muted); font-weight: 600; }
.timeline li.done { border-color: var(--herb); color: var(--ink); }
.timeline li.now { border-color: var(--accent); color: var(--accent); }

/* Lists of bookings */
.blist { display: grid; gap: 10px; }
.bitem { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 14px; align-items: center; text-decoration: none; color: inherit; }
.bitem:hover { border-color: var(--accent); }
.datebox { text-align: center; border-radius: 9px; background: var(--accent-soft); color: var(--accent); padding: 6px 4px; line-height: 1.1; }
.datebox b { display: block; font-size: 1.5rem; font-family: var(--f-display); }
.datebox small { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
@media (max-width: 520px) { .bitem { grid-template-columns: 60px minmax(0, 1fr); } .bitem > :last-child { grid-column: 2; } }

/* Tables (admin) */
.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
td input, td select { width: 100%; min-width: 70px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); }

/* Auth cards */
.auth { max-width: 420px; margin: 6vh auto 0; }
.code-input { font-family: var(--f-mono); font-size: 1.6rem !important; letter-spacing: .4em; text-align: center; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 10px; font-weight: 600; z-index: 50; max-width: calc(100% - 32px); }

.allergy { background: var(--danger-soft); color: var(--danger); border-radius: 10px; padding: 10px 14px; font-weight: 600; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; font-size: .95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

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

/* Small utilities (used instead of inline styles, which the CSP blocks) */
.mt-s { margin-top: 8px; } .mt-m { margin-top: 16px; }
.mb-s { margin-bottom: 6px; } .mb-m { margin-bottom: 16px; }
.gap-s { gap: 10px !important; }
.bare { border: 0; padding: 0; margin: 0; }
.h-page { font-size: 1.8rem; }
.grow { flex: 1; min-width: 0; }
.gap-xs { gap: 6px !important; }

/* ---------- Meal-prep plans ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.plan-card { position: relative; }
.plan-card input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.plan-card > span { display: grid; gap: 2px; border: 1px solid var(--line); border-radius: 11px; padding: 14px; background: var(--surface); height: 100%; }
.plan-card b { font-family: var(--f-display); font-size: 1.15rem; }
.plan-card .price { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: 1.25rem; font-weight: 700; color: var(--accent); }
.plan-card small { color: var(--muted); font-size: .8rem; }
.plan-card input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.plan-card input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.pick-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 4px 0 10px; }
.counter { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: .85rem; font-weight: 700; border-radius: 999px; padding: 3px 10px; background: var(--line); color: var(--muted); white-space: nowrap; }
.counter.ok { background: var(--herb-soft); color: var(--herb); }
.counter.extra { background: var(--accent-soft); color: var(--accent); }
.dish.disabled { opacity: .5; }
.dish.disabled label { cursor: not-allowed; }
.pick-group + .pick-group { margin-top: 22px; }
.menu-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.menu-cols ul { margin: 6px 0 0; padding-left: 18px; }
.deadline { font-weight: 700; }

.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 640px) { .grid3 { grid-template-columns: minmax(0, 1fr); } }
