/* ========== Obsidian Architect Design System ========== */

/* Base Typography */
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
.font-headline {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    vertical-align: middle;
    fill: currentColor;
}

/* Typography Scale */
.display-lg { font-size: 3rem; font-weight: 800; letter-spacing: -0.02em; font-family: 'Plus Jakarta Sans', sans-serif; line-height: 1.1; }
.display-md { font-size: 2.25rem; font-weight: 800; letter-spacing: -0.02em; font-family: 'Plus Jakarta Sans', sans-serif; line-height: 1.1; }
.display-sm { font-size: 1.875rem; font-weight: 700; letter-spacing: -0.02em; font-family: 'Plus Jakarta Sans', sans-serif; line-height: 1.1; }
.label-sm { font-size: 0.625rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-secondary); }

/* Glass Effect */
.glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

/* Ghost Border */
.ghost-border {
    border: 1px solid var(--ghost-border);
}

/* Ambient Shadow (floating elements) */
.ambient-shadow {
    box-shadow: 0 0 32px rgba(225, 226, 235, 0.06);
}

/* Gradient CTA Button */
.btn-primary {
    background: linear-gradient(135deg, #b83b8c, #8a2d6a);
    color: #fff;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    box-shadow: 0 0 4px rgba(184, 59, 140, 0.2);
    transition: all 0.2s;
}
.btn-primary:hover {
    box-shadow: 0 0 12px rgba(184, 59, 140, 0.3);
    transform: translateY(-1px);
}
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
.btn-primary:disabled:hover {
    box-shadow: 0 0 4px rgba(184, 59, 140, 0.2);
    transform: none;
}

/* Card Hover */
.bank-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}
.bank-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    background: var(--surface-high);
}

/* General card hover */
.card-hover:hover {
    background: var(--surface-high);
}

/* Stat link (payment list) */
.stat-link {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.15s;
}
.stat-link:hover {
    text-decoration: underline;
    opacity: 0.8;
}

/* Critical Pulse Glow */
@keyframes critical-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(228, 57, 62, 0); }
    50% { box-shadow: 0 0 16px 2px rgba(228, 57, 62, 0.15); }
}
.bank-card-critical {
    animation: critical-pulse 3s ease-in-out infinite;
}

/* Theme variables — Obsidian Architect */
:root {
    /* Surface Tonal Hierarchy */
    --bg-primary: #0b0e14;
    --bg-secondary: #10131a;
    --bg-card: #1d2026;
    --surface-low: #191c22;
    --surface-high: #272a31;
    --surface-highest: #32353c;
    --surface-bright: #363940;

    /* Text */
    --text-primary: #e1e2eb;
    --text-secondary: #d4d4d9;
    --text-muted: #909095;

    /* Borders */
    --border: rgba(255, 255, 255, 0.05);
    --ghost-border: rgba(144, 144, 149, 0.15);

    /* Semantic Colors */
    --green: #6de039;
    --green-bg: rgba(109, 224, 57, 0.1);
    --green-dim: #338d00;
    --yellow: #cc7f14;
    --yellow-bg: rgba(204, 127, 20, 0.1);
    --yellow-light: #ffb86a;
    --red: #e4393e;
    --red-bg: rgba(228, 57, 62, 0.1);
    --blue: #b83b8c;
    --orange: #cc7f14;

    /* Accent (brand magenta) */
    --accent: #b83b8c;
    --accent-bg: rgba(184, 59, 140, 0.1);
    --accent-dim: #8a2d6a;

    /* Success (true green) */
    --success: #6de039;
    --success-bg: rgba(109, 224, 57, 0.1);
    --success-dim: #338d00;

    /* Shadow Scale */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.35);
    --shadow-glow: 0 0 24px rgba(184, 59, 140, 0.1);

    /* Glass */
    --glass-bg: rgba(50, 53, 60, 0.4);
    --glass-blur: blur(20px);
}

