:root {
  color-scheme: light;
  --bg: #f3f4f8;
  --card: #ffffff;
  --text: #1d2530;
  --muted: #6b7280;
  --primary: #4f82f8;
  --border: #e5e7ef;
  --sidebar-bg: #f7f8fb;
  --sidebar-border: #dde2ee;
  --sidebar-active: #dce8ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body::after {
  content: "Restricted Content - Authorized Users Only - DO NOT REPRODUCE, COPY, DISTRIBUTE ANYTHING ON THIS SITE.";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: #111827;
  color: #ffffff;
  border-top: 1px solid #1f2937;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
  padding: 9px 12px;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 230px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 18px 14px;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 210ms ease, padding 210ms ease;
}

/* Sidebar toggle button — subtle icon-only arrow */
button.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  padding: 4px 8px;
  margin-bottom: 8px;
  border: none;
  border-radius: 6px;
  background: none;
  color: #b0b8c8;
  cursor: pointer;
  font-size: 14px;
  letter-spacing: 0;
  font-weight: 400;
  box-shadow: none;
  transition: background 0.12s, color 0.12s;
}
button.sidebar-toggle:hover {
  background: #e8effe;
  color: #3b4a6b;
  box-shadow: none;
  transform: none;
}
button.sidebar-toggle:active {
  transform: none;
  background: #dde6fc;
}
.sidebar.collapsed button.sidebar-toggle {
  justify-content: center;
  padding: 4px;
}

