@import url('https://fonts.googleapis.com/css2?family=Kings:wght@400&family=Figtree:wght@400;600;700&display=swap');

:root {
  --color-bg: #141310;
  --color-page: #0e0d0b;
  --color-surface: #23211c;
  --color-surface-2: #2e2b25;
  --color-text: #f9f4ed;
  --color-muted: #c0b6a5;
  --color-accent: #f6a06b;
  --color-accent-soft: #ffc6a5;
  --color-accent-on: #2e1a0c;
  --color-accent-2: #aebf92;
  --color-divider: rgba(249, 244, 237, 0.16);
  --font-heading: "Kings", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, sans-serif;
  color-scheme: dark;
}

* , *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--color-page);
  color: var(--color-text);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input { font-family: var(--font-body); }
a { color: var(--color-accent); }
::selection { background: rgba(246, 160, 107, 0.3); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.btn-reset {
  border: 0; background: transparent; cursor: pointer; color: inherit;
  font-family: var(--font-body); padding: 0; -webkit-appearance: none;
}
.icon-btn {
  width: 48px; height: 48px; border: 0; background: transparent; border-radius: 999px;
  display: grid; place-items: center; cursor: pointer; color: var(--color-text);
}
.icon-btn:active { background: rgba(249, 244, 237, 0.12); }

.btn-primary, .btn-secondary {
  min-height: 56px; border-radius: 999px; font-family: var(--font-heading);
  font-size: 17px; cursor: pointer; padding: 0 20px;
}
.btn-primary { border: 0; background: var(--color-accent); color: var(--color-accent-on); }
.btn-primary:active { background: var(--color-accent-soft); }
.btn-primary:disabled {
  background: var(--color-surface); color: var(--color-muted); opacity: 0.55; cursor: not-allowed;
  border: 1px solid var(--color-divider);
}
.btn-secondary { border: 1px solid var(--color-divider); background: transparent; color: var(--color-text); }
.btn-secondary:active { background: rgba(249, 244, 237, 0.12); }

/* ── App shell ─────────────────────────────────────────────── */
#app {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  background: var(--color-bg); color: var(--color-text); overflow: hidden;
  max-width: 560px; margin: 0 auto;
}
.screen { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.screen-header {
  flex: none; display: flex; align-items: center; gap: 6px; padding: 10px 12px 10px 6px;
}
.screen-header .title { font-family: var(--font-heading); font-size: 24px; }
.screen-header .spacer { margin-left: auto; padding-right: 10px; font-size: 14px; color: var(--color-muted); }
.screen-scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ── Today ─────────────────────────────────────────────────── */
.today-header {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 4px 20px; flex: none;
}
.today-header .label { font-size: 15px; letter-spacing: 0.02em; color: var(--color-muted); font-weight: 600; }
.kcal-hero { padding: 6px 20px 16px; }
.kcal-hero .row { display: flex; align-items: baseline; gap: 10px; }
.kcal-hero .value { font-family: var(--font-heading); font-size: 74px; line-height: 0.9; letter-spacing: -0.02em; }
.kcal-hero .target { font-size: 22px; color: var(--color-muted); font-weight: 600; }
.kcal-hero .sub { margin-top: 8px; font-size: 16px; color: var(--color-muted); }

.derive-card {
  width: 100%; display: flex; align-items: stretch; background: var(--color-surface);
  border: 1px solid var(--color-divider); border-radius: 24px; padding: 14px 6px; cursor: pointer; margin: 0 16px 18px;
  width: calc(100% - 32px);
}
.derive-card:active { background: var(--color-surface-2); }
.derive-col { flex: 1; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.derive-col .k { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-muted); }
.derive-col .v { font-family: var(--font-heading); font-size: 23px; }
.derive-sep { width: 1px; background: var(--color-divider); }

.macros { display: flex; flex-direction: column; gap: 16px; padding: 0 20px 14px; }
.macro-row .head { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
.macro-row .head .name { font-weight: 600; letter-spacing: 0.02em; }
.macro-row .head .val { color: var(--color-muted); }
.macro-track { position: relative; height: 8px; border-radius: 999px; background: rgba(249, 244, 237, 0.14); overflow: hidden; margin-top: 8px; }
.macro-fill { height: 100%; border-radius: 999px; }
.macro-tick { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--color-text); opacity: 0.55; }
.macro-delta { font-size: 13.5px; color: var(--color-accent-2); margin-top: 4px; }

.explain-btn {
  width: calc(100% - 32px); margin: 0 16px 22px; min-height: 56px; display: flex; align-items: center; gap: 12px;
  text-align: left; background: transparent; border: 1px solid var(--color-divider); border-radius: 20px; padding: 12px 14px; cursor: pointer;
}
.explain-btn:active { background: rgba(249, 244, 237, 0.08); }
.explain-btn span { flex: 1; font-size: 14.5px; line-height: 1.35; color: var(--color-muted); text-wrap: pretty; }
.explain-btn svg { flex: none; color: var(--color-accent); }

.section-label {
  padding: 0 20px 10px; display: flex; align-items: baseline; justify-content: space-between;
}
.section-label .k { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-muted); }
.section-label .v { font-size: 13px; color: var(--color-muted); }

