/* ════════════════════════════════════════════════════════════════════════
   INTELOGIX DESIGN SYSTEM v1.0 — visual contract for all Intelogix tools
   Spec: INTELOGIX_DESIGN_SYSTEM.md (delivered 2026-05-05, owner JC Trejo)
   This block is the source of truth for tokens. Legacy variables below
   are aliased to the new tokens during the visual refactor migration.
   ════════════════════════════════════════════════════════════════════════ */
:root {
    /* — 2 · Color · Backgrounds (4 levels) — */
    --bg-canvas:    #0A1018;  /* page background */
    --bg-surface:   #0E1620;  /* cards & panels */
    --bg-divider:   #1F2937;  /* separator lines */
    --bg-elevated:  #2A3441;  /* hover & elevated states */

    /* — 2 · Color · Text (4 levels) — */
    --text-primary:  #FFFFFF;  /* critical data, titles */
    --text-body:     #E8EDF2;  /* body, descriptions */
    --text-muted:    #8A98AB;  /* labels, metadata */
    --text-subtle:   #6B7B8F;  /* hints, axes, footnotes */

    /* — 2 · Color · Semantic (data state — never decorative) — */
    --state-danger:  #DC2626;  /* alert, out of bounds */
    --state-warn:    #FBBF24;  /* watch, near limit */
    --state-ok:      #22C55E;  /* healthy, within limit */
    --state-brand:   #1FA8E0;  /* Intelogix accent, info */

    /* Light variants for text on top of the color */
    --state-danger-light:  #FCA5A5;
    --state-warn-light:    #FBBF24;
    --state-ok-light:      #86EFAC;
    --state-brand-light:   #7DD3FC;

    /* Alpha variants for card backgrounds */
    --state-danger-bg:  rgba(220, 38, 38, 0.10);
    --state-warn-bg:    rgba(251, 191, 36, 0.10);
    --state-ok-bg:      rgba( 34, 197,  94, 0.08);
    --state-brand-bg:   rgba( 31, 168, 224, 0.06);

    /* — 2 · Color · Data ramp (composition charts ONLY, not for cards/badges) — */
    --data-critical:   #DC2626;  /* weight × 3 / recent */
    --data-mid:        #1FA8E0;  /* weight × 2 / mid */
    --data-historical: #1E3A5F;  /* weight × 1 / historical */

    /* — 3 · Typography · Family — */
    --font-sans: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono: ui-monospace, 'SF Mono', 'Cascadia Mono', monospace;

    /* — 3 · Typography · Scale — */
    --type-display-xl:  56px;  /* critical score (98, 87) */
    --type-display-lg:  36px;  /* primary KPI (9.34%) */
    --type-heading:     24px;  /* section title */
    --type-body-lg:     15px;  /* table content */
    --type-body:        13px;  /* metadata, sub-info */
    --type-eyebrow:     12px;  /* uppercase labels with letter-spacing */

    /* — 3 · Typography · Weights (only two — bold reserved for signature marks) — */
    --weight-regular: 400;
    --weight-medium:  500;

    /* — 4 · Spacing scale (base 4px, no exceptions) — */
    --space-xs:   4px;
    --space-sm:   8px;
    --space-md:  12px;
    --space-lg:  16px;
    --space-xl:  24px;
    --space-2xl: 32px;
    --space-3xl: 48px;

    /* — 4 · Border radius — */
    --radius-0:   0;     /* tables, dividers, headers */
    --radius-sm:  2px;   /* badges, pills */
    --radius-md:  4px;   /* buttons, inputs */
    --radius-lg:  6px;   /* cards, panels */

    /* — 6 · Per-tool accent (CSAitx — safety / vigilance) — */
    --accent-csaitx: #DC2626;
    --accent-botdot: #1FA8E0;
    --accent-ioh:    #1FA8E0;

    /* ════════════════════════════════════════════════════════════════════
       LEGACY ALIASES — temporary, retained so existing CSS keeps working
       during the step-by-step refactor. Each step migrates uses to the
       new tokens; legacy aliases will be removed when migration is done.
       ════════════════════════════════════════════════════════════════════ */
    --bg:     var(--bg-canvas);
    --bg2:    var(--bg-surface);
    --bg3:    var(--bg-divider);
    --bg4:    var(--bg-elevated);
    --border:  #21262d;
    --border2: #30363d;
    --text:  var(--text-body);
    --text2: var(--text-muted);
    --text3: var(--text-subtle);
    --red:   var(--state-danger);
    --red-l: var(--state-danger-bg);
    --red-b: rgba(220, 38, 38, 0.30);
    --orange: #e36c09;
    --ora-l: rgba(227,108,9,.12);
    --ora-b: rgba(227,108,9,.3);
    --green: var(--state-ok);
    --grn-l: var(--state-ok-bg);
    --grn-b: rgba(34, 197, 94, 0.30);
    --blue:  var(--state-brand);
    --blu-l: var(--state-brand-bg);
    --blu-b: rgba(31, 168, 224, 0.30);
    --yellow: var(--state-warn);
    --yel-l: var(--state-warn-bg);
    /* Legacy stacked-bar aliases now mapped to design system data-ramp.
       t1 = top of stack (1-6mo, ×3 weight, data-critical red)
       t2 = middle (7-12mo, ×2, data-mid blue brand)
       t3 = bottom (13-24mo, ×1, data-historical dark blue)  */
    --t1: var(--data-critical);
    --t2: var(--data-mid);
    --t3: var(--data-historical);
    --shadow: 0 1px 3px rgba(0,0,0,.3);
    --r:    var(--radius-lg);
    --r-sm: var(--radius-md);
    --mono: var(--font-mono);
    --sans: var(--font-sans);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    background: var(--bg) !important;
    color: var(--text);
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
}

