/* ===== Theme tokens =====
   Light = Eucalyptus, dark = Midnight. theme.js sets data-theme on <html> before the app renders,
   following the browser's preference unless the visitor picked a theme. */
:root,
[data-theme="light"] {
    color-scheme: light;
    --bg: #f6f5ef;
    --surface: #ffffff;
    --surface-muted: #f0efe7;
    --border: #e4e2d8;
    --border-strong: #cfccbf;
    --text: #1f2a24;
    --muted: #5f6a62;
    --label: #46524a;
    --placeholder: #a2a89f;
    --accent: #2f7d5b;
    --accent-strong: #24644a;
    --accent-soft: #e4f0e8;
    --on-accent: #ffffff;
    --success: #1f7a4a;
    --success-soft: #e1f1e6;
    --danger: #b3261e;
    --danger-soft: #fbeceb;
    --warning: #7d5400;
    --warning-soft: #fbf1d9;
    --bar: #b9d5c4;
    --hero-bg: linear-gradient(135deg, #e4f0e8 0%, #f1f5ec 55%, #fbfaf6 100%);
    --hero-border: #d3e4d8;
    --shadow: 0 1px 2px rgba(31, 42, 36, 0.04), 0 2px 6px rgba(31, 42, 36, 0.05);
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f1419;
    --surface: #161c23;
    --surface-muted: #1d252e;
    --border: #26303b;
    --border-strong: #37434f;
    --text: #e6edf3;
    --muted: #8f9aa7;
    --label: #b6c0ca;
    --placeholder: #5f6b78;
    --accent: #2dd4bf;
    --accent-strong: #5eead4;
    --accent-soft: #10302d;
    --on-accent: #0b1215;
    --success: #4ade80;
    --success-soft: #12301f;
    --danger: #f87171;
    --danger-soft: #3a1818;
    --warning: #fbbf24;
    --warning-soft: #332709;
    --bar: #2b6a62;
    --hero-bg: linear-gradient(135deg, #12302e 0%, #151d24 55%, #161c23 100%);
    --hero-border: #26303b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.25);
}

:root {
    --radius: 8px;
    --radius-lg: 14px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ===== Base ===== */
html, body {
    font-family: var(--font);
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
}

a, .btn-link { color: var(--accent); text-decoration: none; }
a:hover, .btn-link:hover { color: var(--accent-strong); text-decoration: underline; }
h1:focus { outline: none; }

.text-muted, .form-text { color: var(--muted) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }

/* ===== Form controls ===== */
.form-label { font-size: 0.8rem; font-weight: 500; color: var(--label); margin-bottom: 0.25rem !important; }
.form-control, .form-select {
    padding: 0.55rem 0.75rem;
    font-size: 0.95rem;
    min-height: 42px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background-color: var(--surface);
    color: var(--text);
    box-shadow: none;
}
.form-control::placeholder { color: var(--placeholder); }
.form-control:focus, .form-select:focus {
    background-color: var(--surface);
    color: var(--text);
}
.form-control:focus, .form-select:focus, .form-check-input:focus, .btn:focus-visible {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.input-group-text {
    background: var(--surface-muted);
    border-color: var(--border-strong);
    color: var(--muted);
    font-size: 0.8rem;
    padding: 0 0.7rem;
}
.input-group > .form-control:not(:first-child), .input-group > .input-group-text:not(:first-child) { border-left: 0; }
.form-text { font-size: 0.82rem; margin-top: 0.2rem; }
.mb-2:has(> .input-group) { margin-bottom: 0.75rem !important; }
.form-check-input { background-color: var(--surface); border-color: var(--border-strong); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }

.invalid { outline: 1px solid var(--danger); }
.validation-message { color: var(--danger); font-size: 0.75rem; }

/* ===== Buttons ===== */
.btn { padding: 0.55rem 1.15rem; border-radius: var(--radius); font-weight: 500; box-shadow: none !important; }
.btn-sm { padding: 0.3rem 0.75rem; }
.btn-link { padding: 0; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover, .btn-primary:active, .btn-primary:focus {
    background: var(--accent-strong) !important;
    border-color: var(--accent-strong) !important;
    color: var(--on-accent) !important;
}
.btn-quiet { background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); }
.btn-quiet:hover { background: var(--surface-muted); border-color: var(--border-strong); color: var(--text); }

.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "An error has occurred."; }

/* ===== Top nav ===== */
.app-nav {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.app-nav-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 1.75rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.brand:hover { color: var(--text); text-decoration: none; }
.brand svg { width: 20px; height: 20px; color: var(--accent); }
.brand-accent { color: var(--accent); }
.app-nav-links { display: flex; gap: 1.25rem; height: 100%; }
.app-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 100%;
    font-weight: 500;
    white-space: nowrap;
    color: var(--muted);
    border-bottom: 2px solid transparent;
}
.app-nav-link:hover { color: var(--text); text-decoration: none; }
.app-nav-link.active { color: var(--accent); border-bottom-color: var(--accent); }
.app-nav-link .count {
    font-size: 0.7rem;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0 0.45rem;
    color: var(--muted);
}
.app-nav-note { font-size: 0.75rem; color: var(--muted); }

.theme-toggle {
    margin-left: auto;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface-muted);
    color: var(--text);
    cursor: pointer;
}
.theme-toggle:hover { border-color: var(--border-strong); }
.theme-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ===== Building blocks ===== */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-bottom: 1rem; }
.panel-title { font-size: 1.1rem; font-weight: 600; margin: 0; }
.eyebrow { font-size: 0.75rem; color: var(--muted); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.25rem 0.8rem;
    font-size: 0.85rem;
    background: var(--surface-muted);
    white-space: nowrap;
}
.chip .chip-label { color: var(--muted); }

.tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--muted);
    vertical-align: middle;
}
.tag-success { background: var(--success-soft); color: var(--success); }

