: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: 31px;
  width: 230px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 18px 14px 24px;
  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: 12px;
}
.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-link.has-assigned-alerts .sidebar-icon {
  color: #c62828;
  animation: sidebarAlertBlink 1.1s steps(2, start) infinite;
}

.sidebar-alert-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 999px;
  background: #c62828;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.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: 11px;
  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: 80px; width: auto; }
.app-logo img { max-height: 80px; width: auto; display: block; }

.login-page .app-logo img {
  max-height: 40px;
}

.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; }

.login-page .login-main-bg {
  background-image: linear-gradient(rgba(15, 23, 42, 0.28), rgba(15, 23, 42, 0.28)), url('/logos/login-main-bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  min-height: calc(100vh - 170px);
}

.login-page .login-main-bg .card {
  background: rgba(243, 244, 246, 0.92);
  backdrop-filter: blur(1.5px);
}

.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;
}

.alerts-table th.is-sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 20px;
}

.alerts-table th.is-sortable::after {
  content: "\2195";
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: #9aa6bc;
}

.alerts-table th.is-sortable.is-sorted-asc::after {
  content: "\2191";
  color: #4f82f8;
}

.alerts-table th.is-sortable.is-sorted-desc::after {
  content: "\2193";
  color: #4f82f8;
}

.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-signal {
  margin-top: 10px;
  border: 1px solid #dbe3f4;
  border-radius: 10px;
  padding: 10px;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8ff 100%);
}

.activity-llm-signal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.activity-llm-signal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.activity-llm-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  color: #1e293b;
}

.activity-llm-chip.is-risk-low { border-color: #86efac; background: #f0fdf4; color: #166534; }
.activity-llm-chip.is-risk-medium { border-color: #fcd34d; background: #fffbeb; color: #92400e; }
.activity-llm-chip.is-risk-high { border-color: #fca5a5; background: #fff1f2; color: #991b1b; }
.activity-llm-chip.is-risk-critical { border-color: #ef4444; background: #fee2e2; color: #7f1d1d; }

.activity-llm-chip.is-action-allow { border-color: #86efac; background: #f0fdf4; color: #166534; }
.activity-llm-chip.is-action-allow-with-warning { border-color: #fcd34d; background: #fffbeb; color: #92400e; }
.activity-llm-chip.is-action-escalate-for-review { border-color: #fca5a5; background: #fff1f2; color: #991b1b; }
.activity-llm-chip.is-action-block-and-log { border-color: #ef4444; background: #fee2e2; color: #7f1d1d; }

.activity-llm-signal-label {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.activity-llm-indicators {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 12px;
  color: #334155;
}

.activity-llm-indicators li {
  margin: 2px 0;
}

.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;
}

.alerts-beta-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.55fr) minmax(420px, 1.9fr) 300px;
  gap: 12px;
  align-items: start;
}

.alerts-beta-page {
  font-size: 13px;
}

.alerts-beta-page .muted {
  font-size: 12px;
}

.alerts-beta-page input,
.alerts-beta-page select,
.alerts-beta-page textarea,
.alerts-beta-page button {
  font-size: 12px;
}

.alerts-beta-page .status-chip,
.alerts-beta-page .tag {
  font-size: 10px;
}

.alerts-beta-col {
  margin-bottom: 0;
}

.alerts-beta-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.alerts-beta-col-head h3 {
  margin: 0;
}

.alerts-beta-quick-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.alerts-beta-note-modal {
  border: 1px solid var(--border);
  border-radius: 10px;
  width: min(520px, calc(100vw - 24px));
  padding: 12px;
  background: #fff;
}

.alerts-beta-note-modal::backdrop {
  background: rgba(15, 23, 42, 0.35);
}

.alerts-beta-note-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.alerts-beta-site-app-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.alerts-beta-site-app-list {
  display: grid;
  gap: 6px;
  max-height: min(52vh, 420px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: #fbfcff;
}

.alerts-beta-site-app-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #334155;
}

.alerts-beta-site-app-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #2f6adf;
}

.alerts-beta-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.alerts-beta-list-cards {
  margin-top: 10px;
  display: grid;
  gap: 8px;
  max-height: 66vh;
  overflow: auto;
  padding-right: 2px;
}

.alerts-beta-alert-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.alerts-beta-select-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
}

.alerts-beta-select-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #2f6adf;
}

.alerts-beta-select-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 12px;
  color: #5f6b7a;
}

.alerts-beta-select-all input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #2f6adf;
}

.alerts-beta-alert-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  padding: 10px;
}

