/* ============================================================================================
   PMOP Analytics Dashboard — Tableau-familiar report styling.
   Derived from the approved reference mockup (pmop_tableau_familiar_final.html): ~85% familiar
   Tableau/report presentation, ~15% restrained modernization.

   IMPORTANT: this stylesheet is loaded application-wide from index.html, so every class is
   `analytics-` prefixed (the reference mockup's generic .panel/.tab/.report-table names would
   leak into the rest of the application). The application supplies the page shell (header,
   navigation, footer) — none of that is recreated here.
   ============================================================================================ */

.analytics-dashboard {
    /* Report palette */
    --analytics-ink: #22303c;
    --analytics-title: #123f66;
    --analytics-muted: #6e7d8b;
    --analytics-line: #cfd6de;
    --analytics-line-soft: #e6ebf0;
    --analytics-bg: #edf0f4;
    --analytics-panel: #fff;
    --analytics-blue: #3f7cc0;
    --analytics-green: #4a9d6d;
    --analytics-green-strong: #5aa84f;
    --analytics-red: #e0655c;
    --analytics-red-strong: #ee5b53;
    --analytics-amber: #c98a3c;
    --analytics-amber-strong: #e2913a;
    --analytics-neutral: #b9c0c9;
    --analytics-inconclusive: #434e5a;
    --analytics-shadow: 0 1px 4px rgba(18, 63, 102, .08);
    --analytics-radius: 4px;

    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--analytics-bg);
    color: var(--analytics-ink);
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    padding: 16px 24px 34px;
}

.analytics-dashboard *,
.analytics-dashboard *::before,
.analytics-dashboard *::after {
    box-sizing: border-box;
}

/* Report content is centered and NOT stretched across large monitors. */
.analytics-content {
    max-width: 1360px;
    margin: 0 auto;
}

/* ---- Context row: survey group (left) + freshness (right), shown ONCE ---- */
.analytics-context-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 8px;
}

.analytics-context-left {
    font-size: 13px;
    color: #5b6a79;
    font-weight: 500;
    line-height: 1.5;
}

.analytics-context-right {
    text-align: right;
    font-size: 12.5px;
    color: #657486;
    line-height: 1.5;
}

.analytics-freshness-through {
    color: #26384a;
    font-weight: 700;
}

.analytics-freshness-retrieved {
    display: block;
}

/* ---- Flat tab bar (no raised button appearance) ---- */
.analytics-tabs-wrap {
    border-bottom: 1px solid #c7ced6;
    margin-bottom: 16px;
    overflow-x: auto;
}

.analytics-tabs {
    display: flex;
    gap: 0;
    min-width: max-content;
}

.analytics-tab {
    appearance: none;
    border: 0;
    background: transparent;
    color: #607286;
    padding: 10px 15px 11px;
    cursor: pointer;
    font: inherit;
    font-size: 13.5px;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
}

.analytics-tab:hover:not(:disabled) {
    color: var(--analytics-title);
    background: #f6f8fa;
}

.analytics-tab[aria-selected="true"] {
    color: var(--analytics-title);
    font-weight: 700;
    border-bottom-color: #2f6fb6;
    background: #f8fafc;
}

.analytics-tab:focus-visible {
    outline: 2px solid #2f6fb6;
    outline-offset: -2px;
}

/* ---- Report headings ---- */
.analytics-report-head {
    margin-bottom: 13px;
}

.analytics-report-title {
    text-align: center;
    font-size: 23px;
    font-weight: 700;
    color: var(--analytics-title);
    letter-spacing: .2px;
    margin: 0;
}

.analytics-report-sub {
    text-align: center;
    font-size: 11.5px;
    color: #8794a3;
    margin-top: 4px;
}

.analytics-report-context {
    text-align: center;
    font-size: 11.5px;
    color: #8794a3;
    margin-bottom: 18px;
}

/* ---- Panels ---- */
.analytics-panel {
    background: var(--analytics-panel);
    border: 1px solid #cdd4dc;
    border-radius: var(--analytics-radius);
    box-shadow: var(--analytics-shadow);
}

.analytics-panel-title {
    font-size: 15.5px;
    font-weight: 700;
    color: #1b4f7a;
    text-align: center;
    padding: 12px 15px 10px;
    border-bottom: 1px solid var(--analytics-line-soft);
    margin: 0;
}

.analytics-panel-title--left {
    text-align: left;
}

.analytics-panel-body {
    padding: 16px 18px;
}

/* ---- Report grids ---- */
.analytics-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.analytics-grid-main {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 18px;
}

.analytics-grid-30-70 {
    display: grid;
    grid-template-columns: 30% 70%;
    gap: 18px;
}

.analytics-stack-18 {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.analytics-mt-18 {
    margin-top: 18px;
}

/* ---- Metric lines / mini cards ---- */
.analytics-metric-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 7px 0;
    border-bottom: 1px solid #f1f3f6;
    color: #5a6773;
    font-size: 13px;
}

.analytics-metric-line:last-child {
    border-bottom: 0;
}

.analytics-metric-line strong {
    font-size: 20px;
    color: var(--analytics-title);
    font-variant-numeric: tabular-nums;
}

.analytics-metric-line--amber strong {
    color: var(--analytics-amber);
}

.analytics-mini-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 11px;
    margin-top: 12px;
}

