/* ═══════════════════════════════════════════════════
   TOKENY — TRYB JASNY
═══════════════════════════════════════════════════ */
:root {
  /* Powierzchnie */
  --bg:       #f7f8fa;
  --bg-card:  #ffffff;
  --bg-input: #f0f2f5;
  --bg-hover: #f0f2f5;

  /* Obramowania */
  --border:   #e2e5ea;
  --border2:  #d0d4db;

  /* Tekst */
  --tx:       #111318;
  --tx2:      #3d4350;
  --tx3:      #6b7385;
  --tx4:      #9aa0ae;

  /* Akcenty stacji */
  --c0:       #00b300;   /* Mieroszów          — zieleń */
  --c1:       #ac39ac;   /* Unisław Śl.        — fiolet */
  --c2:       #e06010;   /* Chełmsko Śląskie   — pomarańcz */
  --c3:       #1a7acc;   /* Boguszów-Gorce     — niebieski */
  --c4:       #b8a000;   /* Jedlina-Zdrój      — żółty */

  /* Akcenty UI */
  --accent:   #1a6b3c;
  --accent-h: #155730;
  --gold:     #b07c10;
  --red:      #c0392b;
  --brown2:   #8b4a1a;

  /* Cień i misc */
  --shadow:   0 1px 4px rgba(0,0,0,.07), 0 0 0 1px rgba(0,0,0,.04);
  --shadow-h: 0 2px 10px rgba(0,0,0,.10);
  --radius:   8px;

  /* Spinner */
  --spin-ring: #e2e5ea;
  --spin-top:  var(--accent);
}

/* ── TRYB CIEMNY ── */
[data-theme="dark"] {
  --bg:       #13151a;
  --bg-card:  #1e2028;
  --bg-input: #262930;
  --bg-hover: #2a2d37;

  --border:   #2e3240;
  --border2:  #3a3f52;

  --tx:       #eceef2;
  --tx2:      #b8bece;
  --tx3:      #7d8599;
  --tx4:      #505870;

  --c0:       #33cc33;
  --c1:       #cc66cc;
  --c2:       #ff8040;
  --c3:       #4d9fe0;
  --c4:       #d4b800;

  --accent:   #4dbb7a;
  --accent-h: #3da568;
  --gold:     #e0aa30;
  --red:      #e05555;
  --brown2:   #d4834a;

  --shadow:   0 1px 6px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.04);
  --shadow-h: 0 4px 16px rgba(0,0,0,.45);

  --spin-ring: #2e3240;
}

/* ─────────────────────────────────────── */

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

html { font-size: 14px; }   /* zmieniane przez JS */

body {
  background: var(--bg);
  color: var(--tx);
  font-family: 'Reddit Sans', system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  transition: background .2s, color .2s;
}

/* ── HEADER ── */
header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky; top:0; z-index:200;
  box-shadow: var(--shadow);
}
.hdr-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.hdr-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--tx);
  white-space: nowrap;
  letter-spacing: -.2px;
  line-height: 1.2;
}
.hdr-title em { color: var(--accent); font-style: normal; }
.hdr-legend {
  display: flex;
  gap: 16px;
  align-items: center;
}
.hdr-station {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8125rem;
  color: var(--tx3);
  font-weight: 500;
}
.hdr-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── HEADER CONTROLS (prawy koniec) ── */
.hdr-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
/* Przycisk trybu */
.btn-icon {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px;
  color: var(--tx3);
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--tx); }

/* Kontrolka wielkości fontu */
.font-ctrl {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 6px;
  height: 32px;
}
.font-ctrl span {
  font-size: .75rem;
  color: var(--tx3);
  font-weight: 600;
  min-width: 28px;
  text-align: center;
  font-family: 'Reddit Mono', monospace;
}
.font-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--tx3);
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  border-radius: 4px;
  transition: color .12s;
}
.font-btn:hover { color: var(--tx); }
.font-btn:disabled { opacity:.3; cursor:default; }

