:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f9fbff;
  --border: #dbe3f0;
  --text: #142033;
  --muted: #66758c;
  --primary: #2f6bff;
  --primary-soft: #e8f0ff;
  --success: #1f9d62;
  --warning: #d9a000;
  --shadow: 0 12px 30px rgba(20, 32, 51, 0.08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}
button, input, table { font: inherit; }
.app-shell {
  width: min(1200px, calc(100% - 24px));
  max-width: calc(100vw - 24px);
  margin: 0 auto;
  padding: 16px 0 40px;
}
.topbar, .tab-nav, .panel-card, .definitions-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 20px;
}
.topbar {
  padding: 20px;
  display: flex;
  gap: 16px;
  flex-direction: column;
  margin-bottom: 16px;
}
.topbar-actions, .tab-nav { display: flex; gap: 10px; flex-wrap: wrap; }
.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 12px;
  color: var(--muted);
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.7rem, 5vw, 2.3rem); }
.tab-nav {
  padding: 8px;
  position: sticky;
  top: 0;
  z-index: 5;
  margin-bottom: 16px;
}
.tab-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 600;
}
.tab-button.active {
  background: var(--primary-soft);
  color: var(--primary);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.section-heading, .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.definitions-card, .panel-card { padding: 18px; margin-bottom: 16px; }
.definitions-grid, .metric-grid, .content-grid {
  display: grid;
  gap: 14px;
}
.definitions-grid { grid-template-columns: 1fr; }
.metric-grid { grid-template-columns: 1fr; }
.metric-card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
}
.metric-card.fail-green { border-color: #b8e6cd; background: #edf9f2; color: #16a34a; }
.metric-card.fail-yellow { border-color: #f0d88c; background: #fff8df; color: #ca8a04; }
.metric-card.fail-red { border-color: #efb0b0; background: #fff0f0; color: #dc2626; }
.metric-card.fail-green .provenance,
.metric-card.fail-green .metric-title,
.metric-card.fail-green .metric-meta { color: #166534; }
.metric-card.fail-yellow .provenance,
.metric-card.fail-yellow .metric-title,
.metric-card.fail-yellow .metric-meta { color: #92400e; }
.metric-card.fail-red .provenance,
.metric-card.fail-red .metric-title,
.metric-card.fail-red .metric-meta { color: #991b1b; }
.metric-value { font-size: 1.85rem; font-weight: 700; margin: 8px 0; }
.metric-title { font-weight: 600; }
.metric-meta, .provenance { color: var(--muted); font-size: 13px; line-height: 1.45; }
.badge, .status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}
.badge.warning { color: #8a6300; background: #fff7db; }
.badge.muted { color: var(--muted); }
.ghost-button {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: transparent;
  padding: 10px 12px;
}
.chart-card {
  overflow: hidden;
}
.chart-card canvas {
  width: 100%;
  display: block;
  max-height: 360px;
}
.two-col { grid-template-columns: 1fr; }
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}
th, td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
td a {
  display: block;
  position: relative;
  z-index: 3;
}
.miro-shell {
  display: grid;
  gap: 12px;
}
#miro-frame {
  width: 100%;
  min-height: 280px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #eef2f8;
}
.snapshot-placeholder {
  min-height: 120px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #f8fafc;
}
.narrative-list { padding-left: 18px; color: var(--muted); }
.heatmap-matrix-wrap {
  overflow-x: auto;
}
.heatmap-matrix {
  display: grid;
  gap: 4px;
  min-width: 920px;
}
.heatmap-head,
.heatmap-side,
.heatmap-cell-matrix {
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 12px;
}
.heatmap-head,
.heatmap-side {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-weight: 600;
}
.heatmap-side {
  justify-items: start;
  padding: 0 10px;
  position: sticky;
  left: 0;
  z-index: 1;
}
.heatmap-cell-matrix {
  border: 1px solid rgba(20, 32, 51, 0.06);
}
.hidden { display: none; }
@media (max-width: 699px) {
  .app-shell {
    width: calc(100% - 16px);
    max-width: calc(100vw - 16px);
  }
  .definitions-card, .panel-card {
    padding: 14px;
  }
  .table-wrap {
    overflow-x: hidden;
  }
  table {
    font-size: 12px;
  }
  th, td {
    padding: 10px 6px;
  }
  .chart-card canvas {
    max-height: 260px;
  }
}

@media (min-width: 700px) {
  .chart-card canvas {
    max-height: 300px;
  }
  .topbar { flex-direction: row; justify-content: space-between; align-items: center; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .definitions-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 980px) {
  .chart-card canvas {
    max-height: 320px;
  }
  .app-shell { width: min(1280px, calc(100% - 48px)); padding-top: 24px; }
  .metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
