:root {
  /* ARES AI DESIGN SYSTEM - Mission Control Aesthetics */
  --bg-core: #09090b;
  --bg-card: rgba(17, 17, 19, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --primary: #3b82f6; /* Tactical Blue */
  --secondary: #8b5cf6; /* Neural Purple */
  --success: #10b981; /* Metric Stable */
  --warning: #f59e0b; /* Anomaly Warning */
  --danger: #ef4444; /* Breach Threat */
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --panel-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
  --font-main: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --sidebar-width: clamp(220px, 18vw, 320px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-core);
  color: var(--text);
  font-family: var(--font-main);
  min-height: 100vh;
  overflow: hidden; /* Main container handles scroll */
}

/* Luxury Biometric Overlay */


/* --- AUTH UI --- */
#login-container {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--bg-core);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 400px;
  padding: 3rem;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: var(--panel-shadow);
  text-align: center;
}

.input-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

input, select, textarea {
    width: 100%;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    font-family: var(--font-main);
    transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

select option {
    background: #111;
    color: white;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

.btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.3);
}

.btn-secondary { background: var(--secondary); }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); }

/* --- MAIN LAYOUT --- */
#dashboard-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.top-banner {
  height: 60px;
  background: rgba(10, 10, 12, 0.95);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  z-index: 200;
}

.app-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  background: 
    linear-gradient(rgba(10, 10, 12, 0.9), rgba(10, 10, 12, 0.98));
  border-right: 1px solid var(--glass-border);
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  z-index: 100;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-x: hidden;
  white-space: nowrap;
}

.sidebar.collapsed {
  width: 70px;
  padding: 2rem 0;
  align-items: center;
}

.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed #user-profile div:last-child,
.sidebar.collapsed .ai-hud {
  display: none;
}

.sidebar.collapsed .nav-item {
  padding: 0.8rem;
  justify-content: center;
  width: 45px;
}

.sidebar.collapsed .brand {
  justify-content: center;
  gap: 0;
}

.sidebar.collapsed #user-profile {
  justify-content: center;
  padding: 0.5rem 0;
}

.brand {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand span { color: var(--primary); }

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.5rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.2s;
}

.nav-item:hover, .nav-item.active {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.nav-item.active {
  color: var(--primary);
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 1rem 0 0.2rem 0.8rem;
    opacity: 0.7;
}

.nav-section-label:first-of-type {
    margin-top: 0;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
}

header {
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.glass {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
}

/* --- MACHINE VIEW --- */
.machine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
  gap: 2rem;
}

.machine-card {
  padding: 1.5rem;
  transition: 0.3s;
}

.machine-card:hover { border-color: rgba(59, 130, 246, 0.4); }

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-online { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-offline { background: var(--danger); }

.metric-mini {
  background: rgba(0, 0, 0, 0.4);
  padding: 0.6rem;
  border-radius: 8px;
  text-align: center;
}

.metric-mini span:first-child { font-size: 0.6rem; color: var(--text-muted); display: block; text-transform: uppercase; }
.metric-mini span:last-child { font-size: 1rem; font-weight: 700; font-family: var(--font-mono); }

/* --- DATA TABLES --- */
.table-container {
  overflow-x: auto;
  margin-top: 1rem;
  width: 100%;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  table-layout: auto !important;
}

th {
  text-align: left;
  padding: 0.45rem 0.6rem !important;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--glass-border);
  position: relative;
  cursor: pointer;
  line-height: 1.25 !important;
  vertical-align: middle !important;
  user-select: none;
  transition: color 0.15s ease, background-color 0.15s ease;
  box-sizing: border-box;
}

th:hover {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.04);
}

tr {
  height: auto !important;
}

tbody tr:hover, tbody tr.clickable-row:hover {
  background: rgba(139, 92, 246, 0.12) !important;
  cursor: pointer;
}

td {
  padding: 0.45rem 0.6rem !important;
  border-top: 1px solid var(--glass-border);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  vertical-align: middle !important;
  line-height: 1.3 !important;
  font-size: 0.8rem !important;
  box-sizing: border-box;
}

/* Universal Log Trail Payload Wrapping */
td.payload-cell, .td-payload {
  white-space: pre-wrap !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  max-width: none !important;
  line-height: 1.4 !important;
  vertical-align: middle !important;
}

