:root {
  --bg-main: #f5f7f9;
  --bg-card: #ffffff;
  --bg-soft: #f0f3f6;
  --text-main: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #94a3b8;
  --border-subtle: #d9e1e6;
  --space-xl: 32px;
  --space-lg: 24px;
  --space-md: 20px;
  --space-sm: 16px;
  --trend-color: #2f80ed;
  --trend-fill: rgba(47, 128, 237, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
}

:root[data-theme="dark"] {
  --bg-main: #121212;
  --bg-card: #1e1e1e;
  --bg-soft: #191c20;
  --text-main: #e5e7eb;
  --text-secondary: #9ca3af;
  --text-muted: #7b8490;
  --border-subtle: #2b323c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg-main);
  color: var(--text-main);
  font-family: inherit;
  line-height: 1.4;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: var(--space-lg);
}

h1 {
  margin: 0 0 var(--space-lg);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: none;
}

h2 {
  margin: 0 0 var(--space-sm);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  text-transform: none;
}

.card {
  background: var(--bg-card);
  border-radius: 14px;
  padding: var(--space-md);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
  margin-bottom: var(--space-lg);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-sm);
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-transform: none;
}

select,
input[type="date"] {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0 12px;
  background: var(--bg-soft);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  text-transform: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select:focus-visible,
input[type="date"]:focus-visible {
  outline: none;
  border-color: var(--trend-color);
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.18);
}

.checkbox-label {
  justify-content: flex-start;
}

.quick-range-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  flex-wrap: wrap;
}

.quick-range-btn {
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.quick-range-btn:hover {
  border-color: var(--trend-color);
}

.checkbox-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
}

.checkbox-control input {
  width: 16px;
  height: 16px;
  accent-color: var(--trend-color);
}

.delta-hint {
  text-align: center;
  margin: var(--space-md) 0 8px;
  color: var(--text-main);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.4;
  text-transform: none;
}

.summary {
  text-align: center;
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  text-transform: none;
}

.status {
  text-align: center;
  margin: 10px 0 0;
  min-height: 20px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.4;
  text-transform: none;
}


.trend-card {
  position: relative;
}

.chart-toolbar {
  position: absolute;
  top: 10px;
  right: 20px;
  display: flex;
  gap: 8px;
  z-index: 10;
}

.chart-toolbar button {
  padding: 4px 10px;
  border: 1px solid #d1d5db;
  background: white;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chart-toolbar button:hover {
  background: #f3f4f6;
}

.chart-toolbar button.active {
  background: #2f80ed;
  color: white;
  border-color: #2f80ed;
}

.chart {
  width: 100%;
  height: 440px;
}

.status.error {
  color: #dc2626;
  font-weight: 600;
}


.view-switch {
  display: flex;
  gap: 10px;
  margin: 0 0 var(--space-lg);
}

.view-switch-link {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-main);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.view-switch-link:hover {
  border-color: var(--trend-color);
}

.view-switch-link.active {
  background: var(--trend-color);
  border-color: var(--trend-color);
  color: #fff;
}
