/* Monitoring Portal — warstwa wizualna marki kulinski.tech (makiety zaakceptowane 09.10.2026).
   Paleta: DATA/brand_guidelines.md. Statusy: GREEN leśna zieleń, YELLOW ochra, RED miedź, NO_DATA pusty przerywany pierścień. */

:root {
  --bg: #F5F2E9;
  --card: #FFFDF7;
  --card-soft: #FAF7EE;
  --line: #D3D5C8;
  --line-soft: #E4E3D8;
  --text: #203C32;
  --brand: #234C3B;
  --brand-deep: #1C3F31;
  --copper: #AD4728;
  --copper-soft: #F4E4DC;
  --muted: #5B675D;
  --lime: #E3EAAC;
  --on-brand: #F5F2E9;
  --on-brand-muted: #B9C7BC;

  --s-green: #2F6B4F;
  --s-green-soft: #E6EEE7;
  --s-yellow: #C9962E;
  --s-yellow-text: #855F12;
  --s-yellow-soft: #F6EDD6;
  --s-red: #AD4728;
  --s-red-soft: #F4E4DC;
  --s-nodata: #8F968C;
  --s-nodata-soft: #ECEBE3;

  --serif: Georgia, "Times New Roman", serif;
  --sans: "Avenir Next", Avenir, "Segoe UI", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 4px;
  --shadow: 0 1px 2px rgba(32, 60, 50, 0.04), 0 6px 18px rgba(32, 60, 50, 0.05);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

button:hover {
  background: var(--brand-deep);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
}

a {
  color: var(--brand);
}

.secondary,
.ghost-button {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--line);
}

.secondary:hover,
.ghost-button:hover {
  background: var(--card-soft);
  border-color: var(--brand);
}

.hidden {
  display: none !important;
}

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

.muted {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.message {
  min-height: 1.5em;
  color: var(--copper);
  font-size: 14px;
}

.mono {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
}

.badge,
.own-system-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card-soft);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.empty-state {
  color: var(--muted);
  font-size: 14px;
}

.panel-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12.5px;
}

.section-title {
  font-size: 26px;
}

.section-title span {
  color: var(--muted);
}

.wordmark {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.1;
  color: var(--on-brand);
  letter-spacing: -0.01em;
}

.wordmark em {
  font-style: italic;
}

.wordmark-sub {
  margin-top: 4px;
  color: var(--on-brand-muted);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---------- Lampki statusu ---------- */

.lamp {
  --lamp: var(--s-green);
  --lamp-rgb: 47, 107, 79;
  --size: 16px;
  --halo: 1;
  position: relative;
  display: inline-block;
  flex: none;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: var(--lamp);
  box-shadow: 0 0 0 calc(var(--halo) * 4px) rgba(var(--lamp-rgb), 0.12);
}

.lamp-GREEN {
  animation: lamp-breathe 3.8s ease-in-out infinite;
}

.lamp-YELLOW {
  --lamp: var(--s-yellow);
  --lamp-rgb: 201, 150, 46;
}

.lamp-YELLOW::after,
.lamp-RED::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--lamp);
  opacity: 0;
  pointer-events: none;
}

.lamp-YELLOW::after {
  animation: lamp-ring 1.9s ease-out infinite;
}

.lamp-RED {
  --lamp: var(--s-red);
  --lamp-rgb: 173, 71, 40;
  animation: lamp-pop 0.9s var(--ease) 1 both;
}

.lamp-RED::after {
  animation: lamp-ring 1.4s ease-out 0.15s 1;
}

.lamp-NO_DATA {
  --lamp: var(--s-nodata);
  background: transparent;
  border: 2px dashed var(--s-nodata);
  box-shadow: none;
  animation: none;
}

.lamp-NO_DATA::after {
  content: none;
}

.lamp-xs {
  --size: 9px;
  --halo: 0.5;
  animation: none;
}

.lamp-xs::after {
  content: none;
}

.lamp-xs.lamp-NO_DATA {
  border-width: 1.5px;
}

.lamp-lg {
  --size: 26px;
  --halo: 1.6;
}

.lamp-xl {
  --size: 52px;
  --halo: 2.6;
}

.lamp-xl.lamp-NO_DATA,
.lamp-lg.lamp-NO_DATA {
  border-width: 3px;
}

@keyframes lamp-breathe {
  0%,
  100% {
    box-shadow: 0 0 0 calc(var(--halo) * 3px) rgba(var(--lamp-rgb), 0.12), 0 0 calc(var(--halo) * 6px) rgba(var(--lamp-rgb), 0.18);
  }
  50% {
    box-shadow: 0 0 0 calc(var(--halo) * 6px) rgba(var(--lamp-rgb), 0.07), 0 0 calc(var(--halo) * 16px) rgba(var(--lamp-rgb), 0.32);
  }
}

@keyframes lamp-ring {
  0% {
    opacity: 0.7;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(2.4);
  }
}

