:root {
  color-scheme: light;
  --bg: #f4efe4;
  --bg-top: #efe4ce;
  --bg-bottom: #f7f3ea;
  --panel: rgba(255, 252, 246, 0.88);
  --panel-solid: #fffaf1;
  --line: #d4cab7;
  --line-strong: #bcae95;
  --text: #1f1a15;
  --muted: #6b6155;
  --accent: #0f6f66;
  --accent-dark: #0c544d;
  --accent-soft: rgba(15, 111, 102, 0.12);
  --warn: #aa531f;
  --input-bg: rgba(255, 255, 255, 0.9);
  --shadow: 0 18px 36px rgba(53, 42, 24, 0.08);
  --plot-paper: #fffaf1;
  --plot-bg: #fffdf9;
  --plot-grid: rgba(117, 104, 82, 0.18);
  --plot-speed: #0f6f66;
  --plot-marker: #bf5b27;
  --plot-marker-text: #8e3e12;
  --plot-tooltip: rgba(255, 250, 241, 0.96);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d171d;
  --bg-top: #14303a;
  --bg-bottom: #091117;
  --panel: rgba(13, 24, 31, 0.86);
  --panel-solid: #12212a;
  --line: rgba(117, 154, 168, 0.22);
  --line-strong: rgba(147, 187, 201, 0.34);
  --text: #eaf4f7;
  --muted: #9ab1bc;
  --accent: #67d0bd;
  --accent-dark: #3db59f;
  --accent-soft: rgba(103, 208, 189, 0.12);
  --warn: #ff9f6a;
  --input-bg: rgba(8, 17, 24, 0.88);
  --shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
  --plot-paper: #12212a;
  --plot-bg: #0d171d;
  --plot-grid: rgba(154, 177, 188, 0.22);
  --plot-speed: #67d0bd;
  --plot-marker: #ff9f6a;
  --plot-marker-text: #ffd3bb;
  --plot-tooltip: rgba(18, 33, 42, 0.96);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(103, 208, 189, 0.14), transparent 26%),
    radial-gradient(circle at top right, rgba(191, 91, 39, 0.12), transparent 18%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 32%, var(--bg-bottom) 100%);
  transition: background 180ms ease, color 180ms ease;
}

.wrap {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
}

.site-header {
  padding: 28px 0 18px;
}

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-block;
  color: var(--text);
  text-decoration: none;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

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

.theme-toggle {
  min-width: 126px;
  background: var(--panel-solid);
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}

.theme-toggle:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  align-items: end;
}

.filters label {
  display: grid;
  gap: 6px;
  font-size: 0.95rem;
}

input,
select,
button {
  font: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

input::placeholder {
  color: var(--muted);
}

input:focus,
select:focus,
button:focus {
  outline: 2px solid transparent;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

button {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

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

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

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

tbody tr:hover {
  background: var(--accent-soft);
}

th {
  font-size: 0.9rem;
  color: var(--muted);
}

td a,
.back-link {
  color: var(--accent);
  text-decoration: none;
}

.back-link:hover,
td a:hover {
  color: var(--accent-dark);
}

h1,
h2 {
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  letter-spacing: -0.03em;
  margin-top: 0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.summary-grid div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-solid);
}

.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.summary-grid strong {
  font-size: 1.05rem;
}

.plot {
  min-height: 460px;
}

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

  .brand {
    font-size: 1.6rem;
  }

  .panel {
    padding: 16px;
  }

  .theme-toggle {
    width: 100%;
  }
}
