/* ============================================================================================
   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: #5a6875;
    --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-leak: #d94040;
    --analytics-amber: #c98a3c;
    --analytics-amber-strong: #e2913a;
    --analytics-purple: #7a5aa8;
    --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-date-input-shell:focus-within {
    outline: 2px solid var(--analytics-blue);
    outline-offset: 1px;
}

.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;
    }
}

/* Page tabs sit outside the dashboard palette scope, so their colours are explicit. */
.analytics-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

/* Never shrinks: as a scroll container its minimum height is 0, so a tall page would otherwise squeeze the strip,
   clip the tab labels and let the strip scroll vertically on its own. */
.analytics-page-tabs {
    flex: 0 0 auto;
    display: flex;
    border-bottom: 1px solid #c7ced6;
    background: #fff;
    padding: 0 24px;
    overflow-x: auto;
    overflow-y: hidden;
}

.analytics-page-tab {
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    color: #607286;
    font-size: 14.5px;
    padding: 11px 18px 12px;
    white-space: nowrap;
    cursor: pointer;
}

.analytics-page-tab[aria-selected="true"] {
    color: #123f66;
    font-weight: 700;
    border-bottom-color: #2f6fb6;
}

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

.analytics-page-panel {
    flex: 1 1 auto;
    min-height: 0;
}

.analytics-page-panel[hidden] {
    display: none;
}

.analytics-ach-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

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

.analytics-ach-line {
    flex: 1;
    height: 1px;
    background: var(--analytics-line);
}

.analytics-ach-badge {
    font-size: 12px;
    color: var(--analytics-muted);
    border: 1px solid var(--analytics-line);
    border-radius: 10px;
    padding: 2px 8px;
    white-space: nowrap;
}

.analytics-ach-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.analytics-ach-card {
    position: relative;
    background: var(--analytics-panel);
    border: 1px solid #cdd4dc;
    border-radius: var(--analytics-radius);
    box-shadow: var(--analytics-shadow);
    padding: 14px 16px 14px 20px;
    overflow: hidden;
}

.analytics-ach-card::after {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    content: '';
}

.analytics-ach-card--cost::after {
    background: var(--analytics-green);
}

.analytics-ach-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--analytics-ink);
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 6px;
}

.analytics-ach-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--analytics-green);
}

.analytics-ach-unit {
    font-size: 13px;
    color: var(--analytics-muted);
    margin-top: 4px;
}

.analytics-ach-tag {
    display: inline-flex;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: #e7f3ec;
    color: #2e7a3c;
}

.analytics-ach-breakdown {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--analytics-line-soft);
}

.analytics-ach-bd-item {
    font-size: 13px;
    color: var(--analytics-muted);
}

.analytics-ach-bd-item strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--analytics-ink);
}

.analytics-ach-unavailable {
    margin-top: 10px;
    font-size: 13px;
    color: var(--analytics-muted);
}

.analytics-ach-card--co2::after {
    background: var(--analytics-blue);
}

.analytics-ach-card--co2 .analytics-ach-value {
    color: var(--analytics-blue);
}

.analytics-ach-card--co2 .analytics-ach-tag {
    background: #e8f0f9;
    color: #2f69a8;
}

.analytics-ach-card--steam::after {
    background: var(--analytics-amber);
}

.analytics-ach-card--steam .analytics-ach-value {
    color: var(--analytics-amber);
}

.analytics-ach-card--steam .analytics-ach-tag {
    background: #f8efe3;
    color: #94601f;
}

.analytics-ach-card--tz::after {
    background: var(--analytics-purple);
}

.analytics-ach-card--tz .analytics-ach-value {
    color: var(--analytics-purple);
}

.analytics-ach-card--tz .analytics-ach-tag {
    background: #f0ebf7;
    color: var(--analytics-purple);
}

@media (max-width: 1100px) {
    .analytics-ach-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .analytics-ach-grid {
        grid-template-columns: 1fr;
    }
}