body.light-theme {
    --bg-primary: #f3f4f6;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --surface-low: #f9fafb;
    --surface-high: #f3f4f6;
    --surface-highest: #e5e7eb;
    --surface-bright: #d1d5db;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --border: rgba(0, 0, 0, 0.06);
    --ghost-border: rgba(0, 0, 0, 0.08);
    --green: #22a339;
    --green-bg: rgba(34, 163, 57, 0.08);
    --green-dim: #1a7a2d;
    --yellow: #b45309;
    --yellow-bg: rgba(180, 83, 9, 0.06);
    --yellow-light: #d97706;
    --red: #dc2626;
    --red-bg: rgba(220, 38, 38, 0.06);
    --blue: #a0336f;
    --orange: #b45309;

    /* Accent (brand magenta — light) */
    --accent: #a0336f;
    --accent-bg: rgba(160, 51, 111, 0.06);
    --accent-dim: #7d2858;

    /* Success (true green — light) */
    --success: #22a339;
    --success-bg: rgba(34, 163, 57, 0.08);
    --success-dim: #1a7a2d;

    /* Shadow Scale — light */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 24px rgba(184, 59, 140, 0.06);

    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-blur: blur(16px);
}

/* Header Logo */
.header-logo-light { display: none; }
body.light-theme .header-logo-dark { display: none; }
body.light-theme .header-logo-light { display: block; }

/* Tab active state */
.main-tab.active {
    color: var(--blue);
    border-bottom-color: var(--blue);
}
.main-tab:not(.active) {
    color: var(--text-secondary);
    border-bottom-color: transparent;
}

/* Search dropdown (floating → ghost-border) */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface-high);
    border: 1px solid var(--ghost-border);
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 50;
    display: none;
    box-shadow: var(--shadow-lg);
}
.search-dropdown.visible { display: block; }

.search-result-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.search-result-item:hover { background: var(--surface-highest); }
.search-result-item:last-child { border-bottom: none; }
.result-id { color: var(--text-secondary); font-size: 11px; margin-left: 8px; }

/* Severity cards - dynamic classes from JS */
.sev-ok    { border-left: 4px solid var(--success); }
.sev-warn  { border-left: 4px solid var(--yellow); background: var(--yellow-bg); }
.sev-crit  { border-left: 4px solid var(--red);    background: var(--red-bg); box-shadow: 0 0 8px 2px rgba(228, 57, 62, 0.12); }

/* Severity badge */
.badge-ok   { background: var(--success-bg); color: var(--success); }
.badge-warn { background: var(--yellow-bg); color: var(--yellow); }
.badge-crit { background: var(--red-bg); color: var(--red); }

/* Rate cell colors */
.rate-good { color: var(--success); }
.rate-warn { color: var(--yellow); }
.rate-bad  { color: var(--red); }

/* Table row severity */
.row-crit { background: var(--red-bg); }
.row-warn { background: var(--yellow-bg); }

/* Alert dot */
.dot-critical { background: var(--red); }
.dot-warning  { background: var(--yellow); }
.dot-recovery { background: var(--success); }

/* Alert status pill */
.pill-active   { background: var(--red-bg); color: var(--red); }
.pill-resolved { background: var(--success-bg); color: var(--success); }

/* Chip */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--surface-high);
    border: none;
    border-radius: 9999px;
    font-size: 13px;
    color: var(--text-primary);
}
.chip-bell        { cursor: pointer; opacity: 0.5; transition: opacity 0.2s; }
.chip-bell:hover  { opacity: 1; }
.chip-bell.on     { opacity: 1; color: var(--green); }
.chip-x           { cursor: pointer; color: var(--text-secondary); transition: color 0.2s; }
.chip-x:hover     { color: var(--red); }

/* Terminal tab */
.term-tab {
    padding: 5px 14px;
    font-size: 13px;
    background: var(--surface-high);
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.term-tab.active {
    background: var(--accent);
    color: #fff;
}

/* Summary bar */
#summaryBar {
    background: transparent;
    border-radius: 0;
    padding: 0;
    font-size: 14px;
    color: var(--text-secondary);
    box-shadow: none;
}

