/* Klear — Cockpit dark theme (refined technical cockpit) */

/* ══════════════════════════════════════════════════════════
   DESIGN TOKENS
   ══════════════════════════════════════════════════════════ */
:root {
    /* ── Brand & Accent ─────────────────────────────────── */
    --ck-primary:          #8B5CF6;
    --ck-primary-active:   #7C3AED;
    --ck-primary-glow:     rgba(139, 92, 246, 0.25);
    --ck-primary-disabled: #2D1E5C;
    --ck-on-primary:       #ffffff;
    --ck-amber:            #F4B740;
    --ck-amber-muted:      rgba(244, 183, 64, 0.15);

    /* ── Surfaces (cooler, slightly blue-shifted) ───────── */
    --ck-canvas:           #07080B;
    --ck-surface-soft:     #0C0E13;
    --ck-surface:          #0F1115;
    --ck-surface-2:        #161A21;
    --ck-surface-3:        #1C2130;
    --ck-hairline:         #242937;
    --ck-hairline-strong:  #2E3547;

    /* ── Text ───────────────────────────────────────────── */
    --ck-text:             #F0F2F7;
    --ck-body:             #C2CAD6;
    --ck-body-strong:      #DCE2EC;
    --ck-muted:            #8896A8;
    --ck-muted-soft:       #56677A;

    /* ── Status ─────────────────────────────────────────── */
    --status-pass:         #3FB950;
    --status-fail:         #FF5C5C;
    --status-warn:         #F4B740;
    --status-info:         #58A6FF;
    --status-neutral:      #6E7681;

    /* ── Layout ─────────────────────────────────────────── */
    --sidebar-width:           240px;
    --sidebar-width-collapsed: 64px;
    --topbar-height:           52px;

    /* ── Typography ─────────────────────────────────────── */
    --font-display: 'Bricolage Grotesque', 'Inter Tight', -apple-system, sans-serif;
    --font-sans:    'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono:    'JetBrains Mono', ui-monospace, 'Fira Code', Menlo, monospace;

    /* ── Spacing (base 4px) ─────────────────────────────── */
    --sp-xxs:    4px;
    --sp-xs:     8px;
    --sp-sm:     12px;
    --sp-md:     16px;
    --sp-lg:     24px;
    --sp-xl:     32px;
    --sp-xxl:    48px;
    --sp-section:96px;

    /* ── Border radius ──────────────────────────────────── */
    --r-xs:  3px;
    --r-sm:  6px;
    --r-md:  8px;
    --r-lg:  12px;
    --r-xl:  16px;
    --r-pill:9999px;

    /* ── Font size scale (base = 16px browser default) ─── */
    --fs-xxs:  0.6875rem;   /* 11px */
    --fs-xs:   0.75rem;     /* 12px */
    --fs-sm:   0.8125rem;   /* 13px */
    --fs-md:   0.875rem;    /* 14px */
    --fs-base: 0.9375rem;   /* 15px */
    --fs-body: 1rem;        /* 16px */
    --fs-lg:   1.0625rem;   /* 17px */
    --fs-xl:   1.125rem;    /* 18px */

    /* ── RGB channels for alpha variants ─────────────────── */
    --ck-primary-rgb:     139 92 246;
    --ck-amber-rgb:       244 183 64;
    --ck-status-pass-rgb: 63 185 80;
    --ck-status-fail-rgb: 255 92 92;
    --ck-status-warn-rgb: 244 183 64;
    --ck-status-info-rgb: 88 166 255;
    --ck-neutral-rgb:     107 119 137;
    --ck-muted-rgb:       107 119 137;
    --ck-dark-rgb:        15 17 21;

    /* ── Shadows ─────────────────────────────────────────── */
    --shadow-card: 0 1px 0 rgba(255,255,255,0.03) inset, 0 2px 8px rgba(0,0,0,0.4);
    --shadow-elevated: 0 4px 24px rgba(0,0,0,0.5), 0 1px 0 rgba(255,255,255,0.04) inset;

    /* ── Bootstrap overrides ─────────────────────────────── */
    --bs-secondary-color:     #6B7789;
    --bs-secondary-color-rgb: 107 119 137;

    /* ── Backward-compat aliases ─────────────────────────── */
    --cockpit-bg:        var(--ck-canvas);
    --cockpit-surface:   var(--ck-surface);
    --cockpit-surface-2: var(--ck-surface-2);
    --cockpit-border:    var(--ck-hairline);
    --cockpit-text:      var(--ck-text);
    --cockpit-muted:     var(--ck-muted);
    --cockpit-accent:    var(--ck-primary);
}

/* ══════════════════════════════════════════════════════════
   KEYFRAMES
   ══════════════════════════════════════════════════════════ */
@keyframes shimmer-slide {
    0%   { transform: translateX(-100%); opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { transform: translateX(100vw); opacity: 0; }
}

@keyframes card-reveal {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes dot-pulse {
    0%, 100% { opacity: 0.5; }
    50%       { opacity: 1; }
}

@keyframes conic-spin {
    to { --conic-angle: 360deg; }
}

/* ══════════════════════════════════════════════════════════
   GLOBAL BASE
   ══════════════════════════════════════════════════════════ */
html {
    font-size: 16px;
}

body {
    background-color: var(--ck-canvas);
    color: var(--ck-body);
    font-family: var(--font-sans);
    font-size: var(--fs-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Noise texture overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.028;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
}

/* Radial vignette on content */
.cockpit-main::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(ellipse 120% 120% at 50% 50%, transparent 50%, rgba(7,8,11,0.45) 100%);
}

a {
    color: var(--ck-primary);
    text-decoration: none;
}

a:hover {
    color: var(--ck-primary-active);
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
    color: var(--ck-text);
}

/* ══════════════════════════════════════════════════════════
   COCKPIT SHELL GRID
   ══════════════════════════════════════════════════════════ */
.cockpit-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--topbar-height) 1fr;
    grid-template-areas:
        "sidebar topbar"
        "sidebar content";
    min-height: 100vh;
    transition: grid-template-columns 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cockpit-shell.sidebar-collapsed {
    grid-template-columns: var(--sidebar-width-collapsed) 1fr;
}

/* ── Topbar ──────────────────────────────────────────────── */
.cockpit-topbar {
    grid-area: topbar;
    background-color: var(--ck-surface);
    border-bottom: 1px solid var(--ck-hairline);
    display: flex;
    align-items: center;
    padding: 0 var(--sp-md);
    gap: var(--sp-sm);
    position: sticky;
    top: 0;
    z-index: 1046;
    height: var(--topbar-height);
    overflow: hidden;
}

/* Shimmer line — fires once on page load */
.topbar-shimmer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 180px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--ck-primary), transparent);
    animation: shimmer-slide 1.6s ease-out 0.3s 1 forwards;
    opacity: 0;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    background: transparent;
    border: none;
    border-radius: var(--r-sm);
    color: var(--ck-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.12s, color 0.12s;
}