/* ── CONTAINER ── */
.wrap { max-width:1440px; margin:0 auto; padding:24px 28px 48px; }

/* ── SPINNER ── */
#splash {
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  min-height:60vh; gap:16px; color:var(--tx3);
}
.spin {
  width:36px; height:36px;
  border:3px solid var(--spin-ring);
  border-top-color: var(--spin-top);
  border-radius:50%;
  animation: rot .8s linear infinite;
}
@keyframes rot { to { transform:rotate(360deg); } }

/* ── ERROR ── */
#err-box {
  display:none;
  background:var(--bg-card);
  border:1px solid var(--border);
  border-left:4px solid var(--red);
  border-radius:var(--radius);
  padding:18px 22px;
  margin:24px 0;
  color:var(--red);
}

/* ── CONTROLS ── */
.controls {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 18px;
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  box-shadow: var(--shadow);
}
.ctrl-lbl {
  font-size: .75rem; font-weight: 600; color: var(--tx3);
  text-transform: uppercase; letter-spacing: .6px; white-space: nowrap;
}
input[type=number] {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--tx);
  border-radius: 6px;
  padding: 4px 10px;
  font-family: 'Reddit Mono', monospace;
  font-size: .8125rem; width: 80px; outline: none;
  transition: border-color .15s;
}
input[type=number]:focus { border-color: var(--accent); }
.btn {
  background: var(--accent);
  color: #fff; border: none; border-radius: 6px;
  padding: 5px 16px;
  font-family: 'Reddit Sans', sans-serif;
  font-size: .875rem; font-weight: 600;
  cursor: pointer; transition: background .15s;
}
.btn:hover { background: var(--accent-h); }
.btn-soft {
  background: transparent; color: var(--tx2);
  border: 1px solid var(--border); font-weight: 500;
}
.btn-soft:hover { background: var(--bg-hover); border-color: var(--border2); }
.ctrl-sep { width:1px; height:20px; background: var(--border); }
#rng-info {
  margin-left: auto; font-size: .75rem; color: var(--tx4);
  font-family: 'Reddit Mono', monospace;
}

/* ── TABS ── */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.tab {
  padding: 8px 20px;
  font-size: .875rem; font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  color: var(--tx3);
  background: transparent;
  margin-bottom: -1px;
  transition: color .15s, background .15s;
}
.tab:hover { color: var(--tx); background: var(--bg-hover); }
.tab.active {
  background: var(--bg-card);
  border-color: var(--border);
  border-bottom-color: var(--bg-card);
  color: var(--tx);
}
.tab.t0.active { color: var(--c0); box-shadow: 0 -2px 0 var(--c0) inset; }
.tab.t1.active { color: var(--c1); box-shadow: 0 -2px 0 var(--c1) inset; }
.tab.t2.active { color: var(--c2); box-shadow: 0 -2px 0 var(--c2) inset; }
.tab.t3.active { color: var(--c3); box-shadow: 0 -2px 0 var(--c3) inset; }
.tab.t4.active { color: var(--c4); box-shadow: 0 -2px 0 var(--c4) inset; }
.tab.tcmp.active { color: var(--gold); box-shadow: 0 -2px 0 var(--gold) inset; }

/* ── GRID ── */
.g2 { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:16px; }
.g3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:16px; margin-bottom:16px; }
.g4 { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:16px; }
.mb { margin-bottom:16px; }
@media(max-width:960px){ .g2,.g3,.g4 { grid-template-columns:1fr; } }

