:root {
  color-scheme: light dark;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f0f1f4;
  --border: #e1e4ea;
  --text: #1c1f26;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-soft: #dbe7ff;
  --kcal: #ea7a2c;
  --protein: #2563eb;
  --carbs: #b7791f;
  --fat: #c05621;
  --fiber: #2f855a;
  --good: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1f232c;
    --border: #2a2f3a;
    --text: #e6e8ee;
    --muted: #9aa3b2;
    --accent: #6d9cff;
    --accent-soft: #1e2a44;
    --kcal: #f59e5b;
    --protein: #6d9cff;
    --carbs: #d6a341;
    --fat: #e07a4a;
    --fiber: #4ade80;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }

.top {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; font-size: 17px; letter-spacing: .2px; margin-right: 8px; }
.daynav { display: flex; align-items: center; gap: 6px; }
.quick { display: flex; gap: 6px; margin-left: auto; }
#profileSel { font-weight: 600; }
.quick input { width: 200px; }
.pill { background: var(--accent-soft); color: var(--accent); padding: 3px 10px; border-radius: 999px; font-weight: 600; font-size: 12px; white-space: nowrap; }
.pill.neutral { background: var(--surface-2); color: var(--muted); }
.pill.over { background: #fee2e2; color: #991b1b; }
@media (prefers-color-scheme: dark) { .pill.over { background: #3b0f0f; color: #fca5a5; } }

.tabs { display: flex; gap: 2px; padding: 8px 20px 0; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs button {
  background: none; border: none; border-bottom: 2px solid transparent; padding: 8px 12px; cursor: pointer; color: var(--muted); font-weight: 600; white-space: nowrap;
}
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs button:hover { color: var(--text); }

main { padding: 18px 24px 60px; max-width: 1640px; margin: 0 auto; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.tiles { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.grid.main { grid-template-columns: minmax(0, 3fr) minmax(360px, 2fr); }
.stack > * + * { margin-top: 14px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; min-width: 0; }
.card h2 { margin: 0 0 10px; font-size: 14px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.card h2 .spacer { flex: 1; }
.card h3 { margin: 12px 0 6px; font-size: 14px; }

.tile .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.tile.flip { cursor: pointer; user-select: none; }
.tile.flip:hover { border-color: var(--accent); }
.tile.flip .label::after { content: '⇄'; float: right; opacity: .35; font-size: 11px; }
.tile .value.remaining small { display: block; font-size: 12px; margin-top: 2px; }
.tile .value { font-size: 30px; font-weight: 700; line-height: 1.15; margin-top: 4px; }
.tile .value sup { font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 1px; cursor: help; }
.tile .value small { font-size: 13px; color: var(--muted); font-weight: 500; }
.tile .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-top: 8px; position: relative; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.bar > b { position: absolute; top: -2px; width: 2px; height: 10px; background: var(--muted); }
.kcal .bar > i { background: var(--kcal); }
.protein .bar > i { background: var(--protein); }
.over .bar > i { background: var(--bad); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
.tablewrap { overflow-x: auto; }

.meal { padding: 10px 0; border-bottom: 1px solid var(--border); }
.meal:last-child { border-bottom: none; }
.meal .head { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.meal .slot { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding-top: 3px; }
.meal .name { font-weight: 600; font-size: 15px; }
.meal .macros { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; margin-top: 2px; }
.meal .items { margin: 6px 0 0 86px; color: var(--muted); font-size: 12.5px; line-height: 1.4; opacity: .9; }
.meal .items div::before { content: "· "; }
.meal .note { margin: 4px 0 0 86px; color: var(--muted); font-size: 12px; font-style: italic; }
.meal .actions { display: flex; gap: 4px; white-space: nowrap; }

.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.badge.planned { background: #fef3c7; color: #92400e; }
.badge.keeper { background: #dcfce7; color: #166534; }
.badge.dislike { background: #fee2e2; color: #991b1b; }
.badge.rating, .badge.liked { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: #fef3c7; color: #92400e; }
@media (prefers-color-scheme: dark) {
  .badge.planned, .badge.warn { background: #3b2f0b; color: #fcd34d; }
  .badge.keeper { background: #0f2e1a; color: #86efac; }
  .badge.dislike { background: #3b0f0f; color: #fca5a5; }
}

button { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
button:hover { background: var(--surface-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.ghost { background: transparent; }
button.small { padding: 3px 8px; font-size: 12px; }
button.danger { color: var(--bad); }
button.icon { padding: 4px 10px; font-size: 16px; line-height: 1; }
button.link { border: none; background: none; color: var(--accent); padding: 0; }

input, select, textarea { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=number] { width: 90px; }
input.wide { width: 100%; }
textarea { width: 100%; min-height: 56px; resize: vertical; }
form.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
form.inline label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
form.inline label > * { font-size: 14px; color: var(--text); }
form.inline .full { flex-basis: 100%; }
.item-row { display: grid; grid-template-columns: minmax(160px, 2fr) 70px 80px repeat(5, 72px) 34px; gap: 6px; margin-bottom: 6px; align-items: center; }
.item-row input { width: 100%; }
.item-head { display: grid; grid-template-columns: minmax(160px, 2fr) 70px 80px repeat(5, 72px) 34px; gap: 6px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
.items-wrap { overflow-x: auto; }
.hint { color: var(--muted); font-size: 12px; }
details > summary { cursor: pointer; font-weight: 600; color: var(--accent); list-style: none; }
details > summary::before { content: "+ "; }
details[open] > summary::before { content: "− "; }
details.form-block { margin-top: 10px; }
details.form-block > form { margin-top: 10px; }

.chart { width: 100%; height: auto; display: block; }
.chart text { font-size: 11px; fill: var(--muted); }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart .ma { fill: none; stroke: var(--kcal); stroke-width: 2; stroke-dasharray: 4 3; }
.chart .gap { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 4; }
.chart .dot { fill: var(--accent); }
.chart .bar-kcal { fill: var(--kcal); opacity: .85; }
.chart .bar-protein { fill: var(--protein); opacity: .85; }
.chart .bar-recorded { opacity: .45; }
.chart .goal { stroke: var(--text); stroke-width: 1; stroke-dasharray: 5 4; opacity: .6; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 3px; vertical-align: middle; margin-right: 4px; }

.recipe { padding: 12px 0; border-bottom: 1px solid var(--border); }
.recipe:last-child { border-bottom: none; }
.recipe .head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.recipe .head .name { font-weight: 700; font-size: 15px; flex: 1; }
.recipe .facts { color: var(--muted); font-size: 13px; margin-top: 2px; }
.recipe .ingredients { columns: 2; column-gap: 24px; margin: 6px 0; font-size: 13px; color: var(--muted); }
.recipe .ingredients div { break-inside: avoid; }
.recipe .ingredients div::before { content: "· "; }
.recipe .note { font-size: 13px; margin: 6px 0; }
.recipe .calc { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: 13px; }
.recipe .calc input { width: 80px; }

.event { display: grid; grid-template-columns: 150px 70px 110px 1fr; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.event:last-child { border-bottom: none; }
.event .ts { color: var(--muted); font-variant-numeric: tabular-nums; }
.pref-list > div { padding: 6px 0; border-bottom: 1px solid var(--border); }
.pref-list > div:last-child { border-bottom: none; }
.pref-list .row { gap: 8px; align-items: center; }
.pref-list .item { font-weight: 600; }
.pref-list .note { color: var(--muted); font-size: 13px; margin-top: 2px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 12px 0; }
.right { text-align: right; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type=search] { width: 260px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 10px; box-shadow: var(--shadow); z-index: 20; max-width: 90vw; }
.toast.error { background: var(--bad); color: #fff; }

@media (max-width: 720px) {
  .top { padding: 10px 12px; }
  .quick { margin-left: 0; width: 100%; }
  .quick input { flex: 1; }
  main { padding: 12px; }
  .meal .items, .meal .note { margin-left: 0; }
  .meal .head { grid-template-columns: 1fr auto; }
  .meal .slot { grid-column: 1 / -1; padding-top: 0; }
  .grid.main { grid-template-columns: 1fr; }
  .recipe .ingredients { columns: 1; }
  .event { grid-template-columns: 1fr; gap: 2px; }
  .grid.two { grid-template-columns: 1fr; }
}

/* ---------- chat ---------- */
.chat { max-width: 820px; margin: 0 auto; }
.chat-top { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.chat-top .spacer { flex: 1; }
.chat-top select { max-width: 60vw; }
.chat-log { display: flex; flex-direction: column; gap: 8px; min-height: 40vh; padding-bottom: 8px; }
.chat-empty { color: var(--muted); padding: 24px 8px; text-align: center; }
.chat-msg { display: flex; flex-direction: column; max-width: 88%; }
.chat-msg.user { align-self: flex-end; align-items: flex-end; }
.chat-msg.assistant { align-self: flex-start; }
.bubble { padding: 9px 13px; border-radius: 16px; line-height: 1.45; overflow-wrap: anywhere; }
.chat-msg.user .bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 5px; }
.chat-msg.assistant .bubble { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.bubble ul { margin: 4px 0 4px 18px; padding: 0; }
.bubble code { font-size: 13px; background: var(--surface-2); padding: 0 4px; border-radius: 4px; }
.chat-msg.user .bubble code { background: rgba(255,255,255,.2); }
.chat-msg.user img { max-width: 200px; max-height: 200px; border-radius: 12px; margin-bottom: 4px; border: 1px solid var(--border); }
.typing { color: var(--muted); letter-spacing: 2px; }
.chat-card { align-self: flex-start; display: flex; gap: 10px; align-items: center; font-size: 13px; padding: 6px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--text); border: 1px solid transparent; max-width: 88%; }
.chat-card.muted { background: transparent; border-color: var(--border); color: var(--muted); }
.chat-card.err { background: #fee2e2; color: #991b1b; }
@media (prefers-color-scheme: dark) { .chat-card.err { background: #3b0f0f; color: #fca5a5; } }
.chat-cost { align-self: flex-start; color: var(--muted); font-size: 11px; margin: -4px 0 0 4px; }
.chat-composer { position: sticky; bottom: 0; background: var(--bg); padding: 8px 0 4px; }
.chat-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-row textarea { flex: 1; resize: none; border: 1px solid var(--border); border-radius: 14px; padding: 9px 13px; background: var(--surface); min-height: 40px; max-height: 160px; }
.chat-attach { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; font-size: 18px; }
.chat-attach:hover { background: var(--surface-2); }
.chat-thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.chat-thumb { position: relative; display: inline-block; }
.chat-thumb img { height: 64px; border-radius: 8px; border: 1px solid var(--border); display: block; }
.chat-thumb .x { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; padding: 0; border-radius: 50%; font-size: 11px; line-height: 18px; }
@media (max-width: 720px) {
  .chat-msg { max-width: 94%; }
  .chat-top select { max-width: 50vw; }
}
.meal .slot .time { text-transform: none; letter-spacing: 0; font-size: 11px; color: var(--muted); opacity: .9; }

/* ---------- phone layout ---------- */
.install-hint { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); z-index: 15; font-size: 13px; display: flex; gap: 8px; align-items: center; }
@media (max-width: 720px) {
  .top { padding: 8px 12px calc(8px) 12px; gap: 8px; padding-top: calc(8px + env(safe-area-inset-top)); }
  .brand { flex: 1; margin-right: 0; }
  #profileSel { order: 2; }
  .daynav { order: 3; width: 100%; }
  .daynav input[type=date] { flex: 1; min-width: 0; }
  .daynav .pill { display: none; }
  .quick { order: 4; width: 100%; margin-left: 0; }
  .quick input { flex: 1; width: auto; }
  .tabs { padding: 2px 6px 0; }
  .tabs button { padding: 8px 10px; }
  main { padding: 10px 10px calc(80px + env(safe-area-inset-bottom)); }
  .grid.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .grid.main, .grid.two { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 12px; }
  .tile .value { font-size: 24px; }
  .chat-composer { padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  .chat-top select { max-width: 46vw; }
}
.install-hint > span { flex: 1; }
.install-hint[hidden] { display: none; }
/* Flex children default to min-width:auto, which lets a textarea or date field push the page wider than an iPhone screen. */
.top > *, .daynav > *, .quick > *, .chat-row > *, .chat-top > * { min-width: 0; }
.chat-row textarea { width: 100%; }
@media (max-width: 720px) {
  html, body { overflow-x: hidden; max-width: 100vw; }
  .daynav input[type=date] { width: 100%; }
  #profileSel { max-width: 38vw; }
  .chat-msg { max-width: 92%; }
}

/* Settings lives behind the gear; the 8 tabs fit one row on desktop and two rows of four on phones. */
button.gear { font-size: 18px; padding: 4px 9px; color: var(--muted); }
button.gear.active { color: var(--accent); border-color: var(--accent); }
@media (max-width: 720px) {
  #profileSel { order: 1; max-width: 32vw; }
  #settingsBtn { order: 2; }
  .tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; padding: 0 6px; overflow: visible; }
  .tabs button { padding: 9px 4px; text-align: center; font-size: 14px; }
}

/* ---------- column charts (HTML, so text never distorts on phones) ---------- */
.bars { --bar: var(--kcal); }
.bars.protein { --bar: var(--protein); }
@media (prefers-color-scheme: dark) { .bars.kcal { --bar: #d47827; } .bars.protein { --bar: #4f80e6; } }
.bars .plot { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: end; height: 170px; margin: 26px 8px 22px 42px; border-bottom: 1px solid var(--border); }
.bars .tick { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--border); pointer-events: none; }
.bars .tick span { position: absolute; left: -42px; top: -7px; width: 36px; text-align: right; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bars .band { position: absolute; left: 0; right: 0; background: color-mix(in srgb, var(--bar) 14%, transparent); border-top: 1px solid color-mix(in srgb, var(--bar) 45%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--bar) 45%, transparent); pointer-events: none; }
.bars .band .edge, .bars .goal span { position: absolute; right: 2px; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bars .band .edge.hi { top: -13px; }
.bars .band .edge.lo { bottom: -13px; }
.bars .goal { position: absolute; left: 0; right: 0; border-top: 1px solid color-mix(in srgb, var(--bar) 60%, transparent); pointer-events: none; }
.bars .goal span { top: -13px; }
.bars .col { position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bars .bar { position: relative; width: 58%; max-width: 24px; min-width: 4px; background: var(--bar); border-radius: 4px 4px 0 0; }
.bars .bar.today { opacity: .55; }
.bars .bar.recorded { opacity: .45; }
.bars .bar.over::after { content: '▲'; position: absolute; top: -13px; left: 50%; transform: translateX(-50%); font-size: 8px; line-height: 1; color: var(--bad); }
.bars .col:hover .bar { filter: brightness(1.15); }
.bars .val { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 3px; white-space: nowrap; font-size: 11px; font-weight: 600; color: var(--text); }
.bars .val small { font-weight: 500; color: var(--muted); font-size: 10px; }
.bars .bar.over .val { margin-bottom: 12px; }
.bars .x { position: absolute; top: 100%; left: 0; right: 0; margin-top: 5px; text-align: center; font-size: 10px; color: var(--muted); }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; background: var(--kcal); }
.legend .sw.protein { background: var(--protein); }
.legend .sw.band { opacity: .3; }
.legend .sw.recorded { opacity: .45; }
.legend .sw.over { background: none; width: auto; height: auto; }
.legend .sw.over::before { content: '▲'; color: var(--bad); font-size: 9px; }
@media (max-width: 720px) { .bars .plot { height: 140px; margin: 24px 4px 20px 36px; } .bars .tick span { left: -36px; width: 31px; font-size: 10px; } }
.bars .bar { overflow: visible; margin: 0; }
.bars .plot { height: 150px; margin-right: 6px; }
.legend .sw.today { opacity: .55; }
@media (max-width: 720px) { .bars .plot { height: 125px; } }

/* ---------- line chart (weight): stretched SVG for the strokes, HTML for text and dots ---------- */
.linechart .plot { position: relative; height: 190px; margin: 14px 10px 24px 38px; border-bottom: 1px solid var(--border); }
.linechart svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.linechart .line { stroke: var(--protein); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.linechart .ma { fill: none; stroke: var(--kcal); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.linechart .gap { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
@media (prefers-color-scheme: dark) { .linechart .line { stroke: #4f80e6; } .linechart .ma { stroke: #d47827; } }
.linechart .tick { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--border); }
.linechart .tick span { position: absolute; left: -38px; top: -7px; width: 32px; text-align: right; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.linechart .dot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--protein); box-shadow: 0 0 0 2px var(--surface); }
@media (prefers-color-scheme: dark) { .linechart .dot { background: #4f80e6; } }
.linechart .dot:hover { transform: scale(1.4); }
.linechart .val { position: absolute; transform: translate(-50%, -22px); font-size: 11px; font-weight: 600; color: var(--text); white-space: nowrap; }
.linechart .x { position: absolute; top: 100%; margin-top: 5px; transform: translateX(-50%); font-size: 10px; color: var(--muted); white-space: nowrap; }
.legend .sw.gap { background: none; width: 12px; height: 0; border-top: 1px dashed var(--muted); vertical-align: 2px; }
@media (max-width: 720px) { .linechart .plot { height: 150px; margin-left: 34px; } .linechart .tick span { left: -34px; width: 29px; font-size: 10px; } }
@media (max-width: 720px) { .linechart .dot { width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; } }

/* In range = solid; under the floor = hollow; over the max = solid + red marker. Plots 25% taller. */
.bars .bar.under { background: transparent; box-shadow: inset 0 0 0 2px var(--bar); }
.bars .bar.under.today { opacity: .55; }
.legend .sw.under { background: transparent; box-shadow: inset 0 0 0 2px var(--kcal); }
.legend .sw.protein.under { box-shadow: inset 0 0 0 2px var(--protein); }
.bars .plot { height: 190px; }
@media (max-width: 720px) { .bars .plot { height: 155px; } }

/* ---------- sign-in ---------- */
body.signed-out header.top, body.signed-out nav.tabs { display: none; }
.login { max-width: 420px; margin: 12vh auto 0; text-align: center; }
.login h1 { font-size: 22px; margin: 0 0 6px; }
.login p { color: var(--muted); margin: 0 0 16px; }
.login form { display: flex; gap: 8px; }
.login input { flex: 1; font-size: 16px; padding: 10px 12px; }
.login .sent { background: var(--accent-soft); color: var(--text); border-radius: 10px; padding: 12px; margin-top: 12px; text-align: left; }
.login .sent a { word-break: break-all; }
.members td { vertical-align: middle; }
.meter { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin: 6px 0; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.meter > i.warn { background: var(--warn); }
.meter > i.bad { background: var(--bad); }
