/* Panel biura Inter-Klima — design system „Inter-Klima Nastawa” 2.4 (ADR-0028).
   Tokeny --ik-* z project/tokens.json systemu; Archivo i IBM Plex Mono z zapasem
   systemowym (CSP nie dopuszcza zewnętrznych arkuszy i fontów). */
:root {
  --ik-grafit-950: #0e141b; --ik-grafit-900: #141c25; --ik-grafit-800: #1b2430; --ik-grafit-700: #2b3644;
  --ik-grafit-500: #5a6571; --ik-grafit-300: #9aa3ad;
  --ik-szron-100: #f4f4f1; --ik-szron-200: #eaebe6; --ik-szron-300: #d8dad3; --ik-biel: #ffffff;
  --ik-blekit-700: #183fa6; --ik-blekit-600: #1f4fd1; --ik-blekit-100: #e6ecfb;
  --ik-sygnal-600: #e24b14; --ik-sygnal-500: #ff5a1f;
  --ik-success: #1e7a4c; --ik-success-bg: #e5f2eb; --ik-warning: #87570b; --ik-warning-bg: #f6eedc;
  --ik-error: #c2352b; --ik-error-bg: #f8e6e4;
  --ik-border-control: #808993; --ik-tekst-na-grafit-2: #c3cad2; --ik-tekst-na-tonie: #4a545f;
  --ik-wyrozn: rgba(255, 138, 76, .14);
  --ik-mat-grafit: linear-gradient(155deg, #4a5666 0%, #2c3644 38%, #1e2733 70%, #34404e 100%);
  --ik-mat-grafit-polysk: linear-gradient(115deg, transparent 28%, rgba(255, 255, 255, .07) 42%, rgba(255, 255, 255, .02) 50%, transparent 62%);
  --ik-mat-miedz: linear-gradient(135deg, #7a4222 0%, #b8693a 28%, #f0b48a 46%, #c0703f 62%, #7a4222 100%);
  --ik-mat-zelazo: linear-gradient(160deg, #222c38 0%, #0e141b 46%, #151d27 100%);
  --ik-poswiata-chlod: radial-gradient(60% 80% at 0% 0%, rgba(76, 123, 239, .22), transparent 70%);
  --ik-krawedz: inset 0 1px 0 rgba(255, 255, 255, .16), inset 0 -1px 0 rgba(0, 0, 0, .45);
  --ik-ton-chlod: linear-gradient(180deg, #eef3fa 0%, #dfe7f3 100%);
  --ik-radius-akcja: 12px; --ik-radius-sm: 2px;
  --ik-dur-stan: 160ms; --ik-ease: cubic-bezier(.2, 0, 0, 1);
  --font-sans: "Archivo", system-ui, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--ik-szron-100); color: var(--ik-grafit-950); font: 400 15px/1.5 var(--font-sans); }
a { color: var(--ik-blekit-600); }
a:hover { color: var(--ik-blekit-700); }
:focus-visible { outline: 2px solid var(--ik-sygnal-600); outline-offset: 2px; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.02em; }
h1 { font-size: clamp(30px, 3.2vw, 44px); line-height: 1.06; font-stretch: 112%; letter-spacing: -.025em; }
h2 { font-size: 22px; line-height: 1.2; }
p { margin: 0; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--ik-grafit-500); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.lab { font: 400 12px/1.3 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ik-grafit-500); }
.lab-d { color: var(--ik-tekst-na-grafit-2); }
.lab-strong { color: var(--ik-grafit-950); }

/* Układ: pasek boczny z grafitu + treść; na wąskim ekranie pasek nad treścią. */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 232px; max-width: 280px; background: var(--ik-poswiata-chlod), var(--ik-mat-zelazo); color: #fff; display: flex; flex-direction: column; gap: 24px; padding: 24px 0; box-shadow: var(--ik-krawedz); }
.side-head { padding: 0 20px; display: flex; flex-direction: column; gap: 8px; }
.side-head img { width: 150px; height: auto; display: block; }
.nav { display: flex; flex-direction: column; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0 16px 0 18px; color: #fff; text-decoration: none; font-weight: 500; border-left: 2px solid transparent; }
.nav a:hover { background: rgba(255, 255, 255, .05); }
.nav a[aria-current="page"] { border-left-color: var(--ik-sygnal-500); background: rgba(255, 255, 255, .07); }
.nav .mono { font-size: 12px; color: var(--ik-tekst-na-grafit-2); }
.side-foot { margin-top: auto; padding: 16px 20px 0; border-top: 1px solid rgba(255, 255, 255, .14); display: flex; flex-direction: column; gap: 6px; }
.side-foot button { align-self: flex-start; padding: 0; background: none; border: 0; color: var(--ik-tekst-na-grafit-2); font: inherit; text-decoration: underline; cursor: pointer; min-height: 32px; }
.main { flex: 999 1 560px; min-width: 0; padding: 28px 40px 56px; display: flex; flex-direction: column; gap: 24px; }
.demo-banner { align-self: flex-start; padding: 6px 10px; background: var(--ik-warning-bg); color: var(--ik-warning); }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; }
.page-head > div { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.crumbs a { color: var(--ik-grafit-500); }

/* Przyciski: akcje zaokrąglone, przyrządy ostre (Nastawa 2.2). */
.btn22 { display: inline-flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 52px; padding: 0 8px 0 22px; border: 0; border-radius: var(--ik-radius-akcja); background: var(--ik-mat-grafit-polysk), var(--ik-mat-grafit); color: #fff; font: 600 16px/1.2 var(--font-sans); box-shadow: var(--ik-krawedz), 0 14px 28px -16px rgba(14, 20, 27, .7); cursor: pointer; text-decoration: none; }
.btn22 .sq { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 8px; background: var(--ik-mat-miedz); color: var(--ik-grafit-950); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); transition: transform var(--ik-dur-stan) var(--ik-ease); }
.btn22:hover .sq { transform: translateX(4px); }
.btn22:disabled, .btn:disabled { opacity: .55; cursor: not-allowed; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; font: 600 15px/1.2 var(--font-sans); cursor: pointer; text-decoration: none; }
.btn-obrys { border: 1px solid var(--ik-grafit-950); border-radius: var(--ik-radius-akcja); background: transparent; color: var(--ik-grafit-950); }
.btn-tech { border: 1px solid var(--ik-border-control); border-radius: var(--ik-radius-sm); background: #fff; color: var(--ik-grafit-950); min-height: 40px; padding: 0 14px; }
.btn-danger { border: 1px solid var(--ik-error); border-radius: var(--ik-radius-akcja); background: transparent; color: var(--ik-error); }
.btn-link { border: 0; background: none; padding: 0; min-height: 32px; color: var(--ik-blekit-600); text-decoration: underline; }

/* Statusy: kolor zawsze ze słowem. */
.st { display: inline-flex; align-items: center; gap: 8px; min-height: 28px; padding: 0 10px; font: 500 13px/1.2 var(--font-sans); white-space: nowrap; }
.st::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-ok { background: var(--ik-success-bg); color: var(--ik-success); }
.st-wa { background: var(--ik-warning-bg); color: var(--ik-warning); }
.st-er { background: var(--ik-error-bg); color: var(--ik-error); }
.st-in { background: var(--ik-blekit-100); color: var(--ik-blekit-700); }
.st-ne { background: var(--ik-szron-200); color: var(--ik-grafit-700); }
.komunikat { display: block; padding: 12px 14px; white-space: normal; }
.komunikat::before { display: none; }

/* Skala nastawy: sygnatura systemu. */
.skala { --v: .5; position: relative; height: 12px;
  background:
    repeating-linear-gradient(90deg, var(--ik-grafit-500) 0 1px, transparent 1px 40px) 0 0 / 100% 12px no-repeat,
    repeating-linear-gradient(90deg, var(--ik-grafit-300) 0 1px, transparent 1px 8px) 0 6px / 100% 6px no-repeat; }
.skala::before { content: ""; position: absolute; left: 0; bottom: 0; width: calc(var(--v) * 100%); height: 2px; background: var(--ik-grafit-950); }
.skala::after { content: ""; position: absolute; top: -6px; left: calc(var(--v) * 100%); width: 2px; height: 24px; background: var(--ik-sygnal-600); }
.skala-ciem { background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .55) 0 1px, transparent 1px 40px) 0 0 / 100% 12px no-repeat,
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .28) 0 1px, transparent 1px 8px) 0 6px / 100% 6px no-repeat; }
.skala-ciem::before { background: #fff; }
.skala-ciem::after { background: var(--ik-sygnal-500); }

/* Kafle odczytu (tabliczka) i panele. */
.odczyty { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); border: 1px solid var(--ik-grafit-950); background: #fff; overflow: hidden; }
.odczyt { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; border-right: 1px solid var(--ik-szron-300); box-shadow: 0 1px 0 var(--ik-szron-300); min-width: 0; text-align: left; background: none; border-top: 0; border-bottom: 0; border-left: 0; font: inherit; color: inherit; }
button.odczyt { cursor: pointer; }
button.odczyt:hover { background: var(--ik-szron-100); }
.odczyt .v { font: 400 40px/1 var(--font-mono); }
.odczyt .c { font-size: 13px; color: var(--ik-grafit-500); }
.panel { background: #fff; border: 1px solid var(--ik-szron-300); padding: 24px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; }
.grafit { background: var(--ik-poswiata-chlod), var(--ik-mat-grafit); color: #fff; padding: 24px 28px 28px; display: flex; flex-direction: column; gap: 24px; box-shadow: var(--ik-krawedz); }
.osie { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }
.os { display: flex; flex-direction: column; gap: 6px; }
.os b { font: 500 22px/1.15 var(--font-sans); }
.os span:last-child { font-size: 14px; color: var(--ik-tekst-na-grafit-2); }
.kroki { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; text-align: center; }
.kroki .akt { color: #fff; }
.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.split > .col-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.split > .col-side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }

/* Segmenty filtrów i zakładki. */
.segmenty { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--ik-szron-300); border-radius: var(--ik-radius-sm); background: #fff; color: var(--ik-grafit-950); font: 500 14px/1 var(--font-sans); cursor: pointer; }
.seg[aria-pressed="true"] { border-color: var(--ik-grafit-950); box-shadow: inset 0 -2px 0 var(--ik-sygnal-600); }
.seg .mono { font-size: 12px; color: var(--ik-grafit-500); }
.tabs { display: flex; overflow-x: auto; border-bottom: 1px solid var(--ik-szron-300); }
.tabs a { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 16px; color: var(--ik-grafit-700); text-decoration: none; font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--ik-grafit-950); border-bottom-color: var(--ik-grafit-950); }
.tabs a[aria-current="page"]::before { content: ""; width: 2px; height: 14px; background: var(--ik-sygnal-600); }

/* Tabele: ostre jak przyrząd; szerokie przewijają się w ramce. */
/* position: relative — elementy absolutne (np. .sr-only w nagłówku) nie wychodzą poza ramkę przewijania. */
.tabela { position: relative; overflow-x: auto; background: #fff; border: 1px solid var(--ik-szron-300); }
table { border-collapse: collapse; width: 100%; }
.tabela-kolejka table { min-width: 900px; }
.tabela-kolejka td:first-child { width: 140px; }
.nowrap { white-space: nowrap; }
.stosy { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
th { text-align: left; font: 400 11px/1.3 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ik-grafit-500); padding: 12px 14px; border-bottom: 1px solid var(--ik-grafit-950); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--ik-szron-300); vertical-align: top; }
th.r, td.r { text-align: right; }
td.n { font-family: var(--font-mono); font-size: 14px; white-space: nowrap; }
tr.wyr td { background: var(--ik-wyrozn); }
tfoot td { font-weight: 600; border-bottom: 0; border-top: 1px solid var(--ik-grafit-950); }
td .sub { display: block; font-size: 13px; color: var(--ik-grafit-500); }
.bramki { display: inline-flex; align-items: center; gap: 8px; font: 500 13px/1 var(--font-mono); white-space: nowrap; }
.bramki .pasek { display: inline-block; width: 56px; height: 6px; background: var(--ik-szron-300); position: relative; }
.bramki .pasek i { position: absolute; inset: 0 auto 0 0; width: calc(var(--v) * 100%); background: var(--ik-grafit-950); }
.empty { padding: 32px; text-align: center; color: var(--ik-grafit-500); }

/* Lista bramek i oś czasu. */
.gates { list-style: none; margin: 0; padding: 0; }
.gates li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--ik-szron-300); }
.gates li:last-child { border-bottom: 0; }
.gates .ok { color: var(--ik-success); flex: none; }
.gates .no { color: var(--ik-error); flex: none; }
.gates .na { color: var(--ik-grafit-500); flex: none; width: 18px; text-align: center; }
.gates small { display: block; color: var(--ik-grafit-500); }
.historia { list-style: none; margin: 0; padding: 0; }
.historia li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--ik-szron-300); }
.dl { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.dl dt { font: 400 11px/1.6 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ik-grafit-500); }
.dl dd { margin: 0; }
.wiadomosc { display: flex; flex-direction: column; gap: 6px; padding: 14px; background: var(--ik-szron-100); }
.wiadomosc.biuro { background: var(--ik-blekit-100); }