/* Card-level loading overlay: covers the whole card, over its previous values, while its own request runs. */
.analytics-ach-card[aria-busy="true"] {
    min-height: 120px;
}

.analytics-card-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgb(255 255 255 / 70%);
}

/* ---- Latest Failure Status (Card 5) ---- */
.analytics-fs-section {
    margin-top: 20px;
}

.analytics-fs-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.analytics-fs-card::after {
    background: var(--analytics-leak);
}

.analytics-fs-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--analytics-leak);
}

.analytics-fs-sub {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    margin-top: 4px;
    font-size: 13px;
    color: var(--analytics-muted);
}

.analytics-fs-sub strong {
    color: var(--analytics-ink);
}

.analytics-fs-bar {
    display: flex;
    height: 10px;
    margin-top: 12px;
    border-radius: 5px;
    overflow: hidden;
    background: var(--analytics-line-soft);
}

/* Test-result colours: the analytics GOOD and COLD, and the leak red. */
.analytics-fs-bar-good { background: var(--analytics-green-strong); }
.analytics-fs-bar-leak { background: var(--analytics-leak); }
.analytics-fs-bar-cold { background: var(--analytics-blue); }

.analytics-fs-breakdown {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--analytics-line-soft);
}

.analytics-fs-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.analytics-fs-name {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--analytics-muted);
}

.analytics-fs-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.analytics-fs-item strong {
    font-size: 15px;
    font-weight: 700;
}

.analytics-fs-count {
    font-size: 13px;
    color: var(--analytics-muted);
}

.analytics-fs-item--good .analytics-fs-dot { background: var(--analytics-green-strong); }
/* The Good percentage uses a darker green than its dot so the small text stays readable. */
.analytics-fs-item--good strong { color: #2e7a3c; }
.analytics-fs-item--leak .analytics-fs-dot { background: var(--analytics-leak); }
.analytics-fs-item--leak strong { color: var(--analytics-leak); }
.analytics-fs-item--cold .analytics-fs-dot { background: var(--analytics-blue); }
.analytics-fs-item--cold strong { color: var(--analytics-blue); }

/* Headline and trend each carry their own overlay. */
.analytics-fs-headline,
.analytics-fs-trend {
    position: relative;
}

.analytics-fs-headline[aria-busy="true"],
.analytics-fs-trend[aria-busy="true"] {
    min-height: 120px;
}

.analytics-fs-trend {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--analytics-line-soft);
}

/* ---- Failure State Trend chart ---- */
.analytics-ft-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.analytics-ft-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.analytics-ft-select {
    max-width: 220px;
    height: 28px;
    border: 1px solid var(--analytics-line);
    border-radius: 4px;
    background: var(--analytics-panel);
    color: var(--analytics-ink);
    font-size: 13px;
    padding: 0 6px;
}

.analytics-ft-toggle {
    display: inline-flex;
    border: 1px solid var(--analytics-line);
    border-radius: 4px;
    overflow: hidden;
}

.analytics-ft-toggle button {
    border: 0;
    background: var(--analytics-panel);
    color: var(--analytics-muted);
    font-size: 13px;
    padding: 4px 10px;
    cursor: pointer;
}

.analytics-ft-toggle button[aria-pressed="true"] {
    background: var(--analytics-title);
    color: #fff;
}

.analytics-ft-plot {
    width: 100%;
    overflow: hidden;
}

.analytics-ft-plot:focus-visible {
    outline: 2px solid var(--analytics-blue);
    outline-offset: 2px;
}

.analytics-ft-svg {
    display: block;
}

.analytics-ft-grid { stroke: var(--analytics-line-soft); }
.analytics-ft-axis { stroke: var(--analytics-line); }
.analytics-ft-cursor { stroke: var(--analytics-muted); stroke-dasharray: 3 3; }
.analytics-ft-hit { fill: transparent; }
.analytics-ft-marker--selected { stroke: #fff; stroke-width: 1.5; }

.analytics-ft-tick {
    font-size: 11px;
    fill: var(--analytics-muted);
}

/* ZRM points are marked in green on the axis. */
.analytics-ft-tick--zrm { fill: var(--analytics-green-strong); }

.analytics-ft-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-top: 6px;
}

