/* ============================================================
   CRN Design System — Enterprise / ChevLink-grade dashboard
   Corporate, data-dense, high-signal UI
   ============================================================ */

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

:root {
  /* Enterprise dark palette */
  --bg:       #0a0d12;
  --bg-1:     #0d1117;
  --bg-2:     #111820;
  --bg-3:     #161c26;
  --bg-4:     #1a222e;
  --bg-side:  #070a0f;

  --surface:        rgba(255,255,255,0.02);
  --surface-hover:  rgba(255,255,255,0.05);
  --surface-active: rgba(255,255,255,0.07);

  --border:        rgba(255,255,255,0.06);
  --border-med:    rgba(255,255,255,0.09);
  --border-strong: rgba(255,255,255,0.12);

  --text:       #f0f4f8;
  --text-muted: #6e7a8e;
  --text-dim:    #3d4756;
  --text-link:   #7ee8c9;

  --accent:     #7ee8c9;
  --accent-dim: rgba(126,232,201,0.06);
  --accent-glow: rgba(126,232,201,0.06);

  --division:     #7ee8c9;
  --division-dim: rgba(126,232,201,0.06);

  --crit: #f87171;
  --high: #fb923c;
  --med:  #fbbf24;
  --low:  #60a5fa;
  --ok:   #4ade80;
  --info: #38bdf8;

  --crit-dim: rgba(248,113,113,0.06);
  --high-dim: rgba(251,146,60,0.06);
  --med-dim:  rgba(251,191,36,0.06);
  --low-dim:  rgba(96,165,250,0.06);
  --ok-dim:   rgba(74,222,128,0.06);

  --sidebar-w: 268px;
  --topbar-h:  60px;
  --radius:    8px;
  --radius-sm: 6px;
  --radius-lg: 12px;

  --font:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --shadow:    0 1px 3px rgba(0,0,0,0.4);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.5);
  --glow-accent: none;
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
  letter-spacing: -0.01em;
  line-height: 1.5;
  font-weight: 400;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Hide number input spinners (member count etc.) site-wide */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button { appearance: none; }
input[type="number"]::-webkit-inner-spin-button { appearance: none; }
button { font-family: var(--font); cursor: pointer; border: none; outline: none; }
input, select, textarea { font-family: var(--font); outline: none; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* Minimal background — enterprise flat */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-1) 100%);
  pointer-events: none;
  z-index: 0;
}
body::after { display: none; }
.mouse-glow { opacity: 0; pointer-events: none; }
.bg-orbs { opacity: 0; }
.orb { display: none; }

/* ============================================================
   SHELL LAYOUT
   ============================================================ */
#shell {
  display: flex;
  height: 100vh;
  position: relative;
  z-index: 1;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-side);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 50;
}

@keyframes sidebarIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.sidebar::before { display: none; }

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
}

.sidebar-brand-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--division-dim);
  border: 1px solid var(--border-med);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--division);
  flex-shrink: 0;
}
.sidebar-brand-icon svg { width: 18px; height: 18px; }
.sidebar-brand-icon span { font-size: 18px; line-height: 1; }

.sidebar-brand-text { flex: 1; min-width: 0; }
.sidebar-brand-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.02em;
}
.sidebar-brand-sub {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-top: 2px;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--ok-dim);
  border: 1px solid rgba(74,222,128,0.2);
  border-radius: 6px;
  font-size: 11px;
  color: var(--ok);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.live-dot {
  width: 6px; height: 6px;
  background: var(--ok);
  border-radius: 50%;
  flex-shrink: 0;
}
@keyframes livePulse {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.7; }
}
.live-dot { animation: livePulse 2s ease-in-out infinite; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.nav-group-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  margin: 0 10px 2px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  border-left: 3px solid transparent;
  position: relative;
  user-select: none;
}
.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.nav-item.active {
  background: var(--surface-active);
  border-left-color: var(--division);
  color: var(--division);
}
.nav-item.active .nav-icon { color: var(--division); }

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color 0.12s;
}
.nav-icon svg { width: 16px; height: 16px; flex-shrink: 0; }

