﻿:root {
    --bg: #f7f8fa;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --accent: #4f46e5;
    --accent-soft: rgba(79, 70, 229, 0.12);
    --teal: #0ea5a4;
    --green: #16a34a;
    --yellow: #d97706;
    --red: #dc2626;
    --shadow: 0 18px 50px rgba(15, 23, 42, 0.06);
    --font: "Segoe UI", "Segoe UI Variable", Roboto, Arial, "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: var(--font);
    background: linear-gradient(135deg, #1a1f3a 0%, #2d1b4e 50%, #1a1a2e 100%);
    color: #f3f4f6;
}
button, input { font: inherit; }
.app-shell { max-width: 1440px; margin: 0 auto; padding: 0 20px 48px; }
.topbar, .section-head, .actions, .tabs, .topbar-meta, .legend, .kpi-subvalues { display: flex; gap: 12px; align-items: center; }
.topbar, .section-head { justify-content: space-between; }
.eyebrow { margin: 0 0 8px; color: #93c5fd; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
h1, h2, h3, p { margin: 0; }
h1 {
    font-weight: 800;
    font-size: clamp(34px, 5vw, 54px);
    line-height: 1.02;
    letter-spacing: -0.03em;
    background: linear-gradient(90deg, #8b5cf6 0%, #60a5fa 48%, #6ee7d2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
h2 {
    display: inline-block;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.02em;
    background: linear-gradient(90deg, #8b5cf6 0%, #60a5fa 46%, #6ee7d2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 24px;
    padding: 28px 0 16px;
    background: linear-gradient(135deg, #1a1f3a 0%, #2d1b4e 50%, #1a1a2e 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.tabs {
    flex-wrap: wrap;
    padding: 8px;
    margin-bottom: 24px;
    background: rgba(45, 27, 78, 0.6);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 20px;
}
.tab, .button {
    border: none;
    border-radius: 14px;
    padding: 12px 16px;
    cursor: pointer;
    transition: 0.2s ease;
}
.tab { background: transparent; color: #a1a1a1; }
.tab:hover, .tab.is-active { color: #a78bfa; background: rgba(167, 139, 250, 0.15); }
.button { background: var(--accent); color: #fff; font-weight: 500; box-shadow: 0 10px 25px rgba(79,70,229,0.18); }
.button.secondary { background: rgba(255,255,255,0.1); color: #e5e7eb; border: 1px solid rgba(255,255,255,0.2); box-shadow: none; }
.button:hover, .tab:hover { transform: translateY(-1px); }
.badge {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e5e7eb;
    white-space: nowrap;
}
.badge.subtle { color: #a1a1a1; }
.page, .panel, .grid, .scenario-form, .text-stack, .preset-list, .inline-alerts { display: grid; gap: 20px; }
.panel { display: none; }
.panel.is-active { display: grid; }
.dashboard-kpis {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    max-width: 100%;
    gap: 20px;
}
.kpi-row-1 {
    min-width: auto;
}
.kpi-row-1:nth-child(1) {
    grid-column: 1 / 4;
}
.kpi-row-1:nth-child(2) {
    grid-column: 4 / 7;
}
.kpi-card:not(.kpi-row-1) {
    grid-column: span 2;
}
.charts-grid, .insights-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.sensitivity-grid { grid-template-columns: 2fr 1fr; }
.dash-charts-grid { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.card-wide { grid-column: 1 / -1; }
.chart-host-tall { min-height: 300px; }
.chart-host-wide { min-height: 360px; }
.chart-svg-lines { display: block; }
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 20px;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--muted);
}
.chart-leg {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.chart-leg svg { flex-shrink: 0; }
.dash-range-card .section-head { align-items: flex-end; }
.model-info-collapsible {
    margin: 0 0 24px 0;
}
.model-info-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    transition: all 0.3s ease;
}
.model-info-toggle:hover {
    color: #3f33cc;
}
.toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 12px;
}
.model-info-toggle[aria-expanded="true"] .toggle-icon {
    transform: rotate(90deg);
}
.model-info-content {
    margin-top: 12px;
    animation: slideDown 0.3s ease;
}
@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}
.dash-range-card .section-head { align-items: flex-end; }
.dash-range-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}
.dash-range-grid {
    display: grid;
    grid-template-columns: repeat(2, 140px);
    gap: 12px;
    width: auto;
    margin-left: auto;
}
.dash-range-label { font-size: 13px; color: var(--muted); }
.dash-range-select {
    font: inherit;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    width: 100%;
    cursor: pointer;
}
.dash-range-select:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.14);
}
.card {
    background: var(--card);
    border: 1px solid rgba(229, 231, 235, 0.9);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.3);
    color: var(--text);
}
.card p { color: #6b7280; }
.card h2 { background: linear-gradient(90deg, #8b5cf6 0%, #60a5fa 46%, #6ee7d2 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; font-weight: 800; }
.kpi-card { padding: 22px; position: relative; overflow: hidden; }
.kpi-card > p {
    color: #14d8c4;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 6px;
}
.kpi-card::after {
    content: "";
    position: absolute;
    inset: auto -20px -30px auto;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(79,70,229,0.12), transparent 65%);
}
.kpi-value { font-size: 28px; font-weight: 600; margin: 10px 0 6px; color: var(--text); }
.kpi-card .kpi-subvalues { gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.kpi-card .kpi-subvalues span { display: block; }
.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 13px;
    background: #f3f4f6;
    color: var(--text);
}
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--green); }
.dot.yellow { background: var(--yellow); }
.dot.red { background: var(--red); }
.dot.gray { background: #9ca3af; }
.delta { margin-top: 10px; font-size: 13px; color: var(--muted); }
.chart-host { min-height: 320px; position: relative; }
.chart-svg { width: 100%; height: 100%; overflow: visible; }
.structure-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
.structure-card {
    padding: 14px 16px;
    border: 1px solid rgba(196, 221, 255, 0.22);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, rgba(243,248,255,0.08) 100%);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}
.structure-card h3 {
    margin-bottom: 2px;
    font-size: 16px;
    font-weight: 600;
}
.structure-card p {
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 13px;
}
.waterfall-host {
    display: grid;
    gap: 8px;
}
.waterfall-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.waterfall-total {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}
.waterfall-note {
    color: var(--muted);
    font-size: 13px;
}
.waterfall-track {
    position: relative;
    display: flex;
    align-items: stretch;
    min-height: 76px;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255,255,255,0.08);
    transition: width 0.3s ease;
}
.waterfall-segment {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-width: 70px;
    padding: 10px 12px;
    color: #fff;
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
    word-break: break-word;
    border-right: 1px solid rgba(255,255,255,0.18);
}
.waterfall-segment:last-child {
    border-right: none;
}
.waterfall-segment > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.waterfall-segment span {
    display: block;
    font-weight: 600;
}
.waterfall-caption {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 12px;
}
.waterfall-chip {
    display: inline-flex;
    align-items: center;
    padding: 9px 14px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.01em;
}
.waterfall-chip-increase {
    background: rgba(220, 234, 255, 0.9);
    border: 1px solid rgba(167, 199, 255, 0.95);
    color: #5f86c7;
}
.waterfall-chip-decrease {
    background: rgba(220, 247, 239, 0.92);
    border: 1px solid rgba(160, 229, 202, 0.95);
    color: #4da38d;
}
.tooltip, .toast {
    position: fixed;
    z-index: 50;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(17,24,39,0.95);
    color: #fff;
    max-width: 360px;
    pointer-events: none;
}
.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 720px; }
.table th, .table td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--text); }
.table th { color: var(--muted); font-weight: 500; font-size: 13px; }
.table-note {
    margin: -6px 0 10px;
    color: var(--muted);
    font-size: 13px;
}
.table-data thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f8fafc;
    box-shadow: inset 0 -1px 0 var(--line);
}
.table-data th:first-child,
.table-data td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 96px;
    width: 96px;
    white-space: nowrap;
    background: #fff;
}
.table-data thead th:first-child {
    z-index: 4;
}
.table-data input {
    width: 100%;
    min-width: 120px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
}
.data-table-wrap { max-height: 70vh; }
.nwc-breakdown-table {
    min-width: auto;
    width: 100%;
}
.nwc-breakdown-table th {
    background: #dbeafe;
    border-bottom: 4px solid #3b82f6;
    padding: 14px 10px;
    font-weight: 600;
    font-size: 13px;
    color: #0c4a6e;
}
.nwc-breakdown-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e8ebf2;
}
.nwc-breakdown-table tbody tr:last-child td {
    border-bottom: 3px solid #3b82f6;
}
.nwc-toggle-btn {
    transition: all 0.2s ease;
}
.nwc-toggle-btn:hover {
    color: #1e40af;
    transform: scale(1.2);
}
.scenario-form { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.field { display: grid; gap: 8px; }
.field label { color: var(--muted); font-size: 14px; }
.field input { padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: #fff; color: var(--text); }
.scenario-result, .note, .text-item, .warning-item {
    padding: 16px 18px;
    background: #f8fafc;
    border-radius: 18px;
    border: 1px solid var(--line);
    color: var(--text);
}
.scenario-total { font-size: 24px; color: var(--accent); font-weight: 500; }
.preset-list { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.preset {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(180deg, #fff 0%, #fbfdff 100%);
    cursor: pointer;
}
.inline-alerts { margin-bottom: 12px; }
.inline-alert { padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(217, 119, 6, 0.3); background: rgba(217, 119, 6, 0.1); color: #fbbf24; }
@media (max-width: 900px) {
    .topbar, .section-head { flex-direction: column; align-items: stretch; }
    .topbar-meta, .actions { flex-wrap: wrap; }
    .app-shell { padding-inline: 14px; }
    .card { padding: 18px; border-radius: 20px; }
    .dash-range-card .section-head { align-items: stretch; }
    .dash-range-wrap { align-items: stretch; }
    .dash-range-grid { grid-template-columns: 1fr; width: 100%; }
    .dash-range-select { min-width: 0; width: 100%; }
}
