:root {
  --nav-100: #f1f3f8;
  --nav-200: #e4e9f5;
  --page-1100: #1b273c;
  --page-900: #485161;
  --page-700: #707682;
  --page-600: #8e939b;
  --page-500: #a4a8ae;
  --page-400: #bcbfc3;
  --page-300: #d2d4d6;
  --page-200: #e9eaeb;
  --white: #ffffff;
  --blue: #1d6bfc;
  --blue-600: #357bfc;
  --purple-900: #5e1a64;
  --purple-700: #9f2caa;
  --purple-500: #ca59d4;
  --sidebar-w: 260px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--page-900);
  background: var(--white);
  font-size: 14px;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.icon { width: 16px; height: 16px; display: block; flex-shrink: 0; }

/* ==================== LAYOUT ==================== */
.layout { display: flex; min-height: 100vh; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--nav-100);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
}

.sidebar-logo {
  padding: 24px 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.logo-mark {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--page-1100);
}
.logo-mark span { color: var(--blue); }

.logo-text {
  font-size: 14px;
  line-height: 16px;
  color: var(--page-1100);
  letter-spacing: 0.08px;
}

.btn {
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--page-1100);
  border-radius: 4px;
}

.btn-outline {
  border: 1px solid var(--page-1100);
  padding: 6px 12px 6px 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
}
.btn-outline:hover { background: var(--white); }

.btn-block { width: 100%; justify-content: center; }

.btn-sm { height: 32px; padding: 6px 12px; font-size: 14px; }

.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 16px;
}

.menu-label {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px 0 24px;
  font-size: 12px;
  color: var(--page-700);
}
.menu-label i {
  flex: 1;
  height: 1px;
  background: var(--page-300);
  font-style: normal;
}

.menu-item, .menu-item--group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 24px;
  color: var(--page-900);
  font-size: 14px;
}
.menu-item:hover, .menu-item--group:hover { background: rgba(0,0,0,0.03); }

.menu-item span, .menu-item--group span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-item--group { cursor: pointer; }
.menu-item--group .chevron { transition: transform .15s; }
.menu-item--group.open .chevron { transform: rotate(0deg); }

.menu-subitem {
  display: flex;
  align-items: center;
  padding: 8px 12px 8px 48px;
  color: var(--page-900);
  font-size: 14px;
}
.menu-subitem:hover { background: rgba(0,0,0,0.03); }
.menu-subitem.active { background: var(--nav-200); color: var(--page-1100); }

.chevron-right { color: var(--page-900); margin-left: auto; }

.sidebar-tagline {
  padding: 0 24px 32px;
  font-size: 12px;
  line-height: 16px;
  color: var(--page-500);
}

/* ==================== TOPBAR ==================== */
.topbar {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 16px;
}

.topbar-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 12px 0 8px;
  border-radius: 4px;
  background: var(--white);
  color: var(--page-900);
  font-size: 14px;
  font-weight: 500;
}
.quick-btn:hover { background: var(--page-200); }

.quick-btn--active {
  background: var(--page-900);
  color: var(--white);
}
.quick-btn--active:hover { background: var(--page-900); }

.badge {
  background: var(--blue);
  color: var(--white);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  padding: 0 4px;
  height: 16px;
  line-height: 16px;
  border-radius: 2px;
}

.topbar-shadow {
  height: 4px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.05), transparent);
}

/* ==================== PAGE HEADER ==================== */
.page-header {
  padding: 24px 32px 8px;
}

.page-header-top {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 24px;
}

.icon-btn {
  background: none;
  border: none;
  position: relative;
  display: flex;
  align-items: center;
  color: var(--page-900);
  padding: 0;
}
.icon-btn--text { gap: 4px; }

.icon-btn .dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d00300;
}

.breadcrumb { padding: 8px 0; }
.breadcrumb h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
  line-height: 24px;
  color: var(--page-1100);
}

.breadcrumb--with-parent { padding: 4px 0; }
.breadcrumb-parent {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--page-700);
  margin-bottom: 4px;
}
.breadcrumb-parent a:hover { text-decoration: underline; }
.breadcrumb-parent .icon { color: var(--page-400); }

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

