/* ═══════════════════════════════════════════════════════════════
   Energy Cost Optimizer 2025 - Main Stylesheet
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg:        #0f1117;
  --bg2:       #161923;
  --bg3:       #1e2330;
  --border:    #2a3045;
  --text:      #e2e8f0;
  --text-dim:  #8899aa;
  --blue:      #3b82f6;
  --blue-dim:  #1d4ed8;
  --orange:    #f97316;
  --purple:    #a855f7;
  --green:     #22c55e;
  --teal:      #14b8a6;
  --red:       #ef4444;
  --yellow:    #eab308;
  --radius:    12px;
  --shadow:    0 4px 24px rgba(0,0,0,.45);
  --transition: 0.2s ease;
}

/* ── Reset & Base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

.hidden { display: none !important; }

/* Tryb osadzony (strona w iframe powłoki index.html): własny nagłówek/stopka
   znikają - chrome daje shell. Sama treść renderuje się bez zmian. */
html.embedded #top-header,
html.embedded #main-footer { display: none !important; }
html.embedded body { background: transparent; }

/* ── Header ─────────────────────────────────────────────────── */
#top-header {
  background: linear-gradient(135deg, #0d1b3e 0%, #1a1040 50%, #0d2b2e 100%);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,.6);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1600px;
  margin: 0 auto;
  height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.brand i { color: var(--yellow); font-size: 1.3rem; }
.brand em { color: var(--blue); font-style: normal; }

.header-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* Przycisk „Zmień dane" - w nagłówku, obok pokrycia wczytanych danych */
.header-reupload {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--blue);
  padding: 4px 12px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color var(--transition);
}
.header-reupload:hover { border-color: var(--blue); }

/* ── Sections wrapper ───────────────────────────────────────── */
section {
  max-width: 1600px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
}

/* ── Upload Section ─────────────────────────────────────────── */
#upload-section {
  padding: 2rem 1.5rem;
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr;   /* tylko karta „Zużycie energii” - ceny w tle */
  max-width: 480px;
  gap: 1.5rem;
  margin: 0 auto 1.5rem;        /* wyśrodkowana */
}

/* ── Upload: chowanie po wczytaniu danych ────────────────────── */
/* Pokrycie danych pokazuje #data-coverage w nagłówku; powrót do uploadu
   przyciskiem „Zmień dane" (.header-reupload), też w nagłówku. */
#upload-section.collapsed { display: none; }

.upload-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  transition: border-color var(--transition);
  position: relative;
}

.upload-card:hover { border-color: var(--blue); }

.upload-icon {
  font-size: 2.5rem;
  color: var(--blue);
  margin-bottom: 0.75rem;
}

.upload-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.upload-hint {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-bottom: 1.2rem;
  line-height: 1.5;
}

.btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--blue-dim);
  color: white;
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background var(--transition);
}
.btn-upload:hover { background: var(--blue); }

/* Link do bookmarkletu eksportu z Energa - wariant „ghost" pod przyciskiem uploadu */
.btn-export-energa {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 0.6rem;
  padding: 6px 14px;
  border: 1px solid var(--blue-dim);
  border-radius: 8px;
  color: var(--blue);
  background: transparent;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}
.btn-export-energa:hover { background: var(--blue-dim); color: white; }

input[type="file"] { display: none; }

.upload-status {
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  min-height: 1.4em;
}
.upload-status.ok   { color: var(--green);  font-weight: 600; }
.upload-status.err  { color: var(--red);    font-weight: 600; }
.upload-status.warn { color: var(--yellow); font-weight: 600; }

.upload-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
}
.btn-primary:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary.small { padding: 7px 16px; font-size: 0.82rem; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition);
}
.btn-secondary:hover { border-color: var(--blue); }

/* ── Okres analizy (period-section) ──────────────────────────── */
/* Pokrycie danych z CSV - dwie linie w nagłówku (#header-meta) */
.data-coverage {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--text-dim);
  min-width: 0;
}
.data-coverage .cov-line {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  white-space: nowrap;
}
.data-coverage b { color: var(--text); font-weight: 700; }
.data-coverage .cov-sep { color: var(--text-dim); }
.data-coverage .cov-warn {
  color: var(--yellow);
  font-weight: 600;
}

