:root {
  color-scheme: light;
  --bg: #f8fafc;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --ok: #16a34a;
  --ok-bg: #dcfce7;
  --warn: #f97316;
  --warn-bg: #ffedd5;
  --degraded: #ea580c;
  --degraded-bg: #fed7aa;
  --fail: #dc2626;
  --fail-bg: #fee2e2;
  --unknown: #64748b;
  --unknown-bg: #f1f5f9;
  --link: #2563eb;
  --accent: #2563eb;
  --soft: #f8fafc;
  --sidebar: #0f172a;
  --sidebar-muted: #94a3b8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.app-layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  min-height: 100vh;
  padding: 18px 14px;
  background: var(--sidebar);
  color: #e2e8f0;
}

.sidebar-brand {
  display: grid;
  gap: 4px;
  padding: 8px 10px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.24);
  margin-bottom: 12px;
}

.sidebar-brand strong {
  font-size: 18px;
}

.sidebar-brand span {
  color: var(--sidebar-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

body.security-mode {
  --bg: #111827;
  --panel: #172026;
  --ink: #e5e7eb;
  --muted: #aab4bf;
  --line: #334155;
  --unknown: #cbd5e1;
  --unknown-bg: #334155;
  --link: #7dd3fc;
  --accent: #38bdf8;
  --soft: #1f2937;
}

body.security-mode .small-button,
body.security-mode a.button,
body.security-mode .tab,
body.security-mode .nav-link,
body.security-mode .view-button,
body.security-mode .demo-button,
body.security-mode .control-strip select {
  background: #111827;
  color: var(--ink);
}

body.security-mode .tab.is-active,
body.security-mode .nav-link.is-active,
body.security-mode .view-button.is-active,
body.security-mode .demo-button.is-active {
  background: #0f2a3a;
  color: var(--link);
}

.shell {
  max-width: none;
  min-width: 0;
  padding: 20px 22px 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.brand {
  min-width: 280px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}

.lead {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.topbar-side {
  display: grid;
  justify-items: end;
  gap: 10px;
  min-width: min(100%, 620px);
}

.control-strip,
.header-actions,
.view-switch,
.demo-switch {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.view-switch,
.demo-switch {
  align-items: center;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.view-switch > span,
.demo-switch > span {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.view-button,
.demo-button {
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 5px 9px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.view-button.is-active,
.demo-button.is-active {
  border-color: #1d4ed8;
  background: #2563eb;
  color: #ffffff;
}

.view-button:hover,
.demo-button:hover {
  color: var(--ink);
  background: rgba(37, 99, 235, 0.08);
}

.view-button.is-active:hover,
.demo-button.is-active:hover {
  color: #ffffff;
  background: #1d4ed8;
}

.control-strip label {
  display: grid;
  gap: 4px;
  min-width: 150px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.control-strip select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
}

.tabs {
  display: grid;
  gap: 6px;
}

.tab,
.nav-link {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: #cbd5e1;
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
  font-weight: 700;
  text-align: left;
}

.tab {
  cursor: pointer;
}

.nav-link {
  display: block;
  text-decoration: none;
}

.tab.is-active,
.nav-link.is-active {
  border-color: rgba(37, 99, 235, 0.7);
  color: #ffffff;
  background: #1d4ed8;
}

.tab:hover,
.nav-link:hover {
  background: rgba(148, 163, 184, 0.14);
  color: #ffffff;
}

.architecture-page .topbar {
  margin-bottom: 16px;
}

.architecture-content {
  display: grid;
  gap: 16px;
}

.architecture-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.architecture-grid article {
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 150px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.architecture-grid strong {
  font-size: 15px;
}

.architecture-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.service-summary {
  margin-top: 16px;
  margin-bottom: 0;
}

.loading-status {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--unknown);
  border-radius: 8px;
  background: var(--panel);
}

.loading-status-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.loading-status-head > div {
  display: grid;
  gap: 2px;
}

.loading-status-head strong {
  font-size: 13px;
  letter-spacing: 0;
}

.loading-status-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.loading-progress {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--unknown-bg);
}

.loading-progress > div {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}

.loading-status-loading { border-left-color: var(--accent); }
.loading-status-ready { border-left-color: var(--ok); }
.loading-status-stale { border-left-color: var(--warn); }
.loading-status-empty { border-left-color: var(--unknown); }
.loading-status-error { border-left-color: var(--fail); }
.loading-status-error .loading-progress > div { background: var(--fail); }
.loading-status-stale .loading-progress > div { background: var(--warn); }
.loading-status-ready .loading-progress > div { background: var(--ok); }

.loading-shell {
  display: grid;
  gap: 14px;
}

.loading-message,
.empty-state,
.error-state,
.stale-banner {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.error-state {
  border-left: 4px solid var(--fail);
}

.stale-banner {
  margin-bottom: 12px;
  border-left: 4px solid var(--warn);
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.skeleton-card,
.skeleton-panel {
  min-height: 118px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.skeleton-panel {
  min-height: 220px;
}

.skeleton-line {
  display: block;
  height: 12px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--unknown-bg), #e2e8f0, var(--unknown-bg));
  background-size: 220% 100%;
  animation: skeleton-pulse 1.2s ease-in-out infinite;
}

.skeleton-line.short { width: 42%; }
.skeleton-line.medium { width: 66%; }
.skeleton-line.long { width: 88%; }

@keyframes skeleton-pulse {
  0% { background-position: 0% 0; }
  100% { background-position: -220% 0; }
}

.card,
.content-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.card {
  padding: 14px;
  min-height: 104px;
}

.content-panel {
  padding: 16px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.card h3,
.section-title {
  margin: 0 0 8px;
  font-size: 16px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
  line-height: 1.35;
  margin-top: 4px;
}

.status-pill,
.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 8px;
  padding: 6px 10px;
  font-weight: 800;
  font-size: 13px;
}

.status-ok { background: var(--ok-bg); color: var(--ok); }
.status-warn { background: var(--warn-bg); color: var(--warn); }
.status-degraded { background: var(--degraded-bg); color: var(--degraded); }
.status-fail { background: var(--fail-bg); color: var(--fail); }
.status-unknown { background: var(--unknown-bg); color: var(--unknown); }
.text-ok { color: var(--ok); }
.text-fail { color: var(--fail); }

.readiness-card {
  grid-column: span 2;
}

.readiness-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.readiness-head h3 {
  margin-top: 8px;
}

.readiness-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 6px;
}

.readiness-metrics > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.readiness-card code {
  overflow-wrap: anywhere;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.list {
  display: grid;
  gap: 8px;
}

.row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(160px, 2fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.incident-row {
  grid-template-columns: minmax(150px, 1fr) minmax(220px, 2fr) auto auto;
}

.evidence-card {
  margin-top: 12px;
}

.report-hero {
  min-height: 140px;
}

.kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.kpi-card {
  min-height: 132px;
}

.mini-kpi {
  min-height: 96px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.mini-kpi span,
.mini-kpi small {
  display: block;
  color: var(--muted);
}

.mini-kpi strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 24px;
  line-height: 1.1;
}

.kpi-value {
  margin: 10px 0 6px;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
}

.executive-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card {
  min-height: 136px;
  padding: 14px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--panel);
}

.kpi-label,
.metric-card h3 {
  display: block;
  margin: 8px 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.report-type h3 {
  margin: 10px 0 6px;
  font-size: 15px;
}

.kpi-trend {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.kpi-trend.positive { color: var(--ok); }
.kpi-trend.warning { color: var(--warn); }
.kpi-trend.negative { color: var(--fail); }
.kpi-trend.ok { color: var(--ok); }
.kpi-trend.warn { color: var(--warn); }
.kpi-trend.fail { color: var(--fail); }

.metric-value {
  display: block;
  margin: 8px 0 4px;
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
}

.ranking-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.attention-panel {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--warn);
  border-radius: 8px;
  background: var(--panel);
}

.attention-list {
  display: grid;
  gap: 8px;
}

.attention-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.attention-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(430px, 1.25fr) minmax(320px, 1fr) minmax(300px, 0.9fr);
  gap: 12px;
  margin-bottom: 14px;
}

.analytics-panel {
  min-height: 260px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.department-panel {
  grid-column: 1 / -1;
  min-height: auto;
}

.anomaly-panel {
  grid-column: span 2;
}

.risk-panel {
  grid-column: span 1;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.department-table {
  min-width: 0;
}

.data-table th,
.data-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.data-table small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.agent-quality-card,
.agent-quality-history-card {
  margin: 12px 0 16px;
}

.quality-summary {
  margin: 10px 0;
  font-weight: 700;
  line-height: 1.45;
}

.quality-decision {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 10px 0;
}

.quality-decision > div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.quality-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.quality-grid > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.quality-grid strong {
  overflow-wrap: anywhere;
}

.quality-warning {
  margin-top: 10px;
  padding: 10px 12px;
  border-left: 4px solid var(--warn);
  border-radius: 8px;
  background: var(--warn-bg);
  color: #9a3412;
  font-weight: 700;
  line-height: 1.35;
}

.quality-error {
  margin: 10px 0 0;
  color: var(--fail);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.quality-details {
  margin-top: 10px;
}

.quality-details summary {
  cursor: pointer;
  color: var(--link);
  font-weight: 800;
}

.review-history {
  margin-top: 6px;
  max-width: 320px;
}

.review-history summary {
  cursor: pointer;
  color: var(--link);
  font-size: 12px;
  font-weight: 800;
}

.review-history ul {
  display: grid;
  gap: 6px;
  margin: 6px 0 0;
  padding-left: 16px;
}

.review-history li {
  overflow-wrap: anywhere;
}

.heatmap-table td {
  min-width: 120px;
}

.rank-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rank-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.rank-list small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.risk-list li {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
}

.anomaly-list li {
  grid-template-columns: auto 1fr;
  align-items: start;
}

.anomaly-list li > strong {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.anomaly-list p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.department-table th,
.department-table td,
.settings-table th,
.settings-table td {
  white-space: normal;
}

.dashboard-band {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.period-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--warn);
  border-radius: 8px;
  background: var(--soft);
}

.period-banner > div {
  display: grid;
  gap: 4px;
}

.security-band {
  border-left: 4px solid #7c2d12;
}

.technical-band {
  background: var(--soft);
}

.band-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.band-head h3 {
  margin: 0;
  font-size: 16px;
}

.report-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.report-type {
  min-height: 118px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.report-section {
  min-height: 180px;
}

.index-explain-card,
.kpi-explain-card {
  margin: 12px 0;
}

.risk-narrative-card {
  margin: 12px 0;
}

.action-center-card {
  margin: 12px 0;
}

.security-actions-card {
  border-left: 4px solid #7c2d12;
}

.action-center-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.action-item {
  display: grid;
  gap: 8px;
  min-height: 196px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.action-item-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.action-item-head strong,
.action-item p,
.action-item li {
  overflow-wrap: anywhere;
}

.action-item p {
  margin: 0;
}

.action-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.action-meta span {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.action-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.action-reasons span {
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
}

.action-item ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
}

.risk-narrative-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.risk-narrative-grid > div {
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.risk-narrative-grid strong {
  overflow-wrap: anywhere;
}

.risk-narrative-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.risk-narrative-columns h4 {
  margin: 0 0 6px;
  font-size: 14px;
}

.risk-narrative-columns ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
}

.risk-narrative-columns li {
  overflow-wrap: anywhere;
}

.ueba-risk-card {
  margin: 12px 0;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.section-head h3 {
  margin-bottom: 4px;
}

.index-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.index-metrics > div {
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.soft-panel {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.soft-panel h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.kpi-app-list {
  margin-top: 10px;
}

.app-weight-list {
  margin-top: 8px;
}

.app-weight-row {
  grid-template-columns: minmax(140px, 1fr) minmax(260px, 2fr) auto;
}

.audit-block,
.employee-drilldown,
.audit-note {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.audit-block h4,
.employee-drilldown h4 {
  margin: 0 0 6px;
  font-size: 14px;
}

.audit-note {
  display: grid;
  gap: 4px;
}

.employee-index-row {
  grid-template-columns: minmax(140px, 1fr) minmax(280px, 2fr) auto;
}

.employee-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.employee-card {
  min-height: 180px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.employee-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.leader-card {
  margin-top: 14px;
}

.leader-grid,
.investigation-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.leader-grid > div,
.investigation-grid > div {
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.report-actions {
  display: flex;
  justify-content: flex-end;
  margin: 10px 0;
}

.compact-list {
  gap: 6px;
}

.compact-row {
  grid-template-columns: minmax(110px, 1fr) minmax(170px, 2fr) auto;
  padding: 8px;
}

.report-section .compact-row {
  grid-template-columns: 1fr;
  align-items: flex-start;
}

.row strong,
.row .muted {
  min-width: 0;
  overflow-wrap: anywhere;
}

.markdown-card {
  margin-top: 12px;
}

.evidence-row {
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 2fr) auto auto;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.compact-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(92px, 1fr));
  gap: 6px;
}

.investigation-pack-button {
  margin-top: 8px;
  width: 100%;
  justify-content: center;
  text-align: center;
}

.small-button {
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--link);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.small-button.primary {
  border-color: #1d4ed8;
  background: #2563eb;
  color: #ffffff;
}

a.small-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.small-button:disabled {
  cursor: default;
  opacity: 0.55;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

a.button {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--link);
  text-decoration: none;
  font-weight: 700;
  background: #fff;
}

pre {
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: #111827;
  color: #f9fafb;
  font-size: 12px;
}

@media (max-width: 1280px) {
  .executive-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .analytics-grid { grid-template-columns: 1fr; }
  .ranking-grid { grid-template-columns: 1fr; }
  .department-panel,
  .anomaly-panel,
  .risk-panel { grid-column: auto; }
  .leader-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .risk-narrative-columns { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    min-height: auto;
  }
  .shell { padding: 14px; }
  .topbar { flex-direction: column; }
  .topbar-side { justify-items: stretch; min-width: 0; width: 100%; }
  .control-strip,
  .header-actions,
  .view-switch,
  .demo-switch { justify-content: flex-start; }
  .control-strip label { min-width: 100%; }
  .view-switch > span,
  .demo-switch > span { flex-basis: 100%; }
  .view-button,
  .demo-button { flex: 1 1 120px; }
  h1 { font-size: 24px; }
  .page-head { flex-direction: column; }
  .period-banner { flex-direction: column; align-items: flex-start; }
  .loading-status-head { flex-direction: column; }
  .band-head { flex-direction: column; align-items: flex-start; }
  .row { grid-template-columns: 1fr; }
  .executive-grid { grid-template-columns: 1fr; }
  .risk-narrative-grid { grid-template-columns: 1fr; }
  .risk-narrative-columns { grid-template-columns: 1fr; }
  .action-center-list { grid-template-columns: 1fr; }
  .action-meta { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
  .incident-row { grid-template-columns: 1fr; }
  .evidence-row { grid-template-columns: 1fr; }
  .readiness-card { grid-column: span 1; }
  .readiness-head { flex-direction: column; }
  .readiness-metrics { grid-template-columns: 1fr; }
  .app-weight-row { grid-template-columns: 1fr; }
  .employee-index-row { grid-template-columns: 1fr; }
  .employee-metrics { grid-template-columns: 1fr; }
  .risk-list li { grid-template-columns: 1fr; }
  .attention-item { grid-template-columns: 1fr; }
  .leader-grid { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; }
  .actions { justify-content: flex-start; }
}

@media print {
  body { background: #fff; }
  .tabs,
  .report-actions,
  .links,
  .small-button { display: none !important; }
  .shell {
    max-width: none;
    padding: 0;
  }
  .card,
  .content-panel {
    break-inside: avoid;
    border-color: #cbd5e1;
  }
}