/* High-Visibility Vibrant Pagination Buttons */
.btn-pagination {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%) !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  font-size: 0.8rem !important;
  padding: 0.5rem 1.4rem !important;
  border-radius: 8px !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.35) !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.btn-pagination:hover:not(:disabled) {
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 18px rgba(139, 92, 246, 0.55) !important;
  filter: brightness(1.15) !important;
}

.btn-pagination:disabled {
  background: rgba(255, 255, 255, 0.08) !important;
  color: rgba(255, 255, 255, 0.35) !important;
  border-color: rgba(255, 255, 255, 0.05) !important;
  box-shadow: none !important;
  cursor: not-allowed !important;
  opacity: 0.45 !important;
}

.resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 7px;
  cursor: col-resize;
  user-select: none;
  height: 100%;
  z-index: 10;
  transition: background-color 0.15s ease;
}

.resizer:hover, .resizing .resizer {
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
}

.dragging { opacity: 0.5; background: rgba(59, 130, 246, 0.1); }
.drag-over { border-left: 2px solid var(--primary) !important; }

.badge {
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-info { background: rgba(59, 130, 246, 0.2); color: var(--primary); }
.badge-warn { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge-crit { background: rgba(239, 68, 68, 0.2); color: var(--danger); box-shadow: 0 0 10px rgba(239, 68, 68, 0.3); }

/* --- MODALS --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 2.5rem;
  overflow-y: auto;
  position: relative;
}

.close-modal {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

/* --- LOGS --- */
.log-stream {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.4;
  height: 400px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.5);
  padding: 1rem;
  border-radius: 12px;
}

.log-entry { margin-bottom: 0.4rem; padding: 0.2rem 0; border-bottom: 1px solid rgba(255, 255, 255, 0.02); }
.log-ts { color: var(--primary); margin-right: 0.8rem; }
.log-src { color: var(--secondary); margin-right: 0.8rem; font-weight: 700; }

.hidden { display: none !important; }

/* AI HUD */
.ai-hud {
  width: 100%;
}

.ai-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.ai-pulse {
    width: 12px;
    height: 12px;
    background: var(--secondary);
    border-radius: 50%;
    box-shadow: 0 0 15px var(--secondary);
    animation: brain-throb 3s infinite;
}

@keyframes brain-throb {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.4); opacity: 0.4; }
    100% { transform: scale(1); opacity: 0.8; }
}

.ai-thought {
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.5;
  padding: 1.5rem;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 16px;
  position: relative;
}

.ai-thought:after {
  display: none;
}

/* User Submenu Styles */
.user-submenu-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--primary);
}

.modal-overlay {
    backdrop-filter: blur(8px);
}

.modal {
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    position: relative;
}

/* --- SYSTEM STATUS ANIMATIONS --- */
@keyframes pulse-status {
  0% { transform: scale(1); box-shadow: 0 0 5px currentColor; }
  50% { transform: scale(1.3); box-shadow: 0 0 15px currentColor; }
  100% { transform: scale(1); box-shadow: 0 0 5px currentColor; }
}

/* =====================================================================
   Design system (1.6.0). One look for every section: page head, toolbar
   (search, count, export), cards, tables, buttons, badges and forms.
   These rules come last on purpose: they override the older ones above.
   ===================================================================== */
