/* TrustCtrl web UI — design system.
   Follows UX-002: an 8px spacing scale (4/8/16/24/32/48/64), a capped type scale (5 sizes),
   three button types, and status expressed as colour + icon + text. Calm, professional, light by
   default with a dark theme via [data-theme="dark"]. */

:root {
  /* Spacing scale — the only permitted step values. */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 16px;
  --sp-4: 24px;
  --sp-5: 32px;
  --sp-6: 48px;
  --sp-7: 64px;

  /* Type scale — five sizes, no more. */
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 15px;
  --fs-lg: 20px;
  --fs-xl: 28px;

  --radius: 10px;
  --radius-sm: 6px;
  --content-max: 1440px;
  --sidebar-w: 236px;
  --topbar-h: 56px;

  /* Light theme */
  --bg-body: #f4f6f9;
  --bg-surface: #ffffff;
  --bg-surface-2: #f8fafc;
  --bg-hover: #f1f5f9;
  --bg-topbar: #ffffff;
  --bg-sidebar: #ffffff;

  --text-primary: #0f1b2d;
  --text-secondary: #51607a;
  --text-muted: #8593a8;
  --text-inverse: #ffffff;

  --border: #e3e8ef;
  --border-strong: #cfd6e2;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eaf1fe;
  --accent-text: #1d4ed8;

  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --warn: #b45309;
  --warn-soft: #fdf1e1;
  --attention: #c2410c;
  --attention-soft: #fbeae0;
  --danger: #b91c1c;
  --danger-soft: #fdeaea;
  --info: #1d4ed8;
  --info-soft: #eaf1fe;

  --shadow-sm: 0 1px 2px rgba(15, 27, 45, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 27, 45, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 27, 45, 0.14);

  color-scheme: light;
}

[data-theme="dark"] {
  --bg-body: #0b1220;
  --bg-surface: #131c2b;
  --bg-surface-2: #0f1826;
  --bg-hover: #1b2638;
  --bg-topbar: #101a29;
  --bg-sidebar: #101a29;

  --text-primary: #e8eef6;
  --text-secondary: #a7b3c6;
  --text-muted: #7383a0;
  --text-inverse: #0b1220;

  --border: #223047;
  --border-strong: #2d3f5c;

  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.16);
  --accent-text: #93c5fd;

  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.14);
  --attention: #fb923c;
  --attention-soft: rgba(251, 146, 60, 0.16);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);
  --info: #93c5fd;
  --info-soft: rgba(59, 130, 246, 0.16);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: var(--fs-md);
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-body);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; font-weight: 650; line-height: 1.25; }

/* ── Brand ─────────────────────────────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: var(--sp-2); }
.brand-mark {
  width: 26px; height: 26px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  color: #fff;
}
.brand-word { font-size: var(--fs-md); font-weight: 700; letter-spacing: -0.01em; }
.brand-word .accent { color: var(--accent); }
[data-theme="dark"] .brand-word .accent { color: var(--accent-text); }

/* ── App shell ─────────────────────────────────────────────────────────── */
/* Five permanent areas (UX-003 §3): top bar, left nav, main content, and the docked AI panel. */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr auto; grid-template-rows: var(--topbar-h) 1fr; min-height: 100vh; }

.topbar {
  grid-column: 1 / 4;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3);
  padding: 0 var(--sp-4);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: var(--sp-4); }
.topbar-right { display: flex; align-items: center; gap: var(--sp-2); }

/* Tenant selector */
.tenant-selector {
  display: flex; align-items: center; gap: var(--sp-2);
  height: 34px; padding: 0 var(--sp-3);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-surface-2); color: var(--text-secondary);
  font-size: var(--fs-sm); font-weight: 600; font-family: inherit; cursor: pointer;
  max-width: 220px;
}
.tenant-selector:hover { background: var(--bg-hover); color: var(--text-primary); }
.tenant-selector #tenantName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tenant-selector .caret { color: var(--text-muted); font-size: 10px; }

/* Popover menu (profile) */
.menu-pop { position: absolute; right: 0; top: 40px; width: 224px; padding: var(--sp-2); display: none; z-index: 30; }
.menu-head { padding: var(--sp-2); border-bottom: 1px solid var(--border); margin-bottom: var(--sp-2); }

/* Topbar panels (notifications + task center) — fixed popovers anchored under their icon */
.panel-pop {
  position: fixed; width: 400px; max-width: calc(100vw - 16px);
  max-height: min(520px, calc(100vh - 72px)); overflow-y: auto;
  padding: 0; display: none; z-index: 35;
}
.panel-pop.open { display: block; }
.panel-head {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  padding: var(--sp-3); border-bottom: 1px solid var(--border);
  background: var(--bg-surface); font-weight: 650; font-size: var(--fs-sm);
}
.panel-list { padding: var(--sp-1); }
.panel-section {
  padding: var(--sp-2) var(--sp-2) var(--sp-1);
  font-size: var(--fs-xs); font-weight: 650; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.panel-item {
  display: flex; align-items: flex-start; gap: var(--sp-2);
  width: 100%; padding: var(--sp-2); border: 0; border-radius: var(--radius-sm);
  background: transparent; color: inherit; text-align: left; cursor: pointer;
  font: inherit;
}
.panel-item:hover { background: var(--bg-hover); }
.panel-item.unread { background: var(--accent-soft); }
.panel-item.unread:hover { background: var(--bg-hover); }
.panel-item-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.panel-item-title { font-size: var(--fs-sm); font-weight: 600; }
.panel-item-text { font-size: var(--fs-sm); color: var(--text-secondary); }
.panel-item-time { font-size: var(--fs-xs); color: var(--text-muted); }
.unread-dot { flex: none; width: 8px; height: 8px; border-radius: 999px; background: var(--accent); margin-top: 6px; }

/* Count badge on topbar icon buttons */
.count-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}

