:root {
  font: 100%/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  color-scheme: light;
  --bg: #f4f6fa; --surface: #fff; --subtle: #f3f5f9; --text: #20232b;
  --muted: #626978; --line: #e4e8ef; --accent: #1768d1; --accent-hover: #0f55ae;
  --accent-soft: #e9f2ff; --focus-surface: #eef4ff; --green: #168664;
  --green-soft: #e7f5ee; --amber: #a76a0b; --amber-soft: #fff3df;
  --danger: #b63b43; --danger-bg: #fff2f2;
  background: var(--bg); color: var(--text);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11141a; --surface: #1d222b; --subtle: #272e39; --text: #f3f6fb;
  --muted: #aeb7c6; --line: #343d4b; --accent: #78adff; --accent-hover: #a4c9fa;
  --accent-soft: #263b5c; --focus-surface: #202d45; --green: #6ed9ae;
  --green-soft: #203b32; --amber: #efbf70; --amber-soft: #3b3022;
  --danger: #ff969a; --danger-bg: #38282b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #11141a; --surface: #1d222b; --subtle: #272e39; --text: #f3f6fb;
    --muted: #aeb7c6; --line: #343d4b; --accent: #78adff; --accent-hover: #a4c9fa;
    --accent-soft: #263b5c; --focus-surface: #202d45; --green: #6ed9ae;
    --green-soft: #203b32; --amber: #efbf70; --amber-soft: #3b3022;
    --danger: #ff969a; --danger-bg: #38282b;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); }
button, input, textarea { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { opacity: .5; cursor: wait; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.shell { width: min(100%, 640px); margin-inline: auto; padding: calc(18px + env(safe-area-inset-top)) 20px calc(48px + env(safe-area-inset-bottom)); }
.datebar, .focus-footer, .subheading, .form-actions, .big-number, .item, .transaction-actions { display: flex; align-items: center; }
.datebar { justify-content: space-between; gap: 8px; margin: 0 0 18px; padding: 7px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 8px 26px rgba(24, 42, 73, .08); }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; flex: none; padding: 0 0 4px; border: 0; border-radius: 13px; background: var(--accent-soft); color: var(--accent); font-size: 2rem; line-height: 1; }
.icon-button:hover { background: var(--focus-surface); }
.date-center { min-width: 0; }
.date-center input { min-width: 0; max-width: 186px; padding: 4px 0; border: 0; background: transparent; color: var(--text); text-align: center; font-size: 1rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.date-center input::-webkit-calendar-picker-indicator { opacity: .6; }
.panel { margin-bottom: 12px; padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 3px 14px rgba(24, 42, 73, .035); }
.panel h2 { margin: 0 0 18px; font-size: 1rem; line-height: 1.25; font-weight: 650; letter-spacing: -.015em; }
.focus-card { padding-top: 25px; padding-bottom: 24px; background: var(--focus-surface); border-color: var(--accent-soft); }
.focus-card h2 { margin-bottom: 20px; color: var(--accent); font-size: .88rem; font-weight: 700; }
.focus-text { min-height: 2.5rem; margin: 0 0 25px; font-size: clamp(1.4rem, 4.6vw, 1.75rem); line-height: 1.26; letter-spacing: -.03em; font-weight: 650; white-space: pre-wrap; overflow-wrap: anywhere; }
.empty-copy { margin: 0 0 25px; max-width: 26rem; font-size: 1.4rem; line-height: 1.28; letter-spacing: -.025em; font-weight: 500; }
.focus-footer { justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.action-button, .button { min-height: 44px; padding: 10px 17px; border: 0; border-radius: 11px; background: #1768d1; color: #fff; font-size: .88rem; font-weight: 650; }
.action-button:hover, .button:hover { background: #0f55ae; }
.source-note { color: var(--muted); font-size: .78rem; line-height: 1.3; }
.big-number { align-items: baseline; flex-wrap: wrap; gap: 5px 9px; margin: 0 0 17px; }
.big-number strong { font-size: clamp(2.5rem, 9vw, 3rem); line-height: 1; letter-spacing: -.05em; font-weight: 650; font-variant-numeric: tabular-nums; }
.nutrition-card h2, .nutrition-card .big-number strong { color: var(--green); }
.comp-card h2, .comp-card .big-number strong { color: var(--amber); }
.big-number span { color: var(--muted); font-size: .9rem; }
.progress { height: 5px; margin-bottom: 19px; overflow: hidden; border-radius: 6px; background: var(--line); }
.progress-fill { height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .25s ease; }
.nutrition-card .progress { background: var(--green-soft); }
.nutrition-card .progress-fill { background: var(--green); }
.comp-card .progress { background: var(--amber-soft); }
.comp-card .progress-fill { background: var(--amber); }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.metric-tile { min-width: 0; padding: 15px 12px 2px 0; }
.metric-tile + .metric-tile { padding-left: 17px; border-left: 1px solid var(--line); }
.metric-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: .78rem; }
.metric-tile strong { display: block; font-size: 1rem; line-height: 1.3; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-tile small { display: block; margin-top: 4px; color: var(--muted); font-size: .77rem; }
.helper-copy, .micro { margin: 12px 0 0; color: var(--muted); font-size: .79rem; line-height: 1.5; }
.subheading { justify-content: space-between; gap: 8px; margin: 22px 0 0; }
.subheading h3, .edit-form h3 { margin: 0; font-size: .9rem; font-weight: 650; }
.inline-button { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 2px 0 10px; border: 0; background: transparent; color: var(--accent); font-size: .85rem; font-weight: 650; }
.inline-button:hover, .mini-button:hover { color: var(--accent-hover); }
.inline-button span { font-size: 1.1rem; }
.item-list { display: grid; }
.item { justify-content: space-between; align-items: flex-start; gap: 12px; min-width: 0; padding: 14px 0; border-top: 1px solid var(--line); }
.item-main { min-width: 0; flex: 1; }
.item-title { display: block; font-size: .88rem; line-height: 1.35; font-weight: 600; overflow-wrap: anywhere; }
.item-detail { display: block; margin-top: 4px; color: var(--muted); font-size: .78rem; line-height: 1.4; }
.item-side { flex: none; max-width: 48%; text-align: right; }
.item-side strong { display: block; font-size: .88rem; font-variant-numeric: tabular-nums; }
.mini-button { min-height: 44px; padding: 5px 5px 5px 9px; border: 0; background: transparent; color: var(--accent); font-size: .78rem; font-weight: 600; }
.mini-button.danger { color: var(--danger); }
.transaction-actions { justify-content: flex-end; flex-wrap: wrap; gap: 0 3px; }
.small-count, .tag { color: var(--muted); font-size: .78rem; }
.tag { display: inline-block; margin-top: 4px; }
.tag.eligible, .tag.candidate, .tag.excluded { color: var(--muted); }
.workday { position: relative; display: flex; align-items: center; justify-content: space-between; min-height: 59px; gap: 10px; margin-top: 18px; border-top: 1px solid var(--line); font-size: .88rem; font-weight: 600; cursor: pointer; }
.workday input { position: absolute; width: 52px; height: 44px; right: 0; margin: 0; opacity: 0; cursor: pointer; }
.switch-track { position: relative; width: 49px; height: 29px; flex: none; border-radius: 99px; background: #c6c9cd; transition: background .2s ease; }
.switch-track::after { content: ""; position: absolute; width: 23px; height: 23px; top: 3px; left: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .15); transition: transform .2s ease; }
.workday input:checked + .switch-track { background: var(--amber); }
.workday input:checked + .switch-track::after { transform: translateX(20px); }
.workday input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 3px; }
.edit-form { display: grid; gap: 10px; margin-top: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--subtle); }
.edit-form label { color: var(--text); font-size: .81rem; font-weight: 600; }
.edit-form input, .edit-form textarea { display: block; width: 100%; min-height: 44px; margin-top: 5px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text); font-size: 1rem; resize: vertical; }
.edit-form input:focus, .edit-form textarea:focus { border-color: var(--accent); }
.edit-form textarea { min-height: 105px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form-actions { justify-content: flex-end; gap: 8px; margin-top: 3px; }
.button.secondary { border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.button.secondary:hover { background: var(--subtle); }
.error { margin-bottom: 14px; padding: 13px 15px; border-radius: 10px; background: var(--danger-bg); color: var(--danger); font-size: .83rem; line-height: 1.4; }
.loading { padding: 64px 0; text-align: center; color: var(--muted); font-size: .88rem; }
.login-card { margin-top: 10vh; padding: 30px; }
.login-card h1 { margin: 0 0 10px; font-size: 2rem; line-height: 1.15; letter-spacing: -.04em; font-weight: 700; }
.login-card > p { margin: 0 0 18px; color: var(--muted); font-size: .92rem; }
.login-card .edit-form { margin: 24px 0 15px; padding: 0; border: 0; background: transparent; }
.login-card .button { width: 100%; }
.login-card #web-login-code { font-size: 1.1rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.login-card .helper-copy { margin: 0; }
.access-card h2 { margin-bottom: 8px; }
.access-card .helper-copy { margin: 0 0 15px; }
.pairing-result { margin-top: 15px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--subtle); }
.pairing-code { display: block; color: var(--text); font-size: 1.2rem; letter-spacing: .08em; user-select: all; }
.pairing-result .helper-copy { margin: 8px 0 0; }
@media (max-width: 420px) {
  .shell { padding-inline: 16px; }
  .panel { padding: 20px; border-radius: 16px; }
  .login-card { margin-top: 8vh; }
}
@media (max-width: 350px) {
  .metric-tile + .metric-tile { padding-left: 12px; }
  .metric-tile strong { font-size: .9rem; }
  .source-note { width: 100%; }
  .item-side { max-width: 53%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (prefers-contrast: more) {
  .panel, .edit-form input, .edit-form textarea { border-color: var(--text); }
  .source-note, .helper-copy, .micro, .metric-label, .item-detail { color: var(--text); }
}