:root {
  --primary: #2f9cf6;
  --secondary: #9b5cff;
  --bg-core: #0b0d18;
  --bg-card: rgba(20, 23, 45, 0.72);
  --bg-sunken: rgba(5, 6, 14, 0.55);
  --glass-border: rgba(150, 170, 255, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-width: 248px;
}

body { background: radial-gradient(1200px 700px at 70% -10%, rgba(47, 156, 246, 0.08), transparent 60%), var(--bg-core); }

/* --- Icons (inline SVG sprite in index.html) --- */
.ico { width: 18px; height: 18px; flex: 0 0 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* --- Top bar --- */
.top-banner { height: 56px; padding: 0 1.25rem; gap: 1rem; justify-content: space-between; background: rgba(9, 11, 22, 0.92); }
.topbar-brand { display: flex; align-items: center; gap: 0.7rem; font-weight: 800; font-size: 1.05rem; letter-spacing: -0.3px; white-space: nowrap; }
.topbar-brand img { width: 28px; height: 28px; }
.topbar-brand .accent { background: linear-gradient(90deg, var(--primary), var(--secondary)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar-crumb { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; }
.topbar-crumb b { color: var(--text); font-weight: 600; }
.topbar-status { display: flex; align-items: center; gap: 0.6rem; min-width: 0; max-width: 55%; }
.topbar-status .label { font-size: 0.65rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--secondary); white-space: nowrap; }
#ai-response { font-size: 0.75rem; color: var(--text-muted); padding: 0.35rem 0.75rem; border-radius: 999px; border: 1px solid var(--glass-border); background: var(--bg-sunken); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* --- Sidebar --- */
.sidebar { padding: 1rem 0.75rem; gap: 0.75rem; overflow-y: auto; }
.nav-links { display: flex; flex-direction: column; gap: 2px; }
.nav-group { margin-top: 0.9rem; }
.nav-group:first-child { margin-top: 0; }
.nav-section-label { display: flex; align-items: center; justify-content: space-between; font-size: 0.65rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(148, 163, 184, 0.7); padding: 0 0.7rem; margin: 0 0 0.35rem 0; }
.nav-item { display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 0.7rem; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 500; color: #c7cde4; cursor: pointer; border: 1px solid transparent; transition: background 0.15s, color 0.15s; }
.nav-item:hover { background: rgba(255, 255, 255, 0.04); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(47, 156, 246, 0.18), rgba(155, 92, 255, 0.10)); border-color: rgba(47, 156, 246, 0.35); color: #fff; }
.nav-item.active .ico { color: var(--primary); }
.sidebar-toggle { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 0.2rem; border-radius: 6px; display: flex; }
.sidebar-toggle:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.sidebar.collapsed { width: 64px; padding: 1rem 0.5rem; }
.sidebar.collapsed .nav-label, .sidebar.collapsed .nav-section-label span, .sidebar.collapsed .profile-text { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 0.6rem; }
.sidebar-foot { margin-top: auto; padding-top: 0.75rem; border-top: 1px solid var(--glass-border); }
#user-profile { display: flex; align-items: center; gap: 0.7rem; padding: 0.5rem; border-radius: var(--radius-sm); cursor: pointer; position: relative; }
#user-profile:hover { background: rgba(255, 255, 255, 0.04); }
.avatar { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.85rem; background: linear-gradient(135deg, var(--primary), var(--secondary)); }
.profile-text { flex: 1; min-width: 0; }
#curr-user-name { font-size: 0.85rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#curr-user-role { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
#user-submenu { position: absolute; bottom: calc(100% + 8px); left: 0; right: 0; min-width: 220px; padding: 0.4rem; border-radius: var(--radius); z-index: 1000; background: rgba(14, 16, 32, 0.98); border: 1px solid var(--glass-border); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7); }
.user-submenu-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.7rem; border-radius: var(--radius-sm); font-size: 0.8rem; cursor: pointer; }
.user-submenu-item:hover { background: rgba(255, 255, 255, 0.06); }
.user-submenu-item.danger { color: var(--danger); border-top: 1px solid var(--glass-border); margin-top: 0.3rem; }

/* --- Page layout --- */
.main-content { padding: 1.75rem 2rem 3rem; }
.view-content > * + * { margin-top: 1rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin: 0 0 1.25rem 0; }
.page-head h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.4px; margin: 0; color: var(--text); }
.page-head p { font-size: 0.85rem; color: var(--text-muted); margin: 0.3rem 0 0 0; max-width: 72ch; }
.page-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }
.btn-back { display: inline-flex; align-items: center; gap: 0.35rem; margin-bottom: 0.6rem; font-size: 0.75rem; color: var(--text-muted); background: none; border: none; cursor: pointer; padding: 0; text-transform: none; letter-spacing: 0; font-weight: 600; }
.btn-back:hover { color: var(--primary); }
.section-title { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--secondary); margin: 1.5rem 0 0.75rem 0; }
.section-title:first-child { margin-top: 0; }

