:root {
  color-scheme: light;

  /* British Racing Green — primary brand */
  --brand: #0b3d2e;
  --mint: #a8d5bc;

  /* Light, calm surfaces */
  --bg: #f8f8f6;
  --surface: #ffffff;
  --surface-sunken: #fafaf8;
  --line: #e4e3dd;
  --line-soft: #edece6;

  --text: #1c2320;
  --muted: #64706a;
  --dim: #98a19b;

  /* Status semantics — restrained on light */
  --success: #2e7d52;
  --success-strong: #2e7d52;
  --success-faint: #e9f3ed;
  --success-line: #c7dfd1;
  --warning: #a86a12;
  --warning-strong: #d99a2b;
  --warning-faint: #fbf3e1;
  --warning-line: #ead7ac;
  --error: #b03226;
  --error-strong: #c14b3c;
  --error-faint: #faecea;
  --error-line: #ebc6c0;
  --blue: #527190;
  --blue-strong: #6e8ca6;
  --blue-faint: #edf2f6;
  --blue-line: #ccd9e4;

  --sidebar-width: 224px;
  --font-ui: "Suisse Screen", "Suisse Int'l", "Suisse Intl", Inter,
    system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
    Arial, sans-serif;
  --font-display: "Suisse Int'l", "Suisse Intl", "Suisse Screen", Inter,
    system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
    Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    monospace;
  font-family: var(--font-ui);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 1120px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
select,
input {
  font: inherit;
}

::selection {
  background: rgba(11, 61, 46, 0.14);
}

:focus-visible {
  outline: 2px solid rgba(11, 61, 46, 0.55);
  outline-offset: 2px;
}

/* ———————————————————————————— Sidebar ———————————————————————————— */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  padding: 32px 24px 26px;
  display: flex;
  flex-direction: column;
  background: var(--brand);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 42px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 3px;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-copy strong {
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand-copy small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
  letter-spacing: 0.02em;
}

.primary-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 56px;
}

.primary-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  height: 42px;
  padding: 0 10px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.005em;
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 3px 3px 0;
  transition: color 140ms ease, background-color 140ms ease,
    border-color 140ms ease;
}

.primary-nav a span {
  color: rgba(255, 255, 255, 0.4);
  font-size: 10.5px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.primary-nav a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.primary-nav a.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.09);
  border-left-color: var(--mint);
}

.primary-nav a.active span {
  color: var(--mint);
}

.sidebar-status {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
  letter-spacing: 0.02em;
}

.sidebar-status .status-dot {
  background: #7ed3a5;
  box-shadow: 0 0 0 3px rgba(126, 211, 165, 0.16);
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--success-strong);
  box-shadow: 0 0 0 3px rgba(46, 125, 82, 0.12);
}

/* ———————————————————————————— Page frame ———————————————————————————— */

.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 44px 48px 64px;
  overflow: hidden;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 48px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

.page-header h1,
.section-heading h2,
.panel-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 560;
  letter-spacing: -0.02em;
}

.page-header h1 {
  font-size: clamp(30px, 2.6vw, 38px);
  font-weight: 580;
  line-height: 1.08;
}

.overview-header h1 span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.44em;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--brand);
  font-size: 10.5px;
  font-weight: 680;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.lede {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.project-meta {
  display: grid;
  grid-template-columns: auto auto;
  gap: 56px;
  margin: 0;
}

.project-meta div {
  min-width: 150px;
}

.project-meta dt,
.headline-metrics span,
.version-kpis span {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 550;
  letter-spacing: 0.01em;
}

.project-meta dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text);
}

/* ———————————————————————— Connection strip ———————————————————————— */

.connection-strip {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid var(--line-soft);
}

.connection-strip div {
  display: flex;
  align-items: center;
  padding-right: 26px;
  margin-right: 26px;
  border-right: 1px solid var(--line-soft);
  font-size: 12px;
}

.connection-strip div:last-child {
  border-right: 0;
}