/* Desktop summary cards — Obsidian tonal */
.sum-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px 16px;
    text-align: left;
    border: none;
    border-left: 3px solid var(--surface-bright);
    transition: all 0.2s;
}
.sum-card:hover { background: var(--surface-high); }
.sum-card-value {
    font-size: 1.875rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text-primary);
}
.sum-card-label {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.sum-card-ok { border-left-color: var(--success); }
.sum-card-ok .sum-card-value { color: var(--success); }
.sum-card-ok .sum-card-label { color: var(--success); }
.sum-card-warn { border-left-color: var(--yellow); }
.sum-card-warn .sum-card-value { color: var(--yellow); }
.sum-card-warn .sum-card-label { color: var(--yellow); }
.sum-card-crit { border-left-color: var(--red); }
.sum-card-crit .sum-card-value { color: var(--red); }
.sum-card-crit .sum-card-label { color: var(--red); }

/* Connection dot (header) */
.conn-dot-ok, .conn-dot-fail {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.conn-dot-ok { background: var(--success); }
.conn-dot-fail { background: var(--red); opacity: 0.85; }

/* Error chart tab */
.error-tab {
    padding: 2px 8px;
    font-size: 11px;
    background: var(--surface-high);
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.error-tab:hover { background: var(--surface-highest); color: var(--text-primary); }
.error-tab.active { background: var(--accent); color: #fff; }

/* Severity filter buttons */
.sev-filter {
    padding: 5px 14px;
    font-size: 13px;
    background: var(--surface-high);
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.sev-filter:hover { background: var(--surface-highest); color: var(--text-primary); }
.sev-filter.active {
    background: var(--accent);
    color: #fff;
}

/* Tool buttons */
.tool-btn {
    padding: 4px 10px;
    font-size: 13px;
    border-radius: 8px;
    border: none;
    background: var(--surface-high);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.2;
}
.tool-btn:hover { background: var(--surface-highest); color: var(--text-primary); }
.tool-btn.active { background: var(--accent); color: #fff; }

/* Keyboard shortcuts help */
kbd {
    display: inline-block;
    padding: 2px 6px;
    font-size: 11px;
    font-family: monospace;
    background: var(--surface-highest);
    border: none;
    border-radius: 4px;
    color: var(--text-primary);
}

/* Trend arrow */
.trend-arrow {
    display: inline-block;
    font-size: 0.75em;
    margin-left: 4px;
    font-weight: 700;
}
.trend-up { color: var(--success); }
.trend-down { color: var(--red); }
.trend-flat { color: var(--text-secondary); }

/* Compact table view */
#compactTable { width: 100%; border-collapse: collapse; font-size: 13px; }
#compactTable th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
#compactTable td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
#compactTable tr:hover { background: var(--surface-high); }
#compactTable .compact-row-clickable { cursor: pointer; transition: background 0.15s; }
#compactTable .compact-row-clickable:hover { background: var(--surface-high); }
#compactTable .compact-sev { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
#compactTable .compact-sev-ok { background: var(--success); }
#compactTable .compact-sev-warn { background: var(--yellow); }
#compactTable .compact-sev-crit { background: var(--red); }

/* Compare panel */
.compare-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: start; }
.compare-bank { text-align: center; }
.compare-bank .compare-name { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; }
.compare-bank .compare-rate { font-size: 2.5rem; font-weight: 800; line-height: 1.1; }
.compare-vs { font-size: 1.5rem; font-weight: 700; color: var(--text-secondary); align-self: center; text-align: center; }
.compare-stat { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; }
.compare-stat-label { color: var(--text-secondary); }

/* Bank card compare selection */
.compare-selected { outline: 3px solid var(--blue); outline-offset: 2px; }

/* Downtime counter */
.downtime-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 9999px;
    background: var(--red-bg);
    color: var(--red);
    font-size: 11px;
    font-weight: 600;

}

/* Yesterday comparison */
.yesterday-hint {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 2px;
    text-align: center;
}
.yesterday-hint .yest-better { color: var(--success); }
.yesterday-hint .yest-worse { color: var(--red); }

/* Card top errors */
.card-errors {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}
.card-error-item {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    padding: 1px 0;
    color: var(--text-secondary);
}
.card-error-item > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.card-error-item .error-count { color: var(--red); font-weight: 600; flex-shrink: 0; }

/* Sparkline canvas */
.sparkline-wrap { margin-top: 8px; height: 32px; }
.sparkline-wrap canvas { width: 100% !important; height: 32px !important; }

/* Light theme shadow boost */
body.light-theme .shadow-sm { box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

/* ========== Hamburger Menu ========== */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
}
.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: all 0.3s;
}
.hamburger:hover span { background: var(--text-primary); }

/* ========== Mobile Responsive ========== */
@media (max-width: 640px) {
    /* Hamburger visible */
    .hamburger { display: flex; }

    /* Hide desktop top nav on mobile */
    header nav { display: none !important; }
    /* Show mobile nav links in hamburger dropdown */
    .mobile-nav-link { display: block !important; }

    /* Nav links dropdown on mobile */
    .nav-links {
        display: none !important;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
        padding: 12px 16px;
        gap: 8px;
        z-index: 100;
    }
    .nav-links.open {
        display: flex !important;
    }
    .nav-links a, .nav-links button, .nav-links span {
        width: 100%;
        text-align: left;
    }

    /* Header */
    header { padding: 8px 12px; }
    header h1 { font-size: 0.95rem; }

    /* Main content */
    main { padding: 12px 8px !important; gap: 12px !important; }

    /* Summary bar: 2-column */
    #summaryBar { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }
    .sum-card { padding: 10px 8px; }
    .sum-card-value { font-size: 1.2rem; }

    /* Bank cards: single column */
    #statusCards { grid-template-columns: 1fr !important; }

    /* Stat grids inside cards: 2 col */
    .grid-cols-3, .grid-cols-4 { grid-template-columns: repeat(2, 1fr) !important; }

    /* Charts: reduced height */
    .chart-container, canvas { max-height: 220px; }

    /* Tables: horizontal scroll */
    .overflow-x-auto { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 500px; }

    /* Font sizes */
    .text-2xl { font-size: 1.25rem; }
    .text-5xl { font-size: 2rem; }

    /* Today panel: 2-col */
    #todayPanel .grid { grid-template-columns: repeat(2, 1fr) !important; }

    /* Tabs scrollable */
    .flex.border-b-2 { overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }

    /* Hide desktop-only elements */
    .desktop-only { display: none !important; }

    /* Analytics page widgets */
    #widget-summary { grid-template-columns: repeat(2, 1fr) !important; }
    #widget-compare .flex.items-center.gap-2 { flex-wrap: wrap; }

    /* Touch targets — iOS 44px minimum */
    .tool-btn { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
    .error-tab { min-height: 36px; padding: 6px 12px; }
    .sev-filter { min-height: 44px; }
    .chip { min-height: 44px; }
}

/* ========== Tablet Responsive ========== */
@media (min-width: 641px) and (max-width: 1024px) {
    /* Bank cards: 2-column */
    #statusCards { grid-template-columns: repeat(2, 1fr) !important; }

    /* Summary bar: 3-column */
    #summaryBar { grid-template-columns: repeat(3, 1fr) !important; }
}

/* ========== Table Scroll Wrapper ========== */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ========== Toast Notifications ========== */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 380px;
    width: 100%;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    pointer-events: auto;
    transform: translateX(110%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--ghost-border);
    box-shadow: var(--shadow-lg);
}
.toast-visible { transform: translateX(0); opacity: 1; }
.toast-hiding { transform: translateX(110%); opacity: 0; }
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-msg { flex: 1; line-height: 1.4; }
.toast-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 0 2px;
    line-height: 1;
}
.toast-close:hover { opacity: 1; }
.toast-success { background: rgba(51, 141, 0, 0.85); }
.toast-error { background: rgba(228, 57, 62, 0.85); }
.toast-warning { background: rgba(204, 127, 20, 0.85); }
.toast-info { background: rgba(50, 53, 60, 0.85); color: var(--text-primary); }

/* ========== Confirm Modal ========== */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.confirm-overlay.visible { opacity: 1; }
.confirm-box {
    background: var(--bg-card);
    border: 1px solid var(--ghost-border);
    border-radius: 16px;
    padding: 28px 24px 20px;
    max-width: 380px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95) translateY(8px);
    transition: transform 0.2s ease;
}
.confirm-overlay.visible .confirm-box {
    transform: scale(1) translateY(0);
}
.confirm-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--red-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 20px;
}
.confirm-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-family: var(--font-headline);
}
.confirm-msg {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}
.confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.confirm-btn {
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}
.confirm-btn-cancel {
    background: var(--surface-high);
    color: var(--text-primary);
}
.confirm-btn-cancel:hover { background: var(--surface-highest); }
.confirm-btn-danger {
    background: var(--red);
    color: #fff;
}
.confirm-btn-danger:hover { background: #c52f34; }

/* Watch list section header */
.watchlist-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.watchlist-header-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--green-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.watchlist-header-icon svg { width: 16px; height: 16px; fill: var(--green); }
.watchlist-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-headline);
}
.watchlist-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}

