:root {
  --bg: #F4F6F8; --surface: #FFFFFF; --text: #111827; --muted: #5B6472;
  --border: #D9DEE5; --accent: #0E7490; --accent-strong: #0B5C72;
  --accent-soft: #E0F2F7; --warn: #B45309; --warn-soft: #FEF3C7;
  --danger: #B91C1C; --danger-soft: #FEE2E2;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px; color: var(--text); background: var(--bg);
  font-variant-numeric: tabular-nums;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; line-height: 1.5; }
a { color: var(--accent); text-underline-offset: 4px; }
button, input, select { font: inherit; }
button { border: 1px solid transparent; border-radius: 8px; padding: 12px 24px; min-height: 48px; background: var(--accent); color: white; font-weight: 600; cursor: pointer; transition: background .15s; }
button:hover { background: var(--accent-strong); }
button:disabled { cursor: wait; opacity: .65; }
button.secondary { background: var(--surface); color: var(--accent); border-color: var(--border); }
button.secondary:hover { background: var(--accent-soft); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(28px, 4vw, 36px); line-height: 1.2; letter-spacing: -.8px; margin: 8px 0 12px; }
h2 { font-size: 20px; line-height: 1.4; letter-spacing: -.3px; }
h3 { font-size: 14px; margin-bottom: 8px; }
.muted { color: var(--muted); }
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { max-width: 1008px; padding: 20px 24px; margin: auto; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); font-weight: 700; text-decoration: none; }
.brand-mark { display: grid; place-items: center; background: var(--accent); color: white; width: 36px; height: 36px; border-radius: 8px; font-size: 28px; line-height: 1; }
.brand-detail { font-weight: 400; color: var(--muted); font-size: 14px; }
.account { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.text-button { color: var(--accent); background: none; padding: 4px; min-height: 36px; font-size: 14px; }
.text-button:hover { background: var(--accent-soft); }
.page { max-width: 1008px; padding: 40px 24px 24px; margin: auto; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.eyebrow, .step-label { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase; }
.eyebrow { color: var(--accent); }
.period { padding: 8px 12px; color: var(--accent-strong); background: var(--accent-soft); border-radius: 8px; font-size: 12px; white-space: nowrap; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 28px; box-shadow: 0 2px 6px #11182704; margin-bottom: 24px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1.35fr 1.1fr 1fr; gap: 16px; }
.field { min-width: 0; }
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
input, select { width: 100%; min-width: 0; min-height: 48px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); padding: 10px 12px; }
select { padding-right: 4px; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); background: #fffafa; }
.field-error { color: var(--danger); font-size: 13px; margin-top: 8px; }
.form-bottom { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-top: 24px; }
.hint { font-size: 13px; }
#calculate { min-width: 176px; display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.feedback { min-height: 192px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 28px; border: 1px dashed var(--border); border-radius: 12px; color: var(--muted); text-align: center; }
.feedback.error { background: var(--danger-soft); border: 1px solid #f4baba; color: var(--danger); }
.empty-mark { color: var(--accent); background: var(--accent-soft); width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; font-size: 28px; }
.feedback.error .empty-mark { display: none; }
.result-title { color: var(--muted); font-size: 14px; margin: -12px 0 24px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric { padding: 20px 16px; background: var(--bg); border-radius: 8px; display: flex; flex-direction: column; gap: 8px; }
.metric strong { font-size: 32px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.metric span { font-size: 13px; color: var(--muted); }
.metric-primary { background: var(--accent-soft); }
.metric-primary strong { color: var(--accent-strong); }
.explanation { border-top: 1px solid var(--border); padding-top: 20px; margin-top: 24px; }
.explanation p { font-size: 14px; color: var(--muted); }
.explanation p + p { margin-top: 8px; }
.notice { padding: 16px; border-radius: 8px; margin-top: 20px; font-size: 14px; }
.warning { background: var(--warn-soft); color: #854004; }
.page-footer { display: flex; justify-content: space-between; gap: 24px; padding: 24px 0 0; font-size: 12px; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.chart-wrap { height: 360px; position: relative; }
.chart-notes { background: var(--bg); padding: 20px; border-radius: 8px; font-size: 14px; margin: 20px 0; }
.chart-notes p + p { margin-top: 8px; color: var(--muted); }
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 500px; }
th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--bg); }
th, td { padding: 12px 16px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
tr:last-child td { border-bottom: 0; }
.median-row { background: var(--accent-soft); font-weight: 600; }
.auth-main { max-width: 480px; margin: auto; padding: 48px 20px 24px; }
.auth-main > .eyebrow, .auth-main > h1, .auth-intro { text-align: center; }
.auth-main h1 { font-size: 30px; }
.auth-intro { margin: 16px 0 28px; font-size: 14px; }
.auth-card h2 { margin-bottom: 24px; }
.auth-card .field { margin-bottom: 20px; }
.auth-card button { width: 100%; }
.auth-card .hint { margin-top: 8px; }
.auth-message { color: var(--danger); background: var(--danger-soft); font-size: 14px; padding: 12px; border-radius: 8px; margin-bottom: 20px; }
.auth-switch { text-align: center; font-size: 14px; margin-top: 24px; }
.demo-section { border-top: 1px solid var(--border); margin-top: 24px; padding-top: 20px; }
.demo-section span { display: block; text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.price-advice { margin-top: 24px; padding: 20px; border-radius: 8px; background: var(--accent-soft); }
.price-advice p { font-size: 14px; color: var(--accent-strong); }
.price-advice p + p { margin-top: 8px; }
.price-advice button { margin-top: 16px; font-size: 14px; }
.history-status { color: var(--muted); font-size: 14px; margin-top: 16px; }
#history-table { margin-top: 20px; }
.history-row { cursor: pointer; }
.history-row:hover { background: var(--accent-soft); }
.history-route { background: transparent; padding: 0; color: var(--accent); font-size: 14px; min-height: 24px; }
.history-route:hover { background: transparent; text-decoration: underline; }
@media (max-width: 900px) { .page-heading { display: block; } .period { display: inline-block; margin-top: 16px; } .brand-detail { display: none; } }
@media (max-width: 720px) {
  .header-inner { padding: 16px; } .page { padding: 28px 16px 16px; }
  .card { padding: 20px; } .form-grid { grid-template-columns: 1fr; }
  .form-bottom { align-items: stretch; flex-direction: column; gap: 16px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { padding: 16px 12px; } .metric strong { font-size: 32px; }
  .step-label { display: none; } .page-footer { flex-direction: column; gap: 8px; }
  .account { max-width: 42%; } .brand { gap: 8px; font-size: 14px; }
  .brand-mark { width: 28px; height: 28px; font-size: 24px; }
}
