:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #1f2937;
  --soft: #4b5563;
  --muted: #6b7280;
  --line: #d9e0e8;
  --line-strong: #9fb2c7;
  --accent: #2563eb;
  --accent-2: #0f766e;
  --success: #16803c;
  --radius: 6px;
  --mono: "SFMono-Regular", "SF Mono", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

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

img {
  display: block;
  max-width: 100%;
}

button,
select {
  font: inherit;
}

.dashboard-shell {
  min-height: 100svh;
  padding: 20px;
}

.topbar {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1440px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: center;
  color: var(--ink);
  font-weight: 700;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  color: var(--soft);
  font-size: 13px;
}

.status-strip span {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 8px;
  background: var(--surface-2);
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  max-width: 1440px;
  margin: 18px auto 0;
}

.control-rail {
  position: sticky;
  top: 18px;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--surface);
}

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

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

h1 {
  margin-bottom: 12px;
  font-size: 28px;
  line-height: 1.12;
  text-wrap: balance;
}

h2 {
  margin-bottom: 0;
  font-size: 19px;
  line-height: 1.2;
}

.intro {
  color: var(--soft);
  font-size: 14px;
  line-height: 1.55;
}

.filters {
  display: grid;
  gap: 9px;
  margin-top: 22px;
}

.filters label {
  color: var(--soft);
  font-size: 13px;
  font-weight: 650;
}

.filters select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0 11px;
  color: var(--ink);
  background: var(--surface);
}

.filters select:focus {
  outline: 2px solid rgba(37, 99, 235, 0.24);
  outline-offset: 1px;
}

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

.acceptance span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.acceptance p {
  margin: 8px 0 0;
  color: var(--soft);
  font-size: 13px;
  line-height: 1.5;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(300px, 0.82fr);
  gap: 14px;
}

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

.metric,
.visual-panel,
.event-panel,
.table-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.metric {
  min-height: 108px;
  padding: 16px;
}

.metric span,
.panel-heading span,
th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.metric strong {
  display: block;
  margin-top: 12px;
  font-size: 28px;
  line-height: 1;
}

.metric em {
  display: inline-block;
  margin-top: 10px;
  color: var(--success);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.visual-panel,
.event-panel,
.table-panel {
  overflow: hidden;
}

.trend-panel,
.stage-panel {
  min-height: 350px;
}

.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 16px;
  background: var(--surface-2);
}

#trendChart {
  width: 100%;
  height: 280px;
  padding: 8px;
}

.stage-bars {
  display: grid;
  gap: 14px;
  padding: 18px 16px 20px;
}

.stage-row {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr) 54px;
  align-items: center;
  gap: 10px;
}

.stage-row span {
  color: var(--soft);
  font-size: 13px;
}

.bar-track {
  height: 13px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #edf2f7;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.bar-fill.w0 {
  width: 0;
}

.bar-fill.w12 {
  width: 12%;
}

.bar-fill.w25 {
  width: 25%;
}

.bar-fill.w33 {
  width: 33%;
}

.bar-fill.w50 {
  width: 50%;
}

.bar-fill.w67 {
  width: 67%;
}

.bar-fill.w75 {
  width: 75%;
}

.bar-fill.w100 {
  width: 100%;
}

.event-panel {
  display: grid;
  grid-template-columns: 1fr 190px;
  grid-column: 1 / -1;
  align-items: center;
  gap: 18px;
  min-height: 210px;
  padding: 20px;
}

.event-panel p {
  max-width: 680px;
  color: var(--soft);
  line-height: 1.55;
}

.event-panel img {
  width: 190px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.table-panel {
  grid-column: 1 / -1;
}

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

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

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

th {
  background: var(--surface-2);
}

td {
  color: var(--soft);
  font-size: 14px;
}

tbody tr:hover {
  background: #f7fbff;
}

.stage-pill {
  display: inline-flex;
  border: 1px solid #b9c7d6;
  border-radius: var(--radius);
  padding: 4px 7px;
  color: var(--ink);
  background: #eef4fb;
  font-size: 12px;
  font-weight: 650;
}

.trend-path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.grid-line {
  stroke: #e2e8f0;
  stroke-width: 1;
}

.trend-dot {
  fill: var(--accent-2);
  stroke: #ffffff;
  stroke-width: 3;
}

.axis-label {
  fill: var(--muted);
  font-size: 13px;
}

.value-label {
  fill: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 1060px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .control-rail {
    position: static;
  }

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

@media (max-width: 720px) {
  .dashboard-shell {
    padding: 12px;
  }

  .topbar,
  .event-panel {
    align-items: start;
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }

  .status-strip {
    justify-content: flex-start;
  }

  h1 {
    font-size: 25px;
  }

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

  .metric {
    min-height: 104px;
    padding: 14px;
  }

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

@media (max-width: 440px) {
  .metric-row {
    grid-template-columns: 1fr;
  }

  .stage-row {
    grid-template-columns: 82px minmax(0, 1fr) 42px;
  }
}