.analytics-mini-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #e0e5eb;
    border-left-width: 3px;
    border-radius: 3px;
    padding: 9px 12px;
    font-size: 12.5px;
    color: #40505e;
    background: #fff;
}

.analytics-mini-card strong {
    font-size: 18px;
    font-variant-numeric: tabular-nums;
}

.analytics-mini-card--good { border-left-color: var(--analytics-green); }
.analytics-mini-card--good strong { color: #3e7a62; }
.analytics-mini-card--fail { border-left-color: var(--analytics-red); }
.analytics-mini-card--fail strong { color: #b0122b; }
.analytics-mini-card--cold { border-left-color: var(--analytics-blue); }
.analytics-mini-card--cold strong { color: #245f9f; }
.analytics-mini-card--leak { border-left-color: var(--analytics-red); }
.analytics-mini-card--leak strong { color: #b0122b; }

/* ---- Total CDL card ---- */
.analytics-total-card {
    text-align: center;
    padding: 13px 18px;
}

.analytics-total-label {
    font-size: 11px;
    color: #8794a3;
    letter-spacing: .14em;
    font-weight: 600;
}

.analytics-total-value {
    font-size: 36px;
    color: var(--analytics-title);
    font-weight: 700;
    line-height: 1.1;
    margin-top: 3px;
    font-variant-numeric: tabular-nums;
}

/* ---- Section heading inside a panel ---- */
.analytics-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    margin-bottom: 10px;
    border-bottom: 1px solid #e2e7ec;
    color: var(--analytics-title);
    font-size: 15px;
    font-weight: 700;
}

.analytics-section-heading strong {
    font-size: 21px;
    font-variant-numeric: tabular-nums;
}

.analytics-section-heading--cold { color: var(--analytics-blue); }
.analytics-section-heading--leak { color: var(--analytics-red); }

/* ---- Failure State · Steam Trap: Tableau-familiar composition ---- */
.analytics-st-view {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.analytics-st-header {
    padding: 0 4px;
}

.analytics-st-title,
.analytics-cdl-title,
.analytics-inconclusive-title {
    margin: 0;
    color: var(--analytics-ink);
    font-size: clamp(24px, 2.3vw, 30px);
    font-weight: 700;
    line-height: 1.2;
    text-align: left;
}

.analytics-st-layout {
    display: grid;
    grid-template-columns: minmax(360px, 46%) minmax(0, 54%);
    gap: 20px;
    align-items: start;
}

.analytics-st-left,
.analytics-st-detail-stack {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 16px;
}

.analytics-st-kpi-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border: 1px solid #cdd4dc;
    border-radius: var(--analytics-radius);
    background: #fff;
    box-shadow: var(--analytics-shadow);
}

.analytics-st-kpi {
    min-width: 0;
    padding: 16px 10px 14px;
    text-align: center;
}

.analytics-st-kpi + .analytics-st-kpi {
    border-left: 1px solid #e0e5eb;
}

.analytics-st-kpi span,
.analytics-st-kpi strong {
    display: block;
}

.analytics-st-kpi span {
    min-height: 18px;
    color: #43515f;
    font-size: 13px;
    line-height: 1.25;
}

.analytics-st-kpi strong {
    margin-top: 8px;
    color: #124f91;
    font-size: clamp(22px, 2.2vw, 29px);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.analytics-st-chart-panel {
    min-height: 470px;
    padding: 16px 18px 12px;
    border: 1px solid #cdd4dc;
    border-radius: var(--analytics-radius);
    background: #fff;
    box-shadow: var(--analytics-shadow);
}

.analytics-st-donut .analytics-donut-hole {
    width: 180px;
    height: 180px;
}

.analytics-st-donut .analytics-donut-big {
    font-size: 23px;
    font-weight: 500;
}

.analytics-st-donut .analytics-donut-small {
    color: #354454;
    font-size: 14px;
}

.analytics-st-legend {
    margin-top: 14px;
    border-top: 1px solid #d9dfe5;
}

.analytics-st-legend .analytics-legend-item {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto 58px;
    gap: 10px;
    padding: 7px 10px;
    border-bottom: 1px solid #e5e9ed;
    font-size: 13px;
}

.analytics-st-legend .analytics-swatch {
    width: 13px;
    height: 13px;
}

.analytics-st-legend .analytics-legend-pct {
    width: auto;
}

.analytics-st-reason-table {
    overflow: hidden;
    border: 1px solid #cdd4dc;
    border-radius: var(--analytics-radius);
    background: #fff;
    box-shadow: var(--analytics-shadow);
}

.analytics-st-reason-table thead th {
    padding: 10px 12px;
    border-right: 1px solid rgba(255, 255, 255, .35);
    border-bottom: 0;
    background: var(--analytics-blue);
    color: #fff;
    font-size: 13px;
}

.analytics-st-reason-table thead th:first-child {
    font-size: 15px;
}

.analytics-st-reason-table thead th:last-child {
    border-right: 0;
}

.analytics-st-reason-table--leak thead th {
    background: var(--analytics-red-strong);
}

.analytics-st-reason-table th:first-child,
.analytics-st-reason-table td:first-child {
    width: 58%;
}

.analytics-st-reason-table th:nth-child(2),
.analytics-st-reason-table td:nth-child(2) {
    width: 21%;
}

.analytics-st-reason-table td {
    padding: 8px 12px;
    border-right: 1px solid #e1e5e9;
    font-size: 12.5px;
}

.analytics-st-reason-table td:last-child {
    border-right: 0;
}

.analytics-st-reason-table .analytics-st-grand-total {
    background: #eef5fd;
    color: #154b84;
}

.analytics-st-reason-table--leak .analytics-st-grand-total {
    background: #fff1f0;
    color: #b3322d;
}

.analytics-st-reason-table .analytics-st-grand-total td {
    color: inherit;
}

.analytics-st-note {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 2px;
    padding: 11px 4px 0;
    border-top: 1px solid #d4dbe2;
    color: #687788;
}

.analytics-st-note svg {
    flex: none;
    margin-top: 1px;
}

.analytics-st-note p {
    margin: 0;
    font-size: 11.5px;
    line-height: 1.5;
}

/* ---- Failure State · CDL: detailed reason composition ---- */
.analytics-cdl-view {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.analytics-cdl-header {
    padding: 0 4px;
}

.analytics-cdl-layout {
    display: grid;
    grid-template-columns: minmax(360px, 40%) minmax(0, 60%);
    gap: 20px;
    align-items: start;
}

.analytics-cdl-left,
.analytics-cdl-right {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 14px;
}

.analytics-cdl-chart-panel,
.analytics-cdl-total,
.analytics-cdl-summary-table,
.analytics-cdl-group-table,
.analytics-cdl-note {
    border: 1px solid #cdd4dc;
    border-radius: var(--analytics-radius);
    background: #fff;
    box-shadow: var(--analytics-shadow);
}

.analytics-cdl-chart-panel {
    padding: 16px 18px 12px;
}

.analytics-cdl-pie-wrap {
    display: flex;
    justify-content: center;
    padding: 4px 0 18px;
}

.analytics-cdl-pie {
    position: relative;
    width: 250px;
    height: 250px;
    max-width: 100%;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(18, 63, 102, .08);
}

.analytics-cdl-pie-label {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 70px;
    margin-top: -11px;
    margin-left: -35px;
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    line-height: 22px;
    text-align: center;
    text-shadow: 0 1px 2px rgba(12, 42, 70, .45);
    transform: rotate(var(--analytics-pie-angle)) translateY(-84px) rotate(var(--analytics-pie-angle-inverse));
}

.analytics-cdl-reason-legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 18px;
    padding: 10px 10px 2px;
    border-top: 1px solid #d9dfe5;
}

.analytics-cdl-reason-legend-item {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: #38495a;
    font-size: 13px;
    line-height: 1.25;
}

.analytics-cdl-reason-legend-item .analytics-swatch {
    width: 12px;
    height: 12px;
}

.analytics-cdl-summary-table,
.analytics-cdl-group-table {
    overflow: hidden;
}

.analytics-cdl-summary-table th,
.analytics-cdl-group-table th {
    color: #184f88;
    font-size: 12px;
}

.analytics-cdl-summary-table td,
.analytics-cdl-group-table td {
    padding: 7px 10px;
    border-right: 1px solid #e1e5e9;
    color: #34485d;
    font-size: 12px;
}

.analytics-cdl-summary-table td:last-child,
.analytics-cdl-group-table td:last-child {
    border-right: 0;
}

.analytics-cdl-summary-table th:first-child {
    width: 48%;
}

.analytics-cdl-summary-table th:nth-child(2),
.analytics-cdl-summary-table th:nth-child(3) {
    width: 26%;
}

.analytics-cdl-total {
    padding: 10px 14px 12px;
    color: #124f91;
    text-align: center;
}

.analytics-cdl-total span,
.analytics-cdl-total strong {
    display: block;
}

.analytics-cdl-total span {
    padding-bottom: 7px;
    border-bottom: 1px solid #dce2e8;
    font-size: 15px;
    font-weight: 700;
}

.analytics-cdl-total strong {
    margin-top: 7px;
    font-size: clamp(28px, 2.8vw, 36px);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.analytics-cdl-group-table thead th {
    padding: 8px 10px;
    background: #fff;
}

.analytics-cdl-group-table thead th:first-child {
    width: 16%;
}

.analytics-cdl-group-table thead th:nth-child(2) {
    width: 43%;
}

.analytics-cdl-group-table thead th:nth-child(3),
.analytics-cdl-group-table thead th:nth-child(4) {
    width: 20.5%;
}

.analytics-cdl-group-table .analytics-cdl-group-band {
    padding: 10px;
    border-right: 1px solid rgba(255, 255, 255, .35);
    color: #fff;
    font-size: 14px;
    text-align: center;
    vertical-align: middle;
}

.analytics-cdl-group--cold .analytics-cdl-group-band {
    background: #176aa9;
}

.analytics-cdl-group--leak .analytics-cdl-group-band {
    background: var(--analytics-red-strong);
}

.analytics-cdl-group--leak tr:first-child td,
.analytics-cdl-group--leak tr:first-child th {
    border-top: 12px solid var(--analytics-bg);
}

.analytics-cdl-group-total td {
    font-weight: 700;
}

.analytics-cdl-group--cold .analytics-cdl-group-total td {
    background: #eaf3fb;
    color: #15558d;
}

.analytics-cdl-group--leak .analytics-cdl-group-total td {
    background: #fff0ee;
    color: #bd3731;
}

.analytics-cdl-overall-total td {
    background: #edf4fc;
    color: #124f91;
}

.analytics-cdl-group-table tfoot .analytics-cdl-overall-total td {
    padding: 10px;
    border-top: 12px solid var(--analytics-bg);
    font-size: 13px;
}

.analytics-cdl-note {
    padding: 13px 16px;
    color: #42566a;
}

.analytics-cdl-note p {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
}

.analytics-cdl-note p + p {
    margin-top: 12px;
}

.analytics-cdl-note strong {
    color: #124f91;
    font-weight: 700;
}

/* ---- Inconclusive Rate: Tableau-familiar charcoal composition ---- */
.analytics-inconclusive-view {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.analytics-inconclusive-header {
    padding: 0 4px;
}

.analytics-inconclusive-layout {
    display: grid;
    grid-template-columns: minmax(360px, 40%) minmax(0, 60%);
    gap: 20px;
    align-items: start;
}

.analytics-inconclusive-left,
.analytics-inconclusive-right {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 14px;
}

.analytics-inconclusive-chart-panel,
.analytics-inconclusive-total,
.analytics-inconclusive-summary-table,
.analytics-inconclusive-reason-table,
.analytics-inconclusive-note {
    border: 1px solid #cdd4dc;
    border-radius: var(--analytics-radius);
    background: #fff;
    box-shadow: var(--analytics-shadow);
}

.analytics-inconclusive-chart-panel {
    padding: 18px 18px 12px;
}

.analytics-inconclusive-donut {
    padding: 2px 0 14px;
}

.analytics-inconclusive-donut .analytics-donut-hole {
    width: 190px;
    height: 190px;
}

.analytics-inconclusive-donut .analytics-donut-big {
    color: #123f66;
    font-size: 27px;
    line-height: 1.05;
}

.analytics-inconclusive-donut .analytics-donut-small {
    margin-top: 0;
    color: #123f66;
    font-size: 14px;
    font-weight: 600;
}

.analytics-inconclusive-legend {
    margin-top: 0;
    padding-top: 8px;
    border-top: 1px solid #d9dfe5;
}

.analytics-inconclusive-legend .analytics-legend-item {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto 58px;
    gap: 10px;
    padding: 7px 8px;
    border-bottom: 1px solid #e5e9ed;
    font-size: 13px;
}

.analytics-inconclusive-legend .analytics-swatch {
    width: 14px;
    height: 14px;
}

.analytics-inconclusive-legend .analytics-legend-pct {
    width: auto;
}

.analytics-inconclusive-summary-table,
.analytics-inconclusive-reason-table {
    overflow: hidden;
}

.analytics-inconclusive-summary-table th,
.analytics-inconclusive-reason-table th {
    color: #184f88;
    font-size: 12px;
}

.analytics-inconclusive-summary-table td,
.analytics-inconclusive-reason-table td {
    padding: 8px 12px;
    border-right: 1px solid #e1e5e9;
    color: #34485d;
    font-size: 12.5px;
}

.analytics-inconclusive-summary-table td:last-child,
.analytics-inconclusive-reason-table td:last-child {
    border-right: 0;
}

.analytics-inconclusive-summary-table th:first-child {
    width: 70%;
}

.analytics-inconclusive-summary-table th:last-child {
    width: 30%;
}

.analytics-inconclusive-summary-table strong {
    color: #124f91;
}

.analytics-inconclusive-summary-total td {
    background: #edf4fc;
    color: #124f91;
}

.analytics-inconclusive-total {
    padding: 10px 14px 12px;
    color: #124f91;
    text-align: center;
}

.analytics-inconclusive-total span,
.analytics-inconclusive-total strong {
    display: block;
}

.analytics-inconclusive-total span {
    padding-bottom: 7px;
    border-bottom: 1px solid #dce2e8;
    font-size: 15px;
    font-weight: 700;
}

.analytics-inconclusive-total strong {
    margin-top: 7px;
    font-size: clamp(28px, 2.8vw, 36px);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.analytics-inconclusive-reason-table thead th {
    padding: 8px 10px;
    background: #fff;
}

.analytics-inconclusive-reason-table thead th:first-child {
    width: 20%;
}

.analytics-inconclusive-reason-table thead th:nth-child(2) {
    width: 60%;
}

.analytics-inconclusive-reason-table thead th:last-child {
    width: 20%;
}

.analytics-inconclusive-reason-table .analytics-inconclusive-band {
    padding: 12px;
    border-right: 1px solid rgba(255, 255, 255, .3);
    background: var(--analytics-inconclusive);
    color: #fff;
    font-size: 14px;
    text-align: center;
    vertical-align: middle;
}

.analytics-inconclusive-reason-total td:first-of-type {
    background: var(--analytics-inconclusive);
    color: #fff;
}

.analytics-inconclusive-reason-total td:last-child {
    color: #123f66;
    font-size: 13px;
}

.analytics-inconclusive-note {
    padding: 13px 16px;
    color: #42566a;
}

.analytics-inconclusive-note p {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
}

.analytics-inconclusive-note p + p {
    margin-top: 12px;
}

.analytics-inconclusive-note strong {
    color: #124f91;
    font-weight: 700;
}

/* ---- TTS Summary: compact operational report ---- */
.analytics-tts-summary {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.analytics-tts-top-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 28%);
    border: 1px solid #c8d1da;
    background: #fff;
}

.analytics-tts-title-band {
    display: flex;
    align-items: center;
    min-width: 0;
    padding: 12px 16px;
    background: var(--analytics-title);
}

.analytics-tts-title {
    margin: 0;
    color: #fff;
    font-size: clamp(20px, 1.65vw, 22px);
    font-weight: 700;
    line-height: 1.2;
    text-align: left;
}

.analytics-tts-total {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 14px;
    color: var(--analytics-title);
    text-align: center;
}

.analytics-tts-total-label {
    color: #657486;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
}

.analytics-tts-total-value {
    font-size: clamp(32px, 3vw, 42px);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.analytics-tts-overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 55fr) minmax(0, 45fr);
    gap: 10px;
}

.analytics-tts-block,
.analytics-tts-category {
    min-width: 0;
    border: 1px solid #cbd3dc;
    background: #fff;
}

.analytics-tts-block-title {
    margin: 0;
    padding: 7px 12px;
    border-bottom: 1px solid #dce2e8;
    background: #f5f7f9;
    color: var(--analytics-title);
    font-size: 14px;
    font-weight: 700;
}

.analytics-tts-block-body {
    padding: 5px 12px;
}

.analytics-tts-metric-row,
.analytics-tts-loss-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 6px 0;
    color: #52616f;
    font-size: 12.5px;
}

.analytics-tts-metric-row + .analytics-tts-metric-row,
.analytics-tts-loss-row + .analytics-tts-loss-row {
    border-top: 1px solid #edf0f3;
}

.analytics-tts-metric-row strong,
.analytics-tts-loss-row strong {
    flex: none;
    color: var(--analytics-title);
    font-size: 19px;
    font-variant-numeric: tabular-nums;
}

.analytics-tts-inconclusive {
    display: flex;
    flex-direction: column;
}

.analytics-tts-inconclusive-metric {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 88px;
    padding: 8px 12px 10px;
    color: var(--analytics-amber);
    text-align: center;
}

.analytics-tts-inconclusive-metric strong {
    font-size: clamp(48px, 5vw, 60px);
    font-weight: 750;
    line-height: .95;
    font-variant-numeric: tabular-nums;
}

.analytics-tts-inconclusive-metric span {
    margin-top: 4px;
    color: #7d6951;
    font-size: 12px;
    font-weight: 600;
}

.analytics-tts-status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.analytics-tts-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    padding: 7px 12px;
    border: 1px solid #d2d9e0;
    border-left-width: 4px;
    background: #fff;
    font-size: 13px;
    font-weight: 650;
}

.analytics-tts-status strong {
    font-size: 24px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.analytics-tts-status--failed {
    border-left-color: var(--analytics-red);
    color: #a8423d;
}

.analytics-tts-status--good {
    border-left-color: var(--analytics-green);
    color: #347b55;
}

.analytics-tts-category-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.analytics-tts-category-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0;
    padding: 7px 12px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
}

.analytics-tts-category-head strong {
    font-size: 22px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.analytics-tts-category-head--cold { background: var(--analytics-blue); }
.analytics-tts-category-head--leakage { background: var(--analytics-red); }

.analytics-tts-breakdown {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-bottom: 1px solid #dfe4e9;
}

.analytics-tts-breakdown--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.analytics-tts-breakdown-item {
    padding: 8px 10px;
    text-align: center;
}

.analytics-tts-breakdown-item + .analytics-tts-breakdown-item {
    border-left: 1px solid #e2e7ec;
}

.analytics-tts-breakdown-item span,
.analytics-tts-breakdown-item strong {
    display: block;
}

.analytics-tts-breakdown-item span {
    color: #667584;
    font-size: 11.5px;
}

.analytics-tts-breakdown-item strong {
    margin-top: 2px;
    color: var(--analytics-title);
    font-size: 22px;
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
}

.analytics-tts-category-head--cold + .analytics-tts-breakdown strong {
    color: var(--analytics-blue);
}

.analytics-tts-category-head--leakage + .analytics-tts-breakdown strong {
    color: var(--analytics-red);
}

.analytics-tts-loss-list {
    padding: 3px 10px;
}

.analytics-tts-footnotes {
    margin: 0;
    padding-top: 1px;
}

/* ---- Opportunity Cost: compact Tableau-familiar composition ---- */
.analytics-opportunity-view {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.analytics-opportunity-header {
    padding: 0 4px;
}

.analytics-opportunity-title {
    margin: 0;
    color: var(--analytics-ink);
    font-size: clamp(24px, 2.3vw, 30px);
    font-weight: 700;
    line-height: 1.2;
    text-align: left;
}

.analytics-opportunity-top {
    display: grid;
    grid-template-columns: minmax(360px, 1fr) minmax(390px, .9fr);
    gap: 20px;
    align-items: stretch;
}

.analytics-opportunity-total,
.analytics-opportunity-context,
.analytics-opportunity-metrics,
.analytics-opportunity-breakdown {
    border: 1px solid #cdd4dc;
    border-radius: var(--analytics-radius);
    background: #fff;
    box-shadow: var(--analytics-shadow);
}

.analytics-opportunity-total {
    display: flex;
    min-height: 98px;
    flex-direction: column;
    justify-content: center;
    padding: 14px 20px;
}

.analytics-opportunity-total span {
    color: #526170;
    font-size: 16px;
    font-weight: 500;
}

.analytics-opportunity-total strong {
    margin-top: 5px;
    color: var(--analytics-title);
    font-size: clamp(28px, 3vw, 36px);
    font-weight: 750;
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
}

.analytics-opportunity-context {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    align-content: center;
    padding: 15px 20px;
}

.analytics-opportunity-context span,
.analytics-opportunity-context strong {
    display: block;
}

.analytics-opportunity-context span {
    color: #596777;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.analytics-opportunity-context strong {
    margin-top: 7px;
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid #d7dde4;
    border-radius: 3px;
    color: #43515f;
    font-size: 14px;
    font-weight: 500;
    line-height: 18px;
}

.analytics-opportunity-current {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.analytics-opportunity-section-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 0 2px;
}

.analytics-opportunity-section-head h2,
.analytics-opportunity-breakdown h2 {
    margin: 0;
    color: var(--analytics-title);
    font-size: 19px;
    font-weight: 700;
    line-height: 1.25;
}

.analytics-opportunity-section-head p {
    margin: 0;
    color: #74808d;
    font-size: 13px;
}

.analytics-opportunity-metrics {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    overflow: hidden;
}

.analytics-opportunity-metric {
    min-width: 0;
    padding: 14px 9px 13px;
    text-align: center;
}

.analytics-opportunity-metric + .analytics-opportunity-metric {
    border-left: 1px solid #e2e7ec;
}

.analytics-opportunity-metric span,
.analytics-opportunity-metric strong {
    display: block;
}

.analytics-opportunity-metric span {
    min-height: 38px;
    color: #164d7c;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.analytics-opportunity-metric strong {
    margin-top: 6px;
    color: var(--analytics-title);
    font-size: clamp(21px, 2vw, 27px);
    font-weight: 700;
    line-height: 1.1;
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
}

.analytics-opportunity-breakdown {
    padding: 10px 12px 12px;
}

.analytics-opportunity-breakdown h2 {
    margin: 0 4px 6px;
}

.analytics-opportunity-breakdown-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    color: #2f3e4c;
    font-size: 13.5px;
}

.analytics-opportunity-breakdown-table thead th {
    padding: 4px 7px 5px;
    border-bottom: 1px solid #d6dce3;
    color: #244b70;
    font-size: 12px;
    font-weight: 700;
    text-align: left;
}

.analytics-opportunity-breakdown-table thead th:first-child {
    width: 180px;
}

.analytics-opportunity-breakdown-table thead th:nth-child(2) {
    width: 265px;
}

.analytics-opportunity-breakdown-table thead th:last-child {
    width: 86px;
}

.analytics-opportunity-breakdown-table tbody th,
.analytics-opportunity-breakdown-table tbody td,
.analytics-opportunity-breakdown-table tfoot th,
.analytics-opportunity-breakdown-table tfoot td {
    padding: 3px 7px;
    border-bottom: 1px solid #edf0f3;
    line-height: 1.2;
}

.analytics-opportunity-group + .analytics-opportunity-group tr:first-child > *,
.analytics-opportunity-breakdown-table tfoot tr:first-child > * {
    border-top: 1px solid #ccd4dc;
}

.analytics-opportunity-group th {
    color: var(--analytics-opportunity-color);
    font-size: 14px;
    font-weight: 750;
    text-align: left;
    vertical-align: top;
}

.analytics-opportunity-group td:nth-of-type(1) {
    font-size: 13.5px;
}

.analytics-opportunity-bar-cell {
    width: auto;
}

.analytics-opportunity-bar-track,
.analytics-opportunity-bar-fill {
    display: block;
    height: 10px;
    border-radius: 1px;
}

.analytics-opportunity-bar-track {
    width: 100%;
    background: #f0f3f6;
}

.analytics-opportunity-bar-fill {
    min-width: 2px;
    max-width: 100%;
    background: var(--analytics-opportunity-color);
}

.analytics-opportunity-breakdown-table .analytics-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.analytics-opportunity-breakdown-table tfoot {
    --analytics-opportunity-color: #124f91;
    color: var(--analytics-title);
    font-size: 14px;
    font-weight: 750;
}

.analytics-opportunity-breakdown-table tfoot th {
    text-align: left;
}

.analytics-flex-1 {
    flex: 1;
}

/* ---- Report table ---- */
.analytics-report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.analytics-report-table th {
    text-align: left;
    font-weight: 700;
    color: #536272;
    background: #f4f6f8;
    padding: 8px 9px;
    border-bottom: 1px solid #d7dde4;
}

.analytics-report-table td {
    padding: 8px 9px;
    border-bottom: 1px solid #edf0f3;
    color: #3c4853;
}

.analytics-report-table td.analytics-num,
.analytics-report-table th.analytics-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.analytics-report-table tbody tr:nth-child(even) {
    background: #fafbfd;
}

.analytics-report-table tr:last-child td {
    border-bottom: 0;
}

/* ---- Horizontal bar list ---- */
.analytics-bar-list {
    font-size: 13px;
}

.analytics-bar-row {
    display: grid;
    grid-template-columns: 210px 1fr 96px;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}

.analytics-bar-label {
    color: #3c4853;
}

.analytics-bar-track {
    height: 16px;
    background: #eef1f4;
    border-radius: 2px;
    overflow: hidden;
}

.analytics-bar-fill {
    height: 100%;
    background: #4a7fb5;
}

.analytics-bar-fill--cold { background: var(--analytics-blue); }
.analytics-bar-fill--leak { background: var(--analytics-red); }

.analytics-bar-val {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.analytics-bar-head {
    display: flex;
    justify-content: space-between;
    font-size: 11.5px;
    color: #5a6773;
    font-weight: 600;
    border-bottom: 1px solid #e3e7ec;
    padding-bottom: 6px;
    margin-bottom: 5px;
}

.analytics-group-label {
    margin: 8px 0 4px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--analytics-title);
    letter-spacing: .05em;
}

/* ---- Donut ---- */
.analytics-donut-caption {
    text-align: center;
    font-size: 13px;
    color: #5a6773;
    margin-bottom: 12px;
}

.analytics-donut-caption b {
    color: var(--analytics-title);
}

.analytics-donut-wrap {
    display: flex;
    justify-content: center;
}

.analytics-donut {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.analytics-donut-hole {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.analytics-donut-big {
    font-size: 21px;
    font-weight: 700;
    color: var(--analytics-title);
    font-variant-numeric: tabular-nums;
}

.analytics-donut-small {
    font-size: 10.5px;
    color: #7a8794;
    margin-top: 2px;
}

/* ---- Legend ---- */
.analytics-legend-list {
    font-size: 12.5px;
    margin-top: 14px;
}

.analytics-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
}

.analytics-swatch {
    width: 11px;
    height: 11px;
    border-radius: 2px;
    flex: none;
}

.analytics-legend-name {
    flex: 1;
    color: #3a4650;
}

.analytics-legend-item strong {
    color: var(--analytics-title);
    font-variant-numeric: tabular-nums;
}

.analytics-legend-pct {
    width: 52px;
    text-align: right;
    color: #7a8794;
    font-variant-numeric: tabular-nums;
}

.analytics-cdl-legend {
    max-width: 210px;
    margin-right: auto;
    margin-left: auto;
}

/* ---- Notes ---- */
.analytics-note {
    font-size: 11.5px;
    color: #8794a3;
    line-height: 1.65;
    margin-top: 12px;
}

/* ---- Request-state surfaces (loading / error / empty / no-selection) ---- */
.analytics-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 55vh;
    padding: 32px;
    text-align: center;
    color: var(--analytics-muted);
}

.analytics-state-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--analytics-title);
    margin: 0;
}

.analytics-state-detail {
    margin: 0;
    font-size: 13px;
}

.analytics-state--error svg {
    color: var(--analytics-red);
}

.analytics-loading-panel {
    min-width: 180px;
    min-height: 92px;
}

.analytics-retry-button {
    margin-top: 8px;
    border: 1px solid #2f6fb6;
    background: #2f6fb6;
    color: #fff;
    border-radius: 3px;
    padding: 7px 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.analytics-retry-button:hover {
    background: #245f9f;
    border-color: #245f9f;
}

/* ---- Native Survey Progress view ---- */
.analytics-survey-progress-view {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.analytics-survey-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 4px;
}

.analytics-survey-progress-title {
    margin: 0;
    color: var(--analytics-title);
    font-size: clamp(24px, 2.3vw, 30px);
    font-weight: 750;
    line-height: 1.2;
}

.analytics-survey-progress-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px 18px;
}

.analytics-date-control,
.analytics-currency-context {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #3d4d5f;
    font-size: 13px;
    font-weight: 500;
}

.analytics-date-input-shell {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid #d3dae2;
    border-radius: 4px;
    background: #fff;
    color: #1d5fa3;
    box-shadow: 0 1px 2px rgba(18, 63, 102, .04);
}

.analytics-date-input-shell input {
    width: 118px;
    border: 0;
    outline: 0;
    background: transparent;
    color: #243548;
    font: inherit;
    font-variant-numeric: tabular-nums;
}

.analytics-survey-progress-apply {
    min-height: 36px;
    min-width: 72px;
    align-self: center;
    white-space: nowrap;
}

.analytics-currency-context {
    min-height: 36px;
    padding-left: 4px;
}

.analytics-currency-context strong {
    min-width: 74px;
    padding: 8px 11px;
    border: 1px solid #d3dae2;
    border-radius: 4px;
    background: #fff;
    color: #243548;
    font-size: 13px;
    line-height: 18px;
    text-align: left;
}

.analytics-survey-progress-error {
    margin: -4px 4px 0;
    color: #b8322d;
    font-size: 12.5px;
    font-weight: 600;
}

.analytics-survey-progress-grid {
    margin-top: 2px;
}

.analytics-survey-progress-body {
    min-height: 330px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(26px, 4vw, 46px);
}

.analytics-survey-progress-body .analytics-donut-hole {
    width: 52%;
    height: 52%;
}

.analytics-donut--unavailable {
    flex: none;
    background: var(--analytics-neutral);
}

.analytics-survey-progress-legend {
    min-width: 260px;
    margin-top: 0;
}

.analytics-survey-progress-side {
    display: flex;
    min-width: 260px;
    flex-direction: column;
    gap: 18px;
}

.analytics-survey-progress-total {
    padding-bottom: 15px;
    border-bottom: 1px solid #d9dfe5;
}

.analytics-survey-progress-total span,
.analytics-survey-progress-total strong {
    display: block;
}

.analytics-survey-progress-total span {
    color: #3f4e5f;
    font-size: 15px;
    font-weight: 650;
}

.analytics-survey-progress-total strong {
    margin-top: 5px;
    color: var(--analytics-title);
    font-size: clamp(30px, 3vw, 38px);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.analytics-survey-progress-losses {
    display: flex;
    flex-direction: column;
    gap: 11px;
    padding-top: 14px;
    border-top: 1px solid #d9dfe5;
}

.analytics-survey-progress-loss {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    color: #39485a;
    font-size: 13.5px;
}

.analytics-survey-progress-loss span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    color: #fff;
    font-size: 15px;
    font-style: normal;
    font-weight: 750;
    line-height: 1;
}

.analytics-survey-progress-loss em {
    min-width: 0;
    font-style: normal;
}

.analytics-survey-progress-loss strong {
    color: var(--analytics-title);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.analytics-survey-progress-loss--recovered span {
    background: var(--analytics-green);
}

.analytics-survey-progress-loss--not-recovered span {
    background: var(--analytics-red);
}

.analytics-swatch--blue { background: var(--analytics-blue); }
.analytics-swatch--green { background: var(--analytics-green); }
.analytics-swatch--red { background: var(--analytics-red); }
.analytics-swatch--neutral {
    background: #dde3ea;
    border: 1px solid #c7cdd4;
}

.analytics-survey-progress-note {
    text-align: center;
}

@media (max-width: 1000px) {
    .analytics-grid-2,
    .analytics-grid-main,
    .analytics-grid-30-70 {
        grid-template-columns: 1fr;
    }

    .analytics-opportunity-metrics {
        grid-template-columns: repeat(2, 1fr);
    }

    .analytics-opportunity-top {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .analytics-opportunity-metric:nth-child(odd) {
        border-left: 0;
    }

    .analytics-opportunity-metric:nth-child(n + 3) {
        border-top: 1px solid #e2e7ec;
    }

    .analytics-bar-row {
        grid-template-columns: 140px 1fr 90px;
    }

    .analytics-survey-progress-body {
        flex-direction: column;
        min-height: 0;
    }

    .analytics-tts-overview-grid,
    .analytics-tts-category-grid {
        grid-template-columns: 1fr;
    }

    .analytics-st-layout,
    .analytics-cdl-layout,
    .analytics-inconclusive-layout {
        grid-template-columns: 1fr;
    }

    .analytics-st-chart-panel {
        min-height: 0;
    }
}

@media (max-width: 760px) {
    .analytics-dashboard {
        padding: 12px;
    }

    .analytics-survey-progress-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .analytics-survey-progress-controls {
        justify-content: flex-start;
        width: 100%;
    }

    .analytics-date-control,
    .analytics-currency-context {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .analytics-tts-top-row,
    .analytics-tts-status-grid {
        grid-template-columns: 1fr;
    }

    .analytics-tts-total {
        min-height: 64px;
    }

    .analytics-tts-title-band {
        padding: 10px 12px;
    }

    .analytics-st-kpi-strip {
        grid-template-columns: 1fr;
    }

    .analytics-st-kpi + .analytics-st-kpi {
        border-top: 1px solid #e0e5eb;
        border-left: 0;
    }

    .analytics-st-donut .analytics-donut {
        width: 250px !important;
        height: 250px !important;
    }

    .analytics-st-donut .analytics-donut-hole {
        width: 145px;
        height: 145px;
    }

    .analytics-cdl-pie {
        width: 220px;
        height: 220px;
    }

    .analytics-cdl-pie-label {
        font-size: 15px;
        transform: rotate(var(--analytics-pie-angle)) translateY(-74px) rotate(var(--analytics-pie-angle-inverse));
    }

    .analytics-cdl-reason-legend {
        grid-template-columns: 1fr;
    }

    .analytics-cdl-summary-table,
    .analytics-cdl-group-table,
    .analytics-inconclusive-summary-table,
    .analytics-inconclusive-reason-table {
        display: block;
        overflow-x: auto;
    }

    .analytics-inconclusive-donut .analytics-donut {
        width: 270px !important;
        height: 270px !important;
    }

    .analytics-inconclusive-donut .analytics-donut-hole {
        width: 155px;
        height: 155px;
    }

    .analytics-opportunity-context {
        gap: 12px;
        padding: 13px 14px;
    }

    .analytics-opportunity-section-head {
        display: block;
    }

    .analytics-opportunity-section-head p {
        margin-top: 3px;
    }

    .analytics-opportunity-breakdown {
        padding-right: 7px;
        padding-left: 7px;
    }

    .analytics-opportunity-breakdown-table thead th:first-child {
        width: 21%;
    }

    .analytics-opportunity-breakdown-table thead th:nth-child(2) {
        width: 35%;
    }

    .analytics-opportunity-breakdown-table thead th:last-child {
        width: 68px;
    }
}

@media (max-width: 520px) {
    .analytics-opportunity-context,
    .analytics-opportunity-metrics {
        grid-template-columns: 1fr;
    }

    .analytics-opportunity-metric + .analytics-opportunity-metric {
        border-top: 1px solid #e2e7ec;
        border-left: 0;
    }

    .analytics-opportunity-breakdown-table thead th:first-child {
        width: 25%;
    }

    .analytics-opportunity-breakdown-table thead th:nth-child(2) {
        width: 43%;
    }

    .analytics-opportunity-breakdown-table thead th:nth-child(3) {
        width: 12%;
    }

    .analytics-opportunity-breakdown-table thead th:last-child {
        width: 20%;
    }

    .analytics-tts-breakdown--three {
        grid-template-columns: 1fr;
    }

    .analytics-tts-breakdown--three .analytics-tts-breakdown-item + .analytics-tts-breakdown-item {
        border-top: 1px solid #e2e7ec;
        border-left: 0;
    }
}