@keyframes lamp-pop {
  0% {
    transform: scale(0.6);
    box-shadow: 0 0 0 0 rgba(var(--lamp-rgb), 0.45);
  }
  60% {
    transform: scale(1.08);
    box-shadow: 0 0 0 calc(var(--halo) * 9px) rgba(var(--lamp-rgb), 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 calc(var(--halo) * 4px) rgba(var(--lamp-rgb), 0.12);
  }
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px;
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill.status-GREEN {
  background: var(--s-green-soft);
  color: var(--s-green);
}

.status-pill.status-YELLOW {
  background: var(--s-yellow-soft);
  color: var(--s-yellow-text);
}

.status-pill.status-RED {
  background: var(--s-red-soft);
  color: var(--s-red);
}

.status-pill.status-NO_DATA {
  background: var(--s-nodata-soft);
  color: var(--muted);
}

.status-text-GREEN {
  color: var(--s-green);
}

.status-text-YELLOW {
  color: var(--s-yellow-text);
}

.status-text-RED {
  color: var(--s-red);
}

.status-text-NO_DATA {
  color: var(--muted);
}

.tiny-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  vertical-align: 1px;
}

.tiny-dot.GREEN {
  background: var(--s-green);
}

.tiny-dot.YELLOW {
  background: var(--s-yellow);
}

.tiny-dot.RED {
  background: var(--s-red);
}

.tiny-dot.NO_DATA {
  border: 1.5px dashed var(--s-nodata);
}

/* ---------- Wykresy ---------- */

.spark {
  display: block;
  width: 100%;
  height: 34px;
  overflow: visible;
  color: var(--s-green);
  animation: chart-reveal 1.1s var(--ease) 0.15s both;
}

.spark-YELLOW {
  color: var(--s-yellow);
}

.spark-RED {
  color: var(--s-red);
}

.spark-NO_DATA {
  color: var(--s-nodata);
}

.spark-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.spark-NO_DATA .spark-line {
  stroke-dasharray: 3 3;
}

.spark-area {
  opacity: 0.9;
}

.spark-note,
.spark-caption,
.summary-spark figcaption {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.spark-placeholder {
  display: block;
  width: 100%;
  height: 2px;
  margin-top: 16px;
  background: linear-gradient(90deg, var(--line-soft), var(--line), var(--line-soft));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes chart-reveal {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ---------- Logowanie ---------- */

.auth-view {
  display: grid;
  grid-template-columns: minmax(280px, 42%) minmax(0, 1fr);
  min-height: 100vh;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 48px 56px;
  background: var(--brand);
  color: var(--on-brand);
}

.auth-brand .wordmark {
  font-size: 34px;
}

.auth-brand .wordmark-sub {
  margin-bottom: auto;
  padding-bottom: 32px;
}

.auth-legend {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--on-brand);
  font-size: 15px;
}

.auth-legend li {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-legend .lamp-NO_DATA {
  border-color: var(--on-brand-muted);
}

.auth-panel {
  align-self: center;
  justify-self: center;
  width: min(420px, calc(100% - 32px));
  padding: 40px 0;
  animation: rise 0.6s var(--ease) both;
}

.auth-panel h1 {
  font-size: 40px;
  line-height: 1.1;
}

.auth-panel > .muted {
  margin: 10px 0 28px;
}

.form-stack {
  display: grid;
  gap: 16px;
}

.form-stack label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.form-stack input {
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font-size: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-stack input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(35, 76, 59, 0.12);
  outline: none;
}

.form-stack button {
  min-height: 46px;
  margin-top: 6px;
}

.secret-box {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--card);
  font-family: var(--mono);
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* ---------- Powłoka portalu ---------- */

.portal-view {
  --sidebar-w: 248px;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  background: linear-gradient(90deg, var(--brand) 0 var(--sidebar-w), transparent var(--sidebar-w));
}

.portal-view.sidebar-collapsed {
  --sidebar-w: 78px;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100vh;
  padding: 28px 16px 24px;
  background: var(--brand);
  color: var(--on-brand);
  overflow: hidden auto;
}

.brand {
  position: relative;
  padding: 0 10px 0 12px;
  min-height: 48px;
}

.sidebar-toggle {
  position: absolute;
  top: -6px;
  right: -4px;
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--on-brand-muted);
}

.sidebar-toggle:hover {
  background: rgba(245, 242, 233, 0.08);
  color: var(--on-brand);
}

.sidebar-toggle svg,
.side-icon,
.search-box svg,
.pulse-mark svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side-nav {
  display: grid;
  gap: 4px;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--on-brand-muted);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 400;
  text-align: left;
}

.side-link:hover {
  background: rgba(245, 242, 233, 0.07);
  color: var(--on-brand);
}

.side-link.active {
  border-left-color: var(--lime);
  background: rgba(245, 242, 233, 0.1);
  color: var(--on-brand);
}

.side-icon {
  flex: none;
  width: 22px;
  height: 22px;
}

.sidebar-status {
  display: grid;
  gap: 6px;
  margin-top: auto;
  padding: 18px 12px 0;
  border-top: 1px solid rgba(245, 242, 233, 0.16);
  color: var(--on-brand-muted);
  font-size: 13px;
}

.sidebar-status strong {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 400;
  color: var(--on-brand);
}

.sidebar-status-row {
  display: flex;
  justify-content: space-between;
}

.sidebar-status-row b {
  color: var(--on-brand);
}

.progress-track {
  width: 100%;
  height: 4px;
  border: 0;
  border-radius: 2px;
  appearance: none;
  background: rgba(245, 242, 233, 0.16);
  overflow: hidden;
}

.progress-track::-webkit-progress-bar {
  background: rgba(245, 242, 233, 0.16);
}

.progress-track::-webkit-progress-value {
  background: var(--lime);
}

.progress-track::-moz-progress-bar {
  background: var(--lime);
}

.sidebar-status .secondary {
  margin-top: 8px;
  min-height: 36px;
  border-color: rgba(245, 242, 233, 0.24);
  color: var(--on-brand);
  font-size: 13px;
}

.sidebar-status .secondary:hover {
  background: rgba(245, 242, 233, 0.08);
  border-color: var(--on-brand-muted);
}

.sidebar-collapsed .sidebar {
  padding-inline: 10px;
}

.sidebar-collapsed .brand {
  padding: 0;
}

.sidebar-collapsed .brand .wordmark,
.sidebar-collapsed .brand .wordmark-sub,
.sidebar-collapsed .side-label,
.sidebar-collapsed .sidebar-status {
  display: none;
}

.sidebar-collapsed .sidebar-toggle {
  position: static;
  margin: 0 auto;
}

.sidebar-collapsed .side-link {
  justify-content: center;
  padding: 0;
}

.portal-main {
  min-width: 0;
  padding: 26px 40px 56px;
}

.topbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 14px 20px;
  margin-bottom: 26px;
}

.title-block {
  flex: 1 1 auto;
  min-width: 0;
}

.topbar-eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

body[data-view="system"] .topbar-eyebrow,
body[data-view="evidence"] .topbar-eyebrow {
  display: none;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.breadcrumbs > span:last-child {
  color: var(--text);
}

.crumb {
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 400;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 4px;
}

.crumb:hover {
  background: transparent;
  color: var(--brand);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 1 280px;
  min-width: 160px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--muted);
}

.search-box:focus-within {
  border-color: var(--brand);
}

.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  color: var(--text);
}

.search-box kbd {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 11px;
}

.top-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 12px;
}

.freshness {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.35;
}

.freshness-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--s-green);
}

.freshness-stale .freshness-dot {
  background: var(--s-yellow);
}

.freshness-text {
  display: grid;
}

#freshnessData {
  color: var(--text);
}

.freshness-stale #freshnessData {
  color: var(--s-yellow-text);
}

.probe-run-button {
  min-height: 38px;
  font-size: 13.5px;
  white-space: nowrap;
}

.probe-run-button:disabled {
  opacity: 0.75;
  cursor: progress;
}

