:root {
  --bg: #f6f7f9; --panel: #fff; --text: #1d2330; --muted: #667085; --line: #e4e7ec;
  --accent: #00875a; --accent-ink: #fff; --danger: #c4320a; --warn-bg: #fff6e5; --chip: #eef1f5;
  --ok-bg: #e6f4ee; --radius: 8px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #12151b; --panel: #1b2029; --text: #e6e9ef; --muted: #98a2b3; --line: #2c3340;
    --accent: #2fb37f; --accent-ink: #0b1a13; --danger: #ff7a59; --warn-bg: #3a2c12; --chip: #262d39; --ok-bg: #143327; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.brand { font-weight: 700; color: var(--text); }
.topbar nav { display: flex; gap: 16px; align-items: center; color: var(--muted); }
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; padding: 7px 9px; min-width: 0; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 6px;
  padding: 7px 12px; cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.danger { color: var(--danger); border-color: var(--danger); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
button:disabled { opacity: .5; cursor: progress; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--chip); font-size: 12px; }
.chip.active { background: var(--ok-bg); color: var(--accent); font-weight: 600; }
.serving { font-weight: 600; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-top: 16px; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 16px; }
.card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; color: var(--text); }
.card:hover { border-color: var(--accent); }
.login { max-width: 360px; margin: 10vh auto; }
.login form { display: grid; gap: 12px; }
.bar { height: 8px; background: var(--accent); border-radius: 4px; min-width: 2px; }
.notice { background: var(--warn-bg); border-radius: 6px; padding: 10px 12px; margin-top: 12px; }
#toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 8px 14px; border-radius: 6px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; }
#toast.error { background: var(--danger); color: #fff; }
@media (max-width: 640px) { .topbar { padding: 12px 16px; } }
