/* wxkalshi dashboard – light professional theme */

:root {
  --bg:        #f5f6f8;
  --surface:   #ffffff;
  --surface2:  #f0f2f5;
  --border:    #e2e5ea;
  --border2:   #d0d5dd;
  --text:      #111827;
  --text-2:    #374151;
  --text-muted:#6b7280;
  --accent:    #1d4ed8;
  --accent-lt: #eff6ff;
  --green:     #16a34a;
  --green-lt:  #dcfce7;
  --red:       #dc2626;
  --orange:    #c2410c;
  --orange-lt: #fff7ed;
  --blue-fill: rgba(59,130,246,0.08);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 2px 8px rgba(0,0,0,.09), 0 1px 3px rgba(0,0,0,.06);
  --radius:    10px;
  --font:      -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
  --chart-h:   380px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

.shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px 48px;
}

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 18px 20px 14px;
  margin: 0 -20px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.header-title h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
}

.header-title .subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-title .subtitle .station-code {
  font-weight: 600;
  color: var(--text-2);
  margin-left: 6px;
}

.header-title .updated-line {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* live / delayed badge */
.feed-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.feed-badge.live {
  background: var(--green-lt);
  color: var(--green);
  border-color: #bbf7d0;
}

.feed-badge.delayed {
  background: #fef9c3;
  color: #854d0e;
  border-color: #fde68a;
}

.feed-badge .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

/* date nav */
.header-nav {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.market-date-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
}

.market-date-value {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.date-nav-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-arrow {
  background: none;
  border: 1px solid var(--border2);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  transition: background .12s, color .12s;
  text-decoration: none;
}

.nav-arrow:hover { background: var(--surface2); color: var(--text); }

.day-pills {
  display: flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}

.day-pill {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: background .12s, color .12s;
  text-decoration: none;
  display: inline-block;
}

.day-pill:hover { background: var(--border); color: var(--text); }

.day-pill.active {
  background: var(--text);
  color: #fff;
}

.pick-date-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border2);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: background .12s;
  position: relative;
}

.pick-date-btn:hover { background: var(--surface2); }

.pick-date-btn input[type="date"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}

/* ── Summary strip ───────────────────────────────────────────────────────── */
.summary-strip {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  flex: 1;
  min-width: 110px;
  box-shadow: var(--shadow-sm);
}

.sc-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.sc-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.sc-unit {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 2px;
}

/* ── Chart cards ─────────────────────────────────────────────────────────── */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.chart-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* legend toggles */
.legend-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border2);
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .12s;
  user-select: none;
}

.legend-toggle .swatch {
  width: 10px; height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-toggle.active {
  background: var(--surface);
  color: var(--text-2);
  border-color: var(--border2);
}

.legend-toggle.active .swatch {
  opacity: 1;
}

.legend-toggle:not(.active) .swatch {
  opacity: .3;
}

/* layer toggles (main chart) */
.layer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border2);
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .12s;
}

.layer-toggle.active {
  background: var(--surface);
  color: var(--text-2);
  border-color: var(--border2);
}

.layer-toggle .swatch {
  width: 10px; height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.dew-swatch {
  width: 14px !important;
  height: 2px !important;
  background: none !important;
  border-bottom: 2px dashed #6b8cba;
  border-radius: 0 !important;
}

/* bucket toggle pills */
.bucket-toggle-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1.5px solid;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all .12s;
  color: #fff;
}

.bucket-toggle-btn:not(.active) {
  background: var(--surface) !important;
  color: var(--text-muted) !important;
}

/* ctrl buttons */
.ctrl-btn {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border2);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: background .12s;
}

.ctrl-btn:hover { background: var(--surface2); }

select {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  font-family: var(--font);
  cursor: pointer;
}

.chart-wrap {
  position: relative;
  height: var(--chart-h);
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.tables-section {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  flex: 1;
  min-width: 320px;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.table-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  text-align: right;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

thead th:first-child { text-align: left; }

tbody td {
  padding: 7px 10px;
  text-align: right;
  border-bottom: 1px solid var(--surface2);
  color: var(--text-2);
}

tbody td:first-child {
  text-align: left;
  font-weight: 500;
  color: var(--text);
}

tbody tr:hover { background: var(--surface2); }
tbody tr:last-child td { border-bottom: none; }

.ev-pos { color: var(--green); font-weight: 600; }
.ev-neg { color: var(--red); font-weight: 600; }
.ev-zero { color: var(--text-muted); }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