.ghost-button {
  min-height: 38px;
  font-size: 13.5px;
}

.avatar-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 14px 0 4px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-weight: 500;
}

.avatar-button:hover {
  background: var(--card-soft);
}

.avatar-button > span {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--on-brand);
  font-family: var(--serif);
  font-size: 13px;
}

.avatar-button strong {
  font-size: 13.5px;
  font-weight: 500;
}

/* ---------- Kokpit ---------- */

.dashboard-top {
  margin-bottom: 30px;
  animation: view-in 0.4s var(--ease) both;
}

.greeting {
  margin-bottom: 26px;
}

.greeting h1 {
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.08;
}

.marker {
  font-style: italic;
  padding: 0 0.06em;
  background-image: linear-gradient(var(--lime), var(--lime));
  background-repeat: no-repeat;
  background-size: 100% 0.2em;
  background-position: 0 92%;
  animation: marker-in 0.9s var(--ease) 0.25s both;
}

@keyframes marker-in {
  from {
    background-size: 0% 0.2em;
  }
}

.greeting p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
}

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

.summary-card,
.system-card,
.aside-card,
.probe-card,
.history-item,
.empty-card,
.ster-summary-card,
.ster-queue,
.ster-command-result {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.summary-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(64px, 46%);
  grid-template-areas: "figure figure" "note spark";
  align-items: end;
  gap: 8px 14px;
  padding: 22px 22px 20px;
  animation: rise 0.55s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}

.summary-figure {
  grid-area: figure;
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 22px;
  line-height: 1.1;
  white-space: nowrap;
}

.summary-figure strong {
  font-size: 48px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.summary-red .summary-figure strong {
  color: var(--s-red);
}

.summary-card > p {
  grid-area: note;
  color: var(--muted);
  font-size: 13px;
}

.summary-card > p b {
  font-weight: 600;
  color: var(--text);
}

.summary-spark {
  grid-area: spark;
  margin: 0;
  text-align: right;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: start;
  gap: 26px;
}

body:not([data-view="dashboard"]) .workspace,
body[data-view="ster_firmy"] .workspace {
  grid-template-columns: minmax(0, 1fr);
}

.workspace-main {
  min-width: 0;
}

.view:not(.hidden) {
  animation: view-in 0.4s var(--ease) both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.dashboard-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.filter:hover {
  background: var(--card);
  color: var(--text);
  border-color: var(--muted);
}

.filter.active {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--on-brand);
}

.systems-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.system-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 12px;
  padding: 20px 20px 16px;
  animation: rise 0.5s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 45ms);
  transition: border-color 0.2s ease, box-shadow 0.25s ease, transform 0.25s var(--ease);
}

.system-card:hover {
  border-color: #B9BCAD;
  box-shadow: 0 2px 4px rgba(32, 60, 50, 0.05), 0 14px 28px rgba(32, 60, 50, 0.08);
  transform: translateY(-2px);
}

.system-card.status-RED {
  border-color: rgba(173, 71, 40, 0.45);
}

.system-card-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.system-card-head .lamp {
  margin-top: 4px;
}

.system-card-title {
  flex: 1;
  min-width: 0;
}

.system-card h2 {
  font-size: 18px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.status-text {
  margin-top: 2px;
  font-size: 13.5px;
  font-weight: 600;
}

.system-summary {
  color: var(--muted);
  font-size: 13.5px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.system-card-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(80px, 42%);
  align-items: end;
  gap: 12px;
}

.last-check {
  color: var(--muted);
  font-size: 12.5px;
}

.card-spark {
  display: grid;
  justify-items: end;
  gap: 2px;
  min-height: 34px;
}

.card-action {
  justify-self: start;
  min-height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
}

.card-action:hover {
  background: transparent;
  color: var(--copper);
}

.system-card .card-action::after {
  content: "";
  position: absolute;
  inset: 0;
}

.system-card .card-action span {
  display: inline-block;
  transition: transform 0.2s ease;
}

.system-card:hover .card-action span {
  transform: translateX(3px);
}

.empty-card {
  grid-column: 1 / -1;
  padding: 28px;
}

.empty-card h2 {
  font-size: 22px;
  margin-bottom: 6px;
}

.empty-card p {
  color: var(--muted);
}

/* ---------- Panel boczny: AI Pulse i zdarzenia ---------- */

.dashboard-aside {
  display: grid;
  gap: 18px;
  position: sticky;
  top: 20px;
}

.aside-card {
  padding: 22px;
  animation: rise 0.55s var(--ease) 0.15s both;
}

.panel-head,
.pulse-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  margin-bottom: 14px;
}

.panel-head h2,
.pulse-head h2 {
  font-size: 22px;
}

.panel-head h2 span {
  color: var(--muted);
  font-size: 0.8em;
}

.panel-head > span,
.pulse-head > span {
  color: var(--muted);
  font-size: 12.5px;
}

.panel-head > strong {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  color: var(--s-green);
}

.pulse-head .eyebrow {
  display: none;
}

.pulse-day {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.45;
  color: var(--text);
}

.pulse-warning {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--s-yellow);
  background: var(--s-yellow-soft);
  font-size: 13.5px;
}

.pulse-decision {
  margin: 16px 0;
  padding: 14px 16px;
  border-left: 3px solid var(--copper);
  background: var(--card-soft);
}

