/* ══════════════════════════════════════════════════════════════════════
   EasyToolio — AI Token & API Cost Calculator
   Billing-meter workspace. Token types share one colour code everywhere:
   input = blue, cached = amber, output = violet, savings = green.
   ══════════════════════════════════════════════════════════════════════ */

.atc {
    --atc-ink: #0b1220;
    --atc-text: #0f172a;
    --atc-muted: #64748b;
    --atc-line: #e4e8ef;
    --atc-surface: #ffffff;
    --atc-sunken: #f6f8fb;
    --atc-input: #2563eb;
    --atc-cached: #f59e0b;
    --atc-output: #7c5cff;
    --atc-good: #059669;
    --atc-radius: 1.25rem;
    /* Same family and numeral style as the rest of the tools (app.css --font-sans). */
    --atc-display: 'Inter', system-ui, -apple-system, sans-serif;
    --atc-mono: 'Inter', system-ui, -apple-system, sans-serif;
    --atc-code: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
    font-feature-settings: "tnum";
}

html.dark .atc {
    --atc-text: #f1f5f9;
    --atc-muted: #94a3b8;
    --atc-line: rgba(255, 255, 255, 0.08);
    --atc-surface: rgba(24, 24, 27, 0.72);
    --atc-sunken: rgba(255, 255, 255, 0.03);
    --atc-input: #60a5fa;
    --atc-cached: #fbbf24;
    --atc-output: #a78bfa;
    --atc-good: #34d399;
}

/* JS toggles `.hidden` on these; keep it authoritative over component display rules. */
#custom-model-settings.hidden,
#fx-rate-wrapper.hidden,
#savings-callout-box.hidden,
#panel-mode-tokens.hidden,
#panel-mode-text.hidden {
    display: none !important;
}

.atc :focus-visible {
    outline: 2px solid var(--atc-input);
    outline-offset: 2px;
}

/* ── Toolbar ─────────────────────────────────────────────────────────── */

.atc-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: var(--atc-muted);
    background: var(--atc-surface);
    border: 1px solid var(--atc-line);
}

.atc-pill--brand {
    color: #1d4ed8;
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.2);
}

html.dark .atc-pill--brand {
    color: #93c5fd;
}

.atc-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.8rem;
    border-radius: 0.75rem;
    font-size: 12px;
    font-weight: 600;
    color: var(--atc-text);
    background: var(--atc-surface);
    border: 1px solid var(--atc-line);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.atc-btn i {
    color: var(--atc-muted);
}

.atc-btn:hover {
    border-color: rgba(37, 99, 235, 0.45);
}

.atc-btn--primary {
    color: #1d4ed8;
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.25);
}

.atc-btn--primary i {
    color: inherit;
}

html.dark .atc-btn--primary {
    color: #93c5fd;
}

/* ── Jump navigation ─────────────────────────────────────────────────── */

.atc-jump {
    margin-bottom: 1.5rem;
}

.atc-jump-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    padding: 0 0.25rem;
}

.atc-jump-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--atc-muted);
}

.atc-jump-title i {
    color: var(--atc-input);
    margin-right: 0.25rem;
}

.atc-jump-hint {
    font-size: 11px;
    color: var(--atc-muted);
    opacity: 0.8;
}

@media (max-width: 639px) {
    .atc-jump-hint {
        display: none;
    }
}