.btn-link { border: 0; background: none; color: var(--accent); font: inherit; font-size: var(--fs-xs); cursor: pointer; padding: 0; }
.btn-link:hover { text-decoration: underline; }
.btn-xs { height: 26px; padding: 0 var(--sp-2); font-size: var(--fs-xs); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,27,45,.4); z-index: 40; display: flex; align-items: center; justify-content: center; padding: var(--sp-4); }

.global-search {
  display: flex; align-items: center; gap: var(--sp-2);
  height: 34px; width: 320px; max-width: 40vw;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-surface-2); color: var(--text-muted);
  font-size: var(--fs-sm); cursor: text;
}
.global-search kbd {
  margin-left: auto; font-family: inherit; font-size: var(--fs-xs);
  padding: 1px 6px; border: 1px solid var(--border-strong); border-radius: 4px; color: var(--text-muted);
}

.icon-btn {
  position: relative;
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-secondary); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.avatar {
  width: 32px; height: 32px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-text);
  font-size: var(--fs-sm); font-weight: 700;
}

/* ── Sidebar nav ───────────────────────────────────────────────────────── */
.sidebar {
  grid-row: 2; grid-column: 1;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: var(--sp-3) var(--sp-2);
  overflow-y: auto;
}
.nav-section { margin-bottom: var(--sp-4); }
.nav-label {
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); padding: 0 var(--sp-2); margin-bottom: var(--sp-2);
}
.nav-item {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-2);
  border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: var(--fs-sm); font-weight: 550;
  cursor: pointer; user-select: none; margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); }
.nav-item .nav-ico { width: 18px; height: 18px; flex-shrink: 0; }
.nav-sep { height: 1px; background: var(--border); margin: var(--sp-2) var(--sp-2); }
.nav-sub { margin: 2px 0 var(--sp-1) 30px; }
.nav-sub .nav-item { font-size: var(--fs-xs); padding: 5px var(--sp-2); color: var(--text-muted); }

/* Favorites in the left nav (UX-003 §12) */
.nav-head {
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); padding: var(--sp-2) var(--sp-2) var(--sp-1);
}
.nav-fav .fav-star { color: var(--warn); flex-shrink: 0; }
.fav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Section header inside popover menus (e.g. "Seneste" in the profile menu) */
.menu-sect {
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); padding: var(--sp-2) var(--sp-2) var(--sp-1);
}

/* Favorite toggle on detail pages */
.star-btn.on { color: var(--warn); border-color: var(--warn); }

/* ── Content ───────────────────────────────────────────────────────────── */
.content { grid-row: 2; grid-column: 2; padding: var(--sp-5) var(--sp-6); overflow-y: auto; }
.content-inner { max-width: var(--content-max); margin: 0 auto; }

.breadcrumb { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--sp-2); }

.hero { margin-bottom: var(--sp-5); }
.hero h1 { font-size: var(--fs-xl); letter-spacing: -0.02em; }
.hero p { margin: var(--sp-2) 0 0; color: var(--text-secondary); font-size: var(--fs-md); }

/* ── Cards & KPI ───────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: var(--sp-4);
}
.card + .card { margin-top: var(--sp-3); }
.card-title { font-size: var(--fs-md); font-weight: 650; margin-bottom: var(--sp-3); }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.kpi-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: var(--sp-4); cursor: pointer; transition: box-shadow .12s, transform .12s;
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-label { font-size: var(--fs-sm); color: var(--text-secondary); display: flex; align-items: center; gap: var(--sp-2); }
.kpi-value { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.02em; margin-top: var(--sp-2); }
.kpi-sub { font-size: var(--fs-xs); color: var(--text-muted); margin-top: var(--sp-1); }

/* ── Buttons (three types) ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 38px; padding: 0 var(--sp-4);
  border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: var(--fs-sm); font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background .12s, border-color .12s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); text-decoration: none; }
.btn-secondary { background: var(--bg-surface); color: var(--text-primary); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.1); text-decoration: none; }
.btn-block { width: 100%; }
.tenant-list { display: flex; flex-direction: column; gap: var(--sp-2); margin: var(--sp-3) 0; }
.trust-trend { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--border); }
.sparkline { display: block; margin: var(--sp-1) 0; }

/* ── Forms ─────────────────────────────────────────────────────────────── */
.field { margin-bottom: var(--sp-3); }
.field label { display: block; font-size: var(--fs-sm); font-weight: 600; margin-bottom: var(--sp-2); color: var(--text-secondary); }
.input {
  width: 100%; height: 40px; padding: 0 var(--sp-3);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg-surface); color: var(--text-primary); font-size: var(--fs-md); font-family: inherit;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ── Status badges (colour + icon + text) ──────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-xs); font-weight: 650; padding: 2px 9px; border-radius: 999px;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
.badge-ok { color: var(--ok); background: var(--ok-soft); }
.badge-warn { color: var(--warn); background: var(--warn-soft); }
.badge-danger { color: var(--danger); background: var(--danger-soft); }
.badge-info { color: var(--info); background: var(--info-soft); }
.badge-muted { color: var(--text-muted); background: var(--bg-hover); }
/* Severity (UX-002 §10): critical=red, high=orange, medium=amber, low=blue, info=neutral. */
.sev-critical { color: var(--danger); background: var(--danger-soft); }
.sev-high { color: var(--attention); background: var(--attention-soft); }
.sev-medium { color: var(--warn); background: var(--warn-soft); }
.sev-low { color: var(--info); background: var(--info-soft); }
.sev-info { color: var(--text-muted); background: var(--bg-hover); }