.analytics-ft-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 0;
    background: none;
    padding: 2px 0;
    font-size: 13px;
    color: var(--analytics-ink);
    cursor: pointer;
}

.analytics-ft-legend-item[aria-pressed="false"] {
    color: var(--analytics-muted);
    text-decoration: line-through;
    opacity: .6;
}

.analytics-ft-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.analytics-ft-readout {
    min-height: 1lh;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin: 8px 0 0;
    font-size: 13px;
}

.analytics-ft-readout div {
    display: flex;
    align-items: center;
    gap: 5px;
}

.analytics-ft-readout dt {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--analytics-muted);
}

.analytics-ft-readout dd {
    margin: 0;
    font-weight: 600;
    color: var(--analytics-ink);
}

.analytics-ft-readout-point dd {
    color: var(--analytics-title);
}

/* ---- CDL Failure Status (Card 6) ---- */
/* Small coloured text uses the darker -text shades so it stays readable on white and on the tiles. */
.analytics-cfs-card {
    --analytics-cfs-cold: #2582d4;
    --analytics-cfs-cold-text: #1f6fb8;
    --analytics-cfs-leak-text: #c43333;
    --analytics-cfs-amber-text: #9a5b00;
}

.analytics-cfs-card::after {
    background: var(--analytics-cfs-cold);
}

.analytics-cfs-note {
    margin: 0 0 12px;
    padding: 6px 10px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--analytics-muted);
    background: var(--analytics-line-soft);
    border-radius: var(--analytics-radius);
}

.analytics-cfs-breakdown {
    display: flex;
    align-items: center;
    gap: 18px;
}

.analytics-cfs-groups {
    flex: 1;
    min-width: 0;
}

.analytics-cfs-group + .analytics-cfs-group {
    margin-top: 8px;
}

.analytics-cfs-group-title {
    padding-bottom: 3px;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .4px;
    border-bottom: 1px solid var(--analytics-line-soft);
}

.analytics-cfs-group-title--cold { color: var(--analytics-cfs-cold-text); }
.analytics-cfs-group-title--leak { color: var(--analytics-cfs-leak-text); }

.analytics-cfs-group .analytics-legend-list {
    margin-top: 0;
}

.analytics-cfs-totals {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 12px 0 0;
    padding-top: 10px;
    border-top: 1px solid var(--analytics-line-soft);
    text-align: center;
}

.analytics-cfs-total + .analytics-cfs-total {
    border-left: 1px solid var(--analytics-line-soft);
}

.analytics-cfs-total dt {
    font-size: 12px;
    font-weight: 600;
    color: var(--analytics-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
}

.analytics-cfs-total dd {
    margin: 0;
}

.analytics-cfs-total strong {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--analytics-ink);
}

.analytics-cfs-total--cold strong { color: var(--analytics-cfs-cold); }
.analytics-cfs-total--leak strong { color: var(--analytics-leak); }

.analytics-cfs-unit {
    font-size: 13px;
    font-weight: 400;
    color: var(--analytics-muted);
}

.analytics-cfs-issues {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--analytics-line-soft);
}

.analytics-cfs-issues-title {
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--analytics-ink);
}

.analytics-cfs-tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.analytics-cfs-tile {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 12px;
    border: 1px solid var(--analytics-line-soft);
    border-radius: var(--analytics-radius);
}