/* Jeden panel: przełącznik metody + pola aktywnej metody + wynikowy zakres */
.period-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Segmented control metody (wzór: .batt-mode-toggle, akcent niebieski) */
.period-method-tabs {
  display: flex;
  width: fit-content;
  max-width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
  flex-wrap: wrap;
}
.period-method-btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}
.period-method-btn i { margin-right: 5px; opacity: 0.85; }
.period-method-btn:hover { color: var(--text); }
.period-method-btn.active {
  background: var(--blue-dim);
  color: #fff;
}
.period-method-btn.active i { opacity: 1; }

.period-fields {
  display: flex;
  align-items: flex-end;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.setting-group label {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 500;
}

.setting-group input[type="number"],
.setting-group input[type="date"],
.setting-group select {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 0.88rem;
  font-family: inherit;
  min-width: 140px;
  transition: border-color var(--transition);
}

/* Ikona kalendarza w natywnym date-pickerze widoczna na ciemnym tle */
.setting-group input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}

.setting-group input:focus,
.setting-group select:focus {
  outline: none;
  border-color: var(--blue);
}

/* ── View tabs (zakładki - zmieniają dane poniżej) ───────────── */
/* Styl „folderowy”: pasek z dolną linią, aktywna zakładka łączy się
   z treścią (jaśniejsze tło + niebieski wskaźnik), nieaktywne są płaskie. */
#view-tabs {
  max-width: 1600px;
  margin: 1.75rem auto 0;
  padding: 0 1.5rem;
  display: flex;
  align-items: flex-end;
  gap: 0.25rem;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--border);
  /* Przykleja się pod nagłówkiem (60px, z-index 100) podczas przewijania -
     pełne tło, by wykresy nie prześwitywały. */
  position: sticky;
  top: 60px;
  z-index: 90;
  background: var(--bg);
}

/* Skrót analizowanego okresu na sticky pasku zakładek */
.tabs-period-chip {
  margin-left: auto;
  align-self: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
  padding: 3px 12px;
  margin-bottom: 0.45rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
}

.view-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  margin-bottom: -2px;            /* nachodzi na dolną linię paska */
  color: var(--text-dim);
  border-radius: 9px 9px 0 0;
  padding: 0.65rem 1.25rem 0.7rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition), background var(--transition),
              border-color var(--transition);
}

.view-tab i { font-size: 0.95rem; opacity: 0.85; }

.view-tab:hover {
  color: var(--text);
  background: var(--bg2);
}

/* Aktywna zakładka: jaśniejsze tło, obramowanie i niebieski wskaźnik u dołu,
   wizualnie „przyklejona” do treści pod paskiem. */
.view-tab.active {
  color: var(--text);
  background: var(--bg2);
  border-color: var(--border);
  border-bottom: 2px solid var(--bg2);
}
.view-tab.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  background: var(--blue);
  border-radius: 9px 9px 0 0;
}
.view-tab.active i { color: var(--blue); opacity: 1; }

/* ── Views (jeden widoczny na raz; pozostałe .hidden) ────────── */
.view { margin-top: 1.25rem; }

/* Toolbar widoku „Zużycie” (np. wybór agregacji) */
.view-toolbar {
  max-width: 1600px;
  margin: 1.5rem auto 0;
  padding: 0 1.5rem;
  display: flex;
  gap: 1.5rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

/* ── KPI Cards ───────────────────────────────────────────────── */
#kpi-section { margin-top: 1.5rem; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.kpi-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition);
}
.kpi-card:hover { transform: translateY(-2px); }

.kpi-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}
.accent-blue::before   { background: var(--blue); }
.accent-orange::before { background: var(--orange); }
.accent-purple::before { background: var(--purple); }
.accent-green::before  { background: var(--green); }
.accent-teal::before   { background: var(--teal); }
.accent-red::before    { background: var(--red); }

.kpi-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.accent-blue .kpi-icon   { background: rgba(59,130,246,.15); color: var(--blue); }
.accent-orange .kpi-icon { background: rgba(249,115,22,.15);  color: var(--orange); }
.accent-purple .kpi-icon { background: rgba(168,85,247,.15);  color: var(--purple); }
.accent-green .kpi-icon  { background: rgba(34,197,94,.15);   color: var(--green); }
.accent-teal .kpi-icon   { background: rgba(20,184,166,.15);  color: var(--teal); }
.accent-red .kpi-icon    { background: rgba(239,68,68,.15);   color: var(--red); }

