/*
 * Active Defense — Operator Console
 * Dark-first cyber/defense theme ported from the example/ reference (oklch tokens): cyan primary, magenta accent,
 * red destructive, JetBrains Mono for data. Hand-authored CSS (no Tailwind/npm) so the Blazor app builds without Node.
 */
:root {
    --background: oklch(0.16 0.025 250);
    --foreground: oklch(0.97 0.01 240);
    --card: oklch(0.20 0.028 250);
    --surface-elevated: oklch(0.23 0.03 250);
    --primary: oklch(0.82 0.16 195);
    --primary-glow: oklch(0.88 0.18 195);
    --accent: oklch(0.70 0.18 320);
    --destructive: oklch(0.65 0.23 25);
    --success: oklch(0.75 0.15 160);
    --warning: oklch(0.78 0.18 60);
    --muted: oklch(0.24 0.025 250);
    --muted-foreground: oklch(0.70 0.02 240);
    --border: oklch(0.30 0.03 250);
    --grid-line: oklch(0.30 0.03 250 / 0.5);
    --radius: 0.625rem;
    --font-mono: "JetBrains Mono", ui-monospace, "Fira Code", Menlo, monospace;
    --font-sans: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    --shadow-glow: 0 0 40px -10px oklch(0.82 0.16 195 / 0.45);
    --shadow-card: 0 4px 20px -4px oklch(0.05 0.02 250 / 0.5);
    --gradient-text: linear-gradient(135deg, var(--primary-glow), var(--accent));
    --gradient-hero: radial-gradient(ellipse at top, oklch(0.30 0.10 200 / 0.35), transparent 60%);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--background);
    color: var(--foreground);
    font-family: var(--font-sans);
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em; margin: 0; }
code, .mono { font-family: var(--font-mono); }

.boot {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    color: var(--muted-foreground);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background: var(--gradient-hero), var(--background);
}
.boot-dot, .live-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 12px 2px var(--primary-glow);
    animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
    background: linear-gradient(180deg, var(--card), var(--background));
    border-right: 1px solid var(--border);
    padding: 1.4rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand { display: flex; align-items: center; gap: 0.6rem; padding: 0 0.4rem; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--gradient-text);
    display: grid; place-items: center;
    color: oklch(0.16 0.04 250); font-weight: 800; font-family: var(--font-mono);
    box-shadow: var(--shadow-glow);
}
.brand-name { font-weight: 700; font-size: 0.98rem; }
.brand-sub { font-size: 0.68rem; color: var(--muted-foreground); font-family: var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 0.15rem; }
.nav-section { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted-foreground); padding: 0.8rem 0.6rem 0.3rem; }
.nav a {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.55rem 0.7rem; border-radius: var(--radius);
    color: var(--muted-foreground); font-size: 0.9rem; font-weight: 500;
    transition: all 0.18s ease;
}
.nav a:hover { background: var(--muted); color: var(--foreground); }
.nav a.active { background: oklch(0.82 0.16 195 / 0.14); color: var(--primary-glow); box-shadow: inset 2px 0 0 var(--primary); }
.nav a .ico { font-size: 1rem; width: 1.1rem; text-align: center; }

.sidebar-footer { margin-top: auto; font-size: 0.7rem; color: var(--muted-foreground); font-family: var(--font-mono); }

/* ---------- Main ---------- */
.main { padding: 1.8rem 2.2rem; max-width: 1200px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 1.6rem; gap: 1rem; }
.page-head h1 { font-size: 1.55rem; }
.page-head .sub { color: var(--muted-foreground); font-size: 0.9rem; margin-top: 0.3rem; }
.eyebrow { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--primary); margin-bottom: 0.35rem; }

/* ---------- Cards & grids ---------- */
.grid { display: grid; gap: 1rem; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1000px) { .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr 1fr; } }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    box-shadow: var(--shadow-card);
}
.card.pad-lg { padding: 1.5rem; }

.stat .label { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-foreground); font-family: var(--font-mono); }
.stat .value { font-size: 2rem; font-weight: 700; margin-top: 0.4rem; font-family: var(--font-mono); }
.stat .value.accent { color: var(--primary-glow); }
.stat .value.danger { color: var(--destructive); }
.stat .delta { font-size: 0.78rem; color: var(--success); margin-top: 0.3rem; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.2rem 0.55rem; border-radius: 999px;
    font-size: 0.72rem; font-weight: 600; font-family: var(--font-mono);
    border: 1px solid var(--border);
}
.badge.waiting { color: var(--warning); border-color: oklch(0.78 0.18 60 / 0.4); background: oklch(0.78 0.18 60 / 0.12); }
.badge.active { color: var(--success); border-color: oklch(0.75 0.15 160 / 0.4); background: oklch(0.75 0.15 160 / 0.12); }
.badge.wallet { color: var(--primary-glow); border-color: oklch(0.82 0.16 195 / 0.4); background: oklch(0.82 0.16 195 / 0.12); }
.badge.url, .badge.email, .badge.bankdrop { color: var(--accent); border-color: oklch(0.70 0.18 320 / 0.4); background: oklch(0.70 0.18 320 / 0.12); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-foreground); padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); font-family: var(--font-mono); }
.table td { padding: 0.7rem 0.8rem; border-bottom: 1px solid oklch(0.30 0.03 250 / 0.4); font-size: 0.88rem; }
.table tr:hover td { background: oklch(0.82 0.16 195 / 0.04); }
.table .mono { font-family: var(--font-mono); font-size: 0.82rem; }

/* ---------- Buttons & inputs ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 0.45rem;
    padding: 0.5rem 0.95rem; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--surface-elevated); color: var(--foreground);
    font-size: 0.86rem; font-weight: 600; cursor: pointer; font-family: var(--font-sans);
    transition: all 0.18s ease;
}
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--gradient-text); color: oklch(0.16 0.04 250); border: none; box-shadow: var(--shadow-glow); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }

.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.9rem; }
.field label { font-size: 0.78rem; color: var(--muted-foreground); font-family: var(--font-mono); }
.input {
    background: var(--background); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 0.55rem 0.7rem; color: var(--foreground); font-size: 0.9rem; font-family: var(--font-mono);
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px oklch(0.82 0.16 195 / 0.15); }

.row { display: flex; gap: 0.7rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.muted { color: var(--muted-foreground); }
.mt { margin-top: 1.2rem; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted-foreground); }
.key-pill { font-family: var(--font-mono); font-size: 0.8rem; background: var(--background); border: 1px dashed var(--primary); border-radius: var(--radius); padding: 0.35rem 0.6rem; color: var(--primary-glow); word-break: break-all; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; gap: 0.7rem; }
.bubble { max-width: 78%; padding: 0.65rem 0.85rem; border-radius: 12px; font-size: 0.9rem; line-height: 1.45; }
.bubble.incoming { align-self: flex-start; background: var(--muted); border-bottom-left-radius: 3px; }
.bubble.outgoing { align-self: flex-end; background: oklch(0.82 0.16 195 / 0.14); border: 1px solid oklch(0.82 0.16 195 / 0.3); border-bottom-right-radius: 3px; }
.bubble .meta { font-size: 0.66rem; color: var(--muted-foreground); font-family: var(--font-mono); margin-top: 0.35rem; }

#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--destructive); color: white; padding: 0.7rem 1.2rem; font-size: 0.85rem; z-index: 1000;
}
#blazor-error-ui .reload, #blazor-error-ui .dismiss { color: white; margin-left: 0.8rem; cursor: pointer; text-decoration: underline; }