.sidebar-toggle:hover {
    background-color: var(--ck-surface-2);
    color: var(--ck-text);
}

/* ── Main content area ───────────────────────────────────── */
.cockpit-main {
    grid-area: content;
    padding: var(--sp-lg);
    overflow-y: auto;
    background-color: var(--ck-canvas);
    position: relative;
    z-index: 1;
}

/* ══════════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════════ */
.cockpit-shell .card {
    background-color: var(--ck-surface);
    border: 1px solid var(--ck-hairline);
    border-radius: var(--r-lg);
    color: var(--ck-body);
    box-shadow: var(--shadow-card);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.cockpit-shell .card-header {
    background-color: var(--ck-surface-2);
    border-bottom: 1px solid var(--ck-hairline);
    color: var(--ck-body-strong);
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.cockpit-shell .card:hover {
    border-color: var(--ck-hairline-strong);
    box-shadow: var(--shadow-elevated);
}

/* ══════════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════════ */
.cockpit-shell .table {
    --bs-emphasis-color: var(--ck-body);
    --bs-emphasis-color-rgb: 194, 202, 214;
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255,255,255,0.04);
    --bs-table-striped-color: var(--ck-body);
    --bs-table-hover-bg: rgba(139, 92, 246, 0.08);
    --bs-table-hover-color: var(--ck-body);
    --bs-table-color: var(--ck-body);
    --bs-table-color-state: var(--ck-body);
    --bs-table-border-color: var(--ck-hairline);
    color: var(--ck-body);
    border-color: var(--ck-hairline);
    font-size: var(--fs-md);
}

.cockpit-shell .table th {
    color: var(--ck-muted);
    font-family: var(--font-mono);
    font-size: var(--fs-xxs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
    border-bottom: 1px solid var(--ck-hairline);
    padding: 0.55rem 0.75rem;
    background-color: var(--ck-surface-2);
}

.cockpit-shell .table > thead.table-light,
.cockpit-shell .table > thead.table-light > tr,
.cockpit-shell .table > thead.table-light > tr > th {
    --bs-table-bg: var(--ck-surface-2);
    --bs-table-color: var(--ck-muted);
    background-color: var(--ck-surface-2) !important;
    color: var(--ck-muted) !important;
    border-color: var(--ck-hairline);
    box-shadow: none;
}

.cockpit-shell .table td {
    padding: 0.55rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--ck-hairline);
    color: var(--ck-body) !important;
    transition: none;
}

/* Zebra striping — applied globally, no .table-striped required */
.cockpit-shell .table tbody tr:nth-child(odd) td {
    background-color: rgba(255, 255, 255, 0.03);
}

/* Row hover — highlight on TR, cells get transparent bg to inherit */
.cockpit-shell .table tbody tr {
    transition: background-color 0s;
}
.cockpit-shell .table tbody tr:hover {
    background-color: rgba(139, 92, 246, 0.08);
    outline: none;
}
.cockpit-shell .table tbody tr:hover td {
    background-color: transparent !important;
    color: var(--ck-body) !important;
    box-shadow: none;
}
.cockpit-shell .table tbody tr:hover td:first-child {
    box-shadow: inset 3px 0 0 var(--ck-primary);
}

/* Status row highlights — border on first cell only */
.cockpit-shell .table tr.row-failed td:first-child   { box-shadow: inset 3px 0 0 var(--status-fail); }
.cockpit-shell .table tr.row-blocked td:first-child  { box-shadow: inset 3px 0 0 var(--status-warn); }
.cockpit-shell .table tr.row-running td:first-child  { box-shadow: inset 3px 0 0 var(--status-info); }
.cockpit-shell .table tr.row-waiting td:first-child  { box-shadow: inset 3px 0 0 var(--status-warn); }

/* ══════════════════════════════════════════════════════════
   GRID VIEW — summary + pagination footer
   ══════════════════════════════════════════════════════════ */
.cockpit-shell .grid-view {
    color: var(--ck-body);
}

.cockpit-shell .grid-view .summary {
    color: var(--ck-muted);
    font-family: var(--font-mono);
    font-size: var(--fs-xxs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.75rem 0.25rem 0;
    margin: 0;
}

.cockpit-shell .grid-view .summary b {
    color: var(--ck-body-strong);
    font-weight: 500;
}

.cockpit-shell .grid-view .empty {
    color: var(--ck-muted);
    font-style: normal;
    padding: 1.25rem 0.75rem;
    background-color: var(--ck-surface-2);
    border: 1px dashed var(--ck-hairline);
    border-radius: var(--r-md);
    text-align: center;
    font-size: var(--fs-sm);
}

.cockpit-shell .grid-view > nav,
.cockpit-shell .pager {
    display: flex;
    justify-content: center;
    width: 100%;
}

.cockpit-shell .pagination {
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    --bs-pagination-bg: transparent;
    --bs-pagination-color: var(--ck-body);
    --bs-pagination-border-color: var(--ck-hairline);
    --bs-pagination-hover-bg: rgba(139, 92, 246, 0.10);
    --bs-pagination-hover-color: var(--ck-text);
    --bs-pagination-hover-border-color: var(--ck-hairline-strong);
    --bs-pagination-focus-bg: rgba(139, 92, 246, 0.12);
    --bs-pagination-focus-color: var(--ck-text);
    --bs-pagination-focus-box-shadow: 0 0 0 2px var(--ck-primary-glow);
    --bs-pagination-active-bg: var(--ck-primary);
    --bs-pagination-active-color: var(--ck-on-primary);
    --bs-pagination-active-border-color: var(--ck-primary);
    --bs-pagination-disabled-bg: transparent;
    --bs-pagination-disabled-color: var(--ck-muted-soft);
    --bs-pagination-disabled-border-color: var(--ck-hairline);
    --bs-pagination-border-radius: var(--r-sm);
    --bs-pagination-padding-x: 0.65rem;
    --bs-pagination-padding-y: 0.3rem;
    --bs-pagination-font-size: var(--fs-sm);
    gap: 4px;
    margin: 0.75rem 0 0;
    justify-content: center;
    flex-wrap: wrap;
}

.cockpit-shell .pagination .page-link {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    letter-spacing: 0.04em;
    border: 1px solid var(--bs-pagination-border-color);
    background-color: var(--ck-surface-2);
    min-width: 32px;
    text-align: center;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.cockpit-shell .pagination .page-link:hover {
    background-color: var(--bs-pagination-hover-bg);
    border-color: var(--bs-pagination-hover-border-color);
    color: var(--bs-pagination-hover-color);
}

.cockpit-shell .pagination .page-link:focus,
.cockpit-shell .pagination .page-link:focus-visible {
    box-shadow: var(--bs-pagination-focus-box-shadow);
    outline: none;
    z-index: 2;
}

.cockpit-shell .pagination .page-item.active .page-link {
    background-color: var(--bs-pagination-active-bg);
    border-color: var(--bs-pagination-active-border-color);
    color: var(--bs-pagination-active-color);
    box-shadow: 0 0 0 1px var(--ck-primary-glow);
}

.cockpit-shell .pagination .page-item.disabled .page-link {
    background-color: transparent;
    border-color: var(--ck-hairline);
    color: var(--ck-muted-soft);
    opacity: 0.6;
}

/* Footer row: align summary (left) with pagination (right) when present */
.cockpit-shell .grid-view > .summary + .pagination,
.cockpit-shell .grid-view .table + .summary {
    margin-top: 0.5rem;
}

/* Standalone LinkPager (outside GridView, e.g. projects/history, automation-runs) */
.cockpit-shell nav > .pagination,
.cockpit-shell .pager > .pagination {
    margin-top: var(--sp-md);
}

/* ══════════════════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════════════════ */
.cockpit-shell .badge {
    font-family: var(--font-mono);
    font-size: var(--fs-xxs);
    font-weight: 500;
    letter-spacing: 0.04em;
    border-radius: var(--r-xs);
    padding: 0.2em 0.5em;
}

.cockpit-shell .badge.text-bg-success {
    background-color: rgba(63, 185, 80, 0.15) !important;
    color: #4ADE80 !important;
    border: 1px solid rgba(63, 185, 80, 0.3);
}

.cockpit-shell .badge.text-bg-danger {
    background-color: rgba(255, 92, 92, 0.15) !important;
    color: #FF7070 !important;
    border: 1px solid rgba(255, 92, 92, 0.3);
}

.cockpit-shell .badge.text-bg-warning {
    background-color: rgba(244, 183, 64, 0.15) !important;
    color: #F4B740 !important;
    border: 1px solid rgba(244, 183, 64, 0.3);
}

.cockpit-shell .badge.text-bg-primary {
    background-color: rgba(139, 92, 246, 0.15) !important;
    color: #A78BFA !important;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.cockpit-shell .badge.text-bg-info {
    background-color: rgba(88, 166, 255, 0.12) !important;
    color: #79C0FF !important;
    border: 1px solid rgba(88, 166, 255, 0.25);
}

.cockpit-shell .badge.text-bg-secondary {
    background-color: rgba(107, 119, 137, 0.15) !important;
    color: #8B97A8 !important;
    border: 1px solid rgba(107, 119, 137, 0.25);
}

.cockpit-shell .badge.text-bg-dark {
    background-color: rgba(15, 17, 21, 0.8) !important;
    color: #8B97A8 !important;
    border: 1px solid var(--ck-hairline);
}

.cockpit-shell .badge.text-bg-light {
    background-color: rgba(107, 119, 137, 0.12) !important;
    color: #8B97A8 !important;
    border: 1px solid rgba(107, 119, 137, 0.18);
}

/* ── Status dot+label badges ─────────────────────────────── */
.badge--dot {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
}

.badge--dot::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    background-color: currentColor;
}

/* ══════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════ */
.cockpit-shell .btn-primary,
.btn-primary {
    background-color: var(--ck-primary);
    border-color: var(--ck-primary);
    color: var(--ck-on-primary);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: var(--fs-md);
    border-radius: var(--r-md);
    padding: 0.45rem 1.1rem;
    letter-spacing: -0.01em;
    transition: background-color 0.12s, box-shadow 0.12s, transform 0.08s;
}

.cockpit-shell .btn-primary:hover,
.btn-primary:hover {
    background-color: var(--ck-primary-active);
    border-color: var(--ck-primary-active);
    color: var(--ck-on-primary);
    box-shadow: 0 0 0 3px var(--ck-primary-glow);
}

.cockpit-shell .btn-primary:active,
.btn-primary:active {
    transform: translateY(1px);
}

.cockpit-shell .btn-primary:disabled,
.btn-primary:disabled {
    background-color: var(--ck-primary-disabled);
    border-color: var(--ck-primary-disabled);
    color: rgba(255,255,255,0.3);
}

/* ── Unified button system ───────────────────────────────────
   Every button — primary, secondary, success, warning, danger, info —
   must carry a visible background. Solid and outline variants share the
   same fill so Bootstrap's default `btn-success` (sólid verde brilhante)
   doesn't break the cockpit palette. Tones live in DESIGN.md > Buttons. */

.cockpit-shell .btn,
.btn {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: var(--fs-md);
    border-radius: var(--r-md);
    padding: 0.45rem 1.1rem;
    letter-spacing: -0.01em;
    border: 1px solid transparent;
    transition: background-color 0.12s, color 0.12s, border-color 0.12s, box-shadow 0.12s;
}

/* Neutral (secondary/light) — slate surface, default action affordance */
.cockpit-shell .btn-secondary,
.cockpit-shell .btn-outline-secondary,
.cockpit-shell .btn-light,
.cockpit-shell .btn-outline-light,
.btn-secondary,
.btn-outline-secondary,
.btn-light,
.btn-outline-light {
    color: var(--ck-body);
    background-color: var(--ck-surface-2);
    border-color: var(--ck-hairline);
}
.cockpit-shell .btn-secondary:hover,
.cockpit-shell .btn-outline-secondary:hover,
.cockpit-shell .btn-light:hover,
.cockpit-shell .btn-outline-light:hover,
.btn-secondary:hover,
.btn-outline-secondary:hover,
.btn-light:hover,
.btn-outline-light:hover {
    background-color: var(--ck-surface-3);
    color: var(--ck-text);
    border-color: var(--ck-hairline-strong);
}

/* Success — tonal green ("Create", "Save when destructive elsewhere") */
.cockpit-shell .btn-success,
.cockpit-shell .btn-outline-success,
.btn-success,
.btn-outline-success {
    color: #6AD080;
    background-color: rgba(63, 185, 80, 0.14);
    border-color: rgba(63, 185, 80, 0.40);
}
.cockpit-shell .btn-success:hover,
.cockpit-shell .btn-outline-success:hover,
.btn-success:hover,
.btn-outline-success:hover {
    background-color: rgba(63, 185, 80, 0.22);
    color: #7DDB91;
    border-color: rgba(63, 185, 80, 0.60);
}

/* Warning — amber tonal ("Deactivate", "Cancel cycle") */
.cockpit-shell .btn-warning,
.cockpit-shell .btn-outline-warning,
.btn-warning,
.btn-outline-warning {
    color: var(--ck-amber);
    background-color: rgba(244, 183, 64, 0.14);
    border-color: rgba(244, 183, 64, 0.40);
}
.cockpit-shell .btn-warning:hover,
.cockpit-shell .btn-outline-warning:hover,
.btn-warning:hover,
.btn-outline-warning:hover {
    background-color: rgba(244, 183, 64, 0.22);
    color: #F8C66A;
    border-color: rgba(244, 183, 64, 0.60);
}

/* Danger — destructive ("Delete Permanently", "Ack All") */
.cockpit-shell .btn-danger,
.cockpit-shell .btn-outline-danger,
.btn-danger,
.btn-outline-danger {
    color: #FF8585;
    background-color: rgba(255, 92, 92, 0.14);
    border-color: rgba(255, 92, 92, 0.40);
}
.cockpit-shell .btn-danger:hover,
.cockpit-shell .btn-outline-danger:hover,
.btn-danger:hover,
.btn-outline-danger:hover {
    background-color: rgba(255, 92, 92, 0.22);
    color: #FFA0A0;
    border-color: rgba(255, 92, 92, 0.60);
}

/* Info & outline-primary — violet tonal (secondary brand action) */
.cockpit-shell .btn-info,
.cockpit-shell .btn-outline-info,
.cockpit-shell .btn-outline-primary,
.btn-info,
.btn-outline-info,
.btn-outline-primary {
    color: #B5A0FF;
    background-color: rgba(139, 92, 246, 0.14);
    border-color: rgba(139, 92, 246, 0.42);
}
.cockpit-shell .btn-info:hover,
.cockpit-shell .btn-outline-info:hover,
.cockpit-shell .btn-outline-primary:hover,
.btn-info:hover,
.btn-outline-info:hover,
.btn-outline-primary:hover {
    background-color: rgba(139, 92, 246, 0.22);
    color: var(--ck-text);
    border-color: var(--ck-primary);
}

/* ── Alerts (Bootstrap) ──────────────────────────────────── */
.cockpit-shell .alert {
    border-radius: var(--r-md);
    border: 1px solid var(--ck-hairline);
    background-color: var(--ck-surface-2);
    color: var(--ck-body);
}

.cockpit-shell .alert-success,
.alert-success {
    color: #6AD080;
    background-color: rgba(63, 185, 80, 0.10);
    border-color: rgba(63, 185, 80, 0.30);
}

.cockpit-shell .alert-danger,
.alert-danger {
    color: #FF8585;
    background-color: rgba(255, 92, 92, 0.10);
    border-color: rgba(255, 92, 92, 0.30);
}

.cockpit-shell .alert-warning,
.alert-warning {
    color: var(--ck-amber);
    background-color: rgba(244, 183, 64, 0.10);
    border-color: rgba(244, 183, 64, 0.30);
}

.cockpit-shell .alert-info,
.alert-info {
    color: #8FB7FF;
    background-color: rgba(88, 166, 255, 0.10);
    border-color: rgba(88, 166, 255, 0.30);
}

.cockpit-shell .alert .btn-close,
.alert .btn-close {
    filter: invert(1) grayscale(1) opacity(0.6);
}

/* ══════════════════════════════════════════════════════════
   FORM CONTROLS
   ══════════════════════════════════════════════════════════ */
.cockpit-shell .form-control,
.cockpit-shell .form-select {
    background-color: var(--ck-surface-2);
    border: 1px solid var(--ck-hairline);
    color: var(--ck-text);
    border-radius: var(--r-md);
    font-size: var(--fs-md);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.cockpit-shell .form-control:focus,
.cockpit-shell .form-select:focus {
    background-color: var(--ck-surface-2);
    border-color: var(--ck-primary);
    color: var(--ck-text);
    box-shadow: 0 0 0 3px var(--ck-primary-glow);
}

.cockpit-shell .form-control::placeholder {
    color: var(--ck-muted-soft);
}

.cockpit-shell .form-label {
    color: var(--ck-muted);
    font-size: var(--fs-sm);
    font-weight: 500;
    letter-spacing: 0.02em;
    margin-bottom: 0.35rem;
}

/* Input groups (date pickers, search) */
.cockpit-shell .input-group-text {
    background-color: var(--ck-surface-3);
    border-color: var(--ck-hairline);
    color: var(--ck-muted);
    font-size: var(--fs-sm);
}

/* ══════════════════════════════════════════════════════════
   ALERTS
   ══════════════════════════════════════════════════════════ */
.cockpit-shell .alert {
    border-radius: var(--r-md);
    font-size: var(--fs-md);
}

/* ══════════════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════════════ */
.cockpit-shell footer {
    background-color: var(--ck-surface);
    border-top: 1px solid var(--ck-hairline);
    color: var(--ck-muted);
    font-size: var(--fs-sm);
    padding: 0.6rem var(--sp-lg);
}

/* ══════════════════════════════════════════════════════════
   KPI CARDS
   ══════════════════════════════════════════════════════════ */
.kpi-card {
    background-color: var(--ck-surface);
    border: 1px solid var(--ck-hairline);
    border-radius: var(--r-lg);
    padding: var(--sp-md) var(--sp-md) calc(var(--sp-md) + 2px);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s;
    animation: card-reveal 0.4s ease-out both;
}

.kpi-card:nth-child(1) { animation-delay: 0ms; }
.kpi-card:nth-child(2) { animation-delay: 60ms; }
.kpi-card:nth-child(3) { animation-delay: 120ms; }
.kpi-card:nth-child(4) { animation-delay: 180ms; }
.kpi-card:nth-child(5) { animation-delay: 240ms; }
.kpi-card:nth-child(6) { animation-delay: 300ms; }

.kpi-card:hover {
    border-color: rgba(139, 92, 246, 0.35);
    box-shadow: var(--shadow-elevated), 0 0 0 1px rgba(139,92,246,0.15);
}

.kpi-card__label {
    font-family: var(--font-mono);
    font-size: var(--fs-xxs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ck-muted);
    font-weight: 500;
    margin-bottom: 0.35rem;
}

.kpi-card__value {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--ck-text);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.04em;
    position: relative;
    display: inline-block;
}

/* Micro-underline accent on hover */
.kpi-card__value::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--ck-primary);
    border-radius: 1px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.2s ease;
}