.nav-label {
  font-size: 13px;
  font-weight: 500;
  color: inherit;
  flex: 1;
  letter-spacing: -0.01em;
}

.nav-badge {
  display: none; /* shown by JS when count > 0; hidden when empty to avoid red bar */
  background: var(--crit);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
  animation: badgePop 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.nav-badge:not(:empty) { display: inline-block; }
@keyframes badgePop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  background: rgba(0,0,0,0.2);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.sidebar-avatar {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--surface-active);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.sidebar-actions { display: flex; gap: 8px; }

.btn-sidebar {
  flex: 1;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  text-align: center;
}
.btn-sidebar:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-med); }
.btn-sidebar.danger:hover { background: var(--crit-dim); color: var(--crit); border-color: rgba(248,113,113,0.3); }

/* ============================================================
   MAIN AREA
   ============================================================ */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
  position: relative;
  z-index: 40;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  letter-spacing: -0.025em;
}

.topbar-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 8px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.topbar-time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* ============================================================
   CONTENT AREA
   ============================================================ */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.panel { display: none; flex-direction: column; gap: 24px; }
.panel.active { display: flex; animation: panelIn 0.15s ease-out; }
@keyframes panelIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============================================================
   KPI CARDS
   ============================================================ */
.kpi-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
}

.kpi-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--division);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
  cursor: default;
}

.kpi-card::before { display: none; }

.kpi-card:hover {
  background: var(--bg-3);
  border-color: var(--border-med);
}

.kpi-card.kpi-crit { border-left-color: var(--crit); }
.kpi-card.kpi-warn { border-left-color: var(--med); }
.kpi-card.kpi-ok   { border-left-color: var(--ok); }
.kpi-card.kpi-info { border-left-color: var(--info); }

.kpi-icon {
  display: flex;
  align-items: center;
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1;
  color: var(--text-muted);
}
.kpi-icon svg { width: 18px; height: 18px; color: var(--text-muted); }

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.kpi-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kpi-trend {
  font-size: 11px;
  font-weight: 600;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.kpi-trend.up   { color: var(--crit); }
.kpi-trend.down { color: var(--ok); }
.kpi-trend.flat { color: var(--text-muted); }

/* ============================================================
   SECTION HEADERS
   ============================================================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}
.section-sub { font-size: 12px; color: var(--text-muted); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
  position: relative;
}
.card::before { display: none; }
.card:hover { border-color: var(--border-med); }

.card-header {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(0,0,0,0.15);
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}
.card-body { padding: 20px; }

/* ============================================================
   CHARTS
   ============================================================ */
.chart-grid   { display: grid; gap: 12px; }
.chart-grid-3 { display: grid; gap: 12px; grid-template-columns: 2fr 1fr 1fr; }
.chart-grid-2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }

.chart-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
.chart-card::before { display: none; }

.chart-header {
  padding: 13px 16px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chart-title { font-size: 12px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.chart-sub   { font-size: 11px; color: var(--text-muted); }
.chart-body  { padding: 12px; }

canvas.chart { width: 100%; display: block; border-radius: var(--radius-sm); }
/* Inline width/height (e.g. donut 140x140) override the above so fixed-size charts stay square */

.chart-legend { display: flex; flex-wrap: wrap; gap: 10px; padding: 8px 12px 12px; }
.legend-item  { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); }
.legend-dot   { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* ============================================================
   TABLES
   ============================================================ */
.table-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-toolbar {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: rgba(0,0,0,0.1);
}

.filter-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-1);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.filter-tab {
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  background: transparent;
  border: none;
  white-space: nowrap;
  font-family: var(--font);
}
.filter-tab:hover  { color: var(--text); }
.filter-tab.active { background: var(--surface-active); color: var(--text); }

.search-input {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text);
  min-width: 200px;
  transition: border-color 0.15s;
  font-family: var(--font);
}
.search-input::placeholder { color: var(--text-dim); }
.search-input:focus { border-color: var(--border-med); outline: none; }