.pulse-decision h3,
.pulse-section h3,
.pulse-preview h3 {
  margin-bottom: 6px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.pulse-decision p {
  font-size: 14px;
}

.pulse-hr {
  margin-top: 6px;
  color: var(--copper);
  font-size: 13px;
}

.pulse-section {
  margin-top: 16px;
}

.pulse-list {
  display: grid;
  gap: 10px;
}

.pulse-insight {
  display: grid;
  gap: 4px;
  padding: 12px 0 0;
  border-top: 1px solid var(--line-soft);
  font-size: 13.5px;
}

.pulse-insight strong {
  font-weight: 600;
}

.pulse-type {
  color: var(--copper);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pulse-meta {
  display: flex;
  justify-content: flex-end;
}

.pulse-link {
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pulse-link:hover {
  background: transparent;
  color: var(--copper);
}

.pulse-data-note {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
}

.pulse-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.pulse-action {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.pulse-preview {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-size: 13.5px;
}

.pulse-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.pulse-preview textarea {
  width: 100%;
  min-height: 180px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card-soft);
  font-family: var(--mono);
  font-size: 12px;
  resize: vertical;
}

.pulse-copy {
  min-height: 30px;
  font-size: 12.5px;
}

.pulse-copy-status {
  min-height: 1.4em;
  color: var(--s-green);
  font-size: 12.5px;
}

.pulse-footer {
  display: grid;
  gap: 4px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12px;
}

.timeline {
  position: relative;
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 94px;
  width: 1px;
  background: var(--line);
}

.timeline li {
  animation: rise 0.45s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 60ms + 120ms);
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 78px 9px minmax(0, 1fr);
  align-items: start;
  gap: 0 12px;
  width: 100%;
  min-height: 0;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 400;
  text-align: left;
}

.timeline-item:hover {
  background: transparent;
}

.timeline-item:hover strong {
  color: var(--copper);
}

.timeline-item time {
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.6;
}

.timeline-item .lamp {
  margin-top: 6px;
  box-shadow: 0 0 0 3px var(--card);
}

.timeline-text {
  display: grid;
  gap: 1px;
  min-width: 0;
  font-size: 13px;
}

.timeline-text strong {
  font-weight: 600;
  transition: color 0.2s ease;
}

.timeline-text span {
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Widok systemu ---------- */

.back-button {
  min-height: 32px;
  margin-bottom: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
}

.back-button:hover {
  background: transparent;
  color: var(--brand);
}

.system-header {
  margin-bottom: 26px;
}

.detail-hero {
  display: flex;
  align-items: center;
  gap: 28px;
}

.detail-hero .lamp-xl {
  margin: 10px;
}

.detail-heading {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.detail-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

.detail-heading h2 {
  font-size: clamp(30px, 3.6vw, 46px);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.detail-heading p {
  color: var(--text);
  max-width: 72ch;
}

.detail-heading > span {
  color: var(--muted);
  font-size: 13.5px;
}

.system-insights {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  grid-template-areas: "chart evidence" "tiles evidence";
  gap: 18px;
  margin-bottom: 30px;
}

.availability-card {
  grid-area: chart;
  min-width: 0;
}

.evidence-card {
  grid-area: evidence;
  min-width: 0;
}

.metric-tiles {
  grid-area: tiles;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  align-items: start;
  align-self: start;
  gap: 14px;
}

.metric-tile {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  animation: rise 0.5s var(--ease) 0.2s both;
}

.metric-tile h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 15px;
}

.metric-value {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 400;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.metric-value small {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
}

.metric-tile p {
  color: var(--muted);
  font-size: 12.5px;
}

.metric-tile .spark {
  margin-top: 8px;
}

.chart {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-areas: "y plot" ". x";
  gap: 6px 8px;
}

.chart-y {
  grid-area: y;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 200px;
  margin: -7px 0;
  color: var(--muted);
  font-size: 11.5px;
  text-align: right;
}

.chart-plot {
  grid-area: plot;
  position: relative;
  height: 200px;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.chart-plot svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  animation: chart-reveal 1.3s var(--ease) 0.15s both;
}

.chart-grid {
  fill: none;
  stroke: var(--line-soft);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  vector-effect: non-scaling-stroke;
}

.chart-area {
  opacity: 0.8;
}

.chart-line {
  fill: none;
  stroke: var(--s-green);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.chart-dot {
  position: absolute;
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 -5.5px;
  border: 2px solid var(--card);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(32, 60, 50, 0.15);
  animation: rise 0.4s var(--ease) 1.2s both;
}

.chart-dot-RED {
  background: var(--s-red);
}

.chart-dot-YELLOW {
  background: var(--s-yellow);
}

.chart-x {
  grid-area: x;
  display: flex;
  justify-content: space-between;
  gap: 4px;
  color: var(--muted);
  font-size: 11.5px;
}

.probe-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 14px 0 30px;
}

.probe-card {
  display: grid;
  align-content: space-between;
  gap: 14px;
  padding: 20px;
  border-top-width: 3px;
  animation: rise 0.5s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

.probe-card.status-GREEN {
  border-top-color: var(--s-green);
}

.probe-card.status-YELLOW {
  border-top-color: var(--s-yellow);
}

.probe-card.status-RED {
  border-top-color: var(--s-red);
}

.probe-card.status-NO_DATA {
  border-top-style: dashed;
  border-top-color: var(--s-nodata);
}

.probe-card > div {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.probe-card h3 {
  font-size: 19px;
}

.probe-card p {
  font-size: 13.5px;
}

.owner-action {
  padding-left: 10px;
  border-left: 2px solid var(--lime);
  color: var(--text);
}

.probe-card .card-action {
  justify-self: start;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  font-size: 13px;
}

.probe-card .card-action:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.system-pulse {
  display: flex;
  gap: 22px;
  padding: 26px;
}

.pulse-mark {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--copper-soft);
  color: var(--copper);
}

.pulse-mark svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
  stroke-width: 0.8;
}

.system-pulse-body {
  flex: 1;
  min-width: 0;
}

.system-pulse-body .panel-head h2 {
  font-size: 26px;
}

.system-pulse-body .pulse-insight p:nth-child(2) {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.45;
}

/* ---------- Historia sondy ---------- */

.history-panel {
  display: grid;
  gap: 14px;
}

.history-item {
  display: grid;
  gap: 12px;
  padding: 20px 22px;
  border-left-width: 3px;
  animation: rise 0.45s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}

.history-item.status-GREEN {
  border-left-color: var(--s-green);
}

.history-item.status-YELLOW {
  border-left-color: var(--s-yellow);
}

.history-item.status-RED {
  border-left-color: var(--s-red);
}

.history-item.status-NO_DATA {
  border-left-style: dashed;
  border-left-color: var(--s-nodata);
}

.history-item h3 {
  font-size: 20px;
}

.history-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.evidence-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin: 0;
}

.evidence-meta div {
  min-width: 0;
}

.evidence-meta dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.evidence-meta dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.raw-block {
  margin: 0;
  max-height: 260px;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--card-soft);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-actions button {
  min-height: 34px;
  font-size: 13px;
}

/* ---------- Ster firmy ---------- */

.ster-firmy-view {
  display: grid;
  gap: 22px;
}

.ster-firmy-header h1 {
  font-size: clamp(34px, 4vw, 48px);
}

.ster-firmy-now {
  margin-top: 10px;
  max-width: 70ch;
  color: var(--muted);
}

.ster-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.ster-summary-card {
  display: grid;
  gap: 4px;
  padding: 20px 22px;
  animation: rise 0.5s var(--ease) both;
}

.ster-summary-card:nth-child(2) {
  animation-delay: 70ms;
}

.ster-summary-card:nth-child(3) {
  animation-delay: 140ms;
}

.ster-summary-card h2 {
  font-size: 18px;
}

.ster-summary-card strong {
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 400;
  line-height: 1.1;
}

.ster-summary-card p {
  color: var(--muted);
  font-size: 13px;
}

.ster-queues {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.ster-queue {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 20px 22px;
}

.ster-queue h2 {
  font-size: 20px;
}

.ster-queue > div > p,
.ster-empty {
  color: var(--muted);
  font-size: 13.5px;
}

.ster-item {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.ster-item h3 {
  font-size: 17px;
}

.ster-item p {
  font-size: 13.5px;
}

.ster-item-meta,
.ster-confirmation-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.ster-item-meta div,
.ster-confirmation-list div {
  display: grid;
  grid-template-columns: minmax(90px, 40%) minmax(0, 1fr);
  gap: 10px;
  font-size: 13px;
}

.ster-item-meta dt,
.ster-confirmation-list dt {
  color: var(--muted);
}

.ster-item-meta dd,
.ster-confirmation-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.ster-item-next {
  color: var(--copper);
}

.ster-command-button {
  justify-self: start;
  background: var(--copper);
  border-color: var(--copper);
}

.ster-command-button:hover {
  background: #933B20;
}

.ster-item details summary {
  cursor: pointer;
  color: var(--brand);
  font-size: 13px;
}

.ster-item-details {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
}

.ster-item-details ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.ster-command-result {
  display: grid;
  gap: 8px;
  padding: 22px;
  border-left: 3px solid var(--s-green);
}

.ster-command-result h2 {
  font-size: 22px;
}

.ster-result-note {
  color: var(--muted);
}

.ster-ai-pulse-link a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--brand);
  font-family: var(--serif);
  font-size: 18px;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.ster-ai-pulse-link a:hover {
  border-bottom-color: var(--copper);
}

.ster-command-dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  box-shadow: 0 30px 60px rgba(32, 60, 50, 0.18);
}

.ster-command-dialog::backdrop {
  background: rgba(32, 60, 50, 0.35);
}

.ster-command-dialog-panel {
  display: grid;
  gap: 14px;
  padding: 26px;
}

.ster-command-dialog-panel h2 {
  font-size: 26px;
}

.ster-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

/* ---------- Sprawdź teraz: komunikat ---------- */

.probe-run-status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -12px 0 22px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--s-nodata);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 14px;
  animation: rise 0.35s var(--ease) both;
}

.probe-run-status p {
  flex: 1;
  min-width: 0;
}

.probe-run-busy {
  border-left-color: var(--brand);
}

.probe-run-ok {
  border-left-color: var(--s-green);
  background: var(--s-green-soft);
}

.probe-run-warn {
  border-left-color: var(--s-red);
  background: var(--s-red-soft);
}

.text-link {
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.text-link:hover {
  background: transparent;
  color: var(--copper);
}

/* ---------- Wczytywanie ---------- */

.spinner {
  display: inline-block;
  flex: none;
  width: 14px;
  height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.systems-loading {
  grid-column: 1 / -1;
}

.skeleton {
  display: block;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--line-soft) 0%, var(--card-soft) 45%, var(--line-soft) 90%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.skeleton-stack {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.skeleton-card {
  height: 72px;
  border: 1px solid var(--line-soft);
}

.skeleton-line {
  width: 100%;
  height: 10px;
}

.skeleton-short {
  width: 48%;
  height: 10px;
}

.skeleton-dot {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

.skeleton-title {
  width: 60%;
  height: 16px;
}

.skeleton-figure {
  width: 64px;
  height: 40px;
}

.skeleton-system {
  min-height: 150px;
  grid-template-rows: auto auto auto;
  align-content: start;
}

.summary-loading {
  grid-template-areas: none;
  grid-template-columns: minmax(0, 1fr);
  min-height: 120px;
  align-content: space-between;
}

.error-card,
.calm-card {
  display: grid;
  gap: 10px;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  animation: rise 0.45s var(--ease) both;
}

.systems-grid > .error-card {
  grid-column: 1 / -1;
}

.error-card {
  border-left: 3px solid var(--copper);
  justify-items: start;
}

.error-card h2,
.calm-card h2 {
  font-size: 24px;
}

.error-card p,
.calm-card p {
  color: var(--muted);
}

.calm-card {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  border-left: 3px solid var(--s-green);
}

.calm-card .lamp-lg {
  margin: 10px;
}

.sidebar-note {
  color: var(--on-brand-muted);
  font-size: 13px;
}

.notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card-soft);
  color: var(--muted);
  font-size: 13.5px;
}

.notice-warn {
  border-color: rgba(173, 71, 40, 0.35);
  background: var(--copper-soft);
  color: var(--text);
}

/* ---------- Widoki zakładek ---------- */

.view-head {
  margin-bottom: 22px;
}

.view-head h1 {
  font-size: clamp(32px, 3.4vw, 44px);
  line-height: 1.1;
}

.view-head p {
  margin-top: 8px;
  color: var(--muted);
}

.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  margin-bottom: 16px;
}

.list-count {
  color: var(--muted);
  font-size: 13px;
}

.inline-search input,
.select-field select {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
}

.inline-search input {
  width: min(320px, 100%);
}

.inline-search {
  flex: 0 1 320px;
  min-width: 0;
}

.inline-search input:focus,
.select-field select:focus {
  border-color: var(--brand);
  outline: none;
}

.select-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.select-field select {
  max-width: 260px;
  font: inherit;
}

/* Tabela systemów */

.systems-table-wrap {
  min-width: 0;
}

.systems-table {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 14px;
}

.systems-table th {
  padding: 0;
  border-bottom: 1px solid var(--line);
  background: var(--card-soft);
  text-align: left;
}

.systems-table th:first-child {
  border-top-left-radius: var(--radius);
}

.systems-table th:last-child {
  border-top-right-radius: var(--radius);
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sort-button:hover,
.sort-button.sorted {
  background: transparent;
  color: var(--text);
}

.sort-mark {
  color: var(--line);
  font-size: 13px;
  letter-spacing: 0;
}

.sort-button.sorted .sort-mark {
  color: var(--copper);
}

.systems-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

.systems-table tbody tr:last-child td {
  border-bottom: 0;
}

.systems-table tbody tr {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.systems-table tbody tr:hover {
  background: var(--card-soft);
}

.systems-table.animate tbody tr {
  animation: rise 0.45s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 35ms);
}

.systems-table tr.status-RED td:first-child {
  box-shadow: inset 3px 0 0 var(--s-red);
}

.systems-table tr.status-YELLOW td:first-child {
  box-shadow: inset 3px 0 0 var(--s-yellow);
}

.col-status {
  white-space: nowrap;
}

.col-status .lamp {
  margin-right: 10px;
  vertical-align: -2px;
}

.col-status .status-text {
  display: inline;
}

.col-name {
  min-width: 180px;
}

.col-name .own-system-badge {
  margin-left: 8px;
}

.row-link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 400;
  text-align: left;
}

.row-link:hover {
  background: transparent;
  color: var(--brand);
  text-decoration: underline;
  text-decoration-color: var(--lime);
  text-decoration-thickness: 3px;
  text-underline-offset: 3px;
}

.col-last {
  color: var(--muted);
  white-space: nowrap;
}

.col-availability {
  width: 34%;
  min-width: 220px;
}

.col-probes {
  width: 90px;
}

.cell-number {
  font-variant-numeric: tabular-nums;
}

.cell-note {
  color: var(--muted);
  font-size: 12px;
}

.avail-cell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "value strip" "note note";
  align-items: center;
  gap: 4px 12px;
}

.avail-cell strong {
  grid-area: value;
  min-width: 52px;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.avail-cell .uptime-strip {
  grid-area: strip;
}

.avail-cell .cell-note {
  grid-area: note;
}

.uptime-strip {
  display: flex;
  gap: 2px;
  height: 22px;
  min-width: 0;
}

.uptime-day {
  flex: 1 1 0;
  min-width: 2px;
  border-radius: 1px;
  background: var(--s-green);
  opacity: 0.85;
}

.uptime-YELLOW {
  background: var(--s-yellow);
}

.uptime-RED {
  background: var(--s-red);
}

.uptime-NO_DATA {
  align-self: center;
  height: 4px;
  background: var(--s-nodata-soft);
  box-shadow: inset 0 0 0 1px var(--line);
  opacity: 1;
}

/* Alerty */

.alerts-summary {
  margin-bottom: 14px;
}

.alerts-counts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  font-size: 14px;
}

.alerts-counts > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.alerts-counts b {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
}

.alerts-list {
  display: grid;
  gap: 18px;
}

.alert-card {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--s-nodata);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.animate .alert-card,
.animate .event-day,
.animate .report-item,
.animate .social-post {
  animation: rise 0.45s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 50ms);
}

.alert-card.status-RED {
  border-left-color: var(--s-red);
}

.alert-card.status-YELLOW {
  border-left-color: var(--s-yellow);
}

.alert-card-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.alert-card-head .lamp {
  margin-top: 6px;
}

.alert-card-title h2 .row-link {
  font-size: 22px;
}

.alert-card-title p {
  color: var(--muted);
  font-size: 13.5px;
}

.alert-summary {
  margin: 10px 0 0 32px;
  color: var(--muted);
  font-size: 14px;
}

.alert-probes {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.alert-probe {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--card-soft);
}

.alert-probe-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.alert-probe-head h3 {
  font-size: 17px;
}

.alert-facts {
  display: grid;
  gap: 6px;
  margin: 0;
  font-size: 14px;
}

.alert-facts div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
}