.kpi-card:hover .kpi-card__value::after {
    transform: scaleX(1);
}

.kpi-card__value--danger { color: var(--status-fail); }
.kpi-card__value--warn   { color: var(--status-warn); }
.kpi-card__value--pass   { color: var(--status-pass); }

.kpi-card__sub {
    font-size: var(--fs-sm);
    color: var(--ck-muted);
    margin-top: 0.3rem;
}

/* ══════════════════════════════════════════════════════════
   TAG CHIPS
   ══════════════════════════════════════════════════════════ */
.tag-chip {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: var(--fs-xxs);
    padding: 0.15em 0.5em;
    border-radius: var(--r-xs);
    border: 1px solid var(--ck-hairline);
    background-color: var(--ck-surface-2);
    color: var(--ck-muted);
    white-space: nowrap;
    line-height: 1.5;
}

.tag-chip--functional,
.tag-chip--flow,
.tag-chip--suite { color: #79C0FF; border-color: rgba(88,166,255,0.25); background-color: rgba(88,166,255,0.06); }

.tag-chip--payment,
.tag-chip--integration { color: #F4B740; border-color: rgba(244,183,64,0.25); background-color: rgba(244,183,64,0.06); }

.tag-chip--risk,
.tag-chip--priority { color: #FF7070; border-color: rgba(255,92,92,0.25); background-color: rgba(255,92,92,0.06); }

.tag-chip--execution,
.tag-chip--channel { color: #4ADE80; border-color: rgba(63,185,80,0.25); background-color: rgba(63,185,80,0.06); }

.tag-chip--project,
.tag-chip--context { color: #C4B5FD; border-color: rgba(139,92,246,0.3); background-color: rgba(139,92,246,0.07); }

/* ══════════════════════════════════════════════════════════
   DESIGN / INFO BANNER
   ══════════════════════════════════════════════════════════ */
.design-banner {
    border: 1px solid rgba(139, 92, 246, 0.3);
    background-color: rgba(139, 92, 246, 0.06);
    border-radius: var(--r-md);
    padding: 0.55rem var(--sp-md);
    font-size: var(--fs-sm);
    color: #C4B5FD;
}

/* ══════════════════════════════════════════════════════════
   ITEM HISTORY STRIP — Latest N runs of the same TestCase
   ══════════════════════════════════════════════════════════ */
.cockpit-shell .item-history__strip {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.cockpit-shell .item-history__chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    height: 28px;
    padding: 0 0.5rem;
    border-radius: var(--r-sm);
    font-family: var(--font-mono);
    font-size: var(--fs-xxs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-decoration: none;
    border: 1px solid transparent;
    transition: transform 0.1s, box-shadow 0.12s, border-color 0.12s;
}
.cockpit-shell .item-history__chip:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-card);
    text-decoration: none;
}

.cockpit-shell .item-history__chip--pass {
    background-color: rgba(63, 185, 80, 0.16);
    color: #6AD080;
    border-color: rgba(63, 185, 80, 0.40);
}
.cockpit-shell .item-history__chip--fail {
    background-color: rgba(255, 92, 92, 0.18);
    color: #FF8585;
    border-color: rgba(255, 92, 92, 0.45);
}
.cockpit-shell .item-history__chip--warn {
    background-color: rgba(244, 183, 64, 0.18);
    color: var(--ck-amber);
    border-color: rgba(244, 183, 64, 0.45);
}
.cockpit-shell .item-history__chip--info {
    background-color: rgba(139, 92, 246, 0.18);
    color: #B5A0FF;
    border-color: rgba(139, 92, 246, 0.45);
}
.cockpit-shell .item-history__chip--neutral {
    background-color: var(--ck-surface-2);
    color: var(--ck-muted);
    border-color: var(--ck-hairline);
}
/* ══════════════════════════════════════════════════════════
   ALERT STRIP
   ══════════════════════════════════════════════════════════ */
.alert-strip {
    background-color: rgba(255, 92, 92, 0.08);
    border: 1px solid rgba(255, 92, 92, 0.3);
    border-radius: var(--r-sm);
    padding: 0.25rem 0.6rem;
    animation: card-reveal 0.35s ease-out both;
}

.alert-strip__summary {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    min-height: 28px;
    flex-wrap: nowrap;
    width: 100%;
}

.alert-strip__icon {
    color: var(--status-fail);
    font-size: var(--fs-sm);
    line-height: 1;
    flex-shrink: 0;
}

.alert-strip__count {
    color: var(--status-fail);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 0 1 auto;
}

.alert-strip__count strong {
    color: var(--status-fail);
    font-weight: 700;
    font-size: var(--fs-sm);
    margin-right: 0.25rem;
}

.alert-strip__actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.cockpit-shell .btn-xs {
    --bs-btn-padding-x: 0.5rem;
    --bs-btn-padding-y: 0.1rem;
    --bs-btn-font-size: var(--fs-xxs);
    --bs-btn-border-radius: var(--r-xs);
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
    line-height: 1.25;
}

.alert-strip__drawer {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(255, 92, 92, 0.18);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    animation: card-reveal 0.2s ease-out both;
}

.alert-strip__drawer[hidden] {
    display: none;
}

.alert-strip__row {
    font-size: var(--fs-md);
    color: var(--ck-body);
    padding: 0.3rem 0.25rem;
    border-bottom: 1px solid rgba(255, 92, 92, 0.10);
}

.alert-strip__row:last-child {
    border-bottom: none;
}

.alert-strip__bullet {
    font-size: 0.5rem;
    color: var(--status-fail);
}

.alert-strip__link {
    color: #FF7070;
    font-weight: 600;
    text-decoration: none;
}

.alert-strip__link:hover {
    color: var(--status-fail);
    text-decoration: underline;
}

.alert-strip__project {
    color: var(--ck-muted);
}

/* ══════════════════════════════════════════════════════════
   SECTION LABELS
   ══════════════════════════════════════════════════════════ */
.section-label {
    font-family: var(--font-mono);
    font-size: var(--fs-xxs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ck-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* ══════════════════════════════════════════════════════════
   MONOSPACE META
   ══════════════════════════════════════════════════════════ */
.meta-mono {
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    color: var(--ck-muted);
}

/* ══════════════════════════════════════════════════════════
   PROGRESS BAR
   ══════════════════════════════════════════════════════════ */
.cockpit-shell .progress {
    background-color: var(--ck-surface-3);
    border: 1px solid var(--ck-hairline);
    height: 8px;
    border-radius: 0;
}

.cockpit-shell .progress-bar {
    border-radius: 0;
}

.cockpit-shell .progress-bar.bg-success { background-color: var(--status-pass) !important; }
.cockpit-shell .progress-bar.bg-danger  { background-color: var(--status-fail) !important; }
.cockpit-shell .progress-bar.bg-warning { background-color: var(--status-warn) !important; }
.cockpit-shell .progress-bar.bg-info    { background-color: var(--status-info) !important; }
.cockpit-shell .progress-bar.bg-primary { background-color: var(--ck-primary)  !important; }

/* ── Summary stat cards (cycle view) ───────────────────────── */
.cockpit-shell .card.text-center {
    background-color: var(--ck-surface-2) !important;
    border: 1px solid var(--ck-hairline) !important;
    border-radius: var(--r-md) !important;
    box-shadow: none !important;
}

.cockpit-shell .card.text-center .display-6 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--ck-text);
}

.cockpit-shell .card.text-center .small.text-muted {
    font-family: var(--font-mono);
    font-size: var(--fs-xxs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ck-muted);
}

/* Status accent — left border per status */
.cockpit-shell .card.text-center.bg-success { border-left: 3px solid var(--status-pass) !important; }
.cockpit-shell .card.text-center.bg-danger  { border-left: 3px solid var(--status-fail) !important; }
.cockpit-shell .card.text-center.bg-warning { border-left: 3px solid var(--status-warn) !important; }
.cockpit-shell .card.text-center.bg-info    { border-left: 3px solid var(--status-info) !important; }
.cockpit-shell .card.text-center.bg-primary { border-left: 3px solid var(--ck-primary)  !important; }
.cockpit-shell .card.text-center.bg-light   { border-left: 3px solid var(--ck-hairline-strong) !important; }

/* ══════════════════════════════════════════════════════════
   TOPBAR TITLE
   ══════════════════════════════════════════════════════════ */
.topbar-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--fs-lg);
    color: var(--ck-text);
    white-space: nowrap;
    letter-spacing: -0.02em;
}

.topbar-meta {
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    color: var(--ck-muted);
    white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════
   FILTER PILLS / FILTER AREA
   ══════════════════════════════════════════════════════════ */
.filter-pill {
    font-size: var(--fs-sm);
    padding: 0.2rem 0.65rem;
    border-radius: var(--r-pill);
    border: 1px solid var(--ck-hairline);
    background: transparent;
    color: var(--ck-muted);
    cursor: default;
}

/* Filter card elevated */
.filter-block {
    background-color: var(--ck-surface);
    border: 1px solid var(--ck-hairline);
    border-radius: var(--r-lg);
    padding: var(--sp-md);
    margin-bottom: var(--sp-md);
    box-shadow: var(--shadow-card);
}

/* ══════════════════════════════════════════════════════════
   PAGE HEADINGS (list pages)
   ══════════════════════════════════════════════════════════ */
.page-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 2rem;
    letter-spacing: -0.03em;
    color: var(--ck-text);
    line-height: 1;
    margin-bottom: var(--sp-lg);
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 991px) {
    .cockpit-shell {
        grid-template-columns: 1fr;
        grid-template-areas:
            "topbar"
            "content";
        transition: none;
    }

    .cockpit-shell.sidebar-collapsed {
        grid-template-columns: 1fr;
    }

    .cockpit-topbar {
        overflow: hidden;
        min-width: 0;
    }

    .cockpit-topbar .topbar-actions {
        display: none;
    }
}

/* ══════════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════════ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--ck-canvas);
    position: relative;
    padding: 1.5rem;
}

/* Grid lines on login bg */
.login-page::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(var(--ck-hairline) 1px, transparent 1px),
        linear-gradient(90deg, var(--ck-hairline) 1px, transparent 1px);
    background-size: 64px 64px;
    opacity: 0.15;
}

.login-page::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse 70% 70% at 50% 50%, transparent 30%, rgba(7,8,11,0.85) 100%);
}

