:root {
  color-scheme: light;
  --ink: #18222f;
  --muted: #667085;
  --line: #d8dee8;
  --panel: #ffffff;
  --surface: #f4f7fb;
  --blue: #2764d9;
  --teal: #08847f;
  --amber: #b86b00;
  --red: #be3b35;
  --green: #147a43;
  --violet: #6b4acb;
  --shadow: 0 10px 28px rgba(31, 45, 61, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--surface);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(18px, 4vw, 48px) 16px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

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

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 20px;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
  letter-spacing: 0;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, 1fr));
  gap: 8px;
  min-width: min(340px, 100%);
}

.status-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfd;
  font-size: 12px;
  color: var(--muted);
}

.status-chip strong {
  color: var(--ink);
  font-size: 13px;
}

main {
  padding: 18px clamp(14px, 4vw, 48px) 36px;
}

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

.metric {
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 16px;
  font-size: 32px;
  line-height: 1;
  letter-spacing: 0;
}

.metric small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.35;
}

.metric[data-tone="blue"] {
  border-top: 4px solid var(--blue);
}

.metric[data-tone="teal"] {
  border-top: 4px solid var(--teal);
}

.metric[data-tone="amber"] {
  border-top: 4px solid var(--amber);
}

.metric[data-tone="red"] {
  border-top: 4px solid var(--red);
}

.metric[data-tone="green"] {
  border-top: 4px solid var(--green);
}

.metric[data-tone="violet"] {
  border-top: 4px solid var(--violet);
}

.overview-band {
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(280px, 0.9fr);
  gap: 16px;
  margin-bottom: 16px;
}

.chart-wrap,
.timeline-wrap,
.workspace,
.view-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-head {
  padding: 16px 16px 0;
}

.section-head p {
  color: var(--muted);
  font-size: 13px;
}

.funnel-chart {
  min-height: 230px;
  padding: 6px 12px 16px;
}

.timeline {
  display: grid;
  gap: 8px;
  max-height: 246px;
  margin: 0;
  padding: 8px 16px 16px 38px;
  overflow: auto;
}

.timeline li {
  padding-left: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.timeline strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.timeline .failed strong,
.timeline .re-entered strong,
.timeline .rerun strong,
.timeline .rework strong {
  color: var(--amber);
}

.timeline .failed strong {
  color: var(--red);
}

.timeline .rerun strong {
  color: var(--blue);
}

.workspace {
  overflow: hidden;
}

.tabs {
  display: flex;
  gap: 2px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tab {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  border-color: #bdd2f7;
  background: #eef4ff;
  color: var(--blue);
}

.view {
  min-height: 520px;
  padding: 16px;
}

.split {
  display: grid;
  grid-template-columns: minmax(340px, 1.1fr) minmax(300px, 0.9fr);
  gap: 16px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 13px;
}

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

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  z-index: 1;
}

tr[data-selected="true"] {
  background: #eef9f6;
}

tbody tr {
  cursor: pointer;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f1f4f8;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.pill.high {
  background: #fff0ed;
  color: var(--red);
}

.pill.critical {
  background: #fff0ed;
  color: var(--red);
}

.pill.medium {
  background: #fff8e8;
  color: var(--amber);
}

.pill.low {
  background: #eef6f2;
  color: var(--green);
}

code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

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

.detail {
  min-height: 420px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.kv {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 12px;
  margin: 14px 0;
  font-size: 13px;
}

.kv dt {
  color: var(--muted);
  font-weight: 750;
}

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.dbom-graph {
  width: 100%;
  height: 250px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.dependency-graph {
  width: 100%;
  min-height: 260px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.action-stat {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.action-stat strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.certificate {
  max-height: 560px;
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcfd;
  line-height: 1.5;
}

.certificate h1 {
  font-size: 28px;
}

.certificate h2 {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

@media (max-width: 1080px) {
  .metric-grid,
  .action-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .overview-band,
  .split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .shell-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-strip,
  .metric-grid,
  .action-grid {
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .metric strong {
    font-size: 26px;
  }

  .view {
    padding: 10px;
  }
}

@media (max-width: 460px) {
  .metric-grid,
  .action-grid,
  .status-strip {
    grid-template-columns: 1fr;
  }

  .kv {
    grid-template-columns: 1fr;
  }
}
