﻿/* =============================================================================
   HumanCapital — Platform Owner Dashboard (MOBILE FIRST)
   File: wwwroot/css/platform-owner-dashboard.css

   Design order:
     Base    — 375px phone (single column, compact, bottom-sheet drills)
     ≥ 640px — large phones / small tablets (tightening, KPI grid)
     ≥ 900px — tablets (2-column grid, side-slide drills, scrolling ticker)
     ≥ 1200px — laptop / desktop (6-column grid)

   Extends site2.css tokens (--navy, --font-display, etc.).
   ============================================================================= */

/* ==========================================================================
   ROOT VARIABLES / DESIGN TOKENS
   ========================================================================== */

:root {
    --po-red: #A01932;
    --po-red-pale: #FBECEF;
    --po-amber: #B27A1A;
    --po-amber-pale: #FBF3E1;
    --po-green: #1B6B47;
    --po-green-pale: #E8F2EC;
    --po-panel-bg: #FDFDFE;
    --po-panel-rule: rgba(0, 40, 104, 0.08);
    --po-panel-hover: #F7F9FD;
    --font-mono: 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
    /* WCAG 2.5.5 AAA touch-target floor */
    --po-tap: 44px;
}

/* ==========================================================================
   SHARED BASE STYLES
   (grids, panels, shell — placed first for component-driven architecture)
   ========================================================================== */

/* ── SHELL ──────────────────────────────────────────────────────────────── */
.po-shell {
    padding: 16px 12px 32px;
    background: var(--bg);
    min-height: calc(100vh - var(--nav-h));
}

/* ── GRID + MOBILE READING ORDER ────────────────────────────────────────── */
.po-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}

/* Mobile reading order: Attention first (it's the thing a platform owner
   opens the app to see), then workflow, then cycle histogram, then the
   rest. Order on desktop returns to source order via override. */
.po-panel {
    order: 99;
}

    .po-panel[aria-labelledby="attTitle"] {
        order: 1;
    }

    .po-panel[aria-labelledby="workflowTitle"] {
        order: 2;
    }

    .po-panel[aria-labelledby="cycleTitle"] {
        order: 3;
    }

    .po-panel[aria-labelledby="finTitle"] {
        order: 4;
    }

    .po-panel[aria-labelledby="complianceTitle"] {
        order: 5;
    }

    .po-panel[aria-labelledby="secTitle"] {
        order: 6;
    }

    .po-panel[aria-labelledby="portfolioTitle"] {
        order: 7;
    }

/* ── PANEL BASE (shared container used by all cards) ────────────────────── */
.po-panel {
    background: var(--po-panel-bg);
    border: 1px solid var(--po-panel-rule);
    border-radius: 10px;
    padding: 14px 14px 12px;
    display: flex;
    flex-direction: column;
}

.po-panel-head {
    margin-bottom: 12px;
}

.po-panel-title {
    font-family: var(--platform-font-display);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.005em;
    margin: 0 0 3px;
}

    .po-panel-title em {
        font-style: italic;
        color: var(--navy-mid);
        font-weight: 500;
    }

.po-panel-sub {
    font-size: 0.75rem;
    color: var(--text-subtle);
    margin: 0;
    font-weight: 300;
    line-height: 1.45;
}

.po-panel-foot {
    margin-top: auto;
    padding-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--po-panel-rule);
    font-size: 0.72rem;
    gap: 8px;
    flex-wrap: wrap;
}

.po-panel-foot-meta {
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.po-panel-foot-link {
    color: var(--navy);
    text-decoration: none;
    font-weight: 500;
    letter-spacing: 0.02em;
    min-height: var(--po-tap);
    display: inline-flex;
    align-items: center;
}

    .po-panel-foot-link:hover {
        text-decoration: underline;
    }

    .po-panel-foot-link:active {
        opacity: 0.7;
    }

/* ==========================================================================
   HEADLINE
   ========================================================================== */

/* ── HEADLINE ───────────────────────────────────────────────────────────── */
.po-headline {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--navy);
}

