
/* Dark is the default (Philip). Light is opt-in via the footer switch (data-theme="light"). */
:root {
  color-scheme: dark;
  /* Scotty's palette: shamrock green, beer amber, near-black; autumn rust for the Friendsgiving touch */
  --shamrock-300:#5EDB86; --shamrock-400:#2FC862; --shamrock-500:#0BA33A; --shamrock-600:#098A31; --shamrock-700:#077028; --shamrock-800:#065A21;
  --amber-200:#F8DDA8; --amber-300:#F2C46E; --amber-400:#E8A33A; --amber-600:#A8670E; --amber-700:#8A530B;
  --rust-500:#C2561A; --rust-700:#8C2F14;
  --night-950:#0E0D0B; --night-900:#171512; --night-850:#1D1A16; --night-800:#25221D; --night-700:#36312A; --night-600:#4A443B;
  --stone-50:#F7F3EC; --stone-200:#DED7CB; --stone-400:#ABA295; --stone-600:#5E564C; --stone-900:#1A1714;

  /* roles */
  --bg: var(--night-950);
  --glow-1: rgba(232,163,58,.13);
  --glow-2: rgba(194,86,26,.10);
  --surface: var(--night-900);
  --surface-2: var(--night-800);
  --border: #2B2722;
  --border-strong: var(--night-700);
  --ink: var(--stone-50);
  --ink-2: var(--stone-200);
  --ink-3: var(--stone-400);
  --brand-solid: var(--shamrock-500);
  --brand-solid-hover: var(--shamrock-400);
  --on-brand: var(--night-950);
  --brand-ink: var(--shamrock-300);
  --accent: var(--amber-400);
  --hl-ink: var(--amber-300);
  --hl-soft: #2A1F0F;
  --hl-border: #5C4115;
  --brand-soft: #2A1F0F;
  --brand-soft-border: #5C4115;
  --plate: #FFFFFF;
  --harvest: linear-gradient(90deg, var(--rust-700), var(--rust-500) 30%, var(--amber-400) 60%, var(--shamrock-500));
  --ok-bg: #0D2616; --ok-ink: var(--shamrock-300);
  --warn-bg: #2B200A; --warn-border: #5C3D0B; --warn-ink: #FEC84B;
  --err-bg: #2D1212; --err-border: #6B1F1A; --err-ink: #FDA29B;
  --focus: 0 0 0 4px rgba(11,163,58,.35);

  /* type scale (Untitled UI) */
  --text-xs:12px; --lh-xs:18px; --text-sm:14px; --lh-sm:20px; --text-md:16px; --lh-md:24px;
  --text-lg:18px; --lh-lg:28px; --text-xl:20px; --lh-xl:30px;
  --display-xs:24px; --lh-dxs:32px; --display-sm:30px; --lh-dsm:38px; --display-md:36px; --lh-dmd:44px;
  /* spacing */
  --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px; --sp-5:20px; --sp-6:24px; --sp-8:32px; --sp-10:40px; --sp-12:48px;
  /* radii */
  --r-sm:6px; --r-md:8px; --r-lg:10px; --r-xl:12px; --r-2xl:16px; --r-full:9999px;
  /* shadows (dark: borders carry the edges) */
  --shadow-xs:none; --shadow-sm:none; --shadow-md:0 12px 32px -12px rgba(0,0,0,.6);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #FBF6EC;
  --glow-1: rgba(232,163,58,.16);
  --glow-2: rgba(194,86,26,.08);
  --surface: #FFFFFF;
  --surface-2: #F7F1E6;
  --border: #EAE1D2;
  --border-strong: #D9CDBB;
  --ink: var(--stone-900);
  --ink-2: #3D3730;
  --ink-3: var(--stone-600);
  --brand-solid: var(--shamrock-700);
  --brand-solid-hover: var(--shamrock-800);
  --on-brand: #FFFFFF;
  --brand-ink: var(--shamrock-700);
  --hl-ink: var(--amber-700);
  --hl-soft: #FDF1DC;
  --hl-border: #F2D29A;
  --brand-soft: #FDF1DC;
  --brand-soft-border: #F2D29A;
  --ok-bg: #E9F8EE; --ok-ink: var(--shamrock-700);
  --warn-bg: #FFFAEB; --warn-border: #FEDF89; --warn-ink: #93370D;
  --err-bg: #FEF3F2; --err-border: #FECDCA; --err-ink: #B42318;
  --focus: 0 0 0 4px rgba(7,112,40,.22);
  --shadow-xs:0 1px 2px rgba(16,24,40,.05);
  --shadow-sm:0 1px 3px rgba(16,24,40,.1), 0 1px 2px rgba(16,24,40,.06);
  --shadow-md:0 4px 8px -2px rgba(16,24,40,.1), 0 2px 4px -2px rgba(16,24,40,.06);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: var(--text-md); line-height: var(--lh-md);
  color: var(--ink); background: var(--bg);
  background-image: radial-gradient(900px 420px at 15% -140px, var(--glow-1), transparent 70%), radial-gradient(800px 380px at 95% -100px, var(--glow-2), transparent 70%);
  background-repeat: no-repeat;
  min-height: 100vh;
}
h1, h2, h3 { margin: 0; color: var(--ink); }
h1 { font-size: var(--display-sm); line-height: var(--lh-dsm); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: var(--text-xl); line-height: var(--lh-xl); font-weight: 600; }
p { margin: 0; }
a { color: var(--brand-ink); text-underline-offset: 2px; }
.muted { color: var(--ink-3); }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }

.page { max-width: 640px; margin: 0 auto; padding: var(--sp-6) var(--sp-4) var(--sp-12); display: grid; gap: var(--sp-5); }
.page.wide { max-width: 1120px; }

.brand { display: flex; align-items: center; gap: var(--sp-2); font-weight: 600; font-size: var(--text-sm); color: var(--ink-2); }
.logo { width: 28px; height: 28px; flex: none; }

.hero { display: grid; gap: var(--sp-3); padding: var(--sp-2) 0; }
.hero.compact { padding: 0; justify-items: center; }
.plate { display: inline-flex; background: var(--plate); border-radius: var(--r-2xl); padding: 10px 16px; box-shadow: var(--shadow-md); justify-self: start; }
.plate img { display: block; width: 100%; height: auto; }
.plate-lg { width: min(260px, 70vw); }
.plate-sm { width: 200px; }
.plate-xs { width: 96px; padding: 4px 8px; border-radius: var(--r-md); }
.hero.compact .plate { justify-self: center; }
.eyebrow { font-size: var(--text-sm); line-height: var(--lh-sm); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--hl-ink); margin-top: var(--sp-2); }
.harvest { height: 3px; border-radius: 3px; background: var(--harvest); opacity: .9; margin: var(--sp-1) 0 var(--sp-2); }
.h1-sub { display: block; color: var(--brand-ink); }
.lead { font-size: var(--text-lg); line-height: var(--lh-lg); color: var(--ink-2); }
.facts { list-style: none; margin: var(--sp-2) 0 0; padding: 0; display: grid; gap: var(--sp-2); }
.facts li { display: grid; grid-template-columns: 104px 1fr; gap: var(--sp-3); font-size: var(--text-md); }
.fact-label { color: var(--ink-3); font-size: var(--text-sm); font-weight: 500; padding-top: 2px; }
.card .facts { margin: 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-2xl); box-shadow: var(--shadow-sm); padding: var(--sp-6) var(--sp-5); display: grid; gap: var(--sp-4); }
.card.narrow { max-width: 460px; width: 100%; margin: 0 auto; }
.banner { background: var(--brand-soft); border-color: var(--brand-soft-border); }
.big { font-size: var(--text-xl); line-height: var(--lh-xl); }
.purpose { color: var(--ink-3); font-size: var(--text-sm); line-height: var(--lh-sm); margin-top: calc(-1 * var(--sp-2)); }
.empty { color: var(--ink-3); background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--r-xl); padding: var(--sp-4); font-size: var(--text-sm); }

.rules { margin: 0; padding-left: var(--sp-5); display: grid; gap: var(--sp-2); color: var(--ink-2); }
.help summary { cursor: pointer; color: var(--brand-ink); font-weight: 600; font-size: var(--text-sm); }
.help p { margin-top: var(--sp-2); color: var(--ink-2); font-size: var(--text-sm); line-height: var(--lh-sm); }

.stack { display: grid; gap: var(--sp-4); }
.row-2 { display: grid; gap: var(--sp-4); }
@media (min-width: 560px) { .row-2 { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: 6px; }
label { font-size: var(--text-sm); line-height: var(--lh-sm); font-weight: 500; color: var(--ink-2); }
.optional { color: var(--ink-3); font-weight: 400; }
input, textarea {
  font: inherit; color: var(--ink); background: var(--surface); width: 100%;
  border: 1px solid var(--border-strong); border-radius: var(--r-md); padding: 10px 14px; box-shadow: var(--shadow-xs);
  min-height: 44px;
}
textarea { resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--brand-solid); box-shadow: var(--focus); }
.has-error input, .has-error textarea { border-color: var(--err-ink); }
.hint { font-size: var(--text-sm); line-height: var(--lh-sm); color: var(--ink-3); }
.error { font-size: var(--text-sm); line-height: var(--lh-sm); color: var(--err-ink); }
.dup-hint { font-size: var(--text-sm); color: var(--warn-ink); background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3); margin-top: calc(-1 * var(--sp-2)); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.privacy { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--ink-3); text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font: inherit; font-weight: 600; font-size: var(--text-sm); line-height: var(--lh-sm);
  padding: 10px 16px; min-height: 44px; border-radius: var(--r-md); border: 1px solid transparent;
  text-decoration: none; cursor: pointer; box-shadow: var(--shadow-xs);
}
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .6; cursor: not-allowed; }
.btn-lg { font-size: var(--text-md); line-height: var(--lh-md); padding: 12px 20px; min-height: 48px; }
.btn-sm { min-height: 36px; padding: 8px 12px; }
.btn-primary { background: var(--brand-solid); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-solid-hover); }
.btn-secondary { background: var(--surface); color: var(--ink-2); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--ink-2); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--surface); color: var(--err-ink); border-color: var(--err-border); }
.btn-danger:hover { background: var(--err-bg); }
.actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.cal-link { text-align: center; }

