:root {
  color-scheme: dark;
  /* Named tokens - a sunlit tropical lagoon, not a muted enterprise palette.
     Saturated cyan water, coral glow, warm sand-gold light. */
  --deep-water: #062634;
  --water-surface: #0d4a5c;
  --water-surface-2: #146a80;
  --lagoon-bright: #14b8a6;
  --foam: #f2fffb;
  --coral: #ff7a8a;
  --sand-gold: #ffb454;
  --algae-glow: #2de0c7;
  --alert-koi: #ff5470;
  --info-blue: #4aa8ff;

  /* Semantic aliases used throughout the rest of this file */
  --bg: var(--deep-water);
  --bg-elevated: var(--water-surface-2);
  --panel: var(--water-surface);
  --panel-border: rgba(45, 224, 199, 0.22);
  --gloss: rgba(255, 255, 255, 0.14);
  --text: var(--foam);
  --ink: var(--foam); /* linie i znaczniki, które muszą odcinać się od tła */
  --muted: #8fd4d0;
  --accent: var(--algae-glow);
  --accent-strong: #14b8a6;
  --danger: var(--alert-koi);
  --ok: var(--algae-glow);
  --warn: var(--sand-gold);
  --shadow: inset 0 1px 0 var(--gloss), 0 10px 28px rgba(2, 12, 18, 0.55);
  /* Cztery promienie: drobne znaczniki, kontrolki, karty, pigułki. */
  --radius-xs: 4px; --radius-sm: 10px; --radius: 16px; --radius-pill: 999px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "IBM Plex Sans", -apple-system, "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  /* Skala tekstu: 7 stopni zamiast kilkudziesięciu rozmiarów. Wartości ekspozycyjne
     (duże liczby KPI, zegar trybu ściennego) zostają przy komponentach. */
  --fs-2xs: 0.7rem; --fs-xs: 0.8rem; --fs-sm: 0.875rem; --fs-md: 1rem;
  --fs-lg: 1.15rem; --fs-xl: 1.4rem; --fs-2xl: 2rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 20px;
  background:
    /* soft god-rays */
    linear-gradient(115deg, rgba(242,255,251,0.10) 0%, transparent 18%),
    linear-gradient(100deg, rgba(242,255,251,0.06) 8%, transparent 26%),
    radial-gradient(1200px 700px at 15% -15%, rgba(45, 224, 199, 0.22), transparent 55%),
    radial-gradient(900px 600px at 105% 10%, rgba(255, 122, 138, 0.10), transparent 50%),
    linear-gradient(180deg, var(--water-surface) 0%, var(--deep-water) 65%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

header {
  margin-bottom: 4px;
}

/* ---- Ekran logowania ---- */

.login-body {
  max-width: none;
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 340px;
  text-align: center;
  background: linear-gradient(135deg, rgba(255,255,255,0.09), rgba(255,255,255,0) 35%), linear-gradient(180deg, var(--panel), var(--bg-elevated));
  border: 1px solid rgba(45, 224, 199, 0.35);
  border-radius: var(--radius);
  padding: 36px 32px;
  box-shadow: var(--shadow), 0 0 60px -18px var(--accent);
}

.login-app-link { margin: 20px 0 0; font-size: var(--fs-md); }
.login-app-link a { color: var(--accent); text-decoration: none; font-weight: 600; }
.login-app-link a:hover { text-decoration: underline; }

/* Logo zamiast napisu: sama grafika, bez nazwy. Nazwa zostaje w atrybucie alt
   dla czytnikow ekranu i jako tekst zastepczy, gdyby obraz sie nie zaladowal.
   Cien jest statyczny (box-shadow, nie filter), wiec nic sie nie przelicza. */
.login-logo {
  width: 96px;
  height: 96px;
  margin: 0 auto 16px auto;
  line-height: 0;
}

.login-logo img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 25%;
  box-shadow: 0 12px 28px -10px rgba(2, 12, 18, 0.75);
}

.login-subtitle {
  color: var(--muted);
  font-size: var(--fs-sm);
  margin: 0 0 24px 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: border-color 0.15s ease;
}

.login-field:focus-within {
  border-color: var(--accent);
}

.login-field .icon-inline {
  margin-right: 0;
  color: var(--muted);
}

.login-field input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: var(--fs-md);
  font-family: var(--font-body);
}

.login-error {
  background: rgba(255, 84, 112, 0.1);
  border: 1px solid rgba(255, 84, 112, 0.35);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: var(--fs-sm);
}

.login-submit {
  width: 100%;
  padding: 11px 18px;
}

.app-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.app-logo {
  margin: 0;
  line-height: 0;
  flex-shrink: 0;
}

.app-logo img {
  width: 56px;
  height: 56px;
  display: block;
}

/* Przycisk nie kurczy sie razem z reszta wiersza: bez tego logo i podtytul
   sciskaly go na waskim ekranie tak, ze ikona lądowala nad napisem. To
   podtytul (wymiary zbiornika) ma sie zawijac, nie przycisk. */
.logout-form { margin: 0; flex-shrink: 0; }

.logout-btn {
  padding: 8px 14px;
  font-size: var(--fs-sm);
  white-space: nowrap;
}

/* Podtytul (wymiary zbiornika) stoi teraz obok logo, wiec moze sie zawinac w
   dwa wiersze na wasnym ekranie telefonu zamiast wypychac przycisk Wyloguj. */
.app-subtitle {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--muted);
  margin: 0;
  min-width: 0;
}

@media (max-width: 480px) {
  .app-logo img { width: 48px; height: 48px; }
  .app-brand { gap: 10px; }
}

.panel h2, .rec-card-title, .settings-group h3 { font-family: var(--font-display); }

.alerts-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.alert-card {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--accent);
  background: rgba(45, 224, 199, 0.1);
  box-shadow: var(--shadow);
  font-size: var(--fs-sm);
}

.alert-card.severity-warning {
  border-left-color: var(--danger);
  background: rgba(255, 84, 112, 0.1);
}

.alert-card-message {
  flex: 1;
  min-width: 200px;
}

.alert-card { position: relative; padding-right: 52px; transition: opacity 0.2s ease, transform 0.2s ease; }
.alert-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: var(--fs-xl);
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  box-shadow: none;
  cursor: pointer;
}
.alert-close:hover, .alert-close:focus-visible { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.alert-restore {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  font-size: var(--fs-xs);
}
.alert-card.alert-dismissed { opacity: 0.6; padding-right: 110px; }
.alert-card.alert-closing { opacity: 0; transform: translateX(12px); }
.alerts-hidden-toggle { align-self: flex-start; font-size: var(--fs-sm); }
@media (prefers-reduced-motion: reduce) { .alert-card { transition: none; } }

.alert-card-actions {
  display: flex;
  gap: 8px;
}

.alert-card-actions button {
  padding: 6px 12px;
  font-size: var(--fs-sm);
}

.severity-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
}

.severity-badge.warning {
  background: rgba(255, 84, 112, 0.18);
  color: var(--danger);
}

.severity-badge.info {
  background: rgba(45, 224, 199, 0.16);
  color: var(--accent);
}

.hidden { display: none !important; }

.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--panel-border);
  overflow-x: auto;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 10px 14px;
  font-weight: 600;
  font-size: var(--fs-sm);
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}

.tab-btn .icon-inline {
  margin-right: 7px;
  color: inherit;
}

.tab-btn .icon-inline svg { width: 15px; height: 15px; }

.tab-btn:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.06);
}

.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.tab-panel {
  padding-top: 4px;
  animation: fade-in 0.2s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.card {
  background: linear-gradient(135deg, rgba(255,255,255,0.09), rgba(255,255,255,0) 35%), linear-gradient(180deg, var(--panel), var(--bg-elevated));
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.card-label {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 500;
  margin-bottom: 2px;
}

.card-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.6rem;
  font-weight: 600;
}

.card-sub {
  color: var(--muted);
  font-size: var(--fs-xs);
  margin-top: 4px;
}

/* ---- Hero: tank water-column + compact stat rows ---- */

.instruments {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.tank-hero {
  background: linear-gradient(135deg, rgba(255,255,255,0.09), rgba(255,255,255,0) 35%), linear-gradient(180deg, var(--panel), var(--bg-elevated));
  border: 1px solid rgba(45, 224, 199, 0.35);
  border-radius: var(--radius);
  padding: 22px 28px;
  box-shadow: var(--shadow), 0 0 60px -18px var(--accent);
  cursor: pointer;
  display: flex;
  align-items: stretch;
  gap: 26px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tank-hero-divider {
  width: 1px;
  background: rgba(242, 255, 251, 0.12);
  flex-shrink: 0;
}

.tank-sidebar {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

.hero-sidebar-title {
  margin-bottom: 2px;
}

.hero-stat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(242, 255, 251, 0.08);
}

.hero-stat-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.hero-stat-label, .hero-stat-label-col {
  flex: 1;
  min-width: 0;
}

.hero-stat-label {
  font-size: var(--fs-sm);
  color: var(--muted);
}

.hero-sparkline {
  width: 56px;
  height: 22px;
  flex-shrink: 0;
  color: var(--accent);
}

.hero-sparkline polyline {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.75;
}

.hero-stat-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-xl);
  font-weight: 600;
  white-space: nowrap;
}

.hero-stat-row-level .tank-value {
  margin-bottom: 0;
}

@media (max-width: 560px) {
  .tank-hero-divider { display: none; }
  .hero-sparkline { display: none; }
  .hero-stat-row, .hero-stat-row-level { text-align: left; }
}

/* Pasek statusu pod akwarium - płaski, bez ciężkiego cienia karty, oddzielny
   od paneli gauge'ów żeby nie powielać tego samego stylu wszędzie. */
.status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-radius: var(--radius);
  background: rgba(242, 255, 251, 0.03);
  border: 1px solid var(--panel-border);
  margin-bottom: 16px;
  gap: 12px;
}

.status-strip-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.status-strip-divider {
  width: 1px;
  height: 30px;
  background: rgba(242, 255, 251, 0.14);
  flex-shrink: 0;
}

.tank-side-value.is-overdue {
  color: var(--danger);
}

@media (max-width: 640px) {
  .status-strip { flex-direction: column; align-items: stretch; gap: 14px; }
  .status-strip-divider { width: 100%; height: 1px; }
}

.tank-hero:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow), 0 8px 24px rgba(3, 15, 13, 0.5), 0 0 70px -16px var(--accent);
}

@media (max-width: 560px) {
  .tank-hero { flex-direction: column; text-align: center; }
}

.tank-svg {
  width: 100%;
  max-width: 420px;
  height: auto;
  flex-shrink: 0;
}

.tank-outline {
  fill: rgba(234, 244, 238, 0.04);
  stroke: rgba(234, 244, 238, 0.3);
  stroke-width: 2;
}

/* Boki 3D - prawa ściana i górna krawędź zbiornika pod kątem, żeby prostokątny
   zarys czytał się jako bryła (akwarium), a nie płaski prostokąt. */
.tank-face-side {
  fill: rgba(6, 26, 34, 0.6);
  stroke: rgba(234, 244, 238, 0.25);
  stroke-width: 1;
}

.tank-face-top {
  fill: rgba(94, 240, 216, 0.14);
  stroke: rgba(234, 244, 238, 0.25);
  stroke-width: 1;
}

.tank-ruler line {
  stroke: rgba(234, 244, 238, 0.4);
  stroke-width: 2;
}

.tank-ruler text {
  font-family: var(--font-mono);
  font-size: 9px;
  fill: var(--muted);
}

.tank-ruler-unit {
  font-size: 7px;
  fill: rgba(143, 212, 208, 0.6);
}

.tank-fill {
  transition: d 0.6s ease;
}

.tank-substrate {
  fill: var(--sand-gold);
  opacity: 0.55;
  transition: y 0.6s ease, height 0.6s ease;
}

.tank-rock {
  fill: rgba(20, 30, 34, 0.55);
  stroke: rgba(0, 0, 0, 0.2);
  stroke-width: 0.4;
}

.tank-bubble {
  fill: rgba(255, 255, 255, 0.55);
  animation: bubble-rise 4.2s ease-in infinite;
}

.tank-bubble-2 { animation-delay: 1.1s; animation-duration: 3.3s; }
.tank-bubble-3 { animation-delay: 2.3s; animation-duration: 4.8s; }

@keyframes bubble-rise {
  0% { transform: translateY(0); opacity: 0; }
  10% { opacity: 0.8; }
  90% { opacity: 0.4; }
  100% { transform: translateY(-88px); opacity: 0; }
}

.tank-glass-shine {
  fill: rgba(255, 255, 255, 0.10);
  pointer-events: none;
}

.tank-target-line {
  stroke: var(--sand-gold);
  stroke-width: 1.2;
  stroke-dasharray: 4 3;
  opacity: 0.85;
}

.tank-target-label {
  font-family: var(--font-mono);
  font-size: 6.5px;
  fill: var(--sand-gold);
}

.tank-skull-warning {
  font-size: 34px;
  animation: skull-pulse 1.8s ease-in-out infinite;
}

/* Poziom wody poniżej 50%: migająca czaszka. */
.tank-skull-level {
  font-size: 34px;
  animation: skull-blink 1s steps(1, end) infinite;
}

@keyframes skull-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tank-skull-level { animation: none; }
}

/* Kształt ryby w ściśniętej (płytkiej) kolumnie wody zachowuje normalne proporcje. */
.fish-unsquash { transform: scale(1, var(--fish-unsquash, 1)); }

@keyframes skull-pulse {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

.tank-fish { animation: fish-swim 13s ease-in-out infinite; }

.tank-fish-body {
  fill: var(--coral);
}

.tank-fish-tail {
  fill: var(--coral);
  opacity: 0.85;
}

.tank-fish-eye {
  fill: var(--deep-water);
}

/* Paski na ciele ryby - półprzezroczyste, więc bazowy kolor (w tym dynamiczny
   kolor harmonogramu podmian) zawsze przebija spod spodu. */
.tank-fish-stripe {
  fill: rgba(0, 0, 0, 0.32);
}

@keyframes fish-swim {
  0%   { transform: translate(50px, 60px) scaleX(1); }
  45%  { transform: translate(170px, 50px) scaleX(1); }
  50%  { transform: translate(170px, 50px) scaleX(-1); }
  95%  { transform: translate(50px, 70px) scaleX(-1); }
  100% { transform: translate(50px, 60px) scaleX(1); }
}

/* Dwie dodatkowe, czysto dekoracyjne rybki (bez roli wskaźnika harmonogramu) -
   inne wysokości/trasy/czasy niż główna, żeby zbiornik nie wyglądał pusto. */
.tank-fish-decor-2 { animation: fish-swim-2 17s ease-in-out infinite; }
.tank-fish-decor-3 { animation: fish-swim-3 21s ease-in-out infinite; }

.tank-fish-body-decor-2, .tank-fish-tail-decor-2 { fill: var(--sand-gold); }
.tank-fish-tail-decor-2 { opacity: 0.85; }

.tank-fish-body-decor-3, .tank-fish-tail-decor-3 { fill: #b48ce8; }
.tank-fish-tail-decor-3 { opacity: 0.85; }

@keyframes fish-swim-2 {
  0%   { transform: translate(60px, 30px) scaleX(1); }
  45%  { transform: translate(160px, 25px) scaleX(1); }
  50%  { transform: translate(160px, 25px) scaleX(-1); }
  95%  { transform: translate(60px, 35px) scaleX(-1); }
  100% { transform: translate(60px, 30px) scaleX(1); }
}

@keyframes fish-swim-3 {
  0%   { transform: translate(150px, 80px) scaleX(-1); }
  45%  { transform: translate(55px, 85px) scaleX(-1); }
  50%  { transform: translate(55px, 85px) scaleX(1); }
  95%  { transform: translate(150px, 78px) scaleX(1); }
  100% { transform: translate(150px, 80px) scaleX(-1); }
}

.driftwood-shape {
  fill: none;
  stroke: #6b4226;
  stroke-linecap: round;
  stroke-width: 4;
}

.driftwood-branch {
  stroke-width: 2.5;
  stroke: #7a4d2c;
}

/* Rośliny w tle - lekko kołyszące się, żeby zbiornik nie wyglądał pusto/statycznie.
   Wypełnione, zwężające się ku górze kształty (nie same linie) - jak długie
   liście trawy wodnej (Vallisneria). */
.tank-plant path {
  fill: var(--algae-glow);
  opacity: 0.55;
}

.tank-plant path:nth-child(2n) {
  opacity: 0.4;
}

.tank-plant {
  transform-origin: 0 0;
  animation: plant-sway 4.2s ease-in-out infinite;
}

.tank-plant-2 { animation-duration: 5.6s; animation-delay: -1.1s; }
.tank-plant-3 { animation-duration: 4.8s; animation-delay: -2.4s; }

@keyframes plant-sway {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

/* Tonowane plakietki z ikonami - odróżniają poszczególne parametry od siebie
   zamiast samego tekstu, spójnie z ikonami przy etykietach gauge'ów. */
.icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--accent);
  margin-right: 6px;
  vertical-align: -6px;
}

.icon-badge svg { width: 16px; height: 16px; }

.icon-badge-sm {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(45, 224, 199, 0.14);
  margin-right: 0;
  vertical-align: baseline;
}

.icon-badge-sm svg { width: 17px; height: 17px; }

.icon-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-right: 8px;
  vertical-align: -3px;
}

.icon-inline svg { width: 16px; height: 16px; }

/* Panel gauge'ów: JEDEN płaski kontener z pionowymi separatorami zamiast trzech
   identycznych, osobno ocieniowanych kart - to właśnie powielanie tego samego
   stylu na każdym boksie sprawiało, że dashboard wyglądał monotonnie. */
.gauges-panel {
  border-radius: var(--radius);
  border: 1px solid var(--panel-border);
  background: rgba(242, 255, 251, 0.03);
  padding: 22px 26px;
  margin-bottom: 16px;
}

.gauges-panel h2 {
  margin: 0 0 16px 0;
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: 700;
}

.gauges-panel .stat-column {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}

.gauges-panel .stat-row {
  background: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 4px 18px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.gauges-panel .stat-row:hover {
  transform: none;
  box-shadow: none;
  opacity: 0.85;
}

.gauges-panel .stat-row + .stat-row {
  border-left: 1px solid rgba(242, 255, 251, 0.1);
}

@media (max-width: 640px) {
  .gauges-panel .stat-column { grid-template-columns: 1fr; }
  .gauges-panel .stat-row + .stat-row {
    border-left: none;
    border-top: 1px solid rgba(242, 255, 251, 0.1);
    padding-top: 16px;
    margin-top: 12px;
  }
}

/* Panele drugorzędne (podmiana wody, wykresy, historia) - płaskie, bez ciężkiego
   cienia, żeby hero (akwarium) pozostał jedynym mocno wyeksponowanym elementem. */
.panel-flat {
  background: rgba(242, 255, 251, 0.025);
  box-shadow: none;
}

.tank-side-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-lg);
  font-weight: 600;
}

.tank-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-2xl);
  font-weight: 600;
  line-height: 1;
  margin-bottom: 6px;
}

.tank-value small {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--muted);
  margin-left: 2px;
}

.stat-column {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 640px) {
  .stat-column { grid-template-columns: 1fr; }
}

.stat-row {
  background: linear-gradient(135deg, rgba(255,255,255,0.09), rgba(255,255,255,0) 35%), linear-gradient(180deg, var(--panel), var(--bg-elevated));
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(3, 15, 13, 0.5);
}

.stat-row-vertical {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}

.stat-gauge-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0;
}

.stat-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-xl);
  font-weight: 600;
  line-height: 1.1;
}

.stat-value small {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--muted);
  margin-left: 3px;
}

.stat-value.out-of-range { color: var(--danger); }

/* ---- Termometr (temperatura) ---- */

.gauge-thermo { width: 30px; height: 76px; flex-shrink: 0; }

.thermo-tube {
  fill: rgba(234, 244, 238, 0.08);
  stroke: rgba(234, 244, 238, 0.35);
  stroke-width: 1.5;
}

.thermo-bulb {
  fill: rgba(234, 244, 238, 0.08);
  stroke: rgba(234, 244, 238, 0.35);
  stroke-width: 1.5;
}

.thermo-fill, .thermo-bulb-fill {
  fill: var(--sand-gold);
  transition: y 0.6s ease, height 0.6s ease, fill 0.3s ease;
}

.thermo-fill.out-of-range, .thermo-bulb-fill.out-of-range {
  fill: var(--danger);
}

/* ---- Skala pH (jak papierek lakmusowy) ---- */

.gauge-ph { width: 110px; height: 30px; flex-shrink: 0; }

.ph-marker {
  fill: var(--foam);
  stroke: var(--deep-water);
  stroke-width: 0.5;
  transition: transform 0.5s ease;
}

/* Delikatne znaczniki progów (min/zalecane-średnia/max) na gauge'ach -
   subtelne, żeby nie konkurowały wizualnie z samą wartością/wskaźnikiem. */
.gauge-mark {
  stroke: rgba(234, 244, 238, 0.55);
  stroke-width: 0.8;
  transition: x1 0.4s ease, x2 0.4s ease, y1 0.4s ease, y2 0.4s ease;
}

.gauge-mark-avg {
  stroke: var(--sand-gold);
  stroke-width: 1;
  opacity: 0.8;
}

/* ---- Tuba z bąbelkami CO2 ---- */

.gauge-co2 { width: 24px; height: 76px; flex-shrink: 0; }

.co2-tube {
  fill: rgba(234, 244, 238, 0.06);
  stroke: rgba(234, 244, 238, 0.3);
  stroke-width: 1.5;
}

.co2-base {
  fill: rgba(234, 244, 238, 0.12);
  stroke: rgba(234, 244, 238, 0.3);
  stroke-width: 1.5;
}

/* Pole wypełnienia tuby - kolor według normy: niebieski = za mało CO2 (bezpiecznie
   dla ryb, ale za mało dla roślin), zielony = optymalnie, czerwony = za dużo (ryzyko dla ryb) */
.co2-fill {
  fill: var(--muted);
  transition: y 0.6s ease, height 0.6s ease, fill 0.3s ease;
}

.co2-fill.co2-low { fill: var(--info-blue); }
.co2-fill.co2-ok { fill: var(--algae-glow); }
.co2-fill.co2-alert { fill: var(--danger); }

.co2-bubble {
  fill: var(--muted);
  animation: co2-bubble-rise 2.6s ease-in infinite;
}

.co2-bubble.co2-low { fill: var(--info-blue); }
.co2-bubble.co2-alert { fill: var(--danger); }
.co2-bubble.co2-ok { fill: var(--algae-glow); }

.co2-bubble-2 { animation-delay: 0.7s; }
.co2-bubble-3 { animation-delay: 1.4s; }

@keyframes co2-bubble-rise {
  0% { transform: translateY(0); opacity: 0; }
  15% { opacity: 0.9; }
  85% { opacity: 0.5; }
  100% { transform: translateY(-54px); opacity: 0; }
}

.panel {
  background: linear-gradient(135deg, rgba(255,255,255,0.09), rgba(255,255,255,0) 35%), linear-gradient(180deg, var(--panel), var(--bg-elevated));
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.section-header-row h2 { margin: 0; }

.export-csv-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.export-csv-link:hover { text-decoration: underline; }

.species-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 20;
  width: 220px;
  margin-top: 2px;
  background: var(--bg-elevated);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(3, 15, 13, 0.5);
  overflow: hidden;
}

.species-suggestion-item {
  padding: 8px 12px;
  font-size: var(--fs-sm);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.species-suggestion-item:hover {
  background: rgba(45, 224, 199, 0.14);
}

.species-suggestion-kind {
  color: var(--muted);
  font-size: var(--fs-xs);
}

.premium-locked {
  color: var(--muted) !important;
  cursor: not-allowed;
}
.premium-locked:hover { text-decoration: none !important; }
.export-csv-link .icon-inline { margin-right: 0; }
.export-csv-link .icon-inline svg { width: 14px; height: 14px; }

.panel h2 {
  margin-top: 0;
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: -0.005em;
}

button {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: var(--deep-water);
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  font-size: var(--fs-sm);
  box-shadow: 0 2px 8px rgba(45, 224, 199, 0.25);
  transition: transform 0.1s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

button:hover { opacity: 0.95; transform: translateY(-1px); }
button:active { transform: translateY(0); }

/* Tabele z wieloma/szerokimi kolumnami (daty, wartości liczbowe) mogą nie
   zmieścić się na wąskim ekranie - kontener przewija się w bok SAM, żeby
   nigdy nie wypychał całej strony w poziomie na telefonie. */
.table-scroll {
  overflow-x: auto;
}

.wc-table, .wc-history-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: var(--fs-sm);
}

.table-scroll .wc-history-table {
  min-width: 420px;
}

.wc-table td, .wc-history-table td, .wc-history-table th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--panel-border);
  text-align: left;
}

