/* -----------------------------------------------
   CyboWatch — Production CSS
   Wazuh-identical layout & design system
   ----------------------------------------------- */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* -- CSS Variables -- */
:root {
  --bg:       #f8f9fb;
  --bg2:      #ffffff;
  --bg3:      #f0f2f5;
  --bg4:      #e8eaed;
  --border:   #d8dde6;
  --border2:  #b8bec9;
  --text:     #1a2332;
  --muted:    #657898;
  --dim:      #9bacc2;

  --primary:  #f5a623;
  --primary2: #d4891a;
  --accent:   #006bb4;
  --accent2:  #005a96;
  --green:    #00a69b;
  --red:      #bd271e;
  --orange:   #da8b45;
  --yellow:   #d6bf57;
  --pink:     #e7664c;
  --violet:   #9170b8;
  --teal:     #00bfb3;

  --cr: #bd271e;
  --hi: #da8b45;
  --me: #d6bf57;
  --lo: #006bb4;

  --accent-primary: var(--accent, #006bb4);
    --text-primary: var(--text, #1e293b);
    --text-muted: var(--muted, #94a3b8);

  --sidebar-w: 240px;
  --topbar-h:  48px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
  --shadow:    0 2px 4px rgba(0,0,0,.07), 0 1px 3px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.09);
  --shadow-lg: 0 8px 28px rgba(0,0,0,.12);
  --radius:    6px;
  --radius-lg: 8px;
}

/* -- Reset -- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* -- Scrollbar -- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border2); }

/* -- Animations -- */
@keyframes fadeIn   { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:translateY(0); } }
@keyframes blink    { 0%,100% { opacity:1; } 50% { opacity:.3; } }
@keyframes spin     { from { transform:rotate(0deg); } to { transform:rotate(360deg); } }
@keyframes shimmer  { 0% { background-position:-200% 0; } 100% { background-position:200% 0; } }

/* -----------------------------------------------
   LOGIN
   ----------------------------------------------- */
#login {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0d1b2a 0%, #1a2e47 50%, #0d1b2a 100%);
}
.login-bg-grid {
  position: absolute; inset: 0; opacity: .04;
  background-image:
    linear-gradient(#00bfb3 1px, transparent 1px),
    linear-gradient(90deg, #00bfb3 1px, transparent 1px);
  background-size: 40px 40px;
}
.login-box {
  position: relative; z-index: 2;
  width: 400px;
  background: rgba(255,255,255,.97);
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 24px 80px rgba(0,0,0,.5);
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo img {
  height: 52px;
  width: auto;
  object-fit: contain;
}
.login-field { margin-bottom: 16px; }
.login-label {
  display: block;
  font-size: 11px; font-weight: 600;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: .8px;
  margin-bottom: 5px;
}
.login-input {
  width: 100%;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 13px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.login-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,107,180,.12);
  background: #fff;
}
.login-btn {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none; border-radius: var(--radius);
  color: #fff; font-size: 14px; font-weight: 600;
  margin-top: 8px;
  box-shadow: 0 4px 14px rgba(0,107,180,.35);
  transition: opacity .2s, box-shadow .2s;
}
.login-btn:hover { opacity: .9; box-shadow: 0 6px 20px rgba(0,107,180,.45); }
.login-err {
  background: #fdf3f3; border: 1px solid #f5c6c6;
  border-radius: var(--radius); padding: 8px 12px;
  color: var(--red); font-size: 12px;
  margin-bottom: 12px; display: none;
}

.password-wrap {
  position: relative;
}

.password-wrap .login-input {
  padding-right: 65px;
}

.show-pass {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #f5a623;
  user-select: none;
}

/* -----------------------------------------------
   APP SHELL
   ----------------------------------------------- */
#app { display: none; height: 100vh; flex-direction: column; }
#app.show { display: flex; }

/* -- Topbar -- */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 16px; gap: 10px;
  flex-shrink: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.topbar-logo {
  display: flex; align-items: center; gap: 8px;
  margin-right: 6px; flex-shrink: 0;
}
.topbar-logo img { height: 26px; width: auto; }
.topbar-sp { flex: 1; }
.topbar-status {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--muted);
}
.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%; background: var(--green);
  animation: blink 2s infinite;
  flex-shrink: 0;
}
.status-dot.warn { background: var(--orange); animation: none; }
.status-dot.err  { background: var(--red);    animation: none; }

/* Tenant dropdown */
.tenant-wrap { position: relative; }
.tenant-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px 10px;
  font-size: 12px; font-weight: 500; cursor: pointer;
  transition: border-color .15s;
  white-space: nowrap;
}
.tenant-btn:hover { border-color: var(--accent); }
.tenant-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.tenant-caret { width: 10px; height: 10px; color: var(--muted); }
.tenant-drop {
  position: absolute; top: calc(100% + 5px); left: 0;
  min-width: 260px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 4px;
  box-shadow: var(--shadow-md); z-index: 200; display: none;
}
.tenant-drop.open { display: block; animation: fadeIn .15s ease; }
.tenant-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius);
  cursor: pointer; transition: background .1s;
}
.tenant-opt:hover { background: var(--bg3); }
.tenant-opt.sel { background: #e8f0fb; }
.tenant-opt.sel .tenant-opt-name { color: var(--accent); font-weight: 600; }
.tenant-opt-name { font-size: 12px; font-weight: 500; }
.tenant-opt-index { font-size: 10px; color: var(--muted); font-family: 'JetBrains Mono', monospace; }

/* User badge */
.user-badge {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px 10px;
}

#vuln-ev-timeline {
  height: 120px;
  overflow: hidden;   /* ?? prevents spillover */
}
.user-av {
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-name { font-size: 12px; font-weight: 500; }
.topbar-btn {
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px 10px;
  font-size: 11px; color: var(--muted);
  transition: all .15s;
}
.topbar-btn:hover { border-color: var(--red); color: var(--red); }

/* -- Body layout -- */
.app-body { flex: 1; display: flex; overflow: hidden; }

/* -----------------------------------------------
   SIDEBAR  (exact Wazuh style)
   ----------------------------------------------- */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column;
  padding-bottom: 16px;
}

/* Top-level nav items (Overview, Discover) */
.nav-top {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  font-size: 13px; font-weight: 400;
  color: var(--muted);
  cursor: pointer; user-select: none;
  transition: all .12s;
  border-left: 3px solid transparent;
}
.nav-top svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-top:hover { color: var(--text); background: var(--bg3); }
.nav-top.active {
  color: var(--accent); font-weight: 600;
  background: #eaf3fb;
  border-left-color: var(--accent);
}