/* ── Trust Score & meters ──────────────────────────────────────────────── */
.trust-card { display: flex; gap: var(--sp-5); align-items: flex-start; flex-wrap: wrap; }
.trust-score { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); min-width: 140px; }
.trust-score .num { font-size: 52px; font-weight: 750; letter-spacing: -0.03em; line-height: 1; }
.trust-score .num small { font-size: var(--fs-lg); color: var(--text-muted); font-weight: 600; }
.trust-explain { flex: 1; min-width: 220px; }
.trust-explain p { margin: 0 0 var(--sp-3); color: var(--text-secondary); }

.meter-row { display: grid; grid-template-columns: 150px 1fr 44px; gap: var(--sp-3); align-items: center; padding: var(--sp-2) 0; }
.meter-row .m-label { font-size: var(--fs-sm); color: var(--text-secondary); }
.meter-row .m-val { font-size: var(--fs-sm); font-weight: 650; text-align: right; }
.meter { height: 8px; border-radius: 999px; background: var(--bg-hover); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.meter.good > span { background: var(--ok); }
.meter.fair > span { background: var(--attention); }
.meter.poor > span { background: var(--danger); }

/* Severity breakdown row */
.sev-breakdown { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.sev-chip { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: var(--fs-sm); }
.sev-chip .sev-count { font-weight: 700; font-size: var(--fs-md); }
.sev-dot { width: 9px; height: 9px; border-radius: 999px; }

/* Two-column section layout */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: var(--sp-3); padding: var(--sp-2) 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.timeline li:last-child { border-bottom: none; }
.timeline .t-type { font-weight: 600; }
.timeline .t-time { margin-left: auto; color: var(--text-muted); font-size: var(--fs-xs); white-space: nowrap; }
/* The reason someone gave when they acknowledged or closed a finding. Quoted and italic because it
   is their words, not ours — it must never read as system copy. */
.timeline .fe-note { color: var(--text-secondary); font-style: italic; min-width: 0; overflow-wrap: anywhere; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: var(--fs-xs); }

/* ── Filter bar (sticky above tables, UX-002 §9) ───────────────────────── */
.filter-bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) 0; margin-bottom: var(--sp-2);
  background: var(--bg-body);
}
.search-box {
  display: flex; align-items: center; gap: var(--sp-2);
  height: 38px; padding: 0 var(--sp-3); min-width: 260px; flex: 1 1 260px; max-width: 420px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg-surface); color: var(--text-muted);
}
.search-box input { border: none; background: transparent; outline: none; width: 100%; font-size: var(--fs-sm); color: var(--text-primary); font-family: inherit; }
.input.select { height: 38px; width: auto; min-width: 130px; padding: 0 var(--sp-2); cursor: pointer; }
.row-count { font-size: var(--fs-xs); padding: var(--sp-2) 0; }

/* Context navigation tabs (UX-003 §8) */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); margin-bottom: var(--sp-4); }
.tab {
  padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary);
  border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none;
}
.tab:hover { color: var(--text-primary); text-decoration: none; }
.tab.active { color: var(--accent-text); border-bottom-color: var(--accent); }

/* Relationship rows */
.rel-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.rel-row:last-child { border-bottom: none; }
.rel-arrow { color: var(--text-muted); font-weight: 700; }

/* Key-value rows (detail pages) */
.kv { display: grid; grid-template-columns: 180px 1fr; gap: var(--sp-3); padding: var(--sp-2) 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.kv:last-child { border-bottom: none; }
.kv > span:first-child { color: var(--text-muted); }

/* ── Table ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.data th, table.data td { text-align: left; padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--border); }
table.data th { color: var(--text-muted); font-weight: 600; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.04em; }
table.data th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
table.data th.sortable:hover { color: var(--text-primary); }
table.data tbody tr:hover { background: var(--bg-surface-2); }
table.data tbody tr.row-link { cursor: pointer; }
table.data tr.clickable { cursor: pointer; }

/* ── Empty / error / skeleton states ───────────────────────────────────── */
.empty-state { text-align: center; padding: var(--sp-7) var(--sp-4); color: var(--text-muted); }
.empty-state .empty-ico { font-size: 30px; margin-bottom: var(--sp-3); opacity: .7; }
.empty-state h3 { font-size: var(--fs-lg); color: var(--text-secondary); margin-bottom: var(--sp-2); }

.skeleton { background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg-surface-2) 37%, var(--bg-hover) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.skeleton-line { height: 12px; margin-bottom: var(--sp-2); }
.skeleton-kpi { height: 96px; }

.alert { padding: var(--sp-3); border-radius: var(--radius-sm); font-size: var(--fs-sm); margin-bottom: var(--sp-3); }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-warning { background: var(--warn-soft); color: var(--warn); }

/* ── AI Assistant panel (docked right, collapsed by default) ───────────── */
.ai-panel { grid-row: 2; grid-column: 3; display: flex; border-left: 1px solid var(--border); background: var(--bg-sidebar); }
.ai-panel.collapsed .ai-body { display: none; }
.ai-panel:not(.collapsed) .ai-rail { display: none; }
.ai-rail {
  width: 48px; display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  padding-top: var(--sp-3); border: none; background: transparent; cursor: pointer; color: var(--text-secondary);
}
.ai-rail:hover { color: var(--accent); }
.ai-rail-label { writing-mode: vertical-rl; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.08em; }
.ai-body { width: 340px; max-width: 80vw; display: flex; flex-direction: column; }
.ai-head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-3) var(--sp-3); border-bottom: 1px solid var(--border); font-weight: 650; font-size: var(--fs-sm); }
.ai-content { flex: 1; padding: var(--sp-3); overflow-y: auto; }
.ai-content .muted { font-size: var(--fs-sm); }