/* ════════════════════════════════════════════════════════════════════════
   SCREEN HEADER · Intelogix Design System component 5.1 (per spec §5.1 + §7.1)
   Two-row header: signature row (tool identity + utility) + title row (data).
   Border-top 3px in tool accent communicates which tool you're in.
   ════════════════════════════════════════════════════════════════════════ */
.screen-header {
    background: var(--bg-surface);
    border-top: 3px solid var(--accent-csaitx);
    border-bottom: 1px solid var(--bg-divider);
    position: sticky;
    top: 0;
    z-index: 100;
}
.screen-header-in {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 var(--space-xl);
}

/* Signature row · tool identity left, utility actions right */
.signature-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--bg-divider);
}
.signature-cluster {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    min-width: 0;
}
.tool-signature {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}
.tool-name {
    font-family: var(--font-sans);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1;
}
.tool-name em {
    font-style: normal;
    font-family: var(--font-mono);
    color: var(--state-brand);
    font-weight: 500;
    margin-left: 1px;
}
.divider-vertical {
    display: inline-block;
    width: 1px;
    height: 18px;
    background: var(--bg-divider);
}
.tool-tagline {
    font-size: var(--type-body);
    color: var(--text-muted);
    font-weight: var(--weight-regular);
    line-height: 1;
}

/* Utility cluster · DOT switcher + admin/account/logout */
.utility-cluster {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
}
.dot-switcher-form { margin: 0; }
.dot-switcher {
    background: var(--bg-divider);
    color: var(--text-body);
    border: 1px solid var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 5px 8px;
    font-size: var(--type-eyebrow);
    font-family: var(--font-mono);
    max-width: 240px;
    cursor: pointer;
}
.utility-link {
    font-size: var(--type-eyebrow);
    color: var(--text-muted);
    font-family: var(--font-mono);
    text-decoration: none;
    padding: 5px 10px;
    border-radius: var(--radius-md);
    transition: background .15s, color .15s;
    line-height: 1;
}
.utility-link:hover { color: var(--text-body); background: var(--bg-divider); }
.utility-link-admin { color: var(--state-brand); }
.utility-link-admin:hover { color: var(--state-brand-light); }
.utility-link-logout {
    background: var(--bg-divider);
    border: 1px solid var(--bg-elevated);
}

/* Title row · entity identity left, critical metric right */
.title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-xl);
    padding: var(--space-lg) 0;
}
.title-left { min-width: 0; flex: 1; }
.title-right { text-align: right; flex-shrink: 0; }

.eyebrow {
    font-size: var(--type-eyebrow);
    font-weight: var(--weight-medium);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    line-height: 1;
    margin-bottom: var(--space-sm);
}
.eyebrow-tool   { color: var(--accent-csaitx); }
.eyebrow-danger { color: var(--state-danger); }
.eyebrow-warn   { color: var(--state-warn); }
.eyebrow-ok     { color: var(--state-ok); }
.eyebrow-brand  { color: var(--state-brand); }

.entity-name {
    font-size: var(--type-heading);
    font-weight: var(--weight-medium);
    color: var(--text-primary);
    line-height: 1.2;
    margin: 0 0 var(--space-xs);
}

.metadata {
    font-size: var(--type-body);
    color: var(--text-muted);
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
}

.display-number {
    font-size: var(--type-display-xl);
    font-weight: var(--weight-medium);
    line-height: 0.95;
    letter-spacing: -0.025em;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}
.display-number.display-danger { color: var(--state-danger); }
.display-number.display-warn   { color: var(--state-warn); }
.display-number.display-ok     { color: var(--state-ok); }

