/* Core Identity */
:root {
    --bg-base: #000000;
    --bg-panel: rgba(18, 18, 20, 0.4);
    --border-glass: rgba(255, 255, 255, 0.1);

    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #4a5568;

    --brand-primary: #8b5cf6;
    --brand-accent: #06b6d4;
    --status-ok: #10b981;
    --critical: #ef4444;
    --warning: #eab308;

    --color-bg-deep: var(--bg-base);
    --color-bg-card: var(--bg-panel);
    --color-border: rgba(255, 255, 255, 0.08);

    --color-brand: var(--brand-accent);
    --color-brand-glow: rgba(6, 182, 212, 0.6);

    --color-danger: var(--critical);
    --color-danger-glow: rgba(239, 68, 68, 0.6);

    --color-warning: var(--warning);
    --color-success: var(--status-ok);

    --font-sans: 'Inter', system-ui, sans-serif;
    --font-heading: 'Outfit', sans-serif;
    --font-mono: 'Fira Code', monospace;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: radial-gradient(circle at center, #0a0a0f 0%, #000000 100%);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Typography */
h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.text-brand {
    color: var(--color-brand);
    text-shadow: 0 0 8px var(--color-brand-glow);
}

.text-danger {
    color: var(--color-danger);
    text-shadow: 0 0 8px var(--color-danger-glow);
    animation: simple-glitch 4s infinite;
}

@keyframes simple-glitch {

    0%,
    90%,
    100% {
        transform: translate(0);
        text-shadow: 0 0 8px var(--color-danger-glow);
    }

    91% {
        transform: translate(-2px, 1px);
        text-shadow: 2px 0 #fff, -2px 0 var(--color-brand);
    }

    93% {
        transform: translate(2px, -1px);
        text-shadow: -2px 0 #fff, 2px 0 var(--color-brand);
    }

    95% {
        transform: translate(0);
    }
}

.text-secondary {
    color: var(--text-secondary);
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.w-100 {
    width: 100%;
}

/* Advanced UI Panels */
.glass-panel {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.4));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.glass-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.03), transparent);
    transform: skewX(-20deg);
    transition: all 0.7s ease;
    pointer-events: none;
}

.glass-panel:hover::before {
    left: 150%;
}

.glass-panel:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Cybernetic Corners */
.cyber-corners::before,
.cyber-corners::after {
    content: '';
    position: absolute;
    width: 15px;
    height: 15px;
    border: 2px solid var(--color-brand);
    /* Slower, GPU-accelerated transition prevents jittery glow at panel edges */
    transition: width 0.5s ease-out, height 0.5s ease-out, box-shadow 0.5s ease-out, border-color 0.5s ease-out;
    will-change: width, height;
    pointer-events: none;
    /* Must never intercept cursor — decorative only */
    z-index: 10;
}

.cyber-corners::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.cyber-corners::after {
    bottom: -1px;
    right: -1px;
    border-left: none;
    border-top: none;
}

/* Single hover selector — avoids double-trigger jitter from nested hover chains */
.cyber-corners:hover::before,
.cyber-corners:hover::after {
    width: 28px;
    height: 28px;
    box-shadow: 0 0 12px var(--color-brand-glow);
    border-color: #fff;
}

/* Background Animations */
.bg-mesh {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -2;
    mask-image: linear-gradient(to bottom, black 20%, transparent 80%);
    -webkit-mask-image: linear-gradient(to bottom, black 20%, transparent 80%);
    animation: grid-move 30s linear infinite;
}

@keyframes grid-move {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 0 50px;
    }
}

.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.1));
    background-size: 100% 4px;
    z-index: 100;
    pointer-events: none;
    opacity: 0.2;
    animation: scroll-scanlines 10s linear infinite;
}

@keyframes scroll-scanlines {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 0 100%;
    }
}

.blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.5;
    animation: float 20s infinite alternate;
}

.blob-1 {
    width: 600px;
    height: 600px;
    background: rgba(139, 92, 246, 0.15);
    top: -200px;
    left: -200px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: rgba(6, 182, 212, 0.1);
    bottom: -100px;
    right: -100px;
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translateY(0px) scale(1);
    }

    100% {
        transform: translateY(50px) scale(1.1);
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.95) translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #ffffff, #e2e8f0);
    color: #000;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15);
}

.btn-primary:hover,
.btn-primary.btn-glow {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 15px 30px rgba(255, 255, 255, 0.25), inset 0 -3px 0 rgba(0, 0, 0, 0.1);
    color: #000;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.btn-glow {
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.btn-nav {
    padding: 10px 20px;
    font-size: 12px;
    border: 1px solid var(--border-glass);
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.btn-nav:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-4px) scale(1.02);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--critical) !important;
    color: var(--critical) !important;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: var(--critical) !important;
    color: #fff !important;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.6);
}

/* Inputs */
.input-group label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.auth-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--color-border);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
}

.auth-input:focus {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 2px var(--color-brand-glow);
}