.po-headline-left .section-label {
    margin-bottom: 6px;
    font-size: 0.68rem;
}

.po-title {
    font-family: var(--platform-font-display);
    font-size: 1.65rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0;
}

    .po-title em {
        font-style: italic;
        color: var(--navy-mid);
        font-weight: 500;
    }

.po-headline-right {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ── LIVE STATUS ────────────────────────────────────────────────────────── */
.po-live {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-mid);
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.02em;
    flex-wrap: wrap;
}

.po-live-dot {
    width: 7px;
    height: 7px;
    background: var(--po-green);
    border-radius: 50%;
    animation: po-pulse 2.2s ease-in-out infinite;
    flex-shrink: 0;
}

.po-live-text {
    color: var(--po-green);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: 0.65rem;
}

.po-live-sep {
    color: var(--text-muted);
}

.po-refresh {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Keyframe grouped directly below the element that uses it */
@keyframes po-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.35;
        transform: scale(0.7);
    }
}

/* ==========================================================================
   KPI STRIP
   ========================================================================== */

/* KPI STRIP — Now stacks vertically on mobile */
.po-kpi-strip {
    display: grid; /* Changed from flex to grid */
    grid-template-columns: 1fr; /* Force a single column */
    gap: 12px;
    padding: 0; /* Remove carousel padding */
    margin: 0 0 16px; /* Remove negative "bleed" margins */
    overflow: visible; /* Disable horizontal scrolling */
}

.po-kpi {
    flex: none; /* Remove the 78% width constraint */
    min-width: 0; /* Allow it to fill the column */
    scroll-snap-align: none; /* Remove scroll snapping */
    background: var(--po-panel-bg);
    border: 1px solid var(--po-panel-rule);
    border-radius: 10px;
    padding: 14px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.po-kpi--warn {
    background: var(--po-red-pale);
    border-color: rgba(160, 25, 50, 0.2);
}

    .po-kpi--warn .po-kpi-value {
        color: var(--po-red);
    }

.po-kpi-value {
    font-family: var(--platform-font-display);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--navy);
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.po-kpi-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
    margin: 0 2px;
}

.po-kpi-label {
    font-size: 0.68rem;
    color: var(--text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}

/* Scroll-hint dots */
.po-kpi-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 0 0 16px;
}

.po-kpi-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-mid);
    transition: background .2s, transform .2s;
    border: none;
    padding: 0;
    cursor: pointer;
}

.po-kpi-dot--active {
    background: var(--navy);
    transform: scale(1.3);
}

/* ==========================================================================
   CYCLE HISTOGRAM
   ========================================================================== */

/* CYCLE HISTOGRAM — horizontal scroll on mobile */
.po-cycle-scroll {
    margin: 0 -14px; /* bleed */
    padding: 0 14px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

    .po-cycle-scroll::-webkit-scrollbar {
        height: 4px;
    }

    .po-cycle-scroll::-webkit-scrollbar-thumb {
        background: var(--border-mid);
        border-radius: 2px;
    }

.po-cycle-histogram {
    display: grid;
    grid-template-columns: repeat(12, 52px);
    gap: 4px;
    align-items: end;
    min-height: 160px;
    padding: 12px 0 8px;
}

.po-bucket {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    min-height: 140px;
    min-width: var(--po-tap);
    color: inherit;
    position: relative;
}

    .po-bucket:active .po-bucket-bar {
        opacity: 0.7;
    }

    .po-bucket:focus-visible {
        outline: none;
    }

        .po-bucket:focus-visible .po-bucket-bar {
            outline: 2px solid var(--navy);
            outline-offset: 2px;
        }

.po-bucket-count {
    font-family: var(--platform-font-display);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    transition: color .15s;
}

.po-bucket-count--zero {
    color: var(--text-muted);
    font-weight: 400;
}

.po-bucket-bar {
    width: 70%;
    min-height: 2px;
    background: var(--navy-mid);
    border-radius: 2px 2px 0 0;
    transition: opacity .15s ease;
}

.po-bucket-bar--intake {
    background: #7B8AB0;
}

.po-bucket-bar--calc {
    background: #4E6BA5;
}

.po-bucket-bar--recon {
    background: var(--po-amber);
}

.po-bucket-bar--approve {
    background: var(--navy-mid);
}

.po-bucket-bar--output {
    background: var(--navy);
}

.po-bucket-bar--post {
    background: var(--po-green);
}

.po-bucket-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-mid);
    letter-spacing: 0.03em;
    font-weight: 500;
    padding-top: 6px;
    border-top: 1px solid var(--border);
    width: 100%;
    text-align: center;
}