.wc-history-table th {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 600;
}

canvas {
  margin-bottom: 20px;
  max-width: 100%;
}

/* Chart.js z maintainAspectRatio:false potrzebuje rodzica o JAWNEJ wysokości -
   inaczej (z domyślnym maintainAspectRatio) canvas trzyma proporcje względem
   swojej szerokości, co na wąskim ekranie (telefon) robi wykres bardzo płaskim. */
.inline-chart-wrap {
  position: relative;
  height: 220px;
  margin-bottom: 20px;
  cursor: pointer;
}

.inline-chart-wrap canvas {
  margin-bottom: 0;
}

@media (max-width: 560px) {
  .inline-chart-wrap { height: 200px; }
}

.card-disabled-note {
  color: var(--danger);
}

/* Podzakładki Ustawień - pigułki z ikonami w jednym, poziomo przewijanym
   rzędzie (na telefonie nie łamią się na kilka linii). */
.settings-subtabs {
  display: flex;
  gap: 8px;
  margin: 4px 0 20px 0;
  padding: 6px;
  background: rgba(242, 255, 251, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  overflow-x: auto;
  scrollbar-width: none;
}
.settings-subtabs::-webkit-scrollbar { display: none; }

.settings-subtab-btn {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  box-shadow: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.settings-subtab-btn:hover { color: var(--text); background: rgba(242, 255, 251, 0.06); transform: none; }
.settings-subtab-btn.active {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: var(--deep-water);
}
.settings-subtab-btn .icon-inline { margin-right: 7px; color: inherit; }
.settings-subtab-btn .icon-inline svg { width: 15px; height: 15px; }

/* Sekcje w Ustawieniach - grupują powiązane karty pod wspólnym, ponumerowanym
   nagłówkiem (kolejność = logiczny ciąg: dostęp -> integracje -> sprzęt ->
   konfiguracja zbiornika -> progi alarmowe -> zaawansowane), zamiast jednej
   płaskiej siatki 15+ kart bez podziału tematycznego. */
.settings-section { margin-bottom: 28px; }
.settings-section:last-child { margin-bottom: 0; }

.settings-section-title {
  display: flex;
  align-items: center;
  margin: 0 0 14px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--panel-border);
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text);
}

/* Siatka kart ustawień - każda grupa jest samodzielną, płaską kartą zamiast
   jednej długiej listy oddzielanej liniami. */
.settings-grid {
  display: grid;
  /* min(340px, 100%) zamiast samego 340px - inaczej na wąskim ekranie (telefon)
     grid wymusza kolumnę SZERSZĄ niż viewport, co poziomo przepełnia stronę
     (widoczne jako "duch" karty wystający poza prawą krawędź). */
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  gap: 16px;
  align-items: start;
}

.settings-group {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: rgba(242, 255, 251, 0.03);
  padding: 18px 20px;
}

.settings-group h3 {
  margin: 0 0 12px 0;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  cursor: pointer;
}

.toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.field-row label {
  color: var(--text);
  font-size: var(--fs-sm);
}

.field-row input[type="number"],
.field-row input[type="text"],
.field-row input[type="password"] {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  width: 110px;
  font-size: var(--fs-sm);
  transition: border-color 0.15s ease;
}

.field-row input[type="number"]:focus,
.field-row input[type="text"]:focus,
.field-row input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
}

.field-hint {
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.5;
  margin: -4px 0 10px 0;
}

button.secondary {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  box-shadow: none;
}

.calib-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.calib-result {
  display: inline-block;
  margin-left: 10px;
  font-size: var(--fs-sm);
  color: var(--ok);
}

.sensor-test-result {
  margin: 6px 0 14px 0;
}

.sensor-test-result:empty {
  margin: 0;
}

.sensor-test-result table {
  width: 100%;
  max-width: 320px;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  background: rgba(45, 224, 199, 0.06);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.sensor-test-result td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--panel-border);
}

.sensor-test-result tr:last-child td {
  border-bottom: none;
}

.sensor-test-result td:first-child {
  color: var(--muted);
}

.sensor-test-result td:last-child {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-weight: 600;
}

.sensor-test-result .sensor-test-error {
  color: var(--danger);
  font-size: var(--fs-sm);
}

.sensor-test-result .sensor-test-loading {
  color: var(--muted);
  font-size: var(--fs-sm);
}

.wc-status-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(45, 224, 199, 0.1);
  border: 1px solid rgba(45, 224, 199, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: var(--fs-sm);
}

.wc-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.wc-mini-tank-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
}

.wc-mini-tank-svg {
  width: 140px;
  flex-shrink: 0;
}

.wc-mini-tank-outline {
  fill: rgba(234, 244, 238, 0.04);
  stroke: rgba(234, 244, 238, 0.3);
  stroke-width: 2;
}

.wc-mini-fill {
  transition: d 0.6s ease;
}

.wc-mini-target-line {
  stroke: var(--sand-gold);
  stroke-width: 1.2;
  stroke-dasharray: 4 3;
  opacity: 0.85;
}

.wc-mini-tank-info {
  flex: 1;
  min-width: 0;
}

.wc-drained-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.6rem;
  font-weight: 600;
}

.wc-recommend-track {
  width: 100%;
  height: 8px;
  border-radius: var(--radius-xs);
  background: rgba(234, 244, 238, 0.12);
  margin: 8px 0 4px 0;
  overflow: hidden;
}

.wc-recommend-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--radius-xs);
  background: var(--sand-gold);
  transition: width 0.4s ease, background 0.3s ease;
}

.wc-recommend-fill.in-range {
  background: var(--algae-glow);
}

.wc-recommend-fill.over-range {
  background: var(--danger);
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: currentColor;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: -2px;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

.wc-error {
  background: rgba(255, 84, 112, 0.1);
  border: 1px solid rgba(255, 84, 112, 0.35);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-top: 10px;
  font-size: var(--fs-sm);
}

.manual-entry {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--panel-border);
}

.manual-entry p {
  color: var(--muted);
  font-size: var(--fs-sm);
  margin: 0 0 8px 0;
}

.fert-product {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 10px;
}

.fert-product-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.fert-product-name {
  font-weight: 700;
}

.fert-progress-track {
  width: 100%;
  height: 8px;
  border-radius: var(--radius-pill);
  background: rgba(148, 163, 184, 0.15);
  overflow: hidden;
  margin-bottom: 8px;
}

.fert-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-pill);
  transition: width 0.4s ease, background 0.3s ease;
}

.fert-progress-fill.under-target {
  background: var(--warn);
}

.fert-dose-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fert-dose-row input[type="number"] {
  width: 90px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
}

.fert-remove-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  box-shadow: none;
  padding: 2px 6px;
  font-size: var(--fs-sm);
}

.fert-remove-btn:hover {
  color: var(--danger);
  transform: none;
}

.rec-card {
  border: 1px solid var(--panel-border);
  border-left: 4px solid var(--muted);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 10px;
  background: rgba(148, 163, 184, 0.04);
}

.rec-card.priority-high {
  border-left-color: var(--danger);
}

.rec-card.priority-medium {
  border-left-color: var(--warn);
}

.rec-card.priority-low {
  border-left-color: var(--ok);
}

.rec-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.rec-card-category {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 600;
}

.rec-card-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.rec-card-detail {
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: var(--radius-pill);
}

.chart-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.chart-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 9, 20, 0.72);
  backdrop-filter: blur(2px);
}

.chart-modal-content {
  position: relative;
  background: linear-gradient(135deg, rgba(255,255,255,0.09), rgba(255,255,255,0) 35%), linear-gradient(180deg, var(--panel), var(--bg-elevated));
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  padding: 18px;
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  overflow-y: auto;
}

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

.chart-modal-header h3 {
  margin: 0;
  font-size: var(--fs-lg);
}

.chart-modal-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.chart-modal-compare-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.chart-modal-compare-label select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: var(--fs-sm);
}

.range-btn.active {
  background: var(--accent);
  color: var(--deep-water);
  border-color: transparent;
}

.chart-modal-canvas-wrap {
  position: relative;
  height: 55vh;
  min-height: 280px;
}

/* ---- Kalendarz ---- */
.cal-nav { display: flex; align-items: center; gap: 10px; }
.cal-nav button { padding: 4px 12px; font-size: var(--fs-lg); line-height: 1.2; }
.cal-title { font-weight: 700; min-width: 140px; text-align: center; font-family: var(--font-display); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin: 12px 0;
}
.cal-head { text-align: center; font-size: var(--fs-xs); color: var(--muted); font-weight: 600; padding: 4px 0; }
.cal-cell {
  min-height: 52px;
  padding: 5px 6px;
  border-radius: var(--radius-sm);
  background: rgba(242, 255, 251, 0.04);
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cal-cell.cal-empty { background: none; }
.cal-cell.cal-today { border-color: var(--accent); background: rgba(45, 224, 199, 0.1); }
.cal-num { font-size: var(--fs-xs); font-weight: 600; }
.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; }
.cal-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cal-wc-done { background: var(--info-blue); }
.cal-wc-due { background: var(--sand-gold); }
.cal-maint-due { background: var(--coral); }
.cal-maint-done { background: var(--accent); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: var(--fs-xs); color: var(--muted); margin-bottom: 10px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-event-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid rgba(242, 255, 251, 0.08); font-size: var(--fs-sm); }
.cal-event-row strong { font-family: var(--font-mono); min-width: 46px; }
@media (max-width: 560px) { .cal-cell { min-height: 44px; padding: 3px; } .cal-title { min-width: 110px; } }

.cal-fert { background: #b48ce8; }
.cal-livestock { background: #ff9ad5; }

/* ---- "Żywa" strona: płynne wejścia i mikro-interakcje ---- */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: none; }
}
@keyframes slide-from-right {
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: none; }
}
@keyframes slide-from-left {
  from { opacity: 0; transform: translateX(-28px); }
  to { opacity: 1; transform: none; }
}
@keyframes today-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(45, 224, 199, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(45, 224, 199, 0); }
}

/* kolejne panele/karty wpływają kaskadowo po przełączeniu zakładki/podzakładki
   (display:none -> block restartuje animację przy każdym pokazaniu) */
.tab-panel > .panel,
.tab-panel > section,
.tab-panel .instruments > *,
.tab-panel > .status-strip,
.settings-section:not(.hidden) .settings-group,
.settings-section:not(.hidden) > .panel {
  animation: rise-in 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.tab-panel > *:nth-child(2), .settings-section .settings-group:nth-child(2), .settings-section > .panel:nth-child(2) { animation-delay: 0.06s; }
.tab-panel > *:nth-child(3), .settings-section .settings-group:nth-child(3), .settings-section > .panel:nth-child(3) { animation-delay: 0.12s; }
.tab-panel > *:nth-child(4), .settings-section .settings-group:nth-child(4) { animation-delay: 0.18s; }
.tab-panel > *:nth-child(5), .settings-section .settings-group:nth-child(5) { animation-delay: 0.24s; }
.tab-panel > *:nth-child(n+6), .settings-section .settings-group:nth-child(n+6) { animation-delay: 0.3s; }

.cal-cell { animation: pop-in 0.3s ease both; animation-delay: calc(var(--i, 0) * 12ms); transition: transform 0.15s ease, background 0.15s ease; }
.cal-cell:not(.cal-empty):hover { transform: translateY(-2px) scale(1.04); background: rgba(242, 255, 251, 0.1); }
.cal-cell.cal-today { animation: pop-in 0.3s ease both, today-pulse 2.4s ease-in-out infinite 0.6s; }
.calendar-grid.cal-slide-next { animation: slide-from-right 0.35s ease both; }
.calendar-grid.cal-slide-prev { animation: slide-from-left 0.35s ease both; }
.cal-event-row { animation: rise-in 0.35s ease both; }
.cal-dot { transition: transform 0.15s ease; }
.cal-cell:hover .cal-dot { transform: scale(1.35); }

.settings-group, .rec-card, .fert-product, .stat-row { transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; }
.settings-group:hover, .rec-card:hover, .fert-product:hover { transform: translateY(-2px); border-color: rgba(45, 224, 199, 0.4); box-shadow: 0 10px 24px rgba(2, 12, 18, 0.35); }
button:active { transform: scale(0.97); }
.settings-subtab-btn.active { animation: pop-in 0.25s ease both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* Rozwijane kroki naprawcze pod alertem */
.alert-remedies { width: 100%; margin-top: 6px; }
.alert-remedies summary {
  cursor: pointer;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--accent);
  list-style: none;
}
.alert-remedies summary::-webkit-details-marker { display: none; }
.alert-remedies summary::before { content: "▸ "; }
.alert-remedies[open] summary::before { content: "▾ "; }
.alert-remedies ol {
  margin: 8px 0 2px 0;
  padding-left: 20px;
  font-size: var(--fs-sm);
  color: var(--text);
  line-height: 1.55;
}
.alert-remedies li { margin-bottom: 4px; animation: rise-in 0.3s ease both; }

/* Kafelek mieszkańca: zdjęcie poglądowe + wymagania vs. bieżąca woda */
.livestock-card {
  display: flex;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg-soft, rgba(255, 255, 255, 0.02));
  margin-bottom: 10px;
  animation: rise-in 0.45s ease both;
  animation-delay: calc(var(--i, 0) * 50ms);
}
.livestock-photo {
  flex: 0 0 96px;
  width: 96px;
  height: 96px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: var(--fs-2xl);
  background: linear-gradient(140deg, rgba(90, 190, 220, 0.16), rgba(90, 190, 220, 0.04));
  border: 1px solid var(--border);
}
.livestock-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.livestock-photo.has-photo { background: none; }
.livestock-body { flex: 1; min-width: 0; }
.livestock-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.livestock-name { font-weight: 600; }
.livestock-req {
  margin-top: 6px;
  font-size: var(--fs-sm);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.livestock-approx {
  margin-top: 6px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-style: italic;
}
.livestock-issues {
  margin: 8px 0 0 0;
  padding-left: 18px;
  font-size: var(--fs-sm);
  color: var(--warning, #e8a33d);
  line-height: 1.5;
}
.livestock-issues li { margin-bottom: 6px; }
.livestock-advice { color: var(--text); font-weight: 400; margin-top: 2px; }
.livestock-ok { margin-top: 8px; font-size: var(--fs-sm); color: var(--accent); }

@media (max-width: 480px) {
  .livestock-card { flex-direction: column; }
  .livestock-photo { width: 100%; flex-basis: auto; height: 150px; }
}
/* ---------------------------------------------------------------------------
   Wykresy w stylu terminala notowań: duży bieżący odczyt, zmiana w oknie 24h,
   znacznik "na żywo". Bez poświat i animowanych cieni - te kosztują
   przerysowania i to od nich strona się zacinała. */
.tchart {
  background: rgba(4, 32, 43, 0.55);
  border: 1px solid rgba(45, 224, 199, 0.14);
  border-radius: var(--radius);
  padding: 14px 14px 6px;
  margin-bottom: 18px;
}

.tchart-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.tchart-value {
  font-family: var(--font-mono);
  font-size: clamp(1.7rem, 5vw, 2.3rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.tchart-value small {
  font-size: 0.42em;
  font-weight: 500;
  margin-left: 6px;
  color: var(--muted);
  letter-spacing: 0;
}

.tchart-pair {
  margin-top: 3px;
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.tchart-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.tchart-delta {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.tchart-delta.up { color: var(--sand-gold); }
.tchart-delta.down { color: var(--info-blue); }

.tchart-chip {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: rgba(255, 180, 84, 0.12);
  border: 1px solid rgba(255, 180, 84, 0.3);
  color: var(--sand-gold);
  font-variant-numeric: tabular-nums;
}

.tchart-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-2xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.tchart-live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(45, 224, 199, 0.6);
  animation: live-blip 2s ease-out infinite;
}

@keyframes live-blip {
  0% { box-shadow: 0 0 0 0 rgba(45, 224, 199, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(45, 224, 199, 0); }
  100% { box-shadow: 0 0 0 0 rgba(45, 224, 199, 0); }
}


.tchart .inline-chart-wrap { margin-bottom: 4px; }

@media (prefers-reduced-motion: reduce) {
  .tchart-live i { animation: none; }
}

/* Wymagania gatunku: zalecany zakres i obok bieżący odczyt */
.care-chip { white-space: nowrap; }
.care-now { font-weight: 700; font-variant-numeric: tabular-nums; }
.care-now.care-ok { color: var(--accent); }
.care-now.care-low { color: var(--info-blue); }
.care-now.care-high { color: var(--warn); }
.care-now.care-unknown { color: var(--muted); }
.livestock-req { display: flex; flex-wrap: wrap; gap: 0 2px; }

/* ---------------------------------------------------------------------------
   Obsada zbiornika rysowana z listy mieszkańców. Każda sztuka dostaje własne
   tempo i tor przez zmienne CSS, więc wystarczy jedna klatkówka na wszystkie,
   zamiast osobnej reguły na rybkę. */
.tank-fish-live {
  animation: fish-cruise var(--swim-duration, 16s) ease-in-out infinite;
  animation-delay: var(--swim-delay, 0s);
}

.tank-fish-body-live { fill: var(--fish-color, var(--coral)); }
.tank-fish-tail-live { fill: var(--fish-color, var(--coral)); opacity: 0.85; }

@keyframes fish-cruise {
  0%   { transform: translate(var(--x1), var(--y1)) scaleX(1); }
  45%  { transform: translate(var(--x2), var(--y2)) scaleX(1); }
  50%  { transform: translate(var(--x2), var(--y2)) scaleX(-1); }
  95%  { transform: translate(var(--x1), var(--y2)) scaleX(-1); }
  100% { transform: translate(var(--x1), var(--y1)) scaleX(1); }
}

#tank-live-plants .tank-plant {
  animation-duration: var(--sway-duration, 4.6s);
  animation-delay: var(--sway-delay, 0s);
}

#tank-live-plants .tank-plant path { fill: var(--plant-color, var(--algae-glow)); }

/* ---------------------------------------------------------------------------
   Wejścia przy przewijaniu. Animowane są WYŁĄCZNIE transform i opacity, bo
   tylko te dwie właściwości przeglądarka potrafi policzyć na kompozytorze,
   bez przerysowywania układu strony. Żadnych cieni ani filtrów - to od nich
   wcześniej wykresy się zacinały. */
.reveal {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition: opacity 0.5s cubic-bezier(0.22, 0.61, 0.36, 1),
              transform 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform, opacity;
}

.reveal.revealed {
  opacity: 1;
  transform: none;
  will-change: auto;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .tank-fish-live { animation: none; }
}

/* Edycja wpisu o mieszkańcu: sterownik liczby sztuk i rozwijany formularz */
.livestock-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.livestock-edit-btn {
  background: none;
  border: 1px solid var(--panel-border);
  color: var(--muted);
  border-radius: var(--radius-sm);
  padding: 2px 10px;
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.livestock-edit-btn:hover { color: var(--accent); border-color: var(--accent); }

.livestock-count-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.livestock-count-label { font-size: var(--fs-xs); color: var(--muted); }

.count-step {
  width: 26px;
  height: 26px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: rgba(45, 224, 199, 0.08);
  color: var(--accent);
  font-size: var(--fs-md);
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}
.count-step:hover:not(:disabled) { background: rgba(45, 224, 199, 0.18); }
.count-step:active:not(:disabled) { transform: scale(0.92); }
.count-step:disabled { opacity: 0.45; cursor: default; }

.livestock-count-input {
  width: 62px;
  padding: 3px 6px;
  text-align: center;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: rgba(4, 32, 43, 0.5);
  color: var(--text);
}

.livestock-count-status {
  font-size: var(--fs-xs);
  color: var(--muted);
  min-width: 62px;
}

.livestock-edit { margin-top: 10px; }

.livestock-edit-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.livestock-edit-field {
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: rgba(4, 32, 43, 0.5);
  color: var(--text);
  font-size: var(--fs-sm);
  min-width: 0;
  flex: 1 1 140px;
}

.livestock-save-btn, .livestock-cancel-btn {
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  cursor: pointer;
  border: 1px solid var(--panel-border);
}
.livestock-save-btn { background: var(--accent); border-color: var(--accent); color: #04202b; font-weight: 600; }
.livestock-save-btn:disabled { opacity: 0.6; cursor: default; }
.livestock-cancel-btn { background: none; color: var(--muted); }
.livestock-cancel-btn:hover { color: var(--text); }

@media (max-width: 480px) {
  .livestock-edit-field { flex-basis: 100%; }
}
.livestock-note {
  margin-top: 6px;
  font-size: var(--fs-xs);
  color: var(--muted);
  border-left: 2px solid var(--panel-border);
  padding-left: 8px;
}

/* Dzienniki karmienia i leczenia */
.log-list { margin-top: 10px; }

.log-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--panel-border);
}
.log-row:last-child { border-bottom: none; }
.log-row-main { flex: 1; min-width: 0; }
.log-row-title { font-weight: 600; }

.log-badge {
  margin-left: 8px;
  font-size: var(--fs-2xs);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.log-badge-active {
  background: rgba(255, 180, 84, 0.16);
  border: 1px solid rgba(255, 180, 84, 0.4);
  color: var(--sand-gold);
}

/* Obsada kontra pojemność */
.stocking-summary {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  border-left: 3px solid var(--panel-border);
  background: rgba(4, 32, 43, 0.4);
  color: var(--muted);
}
.stocking-summary.stocking-ok { border-left-color: var(--accent); color: var(--text); }
.stocking-summary.stocking-tight { border-left-color: var(--sand-gold); color: var(--text); }
.stocking-summary.stocking-over { border-left-color: var(--danger); color: var(--text); }

/* Kropki w kalendarzu dla nowych typów zdarzeń */
.cal-feeding { background: #9ad5a0; }
.cal-treatment { background: #ff8fb0; }

.wt-chart-block { margin-bottom: 16px; }

/* Historia zmian */
.release {
  padding: 14px 0;
  border-bottom: 1px solid var(--panel-border);
}
.release:last-child { border-bottom: none; }

.release-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.release-version {
  font-family: var(--font-mono);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--accent);
}

.release-current {
  margin-left: 8px;
  font-family: var(--font-body);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(45, 224, 199, 0.16);
  border: 1px solid rgba(45, 224, 199, 0.4);
  color: var(--accent);
  vertical-align: 2px;
}

.release-date {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--muted);
}

.release-title {
  margin-top: 2px;
  font-weight: 600;
  color: var(--text);
}

.release-entries {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.release-entries li {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 8px;
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--text);
}

.release-tag {
  flex-shrink: 0;
  min-width: 68px;
  text-align: center;
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}
.release-tag-new { background: rgba(45, 224, 199, 0.16); color: var(--accent); }
.release-tag-change { background: rgba(74, 168, 255, 0.16); color: var(--info-blue); }
.release-tag-fix { background: rgba(255, 180, 84, 0.16); color: var(--sand-gold); }

@media (max-width: 480px) {
  .release-entries li { flex-direction: column; gap: 4px; }
  .release-tag { min-width: 0; align-self: flex-start; }
}

/* ---------------------------------------------------------------------------
   Warstwa otoczenia: smugi światła przez wodę i unoszące się bąbelki.
   Cała strona ma sprawiać wrażenie zanurzonej, a nie ułożonej z kafelków.

   Zasada, od której nie ma tu odstępstwa: animowane są WYŁĄCZNIE transform i
   opacity. Żadnych cieni, filtrów ani animowanych gradientów - to one każą
   przeglądarce przemalowywać obszar w każdej klatce i od nich wcześniej
   zacinały się wykresy. Wszystko poniżej leci na kompozytorze. */

.aqua-ambient {
  position: fixed;
  inset: -10vh -10vw;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  contain: strict;
}

/* treść musi zostać nad warstwą tła */
header, nav.tabs, main, footer { position: relative; z-index: 1; }

/* Smugi światła: jeden powtarzalny gradient przesuwany w bok. Ruch w poprzek
   daje wrażenie światła przechodzącego przez poruszającą się taflę. */
.aqua-rays {
  position: absolute;
  inset: -20% -40%;
  /* Miękkie przejścia zamiast twardych stopów: z ostrymi krawędziami to czyta
     się jak paski na ekranie, a nie jak światło wpadające przez taflę. Dwie
     warstwy o różnej szerokości rozbijają regularność wzoru. */
  background:
    repeating-linear-gradient(
      102deg,
      transparent 0,
      transparent 64px,
      rgba(242, 255, 251, 0.012) 92px,
      rgba(242, 255, 251, 0.05) 118px,
      rgba(242, 255, 251, 0.012) 146px,
      transparent 176px,
      transparent 232px
    ),
    repeating-linear-gradient(
      97deg,
      transparent 0,
      transparent 130px,
      rgba(150, 230, 255, 0.008) 168px,
      rgba(150, 230, 255, 0.03) 196px,
      rgba(150, 230, 255, 0.008) 224px,
      transparent 268px,
      transparent 464px
    );
  transform: translate3d(0, 0, 0);
  animation: rays-drift 55s linear infinite;
  will-change: transform;
}

/* Przesunięcie równe najmniejszej wspólnej wielokrotności okresów obu wzorów
   (232 i 464 px, czyli 464), żeby pętla zamykała się bez widocznego skoku.
   Dobranie drugiego okresu na wielokrotność pierwszego nie jest przypadkiem:
   przy 372 px NWW wynosiłoby 21576 px i animacja musiałaby przesuwać obraz o
   pół ekranu na sekundę albo trwać kwadrans. */
@keyframes rays-drift {
  from { transform: translate3d(-464px, 0, 0); }
  to   { transform: translate3d(0, 0, 0); }
}

/* Kaustyka: kilka miękkich plam światła, które bardzo powoli dryfują i lekko
   się skalują. Skala jest transformem, więc nic się nie przemalowuje. */
.aqua-caustics {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(38% 26% at 22% 18%, rgba(45, 224, 199, 0.10), transparent 70%),
    radial-gradient(30% 22% at 72% 34%, rgba(122, 214, 255, 0.08), transparent 72%),
    radial-gradient(34% 24% at 46% 76%, rgba(45, 224, 199, 0.07), transparent 70%),
    radial-gradient(26% 20% at 86% 82%, rgba(255, 180, 84, 0.05), transparent 74%);
  animation: caustics-breathe 38s ease-in-out infinite;
  will-change: transform;
}

@keyframes caustics-breathe {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33%      { transform: translate3d(2.5%, -1.8%, 0) scale(1.06); }
  66%      { transform: translate3d(-2%, 1.5%, 0) scale(1.03); }
}

/* Bąbelki. Dziewięć sztuk wystarczy na wrażenie ruchu; każda kolejna to
   kolejna animacja do policzenia, a policzyć ich wzrokiem i tak się nie da. */
.aqua-bubbles { position: absolute; inset: 0; }

.aqua-bubbles span {
  position: absolute;
  left: var(--x);
  bottom: -40px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, rgba(255, 255, 255, 0.55), rgba(190, 240, 255, 0.14) 60%, transparent 72%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  opacity: 0;
  animation: bubble-float var(--dur, 28s) linear infinite;
  animation-delay: var(--delay, 0s);
  will-change: transform, opacity;
}

/* Bąbelek pojawia się i gaśnie w skrajach, żeby nie "wyskakiwał" zza krawędzi.
   Lekki dryf w bok sprawia, że tor nie jest linijką. */
@keyframes bubble-float {
  0%   { transform: translate3d(0, 0, 0); opacity: 0; }
  8%   { opacity: 0.75; }
  85%  { opacity: 0.55; }
  100% { transform: translate3d(var(--drift, 20px), -118vh, 0); opacity: 0; }
}

/* Wartość, która właśnie się zmieniła, dostaje krótki rozbłysk. Bez tego nowy
   odczyt wchodzi bezszelestnie i nie widać, że strona w ogóle żyje. */
.value-tick { animation: value-tick 0.85s ease-out; }

@keyframes value-tick {
  0%   { transform: translate3d(0, -2px, 0); opacity: 0.55; }
  40%  { transform: translate3d(0, 0, 0); opacity: 1; }
  100% { transform: none; opacity: 1; }
}

/* Karta ukryta lub przewinięta poza ekran nie musi nic animować. Reguła jest
   celowo rozpisana na elementy ORAZ pseudoelementy: animation-play-state nie
   jest dziedziczone, więc ustawienie go na kontenerze nigdy nie dotarłoby do
   zagnieżdżonych rybek czy bąbelków. */
body.anim-paused *,
body.anim-paused *::before,
body.anim-paused *::after {
  animation-play-state: paused !important;
}

@media (prefers-reduced-motion: reduce) {
  .aqua-rays, .aqua-caustics, .aqua-bubbles span, .value-tick { animation: none; }
  .aqua-bubbles span { opacity: 0.4; }
}

/* ---------------------------------------------------------------------------
   Przełącznik zbiorników w zakładce Akwarium */
.tank-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
  margin: 0 0 12px;
}

.tank-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: rgba(4, 32, 43, 0.45);
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.tank-pill.active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(45, 224, 199, 0.12);
}
.tank-pill-name { font-weight: 600; font-size: var(--fs-sm); }
.tank-pill-meta { font-size: var(--fs-2xs); opacity: 0.75; }

.tank-edit-btn, .tank-add-btn {
  align-self: center;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  cursor: pointer;
  background: none;
  border: 1px dashed var(--panel-border);
  color: var(--muted);
}
.tank-add-btn { color: var(--accent); border-color: rgba(45, 224, 199, 0.45); }

.tank-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  padding: 12px;
  margin: 0 0 12px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  background: rgba(4, 32, 43, 0.4);
}
.tank-form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--fs-xs);
  color: var(--muted);
  flex: 1 1 150px;
}
.tank-form-field input, .tank-form-field select {
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: rgba(4, 32, 43, 0.5);
  color: var(--text);
}
.tank-form-buttons { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; }

/* Panele liczone z czujników (parowanie, koszty wody) nie mają sensu dla
   zbiornika, który czujników nie ma */
.tank-secondary .primary-only { display: none !important; }

/* Ocena amoniaku pod formularzem testu wody */
.ammonia-ok { color: var(--accent); }
.ammonia-watch { color: var(--warn); }
.ammonia-alarm { color: var(--danger); font-weight: 600; }

/* Odnośnik wyglądający jak przycisk (pobranie kopii zapasowej) */
.button-link {
  display: inline-block;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--fs-sm);
}
.button-link:hover { background: rgba(45, 224, 199, 0.12); }
.settings-subhead { margin: 18px 0 4px; font-size: var(--fs-md); }

