:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-strong: #f0f5ff;
  --ink: #18202f;
  --muted: #667085;
  --line: #d9e1ee;
  --blue: #2563eb;
  --green: #0f9f6e;
  --red: #d92d20;
  --amber: #b7791f;
  --shadow: 0 10px 30px rgba(24, 32, 47, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
}

button:hover {
  border-color: var(--blue);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

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

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

h1 {
  font-size: 26px;
}

h2 {
  font-size: 16px;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  font-size: 13px;
  color: var(--muted);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amber);
}

.status-pill.ok .dot {
  background: var(--green);
}

.status-pill.bad .dot {
  background: var(--red);
}

main {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 20px 24px 36px;
}

.meta-strip,
.kpi-grid,
.split {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

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

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

.meta-strip > div {
  min-height: 66px;
  padding: 12px 14px;
}

.label,
.kpi span,
.facts dt {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.meta-strip strong {
  display: block;
  margin-top: 6px;
  font-size: 14px;
  overflow-wrap: anywhere;
}

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

.kpi {
  min-height: 92px;
  padding: 16px;
}

.kpi strong {
  display: block;
  margin-top: 10px;
  font-size: 24px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.kpi.accent {
  border-color: rgba(37, 99, 235, 0.3);
  background: #f8fbff;
}

.split {
  grid-template-columns: minmax(0, 2fr) minmax(320px, 0.8fr);
}

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

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.panel-title span {
  color: var(--muted);
  font-size: 13px;
}

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

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

.compact table {
  min-width: 620px;
}

th,
td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: #fbfcff;
}

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

.empty-row td {
  color: var(--muted);
  text-align: center;
  padding: 24px 12px;
}

.side-long,
.positive {
  color: var(--green);
}

.side-short,
.negative {
  color: var(--red);
}

.facts {
  display: grid;
  gap: 0;
  margin: 0;
}

.facts div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.facts div:last-child {
  border-bottom: 0;
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.risk-list {
  padding: 12px 16px 16px;
}

.risk-item {
  display: grid;
  grid-template-columns: minmax(90px, 140px) minmax(0, 1fr) minmax(90px, auto);
  align-items: center;
  gap: 12px;
  min-height: 34px;
}

.bar {
  height: 7px;
  border-radius: 999px;
  background: #e6edf8;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--blue);
}

.event-log {
  max-height: 320px;
  overflow: auto;
  padding: 8px 16px 16px;
}

.event {
  display: grid;
  grid-template-columns: minmax(160px, 210px) minmax(150px, 1fr) minmax(160px, 260px);
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.event:last-child {
  border-bottom: 0;
}

.event .muted {
  color: var(--muted);
}

@media (max-width: 1100px) {
  .meta-strip,
  .kpi-grid,
  .split {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar,
  .top-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  main {
    padding: 16px 12px 28px;
  }

  .meta-strip,
  .kpi-grid,
  .split {
    grid-template-columns: 1fr;
  }

  .facts div,
  .event {
    grid-template-columns: 1fr;
  }
}