.analytics-cfs-tile--pipe { background: #fdeaea; border-color: #f4c0c0; }
.analytics-cfs-tile--valve { background: #fff3dc; border-color: #f5d88a; }

.analytics-cfs-tile-label {
    font-size: 12px;
    color: var(--analytics-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
}

.analytics-cfs-tile-value {
    font-size: 13px;
    color: var(--analytics-muted);
}

.analytics-cfs-tile-value strong {
    font-size: 24px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.analytics-cfs-tile--pipe .analytics-cfs-tile-value strong { color: var(--analytics-leak); }
.analytics-cfs-tile--valve .analytics-cfs-tile-value strong,
.analytics-cfs-tile-money { color: var(--analytics-cfs-amber-text); }

/* One row keeps both tiles the same height. */
.analytics-cfs-tile-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;
}

/* Razor drops the whitespace before the conditional unit, so the gap is a margin. */
.analytics-cfs-tile-money .analytics-cfs-unit {
    margin-left: 4px;
}

.analytics-cfs-tile-money {
    font-size: 15px;
    font-weight: 600;
}

@media (max-width: 640px) {
    .analytics-cfs-breakdown {
        flex-direction: column;
        align-items: stretch;
    }

    .analytics-cfs-tiles {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1100px) {
    .analytics-fs-grid {
        grid-template-columns: 1fr;
    }
}

.analytics-filter-tab .analytics-dashboard {
    padding: 0;
    background: transparent;
    height: auto;
    overflow: visible;
}

/* The tab stacks several sections, so a section's loading, error or no-data state takes about one card row
   rather than half the window. */
.analytics-filter-tab .analytics-state {
    min-height: 240px;
}

/* Filter bar: sizes come from the tab's content width (the sidebar changes it), not the viewport. */
.analytics-filter-tab > .analytics-content {
    container: ach-filter-tab / inline-size;
}

.analytics-ach-filters {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px 16px;
    background: var(--analytics-panel);
    border: 1px solid #cdd4dc;
    border-radius: var(--analytics-radius);
    box-shadow: var(--analytics-shadow);
    padding: 10px 14px;
    margin-bottom: 14px;
}

/* Bootstrap gives labels a bottom margin, which lifts them off the centre line. */
.analytics-ach-filters label {
    margin: 0;
}

.analytics-ach-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    font-size: 13px;
    line-height: 1.2;
    color: var(--analytics-muted);
}

.analytics-ach-filter-label {
    white-space: nowrap;
}

.analytics-ach-filter-sep {
    flex: 0 0 1px;
    width: 1px;
    height: 18px;
    background: var(--analytics-line);
}

.analytics-ach-filter-select {
    height: 36px;
    padding: 0 10px;
    font: inherit;
    font-size: 13px;
    color: var(--analytics-ink);
    background: #fff;
    border: 1px solid #d3dae2;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(18, 63, 102, .04);
}

.analytics-ach-filter-select--survey {
    width: 260px;
}

.analytics-ach-filter-select--area {
    width: 200px;
}

.analytics-ach-filter-select:focus {
    outline: none;
}

.analytics-ach-filter-select:focus-visible {
    outline: 2px solid var(--analytics-blue);
    outline-offset: 1px;
}

.analytics-ach-filter-dates {
    display: flex;
    align-items: center;
    gap: 8px;
}

.analytics-ach-filter-dash {
    color: var(--analytics-muted);
}

.analytics-ach-filter-reset {
    margin-left: auto;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid transparent;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    color: var(--analytics-muted);
    cursor: pointer;
}

.analytics-ach-filter-reset:hover {
    color: var(--analytics-ink);
    background: var(--analytics-bg);
}

.analytics-ach-filter-reset:focus-visible {
    outline: 2px solid var(--analytics-blue);
    outline-offset: 1px;
}

.analytics-ach-filter--invalid .analytics-ach-filter-select,
.analytics-ach-filter--invalid .analytics-date-input-shell {
    border-color: var(--analytics-red);
    box-shadow: 0 0 0 1px var(--analytics-red);
}

.analytics-ach-filter-error {
    margin: -6px 0 12px;
    font-size: 12.5px;
    color: var(--analytics-red);
}

/* Two rows: Survey | Area | × on the first, Period on the second. */
@container ach-filter-tab (max-width: 1119px) {
    .analytics-ach-filters {
        flex-wrap: wrap;
    }

    .analytics-ach-filter-sep--period {
        display: none;
    }

    .analytics-ach-filter-reset {
        order: 1;
    }

    .analytics-ach-filter--period {
        order: 2;
        flex-basis: 100%;
    }
}

/* Stacked: label above each control, full width, × at the bottom right. */
@container ach-filter-tab (max-width: 759px) {
    .analytics-ach-filters {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .analytics-ach-filter-sep {
        display: none;
    }

    .analytics-ach-filter {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        min-height: 0;
    }

    .analytics-ach-filter--period {
        flex-basis: auto;
    }

    .analytics-ach-filter-select--survey,
    .analytics-ach-filter-select--area {
        width: 100%;
    }

    .analytics-ach-filter-dates .analytics-date-input-shell {
        flex: 1 1 0;
        min-width: 0;
    }

    .analytics-ach-filter-dates .analytics-date-input-shell input {
        width: 100%;
        min-width: 0;
    }

    .analytics-ach-filter-reset {
        order: 3;
        align-self: flex-end;
        margin-left: 0;
    }
}

/* Operational Progress & Impact (Tab 2): filter bar and Survey Progress card */
.analytics-ops-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 18px;
    margin-bottom: 14px;
    padding: 12px 14px;
    background: var(--analytics-panel);
    border: 1px solid #cdd4dc;
    border-radius: var(--analytics-radius);
    box-shadow: var(--analytics-shadow);
}

/* margin: 0 clears Bootstrap 4's label margin-bottom, which otherwise lifts the label fields above the Period. */
.analytics-ops-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 0;
    min-width: 0;
    max-width: 100%;
    color: #3d4d5f;
    font-size: 12px;
    font-weight: 600;
}

.analytics-ops-select {
    min-width: 200px;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid #d3dae2;
    border-radius: 4px;
    background: #fff;
    color: #243548;
    font: inherit;
    font-weight: 400;
    font-size: 13px;
}

.analytics-ops-period-inputs {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.analytics-ops-period-sep {
    color: var(--analytics-muted);
}

.analytics-ops-error {
    flex-basis: 100%;
    margin: 0;
    color: var(--analytics-red);
    font-size: 12.5px;
}

.analytics-ops-stale {
    margin: 0 0 12px;
    padding: 8px 10px;
    border-left: 3px solid var(--analytics-amber);
    border-radius: var(--analytics-radius);
    background: #fbf5ec;
    color: #3d4d5f;
    font-size: 12.5px;
}

.analytics-ops-no-surveys {
    margin: 0;
}

.analytics-ops-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.analytics-ops-progress-state {
    grid-column: 1 / -1;
}

.analytics-ops-card {
    background: var(--analytics-panel);
    border: 1px solid #cdd4dc;
    border-radius: var(--analytics-radius);
    box-shadow: var(--analytics-shadow);
    padding: 14px 16px;
}

/* Larger, darker and ruled off, so the title reads apart from the uppercase muted stat labels beneath it. */
.analytics-ops-card-title {
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--analytics-title);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin: 0 0 12px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--analytics-line-soft);
}

.analytics-ops-card-body {
    display: flex;
    align-items: center;
    gap: 24px;
}

/* Thinner ring than the shared donut so the percentage can be larger. */
.analytics-ops-card .analytics-donut-hole {
    width: 136px;
    height: 136px;
}

.analytics-ops-card .analytics-donut-big {
    font-size: 32px;
    line-height: 1.05;
}

.analytics-ops-card .analytics-donut-small {
    font-size: 13px;
}

.analytics-ops-stats {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.analytics-ops-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--analytics-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.analytics-ops-stat strong {
    font-size: 24px;
    font-weight: 700;
    color: var(--analytics-title);
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
}

.analytics-ops-stat--inspected strong {
    color: var(--analytics-blue);
}

.analytics-ops-stat--complete strong {
    color: var(--analytics-green-strong);
}

.analytics-ops-empty {
    margin: 0;
}

/* Steam Trap Replacement and Savings (Card 3): a full-width chart card below the two donut cards. Red = the
   remaining traps (left axis), green = the cumulative estimated annual savings (right axis), as DU306 slide 6. */
.analytics-str-card {
    margin-top: 14px;
    min-width: 0;
    background: var(--analytics-panel);
    border: 1px solid #cdd4dc;
    border-radius: var(--analytics-radius);
    box-shadow: var(--analytics-shadow);
    padding: 14px 16px;
}

.analytics-str-card .analytics-ops-card-title {
    margin: 0 0 12px;
}

.analytics-str-empty {
    margin: 0;
}

.analytics-str-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px 28px;
    margin-bottom: 12px;
}

.analytics-str-summary .analytics-ops-stat strong {
    font-size: 20px;
}

.analytics-str-stat--remaining strong {
    color: #c23b34;
}

.analytics-str-stat--savings strong {
    color: #3d7f35;
}

.analytics-str-asof {
    margin: 0 0 2px auto;
    font-size: 12px;
    color: var(--analytics-muted);
}

.analytics-str-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 20px;
    margin: 4px 0 2px;
    font-size: 12.5px;
    color: var(--analytics-ink);
}