.atc-jump-track {
    display: flex;
    gap: 0.375rem;
    padding: 0.375rem;
    overflow-x: auto;
    scrollbar-width: none;
    border-radius: 1rem;
    background: var(--atc-surface);
    border: 1px solid var(--atc-line);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.atc-jump-track::-webkit-scrollbar {
    display: none;
}

.atc-jump .btn-section-tab {
    flex: 1 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem 0.9rem;
    border-radius: 0.75rem;
    border: 0;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--atc-muted);
    background: transparent;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.atc-jump .btn-section-tab:hover {
    color: var(--atc-text);
    background: var(--atc-sunken);
}

/* !important: the tool JS adds `text-white`, which app.css forces dark in light mode. */
.atc .atc-jump .btn-section-tab.active-section-tab {
    color: #ffffff !important;
    background: var(--atc-ink);
    box-shadow: 0 6px 16px -8px rgba(11, 18, 32, 0.6);
}

html.dark .atc .atc-jump .btn-section-tab.active-section-tab {
    color: var(--atc-ink) !important;
    background: #f1f5f9;
}

/* ── Cards ───────────────────────────────────────────────────────────── */

.atc-card {
    background: var(--atc-surface);
    border: 1px solid var(--atc-line);
    border-radius: var(--atc-radius);
    padding: 1.25rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -16px rgba(15, 23, 42, 0.12);
}

html.dark .atc-card {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.5);
}

@media (min-width: 640px) {
    .atc-card {
        padding: 1.5rem;
    }
}

.atc-card-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.atc-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.6rem;
    font-family: var(--atc-display);
    font-size: 0.875rem;
    font-weight: 700;
    color: #ffffff;
    background: var(--atc-ink);
    flex-shrink: 0;
}

html.dark .atc-step {
    color: var(--atc-ink);
    background: #e2e8f0;
}

.atc-card-title {
    font-family: var(--atc-display);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--atc-text);
}

.atc-card-head-aside {
    margin-left: auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.atc-private {
    font-size: 11px;
    font-weight: 600;
    color: var(--atc-good);
}

.atc-subpanel {
    padding: 1rem;
    border-radius: 0.9rem;
    background: var(--atc-sunken);
    border: 1px solid var(--atc-line);
}

.atc-subpanel-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 12px;
    font-weight: 700;
    color: var(--atc-input);
}

/* ── Form controls ───────────────────────────────────────────────────── */

.atc-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.45rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--atc-text);
}

.atc-label--sm {
    font-size: 0.6875rem;
    color: var(--atc-muted);
}

.atc-help {
    margin-top: 0.4rem;
    font-size: 0.6875rem;
    line-height: 1.5;
    color: var(--atc-muted);
}

