:root {
  color-scheme: light;
  --paper: #fbf6ed;
  --paper-2: #f1e6d7;
  --card: rgba(255, 252, 246, 0.88);
  --ink: #231d16;
  --muted: #6f6254;
  --soft: #958677;
  --line: rgba(76, 55, 35, 0.16);
  --leaf: #54724a;
  --clay: #bd643d;
  --sun: #f1b84a;
  --sky: #7ba7b8;
  --danger: #b94c3d;
  --shadow: 0 18px 48px rgba(72, 49, 24, 0.12), 0 2px 8px rgba(72, 49, 24, 0.06);
  --radius-xl: 30px;
  --radius: 20px;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; }
body {
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 6%, rgba(241, 184, 74, .28), transparent 24rem),
    radial-gradient(circle at 88% 10%, rgba(123, 167, 184, .22), transparent 25rem),
    linear-gradient(135deg, rgba(255,255,255,.5), transparent 42%),
    var(--paper);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  background-image:
    linear-gradient(90deg, rgba(35,29,22,.06) 1px, transparent 1px),
    linear-gradient(rgba(35,29,22,.05) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

a { color: inherit; }
button, input, select, textarea { font: inherit; max-width: 100%; }
button { cursor: pointer; }
.shell { width: min(1120px, calc(100vw - 32px)); max-width: calc(100vw - 32px); margin: 0 auto; padding: 26px 0 64px; position: relative; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: clamp(28px, 5vw, 52px); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 900; letter-spacing: -.02em; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 15px; background: linear-gradient(135deg, var(--leaf), #304934); box-shadow: 0 10px 24px rgba(49, 79, 53, .16); }
.navlinks { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: .96rem; }
.navlinks a { text-decoration: none; border-bottom: 1px solid transparent; }
.navlinks a:hover { color: var(--ink); border-color: var(--clay); }

.hero, .workspace-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 320px); gap: clamp(18px, 4vw, 38px); align-items: end; margin-bottom: 26px; }
.hero.compact { align-items: center; }
.eyebrow { margin: 0 0 12px; color: #7d402c; text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; font-weight: 900; }
h1, h2, h3 { color: var(--ink); font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif; letter-spacing: -.04em; }
h1 { margin: 0; font-size: clamp(2.5rem, 8vw, 5.6rem); line-height: .92; }
h2 { margin: 0; font-size: clamp(1.85rem, 4vw, 3rem); line-height: 1; }
h3 { margin: 0; font-size: 1.2rem; }
.lede { max-width: 740px; margin: 18px 0 0; color: var(--muted); line-height: 1.55; font-size: clamp(1rem, 2vw, 1.2rem); }
.muted { color: var(--muted); line-height: 1.45; }

.status-card, .panel, .dinner-card, .workspace-card, .list-row, .empty-state {
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}
.status-card { display: flex; align-items: center; gap: 10px; padding: 16px 18px; color: var(--muted); font-weight: 800; }
.status-dot { width: 10px; height: 10px; border-radius: 999px; background: var(--soft); flex: 0 0 auto; }
.status-dot.loading { background: var(--sun); box-shadow: 0 0 0 4px rgba(241, 184, 74, .18); }
.status-dot.ok { background: var(--leaf); box-shadow: 0 0 0 4px rgba(84, 114, 74, .16); }
.status-dot.error { background: var(--danger); box-shadow: 0 0 0 4px rgba(185, 76, 61, .14); }

.section { margin-top: 34px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 16px; }
.panel { padding: clamp(18px, 3vw, 26px); }
.form-panel { display: grid; grid-template-columns: minmax(0, .85fr) minmax(300px, 1.15fr); gap: 22px; align-items: end; }
.new-dinner-form { display: grid; grid-template-columns: minmax(0, 1fr) 170px auto; gap: 12px; align-items: end; }
label { display: grid; gap: 7px; color: var(--muted); font-weight: 850; min-width: 0; max-width: 100%; }
input, select, textarea {
  width: 100%; min-width: 0; border: 1px solid rgba(76, 55, 35, .18); border-radius: 16px;
  background: rgba(255, 255, 255, .82); color: var(--ink); padding: 12px 14px;
}
textarea { min-height: 90px; resize: vertical; }
.button {
  min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid rgba(76, 55, 35, .18); border-radius: 16px; background: rgba(255,255,255,.72);
  color: var(--ink); font-weight: 900; text-decoration: none; padding: 11px 16px;
}
.button.primary { border-color: rgba(84, 114, 74, .34); background: linear-gradient(135deg, var(--leaf), #38573c); color: #fffdf8; }
.button.danger { border-color: rgba(185, 76, 61, .24); color: var(--danger); }
.button.small { min-height: 36px; border-radius: 12px; padding: 7px 11px; font-size: .9rem; }

.dinner-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dinner-card { display: grid; gap: 14px; min-width: 0; padding: 22px; text-decoration: none; transition: transform .16s ease, box-shadow .16s ease; }
.dinner-card:hover { transform: translateY(-2px); box-shadow: 0 22px 55px rgba(72,49,24,.16); }
.card-top { display: flex; justify-content: space-between; gap: 12px; align-items: start; min-width: 0; }
.card-title { min-width: 0; }
.card-title h3 { overflow-wrap: anywhere; }
.badge, .chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 10px; font-size: .82rem; font-weight: 900; white-space: nowrap; }
.badge { background: rgba(241,184,74,.22); color: #7a4d15; }
.badge.archived, .muted-grid .badge { background: rgba(111, 98, 84, .12); color: var(--muted); }
.chip { background: rgba(255,255,255,.74); border: 1px solid rgba(76,55,35,.12); color: var(--muted); }
.card-meta, .metric-row { display: flex; gap: 8px; flex-wrap: wrap; }
.metric-row { margin-top: 12px; }
.empty-state { padding: 22px; color: var(--muted); box-shadow: none; }

.tabs { position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 8px; margin: 8px 0 18px; border: 1px solid var(--line); border-radius: 22px; background: rgba(251, 246, 237, .92); backdrop-filter: blur(14px); }
.tab { min-width: 0; min-height: 44px; border: 0; border-radius: 16px; background: transparent; color: var(--muted); font-weight: 900; }
.tab.is-active { color: #fffdf8; background: linear-gradient(135deg, var(--clay), #9c4d31); }
.workspace-content { min-width: 0; max-width: 100%; overflow: hidden; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .65fr); gap: 16px; align-items: start; min-width: 0; }
.workspace-card { min-width: 0; max-width: 100%; padding: 20px; overflow: hidden; }
.card-stack { display: grid; gap: 14px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.inline-form { display: grid; grid-template-columns: minmax(0, 1fr) 130px 150px auto; gap: 10px; align-items: end; margin-top: 14px; }
.note-list, .task-list, .shopping-groups, .menu-list { display: grid; gap: 10px; margin-top: 14px; }
.list-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px; box-shadow: none; }
.list-row input[type="checkbox"] { width: 22px; height: 22px; min-width: 22px; accent-color: var(--leaf); }
.row-main { min-width: 0; }
.row-main strong { display: block; overflow-wrap: anywhere; }
.row-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; color: var(--muted); font-size: .9rem; }
.row-meta .counts { color: var(--clay); font-weight: 800; }

.menu-card { border: 1px solid var(--line); background: var(--card); box-shadow: none; border-radius: var(--radius); min-width: 0; overflow: hidden; }
.menu-card.is-expanded { border-color: rgba(84, 114, 74, .25); }
.menu-summary { width: 100%; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; display: grid; gap: 4px; min-width: 0; cursor: pointer; padding: 14px; }
.menu-summary:focus { outline: 2px solid var(--leaf); outline-offset: -4px; border-radius: var(--radius); }
.menu-summary.is-static { cursor: default; }
.menu-title { display: block; font-weight: 900; overflow-wrap: anywhere; }
.menu-body { border-top: 1px solid var(--line); padding: 14px; display: grid; gap: 12px; }
.recipe-card { border: 1px solid rgba(76,55,35,.12); border-radius: 16px; background: rgba(255,255,255,.42); overflow: hidden; }
.recipe-card h4 { margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: .92rem; text-transform: uppercase; letter-spacing: .08em; color: var(--soft); font-family: inherit; }
.recipe-card .task-body { border-top: 0; }
.recipe-source { margin: 12px 0 0; font-weight: 800; }
.recipe-source a { color: var(--clay); }

.task-card { border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); border-radius: var(--radius); min-width: 0; overflow: hidden; }
.task-card.is-rich { border-color: rgba(84, 114, 74, .25); }
.task-header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px; min-width: 0; }
.task-header input[type="checkbox"] { width: 24px; height: 24px; min-width: 24px; accent-color: var(--leaf); }
.task-summary { width: 100%; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; display: grid; gap: 4px; min-width: 0; cursor: pointer; padding: 4px 0; }
.task-summary:focus { outline: 2px solid var(--leaf); outline-offset: 2px; border-radius: 8px; }
.task-summary.is-static { cursor: default; }
.task-title { font-weight: 800; min-width: 0; overflow-wrap: anywhere; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; overflow-wrap: anywhere; color: var(--muted); font-size: .9rem; }
.task-meta .counts { color: var(--clay); font-weight: 800; }
.next-up { display: inline-flex; align-items: center; gap: 6px; background: rgba(241,184,74,.22); color: #7a4d15; border-radius: 999px; padding: 5px 10px; font-size: .82rem; font-weight: 900; white-space: nowrap; }
.task-body { border-top: 1px solid var(--line); padding: 16px; min-width: 0; }
.task-summary-text { margin: 0 0 12px; color: var(--muted); line-height: 1.45; }
.task-section { margin-top: 14px; }
.task-section:first-child { margin-top: 0; }
.task-section h4 { margin: 0 0 8px; font-size: .9rem; text-transform: uppercase; letter-spacing: .1em; color: var(--soft); font-family: inherit; }
.amount-list, .equipment-list, .note-list.compact, .step-list { margin: 0; padding-left: 0; list-style: none; }
.amount-list li, .equipment-list li, .note-list.compact li { padding: 6px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.amount-list li:last-child, .equipment-list li:last-child, .note-list.compact li:last-child { border-bottom: none; }
.amount { display: inline-block; min-width: 4.5em; color: var(--ink); font-weight: 800; margin-right: 6px; }
.amount-note { color: var(--muted); font-size: .9rem; }
.step-list { counter-reset: step; }
.step-list li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.step-list li:last-child { border-bottom: none; }
.step-num { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 999px; background: rgba(84,114,74,.12); color: var(--leaf); font-weight: 900; font-size: .85rem; flex: 0 0 auto; }
.step-body { min-width: 0; }
.step-body p { margin: 0 0 6px; overflow-wrap: anywhere; }
.step-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.step-chip { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 9px; background: rgba(123,167,184,.14); color: #3d6270; font-size: .82rem; font-weight: 800; }
.step-note { margin: 6px 0 0; color: var(--muted); font-size: .9rem; }
.group-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 18px 0 8px; }
.progress-bar { height: 12px; border-radius: 999px; background: rgba(76,55,35,.1); overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--leaf), var(--sky)); transition: width .2s ease; }
.hidden { display: none !important; }
.error-text { color: var(--danger); font-weight: 800; }

@media (max-width: 860px) {
  .topbar, .section-head { align-items: flex-start; flex-direction: column; }
  .hero, .workspace-hero, .form-panel, .workspace-grid { grid-template-columns: 1fr; }
  .new-dinner-form, .inline-form, .field-grid { grid-template-columns: 1fr; }
  .dinner-grid { grid-template-columns: 1fr; }
  h1 { font-size: clamp(2.4rem, 12vw, 4.8rem); }
}

@media (max-width: 520px) {
  .shell { width: calc(100vw - 32px); max-width: calc(100vw - 32px); padding-top: 18px; }
  .tabs { gap: 4px; padding: 5px; border-radius: 18px; }
  .tab { min-height: 42px; border-radius: 13px; font-size: .92rem; }
  .workspace-card, .panel, .dinner-card { padding: 16px; }
  .recipe-card h4 { font-size: 1rem; letter-spacing: .04em; }
  .field-grid, .inline-form, .new-dinner-form { width: 100%; max-width: 100%; overflow: hidden; }
  .list-row { grid-template-columns: auto minmax(0, 1fr); }
  .list-row .row-actions { grid-column: 2; justify-self: start; }
}