.connection-strip strong {
  margin-right: 8px;
  font-size: 12px;
  font-weight: 620;
}

.connection-strip div > span:last-child {
  color: var(--muted);
}

/* ———————————————————————— KPI strip ———————————————————————— */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(105px, 1fr));
  margin: 26px 0 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(18, 28, 24, 0.04);
}

.metric {
  position: relative;
  min-width: 0;
  padding: 20px 18px 19px;
  border-right: 1px solid var(--line-soft);
}

.metric:first-child {
  padding-left: 20px;
}

.metric:last-child {
  border-right: 0;
}

.metric > span {
  display: block;
  min-height: 32px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 550;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: clamp(22px, 1.7vw, 28px);
  font-weight: 570;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.metric small {
  display: block;
  min-height: 15px;
  margin-top: 5px;
  color: var(--dim);
  font-size: 10.5px;
  white-space: nowrap;
}

.metric.positive strong {
  color: var(--success);
}

.metric.warning strong {
  color: var(--warning);
}

.metric.critical strong {
  color: var(--error);
}

/* ———————————————————————— Panels ———————————————————————— */

.visual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
}

.panel {
  min-width: 0;
  padding: 24px 24px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(18, 28, 24, 0.04);
}

.panel-header,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.panel-header h2,
.section-heading h2 {
  font-size: 17px;
}

.panel-context,
.section-heading > span {
  color: var(--dim);
  font-size: 11.5px;
  letter-spacing: 0.01em;
}

/* ———————————————————————— Charts ———————————————————————— */

.stacked-bar {
  height: 20px;
  display: flex;
  gap: 2px;
  margin: 38px 0 24px;
  background: var(--line-soft);
  border-radius: 2px;
  overflow: hidden;
}

.stacked-bar > span {
  min-width: 2px;
}

.bar-exact,
.bar-fallback,
.bar-ambiguous,
.bar-source,
.bar-target {
  display: inline-block;
}

.bar-exact { background: var(--brand); }
.bar-fallback { background: #7aa98f; }
.bar-ambiguous { background: var(--warning-strong); }
.bar-source { background: var(--error-strong); }
.bar-target { background: var(--blue-strong); }

.legend-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.legend-grid div {
  min-width: 0;
}

.legend-swatch {
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 1.5px;
}

.legend-grid small {
  color: var(--muted);
  font-size: 11px;
}

.legend-grid strong {
  display: block;
  margin-top: 5px;
  font-size: 15px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
}

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 26px;
}

.bar-row-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
}

.bar-row-label span {
  font-size: 12.5px;
}

.bar-row-label strong {
  font-size: 12.5px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
}

.track {
  height: 6px;
  background: #efeee9;
  border-radius: 2px;
  overflow: hidden;
}

.issue-total {
  display: block;
  height: 100%;
  background: var(--error-strong);
  border-radius: 2px;
}

.bar-row > small {
  display: block;
  margin-top: 6px;
  color: var(--dim);
  font-size: 11px;
}

/* ———————————————————————— Page header aside ———————————————————————— */

.compact-header {
  align-items: center;
}

.result-summary {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  column-gap: 10px;
  min-width: 190px;
}