/* Explain AI output in the panel */
.ai-block { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--sp-3); background: var(--bg-surface); }
.ai-q { font-weight: 650; font-size: var(--fs-sm); margin-bottom: var(--sp-2); }
.ai-a { font-size: var(--fs-sm); }
.ai-a p { margin: 0 0 var(--sp-2); }
.ai-a p:last-child { margin-bottom: 0; }
.ai-meta {
  margin-top: var(--sp-2); padding-top: var(--sp-2); border-top: 1px dashed var(--border);
  font-size: var(--fs-xs); color: var(--text-muted);
}
.btn-ai { white-space: nowrap; }
.ai-input { padding: var(--sp-3); border-top: 1px solid var(--border); }

/* ── Global search (command palette) ───────────────────────────────────── */
.search-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(15,27,45,.4); display: flex; justify-content: center; align-items: flex-start; padding: 12vh var(--sp-4) var(--sp-4); }
.search-panel { width: 100%; max-width: 600px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; max-height: 70vh; }
.search-input-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); color: var(--text-muted); }
.search-input-row input { flex: 1; border: none; outline: none; background: transparent; font-size: var(--fs-lg); color: var(--text-primary); font-family: inherit; }
.search-input-row kbd { font-family: inherit; font-size: var(--fs-xs); padding: 2px 6px; border: 1px solid var(--border-strong); border-radius: 4px; color: var(--text-muted); }

/* Bare <kbd> elsewhere (e.g. the Help view's shortcut list) gets the same look */
kbd { font-family: inherit; font-size: var(--fs-xs); padding: 2px 6px; border: 1px solid var(--border-strong); border-radius: 4px; color: var(--text-muted); }
.search-results { overflow-y: auto; padding: var(--sp-2); }
.search-group { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); padding: var(--sp-3) var(--sp-2) var(--sp-2); }
.search-result { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm); cursor: pointer; }
.search-result.active { background: var(--accent-soft); }
.search-result-main { min-width: 0; flex: 1; }
.search-result-label { font-size: var(--fs-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result-sub { font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result-tag { flex-shrink: 0; }
.search-empty { padding: var(--sp-6) var(--sp-4); text-align: center; font-size: var(--fs-sm); }
.search-foot { display: flex; justify-content: space-between; align-items: center; padding: var(--sp-2) var(--sp-4); border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-muted); }

/* ── Auth (login / reset) pages ────────────────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--sp-4); background: var(--bg-body); }
.auth-card { width: 100%; max-width: 400px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: var(--sp-6); }
.auth-card .brand { justify-content: center; margin-bottom: var(--sp-4); }
.auth-card h1 { font-size: var(--fs-lg); text-align: center; margin-bottom: var(--sp-1); }
.auth-card .subtitle { text-align: center; color: var(--text-muted); font-size: var(--fs-sm); margin-bottom: var(--sp-5); }
.auth-links { display: flex; justify-content: space-between; margin-top: var(--sp-3); font-size: var(--fs-sm); }
.muted { color: var(--text-muted); }
.hidden { display: none !important; }
.spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 999px; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Mobile navigation (UX-003 §16): drawer replaces the sidebar, bottom nav for primary items ── */
.nav-burger { display: none; }
.drawer-backdrop { display: none; }
.bottom-nav { display: none; }

@media (max-width: 900px) {
  body { overflow-x: hidden; }
  .app-shell { grid-template-columns: 1fr; }
  .ai-panel { display: none; }
  .content { grid-column: 1; padding: var(--sp-4); padding-bottom: calc(64px + var(--sp-4)); }
  .global-search { display: none; }
  .brand-word { display: none; }
  .tenant-selector { max-width: 110px; }
  .topbar { padding: 0 var(--sp-3); }
  .topbar-left { gap: var(--sp-2); }
  .kpi-grid { grid-template-columns: 1fr 1fr; }

  .nav-burger { display: inline-flex; }

  /* Sidebar becomes an off-canvas drawer */
  .sidebar {
    position: fixed; top: var(--topbar-h); bottom: 0; left: 0; z-index: 45;
    width: min(var(--sidebar-w), 84vw);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }
  body.drawer-open .sidebar { transform: translateX(0); }
  body.drawer-open .drawer-backdrop {
    display: block; position: fixed; inset: var(--topbar-h) 0 0 0;
    background: rgba(15, 27, 45, 0.4); z-index: 44;
  }

  /* Bottom navigation: Dashboard, Findings, Search, Notifications, Profile */
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--bg-topbar); border-top: 1px solid var(--border);
  }
  .bn-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; border: 0; background: none; cursor: pointer;
    color: var(--text-muted); font: inherit; font-size: 10px; font-weight: 600;
    text-decoration: none;
  }
  .bn-item:hover { text-decoration: none; color: var(--text-primary); }
  .bn-item.active { color: var(--accent-text); }
}