/* Dziennik obsady: pasek powodu po zmianie liczby, okno usuwania, historia.
   Tylko opacity/transform w animacji i żadnych cieni ani filtrów. */
.reason-prompt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: var(--fs-xs);
  color: var(--muted);
  animation: reason-in 0.18s ease-out;
}
@keyframes reason-in {
  from { opacity: 0; transform: translateY(-3px); }
}

.reason-chip {
  background: rgba(45, 224, 199, 0.08);
  border: 1px solid var(--panel-border);
  color: var(--accent);
  border-radius: var(--radius-pill);
  padding: 3px 11px;
  font-size: var(--fs-xs);
  font-weight: 500;
  box-shadow: none;
}
.reason-chip:hover { background: rgba(45, 224, 199, 0.18); }
.reason-chip-skip { color: var(--muted); background: none; }

.reason-dialog {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  padding: 0;
  width: min(92vw, 420px);
}
.reason-dialog::backdrop { background: rgba(2, 12, 18, 0.72); }
.reason-dialog-inner { padding: 18px 20px; }
.reason-dialog h3 { margin: 0 0 6px; font-family: var(--font-display); font-size: var(--fs-md); }
.reason-dialog-options { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.reason-dialog-options .reason-chip { padding: 6px 14px; font-size: var(--fs-sm); }
.reason-dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

.livestock-log { margin: 14px 0; }
.livestock-log-list { margin-top: 10px; }
.livestock-log-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--panel-border);
  font-size: var(--fs-sm);
}
.livestock-log-when {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  min-width: 104px;
}
.livestock-log-what { flex: 1 1 200px; }
.livestock-log-reason {
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: rgba(4, 32, 43, 0.5);
  color: var(--text);
  font-size: var(--fs-xs);
}
.livestock-log-reason.unset { border-style: dashed; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .reason-prompt { animation: none; }
}

/* Tryb urlopowy, wyciszanie powtórek, podgląd podsumowania */
.vacation-banner {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--sand-gold);
  background: rgba(4, 32, 43, 0.5);
  font-size: var(--fs-sm);
}
.maintenance-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; padding: 10px 14px;
  border-radius: var(--radius-sm); border-left: 3px solid var(--info-blue); background: var(--glass-deep); font-size: var(--fs-sm); }
.maintenance-banner.hidden { display: none; }
.maint-ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); color: var(--info-blue);
  background: color-mix(in srgb, var(--info-blue) 16%, transparent); flex-shrink: 0; }
.maint-ico svg { width: 18px; height: 18px; }
.maint-text { flex: 1 1 220px; min-width: 0; }
.maintenance-banner button { min-height: 40px; padding: 6px 14px; }
.maint-chip svg { width: 16px; height: 16px; }
@media (max-width: 560px) {
  .maint-chip { width: 44px; padding: 0; justify-content: center; }
  .maint-chip-text { display: none; }
}
.exp-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 12px; margin-bottom: 10px; }
.exp-form input, .exp-form select { width: 100%; box-sizing: border-box; }
.exp-form .exp-change { grid-column: 1 / -1; }
.exp-list { display: grid; gap: 12px; margin-top: 14px; }
.exp-card { display: grid; gap: 8px; padding: 14px; border-radius: var(--radius); background: var(--glass-deep); border: 1px solid var(--glass-border); min-width: 0; }
.exp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.exp-pill { flex-shrink: 0; font-size: var(--fs-xs); padding: 2px 10px; border-radius: var(--radius-pill); border: 1px solid var(--glass-border); color: var(--muted); }
.exp-running .exp-pill { color: var(--accent); border-color: var(--accent); }
.exp-when { color: var(--muted); font-size: var(--fs-xs); }
.exp-summary { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: var(--fs-sm); }
.exp-summary .is-better, .exp-table .is-better { color: var(--ok); }
.exp-summary .is-worse, .exp-table .is-worse { color: var(--warn); }
.exp-note { margin: 0; }
.exp-card summary { cursor: pointer; color: var(--accent); font-size: var(--fs-sm); min-height: 32px; }
.exp-table-wrap { overflow-x: auto; }
.exp-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.exp-table th, .exp-table td { padding: 6px 8px; border-bottom: 1px solid color-mix(in srgb, var(--muted) 14%, transparent); text-align: right; white-space: nowrap; }
.exp-table th[scope="row"], .exp-table thead th:first-child { text-align: left; white-space: normal; font-weight: 500; }
.exp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.share-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px 12px; margin-bottom: 10px; }
.share-form .share-note { grid-column: 1 / -1; }
.share-form input, .share-form select, .share-form textarea { width: 100%; box-sizing: border-box; }
.share-created { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.share-created.hidden { display: none; }
.share-created input { flex: 1 1 240px; min-width: 0; font-family: var(--font-mono); font-size: var(--fs-xs); }
.share-created small { flex-basis: 100%; margin: 0; }
.share-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.share-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px;
  border-radius: var(--radius-sm); background: var(--glass-deep); border: 1px solid var(--glass-border); font-size: var(--fs-sm); }
.share-list button { min-height: 40px; flex-shrink: 0; }
.alert-muted-note { font-size: var(--fs-xs); color: var(--muted); }
.text-alarm { color: var(--danger); font-weight: 600; }
.digest-preview {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: rgba(4, 32, 43, 0.5);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Dziennik, oś czasu i kreator diagnozy */
.journal-form { margin: 12px 0 18px; }
.journal-text {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: rgba(4, 32, 43, 0.5);
  color: var(--text);
  font: inherit;
  resize: vertical;
}
.journal-label { margin: 12px 0 6px; font-size: var(--fs-xs); color: var(--muted); }
.journal-section-title { margin: 22px 0 8px; font-family: var(--font-display); font-size: var(--fs-md); }
.tag-picker, .timeline-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.timeline-filters { margin-bottom: 10px; }
.tag-chip {
  background: rgba(45, 224, 199, 0.06);
  border: 1px solid var(--panel-border);
  color: var(--muted);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-size: var(--fs-xs);
  font-weight: 500;
  box-shadow: none;
}
.tag-chip:hover { color: var(--accent); }
.tag-chip.active { background: rgba(45, 224, 199, 0.2); border-color: var(--accent); color: var(--text); }
.journal-photo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0 8px; }
.journal-photo-preview { display: block; max-width: 220px; max-height: 160px; border-radius: var(--radius-sm); margin: 6px 0 12px; }

.timeline-list { margin-top: 6px; }
.timeline-day {
  margin: 16px 0 6px;
  font-size: var(--fs-xs);
  color: var(--muted);
}
/* Tylko pierwsza litera: capitalize wielką literą pisałby też "Września". */
.timeline-day::first-letter { text-transform: uppercase; }
.timeline-item {
  --dot: var(--muted);
  display: flex;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--panel-border);
}
.timeline-dot { flex: 0 0 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: var(--dot); }
.timeline-body { flex: 1; min-width: 0; font-size: var(--fs-sm); }
.timeline-when { color: var(--muted); font-family: var(--font-mono); font-size: var(--fs-xs); margin-right: 8px; }
.timeline-title { font-weight: 600; }
.timeline-detail { margin-top: 3px; color: var(--text); opacity: 0.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.timeline-photo { display: block; max-width: 220px; max-height: 160px; border-radius: var(--radius-sm); margin-top: 6px; cursor: zoom-in; }
.timeline-delete {
  margin-top: 6px;
  background: none;
  box-shadow: none;
  color: var(--muted);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 2px 10px;
  font-size: var(--fs-xs);
  font-weight: 500;
}
.timeline-delete:hover { color: var(--danger); border-color: var(--danger); }
.timeline-type-journal { --dot: var(--accent); }
.timeline-type-water_change { --dot: var(--info-blue); }
.timeline-type-water_test { --dot: var(--sand-gold); }
.timeline-type-feeding { --dot: var(--muted); }
.timeline-type-treatment { --dot: var(--coral); }
.timeline-type-livestock { --dot: #b48ce8; }
.timeline-type-dose { --dot: #7ed957; }
.timeline-type-maintenance { --dot: var(--lagoon-bright); }
.timeline-type-alert { --dot: var(--danger); }
.tag-chip[class*="timeline-type-"].active { border-color: var(--dot); }

.photo-dialog {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 94vw;
  max-height: 94vh;
}
.photo-dialog::backdrop { background: rgba(2, 12, 18, 0.85); }
.photo-dialog img { display: block; max-width: 94vw; max-height: 90vh; border-radius: var(--radius-sm); cursor: zoom-out; }

.diag-urgent {
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--danger);
  background: rgba(255, 84, 112, 0.1);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.diag-urgent-chip { border-color: rgba(255, 84, 112, 0.5); }
.diag-cause {
  margin: 10px 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  border-left-width: 3px;
  background: rgba(4, 32, 43, 0.35);
}
.diag-cause.diag-high { border-left-color: var(--danger); }
.diag-cause.diag-medium { border-left-color: var(--sand-gold); }
.diag-cause.diag-low { border-left-color: var(--muted); }
.diag-cause-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; }
.diag-cause-title { font-weight: 600; }
.diag-pill { font-size: var(--fs-xs); color: var(--muted); }
.diag-why { margin: 6px 0; font-size: var(--fs-sm); opacity: 0.9; }
.diag-evidence, .diag-missing, .diag-facts { margin: 6px 0; padding-left: 18px; font-size: var(--fs-sm); }
.diag-evidence .for { color: var(--accent); }
.diag-evidence .against { color: var(--muted); }

/* Cechy mieszkańca i zgodność obsady */
.livestock-traits { margin-top: 6px; font-size: var(--fs-xs); color: var(--muted); }
.trait-chip {
  display: inline-block;
  margin: 4px 6px 0 0;
  padding: 1px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--panel-border);
  font-size: var(--fs-2xs);
  color: var(--muted);
}
.compat-common { margin: 4px 0 8px; font-size: var(--fs-sm); color: var(--muted); }
.compat-common.compat-bad { color: var(--danger); font-weight: 600; }
.compat-list { margin: 0; padding: 0; list-style: none; }
.compat-issue {
  margin: 6px 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--muted);
  background: rgba(4, 32, 43, 0.35);
  font-size: var(--fs-sm);
  line-height: 1.45;
}
.compat-warning { border-left-color: var(--danger); }
.compat-info { border-left-color: var(--sand-gold); }
.compat-issue.compat-ok, .compat-ok { border-left-color: var(--accent); color: var(--accent); }
p.compat-ok { margin: 8px 0; font-size: var(--fs-sm); }

/* Profil zbiornika, cykl azotowy, kalkulatory. Tylko kolory i obramowania: bez cieni i filtrów. */
.field-row input[type="date"],
.field-row select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: var(--fs-sm);
  max-width: 100%;
}
.field-row input[type="date"]:focus,
.field-row select:focus { outline: none; border-color: var(--accent); }
.field-row input[type="date"], .field-row select { font-family: inherit; }
.field-row input.wide { width: 220px; max-width: 100%; }
/* W profilu i kalkulatorach etykieta się zawija, a pole zostaje po prawej. Bez tego długa
   etykieta zrzucałaby pole pod siebie i kolumna pól wyglądałaby nierówno. */
.calc-card .field-row, #profile-form .field-row, .planted-fields .field-row { flex-wrap: nowrap; }
.calc-card .field-row label, #profile-form .field-row label, .planted-fields .field-row label { flex: 1 1 auto; min-width: 0; }
.calc-card .field-row input, .calc-card .field-row select,
#profile-form .field-row input, #profile-form .field-row select,
.planted-fields .field-row input { flex: 0 0 auto; }
#profile-form .field-row input.wide { flex: 0 1 220px; min-width: 0; }
.table-scroll .wc-history-table.cycle-tests { min-width: 0; }
.profile-age { margin: 0 0 12px; font-size: var(--fs-sm); color: var(--muted); }

.cycle-steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.cycle-step {
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--panel-border);
  font-size: var(--fs-xs);
  color: var(--muted);
}
.cycle-step.done { border-color: var(--accent); color: var(--accent); background: rgba(45, 224, 199, 0.12); }
.cycle-advice { margin: 6px 0 12px; padding-left: 18px; font-size: var(--fs-sm); line-height: 1.5; }
.cycle-advice li { margin: 4px 0; }
.cycle-warning {
  margin: 8px 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--warn);
  background: rgba(255, 180, 84, 0.1);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.cycle-done {
  margin: 8px 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
  background: rgba(45, 224, 199, 0.1);
  font-size: var(--fs-sm);
}
.cycle-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }

.calc-card .field-row input[type="number"] { width: 96px; }
.calc-card .field-row { margin-bottom: 8px; }
.calc-card .calc-run { margin-top: 4px; }
.calc-result { margin: 10px 0 0; font-size: var(--fs-sm); line-height: 1.5; color: var(--accent); }
.calc-result.calc-error { color: var(--danger); }
.calc-result:empty { margin: 0; }
.calc-result.calc-blocked { color: var(--danger); font-weight: 600; }
.calc-details:empty { display: none; }
.calc-list-title { margin: 12px 0 4px; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.calc-list { margin: 0; padding-left: 20px; font-size: var(--fs-sm); line-height: 1.5; }
.calc-list li { margin: 3px 0; }
.calc-list-block li { color: var(--danger); }
.calc-list-warn li::marker { color: var(--warn); }
.med-calc-wrap { margin: 10px 0 14px; border: 1px solid var(--panel-border); border-radius: var(--radius-sm, var(--radius-sm)); padding: 10px 14px; }
.med-calc-wrap > summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.med-calc-wrap[open] > summary { margin-bottom: 8px; }
.med-calc { border: 0; padding: 0; margin: 0; background: none; }
.med-calc .field-row.med-kind-row { flex-wrap: wrap; }
.med-calc .field-row.med-kind-row label { flex: 0 0 100%; }
.med-calc .field-row.med-kind-row select { flex: 1 1 100%; width: 100%; min-width: 0; }
.med-dose-inline span { white-space: nowrap; }
.med-dose-inline { display: inline-flex; align-items: center; gap: 6px; }
.field-row .med-dose-inline input[type="number"] { width: 58px; }
#btn-med-to-treatment { margin-top: 10px; }

/* Gotowe zadania konserwacyjne, zapas nawozu, lista kontrolna przed wyjazdem. Bez cieni i filtrów. */
.preset-pack { margin: 10px 0 14px; }
.preset-pack-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 2px; }
.preset-pack-title { font-weight: 600; font-size: var(--fs-md); }
.preset-pack-head .field-hint { margin: 0; }
.preset-task {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 7px 0;
  border-bottom: 1px solid var(--panel-border);
  cursor: pointer;
}
.preset-task input[type="checkbox"] { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
.preset-task.present { opacity: 0.6; cursor: default; }
.preset-task-name { font-size: var(--fs-sm); }
.preset-task-why { margin-top: 2px; font-size: var(--fs-xs); color: var(--muted); line-height: 1.45; }

.fert-stock { margin: 8px 0 4px; font-size: var(--fs-sm); }
.fert-stock-slot .field-hint { margin: 6px 0 8px; }
.fert-stock.low { color: var(--warn); }
.fert-stock.empty { color: var(--danger); font-weight: 600; }
.fert-bottle-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.fert-bottle-row input[type="number"] {
  width: 90px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: var(--bg);
  color: var(--text);
}

.vacation-checklist { margin: 12px 0 16px; }
.vc-summary { margin: 0 0 8px; font-size: var(--fs-md); font-weight: 600; }
.vc-summary.ready { color: var(--accent); }
.vc-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 6px 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--muted);
  background: rgba(4, 32, 43, 0.35);
  font-size: var(--fs-sm);
  line-height: 1.45;
}
.vc-item.ok { border-left-color: var(--accent); }
.vc-item.todo { border-left-color: var(--warn); }
.vc-mark { flex: 0 0 1.1em; font-weight: 700; }
.vc-item.ok .vc-mark { color: var(--accent); }
.vc-item.todo .vc-mark { color: var(--warn); }
.vc-title { font-weight: 600; }
.vc-detail { color: var(--muted); }
.vc-manual { cursor: pointer; }
.vc-manual input[type="checkbox"] { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
.vc-manual.checked .vc-detail { text-decoration: line-through; opacity: 0.7; }

/* Testy zbiornika roślinnego: pola w rozwijanym bloku i ocena składników. Bez cieni i filtrów. */
.planted-fields { margin: 6px 0 12px; }
.planted-fields summary { cursor: pointer; font-size: var(--fs-sm); color: var(--accent); padding: 4px 0; }
.planted-fields[open] summary { margin-bottom: 8px; }
.planted-assessment { margin: 12px 0 16px; }
.planted-assessment h3 { margin: 0 0 6px; font-size: var(--fs-md); }
.pt-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 6px 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--muted);
  background: rgba(4, 32, 43, 0.35);
  font-size: var(--fs-sm);
  line-height: 1.45;
}
.pt-item.ok { border-left-color: var(--accent); }
.pt-item.low, .pt-item.high, .pt-item.drift { border-left-color: var(--warn); }
.pt-mark { flex: 0 0 1.1em; font-weight: 700; }
.pt-item.ok .pt-mark { color: var(--accent); }
.pt-item.low .pt-mark, .pt-item.high .pt-mark, .pt-item.drift .pt-mark { color: var(--warn); }
.pt-title { font-weight: 600; }
.pt-status { margin-left: 8px; font-weight: 400; font-size: var(--fs-xs); color: var(--muted); }
.pt-meta { font-size: var(--fs-xs); color: var(--muted); }
.pt-advice { margin-top: 3px; color: var(--text); opacity: 0.9; }