.alert-facts dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding-top: 2px;
}

.alert-facts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.alert-probe .card-action {
  justify-self: start;
}

/* Zdarzenia */

.events-toolbar {
  align-items: flex-end;
}

.events-timeline {
  display: grid;
  gap: 14px;
}

.event-day {
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.event-day-title {
  margin-bottom: 8px;
  font-size: 18px;
}

.event-day-title::first-letter {
  text-transform: uppercase;
}

.event-summary {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12.5px;
}

.events-empty {
  padding: 20px 0;
}

/* Raporty */

.reports-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 18px;
}

.report-card-wide {
  grid-column: 1 / -1;
}

.report-card .panel-head,
.social-card .panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.report-card .panel-head h2,
.social-card .panel-head h2 {
  font-size: 22px;
}

.report-card .panel-head > span,
.social-card .panel-head > span {
  color: var(--muted);
  font-size: 12.5px;
}

.report-list {
  display: grid;
  gap: 8px;
}

.report-item {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--card-soft);
}

.report-item summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 14px;
  cursor: pointer;
  list-style: none;
}

.report-item summary::-webkit-details-marker {
  display: none;
}

.report-item summary:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
}

.report-date {
  flex: 1;
  font-family: var(--serif);
  font-size: 16px;
}

.report-chevron {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.report-item[open] .report-chevron {
  transform: rotate(-135deg);
}

.report-body {
  display: grid;
  gap: 6px;
  padding: 2px 14px 16px;
  font-size: 14px;
}

.report-body h3,
.report-subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.report-subtitle {
  margin: 18px 0 10px;
}

.cost-total {
  display: grid;
  gap: 4px;
}

.cost-total .eyebrow {
  margin: 0;
}

.cost-bars {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13.5px;
}

.cost-bars li {
  display: grid;
  grid-template-columns: minmax(80px, 30%) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.cost-name {
  overflow-wrap: anywhere;
}

.cost-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--line-soft);
  overflow: hidden;
}