.alert { border-radius: var(--r-lg); padding: var(--sp-3) var(--sp-4); font-size: var(--text-sm); line-height: var(--lh-sm); border: 1px solid; }
.alert-error { background: var(--err-bg); border-color: var(--err-border); color: var(--err-ink); }
.alert-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-ink); }
.alert-ok { background: var(--ok-bg); border-color: transparent; color: var(--ok-ink); }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: var(--r-full); font-size: var(--text-sm); font-weight: 600; background: var(--hl-soft); color: var(--hl-ink); border: 1px solid var(--hl-border); white-space: nowrap; }
.dessert-list { list-style: none; margin: 0; padding: 0; display: grid; border-top: 1px solid var(--border); counter-reset: d; }
.dessert-list li { counter-increment: d; display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); }
.dessert-list .dessert::before { content: counter(d) ". "; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.dessert-list .dessert { font-weight: 500; }
.dessert-list .who { color: var(--ink-3); font-size: var(--text-sm); white-space: nowrap; }

.confirm { text-align: center; justify-items: center; }
.confirm h1 { font-size: var(--display-xs); line-height: var(--lh-dxs); }
.confirm .actions { justify-content: center; }
.check { width: 48px; height: 48px; border-radius: var(--r-full); display: grid; place-items: center; background: var(--ok-bg); color: var(--ok-ink); font-size: 24px; font-weight: 700; }

.foot { text-align: center; color: var(--ink-3); font-size: var(--text-xs); line-height: var(--lh-xs); display: grid; gap: var(--sp-2); justify-items: center; }
.theme-toggle { font: inherit; font-size: var(--text-xs); color: var(--ink-3); background: transparent; border: 1px solid var(--border-strong); border-radius: var(--r-full); padding: 4px 12px; cursor: pointer; min-height: 32px; }
.theme-toggle:hover { color: var(--ink); }
.org-brand { display: flex; align-items: center; gap: var(--sp-3); font-weight: 600; font-size: var(--text-sm); color: var(--ink-2); }

/* organizer */
.org-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); background: var(--surface); border-bottom: 1px solid var(--border); }
.org-bar form { margin: 0; }
.page-head { display: grid; gap: var(--sp-3); }
.page-head .purpose { margin-top: 0; }
.stats { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-xs); padding: var(--sp-5); display: grid; gap: var(--sp-1); }
.stat-label { font-size: var(--text-sm); color: var(--ink-3); font-weight: 500; }
.stat-value { font-size: var(--display-sm); line-height: var(--lh-dsm); font-weight: 700; }
.stat-value.is-open { color: var(--ok-ink); }
.stat-value.is-closed { color: var(--hl-ink); }
.stat-value.is-count { color: var(--hl-ink); }
.big strong { color: var(--hl-ink); }
.stat-sub { font-size: var(--text-sm); color: var(--ink-3); }
.settings { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.settings form { margin: 0; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); line-height: var(--lh-sm); }
.table th { text-align: left; font-weight: 500; color: var(--ink-3); background: var(--surface-2); padding: var(--sp-3); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: var(--sp-3); border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.row-actions { display: flex; gap: var(--sp-2); justify-content: flex-end; }
.row-actions form { margin: 0; }
@media (max-width: 760px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border: 1px solid var(--border); border-radius: var(--r-xl); padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-3); }
  .table td { border: 0; padding: var(--sp-1) 0; display: grid; grid-template-columns: 72px 1fr; gap: var(--sp-2); }
  .table td::before { content: attr(data-label); color: var(--ink-3); font-weight: 500; }
  .table td.row-cell { display: block; padding-top: var(--sp-2); }
  .table td.row-cell::before { content: none; }
  .row-actions { justify-content: flex-start; }
}
@media (min-width: 640px) {
  .page { padding-top: var(--sp-10); }
  h1 { font-size: var(--display-md); line-height: var(--lh-dmd); }
  .card { padding: var(--sp-8); }
}