/* Model wzrostu roślin: tabela NO3:PO4 w kolorach stref ryzyka i plan. */
.plant-growth { margin: 12px 0 16px; }
.plant-growth > summary { cursor: pointer; font-weight: 600; color: var(--accent); padding: 4px 0; }
.plant-growth h3 { margin: 14px 0 6px; font-size: var(--fs-md); }
.np-table { border-collapse: collapse; font-size: var(--fs-xs); font-family: var(--font-mono); }
.np-table th { padding: 4px 6px; color: var(--muted); font-weight: 500; text-align: center; }
.np-table th.np-corner { font-size: var(--fs-2xs); white-space: nowrap; }
.np-table td { padding: 4px 6px; text-align: center; border: 1px solid var(--deep-water); color: #0b2530; min-width: 34px; }
/* Kolory stref: niebieski sinice, kremowy niskie ryzyko, zielony glony. */
.np-cyano { background: #a9cdef; color: #0b2530; }
.np-ok { background: #fbe6b3; color: #0b2530; }
.np-algae { background: #b9dea8; color: #0b2530; }
.np-table td.np-now { outline: 3px solid #d7263d; outline-offset: -3px; font-weight: 700; }
.np-table td.np-goal { outline: 3px dashed #0b2530; outline-offset: -3px; font-weight: 700; }
.np-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; font-size: var(--fs-xs); }
.np-key { padding: 2px 8px; border-radius: var(--radius-xs); }
.np-key.np-now { outline: 2px solid #d7263d; }
.np-key.np-goal { outline: 2px dashed var(--ink); }
.np-table td.np-now-line { box-shadow: inset 0 0 0 2px #d7263d; }
.hero-np-row { cursor: pointer; }
.hero-np-row:hover .hero-stat-label, .hero-np-row:focus-visible .hero-stat-label { color: var(--accent); }
.np-pill { display: inline-block; min-width: 2.2em; padding: 1px 10px; border-radius: var(--radius-pill); text-align: center;
  background: rgba(242, 255, 251, 0.08); }
.np-pill.np-cyano, .np-pill.np-ok, .np-pill.np-algae { color: #0b2530; }
.np-pill.np-cyano { background: #a9cdef; }
.np-pill.np-ok { background: #fbe6b3; }
.np-pill.np-algae { background: #b9dea8; }
.np-caption { font-size: var(--fs-sm); margin: 4px 0 0; }
.np-trend-wrap { position: relative; height: 240px; margin: 4px 0 6px; }
.pg-limiting { margin: 4px 0 8px; padding: 6px 12px; border-left: 3px solid var(--warn); border-radius: var(--radius-sm); background: rgba(4, 32, 43, 0.35); font-size: var(--fs-sm); }
.pg-steps { margin: 4px 0 8px; padding-left: 22px; font-size: var(--fs-sm); line-height: 1.45; }
.pg-steps li { margin: 6px 0; }

/* Dodatkowe czujniki: temperatura pokoju pod kafelkiem wody i stan czujnika wycieku. Bez cieni i filtrów. */
.leak-status { margin: 0 0 10px; padding: 6px 12px; border-radius: var(--radius-sm); border-left: 3px solid var(--accent); background: rgba(4, 32, 43, 0.35); font-size: var(--fs-sm); }
.leak-status.leak-wet { border-left-color: var(--danger); color: var(--danger); font-weight: 600; }
.leak-status.leak-unknown { border-left-color: var(--muted); color: var(--muted); }
#sub-room-temp { margin-top: 4px; }

/* =========================================================================
   Nowy pulpit: te same kolory (laguna, poświata glonów, piasek, koral) i żywa
   warstwa otoczenia w tle. Karty są półprzezroczyste i rozmyte ("szkło"),
   więc smugi światła i bąbelki z .aqua-ambient przebijają spod spodu.
   ========================================================================= */
:root {
  --glass: rgba(10, 58, 72, 0.52);
  --glass-deep: rgba(4, 30, 40, 0.62);
  --glass-border: rgba(45, 224, 199, 0.22);
  --zone-cyano: #a9cdef;
  --zone-ok: #fbe6b3;
  --zone-algae: #b9dea8;
}

.dash-card, .kpi-tile {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 42%), var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(14px) saturate(135%);
  backdrop-filter: blur(14px) saturate(135%);
}

/* ---- nagłówek pulpitu ---- */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 2px 0 6px; }
.dash-kicker { font-size: var(--fs-xs); color: var(--muted); }
.dash-name { margin: 2px 0 0; font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; letter-spacing: -0.01em; }
.dash-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dash-actions button { min-height: 44px; }
.dash-wc-summary { margin: 0 0 14px; }

/* ---- kafelki parametrów ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
@media (max-width: 1180px) { .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }

.kpi-tile { padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; }
.kpi-tile:hover { transform: translateY(-2px); border-color: rgba(45, 224, 199, 0.5); box-shadow: var(--shadow), 0 0 40px -14px var(--accent); }
.kpi-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kpi-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; min-width: 0; }
.kpi-icon { width: 28px; height: 28px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
  background: rgba(45, 224, 199, 0.14); color: var(--accent); flex-shrink: 0; }
.kpi-icon svg { width: 16px; height: 16px; }
/* Nazwa parametru zawsze w całości; status przechodzi do nowej linii, gdy się nie mieści. */
.kpi-label { flex: 1 1 calc(100% - 44px); min-width: 0; font-size: var(--fs-sm); color: var(--muted); }
.kpi-chip { align-self: flex-start; }
.kpi-chip { font-size: var(--fs-2xs); font-weight: 600; padding: 3px 8px; border-radius: var(--radius-pill); white-space: nowrap;
  background: rgba(242, 255, 251, 0.08); color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.kpi-chip[data-status="ok"] { background: rgba(45, 224, 199, 0.18); color: var(--algae-glow); }
.kpi-chip[data-status="low"], .kpi-chip[data-status="high"] { background: rgba(255, 180, 84, 0.18); color: var(--sand-gold); }
.kpi-chip[data-status="alarm"] { background: rgba(255, 84, 112, 0.22); color: #ff9aa8; }
#hero-np-row .kpi-chip[data-status="low"] { background: rgba(169, 205, 239, 0.18); color: var(--zone-cyano); }
#hero-np-row .kpi-chip[data-status="ok"] { background: rgba(251, 230, 179, 0.18); color: var(--zone-ok); }
#hero-np-row .kpi-chip[data-status="high"] { background: rgba(185, 222, 168, 0.18); color: var(--zone-algae); }

.kpi-tile[data-status="alarm"] { border-color: rgba(255, 84, 112, 0.55);
  background: linear-gradient(160deg, rgba(255, 84, 112, 0.16), rgba(255, 84, 112, 0) 55%), var(--glass); }
.kpi-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--fs-2xl); font-weight: 600;
  line-height: 1.1; letter-spacing: -0.02em; white-space: nowrap; }
.kpi-value small { font-size: var(--fs-sm); color: var(--muted); margin-left: 4px; font-weight: 500; }
.kpi-value.out-of-range { color: var(--sand-gold); }
.kpi-tile[data-status="alarm"] .kpi-value { color: #ff9aa8; }
.kpi-np-value.np-cyano, .kpi-np-value.np-ok, .kpi-np-value.np-algae { background: none; }
.kpi-np-value.np-cyano { color: var(--zone-cyano); }
.kpi-np-value.np-ok { color: var(--zone-ok); }
.kpi-np-value.np-algae { color: var(--zone-algae); }

.kpi-spark { width: 100%; height: 34px; color: var(--accent); overflow: visible; }
.kpi-spark polyline { fill: none; stroke: currentColor; stroke-width: 1.8; vector-effect: non-scaling-stroke;
  stroke-linecap: round; stroke-linejoin: round; opacity: 0.9; filter: drop-shadow(0 0 4px rgba(45, 224, 199, 0.45)); }
.kpi-tile[data-status="alarm"] .kpi-spark { color: #ff9aa8; }

.kpi-range { position: relative; height: 6px; border-radius: var(--radius-xs); background: rgba(242, 255, 251, 0.1); }
.kpi-band { position: absolute; top: 0; bottom: 0; border-radius: var(--radius-xs); background: rgba(45, 224, 199, 0.55); }
.kpi-band[hidden], .kpi-marker[hidden] { display: none; }
.kpi-band-zones { background: linear-gradient(90deg, var(--zone-cyano) 0 35%, var(--zone-ok) 35% 50%, var(--zone-algae) 50% 100%); opacity: 0.8; }
.kpi-tile[data-status="alarm"] .kpi-band { background: var(--alert-koi); }
.kpi-marker { position: absolute; top: -4px; width: 4px; height: 14px; margin-left: -2px; border-radius: var(--radius-xs);
  background: var(--foam); box-shadow: 0 0 0 2px var(--deep-water); }
.kpi-tile[data-status="low"] .kpi-marker, .kpi-tile[data-status="high"] .kpi-marker { background: var(--sand-gold); }
.kpi-caption { font-size: var(--fs-xs); color: var(--muted); line-height: 1.35; }
.kpi-tile .card-sub { margin: 0; font-size: var(--fs-xs); }

/* ---- wykres z przełącznikiem i "Do zrobienia" ---- */
.dash-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.dash-bottom { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
@media (max-width: 960px) { .dash-main, .dash-bottom { grid-template-columns: minmax(0, 1fr); } }
.dash-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.dash-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dash-card-title { margin: 0; font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 600; }
.dash-card-note { font-size: var(--fs-xs); color: var(--muted); }

.dash-chart-tabs { display: flex; gap: 4px; padding: 4px; border-radius: var(--radius-sm); background: var(--glass-deep);
  border: 1px solid var(--glass-border); overflow-x: auto; max-width: 100%; }
.dash-chart-tab { background: transparent; color: var(--muted); box-shadow: none; padding: 8px 12px; min-height: 36px;
  border-radius: var(--radius-sm); font-size: var(--fs-xs); white-space: nowrap; }
.dash-chart-tab:hover { transform: none; color: var(--text); opacity: 1; }
.dash-chart-tab[aria-pressed="true"] { background: rgba(45, 224, 199, 0.2); color: var(--text); }
.dash-chart-card .tchart { margin: 0; background: none; border: none; padding: 0; }
.dash-chart-card .tchart[hidden] { display: none; }
.dash-chart-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dash-chart-foot .field-hint, .dash-chart-foot .section-header-row { margin: 0; }

.todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.todo-item { display: flex; gap: 12px; align-items: flex-start; }
.todo-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: var(--muted); }
.todo-alarm .todo-dot { background: var(--alert-koi); box-shadow: 0 0 10px rgba(255, 84, 112, 0.7); }
.todo-plan .todo-dot { background: var(--sand-gold); }
.todo-info .todo-dot { background: var(--accent); }
.todo-title { font-weight: 600; font-size: var(--fs-sm); line-height: 1.35; }
.todo-detail { margin-top: 2px; font-size: var(--fs-xs); color: var(--muted); line-height: 1.4; }
.todo-empty { color: var(--muted); font-size: var(--fs-sm); }

/* ---- skala NO3:PO4 (logarytmiczna 2-200: granica 10 na 35%, 20 na 50%) ---- */
.np-scale { position: relative; height: 60px; margin: 0 20px; }
.np-scale-bar { position: absolute; left: 0; right: 0; top: 21px; height: 18px; border-radius: var(--radius-sm); overflow: hidden; display: flex; opacity: 0.85; }
.np-scale-cyano { width: 35%; background: var(--zone-cyano); }
.np-scale-ok { width: 15%; background: var(--zone-ok); }
.np-scale-algae { flex: 1; background: var(--zone-algae); }
.np-scale-goal { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px dashed var(--ink); }
.np-scale-goal span { position: absolute; top: -4px; left: 6px; font-size: var(--fs-2xs); color: var(--ink); }
.np-scale-now { position: absolute; top: 9px; width: 42px; height: 42px; margin-left: -21px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-sm);
  background: var(--deep-water); color: var(--text); border: 3px solid var(--foam); box-shadow: 0 0 20px rgba(45, 224, 199, 0.4); }
.np-scale-now.np-cyano, .np-scale-now.np-ok, .np-scale-now.np-algae { background: var(--deep-water); color: var(--text); }
.np-scale-now.np-cyano { border-color: var(--zone-cyano); }
.np-scale-now.np-ok { border-color: var(--zone-ok); }
.np-scale-now.np-algae { border-color: var(--zone-algae); }
.np-scale-labels { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-xs); color: var(--muted); }
.np-scale-text { margin: 0; font-size: var(--fs-sm); line-height: 1.5; }
.np-scale-card button { align-self: flex-start; }

/* ---- karta zbiornika: rysunek z rybami i najważniejsze liczby ---- */
.tank-card .tank-hero { background: none; border: none; box-shadow: none; padding: 0; border-radius: 0; cursor: default; display: block; flex: 1; min-width: 0; }
.tank-card .tank-hero:hover { transform: none; box-shadow: none; }
.tank-card .tank-svg { max-width: 100%; }
.tank-card-body { display: flex; gap: 18px; align-items: center; }
.tank-facts { display: flex; flex-direction: column; gap: 14px; min-width: 140px; }
.tank-fact .tank-side-value { font-family: var(--font-mono); font-weight: 600; font-size: var(--fs-md); }
.tank-water-bar { height: 6px; margin: 6px 0 4px; border-radius: var(--radius-xs); background: rgba(242, 255, 251, 0.1); overflow: hidden; }
.tank-water-bar span { display: block; height: 100%; width: 0; border-radius: var(--radius-xs);
  background: linear-gradient(90deg, var(--accent-strong), var(--algae-glow)); transition: width 0.6s ease; }
.tank-fact-water .card-sub { margin: 0; font-size: var(--fs-xs); }
@media (max-width: 560px) {
  .tank-card-body { flex-direction: column; align-items: stretch; }
  .tank-facts { flex-direction: row; flex-wrap: wrap; justify-content: space-between; gap: 10px 16px; min-width: 0; }
}

/* ---- nawigacja: boczna na komputerze, dolny pasek na telefonie ---- */
@media (min-width: 1100px) {
  body { max-width: none; padding: 24px 32px 32px 272px; }
  header, main { max-width: 1440px; }
  nav.tabs { position: fixed; left: 16px; top: 16px; bottom: 16px; width: 224px; box-sizing: border-box; z-index: 20;
    flex-direction: column; gap: 4px; margin: 0; padding: 96px 12px 16px; overflow-y: auto;
    border: 1px solid var(--glass-border); border-radius: var(--radius); background: rgba(6, 38, 52, 0.62);
    -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); box-shadow: var(--shadow); }
  nav.tabs .tab-btn { border-bottom: none; border-radius: var(--radius-sm); padding: 12px 14px; min-height: 44px; justify-content: flex-start; }
  nav.tabs .tab-btn .icon-inline { margin-right: 10px; }
  nav.tabs .tab-btn .icon-inline svg { width: 18px; height: 18px; }
  nav.tabs .tab-btn:hover { background: rgba(45, 224, 199, 0.08); }
  nav.tabs .tab-btn.active { background: rgba(45, 224, 199, 0.18); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
  .app-brand { position: fixed; left: 36px; top: 34px; z-index: 21; }
  .app-brand .app-logo img { width: 48px; height: 48px; }
  .app-brand .app-subtitle { display: none; }
  .app-title-row { justify-content: flex-end; min-height: 0; margin-bottom: 8px; }
}
@media (max-width: 720px) {
  body { padding-bottom: 92px; }
  nav.tabs { position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 30; margin: 0; padding: 4px;
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; overflow: hidden;
    border: 1px solid var(--glass-border); border-radius: var(--radius); background: rgba(6, 38, 52, 0.86);
    -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); box-shadow: 0 8px 30px rgba(2, 12, 18, 0.6); }
  nav.tabs .tab-btn { flex-direction: column; gap: 3px; padding: 8px 2px; min-height: 52px; justify-content: center;
    border-bottom: none; border-radius: var(--radius-sm); font-size: 0.62rem /* dolne menu: 6 etykiet w wąskich kolumnach */; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  nav.tabs .tab-btn .icon-inline { margin: 0; }
  nav.tabs .tab-btn .icon-inline svg { width: 19px; height: 19px; }
  nav.tabs .tab-btn.active { background: rgba(45, 224, 199, 0.2); color: var(--text); }
  .dash-name { font-size: var(--fs-xl); }
}
@media (max-width: 420px) {
  /* "Harmonogram" nie mieści się w kolumnie dolnego menu na wąskim telefonie */
  nav.tabs .tab-text[data-short] { font-size: 0; }
  nav.tabs .tab-text[data-short]::after { content: attr(data-short); font-size: 0.62rem /* dolne menu: 6 etykiet w wąskich kolumnach */; }
}
@media (max-width: 720px) {
  .dash-actions { width: 100%; }
  .dash-actions button { flex: 1; }
  .kpi-value { font-size: 1.6rem; }
  .np-scale { margin: 0 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .kpi-tile, .kpi-tile:hover { transition: none; transform: none; }
}

/* ---- oś czasu dnia ---- */
.day-card { margin-bottom: 16px; }
.day-track { --lane-offset: 92px; position: relative; display: flex; flex-direction: column; gap: 8px; padding: 22px 0 4px; }
.day-hours { position: absolute; left: var(--lane-offset); right: 0; top: 0; height: 16px; }
.day-hour { position: absolute; transform: translateX(-50%); font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--muted); }
.day-hour:first-child { transform: none; }
.day-hour:last-child { transform: translateX(-100%); }
.day-row { display: flex; align-items: center; gap: 12px; }
.day-row-label { width: 80px; flex-shrink: 0; font-size: var(--fs-xs); color: var(--muted); }
.day-lane { position: relative; flex: 1; height: 18px; border-radius: var(--radius-sm); background: rgba(242, 255, 251, 0.06);
  background-image: repeating-linear-gradient(90deg, transparent 0 calc(12.5% - 1px), rgba(242, 255, 251, 0.07) calc(12.5% - 1px) 12.5%); }
.day-lane-events { height: 22px; }
.day-lane-empty { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: var(--fs-2xs); color: var(--muted); white-space: nowrap; right: 10px; overflow: hidden; text-overflow: ellipsis; }
.day-seg { position: absolute; top: 0; bottom: 0; border-radius: var(--radius-sm); }
.day-seg-light { background: linear-gradient(90deg, rgba(255, 180, 84, 0.55), rgba(255, 214, 140, 0.85), rgba(255, 180, 84, 0.55));
  box-shadow: 0 0 14px rgba(255, 180, 84, 0.45); }
.day-seg-co2 { background: linear-gradient(90deg, rgba(74, 168, 255, 0.5), rgba(120, 190, 255, 0.8)); }
.day-event { position: absolute; top: 3px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%;
  border: 2px solid var(--deep-water); cursor: default; }
.day-event[style*="width"] { margin-left: 0; border-radius: var(--radius-sm); min-width: 8px; }
.day-event:focus-visible { outline: 2px solid var(--ink); }
.day-event-feeding, .day-key-feeding { background: var(--coral); }
.day-event-dose, .day-key-dose { background: var(--algae-glow); }
.day-event-water_change, .day-key-water_change { background: var(--info-blue); }
.day-now { position: absolute; top: 18px; bottom: 0; width: 2px; margin-left: -1px; background: var(--ink);
  box-shadow: 0 0 8px var(--ink); pointer-events: none; }
.day-now-label { position: absolute; top: -16px; left: 4px; font-size: var(--fs-2xs); font-weight: 600; color: var(--ink); }
.day-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: var(--fs-xs); color: var(--muted); padding-left: 92px; }
.day-key { display: inline-block; width: 12px; height: 8px; border-radius: var(--radius-xs); margin-right: 5px; vertical-align: middle; }
.day-key-light { background: var(--sand-gold); }
.day-key-co2 { background: var(--info-blue); opacity: 0.8; }
@media (max-width: 640px) {
  .day-track { --lane-offset: 64px; }
  .day-now-label { display: none; }
  .day-row-label { width: 52px; font-size: var(--fs-2xs); }
  .day-hour:nth-child(even) { display: none; }
  .day-legend { padding-left: 0; }
}

/* ---- wynik zbiornika i kalendarz zdrowia ---- */
.dash-insights { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; margin-bottom: 16px; }
.dash-bottom { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1180px) { .dash-bottom { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 960px) { .dash-insights, .dash-bottom { grid-template-columns: minmax(0, 1fr); } }

.score-body { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.score-ring { position: relative; width: 132px; height: 132px; flex-shrink: 0; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring-track { fill: none; stroke: rgba(242, 255, 251, 0.1); stroke-width: 10; }
.score-ring-value { fill: none; stroke: var(--muted); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 0.8s ease; }
.score-ring[data-level="good"] .score-ring-value { stroke: var(--algae-glow); filter: drop-shadow(0 0 6px rgba(45, 224, 199, 0.6)); }
.score-ring[data-level="mid"] .score-ring-value { stroke: var(--sand-gold); }
.score-ring[data-level="bad"] .score-ring-value { stroke: var(--alert-koi); }
.score-number { position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center; padding-top: 44px;
  font-family: var(--font-mono); font-weight: 700; font-size: 2.2rem; }
.score-number small { font-size: var(--fs-xs); color: var(--muted); font-weight: 500; }
#score-trend[data-dir="up"] { color: var(--algae-glow); }
#score-trend[data-dir="down"] { color: var(--sand-gold); }
.score-lists { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 10px; }
.score-list-title { margin: 0 0 4px; font-size: var(--fs-xs); font-family: var(--font-body); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.score-up { color: var(--algae-glow); }
.score-down { color: var(--sand-gold); }
.score-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: var(--fs-sm); }
.score-list li { display: flex; justify-content: space-between; gap: 10px; }
.score-item-note { color: var(--muted); text-align: right; }
.score-empty { color: var(--muted); }

.health-legend { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--muted); }
.health-legend i { display: inline-block; width: 10px; height: 10px; border-radius: var(--radius-xs); margin-left: 6px; }
.health-range { margin: -4px 0 8px; font-size: var(--fs-xs); color: var(--muted); }
/* pola 22 px co 26 px: wygodne do trafienia palcem (WCAG 2.5.8), na wąskim ekranie kalendarz przewija się w bok */
.health-grid { display: grid; grid-template-columns: 20px repeat(var(--health-weeks, 14), 22px); grid-template-rows: 16px repeat(7, 22px);
  gap: 4px; overflow-x: auto; padding: 2px 2px 6px; }
.health-wd { font-size: var(--fs-2xs); color: var(--muted); align-self: center; }
.health-month { font-size: var(--fs-2xs); color: var(--muted); text-transform: capitalize; white-space: nowrap; align-self: end; }
.health-day { width: 22px; height: 22px; padding: 0; border: none; border-radius: var(--radius-xs); box-shadow: none; cursor: pointer;
  font-size: var(--fs-2xs); font-family: var(--font-mono); line-height: 22px; text-align: center; color: rgba(0, 20, 30, 0.75); min-height: 0; }
.health-day.hl-none { color: var(--muted); }
.health-day:hover { transform: scale(1.18); opacity: 1; }
.health-day.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.health-day.selected { outline: 2px solid var(--ink); outline-offset: 1px; }
.hl-none { background: rgba(242, 255, 251, 0.07); }
.hl-ok { background: rgba(45, 224, 199, 0.6); }
.hl-warning { background: var(--sand-gold); }
.hl-alarm { background: var(--alert-koi); box-shadow: 0 0 6px rgba(255, 84, 112, 0.6); }
.health-detail { min-height: 40px; }
.health-detail .field-hint { margin: 0; }
.health-detail-title { margin: 0 0 6px; font-size: var(--fs-md); font-family: var(--font-body); }
.health-detail-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; font-size: var(--fs-sm); }
.health-detail-list li { display: grid; grid-template-columns: 44px 1fr; column-gap: 8px; }
.hd-time { font-family: var(--font-mono); color: var(--muted); }
.hd-detail { grid-column: 2; color: var(--muted); font-size: var(--fs-xs); }
.hd-alarm .hd-title { color: #ff9aa8; }
.hd-warning .hd-title { color: var(--sand-gold); }

/* ---- podmiana przed i po ---- */
.wcc-table { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; gap: 8px 10px; align-items: baseline; font-size: var(--fs-sm); }
.wcc-head { font-size: var(--fs-2xs); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.wcc-label { color: var(--muted); }
.wcc-val, .wcc-diff { font-family: var(--font-mono); font-weight: 600; }
.wcc-diff.warn { color: var(--sand-gold); }
.wcc-verdict { margin: 12px 0 0; font-size: var(--fs-sm); line-height: 1.45; color: var(--algae-glow); }
.wcc-verdict.warn { color: var(--sand-gold); }

/* ---------- Etap 2: CO2 przed światłem, galeria, mapa obsady ---------- */
.day-co2-ramp { margin-top: 8px; font-size: var(--fs-sm); color: var(--muted); }
.day-co2-ramp:empty { display: none; }
.day-co2-ramp.ok { color: var(--ok); }
.day-co2-ramp.warn { color: var(--warn); }

.gallery { margin-bottom: 18px; }
.ba { display: grid; gap: 10px; margin-bottom: 12px; }
.ba-viewer {
  position: relative; aspect-ratio: 4 / 3; max-height: 460px; width: 100%;
  border-radius: var(--radius); overflow: hidden; background: var(--glass-deep);
  border: 1px solid var(--glass-border); touch-action: none; cursor: ew-resize; user-select: none;
}
.ba-viewer img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.ba-before { clip-path: inset(0 calc(100% - var(--ba-pos, 50%)) 0 0); }
.ba-handle {
  position: absolute; top: 0; bottom: 0; left: var(--ba-pos, 50%); width: 2px;
  background: var(--foam); box-shadow: 0 0 8px rgba(0, 0, 0, 0.6); transform: translateX(-1px); pointer-events: none;
}
.ba-handle::after {
  content: "⇆"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--foam); color: var(--deep-water); font-weight: 700;
}
.ba-tag {
  position: absolute; top: 10px; padding: 3px 9px; border-radius: var(--radius-pill); font-size: var(--fs-xs);
  background: rgba(0, 0, 0, 0.55); color: #fff; pointer-events: none;
}
#ba-tag-before { left: 10px; }
#ba-tag-after { right: 10px; }
.ba-slider { width: 100%; }
.ba-pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ba-pickers label { display: grid; gap: 4px; font-size: var(--fs-xs); color: var(--muted); }
.gallery-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; }
.gallery-item {
  flex: 0 0 120px; scroll-snap-align: start; margin: 0; padding: 0; border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm); overflow: hidden; background: var(--glass);
}
.gallery-item.active { outline: 2px solid var(--lagoon-bright); }
.gallery-thumb { display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; background: none; cursor: pointer; }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-item figcaption, .gallery-item .gallery-date { display: block; padding: 4px 6px; font-size: var(--fs-2xs); color: var(--muted); }

.livestock-map-wrap { margin-bottom: 16px; }
.livestock-map-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.map-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--muted); }
.map-legend i { display: inline-block; width: 10px; height: 10px; border-radius: var(--radius-xs); margin-left: 8px; }
.map-legend i:first-child { margin-left: 0; }
.map-legend .lm-ok { background: var(--algae-glow); }
.map-legend .lm-bad { background: var(--alert-koi); }
.map-legend .lm-unknown { background: var(--info-blue); }
.livestock-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.lm-tile {
  display: grid; gap: 4px; justify-items: center; text-align: center; padding: 10px 8px;
  border-radius: var(--radius-sm); background: var(--glass); border: 2px solid var(--glass-border); color: inherit; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.lm-tile:hover, .lm-tile:focus-visible { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); }
.lm-tile.lm-ok { border-color: color-mix(in srgb, var(--algae-glow) 70%, transparent); }
.lm-tile.lm-bad { border-color: var(--alert-koi); background: color-mix(in srgb, var(--alert-koi) 12%, var(--glass)); }
.lm-tile.lm-unknown { border-color: color-mix(in srgb, var(--info-blue) 50%, transparent); }
.lm-photo { width: 64px; height: 64px; border-radius: 50%; }
.lm-name { font-weight: 600; font-size: var(--fs-sm); line-height: 1.2; }
.lm-fit { font-size: var(--fs-2xs); color: var(--muted); }
.lm-bad .lm-fit { color: var(--alert-koi); opacity: 1; }
.lm-count { font-size: var(--fs-2xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.lm-flash { animation: lm-flash 1.6s ease; }
@keyframes lm-flash { 0%, 100% { box-shadow: none; } 30% { box-shadow: 0 0 0 3px var(--lagoon-bright); } }
@media (max-width: 720px) {
  .livestock-map { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .gallery-item { flex-basis: 96px; }
}
@media (prefers-reduced-motion: reduce) {
  .lm-flash { animation: none; }
  .lm-tile { transition: none; }
}

/* =========================================================================
   Etap 3: wspólne tokeny odstępów, motyw jasny, kolory zakładek, szkielety
   ładowania, stan urządzeń, szybki test wody i tryb ścienny.
   ========================================================================= */
:root {
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
  --radius-lg: var(--radius);
  --tab-accent: var(--algae-glow);
}

/* Cyfry o stałej szerokości: wartości nie „tańczą”, gdy się zmieniają. */
.kpi-value, .score-value, .wcc-table, .tank-facts, .wall-clock, .hero-stat-value, .kpi-caption {
  font-variant-numeric: tabular-nums;
}

/* Widoczny fokus z klawiatury wszędzie, gdzie komponent nie ma własnego. */
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.link-btn {
  background: none; border: none; box-shadow: none; padding: 8px 0; color: var(--accent);
  font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { background: none; color: var(--text); transform: none; }

/* ---- przyciski w nagłówku: motyw i tryb ścienny ---- */
.app-title-row { flex-wrap: wrap; }
.app-tools { display: flex; gap: var(--space-2); margin-left: auto; }
.icon-btn { width: 44px; height: 44px; padding: 0; display: inline-grid; place-items: center; border-radius: var(--radius-sm); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-icon-light { display: none; }
:root[data-theme="light"] .theme-icon-light { display: block; }
:root[data-theme="light"] .theme-icon-dark { display: none; }

/* ---- kolory zakładek: każda zakładka ma własny akcent (przyciski, aktywne podzakładki, fokus) ---- */
body[data-tab="tab-schedule"]    { --accent: #ffb454; --accent-strong: #f59e0b; --tab-accent: #ffb454; }
body[data-tab="tab-aquarium"]    { --accent: #5cb8ff; --accent-strong: #2f95ec; --tab-accent: #5cb8ff; }
body[data-tab="tab-logs"]        { --accent: #ff8a98; --accent-strong: #f0566a; --tab-accent: #ff8a98; }
body[data-tab="tab-predictions"] { --accent: #c2a8ff; --accent-strong: #9d7ff2; --tab-accent: #c2a8ff; }
body[data-tab="tab-settings"]    { --accent: #9fdce4; --accent-strong: #6cc2ce; --tab-accent: #9fdce4; }
nav.tabs .tab-btn.active { color: var(--text); }
.tab-btn.active { border-bottom-color: var(--tab-accent); }
@media (min-width: 1100px) {
  nav.tabs .tab-btn.active { background: color-mix(in srgb, var(--tab-accent) 18%, transparent); box-shadow: inset 3px 0 0 var(--tab-accent); }
}
@media (max-width: 720px) {
  nav.tabs .tab-btn.active { background: color-mix(in srgb, var(--tab-accent) 20%, transparent); }
  nav.tabs .tab-btn.active .icon-inline { color: var(--tab-accent); }
}
.tab-panel:not(#tab-dashboard) > .card:first-of-type,
.tab-panel:not(#tab-dashboard) .subtab-scope > .card:first-of-type { box-shadow: var(--shadow), inset 0 3px 0 var(--tab-accent); }

/* ---- szkielety ładowania ---- */
@keyframes skeleton-pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 0.9; } }
body.is-loading .kpi-value > span:first-child,
body.is-loading .score-value,
body.is-loading .kpi-caption {
  color: transparent; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--muted) 28%, transparent);
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}
body.is-loading .kpi-value > span:first-child { display: inline-block; min-width: 3.2ch; }
body.is-loading #day-track, body.is-loading #health-grid { animation: skeleton-pulse 1.4s ease-in-out infinite; }

/* ---- mignięcie kafelka, gdy wartość wychodzi poza zakres ---- */
@keyframes kpi-alert-flash {
  0%, 100% { box-shadow: var(--shadow); }
  20%, 60% { box-shadow: var(--shadow), 0 0 0 3px var(--alert-koi), 0 0 36px -6px var(--alert-koi); }
}
.kpi-tile.kpi-alert-flash { animation: kpi-alert-flash 1.8s ease 2; }

/* ---- stan urządzeń na karcie zbiornika ---- */
.device-row { list-style: none; margin: 0 0 var(--space-3); padding: 0; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-2); }
.device { display: flex; align-items: center; gap: var(--space-2); padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--glass-deep); border: 1px solid var(--glass-border); min-width: 0; }
.device-icon { width: 30px; height: 30px; padding: 6px; flex-shrink: 0; border-radius: 50%; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--muted);
  background: color-mix(in srgb, currentColor 14%, transparent); }
.device-text { display: grid; min-width: 0; }
.device-label { font-size: var(--fs-xs); font-weight: 600; }
.device-detail { font-size: var(--fs-2xs); color: var(--muted); line-height: 1.3; }
.device-on .device-icon { color: var(--sand-gold); box-shadow: 0 0 14px -2px var(--sand-gold); }
.device-co2.device-on .device-icon { color: var(--info-blue); box-shadow: 0 0 14px -2px var(--info-blue); }
.device-ok .device-icon { color: var(--ok); }
.device-warn { border-color: color-mix(in srgb, var(--warn) 60%, transparent); }
.device-warn .device-icon { color: var(--warn); }
.device-warn .device-detail { color: var(--warn); }
.device-off .device-icon, .device-unknown .device-icon { opacity: 0.7; }

/* ---- szybki test wody ---- */
.qt-content { max-width: 560px; }
.qt-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); margin: var(--space-3) 0; }
.qt-grid label { display: grid; gap: 4px; font-size: var(--fs-sm); font-weight: 600; }
.qt-grid small { font-weight: 400; color: var(--muted); }
.qt-grid input { width: 100%; min-height: 44px; font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.qt-result { min-height: 1.3em; margin: 0 0 var(--space-2); font-weight: 600; }
.qt-result.ok { color: var(--ok); }
.qt-result.error { color: var(--danger); }
.qt-actions { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.qt-actions button[type="submit"] { min-height: 44px; min-width: 140px; }
@media (max-width: 520px) {
  .qt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #qt-modal { align-items: flex-end; padding: 0; }
  #qt-modal .qt-content { border-radius: var(--radius) var(--radius) 0 0; max-height: 92vh; }
  .qt-actions { flex-direction: column-reverse; align-items: stretch; }
}

/* ---- tryb ścienny ---- */
.wall-bar { display: none; }
body.wall { padding: 20px 24px; max-width: none; }
body.wall header, body.wall .dash-head, body.wall .dash-wc-summary, body.wall .dash-main,
body.wall .dash-insights, body.wall .np-scale-card, body.wall .wc-compare-card, body.wall .tab-panel:not(#tab-dashboard) { display: none !important; }
body.wall main { max-width: none; }
body.wall .wall-bar { display: flex; align-items: baseline; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-4); }
.wall-clock { font-family: var(--font-display); font-size: clamp(2.6rem, 6vw, 4.5rem); font-weight: 600; line-height: 1; }
.wall-date { font-size: var(--fs-lg); color: var(--muted); text-transform: capitalize; }
.wall-note { font-size: var(--fs-sm); color: var(--muted); margin-left: auto; }
body.wall .kpi-grid { gap: var(--space-4); }
body.wall .kpi-value { font-size: clamp(2rem, 3.6vw, 3rem); }
body.wall .dash-bottom { grid-template-columns: 1fr; }
body.wall .kpi-tile { cursor: default; }
body.wall .tank-card-body { max-width: 760px; }
body.wall .tank-svg { max-height: 280px; }
@media (max-width: 720px) { body.wall { padding-bottom: 20px; } .wall-note { margin-left: 0; width: 100%; } }

/* ---- motyw jasny ---- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #e8f3f1;
  --bg-elevated: #ffffff;
  --panel: #f6fbfa;
  --panel-border: rgba(13, 74, 92, 0.16);
  --gloss: rgba(255, 255, 255, 0.7);
  --text: #0e2f38;
  --ink: #0e2f38;
  --muted: #4a6b72;
  --accent: #0a7d6e;
  --accent-strong: #086a5d;
  --ok: #0c8a78;
  --warn: #b86e00;
  --danger: #d12f4d;
  --shadow: 0 1px 2px rgba(13, 50, 60, 0.06), 0 8px 24px rgba(13, 50, 60, 0.08);
  --glass: rgba(255, 255, 255, 0.78);
  --glass-deep: rgba(226, 241, 238, 0.9);
  --glass-border: rgba(13, 74, 92, 0.14);
  --tab-accent: #0f9e8b;
}
:root[data-theme="light"] { background: #e2f0ed; }
:root[data-theme="light"] .day-lane { background: rgba(14, 47, 56, 0.06); }
:root[data-theme="light"] :where(.score-up, .score-down, .score-list) { --algae-glow: #0c8a78; --sand-gold: #a35f00; }
:root[data-theme="light"] body {
  background:
    radial-gradient(1100px 600px at 12% -10%, rgba(45, 224, 199, 0.18), transparent 60%),
    radial-gradient(900px 600px at 100% 0%, rgba(74, 168, 255, 0.10), transparent 55%),
    linear-gradient(180deg, #f3faf8 0%, #e2f0ed 100%);
  background-attachment: fixed;
}
:root[data-theme="light"] .aqua-ambient { opacity: 0.35; }
:root[data-theme="light"] body[data-tab="tab-schedule"]    { --accent: #a35f00; --accent-strong: #8a5000; --tab-accent: #d98300; }
:root[data-theme="light"] body[data-tab="tab-aquarium"]    { --accent: #1a6bb8; --accent-strong: #155a9c; --tab-accent: #2f95ec; }
:root[data-theme="light"] body[data-tab="tab-logs"]        { --accent: #b8324a; --accent-strong: #9c283d; --tab-accent: #e4566b; }
:root[data-theme="light"] body[data-tab="tab-predictions"] { --accent: #6a4bd0; --accent-strong: #5a3dba; --tab-accent: #8a6cf0; }
:root[data-theme="light"] body[data-tab="tab-settings"]    { --accent: #22707a; --accent-strong: #1b5d66; --tab-accent: #3f97a3; }
:root[data-theme="light"] button:not(.secondary):not(.link-btn):not(.tab-btn):not(.dash-chart-tab):not(.settings-subtab-btn):not(.lm-tile):not(.gallery-thumb):not(.day-event):not(.health-day) { color: #fff; }
:root[data-theme="light"] .secondary { background: #ffffff; color: var(--text); border: 1px solid var(--panel-border); }
:root[data-theme="light"] input, :root[data-theme="light"] select, :root[data-theme="light"] textarea {
  background: #ffffff; color: var(--text); border-color: rgba(13, 74, 92, 0.22);
}
:root[data-theme="light"] .dash-card, :root[data-theme="light"] .kpi-tile, :root[data-theme="light"] .card {
  background: var(--glass); border-color: var(--glass-border);
}
:root[data-theme="light"] .kpi-icon { background: color-mix(in srgb, var(--accent) 14%, transparent); }
:root[data-theme="light"] .settings-subtab-btn.active { color: #fff; }
:root[data-theme="light"] .chart-modal-content { background: #ffffff; }
:root[data-theme="light"] .chart-modal-backdrop { background: rgba(14, 47, 56, 0.45); }
@media (min-width: 1100px) {
  :root[data-theme="light"] nav.tabs { background: rgba(255, 255, 255, 0.82); }
}
@media (max-width: 720px) {
  :root[data-theme="light"] nav.tabs { background: rgba(255, 255, 255, 0.92); box-shadow: 0 8px 30px rgba(13, 50, 60, 0.18); }
}

@media (max-width: 720px) {
  button, .secondary { min-height: 44px; }
  .app-tools { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .kpi-tile.kpi-alert-flash, body.is-loading .kpi-value > span:first-child, body.is-loading .score-value,
  body.is-loading .kpi-caption, body.is-loading #day-track, body.is-loading #health-grid { animation: none; }
}

/* ---------- Model wzrostu: beczka Liebiga, roślina, prognoza składników ---------- */
.growth-visual {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.8fr) minmax(0, 1fr); gap: var(--space-4);
  align-items: center; margin: var(--space-3) 0 var(--space-4); padding: var(--space-4);
  border-radius: var(--radius-lg); background: var(--glass-deep); border: 1px solid var(--glass-border);
}
.growth-fig { margin: 0; text-align: center; }
.growth-fig svg { width: 100%; max-height: 240px; display: block; margin: 0 auto; }
.growth-fig figcaption { font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; }
.growth-index { font-family: var(--font-display); font-size: 2.6rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.growth-index-label { font-size: var(--fs-xs); color: var(--muted); margin-bottom: var(--space-2); }
.growth-symptoms { font-size: var(--fs-sm); color: var(--warn); }
@media (max-width: 720px) {
  .growth-visual { grid-template-columns: 1fr 1fr; }
  .growth-info { grid-column: 1 / -1; }
}

.barrel-stave rect { fill: #b98a52; stroke: #7a5630; stroke-width: 1.2; }
.barrel-stave.unknown rect { fill: transparent; stroke: var(--muted); stroke-dasharray: 4 3; }
.barrel-stave.limiting rect { fill: var(--coral); stroke: var(--alert-koi); filter: drop-shadow(0 0 6px var(--alert-koi)); }
.barrel-label { font-size: 10px; fill: var(--muted); font-family: var(--font-body); }
.barrel-pct { font-size: 9px; fill: var(--ink); font-family: var(--font-mono); }
.barrel-stave.limiting .barrel-pct { fill: var(--alert-koi); font-weight: 700; }
.barrel-hoop { stroke: #5b4a3a; stroke-width: 3; opacity: 0.8; }
.barrel-water { transform-box: fill-box; transform-origin: bottom; animation: barrel-fill 1.8s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
.barrel-water-body { fill: rgba(45, 224, 199, 0.55); }
.barrel-wave { fill: rgba(94, 240, 216, 0.75); animation: barrel-wave 3s linear infinite; }
.barrel-drop { fill: #5ef0d8; opacity: 0; animation: barrel-drop 1.4s ease-in 1.8s infinite; }
@keyframes barrel-fill { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes barrel-wave { from { transform: translateX(0); } to { transform: translateX(40px); } }
@keyframes barrel-drop {
  0% { opacity: 0; transform: translate(0, 0); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(10px, 60px); }
}

.plant-substrate { fill: #7a5a3a; }
.plant-stem { fill: none; stroke: #3fae5b; stroke-width: 3; stroke-linecap: round;
  stroke-dasharray: var(--stem-len); stroke-dashoffset: var(--stem-len); animation: plant-grow 2s ease-out forwards; }
.plant-leaf { fill: #3fc26a; stroke: #2a8a49; stroke-width: 0.6; transform-box: fill-box; transform-origin: left center;
  transform: scale(0); animation: leaf-pop 0.5s ease-out forwards; }
.plant-leaf.leaf-yellow { fill: #d8c55a; stroke: #a8953a; }
.plant-leaf.leaf-pale { fill: #cdeaa8; stroke: #9cc57a; }
.leaf-hole { fill: var(--deep-water); }
:root[data-theme="light"] .leaf-hole { fill: #e2f0ed; }
.plant-sway { transform-box: fill-box; transform-origin: bottom center; animation: plant-sway 6s ease-in-out 2.4s infinite; }
@keyframes plant-grow { to { stroke-dashoffset: 0; } }
@keyframes leaf-pop { to { transform: scale(1); } }
@keyframes plant-sway { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }

.forecast-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.forecast-card { padding: var(--space-3); border-radius: var(--radius-sm); background: var(--glass-deep); border: 1px solid var(--glass-border); min-width: 0; }
.forecast-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); flex-wrap: wrap; }
.forecast-now { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--muted); }
.forecast-advice { margin: 6px 0; font-size: var(--fs-sm); font-weight: 600; }
.forecast-advice.forecast-low { color: var(--warn); }
.forecast-advice.forecast-high { color: var(--coral); }
.forecast-advice.forecast-ok { color: var(--ok); }
.forecast-chart { position: relative; height: 150px; }

.fert-comp-fields { border: 1px solid var(--glass-border); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); margin: var(--space-2) 0 var(--space-3); }
.fert-comp-fields legend { font-weight: 600; font-size: var(--fs-sm); padding: 0 4px; }
.fert-comp-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); margin: var(--space-2) 0; }
.fert-comp-grid label { display: grid; gap: 4px; font-size: var(--fs-xs); font-weight: 600; }
.fert-comp-grid input { width: 100%; min-width: 0; }
.fert-comp { margin-top: var(--space-2); }
.fert-comp summary { cursor: pointer; font-size: var(--fs-xs); color: var(--muted); }
.fert-comp summary.fert-comp-missing { color: var(--warn); }
@media (max-width: 520px) { .fert-comp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media (prefers-reduced-motion: reduce) {
  .barrel-water, .barrel-wave, .barrel-drop, .plant-sway { animation: none; }
  .barrel-drop { opacity: 0; }
  .plant-stem { animation: none; stroke-dashoffset: 0; }
  .plant-leaf { animation: none; transform: none; }
}
:root[data-theme="light"] .fert-remove-btn { color: var(--muted); }
:root[data-theme="light"] .fert-remove-btn:hover { color: var(--danger); }

/* ---------- Karta „Zbiornik”: zbiornik na górze, pod nim kafelki faktów ---------- */
.tank-card .tank-card-body { display: flex; flex-direction: column; align-items: stretch; gap: var(--space-3); }
.tank-card .tank-hero { width: 100%; }
.tank-card .tank-svg { display: block; width: 100%; max-height: 230px; margin: 0 auto; }
.tank-card .tank-target-label { display: none !important; }
.tank-card .tank-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); min-width: 0; }
.tank-card .tank-fact { position: relative; padding: 10px 12px; border-radius: var(--radius-sm); min-width: 0;
  background: var(--glass-deep); border: 1px solid var(--glass-border); }
.tank-card .tank-fact-water, .tank-card #tf-wc { grid-column: 1 / -1; }
.tf-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tf-icon { width: 22px; height: 22px; flex-shrink: 0; display: grid; place-items: center; border-radius: var(--radius-sm);
  color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.tf-icon svg { width: 14px; height: 14px; }
.tf-label { font-size: var(--fs-xs); color: var(--muted); line-height: 1.2; }
.tf-chip { margin-left: auto; font-size: var(--fs-xs); font-weight: 700; padding: 1px 8px; border-radius: var(--radius-pill);
  color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); font-variant-numeric: tabular-nums; }
.tf-value { margin-top: 4px; font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 600; line-height: 1.15;
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tf-value small { font-family: var(--font-body); font-size: var(--fs-xs); font-weight: 500; color: var(--muted); margin-left: 4px; }
.tf-value .tf-empty { font-family: var(--font-body); font-size: var(--fs-sm); font-weight: 500; color: var(--muted); }
.tf-sub { font-size: var(--fs-2xs); color: var(--muted); }
.tf-sub:empty { display: none; }
.tank-card .tank-water-bar { height: 8px; margin: 8px 0 4px; background: color-mix(in srgb, var(--muted) 18%, transparent); }
.tank-card .tank-fact[data-level="warn"] { border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.tank-card .tank-fact[data-level="warn"] .tf-value, .tank-card .tank-fact[data-level="warn"] .tf-icon { color: var(--warn); }
.tank-card .tank-fact[data-level="alarm"] { border-color: color-mix(in srgb, var(--danger) 60%, transparent);
  background: color-mix(in srgb, var(--danger) 10%, var(--glass-deep)); }
.tank-card .tank-fact[data-level="alarm"] .tf-value, .tank-card .tank-fact[data-level="alarm"] .tf-icon { color: var(--danger); }
.tank-card .tank-fact[data-level] .tf-icon { background: color-mix(in srgb, currentColor 14%, transparent); }
.tank-card #schedule-next-mini { font-size: var(--fs-lg); }

/* =========================================================================
   Etap „pulpit i sprzęt”: czas w normie, min/max, noc, zadania, tarcza doby,
   stan sprzętu (Logi) i odczynniki (Akwarium).
   ========================================================================= */
.dash-insights { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr) minmax(0, 1.3fr); }
@media (max-width: 1180px) { .dash-insights { grid-template-columns: 1fr 1fr; } .dash-insights .tir-card { grid-column: 1 / -1; } }
@media (max-width: 720px) { .dash-insights { grid-template-columns: 1fr; } }

.tir-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); margin: var(--space-2) 0 var(--space-3); }
.tir-item { text-align: center; min-width: 0; }
.tir-ring-wrap { position: relative; width: 64px; height: 64px; margin: 0 auto; }
.tir-ring { width: 64px; height: 64px; }
.tir-track { fill: none; stroke: color-mix(in srgb, var(--muted) 20%, transparent); stroke-width: 7; }
.tir-arc { fill: none; stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset 1.2s cubic-bezier(0.22, 0.61, 0.36, 1); }
.tir-ok { stroke: var(--ok); } .tir-warn { stroke: var(--warn); } .tir-alarm { stroke: var(--danger); } .tir-none { stroke: transparent; }
.tir-value { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.tir-label { font-size: var(--fs-2xs); color: var(--muted); margin-top: 4px; }
.tir-sub { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; margin: 0 0 6px; }
.stab-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.stab-item { display: grid; grid-template-columns: 1fr auto auto; gap: var(--space-2); align-items: center; font-size: var(--fs-xs); }
.stab-swing { color: var(--muted); font-variant-numeric: tabular-nums; }
.stab-chip { font-size: var(--fs-2xs); font-weight: 700; padding: 1px 8px; border-radius: var(--radius-pill); }
.stab-stable .stab-chip { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.stab-watch .stab-chip { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.stab-unstable .stab-chip { color: var(--danger); background: color-mix(in srgb, var(--danger) 16%, transparent); }

.kpi-minmax { position: absolute; top: -2px; bottom: -2px; border-radius: var(--radius-xs); z-index: 1;
  background: color-mix(in srgb, var(--ink) 30%, transparent); border: 1px solid color-mix(in srgb, var(--ink) 55%, transparent); }
.kpi-minmax[hidden] { display: none; }
.kpi-marker { z-index: 2; }
.kpi-day { font-size: var(--fs-2xs); color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi-day:empty { display: none; }
.kpi-day[data-stability="watch"] { color: var(--warn); }
.kpi-day[data-stability="unstable"] { color: var(--danger); }

.night-report { margin: -6px 0 14px; padding: 8px 12px; border-radius: var(--radius-sm); font-size: var(--fs-sm);
  background: var(--glass-deep); border: 1px solid var(--glass-border); }
.night-report::before { content: "🌙 "; }
.night-report[data-level="alarm"] { border-color: color-mix(in srgb, var(--warn) 60%, transparent); }
.o2-report { margin: -6px 0 14px; padding: 8px 12px; border-radius: var(--radius-sm); font-size: var(--fs-sm);
  background: var(--glass-deep); border: 1px solid color-mix(in srgb, var(--warn) 60%, transparent); }
.o2-report[data-level="alarm"] { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--glass-deep)); }
.o2-report > summary { cursor: pointer; list-style: none; }
.o2-report > summary::-webkit-details-marker { display: none; }
.o2-report > summary::before { content: "💨 "; }
.o2-report[open] > summary { margin-bottom: 4px; }
.o2-report > summary::after { content: " · szczegóły"; color: var(--muted); }
.o2-report[open] > summary::after { content: ""; }

.sys-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border-radius: var(--radius-pill);
  background: var(--glass-deep); color: var(--text); border: 1px solid var(--glass-border); box-shadow: none; font-size: var(--fs-xs); font-weight: 600; }
.sys-chip[hidden] { display: none; }
.sys-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.sys-chip[data-state="warn"] .sys-dot { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.sys-chip[data-state="alarm"] .sys-dot { background: var(--danger); box-shadow: 0 0 8px var(--danger); animation: skeleton-pulse 1.2s infinite; }
:root[data-theme="light"] .sys-chip { color: var(--text); }

.todo-item { align-items: center; }
.todo-action { margin-left: auto; min-height: 36px; padding: 4px 12px; font-size: var(--fs-xs); flex-shrink: 0; }
.todo-task .todo-dot { background: var(--info-blue); }
.todo-done { opacity: 0.55; }
.todo-done .todo-title { text-decoration: line-through; }

.day-card .dash-card-head { flex-wrap: wrap; gap: var(--space-2); }
.day-view-toggle { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-sm); background: var(--glass-deep); border: 1px solid var(--glass-border); }
.day-view-toggle button { background: transparent; color: var(--muted); box-shadow: none; padding: 4px 10px; min-height: 30px; font-size: var(--fs-xs); border-radius: var(--radius-sm); }
.day-view-toggle button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--text); }
:root[data-theme="light"] .day-view-toggle button { color: var(--muted); }
:root[data-theme="light"] .day-view-toggle button[aria-pressed="true"] { color: var(--text); }
.day-dial { display: flex; justify-content: center; }
.dial-svg { width: min(100%, 300px); height: auto; }
body.wall .dial-svg { width: min(100%, 380px); }
.dial-face { fill: var(--glass-deep); stroke: var(--glass-border); }
.dial-tick { stroke: var(--muted); stroke-width: 1; }
.dial-tick.long { stroke-width: 2; }
.dial-hour { font-size: 10px; fill: var(--muted); font-family: var(--font-mono); }
.dial-lane { fill: none; stroke: color-mix(in srgb, var(--muted) 14%, transparent); stroke-width: 8; }
.dial-seg { fill: none; stroke-width: 8; stroke-linecap: round; }
.dial-light { stroke: var(--sand-gold); }
.dial-co2 { stroke: var(--info-blue); }
.dial-event { stroke: var(--deep-water); stroke-width: 1; }
.dial-event-feeding { fill: var(--coral); } .dial-event-dose { fill: var(--algae-glow); } .dial-event-water_change { fill: var(--info-blue); }
.dial-hand { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.dial-hub { fill: var(--ink); }
.dial-now { font-family: var(--font-display); font-size: 16px; font-weight: 600; fill: var(--ink); }

.system-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-3); }
.sys-card { padding: var(--space-3); border-radius: var(--radius-sm); background: var(--glass-deep); border: 1px solid var(--glass-border); border-left: 4px solid var(--muted); }
.sys-ok { border-left-color: var(--ok); } .sys-warn { border-left-color: var(--warn); } .sys-error { border-left-color: var(--danger); }
.sys-card-head { display: flex; justify-content: space-between; gap: var(--space-2); margin-bottom: 6px; }
.sys-state { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
.sys-ok .sys-state { color: var(--ok); } .sys-warn .sys-state { color: var(--warn); } .sys-error .sys-state { color: var(--danger); }
.sys-rows { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; font-size: var(--fs-xs); }
.sys-rows dt { color: var(--muted); } .sys-rows dd { margin: 0; font-variant-numeric: tabular-nums; }
.sys-note { margin: 8px 0 0; font-size: var(--fs-xs); color: var(--warn); }
.sys-error .sys-note { color: var(--danger); }

.kit-list { list-style: none; margin: 0 0 var(--space-3); padding: 0; display: grid; gap: 6px; }
.kit { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--glass-deep); border: 1px solid var(--glass-border); }
.kit-name { font-weight: 600; }
.kit-date { color: var(--muted); font-size: var(--fs-xs); }
.kit-chip { margin-left: auto; font-size: var(--fs-2xs); font-weight: 700; padding: 1px 8px; border-radius: var(--radius-pill); color: var(--ok);
  background: color-mix(in srgb, var(--ok) 14%, transparent); }
.kit-soon .kit-chip { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.kit-expired { border-color: color-mix(in srgb, var(--danger) 55%, transparent); }
.kit-expired .kit-chip { color: var(--danger); background: color-mix(in srgb, var(--danger) 16%, transparent); }
.kit-form { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: flex-end; }
.kit-form label { display: grid; gap: 4px; font-size: var(--fs-xs); font-weight: 600; }
.kit-form input { min-height: 44px; }
@media (prefers-reduced-motion: reduce) { .tir-arc { transition: none; } .sys-chip[data-state="alarm"] .sys-dot { animation: none; } }

/* Porównanie z wczoraj / 7 dni na wykresach doby */
.compare-toggle { background: transparent; color: var(--muted); border: 1px dashed var(--glass-border); box-shadow: none;
  padding: 6px 10px; min-height: 36px; font-size: var(--fs-xs); border-radius: var(--radius-sm); }
.compare-toggle[aria-pressed="true"] { color: var(--text); border-style: solid; background: color-mix(in srgb, var(--accent) 14%, transparent); }
:root[data-theme="light"] .compare-toggle { color: var(--muted); }
:root[data-theme="light"] .compare-toggle[aria-pressed="true"] { color: var(--text); }
.dash-chart-card .dash-card-head { flex-wrap: wrap; gap: var(--space-2); }
.chart-glyph-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 4px; font-size: var(--fs-2xs); color: var(--muted); }
.chart-glyph-legend span { display: inline-flex; align-items: center; gap: 4px; }
.chart-glyph-legend b { width: 14px; height: 14px; border-radius: 50%; display: inline-grid; place-items: center;
  font: 700 8px var(--font-mono); color: #062634; background: var(--g); }

/* Analizy: historia długoterminowa */
.lt-controls { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-3); }
.lt-chart { position: relative; height: 280px; }
.lt-mini { position: relative; height: 56px; margin-top: 6px; border-radius: var(--radius-sm); background: var(--glass-deep);
  border: 1px solid var(--glass-border); cursor: ew-resize; touch-action: none; }
@media (max-width: 720px) { .lt-chart { height: 220px; } }

/* Analizy: mapa godzina × dzień */
.heatmap-wrap { overflow-x: auto; }
.heatmap { display: grid; grid-template-columns: 44px repeat(24, minmax(12px, 1fr)); gap: 2px; min-width: 360px; }
.hm-hour { font-size: var(--fs-2xs); color: var(--muted); text-align: left; font-family: var(--font-mono); }
.hm-day { font-size: var(--fs-2xs); color: var(--muted); font-family: var(--font-mono); align-self: center; }
.hm-cell { height: 12px; border-radius: var(--radius-xs); }
.hm-empty { background: color-mix(in srgb, var(--muted) 10%, transparent); }
.hm-low { box-shadow: inset 0 0 0 2px #4aa8ff; }
.hm-high { box-shadow: inset 0 0 0 2px #ff5470; }
.heatmap-scale { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 10px; font-size: var(--fs-xs); color: var(--muted); }
.hm-bar { width: 140px; height: 10px; border-radius: var(--radius-xs); }
.hm-key::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: var(--radius-xs); margin-right: 4px; vertical-align: -1px; }
.hm-low-key::before { box-shadow: inset 0 0 0 2px #4aa8ff; }
.hm-high-key::before { box-shadow: inset 0 0 0 2px #ff5470; }

/* Analizy: zbiornik a pokój */
.room-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-2); margin-bottom: var(--space-3); }
.room-fact { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--glass-deep); border: 1px solid var(--glass-border); display: grid; gap: 2px; }
.room-fact-label { font-size: var(--fs-xs); color: var(--muted); }
.room-fact strong { font-family: var(--font-display); font-size: var(--fs-xl); font-variant-numeric: tabular-nums; }
.room-warn { border-color: color-mix(in srgb, var(--warn) 55%, transparent); } .room-warn strong { color: var(--warn); }
.room-alarm { border-color: color-mix(in srgb, var(--danger) 55%, transparent); } .room-alarm strong { color: var(--danger); }
.room-chart[hidden] { display: none; }

/* Akwarium: kaskada azotowa */
.n-flow { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding: 4px 0 8px; }
.n-source { align-self: center; flex-shrink: 0; font-size: var(--fs-xs); color: var(--muted); padding: 8px 10px; border-radius: var(--radius-pill);
  background: var(--glass-deep); border: 1px dashed var(--glass-border); white-space: nowrap; }
.n-node { flex: 1 1 0; min-width: 130px; display: grid; gap: 2px; justify-items: center; text-align: center; padding: 12px 10px;
  border-radius: var(--radius-sm); background: var(--glass-deep); border: 2px solid var(--glass-border); }
.n-formula { font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-md); }
.n-label { font-size: var(--fs-xs); color: var(--muted); }
.n-value { font-family: var(--font-display); font-size: var(--fs-xl); font-variant-numeric: tabular-nums; }
.n-chip { font-size: var(--fs-2xs); font-weight: 700; padding: 1px 8px; border-radius: var(--radius-pill); color: var(--muted);
  background: color-mix(in srgb, var(--muted) 14%, transparent); }
.n-note { font-size: var(--fs-2xs); color: var(--muted); }
.n-ok { border-color: color-mix(in srgb, var(--ok) 55%, transparent); } .n-ok .n-chip { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.n-warn { border-color: color-mix(in srgb, var(--warn) 60%, transparent); } .n-warn .n-chip { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.n-alarm { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--glass-deep)); }
.n-alarm .n-chip { color: var(--danger); background: color-mix(in srgb, var(--danger) 16%, transparent); }
.n-arrow { position: relative; flex: 0 0 74px; display: grid; align-content: center; justify-items: center; gap: 4px; }
.n-arrow-line { width: 100%; height: 4px; border-radius: var(--radius-xs);
  background: repeating-linear-gradient(90deg, var(--accent) 0 8px, transparent 8px 14px); background-size: 28px 4px;
  animation: n-flow 1.2s linear infinite; }
.n-arrow-line::after { content: ""; position: absolute; right: 0; top: 50%; margin-top: -14px; border: 6px solid transparent; border-left-color: var(--accent); }
.n-arrow-label { font-size: var(--fs-2xs); color: var(--muted); text-align: center; line-height: 1.15; padding: 0 2px; }
.n-slow .n-arrow-line { animation-duration: 5s; opacity: 0.45; }
@keyframes n-flow { from { background-position: 0 0; } to { background-position: 28px 0; } }
.n-verdict { margin: 8px 0 0; font-weight: 600; font-size: var(--fs-sm); }
.n-verdict[data-code="ok"] { color: var(--ok); }
.n-verdict[data-code^="stuck"], .n-verdict[data-code="high_no3"] { color: var(--warn); }
@media (max-width: 720px) {
  .n-flow { flex-direction: column; align-items: stretch; }
  .n-source { align-self: center; }
  .n-arrow { flex-basis: 44px; }
  .n-arrow-line { width: 4px; height: 26px; background: repeating-linear-gradient(180deg, var(--accent) 0 8px, transparent 8px 14px);
    background-size: 4px 28px; animation-name: n-flow-v; }
  .n-arrow-line::after { right: auto; left: 50%; top: auto; bottom: -6px; margin: 0 0 0 -6px; border-left-color: transparent; border-top-color: var(--accent); }
  .n-node { min-width: 0; }
}
@keyframes n-flow-v { from { background-position: 0 0; } to { background-position: 0 28px; } }
@media (prefers-reduced-motion: reduce) { .n-arrow-line { animation: none; } }

/* Akwarium: tabela KH / pH / CO2 */
.co2-table-wrap { overflow-x: auto; }
.co2-table { border-collapse: separate; border-spacing: 2px; font-family: var(--font-mono); font-size: var(--fs-xs); min-width: 420px; }
.co2-table th { font-weight: 600; color: var(--muted); padding: 4px 6px; text-align: center; }
.co2-table td { text-align: center; padding: 5px 4px; border-radius: var(--radius-xs); color: #062634; font-weight: 600; min-width: 34px; }
.co2-low { background: #a9cdef; } .co2-near { background: #cfe8b6; } .co2-ok { background: #7fd89a; }
.co2-high { background: #ffcf7a; } .co2-danger { background: #ff8a98; }
.co2-mark-col, .co2-mark-row { color: var(--text) !important; background: color-mix(in srgb, var(--accent) 25%, transparent); border-radius: var(--radius-xs); }
.co2-now { outline: 3px solid var(--ink); outline-offset: 1px; box-shadow: 0 0 12px var(--accent); }
.co2-corner { font-size: var(--fs-2xs); }
.co2-legend { display: flex; flex-wrap: wrap; gap: 6px; font-size: var(--fs-2xs); margin-top: 6px; }
.co2-legend span { padding: 2px 8px; border-radius: var(--radius-pill); color: #062634; font-weight: 600; }

/* Szybki test: wybór koloru */
.qt-swatches { display: flex; gap: 4px; flex-wrap: wrap; }
.qt-swatch { width: 22px; height: 22px; min-height: 22px; padding: 0; border-radius: 50%; background: var(--sw);
  border: 2px solid rgba(0, 0, 0, 0.25); box-shadow: none; cursor: pointer; }
.qt-swatch:hover { transform: scale(1.12); background: var(--sw); }
.qt-swatch.picked { border-color: var(--ink); box-shadow: 0 0 0 2px var(--accent); }
@media (max-width: 720px) { .qt-swatch { width: 26px; height: 26px; min-height: 26px; } }
.qt-grid label { align-content: start; }
.qt-grid input { height: 44px; }

/* Akwarium: kranówka a akwarium */
.tap-row { display: grid; grid-template-columns: 44px 1fr 150px; gap: var(--space-2); align-items: center; margin-bottom: 10px; }
.tap-label { font-family: var(--font-mono); font-weight: 700; }
.tap-track { position: relative; height: 10px; border-radius: var(--radius-xs); background: color-mix(in srgb, var(--muted) 16%, transparent); }
.tap-band { position: absolute; top: 0; bottom: 0; border-radius: var(--radius-xs); background: color-mix(in srgb, var(--ok) 40%, transparent); }
.tap-mark { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; border: 2px solid var(--deep-water); transition: left 0.3s ease; }
.tap-tank { background: var(--coral); }
.tap-mix { background: var(--info-blue); }
.tap-values { display: flex; gap: 8px; justify-content: flex-end; font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.tap-v-mix { color: var(--info-blue); } .tap-v-tank { color: var(--coral); }
:root[data-theme="light"] .tap-v-mix { color: #1a6bb8; } :root[data-theme="light"] .tap-v-tank { color: #b8324a; }
.tap-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--muted); margin: 4px 0 8px; }
.tap-key::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.tap-key-mix::before { background: var(--info-blue); } .tap-key-tank::before { background: var(--coral); }
.tap-key-band::before { border-radius: var(--radius-xs); background: color-mix(in srgb, var(--ok) 40%, transparent); }
.tap-slider { display: grid; gap: 6px; font-size: var(--fs-sm); max-width: 420px; }
.tap-slider input { width: 100%; }
@media (max-width: 520px) { .tap-row { grid-template-columns: 38px 1fr; } .tap-values { grid-column: 2; justify-content: flex-start; } }

/* Mieszkańcy: wspólne okno parametrów */
.pw-panel { margin-top: var(--space-4); }
.pw-charts { display: grid; gap: var(--space-4); }
.pw-head { display: flex; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; margin-bottom: 6px; }
.pw-common { font-size: var(--fs-xs); color: var(--ok); font-weight: 600; }
.pw-common.pw-empty { color: var(--danger); }
.pw-chart { --pw-name: 130px; position: relative; display: grid; gap: 4px; }
.pw-window { position: absolute; top: 0; bottom: 18px;
  background: color-mix(in srgb, var(--ok) 16%, transparent); border-left: 1px dashed var(--ok); border-right: 1px dashed var(--ok); }
.pw-row { display: grid; grid-template-columns: var(--pw-name) 1fr; align-items: center; min-height: 18px; position: relative; }
.pw-name { font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 8px; }
.pw-track { position: relative; height: 10px; }
.pw-bar { position: absolute; top: 0; bottom: 0; border-radius: var(--radius-xs); background: color-mix(in srgb, var(--info-blue) 70%, transparent); }
.pw-out .pw-bar { background: color-mix(in srgb, var(--danger) 70%, transparent); }
.pw-out .pw-name { color: var(--danger); font-weight: 600; }
.pw-now { position: absolute; top: -4px; bottom: 16px; width: 2px; margin-left: -1px; background: var(--ink); z-index: 2; }
.pw-now-label { position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%); font-size: var(--fs-2xs); white-space: nowrap; color: var(--ink); font-weight: 700; }
.pw-axis { display: flex; justify-content: space-between; margin-left: var(--pw-name); font-size: var(--fs-2xs); color: var(--muted); font-family: var(--font-mono); padding-top: 4px; }
@media (max-width: 520px) { .pw-chart { --pw-name: 96px; } }

/* Mieszkańcy: macierz zgodności */
.cm-panel { margin-top: var(--space-4); }
.cm-wrap { overflow-x: auto; }
.cm-table { border-collapse: separate; border-spacing: 3px; }
.cm-col { writing-mode: vertical-rl; transform: rotate(180deg); font-size: var(--fs-2xs); font-weight: 600; padding: 4px 0; max-height: 130px; white-space: nowrap; text-align: left; }
.cm-rowhead { font-size: var(--fs-xs); font-weight: 600; text-align: right; padding-right: 6px; white-space: nowrap; }
.cm-cell { padding: 0; }
.cm-btn { width: 34px; height: 34px; min-height: 34px; padding: 0; border-radius: var(--radius-sm); font-weight: 800; box-shadow: none; border: 1px solid transparent; }
.cm-ok .cm-btn { background: color-mix(in srgb, var(--ok) 22%, transparent); color: var(--ok); }
.cm-warn .cm-btn { background: color-mix(in srgb, var(--warn) 24%, transparent); color: var(--warn); }
.cm-bad .cm-btn { background: color-mix(in srgb, var(--danger) 28%, transparent); color: var(--danger); }
.cm-unknown .cm-btn { background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); }
.cm-self .cm-btn { border: 1px dashed currentColor; }
.cm-detail { font-size: var(--fs-sm); margin: 8px 0 0; min-height: 1.2em; }
.cm-detail[data-level="bad"] { color: var(--danger); } .cm-detail[data-level="warn"] { color: var(--warn); }
:root[data-theme="light"] .cm-btn { color: inherit; }

/* Mieszkańcy: wskaźnik obsady */
.stock-gauge { margin: 8px 0 16px; padding: var(--space-3); border-radius: var(--radius-sm); background: var(--glass-deep); border: 1px solid var(--glass-border); }
.sg-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin-bottom: 8px; }
.sg-pct { font-family: var(--font-display); font-size: var(--fs-xl); }
.sg-ok, .sg-comfortable { color: var(--ok); } .sg-tight { color: var(--warn); } .sg-crowded { color: var(--danger); }
.sg-sub { font-size: var(--fs-xs); color: var(--muted); }
.sg-bar { position: relative; display: flex; height: 12px; border-radius: var(--radius-xs); overflow: hidden; }
.sg-zone-ok { background: color-mix(in srgb, var(--ok) 30%, transparent); }
.sg-zone-tight { background: color-mix(in srgb, var(--warn) 30%, transparent); }
.sg-zone-over { background: color-mix(in srgb, var(--danger) 30%, transparent); }
.sg-fill { position: absolute; left: 0; top: 3px; bottom: 3px; border-radius: var(--radius-xs); background: var(--ink); opacity: 0.85; transition: width 0.8s ease; }
.sg-scale { position: relative; height: 16px; font-size: var(--fs-2xs); color: var(--muted); margin-top: 3px; }
.sg-scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.sg-scale .sg-tick { font-weight: 700; color: var(--text); }
.sg-scale .sg-tick::before { content: ""; position: absolute; left: 50%; top: -9px; width: 1px; height: 8px; background: var(--text); }
.sg-fish { display: grid; gap: 8px; margin-top: 12px; }
.sg-row { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }
.sg-svg path { fill: var(--info-blue); }
.sg-unknown path { fill: var(--muted); }
.sg-more { font-size: var(--fs-xs); color: var(--muted); margin-left: 4px; }
.sg-name { font-size: var(--fs-2xs); color: var(--muted); }
.sg-scale .sg-end { transform: translateX(-100%); }
.lh-panel { margin-top: var(--space-4); }
.lh-chart { position: relative; height: 200px; }

/* Dziennik: przycinanie roślin */
.trim-log { margin-bottom: 18px; }
.trim-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--space-2); margin-bottom: 10px; }
.trim-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.trim-item { flex: 0 0 140px; margin: 0; border-radius: var(--radius-sm); overflow: hidden; background: var(--glass); border: 1px solid var(--glass-border); }
.trim-item img, .trim-noimg { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.trim-noimg { display: grid; place-items: center; font-size: var(--fs-2xl); color: var(--muted); background: var(--glass-deep); }
.trim-item figcaption { padding: 4px 6px; font-size: var(--fs-2xs); color: var(--muted); }
.energy-facts { margin-top: var(--space-3); }
.energy-chart[hidden] { display: none; }

/* Zapasy */
.supply-list { list-style: none; margin: 0 0 var(--space-3); padding: 0; display: grid; gap: 8px; }
.supply { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--glass-deep); border: 1px solid var(--glass-border); display: grid; gap: 6px; }
.supply-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.supply-kind { font-size: var(--fs-2xs); color: var(--muted); }
.supply-text { margin-left: auto; font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.supply-bar { height: 8px; border-radius: var(--radius-xs); background: color-mix(in srgb, var(--muted) 16%, transparent); overflow: hidden; }
.supply-bar span { display: block; height: 100%; border-radius: var(--radius-xs); background: var(--ok); transition: width 0.6s ease; }
.supply-low .supply-bar span { background: var(--warn); } .supply-low .supply-text { color: var(--warn); }
.supply-empty .supply-bar span { background: var(--danger); } .supply-empty .supply-text { color: var(--danger); }
.supply-empty { border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.supply-actions { display: flex; gap: 8px; }
.supply-actions button { min-height: 32px; padding: 4px 12px; font-size: var(--fs-xs); }

/* Karta na forum */
.share-content { max-width: 560px; }
.share-canvas { display: block; width: 100%; height: auto; border-radius: var(--radius); margin: 8px 0 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.35); }
.share-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

/* Centrum powiadomień */
.notif-wrap { position: relative; }
.icon-btn { position: relative; }
.notif-badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--radius-sm);
  background: var(--warn); color: #062634; font: 700 11px/20px var(--font-body); text-align: center; }
.notif-badge[data-level="critical"] { background: var(--danger); color: #fff; }
.notif-badge[hidden] { display: none; }
.notif-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: min(380px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto;
  padding: 12px; border-radius: var(--radius-lg); background: var(--panel); border: 1px solid var(--glass-border); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4); }
.notif-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.notif-section { font-size: var(--fs-2xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 10px 0 4px; }
.notif-item { display: grid; grid-template-columns: 10px 1fr; gap: 2px 8px; padding: 6px 4px; border-radius: var(--radius-sm); font-size: var(--fs-xs); }
.notif-item.notif-new { background: color-mix(in srgb, var(--accent) 10%, transparent); cursor: pointer; }
.notif-item.notif-new .notif-text { font-weight: 600; }
.notif-item.notif-new:hover, .notif-item.notif-new:focus-visible { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.notif-item.notif-read { opacity: 0.62; }
.notif-item.notif-read .notif-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
.notif-head .link-btn:disabled { opacity: 0.45; cursor: default; }
.notif-foot { display: flex; justify-content: flex-end; margin-top: 8px; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--info-blue); }
.notif-warning .notif-dot { background: var(--warn); } .notif-critical .notif-dot { background: var(--danger); }
.notif-time { grid-column: 2; font-size: var(--fs-2xs); color: var(--muted); }
@media (max-width: 720px) { .notif-panel { position: fixed; left: 16px; right: 16px; top: 70px; width: auto; } }
header { position: relative; z-index: 40; }

/* Pulpit: wszystkie zbiorniki */
.tanks-overview { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.to-card { display: grid; gap: 6px; text-align: left; padding: 12px 14px; border-radius: var(--radius-sm); color: var(--text);
  background: var(--glass); border: 1px solid var(--glass-border); box-shadow: none; }
.to-card:hover { background: var(--glass); border-color: var(--accent); transform: none; }
.to-card.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.to-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.to-score { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 600; }
.to-ok { color: var(--ok); } .to-warn { color: var(--warn); } .to-alarm { color: var(--danger); } .to-none { color: var(--muted); }
.to-facts { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: var(--fs-xs); color: var(--muted); }
.to-facts .to-bad { color: var(--warn); }
:root[data-theme="light"] .to-card { color: var(--text); }

/* PWA: pasek offline */
.offline-bar { position: sticky; top: 0; z-index: 80; margin: -8px 0 12px; padding: 8px 14px; border-radius: var(--radius-sm);
  background: var(--warn); color: #062634; font-weight: 600; font-size: var(--fs-sm); text-align: center; }
.offline-bar[hidden] { display: none; }
#btn-install[hidden] { display: none; }

/* ---- Większy tekst ---- */
:root.large-text { font-size: 112.5%; }
:root.large-text body { font-size: var(--fs-md); }
.toggle-row { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; font-size: var(--fs-sm); cursor: pointer; }
.toggle-row input { width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0; }

/* Paleta poleceń */
#palette { align-items: flex-start; padding-top: 12vh; }
.palette-box { position: relative; width: min(560px, 100%); border-radius: var(--radius-lg); background: var(--panel);
  border: 1px solid var(--glass-border); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5); overflow: hidden; }
#palette-input { width: 100%; min-height: 56px; padding: 0 18px; font-size: var(--fs-md); border: none; border-bottom: 1px solid var(--glass-border);
  border-radius: 0; background: transparent; color: var(--text); outline: none; }
#palette-list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.palette-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; }
.palette-item.active { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.palette-group { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.palette-empty { padding: 12px; color: var(--muted); }
.palette-foot { margin: 0; padding: 8px 14px; font-size: var(--fs-2xs); color: var(--muted); border-top: 1px solid var(--glass-border); }
:root[data-theme="light"] #palette-input { background: transparent; }
@media (max-width: 720px) { #palette { padding: 12px; } }

/* Puste stany */
.empty-state { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 18px 16px; border-radius: var(--radius-sm);
  border: 1px dashed var(--glass-border); background: color-mix(in srgb, var(--glass-deep) 60%, transparent); }
.empty-state.hidden { display: none; }
.empty-art { width: 56px; height: 56px; fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0.85; }
.empty-title { font-size: var(--fs-md); }
.empty-text { margin: 0; max-width: 46ch; font-size: var(--fs-sm); color: var(--muted); }
.empty-state button { margin-top: 6px; }
.todo-empty { list-style: none; }
.todo-empty .empty-state { border: none; background: none; padding: 8px; }

/* Asystent */
.chat-fab { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: inline-flex; align-items: center; gap: 8px;
  min-height: 52px; padding: 0 18px; border-radius: var(--radius-pill); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4); font-weight: 700; }
.chat-fab svg { width: 22px; height: 22px; }
body.chat-open .chat-fab { display: none; }
body.wall .chat-fab { display: none; }
.chat-panel { position: fixed; right: 20px; bottom: 20px; z-index: 95; width: min(420px, calc(100vw - 32px)); height: min(620px, calc(100vh - 40px));
  display: flex; flex-direction: column; border-radius: var(--radius-lg); background: var(--panel); border: 1px solid var(--glass-border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5); overflow: hidden; }
.chat-panel.hidden { display: none; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--glass-border); }
.chat-head strong { margin-right: auto; }
.chat-head .icon-btn { width: 36px; height: 36px; min-height: 36px; }
.chat-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { max-width: 88%; padding: 8px 12px; border-radius: var(--radius); font-size: var(--fs-sm); line-height: 1.45; white-space: pre-wrap; }
.chat-user { align-self: flex-end; background: color-mix(in srgb, var(--accent) 28%, transparent); border-bottom-right-radius: var(--radius-xs); }
.chat-assistant { align-self: flex-start; background: var(--glass-deep); border: 1px solid var(--glass-border); border-bottom-left-radius: var(--radius-xs); }
.chat-wait { opacity: 0.6; animation: skeleton-pulse 1.2s infinite; }
.chat-note { margin: 0 0 6px; font-size: var(--fs-xs); color: var(--muted); white-space: normal; }
.chat-points { margin: 0; padding-left: 18px; white-space: normal; }
.chat-command { display: grid; gap: 6px; white-space: normal; }
.chat-command-title { font-weight: 700; }
.chat-command-actions { display: flex; gap: 8px; }
.chat-command-actions button { min-height: 36px; padding: 4px 14px; }
.chat-done { color: var(--ok); font-weight: 700; } .chat-error { color: var(--danger); } .chat-muted { color: var(--muted); }
.chat-chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 12px 8px; }
.chat-chip { flex-shrink: 0; min-height: 32px; padding: 4px 10px; font-size: var(--fs-xs); border-radius: var(--radius); background: var(--glass-deep);
  color: var(--text); border: 1px solid var(--glass-border); box-shadow: none; }
.chat-form { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--glass-border); }
.chat-form input { flex: 1; min-height: 44px; }
.chat-form button { min-width: 48px; min-height: 44px; }
:root[data-theme="light"] .chat-chip { color: var(--text); }
@media (max-width: 720px) {
  .chat-fab { bottom: 92px; right: 14px; padding: 0 14px; }
  .chat-fab span { display: none; }
  .chat-panel { right: 8px; left: 8px; bottom: 8px; width: auto; height: calc(100vh - 16px); }
}
@media print { .chat-fab, .chat-panel { display: none !important; } }

/* Pasek testowy ze zdjęcia */
.strip-open { width: 100%; margin: 4px 0 10px; min-height: 44px; }
.strip-content { max-width: 720px; }
.strip-modes { margin-bottom: 10px; }
.strip-field { display: grid; gap: 4px; font-size: var(--fs-sm); font-weight: 600; margin: 6px 0; }
.strip-field input, .strip-field select { min-height: 44px; }
.strip-add { display: grid; grid-template-columns: 150px 1fr auto; gap: 8px; margin: 8px 0; }
.strip-add > * { min-height: 44px; }
.strip-pads { display: grid; gap: 6px; }
.strip-pad-row { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--glass-deep); font-size: var(--fs-sm); }
.strip-pad-refs { color: var(--muted); font-family: var(--font-mono); font-size: var(--fs-xs); }
.strip-photo-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; margin: 8px 0;
  border-radius: var(--radius-sm); border: 1px solid var(--glass-border); cursor: pointer; font-weight: 600; background: var(--glass-deep); }
.strip-prompt { font-weight: 700; color: var(--accent); min-height: 1.3em; margin: 4px 0; }
.strip-canvas-wrap { max-height: 60vh; overflow: auto; border-radius: var(--radius-sm); }
.strip-canvas { display: block; width: 100%; height: auto; cursor: crosshair; touch-action: manipulation; }
.strip-table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: var(--fs-sm); }
.strip-table th, .strip-table td { text-align: left; padding: 6px; border-bottom: 1px solid var(--glass-border); }
.strip-swatch { display: inline-block; width: 16px; height: 16px; border-radius: var(--radius-xs); margin-right: 8px; vertical-align: -3px; border: 1px solid rgba(0,0,0,0.3); }
.strip-q-ok { color: var(--ok); } .strip-q-warn { color: var(--warn); } .strip-q-alarm { color: var(--danger); }
@media (max-width: 520px) { .strip-add { grid-template-columns: 1fr; } }
#strip-modal { z-index: 1010; } #palette { z-index: 1020; }
#strip-modal { align-items: flex-start; }
#strip-modal .strip-content { max-height: calc(100vh - 40px); }

/* Scena zbiornika (Canvas) pod ramką SVG */
.tank-card .tank-hero.scene-on { position: relative; }
.tank-scene { position: absolute; z-index: 0; display: block; touch-action: manipulation; }
.scene-on .tank-svg { position: relative; z-index: 1; pointer-events: none; }
.scene-on .tank-fill, .scene-on #tank-substrate, .scene-on #tank-rocks, .scene-on .tank-driftwood, .scene-on #tank-live-plants,
.scene-on .tank-plants, .scene-on .tank-bubble, .scene-on #tank-fish-zone, .scene-on .tank-glass-shine { display: none; }
.scene-on .tank-outline { fill: none; }
.tank-card .tank-hero.scene-on .tank-svg { max-height: 300px; }
.gallery-bg-btn { width: 100%; min-height: 30px; padding: 2px 6px; font-size: var(--fs-2xs); border-radius: 0; box-shadow: none;
  background: var(--glass-deep); color: var(--muted); border: none; border-top: 1px solid var(--glass-border); }
.tank-full-btn { width: 36px; height: 36px; min-height: 36px; }
.tank-full-btn svg { width: 18px; height: 18px; }
.tank-card .tank-hero:fullscreen, .tank-card .tank-hero.tank-max {
  display: flex; align-items: center; justify-content: center; background: #02121a; padding: 2vh 2vw; border-radius: 0; }
.tank-card .tank-hero.tank-max { position: fixed; inset: 0; z-index: 1100; }
body.tank-max-open .dash-card, body.tank-max-open .tank-card { backdrop-filter: none; -webkit-backdrop-filter: none; transform: none; }
.tank-card .tank-hero:fullscreen .tank-svg, .tank-card .tank-hero.tank-max .tank-svg { width: 100%; height: 100%; max-height: none; }

.diag-plan { margin: 4px 0 12px; padding-left: 22px; font-size: var(--fs-sm); line-height: 1.5; }
.diag-plan li { margin: 4px 0; }
.diag-plan strong { color: var(--accent); margin-right: 4px; }

.q-card { border: 1px solid var(--panel-border); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 12px; }
.q-card.q-ready { border-color: var(--ok); }
.q-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.q-bar { height: 6px; border-radius: var(--radius-xs); background: color-mix(in srgb, var(--muted) 25%, transparent); margin: 10px 0 8px; overflow: hidden; }
.q-bar > span { display: block; height: 100%; background: var(--accent); border-radius: var(--radius-xs); }
.q-ready .q-bar > span { background: var(--ok); }
.q-phase { margin: 0 0 4px; font-size: var(--fs-sm); line-height: 1.45; }
.q-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.q-done { font-size: var(--fs-sm); color: var(--ok); }
.quarantine-form { margin-top: 12px; }

.diag-photo { border: 1px solid var(--panel-border); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 14px; }
.diag-photo-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.diag-photo-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.diag-photo-row select { flex: 1 1 200px; min-width: 0; background: var(--bg); color: var(--text); border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm); padding: 8px 10px; font: inherit; font-size: var(--fs-sm); }
.diag-photo-preview { display: block; max-width: 100%; max-height: 220px; border-radius: var(--radius-sm); margin: 10px 0 6px; }
.diag-photo-obs { margin: 6px 0; font-size: var(--fs-sm); line-height: 1.45; }
#diag-photo-result .calc-error { color: var(--danger); font-size: var(--fs-sm); }

.algae-q { margin-bottom: 6px; }
.algae-q .journal-label { margin: 8px 0 4px; }
.algae-opt[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--text); }
.algae-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.algae-card { border: 1px solid var(--panel-border); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 10px; }
.algae-card.algae-top { border-color: var(--accent); }
.algae-card > summary { cursor: pointer; list-style: none; }
.algae-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.algae-look { margin: 8px 0 4px; line-height: 1.45; }
.algae-guide .calc-list-title { margin-top: 10px; }
.algae-atlas { margin-top: 14px; }
.algae-atlas > summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.algae-rules { margin: 10px 0; }
.algae-guide-item { border-top: 1px solid var(--panel-border); padding: 8px 0; }
.algae-guide-item > summary { cursor: pointer; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.algae-sev { font-size: var(--fs-2xs); padding: 2px 8px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--muted) 18%, transparent); }
.algae-sev-medium { background: color-mix(in srgb, var(--warn) 25%, transparent); }
.algae-sev-high { background: color-mix(in srgb, var(--danger) 25%, transparent); }

/* Dół pulpitu na szerokim ekranie: zbiornik zajmuje 2/3 szerokości z obrazem i liczbami obok
   siebie, a proporcja NO3:PO4 i ostatnia podmiana stoją jedna nad drugą po lewej. Wcześniej trzy
   równe kolumny rozciągały się do wysokości karty zbiornika i zostawiały puste karty. */
@media (min-width: 961px) {
  body:not(.wall) .dash-bottom { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "np wc" "tank tank"; }
  body:not(.wall) .dash-bottom .np-scale-card { grid-area: np; }
  body:not(.wall) .dash-bottom .wc-compare-card { grid-area: wc; }
  body:not(.wall) .dash-bottom .tank-card { grid-area: tank; align-self: stretch; }
  body:not(.wall) .tank-card .tank-card-body { flex-direction: row; align-items: center; }
  body:not(.wall) .tank-card .tank-hero { flex: 1.35 1 0; }
  body:not(.wall) .tank-card .tank-facts { flex: 1 1 0; }
  body:not(.wall) .tank-card .device-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1181px) {
  body:not(.wall) .dash-bottom { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); grid-template-areas: "np tank" "wc tank";
    grid-template-rows: auto 1fr; }
}

.lang-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 6px; }
.lang-row .strip-field { flex: 1 1 200px; }

/* ---- Polityka prywatności (/privacy, publiczna strona dla Google Play) ---- */

.privacy-body {
  max-width: none;
  margin: 0;
  padding: 24px 16px 48px;
}

.privacy-card {
  max-width: 760px;
  margin: 0 auto;
  line-height: 1.6;
}

.privacy-card h1 { font-size: 1.6rem; margin: 8px 0 12px; }
.privacy-card h2 { font-size: var(--fs-lg); margin: 28px 0 8px; }
.privacy-card ul { padding-left: 20px; }
.privacy-card li { margin-bottom: 6px; }
.privacy-lang { text-align: right; font-size: var(--fs-sm); }
.privacy-lang a[aria-current] { font-weight: 700; text-decoration: none; }

.demo-banner {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 8px 16px;
  text-align: center;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: #10231f;
  background: var(--accent);
}

/* Źródło odczytu na kafelku: zielona kropka = czujnik, żółta + poświata = symulacja (demo);
   czerwona poświata = wartość poza zakresem albo alarm. */
.kpi-src { width: 9px; height: 9px; border-radius: 50%; flex: none; margin-right: 2px; display: none; }
.kpi-tile[data-source="sensor"] .kpi-src { display: inline-block; background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18), 0 0 8px rgba(52, 211, 153, 0.7); }
.kpi-tile[data-source="sim"] .kpi-src { display: inline-block; background: #facc15; box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.2), 0 0 8px rgba(250, 204, 21, 0.8); }
.kpi-tile[data-source="sim"] { border-color: rgba(250, 204, 21, 0.55); box-shadow: var(--shadow), 0 0 0 1px rgba(250, 204, 21, 0.5), 0 0 32px -4px rgba(250, 204, 21, 0.6); }
.kpi-tile[data-status="low"], .kpi-tile[data-status="high"], .kpi-tile[data-status="alarm"] {
  border-color: rgba(255, 84, 112, 0.7);
  box-shadow: var(--shadow), 0 0 0 1px rgba(255, 84, 112, 0.65), 0 0 34px -4px rgba(255, 84, 112, 0.7);
}
/* Odwiedziny strony /app (Ustawienia -> Aplikacja Android i Google Play) */
.promo-stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.promo-stat { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(45, 224, 199, 0.08); border: 1px solid var(--panel-border); }
.promo-stat strong { font: 600 1.5rem var(--font-display); color: var(--accent); }
.promo-stat span { font-size: var(--fs-xs); color: var(--text); }
.promo-stat small { font-size: var(--fs-xs); color: var(--muted); }
.promo-bars { display: flex; align-items: flex-end; gap: 2px; height: 48px; margin: 10px 0 4px; }
.promo-bars i { flex: 1; min-height: 2px; border-radius: var(--radius-xs) var(--radius-xs) 0 0; background: var(--accent); opacity: 0.8; }

/* Komunikat w oknie wykresu: brak danych albo błąd serwera zamiast pustej siatki */
.chart-modal-status { margin: 6px 0 0; padding: 8px 12px; border-radius: var(--radius-sm); font-size: var(--fs-sm);
  background: rgba(255, 180, 84, 0.12); border: 1px solid rgba(255, 180, 84, 0.4); color: var(--text); }
.chart-modal-status.is-error { background: rgba(255, 84, 112, 0.12); border-color: rgba(255, 84, 112, 0.5); }

/* ---- Gniazdka Tuya: światło i CO2 (pulpit + ustawienia) ---- */
.plug-dash { margin-bottom: 16px; }
.plug-dash[hidden] { display: none; }
.plug-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.plug-tile {
  --plug-glow: var(--sand-gold);
  position: relative; display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto;
  align-items: center; gap: 10px 14px; padding: 14px 16px; min-height: 0; text-align: left;
  color: var(--text); background: var(--glass-deep); border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg, var(--radius)); box-shadow: none; overflow: hidden;
  transition: border-color .25s ease, box-shadow .25s ease, background .25s ease;
}
.plug-tile[hidden] { display: none; }
.plug-tile-co2 { --plug-glow: var(--algae-glow); }
.plug-tile::before {
  content: ""; position: absolute; inset: -40% -20% auto auto; width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--plug-glow) 38%, transparent), transparent 70%);
  opacity: 0; transition: opacity .35s ease; pointer-events: none;
}
.plug-tile.is-on {
  border-color: color-mix(in srgb, var(--plug-glow) 60%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--plug-glow) 25%, transparent), 0 8px 28px color-mix(in srgb, var(--plug-glow) 22%, transparent);
}
.plug-tile.is-on::before { opacity: 1; }
.plug-tile-ico {
  position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius);
  color: var(--muted); background: color-mix(in srgb, var(--plug-glow) 10%, transparent);
  transition: color .25s ease, background .25s ease;
}
.plug-tile-ico svg { width: 24px; height: 24px; }
.plug-tile.is-on .plug-tile-ico { color: var(--plug-glow); background: color-mix(in srgb, var(--plug-glow) 22%, transparent); }
.plug-tile-light[aria-pressed="true"] .plug-tile-ico svg { animation: plug-spin 24s linear infinite; }
.plug-tile-co2[aria-pressed="true"] .plug-tile-ico svg circle { animation: plug-rise 2.4s ease-in-out infinite; transform-box: fill-box; }
.plug-tile-co2[aria-pressed="true"] .plug-tile-ico svg circle:nth-child(2) { animation-delay: .5s; }
.plug-tile-co2[aria-pressed="true"] .plug-tile-ico svg circle:nth-child(3) { animation-delay: 1s; }
@keyframes plug-spin { to { transform: rotate(360deg); } }
@keyframes plug-rise { 0%, 100% { transform: translateY(0); opacity: 1; } 50% { transform: translateY(-2px); opacity: .7; } }
.plug-tile-text { position: relative; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.plug-tile-text strong { font-family: var(--font-display); font-size: var(--fs-md); font-weight: 600; }
.plug-tile-text small { color: var(--muted); font-size: var(--fs-xs); line-height: 1.3; }
.plug-switch {
  position: relative; width: 46px; height: 26px; min-height: 0; min-width: 0; padding: 0; border: 0; box-shadow: none;
  border-radius: var(--radius-pill); flex: none; cursor: pointer;
  background: color-mix(in srgb, var(--muted) 30%, transparent); transition: background .25s ease;
}
/* Pole dotyku 46x46 wokół przełącznika, sam przełącznik zostaje smukły. */
.plug-switch::before { content: ""; position: absolute; inset: -10px -4px; }
.plug-switch:hover { transform: none; filter: brightness(1.1); }
.plug-switch:focus-visible { outline: 2px solid var(--plug-glow); outline-offset: 3px; }
.plug-switch:disabled { cursor: progress; }
.plug-switch i {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: transform .25s cubic-bezier(.3, 1.4, .5, 1);
}
.plug-tile.is-on .plug-switch { background: var(--plug-glow); }
.plug-tile.is-on .plug-switch i { transform: translateX(20px); background: #fff; }
.plug-tile.is-busy .plug-switch i { animation: plug-pulse .8s ease-in-out infinite; }
@keyframes plug-pulse { 50% { opacity: .4; } }
.plug-tile.is-error { border-color: color-mix(in srgb, var(--danger) 70%, transparent); }
.plug-tile.is-error .plug-tile-text small { color: var(--danger); }
/* pasek doby: godziny pracy i znacznik "teraz" */
.plug-day { position: relative; grid-column: 1 / -1; height: 6px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--muted) 18%, transparent); }
.plug-day b { position: absolute; top: 0; bottom: 0; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--plug-glow) 75%, transparent); }
.plug-day em { position: absolute; top: -4px; width: 2px; height: 14px; border-radius: var(--radius-xs); background: var(--ink); transform: translateX(-1px); }