.po-bucket--today .po-bucket-label {
    color: var(--navy);
    font-weight: 700;
    border-top-color: var(--navy);
}

.po-bucket--today::after {
    content: "today";
    position: absolute;
    bottom: -16px;
    font-size: 0.55rem;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}

.po-cycle-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 24px;
    text-align: center;
}

.po-cycle-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--po-panel-rule);
    font-size: 0.7rem;
    color: var(--text-subtle);
}

    .po-cycle-legend span {
        display: inline-flex;
        align-items: center;
        gap: 5px;
    }

.po-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.po-dot--intake {
    background: #7B8AB0;
}

.po-dot--calc {
    background: #4E6BA5;
}

.po-dot--recon {
    background: var(--po-amber);
}

.po-dot--approve {
    background: var(--navy-mid);
}

.po-dot--output {
    background: var(--navy);
}

.po-dot--post {
    background: var(--po-green);
}

/* ==========================================================================
   ATTENTION LIST
   ========================================================================== */

.po-attention {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.po-attention-item {
    display: grid;
    grid-template-columns: 20px 1fr; /* action col added on ≥640px */
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--po-panel-rule);
    cursor: pointer;
    min-height: var(--po-tap);
    align-items: start;
}

    .po-attention-item:last-child {
        border-bottom: none;
    }

    .po-attention-item:active {
        background: var(--po-panel-hover);
        margin: 0 -4px;
        padding: 12px 4px;
        border-radius: 6px;
    }

    .po-attention-item:focus-visible {
        outline: 2px solid var(--navy);
        outline-offset: -2px;
    }

.po-sev {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.po-sev--critical {
    background: var(--po-red);
}

.po-sev--high {
    background: var(--po-amber);
}

.po-sev--medium {
    background: #C9A24E;
}

.po-sev--low {
    background: var(--text-muted);
}

.po-sev--critical.po-sev--pulse {
    animation: po-dotpulse 1.6s infinite;
}

/* Keyframe grouped directly below the element that uses it */
@keyframes po-dotpulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(160, 25, 50, 0.6);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(160, 25, 50, 0);
    }
}

.po-attention-client {
    font-family: var(--platform-font-display);
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.25;
    letter-spacing: -0.005em;
}

.po-attention-reason {
    font-size: 0.82rem;
    color: var(--text-mid);
    line-height: 1.45;
    margin-top: 3px;
    font-weight: 300;
}

.po-attention-meta {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 6px;
    word-break: break-word;
}

.po-attention-action {
    display: none; /* hidden on mobile — whole row taps */
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-top: 6px;
    white-space: nowrap;
    align-self: start;
}

    .po-attention-action::after {
        content: " \2192";
    }

/* ==========================================================================
   WORKFLOW GRID
   ========================================================================== */

.po-workflow-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.po-wf {
    background: var(--po-panel-bg);
    padding: 12px 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-height: 68px;
    cursor: pointer;
    border: none;
    text-align: left;
    font-family: inherit;
    color: inherit;
}

    .po-wf:active {
        background: var(--po-panel-hover);
    }

    .po-wf:focus-visible {
        outline: 2px solid var(--navy);
        outline-offset: -2px;
    }