.sidebar-brand { margin-bottom: 20px; }
.sidebar-title { font-weight: 800; font-size: 24px; letter-spacing: -0.02em; }
.sidebar-subtitle { color: var(--muted); font-size: 12px; margin-top: 2px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 6px; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #2f3a4b;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}
.sidebar-link:hover { background: #ecf1fc; }
.sidebar-link.active { background: var(--sidebar-active); color: #2d4da3; }

.sidebar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: #5a6578;
}

.sidebar-link.active .sidebar-icon {
  color: #2d4da3;
}

.sidebar-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.sidebar-label {
  white-space: nowrap;
}

.sidebar-account {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-account-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  margin: 0;
  padding: 8px;
  border-radius: 8px;
  line-height: 1.4;
}

.sidebar-submenu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: 12px;
  margin-top: 6px;
  padding-left: 8px;
  border-left: 1px solid #e3e8f3;
}

.sidebar-sublink {
  display: block;
  padding: 7px 10px;
  border-radius: 7px;
  color: #4b5565;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.35;
}

.sidebar-sublink:hover {
  background: #ecf1fc;
}

.sidebar-sublink.active {
  background: var(--sidebar-active);
  color: #2d4da3;
}

.sidebar-group {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  margin: 0;
  padding: 7px 8px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.sidebar-group-title:hover,
.sidebar-account-title:hover {
  background: #eef3fb;
}

.sidebar-group-title::-webkit-details-marker,
.sidebar-account-title::-webkit-details-marker {
  display: none;
}

.sidebar-arrow {
  font-size: 11px;
  color: #6b7280;
  transition: transform 140ms ease;
}

.sidebar-group[open] .sidebar-arrow,
.sidebar-account[open] .sidebar-arrow {
  transform: rotate(90deg);
}

.sidebar-group > .sidebar-sublink {
  display: block;
  margin-left: 12px;
  margin-top: 4px;
  margin-bottom: 2px;
  padding-left: 10px;
  border-left: 1px solid #e3e8f3;
}

.sidebar-group > .sidebar-sublink:last-child {
  margin-bottom: 6px;
}

.app-content {
  margin-left: 230px;
  min-height: 100vh;
  transition: margin-left 210ms ease;
}

/* ---- Collapsed sidebar ---- */
.sidebar.collapsed {
  width: 52px;
  padding: 18px 6px;
}
.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .sidebar-toggle-label,
.sidebar.collapsed .sidebar-group,
.sidebar.collapsed .sidebar-account {
  display: none;
}
.sidebar.collapsed .sidebar-link {
  justify-content: center;
  padding: 10px 6px;
  gap: 0;
}
.sidebar.collapsed .sidebar-icon {
  width: 22px;
  height: 22px;
}
.sidebar.collapsed .sidebar-icon svg {
  width: 22px;
  height: 22px;
}
.app-content.sidebar-collapsed {
  margin-left: 52px;
}

header {
  padding: 18px 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

header h1 {
  margin: 0 0 4px 0;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

header p { margin: 0; color: var(--muted); }

.app-logo { margin-bottom: 8px; }
.app-logo svg { max-height: 44px; width: auto; }
.app-logo img { max-height: 44px; width: auto; display: block; }

.warning-banner {
  background: #fff4df;
  border: 1px solid #f4c168;
  color: #8f5e00;
  margin: 12px 24px 0;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 600;
}

main { padding: 20px 24px 64px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 1px 2px rgba(21, 27, 38, 0.06);
  margin-bottom: 14px;
}

a { color: #3b67ce; text-decoration: none; }
a:hover { color: #274a9e; }

.topbar { display: none; }
.topbar-links { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.topbar-links a {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  background: #fff;
  color: #3a4557;
  font-weight: 600;
}
.topbar-links a:hover { background: #f5f7fd; border-color: #d6dceb; }

.top-menu { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.top-menu-title { font-weight: 700; min-width: 130px; }
.top-menu-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; width: 100%; }
.top-menu-form label { margin-bottom: 4px; }
.top-menu-form select { min-width: 280px; }

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 6px; }

input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 7px 15px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1.4;
  text-decoration: none;
  transition: background 0.14s ease, box-shadow 0.14s ease;
  box-shadow: 0 1px 3px rgba(79,130,248,0.3), 0 0 0 1px rgba(79,130,248,0.18);
}
button:hover {
  background: #3a70ea;
  box-shadow: 0 3px 9px rgba(79,130,248,0.35), 0 0 0 1px rgba(79,130,248,0.22);
}
button:active {
  background: #2d5fd6;
  box-shadow: 0 1px 2px rgba(79,130,248,0.15);
  transform: translateY(0.5px);
}
button:focus-visible {
  outline: 2px solid #4f82f8;
  outline-offset: 2px;
}

/* Ghost / secondary variant */
button.btn-secondary {
  background: #fff;
  color: #3a4f7a;
  box-shadow: 0 1px 2px rgba(0,0,0,0.07), 0 0 0 1px rgba(0,0,0,0.11);
}
button.btn-secondary:hover {
  background: #f3f6fd;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.14);
}
button.btn-secondary:active {
  background: #e8edfa;
  transform: translateY(0.5px);
}

/* Danger variant */
button.btn-danger {
  background: #dc2626;
  box-shadow: 0 1px 3px rgba(220,38,38,0.3), 0 0 0 1px rgba(220,38,38,0.18);
}
button.btn-danger:hover {
  background: #c81e1e;
  box-shadow: 0 3px 9px rgba(220,38,38,0.3), 0 0 0 1px rgba(220,38,38,0.2);
}

/* Small action buttons used in table rows */
.btn-sm {
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 5px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.6;
  text-decoration: none;
  display: inline-block;
}
.btn-sm:hover { filter: brightness(0.93); }
.btn-sm-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-sm-success { background: #16a34a; color: #fff; border-color: #15803d; }
.btn-sm-warn    { background: #d97706; color: #fff; border-color: #b45309; }
.btn-sm-danger  { background: #dc2626; color: #fff; border-color: #b91c1c; }

.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td {
  border-bottom: 1px solid var(--border);
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
}
.table th {
  background: #f8f9fc;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #73809a;
}

.domain-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.domain-logo,
.domain-fallback {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  flex: 0 0 22px;
}

.domain-logo {
  object-fit: cover;
  border: 1px solid var(--border);
  background: #fff;
}

.domain-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  background: #e2e8f0;
  border: 1px solid var(--border);
}

.rules-table {
  table-layout: fixed;
  width: 100%;
}

.rules-table th,
.rules-table td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ai-activity-table,
.alerts-table {
  table-layout: fixed;
  width: 100%;
}

.ai-activity-table th,
.ai-activity-table td,
.alerts-table th,
.alerts-table td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ai-activity-table .col-time { width: 138px; }
.ai-activity-table .col-type { width: 78px; }
.ai-activity-table .col-user { width: 170px; }
.ai-activity-table .col-domain { width: 120px; }
.ai-activity-table .col-app { width: 118px; }
.ai-activity-table .col-policy { width: 118px; }
.ai-activity-table .col-country { width: 72px; }
.ai-activity-table .col-blocked { width: 82px; }
.ai-activity-table .col-topics { width: 110px; }
.ai-activity-table .col-text { width: 42%; }

.ai-activity-table .col-time,
.ai-activity-table .col-type,
.ai-activity-table .col-country,
.ai-activity-table .col-blocked {
  white-space: nowrap;
}

.activity-text-cell {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.activity-row {
  cursor: pointer;
}

.activity-row:hover td {
  background: #f7faff;
}

.activity-row-selected td {
  background: #ecf3ff;
}

.activity-llm-output {
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 110px;
}

.activity-llm-debug {
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 80px;
  max-height: 260px;
  overflow: auto;
  background: #0f172a;
  color: #e2e8f0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #1f2937;
  font-size: 12px;
}

.risk-rank-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.risk-rank-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.risk-rank-table th:nth-child(1),
.risk-rank-table td:nth-child(1) {
  width: 64px;
  white-space: nowrap;
}

.risk-rank-table th:nth-child(3),
.risk-rank-table td:nth-child(3) {
  width: 120px;
  white-space: nowrap;
}

.risk-signal-gauge {
  display: grid;
  gap: 6px;
  min-width: 240px;
}

.risk-signal-item {
  display: grid;
  gap: 4px;
}

.risk-signal-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #475569;
}

.risk-signal-track {
  height: 7px;
  background: #e5e7ef;
  border-radius: 999px;
  overflow: hidden;
}

.risk-signal-fill {
  height: 100%;
  border-radius: 999px;
}

.risk-signal-danger { background: #ef4444; }
.risk-signal-warning { background: #f59e0b; }
.risk-signal-neutral { background: #64748b; }

.risk-signal-drivers {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.domain-with-icon { display: inline-flex; align-items: center; gap: 6px; }
.company-icon { position: relative; display: inline-flex; align-items: center; justify-content: center; height: 32px; width: 32px; flex: 0 0 32px; }
.company-icon svg, .company-icon img { height: 32px; width: 32px; display: block; object-fit: contain; }

.user-with-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.user-flag-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #ffffff;
  cursor: pointer;
  padding: 0;
}

.user-flag-toggle svg {
  width: 14px;
  height: 14px;
  display: block;
}

.user-flag-toggle:hover {
  border-color: #9ca3af;
}

.user-flag-toggle.is-flagged {
  color: #f59e0b;
  border-color: #f59e0b;
}

.user-flag-toggle.is-busy {
  opacity: 0.7;
}

.account-overlay {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
}

.account-overlay svg {
  width: 10px;
  height: 10px;
  display: block;
}

.account-personal { background: #f97316; }
.account-corporate { background: #2563eb; }

.account-type-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}

.account-type-corporate {
  background: #e7f0ff;
  color: #1f4ca3;
  border-color: #c8dafd;
}

.account-type-personal {
  background: #fff1e6;
  color: #a04a11;
  border-color: #ffd5b8;
}

.account-type-unknown {
  background: #f4f5f7;
  color: #5b6472;
  border-color: #dce1e8;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e9eefb;
  color: #324b84;
  font-size: 12px;
}
.badge-yes { background: #fde8e8; color: #9f2020; }
.badge-no { background: #e7f8ef; color: #1f7a4d; }

.muted { color: var(--muted); }
.pagination { display: flex; align-items: center; gap: 8px; }
.pagination a {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  background: #fff;
  color: #3a4557;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.summary .item, .kri-grid .item { min-width: 0; }
@media (max-width: 1100px) {
  .summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .summary {
    grid-template-columns: 1fr;
  }
}

.kri-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}
.kri-visual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}
.kri-visual-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}
.kri-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}
.kri-panel--double {
  grid-column: span 2;
}
.kri-panel h2 { margin-top: 0; font-size: 16px; }

.risk-score-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}
.risk-score-ring {
  --ring-color: #ef4444;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color) calc(var(--score) * 1%), #eef2f9 0);
  display: grid;
  place-items: center;
  animation: pulseRing 1.6s ease-in-out infinite;
}
.risk-score-inner {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #1f2937;
}

.trend-chart {
  min-height: 190px;
  display: flex;
  align-items: end;
  gap: 6px;
  overflow-x: auto;
  padding-top: 10px;
}
.trend-day {
  min-width: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.trend-bars {
  width: 24px;
  height: 130px;
  display: flex;
  align-items: end;
  gap: 3px;
}
.trend-bar {
  width: 10px;
  border-radius: 4px 4px 0 0;
  display: inline-block;
  transition: height 220ms ease;
}
.trend-bar.blocked { background: linear-gradient(180deg, #ef4444, #b91c1c); }
.trend-bar.risky { background: linear-gradient(180deg, #f59e0b, #b45309); }
.trend-label {
  font-size: 10px;
  color: var(--muted);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: .02em;
}

.event-chart {
  display: grid;
  gap: 10px;
}

.event-chart svg {
  width: 100%;
  height: 200px;
}

.event-dot {
  opacity: 0.9;
  pointer-events: all;
}

.event-dot.total { fill: #4f82f8; }
.event-dot.prompts { fill: #16a34a; }
.event-dot.responses { fill: #f59e0b; }
.event-dot.blocked { fill: #ef4444; }
.event-dot.enterprise { fill: #2563eb; }
.event-dot.personal { fill: #10b981; }

.event-point-value {
  font-size: 9px;
  font-weight: 700;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 2px;
  pointer-events: none;
}

.event-point-value.total { fill: #4f82f8; }
.event-point-value.prompts { fill: #16a34a; }
.event-point-value.responses { fill: #f59e0b; }
.event-point-value.blocked { fill: #ef4444; }
.event-point-value.enterprise { fill: #2563eb; }
.event-point-value.personal { fill: #10b981; }

.event-axis-label {
  font-size: 10px;
  fill: #6b7280;
}

.chart-tooltip {
  position: fixed;
  display: none;
  background: #111827;
  color: #fff;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  z-index: 2000;
  box-shadow: 0 6px 18px rgba(0,0,0,0.2);
  pointer-events: none;
}

.event-chart-bg {
  fill: #f8fafc;
}

.event-area {
  opacity: 0.18;
  pointer-events: none;
}

.event-area.total { fill: #4f82f8; }
.event-area.prompts { fill: #16a34a; }
.event-area.responses { fill: #f59e0b; }
.event-area.blocked { fill: #ef4444; }
.event-area.enterprise { fill: #2563eb; }
.event-area.personal { fill: #10b981; }

.event-line {
  fill: none;
  stroke-width: 2.6;
  stroke-linecap: round;
  pointer-events: none;
}

.event-line.total { stroke: #4f82f8; }
.event-line.prompts { stroke: #16a34a; }
.event-line.responses { stroke: #f59e0b; }
.event-line.blocked { stroke: #ef4444; }
.event-line.enterprise { stroke: #2563eb; }
.event-line.personal { stroke: #10b981; }

.event-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.event-legend::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 6px;
  background: currentColor;
}

.event-legend.total { color: #4f82f8; }
.event-legend.prompts { color: #16a34a; }
.event-legend.responses { color: #f59e0b; }
.event-legend.blocked { color: #ef4444; }
.event-legend.enterprise { color: #2563eb; }
.event-legend.personal { color: #10b981; }

.signal-bars { display: grid; gap: 10px; }
.signal-row {
  display: grid;
  grid-template-columns: 180px 1fr 64px;
  gap: 10px;
  align-items: center;
}
.signal-label { font-weight: 600; color: #334155; }
.signal-track {
  height: 12px;
  border-radius: 999px;
  background: #edf1f9;
  overflow: hidden;
}
.signal-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f97316, #ef4444);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.35);
  animation: growBar 700ms ease;
}
.signal-count { text-align: right; }

.bar-list {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 2fr 80px;
  gap: 10px;
  align-items: center;
}
.bar-row > * {
  min-width: 0;
}

.bar-label {
  font-weight: 600;
  color: #334155;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4f82f8, #2563eb);
}

.bar-count {
  text-align: right;
}

.kri-panel--double .bar-row {
  grid-template-columns: minmax(240px, 1.8fr) minmax(220px, 2.2fr) 80px;
}

.kri-panel--double .domain-cell {
  display: flex;
  width: 100%;
  min-width: 0;
}

.kri-panel--double .domain-cell > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stacked-list {
  display: grid;
  gap: 10px;
}

.stacked-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 2fr 100px;
  gap: 10px;
  align-items: center;
}

.stacked-label {
  font-weight: 600;
  color: #334155;
}

.stacked-count {
  text-align: right;
  color: var(--muted);
  font-size: 12px;
}

.segment.blocked { background: #ef4444; }
.segment.allowed { background: #22c55e; }

.pipeline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pipeline-step {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 100px;
  background: #f8fafc;
  text-align: center;
}

.pipeline-count {
  font-size: 20px;
  font-weight: 800;
  color: #111827;
}

.pipeline-label {
  font-size: 12px;
  color: var(--muted);
}

.pipeline-arrow {
  font-size: 18px;
  color: #94a3b8;
}

.visual-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.visual-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}

.stacked-bar {
  display: flex;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: #eef2f7;
  margin: 10px 0;
}

.segment {
  height: 100%;
}

.segment.enterprise { background: #2563eb; }
.segment.personal { background: #10b981; }
.segment.unknown { background: #94a3b8; }
.segment.prompts { background: #16a34a; }
.segment.responses { background: #f59e0b; }
.segment.off-hours { background: #6366f1; }
.segment.weekend { background: #ec4899; }

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.legend::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 6px;
  background: currentColor;
}

.legend.enterprise { color: #2563eb; }
.legend.personal { color: #10b981; }
.legend.unknown { color: #94a3b8; }
.legend.prompts { color: #16a34a; }
.legend.responses { color: #f59e0b; }
.legend.off-hours { color: #6366f1; }
.legend.weekend { color: #ec4899; }

@keyframes growBar {
  from { width: 0; }
}

@keyframes pulseRing {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.18); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.05); }
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.settings-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #fafbff;
}
.settings-section h3 { margin: 0 0 8px 0; }

.settings-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.settings-section-note {
  margin: 0 0 10px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

.settings-savebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfcff;
  padding: 10px 12px;
}

@media (max-width: 720px) {
  .settings-savebar {
    flex-direction: column;
    align-items: stretch;
  }
}

.actions-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  border: none;
  padding: 7px 15px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1.4;
  transition: background 0.14s ease, box-shadow 0.14s ease;
  box-shadow: 0 1px 3px rgba(79,130,248,0.3), 0 0 0 1px rgba(79,130,248,0.18);
}
.button-link:hover {
  background: #3a70ea;
  box-shadow: 0 3px 9px rgba(79,130,248,0.35), 0 0 0 1px rgba(79,130,248,0.22);
  color: #fff;
}
.button-link:active {
  background: #2d5fd6;
  transform: translateY(0.5px);
}

.button-link.subtle {
  background: #fff;
  color: #3a4f7a;
  box-shadow: 0 1px 2px rgba(0,0,0,0.07), 0 0 0 1px rgba(0,0,0,0.11);
}
.button-link.subtle:hover {
  background: #f3f6fd;
  color: #2a3d66;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.14);
}

.stack { display: grid; gap: 10px; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.kpi {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #fbfcff;
}
.kpi-value { font-size: 22px; font-weight: 800; line-height: 1.1; }
.kpi-label { color: var(--muted); font-size: 12px; margin-top: 4px; }
.kpi-sub { color: #64748b; font-size: 11px; margin-top: 6px; }

mark.search-hit {
  background: #fde68a;
  color: #111827;
  border-radius: 3px;
  padding: 0 2px;
}

.exec-action-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfcff;
}

.exec-action-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.exec-action-options {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.exec-action-pill {
  border: 1px solid #dbe4fb;
  background: #eef3ff;
  color: #284493;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.exec-action-pill.is-active.is-block {
  border-color: #fca5a5;
  background: #fee2e2;
  color: #991b1b;
}

.exec-action-pill.is-active.is-coach {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.exec-action-pill.is-active.is-escalate {
  border-color: #fda4af;
  background: #ffe4e6;
  color: #9f1239;
}

.exec-action-reason {
  grid-column: 1 / -1;
  font-size: 12px;
  color: #475569;
}

@media (max-width: 720px) {
  .exec-action-row {
    grid-template-columns: 1fr;
  }
}

.kpi-risk-low {
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.kpi-risk-medium {
  border-color: #fde68a;
  background: #fffbeb;
}
.kpi-risk-high {
  border-color: #fecaca;
  background: #fff1f2;
}

.bar-fill.kpi-risk-low {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}
.bar-fill.kpi-risk-medium {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}
.bar-fill.kpi-risk-high {
  background: linear-gradient(90deg, #ef4444, #b91c1c);
}

.inline-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; min-width: 110px; }

.alerts-table td { vertical-align: top; }
.alerts-table .col-select { width: 34px; }
.alerts-table .col-time { width: 110px; }
.alerts-table .col-user { width: 190px; }
.alerts-table .col-reason { width: 94px; }
.alerts-table .col-prompt { width: 46%; }
.alerts-table .col-triage { width: 260px; }
.alerts-table .col-case { width: 74px; }
.alerts-table .col-export { width: 66px; }

.alerts-table .col-reason,
.alerts-table .col-case,
.alerts-table .col-export {
  white-space: nowrap;
}

.col-time .time-date,
.col-time .time-time {
  display: block;
  white-space: nowrap;
}
.col-time .time-date {
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
}
.col-time .time-time {
  font-size: 11px;
  color: var(--muted, #6b7280);
  margin-top: 2px;
}

.alerts-content-cell {
  max-width: none;
}

.alert-regex-text,
.alert-content-text {
  max-width: 1024px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.triage-cell { min-width: 220px; }

.triage-meta {
  font-size: 12px;
  line-height: 1.35;
  margin-top: 4px;
}

.triage-actions {
  margin-top: 6px;
  display: grid;
  gap: 4px;
}

.triage-action-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

button.triage-btn {
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #c7d3f0;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.6;
  background: #eef3ff;
  color: #3a4f8a;
  box-shadow: none;
  letter-spacing: 0;
  transition: background 0.12s ease, border-color 0.12s ease;
}
button.triage-btn:hover {
  background: #dce8ff;
  border-color: #a8c0f0;
  box-shadow: none;
  transform: none;
}

/* Acknowledge — blue */
button.triage-btn.triage-btn-ack {
  background: #dbeafe; color: #1d4ed8; border-color: #93c5fd;
}
button.triage-btn.triage-btn-ack:hover { background: #bfdbfe; border-color: #60a5fa; }

/* Assign — amber */
button.triage-btn.triage-btn-assign {
  background: #fef3c7; color: #92400e; border-color: #fcd34d;
}
button.triage-btn.triage-btn-assign:hover { background: #fde68a; border-color: #f59e0b; }

/* Resolve — green */
button.triage-btn.triage-btn-resolve {
  background: #d1fae5; color: #065f46; border-color: #6ee7b7;
}
button.triage-btn.triage-btn-resolve:hover { background: #a7f3d0; border-color: #34d399; }

/* Neutral (reopen) — slate */
button.triage-btn.triage-btn-neutral {
  background: #f1f5f9; color: #475569; border-color: #cbd5e1;
}
button.triage-btn.triage-btn-neutral:hover { background: #e2e8f0; border-color: #94a3b8; }

/* False positive — rose */
button.triage-btn.triage-btn-fp {
  background: #fde8e8; color: #8e1a1a; border-color: #f2c5c5;
}
button.triage-btn.triage-btn-fp:hover { background: #fcd4d4; border-color: #f87171; }

.triage-select,
.triage-note-input {
  min-width: 100px;
  padding: 3px 6px;
  font-size: 11px;
  border-radius: 5px;
  border: 1px solid var(--border);
  line-height: 1.6;
}

.triage-note-input {
  min-width: 140px;
}

.export-link {
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}
.status-new { background: #eef2ff; color: #3746a8; border-color: #d9e0ff; }
.status-acknowledged { background: #fff4df; color: #8f5e00; border-color: #f4c168; }
.status-assigned { background: #e9f7ff; color: #035e84; border-color: #b9e8ff; }
.status-resolved { background: #e7f8ef; color: #1f7a4d; border-color: #bfe9d1; }
.status-false-positive { background: #fde8e8; color: #8e1a1a; border-color: #f2c5c5; }

.pivot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.timeline-list { display: grid; gap: 10px; }
.timeline-item {
  border: 1px solid var(--border);
  border-left: 4px solid #99a9cd;
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}
.timeline-item.alert { border-left-color: #ef4444; }
.timeline-item.follow { border-left-color: #f59e0b; }

.saved-view-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.audit-meta {
  max-width: 420px;
  max-height: 160px;
  overflow: auto;
}

.regex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.regex-textarea {
  min-height: 320px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.regex-output {
  min-height: 88px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.regex-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

details { margin-top: 6px; }
pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #f8f9fc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
}

.blur-text { filter: blur(6px); transition: filter 120ms ease-in-out; }
.blur-text:hover,
.blur-text:focus,
.blur-text:focus-within { filter: none; }

@media (max-width: 980px) {
  .sidebar { position: static; width: 100%; border-right: 0; border-bottom: 1px solid var(--sidebar-border); }
  .app-content { margin-left: 0; }
  .signal-row { grid-template-columns: 1fr; }
  .signal-count { text-align: left; }
}

@media print {
  body::after {
    display: none !important;
  }
  .sidebar,
  header,
  .no-print {
    display: none !important;
  }
  .app-content,
  body,
  main {
    margin: 0;
    padding: 0;
    background: white;
  }
  .card { box-shadow: none; border: 0; padding: 0; margin: 0; }
  .table-wrap { overflow: visible !important; }
  table { width: 100% !important; table-layout: auto !important; }
  th, td { page-break-inside: avoid; break-inside: avoid; }
  details { display: none !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PSAP Verdict Badge — Design C  (score card)
   Used in alerts.php col-verdict and wherever a verdict is displayed.
═══════════════════════════════════════════════════════════════════════════ */
.vcard {
  display: inline-flex;
  align-items: stretch;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  vertical-align: middle;
}
.vcard-score {
  padding: 5px 9px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: .03em;
  display: flex;
  align-items: center;
  min-width: 30px;
  justify-content: center;
}
.vcard-label {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  letter-spacing: .04em;
}

/* FALSE */
.vcard-false                { border-color: #334155; }
.vcard-false .vcard-score   { background: #334155; color: #94a3b8; }
.vcard-false .vcard-label   { background: #1e293b; color: #94a3b8; }
/* ALLOW */
.vcard-allow                { border-color: #166534; }
.vcard-allow .vcard-score   { background: #166534; color: #86efac; }
.vcard-allow .vcard-label   { background: #052e16; color: #4ade80; }
/* WARNING */
.vcard-warning              { border-color: #92400e; }
.vcard-warning .vcard-score { background: #92400e; color: #fde68a; }
.vcard-warning .vcard-label { background: #1c1208; color: #fbbf24; }
/* BLOCK */
.vcard-block                { border-color: #7f1d1d; }
.vcard-block .vcard-score   { background: #7f1d1d; color: #fca5a5; }
.vcard-block .vcard-label   { background: #1c0808; color: #f87171; }
/* ESCALATE */
.vcard-escalate             { border-color: #6b21a8; }
.vcard-escalate .vcard-score { background: #6b21a8; color: #e9d5ff; }
.vcard-escalate .vcard-label { background: #1a0a1e; color: #e879f9; }

/* col-verdict table column */
.col-verdict { width: 155px; min-width: 110px; white-space: nowrap; padding-right: 10px; }
.alerts-table .col-verdict { width: 155px; overflow: hidden; }

/* Run Judge button */
.btn-judge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #94a3b8;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.btn-judge:hover:not(:disabled) {
  background: #273548;
  border-color: #4f7bbd;
  color: #e2e8f0;
}
.btn-judge:disabled {
  opacity: .55;
  cursor: default;
}
.btn-judge-error {
  border-color: #7f1d1d;
  color: #f87171;
}