.entry-row {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 12px 20px;
  background: transparent; border: 0; border-top: 1px solid var(--color-divider); text-align: left; cursor: pointer; color: var(--color-text);
}
.entry-row:active { background: rgba(249, 244, 237, 0.07); }
.entry-row .name { font-size: 17px; font-weight: 600; line-height: 1.25; text-wrap: pretty; }
.entry-row .time { font-size: 14px; color: var(--color-muted); margin-top: 3px; }
.entry-row .kcal { font-family: var(--font-heading); font-size: 22px; white-space: nowrap; margin-left: auto; }

.activity-out { padding: 24px 16px 0; }
.activity-out-card { background: var(--color-surface); border-radius: 26px; padding: 14px 16px 16px; }
.activity-out-head { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 6px; }
.activity-out-head .k { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-accent-2); }
.activity-out-head .v { font-size: 13px; color: var(--color-muted); }
.activity-out-row { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 10px 0; border-top: 1px solid var(--color-divider); }
.activity-out-row .type { font-size: 17px; font-weight: 600; line-height: 1.25; }
.activity-out-row .meta { font-size: 14px; color: var(--color-muted); margin-top: 3px; }
.activity-out-row .burn { font-family: var(--font-heading); font-size: 20px; color: var(--color-accent-2); white-space: nowrap; margin-left: auto; }
.activity-out-note { padding-top: 12px; border-top: 1px solid var(--color-divider); font-size: 14px; color: var(--color-muted); line-height: 1.4; }

.fab {
  position: absolute; right: 20px; bottom: 104px; width: 72px; height: 72px; border-radius: 999px; border: 0;
  background: var(--color-accent); color: var(--color-accent-on); display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}
.fab:active { background: var(--color-accent-soft); }

.bottom-nav { flex: none; display: flex; border-top: 1px solid var(--color-divider); background: var(--color-bg); }
.bottom-nav button {
  flex: 1; min-height: 72px; border: 0; background: transparent; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 5px; cursor: pointer; font-size: 13px; letter-spacing: 0.04em;
  font-weight: 600; color: var(--color-muted);
}
.bottom-nav button.active { color: var(--color-accent); }
.bottom-nav button:active { background: rgba(249, 244, 237, 0.07); }

/* ── History ───────────────────────────────────────────────── */
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px 12px 20px; }
.history-head .title { font-family: var(--font-heading); font-size: 30px; }
.pill-btn {
  min-height: 48px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--color-divider); background: transparent;
  color: var(--color-text); font-family: var(--font-heading); font-size: 15px; cursor: pointer; display: flex; align-items: center; gap: 6px;
}
.pill-btn:active { background: rgba(249, 244, 237, 0.12); }

.seg-tabs { display: inline-flex; border: 1px solid var(--color-divider); border-radius: 999px; overflow: hidden; margin: 0 16px 16px; }
.seg-tabs button { min-height: 48px; padding: 0 20px; border: 0; font-family: var(--font-heading); font-size: 15px; cursor: pointer; background: transparent; color: var(--color-text); }
.seg-tabs button.active { background: var(--color-accent); color: var(--color-accent-on); }