.analytics-str-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.analytics-str-axis-titles {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 11.5px;
    font-weight: 600;
}

.analytics-str-axis-title--count {
    color: #c23b34;
}

.analytics-str-axis-title--savings {
    color: #3d7f35;
    text-align: right;
}

.analytics-str-plot {
    width: 100%;
    min-width: 0;
    border-radius: var(--analytics-radius);
    outline: none;
}

.analytics-str-plot:focus-visible {
    box-shadow: 0 0 0 2px var(--analytics-blue);
}

.analytics-str-svg {
    display: block;
}

.analytics-str-grid {
    stroke: var(--analytics-line-soft);
    stroke-width: 1;
}

.analytics-str-axis {
    stroke: var(--analytics-line);
    stroke-width: 1;
}

.analytics-str-tick {
    font-size: 11px;
    fill: var(--analytics-muted);
    font-variant-numeric: tabular-nums;
}

.analytics-str-tick--count {
    fill: #c23b34;
}

.analytics-str-tick--savings {
    fill: #3d7f35;
}

.analytics-str-tick--year {
    font-weight: 600;
}

.analytics-str-line {
    stroke-width: 2.5;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.analytics-str-area {
    fill-opacity: .07;
    stroke: none;
}

.analytics-str-cursor {
    stroke: #9aa6b2;
    stroke-width: 1;
    stroke-dasharray: 3 3;
}

.analytics-str-hit {
    fill: transparent;
    cursor: crosshair;
}

.analytics-str-readout {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    margin: 6px 0 0;
    font-size: 12.5px;
}

.analytics-str-readout > div {
    display: flex;
    gap: 6px;
}

.analytics-str-readout dt {
    color: var(--analytics-muted);
    font-weight: 400;
}

.analytics-str-readout dd {
    margin: 0;
    font-weight: 600;
    color: var(--analytics-ink);
    font-variant-numeric: tabular-nums;
}

.analytics-str-readout-month dd {
    font-weight: 700;
    color: var(--analytics-title);
}

.analytics-str-readout-item--remaining dd {
    color: #c23b34;
}

.analytics-str-readout-item--savings dd {
    color: #3d7f35;
}

.analytics-str-notes {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 10px;
}

.analytics-str-note {
    margin: 0;
    font-size: 12px;
    color: #4f5d6b;
}

.analytics-str-breakdown,
.analytics-str-table {
    margin-top: 10px;
    font-size: 12.5px;
}

.analytics-str-breakdown summary,
.analytics-str-table summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--analytics-title);
}