.trajectory {
    font-size: var(--type-eyebrow);
    color: var(--text-subtle);
    font-variant-numeric: tabular-nums;
    margin-top: var(--space-xs);
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ════════════════════════════════════════════════════════════════════════
   KPI CARD · Intelogix Design System component 5.2
   The card state is dictated by the data, never by aesthetic decision.
   border-left + bg signal severity; value 28px tabular-nums dominates.
   ════════════════════════════════════════════════════════════════════════ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-md);
}
.kpi-card {
    padding: var(--space-lg) var(--space-lg);
    background: var(--bg-surface);
    border-left: 3px solid var(--bg-elevated);
    border-radius: var(--radius-lg);
    transition: border-color .15s, background .15s;
}
.kpi-card--danger  { background: var(--state-danger-bg); border-left-color: var(--state-danger); }
.kpi-card--warn    { background: var(--state-warn-bg);   border-left-color: var(--state-warn); }
.kpi-card--ok      { background: var(--state-ok-bg);     border-left-color: var(--state-ok); }
.kpi-card--brand   { background: var(--state-brand-bg);  border-left-color: var(--state-brand); }
.kpi-card--neutral { background: var(--bg-surface);      border-left-color: var(--bg-elevated); }
.kpi-card--empty   { opacity: .5; }

.kpi-card .eyebrow {
    margin-bottom: var(--space-sm);
    color: var(--text-muted);
}
.kpi-card .value {
    font-size: 28px;
    font-weight: var(--weight-medium);
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    display: flex;
    align-items: baseline;
}
.kpi-card .value .unit {
    font-size: 16px;
    color: var(--text-muted);
    font-weight: var(--weight-regular);
    margin-left: 1px;
}
.kpi-card .delta {
    font-size: var(--type-eyebrow);
    margin-top: var(--space-sm);
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    line-height: 1.2;
}
.kpi-card .delta.good { color: var(--state-ok); }
.kpi-card .delta.bad  { color: var(--state-danger); }
.kpi-card .meta {
    font-size: var(--type-body);
    color: var(--text-muted);
    margin-top: var(--space-sm);
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
}

/* ════════════════════════════════════════════════════════════════════════
   DATA TABLE · Intelogix Design System component 5.3
   Indicator · Current · Prior · Δ · Status (5-column minimum).
   Eyebrow headers, row separators 1px, body 15px, status cell with dot+label.
   ════════════════════════════════════════════════════════════════════════ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.data-table thead th {
    font-size: var(--type-eyebrow);
    font-weight: var(--weight-medium);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: left;
    padding: 14px var(--space-lg);
    border-bottom: 1px solid var(--bg-divider);
    background: transparent;
    white-space: nowrap;
}
.data-table thead th.num,
.data-table tbody td.num { text-align: right; }
.data-table tbody tr {
    border-top: 1px solid var(--bg-divider);
    transition: background .12s;
}
.data-table tbody tr:first-child { border-top: 0; }
.data-table tbody tr:hover { background: var(--bg-divider); }
.data-table tbody td {
    padding: 14px var(--space-lg);
    font-size: var(--type-body-lg);
    font-weight: var(--weight-regular);
    color: var(--text-body);
    vertical-align: middle;
}
.data-table tbody td.num {
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}
.data-table tbody td.num.prior { color: var(--text-muted); }
.data-table tbody td.num.delta-good { color: var(--state-ok); }
.data-table tbody td.num.delta-bad  { color: var(--state-danger); }
.data-table tbody td.indicator {
    font-weight: var(--weight-medium);
    color: var(--text-primary);
}

/* Status cell — dot of severity color + same-color label */
.status-cell { display: flex; align-items: center; gap: var(--space-sm); }
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-dot--danger  { background: var(--state-danger); }
.status-dot--warn    { background: var(--state-warn); }
.status-dot--ok      { background: var(--state-ok); }
.status-dot--neutral { background: var(--text-subtle); }
.status-label {
    font-size: var(--type-body);
    font-weight: var(--weight-medium);
    letter-spacing: 0.04em;
}
.status-label.danger  { color: var(--state-danger-light); }
.status-label.warn    { color: var(--state-warn-light); }
.status-label.ok      { color: var(--state-ok-light); }
.status-label.neutral { color: var(--text-muted); }

/* HEADER · legacy class preserved for any non-MainLayout consumers */
.hdr { background: var(--bg2); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.hdr-in { max-width: 1440px; margin: 0 auto; padding: 0 20px; height: 58px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hdr-brand h1 { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); margin: 0; }
.hdr-brand .sub { font-size: 11px; color: var(--text3); font-family: var(--mono); }
.hdr-meta { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.iss-b { background: var(--red-l); border: 1.5px solid var(--red-b); border-radius: var(--r-sm); padding: 5px 13px; text-align: center; }
.iss-b .n { font-family: var(--mono); font-size: 20px; font-weight: 700; color: var(--red); line-height: 1; }
.iss-b .l { font-size: 9px; color: var(--text3); text-transform: uppercase; letter-spacing: .08em; margin-top: 1px; }
.tag { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px; letter-spacing: .02em; }
.tag.red { background: var(--red-l); color: var(--red); border: 1px solid var(--red-b); }
.snap { font-size: 10px; color: var(--text3); font-family: var(--mono); text-align: right; line-height: 1.6; }

/* TABS */
.tabs { background: var(--bg2); border-bottom: 1px solid var(--border); position: relative; }
.tabs-in { max-width: 1440px; margin: 0 auto; display: flex; padding: 0 20px; overflow-x: auto; scrollbar-width: none; }
.tabs-in::-webkit-scrollbar { display: none; }
.tab {
    padding: 12px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text2);
    cursor: pointer;
    border-bottom: 2.5px solid transparent;
    white-space: nowrap;
    transition: all .15s;
    user-select: none;
    text-decoration: none;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--blue); border-bottom-color: var(--blue); }