.login-wrap {
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-brand__mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--ck-primary) 0%, #A78BFA 100%);
    border-radius: var(--r-lg);
    margin-bottom: 0.75rem;
    box-shadow: 0 0 32px rgba(139, 92, 246, 0.4);
}

.login-brand__name {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ck-text);
    letter-spacing: -0.03em;
    display: block;
    line-height: 1;
}

.login-brand__sub {
    font-family: var(--font-mono);
    font-size: var(--fs-xxs);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ck-muted);
    margin-top: 0.3rem;
    display: block;
}

/* Animated conic-gradient border card */
@property --conic-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

.login-card {
    background-color: var(--ck-surface);
    border-radius: var(--r-xl);
    padding: 2rem;
    position: relative;
    isolation: isolate;
}

.login-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: calc(var(--r-xl) + 1px);
    background: conic-gradient(
        from var(--conic-angle),
        transparent 0%,
        rgba(139,92,246,0.7) 15%,
        transparent 30%,
        transparent 70%,
        rgba(139,92,246,0.3) 85%,
        transparent 100%
    );
    animation: conic-spin 10s linear infinite;
    z-index: -1;
}

.login-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--r-xl);
    background: var(--ck-surface);
    z-index: -1;
}

.login-footer {
    text-align: center;
    margin-top: 1.25rem;
    font-family: var(--font-mono);
    font-size: var(--fs-xxs);
    color: var(--ck-muted-soft);
    letter-spacing: 0.05em;
}