.kpi-value {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.kpi-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 2px;
  font-weight: 500;
}

/* ── Charts ──────────────────────────────────────────────────── */
#charts-section { margin-top: 1.5rem; }

.chart-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem 1.5rem;
  margin-bottom: 1.25rem;
}

.full-width { width: 100%; }

.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.half-width { width: 100%; }

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chart-header h2 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.chart-header h2 i { color: var(--blue); margin-right: 6px; }

.chart-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.leg {
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  gap: 5px;
}
.leg::before {
  content: '';
  display: inline-block;
  width: 12px; height: 3px;
  border-radius: 2px;
}
.leg-flat::before    { background: var(--orange); }
.leg-dynamic::before { background: var(--blue); }
.leg-diff::before    { background: var(--green); }

/* ── Battery Simulator Section ───────────────────────────────── */
#battery-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-top: 2px solid var(--green);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.battery-header { margin-bottom: 1.25rem; }

.battery-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 0.4rem;
}

.battery-title-row h2 {
  font-size: 1.1rem;
  font-weight: 700;
}
.battery-title-row h2 i { color: var(--green); margin-right: 8px; }

.battery-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--green), var(--teal));
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 20px;
  vertical-align: middle;
}

.battery-header p {
  color: var(--text-dim);
  font-size: 0.84rem;
  line-height: 1.5;
}

/* Controls - jawny grid: parametry liczbowe w 2 rzędach po lewej, dwie wysokie
   karty (sprawność, założenia) po prawej, przyciski na dole pod całością. */
.battery-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr)) minmax(250px, 1.15fr) minmax(260px, 1.3fr);
  grid-template-areas:
    "cap  price power eff note"
    "self mode  mode  deg note"
    "btns btns  btns  btns btns";
  gap: 1.25rem 1.5rem;
  align-items: start;
  margin-bottom: 1.5rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
}
.batt-ctrl-cap   { grid-area: cap; }
.batt-ctrl-price { grid-area: price; }
.batt-ctrl-power { grid-area: power; }
.batt-ctrl-self  { grid-area: self; }
.batt-ctrl-eff   { grid-area: eff; }
.batt-ctrl-mode  { grid-area: mode; }
.batt-ctrl-deg   { grid-area: deg; }
.batt-ctrl-note  { grid-area: note; }
.batt-btn-row    { grid-area: btns; }

/* Układ pośredni i mobilny: mniej kolumn, te same obszary */
@media (max-width: 1100px) {
  .battery-controls {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "cap   price"
      "power self"
      "eff   note"
      "deg   note"
      "mode  mode"
      "btns  btns";
  }
}
@media (max-width: 640px) {
  .battery-controls {
    grid-template-columns: 1fr;
    grid-template-areas: "cap" "price" "power" "self" "eff" "deg" "mode" "note" "btns";
  }
}

.batt-ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.batt-ctrl-group label {
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-dim);
}
.batt-ctrl-group label i { margin-right: 5px; color: var(--green); }

.batt-ctrl-group input[type="number"] {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 0.9rem;
  font-family: inherit;
  width: 140px;
  transition: border-color var(--transition);
}
.batt-ctrl-group input[type="number"]:focus {
  outline: none;
  border-color: var(--green);
}

.batt-ctrl-hint {
  font-size: 0.72rem;
  color: var(--teal);
  font-style: italic;
}

.batt-eff-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}

/* Tryb pracy: stały segmented control - równe segmenty, brak reflow przy zmianie.
   Szerokość kolumny dopasowuje się do treści przycisków (min. 260px przez hint),
   a grid 1fr/1fr wyrównuje segmenty - dłuższy napis nie wystaje poza tło. */
.batt-ctrl-mode { width: max-content; }
.batt-mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
}
.batt-mode-btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 6px 6px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  transition: background var(--transition), color var(--transition);
}
.batt-mode-btn:hover { color: var(--text); }
.batt-mode-btn.active {
  background: var(--green);
  color: #06281a;
}
/* Hint o stałej szerokości - różna długość tekstu nie rozciąga kolumny */
.batt-ctrl-mode .batt-ctrl-hint { width: 260px; }