/* Hamburger / mobile nav */
.ham-bar { display: none; align-items: center; justify-content: space-between; padding: 0 12px; height: 44px; background: var(--bg2); border-bottom: 1px solid var(--border); }
.ham-cur { font-size: 13px; font-weight: 600; color: var(--blue); }
.ham-btn { display: flex; flex-direction: column; justify-content: center; gap: 4px; width: 36px; height: 36px; cursor: pointer; border-radius: 6px; background: var(--bg3); border: 1px solid var(--border2); padding: 8px; flex-shrink: 0; }
.ham-line { display: block; width: 100%; height: 2px; background: var(--text); border-radius: 2px; }
.mob-nav { display: none; position: fixed; inset: 0; background: rgba(13,17,23,.97); z-index: 300; flex-direction: column; padding: 60px 16px 20px; gap: 4px; overflow-y: auto; backdrop-filter: blur(4px); }
.mob-nav.open { display: flex; }
.mob-nav-hdr { position: absolute; top: 0; left: 0; right: 0; height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--bg2); }
.mob-nav-title { font-size: 12px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .08em; }
.mob-nav-close { font-size: 22px; color: var(--text2); cursor: pointer; line-height: 1; padding: 4px 8px; background: transparent; border: 0; }
.mob-nav-item { padding: 14px 16px; font-size: 15px; font-weight: 500; color: var(--text2); cursor: pointer; border-radius: 8px; border: 1px solid transparent; text-decoration: none; }
.mob-nav-item.on { background: var(--bg3); border-color: var(--blu-b); color: var(--blue); font-weight: 600; }

/* Responsive: hide tabs, show hamburger on small screens */
@media (max-width: 800px) {
    .tabs { display: none; }
    .ham-bar { display: flex; }
    .hdr-meta { gap: 6px; }
    .hdr-brand h1 { font-size: 13px; }
    .hdr-brand .sub { font-size: 10px; }
    .iss-b { padding: 4px 9px; }
    .iss-b .n { font-size: 16px; }
    .main { padding: 14px 12px 40px; }
}

/* MAIN */
.main { max-width: 1440px; margin: 0 auto; padding: 20px 20px 50px; }

/* APP FOOTER — system signature, design-system §6.x */
.app-footer {
    border-top: 1px solid var(--border);
    background: var(--bg2);
    margin-top: 24px;
}
.app-footer-in {
    max-width: 1440px;
    margin: 0 auto;
    padding: 14px 20px;
    font-size: 12px;
    color: var(--text-subtle);
    text-align: center;
    letter-spacing: 0.02em;
}
.app-footer-in strong { color: var(--text-muted); font-weight: 600; }
.app-footer-dot { margin: 0 8px; opacity: 0.6; }

/* CARD */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); }

/* Bootstrap dark-mode overrides for migrated pages that still use Bootstrap classes */
.table {
    --bs-table-bg: var(--bg2);
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--border);
    --bs-table-striped-bg: var(--bg3);
    --bs-table-hover-bg: var(--bg3);
    --bs-table-hover-color: var(--text);
}
.table-light, .table > thead.table-light, .table > tfoot.table-secondary {
    --bs-table-bg: var(--bg3);
    --bs-table-color: var(--text);
    color: var(--text);
}
code { color: var(--blue); background: rgba(88,166,255,.08); padding: 1px 5px; border-radius: 3px; }
small { color: var(--text2); }
.text-muted { color: var(--text3) !important; }
.text-danger { color: var(--red) !important; }
.text-warning { color: var(--orange) !important; }
.fw-bold { font-weight: 700; }
.alert-danger { background: var(--red-l); border-color: var(--red-b); color: var(--red); }