.result-summary > strong {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 570;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.result-summary > span {
  color: var(--muted);
  font-size: 12px;
}

.result-summary small {
  grid-column: 1 / -1;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
}

.result-summary small b {
  font-weight: 620;
}

.text-error { color: var(--error); }
.text-warning { color: var(--warning); }

/* ———————————————————————— Filters ———————————————————————— */

.filter-bar {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.filter-bar label {
  position: relative;
  flex: 0 1 250px;
  min-width: 200px;
  padding: 8px 13px 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.filter-bar label:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11, 61, 46, 0.1);
}

.filter-bar label span {
  display: block;
  margin-bottom: 2px;
  color: var(--dim);
  font-size: 11px;
  font-weight: 550;
  letter-spacing: 0.01em;
}

.filter-bar select {
  width: 100%;
  padding: 2px 24px 2px 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 13px;
  cursor: pointer;
}

/* ———————————————————————— Tables ———————————————————————— */

.table-shell {
  width: 100%;
  margin-top: 24px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(18, 28, 24, 0.04);
}

.insights-table-shell {
  max-height: calc(100vh - 262px);
}

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

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table th {
  height: 40px;
  padding: 0 14px;
  color: var(--muted);
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  vertical-align: top;
  border-bottom: 1px solid var(--line-soft);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr {
  transition: background-color 100ms ease;
}

.data-table tbody tr:hover td {
  background: #f3f6f4;
}

.data-table td > strong {
  display: block;
  font-weight: 600;
}

.data-table td > small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.insights-table {
  min-width: 1180px;
}

.insights-table th:nth-child(1) { width: 84px; }
.insights-table th:nth-child(2) { width: 172px; }
.insights-table th:nth-child(3) { width: 78px; }
.insights-table th:nth-child(4) { width: 148px; }
.insights-table th:nth-child(5),
.insights-table th:nth-child(6) { width: 108px; }
.insights-table th:nth-child(7) { width: 100px; }
.insights-table th:nth-child(8) { width: 78px; }
.insights-table th:nth-child(9) { min-width: 220px; }

/* ———————————————————————— Pills & badges ———————————————————————— */

.severity,
.status-pill,
.change-status {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 11px;
  font-weight: 620;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.severity-error {
  color: var(--error);
  background: var(--error-faint);
  border-color: var(--error-line);
}

.severity-warning {
  color: var(--warning);
  background: var(--warning-faint);
  border-color: var(--warning-line);
}

.severity-info {
  color: var(--blue);
  background: var(--blue-faint);
  border-color: var(--blue-line);
}

.status-pill {
  color: var(--muted);
  border-color: var(--line);
}

.status-exact_match,
.status-fallback_match {
  color: var(--success);
  background: var(--success-faint);
  border-color: var(--success-line);
}

.status-ambiguous,
.status-split_candidate,
.status-merge_candidate {
  color: var(--warning);
  background: var(--warning-faint);
  border-color: var(--warning-line);
}

.status-source_only,
.status-target_only {
  color: var(--error);
  background: var(--error-faint);
  border-color: var(--error-line);
}

/* ———————————————————————— Technical values ———————————————————————— */

.value-cell {
  max-width: 132px;
  overflow: hidden;
  color: #4d5a54;
  font-family: var(--font-mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.confidence {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.note-cell {
  max-width: 280px;
  color: var(--muted);
  line-height: 1.5;
}

.nowrap {
  white-space: nowrap;
}

/* ———————————————————————— Flächen ———————————————————————— */

.headline-metrics {
  display: flex;
  align-items: flex-end;
  gap: 60px;
}

.headline-metrics div {
  display: flex;
  flex-direction: column;
}

.headline-metrics strong {
  font-family: var(--font-display);
  font-size: 29px;
  font-weight: 570;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.headline-metrics strong small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
}

.area-visuals {
  margin-top: 26px;
}

.area-bars {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-top: 22px;
}

.area-bar-row {
  display: grid;
  grid-template-columns: 128px minmax(80px, 1fr) 84px;
  align-items: center;
  gap: 14px;
}

.area-label {
  min-width: 0;
}

.area-label strong,
.area-label small,
.area-value strong,
.area-value small {
  display: block;
}

.area-label strong {
  font-size: 12.5px;
  font-weight: 620;
}

.area-label small {
  overflow: hidden;
  margin-top: 1px;
  color: var(--dim);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.area-bar-row .track {
  height: 8px;
}

.area-bar-row .track span {
  display: block;
  height: 100%;
  min-width: 1px;
  background: #3e7a5e;
  border-radius: 2px;
}

.area-bar-row:nth-child(1) .track span {
  background: var(--brand);
}

.area-value {
  text-align: right;
}

.area-value strong {
  font-size: 12.5px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
}

.area-value small {
  margin-top: 1px;
  color: var(--dim);
  font-size: 10.5px;
}

.floor-bars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 22px;
}

.floor-bars .area-bar-row {
  grid-template-columns: 56px minmax(60px, 1fr) 64px;
}

.section-heading {
  align-items: flex-end;
  margin: 36px 0 -8px;
}

.area-table {
  min-width: 720px;
}

.area-table th:nth-child(n+3),
.area-table .numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.area-table td {
  padding-block: 10px;
}

/* ———————————————————————— Versionen ———————————————————————— */

.version-header {
  align-items: center;
}

.version-arrow {
  color: var(--brand);
  font-weight: 400;
}

.version-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(92px, 1fr));
  min-width: 500px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(18, 28, 24, 0.04);
}

.version-kpis div {
  padding: 14px 18px 15px;
  border-right: 1px solid var(--line-soft);
}

.version-kpis div:last-child {
  border-right: 0;
}

.version-kpis span,
.version-kpis strong {
  display: block;
}

.version-kpis strong {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 570;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.version-kpis .changed strong { color: var(--warning); }
.version-kpis .added strong { color: var(--success); }
.version-kpis .removed strong { color: var(--error); }

.version-table {
  min-width: 1180px;
}

.version-table th:nth-child(1) { width: 92px; }
.version-table th:nth-child(2) { width: 112px; }
.version-table th:nth-child(3) { width: 172px; }
.version-table th:nth-child(4) { width: 72px; }
.version-table th:nth-child(5) { width: 152px; }
.version-table th:nth-child(6),
.version-table th:nth-child(7) { width: 182px; }
.version-table th:nth-child(8) { width: 150px; }

.change-modified {
  color: var(--warning);
  background: var(--warning-faint);
  border-color: var(--warning-line);
}

.change-added {
  color: var(--success);
  background: var(--success-faint);
  border-color: var(--success-line);
}

.change-removed {
  color: var(--error);
  background: var(--error-faint);
  border-color: var(--error-line);
}

.change-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.change-tags span {
  padding: 3px 7px;
  color: #5c6761;
  background: var(--surface-sunken);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  font-size: 10.5px;
  white-space: nowrap;
}

.diff-cell > span {
  display: block;
  margin-bottom: 3px;
  color: #3f4b45;
  font-family: var(--font-mono);
  font-size: 11px;
}

.diff-cell > span:last-child {
  margin-bottom: 0;
}

.diff-cell small {
  display: inline-block;
  min-width: 50px;
  margin-right: 6px;
  color: var(--dim);
  font-family: var(--font-ui);
  font-size: 10px;
}

.old-value {
  color: var(--dim);
}

.new-value {
  background: #f1f7f3;
}

.delta-value span {
  color: var(--brand);
  white-space: nowrap;
}

/* ———————————————————————— States ———————————————————————— */

.empty-state {
  height: 120px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
  vertical-align: middle !important;
}

.error-panel {
  max-width: 660px;
  margin-top: 22vh;
  padding-top: 24px;
  border-top: 2px solid var(--error);
}

.error-panel h1 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 580;
  letter-spacing: -0.02em;
}

.error-panel p:last-child {
  color: var(--muted);
}

/* ———————————————————————— Scrollbars ———————————————————————— */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: #d5d4cd;
  border: 3px solid transparent;
  border-radius: 6px;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #bdbcb4;
  border: 3px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ———————————————————————— Responsive ———————————————————————— */

@media (max-width: 1280px) {
  :root { --sidebar-width: 196px; }
  .sidebar { padding-inline: 20px; }
  .main-content { padding: 36px 30px 52px; }
  .metric { padding-inline: 13px; }
  .metric:first-child { padding-left: 14px; }
  .metric > span { font-size: 11px; }
  .metric small { display: none; }
  .version-kpis { min-width: 440px; }
  .area-bar-row { grid-template-columns: 106px minmax(70px, 1fr) 72px; }
}