.input-field-custom {
    width: 100%;
    min-height: 40px;
    padding: 0.5rem 0.875rem;
    border-radius: 0.75rem;
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--atc-text, #0f172a);
    background: #ffffff;
    border: 1px solid #d5dbe5;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

html.dark .input-field-custom {
    background: rgba(9, 9, 11, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
}

.input-field-custom:hover {
    border-color: #b8c2d1;
}

html.dark .input-field-custom:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.input-field-custom:focus {
    outline: none;
    border-color: var(--atc-input, #3b82f6);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.atc-select {
    font-weight: 500;
    cursor: pointer;
    text-overflow: ellipsis;
}

.atc-big-input {
    font-family: var(--atc-display);
    font-size: 0.875rem;
    font-weight: 700;
    height: 40px;
    padding-right: 4.5rem;
    font-variant-numeric: tabular-nums;
}

.atc-mini-input {
    width: 4.25rem;
    min-height: 0;
    padding: 0.35rem 0.5rem;
    text-align: right;
    font-family: var(--atc-mono);
    font-size: 12px;
}

.atc-textarea {
    font-family: var(--atc-code);
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.65;
    resize: vertical;
}

.atc-unit {
    position: relative;
}

.atc-unit-suffix {
    position: absolute;
    right: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    font-weight: 600;
    color: var(--atc-muted);
    pointer-events: none;
}

.atc-token-field--input .atc-big-input:focus {
    border-color: var(--atc-input);
}

.atc-token-field--output .atc-big-input:focus {
    border-color: var(--atc-output);
    box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18);
}

.atc-presets {
    display: flex;
    gap: 0.375rem;
    margin-top: 0.5rem;
}

.btn-token-preset {
    flex: 1;
    padding: 0.35rem 0.5rem;
    border-radius: 0.6rem;
    font-size: 0.6875rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #475569;
    background: var(--atc-sunken, #f1f5f9);
    border: 1px solid var(--atc-line, #e2e8f0);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

html.dark .btn-token-preset {
    color: #cbd5e1;
}

.btn-token-preset:hover {
    color: #ffffff;
    background: var(--atc-ink, #0b1220);
    border-color: var(--atc-ink, #0b1220);
}

html.dark .btn-token-preset:hover {
    color: var(--atc-ink, #0b1220);
    background: #f1f5f9;
    border-color: #f1f5f9;
}

.atc-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--atc-text);
    background: var(--atc-surface);
    border: 1px solid var(--atc-line);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.atc-chip:hover {
    border-color: rgba(37, 99, 235, 0.45);
    color: var(--atc-input);
}

.atc-chip.is-active {
    color: #ffffff;
    background: var(--atc-input);
    border-color: var(--atc-input);
}

html.dark .atc-chip.is-active {
    color: var(--atc-ink);
}

.atc-quickpicks {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.875rem;
}

.atc-quickpicks-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--atc-muted);
    margin-right: 0.125rem;
}

.atc-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 12px;
    color: var(--atc-text);
    cursor: pointer;
}

.atc-check input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--atc-input);
}

.atc-dot {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 999px;
    flex-shrink: 0;
}

.atc-dot--input { background: var(--atc-input); }
.atc-dot--cached { background: var(--atc-cached); }
.atc-dot--output { background: var(--atc-output); }

/* Segmented Mode A / Mode B control */
.atc-seg {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem;
    padding: 0.25rem;
    border-radius: 0.875rem;
    background: var(--atc-sunken);
    border: 1px solid var(--atc-line);
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.55rem 0.75rem;
    border-radius: 0.65rem;
    border: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--atc-muted);
    background: transparent;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.tab-btn:hover {
    color: var(--atc-text);
}

@media (max-width: 479px) {
    .tab-btn {
        padding: 0.55rem 0.4rem;
        font-size: 12px;
        white-space: nowrap;
    }

    .tab-btn i {
        display: none;
    }
}

.tab-btn.active-tab {
    color: var(--atc-text);
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 4px 12px -6px rgba(15, 23, 42, 0.18);
}

html.dark .tab-btn.active-tab {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

/* Text estimator metrics */
.atc-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-radius: 0.9rem;
    border: 1px solid var(--atc-line);
    overflow: hidden;
}

@media (min-width: 640px) {
    .atc-metrics {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.atc-metrics > div {
    padding: 0.75rem 0.875rem;
    background: var(--atc-surface);
    box-shadow: inset -1px -1px 0 var(--atc-line);
}

.atc-metric-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--atc-muted);
}

.atc-metric-value {
    margin-top: 0.15rem;
    font-family: var(--atc-display);
    font-size: 1rem;
    font-weight: 800;
    color: var(--atc-text);
    font-variant-numeric: tabular-nums;
}

.atc-metric-value--sm {
    font-size: 0.8125rem;
}

.atc-metric--accent {
    background: rgba(37, 99, 235, 0.06) !important;
}

.atc-metric--accent .atc-metric-label,
.atc-metric--accent .atc-metric-value {
    color: var(--atc-input);
}

.atc-tag {
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-family: var(--atc-mono);
    color: var(--atc-muted);
    background: var(--atc-surface);
    border: 1px solid var(--atc-line);
}

.atc-tag strong {
    color: var(--atc-text);
}

/* Cache slider */
.atc-range {
    width: 100%;
    height: 0.5rem;
    cursor: pointer;
    accent-color: var(--atc-cached);
}

.atc-range-scale {
    display: flex;
    justify-content: space-between;
    font-family: var(--atc-mono);
    font-size: 10px;
    color: var(--atc-muted);
}

@media (max-width: 479px) {
    .atc-range-scale span:nth-child(2),
    .atc-range-scale span:nth-child(4) {
        display: none;
    }
}

/* Batch toggle row */
.atc-toggle-row {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    border-radius: 0.9rem;
    background: var(--atc-sunken);
    border: 1px solid var(--atc-line);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.atc-toggle-row:hover {
    border-color: rgba(37, 99, 235, 0.35);
}

.atc-toggle-row:has(.atc-switch-input:checked) {
    border-color: rgba(37, 99, 235, 0.45);
    background: rgba(37, 99, 235, 0.06);
}

.atc-toggle-row:has(.atc-switch-input:focus-visible) {
    outline: 2px solid var(--atc-input);
    outline-offset: 2px;
}

.atc-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.7rem;
    color: var(--atc-input);
    background: rgba(37, 99, 235, 0.1);
    flex-shrink: 0;
}

.atc-switch {
    position: relative;
    width: 2.6rem;
    height: 1.5rem;
    border-radius: 999px;
    background: #cbd5e1;
    flex-shrink: 0;
    transition: background-color 0.2s ease;
}

html.dark .atc-switch {
    background: #3f3f46;
}

.atc-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease;
}

.atc-switch-input:checked + .atc-switch {
    background: var(--atc-input);
}

.atc-switch-input:checked + .atc-switch::after {
    transform: translateX(1.1rem);
}

/* Mobile live-total bar */
/* Compact pill, left-aligned so it clears the back-to-top button on the right. */
.atc-minibar {
    position: sticky;
    bottom: 5.25rem;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: fit-content;
    max-width: calc(100% - 3.75rem);
    padding: 0.4rem 0.75rem 0.4rem 0.875rem;
    border-radius: 999px;
    color: #ffffff;
    background: rgba(11, 18, 32, 0.92);
    box-shadow: 0 10px 24px -12px rgba(11, 18, 32, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    text-decoration: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.atc-minibar.is-offscreen-hidden {
    opacity: 0;
    transform: translateY(0.5rem);
    pointer-events: none;
}

html.dark .atc-minibar {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@media (min-width: 1024px) {
    .atc-minibar {
        display: none;
    }
}

.atc-minibar-label {
    display: block;
    font-size: 8.5px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #93c5fd;
}

.atc-minibar-value {
    display: block;
    font-family: var(--atc-display);
    font-size: 0.9375rem;
    font-weight: 800;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.atc-minibar-side {
    padding-left: 0.625rem;
    border-left: 1px solid rgba(148, 163, 184, 0.3);
    text-align: right;
    font-family: var(--atc-mono);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.atc-minibar-unit {
    display: block;
    font-size: 8.5px;
    font-weight: 500;
    color: #94a3b8;
}

/* ── Results: the meter ──────────────────────────────────────────────── */

@media (min-width: 1024px) {
    /* JS lowers --atc-sticky-top when the column is taller than the viewport,
       so it pins by its bottom edge instead of clipping. */
    .atc-results {
        position: sticky;
        top: var(--atc-sticky-top, 6rem);
    }
}

.atc-meter {
    position: relative;
    overflow: hidden;
    padding: 1.5rem;
    border-radius: var(--atc-radius);
    color: #e2e8f0;
    background:
        radial-gradient(120% 80% at 100% 0%, rgba(37, 99, 235, 0.35) 0%, rgba(37, 99, 235, 0) 55%),
        linear-gradient(160deg, #111a2e 0%, #0b1220 70%);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 24px 48px -24px rgba(11, 18, 32, 0.65);
}

html.dark .atc-meter {
    background:
        radial-gradient(120% 80% at 100% 0%, rgba(96, 165, 250, 0.22) 0%, rgba(96, 165, 250, 0) 55%),
        linear-gradient(160deg, #141d33 0%, #0d1424 70%);
    border-color: rgba(255, 255, 255, 0.1);
}

.atc-meter-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.atc-meter-eyebrow {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #93c5fd;
}

.atc-meter-verified {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.14);
}

.atc-meter-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #94a3b8;
}

.atc-meter-value {
    margin-top: 0.15rem;
    font-family: var(--atc-display);
    font-size: 1.875rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.025em;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

@media (min-width: 640px) {
    .atc-meter-value {
        font-size: 2.25rem;
    }
}

.atc-mix {
    margin-top: 1.25rem;
}

.atc-mix-bar {
    display: flex;
    height: 0.625rem;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(148, 163, 184, 0.2);
    gap: 2px;
}

.atc-mix-seg {
    display: block;
    height: 100%;
    min-width: 0;
    transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.atc-mix-seg--input { background: #3b82f6; }
.atc-mix-seg--cached { background: #f59e0b; }
.atc-mix-seg--output { background: #8b6cff; }

.atc-mix-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    margin-top: 0.65rem;
    font-size: 0.6875rem;
    color: #cbd5e1;
}

.atc-mix-legend li {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.atc-mix-legend b {
    font-family: var(--atc-mono);
    font-weight: 700;
    color: #ffffff;
}

.atc-meter .atc-dot--input { background: #3b82f6; }
.atc-meter .atc-dot--cached { background: #f59e0b; }
.atc-meter .atc-dot--output { background: #8b6cff; }

.atc-meter-savings {
    margin-top: 1rem;
    padding: 0.7rem 0.85rem;
    border-radius: 0.8rem;
    font-size: 12px;
    line-height: 1.5;
    color: #a7f3d0;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.28);
}

.atc-meter-savings strong {
    color: #ffffff;
}

.atc-meter-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 1.25rem;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.atc-meter-kpis > div {
    padding: 0.9rem 0.5rem 0;
}

.atc-meter-kpis > div:first-child {
    padding-left: 0;
}

.atc-meter-kpis > div + div {
    border-left: 1px solid rgba(148, 163, 184, 0.18);
    padding-left: 0.75rem;
}

.atc-meter-kpi-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
}

.atc-meter-kpi-value {
    display: block;
    margin-top: 0.2rem;
    font-family: var(--atc-display);
    font-size: 0.875rem;
    font-weight: 700;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

@media (max-width: 419px) {
    .atc-meter-kpis {
        grid-template-columns: 1fr;
    }

    .atc-meter-kpis > div,
    .atc-meter-kpis > div:first-child,
    .atc-meter-kpis > div + div {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 1rem;
        padding: 0.6rem 0;
        border-left: 0;
    }

    .atc-meter-kpis > div + div {
        border-top: 1px solid rgba(148, 163, 184, 0.18);
    }

    .atc-meter-kpi-value {
        margin-top: 0;
    }
}

/* ── Report actions ──────────────────────────────────────────────────── */

.atc-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

#atc-export-dropdown.hidden {
    display: none !important;
}

/* Shared custom dropdown: same height as the other inputs on this page. */
.atc .fin-dd-btn {
    min-height: 40px;
}

/* ── Receipt / line-item lists ───────────────────────────────────────── */

.atc-receipt-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--atc-muted);
}

.atc-receipt-title i {
    color: var(--atc-input);
}

.atc-lines {
    font-size: 0.75rem;
}

.atc-lines--money {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--atc-line);
}

.atc-lines--boxed {
    padding: 0.25rem 1rem;
    border-radius: 0.9rem;
    background: var(--atc-sunken);
    border: 1px solid var(--atc-line);
}

.atc-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0;
}

.atc-line + .atc-line {
    border-top: 1px solid var(--atc-line);
}

.atc-line dt {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--atc-muted);
}

.atc-line dd {
    font-family: var(--atc-mono);
    font-weight: 700;
    color: var(--atc-text);
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.atc-line--sub dt {
    color: var(--atc-text);
    font-weight: 600;
}

.atc-line--total {
    padding-top: 0.7rem;
}

.atc-line--total dt {
    color: var(--atc-text);
    font-weight: 700;
    font-size: 0.8125rem;
}

.atc-line--total dd {
    font-family: var(--atc-display);
    font-size: 1rem;
    font-weight: 800;
    color: var(--atc-input);
}

.atc-dd-good {
    color: var(--atc-good) !important;
}

/* ── Lower sections ──────────────────────────────────────────────────── */

.atc-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.atc-eyebrow {
    display: block;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--atc-input);
}

.atc-section-title {
    margin-top: 0.2rem;
    font-family: var(--atc-display);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--atc-text);
}

.atc-section-title--lg {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1rem;
}

.atc-section-title--lg i {
    color: var(--atc-input);
}

.atc-section-note {
    font-size: 0.75rem;
    color: var(--atc-muted);
}

/* Tables */
.table-responsive-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0.9rem;
    border: 1px solid var(--atc-line, #e4e8ef);
}

/* Comparison table: JS caps the height at 12 rows, then this scrolls. */
.table-responsive-wrapper:has(.atc-table--compare) {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
}

.atc-table--compare thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f6f8fb;
}

html.dark .atc-table--compare thead th {
    background: #1c1c21;
}

.table-responsive-wrapper::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.table-responsive-wrapper::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 999px;
}

.atc-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.78rem;
    text-align: left;
}

.atc-table th {
    padding: 0.75rem 1rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--atc-muted);
    background: var(--atc-sunken);
    border-bottom: 1px solid var(--atc-line);
}

.atc-table th.atc-th-accent {
    color: var(--atc-input);
}

.atc-table td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--atc-line);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.atc-table tbody tr:last-child td {
    border-bottom: 0;
}

.atc-table tbody tr:hover td {
    background: rgba(37, 99, 235, 0.03);
}

.atc-table--compare td:first-child {
    white-space: normal;
    min-width: 11rem;
}

.atc-table--compare tr.atc-row-active td {
    background: rgba(37, 99, 235, 0.07);
}

.atc-table--compare tr.atc-row-active td:first-child {
    box-shadow: inset 3px 0 0 var(--atc-input);
}

.atc-cost-cell {
    min-width: 8.5rem;
}

.atc-cost-track {
    display: block;
    height: 4px;
    margin-top: 0.35rem;
    margin-left: auto;
    border-radius: 999px;
    background: var(--atc-line);
    overflow: hidden;
}

.atc-cost-fill {
    display: block;
    height: 100%;
    margin-left: auto;
    border-radius: 999px;
    background: var(--atc-input);
    transition: width 0.4s ease;
}

.atc-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 0.35rem;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    vertical-align: middle;
}

.atc-badge--active {
    color: #ffffff;
    background: var(--atc-input);
}

html.dark .atc-badge--active {
    color: var(--atc-ink);
}

.atc-badge--low {
    color: var(--atc-good);
    background: rgba(5, 150, 105, 0.12);
}

/* Forecast / optimizer stat strip */
.atc-stats {
    display: grid;
    grid-template-columns: 1fr;
    margin-bottom: 1.25rem;
    border-radius: 0.9rem;
    border: 1px solid var(--atc-line);
    background: var(--atc-sunken);
}

@media (min-width: 640px) {
    .atc-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.atc-stats > div {
    padding: 0.9rem 1rem;
}

.atc-stats > div + div {
    border-top: 1px solid var(--atc-line);
}

@media (min-width: 640px) {
    .atc-stats > div + div {
        border-top: 0;
        border-left: 1px solid var(--atc-line);
    }
}

.atc-stat-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--atc-muted);
}

