/* ============================================================
   VBI Widget Primitives
   ------------------------------------------------------------
   Reusable BOARD-form widget tiles. Mobile-first; the BOARD
   dashboard page (dashboards/board.css) lays them out in a
   responsive grid.
   ============================================================ */

/* ── RAG band tokens (lean on the design-system palette) ───── */

.vbi-rag-dot {
    display:        inline-block;
    width:          12px;
    height:         12px;
    border-radius:  50%;
    background:     var(--color-amber);
    flex:           0 0 12px;
    box-shadow:     0 0 0 2px rgba(255,255,255,0.06);
}

.vbi-rag-dot--green   { background: var(--color-green); }
.vbi-rag-dot--amber   { background: var(--color-amber); }
.vbi-rag-dot--red     { background: var(--color-red); }
.vbi-rag-dot--unknown { background: var(--text-muted); }

.vbi-rag--green   { --vbi-rag-accent: var(--color-green); }
.vbi-rag--amber   { --vbi-rag-accent: var(--color-amber); }
.vbi-rag--red     { --vbi-rag-accent: var(--color-red); }
.vbi-rag--unknown { --vbi-rag-accent: rgba(237,232,219,0.30); }


/* ── Tile shell ───────────────────────────────────────────── */

/* Entry animation — polished load reveal */
@keyframes vbi-tile-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

.vbi-tile {
    background:    var(--surface-card);
    border:        1px solid var(--surface-border);
    border-radius: var(--radius-md);
    padding:       var(--space-3);
    color:         var(--text-primary);
    display:       flex;
    flex-direction: column;
    gap:           var(--space-1);
    position:      relative;
    box-shadow:    0 1px 0 rgba(0,0,0,0.20);
    transition:    box-shadow 150ms ease, border-color 150ms ease;
    animation:     vbi-tile-in 220ms ease both;
}

.vbi-tile:hover {
    border-color: rgba(237,232,219,0.22);
    box-shadow:   0 3px 12px rgba(0,0,0,0.28);
}

.vbi-tile:focus-within {
    border-color: var(--color-teal);
    box-shadow:   0 0 0 3px var(--color-teal-glow);
}

/* Compact modifier — alert-strip tiles */
.vbi-tile--compact {
    padding: var(--space-2);
    gap:     var(--space-1);
}

