/* ============================================================
   THE BORG · Shared Design System v4
   ============================================================ */

:root {
  --bg-black: #000000;
  --bg-deep: #050816;
  --bg-panel: rgba(12, 18, 48, 0.75);
  --bg-elevated: rgba(20, 28, 68, 0.9);
  --border-faint: rgba(0, 229, 255, 0.25);
  --border-base: rgba(0, 229, 255, 0.55);
  --border-strong: #00E5FF;
  --neon-blue: #00E5FF;
  --neon-cyan: #5FF7FF;
  --neon-magenta: #FF4D8F;
  --neon-amber: #FFC940;
  --neon-green: #00FF9C;
  --neon-purple: #B57EFF;
  --text-bright: #FFFFFF;
  --text-primary: #E8EFFF;
  --text-secondary: #C8D2F0;
  --text-label: #9BA8D8;
  --text-data: #00E5FF;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { background: var(--bg-black); color: var(--text-primary); font-family: 'Inter', system-ui, sans-serif; min-height: 100vh; position: relative; font-size: 15px; line-height: 1.5; }

body::before {
  content: ''; position: fixed; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 92'><path d='M40 0 L80 23 L80 69 L40 92 L0 69 L0 23 Z' fill='none' stroke='rgba(0,229,255,0.08)' stroke-width='1'/></svg>");
  background-size: 80px 92px; pointer-events: none; z-index: 0;
}
body::after {
  content: ''; position: fixed; inset: 0;
  background: radial-gradient(ellipse at top, rgba(0, 229, 255, 0.12) 0%, transparent 55%), radial-gradient(ellipse at bottom right, rgba(255, 77, 143, 0.06) 0%, transparent 50%);
  pointer-events: none; z-index: 1;
}

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes spin-rev { from { transform: rotate(360deg); } to { transform: rotate(0deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(0.7); } }
@keyframes scanline { 0% { transform: translateY(-100%); } 100% { transform: translateY(100vh); } }
@keyframes dash-flow { to { stroke-dashoffset: -22; } }
@keyframes glow-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.scanline { position: fixed; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--neon-blue), transparent); opacity: 0.3; animation: scanline 9s linear infinite; pointer-events: none; z-index: 999; box-shadow: 0 0 12px var(--neon-blue); }

.app { position: relative; z-index: 2; display: grid; grid-template-rows: 80px 1fr; grid-template-columns: 240px 1fr; min-height: 100vh; }
.app.with-ticker { grid-template-rows: 80px 1fr 96px; }

/* ===== TOP BAR ===== */
.top-bar { grid-column: 1 / -1; background: rgba(5, 8, 22, 0.92); backdrop-filter: blur(24px); border-bottom: 1px solid var(--border-base); display: flex; align-items: center; justify-content: space-between; padding: 0 32px; position: relative; z-index: 10; }
.top-bar::after { content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--neon-blue), transparent); box-shadow: 0 0 16px var(--neon-blue); }

.brand { display: flex; align-items: center; gap: 20px; }
.brand-core { width: 56px; height: 56px; position: relative; }
.brand-core svg { width: 100%; height: 100%; }
.brand-ring-outer { animation: spin 20s linear infinite; transform-origin: center; }
.brand-ring-inner { animation: spin-rev 14s linear infinite; transform-origin: center; }
.brand-text { font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: 22px; letter-spacing: 5px; color: var(--neon-blue); text-shadow: 0 0 16px rgba(0, 229, 255, 0.7); }
.brand-sub { font-family: 'JetBrains Mono', monospace; font-size: 12px; letter-spacing: 2.5px; color: var(--text-label); margin-top: 4px; text-transform: uppercase; font-weight: 500; }