.plug-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 10px 0; }
.plug-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: var(--radius); background: var(--glass-deep); border: 1px solid var(--glass-border); }
.plug-card-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.plug-card-head strong { display: block; }
.plug-card-head small { color: var(--muted); font-size: var(--fs-xs); }
.plug-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); }
.plug-ico svg { width: 20px; height: 20px; }
.plug-ico-light { color: var(--sand-gold); background: color-mix(in srgb, var(--sand-gold) 16%, transparent); }
.plug-ico-co2 { color: var(--algae-glow); background: color-mix(in srgb, var(--algae-glow) 16%, transparent); }
.plug-pill { font-size: var(--fs-2xs); padding: 3px 9px; border-radius: var(--radius-pill); white-space: nowrap; color: var(--muted); background: color-mix(in srgb, var(--muted) 16%, transparent); }
.plug-pill.on { color: var(--ok); background: color-mix(in srgb, var(--ok) 18%, transparent); }
.plug-pill.err { color: var(--danger); background: color-mix(in srgb, var(--danger) 16%, transparent); }
.plug-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.plug-fields input, .plug-fields select { width: 100%; box-sizing: border-box; }
/* Kafelek gniazdka: całe pole otwiera szczegóły, przełącznik leży nad nim i tylko przełącza. */
.plug-tile-open { position: absolute; inset: 0; z-index: 1; width: 100%; min-height: 0; padding: 0; margin: 0; border: 0;
  border-radius: inherit; background: transparent; box-shadow: none; cursor: pointer; }