/* Custom dropdowns: override system default, modern + animated */
.select-filter,
select.form-control,
.content select:not([multiple]) {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--bg-1);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%236b7a99' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, transform 0.12s ease;
}
.select-filter:hover,
select.form-control:hover,
.content select:not([multiple]):hover {
  border-color: var(--border-med);
  background-color: rgba(0,0,0,0.45);
}
.select-filter:focus,
select.form-control:focus,
.content select:not([multiple]):focus {
  border-color: var(--division);
  box-shadow: 0 0 0 2px var(--accent-dim);
  outline: none;
  transform: translateY(-1px);
}
.select-filter {
  background-color: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 32px 6px 12px;
  font-size: 12px;
  color: var(--text);
  font-family: var(--font);
  min-width: 140px;
}
select.form-control { min-height: 40px; }
.select-filter option,
select.form-control option {
  background: var(--bg-2);
  color: var(--text);
  padding: 8px 12px;
}
.tbl .row-escalated { opacity: 0.88; }
.tbl .row-escalated td { color: var(--text-muted); }
.ops-actions-cell .pill { margin-right: 4px; }

.table-wrap, .tbl-wrap { overflow-x: auto; }

.tbl, .crn-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tbl th, .crn-table th {
  padding: 14px 20px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
  font-family: var(--font);
  background: var(--bg-1);
}
.tbl td, .crn-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.tbl tbody tr:nth-child(even) td, .crn-table tbody tr:nth-child(even) td {
  background: rgba(255,255,255,0.01);
}
.tbl tr:last-child td, .crn-table tr:last-child td { border-bottom: none; }
.tbl tbody tr, .crn-table tbody tr { transition: background 0.1s; }
.tbl tbody tr:hover td, .crn-table tbody tr:hover td { background: var(--surface-hover); }
.tbl tbody tr:hover td:nth-child(even), .crn-table tbody tr:hover td:nth-child(even) { background: var(--surface-hover); }

.row-in { }

.tbl tbody tr:hover, .crn-table tbody tr:hover { background: var(--surface-hover); }
.tbl .mono, .crn-table .mono { font-family: var(--font-mono); font-size: 11px; color: var(--text); }

.tbl-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 13px;
}

.tbl-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0,0,0,0.08);
}

