:root {
  --bg: #f6f8fa;
  --panel: #ffffff;
  --border: #e2e8f0;
  --text: #1a202c;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --radius: 10px;
  font-size: 15px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-brand { display: flex; align-items: center; gap: 14px; }
.header-brand img { height: 44px; }
.header-brand h1 { margin: 0; font-size: 1.25rem; letter-spacing: 0.02em; }
.header-brand p { margin: 0; font-size: 0.8rem; color: var(--muted); }
.header-stats { font-size: 0.8rem; color: var(--muted); text-align: right; }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  padding: 16px 24px;
  max-width: 1500px;
  margin: 0 auto;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

/* Sidebar */
.sidebar { display: flex; flex-direction: column; gap: 12px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.panel h2 {
  margin: 0 0 10px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.field { display: block; margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field > span { display: block; font-size: 0.82rem; margin-bottom: 5px; color: var(--text); }

select, .multi {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 7px;
  font: inherit;
  background: #fff;
}
select { padding: 7px 9px; }
select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }

/* Segmented control */
.seg { display: flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.seg-btn {
  flex: 1;
  padding: 8px 0;
  border: none;
  background: #fff;
  font: inherit;
  cursor: pointer;
  color: var(--muted);
}
.seg-btn.active { background: var(--primary); color: #fff; font-weight: 600; }

/* Multi-select (chips + dropdown) */
.multi { position: relative; padding: 4px 6px; min-height: 36px; cursor: text; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.multi input {
  border: none; outline: none; font: inherit; flex: 1; min-width: 70px; padding: 4px 2px;
}
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: #eef2ff; color: var(--primary-dark);
  border-radius: 5px; padding: 2px 7px; font-size: 0.8rem;
}
.chip button { border: none; background: none; cursor: pointer; color: inherit; font-size: 0.9rem; padding: 0; line-height: 1; }
.multi-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px);
  background: #fff; border: 1px solid var(--border); border-radius: 7px;
  max-height: 220px; overflow-y: auto; z-index: 20;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
.multi-list div { padding: 7px 10px; cursor: pointer; font-size: 0.85rem; }
.multi-list div:hover, .multi-list div.hl { background: #eef2ff; }

/* Sliders */
input[type="range"] { width: 100%; accent-color: var(--primary); }
.dual-range { display: flex; flex-direction: column; gap: 2px; }

/* Buttons */
.actions { display: flex; gap: 10px; }
.btn {
  flex: 1; padding: 10px 0; border-radius: 8px; font: inherit; font-weight: 600;
  cursor: pointer; border: 1px solid transparent;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--muted); }
.btn-ghost:hover { border-color: var(--muted); }

/* Chart area */
.content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 640px;
}
.chart { flex: 1; min-height: 560px; }
.message {
  padding: 12px 16px; border-radius: 8px;
  background: #fef9c3; color: #854d0e; font-size: 0.9rem; margin-bottom: 10px;
}
.legend {
  display: flex; justify-content: space-around; padding: 6px 40px 2px;
  font-size: 0.78rem; color: var(--muted); letter-spacing: 0.03em;
}

/* Footer */
.footer {
  text-align: center; padding: 18px 24px 26px; color: var(--muted); font-size: 0.8rem;
}
.footer a { color: var(--primary); text-decoration: none; }
