/* ==========================================================================
   Sentinel AML — analyst console
   ========================================================================== */
:root {
  --bg: #f2f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --ink: #0f1b2d;
  --ink-2: #243349;
  --muted: #64748b;
  --muted-2: #8b98ab;
  --navy: #0b1726;
  --navy-2: #0f1e31;
  --navy-3: #15273d;
  --navy-line: #22344c;
  --teal: #0f766e;
  --teal-bright: #14b8a6;
  --teal-soft: #e7f8f5;
  --blue: #1d4ed8;
  --blue-soft: #eef4ff;
  --amber: #b45309;
  --amber-soft: #fff7e8;
  --red: #b91c1c;
  --red-soft: #fef2f2;
  --purple: #6d28d9;
  --purple-soft: #f5f0ff;
  --green: #15803d;
  --green-soft: #effaf2;
  --shadow-sm: 0 1px 2px rgba(15, 27, 45, .05);
  --shadow: 0 1px 3px rgba(15, 27, 45, .06), 0 8px 24px rgba(15, 27, 45, .04);
  --shadow-lg: 0 24px 70px rgba(8, 20, 36, .22);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 250px;
  --font: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
svg { display: block; }

/* Layout ------------------------------------------------------------------ */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background:
    radial-gradient(600px 260px at 10% -10%, rgba(20, 184, 166, .12), transparent 65%),
    linear-gradient(180deg, var(--navy) 0%, #091421 100%);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  border-right: 1px solid #0a1422;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 22px 20px 18px;
}
.brand-mark { color: var(--teal-bright); filter: drop-shadow(0 0 12px rgba(45,212,191,.25)); }
.brand-name { color: #f8fafc; font-weight: 740; letter-spacing: -.02em; font-size: 17px; line-height: 1.1; }
.brand-name span { color: var(--teal-bright); margin-left: 2px; }
.brand-sub { color: #6d829b; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; margin-top: 3px; font-weight: 600; }
.nav { padding: 4px 12px; flex: 1; overflow-y: auto; }
.nav-group {
  padding: 18px 10px 7px; font-size: 10.5px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: #5b7089;
}
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px;
  border-radius: 8px; color: #a8b8ca; font-weight: 560; font-size: 13.5px;
  margin-bottom: 2px; transition: background .15s, color .15s; position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #edf2f7; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(20,184,166,.17), rgba(20,184,166,.05));
  color: #ecfeff;
}
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--teal-bright);
}
.nav-icon { width: 17px; height: 17px; opacity: .92; flex: none; }
.nav-icon svg { width: 17px; height: 17px; }
.nav-badge {
  margin-left: auto; background: #1f3550; color: #dbeafe; font-size: 10.5px;
  font-weight: 700; border-radius: 20px; padding: 1px 7px; min-width: 22px; text-align: center;
}
.nav-badge.warn { background: #4a2a13; color: #fbbf24; }
.nav-badge.hot { background: #491a1a; color: #fca5a5; }
.sidebar-footer { padding: 14px 18px 18px; border-top: 1px solid rgba(255,255,255,.06); }
.env-pill {
  display: inline-flex; align-items: center; gap: 7px; font-size: 9.5px; font-weight: 700;
  letter-spacing: .09em; color: #5eead4; background: rgba(20,184,166,.08);
  border: 1px solid rgba(20,184,166,.18); border-radius: 20px; padding: 4px 9px;
}
.pulse { width: 5px; height: 5px; background: #2dd4bf; border-radius: 50%; box-shadow: 0 0 0 3px rgba(45,212,191,.14); }
.model-foot { margin-top: 14px; }
.model-foot-label { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: #5b7089; font-weight: 700; }
.model-foot-value { font-family: var(--mono); font-size: 11px; color: #94a9c0; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; }

.main-wrap { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
  height: 62px; background: rgba(255,255,255,.88); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 18px;
  padding: 0 28px; position: sticky; top: 0; z-index: 40;
}
.crumbs { font-size: 13px; color: var(--ink-2); font-weight: 560; white-space: nowrap; }
.crumb-muted { color: var(--muted-2); font-weight: 500; }
.crumb-sep { margin: 0 7px; color: #cbd5e1; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border: 1px solid transparent; background: transparent; border-radius: 8px; color: var(--muted);
  cursor: pointer; transition: .15s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }
.menu-btn { display: none; }

.global-search { position: relative; width: 340px; }
.global-search input {
  width: 100%; height: 36px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface-2); padding: 0 54px 0 34px; font-size: 12.5px; outline: none;
  transition: .15s;
}
.global-search input:focus { border-color: #99d5ce; box-shadow: 0 0 0 3px rgba(20,184,166,.10); background: #fff; }
.search-icon { position: absolute; left: 11px; top: 10px; color: var(--muted-2); pointer-events: none; }
.search-icon svg { width: 15px; height: 15px; }
.global-search kbd {
  position: absolute; right: 8px; top: 8px; font-family: var(--font); font-size: 10px;
  color: var(--muted-2); background: #fff; border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 5px;
}
.search-results {
  position: absolute; top: 42px; left: 0; right: 0; background: #fff; border: 1px solid var(--line);
  border-radius: 11px; box-shadow: var(--shadow-lg); padding: 7px; max-height: 440px; overflow: auto; z-index: 80;
}
.search-group-label { font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); font-weight: 700; padding: 8px 9px 4px; }
.search-result {
  display: block; padding: 8px 9px; border-radius: 7px; cursor: pointer; font-size: 12.5px;
}
.search-result:hover { background: var(--surface-2); }
.search-result strong { display: block; font-weight: 650; color: var(--ink); }
.search-result span { color: var(--muted); font-size: 11px; }
.search-empty { padding: 16px; color: var(--muted); font-size: 12.5px; text-align: center; }

.analyst { display: flex; align-items: center; gap: 9px; padding-left: 10px; border-left: 1px solid var(--line); cursor: pointer; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, #0f766e, #0e7490); color: #fff; font-size: 11px; font-weight: 750;
  letter-spacing: .02em;
}
.analyst-name { font-size: 12px; font-weight: 650; line-height: 1.2; }
.analyst-role { font-size: 10.5px; color: var(--muted); }
.content { padding: 26px 30px 64px; max-width: 1680px; width: 100%; margin: 0 auto; outline: none; }

/* Typography / headings --------------------------------------------------- */
.page-head { display: flex; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
.page-head-copy { min-width: 0; }
.page-eyebrow { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--teal); font-weight: 750; margin-bottom: 5px; }
.page-title { font-size: 25px; line-height: 1.2; letter-spacing: -.025em; font-weight: 740; color: var(--ink); }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 5px; max-width: 760px; }
.page-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.section-title { font-size: 13.5px; font-weight: 700; letter-spacing: -.01em; }
.section-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.strong { font-weight: 700; }
.tiny { font-size: 11px; }
.small { font-size: 12px; }

/* Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink-2); font-size: 12.5px; font-weight: 620;
  cursor: pointer; transition: .15s; white-space: nowrap; box-shadow: var(--shadow-sm);
}
.btn:hover { border-color: #b6c2d3; background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: #16283f; border-color: #16283f; }
.btn-teal { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-teal:hover { background: #0d6b63; border-color: #0d6b63; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #991b1b; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.btn-sm { height: 28px; padding: 0 9px; font-size: 11.5px; border-radius: 6px; }
.btn-sm svg { width: 12px; height: 12px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: none; color: var(--teal); font-weight: 650; font-size: 12px; cursor: pointer; padding: 0; }
.btn-link:hover { text-decoration: underline; }

/* Cards ------------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: flex-start; gap: 16px; padding: 16px 18px 13px;
  border-bottom: 1px solid #eef2f6;
}
.card-head.plain { border-bottom: 0; padding-bottom: 0; }
.card-title { font-size: 13.5px; font-weight: 700; letter-spacing: -.01em; }
.card-sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.card-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 17px 18px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 11px 18px; border-top: 1px solid #eef2f6; display: flex; align-items: center; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }

/* KPI --------------------------------------------------------------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 13px; margin-bottom: 16px; }
.kpi-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
  padding: 15px 16px 13px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.kpi-card::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--accent, var(--teal));
}
.kpi-card.critical { --accent: #dc2626; }
.kpi-card.high { --accent: #ea580c; }
.kpi-card.medium { --accent: #d97706; }
.kpi-card.info { --accent: #2563eb; }
.kpi-card.neutral { --accent: #64748b; }
.kpi-label { font-size: 10.5px; font-weight: 700; letter-spacing: .065em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 23px; font-weight: 740; letter-spacing: -.03em; margin-top: 7px; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-value .unit { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 0; margin-left: 2px; }
.kpi-delta { display: inline-flex; align-items: center; gap: 4px; margin-top: 7px; font-size: 11px; font-weight: 620; color: var(--muted); }
.kpi-delta.up { color: var(--green); } .kpi-delta.down { color: var(--red); }
.kpi-foot { color: var(--muted-2); font-size: 10.5px; margin-top: 5px; }
.kpi-icon {
  position: absolute; right: 13px; top: 13px; width: 28px; height: 28px; border-radius: 8px;
  background: var(--surface-3); color: var(--muted); display: flex; align-items: center; justify-content: center;
}
.kpi-icon svg { width: 14px; height: 14px; }

/* Badges / chips ---------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 5px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
  background: var(--surface-3); color: var(--muted); border: 1px solid transparent;
}
.badge .dot { width: 5px; height: 5px; }
.badge-critical { background: var(--red-soft); color: #a11616; border-color: #fbd5d5; }
.badge-high { background: #fff4ea; color: #b54708; border-color: #fde3c8; }
.badge-medium { background: var(--amber-soft); color: #92400e; border-color: #fce7bb; }
.badge-low { background: var(--green-soft); color: #166534; border-color: #d5efdc; }
.badge-info { background: var(--blue-soft); color: #1e40af; border-color: #dbe7ff; }
.badge-success { background: var(--green-soft); color: #166534; border-color: #d5efdc; }
.badge-warn { background: var(--amber-soft); color: #92400e; border-color: #fce7bb; }
.badge-neutral { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.badge-purple { background: var(--purple-soft); color: #5b21b6; border-color: #e4d8fd; }
.badge-outline { background: transparent; border-color: var(--line-strong); color: var(--muted); }
.badge.sm { font-size: 9.5px; padding: 1px 6px; }
.badge.lg { font-size: 11.5px; padding: 4px 9px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }
.dot.critical { color: #dc2626; } .dot.high { color: #ea580c; }
.dot.medium { color: #d97706; } .dot.low { color: #16a34a; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border-radius: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font-size: 11.5px; font-weight: 600; cursor: pointer; transition: .15s; white-space: nowrap;
}
.chip:hover { border-color: #b8c5d6; color: var(--ink); }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip .count { font-size: 10px; background: rgba(0,0,0,.07); padding: 0 5px; border-radius: 10px; }
.chip.active .count { background: rgba(255,255,255,.16); }

/* Tables ------------------------------------------------------------------ */
.table-wrap { width: 100%; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th {
  text-align: left; padding: 9px 14px; background: var(--surface-2); color: var(--muted);
  font-size: 9.5px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase;
  border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid #eef2f6; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover { background: #f8fbff; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td.mono, table.data th.mono { font-family: var(--mono); font-size: 11px; }
.cell-title { font-weight: 650; color: var(--ink); }
.cell-sub { color: var(--muted); font-size: 10.5px; margin-top: 1px; }
.entity-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.entity-avatar {
  width: 28px; height: 28px; border-radius: 8px; background: var(--surface-3);
  color: var(--muted); display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 750; flex: none; letter-spacing: .02em;
}
.entity-avatar.teal { background: var(--teal-soft); color: var(--teal); }
.entity-avatar.red { background: var(--red-soft); color: var(--red); }
.entity-avatar.blue { background: var(--blue-soft); color: var(--blue); }
.entity-avatar.purple { background: var(--purple-soft); color: var(--purple); }
.score-pill { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; font-weight: 680; }
.score-pill .bar { width: 34px; height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.score-pill .bar i { display: block; height: 100%; background: var(--teal); border-radius: 2px; }

/* Toolbar / filters ------------------------------------------------------- */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 13px; }
.toolbar .spacer { flex: 1; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
input.input, select.input, textarea.input {
  height: 34px; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff;
  padding: 0 10px; font-size: 12.5px; outline: none; transition: .15s; min-width: 0;
}
textarea.input { height: auto; padding: 9px 10px; resize: vertical; min-height: 78px; line-height: 1.45; }
input.input:focus, select.input:focus, textarea.input:focus { border-color: #7dd3c7; box-shadow: 0 0 0 3px rgba(20,184,166,.1); }
input.input::placeholder, textarea.input::placeholder { color: var(--muted-2); }
.search-field { position: relative; }
.search-field input { padding-left: 31px; width: 250px; }
.search-field .icon { position: absolute; left: 10px; top: 10px; color: var(--muted-2); }
.search-field .icon svg { width: 14px; height: 14px; }
.select-wrap { position: relative; }
.select-wrap select { appearance: none; padding-right: 27px; }
.select-wrap::after {
  content: ""; position: absolute; right: 10px; top: 14px; border-left: 4px solid transparent;
  border-right: 4px solid transparent; border-top: 5px solid var(--muted); pointer-events: none;
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-grid .full { grid-column: 1 / -1; }
.form-note { font-size: 11px; color: var(--muted); line-height: 1.5; }
.help-note {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; color: var(--muted); font-size: 11.5px; line-height: 1.55;
}
.help-note strong { color: var(--ink-2); }

/* Tabs -------------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab {
  padding: 9px 13px; border: none; background: none; color: var(--muted); font-size: 12.5px;
  font-weight: 620; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--teal); border-bottom-color: var(--teal); }
.tab .count { font-size: 10px; background: var(--surface-3); border-radius: 10px; padding: 1px 6px; margin-left: 4px; color: var(--muted); }
.tab.active .count { background: var(--teal-soft); color: var(--teal); }

/* Progress / bars --------------------------------------------------------- */
.progress { height: 5px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 4px; background: var(--teal); transition: width .35s; }
.progress.lg { height: 8px; }
.progress.amber i { background: #d97706; }
.progress.red i { background: #dc2626; }
.progress.blue i { background: #2563eb; }
.feature-bar { display: grid; grid-template-columns: 150px 1fr 42px; align-items: center; gap: 10px; font-size: 11px; margin-bottom: 7px; }
.feature-bar span:first-child { color: var(--muted); }
.feature-bar .val { text-align: right; font-family: var(--mono); font-size: 10.5px; color: var(--ink-2); }

/* Score / rings ----------------------------------------------------------- */
.score-ring { position: relative; width: 74px; height: 74px; flex: none; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-ring .num { font-size: 18px; font-weight: 750; letter-spacing: -.03em; line-height: 1; }
.score-ring .lbl { font-size: 8px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-top: 2px; }

/* Lists ------------------------------------------------------------------- */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px;
  border-bottom: 1px solid #eef2f6; transition: background .12s;
}
.list-row:last-child { border-bottom: 0; }
.list-row.clickable { cursor: pointer; }
.list-row.clickable:hover { background: #f8fbff; }
.list-main { min-width: 0; flex: 1; }
.list-title { font-size: 12.5px; font-weight: 630; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-sub { color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.list-meta { text-align: right; flex: none; }

/* Timeline ---------------------------------------------------------------- */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 5px; bottom: 5px; width: 1px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute; left: -20px; top: 4px; width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid #fff; background: var(--muted-2); box-shadow: 0 0 0 1px var(--line);
}
.tl-dot.critical { background: #dc2626; } .tl-dot.high { background: #ea580c; }
.tl-dot.medium { background: #d97706; } .tl-dot.low, .tl-dot.info { background: #16a34a; }
.tl-title { font-size: 12.5px; font-weight: 640; }
.tl-meta { color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.tl-desc { color: var(--ink-2); font-size: 11.5px; margin-top: 4px; line-height: 1.5; }

/* Definition lists -------------------------------------------------------- */
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; font-size: 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 560; color: var(--ink-2); text-align: right; }
.kv.wide { grid-template-columns: 160px 1fr; }
.kv.wide dd { text-align: left; }

/* Customer header --------------------------------------------------------- */
.customer-hero {
  background:
    radial-gradient(700px 220px at 90% -40%, rgba(20,184,166,.12), transparent 60%),
    #fff;
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 22px; display: flex; gap: 18px; align-items: flex-start; margin-bottom: 16px;
}
.customer-avatar {
  width: 56px; height: 56px; border-radius: 14px; flex: none; display: flex; align-items: center;
  justify-content: center; font-size: 18px; font-weight: 750; background: var(--teal-soft); color: var(--teal);
  letter-spacing: -.02em;
}
.customer-avatar.red { background: var(--red-soft); color: var(--red); }
.customer-name { font-size: 22px; font-weight: 740; letter-spacing: -.025em; line-height: 1.2; }
.customer-meta { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 7px; align-items: center; }
.customer-id { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.customer-side { margin-left: auto; display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.mini-stat { text-align: right; }
.mini-stat .v { font-size: 17px; font-weight: 720; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.mini-stat .l { font-size: 9.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-top: 1px; font-weight: 650; }

/* Charts ------------------------------------------------------------------ */
.chart-box { width: 100%; min-height: 160px; position: relative; }
.chart-box svg { width: 100%; height: auto; overflow: visible; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); }
.legend-swatch { width: 8px; height: 8px; border-radius: 2px; }
.chart-tooltip { pointer-events: none; }
.axis-label { fill: var(--muted-2); font-size: 10px; font-family: var(--font); }
.grid-line { stroke: #eef2f7; stroke-width: 1; }
.chart-empty { display: flex; align-items: center; justify-content: center; min-height: 160px; color: var(--muted); font-size: 12px; }

.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut { width: 132px; height: 132px; flex: none; position: relative; }
.donut svg { transform: rotate(-90deg); }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-center .n { font-size: 22px; font-weight: 740; letter-spacing: -.03em; }
.donut-center .l { font-size: 9px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.donut-row { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 8px; font-size: 11.5px; }
.donut-row .label { color: var(--ink-2); }
.donut-row .value { font-variant-numeric: tabular-nums; color: var(--muted); }

/* Scatter ----------------------------------------------------------------- */
.scatter-shell { position: relative; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.scatter-shell svg { width: 100%; height: auto; display: block; cursor: crosshair; }
.scatter-point { transition: opacity .12s; cursor: pointer; }
.scatter-point:hover { stroke: #0b1726; stroke-width: 1.5; }
.scatter-tooltip {
  position: absolute; pointer-events: none; background: #0b1726; color: #fff; border-radius: 7px;
  padding: 7px 9px; font-size: 10.5px; line-height: 1.4; box-shadow: var(--shadow-lg);
  max-width: 240px; z-index: 5; transform: translate(-50%, -110%);
}
.scatter-tooltip strong { display: block; font-size: 11px; }
.scatter-tooltip span { color: #9fb3c8; }
.cluster-legend { display: flex; gap: 7px; flex-wrap: wrap; }
.cluster-pill {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line);
  background: #fff; border-radius: 20px; padding: 3px 9px; font-size: 10.5px; color: var(--muted);
  cursor: pointer; transition: .15s;
}
.cluster-pill:hover, .cluster-pill.active { border-color: var(--ink-2); color: var(--ink); background: var(--surface-2); }
.cluster-pill .sw { width: 7px; height: 7px; border-radius: 50%; }

/* Evidence ---------------------------------------------------------------- */
.finding {
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2);
  padding: 13px 14px; margin-bottom: 10px;
}
.finding:last-child { margin-bottom: 0; }
.finding-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.finding-code { font-family: var(--mono); font-size: 10px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.finding-title { font-size: 12.5px; font-weight: 650; }
.finding-desc { font-size: 11.5px; color: var(--ink-2); line-height: 1.55; }
.finding-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; color: var(--muted); font-size: 10.5px; }
.attr-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.attr-table th { text-align: left; padding: 7px 9px; color: var(--muted); font-size: 9.5px; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line); }
.attr-table td { padding: 9px; border-bottom: 1px solid #eef2f6; vertical-align: top; }
.attr-table tr:last-child td { border-bottom: 0; }
.attr-name { font-weight: 640; }
.attr-observed { font-family: var(--mono); font-size: 10.5px; }
.attr-expected { color: var(--muted); font-size: 10.5px; }
.attr-surprisal { font-family: var(--mono); font-size: 10.5px; white-space: nowrap; }
.surprisal-bar { height: 4px; background: var(--surface-3); border-radius: 2px; width: 62px; display: inline-block; vertical-align: middle; margin-left: 6px; overflow: hidden; }
.surprisal-bar i { display: block; height: 100%; background: #d97706; }
.level-strip { display: flex; gap: 6px; flex-wrap: wrap; }

/* Modal ------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(8, 18, 32, .5); backdrop-filter: blur(2px);
  z-index: 200; display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 20px 20px; overflow-y: auto; animation: fadeIn .14s ease-out;
}
.modal {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); width: 560px; max-width: 100%;
  animation: modalIn .18s ease-out; border: 1px solid rgba(255,255,255,.5);
}
.modal.wide { width: 860px; }
.modal.xwide { width: 1080px; }
.modal-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; gap: 12px; }
.modal-title { font-size: 16px; font-weight: 720; letter-spacing: -.02em; }
.modal-sub { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.modal-close { margin-left: auto; }
.modal-body { padding: 18px 20px; max-height: 68vh; overflow-y: auto; }
.modal-foot { padding: 13px 20px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 9px; justify-content: flex-end; background: var(--surface-2); border-radius: 0 0 14px 14px; }
.modal-foot .left { margin-right: auto; }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Toasts ------------------------------------------------------------------ */
.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: flex; flex-direction: column; gap: 9px; width: 340px; }
.toast {
  background: #0f1e31; color: #eef2f7; border-radius: 9px; padding: 11px 13px;
  box-shadow: var(--shadow-lg); font-size: 12.5px; border-left: 3px solid var(--teal-bright);
  animation: toastIn .2s ease-out; display: flex; gap: 9px; align-items: flex-start;
}
.toast.error { border-left-color: #ef4444; }
.toast.warn { border-left-color: #f59e0b; }
.toast svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.toast .msg { line-height: 1.45; }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Empty / loading --------------------------------------------------------- */
.empty-state { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty-icon { width: 40px; height: 40px; margin: 0 auto 10px; border-radius: 12px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; color: var(--muted-2); }
.empty-icon svg { width: 18px; height: 18px; }
.empty-title { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.empty-sub { font-size: 11.5px; margin-top: 3px; }
.page-loading { padding-top: 6px; }
.skeleton {
  background: linear-gradient(90deg, #e9eef5 25%, #f3f6fa 37%, #e9eef5 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 7px;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.sk-title { height: 27px; width: 260px; margin-bottom: 9px; }
.sk-sub { height: 13px; width: 420px; margin-bottom: 23px; }
.sk-card { height: 102px; }
.sk-chart { height: 320px; margin-top: 16px; }
.loading-inline { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.spinner {
  width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--teal);
  border-radius: 50%; animation: spin .65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Pagination -------------------------------------------------------------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 18px; border-top: 1px solid #eef2f6; font-size: 11.5px; color: var(--muted); }
.page-btns { display: flex; gap: 4px; }
.page-btn {
  min-width: 27px; height: 27px; border: 1px solid var(--line); background: #fff; border-radius: 6px;
  font-size: 11px; cursor: pointer; color: var(--muted); padding: 0 7px;
}
.page-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.page-btn.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: default; }

/* Misc -------------------------------------------------------------------- */
.divider { height: 1px; background: var(--line); margin: 15px 0; }
.callout { border: 1px solid #fde3c8; background: #fffaf2; border-radius: 9px; padding: 12px 14px; font-size: 11.5px; color: #92400e; line-height: 1.55; }
.callout.red { border-color: #fbd5d5; background: #fef6f6; color: #991b1b; }
.callout.blue { border-color: #dbe7ff; background: #f5f9ff; color: #1e40af; }
.callout strong { font-weight: 700; }
.tag-list { display: flex; gap: 5px; flex-wrap: wrap; }
.code-block {
  font-family: var(--mono); font-size: 10.5px; background: #0f1e31; color: #cbd5e1;
  border-radius: 8px; padding: 13px; overflow: auto; line-height: 1.55; max-height: 380px;
}
.risk-meter { display: flex; align-items: center; gap: 10px; }
.risk-meter .bar { flex: 1; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.risk-meter .bar i { display: block; height: 100%; border-radius: 3px; }
.risk-low { background: #16a34a; } .risk-medium { background: #d97706; } .risk-high { background: #dc2626; }
.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-line { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed #eef2f6; font-size: 11.5px; }
.stat-line:last-child { border-bottom: 0; }
.stat-line .k { color: var(--muted); }
.stat-line .v { font-weight: 650; font-variant-numeric: tabular-nums; }
.pill-group { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: #fff; }
.pill-group button { border: 0; background: none; padding: 6px 10px; font-size: 11px; color: var(--muted); cursor: pointer; font-weight: 600; }
.pill-group button.active { background: var(--navy); color: #fff; }
.tooltip-anchor { position: relative; }
.hidden { display: none !important; }

/* Responsive -------------------------------------------------------------- */
@media (max-width: 1380px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr) 340px; }
}
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .global-search { width: 250px; }
  .analyst-copy { display: none; }
}
@media (max-width: 960px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; width: 250px; flex-basis: 250px; }
  .sidebar.open { transform: none; box-shadow: 30px 0 80px rgba(0,0,0,.22); }
  .main-wrap { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .content { padding: 20px 18px 56px; }
  .topbar { padding: 0 14px; gap: 8px; }
  .global-search { width: 190px; }
  .global-search kbd { display: none; }
  .page-head { flex-direction: column; gap: 12px; }
  .page-actions { margin-left: 0; justify-content: flex-start; }
  .grid-main, .grid-2 { grid-template-columns: 1fr; }
  .kpi-grid, .kpi-grid.five, .kpi-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer-side { display: none; }
}
@media (max-width: 620px) {
  .page-title { font-size: 21px; }
  .kpi-grid, .kpi-grid.five, .kpi-grid.four { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-value { font-size: 20px; }
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .global-search { display: none; }
  .crumb-muted, .crumb-sep { display: none; }
  .modal-backdrop { padding: 10px; }
  .modal-body { max-height: 76vh; }
  .form-grid { grid-template-columns: 1fr; }
  .split-2 { grid-template-columns: 1fr; }
  .feature-bar { grid-template-columns: 110px 1fr 38px; }
  .toast-root { width: auto; left: 12px; right: 12px; bottom: 12px; }
  table.data th, table.data td { padding: 9px 10px; }
}
