:root {
  color-scheme: light;
  --background: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172033;
  --muted: #667085;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eaf1ff;
  --danger: #b42318;
  --shadow: 0 12px 35px rgba(15, 23, 42, 0.07);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 88% 5%, rgba(37, 99, 235, 0.09), transparent 24rem),
    var(--background);
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 54px 0 64px;
}

.page-header,
.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
}

.eyebrow,
.section-label {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

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

h1 {
  margin-bottom: 9px;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.subtitle {
  margin-bottom: 0;
  color: var(--muted);
}

.filters {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.05);
  backdrop-filter: blur(12px);
}

.filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.filters input {
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface);
}

.filters button {
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: var(--accent);
  font-weight: 750;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
}

.filters button:hover {
  background: var(--accent-dark);
}

.filters button:active {
  transform: translateY(1px);
}

.filters button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 34px 0 16px;
}

.metric,
.panel {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  display: grid;
  min-height: 158px;
  padding: 22px;
  border-radius: 18px;
}

.metric-primary {
  border-color: #c9d9ff;
  background: linear-gradient(145deg, #fff 15%, var(--accent-soft));
}

.metric span {
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 700;
}

.metric strong {
  align-self: center;
  font-size: clamp(2rem, 4vw, 2.65rem);
  line-height: 1;
  letter-spacing: -0.055em;
}

.metric small {
  align-self: end;
  color: var(--muted);
}

.panel {
  margin-top: 16px;
  padding: 26px;
  border-radius: 20px;
}

.updated-at {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.chart-container {
  position: relative;
  min-height: 330px;
  margin-top: 18px;
}

#dailyChart {
  display: block;
  width: 100%;
  height: 310px;
  overflow: visible;
}

.chart-grid {
  stroke: #e8edf5;
  stroke-width: 1;
}

.chart-axis-label {
  fill: #7c879a;
  font-size: 11px;
}

.chart-area {
  fill: url(#chartGradient);
}

.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-point {
  fill: #fff;
  stroke: var(--accent);
  stroke-width: 2;
}

.table-wrapper {
  margin-top: 20px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 0.73rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

td {
  font-size: 0.92rem;
}

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

.page-link {
  display: inline-block;
  max-width: 780px;
  overflow: hidden;
  color: var(--text);
  font-weight: 650;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.page-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.numeric {
  text-align: right;
  white-space: nowrap;
}

.share {
  display: inline-flex;
  min-width: 58px;
  justify-content: flex-end;
  color: var(--accent-dark);
  font-weight: 750;
}

.empty-state {
  display: grid;
  min-height: 220px;
  margin: 0;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.error-message {
  margin: 16px 0 0;
  padding: 14px 16px;
  border: 1px solid #fecdca;
  border-radius: 12px;
  color: var(--danger);
  background: #fffbfa;
}

@media (max-width: 900px) {
  .page-header {
    align-items: stretch;
    flex-direction: column;
  }

  .filters {
    align-self: flex-start;
  }

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

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

  .filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .filters button {
    grid-column: 1 / -1;
  }

  .filters input {
    width: 100%;
  }

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

  .metric {
    min-height: 135px;
  }

  .panel {
    padding: 20px 16px;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}