.atc-stat-value {
    margin-top: 0.2rem;
    font-family: var(--atc-display);
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--atc-text);
    font-variant-numeric: tabular-nums;
}

.atc-stat-value--accent { color: var(--atc-input); }
.atc-stat-value--output { color: var(--atc-output); }

/* Scenarios */
.atc-scenarios {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

/* Phones: one row per scenario — label left, cost and volume right. */
.atc-scenario {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "label cost"
        "label reqs";
    align-items: center;
    column-gap: 0.75rem;
    min-width: 0;
    padding: 0.75rem 1rem;
    border-radius: 0.9rem;
    background: var(--atc-sunken);
    border: 1px solid var(--atc-line);
}

.atc-scenario-label { grid-area: label; }
.atc-scenario-cost { grid-area: cost; text-align: right; }
.atc-scenario-reqs { grid-area: reqs; text-align: right; }

@media (min-width: 480px) {
    .atc-scenarios {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.625rem;
    }

    .atc-scenario {
        display: block;
        padding: 0.9rem 0.625rem;
        text-align: center;
    }

    .atc-scenario-cost,
    .atc-scenario-reqs {
        text-align: center;
    }
}

.atc-scenario--base {
    background: rgba(37, 99, 235, 0.07);
    border-color: rgba(37, 99, 235, 0.35);
}

.atc-scenario-label {
    display: block;
    min-width: 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--atc-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 479px) {
    .atc-scenario .atc-scenario-cost {
        margin-top: 0;
    }

    .atc-scenario .atc-scenario-label {
        font-size: 11px;
    }
}

.atc-scenario--base .atc-scenario-label,
.atc-scenario--base .atc-scenario-cost {
    color: var(--atc-input);
}

.atc-scenario--high .atc-scenario-cost {
    color: var(--atc-output);
}

.atc-scenario-cost {
    margin-top: 0.35rem;
    font-family: var(--atc-display);
    font-size: 1rem;
    font-weight: 800;
    color: var(--atc-text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.atc-scenario-reqs {
    margin-top: 0.15rem;
    white-space: nowrap;
    font-family: var(--atc-mono);
    font-size: 11px;
    color: var(--atc-muted);
}

.atc-scenario-reqs::after {
    content: ' reqs';
}

/* Optimizer savings */
.atc-savings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-radius: 0.9rem;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.atc-savings-grid > div {
    padding: 0.9rem 1rem;
}

.atc-savings-grid > div + div {
    border-left: 1px solid rgba(16, 185, 129, 0.25);
}

.atc-savings-grid .atc-stat-label {
    color: var(--atc-good);
}

.atc-savings-grid .atc-stat-value {
    color: var(--atc-good);
}

/* Explainers */
.atc-explainer {
    padding: 1.1rem;
    border-radius: 0.9rem;
    background: var(--atc-sunken);
    border: 1px solid var(--atc-line);
    border-top-width: 3px;
}

.atc-explainer--input { border-top-color: var(--atc-input); }
.atc-explainer--cached { border-top-color: var(--atc-cached); }
.atc-explainer--output { border-top-color: var(--atc-output); }

.atc-explainer h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--atc-text);
}

.atc-explainer--input h3 i { color: var(--atc-input); }
.atc-explainer--cached h3 i { color: var(--atc-cached); }
.atc-explainer--output h3 i { color: var(--atc-output); }

.atc-explainer p {
    font-size: 0.75rem;
    line-height: 1.65;
    color: var(--atc-muted);
}

/* Sources */
.atc-sources {
    padding: 1.25rem;
    border-radius: var(--atc-radius);
    font-size: 12px;
    line-height: 1.6;
    color: var(--atc-muted);
    background: var(--atc-sunken);
    border: 1px solid var(--atc-line);
}

.atc-sources > * + * {
    margin-top: 0.5rem;
}

.atc-sources a {
    color: var(--atc-input);
}

.atc-sources a:hover {
    text-decoration: underline;
}

/* FAQ heading matches the SIP calculator's "Good to know / Questions, answered" block.
   Those styles normally live inside .tool-guide, which this page does not load. */
.atc .tool-guide {
    --tg-text: #09090b;
    --tg-body: #3f3f46;
    --tg-muted: #71717a;
    --tg-border-strong: rgba(0, 0, 0, 0.55);
}

html.dark .atc .tool-guide {
    --tg-text: #ffffff;
    --tg-body: #d4d4d8;
    --tg-muted: #8f8f99;
    --tg-border-strong: rgba(255, 255, 255, 0.60);
}

html body .atc .tool-guide h2.tg-title {
    color: var(--tg-text) !important;
    letter-spacing: -0.03em;
}

html body .atc .tool-guide .tg-body {
    color: var(--tg-body) !important;
}

.atc .tool-guide .tg-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--tg-muted) !important;
}

.atc .tool-guide .tg-eyebrow::before {
    content: "";
    width: 1.35rem;
    height: 1px;
    background: var(--tg-border-strong);
}

@media (prefers-reduced-motion: reduce) {
    .atc *,
    .atc *::after {
        transition: none !important;
    }
}