/* ── Print: strip the app chrome so a report view prints/exports as a clean PDF ── */
@media print {
  .topbar, .sidebar, .no-print, .bottom-nav { display: none !important; }
  .app-shell { display: block !important; }
  .content { grid-column: 1 !important; padding: 0 !important; overflow: visible !important; }
  .content-inner { max-width: none !important; }
  body { background: #fff !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; page-break-inside: avoid; }
  a[href]::after { content: ""; }
  .report-doc .card:first-child h1 { color: #000; }
}

/* Dashboard refresh indicator — gentle attention pulse (respects reduced-motion). */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
@media (prefers-reduced-motion: reduce) {
  [style*="animation:pulse"] { animation: none !important; }
  .acc-chev, .kpi-card, .subwrap { transition: none !important; }
}

/* ── Overview redesign: score gauge, health categories, severity buckets ─────
   Layout & information hierarchy inspired by a best-in-class SEO health console;
   colours are TrustCtrl's own tokens. Every number here is real platform data
   (trust score, domain scores, findings-by-severity) — no decorative metrics. */

/* Circular Trust Score gauge — replaces the bare number on the Trust card. The
   arc length is set in JS from the real score; colour follows the trust band. */
.gauge { position: relative; width: 150px; height: 150px; flex: none; }
.gauge svg { transform: rotate(-90deg); display: block; }
.gauge .gauge-arc { transition: stroke-dashoffset .6s ease; }
@media (prefers-reduced-motion: reduce) { .gauge .gauge-arc { transition: none; } }
.gauge .gauge-mid { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge .g-score { font-size: 42px; font-weight: 750; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.gauge .g-delta { font-size: var(--fs-sm); font-weight: 700; min-height: 18px; }
.gauge .g-delta.up { color: var(--ok); }
.gauge .g-delta.down { color: var(--attention); }
.gauge .g-lbl { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 4px; }

/* Product overview panel: score gauge + band on the left, severity breakdown on the right. */
.score-panel { display: flex; gap: var(--sp-4); align-items: center; flex-wrap: wrap; }
.score-panel .sp-gauge { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); flex: none; }
.score-panel .sp-body { flex: 1; min-width: 240px; }

/* Domain-health category cards (driven by real domainScores). */
.health-cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--sp-3); }
.health-cat { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-surface-2); }
.health-cat .hc-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); }
.health-cat .hc-label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health-cat .hc-val { font-size: var(--fs-lg); font-weight: 750; font-variant-numeric: tabular-nums; }

/* Severity buckets (real findings-by-severity counts). */
.sev-buckets { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.sev-bucket { flex: 1 1 76px; text-align: center; padding: var(--sp-3) var(--sp-2); border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-surface-2); text-decoration: none; color: inherit; transition: box-shadow .12s, transform .12s; }
.sev-bucket:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); text-decoration: none; }
.sev-bucket .sb-n { font-size: var(--fs-xl); font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1; }
.sev-bucket .sb-k { font-size: var(--fs-xs); color: var(--text-muted); display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: var(--sp-2); }
@media (prefers-reduced-motion: reduce) { .sev-bucket { transition: none; } }

/* ── Findings list: expandable rows with affected pages inline ──────────────
   Rows for rules that carry an affected-page list expand in place (progressive
   disclosure) instead of forcing a click-through; the URLs are the real ones
   resolved from the linked observation. Other rows still open the detail page. */
.acc-chev { display: inline-block; width: 14px; color: var(--text-muted); transition: transform .15s ease; }
table.data tr.frow.expandable { cursor: pointer; }
table.data tr.frow.open { background: var(--bg-surface-2); }
table.data tr.frow.open .acc-chev { transform: rotate(90deg); }
.eff { display: flex; align-items: center; gap: var(--sp-2); }
.eff .meter { width: 72px; flex: none; }
.eff .eff-lbl { font-size: var(--fs-xs); color: var(--text-secondary); white-space: nowrap; }
.eff .meter.strong > span { background: var(--attention); }
table.data tr.subrow > td { padding: 0; background: var(--bg-surface-2); }
.subwrap { padding: var(--sp-2) var(--sp-4) var(--sp-4); }
.subwrap .sub-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.subwrap .sub-head h4 { margin: 0; font-size: var(--fs-md); }
.subwrap .sub-pages { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-surface); }
.subwrap .sub-pages li { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.subwrap .sub-pages li:last-child { border-bottom: none; }
.subwrap .sub-pages .sp-url { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* Text-length findings: each affected page shows its current title/description with a character
   counter, and the part beyond Google's limit struck through in red (the "too long" case). */
.len-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.len-offender { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--sp-3); background: var(--bg-surface-2); }
.len-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-2); flex-wrap: wrap; }
.len-text { font-size: var(--fs-sm); line-height: 1.6; overflow-wrap: anywhere; color: var(--text-secondary); }
.len-text s { color: var(--danger); text-decoration-thickness: 2px; }

/* ── Findings: product filter tiles + per-product groups (product+category structure) ───────────── */
.ptile-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--sp-3); margin-bottom: var(--sp-3); }
@media (max-width: 1200px) { .ptile-strip { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) { .ptile-strip { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .ptile-strip { grid-template-columns: 1fr; } }
.ptile { display: flex; flex-direction: column; align-items: center; gap: 9px; text-align: center;
  padding: 16px var(--sp-2) 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-surface); box-shadow: var(--shadow-sm); cursor: pointer; font: inherit; color: inherit;
  transition: border-color .12s, transform .12s, box-shadow .12s; }
.ptile:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.ptile.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-sm); }
.ptile .ring { --pct: 0; --rc: var(--accent); width: 58px; height: 58px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--rc) calc(var(--pct) * 1%), var(--bg-hover) 0); display: grid; place-items: center; position: relative; }
.ptile .ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--bg-surface); }
.ptile .ring > .rv { position: relative; font-weight: 800; font-size: var(--fs-md); font-variant-numeric: tabular-nums; line-height: 1; }
.ptile .ring.ok { --rc: var(--ok); } .ptile .ring.warn { --rc: var(--attention); } .ptile .ring.bad { --rc: var(--danger); } .ptile .ring.accent { --rc: var(--accent); }
.ptile .pt-name { font-weight: 700; font-size: var(--fs-sm); display: flex; align-items: center; gap: 6px; }
.ptile .pt-name .pt-ico { font-size: 15px; line-height: 1; }
.ptile .pt-count { font-size: var(--fs-xs); color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.ptile .pt-count b { color: var(--text-primary); font-weight: 700; }
.ptile .pt-count.clean { color: var(--ok); font-weight: 600; }
.ptile-note { font-size: var(--fs-sm); color: var(--text-secondary); margin: 0 0 var(--sp-3); }
.ptile-note b { color: var(--text-primary); }
.linkbtn { background: none; border: none; color: var(--accent-text); cursor: pointer; font: inherit; font-weight: 600; padding: 0; text-decoration: underline; }

/* "Focused on one website" banner, shown on both dashboards when a site is picked in the selector. */
.focus-banner { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
  background: var(--bg-hover); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-3); font-size: var(--fs-sm); color: var(--text-secondary); }