/* ============================================================
   BADGES & PILLS
   ============================================================ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  font-family: var(--font);
}

/* Status */
.pill-new       { background: rgba(137,180,250,0.14); color: #89b4fa; border: 1px solid rgba(137,180,250,0.28); }
.pill-triaging  { background: rgba(249,226,175,0.14); color: #f9e2af; border: 1px solid rgba(249,226,175,0.28); }
.pill-active    { background: rgba(166,243,218,0.11); color: #A6F3DA; border: 1px solid rgba(166,243,218,0.28); }
.pill-pending   { background: rgba(203,166,247,0.11); color: #cba6f7; border: 1px solid rgba(203,166,247,0.28); }
.pill-resolved  { background: rgba(166,227,161,0.11); color: #a6e3a1; border: 1px solid rgba(166,227,161,0.28); }
.pill-closed    { background: rgba(255,255,255,0.04); color: #6b7a99; border: 1px solid rgba(255,255,255,0.08); }
.pill-escalated { background: rgba(243,139,168,0.14); color: #f38ba8; border: 1px solid rgba(243,139,168,0.28); }
.pill-open      { background: rgba(137,220,235,0.11); color: #89dceb; border: 1px solid rgba(137,220,235,0.28); }

/* Severity */
.pill-critical { background: rgba(243,139,168,0.14); color: #f38ba8; border: 1px solid rgba(243,139,168,0.32); }
.pill-high     { background: rgba(250,179,135,0.14); color: #fab387; border: 1px solid rgba(250,179,135,0.32); }
.pill-medium   { background: rgba(249,226,175,0.14); color: #f9e2af; border: 1px solid rgba(249,226,175,0.28); }
.pill-low      { background: rgba(137,180,250,0.11); color: #89b4fa; border: 1px solid rgba(137,180,250,0.24); }
.pill-info     { background: rgba(137,220,235,0.11); color: #89dceb; border: 1px solid rgba(137,220,235,0.24); }

/* Types */
.pill-csam          { background: rgba(243,139,168,0.18); color: #f38ba8; border: 1px solid rgba(243,139,168,0.38); }
.pill-grooming      { background: rgba(250,179,135,0.14); color: #fab387; border: 1px solid rgba(250,179,135,0.28); }
.pill-harassment    { background: rgba(249,226,175,0.14); color: #f9e2af; border: 1px solid rgba(249,226,175,0.28); }
.pill-raid          { background: rgba(243,139,168,0.11); color: #f38ba8; border: 1px solid rgba(243,139,168,0.24); }
.pill-scam          { background: rgba(137,220,235,0.11); color: #89dceb; border: 1px solid rgba(137,220,235,0.24); }
.pill-impersonation { background: rgba(203,166,247,0.11); color: #cba6f7; border: 1px solid rgba(203,166,247,0.24); }
.pill-doxxing       { background: rgba(235,160,172,0.14); color: #eba0ac; border: 1px solid rgba(235,160,172,0.28); }
.pill-spam          { background: rgba(180,190,254,0.11); color: #b4befe; border: 1px solid rgba(180,190,254,0.24); }
.pill-abuse         { background: rgba(245,194,231,0.14); color: #f5c2e7; border: 1px solid rgba(245,194,231,0.28); }
.pill-self_harm     { background: rgba(243,139,168,0.14); color: #f38ba8; border: 1px solid rgba(243,139,168,0.28); }
.pill-violent_threat { background: rgba(243,139,168,0.12); color: #f38ba8; border: 1px solid rgba(243,139,168,0.26); }
.pill-other         { background: rgba(255,255,255,0.04); color: #6b7a99; border: 1px solid rgba(255,255,255,0.08); }

/* Roles */
.pill-superadmin       { background: rgba(243,139,168,0.16); color: #f38ba8; border: 1px solid rgba(243,139,168,0.32); }
.pill-executive        { background: rgba(203,166,247,0.14); color: #cba6f7; border: 1px solid rgba(203,166,247,0.28); }
.pill-director         { background: rgba(166,243,218,0.14); color: #A6F3DA; border: 1px solid rgba(166,243,218,0.28); }
.pill-admin            { background: rgba(250,179,135,0.14); color: #fab387; border: 1px solid rgba(250,179,135,0.28); }
.pill-safeguarding     { background: rgba(243,139,168,0.11); color: #f38ba8; border: 1px solid rgba(243,139,168,0.24); }
.pill-ops              { background: rgba(137,180,250,0.11); color: #89b4fa; border: 1px solid rgba(137,180,250,0.24); }
.pill-support          { background: rgba(137,220,235,0.11); color: #89dceb; border: 1px solid rgba(137,220,235,0.24); }
.pill-hr               { background: rgba(203,166,247,0.11); color: #cba6f7; border: 1px solid rgba(203,166,247,0.24); }
.pill-pr               { background: rgba(249,226,175,0.11); color: #f9e2af; border: 1px solid rgba(249,226,175,0.24); }
.pill-security         { background: rgba(243,139,168,0.11); color: #f38ba8; border: 1px solid rgba(243,139,168,0.2); }
.pill-staff            { background: rgba(255,255,255,0.04); color: #6b7a99; border: 1px solid rgba(255,255,255,0.09); }
.pill-junior           { background: rgba(255,255,255,0.03); color: #3d4a66; border: 1px solid rgba(255,255,255,0.07); }
.pill-partner          { background: rgba(232,184,75,0.14);  color: #e8b84b; border: 1px solid rgba(232,184,75,0.32); }
.pill-technology       { background: rgba(137,220,235,0.11); color: #89dceb; border: 1px solid rgba(137,220,235,0.26); }
.pill-tech             { background: rgba(137,220,235,0.11); color: #89dceb; border: 1px solid rgba(137,220,235,0.26); }
.pill-community_director { background: rgba(137,220,235,0.11); color: #89dceb; border: 1px solid rgba(137,220,235,0.26); }
.pill-operations       { background: rgba(137,180,250,0.11); color: #89b4fa; border: 1px solid rgba(137,180,250,0.24); }

/* Priority */
.pill-urgent { background: rgba(243,139,168,0.18); color: #f38ba8; border: 1px solid rgba(243,139,168,0.38); }

/* ============================================================
   FLAG ICONS
   ============================================================ */
.flag { font-size: 13px; cursor: default; }
.flag-urgent    { color: var(--crit); }
.flag-safeguard { color: var(--high); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  transition: all 0.15s ease;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.btn-primary   { background: var(--division); color: #0a0e14; border-color: var(--division); }
.btn-primary:hover { filter: brightness(1.08); }

.btn-ghost { background: var(--surface); color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-med); }

.btn-danger { background: var(--crit-dim); color: var(--crit); border-color: rgba(243,139,168,0.28); }
.btn-danger:hover { background: rgba(243,139,168,0.18); }

.btn-warn { background: var(--high-dim); color: var(--high); border-color: rgba(250,179,135,0.28); }
.btn-warn:hover { background: rgba(250,179,135,0.18); }

.btn-ok { background: var(--ok-dim); color: var(--ok); border-color: rgba(166,227,161,0.28); }
.btn-ok:hover { background: rgba(166,227,161,0.18); }

.btn-sm   { padding: 4px 10px; font-size: 11px; }
.btn-xs   { padding: 2px 7px;  font-size: 10px; }
.btn-icon { padding: 6px; min-width: 30px; justify-content: center; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group  { display: flex; flex-direction: column; gap: 5px; }
.form-label  { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; }

.form-control {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  width: 100%;
  transition: border-color 0.15s;
  font-family: var(--font);
}
.form-control::placeholder { color: var(--text-dim); }
.form-control:focus { border-color: var(--division); box-shadow: 0 0 0 2px var(--accent-dim); outline: none; }

textarea.form-control { resize: vertical; min-height: 80px; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: overlayIn 0.18s ease;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 540px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.22s cubic-bezier(0.34,1.56,0.64,1);
  position: relative;
}
.modal::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.025) 0%, transparent 50%);
  pointer-events: none;
  border-radius: inherit;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 15px; font-weight: 600; color: var(--text); letter-spacing: -0.02em; }
.modal-close {
  width: 28px; height: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--surface-hover); color: var(--text); }
.modal-body   { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ============================================================
   TOAST
   ============================================================ */
#toast-root {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-3);
  border: 1px solid var(--border-med);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 12px;
  color: var(--text);
  pointer-events: all;
  animation: toastIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
  min-width: 240px;
  max-width: 380px;
  font-family: var(--font);
}
.toast.out { animation: toastOut 0.2s ease forwards; }

@keyframes toastIn  { from { opacity: 0; transform: translateX(18px) scale(0.95); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes toastOut { to   { opacity: 0; transform: translateX(18px); } }

.toast-icon { font-size: 14px; flex-shrink: 0; }
.toast-msg  { flex: 1; }
.toast.toast-ok   { border-left: 3px solid var(--ok); }
.toast.toast-err  { border-left: 3px solid var(--crit); }
.toast.toast-warn { border-left: 3px solid var(--high); }
.toast.toast-info { border-left: 3px solid var(--low); }

/* ============================================================
   LOADING / SKELETON
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.035) 25%, rgba(255,255,255,0.065) 50%, rgba(255,255,255,0.035) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  border-radius: 4px;
  display: block;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.skeleton-row { height: 36px; margin-bottom: 2px; }
.skeleton-kpi { height: 80px; }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--division);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   STATUS INDICATORS
   ============================================================ */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.ok   { background: var(--ok);   box-shadow: 0 0 6px var(--ok); }
.status-dot.warn { background: var(--med);  box-shadow: 0 0 6px var(--med); }
.status-dot.err  { background: var(--crit); box-shadow: 0 0 6px var(--crit); }
.status-dot.off  { background: var(--text-dim); }

/* ============================================================
   ALERTS / BANNERS
   ============================================================ */
.alert {
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid;
  font-size: 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-crit { background: rgba(243,139,168,0.07); border-color: rgba(243,139,168,0.28); color: #f38ba8; }
.alert-warn { background: rgba(249,226,175,0.07); border-color: rgba(249,226,175,0.28); color: #f9e2af; }
.alert-ok   { background: rgba(166,227,161,0.07); border-color: rgba(166,227,161,0.28); color: #a6e3a1; }
.alert-info { background: rgba(137,180,250,0.07); border-color: rgba(137,180,250,0.28); color: #89b4fa; }
.alert-icon { font-size: 15px; flex-shrink: 0; }

/* ============================================================
   DIVIDER
   ============================================================ */
.divider   { height: 1px; background: var(--border); margin: 4px 0; }
.divider-v { width: 1px; background: var(--border); align-self: stretch; }

/* ============================================================
   LOCK / REDACTED
   ============================================================ */
.redacted {
  background: rgba(243,139,168,0.1);
  border: 1px solid rgba(243,139,168,0.22);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 11px;
  color: rgba(243,139,168,0.7);
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
}

/* ============================================================
   COMPLIANCE CHECKS
   ============================================================ */
.comp-list { display: flex; flex-direction: column; gap: 1px; }
.comp-check {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.comp-check:hover { background: var(--surface-hover); }
.comp-icon  { font-size: 15px; flex-shrink: 0; }
.comp-label { flex: 1; font-size: 12px; color: var(--text); font-weight: 500; }
.comp-ref   { font-size: 10px; color: var(--text-dim); font-family: var(--font-mono); }
.comp-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 99px; text-transform: uppercase; letter-spacing: 0.06em; }
.comp-pass .comp-badge { background: rgba(166,227,161,0.14); color: #a6e3a1; }
.comp-fail .comp-badge { background: rgba(243,139,168,0.14); color: #f38ba8; }
.comp-warn .comp-badge { background: rgba(249,226,175,0.14); color: #f9e2af; }

/* ============================================================
   DETAIL ROW (key-value)
   ============================================================ */
.detail-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-item  { display: flex; flex-direction: column; gap: 3px; }
.detail-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 700; }
.detail-value { font-size: 13px; color: var(--text); }
.detail-value.mono { font-family: var(--font-mono); font-size: 12px; }

/* ============================================================
   TIMELINE
   ============================================================ */
.timeline { display: flex; flex-direction: column; }
.timeline-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  position: relative;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 30px; bottom: 0;
  width: 1px;
  background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--surface-active);
  border: 1px solid var(--border-med);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.timeline-content { flex: 1; padding-top: 5px; }
.timeline-title { font-size: 12px; font-weight: 600; color: var(--text); }
.timeline-meta  { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* ============================================================
   UTILITY
   ============================================================ */
.flex             { display: flex; }
.items-center     { align-items: center; }
.justify-between  { justify-content: space-between; }
.gap-2            { gap: 8px; }
.gap-3            { gap: 12px; }
.flex-1           { flex: 1; }

.text-ok    { color: var(--ok); }
.text-crit  { color: var(--crit); }
.text-high  { color: var(--high); }
.text-med   { color: var(--med); }
.text-low   { color: var(--low); }
.text-dim   { color: var(--text-dim); }
.text-muted { color: var(--text-muted); }
.text-mono  { font-family: var(--font-mono); }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   LOADING STATE
   ============================================================ */
body.loading #shell { pointer-events: none; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.6;
}
.empty-state-icon { font-size: 28px; margin-bottom: 10px; opacity: 0.6; display: flex; align-items: center; justify-content: center; }
.empty-state-icon svg { width: 32px; height: 32px; min-width: 32px; max-width: 48px; max-height: 48px; }
.nav-icon svg, .kpi-icon svg { max-width: 100%; max-height: 100%; object-fit: contain; }
.sidebar-brand-icon svg { max-width: 100%; max-height: 100%; }

/* ============================================================
   SUSPENDED OVERLAY (dashboard: empty shell + blurred overlay + modal)
   ============================================================ */
.crn-suspended-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: crn-suspended-fade 0.35s ease-out;
}
@keyframes crn-suspended-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.crn-suspended-modal {
  width: 100%;
  max-width: 420px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
  animation: crn-suspended-modal-in 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes crn-suspended-modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.crn-suspended-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: rgba(248, 113, 113, 0.15);
  border: 2px solid var(--crit);
  display: flex;
  align-items: center;
  justify-content: center;
}
.crn-suspended-excl {
  font-size: 28px;
  font-weight: 700;
  color: var(--crit);
  line-height: 1;
}

.crn-suspended-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--crit);
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}

.crn-suspended-msg {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0 0 24px;
  text-align: center;
}

.crn-suspended-btn-exit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font);
  color: #fff;
  background: var(--crit);
  border: none;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.crn-suspended-btn-exit:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(248, 113, 113, 0.35);
  color: #fff;
  text-decoration: none;
}
.crn-suspended-btn-exit:active {
  transform: translateY(0);
}

/* ============================================================
   Welcome back / While you were away overlay
   ============================================================ */
.crn-welcome-back-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 9, 12, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.crn-welcome-back-backdrop.show { opacity: 1; }
.crn-welcome-back-backdrop.hide { opacity: 0; pointer-events: none; }
.crn-welcome-back-card {
  max-width: 420px;
  width: 100%;
  background: linear-gradient(160deg, var(--bg-2) 0%, var(--bg-3) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 26px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: scale(0.96) translateY(12px);
  transition: opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1), transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.crn-welcome-back-backdrop.show .crn-welcome-back-card {
  opacity: 1;
  transform: scale(1) translateY(0);
}
.crn-welcome-back-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.crn-welcome-back-sub {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0 0 20px;
}
.crn-welcome-back-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.crn-welcome-back-stat {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  opacity: 0;
  transform: translateY(8px);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.crn-welcome-back-stat:hover { border-color: var(--border-med); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); }
.crn-welcome-back-stat-val {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text);
  line-height: 1.2;
}
.crn-welcome-back-stat-lbl {
  font-size: 0.625rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}
.crn-welcome-back-stat.anim-1 { animation: crnWelcomeStatIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.15s forwards; }
.crn-welcome-back-stat.anim-2 { animation: crnWelcomeStatIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.25s forwards; }
.crn-welcome-back-stat.anim-3 { animation: crnWelcomeStatIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.35s forwards; }
.crn-welcome-back-stat.anim-4 { animation: crnWelcomeStatIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.45s forwards; }
@keyframes crnWelcomeStatIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.crn-welcome-back-close-wrap {
  opacity: 0;
  transition: opacity 0.35s ease 0.5s;
}
.crn-welcome-back-backdrop.show .crn-welcome-back-close-wrap { opacity: 1; }
.crn-welcome-back-close {
  width: 100%;
  padding: 12px 20px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--bg);
  background: var(--division);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.crn-welcome-back-close:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.crn-welcome-back-close:active { transform: translateY(0); }


/* ============================================================
   MOBILE BLOCKER — dashboard is desktop-only
   Shown on screens ≤ 768px OR mobile user-agents.
   Injected into the DOM by crn-core.js before auth loads.
   ============================================================ */
.crn-mob-block {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: var(--bg, #0a0d12);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 2rem;
  gap: 1.25rem;
}
.crn-mob-block-logo {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: contain;
  margin-bottom: 0.5rem;
}
.crn-mob-block-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text, #f0f4f8);
  letter-spacing: -0.02em;
}
.crn-mob-block-body {
  font-size: 0.9375rem;
  color: var(--text-muted, #6e7a8e);
  line-height: 1.6;
  max-width: 30ch;
}
.crn-mob-block-btn {
  margin-top: 0.5rem;
  padding: 0.75rem 2rem;
  background: var(--accent, #7ee8c9);
  color: #0a0d12;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.crn-mob-block-btn:hover { opacity: 0.85; }