.status-pills { display: flex; gap: 14px; align-items: center; }
.status-pill { display: flex; gap: 10px; align-items: center; font-family: 'JetBrains Mono', monospace; font-size: 13px; padding: 8px 16px; border: 1px solid var(--border-faint); background: rgba(0, 229, 255, 0.04); border-radius: 24px; }
.status-pill-label { color: var(--text-label); text-transform: uppercase; font-weight: 500; letter-spacing: 1px; }
.status-pill-val { color: var(--neon-blue); font-weight: 700; text-shadow: 0 0 8px rgba(0, 229, 255, 0.6); }
.status-pill-val.good { color: var(--neon-green); text-shadow: 0 0 8px rgba(0, 255, 156, 0.6); }
.status-pill-val.warn { color: var(--neon-amber); text-shadow: 0 0 8px rgba(255, 201, 64, 0.6); }
.status-pill-val.danger { color: var(--neon-magenta); text-shadow: 0 0 8px rgba(255, 77, 143, 0.6); }
.pulse-dot { width: 10px; height: 10px; background: var(--neon-green); border-radius: 50%; box-shadow: 0 0 12px var(--neon-green); animation: pulse 2s ease-in-out infinite; }
.timestamp { font-family: 'JetBrains Mono', monospace; font-size: 14px; color: var(--text-secondary); letter-spacing: 2px; font-weight: 500; }

/* ===== LEFT NAV ===== */
.side-nav { background: rgba(5, 8, 22, 0.85); border-right: 1px solid var(--border-base); padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; backdrop-filter: blur(20px); overflow-y: auto; max-height: calc(100vh - 80px); }
.side-nav::-webkit-scrollbar { width: 4px; }
.side-nav::-webkit-scrollbar-thumb { background: var(--border-base); border-radius: 2px; }
.nav-section-label { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 2px; color: var(--text-label); text-transform: uppercase; padding: 8px 12px; margin-top: 12px; font-weight: 500; }
.nav-section-label:first-child { margin-top: 0; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; border: 1px solid transparent; position: relative; transition: all 0.2s; color: var(--text-secondary); border-radius: 8px; text-decoration: none; }
.nav-item:hover { border-color: var(--border-base); background: rgba(0, 229, 255, 0.08); color: var(--text-bright); }
.nav-item.active { border-color: var(--neon-blue); background: rgba(0, 229, 255, 0.15); color: var(--neon-blue); box-shadow: 0 0 16px rgba(0, 229, 255, 0.3), inset 0 0 12px rgba(0, 229, 255, 0.1); }
.nav-item.active::before { content: ''; position: absolute; left: -1px; top: 6px; bottom: 6px; width: 3px; background: var(--neon-blue); box-shadow: 0 0 8px var(--neon-blue); border-radius: 2px; }
.nav-icon-circle { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center; flex-shrink: 0; }
.nav-icon-circle svg { width: 17px; height: 17px; color: currentColor; }
.nav-item.active .nav-icon-circle { box-shadow: 0 0 10px rgba(0, 229, 255, 0.5); background: rgba(0, 229, 255, 0.1); }
.nav-text { font-family: 'Orbitron', sans-serif; font-size: 13px; font-weight: 500; letter-spacing: 2px; text-transform: uppercase; }
.nav-count { margin-left: auto; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--neon-blue); font-weight: 700; }
.nav-item:not(.active) .nav-count { color: var(--text-label); }
.nav-count.alert { color: var(--neon-magenta) !important; text-shadow: 0 0 6px rgba(255, 77, 143, 0.6); }
.nav-count.warn { color: var(--neon-amber) !important; text-shadow: 0 0 6px rgba(255, 201, 64, 0.6); }
.nav-divider { height: 1px; background: var(--border-faint); margin: 12px 8px; }

/* ===== MAIN ===== */
.main { padding: 24px 28px; overflow-y: auto; max-height: calc(100vh - 80px); }
.main.with-ticker { max-height: calc(100vh - 176px); }

/* PAGE HEADER */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--border-base); position: relative; }
.page-header::after { content: ''; position: absolute; bottom: -1px; left: 0; width: 140px; height: 2px; background: var(--neon-blue); box-shadow: 0 0 12px var(--neon-blue); }
.page-title { font-family: 'Orbitron', sans-serif; font-size: 28px; font-weight: 900; letter-spacing: 6px; color: var(--neon-blue); text-shadow: 0 0 18px rgba(0, 229, 255, 0.6); text-transform: uppercase; }
.page-subtitle { font-family: 'Inter', sans-serif; font-size: 14px; color: var(--text-secondary); margin-top: 6px; font-weight: 500; }

