:root {
  color-scheme: light;
  --ink: #1d2935;
  --muted: #637282;
  --line: #dce3ea;
  --paper: #fffdf9;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-solid: #ffffff;
  --wash: #f3efe7;
  --accent: #2f7d73;
  --accent-strong: #1d665e;
  --accent-warm: #c95f2d;
  --blue: #3d8bd9;
  --green: #2eac68;
  --orange: #ef8f38;
  --red: #963d35;
  --shadow: 0 22px 50px rgba(47, 61, 74, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(201, 95, 45, 0.13), transparent 28rem),
    linear-gradient(135deg, #f9efe8 0%, #f3efe7 44%, #eef5f1 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

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

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1560px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 44px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.1rem, 5vw, 4.35rem);
  line-height: 0.98;
  font-weight: 900;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
}

.eyebrow,
.label {
  display: block;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.icon-button,
.segmented-control button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(47, 61, 74, 0.08);
}

.icon-button {
  padding: 0 18px;
}

.top-grid,
.snapshot-grid,
.analytics-grid,
.filter-grid {
  display: grid;
  gap: 16px;
}

.top-grid {
  grid-template-columns: 1fr 1fr 1fr;
  margin-bottom: 16px;
}

.metric-card,
.stat-card,
.filter-card,
.panel {
  border: 1px solid rgba(220, 227, 234, 0.8);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.metric-card,
.stat-card {
  min-height: 102px;
  padding: 22px;
}

.metric-card strong,
.stat-card strong {
  display: block;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
  font-weight: 900;
}

.metric-card:not(.metric-card-wide) strong {
  font-size: 1.35rem;
}

.metric-card p,
.stat-card p,
.panel-heading p {
  margin: 10px 0 0;
  color: var(--muted);
}

.wide-stat {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
}

.panel {
  padding: 22px;
}

.cohort-panel {
  margin-bottom: 16px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.panel-heading h2,
.section-heading h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2.4vw, 2.1rem);
  line-height: 1.08;
  font-weight: 900;
}

.panel-heading.compact {
  align-items: center;
}

.date-pill,
.table-count {
  flex: 0 0 auto;
  max-width: 100%;
  border-radius: 999px;
  background: #e8f1ee;
  color: var(--accent-strong);
  padding: 12px 18px;
  font-weight: 900;
}

.segmented-control {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}

.segmented-control button {
  padding: 0 18px;
}

.segmented-control button.active {
  border-color: var(--accent-warm);
  background: var(--accent-warm);
  color: #ffffff;
}

.date-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 14px;
}

.date-range input,
.filter-card select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  padding: 0 14px;
  font-weight: 750;
}

.date-arrow {
  padding-bottom: 14px;
  color: var(--muted);
  font-weight: 900;
}

.filter-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 16px;
}

.filter-card {
  display: block;
  padding: 18px;
}

.section-heading {
  margin: 2px 0 14px;
}

.snapshot-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.selected-card strong {
  font-size: clamp(1.35rem, 2.2vw, 2.2rem);
  line-height: 1.08;
}

.analytics-grid {
  grid-template-columns: 0.82fr 1.18fr;
  margin-bottom: 16px;
}

.donut-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: center;
  gap: 22px;
}

.donut {
  width: 220px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--line) 0 360deg);
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(29, 41, 53, 0.06);
}

.donut::after {
  content: attr(data-total);
  position: absolute;
  inset: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font-size: 2.2rem;
  font-weight: 900;
}

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

.legend-row {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 750;
}

.legend-dot,
.status-pill::before {
  width: 14px;
  height: 14px;
  border-radius: 999px;
}

.bar-chart {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(110px, 170px) 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 30px;
}

.bar-label {
  overflow: hidden;
  color: var(--muted);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf2;
}

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

.bar-value {
  min-width: 58px;
  text-align: right;
  font-weight: 900;
}

.table-panel {
  padding-bottom: 10px;
}

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

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

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

th {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 12px;
  background: #eef3f6;
  font-weight: 900;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  display: inline-block;
  background: currentColor;
}

.status-hit {
  color: var(--green);
}

.status-track {
  color: var(--blue);
}

.status-risk {
  color: var(--orange);
}

.status-missed {
  color: var(--red);
}

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

@media (max-width: 1120px) {
  .top-grid,
  .snapshot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .analytics-grid,
  .donut-layout {
    grid-template-columns: 1fr;
  }

  .donut {
    width: min(220px, 100%);
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 24px, 1560px);
    padding-top: 24px;
  }

  .hero,
  .panel-heading,
  .date-range {
    grid-template-columns: 1fr;
    display: grid;
  }

  .top-grid,
  .snapshot-grid,
  .filter-grid {
    grid-template-columns: 1fr;
  }

  .metric-card,
  .stat-card,
  .filter-card,
  .panel {
    border-radius: 18px;
  }

  .wide-stat,
  .bar-row {
    grid-template-columns: 1fr;
  }

  .date-arrow {
    padding: 0;
  }
}