.analytics-str-breakdown dl {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 8px 0;
}

.analytics-str-breakdown-item {
    border: 1px solid var(--analytics-line-soft);
    border-radius: var(--analytics-radius);
    padding: 6px 8px;
}

.analytics-str-breakdown-item dt {
    font-size: 11.5px;
    color: var(--analytics-muted);
}

.analytics-str-breakdown-item dd {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--analytics-title);
    font-variant-numeric: tabular-nums;
}

.analytics-str-table-scroll {
    max-height: 280px;
    overflow: auto;
    margin-top: 8px;
}

.analytics-str-table table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.analytics-str-table th,
.analytics-str-table td {
    padding: 3px 8px;
    border-bottom: 1px solid var(--analytics-line-soft);
    text-align: right;
    white-space: nowrap;
}

.analytics-str-table thead th:first-child,
.analytics-str-table th[scope="row"] {
    text-align: left;
}

.analytics-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 640px) {
    .analytics-str-breakdown dl {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .analytics-str-asof {
        flex-basis: 100%;
        margin-left: 0;
    }
}

@media (max-width: 1100px) {
    .analytics-ops-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 640px) {
    .analytics-ops-card-body {
        flex-direction: column;
        align-items: flex-start;
    }

    .analytics-ops-select {
        min-width: 0;
        width: 100%;
    }

    .analytics-ops-period-inputs {
        flex-wrap: wrap;
    }

    .analytics-ops-period-sep {
        display: none;
    }
}

/* Operational Progress & Impact (Tab 2): Priority Locations (DU306 slide 8). Leak accents are red, cold accents blue. */
.analytics-pl {
    margin-top: 22px;
    min-width: 0;
}

.analytics-pl-empty {
    margin: 0;
}

.analytics-pl-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 18px;
    margin-bottom: 12px;
    padding: 12px 14px;
    background: var(--analytics-panel);
    border: 1px solid #cdd4dc;
    border-radius: var(--analytics-radius);
    box-shadow: var(--analytics-shadow);
}