.focus-banner b { color: var(--text-primary); }

.pgroup { padding: 0; margin-bottom: var(--sp-3); overflow: hidden; }
.pgroup-head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); }
.pgroup-head .pg-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); display: grid; place-items: center; font-size: 17px; flex: none; }
.pgroup-head .pg-name { font-weight: 700; }
.pgroup-head .pg-sub { font-size: var(--fs-xs); color: var(--text-muted); }
.pgroup-head .pg-right { margin-left: auto; display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; justify-content: flex-end; }
.pgroup-head .pg-health { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-secondary); }
.pgroup-head .pg-health .meter { display: inline-block; vertical-align: middle; }
.pgroup-head .pg-health b { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.pgroup .table-wrap { border: 0; margin: 0; }
.pg-empty { padding: var(--sp-4); }

/* Rule sections inside a product card. Rules that raise one finding per affected package can put a
   few hundred rows in one card; each collapses to a counted summary line so the card still reads at
   a glance, and opens to the individually-triageable rows. */
.rsec { border-bottom: 1px solid var(--border); }
.rsec:last-child { border-bottom: 0; }
.rsec-head { display: flex; align-items: center; gap: var(--sp-2); width: 100%; padding: var(--sp-3) var(--sp-4);
  background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.rsec-head:hover { background: var(--bg-subtle, rgba(127, 127, 127, 0.06)); }
.rsec-chev { color: var(--text-muted); font-size: var(--fs-xs); width: 12px; flex: none; }
.rsec-name { font-weight: 600; }
.rsec-sev { display: inline-flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
  font-size: var(--fs-xs); color: var(--text-secondary); }
.rsec-open { margin-left: auto; font-size: var(--fs-xs); color: var(--text-muted); flex: none; }
.rsec-body .table-wrap { border-top: 1px solid var(--border); }
/* A long coordinate must not stretch the table — the full value is in the row's title attribute. */
.frow-problem { display: inline-block; max-width: 34ch; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; vertical-align: bottom; }

/* "By product" rows (per-site drill-downs still use them) — health bar + open-finding count. */
.prod-row { display: grid; grid-template-columns: 26px 1fr auto 80px 46px; gap: var(--sp-2); align-items: center;
  padding: var(--sp-2) 0; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.prod-row:last-child { border-bottom: 0; }
.prod-row:hover { color: inherit; text-decoration: none; }
.prod-row:hover .pr-name { color: var(--accent-text); }
.prod-row .pr-ico { font-size: 16px; }
.prod-row .pr-name { font-weight: 600; }
.prod-row .pr-open { font-size: var(--fs-xs); color: var(--text-secondary); font-variant-numeric: tabular-nums; text-align: right; }
.prod-row .pr-open b { color: var(--text-primary); }

/* Phishing Explorer: clickable screenshot thumbnail, external-site link, and full-size lightbox. */
.shot-thumb { padding: 0; border: 0; background: none; cursor: zoom-in; display: inline-block; line-height: 0; }
.shot-thumb img { height: 72px; max-width: 150px; object-fit: cover; object-position: top;
  border-radius: 6px; border: 1px solid var(--border); transition: box-shadow .12s, transform .12s; }
.shot-thumb:hover img { box-shadow: var(--shadow-sm); transform: scale(1.03); }
.ext-link { font-size: var(--fs-sm); text-decoration: none; opacity: .7; }
.ext-link:hover { opacity: 1; }
.shot-lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.72);
  display: flex; align-items: center; justify-content: center; padding: var(--sp-4); }
.shot-lightbox .shot-box { background: var(--bg-surface); border-radius: var(--radius); border: 1px solid var(--border);
  max-width: min(1100px, 96vw); max-height: 94vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg, 0 20px 60px rgba(0,0,0,.4)); }
.shot-lightbox .shot-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.shot-lightbox .shot-actions { display: flex; align-items: center; gap: var(--sp-2); }
.shot-lightbox .shot-img { overflow: auto; background: var(--bg-hover); }
.shot-lightbox .shot-img img { display: block; max-width: 100%; height: auto; margin: 0 auto; }

/* Findings explorer (per-website report): page-size selector + result footer. */
.fe-size { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-secondary); white-space: nowrap; }
.fe-foot { padding: var(--sp-2) var(--sp-4) var(--sp-3); font-size: var(--fs-sm); }
.fe-foot b { color: var(--text-primary); }
.prod-row .pr-open .clean { color: var(--ok); font-weight: 600; }
.prod-row .pr-h { font-variant-numeric: tabular-nums; font-size: var(--fs-sm); text-align: right; }

/* ── Simple findings view (plain-language default; findings toggle Simple/Technical) ─────────── */
.view-toggle { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 999px;
  overflow: hidden; background: var(--bg-surface); flex: none; }
.view-toggle button { border: 0; background: none; padding: 5px 14px; cursor: pointer;
  font-family: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary); }
.view-toggle button:hover { color: var(--text-primary); }
.view-toggle button.active { background: var(--accent); color: #fff; cursor: default; }

.sv-verdict { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.sv-verdict .ring { --pct: 0; --rc: var(--accent); width: 84px; height: 84px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--rc) calc(var(--pct) * 1%), var(--bg-hover) 0);
  display: grid; place-items: center; position: relative; }
