:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-soft: #eef3f6;
  --ink: #172026;
  --muted: #5c6873;
  --line: #d8dee4;
  --accent: #116466;
  --accent-strong: #0b4a4c;
  --blue: #214f88;
  --green: #206a43;
  --amber: #916313;
  --danger: #a23d31;
  --shadow: 0 10px 24px rgba(23, 32, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

a {
  color: var(--accent-strong);
  font-weight: 750;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input {
  font: inherit;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner,
.main {
  margin: 0 auto;
  max-width: 1440px;
}

.topbar-inner {
  align-items: center;
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr auto;
  padding: 18px 24px;
}

.brand {
  display: grid;
  gap: 3px;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.15;
  margin-bottom: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
  margin-bottom: 12px;
}

h3 {
  font-size: 15px;
  line-height: 1.25;
  margin-bottom: 8px;
}

.nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.nav a,
.button {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: inline-flex;
  font-size: 14px;
  font-weight: 800;
  min-height: 38px;
  padding: 7px 12px;
}

.nav a {
  background: var(--surface);
  color: var(--ink);
}

.button {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  cursor: pointer;
  justify-content: center;
}

.button.secondary {
  background: var(--surface);
  color: var(--accent-strong);
}

.button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.main {
  display: grid;
  gap: 18px;
  padding: 20px 24px 36px;
}

.notice,
.panel,
.card,
.metric-card,
.summary-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.notice {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr auto;
  padding: 16px;
}

.notice p {
  color: var(--muted);
  margin-bottom: 0;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-header {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 14px;
}

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

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

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

.card,
.summary-item {
  padding: 14px;
}

.card p,
.muted {
  color: var(--muted);
}

.card p:last-child,
.panel p:last-child {
  margin-bottom: 0;
}

.briefing-card {
  border-left: 4px solid var(--accent);
}

.callout {
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  margin-top: 14px;
  padding: 12px;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
}

.detail-list li {
  color: var(--muted);
}

.detail-list strong {
  color: var(--ink);
}

.flow-list {
  display: grid;
  gap: 10px;
}

.flow-step {
  align-items: start;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: 42px 1fr;
  padding: 12px;
}

.flow-step > span {
  align-items: center;
  background: var(--accent);
  border-radius: 50%;
  color: #ffffff;
  display: inline-flex;
  font-size: 12px;
  font-weight: 850;
  height: 34px;
  justify-content: center;
  min-width: 34px;
  padding: 0 7px;
  width: 34px;
}

.flow-step strong {
  display: block;
  margin-bottom: 4px;
}

.flow-step p {
  color: var(--muted);
  margin-bottom: 0;
}

.panel-subsection {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 16px;
}

.badge {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  min-height: 28px;
  padding: 3px 10px;
  white-space: nowrap;
}

.badge.staff,
.badge.fresh {
  background: #e8f4ee;
  border-color: #b7d9c7;
  color: var(--green);
}

.badge.fixture {
  background: #fff6df;
  border-color: #ead49a;
  color: var(--amber);
}

.badge.error,
.badge.stale {
  background: #fbeeea;
  border-color: #e7c1b8;
  color: var(--danger);
}

.diagram {
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
}

.diagram svg {
  display: block;
  height: auto;
  width: 100%;
}

.doc-list,
.lineage-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.doc-list li,
.lineage-list li {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 4px;
  list-style: none;
  padding: 10px 0;
}

.path,
.lineage-ref {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.toolbar {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr auto;
}

.range-form {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 4px;
}

input[type="date"] {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 38px;
  min-width: 158px;
  padding: 7px 9px;
}

.status-line {
  color: var(--muted);
  font-size: 13px;
  min-height: 20px;
}

.status-line.error {
  color: var(--danger);
  font-weight: 800;
}

.summary-label,
.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  margin-bottom: 5px;
}

.summary-value {
  font-size: 18px;
  font-weight: 850;
  margin-bottom: 0;
}

.metric-card {
  box-shadow: none;
  padding: 14px;
}

.metric-value {
  font-size: 28px;
  font-weight: 850;
  line-height: 1;
  margin-bottom: 0;
}

.metric-unit {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  margin-left: 4px;
}

.fact-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 10px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 100%;
  width: 100%;
}

.architecture-table {
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.architecture-table td:first-child,
.architecture-table td:nth-child(2) {
  font-weight: 750;
}

td.value-cell {
  font-weight: 850;
  text-align: right;
  white-space: nowrap;
}

.task-name {
  font-weight: 750;
  min-width: 220px;
}

.empty-state {
  align-items: center;
  border: 1px dashed #c4ccd4;
  display: grid;
  gap: 12px;
  justify-items: start;
  padding: 22px;
}

.hidden {
  display: none;
}

@media (max-width: 1100px) {
  .grid-3,
  .grid-4,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar-inner,
  .notice,
  .toolbar,
  .flow-step,
  .grid-2,
  .grid-3,
  .grid-4,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .nav,
  .range-form {
    justify-content: flex-start;
  }

  .main {
    padding: 14px;
  }

  .metric-value {
    font-size: 24px;
  }
}