.btn-primary {
  background: var(--blue);
  color: var(--white);
  border: none;
  height: 32px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 2px;
}
.btn-primary:hover { background: #1854c3; }

/* ==================== TABS ==================== */
.tabs-row { padding: 0 32px 16px; }
.tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--page-200);
}
.tab {
  background: none;
  border: none;
  padding: 0 0 6px;
  min-width: 56px;
  font-size: 14px;
  font-weight: 500;
  color: var(--page-700);
  position: relative;
}
.tab--active {
  color: var(--page-1100);
  box-shadow: inset 0 -2px 0 var(--page-1100);
}

/* ==================== FILTERS ==================== */
.filters-row { padding: 0 32px 16px; }
.filters {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.select {
  height: 32px;
  border: 1px solid var(--page-400);
  border-radius: 2px;
  background: var(--white);
  color: var(--page-700);
  font-size: 14px;
  padding: 0 8px;
}
.filters .select:first-child { width: 200px; }
.filters .select:last-child { width: 143px; }

/* ==================== CONTENT BLOCKS ==================== */
.content-block { padding: 0 32px 24px; }

.card {
  border: 1px solid var(--page-300);
  background: var(--white);
}

/* charts row */
.charts-row {
  display: flex;
  gap: 24px;
}
.chart-card { flex: 1; min-width: 0; padding: 20px; }

.chart-card-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}
.chart-total {
  font-size: 48px;
  font-weight: 500;
  line-height: 48px;
  letter-spacing: -0.96px;
  color: var(--page-900);
}
.chart-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--page-700);
  text-transform: capitalize;
}

.bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  height: 145px;
  margin-bottom: 20px;
}
.bar-col {
  flex: 1;
  max-width: 47px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
}
.bar-col .seg {
  width: 100%;
  transition: filter 0.15s ease, opacity 0.15s ease;
}
.bars.is-focused .seg { opacity: 0.35; filter: saturate(0.6); }
.bars.is-focused .seg.seg--active {
  opacity: 1;
  filter: brightness(1.25) saturate(1.15);
}
.bar-col .bar-label {
  margin-top: 6px;
  font-size: 11px;
  color: var(--page-600);
  text-align: center;
  white-space: nowrap;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--page-1100);
  padding: 2px 4px;
  border-radius: 3px;
  cursor: default;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.legend-item:hover {
  background: var(--page-200);
  color: var(--page-1100);
}
.legend-item:hover i {
  filter: brightness(1.25) saturate(1.15);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}
.legend-item i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
  transition: filter 0.15s ease, box-shadow 0.15s ease;
}
.legend-item span { margin-left: auto; font-weight: 500; }

/* top threats row */
.top-threats-row {
  display: flex;
  gap: 24px;
}
.top-threats-row .card { flex: 1; min-width: 0; padding: 0; }
.card-title {
  padding: 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--page-1100);
  border-bottom: 1px solid var(--page-300);
}
.card-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--page-300);
}
.link { color: #1854c3; font-size: 14px; font-weight: 500; }
.link:hover { text-decoration: underline; }

.hbar-list {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hbar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  border-radius: 3px;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}
.hbar-list.is-focused .hbar-row { opacity: 0.4; }
.hbar-list.is-focused .hbar-row.hbar-row--active { opacity: 1; }
.hbar-row--active { background: var(--page-200); }
.hbar-row--active .hbar-fill {
  filter: brightness(1.25) saturate(1.15);
}
.hbar-label {
  width: 180px;
  flex-shrink: 0;
  font-size: 14px;
  color: var(--page-900);
  padding: 4px 0;
}
.hbar-track {
  flex: 1;
  min-width: 0;
}
.hbar-fill {
  height: 8px;
  border-radius: 1px;
  transition: filter 0.15s ease;
}
.hbar-value {
  width: 32px;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--page-1100);
}

/* recent detections */
.detections { padding: 20px; display: flex; flex-direction: column; }
.detection-row {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 12px 0;
  border-bottom: 1px solid var(--page-200);
}
.detection-row:last-child { border-bottom: none; padding-bottom: 0; }
.detection-row:first-child { padding-top: 0; }

.detection-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--page-200);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.detection-icon svg { width: 44px; height: 44px; }

.detection-body { flex: 1; min-width: 0; }
.detection-body p {
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--page-900);
  line-height: 20px;
}
.detection-meta {
  font-size: 12px;
  color: var(--page-700);
}