.sv-verdict .ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--bg-surface); }
.sv-verdict .ring > .rv { position: relative; font-weight: 800; font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.sv-verdict .ring.ok { --rc: var(--ok); } .sv-verdict .ring.warn { --rc: var(--attention); } .sv-verdict .ring.bad { --rc: var(--danger); }
.sv-verdict-text { flex: 1; min-width: 260px; }
.sv-verdict-text h3 { margin: 0 0 var(--sp-1); font-size: var(--fs-lg); }
.sv-verdict-text p { margin: 0; color: var(--text-secondary); font-size: var(--fs-sm); max-width: 62ch; }
.sv-reassure { color: var(--text-muted) !important; margin-top: var(--sp-1) !important; font-size: var(--fs-xs) !important; }

.sv-concerns { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); margin-bottom: var(--sp-3); }
@media (max-width: 900px) { .sv-concerns { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .sv-concerns { grid-template-columns: 1fr; } }
.sv-concern { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left;
  background: var(--bg-surface); border: 1px solid var(--border); border-top: 3px solid var(--border-strong);
  border-radius: var(--radius); padding: var(--sp-3); cursor: pointer; font-family: inherit; box-shadow: var(--shadow-sm); }
.sv-concern:hover { border-color: var(--border-strong); }
.sv-concern.active { box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-sm); border-color: var(--accent); }
.sv-concern.st-ok { border-top-color: var(--ok); } .sv-concern.st-warn { border-top-color: var(--warn); } .sv-concern.st-bad { border-top-color: var(--danger); }
.sv-concern-name { font-weight: 700; font-size: var(--fs-sm); color: var(--text-primary); display: flex; align-items: center; gap: 7px; }
.sv-concern .st-dot { width: 8px; height: 8px; border-radius: 999px; flex: none; background: var(--border-strong); }
.sv-concern.st-ok .st-dot { background: var(--ok); } .sv-concern.st-warn .st-dot { background: var(--warn); } .sv-concern.st-bad .st-dot { background: var(--danger); }
.sv-status-word { font-size: var(--fs-xs); font-weight: 700; color: var(--text-secondary); }
.sv-concern.st-ok .sv-status-word { color: var(--ok); } .sv-concern.st-warn .sv-status-word { color: var(--warn); } .sv-concern.st-bad .sv-status-word { color: var(--danger); }
.sv-concern-line { font-size: var(--fs-xs); color: var(--text-secondary); }

.sv-bucket { margin-top: var(--sp-4); }
.sv-bucket-head { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-1); }
.sv-bucket-head .dot { width: 10px; height: 10px; border-radius: 999px; flex: none; }
.sv-bucket-head h4 { margin: 0; font-size: var(--fs-md); }
.sv-count { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.sv-bucket-sub { margin: 0 0 var(--sp-2); font-size: var(--fs-xs); color: var(--text-muted); }

.sv-card { display: flex; gap: var(--sp-3); align-items: flex-start; background: var(--bg-surface);
  border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-2); box-shadow: var(--shadow-sm); cursor: pointer; }
.sv-card:hover { border-color: var(--border-strong); }
.sv-card.sv-now { border-left-color: var(--danger); }
.sv-card.sv-soon { border-left-color: var(--warn); }
.sv-card-main { flex: 1; min-width: 0; }
.sv-card-main h5 { margin: 0 0 2px; font-size: var(--fs-md); font-weight: 650; }
.sv-consequence { margin: 0 0 var(--sp-2); color: var(--text-secondary); font-size: var(--fs-sm); max-width: 68ch; }
.sv-related { color: var(--text-muted); }
/* The affected package/file on a per-item card. Set apart from the plain-language headline: it is a
   literal identifier, so it must be copyable-looking and never mistaken for prose. */
.sv-item { display: block; margin-top: 2px; font-family: var(--font-mono, ui-monospace, monospace);
  font-size: var(--fs-sm); font-weight: 500; color: var(--text-secondary); overflow-wrap: anywhere; }
.sv-chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.sv-chip { display: inline-flex; align-items: center; font-size: var(--fs-xs); font-weight: 600;
  border-radius: 999px; padding: 2px 10px; background: var(--bg-surface-2); border: 1px solid var(--border);
  color: var(--text-secondary); white-space: nowrap; }
.sv-chip.who { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.sv-card-cta { flex: none; align-self: center; }
@media (max-width: 640px) {
  .sv-card { flex-direction: column; }
  .sv-card-cta { align-self: stretch; }
  .sv-card-cta .btn { width: 100%; justify-content: center; }
}

.sv-minor { border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--bg-surface-2); }
.sv-minor summary { cursor: pointer; padding: var(--sp-3) var(--sp-4); font-size: var(--fs-sm); font-weight: 600;
  color: var(--text-secondary); list-style: none; display: flex; align-items: center; gap: var(--sp-2); }
.sv-minor summary::-webkit-details-marker { display: none; }
.sv-minor summary::before { content: "▸"; }
.sv-minor[open] summary::before { content: "▾"; }
.sv-minor-body { padding: 0 var(--sp-4) var(--sp-3); }
.sv-minor-row { display: flex; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-2) 0;
  border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-secondary); cursor: pointer; }
.sv-minor-row:hover span:first-child { color: var(--text-primary); }
.sv-minor-row span:last-child { color: var(--text-muted); font-size: var(--fs-xs); white-space: nowrap; }

