:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --text: #17202a;
  --muted: #627083;
  --line: #d7dee6;
  --green: #147a5c;
  --green-bg: #e7f5ef;
  --amber: #996a00;
  --amber-bg: #fff3d8;
  --red: #a33b3b;
  --blue: #2459a6;
  --blue-bg: #e7effb;
  --shadow: 0 10px 30px rgba(22, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  background: #18212b;
  color: #f7fafc;
}

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

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: #f7fafc;
  color: #18212b;
  font-weight: 800;
}

.brand span,
.safety-panel p {
  display: block;
  margin: 2px 0 0;
  color: #b8c3cf;
  font-size: 13px;
}

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

.nav-tab {
  height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #dbe5ef;
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
}

.nav-tab:hover,
.nav-tab.is-active {
  background: #2b3948;
  color: #ffffff;
}

.safety-panel {
  margin-top: auto;
  padding: 14px;
  border: 1px solid #334455;
  border-radius: 8px;
  background: #202c38;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 16px;
}

.topbar-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.search {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.search input {
  width: min(34vw, 340px);
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
}

.primary-action,
.secondary-action,
menu button {
  display: inline-grid;
  place-items: center;
  height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
}

.primary-action,
menu button {
  background: var(--green);
  color: #ffffff;
}

.secondary-action {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--blue);
}

.status-strip,
.metric-grid,
.split-grid {
  display: grid;
  gap: 12px;
}

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

.status-strip > div,
.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.status-strip > div,
.metric {
  min-height: 84px;
  padding: 14px;
}

.status-strip span,
.metric span,
.metric small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.status-strip strong,
.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

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

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

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

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

.pill {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill.good {
  background: var(--green-bg);
  color: var(--green);
}

.pill.warn {
  background: var(--amber-bg);
  color: var(--amber);
}

.pill.neutral {
  background: var(--blue-bg);
  color: var(--blue);
}

.locked {
  color: var(--red);
}

.workflow-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 22px;
}

.workflow-list li,
.gate-list div,
.timeline article,
.data-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-2);
}

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

.gate-list div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.data-table {
  display: grid;
  gap: 8px;
}

.data-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 12px;
  align-items: center;
}

.data-row span,
.detail-list dt,
.timeline time {
  color: var(--muted);
  font-size: 12px;
}

.data-row strong,
.detail-list dd {
  margin: 3px 0 0;
}

.detail-list {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px 14px;
  margin: 0;
}

.detail-list dd {
  min-width: 0;
  overflow-wrap: anywhere;
}

.policy-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.code-block {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  border-radius: 8px;
  background: #111820;
  color: #e9f0f7;
  padding: 14px;
  font-size: 12px;
  line-height: 1.45;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline article {
  display: grid;
  gap: 4px;
}

.view {
  display: none;
}

.view.is-active {
  display: grid;
  gap: 18px;
}

.modal {
  width: min(720px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(23, 32, 42, 0.48);
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

menu {
  display: flex;
  justify-content: flex-end;
  margin: 14px 0 0;
  padding: 0;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding: 16px;
  }

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

  .nav-tab {
    text-align: center;
    padding: 0 6px;
  }

  .topbar,
  .topbar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .search input {
    width: 100%;
  }

  .status-strip,
  .metric-grid,
  .split-grid {
    grid-template-columns: 1fr;
  }

  .data-row,
  .detail-list {
    grid-template-columns: 1fr;
  }
}