.week-preview { width: calc(100% - 32px); margin: 0 16px 20px; text-align: left; background: transparent; border: 0; padding: 0; cursor: pointer; }
.week-preview-card { background: var(--color-surface); border-radius: 22px; padding: 14px; }
.week-preview-head { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 10px; }
.week-preview-head .k { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-muted); }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.mini-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 0; border-radius: 10px; }
.mini-cell .dow { font-size: 11px; color: var(--color-muted); }
.mini-cell .num { font-size: 13px; font-weight: 600; }
.mini-marks { display: flex; gap: 2px; height: 8px; align-items: center; }
.mark-dot { width: 6px; height: 6px; background: var(--color-accent-2); opacity: 0.85; }

.day-row {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 76px; padding: 14px 20px;
  background: transparent; border: 0; border-top: 1px solid var(--color-divider); text-align: left; cursor: pointer; color: var(--color-text);
}
.day-row:active { background: rgba(249, 244, 237, 0.07); }
.day-row .date { font-size: 17px; font-weight: 600; }
.day-track { position: relative; height: 6px; width: 100%; max-width: 190px; border-radius: 999px; background: rgba(249, 244, 237, 0.14); overflow: hidden; margin-top: 9px; }
.day-track .fill { height: 100%; border-radius: 999px; background: var(--color-accent); }
.day-row .target-label { font-size: 13px; color: var(--color-muted); margin-top: 9px; }
.day-row .right { text-align: right; margin-left: auto; }
.day-row .kcal { font-family: var(--font-heading); font-size: 22px; }
.day-row .delta { font-size: 13px; color: var(--color-muted); }

.day-detail { padding: 0 0 10px; background: rgba(249, 244, 237, 0.04); }
.day-detail .entry-mini { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 10px 20px 10px 32px; border-top: 1px solid var(--color-divider); }
.day-detail .entry-mini .name { font-size: 16px; font-weight: 600; line-height: 1.25; }
.day-detail .entry-mini .time { font-size: 13px; color: var(--color-muted); margin-top: 2px; }
.day-detail .entry-mini .kcal { font-family: var(--font-heading); font-size: 19px; margin-left: auto; }
.day-detail .activity-mini { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 10px 20px 10px 32px; border-top: 1px solid var(--color-divider); color: var(--color-accent-2); }
.day-detail .activity-mini .burn { font-family: var(--font-heading); font-size: 18px; margin-left: auto; }