/* ══════════════════════════════════════════════════════════
   ERROR PAGE (dark, consistent with product)
   ══════════════════════════════════════════════════════════ */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--ck-canvas);
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.error-page::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
}

.error-wrap {
    max-width: 480px;
    width: 100%;
    text-align: center;
    position: relative;
    z-index: 1;
    animation: card-reveal 0.5s ease-out both;
}

.error-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--ck-text);
    margin-bottom: 2.5rem;
}

.error-brand:hover { color: var(--ck-text); }

.error-brand__mark {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--ck-primary) 0%, #A78BFA 100%);
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-brand__name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
}

.error-cockpit__code {
    font-family: var(--font-display);
    font-size: clamp(5rem, 18vw, 9rem);
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(135deg, var(--ck-primary) 0%, rgba(139,92,246,0.4) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.04em;
    margin-bottom: 0.5rem;
    display: block;
}

.error-cockpit__title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--ck-text);
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}

.error-cockpit__message {
    color: var(--ck-muted);
    font-size: var(--fs-base);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.error-cockpit__actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.error-cockpit__meta {
    font-family: var(--font-mono);
    font-size: var(--fs-xxs);
    color: var(--ck-muted-soft);
    letter-spacing: 0.05em;
}

.error-cockpit__debug {
    text-align: left;
    font-size: var(--fs-sm);
    margin-top: 1.5rem;
}

.error-cockpit__debug pre {
    max-height: 280px;
    overflow: auto;
    background: var(--ck-surface-2);
    border: 1px solid var(--ck-hairline);
    padding: 1rem;
    border-radius: var(--r-md);
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    color: var(--ck-body);
}

/* Keep old classes working during migration */
.site-error-body {
    background: var(--ck-canvas);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.site-error-wrap {
    max-width: 540px;
    width: 100%;
}

.site-error-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.site-error-brand__link {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ck-text);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.site-error-brand__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: linear-gradient(135deg, var(--ck-primary) 0%, #A78BFA 100%);
    color: #fff;
    border-radius: var(--r-md);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.site-error-card {
    background: var(--ck-surface);
    border: 1px solid var(--ck-hairline);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-elevated);
    padding: 2.5rem 2rem;
    text-align: center;
}

.site-error__icon {
    font-size: 2.5rem;
    color: var(--ck-muted);
    margin-bottom: 1rem;
}

.site-error__code {
    font-family: var(--font-display);
    font-size: 5rem;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(135deg, var(--ck-primary) 0%, rgba(139,92,246,0.5) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    letter-spacing: -0.04em;
}

.site-error__title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--ck-text);
    letter-spacing: -0.02em;
}

.site-error__message {
    color: var(--ck-muted);
    margin-bottom: 2rem;
    font-size: var(--fs-base);
}

.site-error__actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.site-error__debug {
    text-align: left;
    font-size: var(--fs-sm);
}

.site-error__debug pre {
    max-height: 300px;
    overflow: auto;
    background: var(--ck-surface-2);
    border: 1px solid var(--ck-hairline);
    padding: 1rem;
    border-radius: var(--r-md);
    font-family: var(--font-mono);
    color: var(--ck-body);
}

.site-error__request-id {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--ck-muted-soft);
    margin-bottom: 0;
}