.detection-action {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
}
.detection-action--pending {
  color: var(--page-500);
  font-size: 14px;
  font-weight: 500;
}
.spin { animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== REPORTS: STAT CARDS ==================== */
.stats-row {
  display: flex;
  gap: 24px;
}
.stat-card {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 20px;
  border: 1px solid var(--page-200);
  padding: 20px 36px 20px 20px;
}
.stat-icon { flex-shrink: 0; width: 87px; height: 87px; }
.stat-icon svg { width: 100%; height: 100%; }

.stat-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  white-space: nowrap;
}
.stat-number {
  font-size: 26px;
  font-weight: 500;
  line-height: 36px;
  color: var(--page-1100);
}
.stat-caption {
  font-size: 14px;
  color: var(--page-900);
}

.stat-divider {
  align-self: stretch;
  width: 1px;
  background: var(--page-200);
}

.stat-breakdown {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  flex: 1;
  min-width: 0;
}
.stat-breakdown-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--page-900);
  white-space: nowrap;
}
.stat-breakdown-row strong { font-weight: 400; color: var(--page-1100); }
.stat-breakdown-row strong.text-alert { color: #d40031; font-weight: 500; }

/* ==================== REPORTS: TOOLBAR ==================== */
.reports-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 280px;
  border-bottom: 1px solid var(--page-400);
  padding: 6px 0;
  color: var(--page-700);
}
.search-box input {
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  flex: 1;
  min-width: 0;
  color: var(--page-900);
}
.search-box input::placeholder { color: var(--page-700); }

/* ==================== REPORTS: TABLE ==================== */
.table-card { padding: 0; }
.table-scroll { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  text-align: left;
  padding: 18px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--page-1100);
  border-bottom: 1px solid var(--page-300);
  white-space: nowrap;
  cursor: default;
  user-select: none;
}
.data-table th[data-sort] { cursor: pointer; }
.data-table th[data-sort]:hover { background: var(--page-200); }

.sort-icon {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 4px;
  vertical-align: -1px;
  position: relative;
}
.sort-icon::before, .sort-icon::after {
  content: "";
  position: absolute;
  left: 3px;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
}
.sort-icon::before { top: 0; border-bottom: 4px solid var(--page-400); }
.sort-icon::after { bottom: 0; border-top: 4px solid var(--page-400); }
.th--asc .sort-icon::before { border-bottom-color: var(--page-1100); }
.th--desc .sort-icon::after { border-top-color: var(--page-1100); }

.data-table td {
  padding: 12px 20px;
  border-bottom: 1px solid var(--page-200);
  color: var(--page-900);
  white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(28, 39, 60, 0.02); }

.tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--page-300);
  border-radius: 2px;
  padding: 2px 8px;
  font-size: 13px;
  color: var(--page-900);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 2px;
  padding: 2px 8px;
  font-size: 13px;
  font-weight: 500;
}
.status-badge--blocked { background: var(--nav-200); color: #1854c3; }
.status-plain { color: var(--page-900); }

.threat-cell { display: inline-flex; align-items: center; gap: 6px; }
.threat-cell--none { color: var(--page-600); }
.threat-cell--alert { color: var(--page-1100); }
.threat-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.threat-dot--red { background: #d40031; }
.threat-dot--grey { background: var(--page-400); }

.user-cell { display: inline-flex; align-items: center; gap: 8px; }
.user-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--white);
  flex-shrink: 0;
}
.user-avatar--guest {
  background: var(--page-200);
  color: var(--page-700);
}
.user-avatar--guest .icon { width: 12px; height: 12px; }

.session-id { color: var(--page-700); font-family: "Roboto Mono", monospace; font-size: 13px; }

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  font-size: 13px;
  color: var(--page-700);
}
.pagination-controls { display: flex; gap: 4px; }
.page-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--page-300);
  background: var(--white);
  border-radius: 2px;
  color: var(--page-900);
}
.page-btn:hover { background: var(--page-200); }
.page-btn:disabled { color: var(--page-400); cursor: not-allowed; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1100px) {
  .charts-row, .top-threats-row, .stats-row { flex-direction: column; }
  .stat-breakdown-row { white-space: normal; }
}

@media (max-width: 900px) {
  .sidebar { display: none; }
  .topbar-links { flex-wrap: wrap; }
  .reports-toolbar { flex-direction: column; align-items: stretch; }
}