/* Sprawność round-trip: wynik (read-only) + rozbicie na składniki
   (szerokości kart sprawności/założeń wyznaczają kolumny gridu .battery-controls) */
.batt-eff-result {
  display: flex;
  align-items: center;
  gap: 8px;
}
.batt-eff-result input[readonly] {
  width: 72px;
  font-weight: 700;
  color: var(--green);
  background: var(--bg3);
  cursor: default;
}
.batt-eff-unit {
  font-weight: 700;
  color: var(--green);
  font-size: 0.9rem;
}
.batt-eff-breakdown {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
  padding: 7px 9px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 7px;
}
.batt-eff-breakdown label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-dim);
}
.batt-eff-breakdown input[type="number"] {
  width: 58px;
  padding: 3px 6px;
  font-size: 0.78rem;
  text-align: right;
  margin-left: auto;
}
.batt-eff-breakdown label > span { color: var(--text-dim); font-size: 0.72rem; }

/* Degradacja ogniw - zwijana sekcja zaawansowana (natywny <details>) */
.batt-adv-details summary {
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-dim);
  user-select: none;
}
.batt-adv-details summary::-webkit-details-marker { display: none; }
.batt-adv-details summary i { margin-right: 5px; color: var(--green); }
.batt-adv-details summary::after {
  content: '▸';
  margin-left: 6px;
  font-size: 0.7rem;
  color: var(--text-dim);
}
.batt-adv-details[open] summary::after { content: '▾'; }
.batt-adv-details summary:hover { color: var(--text); }
.batt-adv-details .batt-eff-breakdown { margin-top: 6px; }
.batt-adv-details .batt-ctrl-hint { display: block; margin-top: 5px; }

.batt-assumptions {
  list-style: none;
  margin-top: 3px;
  padding: 0;
}
.batt-assumptions li {
  font-size: 0.74rem;
  color: var(--text-dim);
  padding: 2px 0;
  padding-left: 14px;
  position: relative;
}
.batt-assumptions li::before {
  content: '·';
  position: absolute;
  left: 4px;
  color: var(--yellow);
}

/* KPI row */
.battery-kpi-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--bg3);
  border-radius: 10px;
  padding: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.battery-kpi {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 140px;
}

.bk-val {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.bk-val.green     { color: var(--green); }
.bk-val.highlight { color: var(--yellow); }
.bk-val.teal      { color: var(--teal); }
.bk-val.red       { color: var(--red); }

.bk-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: center;
}

.battery-arrow { color: var(--text-dim); font-size: 1.3rem; }
.battery-kpi.accent { background: rgba(234,179,8,.07); border-radius: 10px; padding: 0.5rem 1rem; }

/* Rozbicie kosztu (energia + dystrybucja zmienna) pod kafelkiem */
.bk-breakdown {
  display: flex;
  gap: 10px;
  margin-top: 2px;
  font-size: 0.74rem;
  color: var(--text-dim);
}
.bk-breakdown i { margin-right: 2px; }

/* Stats row */
.battery-stats-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.batt-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  min-width: 130px;
  flex: 1;
}

.batt-stat i { font-size: 1.1rem; }

.batt-stat span:nth-child(2) {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.bst-label {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-align: center;
}

/* Legacy optim styles (kept for insight-box) */
.optim-kpi-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--bg3);
  border-radius: 10px;
  padding: 1.25rem;
  flex-wrap: wrap;
}
.optim-kpi {
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 130px;
}
.ok-val { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.ok-val.green     { color: var(--green); }
.ok-val.highlight { color: var(--yellow); }
.ok-label { font-size: 0.72rem; color: var(--text-dim); }
.optim-arrow { color: var(--text-dim); font-size: 1.3rem; }
.optim-kpi.accent { background: rgba(234,179,8,.06); border-radius: 10px; padding: 0.5rem 1rem; }

.insight-box {
  background: var(--bg3);
  border-left: 3px solid var(--purple);
  border-radius: 0 10px 10px 0;
  padding: 1rem 1.25rem;
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.7;
}

/* ── Insights Table ──────────────────────────────────────────── */
#insights-section { margin-top: 1.5rem; }

.section-header h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 1rem;
}
.section-header h2 i { color: var(--blue); margin-right: 8px; }