/* Group header */
.nav-group-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px 5px;
  cursor: pointer; user-select: none;
}
.nav-group-header:hover .nav-group-label { color: var(--text); }
.nav-group-icon {
  width: 20px; height: 20px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.nav-group-icon svg { width: 13px; height: 13px; }
.nav-group-label {
  font-size: 11px; font-weight: 700;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px;
  flex: 1;
}
.nav-group-arrow {
  width: 12px; height: 12px; color: var(--muted);
  transition: transform .2s; flex-shrink: 0;
}
.nav-group-arrow.open { transform: rotate(180deg); }

/* Nav items inside groups */
.nav-items { display: flex; flex-direction: column; padding: 1px 8px 6px; }
.nav-items.collapsed { display: none; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 400;
  color: var(--muted);
  cursor: pointer; user-select: none;
  transition: all .12s;
  position: relative;
}
.nav-item svg { width: 14px; height: 14px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active {
  background: #eaf3fb; color: var(--accent); font-weight: 600;
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; background: var(--accent); border-radius: 0 2px 2px 0;
}
.nav-badge {
  margin-left: auto; font-size: 9px; font-weight: 700;
  padding: 1px 5px; border-radius: 9px;
  background: #fde8e8; color: var(--red);
}

/* -----------------------------------------------
   CONTENT AREA
   ----------------------------------------------- */
.content {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  background: var(--bg);
}
.page { display: none; padding: 20px 24px; }
.page.active { display: block; animation: fadeIn .18s ease; }

/* -- Page header -- */
.page-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 12px;
  margin-bottom: 16px;
}
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -.3px; }
.page-sub { font-size: 11px; color: var(--muted); margin-top: 2px; font-family: 'JetBrains Mono', monospace; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* -- Buttons -- */
.btn-primary {
  background: var(--accent); border: none; border-radius: var(--radius);
  color: #fff; font-size: 12px; font-weight: 600;
  padding: 7px 14px; transition: opacity .15s;
}
.btn-primary:hover { opacity: .88; }
.btn-secondary {
  background: #fff; border: 1.5px solid var(--border);
  border-radius: var(--radius); color: var(--muted);
  font-size: 12px; padding: 6px 13px; transition: all .15s;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* -----------------------------------------------
   FILTER BAR — global time + agent filter
   ----------------------------------------------- */
.filter-bar {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 8px 12px;
  margin-bottom: 16px; flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.filter-label {
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px; white-space: nowrap;
}
.filter-sep { width: 1px; height: 18px; background: var(--border); }
.filter-select, .filter-search {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 5px 9px;
  font-size: 12px; color: var(--text); outline: none;
  transition: border-color .15s;
  -webkit-appearance: none; appearance: none;
}
.filter-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' fill='%23657898' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
  padding-right: 28px; cursor: pointer;
}
.filter-select:focus, .filter-search:focus {
  border-color: var(--accent); background: #fff;
}
.filter-search { flex: 1; min-width: 200px; }
.filter-search::placeholder { color: var(--dim); }
.filter-btn {
  background: var(--accent); border: none; border-radius: var(--radius);
  color: #fff; font-size: 11px; font-weight: 600;
  padding: 5px 12px; white-space: nowrap; transition: opacity .15s;
}
.filter-btn:hover { opacity: .88; }
.filter-btn.outline {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
}
.filter-btn.outline:hover { border-color: var(--accent); color: var(--accent); background: #fff; }

/* -----------------------------------------------
   SEVERITY STRIP (Overview)
   ----------------------------------------------- */
.sev-strip {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.sev-cell { background: #fff; padding: 16px 20px; text-align: center; }
.sev-cell-label {
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px;
}
.sev-cell-val {
  font-size: 32px; font-weight: 700; letter-spacing: -1.5px; line-height: 1;
}
.sev-cell-sub { font-size: 10px; color: var(--dim); margin-top: 4px; }
.sev-cell-val.cr { color: var(--cr); }
.sev-cell-val.hi { color: var(--hi); }
.sev-cell-val.me { color: var(--me); }
.sev-cell-val.lo { color: var(--lo); }

/* -----------------------------------------------
   STAT CARDS
   ----------------------------------------------- */
.stat-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 16px;
}
.stat-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px;
  position: relative; overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
  box-shadow: var(--shadow-sm);
}
.stat-card:hover { border-color: var(--border2); box-shadow: var(--shadow); }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.stat-card.cr::before { background: var(--cr); }
.stat-card.hi::before { background: var(--hi); }
.stat-card.me::before { background: var(--me); }
.stat-card.lo::before { background: var(--lo); }
.stat-card.gr::before { background: var(--green); }
.stat-card.vi::before { background: var(--violet); }
.stat-card.or::before { background: var(--orange); }
.stat-label {
  font-size: 10px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 7px;
}
.stat-val {
  font-size: 28px; font-weight: 700; letter-spacing: -1px; line-height: 1;
}
.stat-val.cr { color: var(--cr); }
.stat-val.hi { color: var(--hi); }
.stat-val.me { color: var(--me); }
.stat-val.lo { color: var(--lo); }
.stat-val.gr { color: var(--green); }
.stat-val.vi { color: var(--violet); }
.stat-val.gy { color: var(--text); }
.stat-sub { font-size: 10px; color: var(--dim); margin-top: 4px; }

/* -----------------------------------------------
   CARDS
   ----------------------------------------------- */
.card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; background: #fafbfc;
}
.card-title { font-size: 13px; font-weight: 600; }
.card-body { padding: 14px 16px; }
.card-scroll { max-height: 350px; overflow-y: auto; }

/* -- Grids -- */
.g2  { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.g3  { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.g4  { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }

/* -- Badges -- */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px; border-radius: 4px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; }
.badge.cr  { background: #f8d6d4; color: var(--cr);  } .badge.cr::before  { background: var(--cr);  }
.badge.hi  { background: #f8ead4; color: var(--hi);  } .badge.hi::before  { background: var(--hi);  }
.badge.me  { background: #f6f0c9; color: #9a7f0e;   } .badge.me::before  { background: var(--me);  }
.badge.lo  { background: #d8e8f5; color: var(--lo);  } .badge.lo::before  { background: var(--lo);  }
.badge.on  { background: #d1f5f0; color: #006f67;   } .badge.on::before  { background: var(--green);}
.badge.off { background: var(--bg3); color: var(--muted); } .badge.off::before { background: var(--dim); }
.badge.vi  { background: #eee8f6; color: var(--violet); } .badge.vi::before { background: var(--violet); }
.badge.pi  { background: #fce8e4; color: var(--pink); } .badge.pi::before { background: var(--pink); }

/* -- Tables -- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
  padding: 9px 14px; text-align: left;
  border-bottom: 1px solid var(--border);
  background: #f8f9fb; white-space: nowrap;
}
.data-table td {
  padding: 8px 14px; font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f5f8fc; }
.data-table .mono { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--accent); }
.tscroll { overflow-x: auto; }

/* -----------------------------------------------
   MINI BAR CHART
   ----------------------------------------------- */
.mbar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.mbar-row:last-child { margin-bottom: 0; }
.mbar-label { font-size: 12px; color: var(--muted); min-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mbar-track { flex: 1; height: 7px; background: var(--bg3); border-radius: 4px; overflow: hidden; }
.mbar-fill  { height: 100%; border-radius: 4px; transition: width 1.2s ease; }
.mbar-count { font-size: 11px; font-weight: 600; min-width: 60px; text-align: right; font-family: 'JetBrains Mono', monospace; }

/* VBAR CHART */
.vbar-wrap { display: flex; align-items: flex-end; gap: 3px; }
.vbar { flex: 1; border-radius: 2px 2px 0 0; min-height: 2px; transition: height .8s ease; }
.vbar:hover { opacity: .75; }
.vbar-labels { display: flex; gap: 3px; margin-top: 5px; }
.vbar-label-txt { flex: 1; font-size: 9px; color: var(--dim); text-align: center; font-family: 'JetBrains Mono', monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* DONUT */
.donut-wrap { position: relative; width: 140px; height: 140px; flex-shrink: 0; }
.donut-wrap svg { transform: rotate(-90deg); }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-num { font-size: 22px; font-weight: 700; line-height: 1; }
.donut-sub { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

/* -----------------------------------------------
   TABS
   ----------------------------------------------- */
.tabs { display: flex; border-bottom: 1px solid var(--border); background: #fafbfc; }
.tab {
  padding: 10px 18px; font-size: 13px; font-weight: 500;
  color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: all .12s; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tabpane { display: none; }
.tabpane.active { display: block; animation: fadeIn .15s ease; }

/* -----------------------------------------------
   KV ROWS
   ----------------------------------------------- */
.kv-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.kv-row:last-child { border-bottom: none; }
.kv-row:hover { background: var(--bg3); }
.kv-key { color: var(--muted); flex: 1; }
.kv-val { font-weight: 600; }
.kv-cnt { color: var(--muted); margin-left: 20px; min-width: 50px; text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-orange { color: var(--orange); }

/* -----------------------------------------------
   DISCOVER PAGE
   ----------------------------------------------- */
.discover-layout {
  display: grid; grid-template-columns: 240px 1fr;
  height: calc(100vh - var(--topbar-h) - 130px);
  min-height: 500px;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; background: #fff; box-shadow: var(--shadow-sm);
}

/* Field sidebar */
.disc-sidebar { border-right: 1px solid var(--border); overflow-y: auto; }
.disc-sidebar-top {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  background: #fafbfc; position: sticky; top: 0; z-index: 2;
}
.disc-sidebar-title { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 7px; }
.disc-field-search {
  width: 100%; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 5px 9px; font-size: 12px; outline: none;
}
.disc-section-title {
  font-size: 10px; font-weight: 700; color: var(--muted);
  padding: 8px 12px 3px; text-transform: uppercase; letter-spacing: .5px;
}
.disc-field {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 12px; cursor: pointer;
  font-size: 12px; color: var(--muted);
  transition: background .1s;
}
.disc-field:hover { background: var(--bg3); color: var(--text); }
.disc-ftype {
  width: 15px; height: 15px; border-radius: 3px;
  background: #d8e8f5; color: var(--accent);
  font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-family: 'JetBrains Mono', monospace;
}
.disc-ftype.num { background: #f8ead4; color: var(--hi); }
.disc-ftype.bool { background: #d1f5f0; color: var(--green); }

/* Main log explorer */
.disc-main { display: flex; flex-direction: column; overflow: hidden; }
.disc-topbar {
  padding: 8px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 9px;
  background: #fafbfc; flex-wrap: wrap; flex-shrink: 0;
}
.disc-search {
  flex: 1; min-width: 220px;
  background: #fff; border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 7px 12px;
  font-size: 13px; color: var(--text); outline: none;
  transition: border-color .15s;
}
.disc-search:focus { border-color: var(--accent); }
.disc-search::placeholder { color: var(--dim); }
.disc-hits { font-size: 13px; font-weight: 600; white-space: nowrap; }
.disc-hits span { color: var(--muted); font-weight: 400; }
.disc-dql-badge {
  font-size: 11px; font-weight: 600; color: var(--accent);
  background: #d8e8f5; border-radius: var(--radius);
  padding: 3px 8px;
}

/* Histogram */
.disc-histogram-section { padding: 10px 16px 8px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.disc-hist-meta { font-size: 10px; color: var(--muted); margin-bottom: 6px; font-family: 'JetBrains Mono', monospace; }
.disc-hist-bars { display: flex; align-items: flex-end; gap: 2px; height: 72px; }
.disc-hbar {
  flex: 1; border-radius: 2px 2px 0 0;
  background: var(--teal); opacity: .7;
  min-height: 2px; cursor: pointer; transition: opacity .1s;
}
.disc-hbar:hover { opacity: 1; }
.disc-hlabels { display: flex; gap: 2px; margin-top: 4px; }
.disc-hlabel { flex: 1; font-size: 8px; color: var(--dim); text-align: center; font-family: 'JetBrains Mono', monospace; white-space: nowrap; overflow: hidden; }

/* Log rows */
.disc-log-header {
  display: grid; grid-template-columns: 200px 1fr;
  padding: 7px 14px; background: #f8f9fb;
  border-bottom: 1px solid var(--border);
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px;
  flex-shrink: 0;
}
.disc-body { flex: 1; overflow-y: auto; }
.disc-row {
  display: grid; grid-template-columns: 200px 1fr;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .08s;
}
.disc-row:hover { background: #f5f8fc; }
.disc-time-cell {
  padding: 8px 14px;
  font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--accent);
  border-right: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 5px;
  padding-top: 10px;
}
.disc-expand-ico { color: var(--dim); font-size: 10px; user-select: none; flex-shrink: 0; }
.disc-src-cell {
  padding: 8px 14px;
  font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--muted);
  line-height: 1.8; word-break: break-all;
}
.disc-tag {
  display: inline-block;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 3px; padding: 1px 5px;
  font-size: 10px; margin: 1px 2px; white-space: nowrap;
}
.disc-tag-k { color: var(--accent); font-weight: 500; }
.disc-tag-v { color: var(--text); }
/* expanded detail */
.disc-detail {
  display: none; background: #f5f8fc;
  border-bottom: 1px solid var(--border);
  padding: 12px 14px 14px 215px;
}
.disc-detail.open { display: block; animation: fadeIn .15s ease; }
.disc-detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.disc-df-key { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.disc-df-val { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text); margin-top: 2px; word-break: break-all; }

/* -----------------------------------------------
   MODULE TILES  (overview)
   ----------------------------------------------- */
.module-tiles { display: grid; gap: 10px; margin-bottom: 14px; }
.module-tile {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  cursor: pointer; transition: all .15s; box-shadow: var(--shadow-sm);
}
.module-tile:hover { border-color: var(--accent); box-shadow: 0 3px 10px rgba(0,107,180,.1); }
.module-tile-ico { font-size: 20px; margin-bottom: 6px; }
.module-tile-name { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.module-tile-desc { font-size: 11px; color: var(--muted); line-height: 1.4; }
.section-title {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1.5px;
  margin-bottom: 10px; margin-top: 6px;
}

/* -----------------------------------------------
   MITRE GRID
   ----------------------------------------------- */
.mitre-technique-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
  gap: 7px; padding: 14px;
}
.mitre-cell {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 10px;
  text-align: center; cursor: pointer; transition: all .15s;
}
.mitre-cell:hover { border-color: var(--accent); }
.mitre-cell.has-data { border-color: var(--teal); background: #f0fbfa; }
.mitre-cell-id { font-family: 'JetBrains Mono', monospace; font-size: 9px; color: var(--accent); margin-bottom: 3px; }
.mitre-cell-name { font-size: 9.5px; color: var(--muted); line-height: 1.3; }
.mitre-cell-cnt { font-size: 18px; font-weight: 700; color: var(--text); margin-top: 5px; }
.mitre-cell.has-data .mitre-cell-cnt { color: var(--teal); }

/* -----------------------------------------------
   LOADING / EMPTY / ERROR STATES
   ----------------------------------------------- */
.loading-state {
  text-align: center; padding: 32px; color: var(--muted);
}
.loading-spinner {
  font-size: 22px; margin-bottom: 8px;
  display: block;
  animation: spin 1s linear infinite;
}
.empty-state { text-align: center; padding: 40px; color: var(--dim); }
.empty-icon { font-size: 32px; margin-bottom: 10px; opacity: .35; }
.empty-title { font-size: 14px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.empty-desc { font-size: 12px; color: var(--dim); }
.error-state {
  background: #fdf3f3; border: 1px solid #f5c6c6;
  border-radius: var(--radius-lg); padding: 14px 16px;
  color: var(--red); font-size: 12px; margin: 12px 0;
}

/* -----------------------------------------------
   EXPAND ROWS  (MITRE, events)
   ----------------------------------------------- */
.expand-row { cursor: pointer; }
.expand-detail {
  display: none; background: #f5f8fc;
  padding: 10px 14px 14px 42px;
  border-bottom: 1px solid var(--border);
}
.expand-detail.open { display: block; animation: fadeIn .12s ease; }
.expand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.expand-field-key { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.expand-field-val { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text); margin-top: 2px; word-break: break-all; }

/* -----------------------------------------------
   RESPONSIVE
   ----------------------------------------------- */
@media (max-width: 900px) {
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .discover-layout { grid-template-columns: 1fr; }
  .disc-sidebar { display: none; }
  :root { --sidebar-w: 200px; }
}
@media (max-width: 600px) {
  .sev-strip { grid-template-columns: 1fr 1fr; }
  :root { --sidebar-w: 0px; }
  .sidebar { position: fixed; left: -240px; z-index: 200; transition: left .2s; }
  .sidebar.open { left: 0; }
}

/* -----------------------------------------------
   PULSE / LIVE INDICATOR
   ----------------------------------------------- */
.pulse-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); display: inline-block;
  animation: blink 2s infinite; margin-right: 5px; vertical-align: middle;
}

/* -----------------------------------------------
   INDEX CARDS  (cloud section)
   ----------------------------------------------- */
.index-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.index-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
  text-align: center; cursor: pointer; transition: all .15s;
  box-shadow: var(--shadow-sm);
}
.index-card:hover { border-color: var(--accent); box-shadow: 0 3px 12px rgba(0,107,180,.1); }
.index-card-ico { font-size: 26px; margin-bottom: 8px; }
.index-card-name { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.index-card-count { font-size: 20px; font-weight: 700; color: var(--accent); margin-top: 8px; }

/* -----------------------------------------------
   OVERVIEW MODULE TILES  (exact Wazuh style)
   ----------------------------------------------- */
.ov-module-tile {
  padding: 16px 18px;
  cursor: pointer;
  transition: background .12s;
  display: block;
}
.ov-module-tile:hover { background: #f5f8fc; }
.ov-tile-icon {
  width: 34px; height: 34px;
  margin-bottom: 10px;
  color: var(--accent);
}
.ov-tile-icon svg { width: 100%; height: 100%; }
.ov-tile-name {
  font-size: 14px; font-weight: 600;
  color: var(--text); margin-bottom: 5px;
}
.ov-tile-desc {
  font-size: 12px; color: var(--muted);
  line-height: 1.5;
}

/* -----------------------------------------------
   DISCOVER — Field filter buttons
   ----------------------------------------------- */
.disc-tag-plus {
  background: none; border: none; cursor: pointer;
  color: var(--accent); font-size: 11px; padding: 0 2px;
  opacity: 0; transition: opacity .1s;
  vertical-align: middle; line-height: 1;
}
.disc-tag:hover .disc-tag-plus { opacity: 1; }

.disc-field-plus {
  background: none; border: none; cursor: pointer;
  color: var(--accent); font-size: 12px; padding: 0 3px;
  opacity: 0; transition: opacity .1s; flex-shrink: 0;
}
.disc-field:hover .disc-field-plus { opacity: 1; }

.disc-field-filter-btn {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 3px; cursor: pointer;
  font-size: 11px; padding: 0 4px; margin-left: 4px;
  color: var(--accent); font-weight: 700;
  transition: background .1s;
}
.disc-field-filter-btn:hover { background: #d8e8f5; }
.disc-field-filter-btn.minus { color: var(--red); }
.disc-field-filter-btn.minus:hover { background: #fde8e8; }

/* -----------------------------------------------
   FONT SIZE — slightly larger for readability
   ----------------------------------------------- */
body { font-size: 14px; }
.nav-item { font-size: 13.5px; }
.nav-group-label { font-size: 11px; }
.data-table td { font-size: 13px; }
.data-table th { font-size: 11px; }
.disc-src-cell { font-size: 11px; }
.disc-tag { font-size: 10.5px; }
.ov-tile-name { font-size: 14px; }
.ov-tile-desc { font-size: 12.5px; }
.stat-val { font-size: 30px; }

/* -----------------------------------------------
   APP.PY /api/indices — auto new index detection
   ----------------------------------------------- */
.index-row-new {
  background: #f0fbfa !important;
  font-weight: 600;
}


        /* Enhanced Stats Grid */
        .stat-grid {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 16px;
            margin-bottom: 20px;
        }
        
        .stat-card {
            background: var(--bg-secondary, #fff);
            border: 1px solid var(--border-color, #e2e8f0);
            border-radius: 8px;
            padding: 20px;
            text-align: center;
            box-shadow: 0 1px 3px rgba(0,0,0,0.08);
            transition: transform 0.2s, box-shadow 0.2s;
        }
        
        .stat-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.12);
        }
        
        .stat-label {
            font-size: 12px;
            color: var(--text-secondary, #64748b);
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 8px;
        }
        
        .stat-val {
            font-size: 36px;
            font-weight: 700;
            line-height: 1;
        }
        
        /* Severity Colors */
        .cr { color: #bd271e; border-top: 3px solid #bd271e; }
        .hi { color: #da8b45; border-top: 3px solid #da8b45; }
        .me { color: #9170b8; border-top: 3px solid #9170b8; }
        .lo { color: #00a69b; border-top: 3px solid #00a69b; }
        .gy { color: #1e293b; border-top: 3px solid #1e293b; }
        .vi { color: #006bb4; border-top: 3px solid #006bb4; }
        
        /* Enhanced Cards */
        .g2 {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 20px;
            margin-bottom: 20px;
        }
        
        .g3 {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 20px;
            margin-bottom: 20px;
        }
        
        .g4 {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 16px;
            margin-bottom: 20px;
        }
        
        .card {
            background: var(--bg-secondary, #fff);
            border: 1px solid var(--border-color, #e2e8f0);
            border-radius: 8px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.08);
            overflow: hidden;
        }
        
        .card-header {
            padding: 14px 18px;
            border-bottom: 1px solid var(--border-color, #e2e8f0);
            background: var(--bg-tertiary, #f8fafc);
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        
        .card-title {
            font-size: 14px;
            font-weight: 700;
            color: var(--text-primary, #1e293b);
        }
        
        .card-body {
            padding: 16px 18px;
        }
        
        .tscroll {
            overflow-x: auto;
        }
        
        .card-scroll {
            max-height: 500px;
            overflow-y: auto;
        }
        
        /* Data Table */
        .data-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 13px;
        }
        
        .data-table th {
            background: var(--bg-tertiary, #f1f5f9);
            padding: 10px 12px;
            text-align: left;
            font-weight: 600;
            color: var(--text-secondary, #64748b);
            border-bottom: 2px solid var(--border-color, #e2e8f0);
            white-space: nowrap;
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        
        .data-table td {
            padding: 10px 12px;
            border-bottom: 1px solid var(--border-color, #e2e8f0);
            vertical-align: middle;
        }
        
        .data-table tr:hover {
            background: var(--bg-tertiary, #f8fafc);
        }
        
        .mono {
            font-family: 'JetBrains Mono', 'Courier New', monospace;
            font-size: 12px;
        }
        
        /* Badges */
        .badge {
            display: inline-flex;
            align-items: center;
            padding: 3px 10px;
            border-radius: 12px;
            font-size: 11px;
            font-weight: 600;
        }
        
        .badge-critical { background: #fef2f2; color: #bd271e; }
        .badge-high { background: #fffbeb; color: #da8b45; }
        .badge-medium { background: #f3e8ff; color: #9170b8; }
        .badge-low { background: #ecfdf5; color: #00a69b; }
        .badge-active { background: #ecfdf5; color: #00a69b; }
        .badge-fixed { background: #dbeafe; color: #006bb4; }
        .badge-pending { background: #f1f5f9; color: #64748b; }
        
        /* Chart Containers */
        .chart-container {
            position: relative;
            height: 220px;
            padding: 12px;
        }
        
        .chart-container svg {
            width: 100%;
            height: 100%;
        }
        
        /* Mini Bar Charts */
        .mini-bar-item {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 10px;
        }
        
        .mini-bar-label {
            flex: 0 0 140px;
            font-size: 12px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        
        .mini-bar-track {
            flex: 1;
            height: 22px;
            background: #f1f5f9;
            border-radius: 4px;
            overflow: hidden;
        }
        
        .mini-bar-fill {
            height: 100%;
            border-radius: 4px;
            transition: width 0.4s ease;
        }
        
        .mini-bar-count {
            flex: 0 0 40px;
            text-align: right;
            font-weight: 600;
            font-size: 13px;
        }
        
        /* Donut Charts */
        .donut-container {
            display: flex;
            align-items: center;
            gap: 20px;
            height: 180px;
        }
        
        .donut-svg {
            flex-shrink: 0;
        }
        
        .donut-legend {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        
        .donut-legend-item {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 12px;
        }
        
        .donut-legend-dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            flex-shrink: 0;
        }
        
        /* Pagination */
        .pagination {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 14px 18px;
            border-top: 1px solid var(--border-color, #e2e8f0);
            background: var(--bg-tertiary, #f8fafc);
        }
        
        .pagination-info {
            font-size: 12px;
            color: var(--text-secondary, #64748b);
        }
        
        .pagination-buttons {
            display: flex;
            gap: 6px;
        }
        
        .page-btn {
            padding: 5px 11px;
            border: 1px solid var(--border-color, #e2e8f0);
            background: white;
            border-radius: 4px;
            cursor: pointer;
            font-size: 12px;
            transition: all 0.15s;
        }
        
        .page-btn:hover:not(:disabled) {
            border-color: var(--accent-primary, #006bb4);
            color: var(--accent-primary, #006bb4);
        }
        
        .page-btn.active {
            background: var(--accent-primary, #006bb4);
            color: white;
            border-color: var(--accent-primary, #006bb4);
        }
        
        .page-btn:disabled {
            opacity: 0.4;
            cursor: not-allowed;
        }
        
        /* Loading & Empty States */
        .loading-state {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 40px;
            color: var(--text-muted, #94a3b8);
        }
        
        .loading-spinner {
            width: 22px;
            height: 22px;
            border: 3px solid var(--border-color, #e2e8f0);
            border-top-color: var(--accent-primary, #006bb4);
            border-radius: 50%;
            animation: spin 0.7s linear infinite;
            margin-right: 10px;
        }
        
        @keyframes spin {
            to { transform: rotate(360deg); }
        }
        
        .empty-state {
            text-align: center;
            padding: 50px 20px;
            color: var(--text-muted, #94a3b8);
        }
        
        .empty-icon {
            font-size: 42px;
            margin-bottom: 12px;
        }
        
        .empty-title {
            font-size: 15px;
            font-weight: 600;
            margin-bottom: 6px;
            color: var(--text-secondary, #64748b);
        }
        
        .empty-desc {
            font-size: 12px;
        }
        
        /* Expandable Rows */
        .expand-row {
            cursor: pointer;
            transition: background 0.15s;
        }
        
        .expand-detail {
            display: none;
            background: var(--bg-tertiary, #f8fafc);
        }
        
        .expand-detail.open {
            display: table-row;
        }
        
        .expand-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 12px;
            padding: 16px;
            font-size: 12px;
        }
        
        .expand-field-key {
            font-weight: 700;
            color: var(--text-muted, #94a3b8);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 4px;
            font-size: 10px;
        }
        
        .expand-field-val {
            color: var(--text-primary, #1e293b);
            word-break: break-word;
        }
        
        /* Alert Banner */
        .alert-banner {
            background: #fefce8;
            border: 1px solid #fde047;
            border-radius: 6px;
            padding: 12px 16px;
            margin-bottom: 16px;
            font-size: 13px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        /* Agent Selector Modal */
        .modal-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0,0,0,0.5);
            z-index: 9999;
            align-items: center;
            justify-content: center;
        }
        
        .modal-overlay.show {
            display: flex;
        }
        
        .modal-box {
            background: white;
            border-radius: 10px;
            width: 90%;
            max-width: 550px;
            max-height: 75vh;
            overflow: hidden;
            box-shadow: 0 25px 50px rgba(0,0,0,0.25);
        }
        
        .modal-header {
            padding: 18px 22px;
            border-bottom: 1px solid var(--border-color, #e2e8f0);
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        
        .modal-title {
            font-size: 17px;
            font-weight: 700;
        }
        
        .modal-close {
            background: none;
            border: none;
            font-size: 26px;
            cursor: pointer;
            color: var(--text-muted, #94a3b8);
            line-height: 1;
        }
        
        .modal-body {
            padding: 18px 22px;
            overflow-y: auto;
            max-height: 55vh;
        }
        
        .agent-option {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 13px 16px;
            border: 2px solid var(--border-color, #e2e8f0);
            border-radius: 8px;
            margin-bottom: 10px;
            cursor: pointer;
            transition: all 0.2s;
        }
        
        .agent-option:hover {
            border-color: var(--accent-primary, #006bb4);
            background: #f0f9ff;
        }
        
        .agent-option.selected {
            border-color: var(--accent-primary, #006bb4);
            background: #e0f2fe;
        }
        
        .status-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            display: inline-block;
            margin-right: 6px;
        }
        
        .status-active { background: #00a69b; }
        .status-disconnected { background: #bd271e; }
        
        /* No Agent State */
        .no-agent-state {
            text-align: center;
            padding: 70px 20px;
        }
        
        .no-agent-icon {
            font-size: 56px;
            color: var(--text-muted, #94a3b8);
            margin-bottom: 14px;
        }
        
        /* Responsive */
        @media (max-width: 1200px) {
            .stat-grid { grid-template-columns: repeat(3, 1fr); }
            .g4 { grid-template-columns: repeat(2, 1fr); }
            .g3 { grid-template-columns: repeat(2, 1fr); }
        }
        
        @media (max-width: 768px) {
            .stat-grid, .g4, .g3, .g2 { grid-template-columns: 1fr; }
        }

  .dashboard-header {
            background: #fff;
            border-bottom: 1px solid #d3dae6;
            padding: 12px 24px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            position: sticky;
            top: 0;
            z-index: 100;
            box-shadow: 0 1px 3px rgba(0,0,0,0.05);
        }

        .header-left {
            display: flex;
            align-items: center;
            gap: 20px;
        }

        .logo {
            width: 24px;
            height: 24px;
            background: linear-gradient(135deg, #f90 0%, #f60 100%);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: bold;
            font-size: 12px;
        }

        .page-title {
            font-size: 16px;
            font-weight: 600;
            color: #1a1a1a;
        }

        .page-subtitle {
            font-size: 12px;
            color: #6a7788;
            margin-left: 10px;
        }

        .header-right {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .header-select {
            padding: 6px 12px;
            border: 1px solid #d3dae6;
            border-radius: 4px;
            background: white;
            font-size: 13px;
            cursor: pointer;
        }

        .btn-primary {
            padding: 6px 16px;
            background: #0077cc;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 13px;
            font-weight: 500;
            transition: background 0.2s;
        }

        .btn-primary:hover {
            background: #0066b3;
        }

        .btn-outline {
            padding: 6px 16px;
            background: white;
            color: #0077cc;
            border: 1px solid #0077cc;
            border-radius: 4px;
            cursor: pointer;
            font-size: 13px;
            transition: all 0.2s;
        }

        .btn-outline:hover {
            background: #e6f2ff;
        }

        /* Navigation Tabs */
        .nav-tabs {
            background: #fff;
            border-bottom: 1px solid #d3dae6;
            padding: 0 24px;
            display: flex;
            gap: 24px;
        }

        .nav-tab {
            padding: 12px 0;
            color: #6a7788;
            cursor: pointer;
            border-bottom: 2px solid transparent;
            font-weight: 500;
            transition: all 0.2s;
        }

        .nav-tab.active {
            color: #0077cc;
            border-bottom-color: #0077cc;
        }

        .nav-tab:hover {
            color: #0077cc;
        }

        /* Main Content */
        .main-content {
            padding: 20px 24px;
            max-width: 1800px;
            margin: 0 auto;
        }

        /* Alert Banner */
        .alert-banner {
            background: #fef9e7;
            border: 1px solid #f9e79f;
            border-radius: 4px;
            padding: 12px 16px;
            margin-bottom: 20px;
            display: flex;
            align-items: start;
            gap: 10px;
        }

        .alert-icon {
            color: #f39c12;
            font-size: 18px;
            margin-top: 2px;
        }

        .alert-content {
            flex: 1;
        }

        .alert-title {
            font-weight: 600;
            color: #9a7b0a;
            margin-bottom: 4px;
        }

        .alert-text {
            color: #7d6608;
            font-size: 13px;
        }

        .alert-link {
            color: #0077cc;
            text-decoration: none;
        }

        .alert-link:hover {
            text-decoration: underline;
        }

        /* Filter Bar */
        .filter-bar {
            background: #fff;
            border: 1px solid #d3dae6;
            border-radius: 4px;
            padding: 12px 16px;
            margin-bottom: 20px;
            display: flex;
            align-items: center;
            gap: 12px;
            flex-wrap: wrap;
        }

        .filter-label {
            font-size: 13px;
            color: #6a7788;
            font-weight: 500;
        }

        .filter-input {
            padding: 6px 10px;
            border: 1px solid #d3dae6;
            border-radius: 4px;
            font-size: 13px;
            min-width: 150px;
        }

        .filter-sep {
            width: 1px;
            height: 20px;
            background: #d3dae6;
        }

        .filter-btn {
            padding: 6px 14px;
            background: #0077cc;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 13px;
            font-weight: 500;
        }

        .filter-btn.outline {
            background: white;
            color: #6a7788;
            border: 1px solid #d3dae6;
        }

        .filter-btn.outline:hover {
            background: #f5f7fa;
        }

        /* Dashboard Grid */
        .dashboard-grid {
            display: grid;
            grid-template-columns: 2fr 1fr;
            gap: 20px;
            margin-bottom: 20px;
        }

        .chart-card {
            background: #fff;
            border: 1px solid #d3dae6;
            border-radius: 4px;
            padding: 16px;
        }

        .chart-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
        }

        .chart-title {
            font-size: 14px;
            font-weight: 600;
            color: #1a1a1a;
        }

        .chart-container {
            height: 280px;
            position: relative;
        }

        /* Donut Charts Row */
        .donut-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 20px;
            margin-bottom: 20px;
        }

        .donut-card {
            background: #fff;
            border: 1px solid #d3dae6;
            border-radius: 4px;
            padding: 16px;
        }

        .donut-container {
            height: 200px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        /* Bottom Row */
        .bottom-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
        }

        /* Table Styles */
        .table-card {
            background: #fff;
            border: 1px solid #d3dae6;
            border-radius: 4px;
            overflow: hidden;
        }

        .table-header {
            padding: 16px;
            border-bottom: 1px solid #d3dae6;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .table-title {
            font-size: 14px;
            font-weight: 600;
        }

        .table-meta {
            font-size: 12px;
            color: #6a7788;
        }

        .data-table {
            width: 100%;
            border-collapse: collapse;
        }

        .data-table th {
            background: #f5f7fa;
            padding: 10px 12px;
            text-align: left;
            font-size: 12px;
            font-weight: 600;
            color: #6a7788;
            border-bottom: 1px solid #d3dae6;
            cursor: pointer;
            user-select: none;
        }

        .data-table th:hover {
            background: #ebeef3;
        }

        .data-table td {
            padding: 10px 12px;
            font-size: 13px;
            border-bottom: 1px solid #f0f2f5;
            color: #1a1a1a;
        }

        .data-table tr:hover {
            background: #f9fafb;
        }

        .link-text {
            color: #0077cc;
            text-decoration: none;
            cursor: pointer;
        }

        .link-text:hover {
            text-decoration: underline;
        }

        .badge {
            display: inline-block;
            padding: 2px 8px;
            border-radius: 3px;
            font-size: 11px;
            font-weight: 600;
        }

        .badge-info { background: #e6f7ff; color: #0066cc; }
        .badge-warning { background: #fff7e6; color: #ad6800; }
        .badge-danger { background: #fff1f0; color: #cf1322; }

        /* Pagination */
        .pagination {
            padding: 12px 16px;
            border-top: 1px solid #d3dae6;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 13px;
            color: #6a7788;
        }

        .pagination-controls {
            display: flex;
            gap: 8px;
            align-items: center;
        }

        .page-btn {
            padding: 4px 10px;
            border: 1px solid #d3dae6;
            background: white;
            border-radius: 3px;
            cursor: pointer;
            font-size: 12px;
        }

        .page-btn:hover:not(:disabled) {
            background: #f5f7fa;
        }

        .page-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .page-btn.active {
            background: #0077cc;
            color: white;
            border-color: #0077cc;
        }

        /* Loading State */
        .loading-overlay {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(255,255,255,0.8);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10;
        }

        .spinner {
            width: 40px;
            height: 40px;
            border: 3px solid #d3dae6;
            border-top-color: #0077cc;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        /* Empty State */
        .empty-state {
            text-align: center;
            padding: 40px 20px;
            color: #6a7788;
        }

        .empty-icon {
            font-size: 48px;
            margin-bottom: 12px;
            opacity: 0.3;
        }

        /* Scrollbar */
        ::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }

        ::-webkit-scrollbar-track {
            background: #f5f7fa;
        }

        ::-webkit-scrollbar-thumb {
            background: #c1c7cd;
            border-radius: 4px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: #a0a8b0;
        }

        /* Responsive */
        @media (max-width: 1400px) {
            .donut-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        @media (max-width: 1024px) {
            .dashboard-grid,
            .bottom-grid {
                grid-template-columns: 1fr;
            }

/* ============================================
   DASHBOARD CSS - ?? RAINBOW THEME
   Every element has a DIFFERENT vibrant color!
   ============================================ */

.panel-container {
    background: #000000;
    border-radius: 16px;
    padding: 25px;
    width: 100%;
    box-sizing: border-box;
    color: #ffffff;
    border: 2px solid #ff00ff;  /* MAGENTA border */
}

/* ============================================
   ?? ELEMENT 1: TITLE - RED/ORANGE
   "Log Events Per Second"
   ============================================ */
.panel-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 20px !important;
    flex-wrap: wrap !important;
    gap: 15px !important;
}

.panel-title {
    color: #ff6b6b !important;  /* ?? CORAL RED */
    font-size: 22px !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin: 0 !important;
    text-shadow: 0 0 15px rgba(255, 107, 107, 0.5) !important;  /* Red glow */
    letter-spacing: 0.5px !important;
}

.status-indicator {
    width: 14px !important;
    height: 14px !important;
    background: #ff4757 !important;  /* ?? BRIGHT RED */
    border-radius: 50% !important;
    animation: pulse-red 2s infinite !important;
    box-shadow: 0 0 15px #ff4757 !important;  /* Red glow */
    flex-shrink: 0 !important;
}

@keyframes pulse-red {
    0%, 100% { 
        opacity: 1; 
        box-shadow: 0 0 15px #ff4757;
    }
    50% { 
        opacity: 0.6; 
        box-shadow: 0 0 25px #ff4757;
    }
}

/* ============================================
   ?? ELEMENT 2: TIME RANGE - BLUE/CYAN
   Dropdown selector
   ============================================ */
.time-range-selector {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    color: #00d4ff !important;  /* ?? CYAN BLUE */
    font-size: 13px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.time-range-selector select {
    background: linear-gradient(135deg, #0a1628 0%, #1a3a5c 100%) !important;  /* Dark blue gradient */
    color: #00d4ff !important;  /* ?? CYAN text */
    border: 2px solid #00d4ff !important;  /* Cyan border */
    padding: 8px 12px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.2) !important;
}

.time-range-selector select:hover {
    background: linear-gradient(135deg, #1a3a5c 0%, #2a5a8c 100%) !important;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5) !important;
    transform: translateY(-2px);
}

.time-range-selector select:focus {
    outline: none !important;
    box-shadow: 0 0 25px rgba(0, 212, 255, 0.7) !important;
}

.time-range-selector select option {
    background: #0a1628 !important;
    color: #00d4ff !important;
    font-weight: 600 !important;
}

/* ============================================
   ?? ELEMENT 3: CONTROL BUTTONS - PURPLE/VIOLET
   Real-time | 1 Sec | 5 Sec | Pause
   ============================================ */
.controls {
    display: flex !important;
    gap: 10px !important;
    margin-top: 18px !important;
    flex-wrap: wrap !important;
}

.control-btn {
    background: linear-gradient(135deg, #2d1b69 0%, #5b21b6 100%) !important;  /* Deep purple gradient */
    color: #e879f9 !important;  /* ?? PINK-PURPLE text */
    border: 2px solid #a855f7 !important;  /* Purple border */
    padding: 10px 18px !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3) !important;
    position: relative !important;
    overflow: hidden !important;
}

.control-btn::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: -100% !important;
    width: 100% !important;
    height: 100% !important;
    background: linear-gradient(90deg, transparent, rgba(232, 121, 249, 0.2), transparent) !important;
    transition: left 0.5s !important;
}

.control-btn:hover::before {
    left: 100% !important;
}

.control-btn:hover {
    background: linear-gradient(135deg, #5b21b6 0%, #7c3aed 50%, #a855f7 100%) !important;
    color: #ffffff !important;
    border-color: #c084fc !important;
    box-shadow: 0 6px 25px rgba(168, 85, 247, 0.6) !important;
    transform: translateY(-3px) scale(1.05);
}

.control-btn.active {
    background: linear-gradient(135deg, #a855f7 0%, #d946ef 50%, #f0abfc 100%) !important;  /* Bright purple-pink gradient */
    color: #ffffff !important;
    border-color: #e879f9 !important;
    box-shadow: 0 8px 30px rgba(217, 70, 239, 0.7) !important;  /* Strong pink-purple glow */
    animation: button-glow 2s ease-in-out infinite !important;
}

@keyframes button-glow {
    0%, 100% { 
        box-shadow: 0 8px 30px rgba(217, 70, 239, 0.7);
    }
    50% { 
        box-shadow: 0 8px 40px rgba(217, 70, 239, 1), 0 0 60px rgba(217, 70, 239, 0.4);
    }
}

/* ============================================
   ?? METRIC CARDS - Colorful Gradients (Keep as before)
   ============================================ */
.metrics-row {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    gap: 15px !important;
    margin-bottom: 20px !important;
}

.metric-card {
    border-radius: 14px !important;
    padding: 20px 16px !important;
    color: #fff !important;
    position: relative !important;
    overflow: hidden !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    min-height: 120px !important;
    border: none !important;
}

.metric-card::after {
    content: '' !important;
    position: absolute !important;
    bottom: -20px !important;
    right: -20px !important;
    width: 90px !important;
    height: 90px !important;
    background: rgba(255, 255, 255, 0.18) !important;
    border-radius: 50% !important;
    pointer-events: none !important;
}

/* Card 1 - Current EPS - Blue/Purple */
.card-current,
.metric-card:nth-child(1) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.6) !important;
}
.card-current:hover,
.metric-card:nth-child(1):hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 12px 28px rgba(102, 126, 234, 0.8) !important;
}

/* Card 2 - Average EPS - Red/Pink */
.card-average,
.metric-card:nth-child(2) {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.6) !important;
}
.card-average:hover,
.metric-card:nth-child(2):hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 12px 28px rgba(245, 87, 108, 0.8) !important;
}

/* Card 3 - Peak EPS - Orange/Yellow */
.card-peak,
.metric-card:nth-child(3) {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%) !important;
    box-shadow: 0 4px 15px rgba(250, 112, 154, 0.6) !important;
}
.card-peak:hover,
.metric-card:nth-child(3):hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 12px 28px rgba(250, 112, 154, 0.8) !important;
}

/* Card 4 - Total Events - Green/Lime */
.card-total,
.metric-card:nth-child(4) {
    background: linear-gradient(135deg, #86b110 0%, #c4dd54 50%, #dfe982 100%) !important;
    box-shadow: 0 4px 15px rgba(134, 177, 16, 0.6) !important;
}
.card-total:hover,
.metric-card:nth-child(4):hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 12px 28px rgba(134, 177, 16, 0.8) !important;
}

/* Text styles */
.metric-label {
    font-size: 13px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.8px !important;
    opacity: 1 !important;
    margin-bottom: 10px !important;
    line-height: 1.3 !important;
    color: #ffffff !important;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3) !important;
}

.metric-value {
    font-size: 38px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    margin-bottom: 4px !important;
    color: #ffffff !important;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.4) !important;
}

/* Chart container - Keep dark with subtle rainbow accent */
.chart-container {
    background: #000000 !important;
    border-radius: 12px !important;
    padding: 15px !important;
    border: 2px solid #444444 !important;
    position: relative !important;
    height: 280px !important;
    box-shadow: inset 0 0 30px rgba(255, 0, 255, 0.05) !important;  /* Subtle magenta inner glow */
}

/* Responsive */
@media (max-width: 1200px) {
    .metrics-row {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
    }
    .metric-value { font-size: 32px !important; }
    .chart-container { height: 240px !important; }
}

@media (max-width: 768px) {
    .panel-container { padding: 15px !important; }
    .panel-title { font-size: 18px !important; }
    .metrics-row { grid-template-columns: 1fr 1fr !important; }
    .metric-value { font-size: 28px !important; }
    .chart-container { height: 200px !important; }
}