/* --- Cards --- */
.glass, .card { background: var(--bg-card); border: 1px solid var(--glass-border); border-radius: var(--radius); backdrop-filter: blur(14px); }
.card { padding: 1.25rem; }
.card + .card { margin-top: 1rem; }
.card-ai { border-color: rgba(155, 92, 255, 0.35); background: linear-gradient(180deg, rgba(155, 92, 255, 0.08), rgba(20, 23, 45, 0.72)); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.card-head h2 { font-size: 0.8rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text); display: flex; align-items: center; gap: 0.5rem; }
.ai-output { max-height: 240px; overflow-y: auto; font-size: 0.85rem; color: #cbd5e1; line-height: 1.55; background: var(--bg-sunken); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); padding: 0.9rem; margin-bottom: 0.75rem; }
.ai-ask { display: flex; gap: 0.6rem; align-items: center; }
.ai-ask input { flex: 1; }

/* --- Toolbar: search, filters, count, export --- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; padding: 0.6rem; background: var(--bg-card); border: 1px solid var(--glass-border); border-radius: var(--radius); }
.toolbar .tb-search { position: relative; flex: 1 1 260px; min-width: 200px; }
.toolbar .tb-search .ico { position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 16px; height: 16px; }
.toolbar .tb-search input { padding-left: 2.2rem; }
.toolbar input, .toolbar select { width: auto; padding: 0.5rem 0.7rem; font-size: 0.8rem; border-radius: var(--radius-sm); background: var(--bg-sunken); }
.toolbar .tb-search input { width: 100%; }
.toolbar .tb-count { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; padding: 0 0.3rem; }
.toolbar .tb-spacer { flex: 1 1 0; }
.toolbar .tb-filters { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: flex-end; flex-basis: 100%; padding-top: 0.6rem; border-top: 1px solid var(--glass-border); }
.toolbar .tb-filters .input-group { margin: 0; }
.toolbar .tb-filters label { font-size: 0.62rem; margin-bottom: 0.3rem; }
.toolbar.tb-form .tb-search { flex-basis: 320px; flex-grow: 0; }
.filtered-out { display: none !important; }

/* --- Forms --- */
input, select, textarea { padding: 0.65rem 0.8rem; border-radius: var(--radius-sm); font-size: 0.85rem; background: var(--bg-sunken); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47, 156, 246, 0.18); }
.input-group { margin-bottom: 1rem; }
.input-group label { font-size: 0.66rem; letter-spacing: 0.08em; margin-bottom: 0.35rem; }
.form-grid { display: grid; gap: 1rem; align-items: end; }
.form-actions { display: flex; gap: 0.5rem; justify-content: flex-end; align-items: center; margin-top: 1rem; }
.hint { font-size: 0.75rem; color: var(--text-muted); }
.note { font-size: 0.8rem; color: var(--text-muted); background: var(--bg-sunken); padding: 0.6rem 0.9rem; border-radius: var(--radius-sm); border-left: 3px solid var(--warning); }