.cal-wrap { padding: 4px 16px 20px; }
.cal-month { text-align: center; font-family: var(--font-heading); font-size: 20px; padding-bottom: 14px; }
.cal-dow-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px 0; padding-bottom: 6px; }
.cal-dow-row div { text-align: center; font-size: 12px; color: var(--color-muted); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell {
  min-height: 52px; border-radius: 14px; background: transparent; border: 1px solid transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 4px;
}
.cal-cell.in-month { background: var(--color-surface); border-color: var(--color-divider); }
.cal-cell.today { border-color: var(--color-accent); }
.cal-cell .num { font-size: 13px; }
.cal-legend { display: flex; gap: 16px; padding-top: 16px; font-size: 13px; color: var(--color-muted); flex-wrap: wrap; }
.cal-legend .item { display: flex; align-items: center; gap: 6px; }
.cal-legend .dot { width: 8px; height: 8px; background: var(--color-accent-2); border-radius: 50%; }
.cal-legend .sq { width: 8px; height: 8px; background: var(--color-accent-2); border-radius: 3px; }
.cal-legend .tri { width: 8px; height: 8px; background: var(--color-accent-2); border-radius: 2px; transform: rotate(45deg); }

/* ── Confirm ───────────────────────────────────────────────── */
.confirm-list { flex: 1; min-height: 0; min-width: 0; overflow-y: auto; padding: 4px 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.item-card { background: var(--color-surface); border-radius: 24px; padding: 16px; display: flex; flex-direction: column; gap: 14px; border: 1px solid transparent; min-width: 0; box-sizing: border-box; }
.item-card.warn { border-color: var(--color-accent); }
.item-card-head { display: flex; align-items: flex-start; gap: 12px; }
.item-name {
  flex: 1; font-size: 18px; font-weight: 600; line-height: 1.3; background: transparent; border: 0; color: var(--color-text);
  font-family: var(--font-body); padding: 0; min-width: 0;
}
.warn-box { display: flex; flex-direction: column; gap: 12px; background: var(--color-surface-2); border-radius: 18px; padding: 14px; }
.warn-box .msg { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; line-height: 1.4; color: var(--color-accent); }
.warn-box .msg svg { flex: none; margin-top: 1px; }
.resolve-btn {
  min-height: 48px; border-radius: 999px; border: 1px solid var(--color-accent); background: transparent; color: var(--color-accent);
  font-family: var(--font-heading); font-size: 16px; cursor: pointer; padding: 0 18px;
}
.resolve-btn:active { background: rgba(246, 160, 107, 0.18); }
.qty-row { display: flex; align-items: center; gap: 10px; }
.round-btn {
  width: 52px; height: 52px; flex: none; border-radius: 999px; border: 1px solid var(--color-divider); background: transparent;
  color: var(--color-text); font-size: 26px; line-height: 1; cursor: pointer;
}
.round-btn:active { background: rgba(249, 244, 237, 0.12); }
.qty-field {
  flex: 1; display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 16px; border-radius: 999px;
  background: var(--color-surface-2); border: 1px solid var(--color-divider);
}
.qty-field input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--color-text);
  font-size: 20px; font-weight: 600; font-family: var(--font-body); text-align: left;
}
.qty-field .unit { font-size: 16px; color: var(--color-muted); }
.item-kcal { width: 88px; flex: none; text-align: right; font-family: var(--font-heading); font-size: 22px; }
.macro-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; min-width: 0; }
.macro-field { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--color-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.macro-field input {
  width: 100%; min-width: 0; box-sizing: border-box;
  min-height: 40px; border-radius: 12px; background: var(--color-surface-2); border: 1px solid var(--color-divider);
  color: var(--color-text); font-size: 14px; font-family: var(--font-body); padding: 0 6px; text-align: center;
}
.add-item-btn {
  min-height: 56px; border-radius: 999px; border: 1px dashed var(--color-divider); background: transparent; color: var(--color-muted);
  font-size: 16px; cursor: pointer;
}
.add-item-btn:active { background: rgba(249, 244, 237, 0.07); }
.confirm-footer { flex: none; padding: 14px 16px 16px; border-top: 1px solid var(--color-divider); background: var(--color-bg); display: flex; flex-direction: column; gap: 12px; }
.confirm-totals { display: flex; align-items: baseline; justify-content: space-between; }
.confirm-totals .kcal { font-family: var(--font-heading); font-size: 38px; line-height: 1; }
.confirm-totals .kcal-unit { font-size: 15px; color: var(--color-muted); margin-left: 6px; }
.confirm-totals .macros { padding: 0; font-size: 15px; color: var(--color-muted); }
.confirm-actions { display: flex; gap: 12px; }
.confirm-actions .btn-primary { flex: 1.4; }
.confirm-actions .btn-secondary { flex: 1; }
.confirm-blocked-note { font-size: 14px; color: var(--color-muted); text-align: center; }
.remove-item-btn {
  width: 48px; height: 48px; margin: -8px -8px 0 0; border: 0; background: transparent; border-radius: 999px;
  display: grid; place-items: center; cursor: pointer; color: var(--color-muted); flex: none;
}
.remove-item-btn:active { background: rgba(249, 244, 237, 0.12); }
.qa-checkbox-row { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--color-muted); }
.qa-checkbox-row input { width: 20px; height: 20px; accent-color: var(--color-accent); }