/* ========== Skeleton Loading ========== */
.skeleton {
    background: var(--surface-low);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}
.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--surface-low) 25%, var(--surface-high) 50%, var(--surface-low) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}
body.light-theme .skeleton::after {
    background: linear-gradient(90deg, transparent 0%, rgba(0,0,0,0.04) 50%, transparent 100%);
}
@keyframes skeleton-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.skeleton-card {
    height: 220px;
    border: none;
    padding: 24px;
}
.skeleton-chart {
    height: 200px;
    border: none;
    padding: 20px;
}
.skeleton-row {
    height: 48px;
    border: none;
    border-radius: 8px;
    margin-bottom: 8px;
}

/* ========== Info Tooltip (CSS-only) ========== */
.info-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 11px;
    color: var(--text-secondary);
    cursor: help;
    position: relative;
    vertical-align: middle;
    border-radius: 50%;
    transition: color 0.2s;
}
.info-tip:hover,
.info-tip:focus { color: var(--blue); outline: none; }
.info-tip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    white-space: normal;
    max-width: 280px;
    text-align: center;
    border-radius: 10px;
    border: 1px solid var(--ghost-border);
    box-shadow: var(--shadow-lg);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 100;
}
.info-tip:hover::after,
.info-tip:focus::after { opacity: 1; }