/* NOC Unified Layout */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.cmd-bar {
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    border-radius: 0;
    flex-wrap: wrap;
    gap: 1rem;
}

.cmd-left,
.cmd-center,
.cmd-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.brand h2 {
    font-size: 1.25rem;
    margin: 0;
    line-height: 1;
    letter-spacing: 0.1em;
    color: var(--text-primary);
}

.brand .version {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--color-brand);
}

.global-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-success);
    background: rgba(0, 255, 204, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(0, 255, 204, 0.3);
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.1);
}

.operator-badge,
.plan-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    display: flex;
    gap: 0.5rem;
}

.operator-badge .label,
.plan-badge .label {
    color: var(--text-secondary);
}

.noc-grid {
    display: grid;
    grid-template-columns: 320px minmax(400px, 1fr) 380px;
    gap: 1.5rem;
    padding: 1.5rem;
    flex: 1;
}

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

.noc-col {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.flex-1 {
    flex: 1;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.align-center {
    align-items: center;
}

.gap-3 {
    gap: 1rem;
}

.px-4 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.py-3 {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.panel {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.panel-header {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
}

.metric-card {
    padding: 1.25rem;
    border-top: 1px solid var(--border-glass);
    border-left: 2px solid var(--brand-accent);
}

.alert-card {
    border-top: 1px solid var(--border-glass);
    border-left: 2px solid var(--critical);
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.1) 0%, rgba(0, 0, 0, 0) 100%);
    border-color: rgba(239, 68, 68, 0.3);
}

.override-panel {
    border: 1px solid var(--critical);
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.15) 0%, rgba(0, 0, 0, 0.8) 100%);
    box-shadow: inset 0 0 20px rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-lg);
}

.override-panel h4 {
    text-shadow: 0 0 10px var(--color-danger-glow);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.card-title {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.text-gradient {
    background: linear-gradient(90deg, var(--brand-accent), var(--brand-primary), #d8b4fe);
    background-size: 200% auto;
    animation: gradient-flow 6s linear infinite;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

@keyframes gradient-flow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* ML Metrics Panel styles */
.ml-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    padding: 0.35rem 0.5rem;
    border: 1px solid rgba(0, 255, 204, 0.1);
    border-radius: var(--radius-sm);
}

.ml-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-secondary);
}

.ml-val {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--color-brand);
    font-weight: 700;
}

/* 4-Layer Matrix */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
}

.layer-card {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
}

.layer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0, 255, 204, 0.1);
    padding-bottom: 0.25rem;
}

.layer-num {
    font-family: var(--font-heading);
    font-weight: 900;
    color: var(--color-brand);
    text-shadow: 0 0 5px var(--color-brand-glow);
}

.layer-title {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-primary);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.layer-sub {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    color: var(--text-secondary);
}

.pulse-dot-green {
    width: 6px;
    height: 6px;
    background-color: var(--color-success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--color-success);
    animation: pulse 1.5s infinite;
}

.card-value {
    font-family: var(--font-heading);
    /* Adaptive Scaling: min 1.5rem, preferred 2.5vw, max 3rem */
    font-size: clamp(1.5rem, 2.5vw, 3rem);
    font-weight: 300;
    margin-top: 0.5rem;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
    line-height: 1.1;
    white-space: nowrap;
    /* Prevent "NOMINAL" from wrapping */
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-value .unit {
    /* Scale unit relative to the main number */
    font-size: clamp(0.75rem, 1vw, 1.25rem);
    color: var(--text-secondary);
    margin-left: 4px;
    text-shadow: none;
}

.chart-container {
    display: flex;
    flex-direction: column;
    min-height: 350px;
}

.chart-wrapper {
    flex: 1;
    position: relative;
    min-height: 0;
}

.panel-header h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

.chart-legend {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.legend-item .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}

.terminal-log {
    background: #020202;
    border: 1px solid rgba(0, 255, 204, 0.3);
    box-shadow: inset 0 0 20px rgba(0, 255, 204, 0.05);
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    /* ROLL DOWN FIX */
    min-height: 150px;
    height: 100%;
}

.terminal-log::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    box-shadow: inset 0 0 30px #000;
}

.log-entry {
    color: var(--text-secondary);
    line-height: 1.4;
    text-shadow: 0 0 2px rgba(140, 158, 255, 0.3);
    z-index: 1;
}

.log-entry .timestamp {
    color: var(--text-muted);
    margin-right: 0.5rem;
}

.log-entry.system {
    color: var(--color-brand);
    text-shadow: 0 0 5px var(--color-brand-glow);
}

.log-entry.block {
    color: var(--color-danger);
    text-shadow: 0 0 5px var(--color-danger-glow);
}

.log-entry.allow {
    color: var(--color-success);
    text-shadow: 0 0 5px var(--color-brand-glow);
}

