:root {
  --bg: #f3f5f7;
  --card: #ffffff;
  --ink: #131820;
  --muted: #6d7480;
  --line: #e3e7ec;
  --brand: #1d4ed8;
  --brand-soft: #e8efff;
  --good: #087f5b;
  --good-soft: #e7f7f1;
  --warn: #a15c00;
  --warn-soft: #fff3dc;
  --bad: #b42318;
  --bad-soft: #ffebe9;
  --shadow: 0 8px 28px rgba(21, 30, 44, .07);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.app-shell { min-height: 100dvh; padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: calc(14px + env(safe-area-inset-top)) 18px 12px; background: rgba(243,245,247,.92); backdrop-filter: blur(18px); border-bottom: 1px solid rgba(227,231,236,.75); }
.topbar h1 { margin: 1px 0 0; font-size: 21px; letter-spacing: -.03em; }
.eyebrow { font-size: 10px; font-weight: 800; letter-spacing: .16em; color: var(--muted); }
.icon-btn { border: 0; background: var(--card); width: 42px; height: 42px; border-radius: 14px; box-shadow: var(--shadow); font-size: 20px; }
main { width: min(760px, 100%); margin: 0 auto; padding: 14px 14px 26px; }
.view { display: none; }
.view.active { display: block; }
.hero-card, .card, .metric-card { background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.hero-card { border-radius: 24px; padding: 20px; background: linear-gradient(145deg, #111827, #1e293b); color: white; border: none; }
.hero-top { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.label { display: block; color: var(--muted); font-size: 12px; font-weight: 700; margin-bottom: 6px; }
.hero-card .label { color: #aeb9c9; }
.hero-number { font-size: clamp(28px, 8vw, 40px); font-weight: 850; letter-spacing: -.04em; }
.hero-number small { font-size: 14px; color: #bcc6d4; font-weight: 650; letter-spacing: normal; }
.badge { font-size: 11px; font-weight: 800; padding: 7px 9px; border-radius: 999px; white-space: nowrap; }
.badge.neutral { background: rgba(255,255,255,.12); color: #e9eef5; }
.badge.good { background: #123f35; color: #a7f3d0; }
.badge.warn { background: #4b3514; color: #fde68a; }
.badge.bad { background: #4a2020; color: #fecaca; }
.progress-track { height: 10px; border-radius: 999px; background: rgba(255,255,255,.13); overflow: hidden; margin-top: 20px; }
.progress-fill { height: 100%; width: 0; border-radius: inherit; background: #8ab4ff; transition: width .3s ease; }
.progress-meta { display: flex; justify-content: space-between; gap: 10px; color: #bdc6d2; font-size: 11px; margin-top: 9px; }
.progress-meta b { color: white; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 18px; }
.metric-card { border-radius: 18px; padding: 15px; min-height: 112px; }
.metric-card strong { display: block; font-size: 24px; letter-spacing: -.035em; line-height: 1.05; }
.metric-card .sub { display: block; font-size: 11px; color: var(--muted); margin-top: 5px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 20px 2px 9px; }
.section-head.tight { margin: 0 0 12px; }
h2 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
h3 { margin: 0 0 6px; }
.link-btn { border: 0; background: transparent; color: var(--brand); font-weight: 750; padding: 8px; }
.card { border-radius: 20px; padding: 17px; margin-bottom: 12px; }
.muted { color: var(--muted); margin: 5px 0 0; font-size: 13px; line-height: 1.45; }
.pace-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; font-size: 13px; }
.pace-scale { height: 7px; background: linear-gradient(90deg, #d6f4e9 0 50%, #ffdfd9 50% 100%); border-radius: 999px; margin-top: 8px; position: relative; }
.pace-marker { width: 12px; height: 18px; border-radius: 6px; background: #111827; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); transition: left .3s ease; }
.page-title { margin: 8px 2px 16px; }
.page-title p { color: var(--muted); margin: 5px 0 0; font-size: 14px; line-height: 1.4; }
.inline-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.form-card { display: grid; gap: 14px; }
.form-card label { font-size: 12px; color: var(--muted); font-weight: 750; }
input, select { width: 100%; border: 1px solid #d7dce3; background: #fafbfc; color: var(--ink); border-radius: 13px; padding: 13px 12px; margin-top: 6px; outline: none; font-size: 16px; }
input:focus, select:focus { border-color: #89aaf5; box-shadow: 0 0 0 3px rgba(29,78,216,.09); background: white; }
.input-suffix, .input-prefix { display: flex; align-items: center; border: 1px solid #d7dce3; background: #fafbfc; border-radius: 13px; margin-top: 6px; overflow: hidden; }
.input-suffix:focus-within, .input-prefix:focus-within { border-color: #89aaf5; box-shadow: 0 0 0 3px rgba(29,78,216,.09); background: white; }
.input-suffix input, .input-prefix input { border: 0; background: transparent; box-shadow: none; margin: 0; }
.input-suffix span { padding-right: 12px; color: var(--muted); font-size: 13px; }
.input-prefix span { padding-left: 12px; color: var(--muted); }
.optional { font-weight: 500; }
.field-hint { color: var(--muted); font-size: 12px; margin: -8px 1px 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.primary-btn, .secondary-btn, .danger-btn, .setup-banner button { border: 0; border-radius: 14px; padding: 13px 15px; font-weight: 800; }
.primary-btn { background: var(--brand); color: white; }
.secondary-btn { background: #eef1f5; color: #28313d; }
.secondary-btn.small { padding: 9px 11px; font-size: 12px; }
.danger-btn { background: var(--bad-soft); color: var(--bad); }
.button-stack { display: grid; gap: 9px; margin-top: 14px; }
.file-btn { text-align: center; position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.segmented { display: flex; padding: 4px; background: #edf0f4; border-radius: 14px; gap: 3px; }
.seg { flex: 1; border: 0; border-radius: 11px; padding: 9px 8px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 800; }
.seg.active { background: white; color: var(--ink); box-shadow: 0 1px 5px rgba(30,40,55,.08); }
.check-row { display: flex !important; gap: 12px; align-items: flex-start; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: #fafbfc; }
.check-row input { width: 20px; height: 20px; margin: 0; }
.check-row span { display: grid; gap: 3px; color: var(--ink); }
.check-row small { color: var(--muted); font-weight: 500; line-height: 1.3; }
.activity-list { display: grid; gap: 0; }
.activity-item { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: 0; }
.activity-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: #f0f3f7; flex: 0 0 auto; }
.activity-main { min-width: 0; flex: 1; }
.activity-title { font-size: 13px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.activity-value { text-align: right; font-size: 13px; font-weight: 850; white-space: nowrap; }
.activity-value small { display: block; color: var(--muted); font-size: 10px; font-weight: 600; margin-top: 3px; }
.delete-entry { border: 0; background: transparent; color: #9da4ae; padding: 7px 2px 7px 7px; font-size: 16px; }
.empty-state { color: var(--muted); font-size: 13px; text-align: center; padding-top: 22px; padding-bottom: 22px; }
.history-filter { margin-bottom: 11px; }
.setup-banner { background: var(--warn-soft); border: 1px solid #f1d39b; color: #674719; border-radius: 17px; padding: 13px; margin-bottom: 11px; display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; align-items: center; }
.setup-banner strong { font-size: 13px; }
.setup-banner span { font-size: 11px; line-height: 1.35; grid-column: 1 / 2; }
.setup-banner button { grid-column: 2; grid-row: 1 / 3; align-self: stretch; background: #fff9ee; color: #704c15; padding: 8px 10px; font-size: 11px; }
.hidden { display: none !important; }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); background: rgba(250,251,252,.95); border-top: 1px solid var(--line); backdrop-filter: blur(18px); padding: 7px 6px calc(7px + env(safe-area-inset-bottom)); }
.nav-btn { border: 0; background: transparent; display: grid; place-items: center; gap: 2px; color: #838a94; padding: 4px 2px; }
.nav-btn span { font-size: 19px; line-height: 1; height: 21px; }
.nav-btn small { font-size: 9px; font-weight: 750; }
.nav-btn.active { color: var(--brand); }
.toast { position: fixed; left: 50%; bottom: calc(85px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); background: #111827; color: white; border-radius: 999px; padding: 10px 14px; font-size: 12px; font-weight: 750; opacity: 0; pointer-events: none; transition: .2s ease; z-index: 50; white-space: nowrap; max-width: calc(100vw - 30px); overflow: hidden; text-overflow: ellipsis; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 700px) {
  main { padding-top: 22px; }
  .metric-grid { grid-template-columns: repeat(4, 1fr); }
  .topbar { padding-left: max(24px, calc((100vw - 760px)/2 + 14px)); padding-right: max(24px, calc((100vw - 760px)/2 + 14px)); }
}
