:root {
  --bg: #f6f7f3;
  --surface: #ffffff;
  --surface-soft: #edf5f0;
  --text: #1d2521;
  --muted: #66736d;
  --line: #dde5df;
  --green: #2f8f6b;
  --green-dark: #1c6d50;
  --blue: #4077b8;
  --coral: #d06c55;
  --violet: #7a64a8;
  --shadow: 0 18px 45px rgba(34, 48, 42, 0.1);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(237, 245, 240, 0.92), rgba(246, 247, 243, 0.3) 34rem),
    var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1420px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 104px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4.25rem);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 1.04rem;
  line-height: 1.25;
}

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 800;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.primary-button {
  background: var(--green);
  color: #fff;
  box-shadow: 0 10px 22px rgba(47, 143, 107, 0.24);
}

.primary-button span {
  display: grid;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  line-height: 1;
}

.ghost-button {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.empty-state {
  display: grid;
  min-height: 58vh;
  place-items: center;
  border: 1px dashed #c8d8cf;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(47, 143, 107, 0.08), rgba(64, 119, 184, 0.05)),
    rgba(255, 255, 255, 0.62);
}

.empty-copy {
  max-width: 600px;
  padding: 48px 24px;
  text-align: center;
}

.empty-copy h2 {
  margin-bottom: 12px;
  font-size: clamp(1.55rem, 3vw, 2.5rem);
}

.empty-copy p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.dashboard {
  display: grid;
  gap: 18px;
}

.summary-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card span {
  display: block;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: clamp(1.45rem, 2.7vw, 2.05rem);
  line-height: 1.1;
}

.accent-green {
  border-top: 4px solid var(--green);
}

.accent-blue {
  border-top: 4px solid var(--blue);
}

.accent-coral {
  border-top: 4px solid var(--coral);
}

.context-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 700;
}

.chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 16px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-wide {
  grid-column: span 1;
}

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

.panel-header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: 320px;
}

.chart-wrap.tall {
  height: 390px;
}

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

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

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

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

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td {
  font-weight: 700;
}

td:first-child {
  color: var(--text);
  white-space: normal;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 36px));
  transform: translateY(16px);
  border-radius: 8px;
  padding: 14px 16px;
  background: #1d2521;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.is-hidden {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

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

  .upload-actions {
    justify-content: flex-start;
  }

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

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

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1420px);
    padding-top: 20px;
  }

  .topbar {
    min-height: auto;
    padding-bottom: 16px;
  }

  .upload-actions,
  .primary-button,
  .ghost-button {
    width: 100%;
  }

  .summary-bar {
    grid-template-columns: 1fr;
  }

  .panel,
  .metric-card {
    padding: 14px;
  }

  .chart-wrap,
  .chart-wrap.tall {
    height: 300px;
  }
}
