*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: radial-gradient(120% 45% at 50% -8%, rgba(189,31,34,0.18) 0%, rgba(7,7,7,0) 60%), var(--bg);
  color: var(--text); font-family: var(--font-body); font-size: 16px; line-height: 1.45; overflow-x: hidden;
}
a { color: var(--red-light); text-decoration: none; }
a:hover { color: #ff6b6e; }
img { max-width: 100%; }
.page { max-width: 560px; margin: 0 auto; padding: calc(16px + var(--safe-top)) 16px calc(96px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 16px; }
.page-wide { max-width: 960px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 34px; height: 36px; border-radius: 4px; object-fit: cover; }
.brand-name { font-family: var(--font-display); font-size: 10.5px; letter-spacing: 0.16em; color: var(--silver-light); }
.brand-sub { font-family: var(--font-display); font-size: 7.5px; letter-spacing: 0.34em; color: var(--red); }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--silver-2); }
.h1 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 22px; line-height: 1.25; letter-spacing: 0.02em;
  background: linear-gradient(180deg, #fff 0%, #b9b8bc 60%, #7e7d80 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 12px; letter-spacing: 0.14em; color: var(--silver-light); text-transform: uppercase; }
.muted { color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 16px; }
.card-hero { border: 1px solid rgba(189,31,34,0.55); box-shadow: 0 0 34px -12px var(--red-glow); background: linear-gradient(180deg, var(--raised), #0c0c0d); }
.btn { min-height: var(--tap); padding: 0 18px; border-radius: var(--radius-control); border: 1px solid transparent; font: 600 15px/1 var(--font-body);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-align: center; }
.btn-primary { min-height: 54px; width: 100%; font-family: var(--font-display); font-size: 12.5px; letter-spacing: 0.14em; text-transform: uppercase; color: #fff;
  background: linear-gradient(180deg, #c4262a 0%, var(--red-deep) 100%); box-shadow: inset 0 0 0 1px rgba(255,120,120,0.25), 0 10px 30px -10px var(--red-glow); }
.btn-secondary { color: var(--silver-light); background: transparent; border-color: var(--line-2); }
.btn-text { color: var(--red-light); background: transparent; padding: 0 8px; }
.btn-danger { width: 100%; color: #fff; background: #3a0d0e; border-color: rgba(232,71,74,0.6); }
.btn:focus-visible, .input:focus-visible, a:focus-visible { outline: 2px solid var(--red-light); outline-offset: 2px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 14px; font-weight: 600; color: var(--text); }
.field-help { font-size: 13px; color: var(--muted); }
.field-error { font-size: 13px; color: var(--red-light); }
.input { min-height: 48px; width: 100%; padding: 10px 14px; border-radius: var(--radius-control); border: 1px solid var(--line-2);
  background: var(--inset); color: var(--text-strong); font: 500 17px var(--font-body); }
.input-unit { position: relative; }
.input-unit span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--silver-2); font-size: 14px; }
select.input { appearance: none; }
.chip { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 13px; font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--silver-light); border: 1px solid var(--line-2); }
.chip-red { color: #fff; background: rgba(189,31,34,0.22); border-color: rgba(232,71,74,0.55); }
.chip-muted { color: var(--muted); }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-card); overflow: hidden; }
.list-row { min-height: 60px; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text);
  border-bottom: 1px solid rgba(200,200,205,0.07); }
.list-row:last-child { border-bottom: 0; }
.list-row .t { font-weight: 600; }
.list-row .s { font-size: 13px; color: var(--silver-2); }
.status { padding: 10px 14px; border-radius: 10px; font-size: 14px; background: var(--raised); border: 1px solid var(--line); }
.status-ok { border-color: rgba(216,216,220,0.35); }
.status-warn { border-color: var(--warn); }
.status-error { border-color: rgba(232,71,74,0.6); color: #f3d6d6; }
.empty { text-align: center; padding: 32px 16px; color: var(--silver-2); }
.sheet { position: fixed; inset: auto 0 0 0; z-index: 40; background: var(--raised); border-top: 1px solid rgba(189,31,34,0.5);
  border-radius: 18px 18px 0 0; padding: 20px 16px calc(20px + var(--safe-bottom)); box-shadow: 0 -20px 60px rgba(0,0,0,0.6); }
.sheet-backdrop { position: fixed; inset: 0; z-index: 39; background: rgba(0,0,0,0.6); }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: rgba(10,10,11,0.96); border-top: 1px solid var(--line); padding: 6px 8px calc(8px + var(--safe-bottom)); }
.tab { min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--muted); position: relative; }
.tab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab-active { color: var(--text-strong); font-weight: 600; }
.tab-active::before { content: ""; position: absolute; top: -7px; width: 28px; height: 2px; border-radius: 2px; background: var(--red-light); box-shadow: 0 0 12px 2px rgba(232,71,74,0.8); }
.coachbar { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.coachbar a { min-height: var(--tap); padding: 0 14px; display: inline-flex; align-items: center; border-radius: 22px; border: 1px solid var(--line-2); color: var(--silver-light); white-space: nowrap; }
.coachbar a.active { color: #fff; border-color: rgba(232,71,74,0.6); box-shadow: 0 0 18px -6px var(--red-glow); }
.table-scroll { overflow-x: auto; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.pw-meter { display: flex; flex-direction: column; gap: 6px; }
.pw-track { height: 4px; border-radius: 4px; background: #1a1a1c; overflow: hidden; }
.pw-fill { height: 4px; width: 0; background: linear-gradient(90deg, #6e6d70, var(--silver-light)); }
.pw-1 { width: 25%; } .pw-2 { width: 50%; } .pw-3 { width: 75%; } .pw-4 { width: 100%; }
[x-cloak] { display: none !important; }
.stack-tight { display: flex; flex-direction: column; gap: 2px; }
.brand-text { display: flex; flex-direction: column; gap: 1px; }
.icon-btn { min-width: var(--tap); min-height: var(--tap); border-radius: 22px; border: 1px solid var(--line-2); }
.list-note { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* Component kit (spec 4.2). Every control keeps a 44 px hit area; red is light only. */
fieldset.field { display: block; min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset.field > legend { padding: 0; margin-bottom: 6px; }
/* The range input already carries its own 44 px touch height, so the field gap tightens around it. */
.slider-field { gap: 4px; }
.slider-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.slider-value { font: 600 17px var(--font-body); font-variant-numeric: tabular-nums; color: var(--muted); }
.slider { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: var(--tap); margin: 0; background: transparent; cursor: pointer; }
.slider::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: #1a1a1c; border: 1px solid var(--line); }
.slider::-moz-range-track { height: 6px; border-radius: 6px; background: #1a1a1c; border: 1px solid var(--line); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 28px; height: 28px; margin-top: -12px; border-radius: 50%; background: var(--raised); border: 2px solid var(--line-2); }
.slider::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: var(--raised); border: 2px solid var(--line-2); }
.slider-touched .slider::-webkit-slider-thumb { background: var(--silver-light); border-color: var(--red-light); box-shadow: 0 0 14px -2px var(--red-glow); }
.slider-touched .slider::-moz-range-thumb { background: var(--silver-light); border-color: var(--red-light); box-shadow: 0 0 14px -2px var(--red-glow); }
.slider-touched .slider-value { color: var(--text-strong); }
.slider:focus-visible { outline: 2px solid var(--red-light); outline-offset: 2px; }
.slider-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--faint); }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px; border-radius: var(--radius-control); background: var(--inset); border: 1px solid var(--line-2); }
.seg-option, .choice { position: relative; display: block; }
.seg-input, .chip-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg-label { min-height: var(--tap); display: flex; align-items: center; justify-content: center; padding: 0 10px; border-radius: 9px; font-size: 15px; font-weight: 600; color: var(--silver-2); text-align: center; }
.seg-input:checked + .seg-label { color: var(--text-strong); background: var(--raised); box-shadow: inset 0 0 0 1px var(--line-2), 0 0 16px -8px var(--red-glow); }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-chip { min-height: var(--tap); display: inline-flex; align-items: center; padding: 0 16px; border-radius: 22px; border: 1px solid var(--line-2); font-size: 15px; font-weight: 600; color: var(--silver-light); }
.chip-input:checked + .choice-chip { color: #fff; border-color: rgba(232,71,74,0.6); background: rgba(189,31,34,0.16); box-shadow: 0 0 18px -6px var(--red-glow); }
.seg-input:focus-visible + .seg-label, .chip-input:focus-visible + .choice-chip { outline: 2px solid var(--red-light); outline-offset: 2px; }
.progress-block { display: flex; flex-direction: column; gap: 6px; }
.progress-head { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.progress { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 8px; border: 0; border-radius: 8px; background: #1a1a1c; overflow: hidden; }
.progress::-webkit-progress-bar { background: #1a1a1c; border-radius: 8px; }
.progress::-webkit-progress-value { background: linear-gradient(90deg, #6e6d70, var(--silver-light)); border-radius: 8px; }
.progress::-moz-progress-bar { background: linear-gradient(90deg, #6e6d70, var(--silver-light)); border-radius: 8px; }
.progress-glow { overflow: visible; }
.progress-glow::-webkit-progress-value { background: linear-gradient(90deg, var(--red-deep), var(--red-light)); box-shadow: 0 0 12px 2px var(--red-glow); }
.progress-glow::-moz-progress-bar { background: linear-gradient(90deg, var(--red-deep), var(--red-light)); box-shadow: 0 0 12px 2px var(--red-glow); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-row { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 10px 0; }
.timeline-row::before { content: ""; position: absolute; left: 9px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.timeline-row:first-child::before { top: 18px; }
.timeline-row:last-child::before { bottom: calc(100% - 18px); }
.timeline-node { position: relative; z-index: 1; width: 12px; height: 12px; margin: 5px 4px 0; border-radius: 50%; background: var(--card); border: 2px solid var(--silver-2); }
.timeline-done .timeline-node { background: var(--silver-2); }
.timeline-next .timeline-node { border-color: var(--red-light); box-shadow: 0 0 12px 2px var(--red-glow); }
.timeline-later { color: var(--muted); }
.timeline-row .t { font-weight: 600; }
.timeline-row .s { font-size: 13px; color: var(--silver-2); }
.timeline-time { font-size: 13px; color: var(--silver-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.note { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-card); }
.note-summary { min-height: var(--tap); padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; cursor: pointer; list-style: none; }
.note-summary::-webkit-details-marker { display: none; }
.note-summary::after { content: "+"; font-size: 20px; color: var(--silver-2); }
.note[open] .note-summary::after { content: "\2212"; }
.note-body { padding: 0 16px 14px; font-size: 15px; color: var(--silver-light); }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(84px + var(--safe-bottom)); z-index: 50; max-width: 528px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 4px 4px 4px 16px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line-2); box-shadow: 0 16px 40px rgba(0,0,0,0.6); animation: toast-in 180ms ease-out; }
.toast-ok { border-color: rgba(216,216,220,0.35); }
.toast-warn { border-color: var(--warn); }
.toast-error { border-color: rgba(232,71,74,0.6); }
.toast-close { min-width: var(--tap); min-height: var(--tap); border: 0; background: transparent; color: var(--silver-2); font-size: 20px; cursor: pointer; }
.toast-close:focus-visible { outline: 2px solid var(--red-light); outline-offset: -4px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.skeleton { display: flex; flex-direction: column; gap: 10px; }
.skeleton-line { height: 14px; border-radius: 7px; background: linear-gradient(90deg, #151516 0%, #202022 50%, #151516 100%); background-size: 200% 100%; animation: skeleton-shimmer 1.4s ease-in-out infinite; }
.skeleton-line:nth-child(3n+1) { width: 92%; }
.skeleton-line:nth-child(3n+2) { width: 76%; }
.skeleton-line:nth-child(3n) { width: 58%; }
.skeleton .skeleton-line.skeleton-block { width: 100%; height: 88px; border-radius: var(--radius-card); }
@keyframes skeleton-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton-line, .toast { animation: none; } }
@media (min-width: 900px) { .page-wide { padding-bottom: 40px; } }