.vbi-tile__header {
    font-size:      var(--text-xs);
    font-weight:    600;
    color:          var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.vbi-tile__headline,
.vbi-tile__headline-row {
    display:     flex;
    align-items: baseline;
    gap:         var(--space-1);
    color:       var(--text-primary);
}

.vbi-tile__headline-value {
    font-size:   var(--text-2xl);
    font-weight: 700;
    line-height: 1.1;
    color:       var(--vbi-rag-accent, var(--color-gold));
}

/* KPI tiles keep the big number — it IS the point */
.vbi-tile--kpi .vbi-tile__headline-value {
    font-size: var(--text-4xl);
}

.vbi-tile__headline-unit {
    font-size: var(--text-sm);
    color:     var(--text-secondary);
}

.vbi-tile__narrative,
.vbi-tile__sentence,
.vbi-tile__ref,
.vbi-tile__range {
    font-size:   var(--text-sm);
    line-height: 1.5;
    color:       var(--text-secondary);
    margin:      0;
}

.vbi-tile__sentence--forecast { color: var(--text-primary); }
.vbi-tile__ref                { color: var(--text-muted); }

.vbi-tile__empty {
    color:      var(--text-muted);
    font-size:  var(--text-sm);
    font-style: italic;
}


/* ── Plain-sentence card (alerts) ─────────────────────────── */

.vbi-tile--sentence {
    flex-direction: row;
    align-items:    flex-start;
    gap:            var(--space-3);
    padding:        var(--space-2) var(--space-3);
    min-height:     auto;
}

.vbi-tile--sentence .vbi-tile__rag-dot {
    width:         14px;
    height:        14px;
    border-radius: 50%;
    background:    var(--vbi-rag-accent, var(--color-amber));
    flex:          0 0 14px;
    margin-top:    var(--space-1);
    box-shadow:    0 0 0 2px rgba(255,255,255,0.06);
}

.vbi-tile__body  { flex: 1 1 auto; display: flex; flex-direction: column; gap: var(--space-1); }
.vbi-tile__title { margin: 0; font-size: var(--text-base); font-weight: 600; }

.vbi-tile__dismiss {
    width:           44px;
    height:          44px;
    border-radius:   var(--radius-sm);
    border:          1px solid transparent;
    background:      transparent;
    color:           var(--text-secondary);
    font-size:       1.5rem;
    line-height:     1;
    cursor:          pointer;
    flex:            0 0 44px;
}

.vbi-tile__dismiss:hover,
.vbi-tile__dismiss:focus-visible {
    background:   var(--surface-card-hover);
    color:        var(--text-primary);
    border-color: var(--surface-border-mid);
}


/* ── Statutory RAG matrix — card grid (W-AN-04) ──────────── */

.vbi-rag-matrix {
    list-style: none;
    padding:    0;
    margin:     0;
    display:    flex;
    flex-direction: column;
    gap:        var(--space-1);
}

/* Card-grid variant (redesigned) */
.vbi-rag-matrix--cards {
    display:               grid;
    grid-template-columns: 1fr;
    gap:                   3px;
}

.vbi-rag-matrix__card {
    display:       grid;
    grid-template-columns: 52px 1fr auto;
    align-items:   center;
    gap:           var(--space-2);
    padding:       6px var(--space-2);
    border-radius: var(--radius-sm);
    border:        1px solid var(--surface-border);
    background:    var(--surface-card-hover);
    border-left:   3px solid var(--surface-border);
    transition:    background 120ms ease;
}
.vbi-rag-matrix__card:hover { background: rgba(237,232,219,0.07); }

.vbi-rag-matrix__card--green  { border-left-color: var(--color-green); }
.vbi-rag-matrix__card--amber  { border-left-color: var(--color-amber); }
.vbi-rag-matrix__card--red    { border-left-color: var(--color-red); background: rgba(232,92,92,0.05); }
.vbi-rag-matrix__card--unknown { border-left-color: var(--text-muted); }

.vbi-rag-matrix__status {
    display:        flex;
    flex-direction: column;
    align-items:    center;
    gap:            2px;
}
.vbi-rag-matrix__band-label {
    font-size:      0.62rem;
    font-weight:    700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color:          var(--text-muted);
}
.vbi-rag-matrix__card--red .vbi-rag-matrix__band-label   { color: var(--color-red); }
.vbi-rag-matrix__card--amber .vbi-rag-matrix__band-label { color: var(--color-amber); }
.vbi-rag-matrix__card--green .vbi-rag-matrix__band-label { color: var(--color-green); }

.vbi-rag-matrix__content {
    display:        flex;
    flex-direction: column;
    gap:            1px;
    min-width:      0;
}

.vbi-rag-matrix__label {
    font-weight:   500;
    color:         var(--text-primary);
    font-size:     var(--text-sm);
    white-space:   nowrap;
    overflow:      hidden;
    text-overflow: ellipsis;
}

.vbi-rag-matrix__ref {
    font-size:   0.67rem;
    color:       var(--text-muted);
    font-family: var(--font-mono);
    white-space: nowrap;
    overflow:    hidden;
    text-overflow: ellipsis;
}

/* Legacy (plain list fallback) */
.vbi-rag-matrix__row {
    display:       flex;
    align-items:   center;
    gap:           var(--space-2);
    padding:       var(--space-1) var(--space-2);
    background:    var(--surface-card-hover);
    border-radius: var(--radius-sm);
    border:        1px solid var(--surface-border);
    min-height:    36px;
    flex-wrap:     wrap;
}


/* ── CSS-grid heatmap (HeatmapTile redesign) ──────────────── */

.vbi-hm-wrap {
    width:      100%;
    overflow-x: auto;
    overflow-y: hidden;
    /* subtle scroll indicator */
    background: linear-gradient(to right, transparent calc(100% - 24px), rgba(237,232,219,0.06));
    border-radius: var(--radius-sm);
    margin-top: var(--space-1);
}

.vbi-hm-grid {
    display:    grid;
    gap:        2px;
    min-width:  max-content;
    padding:    4px;
}

.vbi-hm-corner {
    /* empty top-left cell */
    min-width:  70px;
}

.vbi-hm-col-label {
    font-size:      0.58rem;
    font-weight:    700;
    color:          var(--text-secondary);
    text-align:     center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding:        2px 3px 4px;
    white-space:    nowrap;
    overflow:       hidden;
    text-overflow:  ellipsis;
    max-width:      60px;
}

.vbi-hm-row-label {
    font-size:      0.62rem;
    color:          var(--text-secondary);
    text-align:     right;
    padding-right:  6px;
    display:        flex;
    align-items:    center;
    justify-content: flex-end;
    white-space:    nowrap;
    min-width:      60px;
    max-width:      80px;
    overflow:       hidden;
    text-overflow:  ellipsis;
}

.vbi-hm-cell {
    display:        flex;
    align-items:    center;
    justify-content: center;
    min-width:      28px;
    height:         22px;
    border-radius:  3px;
    border:         1px solid transparent;
    font-size:      0.6rem;
    font-weight:    700;
    color:          var(--text-primary);
    font-variant-numeric: tabular-nums;
    cursor:         default;
    transition:     filter 120ms ease, outline 80ms;
    position:       relative;
}
.vbi-hm-cell:hover { filter: brightness(1.18); outline: 1px solid rgba(255,255,255,0.25); }
/* CSS tooltip for heatmap cells */
.vbi-hm-cell[data-vbi-tip]::after { bottom: calc(100% + 4px); font-size: 0.65rem; }


/* ── Infographic donut layout (W-AN-01 full-tenant scope) ──── */

.vbi-infographic__donut-row {
    display:     flex;
    align-items: center;
    gap:         var(--space-3);
    flex-wrap:   wrap;
    margin-top:  var(--space-1);
    min-height:  140px;
}

.vbi-infographic__donut-stats {
    display:        flex;
    flex-direction: column;
    gap:            var(--space-1);
    min-width:      0;
    flex:           1 1 auto;
}


/* ── DonutTile SVG proportionate sizing ───────────────────── */

.vbi-donut {
    display:   block;
    width:     100%;
    max-width: 160px;
    height:    auto;
    flex-shrink: 0;
}

.vbi-donut__row {
    display:     flex;
    align-items: center;
    gap:         var(--space-3);
    flex-wrap:   wrap;
    margin-top:  var(--space-2);
    min-height:  120px;
}

.vbi-donut__legend {
    flex:           1 1 120px;
    list-style:     none;
    padding:        0;
    margin:         0;
    display:        flex;
    flex-direction: column;
    gap:            var(--space-1);
    min-width:      0;
}

.vbi-donut__legend-item {
    display:     flex;
    align-items: center;
    gap:         var(--space-1);
    font-size:   var(--text-xs);
    color:       var(--text-secondary);
}

.vbi-donut__legend-dot {
    width:         10px;
    height:        10px;
    border-radius: 50%;
    flex-shrink:   0;
}
/* index-based colours */
.vbi-donut__legend-dot--0 { background: var(--color-teal); }
.vbi-donut__legend-dot--1 { background: var(--color-amber); }
.vbi-donut__legend-dot--2 { background: var(--color-green); }
.vbi-donut__legend-dot--3 { background: var(--color-red); }
.vbi-donut__legend-dot--4 { background: var(--color-gold-light); }

.vbi-donut__headline {
    font-size:   14px;
    font-weight: 700;
    fill:        var(--text-primary, #ede8db);
}


/* ── State-override badge + sheet ─────────────────────────── */

.vbi-state-badge {
    display:        inline-block;
    padding:        var(--space-1) var(--space-2);
    background:     var(--color-gold-glow);
    color:          var(--color-gold-light);
    border:         1px solid var(--color-gold-border);
    border-radius:  9999px;
    font-size:      var(--text-xs);
    font-weight:    600;
    cursor:         pointer;
    min-height:     28px;
    line-height:    1.2;
}

.vbi-state-badge:focus-visible {
    outline:        2px solid var(--color-teal);
    outline-offset: 2px;
}

.vbi-state-badge--missing {
    background: repeating-linear-gradient(
        45deg,
        rgba(237,232,219,0.08), rgba(237,232,219,0.08) 6px,
        rgba(237,232,219,0.18) 6px, rgba(237,232,219,0.18) 12px
    );
    color:        var(--text-secondary);
    border-color: var(--surface-border-mid);
}

.vbi-state-sheet {
    margin-top:    var(--space-3);
    padding:       var(--space-3);
    background:    var(--surface-elevated);
    border:        1px solid var(--surface-border);
    border-radius: var(--radius-sm);
}

.vbi-state-sheet__heading {
    margin:         0 0 var(--space-2) 0;
    font-size:      var(--text-base);
    color:          var(--text-primary);
}

.vbi-state-sheet__list {
    list-style: none;
    padding:    0;
    margin:     0;
    display:    flex;
    flex-direction: column;
    gap:        var(--space-1);
}

.vbi-state-sheet__row {
    display:         flex;
    justify-content: space-between;
    gap:             var(--space-3);
    padding:         var(--space-1) var(--space-2);
    border-bottom:   1px solid var(--surface-border);
    font-size:       var(--text-xs);
    flex-wrap:       wrap;
}

.vbi-state-sheet__row--missing { color: var(--text-muted); font-style: italic; }
.vbi-state-sheet__label        { font-weight: 600; color: var(--text-primary); }
.vbi-state-sheet__value        { color: var(--text-secondary); }

.vbi-state-sheet__close {
    margin-top:    var(--space-3);
    padding:       var(--space-2) var(--space-4);
    background:    transparent;
    border:        1px solid var(--surface-border-mid);
    border-radius: var(--radius-sm);
    color:         var(--text-primary);
    cursor:        pointer;
    min-height:    44px;
    min-width:     88px;
}

.vbi-state-sheet__close:hover { background: var(--surface-card-hover); }


/* ── Sparkline ─────────────────────────────────────────────── */

.vbi-sparkline {
    width:  100%;
    height: 36px;
    color:  var(--vbi-rag-accent, var(--color-teal));
    margin-top: var(--space-1);
}


/* ── Confidence pill ──────────────────────────────────────── */

.vbi-tile__meta-row {
    display:    flex;
    flex-wrap:  wrap;
    gap:        var(--space-2);
    margin-top: var(--space-2);
}

.vbi-confidence-pill {
    display:       inline-block;
    padding:       2px var(--space-2);
    border-radius: 9999px;
    font-size:     0.7rem;
    font-weight:   600;
    background:    var(--color-teal-glow);
    color:         var(--color-teal);
    border:        1px solid var(--color-teal-glow);
}

.vbi-confidence-pill--high { background: var(--color-green-glow, rgba(74,222,128,.15)); color: var(--color-green, #4ade80); border-color: var(--color-green-glow, rgba(74,222,128,.2)); }
.vbi-confidence-pill--mid  { background: var(--color-gold-glow); color: var(--color-gold-light); border-color: var(--color-gold-border); }
.vbi-confidence-pill--low  { background: var(--color-red-glow);  color: var(--color-red);        border-color: var(--color-red-glow); }


/* ── Activity list (W-AN-13) ───────────────────────────────── */

.vbi-activity-list {
    list-style: none;
    padding:    0;
    margin:     0;
    display:    flex;
    flex-direction: column;
    gap:        var(--space-2);
}

.vbi-activity-list__item {
    padding:       var(--space-1) var(--space-2);
    background:    var(--surface-card-hover);
    border-radius: var(--radius-sm);
    border:        1px solid var(--surface-border);
}

.vbi-activity-list__meta {
    font-size:     var(--text-xs);
    color:         var(--text-muted);
    margin-bottom: var(--space-1);
}

.vbi-activity-list__actor   { color: var(--color-gold-light); font-weight: 600; }
.vbi-activity-list__summary { margin: 0; font-size: var(--text-xs); color: var(--text-primary); }

.vbi-activity-list__empty {
    color:      var(--text-muted);
    font-style: italic;
    padding:    var(--space-2);
}


/* ── SHAP Narrative block (ForecastTile VBI-4-U) ─────────── */

.shap-narrative {
    margin-top:     var(--space-2);
    padding:        var(--space-2) var(--space-3);
    background:     rgba(237,232,219,0.05);
    border:         1px solid var(--surface-border);
    border-left:    2px solid var(--color-teal-glow);
    border-radius:  var(--radius-sm);
    display:        flex;
    flex-direction: column;
    gap:            var(--space-1);
}

.shap-narrative__sentence {
    margin:      0;
    font-size:   var(--text-xs);
    line-height: 1.55;
    color:       var(--text-secondary);
    font-style:  italic;
}

.shap-narrative__low-confidence-note,
.low-confidence-note {
    margin:      0;
    font-size:   var(--text-xs);
    color:       var(--color-amber);
    font-weight: 600;
}

.shap-narrative__model-version,
.model-version {
    font-size:      0.65rem;
    color:          var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-top:     var(--space-1);
}


/* ── RAG Countdown tile (W-PR-07) ────────────────────────── */

.vbi-tile--countdown .vbi-tile__headline {
    align-items: center;
    gap:         var(--space-2);
    flex-wrap:   nowrap;
}

.vbi-tile--countdown .vbi-tile__headline-value {
    font-size:   var(--text-4xl);
    font-weight: 900;
    line-height: 1;
    color:       var(--vbi-rag-accent, var(--color-amber));
    flex-shrink: 0;
}

.vbi-tile--countdown .vbi-tile__headline-unit {
    font-size:   var(--text-sm);
    font-weight: 600;
    color:       var(--text-secondary);
    white-space: nowrap;
}


/* ── Audit Evidence Coverage (W-AN-13 custom renderer) ─────── */

.vbi-aec__kpi {
    display:     flex;
    align-items: baseline;
    gap:         var(--space-2);
    margin:      var(--space-1) 0 var(--space-2);
    padding:     var(--space-2) var(--space-3);
    background:  rgba(237,232,219,0.04);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--vbi-rag-accent, var(--color-amber));
}
.vbi-aec__pct {
    font-size:   var(--text-3xl);
    font-weight: 800;
    color:       var(--vbi-rag-accent, var(--color-gold));
    line-height: 1;
}
.vbi-aec__sub {
    font-size: var(--text-sm);
    color:     var(--text-secondary);
}
.vbi-aec__due {
    font-size: var(--text-xs);
    color:     var(--text-muted);
    margin:    0 0 var(--space-2);
}
.vbi-aec__section-title {
    font-size:      var(--text-xs);
    font-weight:    700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color:          var(--text-muted);
    margin:         var(--space-2) 0 var(--space-1);
    padding:        0;
}
.vbi-aec__frameworks {
    display:        flex;
    flex-direction: column;
    gap:            4px;
    margin-bottom:  var(--space-2);
}
.vbi-aec__fw-row {
    display:               grid;
    grid-template-columns: 90px 1fr 38px;
    align-items:           center;
    gap:                   var(--space-2);
}
.vbi-aec__fw-name {
    font-size:     var(--text-xs);
    color:         var(--text-secondary);
    white-space:   nowrap;
    overflow:      hidden;
    text-overflow: ellipsis;
}
.vbi-aec__bar-wrap {
    height:       8px;
    background:   rgba(237,232,219,0.10);
    border-radius: 4px;
    overflow:     hidden;
}
.vbi-aec__bar {
    height:        100%;
    border-radius: 4px;
    background:    var(--vbi-rag-accent, var(--color-amber));
    transition:    width 400ms ease;
}
.vbi-aec__fw-pct {
    font-size:             0.65rem;
    color:                 var(--text-muted);
    text-align:            right;
    font-variant-numeric:  tabular-nums;
}
.vbi-aec__gaps        { margin-bottom: var(--space-1); }
.vbi-aec__gap-list    { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 3px; }
.vbi-aec__gap-item {
    display:     flex;
    align-items: flex-start;
    gap:         var(--space-2);
    padding:     4px var(--space-2);
    background:  rgba(237,232,219,0.04);
    border-radius: var(--radius-sm);
}
.vbi-aec__gap-risk {
    flex-shrink:    0;
    font-size:      0.6rem;
    font-weight:    700;
    padding:        1px 5px;
    border-radius:  3px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.vbi-aec__gap-item--high   .vbi-aec__gap-risk { background: rgba(232,92,92,0.15);  color: var(--color-red);   }
.vbi-aec__gap-item--medium .vbi-aec__gap-risk { background: var(--color-gold-glow); color: var(--color-amber); }
.vbi-aec__gap-item--low    .vbi-aec__gap-risk { background: rgba(237,232,219,0.10); color: var(--text-muted);  }
.vbi-aec__gap-desc { font-size: var(--text-xs); color: var(--text-secondary); line-height: 1.4; }


/* ── Content Drift Forecast (W-PR-05 custom renderer) ───────── */

.vbi-low-confidence-badge {
    display:       inline-block;
    padding:       3px var(--space-2);
    background:    var(--color-gold-glow);
    color:         var(--color-amber);
    border:        1px solid var(--color-gold-border);
    border-radius: var(--radius-sm);
    font-size:     var(--text-xs);
    font-weight:   600;
    margin-bottom: var(--space-2);
}
.vbi-cdf__kpi {
    display:        flex;
    flex-direction: column;
    gap:            2px;
    padding:        var(--space-2) var(--space-3);
    background:     rgba(237,232,219,0.04);
    border-radius:  var(--radius-sm);
    border-left:    3px solid var(--vbi-rag-accent, var(--color-amber));
    margin-bottom:  var(--space-2);
}
.vbi-cdf__point {
    font-size:   var(--text-2xl);
    font-weight: 800;
    color:       var(--vbi-rag-accent, var(--color-gold));
}
.vbi-cdf__interval { font-size: var(--text-xs); color: var(--text-muted); }
.vbi-cdf__meta {
    display:         flex;
    justify-content: space-between;
    align-items:     center;
    gap:             var(--space-2);
    font-size:       var(--text-xs);
    color:           var(--text-secondary);
    margin-bottom:   var(--space-2);
    flex-wrap:       wrap;
}
.vbi-cdf__model-ver {
    font-family:   var(--font-mono);
    font-size:     0.65rem;
    color:         var(--text-muted);
    background:    rgba(237,232,219,0.08);
    padding:       1px 5px;
    border-radius: 3px;
}
.vbi-cdf__section-title {
    font-size:      var(--text-xs);
    font-weight:    700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color:          var(--text-muted);
    margin:         var(--space-1) 0 var(--space-1);
    padding:        0;
}
.vbi-cdf__shap        { margin-bottom: var(--space-2); }
.vbi-cdf__shap-row    { display: flex; justify-content: space-between; gap: var(--space-2); padding: 3px var(--space-1); border-bottom: 1px solid rgba(237,232,219,0.06); font-size: var(--text-xs); }
.vbi-cdf__shap-feature { color: var(--text-secondary); }
.vbi-cdf__shap-val    { font-family: var(--font-mono); font-weight: 700; font-size: 0.7rem; }
.vbi-cdf__dir--pos    { color: var(--color-red); }
.vbi-cdf__dir--neg    { color: var(--color-green); }
.vbi-cdf__at-risk     { margin-bottom: var(--space-2); }
.vbi-cdf__risk-list   { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 3px; }
.vbi-cdf__risk-item   { display: grid; grid-template-columns: 1fr auto auto; gap: var(--space-2); align-items: center; padding: 3px var(--space-1); border-bottom: 1px solid rgba(237,232,219,0.06); font-size: var(--text-xs); }
.vbi-cdf__risk-title  { color: var(--text-secondary); }
.vbi-cdf__drift-score { font-weight: 700; font-size: 0.7rem; color: var(--vbi-rag-accent, var(--color-amber)); }
.vbi-cdf__trigger     { color: var(--text-muted); font-size: 0.65rem; white-space: nowrap; }
.vbi-cdf__narrative   { font-size: var(--text-xs); color: var(--text-muted); line-height: 1.5; margin: var(--space-1) 0 0; font-style: italic; }


/* ── IC Cases by Stage (W-AN-05) ─────────────────────────────── */

.vbi-ic-stage-list { list-style: none; padding: 0; margin: var(--space-1) 0 0; display: flex; flex-direction: column; gap: 4px; }
.vbi-ic-stage-list__item {
    display:         grid;
    grid-template-columns: 1fr auto 60px;
    align-items:     center;
    gap:             var(--space-2);
    padding:         4px var(--space-2);
    background:      rgba(237,232,219,0.04);
    border-radius:   var(--radius-sm);
    border:          1px solid var(--surface-border);
}
.vbi-ic-stage-list__label { font-size: var(--text-xs); color: var(--text-secondary); text-transform: capitalize; }
.vbi-ic-stage-list__count { font-size: var(--text-sm); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.vbi-ic-stage-list__count.vbi-rag--unknown { color: var(--text-muted); font-style: italic; }
.vbi-ic-spark { width: 60px; height: 20px; overflow: visible; }
.vbi-ic-stage-list__floor-note { font-size: 0.65rem; color: var(--text-muted); margin: var(--space-1) 0 0; font-style: italic; }


/* ── Integration Health Matrix (W-AN-18) ─────────────────────── */

.vbi-int-grid { display: flex; flex-direction: column; gap: 2px; margin-top: var(--space-1); }
.vbi-int-grid__hdr,
.vbi-int-grid__row {
    display:               grid;
    grid-template-columns: 1fr 60px 62px 54px;
    gap:                   var(--space-1);
    align-items:           center;
    padding:               4px var(--space-2);
    border-radius:         var(--radius-sm);
}
.vbi-int-grid__hdr   { background: transparent; }
.vbi-int-grid__row   { background: rgba(237,232,219,0.04); border: 1px solid var(--surface-border); }
.vbi-int-grid__row:hover { background: rgba(237,232,219,0.08); }
.vbi-int-grid__row.vbi-rag--red   { border-left: 2px solid var(--color-red); }
.vbi-int-grid__row.vbi-rag--amber { border-left: 2px solid var(--color-amber); }
.vbi-int-grid__row.vbi-rag--green { border-left: 2px solid var(--color-green); }
.vbi-int-grid__th    { font-size: 0.58rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.vbi-int-grid__name  { font-size: var(--text-xs); color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vbi-int-grid__cat   { font-size: 0.62rem; color: var(--text-muted); }
.vbi-int-grid__heartbeat { font-size: var(--text-xs); color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.vbi-int-grid__pct   { font-size: var(--text-xs); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.vbi-int-grid__pct.vbi-rag--red   { color: var(--color-red); }
.vbi-int-grid__pct.vbi-rag--amber { color: var(--color-amber); }
.vbi-int-grid__pct.vbi-rag--green { color: var(--color-green); }


/* ── COGS by Provider (W-AN-23) ─────────────────────────────── */

.vbi-cogs-list { list-style: none; padding: 0; margin: var(--space-2) 0 0; display: flex; flex-direction: column; gap: 4px; }
.vbi-cogs-list__item {
    display:               grid;
    grid-template-columns: 130px 1fr 38px;
    align-items:           center;
    gap:                   var(--space-2);
    padding:               3px var(--space-1);
}
.vbi-cogs-list__name-wrap { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.vbi-cogs-list__name  { font-size: var(--text-xs); color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vbi-cogs-list__cat   { font-size: 0.62rem; color: var(--text-muted); }
.vbi-cogs-list__bar-wrap { height: 7px; background: rgba(237,232,219,0.10); border-radius: 4px; overflow: hidden; }
.vbi-cogs-list__bar   { height: 100%; background: var(--color-teal); border-radius: 4px; transition: width 400ms ease; opacity: 0.75; }
.vbi-cogs-list__pct   { font-size: 0.65rem; color: var(--text-secondary); text-align: right; font-variant-numeric: tabular-nums; }


/* ── License Utilisation by Persona (W-AN-24) ───────────────── */

.vbi-licence-list { list-style: none; padding: 0; margin: var(--space-1) 0 0; display: flex; flex-direction: column; gap: 4px; }
.vbi-licence-list__item {
    display:               grid;
    grid-template-columns: 110px 1fr 48px;
    align-items:           center;
    gap:                   var(--space-2);
    padding:               3px var(--space-1);
}
.vbi-licence-list__label  { font-size: var(--text-xs); color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vbi-licence-list__bar-wrap { height: 7px; background: rgba(237,232,219,0.10); border-radius: 4px; overflow: hidden; }
.vbi-licence-list__bar   { height: 100%; border-radius: 4px; transition: width 400ms ease; background: var(--color-teal); opacity: 0.75; }
.vbi-licence-list__bar.vbi-rag--red   { background: var(--color-red); }
.vbi-licence-list__bar.vbi-rag--amber { background: var(--color-amber); }
.vbi-licence-list__bar.vbi-rag--green { background: var(--color-green); }
.vbi-licence-list__pct   { font-size: 0.65rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.vbi-licence-list__pct.vbi-rag--red   { color: var(--color-red); }
.vbi-licence-list__pct.vbi-rag--amber { color: var(--color-amber); }
.vbi-licence-list__pct.vbi-rag--green { color: var(--color-green); }


/* ── Access Review Aging (W-AN-22) ──────────────────────────── */

.vbi-age-bucket-list { list-style: none; padding: 0; margin: var(--space-1) 0 0; display: flex; flex-direction: column; gap: 4px; }
.vbi-age-bucket-list__item {
    display:               grid;
    grid-template-columns: 80px 1fr 28px;
    align-items:           center;
    gap:                   var(--space-2);
    padding:               3px var(--space-1);
}
.vbi-age-bucket-list__label   { font-size: var(--text-xs); color: var(--text-secondary); }
.vbi-age-bucket-list__bar-wrap { height: 7px; background: rgba(237,232,219,0.10); border-radius: 4px; overflow: hidden; }
.vbi-age-bucket-list__bar     { height: 100%; border-radius: 4px; background: var(--color-amber); opacity: 0.75; transition: width 400ms ease; }
.vbi-age-bucket-list__count   { font-size: var(--text-xs); font-weight: 700; text-align: right; color: var(--text-primary); font-variant-numeric: tabular-nums; }


/* ── Subscription Tiers (W-AN-09) ────────────────────────── */

.vbi-sub-tiers__list {
    list-style: none;
    padding:    0;
    margin:     var(--space-1) 0 0;
    display:    flex;
    flex-direction: column;
    gap:        var(--space-1);
}
.vbi-sub-tiers__item {
    display:     grid;
    grid-template-columns: 1fr 2fr auto;
    align-items: center;
    gap:         var(--space-2);
    padding:     var(--space-1) 0;
    border-bottom: 1px solid var(--border-subtle, rgba(237,232,219,.08));
    cursor:      default;
}
.vbi-sub-tiers__item:last-child { border-bottom: none; }
.vbi-sub-tiers__label {
    font-size:   var(--text-xs);
    color:       var(--text-secondary);
    white-space: nowrap;
    overflow:    hidden;
    text-overflow: ellipsis;
}
.vbi-sub-tiers__bar-wrap {
    height:      6px;
    background:  var(--surface-card-hover);
    border-radius: 3px;
    overflow:    hidden;
}
.vbi-sub-tiers__bar {
    height:      100%;
    border-radius: 3px;
    background:  var(--vbi-rag-accent, var(--color-teal));
    transition:  width .3s ease;
}
.vbi-sub-tiers__seats {
    font-size:   var(--text-xs);
    font-weight: 600;
    color:       var(--vbi-rag-accent, var(--text-primary));
    white-space: nowrap;
}
.vbi-sub-tiers__renewal {
    font-size:   var(--text-xs);
    color:       var(--text-secondary);
    margin-top:  var(--space-2);
    padding-top: var(--space-2);
    border-top:  1px solid var(--border-subtle, rgba(237,232,219,.08));
}


/* ── Manager Cohort Posture tree (W-AN-14) ───────────────── */

.vbi-mgr-tree__root,
.vbi-mgr-tree__children {
    list-style:  none;
    padding:     0;
    margin:      0;
}
.vbi-mgr-tree__root { margin-top: var(--space-2); }
.vbi-mgr-tree__children { padding-left: var(--space-4); }
.vbi-mgr-tree__node {
    display:     flex;
    align-items: center;
    gap:         var(--space-2);
    padding:     var(--space-1) 0;
    border-bottom: 1px solid var(--border-subtle, rgba(237,232,219,.06));
    cursor:      default;
    flex-wrap:   wrap;
}
.vbi-mgr-tree__node:last-child { border-bottom: none; }
.vbi-mgr-tree__node--depth-0 .vbi-mgr-tree__label {
    font-weight: 700;
    color:       var(--text-primary);
}
.vbi-mgr-tree__node--depth-1 .vbi-mgr-tree__label {
    font-weight: 500;
    color:       var(--text-secondary);
    font-size:   var(--text-xs);
}
.vbi-mgr-tree__label {
    flex:        1 1 auto;
    font-size:   var(--text-sm);
    overflow:    hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vbi-mgr-tree__pct {
    font-size:   var(--text-xs);
    font-weight: 700;
    color:       var(--vbi-rag-accent, var(--text-primary));
    white-space: nowrap;
    min-width:   2.5rem;
    text-align:  right;
}
.vbi-mgr-tree__children .vbi-mgr-tree__node {
    border-bottom: 1px solid var(--border-subtle, rgba(237,232,219,.04));
}


/* ── Stacked bar / area tile (StackedBarTile.js) ─────────────
   Pre-existing gap found while wiring PCD-6.4/PCD-7 (POSH CHRO
   Dashboard): StackedBarTile.js has shipped since W-AN-08/W-AN-19
   with zero corresponding CSS anywhere in the codebase — its
   <rect>/<div> elements carried only class names with no fill/
   color rules, so every consumer rendered solid black/unstyled
   bars. Fixed here (frontend/* is this agent's custodial scope)
   rather than left half-migrated, since PCD-7's own #9 widget
   depends on this component rendering correctly. ─────────────── */

.vbi-stacked-bar          { width: 100%; height: auto; }
.vbi-stacked-bar__seg     { transition: opacity var(--transition-fast, 0.15s); }
.vbi-stacked-bar__seg--0  { fill: var(--color-gold); }
.vbi-stacked-bar__seg--1  { fill: var(--color-teal); }
.vbi-stacked-bar__seg--2  { fill: var(--color-green); }
.vbi-stacked-bar__seg--3  { fill: var(--color-red); }
.vbi-stacked-bar__seg--4  { fill: var(--color-amber); }

.vbi-stacked-bar__legend {
    display:     flex;
    flex-wrap:   wrap;
    gap:         var(--space-3);
    list-style:  none;
    margin:      var(--space-2) 0 0;
    padding:     0;
    font-size:   var(--text-xs, 11px);
    color:       var(--text-muted);
}
.vbi-stacked-bar__legend-item { display: flex; align-items: center; gap: var(--space-1); }
.vbi-stacked-bar__legend-dot  { width: 8px; height: 8px; border-radius: 2px; flex: 0 0 8px; }
.vbi-stacked-bar__legend-dot--0 { background: var(--color-gold); }
.vbi-stacked-bar__legend-dot--1 { background: var(--color-teal); }
.vbi-stacked-bar__legend-dot--2 { background: var(--color-green); }
.vbi-stacked-bar__legend-dot--3 { background: var(--color-red); }
.vbi-stacked-bar__legend-dot--4 { background: var(--color-amber); }

.vbi-feature-bars          { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.vbi-feature-bars__item    { display: flex; align-items: center; gap: var(--space-2); }
.vbi-feature-bars__label   { flex: 0 0 40%; font-size: var(--text-xs, 11px); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vbi-feature-bars__bar     { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-elevated); overflow: hidden; }
.vbi-feature-bars__fill    { height: 100%; background: var(--color-teal); border-radius: 4px; }
.vbi-feature-bars__fill--inactive { background: var(--text-muted); }
.vbi-feature-bars__pct     { flex: 0 0 auto; font-size: var(--text-xs, 11px); color: var(--text-primary); font-weight: 600; }


/* ── India choropleth tile (IndiaChoroplethTile.js, PCD-6.4) ──
   State-wise incident intensity map. Fill colour is always the
   --color-gold design token; only fill-opacity is data-driven
   (per-instance inline style set in JS from the count ratio) —
   no hardcoded colour values. Suppressed (k-anonymity-floored)
   states use the JS-generated <pattern> hatch fill instead.  ── */

.vbi-tile--choropleth      { display: flex; flex-direction: column; gap: var(--space-3); }
.vbi-choropleth__body      { display: flex; flex-direction: column; gap: var(--space-3); align-items: center; }
.vbi-choropleth__map       { width: 100%; max-width: 320px; height: auto; }
.vbi-choropleth__state     { cursor: default; }

.vbi-choropleth__legend {
    display:     flex;
    flex-wrap:   wrap;
    gap:         var(--space-3);
    list-style:  none;
    margin:      0;
    padding:     0;
    font-size:   var(--text-xs, 11px);
    color:       var(--text-muted);
    justify-content: center;
}
.vbi-choropleth__legend-item { display: flex; align-items: center; gap: var(--space-1); }
.vbi-choropleth__swatch      { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--surface-border-mid); flex: 0 0 12px; }
.vbi-choropleth__swatch--low  { background: var(--color-gold); opacity: 0.30; }
.vbi-choropleth__swatch--high { background: var(--color-gold); opacity: 0.90; }
.vbi-choropleth__swatch--none { background: var(--text-muted); opacity: 0.20; }
.vbi-choropleth__swatch--suppressed {
    background-image: repeating-linear-gradient(45deg, var(--color-amber) 0, var(--color-amber) 1.5px, transparent 1.5px, transparent 4px);
}
.vbi-choropleth__unresolved { font-size: var(--text-xs, 11px); color: var(--text-muted); text-align: center; }


/* ── Responsive ───────────────────────────────────────────── */
/* MR-069: canonical breakpoints 375px/768px/1024px */

@media (max-width: 375px) {
    /* MR-069: narrowest mobile — was max-width: 480px */
    .vbi-tile {
        padding: var(--space-2);
        gap:     var(--space-1);
    }
    .vbi-tile__headline-value { font-size: var(--text-xl); }
    .vbi-tile--kpi .vbi-tile__headline-value { font-size: var(--text-3xl); }
    .vbi-rag-matrix__row { flex-direction: column; align-items: flex-start; gap: var(--space-1); }
    .vbi-rag-matrix__ref { font-size: 11px; }
    .vbi-tile--sentence { flex-direction: column; gap: var(--space-2); padding: var(--space-2); }
    .vbi-tile__dismiss { align-self: flex-end; }
}

@media (min-width: 376px) and (max-width: 768px) {
    /* MR-069: standard mobile to tablet — was min-width: 481px */
    .vbi-tile__headline-value { font-size: var(--text-2xl); }
    .vbi-tile--kpi .vbi-tile__headline-value { font-size: var(--text-3xl); }
}

@media (min-width: 1024px) {
    .vbi-tile__headline-value { font-size: var(--text-3xl); }
    .vbi-tile--kpi .vbi-tile__headline-value { font-size: var(--text-4xl); }
}