.plug-tile-open:hover { transform: none; background: color-mix(in srgb, var(--plug-glow) 6%, transparent); }
.plug-tile-open:focus-visible { outline: 2px solid var(--plug-glow); outline-offset: -2px; }
.plug-tile .plug-tile-ico, .plug-tile .plug-tile-text, .plug-tile .plug-day { pointer-events: none; }
.plug-tile .plug-switch { z-index: 2; }
.plug-modal-content { max-width: 680px; }
.pm-state { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; margin-bottom: 12px;
  border-radius: var(--radius-sm); background: var(--glass-deep); border: 1px solid var(--glass-border); --plug-glow: var(--accent); }
.pm-state .plug-switch[aria-checked="true"] { background: var(--plug-glow); }
.pm-state .plug-switch[aria-checked="true"] i { transform: translateX(20px); background: #fff; }
.pm-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pm-stat { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--glass-deep); border: 1px solid var(--glass-border); min-width: 0; }
.pm-stat small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.pm-stat b { display: block; font-family: var(--font-mono); font-size: var(--fs-lg); font-variant-numeric: tabular-nums; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.pm-stat-main b { color: var(--accent); }
.pm-stat .pm-sub { margin-top: 2px; }
.pm-foot { margin-top: 12px; }
.pm-raw { margin-top: 12px; font-size: var(--fs-xs); color: var(--muted); }
.pm-raw summary { cursor: pointer; min-height: 32px; }
.pm-raw code { display: block; font-family: var(--font-mono); word-break: break-all; }
.pm-h { margin: 16px 0 6px; font-size: var(--fs-sm); }
.pm-h small { color: var(--muted); font-weight: 400; }
.pm-chart { display: block; width: 100%; height: 160px; border-radius: var(--radius-sm); background: var(--glass-deep); }
.pm-chart .pm-line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.pm-chart .pm-area { fill: color-mix(in srgb, var(--accent) 18%, transparent); }
.pm-chart .pm-grid { stroke: color-mix(in srgb, var(--muted) 20%, transparent); stroke-width: 1; vector-effect: non-scaling-stroke; }
.pm-chart .pm-bar { fill: color-mix(in srgb, var(--accent) 70%, transparent); }
.pm-chart .pm-bar.is-today { fill: var(--sand-gold); }
.pm-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: var(--fs-2xs); font-family: var(--font-mono); margin-top: 4px; }
@media (max-width: 560px) {
  .pm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pm-chart { height: 130px; }
}
.plug-meter-line { display: block; color: var(--muted); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.plug-meter-line[hidden], .plug-meter[hidden] { display: none; }
.plug-meter { display: grid; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--accent) 6%, transparent);
  border: 1px solid var(--glass-border); }