.alerts-beta-alert-card:hover {
  border-color: #c7d5f4;
  background: #f8fbff;
}

.alerts-beta-alert-card.is-active {
  border-color: #8bb2ff;
  background: #eaf1ff;
  box-shadow: inset 0 0 0 1px rgba(79, 130, 248, 0.25);
}

.alerts-beta-alert-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.alerts-beta-alert-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sla-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid transparent;
}

.sla-ok {
  background: #e8f7ef;
  color: #1f7a4d;
  border-color: #bfe4cf;
}

.sla-risk {
  background: #fff7e6;
  color: #a35a00;
  border-color: #f4ddb3;
}

.sla-breach {
  background: #fdeaea;
  color: #a32828;
  border-color: #f3c6c6;
}

.sla-closed,
.sla-na {
  background: #eef1f5;
  color: #5a6473;
  border-color: #d9dfe8;
}

/* Severity chips */
.sev-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid transparent;
}

.sev-critical {
  background: #3b0a0a;
  color: #fff;
  border-color: #7f1d1d;
}

.sev-high {
  background: #fdeaea;
  color: #991b1b;
  border-color: #fca5a5;
}

.sev-medium {
  background: #fff7e6;
  color: #92400e;
  border-color: #fcd34d;
}

.sev-low {
  background: #f0f4ff;
  color: #3b4a82;
  border-color: #c7d5f4;
}

/* Preset views bar */
.alerts-beta-presets {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 14px;
  margin-bottom: 0;
}

.preset-link {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #fff;
  color: #3a4557;
  text-decoration: none;
  transition: background 0.1s;
}

.preset-link:hover {
  background: #f0f4ff;
  border-color: #a9bef4;
}

.preset-link.is-active {
  background: #2f6adf;
  color: #fff;
  border-color: #2259c8;
}

.alerts-beta-attention-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: linear-gradient(90deg, #fff7e6 0%, #fff 100%);
  border-color: #f4ddb3;
}

.alerts-beta-attention-bar a {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #f4ddb3;
  color: #92400e;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

.alerts-beta-collapsible-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  padding: 0;
  margin: 0;
}
.alerts-beta-collapsible-head::-webkit-details-marker { display: none; }
.alerts-beta-collapsible-head h3 {
  margin: 0;
}
.alerts-beta-collapsible-head::after {
  content: '▸';
  margin-left: auto;
  font-size: 12px;
  color: var(--muted-text, #888);
  transition: transform 0.15s;
}
details[open] > .alerts-beta-collapsible-head::after {
  content: '▾';
}

.alerts-beta-saved-views {
  display: grid;
  gap: 10px;
}
.alerts-beta-saved-views[open],
.alerts-beta-subscriptions[open] {
  gap: 10px;
}

.alerts-beta-saved-view-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.alerts-beta-save-view-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.alerts-beta-save-view-form input,
.alerts-beta-save-view-form select {
  min-width: 180px;
}

.alerts-beta-subscriptions {
  display: grid;
  gap: 10px;
}

/* ── Alert Notes Thread ───────────────────────────────────────── */
.alert-notes-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alert-note {
  background: var(--input-bg, #f9fafb);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
}

.alert-note-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 11px;
}

.alert-note-meta strong {
  font-size: 12px;
}

.alert-note-body {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

.alert-note-edit-form textarea {
  width: 100%;
  box-sizing: border-box;
}

a.note-edit-toggle {
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
}

.btn-link-danger {
  background: none;
  border: none;
  color: #dc2626;
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.btn-link-danger:hover {
  color: #991b1b;
}

.alerts-beta-digest-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.digest-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #cfe0ff;
  background: #f4f8ff;
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 700;
}

.sub-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fbfcff;
  font-size: 12px;
}

.alerts-beta-save-sub-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.alerts-beta-save-sub-form input[type="text"] {
  min-width: 240px;
}

.alerts-beta-save-sub-form label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #4b5565;
}