.analytics-pl-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 0;
    min-width: 0;
    max-width: 100%;
    color: #3d4d5f;
    font-size: 12px;
    font-weight: 600;
}

.analytics-pl-controls .analytics-ops-select {
    min-width: 150px;
}

.analytics-pl-toggle {
    display: inline-flex;
    min-height: 36px;
    border: 1px solid #d3dae2;
    border-radius: 4px;
    overflow: hidden;
}

.analytics-pl-toggle-option {
    min-height: 34px;
    padding: 0 12px;
    border: 0;
    background: #fff;
    color: #3d4d5f;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.analytics-pl-toggle-option + .analytics-pl-toggle-option {
    border-left: 1px solid #d3dae2;
}

.analytics-pl-toggle-option[aria-pressed="true"] {
    background: var(--analytics-title);
    color: #fff;
}

.analytics-pl-toggle-option:focus-visible {
    outline: 2px solid var(--analytics-blue);
    outline-offset: -2px;
}

.analytics-pl-count {
    margin-left: auto;
    align-self: center;
    padding: 4px 12px;
    border: 1px solid #d3dae2;
    border-radius: 999px;
    background: #f5f7fa;
    color: var(--analytics-muted);
    font-size: 12.5px;
    white-space: nowrap;
}

.analytics-pl-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
}

.analytics-pl-table-card {
    min-width: 0;
    background: var(--analytics-panel);
    border: 1px solid #cdd4dc;
    border-radius: var(--analytics-radius);
    box-shadow: var(--analytics-shadow);
    overflow: hidden;
}

.analytics-pl-table-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--analytics-line-soft);
}

.analytics-pl-dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.analytics-pl--leak .analytics-pl-dot { background: var(--analytics-red-strong); }
.analytics-pl--cold .analytics-pl-dot { background: var(--analytics-blue); }

.analytics-pl-table-title {
    margin: 0;
    color: var(--analytics-ink);
    font-size: 15px;
    font-weight: 600;
}

.analytics-pl-unit {
    margin-left: auto;
    color: var(--analytics-muted);
    font-size: 13px;
    white-space: nowrap;
}

.analytics-pl-no-rows {
    margin: 0;
    padding: 14px 16px;
}