.po-wf-count {
    font-family: var(--platform-font-display);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.po-wf-label {
    font-size: 0.68rem;
    color: var(--text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}

.po-wf--flagged .po-wf-count {
    color: var(--po-red);
}

.po-wf--flagged {
    background: var(--po-red-pale);
}

.po-wf--warn .po-wf-count {
    color: var(--po-amber);
}

.po-wf--good .po-wf-count {
    color: var(--po-green);
}

.po-wf--zero .po-wf-count {
    color: var(--text-muted);
    font-weight: 400;
}

.po-wf--zero {
    cursor: default;
    opacity: 0.55;
}

/* ==========================================================================
   COMPLIANCE TABLE
   ========================================================================== */

.po-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

    .po-table th {
        font-size: 0.64rem;
        font-weight: 500;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        padding: 4px 6px 8px;
        text-align: right;
        border-bottom: 1px solid var(--navy);
        font-family: var(--platform-font-body);
    }

        .po-table th:first-child {
            text-align: left;
        }

    .po-table td {
        padding: 10px 6px;
        font-family: var(--font-mono);
        font-variant-numeric: tabular-nums;
        text-align: right;
        border-bottom: 1px solid var(--po-panel-rule);
    }

        .po-table td:first-child {
            font-family: var(--platform-font-body);
            text-align: left;
            font-weight: 500;
            color: var(--text);
            font-size: 0.85rem;
        }

    .po-table tr:last-child td {
        border-bottom: none;
    }

    .po-table tbody tr {
        cursor: pointer;
        min-height: var(--po-tap);
    }

        .po-table tbody tr:active {
            background: var(--po-panel-hover);
        }

.po-c-ok {
    color: var(--po-green);
    font-weight: 600;
}

.po-c-due {
    color: var(--po-amber);
    font-weight: 600;
}

.po-c-miss {
    color: var(--po-red);
    font-weight: 600;
}

.po-rule-meta {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--po-panel-rule);
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-subtle);
    flex-wrap: wrap;
    gap: 8px;
}

    .po-rule-meta b {
        color: var(--text);
        font-weight: 600;
    }

.po-pending {
    color: var(--po-amber);
}

/* ==========================================================================
   FINANCIAL
   ========================================================================== */

.po-fin-primary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--po-panel-rule);
}

.po-fin-label {
    font-size: 0.68rem;
    color: var(--text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
    margin-bottom: 3px;
}

.po-fin-value {
    font-family: var(--platform-font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    word-break: break-word;
}

.po-fin-ccy {
    font-family: var(--platform-font-body);
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    margin-right: 6px;
}

.po-fin-spark {
    width: 100%;
    height: 38px;
    margin: 10px 0;
    display: block;
}

.po-fin-list {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.po-fin-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 10px 0;
    border-bottom: 1px solid var(--po-panel-rule);
    gap: 8px;
}

    .po-fin-row:last-child {
        border-bottom: none;
    }

    .po-fin-row dt {
        font-size: 0.78rem;
        color: var(--text-mid);
        font-weight: 400;
    }

    .po-fin-row dd {
        margin: 0;
        font-family: var(--font-mono);
        font-size: 0.88rem;
        color: var(--text);
        font-weight: 500;
        font-variant-numeric: tabular-nums;
        text-align: right;
    }

.po-delta {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    margin-left: 6px;
    font-weight: 500;
    letter-spacing: 0.02em;
    display: inline-block;
}

.po-delta--up {
    color: var(--po-green);
}

.po-delta--down {
    color: var(--po-red);
}

/* ==========================================================================
   ANOMALY GRID
   ========================================================================== */

.po-anomaly-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.po-anomaly {
    background: var(--po-panel-bg);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    cursor: pointer;
    border: none;
    text-align: left;
    font-family: inherit;
    color: inherit;
    min-height: 90px;
}

    .po-anomaly:active {
        background: var(--po-panel-hover);
    }

    .po-anomaly:focus-visible {
        outline: 2px solid var(--navy);
        outline-offset: -2px;
    }

    .po-anomaly:disabled,
    .po-anomaly--zero {
        cursor: default;
    }

.po-anomaly-count {
    font-family: var(--platform-font-display);
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.po-anomaly--zero .po-anomaly-count {
    color: var(--po-green);
}

.po-anomaly--low .po-anomaly-count {
    color: var(--po-amber);
}

.po-anomaly--high .po-anomaly-count {
    color: var(--po-red);
}

.po-anomaly-label {
    font-size: 0.66rem;
    color: var(--text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
    margin-top: 3px;
    line-height: 1.3;
}

.po-anomaly-note {
    font-size: 0.66rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 3px;
    line-height: 1.35;
}

/* ==========================================================================
   PORTFOLIO
   ========================================================================== */

.po-portfolio {
    margin: 0;
    padding: 0;
}

.po-portfolio-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 9px 0;
    border-bottom: 1px solid var(--po-panel-rule);
}

    .po-portfolio-row:last-child {
        border-bottom: none;
    }

    .po-portfolio-row dt {
        font-size: 0.78rem;
        color: var(--text-mid);
        margin: 0;
    }

    .po-portfolio-row dd {
        margin: 0;
        font-family: var(--font-mono);
        font-size: 0.88rem;
        font-weight: 500;
        color: var(--text);
        font-variant-numeric: tabular-nums;
    }

.po-portfolio-warn {
    color: var(--po-amber);
}

.po-capacity {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--po-panel-rule);
}

.po-capacity-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--text-subtle);
    letter-spacing: 0.04em;
    margin-bottom: 8px;
    text-transform: uppercase;
    font-weight: 500;
    gap: 8px;
    flex-wrap: wrap;
}

    .po-capacity-label b {
        color: var(--navy);
        font-family: var(--font-mono);
        font-weight: 600;
    }