/* ========== Error & Empty State ========== */
.error-state, .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    text-align: center;
    gap: 8px;
}
.error-state-icon, .empty-state-icon {
    font-size: 2rem;
    line-height: 1;
    opacity: 0.6;
}
.error-state-msg, .empty-state-msg {
    font-size: 13px;
    color: var(--text-secondary);
}
.error-state-retry {
    margin-top: 8px;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    background: var(--surface-high);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}
.error-state-retry:hover { background: var(--accent); color: #fff; }

/* ========== Settings Tabs ========== */
.settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}
.settings-tab {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.settings-tab:hover { color: var(--text-primary); }
.settings-tab.active {
    color: var(--blue);
    border-bottom-color: var(--blue);
}
.settings-panel { display: none; }
.settings-panel.active { display: block; }

/* ========== Card Progressive Disclosure ========== */
.card-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.card-details.open { max-height: 500px; }
.card-details-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    padding: 6px 0 0;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}
.card-details-toggle:hover { color: var(--text-primary); }
.card-details-toggle .toggle-arrow {
    transition: transform 0.3s;
    display: inline-block;
}
.card-details.open + .card-details-toggle .toggle-arrow,
.card-details-toggle.open .toggle-arrow {
    transform: rotate(180deg);
}

/* ========== Nav Active Highlighting ========== */
.nav-link-active {
    color: var(--blue) !important;
    border-color: var(--blue) !important;
}

/* ========== Section Description ========== */
.section-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}

/* ========== Compact Chart Containers ========== */
.compact-chart-container { height: 200px; }