/* ── Activity / Plan forms ────────────────────────────────── */
.form-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 16px 20px; display: flex; flex-direction: column; gap: 20px; }
.form-section { display: flex; flex-direction: column; gap: 10px; }
.form-section .k { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-muted); }
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  min-height: 52px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--color-accent-2); background: transparent;
  color: var(--color-text); font-size: 15.5px; font-weight: 600; cursor: pointer;
}
.chip:active { background: rgba(174, 191, 146, 0.2); }
.type-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.type-tile {
  min-height: 78px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border-radius: 20px; border: 1px solid var(--color-divider); background: transparent; color: var(--color-text); cursor: pointer; padding: 8px 4px;
}
.type-tile.selected { border-color: var(--color-accent); background: rgba(246, 160, 107, 0.18); color: var(--color-accent); }
.type-tile:active { background: rgba(249, 244, 237, 0.14); }
.type-tile span { font-size: 12px; font-weight: 600; line-height: 1.15; text-align: center; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper-field {
  flex: 1; display: flex; align-items: baseline; justify-content: center; gap: 8px; height: 56px; border-radius: 999px;
  background: var(--color-surface-2); border: 1px solid var(--color-divider); padding: 0 16px;
}
.stepper-field .value { font-family: var(--font-heading); font-size: 28px; }
.stepper-field .unit { font-size: 16px; color: var(--color-muted); }
.tri-row { display: flex; gap: 10px; }
.tri-btn {
  flex: 1; min-height: 56px; border-radius: 999px; border: 1px solid var(--color-divider); background: transparent;
  color: var(--color-text); font-size: 16px; font-weight: 600; cursor: pointer;
}
.tri-btn.selected { border-color: var(--color-accent); background: rgba(246, 160, 107, 0.18); color: var(--color-accent); }
.tri-btn:active { background: rgba(249, 244, 237, 0.14); }
.field-row { display: flex; align-items: center; gap: 14px; }
.field-row label { flex: 1; font-size: 16px; font-weight: 600; }
.field-box {
  display: flex; align-items: center; gap: 8px; width: 148px; height: 56px; padding: 0 16px; border-radius: 999px;
  background: var(--color-surface-2); border: 1px solid var(--color-divider);
}
.field-box input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--color-text);
  font-size: 19px; font-weight: 600; font-family: var(--font-body); text-align: right;
}
.field-box .unit { font-size: 15px; color: var(--color-muted); }
.note-line { font-size: 14px; color: var(--color-muted); line-height: 1.4; }
.form-footer { flex: none; padding: 14px 16px 16px; border-top: 1px solid var(--color-divider); display: flex; flex-direction: column; gap: 10px; }
.form-footer .row { display: flex; gap: 12px; }
.form-footer .btn-primary { flex: 1.4; }
.form-footer .btn-secondary { flex: 1; }
.choice-card {
  min-height: 60px; padding: 12px 18px; border-radius: 20px; border: 1px solid var(--color-divider); background: transparent;
  color: var(--color-text); text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px;
}
.choice-card.selected { border-color: var(--color-accent); background: rgba(246, 160, 107, 0.14); }
.choice-card:active { background: rgba(249, 244, 237, 0.14); }
.choice-card .label { font-size: 16.5px; font-weight: 600; }
.choice-card .note { font-size: 13.5px; color: var(--color-muted); }
.choice-list { display: flex; flex-direction: column; gap: 10px; }
.wizard-title { font-family: var(--font-heading); font-size: 26px; line-height: 1.15; }

.rate-block { display: flex; flex-direction: column; gap: 14px; }
.rate-head { display: flex; align-items: baseline; justify-content: space-between; }
.rate-head .k { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-muted); }
.rate-head .zone { font-size: 15px; color: var(--color-muted); }
.rate-value { display: flex; align-items: baseline; gap: 8px; }
.rate-value .num { font-family: var(--font-heading); font-size: 34px; }
.rate-value .unit { font-size: 16px; color: var(--color-muted); }
.rate-slider { position: relative; height: 56px; }
.rate-track { position: absolute; left: 0; right: 0; top: 25px; height: 6px; border-radius: 999px; background: rgba(249, 244, 237, 0.14); overflow: hidden; }
.rate-track .safe { position: absolute; left: 0; top: 0; bottom: 0; background: var(--color-accent-2); opacity: 0.55; }
.rate-track .caution { position: absolute; top: 0; bottom: 0; right: 0; background: repeating-linear-gradient(135deg, rgba(246,160,107,0.75) 0 4px, rgba(246,160,107,0.2) 4px 8px); }
.rate-stops { position: absolute; inset: 0; display: flex; }
.rate-stops button { flex: 1; height: 56px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; }
.rate-stops .dot { border-radius: 999px; display: block; }
.rate-labels { display: flex; justify-content: space-between; font-size: 13px; color: var(--color-muted); }
.callout {
  display: flex; gap: 12px; align-items: flex-start; background: var(--color-surface); border-radius: 22px; padding: 14px 16px;
}
.callout.flagged { border: 1px solid var(--color-accent); }
.callout svg { flex: none; margin-top: 1px; }
.callout .text { font-size: 14.5px; line-height: 1.45; text-wrap: pretty; }
.callout .text.muted { color: var(--color-muted); }