.po-capacity-bar {
    position: relative;
    height: 6px;
    background: var(--navy-pale);
    border-radius: 3px;
    overflow: visible;
}

.po-capacity-fill {
    height: 100%;
    background: var(--navy);
    border-radius: 3px;
    max-width: 100%;
}

.po-capacity-marker {
    position: absolute;
    top: -3px;
    width: 2px;
    height: 12px;
    background: var(--text);
    transform: translateX(-1px);
}

.po-capacity-rule {
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.64rem;
    color: var(--text-muted);
}

/* ==========================================================================
   TICKER
   ========================================================================== */

.po-ticker {
    background: var(--navy);
    color: rgba(255, 255, 255, 0.85);
    border-radius: 10px;
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.02em;
}

.po-ticker-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    color: var(--white);
    font-family: inherit;
    font-size: inherit;
    text-align: left;
    min-height: var(--po-tap);
}

.po-ticker-summary-title {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.55);
}

.po-ticker-summary-count {
    background: rgba(255, 255, 255, 0.12);
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 0.72rem;
    color: var(--white);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

    .po-ticker-summary-count::after {
        content: "▾";
        transition: transform .2s;
        color: rgba(255, 255, 255, 0.7);
    }

.po-ticker[data-expanded="true"] .po-ticker-summary-count::after {
    transform: rotate(180deg);
}

.po-ticker-track {
    display: none; /* hidden on mobile until expanded */
    padding: 4px 16px 16px;
    list-style: none;
    margin: 0;
}

.po-ticker[data-expanded="true"] .po-ticker-track {
    display: block;
}

.po-ticker-track li {
    padding: 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.45;
    font-size: 0.75rem;
}

    .po-ticker-track li b {
        color: var(--white);
        font-weight: 600;
    }

.po-t-warn {
    color: #FFBFB0 !important;
}

/* Keyframe grouped directly below the element that uses it */
@keyframes po-ticker-scroll {
    from {
        transform: translate3d(0, 0, 0);
    }

    to {
        transform: translate3d(-100%, 0, 0);
    }
}

/* ==========================================================================
   DRILL-DOWN (bottom-sheet on mobile)
   ========================================================================== */

.po-drill {
    position: fixed;
    inset: 0;
    z-index: 200;
    pointer-events: none;
    opacity: 0;
    transition: opacity .25s ease;
}

    .po-drill[aria-hidden="false"] {
        pointer-events: auto;
        opacity: 1;
    }

.po-drill-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(11, 18, 38, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.po-drill-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 85vh;
    background: var(--bg);
    border-top: 1px solid var(--navy);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 24px rgba(0, 40, 104, 0.18);
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.2,.9,.3,1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.po-drill[aria-hidden="false"] .po-drill-panel {
    transform: translateY(0);
}

/* Drag handle */
.po-drill-panel::before {
    content: "";
    display: block;
    width: 40px;
    height: 4px;
    background: var(--border-mid);
    border-radius: 2px;
    margin: 8px auto 0;
    flex-shrink: 0;
}

.po-drill-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 18px 16px;
    border-bottom: 1px solid var(--po-panel-rule);
}

.po-drill-eyebrow {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}

.po-drill-title {
    font-family: var(--platform-font-display);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.po-drill-meta {
    margin-top: 4px;
    font-size: 0.78rem;
    color: var(--text-subtle);
    font-weight: 300;
}

.po-drill-close {
    background: none;
    border: 1px solid var(--border-mid);
    border-radius: 6px;
    min-width: var(--po-tap);
    min-height: var(--po-tap);
    font-size: 1.1rem;
    color: var(--text-mid);
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
}

    .po-drill-close:active {
        background: var(--navy-pale);
        color: var(--navy);
    }

.po-drill-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 18px 24px;
}

.po-drill-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.po-drill-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 12px 0;
    border-bottom: 1px solid var(--po-panel-rule);
    cursor: pointer;
    align-items: center;
    min-height: var(--po-tap);
}

    .po-drill-item:active {
        background: var(--po-panel-hover);
        margin: 0 -8px;
        padding: 12px 8px;
        border-radius: 6px;
    }

    .po-drill-item:last-child {
        border-bottom: none;
    }