/* ========== Scrollbar ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--surface-highest); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--surface-bright); }

/* ========== Focus States ========== */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Component focus-visible */
.sev-filter:focus-visible,
.term-tab:focus-visible,
.error-tab:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(184, 59, 140, 0.15);
}
.tool-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    background: var(--surface-highest);
}
.settings-tab:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}
.bank-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(184, 59, 140, 0.12);
}
.chip:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
/* Toggle switch focus ring */
.peer:focus-visible + div {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.info-tip:focus-visible {
    outline: 2px solid var(--accent);
    border-radius: 50%;
}

/* ========== Glass Header & Sidebar (D6) ========== */
header.glass {
    background: rgba(16, 19, 26, 0.8);
}
body.light-theme header.glass {
    background: rgba(255, 255, 255, 0.8);
}
aside.glass {
    background: rgba(11, 14, 20, 0.75);
}
body.light-theme aside.glass {
    background: rgba(243, 244, 246, 0.8);
}

/* ========== Typography Semantic Classes (D8) ========== */
.heading-section {
    font-size: 0.875rem;
    font-weight: 700;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text-primary);
}
.heading-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}
.text-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.text-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ========== Copy Button ========== */
.copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
    vertical-align: middle;
}
.copy-btn:hover {
    color: var(--accent);
    background: var(--accent-bg);
}

/* ========== Offline Banner ========== */
#offlineBanner.visible {
    display: block;
}
#offlineBanner.visible ~ #mainHeader {
    top: 36px;
}

/* ========== Mobile: Toast & Tabs ========== */
@media (max-width: 640px) {
    .toast-container { left: 16px; max-width: calc(100% - 32px); }
    .settings-tabs { gap: 0; flex-wrap: wrap; }
    .settings-tab { padding: 8px 12px; font-size: 12px; }
    .info-tip::after { white-space: normal; min-width: 200px; max-width: 260px; }
}

/* ========== Unified Stats Row ========== */
.unified-stats-row {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
}
.unified-stat {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 12px 10px;
    text-align: center;
    border-left: 3px solid var(--surface-bright);
    transition: background 0.2s;
}
.unified-stat:hover { background: var(--surface-high); }
.unified-stat-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 2px;
}
.unified-stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.2;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text-primary);
}
.unified-stat-ok { border-left-color: var(--success); }
.unified-stat-ok .unified-stat-value { color: var(--success); }
.unified-stat-warn { border-left-color: var(--yellow); }
.unified-stat-warn .unified-stat-value { color: var(--yellow); }
.unified-stat-crit { border-left-color: var(--red); }
.unified-stat-crit .unified-stat-value { color: var(--red); }
.unified-stat-rate { border-left-color: var(--success); }

@media (max-width: 640px) {
    .unified-stats-row { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 641px) and (max-width: 1024px) {
    .unified-stats-row { grid-template-columns: repeat(4, 1fr); }
}

/* ========== Mini Status Cards (HC/Fraud) ========== */
.mini-cards-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.mini-status-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg-card);
    border-radius: 12px;
    border-left: 3px solid var(--surface-bright);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}
.mini-status-card:hover {
    background: var(--surface-high);
    transform: translateX(2px);
}
.mini-status-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    flex-shrink: 0;
}
.mini-status-card-label {
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text-primary);
}
.mini-status-card-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

@media (max-width: 640px) {
    .mini-cards-row { grid-template-columns: 1fr; }
}