.segmented {
    display: inline-flex;
    padding: 2px;
    gap: 2px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label, .segmented button {
    margin: 0;
    padding: 0.25rem 0.85rem;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--muted);
    font-size: 0.85rem;
    cursor: pointer;
    line-height: 1.6;
}
.segmented input:checked + label, .segmented button.on {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 0 0 1px var(--border);
}
.segmented input:focus-visible + label { box-shadow: 0 0 0 3px var(--accent-soft); }

.check { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--text); cursor: pointer; }
.check .form-check-input { margin: 0; }

.hint { font-size: 0.9rem; color: var(--muted); line-height: 1.55; }
.hint summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.hint ul { margin: 0.5rem 0 0; padding-left: 1.2rem; }
.hint li { margin-bottom: 0.35rem; }

/* ===== Hero ===== */
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 1.5rem 2.5rem;
    align-items: center;
    padding: 2.25rem 2.5rem;
    margin: 0.5rem 0 1.5rem;
    border-radius: var(--radius-lg);
    background: var(--hero-bg);
    border: 1px solid var(--hero-border);
}
.hero-eyebrow {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--surface);
    border: 1px solid var(--hero-border);
    border-radius: 999px;
    padding: 0.2rem 0.75rem;
    margin-bottom: 0.9rem;
}
.hero-title { font-size: 2.15rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 0.75rem; color: var(--text); }
.hero-lead { font-size: 1.05rem; color: var(--label); line-height: 1.6; margin: 0; max-width: 36rem; }
.hero-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.hero-steps li {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    box-shadow: var(--shadow);
}
.hero-steps strong { display: block; font-size: 0.95rem; }
.hero-steps span:not(.step-num) { display: block; font-size: 0.85rem; color: var(--muted); }
.step-num {
    flex: 0 0 auto;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 700;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.page-heading { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.01em; margin: 0.25rem 0 1rem; }

/* ===== Usage strip ===== */
.usage-strip { padding: 0.85rem 1.1rem; }
.usage-strip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.usage-strip-row .eyebrow { margin-right: 0.35rem; }
.usage-editor { border-top: 1px solid var(--border); margin-top: 0.6rem; padding-top: 0.75rem; }
.split-helper { background: var(--surface-muted); border-radius: var(--radius); padding: 0.6rem 0.75rem; }

/* ===== Quote form ===== */
.rate-row { margin-bottom: 0.5rem; }
.collapsible-row { border-top: 1px solid var(--border); }
.collapsible-row:last-of-type { border-bottom: 1px solid var(--border); }
.collapsible-row > summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0;
    cursor: pointer;
    font-size: 0.9rem;
}
.collapsible-row > summary::-webkit-details-marker { display: none; }
.collapsible-row > summary::after { content: "+"; color: var(--muted); width: 1rem; text-align: center; }
.collapsible-row[open] > summary::after { content: "−"; }
.collapsible-row .summary-value { margin-left: auto; color: var(--muted); font-size: 0.8rem; text-align: right; }
.collapsible-body { padding: 0.1rem 0 0.75rem; }

/* ===== Estimate ===== */
.estimate { padding: 1.5rem; position: sticky; top: 76px; border-top: 4px solid var(--accent); }
.big-figure { font-size: 2.6rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; color: var(--accent); }
.big-figure .per { font-size: 0.95rem; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.estimate-sub { color: var(--muted); margin-bottom: 1rem; }
.breakdown-list { border-top: 1px solid var(--border); margin-bottom: 0.75rem; }
.breakdown-item { display: flex; justify-content: space-between; gap: 1rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border); }
.breakdown-item .detail { font-size: 0.72rem; color: var(--muted); }
.breakdown-item .amount { white-space: nowrap; font-variant-numeric: tabular-nums; }
.breakdown-item.credit .amount { color: var(--success); }
.note { font-size: 0.78rem; border-radius: var(--radius); padding: 0.35rem 0.6rem; margin-bottom: 0.4rem; background: var(--warning-soft); color: var(--warning); }
.fine-print { font-size: 0.72rem; color: var(--muted); margin: 0.75rem 0 0; }