/* Formularze: etykieta nad polem, błąd przy polu. */
.pola { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.pole { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pole label { font: 500 14px/1.25 var(--font-sans); }
.pole input, .pole select, .pole textarea { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--ik-border-control); border-radius: var(--ik-radius-sm); background: #fff; color: var(--ik-grafit-950); font: 400 15px/1.3 var(--font-sans); }
.pole textarea { min-height: 88px; padding: 10px 12px; resize: vertical; }
.pole-blad input, .pole-blad select, .pole-blad textarea { border-color: var(--ik-error); }
.pole-msg { font-size: 13px; color: var(--ik-error); }
.wybor { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.wybor input { width: 20px; height: 20px; accent-color: var(--ik-grafit-950); }
.jednostka { display: grid; grid-template-columns: 150px repeat(3, minmax(0, 1fr)) 44px; gap: 12px; align-items: end; padding: 14px 0; border-top: 1px solid var(--ik-szron-300); }
.ikona { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--ik-border-control); border-radius: var(--ik-radius-sm); background: #fff; color: var(--ik-grafit-700); cursor: pointer; }
.stopka-formularza { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 16px; border-top: 1px solid var(--ik-szron-300); }
.krok-skala { display: flex; align-items: center; gap: 16px; }
.krok-skala .skala { flex: 1; }
.krok-etykiety { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); text-align: center; }
.krok-skala > .lab:first-child { min-width: 260px; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 10; max-width: 420px; padding: 12px 16px; white-space: normal; box-shadow: 0 24px 48px -24px rgba(14, 20, 27, .28); }
.toast::before { display: none; }

/* Logowanie. */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--ik-poswiata-chlod), var(--ik-mat-zelazo); }
.login .karta { width: min(460px, 100%); background: var(--ik-szron-100); padding: 32px; display: flex; flex-direction: column; gap: 18px; border-radius: 16px; }
.login img { width: 160px; height: auto; }
.login .demo { display: grid; gap: 8px; }