.plug-meter-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.plug-meter-stats small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.plug-meter-stats b { font-family: var(--font-mono); font-size: var(--fs-md); font-variant-numeric: tabular-nums; white-space: nowrap; }
.plug-meter-spark { width: 100%; height: 40px; color: var(--accent); }
.plug-meter-month { color: var(--muted); font-size: var(--fs-xs); }
@media (max-width: 420px) { .plug-meter-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.plug-guard { display: grid; gap: 6px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px dashed var(--glass-border); }
.plug-guard .strip-field { max-width: 160px; }
.plug-guard .strip-field input { width: 100%; box-sizing: border-box; }
.plug-guard .field-hint { margin: 0; }
.plug-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.plug-help { margin-top: 6px; font-size: var(--fs-sm); color: var(--muted); }
.plug-help summary { cursor: pointer; color: var(--text); }
.plug-help ol { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
@media (prefers-reduced-motion: reduce) {
  .plug-tile, .plug-tile::before, .plug-switch, .plug-switch i { transition: none; }
  .plug-tile-ico svg, .plug-tile-ico svg circle, .plug-tile.is-busy .plug-switch i { animation: none !important; }
}

/* ---- Kreator gniazdek Tuya ---- */
.plug-wizard-cta { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin: 4px 0 10px;
  padding: 12px 14px; border-radius: var(--radius); border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent); }
.plug-wizard-cta strong { display: block; }
.plug-wizard-cta small { color: var(--muted); font-size: var(--fs-xs); }
.plug-wizard-cta-ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-sm); color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent); }
.plug-wizard-cta-ico svg { width: 20px; height: 20px; }
@media (max-width: 560px) { .plug-wizard-cta { grid-template-columns: auto 1fr; } .plug-wizard-cta button { grid-column: 1 / -1; } }