/* Nagłówek statystyk (zakres dat żyje w panelu okresu + chipie zakładek) */
.stats-header {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.table-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.table-half {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.table-half h3 {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.table-wrap th, .table-wrap td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.table-wrap th {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap tr:hover td { background: var(--bg3); }

/* ══════════════════════════════════════════════════════════════
   TARIFF SECTION
   ══════════════════════════════════════════════════════════════ */

#tariff-section {
  margin-top: 1.5rem;
}

.tariff-sec-header {
  margin-bottom: 1.25rem;
}
.tariff-sec-title-row {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 0.4rem;
}
.tariff-sec-title-row h2 {
  font-size: 1.05rem; font-weight: 700; color: var(--text);
}
.tariff-sec-title-row h2 i { color: var(--yellow); margin-right: 0.3rem; }

.tariff-config-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.78rem; color: var(--blue); text-decoration: none;
  border: 1px solid rgba(59,130,246,.3); padding: 4px 10px; border-radius: 6px;
  transition: background 0.12s;
  /* działa też jako <button> (nawigacja w powłoce) */
  background: none; cursor: pointer; font-family: inherit;
}
.tariff-config-link:hover { background: rgba(59,130,246,.08); }

.tariff-sec-links { display: inline-flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.tariff-sec-desc {
  font-size: 0.8rem; color: var(--text-dim); line-height: 1.5;
}
.tariff-sec-desc a { color: var(--blue); }

/* ── KPI cards row ── */
.tariff-kpi-row {
  display: flex; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.tariff-kpi-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  flex: 1; min-width: 200px;
  display: flex; flex-direction: column; gap: 0.35rem;
  position: relative; overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
}
.tariff-kpi-card:hover { border-color: var(--text-dim); }
.tariff-kpi-card.best {
  border-color: var(--green);
  background: rgba(34,197,94,.04);
}
/* Wybrana (aktualna) taryfa - punkt odniesienia dla porównań */
.tariff-kpi-card.selected {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}
.tariff-kpi-card.selected.best { border-color: var(--blue); }

.tkc-dot {
  width: 10px; height: 10px; border-radius: 50%;
  position: absolute; top: 0.9rem; right: 0.9rem;
}
.tkc-name {
  font-size: 0.82rem; font-weight: 600; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding-right: 1.2rem;
}
.tkc-total {
  font-size: 1.6rem; font-weight: 800; color: var(--text);
  letter-spacing: -0.02em; line-height: 1.1;
}
.tkc-total span { font-size: 0.9rem; font-weight: 500; color: var(--text-dim); }
.tkc-sub { font-size: 0.72rem; color: var(--text-dim); }
.tkc-breakdown {
  display: flex; gap: 0.75rem; flex-wrap: wrap;
  font-size: 0.72rem; color: var(--text-dim); margin-top: 0.1rem;
}
.tkc-breakdown i { margin-right: 2px; }
.tkc-badge {
  font-size: 0.7rem; font-weight: 600; padding: 2px 8px;
  border-radius: 4px; display: inline-flex; align-items: center; gap: 4px;
  margin-top: 0.2rem; width: fit-content;
}
.tkc-badge.best-badge  { background: rgba(34,197,94,.15); color: var(--green); }
.tkc-badge.worse-badge { background: rgba(239,68,68,.1);  color: var(--red); font-weight: 400; }
/* Porównanie z wybraną (aktualną) taryfą */
.tkc-badge.sel-badge      { background: rgba(59,130,246,.12); color: var(--blue); font-weight: 600; }
.tkc-badge.vs-sel-badge   { background: rgba(59,130,246,.08); font-weight: 400; }
.tkc-badge.vs-sel-badge.gain { color: var(--green); }
.tkc-badge.vs-sel-badge.loss { color: var(--red); }

/* ── Sekcja scenariusza na kaflu: „Bez optymalizacji" / „Po optymalizacji" ── */
.tkc-scenario {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem;
  margin-top: 0.4rem; padding-top: 0.4rem; border-top: 1px dashed var(--border);
}
.tkc-scenario-head {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-dim); font-weight: 700;
  display: flex; align-items: center; gap: 0.3rem;
}
.tkc-scenario-opt .tkc-scenario-head { color: var(--purple); }
.tkc-scenario-opt .tkc-scenario-head i { color: var(--purple); }

/* ── Pasek udziału stref (100%) per karta taryfy ── */
.tariff-zone-bar {
  display: flex; width: 100%; height: 12px;
  border-radius: 6px; overflow: hidden;
  margin-top: 0.45rem; background: var(--bg);
}
.tzb-seg {
  height: 100%; min-width: 2px; cursor: help;
  transition: filter 0.12s;
}
.tzb-seg:hover { filter: brightness(1.15); }
.tzb-legend {
  display: flex; gap: 0.6rem; flex-wrap: wrap;
  font-size: 0.68rem; color: var(--text-dim); margin-top: 0.3rem;
}
.tzb-leg { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.tzb-leg i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* ── Pływający popup paska stref ── */
.tzb-tooltip {
  position: fixed; z-index: 9999; pointer-events: none;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.5rem 0.65rem;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
  font-size: 0.74rem; color: var(--text); min-width: 160px;
  opacity: 0; transform: translateY(2px); transition: opacity 0.1s;
}
.tzb-tooltip.show { opacity: 1; transform: none; }
.tzb-tip-h { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.tzb-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.tzb-tip-kwh { color: var(--text-dim); margin: 2px 0 5px; }
.tzb-tip-row {
  display: flex; justify-content: space-between; gap: 1rem;
  line-height: 1.6;
}
.tzb-tip-row i { margin-right: 4px; }
.tzb-tip-total { border-top: 1px solid var(--border); margin-top: 3px; padding-top: 3px; }

/* ── Detail table tweaks ── */
#tariff-detail-table table th {
  white-space: nowrap;
}
#tariff-detail-table table .sum-row td {
  border-top: 2px solid var(--border);
  background: var(--bg3);
}

/* ── Zestawienie miesięczne: separacja kolumn taryf + kolory koszt min/max ── */
.bill-table th.grp,
.bill-table td.grp {
  border-left: 2px solid var(--border);   /* wyraźna granica między taryfami */
}
.bill-table td.tot {
  background: rgba(255,255,255,.035);      /* delikatne tło kolumny „Łącznie" */
}
.bill-table td.cheap { background: rgba(34,197,94,.14); }
.bill-table td.exp   { background: rgba(239,68,68,.14); }
.bill-table td.cheap b { color: var(--green); }
.bill-table td.exp   b { color: var(--red); }
.bill-key { font-size: 0.8rem; line-height: 1; }
.bill-key.cheap { color: var(--green); }
.bill-key.exp   { color: var(--red); }

/* ── Switch „Bez / Z optymalizacją" (globalny, na belce „Analizowany okres") ── */
.bill-switch {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.74rem; color: var(--text-dim); cursor: pointer; user-select: none;
}
.bill-switch span.on { color: var(--text); font-weight: 600; }
.bill-switch input { position: absolute; opacity: 0; pointer-events: none; }
.bill-switch-track {
  position: relative; width: 34px; height: 18px; flex-shrink: 0;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 999px;
  transition: background .15s, border-color .15s;
}
.bill-switch-thumb {
  position: absolute; top: 1px; left: 1px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--text-dim); transition: transform .15s, background .15s;
}
.bill-switch input:checked + .bill-switch-track { background: rgba(168,85,247,.25); border-color: var(--purple); }
.bill-switch input:checked + .bill-switch-track .bill-switch-thumb { transform: translateX(16px); background: var(--purple); }

/* ── Sekcja „Porównanie faktur": sticky nagłówek ze switchem ── */
.compare-sticky-header {
  position: sticky;
  top: 104px;                /* tuż pod sticky paskiem zakładek (#view-tabs: top 60px, ~44px wys.) */
  z-index: 80;
  background: var(--bg);
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  margin-top: 1.5rem; padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}
.compare-sticky-header h2 { font-size: 1rem; font-weight: 650; color: var(--text); }
.compare-sticky-header h2 i { color: var(--blue); margin-right: 6px; }

/* ── Wiersz „Śr. oszczędność / mies." (z optymalizacji) ── */
.bill-table .sav-row td { border-top: 1px dashed var(--border); font-size: 0.8rem; padding-top: 0.5rem; }
.bill-table .sav-row td b { color: var(--text-dim); font-weight: 600; }
.bill-table .sav-row td.sav  { color: var(--green); font-weight: 700; }
.bill-table .sav-row td.loss { color: var(--red);   font-weight: 700; }
.bill-table .sav-row td.dim  { color: var(--text-dim); }
.sav-note { font-weight: 400; color: var(--text-dim); }

/* ── Ramki kolumn: aktualna (niebieska) · najtańsza (zielona) ── */
.bill-table .gcell-l.fr-sel  { border-left:  2px solid var(--blue); }
.bill-table .gcell-r.fr-sel  { border-right: 2px solid var(--blue); }
.bill-table .gcol-top.fr-sel { border: 2px solid var(--blue); border-bottom: none; }
.bill-table tbody tr:last-child .gcell-l.fr-sel,
.bill-table tbody tr:last-child .gcell-r.fr-sel { border-bottom: 2px solid var(--blue); }
.bill-table .gcell-l.fr-cheap  { border-left:  2px solid var(--green); }
.bill-table .gcell-r.fr-cheap  { border-right: 2px solid var(--green); }
.bill-table .gcol-top.fr-cheap { border: 2px solid var(--green); border-bottom: none; }
.bill-table tbody tr:last-child .gcell-l.fr-cheap,
.bill-table tbody tr:last-child .gcell-r.fr-cheap { border-bottom: 2px solid var(--green); }
.chart-hint .ff { font-weight: 700; }
.chart-hint .ff.sel   { color: var(--blue); }
.chart-hint .ff.cheap { color: var(--green); }

/* ── Wiersz SUMA w prostych tabelach (.table-wrap) ── */
.table-wrap .sum-row td {
  border-top: 2px solid var(--border);
  background: var(--bg3);
}

/* ── Pobór bazowy (standby) - pod paskiem statystyk okresu ── */
.baseline-block { margin-top: 0.85rem; }
.section-subhead {
  font-size: 0.82rem; font-weight: 600; color: var(--text);
  margin: 0 0 0.6rem;
}
.section-subhead i { color: var(--purple); margin-right: 5px; }
.section-subhead span { color: var(--text-dim); font-weight: 400; font-size: 0.74rem; }

.baseline-bar {
  display: flex; height: 14px;
  border-radius: 7px; overflow: hidden;
  background: var(--bg3);
  margin-top: 0.75rem;
}
.baseline-bar .bl-seg { height: 100%; }
.bl-seg.bl-base { background: #a855f7; }
.bl-seg.bl-var  { background: #14b8a6; }

.baseline-legend {
  display: flex; gap: 1.25rem;
  margin-top: 0.55rem;
  font-size: 0.78rem; color: var(--text-dim);
}
.baseline-legend .bl-key {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 2px; margin-right: 4px;
}
.baseline-legend .bl-key.bl-base { background: #a855f7; }
.baseline-legend .bl-key.bl-var  { background: #14b8a6; }

/* ── Histogram cen RCE - podsumowanie / legenda ── */
.hist-summary {
  display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem;
  margin-top: 0.5rem;
  font-size: 0.76rem; color: var(--text-dim);
}
.hist-summary .hs-stat { display: block; }
.hist-summary .hs-stat b { color: var(--text); }
.hist-summary .hs-key {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 2px; margin-right: 5px; vertical-align: middle;
}
.hs-key.hs-neg   { background: #22c55e; }
.hs-key.hs-cheap { background: #14b8a6; }
.hs-key.hs-exp   { background: #f97316; }

.chart-hint {
  font-size: 0.72rem; color: var(--text-dim); margin-left: 0.5rem;
}

/* ── Battery controls button row ────────────────────────────── */
.batt-btn-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  width: 100%;            /* span full width inside flex-wrap battery-controls */
  margin-top: 0.25rem;
}

/* ── Capacity sweep section ──────────────────────────────────── */
#capacity-sweep-section {
  margin-top: 1.5rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.sweep-header h3 {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sweep-header h3 i { color: var(--teal); }

.sweep-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

/* Progress bar */
.sweep-progress-wrap {
  margin-bottom: 0.75rem;
}
.sweep-progress-track {
  background: var(--bg3);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
}
.sweep-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--green));
  border-radius: 999px;
  transition: width 0.15s linear;
}

/* Info row */
.sweep-info-row {
  font-size: 0.82rem;
  color: var(--text-dim);
  min-height: 1.4em;
  margin-bottom: 0.25rem;
  line-height: 1.6;
}
.sweep-info-row b { color: var(--text); }

/* ── Footer ─────────────────────────────────────────────────── */
#main-footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-dim);
  font-size: 0.75rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

/* ── VAT Toggle ─────────────────────────────────────────────── */
.vat-toggle {
  display: flex;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.vat-btn {
  flex: 1;
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.vat-btn.active {
  background: var(--blue-dim);
  color: white;
  font-weight: 700;
}

.vat-btn:hover:not(.active) {
  background: rgba(255,255,255,.05);
  color: var(--text);
}

.vat-hint {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 3px;
  font-style: italic;
}

/* ── Date range inputs in settings bar ──────────────────────── */
.date-range-group input[type="date"] {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 0.88rem;
  font-family: inherit;
  width: 148px;
  transition: border-color var(--transition);
  cursor: pointer;
  /* Chromium date picker dark mode */
  color-scheme: dark;
}
.date-range-group input[type="date"]:focus {
  outline: none;
  border-color: var(--blue);
}

/* ══════════════════════════════════════════════════════════════
   KPI STRIP - wąski pasek statystyk nad sekcją taryf
   ══════════════════════════════════════════════════════════════ */
#kpi-strip-section {
  margin-top: 1.5rem;
}

.kpi-strip {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.kpi-strip-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 160px;
  position: relative;
  overflow: hidden;
}
.kpi-strip-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
}
.kpi-strip-card.accent-blue::before   { background: var(--blue); }
.kpi-strip-card.accent-green::before  { background: var(--green); }
.kpi-strip-card.accent-teal::before   { background: var(--teal); }
.kpi-strip-card.accent-red::before    { background: var(--red); }
.kpi-strip-card.accent-purple::before { background: var(--purple); }
.kpi-strip-card.accent-orange::before { background: var(--orange); }

.kpi-strip-card > i {
  font-size: 1.1rem;
  flex-shrink: 0;
}
.kpi-strip-card.accent-blue   > i { color: var(--blue); }
.kpi-strip-card.accent-green  > i { color: var(--green); }
.kpi-strip-card.accent-teal   > i { color: var(--teal); }
.kpi-strip-card.accent-red    > i { color: var(--red); }
.kpi-strip-card.accent-purple > i { color: var(--purple); }
.kpi-strip-card.accent-orange > i { color: var(--orange); }

.kpi-strip-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.kpi-strip-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-strip-label {
  font-size: 0.68rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ── Settings equivalents ────────────────────────────────────── */
.setting-equiv {
  font-size: 0.72rem;
  color: var(--text-dim);
  white-space: nowrap;
  font-style: italic;
}

.settings-sep {
  width: 1px;
  height: 40px;
  background: var(--border);
  margin: 0 4px;
  align-self: center;
}

.label-dim {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 0.85em;
}

/* ── Pricing summary pill ────────────────────────────────────── */
.pricing-summary {
  max-width: 1600px;
  margin: 0 auto;
  padding: 6px 1.5rem 0;
  font-size: 0.75rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}

.pricing-summary i { color: var(--blue); }

#ps-formula {
  font-family: 'Courier New', monospace;
  color: var(--text-dim);
}

/* ── KPI VAT tag ─────────────────────────────────────────────── */
.kpi-vat-tag {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(59,130,246,.15);
  color: var(--blue);
  vertical-align: middle;
  text-transform: uppercase;
  margin-left: 2px;
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3a4560; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .chart-row { grid-template-columns: 1fr; }
  .table-row { grid-template-columns: 1fr; }
  .upload-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .settings-inner { flex-direction: column; align-items: stretch; }
  .optim-controls { flex-direction: column; }
  .optim-kpi-row { flex-direction: column; text-align: center; }
  .tabs-period-chip { display: none; }
}

/* ── Loading spinner ─────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tag chips ───────────────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}
.tag-red    { background: rgba(239,68,68,.18); color: var(--red); }
.tag-green  { background: rgba(34,197,94,.18);  color: var(--green); }
.tag-yellow { background: rgba(234,179,8,.18);  color: var(--yellow); }