/* ========== Bank Row ========== */
.bank-row {
    display: grid;
    grid-template-columns: 40px 1fr minmax(80px, auto) minmax(80px, auto) minmax(80px, auto) minmax(80px, auto) 24px;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: 12px;
    border-left: 4px solid var(--surface-bright);
    cursor: pointer;
    transition: all 0.2s;
}
.bank-row:hover {
    background: var(--surface-high);
    transform: translateX(2px);
}
.bank-row-ok { border-left-color: var(--success); }
.bank-row-warn { border-left-color: var(--yellow); }
.bank-row-crit {
    border-left-color: var(--red);
    animation: critical-pulse 3s ease-in-out infinite;
}
.bank-row-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    background: var(--surface-highest);
    flex-shrink: 0;
}
.bank-row-name {
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bank-row-name-sub {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.bank-row-stat-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.bank-row-stat-value {
    font-size: 0.9rem;
    font-weight: 700;
    font-family: 'Plus Jakarta Sans', sans-serif;
}
.raw-hint {
    font-size: 0.7em;
    font-weight: 500;
    color: inherit;
    opacity: 0.5;
    margin-left: 1px;
}
.payout-widget {
    border: 1px solid var(--border);
    transition: border-color 0.3s, box-shadow 0.3s;
}
.payout-widget-critical {
    border-color: rgba(228, 57, 62, 0.4);
    box-shadow: 0 0 12px rgba(228, 57, 62, 0.08);
}
.payout-widget-warning {
    border-color: rgba(204, 127, 20, 0.3);
    box-shadow: 0 0 12px rgba(204, 127, 20, 0.06);
}
.payout-widget-ok {
    border-color: rgba(109, 224, 57, 0.2);
}
.payout-time-btns {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}
.payout-time-btn {
    padding: 3px 10px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.02em;
}
.payout-time-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text-secondary);
}
.payout-time-btn.active {
    background: var(--green-bg);
    border-color: var(--green);
    color: var(--green);
}
.bank-row-arrow {
    color: var(--text-muted);
    transition: color 0.2s;
}
.bank-row:hover .bank-row-arrow { color: var(--text-primary); }
.bank-row-info { min-width: 0; }
.bank-row-name-line {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bank-row-name-line .bank-row-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bank-row-payments-btn {
    padding: 6px 14px;
    margin-left: 12px;
    padding-left: 20px;
    border-left: 2px solid var(--text-muted);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    background: var(--green-bg);
    color: var(--green);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s;
}
.bank-row-payments-btn:hover { background: var(--green); color: var(--bg-primary); }

.card-payments-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    background: var(--green-bg);
    color: var(--green);
    text-decoration: none;
    transition: background 0.2s;
}
.card-payments-btn:hover { background: var(--green); color: var(--bg-primary); }

@media (max-width: 640px) {
    .bank-row {
        grid-template-columns: 36px 1fr 60px 60px 24px;
        gap: 8px;
        padding: 10px 12px;
    }
    .bank-row .bank-row-stat-extra { display: none; }
}

/* ========== Bank Detail Slide-Out Panel ========== */
.bank-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.bank-detail-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.bank-detail-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 800px;
    background: var(--bg-primary);
    z-index: 201;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.bank-detail-drawer.open {
    transform: translateX(0);
}
.bank-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.bank-detail-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.bank-detail-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--surface-high);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
}
.bank-detail-close:hover {
    background: var(--surface-highest);
    color: var(--text-primary);
}
.bank-detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    space-y: 20px;
}
.bank-detail-body > * + * { margin-top: 20px; }

.bank-detail-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.bank-detail-stat {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}
.bank-detail-stat-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.bank-detail-stat-value {
    font-size: 1.125rem;
    font-weight: 800;
    font-family: 'Plus Jakarta Sans', sans-serif;
}
.bank-detail-section {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
}
.bank-detail-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text-primary);
    margin-bottom: 12px;
}

/* TV mode: hide detail panel */
body.tv-mode .bank-detail-overlay,
body.tv-mode .bank-detail-drawer { display: none; }

@media (max-width: 640px) {
    .bank-detail-drawer { max-width: 100%; }
    .bank-detail-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ========== Fraud Breakdown Card Active ========== */
.fraud-breakdown-card {
    cursor: pointer;
    transition: all 0.2s;
}
.fraud-breakdown-card:hover { background: var(--surface-high); }
.fraud-breakdown-card.active {
    border-color: var(--yellow);
    background: var(--yellow-bg);
    box-shadow: 0 0 0 1px var(--yellow);
}

/* ========== Alert Mini (compact 5-item) ========== */
.alerts-show-more-btn {
    display: block;
    width: 100%;
    padding: 8px;
    margin-top: 12px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--surface-high);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.alerts-show-more-btn:hover {
    background: var(--surface-highest);
    color: var(--text-primary);
}
