:root {
  color-scheme: light;
  --paper: #f6f4ec; --surface: #fffcf5; --ink: #222b20;
  --muted: #52594e; --line: #d8d9cb; --green: #405536;
  --tint: #e7eddf; --danger: #8d3028;
  font: 16px/1.5 'Segoe UI', sans-serif;
  color: var(--ink); background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p { margin: 0; }
h1, article h2 { font-family: Georgia, serif; line-height: 1.12; }
h1 { font-size: clamp(2.15rem, 7vw, 3.4rem); letter-spacing: -.038em; }
h2 { font-size: 1.35rem; }
button, input, textarea { font: inherit; }
button { min-height: 44px; border-radius: 8px; padding: .48rem .76rem; cursor: pointer; font-weight: 650; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.primary { background: var(--green); color: #fff; border: 1px solid var(--green); }
.primary:hover { background: #30422a; }
.secondary { background: transparent; color: var(--green); border: 1px solid var(--line); }
.secondary:hover { background: var(--tint); }
.shell { max-width: 820px; margin-inline: auto; padding-inline: 16px; }
.masthead { border-bottom: 1px solid var(--line); }
.masthead-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 10px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 750; letter-spacing: -.02em; }
.preview, .badge { display: inline-block; border-radius: .35rem; padding: .16rem .55rem; background: var(--tint); color: #35472d; font-size: .82rem; font-weight: 700; }
main.shell { padding-block: 26px 50px; }
.intro { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 14px; }
.intro h1 + p { margin-top: 8px; }
.hint, .meta { color: var(--muted); }
nav { display: flex; gap: 13px; margin-top: 20px; border-bottom: 1px solid var(--line); }
nav button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); }
nav button[aria-pressed=true] { color: var(--green); border-bottom-color: var(--green); }
.status { font-size: .88rem; color: var(--green); min-height: 1.65rem; margin-top: 6px; overflow-wrap: anywhere; }
#meal-list { display: grid; gap: 12px; }
article, .empty { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
article { display: grid; gap: 13px; }
article h2, article p, #use-hint { overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 10px; margin-top: 8px; font-size: .88rem; }
.note { margin-top: 8px; white-space: pre-wrap; }
.card-actions, .dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.empty h2 { margin-bottom: 4px; }
.error { color: var(--danger); }
#storage-error { margin-top: 16px; }
dialog { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: 20px; width: min(470px, calc(100% - 24px)); max-height: calc(100% - 24px); }
dialog::backdrop { background: #20271c80; }
form { display: grid; gap: 13px; }
label { font-weight: 650; min-width: 0; }
label .hint { font-weight: 400; }
input, textarea { display: block; width: 100%; min-width: 0; min-height: 44px; margin-top: 4px; border: 1px solid #a1a696; border-radius: 6px; padding: 8px; color: var(--ink); background: #fff; }
textarea { resize: vertical; }
.fields { display: grid; gap: 12px; }
.dialog-actions { justify-content: center; }
#account-actions, #sign-in, #export-preview, #key-form, #key-reveal, #key-list { margin-top: 16px; }
#sign-in button { margin-inline: auto; }
#key-form select { display: block; font: inherit; min-height: 44px; width: 100%; border-radius: 6px; padding: 6px; background: white; border: 1px solid #a1a696; }
#key-reveal button { margin-block: 8px; }
#key-list { padding: 0; list-style: none; }
#key-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-block: 5px; overflow-wrap: anywhere; }
@media (min-width: 440px) { .fields { grid-template-columns: 1fr 1fr; } }
@media (min-width: 650px) {
  .shell { padding-inline: 24px; }
  main.shell { padding-top: 44px; }
  article { grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 19px; }
}