/* BREADCRUMBS */
.breadcrumbs { display: flex; align-items: center; gap: 8px; font-family: 'JetBrains Mono', monospace; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-label); margin-bottom: 8px; font-weight: 500; }
.breadcrumbs a { color: var(--text-label); text-decoration: none; cursor: pointer; transition: color 0.15s; }
.breadcrumbs a:hover { color: var(--neon-blue); text-shadow: 0 0 6px rgba(0, 229, 255, 0.5); }
.breadcrumbs .crumb-current { color: var(--neon-blue); font-weight: 700; text-shadow: 0 0 6px rgba(0, 229, 255, 0.5); }
.breadcrumbs .crumb-sep { color: var(--text-label); opacity: 0.6; }

/* INSTRUCTIONS */
.instructions { background: rgba(0, 229, 255, 0.06); border-left: 4px solid var(--neon-blue); padding: 16px 22px; margin-bottom: 24px; display: flex; gap: 18px; align-items: center; border-radius: 0 12px 12px 0; }
.instructions-icon { width: 32px; height: 32px; flex-shrink: 0; color: var(--neon-blue); filter: drop-shadow(0 0 8px var(--neon-blue)); }
.instructions-text { font-family: 'Inter', sans-serif; font-size: 14px; color: var(--text-primary); line-height: 1.6; }
.instructions-text strong { color: var(--neon-blue); font-weight: 700; }

/* PANELS */
.panel { background: var(--bg-panel); border: 1px solid var(--border-base); border-radius: 18px; position: relative; backdrop-filter: blur(12px); box-shadow: 0 0 28px rgba(0, 229, 255, 0.08); }
.panel.corner-tl::before { content: ''; position: absolute; top: -1px; left: -1px; width: 14px; height: 14px; border-top: 2px solid var(--neon-blue); border-left: 2px solid var(--neon-blue); border-top-left-radius: 18px; box-shadow: 0 0 6px rgba(0, 229, 255, 0.4); }
.panel.corner-br::after { content: ''; position: absolute; bottom: -1px; right: -1px; width: 14px; height: 14px; border-bottom: 2px solid var(--neon-blue); border-right: 2px solid var(--neon-blue); border-bottom-right-radius: 18px; box-shadow: 0 0 6px rgba(0, 229, 255, 0.4); }
.panel-header { padding: 16px 22px; border-bottom: 1px solid var(--border-base); display: flex; align-items: center; justify-content: space-between; position: relative; }
.panel-title { font-family: 'Orbitron', sans-serif; font-size: 14px; font-weight: 700; letter-spacing: 3px; color: var(--neon-blue); text-transform: uppercase; text-shadow: 0 0 8px rgba(0, 229, 255, 0.5); }
.panel-meta { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-label); letter-spacing: 1.5px; text-transform: uppercase; font-weight: 500; }
.panel-body { padding: 22px; }

