/* Scale: a bathroom in the morning. Cool tile background, white cards, and one object with character:
   the grey-green LCD readout of a scale. Teal carries the trend, coral the goal. */
:root {
  --tile: #eef3f2; --card: #ffffff; --ink: #0f2a2e; --soft: #51666a; --line: #d3dedc; --field: #f1f5f4;
  --trend: #008f84; --action: #0b7a75; --day: #93a6a8; --goal: #c2410c; --on-trend: #ffffff;
  --lcd: #c7d2c2; --lcd-on: #1b2420; --lcd-off: rgba(27, 36, 32, 0.07); --lcd-edge: #9fae9b;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --tile: #0c1719; --card: #132124; --ink: #e8f0ef; --soft: #9db0b2; --line: #26393d; --field: #0c1719;
    --trend: #1c9e93; --action: #4fc3ba; --day: #5e7679; --goal: #e2643a; --on-trend: #06201e; --lcd: #b4c0af; --lcd-edge: #7f8d7b; color-scheme: dark; }
}
:root[data-theme="dark"] { --tile: #0c1719; --card: #132124; --ink: #e8f0ef; --soft: #9db0b2; --line: #26393d; --field: #0c1719;
  --trend: #1c9e93; --action: #4fc3ba; --day: #5e7679; --goal: #e2643a; --on-trend: #06201e; --lcd: #b4c0af; --lcd-edge: #7f8d7b; color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--tile); color: var(--ink); font: 400 17px/1.5 "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif; font-variant-numeric: tabular-nums; }
main { max-width: 860px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom)); display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--trend); outline-offset: 2px; }
h1 { font-size: 28px; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 18px; margin: 0 0 10px; }
p { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
[hidden] { display: none !important; }

.top { display: flex; justify-content: space-between; align-items: center; }
.units { display: flex; border: 1.5px solid var(--ink); border-radius: 999px; overflow: hidden; }
.units button { border: 0; border-radius: 0; background: transparent; color: var(--ink); min-width: 52px; min-height: 44px; padding: 0 14px; font-weight: 600; }
.units button[aria-pressed="true"] { background: var(--ink); color: var(--tile); }

.welcome { display: grid; gap: 12px; justify-items: start; max-width: 60ch; }
.lead { font-size: 22px; line-height: 1.35; }

.readout { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: center; }
@media (min-width: 700px) { .readout { grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 28px; } }
.glass { background: var(--lcd); border: 2px solid var(--lcd-edge); border-radius: 10px; padding: 14px 18px 18px; color: var(--lcd-on);
  box-shadow: inset 0 2px 6px rgba(27, 36, 32, 0.22); }
.glass-label { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.display { display: flex; align-items: flex-end; gap: 10px; }
#lcd { display: block; flex: 1; min-width: 0; }
.lcd { display: block; height: 84px; max-width: 100%; transform: skewX(-4deg); }
.lcd .on { fill: var(--lcd-on); }
.lcd .off { fill: var(--lcd-off); }
.display-unit { font-weight: 700; font-size: 20px; padding-bottom: 2px; }
.facts { display: grid; gap: 6px; }
.pace { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.facts p:not(.pace) { color: var(--soft); }

/* Progress drawn as a tape measure: ticks along the track, filled up to today's trend. */
.ruler { margin-top: 10px; }
.ruler-track { position: relative; height: 22px; border-radius: 3px; background-color: var(--card);
  background-image: repeating-linear-gradient(to right, var(--line) 0 1px, transparent 1px 10%); border: 1px solid var(--line); }
.ruler-done { position: absolute; inset: 0 auto 0 0; background: var(--trend); opacity: 0.25; border-radius: 2px 0 0 2px; }
.ruler-mark { position: absolute; top: -5px; bottom: -5px; width: 4px; margin-left: -2px; background: var(--trend); border-radius: 2px; }
.ruler-ends { display: flex; justify-content: space-between; font-size: 14px; color: var(--soft); margin-top: 8px; }

.notice { background: var(--card); border-left: 4px solid var(--goal); padding: 10px 14px; }

.chart-box, .card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tabs button { border: 1.5px solid var(--line); background: transparent; color: var(--ink); border-radius: 999px; min-height: 44px; padding: 0 14px; font-weight: 500; font-size: 15px; }
.tabs button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--card); }
.chart { position: relative; margin: 12px 0 4px; min-height: 120px; }
.chart svg { display: block; touch-action: pan-y; }
.chart .empty { color: var(--soft); padding: 40px 0; text-align: center; }
.grid { stroke: var(--line); stroke-width: 1; }
.axis { fill: var(--soft); font-size: 12px; }
.day { fill: var(--day); }
.trend { fill: none; stroke: var(--trend); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.goal { stroke: var(--goal); stroke-width: 1.5; stroke-dasharray: 5 4; }
.goal-label { fill: var(--goal); font-size: 12px; font-weight: 700; }
.cross { stroke: var(--soft); stroke-width: 1; }
.dot { fill: var(--trend); stroke: var(--card); stroke-width: 2; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--card); border-radius: 6px; padding: 8px 10px; font-size: 14px; line-height: 1.35; display: grid; white-space: nowrap; z-index: 1; }
.legend { font-size: 14px; color: var(--soft); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.key { display: inline-block; }
.key-trend { width: 18px; height: 3px; background: var(--trend); border-radius: 2px; }
.key-day { width: 7px; height: 7px; border-radius: 50%; background: var(--day); margin-left: 12px; }

.cols { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 700px) { .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card { display: grid; gap: 12px; }
.card h2 { margin: 0; }
.card h2:not(:first-child) { margin-top: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
label { display: grid; gap: 4px; font-weight: 600; font-size: 15px; flex: 1; min-width: 120px; }
input:not([type="file"]) { width: 100%; min-height: 46px; border: 0; border-bottom: 2px solid var(--ink); border-radius: 4px 4px 0 0; background: var(--field); padding: 8px 10px; font-size: 16px; font-weight: 400; }
button, .file { cursor: pointer; border: 0; border-radius: 999px; min-height: 46px; padding: 0 20px; font-weight: 700; background: var(--action); color: var(--on-trend); }
.quiet { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.file { position: relative; display: inline-flex; align-items: center; justify-self: start; flex: none; font-size: 17px; }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file:focus-within { outline: 3px solid var(--trend); outline-offset: 2px; }
.hint, #import-note { color: var(--soft); font-size: 15px; }
.error { color: var(--goal); font-weight: 600; }
.danger { border-color: var(--goal); color: var(--goal); }

.history { list-style: none; padding: 0; margin: 0 0 16px; }
.history li { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.history .fat { color: var(--soft); font-size: 15px; }
.small { min-height: 44px; padding: 0 14px; font-size: 14px; font-weight: 600; border-color: var(--line); }

footer { font-size: 14px; color: var(--soft); }
footer a { display: inline-block; padding: 4px 0; }
.noscript { padding: 16px; }
.doc { max-width: 68ch; display: block; }
.doc h1 { margin: 16px 0; } .doc h2 { margin: 24px 0 8px; } .doc p, .doc ul { margin: 0 0 12px; }

@media (max-width: 480px) { .history li { grid-template-columns: minmax(0, 1fr) auto auto; } .history .fat { display: none; } #add button { width: 100%; } }
@media (max-width: 760px), (pointer: coarse) { input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea { font-size: 16px !important; } }
