:root {
  --page: #f9f9f7; --surface: #fcfcfb; --text: #0b0b0b; --text-2: #52514e; --muted: #6f6d68; --line: #e1e0d9;
  --accent: #2a78d6; --accent-ink: #1c5cab; --neg-fill: #e34948; --up: #006300; --down: #b32f2f; --track: #ecebe6; --warn-bg: #fdf1d6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0d0d0d; --surface: #1a1a19; --text: #ffffff; --text-2: #c3c2b7; --muted: #9c9a93; --line: #2c2c2a;
    --accent: #3987e5; --accent-ink: #86b6ef; --neg-fill: #e66767; --up: #3fbf3f; --down: #f08080; --track: #2c2c2a; --warn-bg: #3a2f12;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; padding-bottom: calc(72px + env(safe-area-inset-bottom)); overflow-x: hidden;
}
button { font: inherit; color: inherit; }
header {
  position: sticky; top: 0; z-index: 2; background: var(--page); border-bottom: 1px solid var(--line);
  padding: calc(10px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) 8px calc(16px + env(safe-area-inset-left));
}
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bar-right { display: flex; align-items: center; gap: 8px; }
h1 { font-size: 19px; font-weight: 650; margin: 0; letter-spacing: -0.01em; }
#status { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; min-height: 18px; font-variant-numeric: tabular-nums; }
#notice { margin: 6px 0 0; padding: 7px 10px; border-radius: 8px; background: var(--warn-bg); font-size: 13.5px; }
.icon { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 20px; line-height: 1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; min-height: 44px; padding: 0 14px; font-size: 14px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { color: var(--accent-ink); background: var(--track); }
.seg.wide { display: flex; margin-bottom: 12px; }
.seg.wide button { flex: 1; padding: 0 4px; }
main { max-width: 640px; margin: 0 auto; padding: 14px calc(16px + env(safe-area-inset-right)) 8px calc(16px + env(safe-area-inset-left)); }
.hero { padding: 6px 2px 16px; }
.hero-label { color: var(--muted); font-size: 14px; }
.hero-value { font-size: 40px; font-weight: 650; letter-spacing: -0.025em; line-height: 1.1; margin: 2px 0; overflow-wrap: anywhere; }
.hero-sub { color: var(--text-2); font-size: 14px; }
.hero-day { font-size: 16px; font-weight: 600; margin-top: 6px; color: var(--text-2); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.tile, .card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.tile { padding: 12px 14px; min-width: 0; }
.tile-label { color: var(--muted); font-size: 13px; }
.tile-value { font-size: 20px; font-weight: 640; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.tile-sub { color: var(--text-2); font-size: 12.5px; }
.card { padding: 14px 16px; margin-bottom: 12px; }
.card-title { font-size: 16px; font-weight: 640; margin: 0 0 8px; }
.note { color: var(--muted); font-size: 13px; margin: -4px 0 10px; }
.line { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 15px; }
.card > .line:first-of-type, .block > .line:first-child, .detail > .line:first-child { border-top: 0; }
.line-label { color: var(--text-2); min-width: 0; }
.line-value { text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.block + .block { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
.strong { font-weight: 640; }
.dim { color: var(--muted); }
.up { color: var(--up); }
.down { color: var(--down); }
.bar-row { display: grid; grid-template-columns: minmax(58px, 30%) 1fr minmax(64px, auto); align-items: center; gap: 10px; padding: 5px 0; font-size: 14px; }
.bar-label { color: var(--text-2); overflow-wrap: anywhere; }
.bar-track { background: var(--track); border-radius: 4px; height: 12px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.bar-fill.neg { background: var(--neg-fill); }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; }
.list { padding: 0; overflow: hidden; }
.stock + .stock { border-top: 1px solid var(--line); }
.stock-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.1fr); gap: 8px; width: 100%; min-height: 60px; padding: 10px 14px; border: 0; background: transparent; text-align: left; align-items: center; }
.stock-row > span { display: flex; flex-direction: column; min-width: 0; }
.stock-mid, .stock-right { text-align: right; font-variant-numeric: tabular-nums; }
.stock-t, .stock-v { font-weight: 640; }
.stock-n { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stock-d, .stock-g { font-size: 13.5px; }
.detail { padding: 2px 14px 12px; background: var(--page); }
.button { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; margin-top: 10px; padding: 0 14px; border: 1px solid var(--accent-ink); border-radius: 12px; background: transparent; color: var(--accent-ink); font-size: 16px; font-weight: 600; position: relative; text-align: center; }
.button.quiet { border-color: var(--line); color: var(--text); }
.button.danger { border-color: var(--down); color: var(--down); }
.button:focus-within, button:focus-visible, .text:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.file { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; }
.text { width: 100%; min-height: 48px; padding: 0 12px; font: inherit; font-size: 16px; color: var(--text); background: var(--page); border: 1px solid var(--line); border-radius: 12px; }
.steps { margin: 0; padding-left: 20px; }
.steps li { margin-bottom: 6px; }
.check { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; color: var(--text-2); }
.pill { flex: none; font-size: 12px; font-weight: 640; padding: 1px 8px; border-radius: 20px; background: var(--track); color: var(--text); }
nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
nav button { flex: 1; min-height: 56px; border: 0; background: transparent; font-size: 13.5px; font-weight: 600; color: var(--muted); padding: 0 2px; }
nav button[aria-current="page"] { color: var(--accent-ink); box-shadow: inset 0 2px 0 var(--accent); }
