/* =========================================================================
   OKK-MFO — UI stylesheet
   Design language: dense, senior-business, thin sans-serif.
   Palette:
     --accent: #1E66FF
     --critical: #E53935
     --warning: #F59E0B
     --success: #16A34A
     --bg-dark: #0B1220
     --bg-light: #F8FAFC
     --ink: #0f172a
     --muted: #64748b
   ========================================================================= */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
pre, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }

/* ---------- variables ---------- */
:root {
  --accent: #1E66FF;
  --accent-600: #1552d6;
  --critical: #E53935;
  --critical-bg: #fee2e1;
  --warning: #F59E0B;
  --warning-bg: #fef3c7;
  --success: #16A34A;
  --success-bg: #dcfce7;
  --bg-dark: #0B1220;
  --bg: #F8FAFC;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --border: #e5e7eb;
  --border-strong: #cbd5e1;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
  --radius: 10px;
  --radius-sm: 6px;
}

/* ---------- base ---------- */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 12px;
}
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
h2.inline { display: inline-block; margin: 0; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.text-critical { color: var(--critical); }
.text-warning { color: var(--warning); }
.text-success { color: var(--success); }

.link { color: var(--accent); }
.link:hover { text-decoration: underline; }

/* ---------- layout ---------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 240px;
  background: var(--bg-dark);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  z-index: 10;
}
.sidebar .brand { padding: 4px 8px 18px; border-bottom: 1px solid rgba(255,255,255,0.08); margin-bottom: 14px; }
.sidebar .logo {
  font-size: 20px; font-weight: 700; color: #fff; letter-spacing: 0.02em;
}
.sidebar .brand-sub { font-size: 11px; color: #94a3b8; margin-top: 2px; }

.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
  color: #cbd5e1;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  transition: background 0.12s ease, color 0.12s ease;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.04); color: #fff; }
.sidebar nav a.active {
  background: var(--accent);
  color: #fff;
}
.sidebar nav a.nav-cta {
  margin-top: 10px;
  border: 1px dashed rgba(255,255,255,0.25);
  text-align: left;
  color: #e2e8f0;
}
.sidebar nav a.nav-cta:hover { border-color: var(--accent); color: #fff; }

.footer-mini {
  font-size: 11px; color: #64748b;
  padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.08);
}

.main {
  margin-left: 240px;
  padding: 24px 28px 60px;
  max-width: 1600px;
}

.topbar {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 18px;
}
.topbar h1 { margin: 0; }
.topbar-sub { font-size: 12.5px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.card h2 { margin-bottom: 10px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }

/* ---------- grids ---------- */
.grid-3, .grid-2 { display: grid; gap: 14px; margin-bottom: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 1.2fr 1fr; }

@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .grid-3 { grid-template-columns: 1fr; }
  .sidebar { position: static; width: 100%; flex-direction: row; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .main { margin-left: 0; padding: 16px; }
}

/* ---------- KPI tiles ---------- */
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-val { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; }
.kpi-sub { font-size: 12.5px; color: var(--muted); }

.kpi-hero { position: relative; border-left: 4px solid var(--muted); }
.kpi-hero.zone-success { border-left-color: var(--success); }
.kpi-hero.zone-warning { border-left-color: var(--warning); }
.kpi-hero.zone-critical { border-left-color: var(--critical); }
.kpi-hero.zone-muted    { border-left-color: var(--muted); }
.kpi-hero .kpi-val { font-size: 40px; }

.mini-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mini-kpi {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.mini-kpi-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.mini-kpi-val { font-size: 22px; font-weight: 600; margin-top: 2px; }

/* ---------- tables ---------- */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tbl th, .tbl td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tbl thead th {
  background: var(--bg);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.tbl tbody tr:nth-child(even) { background: #fbfcfe; }
.tbl tbody tr:hover { background: #f1f5f9; }
.tbl.dense th, .tbl.dense td { padding: 5px 8px; font-size: 12.5px; }
.quote-cell { max-width: 320px; }

/* ---------- badges ---------- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.02em;
  background: #eef2f7;
  color: #334155;
  border: 1px solid transparent;
  vertical-align: middle;
  white-space: nowrap;
}
.badge + .badge { margin-left: 4px; }

.badge-critical { background: var(--critical-bg); color: #991b1b; }
.badge-high     { background: #fde7d0; color: #9a3412; }
.badge-medium   { background: var(--warning-bg); color: #92400e; }
.badge-success  { background: var(--success-bg); color: #166534; }
.badge-warning  { background: var(--warning-bg); color: #92400e; }
.badge-muted    { background: #e2e8f0; color: #475569; }
.badge-good     { background: #dbeafe; color: #1e40af; }
.badge-excellent{ background: var(--success-bg); color: #166534; }
.badge-average  { background: var(--warning-bg); color: #92400e; }
.badge-poor     { background: var(--critical-bg); color: #991b1b; }

/* Status badges (transcript/analytics) */
.badge-status { font-size: 10.5px; padding: 1px 7px; }
.badge-pending     { background: #e2e8f0; color: #475569; }
.badge-in_progress { background: #dbeafe; color: #1e40af; }
.badge-done        { background: var(--success-bg); color: #166534; }
.badge-failed      { background: var(--critical-bg); color: #991b1b; }
.badge-open        { background: var(--critical-bg); color: #991b1b; }
.badge-acknowledged{ background: var(--warning-bg); color: #92400e; }
.badge-resolved    { background: var(--success-bg); color: #166534; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
  text-align: center;
}
.btn:hover { background: #f1f5f9; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-600); border-color: var(--accent-600); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-ghost:hover { background: var(--bg); color: var(--ink); }
.btn-small { padding: 4px 10px; font-size: 12px; }
.btn-big { padding: 10px 22px; font-size: 14px; }

.inline-form { display: inline-block; margin: 0; }

/* ---------- forms ---------- */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.filter-bar label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: var(--muted);
}
.filter-bar label.grow { flex: 1; min-width: 220px; }
.filter-bar input,
.filter-bar select,
.field input,
.field select {
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  min-width: 140px;
  font-size: 13px;
}
.filter-bar input:focus,
.filter-bar select:focus,
.field input:focus,
.field select:focus {
  outline: 2px solid rgba(30, 102, 255, 0.25);
  border-color: var(--accent);
}
.filter-actions { display: flex; gap: 6px; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 14px 0;
}
.form-actions { display: flex; gap: 8px; margin-top: 10px; }

.upload-card { max-width: 640px; }
.upload-form .field input[type="file"] {
  padding: 8px;
  background: var(--bg);
  border-style: dashed;
}

/* ---------- spend bars ---------- */
.spend-grid { display: flex; flex-direction: column; gap: 10px; }
.spend-row {
  display: grid;
  grid-template-columns: 120px 1fr 160px;
  gap: 12px;
  align-items: center;
}
.spend-name { font-weight: 600; text-transform: capitalize; }
.spend-val  { text-align: right; color: var(--muted); }

.bar {
  height: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}
.bar-success  { background: var(--success); }
.bar-warning  { background: var(--warning); }
.bar-critical { background: var(--critical); }

/* ---------- alerts banner ---------- */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 14px;
  font-size: 13px;
}
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

.status-row {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px;
}

.alert-list { list-style: none; padding: 0; margin: 0; }
.alert-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.alert-list li:last-child { border-bottom: none; }
.alert-quote {
  margin: 6px 0 0;
  padding: 4px 10px;
  border-left: 3px solid var(--border-strong);
  font-style: italic;
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------- call detail layout ---------- */
.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}
@media (max-width: 1200px) { .detail-grid { grid-template-columns: 1fr; } }

.actions-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.qc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 10px; }
.qc-score {
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--bg);
  text-align: center;
  border-left: 4px solid var(--muted);
  min-width: 120px;
}
.qc-score.zone-success  { border-left-color: var(--success); }
.qc-score.zone-warning  { border-left-color: var(--warning); }
.qc-score.zone-critical { border-left-color: var(--critical); }
.qc-score-val { font-size: 28px; font-weight: 600; }
.qc-score-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.qc-flags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.qc-summary { font-size: 13.5px; color: var(--ink); margin: 6px 0 0; line-height: 1.55; }

.ptp-card { border-left: 4px solid var(--success); }
.ptp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.ptp-val { font-size: 18px; font-weight: 600; margin-top: 2px; }

/* ---------- transcript ---------- */
.transcript {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  max-height: 480px;
  overflow-y: auto;
  margin-top: 8px;
}
.transcript-plain {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  max-height: 480px;
  overflow-y: auto;
  white-space: pre-wrap;
  margin: 8px 0 0;
}
.segment { padding: 2px 0; display: flex; gap: 8px; }
.segment .seg-time { color: var(--muted); flex: 0 0 110px; }
.segment .seg-text { flex: 1; font-family: inherit; color: var(--ink); white-space: pre-wrap; }

/* ---------- checklist sidebar ---------- */
.detail-side .card { position: sticky; top: 16px; max-height: calc(100vh - 40px); overflow-y: auto; }

.chk-block { margin-bottom: 14px; }
.chk-block-head {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.checklist-item {
  padding: 6px 8px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--border);
  background: #fbfcfe;
}
.checklist-item.chk-pass { border-left-color: var(--success); }
.checklist-item.chk-fail { border-left-color: var(--critical); background: #fef7f7; }
.checklist-item.chk-n { border-left-color: var(--muted); }
.checklist-item.chk-na { border-left-color: var(--muted); }

.chk-row { display: flex; gap: 8px; align-items: center; }
.chk-icon { width: 14px; font-weight: 700; text-align: center; }
.chk-pass .chk-icon { color: var(--success); }
.chk-fail .chk-icon { color: var(--critical); }
.chk-na   .chk-icon { color: var(--muted); }
.chk-title { flex: 1; font-size: 12.5px; line-height: 1.3; }
.chk-weight { color: var(--muted); }

.chk-quote {
  font-style: italic;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  padding-left: 22px;
  line-height: 1.4;
}
.chk-legal {
  color: var(--muted);
  margin-top: 2px;
  padding-left: 22px;
}

/* ---------- misc ---------- */
.code-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 8px 0 0;
}
.code-block.error { border-color: var(--critical); background: #fef7f7; color: #991b1b; }

details > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; }
details > summary::before { content: "▸"; color: var(--muted); transition: transform 0.12s ease; }
details[open] > summary::before { transform: rotate(90deg); display: inline-block; }
details > summary::-webkit-details-marker { display: none; }

::selection { background: rgba(30, 102, 255, 0.18); }

/* scrollbar polish (webkit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
::-webkit-scrollbar-track { background: transparent; }

/* ─── 50-item checklist on Overview ─────────────────────────────────── */
.cl-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink-100, #e5e7eb);
}
.cl-overall {
  text-align: right;
  min-width: 200px;
}
.cl-overall-val {
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  margin: 4px 0;
  font-variant-numeric: tabular-nums;
}
.cl-overall-val.zone-success  { color: var(--success, #16A34A); }
.cl-overall-val.zone-warning  { color: var(--warning, #F59E0B); }
.cl-overall-val.zone-critical { color: var(--critical, #E53935); }
.cl-overall-val.zone-muted    { color: var(--muted, #64748b); }

.cl-block {
  margin: 24px 0;
  padding: 14px 0 0;
  border-top: 2px solid var(--ink-100, #e5e7eb);
}
.cl-block:first-of-type { border-top: none; padding-top: 4px; }

.cl-block-head {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 20px;
  align-items: center;
  margin-bottom: 8px;
}
.cl-block-label {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cl-block-letter {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1E66FF, #3b82f6);
  color: white;
  font-weight: 800;
  font-size: 16px;
}
.cl-block-name { font-weight: 600; font-size: 15px; }
.cl-block-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.cl-stack {
  flex: 1;
  display: flex;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--ink-050, #f1f5f9);
  min-width: 180px;
}
.cl-stack .seg { height: 100%; }
.cl-stack .seg-pass { background: var(--success, #16A34A); }
.cl-stack .seg-fail { background: var(--critical, #E53935); }
.cl-stack .seg-na   { background: var(--ink-200, #cbd5e1); }

.cl-tbl td, .cl-tbl th { padding: 6px 8px; font-size: 13px; }
.cl-tbl .cl-item-title { font-weight: 500; color: var(--ink, #0f172a); line-height: 1.3; }
.cl-tbl tr.cl-row-crit { background: rgba(229, 57, 53, 0.04); }
.cl-tbl tr.cl-row-crit:hover { background: rgba(229, 57, 53, 0.08); }
.cl-row-bar { display: flex; align-items: center; gap: 8px; }
.bar-success  { background: var(--success, #16A34A); }
.bar-warning  { background: var(--warning, #F59E0B); }
.bar-critical { background: var(--critical, #E53935); }
.bar-muted    { background: var(--muted, #64748b); }

.badge.small { font-size: 10px; padding: 1px 6px; }
.text-success  { color: var(--success, #16A34A); }
.text-critical { color: var(--critical, #E53935); }

@media (max-width: 1100px) {
  .cl-block-head { grid-template-columns: 1fr; gap: 8px; }
  .cl-block-stats { flex-wrap: wrap; }
}

/* =========================================================================
   EPIC 8 — call_detail vertical layout additions
   ========================================================================= */

/* ---------- KV grid (portrait legacy compat) ---------- */
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.kv-row { display: flex; flex-direction: column; gap: 2px; }
.kv-row.kv-wide { grid-column: span 2; }
.kv-k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.kv-v { font-size: 13px; }
.simple-list { padding-left: 16px; margin: 4px 0 0; }

/* ---------- Sticky right-side TOC ---------- */
.sticky-toc {
  position: fixed;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: var(--shadow-md);
  z-index: 50;
  min-width: 120px;
  max-width: 150px;
}
.sticky-toc-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.sticky-toc-link {
  font-size: 11.5px;
  color: var(--muted);
  padding: 3px 0;
  transition: color 0.12s ease;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sticky-toc-link:hover { color: var(--accent); }
.sticky-toc-danger { color: var(--critical); }
.sticky-toc-danger:hover { color: var(--critical); opacity: 0.8; }
@media (max-width: 1400px) { .sticky-toc { display: none; } }

/* ---------- Call header strip ---------- */
.call-header-strip {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.call-header-left { flex: 1; min-width: 0; }
.call-header-title { font-size: 22px; font-weight: 700; margin: 0 0 8px; }
.call-header-meta {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-bottom: 10px;
}
.call-header-meta .sep { opacity: 0.4; }
.call-header-badges { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Big score badge ---------- */
.score-badge-lg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 4px solid currentColor;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
}
.score-badge-val {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  font-feature-settings: "tnum";
}
.score-badge-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 3px;
  opacity: 0.75;
}
.score-badge-success {
  color: #15803d;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-color: #86efac;
}
.score-badge-warning {
  color: #b45309;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #fcd34d;
}
.score-badge-critical {
  color: #991b1b;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border-color: #fca5a5;
}
.score-badge-muted {
  color: var(--muted);
  background: var(--bg);
  border-color: var(--border-strong);
}

/* ---------- Call action bar ---------- */
.call-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px 18px;
  margin-bottom: 16px;
  position: relative;
}
.call-action-status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex-basis: 100%;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

/* Override details dropdown */
.inline-details { position: relative; display: inline-block; }
.override-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  min-width: 340px;
  margin: 0;
  box-shadow: var(--shadow-lg);
}
.override-form { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Portrait card ---------- */
.portrait-card { margin-bottom: 16px; }
.portrait-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.portrait-card-icon {
  display: inline-grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  font-size: 18px;
  flex-shrink: 0;
}
.portrait-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
}
.portrait-section { display: flex; flex-direction: column; gap: 6px; }
.portrait-section-wide { grid-column: span 2; }
.portrait-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.portrait-text { font-size: 13px; color: var(--ink); line-height: 1.5; }

.portrait-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.portrait-bullets {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.6;
}

/* Portrait chip variants */
.portrait-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-subtle, #f1f5f9);
  color: var(--ink);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.portrait-chip-hot    { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.portrait-chip-warm   { background: #fff7ed; color: #c2410c; border-color: #fdba74; }
.portrait-chip-cold   { background: #e0f2fe; color: #0369a1; border-color: #7dd3fc; }
.portrait-chip-success{ background: #dcfce7; color: #166534; border-color: #86efac; }
.portrait-chip-muted  { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.portrait-chip-warn   { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.portrait-chip-finance{ background: #ede9fe; color: #5b21b6; border-color: #c4b5fd; }
.portrait-chip-info   { background: #e0f2fe; color: #075985; border-color: #7dd3fc; }

@media (max-width: 900px) {
  .portrait-card-body { grid-template-columns: 1fr; }
  .portrait-section-wide { grid-column: span 1; }
}

/* ---------- Checklist section (full-width vertical) ---------- */
.checklist-section {
  margin-bottom: 18px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* Section header banner */
.checklist-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #1e293b;
  color: #f1f5f9;
}
.checklist-section-success .checklist-section-head { background: #14532d; }
.checklist-section-warning .checklist-section-head  { background: #78350f; }
.checklist-section-critical .checklist-section-head { background: #7f1d1d; }
.checklist-section-muted .checklist-section-head    { background: #334155; }

.checklist-section-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.checklist-section-score {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.9;
  white-space: nowrap;
  font-feature-settings: "tnum";
}

/* Individual checklist item rows */
.checklist-item-row {
  display: flex;
  flex-direction: column;
  padding: 9px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  transition: filter 0.08s ease;
}
.checklist-item-row:last-child { border-bottom: none; }

.checklist-item-pass {
  background: #16a34a;
  color: #ffffff;
}
.checklist-item-fail {
  background: #dc2626;
  color: #ffffff;
}
.checklist-item-na {
  background: #6b7280;
  color: #ffffff;
}

.checklist-item-main {
  display: flex;
  align-items: center;
  gap: 8px;
}
.checklist-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.checklist-item-title {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}
.checklist-item-weight {
  opacity: 0.7;
  font-size: 11px;
}

/* Quote block inside checklist row */
.checklist-item-quote {
  margin: 6px 0 2px 28px;
  padding: 5px 10px;
  border-left: 3px solid rgba(255,255,255,0.35);
  font-style: italic;
  font-size: 12px;
  opacity: 0.9;
  line-height: 1.45;
}

/* Red flags item */
.redflags-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.redflags-item:last-child { border-bottom: none; }

/* --- Nav group label styling (EPIC 18) --- */
.nav-group {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #4b5563;  /* more visible on dark sidebar */
  padding: 12px 10px 4px;
  font-weight: 700;
}

/* --- Role dashboard fixes (EPIC 1) --- */
.nav-role { font-weight: 500; }

/* Role header top area contrast fix */
.role-header-bar {
  background: var(--bg-dark);
  color: #fff;
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.role-header-bar h1 { color: #fff; margin: 0; font-size: 20px; }
.role-header-bar .role-period { color: #94a3b8; font-size: 13px; }
.role-header-bar .role-kpis { display: flex; gap: 20px; }
.role-kpi { text-align: right; }
.role-kpi-val { font-size: 24px; font-weight: 700; color: #fff; }
.role-kpi-label { font-size: 11px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; }

/* Heatmap for CEO/Sales/Product */
.heatmap-grid { display: grid; gap: 2px; }
.heatmap-cell {
  padding: 8px 6px;
  border-radius: 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  transition: transform 0.1s;
  cursor: default;
}
.heatmap-cell:hover { transform: scale(1.05); z-index: 1; }
.heatmap-cell-label { font-size: 10px; opacity: 0.85; font-weight: 400; }
/* Zone colors */
.hm-z0 { background: #16a34a; } /* excellent >= 85% */
.hm-z1 { background: #4ade80; color: #166534; } /* good 70-85% */
.hm-z2 { background: #fbbf24; color: #78350f; } /* ok 55-70% */
.hm-z3 { background: #f97316; color: #fff; }    /* weak 40-55% */
.hm-z4 { background: #dc2626; }                  /* critical < 40% */
.hm-z-empty { background: #e5e7eb; color: #9ca3af; }

/* Top/Anti-top product cards */
.product-rank-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.product-rank-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--surface);
}
.product-rank-card.rank-top { border-left: 4px solid var(--success); }
.product-rank-card.rank-anti { border-left: 4px solid var(--critical); }
.product-rank-item { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.product-rank-item:last-child { border-bottom: none; }

/* LLM insights panel */
.insights-panel {
  background: linear-gradient(135deg, #f0f4ff 0%, #fafbff 100%);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-top: 16px;
}
.insights-panel h3 { color: #3730a3; margin-bottom: 10px; }
.insights-content { font-size: 13.5px; line-height: 1.65; white-space: pre-wrap; }
.insights-meta { font-size: 11px; color: var(--muted); margin-top: 10px; }
.btn-llm { position: relative; overflow: hidden; }
.btn-llm.loading::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* Trend arrows */
.trend-up   { color: var(--success); font-weight: 700; }
.trend-down { color: var(--critical); font-weight: 700; }
.trend-flat { color: var(--muted); }