/* CIRCULAR GAUGE COMPONENT */
.gauge-card { background: var(--bg-panel); border: 1px solid var(--border-faint); border-radius: 16px; padding: 16px 18px; display: flex; align-items: center; gap: 14px; position: relative; backdrop-filter: blur(8px); }
.gauge-card::before { content: ''; position: absolute; top: -1px; left: -1px; width: 12px; height: 12px; border-top: 2px solid var(--neon-blue); border-left: 2px solid var(--neon-blue); border-top-left-radius: 14px; }
.gauge-ring { width: 72px; height: 72px; position: relative; flex-shrink: 0; }
.gauge-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge-bg { stroke: rgba(0, 229, 255, 0.18); fill: none; }
.gauge-progress { fill: none; stroke-linecap: round; }
.gauge-progress.blue { stroke: var(--neon-blue); filter: drop-shadow(0 0 6px var(--neon-blue)); }
.gauge-progress.green { stroke: var(--neon-green); filter: drop-shadow(0 0 6px var(--neon-green)); }
.gauge-progress.amber { stroke: var(--neon-amber); filter: drop-shadow(0 0 6px var(--neon-amber)); }
.gauge-progress.magenta { stroke: var(--neon-magenta); filter: drop-shadow(0 0 6px var(--neon-magenta)); }
.gauge-progress.dim { stroke: var(--text-label); }
.gauge-center { position: absolute; inset: 0; display: grid; place-items: center; }
.gauge-num { font-family: 'Orbitron', sans-serif; font-size: 18px; font-weight: 900; color: var(--neon-blue); text-shadow: 0 0 8px rgba(0, 229, 255, 0.6); line-height: 1; }
.gauge-num.green { color: var(--neon-green); text-shadow: 0 0 8px rgba(0, 255, 156, 0.6); }
.gauge-num.amber { color: var(--neon-amber); text-shadow: 0 0 8px rgba(255, 201, 64, 0.6); }
.gauge-num.magenta { color: var(--neon-magenta); text-shadow: 0 0 8px rgba(255, 77, 143, 0.6); }
.gauge-num.dim { color: var(--text-label); text-shadow: none; }
.gauge-info { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.gauge-label { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 1.5px; color: var(--text-label); text-transform: uppercase; font-weight: 500; }
.gauge-desc { font-family: 'Inter', sans-serif; font-size: 13px; color: var(--text-primary); font-weight: 500; line-height: 1.4; }

/* STATUS PILL */
.status-tag { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 1.5px; font-weight: 700; text-transform: uppercase; border-radius: 16px; width: fit-content; }
.status-tag.live { background: var(--neon-green); color: var(--bg-black); box-shadow: 0 0 12px rgba(0, 255, 156, 0.6); }
.status-tag.op { background: var(--neon-blue); color: var(--bg-black); box-shadow: 0 0 12px rgba(0, 229, 255, 0.5); }
.status-tag.trigger { background: var(--neon-amber); color: var(--bg-black); }
.status-tag.pending { background: transparent; color: var(--text-label); border: 1px solid var(--text-label); }
.status-tag.idle { background: rgba(155, 168, 216, 0.2); color: var(--text-secondary); border: 1px solid var(--text-label); }
.status-tag.active { background: var(--neon-green); color: var(--bg-black); box-shadow: 0 0 12px rgba(0, 255, 156, 0.5); }
.status-tag.thinking { background: var(--neon-purple); color: var(--bg-black); box-shadow: 0 0 12px rgba(181, 126, 255, 0.5); }
.status-pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-tag.live .status-pill-dot, .status-tag.active .status-pill-dot, .status-tag.thinking .status-pill-dot { background: var(--bg-black); animation: glow-pulse 1.5s ease-in-out infinite; }

/* BUTTON */
.btn { padding: 12px 20px; background: transparent; border: 2px solid var(--border-base); border-radius: 10px; color: var(--text-bright); font-family: 'Orbitron', sans-serif; font-size: 13px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; cursor: pointer; transition: all 0.25s; display: inline-flex; align-items: center; gap: 10px; }
.btn:hover { background: rgba(0, 229, 255, 0.1); box-shadow: 0 0 20px rgba(0, 229, 255, 0.4); }
.btn-act { border-color: var(--neon-green); color: var(--neon-green); }
.btn-act:hover { background: rgba(0, 255, 156, 0.15); box-shadow: 0 0 24px rgba(0, 255, 156, 0.5); }
.btn-defer { border-color: var(--neon-amber); color: var(--neon-amber); }
.btn-defer:hover { background: rgba(255, 201, 64, 0.15); box-shadow: 0 0 24px rgba(255, 201, 64, 0.5); }
.btn-kill { border-color: var(--neon-magenta); color: var(--neon-magenta); }
.btn-kill:hover { background: rgba(255, 77, 143, 0.15); box-shadow: 0 0 24px rgba(255, 77, 143, 0.5); }
.btn-dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