/* ══════════════════════════════════════════════════════════
   TEST CYCLE ITEM — HERO + TABS + EVIDENCE
   Inherits cockpit tokens; no surface goes lighter than --ck-surface-2.
   ══════════════════════════════════════════════════════════ */

.item-hero {
    margin-bottom: var(--sp-lg);
}

.item-hero__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-md);
    margin-bottom: var(--sp-md);
    flex-wrap: wrap;
}

.item-hero__crumb {
    color: var(--ck-muted);
    margin-bottom: var(--sp-xxs);
    letter-spacing: 0.04em;
    text-transform: lowercase;
}

.item-hero__crumb a {
    color: var(--ck-muted);
    border-bottom: 1px dotted var(--ck-hairline-strong);
}

.item-hero__crumb a:hover {
    color: var(--ck-body-strong);
}

.item-hero__sep {
    color: var(--ck-muted-soft);
    margin: 0 var(--sp-xxs);
}

.item-hero__title h1 {
    font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
    line-height: 1.15;
    margin: 0;
}

.item-hero__actions {
    display: flex;
    gap: var(--sp-xs);
    flex-shrink: 0;
}

.item-hero__kpis .kpi-card--text .kpi-card__text {
    font-family: var(--font-display);
    font-size: var(--fs-lg);
    color: var(--ck-text);
    line-height: 1.25;
    margin-top: var(--sp-xxs);
    display: flex;
    align-items: baseline;
    gap: var(--sp-xs);
    flex-wrap: wrap;
}