.po-drill-client {
    font-family: var(--platform-font-display);
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: 3px;
}

.po-drill-sub {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.po-drill-status {
    font-size: 0.66rem;
    font-weight: 600;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 9px;
    background: var(--navy-pale);
    border: 1px solid var(--border-mid);
    border-radius: 100px;
    white-space: nowrap;
}

.po-drill-status--warn {
    color: var(--po-amber);
    background: var(--po-amber-pale);
    border-color: var(--po-amber);
}

.po-drill-status--crit {
    color: var(--po-red);
    background: var(--po-red-pale);
    border-color: var(--po-red);
}

.po-drill-status--ok {
    color: var(--po-green);
    background: var(--po-green-pale);
    border-color: var(--po-green);
}

.po-drill-empty {
    padding: 40px 0;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

/* ==========================================================================
   RESPONSIVE OVERRIDES & MEDIA QUERIES
   (grouped at the bottom per mobile-first pattern)
   ========================================================================== */

@media (min-width: 640px) {
    .po-shell {
        padding: 24px 20px 40px;
    }

    .po-headline {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-end;
        gap: 24px;
        padding-bottom: 16px;
        margin-bottom: 20px;
    }

    .po-headline-right {
        width: auto;
        justify-content: flex-end;
        flex-direction: column;
        align-items: flex-end;
    }

    .po-title {
        font-size: 2rem;
    }

    /* KPIs grid, no more horizontal scroll */
    /* KPI STRIP — Clean Stacked Layout */
    .po-kpi-strip {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 16px;
        /* Carousel overflow and snap properties removed */
    }

    /* REMOVE: The entire .po-kpi-strip::-webkit-scrollbar block is no longer needed */

    .po-kpi {
        background: var(--po-panel-bg);
        border: 1px solid var(--po-panel-rule);
        border-radius: 10px;
        padding: 14px 16px 12px;
        display: flex;
        flex-direction: column;
        gap: 4px;
        transition: transform 0.2s ease, border-color 0.2s ease;
        cursor: pointer;
        /* Flex-basis and scroll-snap-align removed */
    }

    .po-workflow-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .po-anomaly-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .po-fin-primary {
        grid-template-columns: 1fr 1fr;
    }

    .po-attention-item {
        grid-template-columns: 22px 1fr auto;
    }

    .po-attention-action {
        display: block;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ≥ 900px — TABLET / SMALL LAPTOP
   ═══════════════════════════════════════════════════════════════════════════ */

@media (min-width: 900px) {
    .po-shell {
        padding: 32px 28px 44px;
    }

    .po-title {
        font-size: 2.35rem;
    }

    /* KPI strip becomes full 5-across connected strip */
    /* MOBILE FIRST (default) */
    .po-kpi-strip {
        display: grid;
        grid-template-columns: 1fr; /* stack one per row */
        gap: 12px;
        background: none;
        border: none;
    }

    .po-kpi {
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 16px 18px 14px;
    }

    .po-kpi-value {
        font-size: 1.75rem;
    }

    /* Tablet */
    @media (min-width:540px) {
        .po-kpi-strip {
            grid-template-columns: 1fr 1fr;
        }
    }

    /* Desktop restores connected strip */
    @media (min-width:1100px) {

        .po-kpi-strip {
            grid-template-columns: repeat(5,1fr);
            background: var(--border);
            border: 1px solid var(--border);
            border-radius: 10px;
            overflow: hidden;
            gap: 1px;
        }

        .po-kpi {
            border: none;
            border-radius: 0;
        }
    }

    .po-grid {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        gap: 18px;
    }
    /* Reset mobile order; desktop follows source order */
    .po-panel[aria-labelledby] {
        order: unset;
    }

    .po-panel--span1 {
        grid-column: span 3;
    }

    .po-panel--span2 {
        grid-column: span 3;
    }

    .po-panel--span3 {
        grid-column: span 6;
    }

    .po-panel {
        padding: 18px 20px;
    }

    .po-panel-title {
        font-size: 1.25rem;
    }

    .po-panel-sub {
        font-size: 0.8rem;
    }

    /* CYCLE DISTRIBUTION — Mobile Stacked Layout */
    .po-cycle-scroll {
        overflow-x: visible;
        padding: 0;
        margin: 0;
    }

    .po-cycle-histogram {
        display: flex;
        flex-direction: column; /* Stack vertically */
        gap: 12px;
        height: auto; /* Remove fixed height */
        padding: 8px 0;
    }

    .po-bucket {
        display: grid;
        grid-template-columns: 45px 1fr 30px; /* Label | Bar | Count */
        align-items: center;
        gap: 12px;
        height: 32px; /* Consistent row height */
        width: 100%;
        padding: 0;
        border: none;
        background: transparent;
    }

    .po-bucket-label {
        text-align: left;
        border-top: none; /* Remove the horizontal-view border */
        font-size: 0.85rem;
        padding: 0;
    }

    /* IMPORTANT: Since your JS currently sets "height: XX%", 
   we force that height value to act as the width on mobile. 
*/
    .po-bucket-bar {
        height: 12px !important; /* Fixed thickness for the horizontal bar */
        width: var(--bar-width, 0%); /* See JS note below */
        border-radius: 0 4px 4px 0;
        margin: 0;
    }

    .po-bucket-count {
        font-size: 0.9rem;
        font-weight: 600;
        text-align: right;
    }

    .po-cycle-hint {
        display: none; /* Hide swipe hint on mobile */
    }
    @media (min-width: 900px) {
        .po-cycle-histogram {
            display: grid;
            grid-template-columns: repeat(12, 1fr);
            align-items: end;
            height: 160px;
            gap: 4px;
        }

        .po-bucket {
            display: flex;
            flex-direction: column;
            justify-content: flex-end;
            height: 100%;
        }

        .po-bucket-bar {
            width: 100% !important; /* Full width of the grid column */
            height: var(--bar-height, 0%) !important; /* Dynamic height */
            border-radius: 4px 4px 0 0;
        }

        .po-bucket-label {
            border-top: 1px solid var(--po-panel-rule);
            text-align: center;
            padding-top: 8px;
        }

        .po-cycle-hint {
            display: block; /* Show swipe hint if needed for overflow */
        }
    }
    .po-workflow-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .po-wf {
        min-height: 76px;
        padding: 14px;
    }

    .po-wf-count {
        font-size: 1.55rem;
    }

    .po-anomaly-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .po-anomaly {
        min-height: 96px;
        padding: 14px 16px;
    }

    .po-anomaly-count {
        font-size: 1.7rem;
    }

    .po-fin-value {
        font-size: 1.6rem;
    }

    /* 1. Hide the summary toggle (not needed for a continuous scroll) */
    .po-ticker-summary {
        display: none;
    }

    /* 2. Setup the "Window" */
    .po-ticker {
        margin: 12px 0 20px;
        overflow: hidden; /* This hides the text outside the box */
        background: var(--po-panel-bg);
        border: 1px solid var(--po-panel-rule);
        border-radius: 8px;
    }

    /* 3. Force the Track to be a horizontal strip */
    .po-ticker-track {
        display: flex !important; /* Override the 'none' display */
        flex-direction: row; /* Horizontal layout */
        flex-wrap: nowrap;
        white-space: nowrap; /* Keep text on one line */
        gap: 50px; /* Space between updates */
        padding: 10px 0;
        width: max-content;
        /* Apply the animation you already have in your keyframes */
        animation: po-ticker-scroll 30s linear infinite;
    }

        /* 4. Clean up list items for the horizontal view */
        .po-ticker-track li {
            border-top: none;
            padding: 0;
            display: flex;
            align-items: center;
            font-size: 0.85rem;
        }

    @media (prefers-reduced-motion: reduce) {
        .po-ticker-track {
            animation: none;
            padding-left: 0;
            white-space: normal;
        }

            .po-ticker-track li {
                display: block;
                margin: 6px 16px;
                padding: 4px 0;
            }
    }

    /* Drill-down: right side-slide on tablet+ */
    .po-drill-panel {
        top: 0;
        right: 0;
        bottom: 0;
        left: auto;
        width: min(520px, 70vw);
        max-height: none;
        border-radius: 0;
        border-top: none;
        border-left: 1px solid var(--navy);
        box-shadow: -12px 0 40px rgba(0, 40, 104, 0.12);
        transform: translateX(100%);
    }

    .po-drill[aria-hidden="false"] .po-drill-panel {
        transform: translateX(0);
    }

    .po-drill-panel::before {
        display: none;
    }

    .po-drill-head {
        padding: 22px 24px 18px;
    }

    .po-drill-title {
        font-size: 1.4rem;
    }

    .po-drill-body {
        padding: 16px 24px 28px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ≥ 1200px — LAPTOP / DESKTOP
   ═══════════════════════════════════════════════════════════════════════════ */

@media (min-width: 1200px) {
    .po-shell {
        padding: 40px 32px 48px;
        max-width: 1440px;
        margin: 0 auto;
    }

    .po-title {
        font-size: 2.6rem;
    }

    .po-kpi-value {
        font-size: 1.9rem;
    }

    .po-grid {
        gap: 20px;
    }

    .po-panel--span1 {
        grid-column: span 2;
    }

    .po-panel--span2 {
        grid-column: span 3;
    }

    .po-panel--span3 {
        grid-column: span 6;
    }

    .po-panel {
        padding: 20px 22px;
    }

    .po-panel-title {
        font-size: 1.35rem;
    }

    .po-panel-sub {
        font-size: 0.85rem;
    }

    .po-bucket-count {
        font-size: 1.4rem;
    }

    .po-wf-count {
        font-size: 1.6rem;
    }

    .po-anomaly-count {
        font-size: 1.85rem;
    }

    .po-fin-value {
        font-size: 1.65rem;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRINT
   ═══════════════════════════════════════════════════════════════════════════ */

@media print {
    .po-ticker, .po-drill, .po-panel-foot-link {
        display: none;
    }

    .po-panel {
        break-inside: avoid;
        page-break-inside: avoid;
        border: 1px solid #ccc;
    }
}