.plugwiz { max-width: 720px; width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; }
.wiz-steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 4px 0 16px; counter-reset: none; }
.wiz-steps li { flex: 1; display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--muted);
  padding-top: 8px; border-top: 3px solid color-mix(in srgb, var(--muted) 25%, transparent); transition: border-color .25s, color .25s; }
.wiz-steps li span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: var(--fs-xs); font-weight: 600;
  background: color-mix(in srgb, var(--muted) 20%, transparent); }
.wiz-steps li.is-current { color: var(--text); border-color: var(--accent); }
.wiz-steps li.is-current span { background: var(--accent); color: var(--bg); }
.wiz-steps li.is-done { color: var(--text); border-color: color-mix(in srgb, var(--ok) 60%, transparent); }
.wiz-steps li.is-done span { background: color-mix(in srgb, var(--ok) 25%, transparent); color: var(--ok); }
.wiz-steps li.is-done span::after { content: "✓"; }
.wiz-steps li.is-done span { font-size: 0; }
.wiz-steps li.is-done span::after { font-size: var(--fs-xs); }
.wiz-step { display: flex; flex-direction: column; gap: 12px; }
.wiz-lead { margin: 0; line-height: 1.5; }
.wiz-status { font-size: var(--fs-sm); min-height: 1.2em; }
.wiz-status.ok { color: var(--ok); }
.wiz-status.err { color: var(--danger); }
.wiz-progress { position: relative; height: 4px; border-radius: var(--radius-pill); overflow: hidden; background: color-mix(in srgb, var(--muted) 20%, transparent); }
.wiz-progress i { position: absolute; top: 0; bottom: 0; width: 35%; border-radius: var(--radius-pill); background: var(--accent); animation: wiz-slide 1.3s ease-in-out infinite; }
@keyframes wiz-slide { from { left: -35%; } to { left: 100%; } }
.wiz-log pre { max-height: 160px; overflow: auto; font-size: var(--fs-2xs); white-space: pre-wrap; }
.wiz-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.wiz-guide { margin: 0; padding: 0; list-style: none; counter-reset: wiz; display: flex; flex-direction: column; gap: 10px; }
.wiz-guide li { counter-increment: wiz; position: relative; padding: 10px 12px 10px 46px; border-radius: var(--radius-sm); line-height: 1.45; font-size: var(--fs-sm);
  background: var(--glass-deep); border: 1px solid var(--glass-border); }
.wiz-guide li::before { content: counter(wiz); position: absolute; left: 12px; top: 10px; display: grid; place-items: center; width: 24px; height: 24px;
  border-radius: 50%; font-size: var(--fs-xs); font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.wiz-guide .button-link { display: inline-block; margin-top: 8px; }
.wiz-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.wiz-fields input, .wiz-fields select { width: 100%; box-sizing: border-box; }
.wiz-devices { display: flex; flex-direction: column; gap: 10px; }
.wiz-dev { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--glass-deep); border: 1px solid var(--glass-border); transition: border-color .25s, box-shadow .25s; }
.wiz-dev.is-light { border-color: color-mix(in srgb, var(--sand-gold) 65%, transparent); box-shadow: 0 0 22px color-mix(in srgb, var(--sand-gold) 16%, transparent); }
.wiz-dev.is-co2 { border-color: color-mix(in srgb, var(--algae-glow) 65%, transparent); box-shadow: 0 0 22px color-mix(in srgb, var(--algae-glow) 16%, transparent); }
.wiz-dev-ico { grid-row: span 2; display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-sm); color: var(--muted);
  background: color-mix(in srgb, var(--muted) 14%, transparent); }
.wiz-dev-ico svg { width: 22px; height: 22px; }
.wiz-dev-name { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.wiz-dev-name strong { font-size: var(--fs-md); }
.wiz-dev-name small { color: var(--muted); font-size: var(--fs-xs); }
.wiz-dev-net { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--muted); }
.wiz-chip { padding: 2px 8px; border-radius: var(--radius-pill); font-size: var(--fs-xs); background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.wiz-chip.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.wiz-dev-net input { width: 150px; padding: 4px 8px; min-height: 30px; }
.wiz-dev-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.wiz-dev-actions button { min-height: 36px; padding: 6px 12px; }
.wiz-dev-actions .wiz-assign-light[aria-pressed="true"] { background: var(--sand-gold); color: #231400; }
.wiz-dev-actions .wiz-assign-co2[aria-pressed="true"] { background: var(--algae-glow); color: #00211c; }
.wiz-dev-msg { grid-column: 1 / -1; font-size: var(--fs-xs); }
.wiz-dev-msg.ok { color: var(--ok); } .wiz-dev-msg.err { color: var(--danger); } .wiz-dev-msg.warn { color: var(--warn); }
@media (prefers-reduced-motion: reduce) { .wiz-progress i { animation: none; left: 0; width: 100%; opacity: .5; } }

/* ---- Koszty prądu ---- */
.energy-panel { display: flex; flex-direction: column; gap: 14px; }
.en-hero { display: grid; grid-template-columns: minmax(220px, 0.8fr) 1.6fr; gap: 20px; align-items: stretch; }
@media (max-width: 820px) { .en-hero { grid-template-columns: 1fr; } }
.en-hero-main { display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 18px 20px; border-radius: var(--radius-lg, var(--radius));
  background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%), var(--glass-deep);
  border: 1px solid var(--glass-border); }
.en-eyebrow { font-size: var(--fs-2xs); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.en-cost { font-family: var(--font-display); font-size: clamp(2.2rem, 5vw, 3rem); line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.en-sub { font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.en-split-wrap { display: flex; flex-direction: column; gap: 12px; justify-content: center; min-width: 0; }
.en-split { display: flex; gap: 2px; height: 14px; border-radius: var(--radius-pill); overflow: hidden; background: color-mix(in srgb, var(--muted) 14%, transparent); }
.en-split i { flex-basis: 0; min-width: 3px; }
.en-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.en-legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) 80px 84px 44px; grid-template-rows: auto 3px; align-items: center;
  column-gap: 12px; row-gap: 6px; padding: 9px 2px; border-bottom: 1px solid color-mix(in srgb, var(--muted) 12%, transparent); }
.en-legend li:last-child { border-bottom: none; }
.en-legend li.is-zero { opacity: .5; }
.en-swatch { width: 12px; height: 12px; border-radius: var(--radius-xs); }
.en-name { display: flex; flex-direction: column; min-width: 0; }
.en-name strong { font-size: var(--fs-md); font-weight: 600; }
.en-name small { font-size: var(--fs-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.en-num { text-align: right; font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.en-strong { color: var(--text); font-weight: 600; }
.en-pct { color: var(--text); }
.en-bar { grid-column: 2 / -1; height: 3px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--muted) 12%, transparent); overflow: hidden; }
.en-bar i { display: block; height: 100%; border-radius: var(--radius-pill); }
@media (max-width: 520px) {
  .en-legend li { grid-template-columns: 12px minmax(0, 1fr) auto auto; }
  .en-legend li .en-kwh { display: none; }
}
.en-chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.en-h3 { margin: 4px 0 0; font-family: var(--font-display); font-size: var(--fs-md); font-weight: 600; }
.energy-chart { height: 260px; }
.en-tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.en-tip { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; padding: 14px; border-radius: var(--radius);
  background: var(--glass-deep); border: 1px solid var(--glass-border); }
.en-tip-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.en-tip-ico svg { width: 20px; height: 20px; }
.en-tip div { display: flex; flex-direction: column; gap: 2px; }
.en-tip-value { font-family: var(--font-display); font-size: var(--fs-xl); color: var(--ok); font-variant-numeric: tabular-nums; }
.en-tip-title { font-size: var(--fs-sm); font-weight: 600; }
.en-tip small { font-size: var(--fs-xs); color: var(--muted); line-height: 1.4; }

/* ---- Ustawienia i Akwarium na telefonie: lista kategorii jak w Androidzie, sekcja z powrotem ---- */
.subtab-text { display: inline-flex; flex-direction: column; }
.subtab-desc, .settings-back { display: none; }
@media (max-width: 700px) {
  .m-list .settings-subtabs { flex-direction: column; overflow: visible; padding: 4px 0; gap: 0; background: var(--glass-deep);
    border: 1px solid var(--glass-border); border-radius: var(--radius-lg, var(--radius)); mask-image: none; -webkit-mask-image: none; }
  .m-list .settings-subtab-btn { display: grid; grid-template-columns: 40px 1fr 14px; align-items: center; gap: 14px; width: 100%;
    min-height: 64px; padding: 10px 16px; border-radius: 0; text-align: left; color: var(--text); background: transparent; box-shadow: none;
    animation: none; white-space: normal; }
  .m-list .settings-subtab-btn + .settings-subtab-btn { border-top: 1px solid color-mix(in srgb, var(--muted) 14%, transparent); }
  .m-list .settings-subtab-btn.active { background: transparent; color: var(--text); }
  .m-list .settings-subtab-btn:active { background: color-mix(in srgb, var(--accent) 10%, transparent); }
  .m-list .settings-subtab-btn .icon-inline { margin: 0; display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-sm);
    color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
  .m-list .settings-subtab-btn .icon-inline svg { width: 20px; height: 20px; }
  .m-list .settings-subtab-btn::after { content: "›"; font-size: var(--fs-xl); line-height: 1; color: var(--muted); }
  .m-list .subtab-title { font-size: var(--fs-md); font-weight: 600; }
  .m-list .subtab-desc { display: block; font-size: var(--fs-xs); font-weight: 400; color: var(--muted); line-height: 1.3; margin-top: 2px; }
  /* tryb listy: tylko kategorie */
  .m-list.settings-menu .settings-section { display: none !important; }
  /* tryb sekcji: bez listy, z przyciskiem powrotu */
  .m-list.settings-detail .settings-subtabs { display: none; }
  .m-list.settings-detail .settings-back { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 48px; margin-bottom: 12px;
    padding: 8px 14px; border-radius: var(--radius); color: var(--accent); background: var(--glass-deep); border: 1px solid var(--glass-border);
    box-shadow: none; font-weight: 600; text-align: left; }
  .m-list .settings-back > span[aria-hidden] { font-size: var(--fs-xl); line-height: 1; margin-top: -2px; }
  .m-list .settings-back-title { margin-left: auto; color: var(--muted); font-weight: 400; font-size: var(--fs-sm); }
}
@media (min-width: 701px) {
  /* kategorie zawijają się do drugiego rzędu zamiast chować za krawędzią */
  .m-list .settings-subtabs { flex-wrap: wrap; overflow: visible; }
}

/* ---- Telefon: nic nie wychodzi poza ekran, cele dotykowe min. ~40 px ---- */
.promo-stats-row { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.promo-stat { min-width: 0; }
.promo-stat span, .promo-stat small { overflow-wrap: anywhere; }
.strip-field select, .strip-field input { max-width: 100%; box-sizing: border-box; }
@media (pointer: coarse), (max-width: 700px) {
  input[type="time"], input[type="date"], input[type="month"], select { min-height: 40px; }
  input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; }
  .export-csv-link { display: inline-flex; align-items: center; min-height: 40px; padding: 0 4px; }
  #cal-prev, #cal-next { min-width: 44px; }
  .field-hint a { display: inline-block; padding: 8px 0; }
}
/* pole w siatce nie może rozpychać się do długości najdłuższej opcji listy */
.strip-field > * { min-width: 0; }
.strip-field select { width: 100%; text-overflow: ellipsis; }
.chart-modal-header h3 { flex: 1 1 auto; min-width: 0; }
.chart-modal-header > button { flex: none; white-space: nowrap; }
@media (max-width: 420px) { .chart-modal-header > button { padding: 8px 12px; } }

/* ---- Karta Raspberry Pi (Logi → Stan sprzętu) ---- */
.pi-card { grid-column: 1 / -1; padding: 16px; border-radius: var(--radius-lg, var(--radius)); background: var(--glass-deep);
  border: 1px solid var(--glass-border); border-left: 4px solid var(--ok); display: flex; flex-direction: column; gap: 12px; }
.pi-card.sys-warn { border-left-color: var(--warn); }
.pi-card.sys-error { border-left-color: var(--danger); }
.pi-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pi-card-head strong { display: block; font-family: var(--font-display); font-size: var(--fs-lg); }
.pi-card-head small { color: var(--muted); font-size: var(--fs-xs); }
.pi-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 10px; }
.pi-tile { --lvl: var(--ok); display: flex; flex-direction: column; gap: 3px; padding: 12px; border-radius: var(--radius-sm); min-width: 0;
  background: color-mix(in srgb, var(--panel) 60%, transparent); border: 1px solid color-mix(in srgb, var(--muted) 14%, transparent); }
.pi-tile.pi-warn { --lvl: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.pi-tile.pi-alarm { --lvl: var(--danger); border-color: color-mix(in srgb, var(--danger) 60%, transparent);
  background: color-mix(in srgb, var(--danger) 10%, transparent); }
.pi-tile-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.pi-tile-label { font-size: var(--fs-xs); color: var(--muted); }
.pi-tile-word { font-size: var(--fs-2xs); font-weight: 600; padding: 1px 7px; border-radius: var(--radius-pill); color: var(--lvl);
  background: color-mix(in srgb, var(--lvl) 16%, transparent); white-space: nowrap; }
.pi-tile-value { color: var(--text); font-family: var(--font-display); font-size: var(--fs-xl); font-variant-numeric: tabular-nums; line-height: 1.15; overflow-wrap: anywhere; }
.pi-tile-sub { font-size: var(--fs-xs); color: var(--muted); line-height: 1.35; }
.pi-meter { height: 4px; border-radius: var(--radius-pill); margin-top: 4px; background: color-mix(in srgb, var(--muted) 18%, transparent); overflow: hidden; }
.pi-meter i { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--lvl); }
.pi-issues { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); line-height: 1.45; }
.pi-ok { margin: 0; font-size: var(--fs-sm); color: var(--ok); }
.pi-raw { margin: 0; font-size: var(--fs-2xs); color: var(--muted); font-family: var(--font-mono); }
.pi-card-head .sys-state { white-space: nowrap; }
@media (max-width: 420px) { .pi-card { padding: 12px; } .pi-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .pi-tile { padding: 10px; } .pi-tile-value { font-size: var(--fs-lg); } }
/* kafelek zasilania: szerszy, ze skalą woltów */
.pi-supply { grid-column: span 2; }
@media (max-width: 420px) { .pi-supply { grid-column: 1 / -1; } }
.pi-supply-drop { color: var(--text); font-size: var(--fs-sm); display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; }
.pi-supply-drop strong { color: var(--lvl); font-variant-numeric: tabular-nums; }
.pi-scale { position: relative; height: 12px; margin: 10px 0 2px; border-radius: var(--radius-pill); overflow: visible;
  background: color-mix(in srgb, var(--muted) 14%, transparent); }
.pi-zone { position: absolute; top: 0; bottom: 0; opacity: .55; }
.pi-zone:first-child { border-radius: var(--radius-pill) 0 0 var(--radius-pill); }
.pi-zone:nth-child(4) { border-radius: 0 var(--radius-pill) var(--radius-pill) 0; }
.pi-zone.z-bad { background: var(--danger); }
.pi-zone.z-warn { background: var(--warn); }
.pi-zone.z-ok { background: var(--ok); }
.pi-mark { position: absolute; top: -4px; width: 4px; height: 20px; margin-left: -2px; border-radius: var(--radius-xs); background: var(--ink);
  box-shadow: 0 0 0 2px var(--panel); }
.pi-range { position: absolute; top: -3px; height: 18px; border-radius: var(--radius-pill); border: 2px solid var(--ink);
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--ink) 28%, transparent) 0 3px, transparent 3px 7px);
  font-size: var(--fs-2xs); line-height: 14px; text-align: center; color: var(--ink); font-weight: 700; box-sizing: border-box; }
.pi-ticks { position: relative; height: 16px; font-size: var(--fs-2xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.pi-ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.pi-ticks span.is-nominal { color: var(--text); font-weight: 600; }
.table-scroll:focus-visible, .heatmap-wrap:focus-visible, .co2-table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }
/* stan Pi obok "Pulpit · odczyt…": miejsce zarezerwowane, żeby kafelki nie przeskakiwały po wczytaniu */
.dash-kicker-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 34px; }
.dash-kicker-row .sys-chip { min-height: 34px; padding: 0 10px; font-size: var(--fs-xs); }
#night-report { margin: 12px 0 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- pierwszy ekran na telefonie ----
   Nagłówek w jednym wierszu (logo + ikony), podmiana wody jako główna akcja
   na całą szerokość, a pod nią dwie drugorzędne obok siebie. Przycisk
   asystenta jest mniejszy i nie zasłania treści na końcu strony. */
@media (max-width: 560px) {
  .app-title-row { flex-wrap: nowrap; gap: var(--space-2); margin-bottom: 10px; }
  .app-subtitle { display: none; }
  .app-logo img { width: 40px; height: 40px; }
  .app-tools { gap: 6px; }
  .app-tools .icon-btn, .logout-btn { width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: var(--radius-sm); }
  .logout-btn { display: inline-grid; place-items: center; }
  .logout-btn .icon-inline { margin: 0; }
  .logout-text { display: none; }
  .dash-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
  .dash-actions #btn-open-wc-modal { grid-column: 1 / -1; order: -1; }
  .dash-actions button { min-height: 44px; padding: 8px 10px; font-size: var(--fs-sm); line-height: 1.2; }
}
@media (max-width: 720px) {
  .chat-fab { width: 48px; height: 48px; min-height: 48px; padding: 0; justify-content: center; border-radius: 50%; right: 12px; }
  body { padding-bottom: 150px; }
  .kpi-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* Pusty kafelek KPI i drobne teksty pulpitu */
.kpi-value.is-empty > span:first-child { color: var(--muted); opacity: 0.7; font-weight: 500; letter-spacing: 0.08em; }
.kpi-value.is-empty small { display: none; }
.kpi-caption, .kpi-tile .card-sub, .tank-fact-water .card-sub { font-size: var(--fs-xs); }
.day-lane-empty { font-size: var(--fs-xs); }
.day-hour-near { visibility: hidden; }
.day-now-label { top: -17px; padding: 0 4px; border-radius: var(--radius-xs); background: var(--panel); }
.day-now-label-left { left: auto; right: 4px; }
@media (max-width: 640px) {
  .day-legend { gap: 6px 12px; }
  .day-now-label { display: block; }
  .day-hour-near { display: none; }
}

/* ---- Okna szczegółów kart pulpitu ---- */
.dash-more { min-height: 32px; padding: 4px 10px; font-size: var(--fs-xs); border-radius: var(--radius-pill); color: var(--accent);
  background: transparent; border: 1px solid var(--glass-border); box-shadow: none; margin-left: auto; }
.dash-more:hover { transform: none; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.tank-fact[data-detail], .device[data-detail] { cursor: pointer; transition: border-color .2s ease, background .2s ease; }
.tank-fact[data-detail]:hover, .device[data-detail]:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.tank-fact[data-detail]:focus-visible, .device[data-detail]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dd-content { max-width: 760px; }
.dd-body { display: grid; gap: 12px; }
.dd-sec { min-width: 0; }
.dd-h { margin: 4px 0 8px; font-size: var(--fs-sm); }
.dd-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.dd-table th, .dd-table td { padding: 8px; text-align: left; border-bottom: 1px solid color-mix(in srgb, var(--muted) 14%, transparent); vertical-align: top; }
.dd-table thead th { color: var(--muted); font-weight: 500; font-size: var(--fs-xs); }
.dd-table td b { display: block; font-family: var(--font-mono); font-size: var(--fs-md); }
.dd-table td small, .dd-range { display: block; color: var(--muted); font-size: var(--fs-xs); font-weight: 400; }
.dd-table td[data-zone="ok"] { color: var(--ok); }
.dd-table td[data-zone="algae"], .dd-table td[data-zone="cyano"] { color: var(--warn); }
.dd-bar { display: block; height: 5px; margin: 4px 0; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--muted) 20%, transparent); overflow: hidden; }
.dd-bar i { display: block; height: 100%; background: var(--ok); }
.dd-bar i[data-level="warn"] { background: var(--warn); }
.dd-bar i[data-level="bad"] { background: var(--danger); }
.dd-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dd-score { display: flex; align-items: baseline; gap: 4px; }
.dd-score-num { font-family: var(--font-mono); font-size: 2.6rem; line-height: 1; }
.dd-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.dd-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dd-list li { display: grid; gap: 2px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--glass-deep); border: 1px solid var(--glass-border); }
.dd-list small { color: var(--muted); font-size: var(--fs-xs); }
.dd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dd-chip { font-size: var(--fs-xs); padding: 4px 10px; border-radius: var(--radius-pill); border: 1px solid var(--glass-border); background: var(--glass-deep); }
.dd-chip.hl-alarm, .hl-text-alarm { color: var(--danger); }
.dd-chip.hl-warning, .hl-text-warning { color: var(--warn); }
.dd-chip.hl-ok { color: var(--ok); }
.dd-wc { display: grid; gap: 4px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--glass-deep); border: 1px solid var(--glass-border); font-size: var(--fs-sm); }
.dd-wc-rows { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: var(--fs-xs); font-family: var(--font-mono); }
.dd-wc-rows .warn { color: var(--warn); }
.dd-health-grid { max-width: 100%; }
/* W karcie z przyciskiem szczegółów: tytuł i przycisk w jednym wierszu, opis pod spodem. */
.dash-card-head:has(.dash-more) { flex-wrap: wrap; }
.dash-card-head:has(.dash-more) > .dash-card-title { flex: 1 1 auto; min-width: 0; }
.dash-card-head:has(.dash-more) > .dash-card-note, .dash-card-head:has(.dash-more) > .health-legend { order: 3; flex-basis: 100%; margin-top: -6px; }
.dash-card-head > .dash-more { order: 2; flex: none; }