/* ── Weight ────────────────────────────────────────────────── */
.weight-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.weight-top .num { font-family: var(--font-heading); font-size: 52px; line-height: 1; }
.weight-top .unit { font-size: 18px; color: var(--color-muted); }
.weight-top .note { margin-top: 6px; font-size: 15px; color: var(--color-muted); }
.weight-top .trend { text-align: right; }
.weight-top .trend .v { font-family: var(--font-heading); font-size: 24px; color: var(--color-accent-2); }
.weight-top .trend .k { font-size: 13.5px; color: var(--color-muted); }
.weight-chart { background: var(--color-surface); border-radius: 26px; padding: 16px 14px 12px; }
.weight-chart-labels { display: flex; justify-content: space-between; font-size: 13px; color: var(--color-muted); padding: 6px 2px 0; }
.new-weight-row { display: flex; gap: 10px; }
.new-weight-row .field-box.wide { width: auto; flex: 1; }
.weight-row { display: flex; align-items: center; min-height: 56px; padding: 10px 4px; border-top: 1px solid var(--color-divider); }
.weight-row .date { flex: 1; font-size: 16px; }
.weight-row .kg { font-family: var(--font-heading); font-size: 19px; }

/* ── Week ──────────────────────────────────────────────────── */
.week-bars { display: flex; align-items: flex-end; gap: 8px; height: 120px; }
.week-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.week-bar { width: 100%; border-radius: 10px 10px 4px 4px; background: var(--color-accent); opacity: 0.85; }
.week-bar-col .day { font-size: 12px; color: var(--color-muted); }
.week-stats { display: flex; flex-direction: column; gap: 12px; }
.week-stat { display: flex; align-items: center; gap: 14px; background: var(--color-surface); border-radius: 22px; padding: 14px 18px; min-height: 64px; }
.week-stat .label { font-size: 15.5px; font-weight: 600; }
.week-stat .note { font-size: 13.5px; color: var(--color-muted); margin-top: 2px; }
.week-stat .value { font-family: var(--font-heading); font-size: 24px; margin-left: auto; }
.week-reading { background: var(--color-surface-2); border-radius: 24px; padding: 18px; }
.week-reading .k { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-muted); margin-bottom: 8px; }
.week-reading .text { font-size: 17px; line-height: 1.5; text-wrap: pretty; }

/* ── Sheets ────────────────────────────────────────────────── */
.sheet-backdrop { position: absolute; inset: 0; background: rgba(14, 13, 11, 0.72); animation: fadeIn 140ms ease-out; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 90%; overflow-y: auto; background: var(--color-surface);
  border-radius: 32px 32px 0 0; padding: 20px 20px 24px; animation: sheetUp 200ms cubic-bezier(.2, .8, .2, 1);
}
.sheet-grabber { width: 56px; height: 5px; border-radius: 999px; background: rgba(249, 244, 237, 0.28); margin: 0 auto 16px; }
.sheet-title { font-family: var(--font-heading); font-size: 26px; margin-bottom: 16px; }
.sheet-sub { font-size: 14.5px; color: var(--color-muted); margin-bottom: 18px; }

.add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.add-tile {
  min-height: 104px; border-radius: 24px; border: 1px solid var(--color-divider); background: var(--color-surface-2);
  color: var(--color-text); display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between;
  padding: 16px; cursor: pointer;
}
.add-tile:active { background: rgba(249, 244, 237, 0.14); }
.add-tile.wide { grid-column: span 2; min-height: 80px; flex-direction: row; align-items: center; gap: 14px; border-color: var(--color-accent-2); }
.add-tile .label { font-family: var(--font-heading); font-size: 19px; }
.add-tile .sub { display: block; font-size: 14px; color: var(--color-muted); margin-top: 2px; }
.sheet-cancel { width: 100%; min-height: 56px; margin-top: 14px; border-radius: 999px; border: 0; background: transparent; color: var(--color-muted); font-family: var(--font-heading); font-size: 17px; cursor: pointer; }
.sheet-cancel:active { background: rgba(249, 244, 237, 0.1); }