.item-hero__kpis .kpi-card--text .kpi-card__text .meta-mono {
    font-size: var(--fs-xs);
    color: var(--ck-muted);
}

/* ── Tabs ─────────────────────────────────────────────────── */
.cockpit-shell .nav-tabs.item-tabs {
    border-bottom: 1px solid var(--ck-hairline);
    gap: var(--sp-xs);
}

.cockpit-shell .nav-tabs.item-tabs .nav-link {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--ck-muted);
    font-family: var(--font-display);
    font-size: var(--fs-md);
    font-weight: 500;
    letter-spacing: -0.01em;
    padding: var(--sp-xs) var(--sp-sm);
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    gap: var(--sp-xs);
    transition: color 0.15s, border-color 0.15s;
}

.cockpit-shell .nav-tabs.item-tabs .nav-link:hover {
    color: var(--ck-body-strong);
    border-bottom-color: var(--ck-hairline-strong);
}

.cockpit-shell .nav-tabs.item-tabs .nav-link.active {
    color: var(--ck-text);
    background: transparent;
    border-bottom-color: var(--ck-primary);
}

.item-tabs__count {
    color: var(--ck-muted);
    font-size: var(--fs-xxs);
    padding: 0.1em 0.45em;
    background: var(--ck-surface-3);
    border: 1px solid var(--ck-hairline);
    border-radius: var(--r-xs);
}

.nav-tabs.item-tabs .nav-link.active .item-tabs__count {
    color: var(--ck-primary);
    border-color: rgba(var(--ck-primary-rgb) / 0.4);
    background: rgba(var(--ck-primary-rgb) / 0.08);
}

/* ── Snapshot grid ────────────────────────────────────────── */
.snapshot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--sp-md);
    margin: 0;
}

.snapshot-grid__cell--wide {
    grid-column: 1 / -1;
}

.snapshot-grid dt {
    font-family: var(--font-mono);
    font-size: var(--fs-xxs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ck-muted);
    margin-bottom: var(--sp-xxs);
    font-weight: 500;
}

.snapshot-grid dd {
    margin: 0;
    color: var(--ck-body-strong);
    font-size: var(--fs-md);
}

.snapshot-grid__desc {
    color: var(--ck-body);
    line-height: 1.5;
}

.snapshot-grid dd code.meta-mono {
    background: var(--ck-surface-2);
    border: 1px solid var(--ck-hairline);
    border-radius: var(--r-xs);
    padding: 0.15em 0.5em;
    color: var(--ck-body-strong);
}

/* ── Runner banner (replaces alert-secondary) ─────────────── */
.cockpit-shell .item-banner.card {
    border-left: 3px solid var(--ck-primary);
}

/* ── Evidence: preview ────────────────────────────────────── */
.evidence-preview-card {
    display: block;
}

.evidence-preview-card__link {
    display: block;
    width: 100%;
}