/* ── CARD ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: background .2s, border-color .2s;
}
.card-t {
  font-size: .875rem; font-weight: 600;
  color: var(--tx2);
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 9px;
}
.card-t .ct-bar {
  width: 3px; height: 13px;
  border-radius: 2px;
  background: var(--accent);
  flex-shrink: 0;
}

/* ── KPI ── */
.kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
  transition: background .2s, border-color .2s;
}
.kpi-stripe {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px;
}
.kpi-lbl {
  font-size: .6875rem; font-weight: 600; color: var(--tx4);
  text-transform: uppercase; letter-spacing: .7px; margin-bottom: 4px;
}
.kpi-val {
  font-size: 1.75rem; font-weight: 700; line-height: 1;
  color: var(--tx); margin-bottom: 3px;
  font-family: 'Reddit Mono', monospace;
}
.kpi-unit { font-size: .875rem; font-weight: 400; color: var(--tx4); }
.kpi-sub  { font-size: .875rem; color: var(--tx4); margin-top: 3px; }

/* ── HEATMAP ── */
.hm-scroll { overflow-x: auto; }
.hm-table {
  border-collapse: collapse;
  font-family: 'Reddit Mono', monospace;
  font-size: .625rem;
  width: 100%;
}
.hm-table th {
  color: var(--tx4); font-weight: 600;
  padding: 3px 4px; text-align: center;
  font-size: .5625rem; text-transform: uppercase; letter-spacing: .4px;
  white-space: nowrap;
}
.hm-table td {
  height: 16px; min-width: 26px;
  text-align: center;
  border-radius: 2px;
  font-size: .5rem; cursor: default;
  transition: outline .08s; padding: 0 2px;
}
.hm-table td:hover { outline: 1px solid var(--tx2); z-index:1; position:relative; }
.hm-yr {
  text-align: right; padding-right: 8px;
  color: var(--tx4); font-weight: 600;
  font-size: .5625rem; white-space: nowrap; min-width: 36px;
}

/* ── TABELA ── */
.tbl {
  width: 100%; border-collapse: collapse;
  font-size: .8125rem;
}
.tbl th {
  text-align: center; color: var(--tx3); font-weight: 600;
  padding: 6px 10px;
  border-bottom: 1.5px solid var(--border2);
  font-size: .6875rem; text-transform: uppercase; letter-spacing: .5px;
}
.tbl td { padding: 5px 10px; border-bottom: 1px solid var(--border); text-align: center; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--bg-hover); }
.tl  { text-align: left !important; }
.tr  { text-align: right; }
.tc  { text-align: center; }
.hi  { color: var(--c0); font-weight: 700; }
.lo  { color: var(--c1); font-weight: 700; }
.dim { color: var(--tx4); font-size: .75rem; }

/* ── PORY ROKU ── */
.szn-list { display: flex; flex-direction: column; gap: 14px; }
.szn-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: .875rem; font-weight: 600;
  color: var(--tx2); margin-bottom: 5px;
}
.szn-vals { font-family: 'Reddit Mono', monospace; font-size: .75rem; color: var(--tx3); font-weight: 400; }
.szn-bg {
  background: var(--bg-input); border-radius: 4px; height: 8px;
  overflow: hidden;
}
.szn-fill { height: 100%; border-radius: 4px; transition: width .8s cubic-bezier(.4,0,.2,1); }

/* ── BRAK DANYCH ── */
.nodata {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 160px; color: var(--tx4);
  font-style: italic; gap: 6px;
}

/* ── LEGENDA HEATMAPY ── */
.hm-legend {
  display: flex; align-items: center; gap: 6px;
  margin-top: 8px; font-size: .6875rem;
  font-family: 'Reddit Mono', monospace; color: var(--tx4);
}
.hm-grad {
  flex: 1; max-width: 160px; height: 7px; border-radius: 2px;
  border: 1px solid var(--border);
}

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--border);
  padding: 18px 28px;
  text-align: center;
  color: var(--tx4);
  font-size: .75rem;
  margin-top: 40px;
}

/* ── BACK LINK ── */
.back-link {
  font-size: .8125rem;
  color: var(--tx3);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.back-link:hover { color: var(--accent); }

/* ── NAGŁÓWEK SEKCJI ── */
.section-heading {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--tx3);
  text-transform: uppercase;
  letter-spacing: .7px;
  padding: 4px 2px 14px;
}