/* --- Buttons: one size scale everywhere (also overrides inline sizes set by scripts) --- */
.btn { width: auto; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 0.6rem 1.1rem; border-radius: var(--radius-sm); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; line-height: 1.2; background: linear-gradient(135deg, var(--primary), #4f7cff); }
.btn:hover { transform: none; filter: brightness(1.1); box-shadow: 0 4px 14px rgba(47, 156, 246, 0.25); }
.btn-secondary { background: var(--secondary); }
.btn-outline { background: transparent; border: 1px solid rgba(47, 156, 246, 0.55); color: #8cc8ff; }
.btn-outline:hover { background: rgba(47, 156, 246, 0.1); box-shadow: none; }
.btn-danger { background: var(--danger); border: none; color: #fff; }
.btn-sm, td .btn, .toolbar .btn { padding: 0.4rem 0.75rem !important; font-size: 0.68rem !important; width: auto !important; height: auto !important; }
td .btn + .btn { margin-left: 0.3rem; }
.auth-card .btn { width: 100%; padding: 0.8rem; }

/* --- Tables --- */
.table-container { margin-top: 0; padding: 0; }
.table-container table { font-size: 0.8rem; }
.table-container thead th { background: rgba(255, 255, 255, 0.02); position: sticky; top: 0; z-index: 1; }
.table-container tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.015); }
.table-container td.empty, .table-container td[colspan] { color: var(--text-muted); text-align: center; padding: 2.5rem 1rem !important; white-space: normal; }

/* --- Badges: one shape, colour by meaning --- */
.badge { display: inline-block; padding: 0.2rem 0.55rem; border-radius: 999px; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.04em; line-height: 1.3; border: 1px solid transparent; }
.badge-info { background: rgba(47, 156, 246, 0.14); color: #8cc8ff; border-color: rgba(47, 156, 246, 0.3); }
.badge-warn { background: rgba(245, 158, 11, 0.14); color: #fbbf24; border-color: rgba(245, 158, 11, 0.3); }
.badge-crit, .badge-danger { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); box-shadow: none; }
.badge-success { background: rgba(16, 185, 129, 0.14); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.3); }
.badge-muted { background: rgba(148, 163, 184, 0.12); color: #cbd5e1; border-color: rgba(148, 163, 184, 0.25); }

/* --- Modals --- */
.modal, .modal-content { border-radius: 16px; }
.close-modal { top: 1rem; right: 1rem; font-size: 1.2rem; background: transparent; border: none; color: var(--text-muted); cursor: pointer; position: absolute; }
.close-modal:hover { color: #fff; }

/* --- Sign-in --- */
.auth-card { border-radius: 16px; padding: 2.5rem; }
.auth-sub { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 1.75rem; letter-spacing: 0.08em; text-transform: uppercase; }

/* Log lines wrap, but never into a sliver: automatic table layout would give a cell that may break
   anywhere almost no width. */
td.payload-cell, .td-payload { min-width: 26rem; }

/* ATT&CK detections (1.6.0) */
.badge-attack { background: rgba(155, 92, 255, 0.16); color: #d8c4ff; border: 1px solid rgba(155, 92, 255, 0.4); font-family: var(--font-mono); margin-right: 0.15rem; }
.evidence-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.evidence-list li { font-family: var(--font-mono); font-size: 0.78rem; color: #cbd5e1; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--glass-border); border-radius: 6px; padding: 0.35rem 0.6rem; white-space: pre-wrap; word-break: break-word; }
.detections-summary { display: grid; grid-template-columns: minmax(220px, 280px) 1fr; gap: 1rem; margin-bottom: 1rem; }
.threat-level { border: 1px solid var(--glass-border); border-radius: 12px; padding: 1rem 1.2rem; background: rgba(255, 255, 255, 0.03); }
.threat-level .tl-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); font-weight: 700; }
.threat-level .tl-value { font-size: 1.6rem; font-weight: 800; margin: 0.2rem 0 0.6rem; }
.threat-level .tl-meter { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-bottom: 0.6rem; }
.threat-level .tl-meter span { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); }
.threat-level .tl-note { font-size: 0.72rem; color: var(--text-muted); }
.tl-low { --tl: #22c55e; } .tl-moderate { --tl: #eab308; } .tl-high { --tl: #f97316; } .tl-severe { --tl: #ef4444; } .tl-critical { --tl: #e11d48; }
.threat-level .tl-value { color: var(--tl, #fff); }
.threat-level .tl-meter span.on { background: var(--tl, #22c55e); }
.tactic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0.6rem; }
.tactic { border: 1px solid var(--glass-border); border-radius: 10px; padding: 0.6rem 0.8rem; background: rgba(255, 255, 255, 0.02); }
.tactic.hot { border-color: rgba(239, 68, 68, 0.45); background: rgba(239, 68, 68, 0.06); }
.tactic-name { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.tactic-num { font-size: 1.3rem; font-weight: 800; }
.tactic-sub { font-size: 0.68rem; color: var(--text-muted); }
.hint.wrap { white-space: normal; max-width: 28rem; margin-top: 0.25rem; }
.topbar-threat { display: inline-flex; align-items: center; gap: 0.45rem; margin-left: auto; margin-right: 1rem; padding: 0.3rem 0.75rem; border-radius: 999px; border: 1px solid var(--glass-border); background: rgba(255, 255, 255, 0.04); color: var(--tl, #fff); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase; cursor: pointer; }
.topbar-threat .tl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tl, #22c55e); box-shadow: 0 0 8px var(--tl, #22c55e); }
.topbar-threat.hidden { display: none; }
@media (max-width: 900px) { .detections-summary { grid-template-columns: 1fr; } }