.log-entry.pulse {
    animation: flashTextBlock 1s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes flashTextBlock {
    0% {
        background: var(--color-danger);
        color: #fff;
        text-shadow: none;
        padding: 0 4px;
    }

    100% {
        background: transparent;
        padding: 0;
    }
}

/* Tables */
.table-container {
    overflow-y: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.data-table th {
    text-align: left;
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--text-secondary);
    font-weight: normal;
    text-transform: uppercase;
}

.data-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.badge {
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    color: white;
    font-weight: bold;
}

/* Views */
.view-container {
    display: none;
    width: 100vw;
    height: 100vh;
    position: relative;
    z-index: 10;
}

.view-container.active-view {
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-modal-container {
    width: 100%;
    max-width: 450px;
    z-index: 100;
}

/* Modals */
.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-box {
    padding: 2rem;
    width: 400px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.5rem;
}

/* ── Auth Tab System ── */
.auth-tab-btn {
    letter-spacing: 0.1em;
    font-family: var(--font-heading);
}

.auth-tab-btn.active {
    box-shadow: inset 0 0 10px rgba(139, 92, 246, 0.2);
}

.auth-tab-btn:hover:not(.active) {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

.error-text {
    color: var(--color-danger);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-align: center;
    margin-top: 15px;
    height: 1.2rem;
    text-shadow: 0 0 5px var(--color-danger-glow);
}

.success-text {
    color: var(--color-success);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-align: center;
    margin-top: 15px;
    height: 1.2rem;
    text-shadow: 0 0 5px var(--color-brand-glow);
}

.highlight {
    color: var(--color-brand);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
}

.error-text {
    color: var(--color-danger);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-align: center;
    margin-top: 10px;
}

.key-box {
    background: #000;
    padding: 10px;
    border: 1px solid var(--color-border);
    color: var(--color-brand);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    overflow-x: auto;
}

/* Progress */
.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--color-brand);
    transition: width 0.4s ease;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.5);
        opacity: 0.5;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes flashText {
    0% {
        color: white;
        background: var(--color-brand);
    }

    100% {}
}

/* --- GLOBAL BUTTON SYSTEM --- */
/*
 * `all: unset` nukes cursor inheritance, so we re-declare it explicitly.
 * `position: relative` is mandatory here — the shimmer ::before pseudo-element
 * uses position:absolute and needs a positioned ancestor to anchor to.
 */
button,
.btn {
    all: unset;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer !important;
    /* Explicit: all:unset resets cursor to default, force pointer back */
    border: 1px solid var(--color-border);
    transition: border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        background 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    position: relative;
    /* Required anchor for the shimmer ::before pseudo-element */
    overflow: hidden;
}

button:hover,
.btn:hover {
    border-color: var(--color-brand);
    color: var(--color-brand);
    box-shadow: inset 0 0 10px rgba(0, 255, 204, 0.1), 0 0 15px rgba(0, 255, 204, 0.2);
    cursor: pointer !important;
}

button:active,
.btn:active {
    background: var(--color-brand);
    color: var(--color-bg-deep);
}

/* Toggle Switch */
.toggle-container {
    position: relative;
    width: 60px;
    height: 30px;
}

.beast-toggle {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.beast-toggle:checked {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--critical);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

.beast-toggle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 4px;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.beast-toggle:checked::before {
    left: 34px;
    background: var(--critical);
    box-shadow: 0 0 10px var(--color-danger-glow);
}

/* Badges */
.badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-family: var(--font-mono);
    font-weight: 700;
}

.badge-primary {
    background: rgba(6, 182, 212, 0.1);
    color: var(--color-brand);
    border: 1px solid var(--color-brand);
}

.badge-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Health Status Colors */
.status-healthy {
    color: var(--color-success) !important;
    text-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.status-stale {
    color: var(--color-warning) !important;
    text-shadow: 0 0 8px rgba(234, 179, 8, 0.4);
}

.status-zombie {
    color: var(--color-danger) !important;
    text-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
    animation: simple-glitch 2s infinite;
}

/* Gauge Animation */
.metric-gauge {
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ============ Skeleton Loaders (swarm contract) ============ */
@keyframes sk-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton {
  background-image: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.12) 37%, rgba(255,255,255,0.04) 63%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.4s ease-in-out infinite;
  border-radius: 6px; color: transparent !important; pointer-events: none; user-select: none;
}
.skeleton > * { visibility: hidden !important; }
.skeleton-text   { display: block; height: 0.8em; margin: 0.45em 0; border-radius: 4px; }
.skeleton-line   { display: block; height: 12px;  margin: 10px 0;  border-radius: 4px; }
.skeleton-block  { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; z-index: 5; background-color: rgba(10,12,16,0.6); }
.skeleton-circle { border-radius: 50%; }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* Full-page load guard */
#page-loader { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: var(--bg-base); transition: opacity .45s ease, visibility .45s ease; }
#page-loader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
#page-loader .pl-spinner { width: 46px; height: 46px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.12); border-top-color: var(--brand-accent); animation: pl-spin 0.9s linear infinite; }
@keyframes pl-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #page-loader .pl-spinner { animation: none; } }