.sv-qa { display: grid; gap: var(--sp-3); }
.sv-qa-block h6 { margin: 0 0 var(--sp-1); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-muted); }
.sv-qa-block p { margin: 0; font-size: var(--fs-sm); color: var(--text-secondary); max-width: 68ch; }
.sv-qa-block p + p { margin-top: var(--sp-2); }
.sv-qa-block b { color: var(--text-primary); }
.sv-tech { color: var(--text-muted) !important; font-size: var(--fs-xs) !important; }
.sv-tech span { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
.sv-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-3); }
.sv-footlink { margin: var(--sp-4) 0 0; font-size: var(--fs-sm); color: var(--text-secondary); }

/* ── Simple dashboard (plain-language Mission Control) ────────────────────────────────────────── */
.sv-verdict-cta { margin-left: auto; align-self: center; }
.sv-delta { font-weight: 700; }
.sv-delta.up { color: var(--ok); }
.sv-delta.down { color: var(--danger); }
.sv-seeall { margin: var(--sp-1) 0 0; font-size: var(--fs-xs); color: var(--text-muted); }

.sv-site-row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--sp-2) var(--sp-4); margin-bottom: var(--sp-2); box-shadow: var(--shadow-sm); }
.sv-site-name { font-weight: 650; font-size: var(--fs-sm); min-width: 150px; }
.sv-site-chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; flex: 1; }
.sv-sitechip { font-size: var(--fs-xs); font-weight: 600; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.sv-sitechip.ok { background: var(--ok-soft); color: var(--ok); }
.sv-sitechip.warn { background: var(--warn-soft); color: var(--warn); }
.sv-sitechip.bad { background: var(--danger-soft); color: var(--danger); }

.sv-digest { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); }
@media (max-width: 760px) { .sv-digest { grid-template-columns: repeat(2, 1fr); } }
.sv-digest-stat { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--sp-3); display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow-sm); }
.sv-digest-stat b { font-size: var(--fs-xl); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.sv-digest-stat span { font-size: var(--fs-xs); color: var(--text-secondary); }

/* ── Advanced dashboards refresh: the Simple design language at technical density ──────────────
   Stat tiles (the digest-stat look, with a tone colour when the number is a signal), a verdict
   headline inside the product overview panel, compact all-clear rows instead of towering empty
   states, and a tab strip that replaces the hero button-soup on the product pages. */

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-3); }
.stat { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: var(--sp-3) var(--sp-4); display: flex; flex-direction: column; gap: 2px;
  color: inherit; text-decoration: none; transition: box-shadow .12s, transform .12s; }
a.stat:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); text-decoration: none; }
.stat b { font-size: var(--fs-xl); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; line-height: 1.15; }
.stat .st-label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary); }
.stat .st-sub { font-size: var(--fs-xs); color: var(--text-muted); }
.stat.tone-bad b { color: var(--danger); }
.stat.tone-warn b { color: var(--attention); }
.stat.tone-ok b { color: var(--ok); }
.stat.tone-accent b { color: var(--accent-text); }
@media (max-width: 760px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

/* Verdict headline inside the product overview panel (score-panel) — same voice as sv-verdict. */
.sp-body .sp-headline { margin: 0 0 var(--sp-1); font-size: var(--fs-lg); }
.sp-body .sp-line { margin: 0 0 var(--sp-3); color: var(--text-secondary); font-size: var(--fs-sm); max-width: 70ch; }
.sp-body .sp-line b { color: var(--text-primary); }

/* Compact all-clear row — replaces a towering empty state when a list is simply empty & healthy. */
.all-clear { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-sm); color: var(--text-secondary); }
.all-clear .ac-dot { width: 9px; height: 9px; border-radius: 999px; background: var(--ok); flex: none; }
.all-clear b { color: var(--text-primary); }

/* Product tab strip under the hero — the sub-pages live here, not as a wall of hero buttons. */
.product-tabs { margin: calc(-1 * var(--sp-3)) 0 var(--sp-4); }

/* Hero action menu (e.g. CertControl's import options) — one button, small popover. */
.action-menu { position: relative; display: inline-flex; }
.action-menu .menu-pop { top: 42px; width: 240px; }
.action-menu.open .menu-pop { display: block; }
.menu-item { display: flex; align-items: center; gap: var(--sp-2); width: 100%; padding: var(--sp-2);
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-primary);
  font: inherit; font-size: var(--fs-sm); font-weight: 550; text-align: left; cursor: pointer; }
.menu-item:hover { background: var(--bg-hover); }

/* Day separators in event streams — a quiet label row that chunks the table into days. */
table.data tr.day-sep td { padding: var(--sp-3) var(--sp-3) var(--sp-1);
  font-size: var(--fs-xs); font-weight: 650; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .05em; border-bottom: none; }
table.data tr.day-sep:hover, table.data tbody tr.day-sep:hover { background: transparent; }

/* "By product" tiles on the technical dashboard — the findings-page ptile, four across. */
.ptile-strip.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .ptile-strip.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .ptile-strip.cols-4 { grid-template-columns: 1fr; } }

/* ── Simple SiteControl: per-website cards with a small health ring ───────────────────────────── */
.sv-card .ring.sv-site-ring { --pct: 0; --rc: var(--border-strong); width: 56px; height: 56px; border-radius: 50%;
  flex: none; align-self: center; background: conic-gradient(var(--rc) calc(var(--pct) * 1%), var(--bg-hover) 0);
  display: grid; place-items: center; position: relative; }
.sv-card .ring.sv-site-ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--bg-surface); }
.sv-card .ring.sv-site-ring > .rv { position: relative; font-weight: 800; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.sv-card .ring.sv-site-ring.ok { --rc: var(--ok); } .sv-card .ring.sv-site-ring.warn { --rc: var(--attention); } .sv-card .ring.sv-site-ring.bad { --rc: var(--danger); }