.evidence-preview-card__img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    background: var(--ck-canvas);
    border: 1px solid var(--ck-hairline);
    border-radius: var(--r-md);
    transition: border-color 0.15s, transform 0.15s;
}

.evidence-preview-card__link:hover .evidence-preview-card__img {
    border-color: var(--ck-primary);
}

.evidence-preview-card__caption {
    margin-top: var(--sp-xs);
    color: var(--ck-muted);
    font-size: var(--fs-xs);
}

.evidence-preview-card--empty .evidence-preview-card__img {
    opacity: 0.6;
}

/* ── Evidence: video ──────────────────────────────────────── */
.evidence-video-wrap__player {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--ck-canvas);
    border: 1px solid var(--ck-hairline);
    border-radius: var(--r-md);
    display: block;
}

.evidence-video-wrap__caption {
    margin-top: var(--sp-xs);
    color: var(--ck-muted);
    font-size: var(--fs-xs);
}

/* ── Evidence: trace ──────────────────────────────────────── */
.evidence-trace {
    background: var(--ck-canvas);
    border: 1px solid var(--ck-hairline);
    border-radius: var(--r-md);
    overflow: hidden;
}

.evidence-trace__head {
    display: flex;
    align-items: center;
    gap: var(--sp-xs);
    padding: var(--sp-xs) var(--sp-sm);
    background: var(--ck-surface-2);
    border-bottom: 1px solid var(--ck-hairline);
    color: var(--ck-muted);
    font-size: var(--fs-xxs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.evidence-trace__prompt {
    color: var(--status-pass);
    font-weight: 600;
}

.evidence-trace__label {
    flex-grow: 1;
}

.evidence-trace__copy {
    font-family: var(--font-mono);
    font-size: var(--fs-xxs);
    padding: 0.15rem 0.55rem;
    text-transform: none;
    letter-spacing: 0;
}

.evidence-trace__code {
    margin: 0;
    padding: var(--sp-md);
    background: transparent;
    color: var(--ck-body-strong);
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.evidence-trace__code code {
    color: inherit;
    background: transparent;
    padding: 0;
}

.evidence-trace__foot {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-sm);
    padding: var(--sp-xs) var(--sp-sm);
    background: var(--ck-surface-2);
    border-top: 1px solid var(--ck-hairline);
    color: var(--ck-muted);
    font-size: var(--fs-xs);
}

/* ── Evidence: empty states ───────────────────────────────── */
.evidence-empty {
    padding: var(--sp-lg);
    border: 1px dashed var(--ck-hairline-strong);
    border-radius: var(--r-md);
    text-align: center;
    color: var(--ck-muted-soft);
    background: rgba(255, 255, 255, 0.015);
}

/* ── Evidence: others list (no Bootstrap list-group) ─────── */
.evidence-others-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: var(--sp-xs);
}

.evidence-others-list__item {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: var(--sp-md);
    padding: var(--sp-xs) var(--sp-sm);
    background: var(--ck-surface-2);
    border: 1px solid var(--ck-hairline);
    border-radius: var(--r-sm);
    transition: border-color 0.15s;
}

.evidence-others-list__item:hover {
    border-color: var(--ck-hairline-strong);
}

.evidence-others-list__type {
    color: var(--ck-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: var(--fs-xxs);
    align-self: center;
}

.evidence-others-list__main {
    min-width: 0;
}

.evidence-others-list__name {
    color: var(--ck-body-strong);
    font-weight: 500;
    word-break: break-all;
}

.evidence-others-list__name:hover {
    color: var(--ck-primary);
}

.evidence-others-list__meta {
    display: flex;
    gap: var(--sp-sm);
    color: var(--ck-muted-soft);
    font-size: var(--fs-xxs);
    margin-top: 2px;
}

/* ── Accordion override (Add evidence) ────────────────────── */
.cockpit-shell .accordion-item {
    background: var(--ck-surface);
    border: 1px solid var(--ck-hairline);
    border-radius: var(--r-lg);
}

.cockpit-shell .accordion-button {
    background: var(--ck-surface-2);
    color: var(--ck-body-strong);
    font-family: var(--font-display);
    font-weight: 500;
    box-shadow: none;
}

.cockpit-shell .accordion-button:not(.collapsed) {
    background: var(--ck-surface-3);
    color: var(--ck-text);
}

.cockpit-shell .accordion-button:focus {
    box-shadow: 0 0 0 0.2rem rgba(var(--ck-primary-rgb) / 0.15);
}

/* ── List-group override (Execution history timeline, etc.) ── */
.cockpit-shell .list-group {
    --bs-list-group-bg: transparent;
    --bs-list-group-color: var(--ck-body);
    --bs-list-group-border-color: var(--ck-hairline);
    --bs-list-group-action-color: var(--ck-body);
    --bs-list-group-action-hover-bg: rgba(var(--ck-primary-rgb) / 0.06);
    --bs-list-group-action-hover-color: var(--ck-text);
    background-color: transparent;
}

.cockpit-shell .list-group-item {
    background-color: transparent;
    color: var(--ck-body);
    border-color: var(--ck-hairline);
}

.cockpit-shell .list-group-flush > .list-group-item {
    border-left: 0;
    border-right: 0;
    background-color: transparent;
}

/* ── Evidence: error-context.md (fixed-height code block) ── */
.error-context {
    background: var(--ck-canvas);
    border: 1px solid var(--ck-hairline);
    border-radius: var(--r-md);
    overflow: hidden;
}

.error-context__head {
    display: flex;
    align-items: center;
    gap: var(--sp-xs);
    padding: var(--sp-xs) var(--sp-sm);
    background: var(--ck-surface-2);
    border-bottom: 1px solid var(--ck-hairline);
    color: var(--ck-muted);
    font-size: var(--fs-xxs);
    text-transform: lowercase;
    letter-spacing: 0.04em;
}

.error-context__filename {
    color: var(--ck-body-strong);
    font-weight: 500;
}

.error-context__sep {
    color: var(--ck-muted-soft);
}

.error-context__body {
    margin: 0;
    padding: var(--sp-md);
    max-height: 420px;
    overflow: auto;
    background: transparent;
    color: var(--ck-body);
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.error-context__body code {
    color: inherit;
    background: transparent;
    padding: 0;
    font-family: inherit;
}

.error-context__body::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
.error-context__body::-webkit-scrollbar-track {
    background: var(--ck-surface);
}
.error-context__body::-webkit-scrollbar-thumb {
    background: var(--ck-hairline-strong);
    border-radius: var(--r-xs);
}
.error-context__body::-webkit-scrollbar-thumb:hover {
    background: var(--ck-muted-soft);
}