/* ===== Saved quotes strip ===== */
.saved-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.75rem 0.9rem; margin-top: 1.25rem; }
.quote-chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--surface);
    font-size: 0.8rem;
    overflow: hidden;
}
.quote-chip.cheapest { border-color: var(--success); }
.quote-chip.editing { background: var(--accent-soft); border-color: var(--accent); }
.quote-chip-main { border: 0; background: transparent; padding: 0.2rem 0.4rem 0.2rem 0.75rem; display: inline-flex; gap: 0.4rem; align-items: center; color: var(--text); }
.quote-chip-main .amt { color: var(--muted); font-variant-numeric: tabular-nums; }
.quote-chip.cheapest .amt { color: var(--success); }
.chip-actions { display: inline-flex; opacity: 0; transition: opacity 0.15s; }
.quote-chip:hover .chip-actions, .quote-chip:focus-within .chip-actions { opacity: 1; }
.chip-actions button { border: 0; background: transparent; color: var(--muted); font-size: 0.75rem; padding: 0.2rem 0.45rem; }
.chip-actions button:hover { color: var(--text); }
.chip-actions button.delete:hover { color: var(--danger); }

/* ===== Compare ===== */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.page-title { font-size: 1.35rem; font-weight: 600; margin: 0; }
.cost-bars { padding: 1rem 1.25rem; margin-bottom: 1rem; }
.cost-bar { height: 0.6rem; border-radius: 999px; background: var(--bar); min-width: 2px; }
.cost-bar.cheapest { background: var(--success); }
.bar-label { width: 14rem; flex-shrink: 0; }
.bar-value { width: 7.5rem; flex-shrink: 0; font-variant-numeric: tabular-nums; }

.compare-wrap { overflow-x: auto; }
.compare-table { margin: 0; --bs-table-bg: transparent; --bs-table-color: var(--text); color: var(--text); }
.compare-table th, .compare-table td { min-width: 9rem; border-color: var(--border); padding: 0.45rem 0.75rem; }
.compare-table td:first-child, .compare-table th:first-child { min-width: 12rem; white-space: nowrap; color: var(--muted); }
.compare-table thead th { font-weight: 600; vertical-align: top; border-bottom: 1px solid var(--border-strong); }
.compare-table td.num { font-variant-numeric: tabular-nums; }
.compare-table .is-cheapest { background: var(--success-soft); }
.compare-table .section-row td { background: var(--surface-muted); font-size: 0.75rem; color: var(--muted); font-weight: 500; }
.compare-table .total-row td { font-weight: 600; color: var(--text); }

/* ===== Pages and footer ===== */
.prose { max-width: none; }
.prose h2 { font-size: 1rem; font-weight: 600; margin: 1.5rem 0 0.4rem; }
.prose p, .prose li { color: var(--text); line-height: 1.6; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem 1.5rem; font-size: 0.9rem; font-weight: 500; }
.footer-copy { margin: 0.6rem 0 0; }

/* ===== Shell (index.html) ===== */
.app-loading { max-width: 1240px; margin: 3rem auto; padding: 0 1rem; color: var(--muted); }

#blazor-error-ui {
    background: var(--warning-soft);
    color: var(--warning);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.15);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* ===== Responsive ===== */
@media (max-width: 991.98px) {
    .estimate { position: static; }
    .hero { grid-template-columns: 1fr; padding: 1.75rem 1.5rem; }
}
@media (max-width: 576px) {
    .app-nav-inner { gap: 0.9rem; }
    .app-nav-links { gap: 0.9rem; }
    .app-nav-link.nav-about { display: none; }
    .brand { font-size: 1rem; }
    .hero { padding: 1.5rem 1.15rem; }
    .hero-title { font-size: 1.7rem; }
    .big-figure { font-size: 2.2rem; }
    .bar-label { width: 7rem; }
    .bar-value { width: 6rem; }
}
@media (max-width: 420px) {
    .brand-name { display: none; }
}

/* ===== Larger supporting text ===== */
.hero-steps strong { font-size: 1.05rem; }
.hero-steps span:not(.step-num) { font-size: 0.95rem; }
.form-label { font-size: 0.9rem; }
.eyebrow { font-size: 0.9rem; font-weight: 500; }
.chip { font-size: 0.95rem; }
.collapsible-row > summary { font-size: 1rem; padding: 0.65rem 0; }
.collapsible-row .summary-value { font-size: 0.9rem; }
.fine-print { font-size: 0.85rem; line-height: 1.5; }
.saved-strip .small { font-size: 0.95rem; }
.quote-chip { font-size: 0.9rem; }

/* ===== FAQ ===== */
.faq { padding: 1.25rem 1.5rem 0.5rem; margin-top: 1.25rem; }
.faq .panel-title { margin-bottom: 0.5rem; }
.faq .collapsible-row > summary { font-weight: 500; justify-content: space-between; }
.faq .collapsible-row:last-of-type { border-bottom: 0; }
.faq .collapsible-body { color: var(--label); line-height: 1.6; padding-bottom: 1rem; max-width: 60rem; }