.derive-rows { display: flex; flex-direction: column; }
.derive-row { display: flex; align-items: flex-start; gap: 14px; padding: 14px 0; border-top: 1px solid var(--color-divider); }
.derive-row .label { font-size: 16px; font-weight: 600; line-height: 1.3; }
.derive-row .note { font-size: 13.5px; color: var(--color-muted); margin-top: 3px; line-height: 1.4; text-wrap: pretty; }
.derive-row .value { font-family: var(--font-heading); font-size: 19px; white-space: nowrap; margin-left: auto; }
.floor-note { margin-top: 18px; background: var(--color-surface-2); border-radius: 20px; padding: 14px 16px; font-size: 14.5px; line-height: 1.45; color: var(--color-muted); }

.settings-links { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.settings-link {
  min-height: 64px; border-radius: 20px; border: 1px solid var(--color-divider); background: var(--color-surface-2); color: var(--color-text);
  display: flex; align-items: center; gap: 12px; padding: 12px 18px; cursor: pointer; text-align: left; width: 100%;
}
.settings-link:active { background: rgba(249, 244, 237, 0.14); }
.settings-link .label { font-size: 16.5px; font-weight: 600; }
.settings-link .sub { font-size: 13.5px; color: var(--color-muted); margin-top: 2px; }
.settings-fields { display: flex; flex-direction: column; gap: 18px; }
.hr { height: 1px; background: var(--color-divider); margin: 22px 0 18px; }

/* ── Quick add picker ──────────────────────────────────────── */
.qa-list { display: flex; flex-direction: column; gap: 10px; max-height: 50vh; overflow-y: auto; }
.qa-list-item {
  display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 14px; border-radius: 18px;
  border: 1px solid var(--color-divider); background: var(--color-surface-2); cursor: pointer; text-align: left; width: 100%; color: var(--color-text);
}
.qa-list-item:active { background: rgba(249, 244, 237, 0.14); }
.qa-list-item .name { flex: 1; font-size: 16px; font-weight: 600; }
.qa-list-item .meta { font-size: 13px; color: var(--color-muted); }
.qa-empty { font-size: 14.5px; color: var(--color-muted); text-align: center; padding: 20px 0; }

/* ── Misc ──────────────────────────────────────────────────── */
.textarea-field {
  width: 100%; min-height: 120px; border-radius: 20px; background: var(--color-surface-2); border: 1px solid var(--color-divider);
  color: var(--color-text); font-family: var(--font-body); font-size: 16px; padding: 14px 16px; resize: vertical;
}
.toast {
  position: absolute; left: 16px; right: 16px; bottom: 96px; background: var(--color-surface-2); border: 1px solid var(--color-divider);
  border-radius: 18px; padding: 14px 18px; font-size: 14.5px; text-align: center; z-index: 50; animation: fadeIn 140ms ease-out;
}
.centered-note { padding: 40px 24px; text-align: center; color: var(--color-muted); font-size: 15px; line-height: 1.5; }
.spinner {
  width: 22px; height: 22px; border-radius: 999px; border: 2.5px solid rgba(249, 244, 237, 0.25); border-top-color: var(--color-accent);
  animation: spin 700ms linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Login ─────────────────────────────────────────────────── */
.login-page {
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; background: var(--color-page); gap: 24px;
}
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 18px; }
.login-card h1 { font-family: var(--font-heading); font-size: 32px; margin: 0; text-align: center; }
.login-card input {
  width: 100%; min-height: 56px; border-radius: 999px; background: var(--color-surface-2); border: 1px solid var(--color-divider);
  color: var(--color-text); font-size: 18px; padding: 0 20px; text-align: center;
}
.login-error { color: var(--color-accent); font-size: 14.5px; text-align: center; min-height: 20px; }