/* Section header */
.sh { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.sh .st { font-size: 13px; font-weight: 600; color: var(--text); }
.sh .ss { font-size: 11px; color: var(--text3); margin-top: 1px; }

/* Pill */
.pill { font-size: 10px; font-weight: 600; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.pill.red { background: var(--red-l); color: var(--red); }
.pill.ora { background: var(--ora-l); color: var(--orange); }
.pill.grn { background: var(--grn-l); color: var(--green); }
.pill.blu { background: var(--blu-l); color: var(--blue); }

/* Score bar chart */
.score-card { padding: 16px 20px; margin-bottom: 20px; }
.score-card h2 { font-size: 14px; font-weight: 700; margin-bottom: 2px; color: var(--text); }
.score-card .sub { font-size: 10px; color: var(--text3); margin-bottom: 16px; line-height: 1.5; }
.bc-scroll { overflow-x: auto; padding-bottom: 4px; }
/* Stacked bar chart container — Intelogix Design System pattern 5.5.
   Bar max-width 56px, gap 16px, y-axis with 0/65/80/100 markers,
   white dashed threshold lines at 65% and 80%, data-ramp colors per bucket. */
.bc-wrap { display: flex; align-items: flex-end; justify-content: space-around; gap: var(--space-md); min-width: 500px; height: 215px; position: relative; padding: 0 16px 0 40px; }
.bc-col { max-width: 84px; }
.bc-bar-wrap { width: 100% !important; }
.bc-ya { position: absolute; left: 0; bottom: 28px; font-size: 10px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.bc-yb { position: absolute; left: 0; bottom: calc(28px + 65px); font-size: 10px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.bc-yc { position: absolute; left: 0; bottom: calc(28px + 130px); font-size: 10px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
/* Y-axis label, position from inline style — replaces ya/yb/yc with explicit per-spec values 0/65/80/100 */
.bc-yax { position: absolute; left: 0; font-size: 10px; color: var(--text-subtle); font-variant-numeric: tabular-nums; line-height: 1; }
/* Global threshold line spanning the chart at 65% and 80% (Intelogix DS §5.5) */
.bc-thr-global {
    position: absolute;
    left: 28px;
    right: 4px;
    height: 0;
    border-top: 1.5px dashed rgba(232, 237, 242, 0.3);
    z-index: 4;
    pointer-events: none;
}
.bc-thr-global span {
    position: absolute;
    right: 2px;
    top: -14px;
    font-size: 9px;
    font-weight: var(--weight-medium);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    background: var(--bg-surface);
    padding: 0 4px;
}
.bc-grid-lines { position: absolute; left: 24px; right: 0; bottom: 46px; height: 130px; pointer-events: none; }
.bc-gl { position: absolute; left: 0; right: 0; border-top: 1px solid rgba(255,255,255,.05); }
.bc-col { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 64px; height: 100%; position: relative; }
.bc-col-in { width: 100%; height: 169px; position: relative; }
.bc-lbl { font-size: 10px; font-weight: 500; color: var(--text3); text-align: center; width: 100%; max-width: 84px; line-height: 1.3; padding-top: 4px; height: 28px; }
.bc-chg { font-size: 10px; font-weight: 700; font-family: var(--mono); margin-top: 1px; }
.bc-chg.up { color: var(--red); }
.bc-chg.dn { color: var(--green); }
.bc-chg.fl { color: var(--text3); }
.bc-leg { display: flex; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.bc-li { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--text3); }
.bc-lsq { width: 9px; height: 9px; border-radius: 2px; }

/* Banner strip — wraps top-of-page alert-banner so it respects page max-width */
.banner-strip {
    max-width: 1440px;
    margin: 0 auto;
    padding: var(--space-md) var(--space-xl) 0;
}
.banner-strip .alert-banner { margin-bottom: 0; }

/* Alert Banner — Intelogix Design System pattern 5.6.
   Used for events that need attention (regulatory action, system warning, info live data).
   Never use for trivial info — the banner is an event. */
.alert-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: 14px 18px;
    border-left: 3px solid var(--state-brand);
    background: var(--state-brand-bg);
    margin-bottom: var(--space-md);
    border-radius: 0;
}
.alert-banner .left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.alert-banner .right { display: flex; align-items: center; gap: var(--space-sm); flex-shrink: 0; font-size: var(--type-body); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.alert-banner .eyebrow {
    font-size: var(--type-eyebrow);
    font-weight: var(--weight-medium);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    line-height: 1.2;
    color: var(--state-brand);
}
.alert-banner .message {
    font-size: var(--type-body-lg);
    color: var(--text-primary);
    font-weight: var(--weight-regular);
    line-height: 1.4;
}
.alert-banner a { color: inherit; text-decoration: underline; font-weight: var(--weight-medium); }
.alert-banner--danger { border-left-color: var(--state-danger); background: var(--state-danger-bg); }
.alert-banner--danger .eyebrow { color: var(--state-danger); }
.alert-banner--warn   { border-left-color: var(--state-warn);   background: var(--state-warn-bg); }
.alert-banner--warn   .eyebrow { color: var(--state-warn); }
.alert-banner--ok     { border-left-color: var(--state-ok);     background: var(--state-ok-bg); }
.alert-banner--ok     .eyebrow { color: var(--state-ok); }
.alert-banner--brand  { border-left-color: var(--state-brand);  background: var(--state-brand-bg); }
.alert-banner--brand  .eyebrow { color: var(--state-brand); }

/* Ghost button — outline style for actions inside banners. Inherits banner color via currentColor. */
.btn-ghost {
    background: transparent;
    border: 1px solid var(--state-brand);
    color: var(--state-brand);
    padding: 6px 14px;
    border-radius: var(--radius-md);
    font-size: var(--type-body);
    font-weight: var(--weight-medium);
    font-family: var(--font-sans);
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background .12s ease;
    white-space: nowrap;
}
.btn-ghost:hover:not(:disabled) { background: var(--state-brand-bg); }
.btn-ghost:disabled { opacity: 0.5; cursor: wait; }
.alert-banner--danger .btn-ghost { border-color: var(--state-danger); color: var(--state-danger); }
.alert-banner--danger .btn-ghost:hover:not(:disabled) { background: var(--state-danger-bg); }
.alert-banner--warn   .btn-ghost { border-color: var(--state-warn);   color: var(--state-warn); }
.alert-banner--warn   .btn-ghost:hover:not(:disabled) { background: var(--state-warn-bg); }
.alert-banner--ok     .btn-ghost { border-color: var(--state-ok);     color: var(--state-ok); }
.alert-banner--ok     .btn-ghost:hover:not(:disabled) { background: var(--state-ok-bg); }

/* Standalone btn-ghost severity modifiers (for buttons not inside an alert-banner) */
.btn-ghost--danger { border-color: var(--state-danger); color: var(--state-danger); }
.btn-ghost--danger:hover:not(:disabled) { background: var(--state-danger-bg); }
.btn-ghost--warn   { border-color: var(--state-warn);   color: var(--state-warn); }
.btn-ghost--warn:hover:not(:disabled)   { background: var(--state-warn-bg); }
.btn-ghost--ok     { border-color: var(--state-ok);     color: var(--state-ok); }
.btn-ghost--ok:hover:not(:disabled)     { background: var(--state-ok-bg); }
.btn-ghost--neutral { border-color: var(--bg-divider); color: var(--text-muted); }
.btn-ghost--neutral:hover:not(:disabled) { background: var(--bg-elevated); }

/* Primary solid button — for main form submits (login, save, etc.) */
.btn-primary {
    background: var(--state-brand);
    border: 1px solid var(--state-brand);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: var(--type-body);
    font-weight: var(--weight-medium);
    font-family: var(--font-sans);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: opacity .12s ease;
    width: 100%;
}
.btn-primary:hover:not(:disabled) { opacity: 0.88; }
.btn-primary:disabled { opacity: 0.5; cursor: wait; }

/* Standardized form input — Inter, dark surface, brand focus */
.input-field {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--bg-divider);
    color: var(--text-body);
    border-radius: var(--radius-md);
    padding: 9px 12px;
    font-size: var(--type-body-lg);
    font-family: var(--font-sans);
    transition: border-color .12s ease;
}
.input-field:focus {
    outline: none;
    border-color: var(--state-brand);
}
.input-field::placeholder { color: var(--text-subtle); }

/* Toolbar — flat horizontal control bar (toggles + search + checkbox + button).
   No card wrapper — sits inline with content. All controls share 36px height. */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    align-items: center;
    margin-bottom: var(--space-md);
}
.toolbar > .toggle-group,
.toolbar > label,
.toolbar > button { flex-shrink: 0; }
.toolbar label { display: flex; align-items: center; gap: var(--space-sm); font-size: var(--type-body-lg); color: var(--text-muted); cursor: pointer; white-space: nowrap; height: 36px; }
.toolbar > .btn-ghost { height: 36px; padding: 0 16px; }
.toolbar-search {
    flex: 1 1 240px;
    width: auto;
    min-width: 200px;
    height: 36px;
    box-sizing: border-box;
    padding: 0 12px;
}

/* Segmented control — group of toggle buttons sharing a tray (lens / role / view mode toggles).
   Use `.toggle-btn` + `.toggle-btn--active` on each child. Locked at 36px to match toolbar items. */
.toggle-group {
    display: inline-flex;
    gap: 2px;
    background: var(--bg-elevated);
    border: 1px solid var(--bg-divider);
    border-radius: var(--radius-md);
    padding: 3px;
    height: 36px;
    box-sizing: border-box;
}
.toggle-btn {
    background: transparent;
    border: 0;
    color: var(--text-muted);
    padding: 0 14px;
    border-radius: var(--radius-sm);
    font-size: var(--type-body);
    font-weight: var(--weight-medium);
    font-family: var(--font-sans);
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
    white-space: nowrap;
}
.toggle-btn:hover:not(.toggle-btn--active) { color: var(--text-primary); }
.toggle-btn--active {
    background: var(--state-brand);
    color: var(--text-primary);
}

/* Period pill — month/year selector chip (BreakdownMonthly).
   Inactive = neutral outline · Active = brand-filled with state-brand bg+border */
.period-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: var(--type-body);
    font-weight: var(--weight-medium);
    color: var(--text-muted);
    background: var(--bg-elevated);
    border: 1px solid var(--bg-divider);
    cursor: pointer;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
    font-variant-numeric: tabular-nums;
    user-select: none;
}
.period-pill:hover { color: var(--text-primary); border-color: var(--text-subtle); }
.period-pill--active {
    background: var(--state-brand);
    border-color: var(--state-brand);
    color: var(--text-primary);
}
.period-pill--active:hover { color: var(--text-primary); border-color: var(--state-brand); }

/* Severity badge — inline tag for table cells / drawer markers (REPEAT, DISPUTE, TOW-AWAY, etc.).
   Use --danger / --warn / --ok / --brand variants based on the meaning of the tag. */
.severity-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--type-eyebrow);
    font-weight: var(--weight-medium);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
}
.severity-badge--danger { background: var(--state-danger-bg); color: var(--state-danger); }
.severity-badge--warn   { background: var(--state-warn-bg);   color: var(--state-warn); }
.severity-badge--ok     { background: var(--state-ok-bg);     color: var(--state-ok); }
.severity-badge--brand  { background: var(--state-brand-bg);  color: var(--state-brand); }

