:root {
  color-scheme: light;
  --bg: #f7f6f2;
  --surface: #f9f8f5;
  --surface-2: #fbfbf9;
  --border: #d4d1ca;
  --text: #28251d;
  --muted: #7a7974;
  --faint: #bab9b4;
  --primary: #01696f;
  --primary-2: #0c4e54;
  --warning: #964219;
  --shadow: 0 12px 32px rgba(41, 38, 31, 0.08);
  --radius: 18px;
  --font-body: "Satoshi", "Inter", sans-serif;
  --font-display: "Switzer", "Satoshi", sans-serif;
}

:root.dark {
  color-scheme: dark;
  --bg: #171614;
  --surface: #1c1b19;
  --surface-2: #201f1d;
  --border: #393836;
  --text: #cdccca;
  --muted: #908f8b;
  --faint: #5a5957;
  --primary: #4f98a3;
  --primary-2: #7db6bf;
  --warning: #bb653b;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid color-mix(in srgb, var(--border), transparent 30%);
  background: color-mix(in srgb, var(--bg), transparent 8%);
  backdrop-filter: blur(14px);
}

.header-inner,
.page-shell {
  width: min(1376px, calc(100% - 40px));
  margin-inline: auto;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 40px;
  height: 40px;
  color: var(--primary);
}

h1,
h2,
p {
  margin: 0;
}

h1,
h2 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(1.15rem, 1rem + 0.5vw, 1.65rem);
  line-height: 1.1;
}

h2 {
  font-size: clamp(1.15rem, 1rem + 0.45vw, 1.5rem);
}

.brand p,
.panel-header p,
.metric-card small,
.metric-card span,
.muted {
  color: var(--muted);
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}

.page-shell {
  display: grid;
  gap: 22px;
  padding-block: 28px 56px;
}

.banner {
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--warning), transparent 65%);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--warning), transparent 92%);
}

.hidden {
  display: none !important;
}

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

.metric-card,
.panel {
  border: 1px solid color-mix(in srgb, var(--border), transparent 20%);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card {
  display: grid;
  gap: 8px;
  min-height: 112px;
  padding: 18px;
  border-radius: 16px;
}

.metric-card strong {
  font-size: clamp(1.45rem, 1rem + 1vw, 2rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, 0.95fr);
  gap: 22px;
}

.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.panel {
  overflow: hidden;
  border-radius: var(--radius);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid color-mix(in srgb, var(--border), transparent 35%);
}

.panel-header.compact {
  padding-block: 20px;
}

.symbol-grid {
  display: flex;
  position: relative;
  z-index: 1;
  height: 170px;
  gap: 8px;
  flex-wrap: wrap;
  overflow: auto;
  padding: 20px 24px;
  border-bottom: 1px solid color-mix(in srgb, var(--border), transparent 35%);
  background: var(--surface);
  align-content: flex-start;
  overscroll-behavior: contain;
}

.symbol-toolbar {
  display: grid;
  grid-template-columns: auto minmax(190px, 320px) 1fr;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-bottom: 1px solid color-mix(in srgb, var(--border), transparent 35%);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 14px;
}

.symbol-toolbar label {
  color: var(--text);
  font-weight: 600;
}

.symbol-toolbar input {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding-inline: 12px;
}

.symbol-button {
  min-width: 54px;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--border), transparent 10%);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.symbol-button.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.chart-wrap {
  position: relative;
  min-height: 360px;
  padding: 20px 24px 24px;
  background: var(--surface);
}

#ratioChart {
  width: 100% !important;
  height: 330px !important;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.reading-list,
.run-list {
  display: grid;
}

.reading-row,
.run-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid color-mix(in srgb, var(--border), transparent 45%);
}

.reading-row:last-child,
.run-row:last-child {
  border-bottom: 0;
}

.reading-row button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  margin-left: 8px;
  padding-inline: 8px;
  border-radius: 999px;
  background: var(--primary);
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.ratio-value {
  font-size: 1.15rem;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-wrap {
  max-height: 440px;
  overflow: auto;
}

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

th,
td {
  padding: 12px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--border), transparent 45%);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

@media (max-width: 980px) {
  .metrics,
  .dashboard-grid,
  .two-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .header-inner,
  .page-shell {
    width: min(100% - 24px, 1376px);
  }

  .brand {
    align-items: flex-start;
  }

  .brand p {
    font-size: 13px;
  }

  .symbol-grid {
    height: 150px;
  }

  .symbol-toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}