/* Układ stron i formularzy akcji. */
.strona { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.kolejka, .krok, .pola-warunkow, .formularz-akcji, .ekipa { display: flex; flex-direction: column; gap: 12px; }
.pola-warunkow { gap: 16px; }
.pola-ceny { display: flex; flex-direction: column; gap: 12px; }
.pola-ceny .wybor { align-items: flex-start; }
.pola-ceny .wybor input { margin-top: 2px; flex: none; }
.wyjatki { border: 1px solid var(--ik-szron-300); padding: 12px 16px; margin: 0; }
.wyjatki legend { padding: 0 6px; }
.lista-pominiec { list-style: none; margin: 0 0 12px; padding: 0; }
.lista-pominiec li { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--ik-szron-300); }
.lista-pominiec li > span:first-child { flex: 1 1 260px; }
.lista-pominiec .sub { display: block; font-size: 13px; color: var(--ik-grafit-500); }
.pola-akcji { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.pola-akcji .pole { width: 260px; }
.akcje { display: flex; flex-direction: column; gap: 10px; }
.akcje .btn-link { align-self: flex-start; }
.formularz-akcji { padding-top: 12px; border-top: 1px solid var(--ik-szron-300); }
.formularz-akcji:empty, .akcje-formularz:empty, .akcje:empty { display: none; }
.odczyt .v-sm { font: 400 24px/1.1 var(--font-mono); }
.odczyty-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
td .sub .st { margin-top: 6px; }
/* Dwuwyrazowa akcja łamie się między wyrazami, żeby kolumna nie wypychała tabeli poza ramkę. */
.akcja { font-weight: 600; }

@media (max-width: 760px) {
  .side { max-width: none; }
  .main { padding: 20px 16px 40px; }
  .kroki { display: none; }
  .jednostka { grid-template-columns: 1fr 1fr; }
  .historia li, .dl { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .btn22 .sq { transition: none; } }

/* Kreator po utworzeniu zlecenia: zapisane sekcje tylko do odczytu (fieldset disabled). */
fieldset.zapisane { display: contents; }
fieldset.panel { margin: 0; min-width: 0; }
fieldset.zapisane :disabled, fieldset.panel:disabled :disabled { cursor: not-allowed; opacity: 0.75; }

/* Galeria zdjęć zlecenia i podgląd pełnoekranowy (ADR-0032). */
.galeria-grupa { display: flex; flex-direction: column; gap: 12px; }
.galeria-grupa h3 { margin: 0; }
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.kafel-ramka { margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kafel-ramka figcaption { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.kafel-ramka figcaption .sub { color: var(--ik-grafit-500); }
.kafel { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; width: 100%; padding: 0; border: 1px solid var(--ik-szron-300);
  background: var(--ik-szron-100); cursor: zoom-in; overflow: hidden; }
.kafel img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kafel-ladowanie { padding: 8px; text-align: center; }
.lightbox { border: 0; padding: 16px; max-width: min(96vw, 1400px); max-height: 96vh; background: var(--ik-grafit-950); color: #fff; }
.lightbox::backdrop { background: rgb(0 0 0 / 0.8); }
.lightbox img { display: block; max-width: 100%; max-height: 76vh; margin: 12px auto; object-fit: contain; }
.lightbox-pasek { display: flex; align-items: center; gap: 16px; }
.lightbox-pasek .ikona { margin-left: auto; }
.lightbox-pasek .btn-link { color: #fff; }
.lightbox-opis { margin: 0 0 8px; }
.lightbox-flagi { display: flex; flex-wrap: wrap; gap: 8px; }