/* Role badge — outline style matching role's semantic color (admin=danger, regular=brand, viewer=neutral) */
.role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--type-eyebrow);
    font-weight: var(--weight-medium);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 1px solid var(--bg-divider);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.role-badge--admin   { border-color: var(--state-danger); color: var(--state-danger); background: var(--state-danger-bg); }
.role-badge--regular { border-color: var(--state-brand);  color: var(--state-brand);  background: var(--state-brand-bg); }
.role-badge--viewer  { border-color: var(--bg-divider);   color: var(--text-muted);   background: var(--bg-elevated); }

/* Form field group — eyebrow-style label above input */
.field-group { display: flex; flex-direction: column; gap: var(--space-xs); margin-bottom: var(--space-md); }
.field-label {
    font-size: var(--type-eyebrow);
    font-weight: var(--weight-medium);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    line-height: 1;
}

/* Measures table */
.mt-card { margin-bottom: 20px; overflow: hidden; }
.mt-card table { width: 100%; border-collapse: collapse; }
.mt-card thead th { background: var(--bg3); padding: 10px 14px; font-size: 10px; font-weight: 600; color: var(--text3); text-align: left; border-bottom: 1px solid var(--border); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.mt-card thead th.r { text-align: right; }
.mt-card tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
.mt-card tbody tr:last-child { border-bottom: none; }
.mt-card tbody tr:hover { background: var(--bg3); }
.mt-card td { padding: 10px 14px; font-size: 13px; vertical-align: middle; color: var(--text); }
.mt-card td.r { text-align: right; }
.bname { display: flex; align-items: center; gap: 8px; }
.bdot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.bdot.red { background: var(--red); }
.bdot.ora { background: var(--orange); }
.bdot.grn { background: var(--green); }
.mnum { font-family: var(--mono); font-weight: 600; font-size: 13px; }
.mnum.red { color: var(--red); }
.mnum.ora { color: var(--orange); }
.mnum.grn { color: var(--green); }
.stag { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.stag.red { background: var(--red-l); color: var(--red); }
.stag.ora { background: var(--ora-l); color: var(--orange); }
.stag.grn { background: var(--grn-l); color: var(--green); }
.etxt { font-size: 11px; color: var(--text3); font-family: var(--mono); }

/* Timeline */
.tl-card { padding: 14px; margin-bottom: 20px; }
.tl-sc { display: flex; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }
.tl-m { flex: 0 0 110px; padding: 10px 7px; border-right: 1px solid var(--border); text-align: center; }
.tl-m:last-child { border-right: none; }
.tl-m.hi { background: rgba(63,185,80,.05); border-radius: 4px; }
.tl-mn { font-size: 10px; font-family: var(--mono); color: var(--text3); margin-bottom: 5px; }
.tl-ev { font-size: 9px; color: var(--text2); line-height: 1.5; min-height: 30px; margin-bottom: 4px; }
.tl-ch { display: inline-block; font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 20px; font-family: var(--mono); }
.tl-ch.ex { background: var(--grn-l); color: var(--green); }
.tl-ch.pr { background: var(--ora-l); color: var(--orange); }
.tl-ch.al { background: var(--red-l); color: var(--red); }

/* Heatmap */
.hml { display: grid; grid-template-columns: 1fr 300px; gap: 12px; margin-bottom: 20px; }
.hmc { padding: 14px; }
.hmap-svg-box { border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.hleg { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-size: 10px; color: var(--text3); }
.hgrad { flex: 1; height: 5px; border-radius: 3px; background: linear-gradient(to right, #1a4731, #2d6a4f, #ffd166, #e76f51, #dc2626); }
.rcard { overflow: hidden; margin-bottom: 12px; }
.rcard:last-child { margin-bottom: 0; }
.rcard-h { background: var(--bg3); padding: 10px 14px; border-bottom: 1px solid var(--border); }
.rcard-h h3 { font-size: 12px; font-weight: 600; color: var(--text); margin: 0; }
.rcard-h p { font-size: 10px; color: var(--text3); margin-top: 1px; margin-bottom: 0; }
.ri { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--border); }
.ri:last-child { border-bottom: none; }
.ri-n { font-family: var(--mono); font-size: 10px; color: var(--text3); width: 16px; flex-shrink: 0; }
.ri-name { flex: 1; font-size: 11px; font-weight: 500; color: var(--text2); }
.ri-bw { flex: 1; max-width: 70px; height: 4px; background: var(--bg3); border-radius: 2px; overflow: hidden; }
.ri-bf { height: 100%; border-radius: 2px; }
.ri-c { font-family: var(--mono); font-size: 11px; font-weight: 700; min-width: 28px; text-align: right; }

@media (max-width: 768px) {
    .hml { grid-template-columns: 1fr; }
}

/* Trends */
.tg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.tc2 { padding: 14px; }
.tc2-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.tc2-title { font-size: 12px; font-weight: 600; color: var(--text); }
.tc2-sub { font-size: 9px; color: var(--text3); margin-top: 2px; line-height: 1.5; }
.measure-box { background: var(--bg3); border: 1px solid var(--border2); border-radius: var(--r-sm); padding: 8px 12px; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.measure-current { font-family: var(--mono); font-size: 28px; font-weight: 700; line-height: 1; }
.measure-current.red { color: var(--red); }
.measure-current.ora { color: var(--orange); }
.measure-current.grn { color: var(--green); }
.measure-meta { text-align: right; }
.measure-thr { font-size: 10px; color: var(--text3); font-family: var(--mono); }
.measure-pct { font-size: 12px; font-weight: 600; font-family: var(--mono); margin-top: 2px; }
.measure-pct.red { color: var(--red); }
.measure-pct.grn { color: var(--green); }
.tc2-chart { position: relative; height: 120px; }
.vt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.vt-card { overflow: hidden; }
.vt-card h3 { font-size: 12px; font-weight: 600; padding: 11px 14px; background: var(--bg3); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; color: var(--text); margin: 0; }
.vt-card h3 .vh-right { display: flex; gap: 6px; align-items: center; }
.vt-table { width: 100%; border-collapse: collapse; }
.vt-table thead th { background: var(--bg4); padding: 7px 10px; font-size: 10px; font-weight: 600; color: var(--text3); text-align: right; border-bottom: 1px solid var(--border); letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.vt-table thead th:first-child { text-align: left; }
.vt-table tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
.vt-table tbody tr:last-child { border-bottom: none; }
.vt-table tbody tr:hover { background: var(--bg3); }
.vt-table td { padding: 8px 10px; font-size: 11px; vertical-align: middle; text-align: right; color: var(--text2); }
.vt-table td:first-child { text-align: left; font-family: var(--mono); font-size: 10px; font-weight: 600; color: var(--text); }
.vt-table td.oos-y { color: var(--red); font-weight: 600; }
.tier-bars { display: flex; gap: 2px; align-items: flex-end; height: 18px; min-width: 54px; justify-content: flex-end; }
.tier-bar { width: 14px; border-radius: 2px 2px 0 0; min-height: 2px; flex-shrink: 0; }

/* Action Plan */
.ag { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.ac { padding: 14px; display: flex; flex-direction: row; gap: 11px; align-items: flex-start; }
.ai { width: 34px; height: 34px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.ai.red { background: var(--red-l); }
.ai.ora { background: var(--ora-l); }
.ai.grn { background: var(--grn-l); }
.ab { flex: 1; min-width: 0; }
.at { font-size: 12px; font-weight: 600; margin-bottom: 3px; color: var(--text); }
.ad { font-size: 11px; color: var(--text2); line-height: 1.5; }
.af { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; flex-wrap: wrap; gap: 5px; }
.adate { font-size: 10px; font-family: var(--mono); color: var(--text3); }
.aown { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.aown.red { background: var(--red-l); color: var(--red); }
.aown.ora { background: var(--ora-l); color: var(--orange); }
.aown.grn { background: var(--grn-l); color: var(--green); }

@media (max-width: 1100px) {
    .tg { grid-template-columns: 1fr 1fr; }
    .vt-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .tg { grid-template-columns: 1fr; }
    .ag { grid-template-columns: 1fr; }
}