.alerts-beta-ops-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: 12px;
  align-items: start;
}

.alerts-beta-health-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.alerts-beta-load-table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfcff;
}

.alerts-beta-load-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.alerts-beta-load-table th,
.alerts-beta-load-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.alerts-beta-load-table th {
  color: #5b6472;
  font-size: 11px;
  font-weight: 700;
  background: #f8fafc;
}

.alerts-beta-load-table tbody tr:last-child td {
  border-bottom: 0;
}

/* Related alerts row in detail panel */
.alerts-beta-related {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.related-link {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #fff3e0;
  color: #92400e;
  border: 1px solid #fcd34d;
  text-decoration: none;
}

.related-link:hover {
  background: #fde68a;
}

  /* ── Phase 3: Judge explainability ── */
  .judge-conf-bar {
    display: inline-block;
    width: 52px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    vertical-align: middle;
  }

  .judge-conf-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #22c55e 0%, #eab308 60%, #ef4444 100%);
    border-radius: 999px;
  }

  .judge-threat-pill {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 10px;
    border-radius: 999px;
    background: #fff7e6;
    color: #92400e;
    border: 1px solid #fcd34d;
    font-size: 11px;
    font-weight: 600;
  }

  .judge-reasoning-details summary::-webkit-details-marker { display:none; }
  .judge-reasoning-details summary::marker { display:none; }

    /* ── Rule validation matrix ── */
    .judge-rule-matrix { margin-top:10px; padding-top:8px; border-top:1px solid var(--border,#d0d5dd); }
    .judge-rule-matrix-title { font-size:10px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:var(--muted,#667085); margin-bottom:6px; }
    .judge-rule-grid { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:6px 10px; max-height:220px; overflow-y:auto; padding-right:3px; }
    .judge-rule-item { display:grid; grid-template-columns:minmax(0,1fr) 20px; align-items:center; gap:6px; }
    .judge-rule-name { font-size:11px; line-height:1.3; color:var(--text,#111827); word-break:break-word; }
    .judge-rule-status { width:18px; height:18px; border-radius:999px; display:inline-flex; align-items:center; justify-content:center; font-size:11px; font-weight:700; justify-self:end; }
    .judge-rule-status.is-pass { background:#e6f7ed; color:#15803d; }
    .judge-rule-status.is-fail { background:#fde8e8; color:#b91c1c; }
    .judge-rule-item.is-disabled { opacity:.6; }
    .judge-rule-item.is-disabled .judge-rule-name { color:#6b7280; }
    .judge-rule-item.is-disabled .judge-rule-status { background:#e5e7eb; color:#6b7280; }
    @media (max-width: 900px) {
      .judge-rule-grid { grid-template-columns:minmax(0,1fr); }
    }

  /* ── AI Tips Ticker ── */
  .ai-tips-ticker {
    display: flex;
    align-items: center;
    overflow: hidden;
    background: #1e293b;
    border-bottom: 2px solid #334155;
    height: 34px;
    font-size: 12px;
    user-select: none;
  }
  .ticker-label {
    flex-shrink: 0;
    background: #0ea5e9;
    color: #fff;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.05em;
    padding: 0 14px;
    height: 100%;
    display: flex;
    align-items: center;
    white-space: nowrap;
    z-index: 1;
  }
  .ticker-track {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
  }
  .ticker-item {
    position: absolute;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    color: #cbd5e1;
    font-size: 12px;
    cursor: help;
    transform: translateX(110vw);
    animation: ticker-slide linear infinite;
  }
  .ticker-item:hover {
    animation-play-state: paused;
  }
  .ticker-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 1px 6px;
    border-radius: 3px;
    flex-shrink: 0;
  }
  .ticker-badge.do {
    background: #166534;
    color: #bbf7d0;
  }
  .ticker-badge.dont {
    background: #7f1d1d;
    color: #fecaca;
  }
  @keyframes ticker-slide {
    0%     { transform: translateX(110vw);  opacity: 0; }
    2%     { transform: translateX(110vw);  opacity: 1; }
    18%    { transform: translateX(-110vw); opacity: 1; }
    20%    { transform: translateX(-110vw); opacity: 0; }
    20.01% { transform: translateX(110vw);  opacity: 0; }
    100%   { transform: translateX(110vw);  opacity: 0; }
  }

  /* ── Footer or Page Content below ticker ── */
  .user-timeline {
    display: grid;
    gap: 4px;
  }

  .tl-row {
    display: grid;
    grid-template-columns: 52px minmax(0,1fr) auto auto;
    gap: 6px;
    align-items: center;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #fff;
    text-decoration: none;
    color: inherit;
    font-size: 11px;
  }

  .tl-row:hover {
    background: #f0f4ff;
    border-color: #a9bef4;
  }

  .tl-time {
    white-space: nowrap;
    font-size: 10px;
  }

  .tl-rule {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
  }

  /* ── Smart assignee suggestion ── */
  .smart-suggest {
    font-size: 11px;
    padding: 5px 8px;
    background: #f0f7ff;
    border: 1px solid #bdd7ff;
    border-radius: 6px;
    color: #1e3a5f;
  }

  .smart-suggest-use {
    color: #2563eb;
    text-decoration: underline;
  }

  /* ── Escalated status ── */
  .status-escalated {
    background: #f5f0ff;
    color: #6d28d9;
    border: 1px solid #c4b5fd;
  }

  .escalated-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: #f5f0ff;
    color: #6d28d9;
    border: 1px solid #c4b5fd;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
  }

.alerts-beta-alert-time {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.alerts-beta-alert-title {
  margin-top: 8px;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.35;
}

.alerts-beta-alert-meta {
  margin-top: 4px;
  font-size: 12px;
  color: #4b5565;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alerts-beta-alert-foot {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}

.alerts-beta-alert-id {
  color: #64748b;
  font-weight: 700;
}

.alerts-beta-table td,
.alerts-beta-table th {
  vertical-align: middle;
}

.alerts-beta-row-active td {
  background: #eaf1ff;
}

.alerts-beta-row-link {
  display: block;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

.alerts-beta-row-link:hover {
  color: #274a9e;
}

.alerts-beta-pre {
  margin: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8f9fc;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.45;
}

.text-translate-box {
  margin-top: 10px;
}

.text-translate-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.text-translate-status {
  font-size: 11px;
}

.text-translate-output[hidden] {
  display: none;
}

.alerts-beta-action-form {
  margin-bottom: 10px;
}

.alerts-beta-judge-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcff;
}

.alerts-beta-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

@media (max-width: 1380px) {
  .alerts-beta-ops-grid {
    grid-template-columns: 1fr;
  }

  .alerts-beta-grid {
    grid-template-columns: minmax(200px, 0.5fr) minmax(400px, 1.2fr);
  }

  .alerts-beta-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .alerts-beta-grid {
    grid-template-columns: 1fr;
  }

  .alerts-beta-actions {
    grid-column: auto;
  }
}

.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); }
}

@keyframes sidebarAlertBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

.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);
}

.login-primary-cta {
  width: auto;
  min-width: 260px;
  display: flex;
  margin-left: auto;
  margin-right: auto;
  justify-content: center;
  font-size: 14px;
  padding: 9px 16px;
}

.entra-logo-wrap {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.entra-logo {
  width: min(320px, 100%);
  max-height: 120px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 5px rgba(15, 23, 42, 0.18));
}

.login-fallback-btn {
  width: 100%;
  justify-content: center;
  font-weight: 500;
  opacity: 0.9;
}

.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; }
.direction-prompt { background: #e8f7ef; color: #166534; border-color: #bfe4cf; }
.direction-response { background: #fff7e6; color: #92400e; border-color: #f4ddb3; }
.direction-unknown { background: #eef1f5; color: #5a6473; border-color: #d9dfe8; }

.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;
}