.analytics-pl-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.analytics-pl-table th {
    padding: 8px 10px;
    background: #f5f7fa;
    border-bottom: 1px solid var(--analytics-line);
    color: var(--analytics-muted);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .4px;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.analytics-pl-table td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--analytics-line-soft);
    vertical-align: middle;
}

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

.analytics-pl-table th.analytics-pl-col-rank,
.analytics-pl-table td.analytics-pl-col-rank {
    width: 40px;
    padding-left: 14px;
}

.analytics-pl-table th.analytics-pl-col-amount,
.analytics-pl-table td.analytics-pl-col-amount {
    padding-right: 16px;
    text-align: right;
}

.analytics-pl-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.analytics-pl-rank--1 { background: #e6a817; color: #3b2a00; }
.analytics-pl-rank--2 { background: #5f6f80; }
.analytics-pl-rank--3 { background: #94582a; }
.analytics-pl-rank--other { background: #e3e8ee; color: #5b6a79; }

.analytics-pl-id {
    color: var(--analytics-ink);
    font-family: Consolas, "Courier New", monospace;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.analytics-pl-id--fallback {
    color: var(--analytics-muted);
    font-style: italic;
    font-weight: 500;
}

.analytics-pl-model {
    display: inline-block;
    padding: 1px 6px;
    border: 1px solid #d3dae2;
    border-radius: 3px;
    background: #f5f7fa;
    color: #33475b;
    font-size: 12.5px;
    overflow-wrap: anywhere;
}

.analytics-pl-ctype {
    display: inline-block;
    padding: 2px 7px;
    border: 1px solid transparent;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.analytics-pl-ctype--swap { background: #e7f4ec; border-color: #b9dfc7; color: #2f7a4d; }
.analytics-pl-ctype--repipe { background: #fbf1e3; border-color: #efd1a6; color: #9a5d12; }
.analytics-pl-ctype--hotwork { background: #f1ebfa; border-color: #d4c3ef; color: #6a3fb0; }
.analytics-pl-ctype--none { background: #f1f3f6; border-color: #dde2e8; color: #6e7d8b; font-weight: 500; }

.analytics-pl-amount {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 4px 8px;
}

.analytics-pl-money {
    font-size: 14.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.analytics-pl--leak .analytics-pl-money { color: #bf3a31; }
.analytics-pl--cold .analytics-pl-money { color: #2f6db0; }

.analytics-pl-done {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    border: 1px solid #b9dfc7;
    border-radius: 3px;
    background: #eef8f1;
    color: #2f7a4d;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.analytics-pl-done svg {
    width: 11px;
    height: 11px;
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* The model and construction type under the identifier: narrow screens only. */
.analytics-pl-meta {
    display: none;
}

.analytics-pl-notes {
    margin-top: 10px;
}

.analytics-pl-note {
    margin: 4px 0 0;
    color: #6e7d8b;
    font-size: 12px;
    line-height: 1.55;
}

.analytics-pl-note--priority {
    color: #3d4d5f;
    font-weight: 600;
}

@media (max-width: 1100px) {
    .analytics-pl-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 640px) {
    .analytics-pl-controls .analytics-pl-field {
        flex: 1 1 100%;
    }

    .analytics-pl-controls .analytics-ops-select {
        min-width: 0;
        width: 100%;
    }

    .analytics-pl-toggle {
        display: flex;
    }

    .analytics-pl-toggle-option {
        flex: 1 1 50%;
    }

    .analytics-pl-count {
        margin-left: 0;
    }

    .analytics-pl-table th.analytics-pl-col-model,
    .analytics-pl-table td.analytics-pl-col-model,
    .analytics-pl-table th.analytics-pl-col-ctype,
    .analytics-pl-table td.analytics-pl-col-ctype {
        display: none;
    }

    .analytics-pl-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        margin-top: 4px;
    }

    .analytics-pl-table-head {
        flex-wrap: wrap;
    }

    .analytics-pl-amount {
        flex-direction: column;
        align-items: flex-end;
    }
}