.cost-bar i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--brand);
  animation: chart-reveal 0.9s var(--ease) 0.1s both;
}

.cost-value {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.social-posts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.social-post {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--card-soft);
}

.social-post-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.social-post-head .badge {
  margin-right: auto;
}

.social-date {
  flex: 1 1 100%;
  order: 3;
  color: var(--muted);
  font-size: 13px;
}

.social-facts {
  display: grid;
  gap: 4px;
  margin: 0;
  font-size: 13.5px;
}

.social-facts div {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.social-facts dt {
  min-width: 78px;
  color: var(--muted);
}

.social-facts dd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.social-reasons {
  color: var(--muted);
  font-size: 12.5px;
}

.badge-alarm {
  border-color: rgba(173, 71, 40, 0.4);
  background: var(--copper-soft);
  color: var(--copper);
}

.social-measures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.social-measures h3 {
  margin-bottom: 6px;
  font-size: 15px;
}

.social-meta {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.metric-list {
  display: grid;
  gap: 4px;
  margin: 0;
  font-size: 13.5px;
}

.metric-list div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.metric-list dt {
  color: var(--muted);
}

.metric-list dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.no-reading {
  color: var(--s-nodata);
  font-size: 13px;
  font-style: italic;
}

.system-extra {
  margin-bottom: 30px;
}

.social-tiles {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.metric-value-small {
  font-size: 20px;
}

/* ---------- Responsywność ---------- */

@media (max-width: 1280px) {
  .portal-main {
    padding: 24px 28px 48px;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
}

@media (max-width: 1120px) {
  .topbar {
    flex-wrap: wrap;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-aside {
    position: static;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    align-items: start;
  }

  .summary-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .system-insights {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "chart" "tiles" "evidence";
  }

  .reports-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  .portal-view,
  .portal-view.sidebar-collapsed {
    grid-template-columns: minmax(0, 1fr);
    background: none;
  }

  .sidebar,
  .sidebar-collapsed .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    height: auto;
    padding: 10px 16px;
    overflow: visible;
  }

  .brand,
  .sidebar-collapsed .brand {
    flex: none;
    min-height: 0;
    padding: 0;
  }

  .sidebar-collapsed .brand .wordmark {
    display: block;
  }

  .brand .wordmark {
    font-size: 19px;
  }

  .brand .wordmark-sub,
  .sidebar-toggle,
  .sidebar-status,
  .sidebar-collapsed .sidebar-toggle {
    display: none;
  }

  .side-nav {
    display: flex;
    flex: 1;
    min-width: 0;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .side-nav::-webkit-scrollbar {
    display: none;
  }

  .side-link,
  .sidebar-collapsed .side-link {
    flex: none;
    width: auto;
    min-height: 40px;
    padding: 0 10px;
    border-left: 0;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    gap: 8px;
  }

  .side-link.active {
    border-bottom-color: var(--lime);
  }

  .sidebar-collapsed .side-label {
    display: inline;
  }

  .side-icon {
    width: 18px;
    height: 18px;
  }

  .auth-view {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-brand {
    gap: 20px;
    padding: 24px;
  }

  .auth-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
    font-size: 14px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14.5px;
  }

  .portal-main {
    padding: 18px 16px 40px;
  }

  .side-label {
    display: none;
  }

  .sidebar-collapsed .side-label {
    display: none;
  }

  .side-link,
  .sidebar-collapsed .side-link {
    padding: 0 9px;
  }

  .topbar {
    gap: 10px;
    margin-bottom: 20px;
  }

  .search-box {
    order: 3;
    flex: 1 1 100%;
  }

  .search-box kbd {
    display: none;
  }

  .top-actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .freshness {
    order: 5;
    flex: 1 1 100%;
  }

  .freshness-text {
    display: flex;
    flex-wrap: wrap;
    gap: 0 10px;
  }

  .top-actions .ghost-button,
  .top-actions .probe-run-button {
    flex: 1 1 0;
    padding: 0 10px;
  }

  .top-actions {
    gap: 8px;
  }

  .avatar-button strong {
    font-size: 13px;
  }

  .greeting {
    margin-bottom: 18px;
  }

  .summary-row {
    gap: 12px;
  }

  .summary-card {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "figure" "note" "spark";
    padding: 16px;
  }

  .summary-figure {
    flex-direction: column;
    gap: 2px;
    font-size: 16px;
  }

  .summary-figure strong {
    font-size: 38px;
  }

  .summary-spark {
    text-align: left;
  }

  .section-title {
    font-size: 22px;
  }

  .systems-grid,
  .probe-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-hero {
    align-items: flex-start;
    gap: 18px;
  }

  .detail-hero .lamp-xl {
    --size: 36px;
    --halo: 1.8;
    margin: 6px;
  }

  .system-pulse {
    flex-direction: column;
    gap: 14px;
    padding: 20px;
  }

  .ster-summary,
  .ster-queues {
    grid-template-columns: minmax(0, 1fr);
  }

  .probe-run-status {
    margin: -6px 0 18px;
    font-size: 13.5px;
  }

  .view-head h1 {
    font-size: 32px;
  }

  .inline-search,
  .inline-search input,
  .select-field,
  .select-field select {
    flex: 1 1 100%;
    width: 100%;
    max-width: none;
  }

  .systems-table,
  .systems-table thead,
  .systems-table tbody,
  .systems-table tr,
  .systems-table td {
    display: block;
  }

  .systems-table {
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .systems-table thead tr {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
  }

  .systems-table th {
    display: block;
    width: auto;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
  }

  .systems-table th .sort-button {
    min-height: 34px;
    padding: 0 10px;
    font-size: 11px;
  }

  .systems-table tbody {
    display: grid;
    gap: 12px;
  }

  .systems-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
  }

  .systems-table td {
    padding: 0;
    border: 0;
    width: auto;
    min-width: 0;
  }

  .systems-table tr.status-RED td:first-child,
  .systems-table tr.status-YELLOW td:first-child {
    box-shadow: none;
  }

  .systems-table tr.status-RED {
    border-left: 3px solid var(--s-red);
  }

  .systems-table tr.status-YELLOW {
    border-left: 3px solid var(--s-yellow);
  }

  .systems-table .col-name {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .systems-table .col-status {
    grid-column: 1;
  }

  .systems-table .col-last {
    grid-column: 2;
    text-align: right;
    font-size: 13px;
  }

  .systems-table .col-availability {
    grid-column: 1 / -1;
  }

  .systems-table .col-probes {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 13px;
  }

  .systems-table td.col-probes::before {
    content: "Sondy: ";
  }

  .alert-card {
    padding: 18px;
  }

  .alert-summary {
    margin-left: 0;
  }

  .alert-facts div {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .calm-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 22px;
  }

  .event-day {
    padding: 14px 14px 10px;
  }

  .social-posts,
  .social-measures {
    grid-template-columns: minmax(0, 1fr);
  }

  .social-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .cost-bars li {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .cost-bar {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .chart {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .chart-y,
  .chart-plot {
    height: 160px;
  }

  .topbar-eyebrow {
    display: none;
  }

  .auth-brand .wordmark-sub {
    padding-bottom: 0;
  }

  .auth-panel h1 {
    font-size: 32px;
  }
}

/* ---------- Strona i reklamy ---------- */
/* Kategorie wykresu: 5 serii w stałej kolejności, sprawdzone walidatorem palety (dataviz, powierzchnia #FFFDF7):
   pasmo jasności, nasycenie, rozróżnialność przy daltonizmie PASS; kontrast < 3:1 → legenda + tabela pod wykresem. */

.webads-view {
  --wa-s1: #2a78d6;
  --wa-s2: #eb6834;
  --wa-s3: #1baf7a;
  --wa-s4: #eda100;
  --wa-s5: #e87ba4;
  --wa-dot: var(--brand-deep);
}

.wa-asof {
  margin: 0 0 16px;
}

.webads-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 14px;
  margin-bottom: 18px;
}

.wa-tile {
  align-content: start;
  gap: 6px;
}

.wa-tile-tall {
  grid-row: span 2;
}

/* Kafel 7 (jakość danych) jako pasek stanu przez całą szerokość. */
.wa-tile-wide {
  grid-column: 1 / -1;
}

.wa-tile-wide .wa-rules {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.wa-tile .metric-value {
  font-size: 28px;
}

.wa-tile .metric-value small {
  margin-left: 4px;
}

.wa-nr {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.wa-foot {
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px dashed var(--line-soft);
  font-size: 11.5px;
}

.wa-low {
  display: inline-block;
  padding: 1px 6px;
  border: 1px dashed var(--s-nodata);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.wa-counts {
  font-variant-numeric: tabular-nums;
}

.wa-range {
  color: var(--muted);
  font-size: 12px;
}

.wa-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.wa-list {
  display: grid;
  gap: 3px;
  margin: 4px 0 0;
  font-size: 13px;
}

.wa-list div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 0;
  border-bottom: 1px solid var(--line-soft);
}

.wa-list dt {
  color: var(--muted);
}

.wa-list dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.wa-warn,
.wa-list .wa-warn dt {
  color: var(--s-yellow-text);
}

.wa-mini {
  width: 100%;
  margin-top: 6px;
  border-collapse: collapse;
  font-size: 12.5px;
}

.wa-mini th,
.wa-mini td {
  padding: 3px 0;
  border-bottom: 1px solid var(--line-soft);
  text-align: right;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.wa-mini th:first-child {
  color: var(--muted);
  text-align: left;
}

.wa-mini thead th {
  color: var(--muted);
  font-size: 11px;
}

.wa-trend {
  margin-left: 4px;
  font-size: 11.5px;
  white-space: nowrap;
}

.wa-up {
  color: var(--s-green);
}

.wa-down {
  color: var(--copper);
}

.wa-semafor {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0;
  font-size: 16px;
}

.wa-rules {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
}

.wa-rules li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
}

.wa-rule-nr {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--s-yellow-soft);
  color: var(--s-yellow-text);
  font-size: 11px;
}

.wa-rule-RED .wa-rule-nr {
  background: var(--s-red-soft);
  color: var(--s-red);
}

.webads-charts {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  margin-bottom: 18px;
}

.webads-table-card {
  margin-bottom: 18px;
}

.wa-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 12px;
}

.wa-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wa-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: currentColor;
}

.wa-swatch.wa-s1 { background: var(--wa-s1); }
.wa-swatch.wa-s2 { background: var(--wa-s2); }
.wa-swatch.wa-s3 { background: var(--wa-s3); }
.wa-swatch.wa-s4 { background: var(--wa-s4); }
.wa-swatch.wa-s5 { background: var(--wa-s5); }

.wa-dot-swatch {
  border: 2px solid var(--card);
  border-radius: 50%;
  background: var(--wa-dot);
  box-shadow: 0 0 0 1px var(--wa-dot);
}

.wa-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.wa-seg.wa-s1 { fill: var(--wa-s1); }
.wa-seg.wa-s2 { fill: var(--wa-s2); }
.wa-seg.wa-s3 { fill: var(--wa-s3); }
.wa-seg.wa-s4 { fill: var(--wa-s4); }
.wa-seg.wa-s5 { fill: var(--wa-s5); }

.wa-partial .wa-seg {
  opacity: 0.55;
}

.wa-dot {
  fill: var(--wa-dot);
  stroke: var(--card);
  stroke-width: 2;
}

.wa-grid {
  stroke: var(--line-soft);
  stroke-dasharray: 4 4;
}

.wa-baseline {
  stroke: var(--line);
}

.wa-axis {
  fill: var(--muted);
  font-family: var(--sans);
  font-size: 11px;
}

.wa-hit {
  fill: transparent;
}

.wa-week:hover .wa-hit,
.wa-svg-line .wa-hit:hover {
  fill: rgba(35, 76, 59, 0.06);
}

.wa-line {
  fill: none;
  stroke: var(--s-green);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.wa-line-step {
  stroke: var(--brand-deep);
}

.wa-end {
  fill: var(--brand-deep);
  stroke: var(--card);
  stroke-width: 2;
}

.wa-end-label {
  fill: var(--text);
  font-family: var(--sans);
  font-size: 12px;
}

.wa-chart-title {
  margin: 4px 0 2px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12.5px;
}

.wa-table-toggle {
  margin-top: 8px;
  font-size: 13px;
}

.wa-table-toggle summary {
  color: var(--brand);
  cursor: pointer;
}

.wa-scroll {
  overflow-x: auto;
}

.wa-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 13px;
}

.wa-table th,
.wa-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
  text-align: right;
  vertical-align: top;
  font-variant-numeric: tabular-nums;
}

.wa-table thead th {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 400;
  white-space: nowrap;
}

.wa-table th[scope="row"],
.wa-table thead th:first-child {
  text-align: left;
}

.wa-table th[scope="row"] {
  font-weight: 500;
  white-space: nowrap;
}

.wa-table th[scope="row"] .cell-note {
  display: block;
  font-weight: 400;
}

.wa-funnel {
  min-width: 760px;
}

.wa-funnel td .cell-note {
  display: block;
  font-size: 11.5px;
  white-space: normal;
}

.wa-funnel-total th,
.wa-funnel-total td {
  border-top: 1px solid var(--line);
  font-weight: 600;
}

.wa-ages {
  max-width: 220px;
  white-space: normal;
}

.wa-table .wa-range {
  display: block;
  white-space: normal;
}

.wa-age {
  display: inline-block;
  margin: 0 0 2px 4px;
  font-size: 12px;
}

.webads-tiles.animate .wa-tile {
  animation: rise 0.5s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}

@media (max-width: 1280px) {
  .webads-tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1120px) {
  .webads-charts {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  .webads-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .webads-tiles {
    grid-template-columns: minmax(0, 1fr);
  }

  .wa-tile-tall {
    grid-row: auto;
  }
}

/* ---------- Ograniczony ruch ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
