/* jarvis-connected — jeden arkusz (1.6, ADR 0008). Zmienne CSS: motyw Jarvis (praca) i Edith
   (życie prywatne) przez [data-theme]; wariant ciemny przez prefers-color-scheme. Kolory
   accent/background muszą być równe THEME_COLORS w app/ui/theme.py (strażnik test_static_assets).
   Paleta B „Jodła i śliwka” (Praca jodła, Dom śliwka) jest jedyną paletą aplikacji, a czcionki (Plus Jakarta Sans
   dla Pracy, Nunito dla Domu) idą z własnego serwera (`fonts/`, `@font-face` poniżej, plan 104A); font-family
   tylko przez tokeny --font-ui i --font-mono (UX-SYSTEM §22).
   Progi: telefon < 640 px (pasek dolny), tablet 640–1023 px (wąska kolumna), desktop ≥ 1024 px. */

/* Czcionki (plan 104A): SIL OFL, pliki w `fonts/` (licencje: docs/LICENSES-FONTS.md). Adres względny liczony od arkusza (`/static/fonts/…`).
   `@font-face` nie da się zawęzić selektorem - nazwany wyjątek strażnika. */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url("fonts/nunito-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url("fonts/nunito-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Tokeny wspólne obu światów (plan 104A, UX-SYSTEM §22). --radius = alias --radius-ctrl do końca planu 104. */
:root,
[data-theme="jarvis"] {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #eef1ec;
  --border: #dde3dd;
  --text: #1f2a26;
  --muted: #5c6b66;
  --accent: #2f5d50;
  --accent-brand: #2f5d50;
  --accent-soft: #e1ebe6;
  --on-accent: #ffffff;
  --link: #2f5d50;
  --danger: #a23b2e;
  --danger-soft: #f7e5e1;
  --warning: #8a5100; /* ostrzeżenie (pigułka stanu, baner): kontrast 6,45:1 na --surface #fff */
  --focus: #2f5d50;
  --radius-ctrl: 8px; /* kontrolki: pola, przyciski, zakładki, banery */
  --radius-card: 12px; /* karty, tabele, sekcje, KPI */
  --radius: var(--radius-ctrl);
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 2px 8px rgba(16, 24, 40, 0.04);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 2px 8px rgba(16, 24, 40, 0.04);
  --control-h: 44px; /* jedna wysokość kontrolek */
  --card-pad: 20px; /* odstęp wewnętrzny kart poziomo (telefon 16 px niżej) */
  --card-pad-y: 16px;
  --font-ui: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, "DejaVu Sans Mono", "Liberation Mono", Consolas, monospace;
  --text-size: 0.9375rem;
  --content-max: 1440px; /* plan 74: najszersza treść na komputerze (≥ 1024 px); tablet wypełnia kolumnę obok nawigacji */
  --record-panel-w: min(560px, 40vw); /* plan 74: szerokość panelu rekordu */
  --topbar-h: 60px; /* 1.7a: 7 px luzu nad i pod toggle'em (44 px + ramka) */
  --sidenav-w: 240px;
  --tap: 44px;
  --ok: #1a7f45;
  --card-title: 1.0625rem;
}

@media (max-width: 639.98px) {
  :root,
  [data-theme="jarvis"] {
    --card-pad: 16px;
    --card-pad-y: 14px;
  }
}

[data-theme="edith"] {
  --bg: #f9f5f7;
  --surface: #fffdfe;
  --surface-2: #f1e9ee;
  --border: #e4d8df;
  --text: #2b2228;
  --muted: #6d5d68;
  --accent: #7a4b6e;
  --accent-brand: #7a4b6e;
  --accent-soft: #efe4ec;
  --on-accent: #ffffff;
  --link: #7a4b6e;
  --danger: #a4463a;
  --danger-soft: #f6e4df;
  --warning: #8a5100; /* kontrast 6,36:1 na --surface #fffdfe */
  --focus: #7a4b6e;
  --font-ui: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; /* mniejsze x-height: tekst 1 rem */
  --text-size: 1rem;
  --ok: #1a7f45;
}

@media (prefers-color-scheme: dark) {
  :root,
  [data-theme="jarvis"] {
    --bg: #121715;
    --surface: #1b2320;
    --surface-2: #242e2a;
    --border: #34413c;
    --text: #e6ece9;
    --muted: #a4b3ad;
    --accent: #8fc4b0;
    --accent-brand: #8fc4b0;
    --accent-soft: #1f3029;
    --on-accent: #102019;
    --link: #8fc4b0;
    --danger: #ff8a80;
    --danger-soft: #3a1f1c;
    --warning: #f0b24a; /* ciemny Praca: kontrast na --surface #1b2320 > 8:1 */
    --focus: #8fc4b0;
    --shadow-card: none;
    --shadow: none;
    --ok: #6fd39a;
  }
  [data-theme="edith"] {
    --bg: #1a1518;
    --surface: #251e22;
    --surface-2: #30272d;
    --border: #473b43;
    --text: #efe7ec;
    --muted: #b8a8b2;
    --accent: #c79ab9;
    --accent-brand: #c79ab9;
    --accent-soft: #33252f;
    --on-accent: #2a1623;
    --link: #c79ab9;
    --danger: #f2a094;
    --danger-soft: #3d2622;
    --warning: #e8b45a; /* ciemny Dom: kontrast na --surface #251e22 > 7:1 */
    --focus: #c79ab9;
    --shadow-card: none;
    --shadow: none;
    --ok: #6fd39a;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  font: var(--text-size)/1.5 var(--font-ui);
  color: var(--text);
  background: var(--bg);
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-columns: 1fr;
  grid-template-areas: "top" "main";
  overflow-x: hidden;
}

/* Typografia (plan 104A): rodzina i rozmiar tylko z tokenów; Plus Jakarta Sans ma wąską spację, więc Praca dostaje odstęp słów. */
body,
button,
input,
select,
textarea {
  font-family: var(--font-ui);
}
[data-theme="jarvis"] {
  word-spacing: 0.08em;
}
code,
pre,
.ux-k-code {
  font-family: var(--font-mono);
}

@media (prefers-reduced-motion: no-preference) {
  a,
  button {
    transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
  }
}

a {
  color: var(--link);
  text-underline-offset: 2px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -100px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: var(--radius);
}
.skip-link:focus {
  top: 8px;
}

/* --- nagłówek --- */
.topbar {
  grid-area: top;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--topbar-h);
  padding: 0 12px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}
.brand {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 4px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40vw;
}
.brand::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--text); /* plan 113F: kropka marki bez koloru „online” (zielony akcent czytany jak status połączenia) */
  flex: none;
}
.topbar-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
/* konto = avatar z inicjałami (1.7a): bez adresu e-mail w nagłówku, stała szerokość */
.account.avatar {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.5px;
  text-decoration: none;
}
.account.avatar:hover {
  background: var(--accent);
  color: var(--on-accent);
}

/* przełączniki: motyw i język */
.segmented {
  display: inline-flex;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
}
.seg {
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
/* przełącznik światów w akcencie świata (T1, plan 104B) */
.seg.is-active {
  background: var(--accent);
  color: var(--on-accent);
}
/* toggle w nagłówku (1.7a): aktywny segment to link Home, nieaktywny — formularz POST /ui/app */
.app-switch .seg-form {
  display: contents;
  margin: 0;
}
.app-switch .seg {
  margin: 0;
}

/* --- nawigacja --- */
.sidenav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 4px;
}
.sidenav a,
.sidenav .nav-end button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 0 14px;
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}
.ux-icon {
  width: 20px;
  height: 20px;
  flex: none;
}
.sidenav a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 700;
}
/* `:hover` tylko dla wskaźnika, który naprawdę najeżdża (plan 42, 1b): po dotknięciu na telefonie `:hover` zostaje
   przyklejony do ostatnio dotkniętego elementu (szare tło „Więcej” po zamknięciu arkusza) */
@media (hover: hover) {
  .sidenav a:hover {
    background: var(--surface-2);
  }
}
/* 2.13: nagłówek grupy „Administracja” w kolumnie (tylko administrator; na telefonie ukryty jak
   każda pozycja poza `nav-primary`) */
.sidenav .nav-group span {
  display: block;
  padding: 12px 14px 4px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--muted);
}
/* poprawki 2026-10-20: grupy kolumny - nagłówek grupy jak „Administracja”, separator = cienka linia; na telefonie
   oba ukryte (jak każda pozycja poza `nav-primary`, reguła `li:not(.nav-primary)` niżej) */
.sidenav .nav-sep {
  height: 1px;
  margin: 8px 14px;
  background: var(--border);
}

/* telefon: pasek dolny — pozycje `PHONE_BAR` świata (`nav-primary nav-pos-N`, plan 64: 5-7 równych komórek,
   bez „Więcej”; reszta opcji to kafelki Startu), bez przewijania; wylogowanie w Ustawieniach (1.7a, uwaga U7) */
.sidenav {
  grid-area: nav;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 4px 4px;
  padding-bottom: max(4px, env(safe-area-inset-bottom));
}
.sidenav ul {
  justify-content: space-around;
}
.sidenav .nav-short {
  display: none; /* krótka etykieta tylko w pasku telefonu (blok `max-width: 639.98px` niżej) */
}
.sidenav li:not(.nav-primary) {
  display: none;
}
.sidenav a {
  flex: 1 1 0;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 4px 4px;
  font-size: 0.7rem;
  line-height: 1.2;
  min-width: 0;
}
.sidenav a .ux-icon {
  width: 22px;
  height: 22px;
}
.sidenav a span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* pasek telefonu (plan 64): komórki `li.nav-primary` równej szerokości (`flex: 1 1 0`), kolejność z klasy `nav-pos-N`
   (kolejność `PHONE_BAR` świata, nie rejestru); etykieta 10,5 px bez rozstrzału — musi się mieścić także pogrubiona
   (aktywna pozycja); wielokropek zostaje tylko jako zabezpieczenie (test UI sprawdza brak obcięcia przy 375 px) */
@media (max-width: 639.98px) {
  .sidenav li.nav-primary {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
  }
  .sidenav ul {
    gap: 0; /* 7 komórek na 375 px: każdy piksel idzie na etykietę */
  }
  /* krótka etykieta (`NavItem.short_key`) tylko w pasku: pełna znika, krótka się mieści w 1/7 szerokości */
  .sidenav .nav-full {
    display: none;
  }
  .sidenav .nav-short {
    display: block;
  }
  .sidenav li.nav-pos-1 { order: 1; }
  .sidenav li.nav-pos-2 { order: 2; }
  .sidenav li.nav-pos-3 { order: 3; }
  .sidenav li.nav-pos-4 { order: 4; }
  .sidenav li.nav-pos-5 { order: 5; }
  .sidenav li.nav-pos-6 { order: 6; }
  .sidenav li.nav-pos-7 { order: 7; }
  .sidenav {
    padding-inline: 0; /* 7 komórek na 375 px: każdy piksel idzie na etykietę */
  }
  .sidenav li.nav-primary > a {
    padding-inline: 0;
  }
  .sidenav li.nav-primary > a span {
    font-size: 0.6875rem; /* 10 px przy domyślnych 16 px; rem szanuje rozmiar czcionki z przeglądarki */
    letter-spacing: 0;
  }
}
body:has(.sidenav) .content {
  padding-bottom: calc(var(--tap) + 32px);
}
/* 104F (K9): pasek telefonu = 4 pozycje + „Więcej” (arkusz `<details>` bez JS; `app.js` zamyka go kliknięciem poza nim i Esc).
   Arkusz to `div` z linkami (nie `ul/li`), żeby nie podlegał regułom komórek paska; od 640 px `li.nav-more` jest ukryty. */
.sidenav li.nav-more {
  display: flex;
}
.ux-nav-more {
  flex: 1 1 0;
  min-width: 0;
}
.ux-nav-more > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--tap);
  padding: 4px 0;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.625rem;
  line-height: 1.2;
}
.ux-nav-more > summary::-webkit-details-marker {
  display: none;
}
.ux-nav-more > summary .ux-icon {
  width: 22px;
  height: 22px;
}
.ux-nav-more[open] > summary,
.ux-nav-more > summary[aria-current] {
  background: var(--accent-soft);
  font-weight: 700;
}
.ux-nav-sheet {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: calc(var(--tap) + 12px + env(safe-area-inset-bottom));
  z-index: 70;
  max-height: 60vh;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card, var(--radius));
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.24);
}
.ux-nav-sheet-heading {
  grid-column: 1 / -1;
  margin: 8px 8px 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}
.sidenav .ux-nav-sheet a {
  flex-direction: row;
  justify-content: flex-start;
  gap: 10px;
  min-height: var(--tap);
  padding: 0 12px;
  font-size: 1rem;
  white-space: normal;
}
.sidenav .ux-nav-sheet a span {
  max-width: none;
  overflow: visible;
}
@media (min-width: 640px) {
  .sidenav ul > li.nav-more {
    display: none;
  }
}

/* --- treść --- */
.content {
  grid-area: main;
  width: 100%;
  max-width: none; /* plan 74: tablet (640-1023 px) wypełnia kolumnę; limit `--content-max` od 1024 px niżej */
  margin: 0 auto;
  padding: 16px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  min-width: 0;
}
.content-anon {
  max-width: 480px;
}
h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin: 8px 0 16px;
}
h2 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 24px 0 8px;
}
p {
  margin: 8px 0;
}

/* Treść: T4 (plan 104B) */
.content > h1 + p:not([role]),
.content > .ux-tabs + p:not([role]) {
  font-size: var(--text-size);
  line-height: 1.5;
  color: var(--text);
  max-width: 70ch;
  margin: 0 0 12px;
}
small {
  color: var(--muted);
}

/* Typografia: T13 (plan 104B) */
small {
  font-size: 0.8125rem;
}
/* Stos mono z jawnymi nazwami: na Linuksie `ui-monospace` i Menlo nie istnieją, a goły `monospace`
   rozwiązuje się przez fontconfig różnie na różnych maszynach (lokalnie DejaVu Sans Mono, na runnerze CI
   inny font) — jawna nazwa daje ten sam font tam, gdzie jest zainstalowany. Na Macu/iOS pierwszeństwo
   ma `ui-monospace`, więc wygląd dla użytkownika się nie zmienia. */
code {
  font-size: 0.95em;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  overflow-wrap: anywhere;
}
ul {
  padding-left: 20px;
}
.tiles {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.tiles-heading {
  font-size: var(--text-size);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  margin: 24px 0 8px;
}
.tiles a {
  display: flex;
  align-items: center;
  gap: 8px; /* ikona nie przykleja się do napisu (rev 25, M-1) */
  min-height: 40px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-ctrl);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

/* Start: T3 (plan 104B) */
@media (max-width: 639.98px) {
  .tiles {
    grid-template-columns: 1fr 1fr;
  }
  .tiles a {
    min-height: 44px; /* cel dotykowy na telefonie */
  }
}
/* 104F (T3): „Administracja” na Starcie zwinięta w `<details>` (nagłówek jak h2 kafelków, chevron zamiast markera) */
.tiles-admin-box > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tiles-admin-box > summary::-webkit-details-marker {
  display: none;
}
.tiles-admin-box > summary::before {
  content: "\203A";
  display: inline-block;
  transition: transform 0.15s;
}
.tiles-admin-box[open] > summary::before {
  transform: rotate(90deg);
}

/* --- formularze --- */
form {
  margin: 12px 0;
}
form.inline {
  display: inline-block;
  margin: 2px 4px 2px 0;
}
label {
  display: block;
  font-weight: 500;
  margin: 8px 0 4px;
}
/* UX-SYSTEM §14: etykieta z ikoną pomocy „?” zaraz za ostatnim słowem (`<label for>` + `.ux-help`; `inline`, nie
   `inline-block` — po zawinięciu długiej etykiety ikona zostaje przy tekście, nie w osobnej linii), kontrolka pod spodem */
.settings-label,
.ux-field > label {
  display: inline;
  vertical-align: middle;
  font-weight: 500; /* także `<span class="settings-label">` (etykieta sekretu): jak `label` */
}
.ux-field > label + .ux-help + *,
.settings-label + .ux-help + *,
.settings-label + *:not(.ux-help) {
  margin-top: 6px;
}
/* rev 77 M-1: `input[type="file"]` nie ma reguły blokowej niżej — po etykiecie `inline` zostawał w jej linii */
.ux-field > input[type="file"] {
  display: block;
  margin-top: 6px;
}
/* 104J: pole pliku (długa nazwa wybranego pliku) nie rozpycha strony szerzej niż ekran 375 px */
input[type="file"] {
  max-width: 100%;
  min-width: 0;
}
/* 113C · pole pliku: przycisk wyboru wygląda jak przycisk drugiego poziomu (ramka, 44 px), nazwa pliku przygaszona obok */
input[type="file"] {
  font: inherit;
  color: var(--muted);
}
input[type="file"]::file-selector-button {
  min-height: var(--control-h);
  margin: 0 12px 0 0;
  padding: 6px 14px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-ctrl);
  cursor: pointer;
}
@media (hover: hover) {
  input[type="file"]::file-selector-button:hover {
    background: var(--surface-2);
  }
}
:is(.ux-form, .settings-form, .ux-section-body) > .ux-field {
  min-width: 0;
}
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="search"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="url"],
select,
textarea {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 8px 12px;
  margin-top: 4px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-ctrl);
  font-family: inherit;
  font-weight: inherit;
  line-height: inherit;
}
textarea {
  min-height: 96px;
  resize: vertical;
}
/* 113C (B2 #4) · podpowiedź w polu („domyślnie: 30”) czytelna, ale inna niż wartość */
::placeholder {
  color: var(--muted);
  opacity: 1;
}
/* P4 (uwaga właściciela 2026-10-03): lista wyboru (tak/nie, język, strefa czasowa) ma szerokość OD TREŚCI (poza siatką formularza, 113C), nie 100 % wiersza
   — pole „tak” na 760 px wyglądało jak pusta belka; `max-width` chroni długą nazwę strefy na telefonie. `.ux-toolbar select`
   i `.ux-per-page select` mają własne reguły niżej. */
select {
  width: auto;
  min-width: 10ch;
  max-width: 100%;
}
/* pole daty i godziny: Safari/iOS nadaje im własną szerokość i wyśrodkowanie — mają być jak każde inne pole
   (rev 23, uwaga właściciela; 2.14: `time` w Ustawieniach → Uwaga i w cronach) */
input[type="date"],
input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
  max-width: 100%;
  text-align: left;
}
/* iOS trzyma tekst daty/godziny w osobnym elemencie z własnym wyśrodkowaniem — `text-align` na polu go nie sięga (rev 24, M-3) */
input[type="date"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value {
  text-align: left;
}
/* U6 (uwaga właściciela 2026-10-02; UX-SYSTEM §13): pole liczby i godziny ma szerokość OD TREŚCI, nie 100 % wiersza — w polu
   na całą szerokość cyfry stały po lewej, a strzałki (spinner) i wskaźnik listy podpowiedzi (`list=`) pojawiały się dopiero po
   najechaniu na prawym końcu, 700 px dalej („skaczące strzałki”). Spinner i wskaźnik `datalist` są widoczne ZAWSZE — zero zmiany
   układu przy hover. Na telefonie pola mogą być szersze, ale nigdy 100 %. Rev 75 M-2: 13ch = 6 cyfr (`100000`, sufit budżetu
   USD) + spinner + wskaźnik `datalist`; godzina 14ch mieści `11:59 PM` (locale 12-godzinne) także od tabletu. Rev 76 M-2:
   godzina ma JEDNĄ regułę dla wszystkich szerokości (duplikat w bloku telefonu usunięty), telefon poszerza tylko liczbę. */
input[type="number"] {
  width: min(12rem, 100%);
  flex: 0 0 auto;
  max-width: 12rem;
}
input[type="time"] {
  width: auto;
  min-width: 9ch;
  max-width: 14ch;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  opacity: 1;
}
input[type="number"]::-webkit-calendar-picker-indicator {
  opacity: 1;
}
/* 2.14 (UX-SYSTEM §13): liczba z jednostką po polu — jednostka nie zawija się; pola crona (godzina + wyrażenie) w rzędzie od tabletu */
.ux-with-unit {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ux-with-unit input {
  flex: 0 0 auto;
  width: min(12rem, 100%); /* U6: szerokość od treści, nie na cały wiersz; rev 75 M-2: 6 cyfr + dwa wskaźniki */
  min-width: 0;
  max-width: 12rem;
}
.ux-unit {
  flex: 0 0 auto;
  color: var(--muted, inherit);
  white-space: nowrap;
  font-size: 0.875rem;
}
/* 2.14: sekcje persony na zakładce Asystent — dwa boty, ta sama ramka co pola */
.settings-persona {
  margin: 12px 0;
  padding: 4px 16px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.settings-persona legend {
  padding: 0 6px;
  font-weight: 600;
}
.settings-cron-fields {
  display: grid;
  gap: 0 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .settings-cron-fields {
    grid-template-columns: minmax(8rem, 1fr) 2fr;
  }
}
/* plan 36 (UX-SYSTEM §16), plan 43: sekcje formularza (`form_section`: `<details name>` + `<fieldset>`) — obszary WEWNĄTRZ
   jednej zakładki; domyślnie zwinięte i wzajemnie wyłączne (natywny akordeon), kotwice `#sec-<id>` otwiera `app.js` */
.ux-section {
  margin: 0 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  scroll-margin-top: calc(var(--topbar-h) + 12px); /* sticky `.topbar` nie zasłania tytułu po skoku z kotwicy */
}
/* rev 107 M-2: cel kotwicy `#cron-…` (wiersz tabeli) tak samo nie chowa się pod przyklejonym `.topbar` */
.ux-table tr[id] {
  scroll-margin-top: calc(var(--topbar-h) + 12px);
}
.ux-section-title {
  min-height: var(--tap);
  padding: 14px var(--card-pad);
  box-sizing: border-box;
  font-weight: 700;
  cursor: pointer;
  list-style-position: inside;
  font-size: var(--card-title);
  margin: 0;
}
/* U-2 (plan 104I): licznik w nagłówku sekcji (np. „3 zmiany”) widoczny po zwinięciu; wiersz tabeli pól z odchyleniem od domyślnych */
.ux-section-meta {
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap; /* 113K: plakietka w nagłówku sekcji w jednej linii */
}
.ux-ftable-row.is-changed {
  box-shadow: inset 3px 0 0 var(--accent);
  background: var(--surface-2);
}
.ux-section-title:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}
.ux-section-intro {
  margin: 0;
  padding: 0 16px 8px;
  color: var(--muted);
}
.ux-section-body {
  min-width: 0;
  margin: 0;
  padding: 0 var(--card-pad) var(--card-pad-y);
  border: 0;
}
.ux-subsection {
  margin-top: 16px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.ux-subsection-title {
  margin: 0 0 4px;
  font-weight: 500; /* jak etykieta pola (`.settings-label`) — bez `<strong>` w szablonie */
}
/* wiersz crona w sekcji zakładki „Zadania”: tytuł | włącznik | harmonogram, pod spodem następne uruchomienie */
.settings-cron-row {
  display: grid;
  gap: 4px 16px;
  grid-template-columns: minmax(0, 1fr);
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.settings-cron-title,
.settings-cron-next {
  margin: 0;
}
.settings-cron-enabled {
  display: flex;
  align-items: center;
}
/* kontrolka w wierszu ma szerokość od treści, a „?” stoi tuż za nią (nie nad nią); etykieta „Jak często” jak „O której godzinie” */
.settings-cron-row select {
  display: inline-block;
  width: auto;
  max-width: 100%;
  margin-top: 0;
}
.settings-cron-title {
  font-weight: 600;
}
.settings-cron-next {
  color: var(--muted);
}
@media (min-width: 640px) {
  .settings-cron-row {
    grid-template-columns: minmax(7rem, 9rem) minmax(0, 1fr);
    align-items: start;
  }
  .settings-cron-title,
  .settings-cron-next {
    grid-column: 1 / -1;
  }
  /* harmonogram w jednym rzędzie: preset, godzina i wyrażenie własne obok siebie (zawijają się, gdy brak miejsca) */
  .settings-cron-schedule {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0 16px;
  }
  .settings-cron-freq {
    flex: none; /* „Jak często” + lista + „?” obok godziny i wyrażenia */
  }
  .settings-cron-schedule .settings-cron-fields {
    display: flex;
    flex: 1 1 18rem;
    flex-wrap: wrap;
    gap: 0 16px;
  }
  .settings-cron-schedule .settings-cron-at,
  .settings-cron-schedule .settings-cron-expr {
    flex: 1 1 9rem;
    margin-top: 0;
  }
}
input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin: 0 8px 0 0;
  vertical-align: middle;
  accent-color: var(--accent);
}
label:has(> input[type="checkbox"]) {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  font-weight: 400;
}
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 8px 16px;
  margin: 4px 4px 4px 0;
  font: inherit;
  font-weight: 600;
  color: var(--on-accent);
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-secondary,
form.inline button:not(:where(.btn-quiet)) {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
/* akcja główna `.btn.ux-primary` jest zielona także w `form.inline` (tam `form.inline button` ustawia tło pomocnicze;
   dwie klasy biją element + klasę) */
.btn.ux-primary {
  color: var(--on-accent);
  background: var(--accent);
  border-color: transparent;
}
/* UX-SYSTEM §19: wiersz akcji — przyciski (także w `form.inline`) obok siebie w naturalnej szerokości; poniżej 640 px
   równe kolumny, najwęższa 8 rem, potem zawijanie (113C) */
.ux-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 8px 0 0;
}
.ux-actions-row form,
.ux-actions-row .btn,
.ux-actions-row button:not(.ux-help-btn) {
  margin: 0; /* rev 555 M-2: ujemny margines pudelka dotykowego „?” zostaje */
}
@media (max-width: 639.98px) {
  .ux-actions-row > :is(.btn, form, button:not(.ux-help-btn)) {
    flex: 1 1 0;
    min-width: min(100%, 8rem);
    width: auto;
  }
  .ux-actions-row > :not(:is(.btn, form, button)) {
    flex: 0 1 auto;
    min-width: 0;
  }
  .ux-actions-row > form {
    display: flex;
  }
  .ux-actions-row > form > button,
  .ux-actions-row > form > .btn {
    flex: 1 1 auto;
    width: 100%;
  }
}
.btn-danger,
button.btn-danger {
  background: var(--danger);
  color: #fff;
}

/* Przyciski: S5, T7, W24 (plan 104B) */
.btn,
button:not([class]),
button.btn-quiet,
button.btn-secondary,
button.btn-danger {
  min-height: var(--control-h);
  padding: 6px 14px;
  border-radius: var(--radius-ctrl);
  font-weight: 600;
}
/* R1 · cichy = duch (ghost): tło przezroczyste, ramka 1 px, tekst; musi wyglądać jak przycisk („Wyloguj”, „Odepnij”,
   „Pobierz ponownie”). Wariant bez ramki (sam tekst) tylko w kilku miejscach, niżej */
.btn-quiet,
form.inline button.btn-quiet:not(.btn):not(.ux-primary) {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
@media (hover: hover) {
  .btn-quiet:hover,
  form.inline button.btn-quiet:not(.btn):not(.ux-primary):hover {
    background: var(--surface-2);
  }
}
/* drugi poziom: `.btn-secondary` i przyciski formularzy inline bez klasy cichego (wypełnienie --surface) */
.btn-secondary,
form.inline button:not(.ux-primary):not(.btn-danger):not(.btn-quiet) {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
@media (max-width: 639.98px) {
  .btn,
  button:not([class]),
  button.btn-quiet,
  button.btn-secondary,
  button.btn-danger {
    min-height: 44px;
  }
}
/* przyciski i linki w rzędach nie wystają poza własne pudełko */
.btn,
button,
.btn-quiet {
  max-width: 100%;
}
/* 113C (B2 #23) · wyłączony przycisk wygląda na wyłączony: szare tło, przygaszony tekst (nie półprzezroczysta zieleń), bez cienia */
button:is(.btn, .btn-secondary, .btn-danger, .btn-quiet, .ux-primary):disabled,
form.inline button:disabled:not(.ux-switch):not(.ux-level-btn) {
  opacity: 1;
  background: var(--surface-2);
  color: var(--muted);
  border-color: var(--border);
  box-shadow: none;
  cursor: not-allowed;
}
/* W24: JEDNA wysokość, padding, ramka, promień i rozmiar czcionki dla wszystkich pól jednowierszowych i selectów (nie dotyczy
   textarea, checkboxów, radio, range, file i przycisków-inputów). Przyciski (`.btn`, `button`) mają tę samą minimalną wysokość. */
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="image"]),
select {
  box-sizing: border-box;
  height: var(--control-h);
  min-height: var(--control-h);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-ctrl);
  line-height: 1.25;
}
/* 113C (A5) · lista rozwijana: własna strzałka z powietrzem (natywna stoi przy krawędzi i ignoruje `padding-right`); SVG w data URI
   (`img-src data:`), osobny kolor dla ciemnego motywu (w data URI nie działa `currentColor`) */
select:not([multiple]):not([size]):not(.ux-switch-select) {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%235c6b66' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 12px;
}
@media (prefers-color-scheme: dark) {
  select:not([multiple]):not([size]):not(.ux-switch-select) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23a4b3ad' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  }
}
.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}
.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;
}

/* komunikaty */
[role="alert"] {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid transparent;
}
[role="status"] {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--text);
}

/* --- tablet: nawigacja jako lewa kolumna --- */
@media (min-width: 640px) {
  body {
    grid-template-columns: var(--sidenav-w) 1fr;
    grid-template-rows: var(--topbar-h) 1fr;
    grid-template-areas: "top top" "nav main";
  }
  body:not(:has(.sidenav)) {
    grid-template-columns: 1fr;
    grid-template-areas: "top" "main";
  }
  .sidenav {
    position: sticky;
    top: var(--topbar-h);
    bottom: auto;
    left: auto;
    right: auto;
    align-self: start;
    height: calc(100dvh - var(--topbar-h));
    border-top: 0;
    border-right: 1px solid var(--border);
    padding: 12px 8px;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .sidenav ul {
    flex-direction: column;
    min-width: 0;
  }
  .sidenav li:not(.nav-primary) {
    display: flex; /* kolumna pokazuje wszystkie pozycje */
  }
  .sidenav li > a,
  .sidenav li > form {
    flex: 1 1 auto;
    min-width: 0; /* pozycja zwęża się do kolumny (180 px na tablecie) zamiast ją rozpychać */
  }
  /* Start jest zbędny przy menu bocznym (decyzja właściciela 2026-10-26): zostaje tylko w pasku telefonu */
  .sidenav ul > li.nav-home {
    display: none;
  }
  .sidenav ul {
    gap: 1px; /* gęstsze menu: rząd 37 px zamiast 48 px (-23%) */
  }
  .sidenav a {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    min-height: 36px;
    padding: 8px 14px;
    font-size: 1rem;
    line-height: 1.3;
    white-space: nowrap; /* jedna linia, wielokropek; pełna nazwa w `title` - 113B */
  }
  .sidenav a .ux-icon {
    width: 20px;
    height: 20px;
  }
  .sidenav a span {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body:has(.sidenav) .content {
    padding-bottom: 24px;
  }
  .content {
    padding: 24px;
  }
}

@media (min-width: 640px) and (max-width: 1023.98px) {
  :root {
    --sidenav-w: 180px;
  }
  /* plan 70A: „Powiadomienia” to jedno długie słowo - węższe odstępy w kolumnie zamiast szerszej kolumny
     (szersza zabierała treści 16 px i wypychała listy, np. 1:1, poza ekran) */
  .sidenav a {
    gap: 6px;
    padding: 8px 8px;
    font-size: 0.95rem;
  }
  .sidenav a .ux-icon {
    width: 18px;
    height: 18px;
  }
}

@media (min-width: 1024px) {
  .content {
    padding: 32px 40px;
  }
  .content:not(.content-anon) {
    max-width: var(--content-max);
  }
  .brand {
    max-width: none;
  }
}

/* plan 74: panel rekordu (≥ 1024 px, UX-SYSTEM §8). `<aside id="record-panel">` leży w siatce body obok `main`
   (kolumna `panel`), więc lista zwęża się zamiast być przykrywana; poniżej 1024 px panel nie istnieje (tablet
   i telefon: zwykła nawigacja). Bez klasy `has-record-panel` na body (przełącza ją `app.js` razem z atrybutem
   `hidden`) panel nie jest wyświetlany. */
.ux-record-panel,
.ux-assistant-panel {
  display: none;
}
@media (min-width: 1024px) {
  body.has-record-panel,
  body.has-assistant-panel {
    grid-template-columns: var(--sidenav-w) minmax(0, 1fr) var(--record-panel-w);
    grid-template-areas: "top top top" "nav main panel";
  }
  body.has-record-panel .ux-record-panel,
  body.has-assistant-panel .ux-assistant-panel {
    grid-area: panel;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: var(--topbar-h);
    align-self: start;
    height: calc(100dvh - var(--topbar-h));
    min-width: 0;
    background: var(--surface);
    border-left: 1px solid var(--border);
  }
  .ux-record-panel-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 8px 8px 20px;
    border-bottom: 1px solid var(--border);
    flex: none;
    min-height: 56px;
  }
  .ux-record-panel-title {
    flex: 1;
    font-weight: 700;
    min-width: 0;
    overflow: hidden;
    font-size: 1.125rem;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .ux-record-panel-bar .btn-quiet {
    margin: 0;
    min-width: var(--tap);
  }
  .ux-record-panel-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 20px 0;
    display: flex;
    flex-direction: column;
  }
  /* w panelu „Wstecz” jest zbędny (zamyka go ×); rekord nie potrzebuje też własnego odstępu od góry */
  .ux-record-panel .ux-back {
    display: none;
  }
  .ux-record-panel h1,
  .ux-record-panel .ux-record-title {
    margin-top: 0;
  }
  /* wiersz listy otwarty w panelu: to samo tło co wiersz wyróżniony skrótem, bez obrysu */
  .ux-table tbody tr.is-open {
    background: var(--accent-soft);
  }
  /* plan 82: wiersz w trakcie ładowania do panelu */
  .ux-table tbody tr.is-loading {
    cursor: progress;
  }
  .ux-table tbody tr.is-loading .ux-row-link {
    opacity: 0.6;
  }
  /* plan 91B: rozmowa w panelu asystenta - pole przyklejone do dołu panelu, tło jak panel */
  .ux-assistant-panel .ux-record-panel-body {
    padding-bottom: 0;
  }
  .ux-assistant-panel .ux-chat-composer {
    background: var(--surface);
    padding-bottom: 12px;
  }
}

/* Panel rekordu: 100B-6 (plan 104B) */
@media (min-width: 1024px) {
  .ux-record-panel-body > .ux-record {
    flex: 1 0 auto;
    margin: 0;
  }
  .ux-record-panel .ux-record-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .ux-record-panel dl.ux-fields {
    margin: 0;
  }
  .ux-record-panel .ux-field {
    margin: 0;
  }
  .ux-record-panel .ux-field > label {
    margin-bottom: 6px;
  }
}
/* plan 91B: przycisk „Asystent” w pasku górnym (tylko ≥ 1024 px - `desk-only`; otwarty panel = `aria-expanded="true"`) */
.topbar-assistant {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 4px;
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  flex: none;
}
.topbar-assistant:hover {
  background: var(--surface-2);
}
.topbar-assistant[aria-expanded="true"] {
  background: var(--accent-soft);
}
/* plan 92C: przycisk panelu = sama odznaka „AI” w kolorze akcentu (tekst z locale `assistant.panel.badge`) */
.topbar-assistant-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  line-height: 1;
  box-shadow: var(--shadow);
}
.topbar-assistant[aria-expanded="true"] .topbar-assistant-badge {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
}
/* wariant przycisku „Nowy” wg progu: panel rekordu od 1024 px (`desk-only`), panel nakładany na tablecie (`below-desk`) */
@media (max-width: 1023.98px) {
  .desk-only {
    display: none !important;
  }
}
@media (min-width: 1024px) {
  .below-desk {
    display: none !important;
  }
}

/* widoczność wg progu: `.wide-only` od tabletu, `.phone-only` tylko telefon */
@media (max-width: 639.98px) {
  .wide-only {
    display: none !important;
  }
  .brand {
    font-size: 1rem;
    max-width: 34vw;
  }
  .seg {
    padding: 0 10px;
  }
}
@media (min-width: 640px) {
  .phone-only {
    display: none !important;
  }
  .sidenav .nav-end {
    margin-top: auto;
  }
  .sidenav ul {
    height: 100%;
  }
}
.sidenav .inline {
  margin: 0;
}
.sidenav li {
  display: flex;
  align-items: center;
}
.sidenav .nav-end button {
  margin: 0;
  border: 0;
  background: transparent;
  width: 100%;
  justify-content: flex-start;
}
.sidenav .nav-end button:hover {
  background: var(--surface-2);
}

/* Menu boczne i pasek telefonu: S8, T2 (plan 104B) */
@media (min-width: 640px) {
  .sidenav a[aria-current="page"] {
    box-shadow: inset 3px 0 0 var(--text);
    border-radius: 0 var(--radius-ctrl) var(--radius-ctrl) 0;
    background: var(--surface-2);
  }
  .sidenav a[aria-current="page"] .ux-icon {
    color: var(--text);
  }
}
@media (max-width: 639.98px) {
  .sidenav li.nav-primary > a[aria-current="page"],
  .sidenav li.nav-primary > a[aria-current="page"] span,
  .sidenav li.nav-primary > a[aria-current="page"] .ux-icon {
    color: var(--text);
    font-weight: 700;
  }
  /* kontrast: akcent na --accent-soft ma 4,3 : 1 (Praca) i 3,8 : 1 (Dom), na --surface 5,0 / 4,53 - więc aktywna komórka bez tła */
  .sidenav li.nav-primary > a[aria-current="page"] {
    background: transparent;
    box-shadow: inset 0 2px 0 var(--text);
  }
}



/* ==========================================================================================
   System UX (1.7, ADR 0008, docs/UX-SYSTEM.md) — jedna sekcja per wzorzec z app/templates/ui/_ux.html.
   Kolory tylko ze zmiennych motywu; cele dotykowe ≥ var(--tap); karty < 640 px zamiast tabeli.
   ========================================================================================== */

/* --- lista: toolbar --- */
.ux-list {
  margin: 12px 0 24px;
}
.ux-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}
.ux-toolbar label {
  margin: 0;
  font-weight: 500;
}
.ux-toolbar input,
.ux-toolbar select {
  margin-top: 0;
}
.ux-search {
  flex: 1 1 200px;
  min-width: 0;
}
.ux-per-page {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 0.875rem;
}
.ux-per-page select {
  width: auto;
  min-width: 0; /* P4: ogólne `select { min-width: 10ch }` nie dotyczy „na stronie” w toolbarze (golden `/notes`) */
}
.ux-toolbar .btn-quiet,
.ux-toolbar .btn {
  margin: 0;
}
.ux-toolbar .ux-primary {
  order: -1; /* akcja główna listy jako pierwsza w toolbarze (1.7a) */
}
.ux-toolbar .ux-secondary {
  order: -1; /* akcja dodatkowa (plan 27) zaraz za główną — oba `order: -1`, kolejność źródła */
}
@media (max-width: 639.98px) {
  .ux-toolbar .ux-primary {
    flex-basis: 100%;
  }
}
.ux-count {
  flex-basis: auto;
  padding: 0;
  background: none;
  color: var(--muted);
  margin-left: auto;
  font-size: 0.875rem;
}

/* --- lista: pasek akcji masowych (widoczny tylko z zaznaczeniem) --- */
.ux-bulk {
  margin: 0;
}
.ux-bulk-bar {
  display: none;
  position: sticky;
  top: var(--topbar-h);
  z-index: 10;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 0 0 8px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.ux-bulk:has(input[name="ids"]:checked) .ux-bulk-bar {
  display: flex;
  flex-wrap: wrap;
}
/* M04.5/M04.6 (plan 104H): pasek akcji masowych widoczny zawsze (`list_view(bulk_visible=true)`); do pierwszego zaznaczenia przyciski są wyszarzone, a podpis podpowiada, co zrobić */
.ux-bulk.is-visible .ux-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  position: static;
}
.ux-bulk.is-visible:not(:has(input[name="ids"]:checked)) .ux-bulk-bar .btn:not(.btn-quiet),
.ux-bulk.is-visible:not(:has(input[name="ids"]:checked)) .ux-bulk-bar button:not(.btn-quiet) {
  opacity: 0.5;
  pointer-events: none;
}
.ux-bulk.is-visible .ux-bulk-count:empty::before {
  content: attr(data-empty-label);
  font-weight: 400;
  color: var(--muted);
}
/* Filtr stron Notion (plan 39, Z2b): pola „Nazwa właściwości” i „Szukana wartość” mają sens tylko dla
   opcji „property” — przeglądarka chowa je selektorem `:has`, bez JS (CSP zabrania inline). Gdy
   przeglądarka nie zna `:has` (stare silniki), reguła się nie stosuje i pola zostają widoczne —
   formularz działa jak przed zmianą, nic nie znika na zawsze. Błąd walidacji leży przy polu rodzaju
   filtra (zawsze widocznym), więc nigdy nie wpada w ukryty blok. */
#notion-filter:has(select[name="import_filter"] option[value="property"]:not(:checked))
  .notion-filter-property {
  display: none;
}
.ux-bulk-bar .btn,
.ux-bulk-bar button {
  margin: 0;
}
.ux-bulk-count {
  font-weight: 600;
  margin-right: auto;
}

/* plan 50 D3 B6: wiersz wyróżniony skrótami klawiszowymi (j/k) - obrys i tło z tokenów motywu, oba motywy */
.ux-table tbody tr.is-current {
  background: var(--surface-2);
  outline: 2px solid var(--text);
  outline-offset: -2px;
}
.ux-shortcuts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0 0 16px;
}
.ux-shortcuts dt {
  font-weight: 600;
  font-family: var(--font-mono);
}
.ux-shortcuts dd {
  margin: 0;
}

/* --- lista: tabela --- */
.ux-table-wrap {
  container-type: inline-size; /* `@container` poniżej: kolumny drugorzędne (`hide_below`) znikają wg szerokości TABELI, nie okna */
  overflow-x: auto;
  position: relative; /* 2.3: blok zawierający dla `.visually-hidden` w nagłówku kolumny akcji — inaczej
     pozycjonowany absolutnie napis leżał poza przewijanym opakowaniem i rozpychał stronę (7 kolumn na 834 px) */
  -webkit-overflow-scrolling: touch;
}
.ux-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: clip; /* plan 84: `hidden` robiłoby z tabeli kontener przewijania i `sticky` kolumny akcji nie działałoby względem `.ux-table-wrap` */
}
.ux-table th,
.ux-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.ux-table tbody tr:last-child td {
  border-bottom: 0;
}
.ux-table th {
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  white-space: nowrap;
  position: relative; /* plan 47: blok zawierający dla uchwytu zmiany szerokości `.ux-col-grip` */
}
/* domyślne szerokości kolumn (plan 82, UX-SYSTEM §1; typ z `app/ui/listing.py::COLUMN_KINDS`, klasa `ux-k-<typ>` na `th` i `td`):
   układ `table-layout: auto` dzieli miejsce proporcjonalnie do treści (Blink: szerokość = min + t × (max − min)), więc reguły typu mogą
   tylko mówić PRAWDĘ o treści: `nowrap` dla krótkich wartości (min = max = wartość), `break-word` dla tekstu (min = najdłuższe słowo),
   `anywhere` WYŁĄCZNIE dla adresów i kluczy (min = jeden znak) i wtedy z podłogą `min-width`. Jedyna inna podłoga to pierwsza kolumna.
   `max-width` na komórkach Chrome ignoruje w układzie automatycznym - nie używać. Karty (< 640 px) bez zmian. */
@media (min-width: 640px) {
  .ux-table th {
    font-size: var(--text-size);
    white-space: normal;
    overflow-wrap: normal;
    background: transparent;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    vertical-align: bottom;
    line-height: 1.4;
  }
  .ux-table .ux-k-main {
    min-width: 10rem;
    overflow-wrap: break-word;
  }
  .ux-table .ux-k-person,
  .ux-table .ux-k-long,
  .ux-table .ux-k-tag,
  .ux-table .ux-k-text {
    overflow-wrap: break-word;
  }
  .ux-table .ux-k-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
  }
  /* stany i liczby nie łamią się i zajmują dokładnie tyle, ile potrzebują - dopóki tabela ma >= 720 px; w węższej (tablet obok
     menu, panel rekordu) zwykłe łamanie na spacjach. `width: 1%` TYLKO razem z `nowrap` (inaczej kolumna ma dosłownie 1 %).
     Data NIE jest `nowrap` (plan 82): „2026-10-10 12:25 CEST” łamie się na spacjach (min-content = data), więc tabela mieści się
     w opakowaniu bez przewijania poziomego i bez chowania kolumn */
  @container (min-width: 720px) {
    .ux-table td.ux-k-status,
    .ux-table td.ux-k-bool,
    .ux-table td.ux-k-num {
      white-space: nowrap;
    }
    .ux-table .ux-k-status,
    .ux-table .ux-k-bool,
    .ux-table .ux-k-num {
      width: 1%;
    }
    /* plan 113B: długi tekst nie schodzi poniżej ~16 znaków, gdy tabela ma miejsce (Notatki „Treść”, 1:1 „Opis”) */
    .ux-table .ux-k-long {
      min-width: 16ch;
    }
    .ux-table td.ux-k-date .ux-badges,
    .ux-table td.ux-k-status .ux-badges {
      display: block; /* plakietka („po terminie”) schodzi pod wartość zamiast ją poszerzać */
    }
  }
  .ux-table .ux-k-code {
    min-width: 6rem;
    overflow-wrap: anywhere;
  }
}
/* `hide_below` kolumny (`sm` < 520 px, `md` < 720 px, `lg` < 960 px, `xl` < 1200 px szerokości TABELI): obok menu, przy otwartym panelu
   rekordu i na laptopie 1280-1440 px tabela jest za wąska na 7-10 kolumn, więc kolumny drugorzędne znikają (są w rekordzie); tylko tabela
   (>= 640 px okna) - karty telefonu pokazują wszystko */
@media (min-width: 640px) {
  @container (max-width: 519.98px) {
    .ux-table .ux-hide-sm {
      display: none;
    }
  }
  @container (max-width: 719.98px) {
    .ux-table .ux-hide-md {
      display: none;
    }
  }
  @container (max-width: 959.98px) {
    .ux-table .ux-hide-lg {
      display: none;
    }
  }
  @container (max-width: 1199.98px) {
    .ux-table .ux-hide-xl {
      display: none;
    }
  }
}
/* tablet (kolumna menu 180 px zostawia ~600 px): węższa podłoga pierwszej kolumny (plan 82: 6 rem, żeby Zadania mieściły się bez przewijania) */
@media (min-width: 640px) and (max-width: 1023.98px) {
  .ux-table .ux-k-main {
    min-width: 6rem;
  }
}
/* plan 47 → plan 82: uchwyt przy prawej krawędzi KAŻDEJ kolumny danych (tylko >= 900 px, 113B; w spoczynku niewidoczny — zero zmian
   pikseli). Uchwyt zmienia TYLKO swoją kolumnę; JS zamraża tabelę (`.is-resized`, px na każdym `th` poza `.ux-col-fill`) dopiero po
   pierwszym ruchu, więc bez zapisu tabela zostaje w układzie automatycznym. Resztę miejsca bierze pusta kolumna `.ux-col-fill`;
   suma px większa niż opakowanie = tabela szersza niż `.ux-table-wrap` (przewijanie poziome), żadna inna kolumna się nie rusza. */
.ux-col-grip {
  position: absolute;
  right: 0;
  top: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  opacity: 0;
  touch-action: none;
}
.ux-col-grip::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 2px;
  height: 100%;
  background: var(--accent);
}
.ux-table th:hover .ux-col-grip,
.ux-col-grip:focus-visible,
.ux-col-grip.is-dragging {
  opacity: 1;
}
/* `!important` przebija `#<lista> th { padding-left/right }`: kolumna wypełniająca ma mieć 0 px */
.ux-table .ux-col-fill {
  padding: 0 !important;
  width: 0;
}
.ux-table.is-resized {
  table-layout: fixed;
}
.ux-table.is-resized .ux-col-fill {
  width: auto;
}
.ux-table.is-resized td {
  overflow-wrap: anywhere;
}
/* po ręcznej zmianie: minimum uchwytu = cała etykieta nagłówka, wielokropek działa */
.ux-table.is-resized th {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 113J: migawka szerokości zaokrągla w dół, więc kolumna równa etykiecie traci ułamek piksela - link sortowania mieści się w kolumnie
   (bez tego nieściśnięty `inline-flex` wystawał poza nagłówek) */
.ux-table.is-resized th .ux-sort {
  max-width: 100%;
  overflow: hidden;
}
@media (max-width: 899.98px) {
  .ux-col-grip {
    display: none;
  }
}
@media (max-width: 639.98px) {
  .ux-table .ux-col-fill {
    display: none; /* karty: pusta komórka nie ma czego pokazać */
  }
}
/* karty (< 640 px): klucze i adresy bez spacji (e-mail, klucz promptu) łamią się jak dotąd; od 640 px robi to reguła typu `code` */
@media (max-width: 639.98px) {
  .ux-table .col-key,
  .ux-table .col-model,
  .ux-table .col-email {
    overflow-wrap: anywhere;
  }
}
/* podświetlenie TYLKO wierszy interaktywnych (link rekordu, zaznaczanie, akcje); na iOS `:hover` „przykleja się”
   po dotknięciu, więc wiersz bez akcji nie może szarzeć (uwaga właściciela 2026-10-03) */
.ux-table tbody tr:has(.ux-row-link):hover,
.ux-table tbody tr:has(.ux-col-select):hover,
.ux-table tbody tr:has(td.ux-col-actions > *):hover {
  background: var(--surface-2);
}
.ux-table tr:has(input[name="ids"]:checked) {
  background: var(--accent-soft);
}
/* pod-wiersz z pozycjami (`row.subitems` w `list_view`, np. propozycje zadań pod mailem): ciągnie się z wierszem nad sobą,
   nie jest wierszem interaktywnym (bez hover i kursora rekordu) */
.ux-table tbody tr:has(+ .ux-row-sub) td {
  border-bottom: 0;
}
.ux-table .ux-row-sub td {
  padding: 0 12px 10px;
}
.ux-subitems {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}
.ux-subitem {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: var(--radius);
}
.ux-subitem-text {
  flex: 1 1 16rem;
  min-width: 0;
  overflow-wrap: anywhere;
}
.ux-subitem-meta {
  color: var(--muted);
  font-size: 0.9rem;
}
.ux-subitem-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
/* nagłówek grupy wierszy (`row.group` w `list_view`): nie jest wierszem interaktywnym, więc bez hover */
.ux-group-row th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  padding: 6px 12px;
  border-top: 1px solid var(--border);
}
.ux-table .ux-col-select {
  width: 44px;
  padding: 4px 8px;
}
.ux-table .ux-col-select label {
  margin: 0;
  min-height: var(--tap);
  justify-content: center;
}
.ux-table .ux-col-select input[type="checkbox"] {
  margin: 0;
}
.ux-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  color: inherit;
  text-decoration: none;
}
.ux-sort::after {
  content: "\2195";
  opacity: 0.5;
}
.ux-sort.is-active {
  color: var(--text);
}
.ux-sort.is-active::after {
  opacity: 1;
}
.ux-sort.is-asc::after {
  content: "\2191";
}
.ux-sort.is-desc::after {
  content: "\2193";
}
.ux-table tbody tr:has(.ux-row-link) {
  cursor: pointer; /* cały wiersz otwiera rekord — app.js klika w .ux-row-link (1.7a) */
}
/* akcje na wierszu (1.8): ikony 44 px, kolumna ostatnia do prawej; karta: prawy górny róg obok checkboxa */
/* plan 84: ikony akcji układają się w siatce o NAJMNIEJSZEJ liczbie wierszy, po równo (N ikon, c w wierszu: r = ceil(N/c), c = ceil(N/r)).
   `--act-n` = liczba ikon najliczniejszego wiersza (z liczby dzieci komórki, max 6); `--act-cols` ustawia `app.js` (CSSOM) TYLKO gdy
   wszystkie ikony w jednym wierszu się nie mieszczą - bez niej kolumna ma szerokość `--act-n` ikon (jeden wiersz). Szerokość kolumny
   (c × 48 px + padding) pochodzi z liczby ikon, NIGDY z pomiaru i nie jest zamrażana w px przez uchwyty; minimum = jedna ikona.
   Od 640 px kolumna przykleja się do prawej krawędzi opakowania (`sticky`), więc przy przewijaniu poziomym (panel rekordu, szerokie
   kolumny) ikony zostają w widoku; od 640 px ikona ma margines 2 px (rozstaw 48 px), karty (< 640 px) używają `gap`. */
.ux-table {
  --act-n: 1;
  line-height: 1.45;
}
.ux-table:has(td.ux-col-actions > :nth-child(2 of :not(.is-overflow))) {
  --act-n: 2;
}
.ux-table:has(td.ux-col-actions > :nth-child(3 of :not(.is-overflow))) {
  --act-n: 3;
}
.ux-table:has(td.ux-col-actions > :nth-child(4 of :not(.is-overflow))) {
  --act-n: 4;
}
.ux-table:has(td.ux-col-actions > :nth-child(5 of :not(.is-overflow))) {
  --act-n: 5;
}
.ux-table:has(td.ux-col-actions > :nth-child(6 of :not(.is-overflow))) {
  --act-n: 6;
}
/* plan 113B (priority+): akcje `menu` jako ikony, gdy kolumna ma miejsce - `app.js` (`fitActions`) dokłada `is-actions-all` */
.ux-col-actions .is-overflow {
  display: none;
}
.ux-table.is-actions-all .ux-col-actions .is-overflow {
  display: inline-flex;
}
.ux-table.is-actions-all .ux-col-actions .ux-row-menu {
  display: none;
}
.ux-table.is-actions-all:has(td.ux-col-actions > :nth-child(2 of :not(.ux-row-menu))) {
  --act-n: 2;
}
.ux-table.is-actions-all:has(td.ux-col-actions > :nth-child(3 of :not(.ux-row-menu))) {
  --act-n: 3;
}
.ux-table.is-actions-all:has(td.ux-col-actions > :nth-child(4 of :not(.ux-row-menu))) {
  --act-n: 4;
}
.ux-table.is-actions-all:has(td.ux-col-actions > :nth-child(5 of :not(.ux-row-menu))) {
  --act-n: 5;
}
.ux-table.is-actions-all:has(td.ux-col-actions > :nth-child(6 of :not(.ux-row-menu))) {
  --act-n: 6;
}
.ux-table .ux-col-actions {
  text-align: right;
}
@media (min-width: 640px) {
  .ux-table th.ux-col-actions,
  .ux-table td.ux-col-actions {
    box-sizing: border-box;
    width: calc(var(--act-cols, var(--act-n)) * 48px + 2px); /* c ikon (48 px z marginesem) + 2 px zapasu na zaokrąglenia: nigdy c + 1 */
    min-width: calc(var(--act-cols, var(--act-n)) * 48px + 2px); /* układ automatyczny nie zwęzi kolumny poniżej c ikon (inne kolumny schodzą do minimów) */
    padding-left: 0 !important; /* przebija `#<lista> td { padding }`: szerokość kolumny liczy się tylko z ikon */
    padding-right: 0 !important;
    padding-top: 0;
    padding-bottom: 0;
    white-space: normal;
    position: sticky;
    right: 0;
    z-index: 1;
  }
  .ux-table td.ux-col-actions {
    background: var(--surface);
  }
  .ux-table th.ux-col-actions {
    background: var(--surface);
  }
  .ux-table td.ux-col-actions > * {
    margin: 2px;
  }
  .ux-table tbody tr:has(td.ux-col-actions > *):hover td.ux-col-actions {
    background: var(--surface-2);
  }
  .ux-table tbody tr:has(input[name="ids"]:checked) td.ux-col-actions,
  .ux-table tbody tr.is-current td.ux-col-actions,
  .ux-table tbody tr.is-open td.ux-col-actions {
    background: var(--accent-soft); /* komórka akcji ma własne tło (sticky) - wyróżnienie wiersza obejmuje też ją */
  }
}
.ux-row-action,
.ux-row-action-form {
  display: inline-flex;
  vertical-align: middle;
}
.ux-row-action-form {
  margin: 0;
}
.ux-row-action {
  align-items: center;
  justify-content: center;
  min-width: var(--tap);
  min-height: var(--tap);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  position: relative;
}
.ux-row-action:hover {
  background: var(--surface-2);
  color: var(--text);
}
.ux-row-action.is-danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
}
/* T24 (plan 104H): akcja GŁÓWNA wiersza jako przycisk z napisem (`row_actions[].text`) - zawsze widoczna, obok ikon rzadkich akcji */
.ux-row-action.is-text {
  padding: 0 12px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
.ux-row-action.is-text:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.ux-row-action.is-text.is-quiet {
  border-color: var(--border);
  color: var(--text);
}
.ux-row-action.is-text.is-quiet:hover {
  background: var(--surface-2);
  color: var(--text);
}
@media (min-width: 640px) {
  /* kolumna akcji z przyciskiem tekstowym nie liczy szerokości z ikon (48 px) - bierze szerokość zawartości */
  .ux-table:has(td.ux-col-actions .is-text) th.ux-col-actions,
  .ux-table:has(td.ux-col-actions .is-text) td.ux-col-actions {
    width: auto;
    min-width: 0;
    white-space: nowrap;
  }
  /* 104J: po ręcznej zmianie szerokości kolumn (`.is-resized`, układ stały) kolumna `width: auto` miałaby 0 px - przycisk tekstowy
     i ikony wypadałyby poza opakowanie; szerokość = ikony (48 px) + zapas na jeden napis */
  .ux-table.is-resized:has(td.ux-col-actions .is-text) th.ux-col-actions,
  .ux-table.is-resized:has(td.ux-col-actions .is-text) td.ux-col-actions {
    width: calc(var(--act-n) * 48px + 5rem); /* bez `--act-cols`: przycisk tekstowy się nie zawija, siatka ikon nie ma zastosowania */
  }
}
.ux-row-link {
  display: block;
  min-height: 24px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.ux-row-link:hover {
  text-decoration: underline;
}
/* plan 67 A2b: lista 1:1 ma 7 kolumn - imię osoby i link do notatek łamią się tylko na spacjach,
   nigdy w środku słowa („Now/ak”, „Noti/on”); wolne miejsce oddają kolumny tekstowe */
#one-on-one-list .col-person .ux-row-link,
#one-on-one-list .col-notes a {
  overflow-wrap: normal;
}
#one-on-one-list .ux-table th {
  white-space: normal; /* nagłówki dwuwyrazowe zawijają się na spacji zamiast rozpychać tabelę */
}
#team-list .ux-table th {
  white-space: normal; /* plan 49A: długi nagłówek grupy ("Marek (spoza Osób) · 2 otwarte · + Dodaj do Osób") zawija się na 375 px */
}
.ux-table td small {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* karty zamiast tabeli na telefonie (ADR 0008 §3) */
@media (max-width: 639.98px) {
  .ux-table,
  .ux-table tbody,
  .ux-table tr,
  .ux-table td {
    display: block;
  }
  .ux-table {
    border: 0;
    background: none;
  }
  .ux-table tr {
    position: relative;
    display: flex; /* karta: kolejność komórek przez `order` — tytuł, pod nim meta (data), reszta */
    flex-direction: column;
    margin: 0 0 8px;
    padding: 4px 0 8px; /* dolny odstęp na karcie, nie na `td:last-child` — po `order` ostatnia w DOM ≠ ostatnia wizualnie (rev 24, M-4) */
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
  }
  .ux-table td {
    display: flex;
    gap: 12px;
    padding: 6px 12px;
    border-bottom: 0;
  }
  /* nagłówek grupy w trybie kart: zwykły napis nad kartami, bez ramki karty */
  .ux-table .ux-group-row,
  .ux-table .ux-group-row th {
    display: block;
  }
  .ux-table .ux-group-row {
    margin: 12px 0 4px;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .ux-table .ux-group-row th {
    padding: 0 4px;
    background: none;
    border: 0;
  }
  /* pod-wiersz pod kartą: dolna część tej samej karty, przyciski w jednym rzędzie */
  .ux-table tbody tr:has(+ .ux-row-sub) {
    margin-bottom: 0;
    padding-bottom: 4px;
    border-bottom: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: none;
  }
  .ux-table tbody tr.ux-row-sub {
    padding: 0 0 8px;
    border-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }
  .ux-table .ux-row-sub td {
    display: block;
    padding: 0 12px;
  }
  .ux-table .ux-row-sub td::before {
    display: none;
  }
  .ux-subitem-actions {
    flex-wrap: nowrap;
    width: 100%;
  }
  .ux-subitem-actions .btn {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: 6px;
  }
  .ux-table td::before {
    content: attr(data-label);
    flex: 0 0 96px; /* stała szerokość etykiety = wartości w jednej linii pionowej (1.7a, uwaga U4) */
    color: var(--muted);
    font-size: 0.8125rem;
  }
  /* nagłówek karty: pierwsza komórka (link rekordu) bez etykiety, na całą szerokość; miejsce na checkbox */
  .ux-table td.ux-cell-main {
    display: block;
    order: -2;
    padding: 10px 12px 2px;
  }
  /* akcje karty: pod treścią, wiersz wyrównany do prawej (ikony po 44 px z odstępem 4 px) */
  .ux-table td.ux-col-actions {
    position: static;
    width: auto;
    padding: 0 8px 4px;
    display: flex;
    flex-wrap: wrap; /* plan 84: nadmiar ikon zawija się do siatki po równo (limit szerokości niżej, `--act-cols`) */
    gap: 4px;
    justify-content: flex-end;
    align-self: flex-end;
    max-width: none;
  }
  .ux-table td.ux-col-actions::before {
    content: none;
  }
  /* od TRZECIEJ akcji ikony schodzą pod treść karty (wiersz wyrównany do prawej), a róg zostaje dla checkboxa —
     4 ikony w rogu zostawiały tytułowi 28 px na 320 px (rev 26, I-1) */
  .ux-table tbody tr:has(td.ux-col-actions > :nth-child(3 of :not(.is-overflow))) td.ux-col-actions {
    position: static; /* komórka akcji jest ostatnia w DOM, treść ma `order` ujemny — bez `order` */
    justify-content: flex-end;
    box-sizing: border-box;
    align-self: flex-end;
    max-width: calc(var(--act-cols, 6) * 48px + 12px); /* c ikon w wierszu (c × 44 + (c − 1) × 4 + padding 16 px) */
    padding: 0 8px 4px;
  }
  /* telefon 320 px: karta ma 288 px, 6 ikon (mail) w jednym wierszu się nie mieści - 3 + 3 zamiast 5 + 1 */
  @container (max-width: 299.98px) {
    .ux-table tbody tr:has(td.ux-col-actions > :nth-child(6 of :not(.is-overflow))) {
      --act-cols: 3;
    }
  }
  .ux-table td.ux-cell-main::before {
    content: none;
  }
  /* meta (np. data) pod tytułem, bez etykiety */
  .ux-table td.ux-cell-meta {
    order: -1; /* tuż pod tytułem, bez etykiety (uwaga właściciela 2026-09-27) */
    padding-top: 0;
    padding-bottom: 8px;
    color: var(--muted);
    font-size: 0.8125rem;
  }
  .ux-table td.ux-cell-meta::before {
    content: none;
  }
  .ux-table .ux-col-select {
    position: absolute;
    width: auto;
    padding: 0;
  }
  .ux-table .ux-col-select::before {
    content: none;
  }
  /* nagłówek tabeli = pasek sortowania nad kartami (tylko kolumny sortowalne + „zaznacz wszystkie") */
  .ux-table thead {
    display: block;
  }
  .ux-table thead tr {
    position: static;
    display: flex;
    flex-direction: row; /* pasek chipów w wierszu — karty (`tbody tr`) są kolumną flex */
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    margin: 0 0 8px;
    padding: 0;
    background: none;
    border: 0;
  }
  .ux-table th {
    display: inline-flex;
    align-items: center;
    padding: 0;
    border: 0;
    background: none;
  }
  .ux-table thead th:not(.ux-col-select):not(:has(.ux-sort)) {
    display: none; /* tylko w `thead` — nagłówek grupy (`tbody`) ma zostać */
  }
  .ux-table th.ux-col-select {
    position: static;
    width: auto;
  }
  .ux-table th .ux-sort {
    min-height: var(--tap);
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
  }
  .ux-table th .ux-sort.is-active {
    background: var(--accent-soft);
  }
}

/* --- lista: stronicowanie i pusty stan --- */
.ux-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 12px 0;
}
.ux-pagination .btn-quiet {
  margin: 0;
}
.ux-page-of {
  color: var(--muted);
  padding: 0 8px;
}
.ux-empty {
  padding: 32px 16px;
  text-align: center;
  background: var(--surface-2);
  border: 0;
  border-radius: var(--radius-card);
  color: var(--muted);
}
.ux-empty-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}
/* plan 113G (T16): ikona modułu w pustym stanie - 32 px, przygaszona, nad tytułem */
.ux-empty-icon { display: block; margin: 0 auto 8px; color: var(--muted); }
.ux-empty-icon .ux-icon { display: block; margin: 0 auto; width: 32px; height: 32px; }
/* --- plan 113F (M90-M92.1, UX-SYSTEM §31): karta bez logowania `anon_card` - logowanie, pierwsze uruchomienie, aktywacja,
   nieważny link, offline, „Przełącz i otwórz”. Ton `is-info` = szary pasek jak baner informacyjny, nigdy czerwień --- */
.ux-anon-card {
  width: 100%;
  max-width: 400px;
  margin: 8px auto 0;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.ux-anon-card.is-info {
  border-left: 3px solid var(--muted);
}
.ux-anon-title {
  font-size: 1.5rem;
  line-height: 1.25;
  margin: 0 0 8px;
}
.ux-anon-text {
  margin: 0 0 16px;
  color: var(--muted);
}
.ux-anon-card .ux-banner {
  margin: 0 0 12px;
}
.ux-anon-form {
  margin: 0;
}
.ux-anon-form > .ux-field {
  margin: 0 0 12px;
}
.ux-anon-check {
  margin: 0 0 4px;
}
.ux-anon-action-form {
  margin: 0;
}
/* jedna akcja główna = cała szerokość karty (cel dotykowy na telefonie) */
.ux-anon-form > button[type="submit"],
.ux-anon-action {
  display: flex;
  width: 100%;
  margin: 8px 0 0;
}
@media (max-width: 639.98px) {
  .ux-anon-card {
    margin-top: 0;
    padding: 20px 16px;
  }
}
/* od tabletu karta stoi na środku wysokości (body = siatka `top` + `main` 1fr, więc `main` ma pełną wysokość); na telefonie
   u góry - klawiatura nie przesuwa formularza */
@media (min-width: 640px) {
  .content-anon:has(> .ux-anon-card) {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}
.ux-loading {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius);
}
@media (prefers-reduced-motion: no-preference) {
  .ux-loading {
    animation: ux-shimmer 1.4s linear infinite;
  }
}
@keyframes ux-shimmer {
  to {
    background-position: -200% 0;
  }
}

/* --- rekord: nagłówek to `page_head` (plan 104C2; reguły niżej, przy bloku 104C1), „Wstecz” jako przycisk z ramką (plan 104B), zakładki --- */
.ux-back {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: var(--control-h);
  border: 1px solid var(--border);
  border-radius: var(--radius-ctrl);
  padding: 0 10px;
  white-space: nowrap; /* T20 */
  text-decoration: none;
}

/* --- nagłówek strony `page_head` (plan 103B, UX-SYSTEM §21): tytuł po lewej, akcje strony po prawej; od prawej: akcja główna
   (wypełniona), drugorzędne (ramka), `danger` najdalej z lewej z odstępem 16 px (8 px przerwy + 8 px marginesu). Telefon:
   tytuł w jednej linii (wielokropek), pod nim akcje w rzędzie przewijanym poziomo, główna PIERWSZA (`order`, nie DOM). --- */
.ux-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 8px 0 16px;
}
.ux-page-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}
.ux-page-title h1 {
  margin: 0;
  min-width: 0;
}
.ux-page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}
.ux-page-actions .btn,
.ux-page-actions button,
.ux-page-actions form {
  margin: 0;
}
.ux-page-actions form.inline {
  display: inline-flex;
}
.ux-page-actions form.inline button.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.ux-page-actions .ux-page-danger {
  margin-right: 8px;
}
.ux-page-actions .btn .ux-icon {
  width: 18px;
  height: 18px;
  margin-right: 6px;
}
.ux-page-more {
  position: relative;
}
.ux-page-more > summary {
  list-style: none;
  cursor: pointer;
}
.ux-page-more > summary::-webkit-details-marker {
  display: none;
}
.ux-page-more > summary .ux-icon {
  margin-right: 0;
}
.ux-page-more-list {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 30;
  min-width: 180px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}
@media (max-width: 639.98px) {
  .ux-page-head {
    display: block;
  }
  .ux-page-title h1 {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .ux-page-actions {
    flex-wrap: wrap; /* 113K: druga linia zamiast przewijania - „Usuń” zawsze widoczny */
    justify-content: flex-start;
    margin: 8px 0 0;
    padding: 0 0 4px;
  }
  .ux-page-actions > * {
    flex: none;
  }
  .ux-page-actions .ux-primary {
    order: -1;
  }
  /* 113D (B1 A6, B2 #31): „Usuń” ostatni w rzędzie telefonu, z dala od „Zapisz” */
  .ux-page-actions > .ux-page-danger,
  .ux-page-actions > .ux-action:has(> .ux-page-danger) {
    order: 99;
    margin-right: 0;
    margin-left: 8px;
  }
  /* 113D (B1 A15): tytuł rekordu do dwóch linii, nie wielokropek po kilku słowach */
  .ux-page-title h1.ux-record-title,
  .ux-page-title h2.ux-record-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    white-space: normal;
    text-overflow: clip;
  }
  /* menu „⋯” jako dolny arkusz (przewijany rząd obcinałby listę absolutną) */
  .ux-page-more-list {
    position: fixed;
    left: 16px;
    right: 16px;
    top: auto;
    bottom: calc(var(--tap) + 16px + env(safe-area-inset-bottom));
  }
}
/* --- plan 104C1: „Wstecz” w nagłówku (W30), akcja z „?” w jednym opakowaniu (W12), ikony akcji (S6/W13/W34) i przycisk z menu (W29) --- */
.ux-page-title .ux-back {
  flex: none;
  white-space: nowrap;
}
.ux-page-title h1 {
  overflow-wrap: anywhere;
}
.ux-action {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}
.ux-has-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}
.ux-has-icon .ux-icon,
.btn.ux-primary .ux-icon {
  width: 18px;
  height: 18px;
  flex: none;
}
.btn.ux-primary:has(.ux-icon) {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.ux-page-actions .btn .ux-icon {
  margin-right: 0;
}
/* poniżej 1024 px przyciski drugorzędne z ikoną to sama ikona (tekst zostaje w `aria-label`/`title` i dla czytnika); akcja główna
   zawsze z tekstem; w menu „⋯” pozycje z tekstem.
   113D: akcje rekordu i jedyna drugorzędna akcja strony zostają tekstem (B1 A4: jednolicie na telefonie) */
@media (max-width: 1023.98px) {
  .ux-page-actions:not(.ux-record-actions):not(.has-one) .ux-has-icon:not(.ux-primary) {
    box-sizing: border-box;
    width: 40px;
    min-width: 40px;
    padding: 0;
  }
  .ux-page-actions:not(.ux-record-actions):not(.has-one) .ux-has-icon:not(.ux-primary) .ux-btn-text {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .ux-page-actions .ux-page-more .ux-page-more-list .ux-has-icon:not(.ux-primary) {
    width: auto;
    min-width: 0;
    padding: 6px 10px;
    justify-content: flex-start;
  }
  .ux-page-actions .ux-page-more .ux-page-more-list .ux-has-icon:not(.ux-primary) .ux-btn-text {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    clip: auto;
  }
}
@media (max-width: 639.98px) {
  .ux-page-actions:not(.ux-record-actions):not(.has-one) .ux-has-icon:not(.ux-primary) {
    width: 44px;
    min-width: 44px;
  }
  .ux-page-title .ux-back {
    margin-right: 4px;
  }
}
/* W29 · przycisk z menu (`menu_button`, `<details>` w formularzu): opcje to przyciski wysyłające formularz */
.ux-menu {
  position: relative;
  display: inline-block;
}
.ux-menu > summary {
  list-style: none;
  cursor: pointer;
}
.ux-menu > summary::-webkit-details-marker {
  display: none;
}
.ux-menu > summary::after {
  content: "";
  width: 6px;
  height: 6px;
  margin: -3px 0 0 2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}
.ux-menu[open] > summary::after {
  margin-top: 3px;
  transform: rotate(-135deg);
}
.ux-menu-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 35;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 13rem;
  max-width: min(20rem, calc(100vw - 32px));
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.16);
}
.ux-page-actions .ux-menu-list {
  left: auto;
  right: 0;
}
.ux-menu-item {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
@media (hover: hover) {
  .ux-menu-item:hover {
    background: var(--surface-2);
  }
}
.ux-menu-hint {
  margin: -2px 0 4px;
  padding: 0 10px 4px;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.4;
}
.ux-menu-note {
  margin: 0 0 4px;
  padding: 4px 10px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.4;
}
/* 113C · akcje pozycji (`item_actions`/`item_action`, UX-SYSTEM §11): JEDEN wariant - cichy z ramką (R1), 36 px (telefon 44 px), ten sam
   dla linku, przycisku POST i „Odłóż” (`menu_button(variant='quiet')`); formularze `ux-item-form` (nie `inline`) */
.ux-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.ux-item-form {
  display: inline-flex;
  max-width: 100%;
  margin: 0;
}
.ux-item-actions .ux-item-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  max-width: 100%;
  margin: 0;
  padding: 4px 10px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-ctrl);
  text-decoration: none;
}
.ux-item-actions .ux-item-action .ux-icon {
  width: 16px;
  height: 16px;
  flex: none;
}
@media (hover: hover) {
  .ux-item-actions .ux-item-action:hover {
    background: var(--surface-2);
  }
}
@media (max-width: 639.98px) {
  .ux-item-actions .ux-item-action {
    min-height: 44px;
  }
}
/* --- plan 104C2: rekord - tytuł, „Zapisz” u góry (S11/W26), kolumna boczna (S2/W25), narzędzia (W11), stopka panelu (W41) --- */
.ux-record-title {
  min-width: 0;
  margin: 0;
  font-size: 1.4rem; /* tytuł rekordu mniejszy niż tytuł strony */
  overflow-wrap: anywhere;
}
.ux-record-bar {
  margin: 0 0 8px;
}
.ux-page-title h2.ux-record-title {
  font-size: 1.4rem;
}
/* S11/W26 · „Zapisz” w nagłówku; oryginał w formularzu ukryty (Enter wysyła formularz: przycisk nagłówka jest pierwszym `submit` formularza w drzewie) */
.ux-save-orig {
  display: none;
}
.ux-save-head.is-dirty::before {
  content: "\2022";
  margin-right: 6px;
  font-size: 1.25em;
  line-height: 1;
}
@media (max-width: 639.98px) {
  /* telefon: nagłówek ze „Zapisz” przyklejony pod paskiem górnym; pole przewijane do widoku nie chowa się pod nim */
  .ux-page-head.has-save {
    position: sticky;
    top: var(--topbar-h);
    z-index: 6;
    margin: 0 0 8px;
    padding: 8px 0;
    background: var(--bg);
  }
  :root:has(.ux-page-head.has-save) {
    scroll-padding-top: calc(var(--topbar-h) + 128px);
  }
}
/* W11 · narzędzia rekordu (`form_section` z `group='tools'`, wyłączne): po otwarciu nagłówek sekcji ląduje pod paskiem górnym */
details.ux-section[name="tools"] {
  scroll-margin-top: calc(var(--topbar-h) + 12px);
}
/* S2/W25 · rekord z kolumną boczną. Jedno miejsce decyzji = szerokość TREŚCI rekordu (`@container`), nie okna: dwie kolumny, gdy lewa dostaje
   >= 640 px (przy >= 4 wierszach meta >= 560 px; prawa 280-340 px + luka 24 px); inaczej meta jako zwarty pasek nad treścią, a historia i
   dokumenty (`.ux-record-extra`) na końcu. `display: contents` rozkłada `aside` na elementy siatki jednej kolumny (kolejność przez `order`). */
.ux-record-body.has-aside {
  container: rec / inline-size;
}
.ux-record-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
.ux-record-cols > * {
  min-width: 0;
}
.ux-record-aside,
.ux-record-aside-inner {
  display: contents;
}
.ux-record-meta {
  order: -1;
  box-sizing: border-box;
  margin: 0 0 16px;
  padding: var(--card-pad-y) var(--card-pad);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}
.ux-record-meta .ux-fields {
  grid-template-columns: max-content minmax(0, 1fr);
  overflow-wrap: break-word; /* 113K: łamie tylko to, co się nie mieści w całości */
  gap: 4px 12px;
  margin: 0;
}
@media (max-width: 639.98px) {
  .ux-record-meta .ux-fields {
    grid-template-columns: minmax(0, 40%) minmax(0, 1fr); /* 113K: długa etykieta nie zabiera połowy karty */
  }
}
.ux-record-meta .ux-fields + .ux-fields {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.ux-record-meta .ux-fields dt {
  font-size: 0.8125rem;
}
.ux-record-extra {
  order: 9;
}
@container rec (min-width: 560px) {
  .ux-record-meta .ux-fields {
    grid-template-columns: repeat(2, max-content minmax(0, 1fr));
    align-items: baseline;
  }
  .ux-record-meta .ux-fields dd {
    margin: 0 12px 0 0;
  }
}
@container rec (min-width: 944px) {
  .ux-record-cols {
    grid-template-columns: minmax(0, 1fr) clamp(280px, 24%, 340px);
    column-gap: 24px;
  }
  .ux-record-cols > * {
    grid-column: 1;
  }
  .ux-record-cols > .ux-record-aside {
    display: block;
    grid-column: 2;
    grid-row: 1 / span 99;
    contain: size; /* aside nie rozciąga wierszy lewej kolumny; przyklejony środek jest sticky w pełnej wysokości obszaru */
  }
  .ux-record-aside-inner {
    display: block;
    position: sticky;
    top: calc(var(--topbar-h) + 16px);
    box-sizing: border-box;
    max-height: min(100%, calc(100dvh - var(--topbar-h) - 32px));
    overflow-y: auto;
    padding: var(--card-pad-y) var(--card-pad);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--surface);
  }
  .ux-record-meta {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
  }
  .ux-record-meta .ux-fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .ux-record-meta .ux-fields dd {
    margin: 0 0 8px;
  }
  .ux-record-extra {
    margin-top: 12px;
  }
  .ux-record-extra h2 {
    margin: 16px 0 8px;
    font-size: 1rem;
  }
}
@container rec (min-width: 864px) {
  .ux-record-cols:has(> .ux-record-aside.is-many) {
    grid-template-columns: minmax(0, 1fr) clamp(280px, 24%, 340px);
    column-gap: 24px;
  }
  .ux-record-cols:has(> .ux-record-aside.is-many) > * {
    grid-column: 1;
  }
  .ux-record-cols > .ux-record-aside.is-many {
    display: block;
    grid-column: 2;
    grid-row: 1 / span 99;
    contain: size;
  }
  .ux-record-aside.is-many > .ux-record-aside-inner {
    display: block;
    position: sticky;
    top: calc(var(--topbar-h) + 16px);
    box-sizing: border-box;
    max-height: min(100%, calc(100dvh - var(--topbar-h) - 32px));
    overflow-y: auto;
    padding: var(--card-pad-y) var(--card-pad);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--surface);
  }
  .ux-record-aside.is-many .ux-record-meta {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
  }
  .ux-record-aside.is-many .ux-record-meta .ux-fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .ux-record-aside.is-many .ux-record-meta .ux-fields dd {
    margin: 0 0 8px;
  }
  .ux-record-aside.is-many .ux-record-extra {
    margin-top: 12px;
  }
}
/* W41 · rekord w panelu: jedna kolumna, meta jako zwykła lista (bez ramki paska) */
.ux-record-cols.is-panel .ux-record-meta {
  padding: 0;
  border: 0;
  background: none;
}
/* W41 · stopka akcji przyklejona do dołu panelu (rekord w `#record-panel` i `side_panel`): „Usuń” z lewej, główna z prawej */
.ux-panel-foot {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 16px -16px -24px;
  padding: 12px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.ux-panel-foot > .ux-page-danger {
  margin-right: auto;
}
.ux-panel-foot .btn {
  margin: 0;
  white-space: nowrap;
}
.ux-panel-foot .btn .ux-icon {
  width: 18px;
  height: 18px;
  margin-right: 6px;
}
.ux-panel .ux-panel-foot {
  margin-bottom: -12px;
}
/* T26 · „?” wewnątrz `<legend>` grupy pól wyboru */
.ux-checks legend .ux-help {
  margin-left: 6px;
  vertical-align: middle;
}
/* --- zakładki strony (2.13, UX-SYSTEM §12): jedno makro `page_tabs` dla stron i rekordu; pasek przewija się
   poziomo SAM na telefonie (strona nigdy), zakładka to link z podkreśleniem w kolorze świata, focus widoczny,
   kontrast AA z tych samych zmiennych w jasnym i ciemnym motywie. --- */
.ux-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  margin: 0 0 20px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  max-width: 100%;
}
.ux-tabs::-webkit-scrollbar {
  display: none;
}
/* od tabletu: pasek, który się nie mieści (9 zakładek Ustawień), zawija się w drugi rząd — żadna
   zakładka nie jest ukryta za krawędzią; przewijanie palcem tylko na telefonie */
@media (min-width: 640px) {
  .ux-tabs {
    flex-wrap: wrap;
    overflow-x: visible;
    scroll-snap-type: none;
  }
}
.ux-tab {
  display: inline-flex;
  align-items: center;
  flex: none;
  scroll-snap-align: start;
  min-height: var(--tap);
  padding: 0 12px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  border-radius: var(--radius-ctrl) var(--radius-ctrl) 0 0;
  margin-bottom: -1px;
  font-size: var(--text-size);
}
.ux-tab:hover {
  color: var(--text);
  background: var(--surface-2);
}
.ux-tab:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}
.ux-tab.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.ux-tab.is-disabled {
  color: var(--muted);
  opacity: 0.6;
  cursor: not-allowed;
}
/* Ustawienia, dwa poziomy zakładek (T10/U-1, plan 104I): pierwszy poziom = grupy. Od tabletu zwykły pasek (opis grupy ukryty),
   na telefonie LISTA grup z opisem (zakładki grupy) pod nazwą - drugi poziom zostaje przewijanym paskiem. */
.ux-tabs-groups {
  margin-bottom: 8px;
}
.ux-tabs-groups .ux-tab {
  font-size: 1.0625rem;
}
.ux-tab-meta {
  display: none;
}
@media (max-width: 639.98px) {
  .ux-tabs-groups {
    flex-direction: column;
    overflow: visible;
    gap: 6px;
    border-bottom: 0;
  }
  .ux-tabs-groups .ux-tab {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    padding: 8px 14px;
    white-space: normal;
    border: 1px solid var(--border);
    border-left: 4px solid transparent;
    border-radius: var(--radius-card);
    margin-bottom: 0;
  }
  .ux-tabs-groups .ux-tab.is-active {
    border-left-color: var(--accent);
    background: var(--surface-2);
  }
  .ux-tabs-groups .ux-tab-meta {
    display: block;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--muted);
  }
}
.ux-record-body {
  min-width: 0;
}

/* Rekord: T13, T7, T8, T9, W8 (plan 104B); tytuł rekordu (`.ux-record-title`) ma stałe 1.4 rem z bloku 104C2 */
@media (max-width: 639.98px) {
  h1 {
    font-size: 1.5rem;
  }
}
/* „Usuń” w pasku rekordu i w rzędzie akcji: wariant drugiego poziomu w kolorze błędu (wypełnienie tylko w dialogu) */
.ux-record-actions .btn-danger,
.ux-actions-row .btn-danger,
.integration-actions .btn-danger, /* 113K: „Odłącz” w kartach połączeń jak „Usuń” - obrys, wypełnienie dopiero w dialogu */
.ux-actions-row form.inline button.btn-danger,
.ux-record-actions form.inline button.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
/* Główny „Zapisz” to ostatnie dziecko formularza (`form.ux-form > button[type=submit]`, także `form.settings-form`), bez klasy
   cichego/drugiego poziomu. Samo dziecko nie ma opakowania, więc zamiast paska jest pasek tła na całą szerokość (113C: `box-shadow` z `--bg` przycięty `clip-path`);
   przycisk kleji się do dołu okna (albo panelu rekordu) tylko tak długo, jak widać jego formularz. Tylko długie formularze:
   `.ux-form` z >= 4 polami `.ux-field` jako dziećmi, `.settings-form` z >= 2 sekcjami `form_section` albo >= 4 polami
   (pola Ustawień leżą w sekcjach, nie bezpośrednio w formularzu - stąd `:has` bez `>`); małe formularze w treści
   (np. „Dodaj osobę”) nie wiszą nad polami */
.ux-form:has(> .ux-field ~ .ux-field ~ .ux-field ~ .ux-field) > button[type="submit"]:last-child:not(.btn-quiet):not(.btn-secondary):not(.btn-danger),
.settings-form:has(.ux-section ~ .ux-section) > button[type="submit"]:last-child:not(.btn-quiet):not(.btn-secondary):not(.btn-danger),
.settings-form:has(.ux-field ~ .ux-field ~ .ux-field ~ .ux-field) > button[type="submit"]:last-child:not(.btn-quiet):not(.btn-secondary):not(.btn-danger) {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin-top: 8px;
  box-shadow: 0 0 0 100vmax var(--bg);
  clip-path: inset(-12px -100vmax);
}
@media (max-width: 639.98px) {
  .ux-form:has(> .ux-field ~ .ux-field ~ .ux-field ~ .ux-field) > button[type="submit"]:last-child:not(.btn-quiet):not(.btn-secondary):not(.btn-danger),
  .settings-form:has(.ux-section ~ .ux-section) > button[type="submit"]:last-child:not(.btn-quiet):not(.btn-secondary):not(.btn-danger),
  .settings-form:has(.ux-field ~ .ux-field ~ .ux-field ~ .ux-field) > button[type="submit"]:last-child:not(.btn-quiet):not(.btn-secondary):not(.btn-danger) {
    bottom: calc(var(--tap) + 16px + env(safe-area-inset-bottom));
  }
}
.ux-record-body h2 {
  margin-top: 32px;
}
/* W8 · formularz ustawień bez sekcji `form_section` (płaski) = jedna karta jak sekcja, ale bez zwijania */
.content > form.settings-form:not(:has(.ux-section)) {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: var(--card-pad-y) var(--card-pad);
  margin-bottom: 12px;
}

/* --- formularz: pole z pomocą i błędem inline (szerokość i siatka `.ux-form`: blok S1 planu 104E niżej) --- */
.ux-field {
  margin: 0 0 16px;
}
/* 113C · pole ustawienia (`field()` → `form_field(tag='span')`) leży w `<p>` wołającego: opakowanie blokowe bez własnego marginesu */
span.ux-field:not(.ux-field-inline),
span.ux-field-error {
  display: block;
}
p > .ux-field {
  margin: 0;
}
/* Plan 63 A2: krótki wybór obok etykiety (`form_field(inline=True)`, `field()` dla tak/nie i krótkich list): jeden wiersz
   etykieta - ikona „?” - kontrolka, wyrównane do lewej; za długa etykieta łamie własny tekst (bez zawijania elementów, żeby „?”
   nie odkleił się od etykiety); błąd pola przechodzi do nowej linii */
.ux-field-inline {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px 12px;
}
.ux-field-inline.has-error {
  flex-wrap: wrap;
}
.ux-field-inline > * {
  flex: none;
}
.ux-field-inline > label {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
}
.ux-field-inline.ux-field-inline > select { /* podwójna klasa: wygrywa z marginesem `.settings-label + …` */
  width: auto;
  margin: 0;
}
.ux-field-inline > .ux-field-error {
  flex: 1 1 100%;
}
/* rev: zrzut właściciela 2026-10-18 - pole tekstowe/data/combo w polu inline (domyślnie width 100%) nie może
   wypychać etykiety: kurczy się do reszty miejsca, etykieta zachowuje szerokość tekstu */
.ux-field-inline > input { flex: 1 1 auto; min-width: 0; width: auto; }
.ux-field small {
  display: block;
  margin-top: 4px;
}

/* --- S1 (plan 104E, UX-SYSTEM §25): siatka formularza. `.ux-form`, `.settings-form` i `.ux-section-body` układają pola w kolumnach:
   telefon jedna, 640-1023 px dwie, od 1024 px `auto-fill` po min. 240 px, najwyżej 3 (W46). Pole `short` (`.ux-field[data-width="short"]`, w Ustawieniach
   `[data-width="short"]` na opakowaniu pola `span.ux-field` z `_setting_field.html`, 113C) zajmuje komórkę, `long` i wszystko inne cały wiersz; etykieta jest ZAWSZE nad
   polem; „Zapisz” (przycisk bezpośrednio w formularzu) nie rozciąga się na cały wiersz --- */
.ux-form,
.settings-form,
.ux-section-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px 24px;
  align-items: start;
  max-width: none;
}
@media (min-width: 640px) {
  .ux-form,
  .settings-form,
  .ux-section-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  .ux-form,
  .settings-form,
  .ux-section-body {
    grid-template-columns: repeat(auto-fill, minmax(max(240px, calc((100% - 48px) / 3)), 1fr));
  }
}
.ux-form > *,
.settings-form > *,
.ux-section-body > * {
  grid-column: 1 / -1;
  min-width: 0;
  margin-top: 0;
  margin-bottom: 8px;
}
.ux-form > .ux-field[data-width="short"],
.settings-form > .ux-field[data-width="short"],
.ux-section-body > .ux-field[data-width="short"],
.ux-form > p:has([data-width="short"]):not(:has([data-width="long"])),
.settings-form > p:has([data-width="short"]):not(:has([data-width="long"])),
.ux-section-body > p:has([data-width="short"]):not(:has([data-width="long"])) {
  grid-column: auto;
}
.ux-form > button,
.settings-form > button,
.ux-section-body > button,
.ux-form > .btn,
.settings-form > .btn {
  justify-self: start;
}
:is(.ux-form, .settings-form, .ux-section-body) .ux-field-inline.ux-field-inline {
  display: block;
}
/* `select` schowany pod przełącznikiem (`.ux-switch-select`, niżej) zostaje 1 px: `position: absolute` z `width: 100%` liczyłby szerokość
   od okna i przewijał stronę poziomo na telefonie (scalenie 104B+104E, `tests/ui/test_overlap.py`) */
:is(.ux-form, .settings-form, .ux-section-body) .ux-field-inline.ux-field-inline > select:not(.ux-switch-select),
:is(.ux-form, .settings-form, .ux-section-body) .ux-field-inline.ux-field-inline > input {
  display: block;
  width: 100%;
  margin-top: 6px;
}
/* 113C (B1 A19) · w siatce formularza lista ma szerokość komórki jak pole tekstowe (opcje nie są ucinane); `inline` zostaje od treści */
:is(.ux-form, .settings-form, .ux-section-body) .ux-field:not(.ux-field-inline) > select:not(.ux-switch-select) {
  width: 100%;
}
:is(.ux-form, .settings-form, .ux-section-body) .ux-field-inline > .ux-switch-wrap {
  margin-top: 0;
}
/* 113C (A3) · tak/nie = JEDEN rząd: etykieta, „?” i przełącznik wyśrodkowane w pionie; długa etykieta łamie własny tekst; błąd w nowej linii.
   Bez JS (`select` widoczny) reguła się nie stosuje */
:is(.ux-form, .settings-form, .ux-section-body) .ux-field-inline.ux-field-inline:has(> .ux-switch-wrap) {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px 12px;
}
:is(.ux-form, .settings-form, .ux-section-body) .ux-field-inline.ux-field-inline.has-error:has(> .ux-switch-wrap) {
  flex-wrap: wrap;
}
@media (max-width: 639.98px) {
  /* 113K (N*8): na telefonie etykieta ma minimum 12 znaków, a przełącznik spada pod nią zamiast ściskać ją do czterech linii */
  :is(.ux-form, .settings-form, .ux-section-body) .ux-field-inline.ux-field-inline:has(> .ux-switch-wrap) {
    flex-wrap: wrap;
  }
  :is(.ux-form, .settings-form, .ux-section-body) .ux-field-inline.ux-field-inline:has(> .ux-switch-wrap) > label {
    flex: 1 1 12ch;
    min-width: 12ch;
  }
}

/* --- S9/U-4 (plan 104E, §25): przełącznik tak/nie. Bez JS jest zwykły `select`; `app.js` ukrywa go wizualnie (`.ux-switch-select`)
   i dokłada `button[role=switch]` - wysyłana jest ZAWSZE wartość `select` --- */
.ux-switch-select,
select.ux-switch-select.ux-switch-select {
  position: absolute;
  width: 1px;
  min-width: 0; /* ogólne `select { min-width: 10ch; min-height: var(--control-h) }` (W24, plan 104B) nie może rozpychać ukrytego pola */
  height: 1px;
  min-height: 0;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
}
.ux-switch-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  vertical-align: middle;
}
.ux-switch {
  position: relative;
  box-sizing: border-box;
  width: 40px;
  min-width: 40px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--muted);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
}
.ux-switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
}
.ux-switch[aria-checked="true"] {
  background: var(--accent);
  border-color: var(--accent);
}
.ux-switch[aria-checked="true"] .ux-switch-knob {
  left: 19px;
  background: var(--on-accent);
}
.ux-switch:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.ux-switch::after { /* pole dotyku >= 44 px wysokości bez powiększania przełącznika */
  content: "";
  position: absolute;
  top: -10px;
  right: -2px;
  bottom: -10px;
  left: -2px;
}
.ux-switch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
@media (max-width: 639.98px) {
  /* 104J: cel dotykowy przełącznika >= 44 px mierzony samym przyciskiem (nie tylko polem `::after`): przycisk ma 44 px wysokości,
     a widoczny tor 24 px to jego wypełnienie (przezroczysta ramka góra/dół, ramka toru jako wewnętrzny cień) */
  .ux-switch {
    height: 44px;
    min-height: 44px;
    border-width: 10px 0;
    border-color: transparent;
    background-clip: padding-box;
    box-shadow: inset 0 0 0 1px var(--muted);
  }
  .ux-switch[aria-checked="true"] {
    border-color: transparent;
    /* skrót `background` w regule stanu (wyżej) zeruje `background-clip` - bez tego tor 24 px wypełniał całe 44 px przycisku */
    background-clip: padding-box;
    box-shadow: inset 0 0 0 1px var(--accent);
  }
  .ux-switch::after {
    top: 0;
    bottom: 0;
  }
}
.ux-switch-text {
  color: var(--muted);
  font-size: 0.875rem;
}

/* --- S3/W8/W15 (plan 104E, §25): jedna karta - `settings_card`, sekcja `form_section`, karta połączenia, karta Telegrama: ta sama ramka,
   promień i odstępy (sekcja `.ux-section` wyżej, `.integration-card` i `.telegram-card` niżej niosą tę ramkę we własnych regułach - plan 104B);
   nagłówek karty niesie JEDEN „Zapisz” (`.ux-card-save`, `form=` wskazuje formularz w treści) --- */
.ux-card {
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: var(--card-pad-y) var(--card-pad);
  margin: 0 0 16px;
}
.ux-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin: 0 0 12px;
}
.ux-card-head > h2 {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 1.0625rem;
}
.ux-card-save {
  flex: 0 0 auto;
  margin: 0;
}
.ux-section-title .ux-card-save {
  float: right;
  min-height: 0;
  padding-top: 2px;
  padding-bottom: 2px;
}
@media (max-width: 639.98px) {
  /* 104J: na telefonie „Zapisz” w tytule sekcji ma cel dotykowy >= 44 px */
  .ux-section-title .ux-card-save {
    min-height: var(--tap);
  }
}
/* karta opakowuje sekcje i karty połączeń: bez podwójnej ramki */
.ux-card-body > .ux-section,
.ux-card-body > .connection-anchor > .integration-card {
  border-width: 1px 0 0;
  border-radius: 0;
  background: none;
  margin: 0;
}
.ux-card-body > :last-child {
  margin-bottom: 0;
}

/* --- S9/W16 (plan 104E, §25): tabela pól (`field_table`) - nagłówek kolumn raz, w wierszach same pola (etykiety zostają dla czytnika
   ekranu; na telefonie wiersz jest kartą z widocznymi etykietami) --- */
.ux-ftable {
  list-style: none;
  margin: 8px 0 12px;
  padding: 0;
}
.ux-ftable-head,
.ux-ftable-row {
  display: grid;
  align-items: center;
  gap: 4px 16px;
  grid-template-columns: minmax(0, 1fr);
}
.ux-ftable-head {
  display: none;
}
.ux-ftable-row {
  padding: 10px 14px;
  margin: 0 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}
.ux-ftable-title {
  font-weight: 600;
  min-width: 0;
  overflow-wrap: anywhere;
}
.ux-ftable-row .ux-field {
  margin: 0;
  min-width: 0;
}
/* 113C (B2 #18) · telefon: etykieta pierwszego pola równa tytułowi wiersza nie powtarza go */
@media (max-width: 639.98px) {
  .ux-ftable.is-title-label .ux-ftable-title + .ux-field > label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}
@media (min-width: 640px) {
  .ux-ftable-head,
  .ux-ftable-row {
    display: grid;
  }
  .ux-ftable-c2 > li { grid-template-columns: minmax(10rem, 1fr) minmax(12rem, 2fr); }
  .ux-ftable-c3 > li { grid-template-columns: minmax(8rem, 1fr) minmax(14rem, 2fr) minmax(12rem, 1fr); }
  .ux-ftable-c4 > li { grid-template-columns: minmax(10rem, 2fr) repeat(3, minmax(7rem, 1fr)); }
  /* 112A: minimum kolumny 5rem (było 7rem) - tabela pól typu Brain mieści się obok menu na 834 px; szerszy kontener bez zmian */
  .ux-ftable-c5 > li { grid-template-columns: minmax(10rem, 2fr) repeat(4, minmax(5rem, 1fr)); }
  .ux-ftable-c6 > li { grid-template-columns: minmax(10rem, 2fr) repeat(5, minmax(6rem, 1fr)); }
  .ux-ftable-head {
    padding: 0 0 6px;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--muted);
  }
  .ux-ftable-row {
    padding: 8px 0;
    margin: 0;
    border-width: 0 0 1px;
    border-radius: 0;
  }
  /* 113J (I-2, I-3): pomoc kolumny jest w nagłówku, więc „?” przy POLU w wierszu zostaje tylko na telefonie;
     pomoc tytułu wiersza (np. kategorii Poczty) zostaje zawsze */
  .ux-ftable-row .ux-field .ux-help {
    display: none;
  }
  /* etykiety pól w wierszu: ukryte wizualnie (czyta je czytnik ekranu), nagłówek kolumny jest widoczny */
  .ux-ftable-row .ux-field > label,
  .ux-ftable-row .settings-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .ux-ftable-row .ux-field-inline.ux-field-inline > select,
  .ux-ftable-row .ux-field-inline.ux-field-inline > input {
    margin-top: 0;
  }
}
/* plan 52C: grupa pól wyboru (`form_checks`): fieldset bez ramki, pola w rzędzie z zawijaniem */
.ux-checks {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.ux-checks > legend {
  display: inline;
  padding: 0;
  font-weight: 600;
  font-size: var(--text-size);
}

/* Formularze: 100B-3, 100B-4, 100B-5, 100B-6, S1, S5, T5, T8, W7 (plan 104B) */
@media (min-width: 640px) {
  .ux-table td:not(.ux-col-actions):not(.ux-col-select):not(.ux-sub-cell) {
    padding-top: 12px;
    padding-bottom: 12px;
  }
}
/* W7 · pola vs etykiety: etykieta i wartość tej samej wielkości od 640 px; na telefonie wartość 1 rem (16 px) - przy mniejszej
   Safari na iOS powiększa stronę przy fokusie w polu. Pole liczbowe z `list` (T26): bez podwójnej strzałki listy podpowiedzi */
.ux-field > label,
.settings-label {
  font-size: var(--text-size);
  font-weight: 600;
}
:root {
  scroll-padding-bottom: calc(var(--tap) + 72px);
}
input,
select,
textarea {
  font-size: var(--text-size);
}
/* Pole poniżej 16 px na telefonie = iOS przybliża ekran przy fokusie (rev 551 I-1) */
@media (max-width: 639.98px) {
  input,
  select,
  textarea {
    font-size: 1rem;
  }
}
input[type="number"][list]::-webkit-calendar-picker-indicator {
  /* `display: none` nie działa (UA ma tu pierwszeństwo, a `!important` jest w arkuszu zakazany) - zerujemy rozmiar i krycie */
  opacity: 0;
  width: 0;
  min-width: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
}
@media (max-width: 639.98px) {
  #main .ux-table tbody .ux-col-select {
    position: absolute;
    top: 2px;
    left: 4px;
    right: auto;
    width: 44px;
    padding: 0;
  }
  #main .ux-table tbody .ux-col-select label {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
  }
  #main .ux-table tbody tr:has(> .ux-col-select) > td:not(.ux-col-select):not(.ux-col-actions):not(.ux-col-fill) {
    padding-left: 52px;
  }
  #main .ux-table tbody tr:has(> .ux-col-select) > td.ux-cell-main {
    padding-top: 12px;
    padding-right: 12px;
    min-height: 44px;
  }
  #main .ux-table tbody tr:not(:has(> .ux-col-select)) > td:not(.ux-col-actions):not(.ux-col-fill) {
    padding-left: 16px;
  }
}
@media (min-width: 640px) {
  #main .ux-table .ux-group-row ~ tr:not(.ux-group-row) > td:first-child:not(.ux-col-select),
  #main .ux-table .ux-group-row ~ tr:not(.ux-group-row) > td.ux-col-select + td {
    padding-left: 28px;
  }
}
/* plan 84B: wiersz „dzień” formularza planu Sportu (zaznaczenie, godzina, długość tego dnia) */
.sport-day {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  margin: 0 0 8px;
}
.sport-day > .ux-field {
  margin: 0;
}
/* M52.5/M52.6 (plan 104H): dni planu jako pigułki w jednym rzędzie; godzina i długość tylko dla zaznaczonego dnia, który zajmuje własny wiersz */
.sport-days {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}
.sport-days > .sport-day {
  margin: 0;
}
.sport-day:has(input[type="checkbox"]:checked) {
  flex: 1 1 100%;
}
.sport-day:not(:has(input[type="checkbox"]:checked)) > .ux-field-inline {
  display: none;
}
.sport-day .ux-checks > legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.sport-day .ux-checks-list {
  margin-top: 0;
}
.sport-day .ux-check {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: var(--tap);
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}
.sport-day .ux-check input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.sport-day .ux-check:has(input:checked) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.sport-day .ux-check:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.ux-checks-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
  margin-top: 6px;
}
.ux-field.has-error input,
.ux-field.has-error textarea,
.ux-field.has-error select {
  border-color: var(--danger);
}
.ux-field-error {
  margin: 6px 0 0;
  padding: 6px 10px;
}

/* plan 91A: pomoc „Co umiem” (makro `capabilities`): grupy jako lista definicji, czynności i przykład przygaszone */
.ux-capabilities-list { margin: 0 0 16px; }
.ux-capability { padding: 10px 0; border-bottom: 1px solid var(--border); }
.ux-capability dt { font-weight: 700; }
.ux-capability dd { margin: 4px 0 0; }
.ux-capability-actions,
.ux-capability-example { color: var(--muted); font-size: 0.9rem; }
.ux-capabilities-sub { font-weight: 700; margin-bottom: 4px; }
.ux-capabilities-commands { margin: 0 0 16px; padding-left: 20px; }

/* --- pomoc kontekstowa (UX-SYSTEM §14, 2026-10-03): ikona „?” z dymkiem — czysty CSS (`:hover`, `:focus-within`), zero JS.
   Dotknięcie na telefonie = fokus przycisku = dymek; drugie dotknięcie poza nim zabiera fokus. Przycisk ma 44 px (cel dotykowy
   ≥ `--tap`, mierzony przez test UI), ale w układzie zajmuje 20 px (ujemne marginesy), a widoczne kółko 20 px rysuje `::before`.
   Dymek pod ikoną, od lewej krawędzi (nie wychodzi poza ekran na 375 px), tło i ramka ze zmiennych motywu (tryb ciemny bez
   dodatkowych reguł). Bez animacji (także bez `transition` z reguły `a, button`). --- */
.ux-help {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
  font-size: 0.8rem; /* własny rozmiar: `h2 .ux-help` nie dziedziczy rozmiaru nagłówka */
  line-height: 1;
}
.ux-help-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  min-height: 0;
  min-width: 0;
  padding: 0;
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1;
  color: color-mix(in srgb, var(--accent) 75%, var(--text));
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: help;
  transition: none;
}
.ux-help-btn::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0; /* cztery krawędzie zamiast `inset` (Safari < 14.1 go nie zna) */
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.ux-help-btn > * {
  position: relative;
}
.ux-help-btn > span {
  font-size: inherit;
}
.ux-help-btn:hover,
.ux-help:focus-within .ux-help-btn {
  color: var(--on-accent);
  background: transparent;
}
.ux-help-btn:hover::before,
.ux-help:focus-within .ux-help-btn::before {
  border-color: var(--accent);
  background: var(--accent);
}
.ux-help-btn:focus-visible {
  outline: none;
}
.ux-help-btn:focus-visible::before {
  box-shadow: 0 0 0 2px var(--focus);
}
.ux-help-text {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  width: max-content;
  max-width: min(36ch, 90vw);
  padding: 10px 12px;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.45;
  text-align: left;
  color: var(--bg);
  background: var(--text);
  border: 0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.24);
  overflow-wrap: anywhere;
  white-space: normal;
}
.ux-help:hover .ux-help-text,
.ux-help:focus-within .ux-help-text {
  display: block;
}
/* telefon: dymek przy ikonie wychodził poza ekran (ikona po krótkiej etykiecie, dymek 36ch), a wyrównanie do krawędzi pola
   wymagałoby `position: relative` na każdym opakowaniu (`<p>`, `.ux-field`, `h2`) — zamiast tego dolny arkusz nad paskiem
   nawigacji (jak toast), zawsze w ekranie; test UI mierzy `boundingBox` ≤ 375 px */
@media (max-width: 639.98px) {
  .ux-help-text {
    position: fixed;
    top: auto;
    left: 12px;
    right: 12px;
    bottom: calc(var(--tap) + 24px + env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
    z-index: 40;
  }
}
/* nagłówek, przycisk albo akapit z ikoną obok — ikona nie łamie linii i trzyma się tekstu */
h2 .ux-help,
.ux-help-row .ux-help {
  margin-left: 8px;
}
h2 .ux-help-text {
  font-size: 0.875rem;
  font-weight: 400;
}

/* Dymek pomocy: 100B-3, R4, S4, S7 (plan 104B) */
@media (min-width: 640px) {
  /* na telefonie dymek to dolny arkusz na całą szerokość - tam szerokości nie ruszamy */
  .ux-help-text {
    max-width: 32ch;
  }
}
@media (min-width: 640px) {
  /* 104J: ikona „?” w akcjach nagłówka stoi przy prawej krawędzi strony - dymek rozwija się w lewo, nie poza ekran */
  .ux-page-actions .ux-help-text,
  .ux-record-actions .ux-help-text {
    left: auto;
    right: 0;
  }
}
/* dymek jest odwrócony (jasny tekst na ciemnym tle), więc link z wprowadzenia dziedziczy kolor tekstu dymka */
.ux-help-text a {
  color: inherit;
  text-decoration: underline;
}
.ux-kpi-label .ux-help {
  margin-left: 4px;
}
.ux-field > label ~ .ux-help .ux-help-btn,
.settings-label ~ .ux-help .ux-help-btn,
.ux-checks > legend ~ .ux-help .ux-help-btn,
.ux-checks > legend .ux-help-btn,
.ux-field-inline .ux-help-btn,
.ux-kpi-label .ux-help-btn {
  width: 18px;
  height: 18px;
  font-size: 0.75rem;
  color: var(--muted);
}
.ux-field > label ~ .ux-help .ux-help-btn::before,
.settings-label ~ .ux-help .ux-help-btn::before,
.ux-checks > legend ~ .ux-help .ux-help-btn::before,
.ux-checks > legend .ux-help-btn::before,
.ux-field-inline .ux-help-btn::before,
.ux-kpi-label .ux-help-btn::before {
  background: transparent;
  border: 1px solid var(--muted);
}
.ux-field > label ~ .ux-help .ux-help-btn:hover,
.settings-label ~ .ux-help .ux-help-btn:hover,
.ux-field-inline .ux-help-btn:hover,
.ux-kpi-label .ux-help-btn:hover,
.ux-field > label ~ .ux-help:focus-within .ux-help-btn,
.settings-label ~ .ux-help:focus-within .ux-help-btn,
.ux-field-inline .ux-help:focus-within .ux-help-btn {
  color: var(--text);
}
.ux-field > label ~ .ux-help .ux-help-btn:hover::before,
.settings-label ~ .ux-help .ux-help-btn:hover::before,
.ux-field-inline .ux-help-btn:hover::before,
.ux-kpi-label .ux-help-btn:hover::before,
.ux-field > label ~ .ux-help:focus-within .ux-help-btn::before,
.settings-label ~ .ux-help:focus-within .ux-help-btn::before,
.ux-field-inline .ux-help:focus-within .ux-help-btn::before {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.ux-checks > legend .ux-help {
  margin-left: 6px;
}
/* telefon: pudełko „?” ma 44 x 44 px (cel dotykowy mierzony przez test UI), w układzie zajmuje tyle co kółko (ujemny margines),
   a widoczne kółko 22 px (18 px przy polach) rysuje `::before` */
@media (max-width: 639.98px) {
  .ux-help-btn,
  .ux-field > label ~ .ux-help .ux-help-btn,
  .settings-label ~ .ux-help .ux-help-btn,
  .ux-checks > legend ~ .ux-help .ux-help-btn,
  .ux-checks > legend .ux-help-btn,
  .ux-field-inline .ux-help-btn,
  .ux-kpi-label .ux-help-btn {
    width: 44px;
    min-width: 44px;
    height: 44px;
    margin: -11px;
    flex: none;
  }
  .ux-field > label ~ .ux-help .ux-help-btn,
  .settings-label ~ .ux-help .ux-help-btn,
  .ux-checks > legend ~ .ux-help .ux-help-btn,
  .ux-checks > legend .ux-help-btn,
  .ux-field-inline .ux-help-btn,
  .ux-kpi-label .ux-help-btn {
    margin: -13px;
  }
  .ux-help-btn::before {
    top: 11px;
    right: 11px;
    bottom: 11px;
    left: 11px;
  }
  .ux-field > label ~ .ux-help .ux-help-btn::before,
  .settings-label ~ .ux-help .ux-help-btn::before,
  .ux-checks > legend ~ .ux-help .ux-help-btn::before,
  .ux-checks > legend .ux-help-btn::before,
  .ux-field-inline .ux-help-btn::before,
  .ux-kpi-label .ux-help-btn::before {
    top: 13px;
    right: 13px;
    bottom: 13px;
    left: 13px;
  }
}
/* 2.12: ostrzeżenie o treści przy polu wyboru śledzenia — widoczne zawsze (prywatność), przygaszone */
.trace-content-warning {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

/* --- potwierdzenie: natywny <dialog> --- */
.ux-dialog {
  width: min(480px, calc(100% - 32px));
  padding: 20px;
  border: 0;
  border-radius: var(--radius-card);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.ux-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}
.ux-dialog[open]:not(:modal) {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 40;
  margin: 0;
}
.ux-dialog h2 {
  margin: 0 0 8px;
}
.ux-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.ux-dialog-actions form {
  margin: 0;
}
.ux-dialog-actions button {
  margin: 0;
}

/* --- toast (znika sam po 6 s) i baner (zostaje, ma akcję) --- */
.ux-toast {
  /* `left` + `right` + `width: max-content` + auto-marginesy: krótki tekst = ramka na szerokość tekstu, wyśrodkowana;
     długi = do pełnej szerokości minus 12 px. Dawne środkowanie od połowy okna liczyło szerokość do prawej
     krawędzi od środka (połowa ekranu) i łamało tekst co dwa słowa (uwaga właściciela 2026-10-03) */
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--tap) + 24px + env(safe-area-inset-bottom));
  z-index: 30;
  width: max-content;
  max-width: calc(100% - 24px);
  margin: 0 auto;
  transform: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 10px 16px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-ctrl);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.ux-toast-close {
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0;
  margin: 0;
  background: transparent;
  color: inherit;
  border: 0;
  font-size: 1.3rem;
  line-height: 1;
}
@media (min-width: 640px) {
  .ux-toast {
    max-width: min(640px, calc(100% - 24px));
    bottom: 24px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .ux-toast {
    animation: ux-toast-out 400ms ease 6s forwards;
  }
}
/* „Ogranicz ruch”: toast znika tak samo po 6 s, tylko bez przejscia (inaczej zostawalby na stale) */
@media (prefers-reduced-motion: reduce) {
  .ux-toast {
    animation: ux-toast-out 0s linear 6s forwards;
  }
}
@keyframes ux-toast-out {
  to {
    opacity: 0;
    visibility: hidden;
  }
}
.ux-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 8px 0 12px;
  padding: 10px 14px;
  border-radius: var(--radius-ctrl);
  background: var(--surface);
  color: var(--text);
  box-sizing: border-box;
  min-height: 44px;
  line-height: 1.4;
  font-size: 0.9375rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--muted);
}
.ux-banner.is-danger {
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  color: var(--text);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
  border-left-color: var(--danger);
}
.ux-banner.is-warning {
  background: color-mix(in srgb, var(--warning) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--warning) 35%, var(--border));
  border-left-color: var(--warning);
}
.ux-banner form.inline {
  margin: 0 0 0 auto;
  display: flex;
  align-items: center;
}
.ux-banner form.inline button {
  margin: -6px 0;
  min-height: 32px;
  padding: 2px 12px;
}

/* Baner, toast, dialog: S8, T7, W9 (plan 104B) */
/* R1 · wariant tekstowy (bez ramki) TYLKO tam, gdzie przycisk jest jedną z wielu równorzędnych akcji w gęstym rzędzie:
   „Anuluj” w dialogu, stronicowanie, „Szukaj” w pasku listy, pasek panelu rekordu */
.ux-dialog-actions form[method="dialog"] button,
.ux-pagination .btn-quiet,
.ux-toolbar .btn-quiet,
.ux-record-panel-bar .btn-quiet {
  background: transparent;
  color: var(--text);
  border-color: transparent;
}
@media (hover: hover) {
  .ux-dialog-actions form[method="dialog"] button:hover,
  .ux-pagination .btn-quiet:hover,
  .ux-toolbar .btn-quiet:hover,
  .ux-record-panel-bar .btn-quiet:hover {
    background: var(--surface-2);
  }
}
/* W9 · baner i status „✓ Wiem 08:12” tylko tak szerokie jak treść */
.ux-banner,
.attention-item-meta[role="status"] {
  width: fit-content;
  max-width: 100%;
}
.ux-banner.is-ok {
  background: color-mix(in srgb, var(--ok) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--ok) 35%, var(--border));
  border-left-color: var(--ok);
}
.ux-banner .btn,
.ux-banner .btn-quiet,
.ux-banner button {
  min-height: 32px;
  padding: 2px 12px;
  margin: -6px 0; /* przycisk 32 px nie podnosi baneru ponad 44 px (padding 10 px + jedna linia) */
}
@media (max-width: 639.98px) {
  /* telefon: cel dotykowy 44 px także w banerze (baner jest wtedy wyższy - świadomy wyjątek od S8) */
  .ux-banner .btn,
  .ux-banner .btn-quiet,
  .ux-banner button,
  .ux-banner form.inline button {
    min-height: 44px;
    margin: 0;
  }
}

/* --- Admin → Użytkownicy (U9, 2026-10-02): wiersz konta nie łamie się — tekst po lewej, trzy akcje w jednym rzędzie po prawej;
   na telefonie akcje schodzą pod tekst, nadal w jednym rzędzie --- */
.admin-users {
  list-style: none;
  margin: 8px 0;
  padding: 0;
}
.admin-user {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.admin-user-main {
  flex: 1 1 240px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.admin-user.is-muted .admin-user-main { color: var(--muted); }
.admin-user-main small {
  display: block;
  color: var(--muted);
}
.admin-user-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: auto;
}
.admin-user-actions form.inline {
  margin: 0;
}
.admin-user-actions button {
  white-space: nowrap;
}
@media (max-width: 639.98px) {
  .admin-user-actions {
    flex: 1 1 100%;
    margin-left: 0;
  }
}

/* --- karta KPI --- */
.ux-kpi-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* ramki min. 150 px: 3 w rzędzie od ok. 500 px, na telefonie 2 + 1 (1.7a, U6; 104B S7) */
  grid-auto-rows: 1fr; /* wszystkie ramki tej samej wysokości, także w różnych rzędach (uwaga właściciela 2026-10-03) */
  margin: 8px 0 16px;
  align-items: stretch;
}
/* 113C (B2 #11) · telefon: dwie kolumny, trzy karty = trzy kolumny, ostatnia nieparzysta karta na całą szerokość (bez układu 2+1) */
@media (max-width: 639.98px) {
  .ux-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ux-kpi-grid > .ux-kpi:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  .ux-kpi-grid:has(> .ux-kpi:nth-child(3):last-child) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .ux-kpi-grid:has(> .ux-kpi:nth-child(3):last-child) > .ux-kpi:last-child {
    grid-column: auto;
  }
}
.ux-kpi {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 12px 14px;
  background: var(--surface);
  border: 0;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  align-items: flex-start;
  text-align: left;
  min-width: 0;
}
.ux-kpi p {
  margin: 0;
}
/* poprawka właściciela P12: liczba 1.75rem (telefon 1.4rem), tekst 1.25rem (telefon 1.1rem) — różnica ≤ 0.6rem, jeden
   `line-height`; etykieta i delta 0.85rem wszędzie; tekst najwyżej w 2 liniach (pełny tekst w `title` z makra) */
.ux-kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.ux-kpi-value.is-text {
  /* wartość tekstowa (np. „nie skonfigurowano”): mniejsza, łamana w ramce, najwyżej 2 linie (U1, 2026-10-02; P12) */
  font-size: 1.75rem;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.ux-kpi.is-ok .ux-kpi-value {
  color: var(--link);
}
.ux-kpi.is-danger .ux-kpi-value {
  color: var(--danger);
}
.ux-kpi.is-warning .ux-kpi-value {
  color: var(--warning);
}
.ux-kpi-label {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 2px; /* S7/W14 (plan 104E): etykieta NAD liczbą (markup `kpi_card`) */
  display: block;
}
/* S7/W14 (plan 104E): jednostka osobnym `span` - mniejsza i przygaszona (cyfry tabelaryczne liczby daje `.ux-kpi-value` wyżej) */
.ux-kpi-unit {
  margin-left: 0; /* odstęp = spacja w znacznikach (czytnik i schowek: „0.00 USD”, rev 104E M-3) */
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
}
.ux-kpi-label a {
  color: inherit;
}
.ux-kpi-delta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 4px;
}
/* telefon: po regułach bazowych, inaczej `.ux-kpi-value` (ta sama specyficzność) nadpisałoby rozmiary */
@media (max-width: 639.98px) {
  .ux-kpi {
    padding: 10px 10px;
  }
  .ux-kpi-value {
    font-size: 1.5rem; /* S7 (plan 104E): telefon 1.5 rem */
  }
  .ux-kpi-value.is-text {
    font-size: 1.5rem;
  }
}

/* --- pigułki filtrów --- */
.ux-pills {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0 0 8px;
  padding: 0;
  align-items: center;
}
.ux-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  max-width: 100%;
  padding: 0 10px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
}
.ux-pill.is-muted:not(.is-active) {
  opacity: 0.6; /* plan 122A: typ bez encji, link działa */
}
.ux-pill-clear {
  background: transparent;
  color: var(--link);
  border-style: dashed;
}

/* --- poziom ważności encji (plan 40C, 42): segmentowana grupa pigułek w karcie osoby, pigułka priorytetu tygodnia
   i znacznik w dzwonku --- */
.ux-levels-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 8px 0;
}
/* cztery przyciski sklejone w jedną grupę: wspólna ramka z zaokrągleniem na obu końcach, przyciski bez własnych ramek
   (tylko cienki separator), każdy 44 px wysokości; bieżący poziom wypełniony kolorem akcentu */
.ux-levels {
  display: inline-flex;
  gap: 0;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.ux-levels form {
  display: flex;
  margin: 0;
}
.ux-level-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 6px 16px;
  margin: 0; /* bije `button { margin }` i `form.inline` — przyciski grupy są sklejone */
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}
.ux-levels > :first-child,
.ux-levels > :first-child > .ux-level-btn {
  border-left: 0;
}
.ux-level-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -3px; /* wewnątrz przycisku: `overflow: hidden` grupy obcinałoby obrys na zewnątrz */
}
@media (hover: hover) {
  .ux-level-btn:hover:not([aria-pressed="true"]) {
    background: var(--surface-2);
  }
}
.ux-level-btn.is-active,
.ux-level-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 700;
  cursor: default;
}
/* pigułka stanu „Priorytet tygodnia do …” obok grupy (nie przycisk — nic nie klika) */
.ux-level-focus {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.875rem;
  white-space: nowrap;
}
/* jedna linia „Ostatnia zmiana: …” pod pigułkami */
.ux-meta-line {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 0.875rem;
}
/* podsekcja w sekcji (np. zwinięta „Ostatnie zmiany” w karcie osoby): lżejsza ramka niż sekcja nadrzędna */
.ux-section-body > .ux-section {
  margin: 8px 0 0;
  border-left-width: 1px;
}
.ux-level {
  display: inline-block;
  padding: 0 2px;
  border: 0;
  border-radius: 999px;
  font-size: 0.8rem;
  white-space: nowrap;
}
.ux-level.is-key {
  border-color: var(--accent);
  color: var(--accent);
}

/* --- panel boczny: desktop kolumna po prawej, telefon cały ekran --- */
.ux-panel {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  bottom: 0;
  z-index: 25;
  width: min(420px, 100%);
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
}
.ux-panel-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.ux-panel-bar h2 {
  flex: 1;
  margin: 0;
  font-size: 1.1rem;
}
.ux-panel-bar .btn-quiet {
  margin: 0;
  min-width: var(--tap);
}
.ux-panel-body {
  padding: 12px 16px;
}

/* --- dzwonek uwagi (szkielet) --- */
.ux-bell {
  position: relative;
  flex: none;
}
.ux-bell summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: var(--tap);
  min-height: var(--tap);
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.2rem;
}
.ux-bell summary::-webkit-details-marker {
  display: none;
}
/* 104F (T1): dzwonek to ikona ze sprite'a (nie emoji) w kolorze tekstu; licznik jak dotąd na rogu */
.ux-bell-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}
.ux-bell-icon .ux-icon {
  width: 22px;
  height: 22px;
}
.ux-bell[open] summary,
.ux-bell summary:hover {
  background: var(--surface-2);
}
.ux-bell-count {
  position: absolute;
  top: 4px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.ux-bell-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 30;
  width: min(300px, calc(100vw - 24px));
  padding: 16px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}
/* --- menu języka: flaga w nagłówku, rozwijana lista języków (1.7a, uwaga U8) --- */
.ux-lang {
  position: relative;
  flex: none;
}
.ux-lang summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap);
  min-height: var(--tap);
  border-radius: 999px;
  cursor: pointer;
}
.ux-lang summary::-webkit-details-marker {
  display: none;
}
.ux-lang[open] summary,
.ux-lang summary:hover {
  background: var(--surface-2);
}
.ux-flag {
  width: 24px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid var(--border);
  object-fit: cover;
  flex: none;
}
.ux-lang-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 30;
  min-width: 180px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}
.ux-lang-panel form {
  margin: 0;
}
.ux-lang-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-height: var(--tap);
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.ux-lang-item:hover {
  background: var(--surface-2);
}
.ux-lang-item.is-active {
  background: var(--accent-soft);
  font-weight: 700;
}
main .ux-bell {
  display: inline-block;
  vertical-align: middle;
}
main .ux-bell-panel {
  right: auto;
  left: 0;
}

/* --- prompty (2.2): treść domyślna, diff i podgląd renderu --- */
/* M83.4 (plan 104I): różnica promptu - linia dodana/usunięta kolorem (tło + znak w `::before`, żeby nie zależeć od samego koloru) */
.prompt-diff-line {
  display: block;
  padding: 0 4px;
}
.prompt-diff-line.is-add {
  background: color-mix(in srgb, var(--ok) 14%, var(--surface));
}
.prompt-diff-line.is-del {
  background: var(--danger-soft);
}
.prompt-diff-line.is-add::before {
  content: "+ ";
}
.prompt-diff-line.is-del::before {
  content: "- ";
}
.prompt-diff-line.is-gap {
  height: 1px;
  margin: 6px 0;
  padding: 0;
  background: var(--border);
}
.prompt-diff-line.is-ctx::before {
  content: "  ";
  white-space: pre;
}
.prompt-source,
.prompt-diff {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}
/* 2.13: karta promptu — pigułki języka nad zakładkami treści, licznik znaków pod podglądem */
.prompt-langs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0 0 8px;
}
.prompt-stats {
  display: block;
  margin: 4px 0 0;
}

/* 2.4 → plan 39B — karta Telegrama: zwijany formularz tokenu w sekcji bota (sekcje to `form_section`, reszta wzorca w `connection_card`) */
.telegram-connect summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }

/* --- Silnik uwagi (2.5): lista pozycji `/attention`, `/attention/policies`; dzwonek z listą --- */
/* `minmax(0, 1fr)` + `min-width: 0`: element siatki ma domyślnie `min-width: auto` i rozpychałby się do szerokości
   przycisków z odkładaniem — karta wychodziła poza ekran telefonu (uwaga właściciela 2026-10-03) */
.attention-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.attention-item { min-width: 0; border: 0; border-radius: 0; padding: 12px 0; background: transparent; border-bottom: 1px solid var(--border); }
.attention-item.is-question { background: transparent; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 12px 0; }
.attention-item.is-reminder, .attention-item.is-ritual { border-left: 4px solid var(--muted); }
.attention-item-title { font-size: var(--text-size); margin: 0 0 4px; overflow-wrap: anywhere; font-weight: 600; }
.attention-item-body { margin: 0 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; } /* iOS: długie słowo (nazwa wyjątku, URL) nie rozpycha karty poza ekran */
.attention-item-meta { margin: 0 0 8px; color: var(--muted); font-size: 0.8125rem; }
.attention-policy-form label { display: inline-flex; gap: 6px; align-items: center; }
.attention-empty { color: var(--muted); }
/* --- Dzwonek v2 (plan 40A): paczki dnia („Dziś”) i grupy klas („Reszta”) --- */
.attention-digest, .attention-class { margin: 0 0 20px; min-width: 0; }
.attention-digest-title, .attention-class-title { font-size: 1.125rem; margin: 12px 0 8px; overflow-wrap: anywhere; }
.attention-digest-title small, .attention-class-title small { color: var(--muted); font-weight: normal; margin-left: 6px; }
.attention-digest-intro { margin: 0 0 10px; color: var(--muted); overflow-wrap: anywhere; font-size: 0.875rem; }
.attention-item.is-returning { background: transparent; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 12px 0; }
.attention-badge { display: inline-block; padding: 0 8px; border: 1px solid var(--border); border-radius: 999px; font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.attention-rows { margin: 8px 0 0; min-width: 0; }
.attention-rows > summary { cursor: pointer; padding: 0 14px; min-height: var(--control-h); display: inline-flex; align-items: center; list-style: none; border: 1px solid var(--border); border-radius: var(--radius-ctrl); background: var(--surface); font-weight: 600; }
.attention-interrupts-title { margin: 20px 0 8px; font-size: 1.125rem; }
.attention-now { margin: 0 0 20px; min-width: 0; background: var(--surface); box-shadow: var(--shadow-card); border-left: 4px solid var(--accent); border-radius: var(--radius-card); padding: 4px 16px 12px; border-left-color: var(--text); } /* plan 71F: sekcja „Teraz” na górze zakładki „Dziś” */
.attention-now-updated { margin: 8px 0 0; }
/* Plan 40B: „Wycisz do…” — opcja, godzina i przycisk w jednym rzędzie, zawijane na telefonie */
.attention-pause-form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; margin: 0 0 16px; min-width: 0; }
.attention-pause-form .ux-field { min-width: 0; margin: 0; } /* spód pól = spód przycisku (`align-items: flex-end`) */
.attention-pause-form .ux-actions-row { margin: 0; }
@media (max-width: 639.98px) { .attention-pause-form .ux-actions-row { flex: 1 1 100%; } }

/* Uwaga: 100B-3, T12, W6 (plan 104B) */
.attention-item.is-reminder,
.attention-item.is-ritual {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 12px 0;
}
.attention-list > li.attention-item:last-child {
  border-bottom: 0;
}
.attention-now > h2 {
  margin: 12px 0 4px;
}
.attention-now .attention-item-title {
  font-weight: 700;
}
.attention-now .attention-item {
  border-bottom-color: var(--border);
}
.attention-now .attention-list > li:last-child {
  border-bottom: 0;
}
@media (prefers-color-scheme: dark) {
  #transcript-record .transcript-summary,
  #transcript-record dl.transcript-meeting,
  #transcript-record section[id^="panel-"],
  #transcript-record details.transcript-details:has(> .transcript-text),
  .attention-now {
    border: 1px solid var(--border);
  }
  .attention-now {
    border-left: 4px solid var(--accent);
  }
}
/* W6 · powtarzane elementy jako karty: grupy „Reszty”, paczki „Dziś” i przerwania dnia = karta `--surface` z ramką i cieniem,
   odstęp 12 px, pozycje w środku rozdzielone linią (T12). „Pokaż pozycje” wygląda jak przycisk z ramką */
.attention-class,
.attention-digest,
.attention-interrupts-title + .attention-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 4px 16px 12px;
  margin: 0 0 12px;
}
.attention-interrupts-title + .attention-list {
  padding: 0 16px;
}
.attention-rows > summary::-webkit-details-marker {
  display: none;
}
.attention-rows[open] > summary {
  margin-bottom: 8px;
}
@media (max-width: 639.98px) {
  .attention-rows > summary {
    min-height: 44px;
  }
}
/* P17: pole widoczne tylko przy wybranej wartości innego pola formularza (`data-show-when="nazwa=wartość"`, `app.js`); bez JS zostaje widoczne */
[data-show-when].is-hidden { display: none; }

/* dzwonek: bez podkreśleń i zielonych linków, wiersze odróżnia cienka linia (uwaga właściciela 2026-10-03) */
.ux-bell-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.ux-bell-list li + li { border-top: 1px solid var(--border); }
.ux-bell-list a { display: block; padding: 10px 0; color: var(--text); text-decoration: none; }
.ux-bell-list a:hover, .ux-bell-list a:focus-visible { color: var(--link); }
.ux-bell-list + p { margin: 8px 0 0; }
.ux-bell-list + p a { display: inline-flex; align-items: center; min-height: 44px; }
/* 104F (T12/T18, K4, M02.2): ikona źródła ze sprite'a przed tytułem, numer pozycji w akcencie, linia „↑ wyżej”, pusty stan, akcje grupy */
.attention-item-icon { display: inline-flex; vertical-align: text-bottom; margin-right: 6px; color: var(--muted); }
.attention-item-icon .ux-icon { width: 18px; height: 18px; }
.attention-rank { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.attention-item-is-above { padding-top: 8px; padding-bottom: 8px; }
.attention-item-above { margin: 0; color: var(--muted); font-size: 0.875rem; overflow-wrap: anywhere; }
.attention-item-above a { color: inherit; text-decoration: none; }
.attention-item-above a:hover, .attention-item-above a:focus-visible { color: var(--link); text-decoration: underline; }
.attention-reaction .ux-icon, .ux-level .ux-icon { width: 16px; height: 16px; vertical-align: text-bottom; }
.attention-class-actions { margin-top: 10px; }
.attention-rows > summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius); padding: 0 14px; background: var(--surface); font-weight: 600; }
.attention-rows > summary::-webkit-details-marker { display: none; }
.attention-rows > summary::after { content: "\203A"; display: inline-block; transition: transform 0.15s; }
.attention-rows[open] > summary::after { transform: rotate(90deg); }
.attention-rows[open] > summary { margin-bottom: 8px; }
.attention-all-clear { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.attention-all-clear .ux-empty-icon { margin: 0; }

/* Dzwonek: T1 (plan 104B) */
.ux-bell-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  font-size: 0;
  color: transparent;
  background-color: var(--text);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 8a6 6 0 0 0-12 0c0 7-3 9-3 9h18s-3-2-3-9'/%3E%3Cpath d='M13.7 21a2 2 0 0 1-3.4 0'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 8a6 6 0 0 0-12 0c0 7-3 9-3 9h18s-3-2-3-9'/%3E%3Cpath d='M13.7 21a2 2 0 0 1-3.4 0'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* 2.6: kod parowania urządzenia na /settings/devices — duży, z odstępem między znakami */
.devices-code code { font-size: 2rem; letter-spacing: 0.25em; padding: 0.25rem 0.5rem; }

/* 2.9: karta transkrypcji — tekst z zachowaniem łamania, filtry stanu/źródła (plan 38: bez segmentów) */
.transcript-text { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; margin: 0 0 12px; max-width: 75ch; line-height: 1.6; }
/* plan 48A: treść dokumentu markdown pokazywana jako tekst preformatowany (bez renderowania HTML) */
.ux-pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; margin: 0 0 12px; padding: 8px 12px; border-left: 3px solid var(--border); max-height: 60vh; overflow: auto; max-width: 75ch; line-height: 1.6; }
.transcript-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 16px; }
/* plan 35: streszczenie na górze karty, zwinięty tekst, spotkanie z kalendarza, przygaszona data zastępcza, ikona „Skopiowano” */
/* plan 38: streszczenie = lista głównych wątków (zwykły tekst w <li>, bez Markdownu) */
.transcript-summary { overflow-wrap: anywhere; margin: 0 0 12px; padding-left: 1.25rem; display: grid; gap: 4px; }
.ux-details { margin: 8px 0 12px; }
.ux-details > summary { cursor: pointer; font-weight: 600; }
.transcript-match { margin: 4px 0; }
/* plan 38: kandydaci do przypięcia — tytuł i data, pod nimi wiersz akcji `.ux-actions-row` (poprawka właściciela P11: bez lokalnych szerokości przycisków) */
.transcript-candidates { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.transcript-candidate { display: block; min-width: 0; overflow-wrap: anywhere; }
.transcript-candidates .transcript-candidate small { color: var(--muted); white-space: nowrap; }
/* plan 38: etykiety uczestników („Ja”, imię) z adresem w nawiasie; tytuł ze spotkania; edycja tytułu */
.transcript-email, .transcript-title-note { color: var(--muted); }
.transcript-title-form { margin: 0 0 8px; }
.ux-table td.is-muted { color: var(--muted); }
.ux-row-action.is-copied { color: var(--accent, currentColor); }

/* 2.11: rekord błędu (/admin/logs/{id}) i rekord aktywności asystenta — lista pól i traceback */
.ux-fields { display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; gap: 4px 16px; margin: 0 0 12px; }
.ux-fields dt { color: var(--muted, inherit); }
.ux-fields dd { margin: 0; overflow-wrap: anywhere; }
/* plan 39B: wartość przygaszona (`meta_rows` z `muted`), np. „jeszcze nie było”; wąski ekran — etykieta nad wartością */
.ux-fields dd.is-muted { color: var(--muted, inherit); }
.ux-fields-items { margin: 4px 0 0; padding: 0; list-style: none; color: var(--muted, inherit); }
@media (max-width: 639.98px) {
  .ux-fields { grid-template-columns: 1fr; gap: 0; }
  .ux-fields dd { margin: 0 0 8px; }
}

/* Rekord: siatka meta: T9 (plan 104B) */
@media (min-width: 640px) {
  dl.ux-fields {
    grid-template-columns: max-content 1fr;
    gap: 6px 16px;
  }
}
dl.ux-fields dt {
  font-size: 0.8125rem;
  color: var(--muted);
}
dl.ux-fields dd {
  margin: 0;
}
.error-message { font-weight: 600; overflow-wrap: anywhere; }
.error-traceback { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.85rem; max-height: 60vh; overflow: auto; }

/* 3.G2a → plan 39B (UX-SYSTEM §17) — karta połączenia (`connection_card`): ramka, nagłówek z pigułką stanu, jeden rząd akcji na końcu */
.integration-card { border: 1px solid var(--border); border-radius: var(--radius-card); padding: var(--card-pad-y) var(--card-pad); background: var(--surface); box-sizing: border-box; box-shadow: none; margin: 0 0 16px; }
/* nagłówek: tytuł (z ikoną pomocy) po lewej, pigułka stanu po prawej; wąski ekran — pigułka zawija się pod tytuł */
.integration-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 0 0 12px; }
.integration-card h2 { margin: 0; min-width: 0; overflow-wrap: anywhere; }
/* M64 (plan 104I): karta połączenia zwinięta do nagłówka - `summary` jest nagłówkiem (strzałka CSS zamiast znacznika, który znika we flexie) */
.integration-fold > summary.integration-head { cursor: pointer; list-style: none; margin: 0; min-height: var(--tap); }
.integration-fold > summary.integration-head::-webkit-details-marker { display: none; }
.integration-fold > summary.integration-head::before { content: "\25B8"; color: var(--muted); margin-right: 4px; transition: transform .15s; }
.integration-fold[open] > summary.integration-head::before { transform: rotate(90deg); }
/* 113E2b: pigułka stanu w jednym rzędzie z tytułem, póki tytuł ma >= 10rem; węższa karta (375 px w układzie z kolumną) = pigułka pod tytułem */
.integration-fold > summary.integration-head h2 { flex: 1 1 10rem; min-width: 0; }
.integration-fold > summary.integration-head:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.integration-fold[open] > summary.integration-head { margin-bottom: 12px; }
/* pigułka STANU (nie filtr): niska, bez obramowania jako przycisk; kolor niesie znaczenie, ale stan zawsze jest też słowem */
.integration-state { font-size: .875rem; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.integration-state.is-connected { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); color: var(--text); border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); }
.integration-state.is-needs_reauth, .integration-state.is-error { background: var(--surface); color: var(--warning); border-color: var(--warning); }
/* rząd akcji: przyciski obok siebie, zawijane (używa go też sekcja „Webhooki Oury” w panelu instalacji — jej wygląd bez zmian) */
.integration-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
/* w karcie połączenia: rząd na końcu, przyciski bez własnych marginesów (odstęp daje `gap`) */
.integration-card .integration-actions { margin: 12px 0 0; }
.integration-card .integration-actions .btn, .integration-card .integration-actions form, .integration-card .integration-actions form.inline { margin: 0; }
/* `form.inline button` (przycisk pomocniczy) bije `.btn` specyficznością — akcja główna w formularzu POST musi zostać zielona (poza wyłączoną, 113C) */
.integration-card .integration-actions form.inline button.btn:not(.btn-secondary):not(.btn-danger):not(:disabled) { background: var(--accent); color: var(--on-accent); border-color: transparent; }

/* Karta połączenia: S3, S5 (plan 104B) */
.telegram-card {
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: none;
  padding: var(--card-pad-y) var(--card-pad);
  margin: 0 0 16px;
}
.telegram-card > h2,
.integration-head h2 {
  font-size: var(--card-title);
  font-weight: 700;
  margin: 0 0 12px;
}
.telegram-card > :last-child {
  margin-bottom: 0;
}
.telegram-card .telegram-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.telegram-actions {
  flex-wrap: wrap;
}

/* plan 27 — import osoby z karty Brain: podgląd propozycji (pole · dziś · z Brain · pewność) jako lista, bez tabeli */
.persons-proposal { border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 12px; margin: 12px 0; background: var(--surface); }
.persons-proposal h3 { margin: 0 0 8px; }
.persons-proposal-rows { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.persons-proposal-row { display: grid; grid-template-columns: minmax(8rem, 12rem) 1fr 1fr; gap: 4px 12px; align-items: start; }
.persons-proposal-row .persons-proposal-field { font-weight: 600; align-items: flex-start; gap: 8px; }
/* etykieta zawija sie do dwoch linii: pole wyboru ma zostac 22 x 22 px (jak w innych wierszach), a nie kurczyc sie we flexie */
.persons-proposal-row .persons-proposal-field input[type="checkbox"] { flex: 0 0 auto; margin: 0; }
.persons-proposal-note { color: var(--muted, inherit); font-style: italic; }
.persons-proposal-row .persons-proposal-today { color: var(--muted, inherit); overflow-wrap: anywhere; }
.persons-proposal-row .persons-proposal-new { overflow-wrap: anywhere; }
.persons-proposal-row .ux-field-error { grid-column: 1 / -1; margin: 0; }
.persons-proposal-head { color: var(--muted, inherit); font-size: 0.85rem; }
.persons-proposal-label { display: none; color: var(--muted, inherit); margin-right: 4px; }
.persons-proposal-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.persons-proposal-actions .btn { margin: 0; }
@media (max-width: 639.98px) {
  .persons-proposal-row { grid-template-columns: 1fr; }
  .persons-proposal-head { display: none; }
  .persons-proposal-label { display: inline; }
}

/* plan 29 — /settings/connections: siedem kart (include) jedna pod drugą, kotwice `#google|#plaud|#oura|#fireflies|#notion|#telegram|#devices` */
.connection-anchor { margin: 0 0 1.5rem; scroll-margin-top: 1rem; }

/* plan 30 — karta Fireflies: adres webhooka i sekret do skopiowania (pole tylko do odczytu na całą szerokość karty) */
.integration-copy { width: 100%; font-family: var(--font-mono); }
.integration-copy-row { display: flex; gap: .5rem; align-items: center; }
.integration-copy-row .integration-copy { flex: 1 1 auto; min-width: 0; width: auto; }
.integration-copy-row .btn { margin: 0; }
.integration-copy-field { margin: 0 0 12px; }
/* Powiadomienia - kroki konfiguracji skrótu i lista tokenów (plan 101) */
.ntf-steps { margin: 0 0 12px; padding-left: 1.4rem; }
.ntf-steps > li { margin: 0 0 10px; overflow-wrap: anywhere; }
.ntf-steps .integration-copy-field { margin: 8px 0 0; }
.ntf-steps .integration-copy-row .btn { flex: 0 0 auto; white-space: nowrap; }
.ntf-tokens { list-style: none; margin: 0 0 12px; padding: 0; }
.ntf-tokens > li { margin: 0 0 6px; overflow-wrap: anywhere; }
.transcript-meeting dt { font-weight: 600; margin-top: .5rem; }
.transcript-meeting dd { margin: 0; }

/* Karta transkrypcji: T13 (plan 104B) */
/* treść maila, transkrypcji, dokumentu i notatki Brain: wygodna długość linii */
.mail-body,
.brain-md {
  max-width: 75ch;
  line-height: 1.6;
}
/* M06.1 (plan 104H, 105A): treść encji Brain zawija się (`pre` nie rozpycha strony na telefonie) */
.brain-md {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  margin: 0 0 12px;
}
/* plan 105A (UX-SYSTEM §28): wikilink bez celu to tekst, nie link */
.brain-link-missing {
  color: var(--muted);
  text-decoration: underline dotted;
  cursor: help;
}
.brain-section-head,
.brain-entry-head {
  margin: 0 0 8px;
}
.brain-entry {
  margin: 0 0 16px;
}
/* plan 112C: rada modelu pod podsumowaniem biegu porządków - zwykła notka */
.brain-run-advice {
  max-width: 75ch;
  margin: 8px 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.brain-backlinks {
  margin: 0;
  padding-left: 1.2rem;
}
.brain-backlink-section {
  color: var(--muted);
  font-size: 0.8125rem;
}
.brain-backlinks-more {
  list-style: none; /* plan 122A: „Wszystkie (N)” pod grupą */
  margin-left: -1.2rem;
}
/* plan 119: listy w panelach Linki i Wersje rekordu encji */
.brain-link-list,
.brain-version-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}
.brain-link-list li,
.brain-version-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}
.transcript-title-note {
  margin: 0 0 4px;
}
.transcript-title-note small {
  font-size: 0.8125rem;
  color: var(--muted);
}
#transcript-record h2 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 24px 0 8px;
}
#transcript-record .transcript-summary,
#transcript-record dl.transcript-meeting,
#transcript-record section[id^="panel-"],
#transcript-record details.transcript-details:has(> .transcript-text) {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--card-pad-y) var(--card-pad);
  margin: 0 0 16px;
}
#transcript-record .transcript-summary {
  padding-left: 40px;
}
#transcript-record dl.transcript-meeting dt:first-child {
  margin-top: 0;
}
#transcript-record section[id^="panel-"] > h2 {
  margin: 0 0 8px;
}
#transcript-record section[id^="panel-"] .transcript-actions {
  margin-bottom: 0;
}
#transcript-record details.transcript-details:has(> .transcript-text) > summary {
  font-size: 1.125rem;
  font-weight: 700;
}
#transcript-record details.transcript-details:has(> .transcript-text)[open] > summary {
  margin-bottom: 8px;
}
#transcript-record details.transcript-details:has(> .transcript-text) .transcript-text {
  max-width: 75ch;
  line-height: 1.6;
  margin-bottom: 0;
}
@media (max-width: 639.98px) {
  #transcript-record .transcript-summary,
  #transcript-record dl.transcript-meeting,
  #transcript-record section[id^="panel-"],
  #transcript-record details.transcript-details:has(> .transcript-text) {
    padding: var(--card-pad-y) var(--card-pad);
  }
  #transcript-record .transcript-summary {
    padding-left: 34px;
  }
}
/* --- Poczta → Etykiety (plan 50 A1, `mail/settings.html`): wiersz pozycji katalogu to wiersz `field_table` (plan 104E, M67); klasa `mail-label-row` zostaje jako uchwyt testów --- */
/* --- plan 50 B2 — `list_view`: plakietki komórki (`cell.badges`) i linki dokumentów pod treścią (`cell.links`); `choice_pills` (UX-SYSTEM §1, §7) --- */
.ux-badges { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; }
.ux-badge { display: inline-block; padding: 1px 8px; border: 0; border-radius: 999px; font-size: 0.8125rem; font-weight: 500; color: color-mix(in srgb, var(--muted) 55%, var(--text)); white-space: nowrap; background: var(--surface-2); }
/* tag (cell.tag): wariant plakietki - klikalny (link filtru listy), z wielokropkiem na wąskim ekranie */
/* W39 · plakietka pochodzenia/źródła: cichy tekst --muted bez tła i ramki; limit szerokości, żeby nie rozpychała kolumny tabeli (`nowrap`) także od tabletu (834 px, lista zadań) */
.ux-tag { display: inline-block; max-width: min(100%, 11rem); padding: 0; border: 0; background: transparent; font-size: 0.8125rem; font-weight: 400; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; text-decoration: none; }
a.ux-tag:hover, a.ux-tag:focus-visible { text-decoration: underline; }
/* ikona zrodla w tagu: rozmiar i linia bazowa liczone od czcionki tagu (domyslne 20 px wypychalo ikone ponad tekst) */
.ux-tag .ux-icon { width: 1.1em; height: 1.1em; margin-right: 0.3em; vertical-align: -0.2em; }
.ux-cell-links { display: flex; flex-wrap: wrap; gap: 0 12px; margin: 2px 0 0; }
.ux-cell-link { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; max-width: 100%; color: var(--link); overflow-wrap: anywhere; }
.ux-cell-link .ux-icon { width: 16px; height: 16px; }
/* T21 (plan 104D) · tony plakietek: serwer podaje `tone` (`ok|warning|danger`), `neutral` zostaje spokojny (szare tło z reguły `.ux-badge` 104B,
   bez ramki); ton = tło 12-16 % koloru tonu (`--ok`/`--warning`/`--danger`), tekst w kolorze tonu zmieszanym z tekstem strony (kontrast >= 4,5 : 1) */
.ux-badge.is-danger {
  background: color-mix(in srgb, var(--danger) 14%, var(--surface));
  color: color-mix(in srgb, var(--danger) 85%, var(--text));
}
.ux-badge.is-warning {
  background: color-mix(in srgb, var(--warning) 16%, var(--surface));
  color: color-mix(in srgb, var(--warning) 70%, var(--text));
}
.ux-badge.is-ok {
  background: color-mix(in srgb, var(--ok) 14%, var(--surface));
  color: color-mix(in srgb, var(--ok) 70%, var(--text));
}
/* W32 (plan 104D) · kolumna `counters`: plakietki liczników do lewej, zawijane; pusta komórka (wszystkie zera) nie pokazuje samego podpisu */
.ux-table td.ux-k-counters {
  white-space: normal;
}
.ux-counters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  vertical-align: baseline;
}
@media (max-width: 639.98px) {
  #main .ux-table td.is-empty {
    display: none;
  }
}
/* W33 (plan 104D) · makro `ratio`: pasek 48 px (`<progress>`) i „X / Y”; pełny zapis w `title`, pełny pasek półgruby, zero przygaszone */
.ux-ratio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.ux-ratio-bar {
  appearance: none;
  -webkit-appearance: none;
  width: 48px;
  height: 6px;
  border: 0;
  border-radius: 3px;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border);
}
.ux-ratio-bar::-webkit-progress-bar {
  background: transparent;
}
.ux-ratio-bar::-webkit-progress-value {
  background: var(--accent);
  border-radius: 3px;
}
.ux-ratio-bar::-moz-progress-bar {
  background: var(--accent);
}
.ux-ratio.is-empty .ux-ratio-text {
  color: var(--muted);
}
.ux-ratio.is-full .ux-ratio-text {
  font-weight: 600;
}
/* K5/T22 (plan 104D) · krótka data (`cell.when`, `meta_rows(when)`): cyfry tabelaryczne, bez łamania; pełna wartość w `title` */
.ux-when {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* T6 (plan 104D) · stopka listy: „Na stronie” i licznik pod tabelą */
.ux-list-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}
.ux-list-footer .ux-count {
  flex-basis: auto;
  margin-left: auto;
}
/* S10/W19/T23 (plan 104D, `list_view(add_form=)`) · formularz „Dodaj…” za przyciskiem nad listą; z błędem walidacji otwarty (`open`) */
.ux-add {
  display: block; /* 104J: nie flex - w nowych Chromium treść `details` (`::details-content`) jest elementem flex i kurczyła się do paddingu */
  margin: 0 0 12px;
}
.ux-add > summary {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  list-style: none;
  cursor: pointer;
  margin: 0 0 0 auto; /* przycisk po prawej, formularz pod nim na całą szerokość */
}
.ux-add > summary::-webkit-details-marker {
  display: none;
}
.ux-add-body {
  align-self: stretch;
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  margin-top: 8px;
  padding: var(--card-pad-y) var(--card-pad);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  text-align: left;
}
.ux-add-body > form > h2,
.ux-add-body > form > h3,
.ux-add-body > h2,
.ux-add-body > h3 {
  margin-top: 0;
}
/* W35 (plan 104G) · Kategorie dokumentów: jedna karta; wiersz „Nowa kategoria” (pole i akcja główna w jednej linii) nad listą; wiersz kategorii =
   pole nazwy (cicha ramka, widoczna na hover i fokus), licznik, akcje ikonami (`.ux-icon-btn`). Selektory z `#main`: globalna reguła pól (W24) jest mocniejsza */
#main .ux-cats {
  margin-top: 16px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
#main .ux-cats-add {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: var(--card-pad-y) var(--card-pad);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
#main .ux-cats-add input {
  flex: 1 1 16rem;
  min-width: 0;
  background: var(--surface);
}
#main .ux-cats-add .ux-field-error {
  flex: 1 1 100%;
  margin: 0;
}
#main .ux-cats-defaults {
  margin: 0;
  padding: var(--card-pad-y) var(--card-pad);
}
#main .ux-cats-empty {
  margin: 0;
  padding: var(--card-pad-y) var(--card-pad);
  color: var(--muted);
}
#main .ux-cats-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
#main .ux-cats-row + .ux-cats-row {
  border-top: 1px solid var(--border);
}
#main .ux-cats-row > form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 4px 16px;
  margin: 0;
  padding: 8px var(--card-pad);
}
#main .ux-cats-row input[type="text"] {
  border-color: transparent;
  background: transparent;
  font-weight: 600;
}
@media (hover: hover) {
  #main .ux-cats-row input[type="text"]:hover {
    border-color: var(--border);
  }
}
#main .ux-cats-row input[type="text"]:focus {
  border-color: var(--accent);
  background: var(--surface);
}
.ux-cats-count {
  color: var(--muted);
  font-size: 0.875rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.ux-cats-actions {
  display: inline-flex;
  gap: 4px;
}
#main .ux-cats-row .ux-field-error {
  grid-column: 1 / -1;
  margin: 0;
}
@media (max-width: 639.98px) {
  #main .ux-cats-row > form {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  #main .ux-cats-row input[type="text"] {
    grid-column: 1 / -1;
  }
  .ux-cats-actions {
    justify-self: end;
  }
}
/* przycisk-ikona (plan 104G, W35): kwadrat wysokości kontrolki, bez ramki; `.is-danger` = kolor błędu (kosz) */
.ux-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--control-h);
  min-width: var(--control-h);
  min-height: var(--control-h);
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-ctrl);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}
.ux-icon-btn .ux-icon {
  width: 20px;
  height: 20px;
}
.ux-icon-btn.is-danger {
  color: var(--danger);
}
@media (hover: hover) {
  .ux-icon-btn:hover {
    background: var(--surface-2);
  }
  .ux-icon-btn.is-danger:hover {
    background: var(--danger-soft);
  }
}

/* W38 (plan 104G) · Plan (`tasks/plan.html`): linia stanu, pasek widoku, oś dnia jako karta z blokami, „Nie zmieściło się” jako karta */
.ux-plan-status {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.875rem;
}
.ux-plan-status > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ux-plan-status .ux-icon {
  width: 16px;
  height: 16px;
  flex: none;
}
.ux-plan-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin: 0 0 16px;
}
.ux-plan-bar h2 {
  margin: 0;
  font-size: 1.25rem;
}
.ux-plan-nav {
  display: inline-flex;
  gap: 4px;
}
.ux-plan-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-h);
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-ctrl);
  background: var(--surface);
  text-decoration: none;
}
.ux-plan-nav .ux-plan-step {
  width: var(--control-h);
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
}
.ux-plan-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-left: auto;
}
.ux-plan-tools .ux-choices {
  margin: 0;
}
.ux-plan-allday {
  margin: 0 0 8px;
}
.ux-slots {
  display: grid;
  gap: 4px;
  margin: 0 0 24px;
  padding: 8px var(--card-pad);
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.ux-slot {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 4px 0;
}
.ux-slots.is-week .ux-slot {
  grid-template-columns: 11rem minmax(0, 1fr);
}
.ux-slot-time {
  padding-top: 10px;
  color: var(--muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ux-slot-body {
  min-width: 0;
  padding: 10px 14px;
  border-radius: var(--radius-ctrl);
}
.ux-slot.is-task .ux-slot-body {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}
.ux-slot.is-busy .ux-slot-body {
  color: var(--muted);
  background: repeating-linear-gradient(135deg, transparent 0 6px, var(--surface-2) 6px 12px);
  border: 1px dashed var(--border);
}
.ux-slot-title {
  display: block;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.ux-slot.is-busy .ux-slot-title {
  font-weight: 400;
}
.ux-slot-body .ux-badges {
  margin-top: 6px;
}
.ux-slot.is-task .ux-badge {
  background: var(--surface);
}
.ux-plan-unplaced {
  margin: 0 0 24px;
  padding: var(--card-pad-y) var(--card-pad);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.ux-plan-unplaced h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  font-size: 1.125rem;
}
.ux-plan-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.875rem;
}
.ux-plan-unplaced-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ux-plan-unplaced-list .ux-slot-body {
  padding: 8px 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
}
@media (max-width: 639.98px) {
  .ux-slot,
  .ux-slots.is-week .ux-slot {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
  .ux-slot-time {
    padding-top: 0;
  }
  .ux-plan-tools {
    margin-left: 0;
  }
}

/* M20/T5 (plan 104G) · menu „⋯” akcji wiersza (`row_action_buttons`, akcje z `menu: true`): menu jako `popover` w warstwie wierzchniej (113B): pozycję ustawia `app.js`
   (`placeRowMenu`), nie przycina go tabela. „Usuń” (`is-danger`) na końcu, odsunięte linią */
.ux-row-menu {
  display: inline-block;
  vertical-align: top;
}
.ux-row-menu-list {
  display: none;
  position: fixed;
  inset: auto;
  margin: 0;
  max-height: calc(100vh - 16px);
  overflow: auto;
  color: var(--text);
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-width: 11rem;
  padding: 6px;
  text-align: left;
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-ctrl);
  box-shadow: var(--shadow-card);
}
.ux-row-menu-list:popover-open {
  display: flex;
}
.ux-row-menu-list form {
  display: flex;
  margin: 0;
}
.ux-row-menu-item {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  min-height: var(--control-h);
  margin: 0;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-ctrl);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.ux-row-menu-item .ux-icon {
  flex: none;
  width: 18px;
  height: 18px;
}
.ux-row-menu-item:hover {
  background: var(--surface-2);
}
.ux-row-menu-item.is-danger {
  color: var(--danger);
}
.ux-row-menu-list > .is-danger,
.ux-row-menu-list > form:has(> .is-danger) {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
.ux-row-menu-item.is-danger:hover {
  background: var(--danger-soft);
}

/* M21.4 (plan 104G) · przycisk w nagłówku grupy listy (`row.group_action`): etykieta grupy po lewej, akcja po prawej */
.ux-group-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}
.ux-group-label {
  min-width: 0;
  overflow-wrap: anywhere;
}
.ux-group-bar form {
  margin: 0;
}
.ux-group-action {
  margin: 0;
  font-size: 0.875rem;
}
.ux-slot-body .ux-badges {
  display: flex;
}
/* W27 (plan 104D) · telefon: wartość wielowierszowa (`is-stack`: komórka z `sub` albo `links`) - podpis kolumny NAD wartością */
@media (max-width: 639.98px) {
  #main .ux-table td.is-stack {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }
  #main .ux-table td.is-stack > * {
    padding-left: 0;
    margin-left: 0;
    margin-top: 0;
  }
  #main .ux-table td.is-stack::before {
    flex: none; /* 113K: w kolumnie `flex-basis` byłby WYSOKOŚCIĄ (96 px pustki nad wartością) */
    margin: 0 0 2px;
    font-size: 0.75rem;
    color: var(--muted);
  }
}
.ux-choices { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0 0 8px; }
/* 113C · pigułki POST (`choice_buttons`): formularz bez marginesu, przycisk ma wygląd pigułki, nie przycisku */
.ux-choice-form {
  display: inline-flex;
  margin: 0;
}
.ux-choices button.ux-pill {
  min-height: var(--control-h);
  margin: 0;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}
.ux-choices button.ux-pill[aria-pressed="true"] {
  font-weight: 600;
  cursor: default;
}
.ux-choices .ux-pill.is-active { font-weight: 600; border-color: var(--text); background: var(--surface-2); color: var(--text); }

/* Filtry i pigułki: S8, T6 (plan 104B) */
@media (min-width: 640px) {
  /* kontener `list_filters` (div z `.ux-choices` w środku): grupy obok siebie, zawijane */
  .content div[id]:has(> .ux-choices) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 20px;
  }
}
.ux-choices-label {
  font-size: 0.8125rem;
  color: var(--muted);
}
@media (max-width: 639.98px) {
  .ux-choices,
  .ux-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .ux-choices::-webkit-scrollbar,
  .ux-pills::-webkit-scrollbar {
    display: none;
  }
  /* każda grupa w osobnym rzędzie przewijanym poziomo (113B, A14; kontener `list_filters`) */
  .content div[id]:has(> .ux-choices) {
    display: block;
    overflow: visible;
    margin-inline: 0;
    padding-inline: 0;
  }
  .content div[id]:has(> .ux-choices) > .ux-choices,
  .content div[id]:has(> .ux-choices) > .ux-pills {
    display: flex;
    flex: none;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -16px 8px;
    padding-inline: 16px;
    scroll-padding-inline: 16px;
  }
  /* 113B: zanikanie krawędzi przewijanego paska (klasy z `app.js`) - widać, że jest więcej */
  .ux-tabs.has-more-end,
  .ux-choices.has-more-end,
  .ux-pills.has-more-end {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
  }
  .ux-tabs.has-more-start,
  .ux-choices.has-more-start,
  .ux-pills.has-more-start {
    -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 32px), transparent);
    mask-image: linear-gradient(to left, #000 calc(100% - 32px), transparent);
  }
  .ux-tabs.has-more-start.has-more-end,
  .ux-choices.has-more-start.has-more-end,
  .ux-pills.has-more-start.has-more-end {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent);
  }
  .ux-tabs {
    scroll-padding-inline: 32px;
  }
  /* kompromis: 40 px zamiast 44 px, żeby filtry nie zjadały pierwszego ekranu */
  .ux-pill {
    min-height: 40px;
    flex: none;
    white-space: nowrap;
  }
  .ux-choices-label {
    flex: none;
    white-space: nowrap;
  }
}
.ux-pill[aria-current],
.ux-pill[aria-pressed="true"] {
  background: var(--surface-2);
  border-color: var(--text);
  color: var(--text);
  font-weight: 600;
}

/* Lista: 100B-3, 100B-6, R6, S8, T13, T5, W10, W36, W39 (plan 104B) */
.ux-table .ux-k-date,
.ux-table .ux-k-num {
  font-variant-numeric: tabular-nums;
}
@media (min-width: 640px) {
  /* wrapper przewijany poziomo (overflow) obcinałby cień tabeli - zapas w paddingu, wyrównany ujemnym marginesem */
  .ux-table-wrap {
    padding: 4px 4px 12px;
    margin: -4px -4px -12px;
  }
  .ux-table {
    border: 0;
    box-shadow: var(--shadow-card);
    border-radius: var(--radius-card);
  }
}
@media (hover: hover) and (min-width: 640px) {
  /* akcje wiersza: na urządzeniu z myszą widoczne dopiero przy najechaniu / fokusie (na dotyku zawsze); wiersz
   wyróżniony skrótami klawiszowymi pokazuje je też. Otwarty w panelu NIE jest wyjątkiem (W42: akcje zależą tylko od hover/fokusu,
   nie od panelu) */
  .ux-table tbody tr:not(:hover):not(:focus-within):not(.is-current) .ux-col-actions .ux-row-action:not(.is-text) {
    opacity: 0;
  }
}
@media (hover: hover) and (min-width: 640px) and (prefers-reduced-motion: no-preference) {
  .ux-row-action {
    transition: opacity 120ms ease, background-color 120ms ease, color 120ms ease;
  }
}
@media (min-width: 640px) {
  /* data w jednej linii tylko w opakowaniu >= 720 px (`@container` niżej); w węższym (tablet obok menu, panel) łamie się na spacjach (plan 82, 104J) */
  .ux-table td.col-sender small {
    max-width: 18rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* W2 · nagłówki tabel: ten sam rozmiar co komórki, 600, przygaszone, bez wersalików; wszystkie na jednej linii bazowej (dół komórki),
   sortowalny nagłówek (`a.ux-sort`) bez własnego paddingu i minimalnej wysokości, ikona 14 px. Reguły `#id th` modułów (Poczta) mają
   wyższą specyficzność, więc są tu wymienione. Telefon: nagłówek to pasek chipów, tam nic nie zmieniamy */
  #mail-list th,
  #one-on-one-list .ux-table th,
  #team-list .ux-table th {
    font-size: var(--text-size);
    font-weight: 600;
    color: var(--muted);
    text-transform: none;
    letter-spacing: 0;
    vertical-align: bottom;
    line-height: 1.4;
  }
  .ux-table th .ux-sort {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 0;
    padding: 0;
    margin: 0;
  }
  .ux-table th .ux-sort::after {
    font-size: 14px;
    line-height: 1;
  }
}
/* W10 · plakietki komórki głównej pod tytułem, od lewej krawędzi tytułu (wcześniej `margin-left: 4px` w regułach `#id` modułów),
   odstęp nad i pod 6 px, zajawka pod plakietkami z tym samym odstępem */
.ux-table td.ux-cell-main .ux-badges,
#outbox-list .col-subject .ux-badges,
#outbox-list .col-waiting .ux-badges {
  display: flex;
  margin: 6px 0 0;
  padding: 0;
}
.ux-table td.ux-cell-main small {
  margin-top: 6px;
}
.ux-table td.ux-cell-main .ux-cell-links {
  margin-top: 6px;
}
.ux-table tbody tr.is-open {
  background: var(--surface-2);
  outline-color: var(--text);
}
.ux-table th.ux-k-code,
.ux-table td.ux-k-code::before {
  font-family: var(--font-ui); /* 113K: etykieta karty zwykłym krojem, kroj maszynowy tylko dla wartości */
}
/* W36 · nagłówek grupy listy (`list_view`, `row.group`): wyraźnie mocniejszy niż wiersze - 1.125 rem 700, kolor tekstu (nie przygaszony),
   24 px odstępu nad, pasek akcentu z lewej i linia pod spodem; wiersze grupy wcięte pod nim (pierwsza komórka z tekstem, 28 px) */
#main .ux-table .ux-group-row th {
  padding: 24px 12px 8px;
  background: transparent;
  color: var(--text);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  border-top: 0;
  border-bottom: 1px solid var(--border);
  box-shadow: inset 3px 0 0 var(--accent);
  padding-left: 16px;
}
#main .ux-table .ux-group-row:first-child th {
  padding-top: 16px;
}
#main .ux-table .ux-group-row a {
  color: inherit;
  text-decoration: none;
}
@media (min-width: 640px) {
  /* W45 · komórki wiersza tabeli: pierwsza linia tekstu na tej samej linii bazowej (daty, liczby i plakietki nie „wiszą wyżej” niż tytuł,
   gdy mają mniejszą czcionkę); tylko tabela (>= 640 px) - karty telefonu mają osobny układ */
  .ux-table tbody td {
    vertical-align: baseline;
  }
}
@container (min-width: 720px) {
  #main .ux-table .ux-k-main {
    width: 44%;
  }
  #main .ux-table .ux-k-date,
  #main .ux-table .ux-k-status,
  #main .ux-table .ux-k-bool,
  #main .ux-table .ux-k-num {
    width: 1%;
    white-space: nowrap;
  }
}
@media (hover: hover) {
  a.ux-tag:hover {
    color: var(--text);
    text-decoration: underline;
  }
}

/* Lista: karty na telefonie: 100B-5, 100B-6, T17, T5, T7 (plan 104B) */
@media (max-width: 639.98px) {
  .ux-table thead tr {
    box-shadow: none;
    border-radius: 0;
  }
  .ux-actions-row > :only-child {
    flex: 1 1 100%;
  }
  #main .ux-table td[data-label]:not([data-label=""]):not(.ux-cell-main):not(.ux-cell-meta):not(.is-stack)::before {
    flex: 0 0 96px; /* U4: wartości w jednej linii pionowej (113B przywraca 1.7a) */
    width: 96px;
    min-width: 0;
    margin-right: 0;
    overflow-wrap: break-word;
  }
  #main .ux-table .ux-group-row {
    margin: 24px 0 8px;
  }
  #main .ux-table .ux-group-row th {
    padding: 4px 0 6px 12px;
    border-bottom: 0;
    box-shadow: inset 3px 0 0 var(--accent);
  }
}
/* --- plan 50 B2 — Poczta: wiersz „czeka na analizę”, rekord wątku (dokumenty, wiadomości; treść jako tekst z nowymi liniami) --- */
/* lista wątków (plan 63 A1b): dwie kolumny — temat (plakietki etykiety, liczby maili i daty, całe streszczenie, dokumenty) i nadawca — plus akcje wiersza (siatka wg reguły ogólnej, plan 84);
   streszczenie (`<small>`) łamie się normalnie, bez obcinania; zapas min-content ≥ 24 px na 834 px mierzy `test_mail_rest_tab_keeps_spare_width_at_tablet_width` (pl i en) */
/* plan 50 D3: tylko od tabletu — w karcie (< 640 px) prawy margines tytułu robi miejsce na checkbox zaznaczania (reguły `.ux-cell-main` powyżej) */
@media (min-width: 640px) { #mail-list th, #mail-list td { padding-left: 8px; padding-right: 8px; } }
@media (max-width: 639.98px) {
  #mail-list th { font-size: 0.875rem; }
}
#mail-list .col-subject small { white-space: normal; overflow-wrap: anywhere; }
#mail-list .col-sender small, #outbox-replies .col-who small { overflow-wrap: anywhere; } /* plan 65/82: adres pod nazwą nadawcy (jedno słowo; `break-word` robiło z niego podłogę 200 px) */
/* plan 65: na karcie (< 640 px) komórka jest rzędem „etykieta + wartość” - adres schodzi pod nazwę, równo z wartością (96 px etykiety + 12 px odstępu) */
@media (max-width: 639.98px) {
  #mail-list td.col-sender { flex-wrap: wrap; }
  #mail-list td.col-sender small { flex: 0 0 100%; box-sizing: border-box; padding-left: 108px; margin-top: -4px; }
}
#mail-list .col-subject .ux-badges { display: flex; margin: 6px 0 0; padding: 0; }
.mail-pending { color: var(--muted); margin: 0 0 8px; }
.mail-proposals { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.mail-proposal-title { font-weight: 600; overflow-wrap: anywhere; }
.mail-docs { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 4px; }
.mail-docs a { display: inline-flex; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.mail-docs a:not(.btn) {
  min-height: 32px;
}
.mail-message { border-top: 1px solid var(--border); padding: 12px 0; min-width: 0; }
.mail-message-head { margin: 0 0 6px; color: var(--muted); overflow-wrap: anywhere; }
.mail-message-head strong { color: var(--text); }
.mail-address { font-size: 0.875rem; overflow-wrap: anywhere; } /* plan 65: adres w nagłówku wiadomości (tekst, bez mailto:) */
/* plan 50 D3 B7: rozwijany blok „Szczegóły” z adresami nadawcy, adresatów i DW (zwinięty domyślnie) */
.mail-headers { margin: 0 0 8px; font-size: 0.875rem; color: var(--muted); }
.mail-headers summary { cursor: pointer; }
.mail-headers dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 6px 0 0; }
.mail-headers dt { font-weight: 600; }
.mail-headers dd { margin: 0; overflow-wrap: anywhere; }
.mail-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 8px; }
.mail-frame { display: block; width: 100%; height: 24rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); margin: 0 0 8px; }
.mail-frame-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; }
.mail-frame-actions form { display: inline; margin: 0; }
.mail-frame-actions .mail-note { margin: 0; }
.mail-note, .mail-attachments { margin: 0 0 8px; color: var(--muted); overflow-wrap: anywhere; }
.mail-draft-confidence { margin: 0 0 8px; color: var(--muted); }
.mail-draft-uncertain { margin: 0 0 8px; padding-left: 20px; color: var(--muted); }
.mail-draft-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 8px; padding: 8px 12px; border-left: 3px solid var(--border); } /* plan 79: podgląd treści szkicu AI (tekst) */
/* --- plan 50 D1 — Podpisy: lista dokumentów (sześć kolumn + akcje); kolumny drugorzędne chowa `hide_below` w szablonie listy (wg szerokości tabeli), a akcje wiersza układa reguła ogólna kolumny akcji (plan 84) --- */
#signatures-list th, #signatures-list td { padding-left: 8px; padding-right: 8px; }
#signatures-list th { font-size: 0.875rem; }
#signatures-list .col-document, #signatures-list .col-requester, #signatures-list .col-platform { overflow-wrap: break-word; }
#signatures-list .col-document .ux-badges { display: flex; margin: 6px 0 0; padding: 0; }
#signature-history th, #signature-history td { padding-left: 8px; padding-right: 8px; }
/* kolumny drugorzędne (reguła, liczba maili) chowa `hide_below` w szablonie listy - są w rekordzie */
/* --- plan 50 D2 — Outbox: lista wątków (siedem kolumn + akcje); dzwonek, odpowiedzi i follow-up chowa `hide_below` w szablonie listy (są w rekordzie), a dwie akcje wiersza mieszczą się w wąskiej kolumnie --- */
#outbox-list th, #outbox-list td { padding-left: 8px; padding-right: 8px; }
#outbox-list th { font-size: 0.875rem; }
/* plan 65: adresy adresatów i autorów odpowiedzi w Outboxie (tekst pod nazwą) */
#outbox-list .col-subject, #outbox-list .col-waiting { overflow-wrap: break-word; }
#outbox-replies th, #outbox-replies td { padding-left: 8px; padding-right: 8px; }
/* --- plan 113E1a - pole wyboru jednej wartości (`form_field(type='segmented')`), Poczta, Outbox --- */
.ux-segmented { border: 0; padding: 0; margin: 0; min-width: 0; }
.ux-segmented > legend { display: inline; padding: 0; font-weight: 600; font-size: var(--text-size); }
.ux-segmented-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.ux-seg { position: relative; display: inline-flex; }
.ux-seg input { position: absolute; opacity: 0; }
.ux-seg span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
}
.ux-seg input:checked + span { font-weight: 600; border-color: var(--text); background: var(--surface-2); color: var(--text); }
.ux-seg input:focus-visible + span { outline: 2px solid var(--link); outline-offset: 2px; }
/* Plan zadań: wolny dzień w widoku tygodnia (przygaszony) */
.ux-slot-title.is-muted { color: var(--muted); font-weight: 400; }
/* Poczta: nagłówek sekcji „Wiadomości” z przełącznikiem HTML/tekst po prawej */
.mail-messages-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.mail-messages-head h2 { margin: 0; }
/* Outbox: adres pod nazwą w „Do kogo” łamie się dopiero przy braku miejsca (podłogi kolumny nie dajemy - strażnik 113B) */
#outbox-list .col-to small { overflow-wrap: break-word; }
/* --- plan 51/71 — Zadania: opis pozycji propozycji na stronie pozycji (tylko do odczytu) --- */
.tasks-proposal-note { margin: 0 0 8px; color: var(--muted); overflow-wrap: anywhere; }
/* --- plan 51 — Zadania: lista (siedem kolumn + akcje); kolumny drugorzędne chowa `hide_below` w szablonie listy (są w rekordzie), a akcje wiersza mieszczą się w wąskiej kolumnie --- */
#tasks-list th, #tasks-list td, #projects-list th, #projects-list td, #tasks-batches th, #tasks-batches td { padding-left: 8px; padding-right: 8px; }
#tasks-list th, #projects-list th, #tasks-batches th { font-size: 0.875rem; }
#tasks-list .col-title { overflow-wrap: break-word; }
#tasks-list .col-project, #tasks-list .col-assignee, #projects-list .col-name { overflow-wrap: break-word; } /* break-word (nie anywhere): minimum = najdłuższe słowo, kolumny nie kruszą słów na tablecie */
#tasks-list .col-title .ux-badges { display: flex; margin: 6px 0 0; padding: 0; }
#tasks-batches .col-title, #tasks-batches .col-assignee, #tasks-batches .col-source { overflow-wrap: break-word; }
/* telefon: ikony propozycji (Dodaj, Auto, Usuń) zostają w rogu karty w jednym rzędzie i nie wydłużają jej (reguła ogólna spycha od
   trzeciej pod treść); regułę `#tasks-batches td { padding-right: 8px }` wyżej przebija margines nagłówka z miejscem na akcje i checkbox */
@media (max-width: 639.98px) {
  #tasks-batches tbody tr td.ux-cell-main { padding-left: 12px; padding-right: 12px; }
  #tasks-batches tbody tr:has(td.ux-col-actions > :nth-child(3 of :not(.is-overflow))) td.ux-col-actions { position: static; padding: 0 8px 4px; justify-content: flex-start; align-self: flex-end; }
  }
/* plan 73: tag źródła stoi w kolumnie „Źródło” (telefon: karta, komputer: kolumna z sortowaniem); gdy tabela zadań albo propozycji
   ma < 1200 px (`hide_below: xl`, plan 84: trzy ikony akcji w jednym wierszu na laptopie 1280 px), kolumna znika, a ten sam tag
   pokazuje się przy tytule (ten sam próg `@container` co `.ux-hide-xl`) */
#tasks-list .col-title .ux-tag, #tasks-batches .col-title .ux-tag { display: none; }
@media (min-width: 640px) and (max-width: 1023.98px) {
  #tasks-batches .col-source { display: none; } /* widok decyzji (partie) nie ma tytułu z tagiem - kolumna znika jak dotąd na tablecie */
}
@media (min-width: 640px) {
  @container (max-width: 1199.98px) {
    #tasks-list .col-title .ux-tag, #tasks-batches .col-title .ux-tag { display: inline-flex; align-items: center; margin-left: 4px; }
  }
}
/* --- plan 67 A1 — 1:1: lista serii (pięć kolumn + akcje); kolumny drugorzędne (sugerowane, seria, notatki) chowa `hide_below` w szablonie listy (są w rekordzie), a akcje wiersza mieszczą się w wąskiej kolumnie --- */
#one-on-one-list th, #one-on-one-list td, #one-on-one-meetings th, #one-on-one-meetings td { padding-left: 8px; padding-right: 8px; }
#one-on-one-list th, #one-on-one-meetings th { font-size: 0.875rem; }
#one-on-one-list .col-person, #one-on-one-list .col-series, #one-on-one-list .col-next { overflow-wrap: break-word; }
/* --- plan 67 A2 — 1:1: listy feedbacku (cztery kolumny + akcje), Przegląd i wartości w Ustawieniach; na tablecie wydźwięk schodzi (jest na karcie pozycji), a akcje wiersza mieszczą się w wąskiej kolumnie --- */
#one-on-one-feedback th, #one-on-one-feedback td, #one-on-one-next-feedback th, #one-on-one-next-feedback td,
#one-on-one-meeting-feedback th, #one-on-one-meeting-feedback td, #one-on-one-review th, #one-on-one-review td,
#one-on-one-values th, #one-on-one-values td { padding-left: 8px; padding-right: 8px; }
#one-on-one-feedback th, #one-on-one-next-feedback th, #one-on-one-meeting-feedback th, #one-on-one-review th, #one-on-one-values th { font-size: 0.875rem; }
#one-on-one-feedback .col-behavior, #one-on-one-next-feedback .col-behavior, #one-on-one-meeting-feedback .col-behavior, #one-on-one-review .col-behavior { overflow-wrap: break-word; }
#one-on-one-feedback .col-value, #one-on-one-next-feedback .col-value, #one-on-one-meeting-feedback .col-value, #one-on-one-review .col-value,
#one-on-one-values .col-name, #one-on-one-values .col-description { overflow-wrap: break-word; }
@media (min-width: 640px) and (max-width: 1023.98px) {
  #one-on-one-feedback .col-polarity, #one-on-one-next-feedback .col-polarity, #one-on-one-meeting-feedback .col-polarity,
  #one-on-one-review .col-polarity { display: none; }
}
/* --- plan 113E1b - Uwaga: menu „Wycisz” w nagłówku (`menu_button` z `links`), pozycje-linki menu --- */
/* lista menu w nagłówku: od 640 px do prawej krawędzi nagłówka (reguła wyżej), na telefonie od lewej krawędzi przycisku */
@media (max-width: 639.98px) { .ux-page-actions .ux-menu-list { left: 0; right: auto; } }
.ux-menu-list a.ux-menu-item { display: flex; align-items: center; color: var(--text); text-decoration: none; }
/* --- Czat (plan 69A, UX-SYSTEM §20) - bąble rozmowy, pole wiadomości przyklejone do dołu; tylko zmienne motywu --- */
.ux-chat-list { list-style: none; display: flex; flex-direction: column; gap: 8px; padding: 0; margin: 0 0 12px; }
.ux-chat-msg { max-width: min(42rem, 88%); padding: 8px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.ux-chat-msg.is-user { align-self: flex-end; background: var(--accent-soft); color: var(--text); }
.ux-chat-msg.is-assistant { align-self: flex-start; }
.ux-chat-msg.is-muted { opacity: .7; }
.ux-chat-msg.is-waiting .ux-chat-text { color: var(--muted); }
.ux-chat-msg.is-waiting .ux-chat-note { color: var(--text); margin-bottom: 4px; }
.ux-chat-who { display: block; font-size: .8rem; color: var(--muted); }
/* 113H: czas wiadomości małym drukiem pod tekstem dymka (rekord rozmowy Zespołu) */
.ux-chat-when { display: block; margin-top: 4px; font-size: .75rem; color: var(--muted); }
.ux-chat-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.ux-chat-tools { align-self: flex-start; font-size: .8rem; color: var(--muted); }
.ux-chat-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ux-chat-followups { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.ux-chat-composer { position: sticky; bottom: 0; background: var(--bg); padding-top: 8px; }
@media (max-width: 639px) {
  .ux-chat-composer { bottom: calc(var(--tap) + env(safe-area-inset-bottom)); padding-bottom: 12px; }
  .ux-chat-msg { max-width: 100%; }
}
/* 104F (W43): „Wyślij” jako okrągły przycisk ikonowy w prawym dolnym rogu pola; pole ma z prawej miejsce na przycisk */
.ux-composer-box { position: relative; }
.ux-composer-box textarea { padding-right: 56px; }
/* pole bez dolnego marginesu: pudełko jest elementem siatki `.ux-form` (104E S1, własny kontekst formatowania), więc margines pola nie zapada się
   przez pudełko i odsuwałby przycisk pod krawędź textarea; odstęp pod kompozytorem daje `.ux-form > *` */
.ux-composer-box > .ux-field { margin-bottom: 0; }
.ux-send { position: absolute; right: 10px; bottom: 10px; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; width: 36px; height: 36px; min-width: 36px; min-height: 36px; padding: 0; border-radius: 50%; }
.ux-send .ux-icon { width: 18px; height: 18px; }
@media (max-width: 639.98px) {
  .ux-send { width: 44px; height: 44px; min-width: 44px; min-height: 44px; right: 6px; bottom: 6px; } /* cel dotykowy 44 px */
}

/* Czat: 100B-5 (plan 104B) */
@media (min-width: 640px) {
  /* W22: dymki asystenta na szerokim ekranie do ~80 % szerokości kolumny czatu (to czat, nie tekst do czytania - limit znaków
   nie obowiązuje); wiadomości użytkownika zostają węższe. Panel asystenta (wąski) i telefon: pełna szerokość. */
  .ux-chat-msg.is-assistant {
    max-width: 80%;
  }
  .ux-chat-msg.is-user {
    max-width: min(34rem, 70%);
  }
  .ux-assistant-panel .ux-chat-msg.is-assistant,
  .ux-assistant-panel .ux-chat-msg.is-user {
    max-width: 92%;
  }
}

/* Powiadomienia (plan 70A) */
.notification-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 12px; }
#notifications-list th, #notifications-list td { padding-left: 8px; padding-right: 8px; }
#notifications-list .col-title, #notifications-list .col-sender, #notifications-list .col-app, #notifications-list .col-received { overflow-wrap: break-word; }
@media (min-width: 640px) and (max-width: 1023.98px) {
  #notifications-list .col-world, #notifications-list .col-sender, #notifications-list .col-received { display: none; }
}

/* Lista: karty na telefonie, listy modułów: S5 (plan 104B) */
@media (max-width: 639.98px) {
  /* S5 (telefon, karty list): reguły modułowe `#<lista> …` (8 px po bokach, akcje w rogu karty, specyficzność id) zjadały miejsce
   rezerwowane na pole zaznaczenia i akcje, więc tytuł wchodził pod checkbox i ikony; te same selektory id, ułożone za nimi, wygrywają z nimi: akcje w stopce karty, tytuł z miejscem na checkbox */
  #tasks-list td,
  #projects-list td,
  #tasks-batches td,
  #outbox-list td,
  #outbox-replies td,
  #signatures-list td,
  #signature-history td,
  #one-on-one-list td,
  #one-on-one-meetings td,
  #one-on-one-feedback td,
  #one-on-one-next-feedback td,
  #one-on-one-meeting-feedback td,
  #one-on-one-review td,
  #one-on-one-values td,
  #notifications-list td {
    padding-left: 12px;
    padding-right: 12px;
  }
  #tasks-list tbody tr td.ux-cell-main,
  #projects-list tbody tr td.ux-cell-main,
  #outbox-list tbody tr td.ux-cell-main,
  #outbox-replies tbody tr td.ux-cell-main,
  #signatures-list tbody tr td.ux-cell-main,
  #signature-history tbody tr td.ux-cell-main,
  #one-on-one-list tbody tr td.ux-cell-main,
  #one-on-one-meetings tbody tr td.ux-cell-main,
  #one-on-one-feedback tbody tr td.ux-cell-main,
  #one-on-one-next-feedback tbody tr td.ux-cell-main,
  #one-on-one-meeting-feedback tbody tr td.ux-cell-main,
  #one-on-one-review tbody tr td.ux-cell-main,
  #one-on-one-values tbody tr td.ux-cell-main,
  #notifications-list tbody tr td.ux-cell-main {
    padding-right: 12px;
  }
  #tasks-list tbody tr:has(td.ux-col-actions > :nth-child(3 of :not(.is-overflow))) td.ux-col-actions,
  #projects-list tbody tr:has(td.ux-col-actions > :nth-child(3 of :not(.is-overflow))) td.ux-col-actions,
  #outbox-list tbody tr:has(td.ux-col-actions > :nth-child(3 of :not(.is-overflow))) td.ux-col-actions,
  #outbox-replies tbody tr:has(td.ux-col-actions > :nth-child(3 of :not(.is-overflow))) td.ux-col-actions,
  #signatures-list tbody tr:has(td.ux-col-actions > :nth-child(3 of :not(.is-overflow))) td.ux-col-actions,
  #signature-history tbody tr:has(td.ux-col-actions > :nth-child(3 of :not(.is-overflow))) td.ux-col-actions,
  #one-on-one-list tbody tr:has(td.ux-col-actions > :nth-child(3 of :not(.is-overflow))) td.ux-col-actions,
  #one-on-one-meetings tbody tr:has(td.ux-col-actions > :nth-child(3 of :not(.is-overflow))) td.ux-col-actions,
  #one-on-one-feedback tbody tr:has(td.ux-col-actions > :nth-child(3 of :not(.is-overflow))) td.ux-col-actions,
  #one-on-one-next-feedback tbody tr:has(td.ux-col-actions > :nth-child(3 of :not(.is-overflow))) td.ux-col-actions,
  #one-on-one-meeting-feedback tbody tr:has(td.ux-col-actions > :nth-child(3 of :not(.is-overflow))) td.ux-col-actions,
  #one-on-one-review tbody tr:has(td.ux-col-actions > :nth-child(3 of :not(.is-overflow))) td.ux-col-actions,
  #one-on-one-values tbody tr:has(td.ux-col-actions > :nth-child(3 of :not(.is-overflow))) td.ux-col-actions,
  #notifications-list tbody tr:has(td.ux-col-actions > :nth-child(3 of :not(.is-overflow))) td.ux-col-actions {
    position: static;
    align-self: flex-end;
    padding: 0 8px 4px;
  }
}
/* ikona „?” ma ujemny margines (pole dotyku) - w wierszu akcji dostaje zapas z prawej, by nie nachodziła na następny przycisk */
.ux-actions-row .ux-help { flex: none; margin-right: 14px; }
@media (max-width: 639.98px) {
  .ux-actions-row > form:has(.ux-help) { flex: 1 1 auto; }
  .ux-actions-row > form:has(.ux-help) > button { width: auto; min-width: 0; }
}
#ntf-rules-list .col-name { overflow-wrap: break-word; }

/* Plan 81: plakietka strony mockupu (`/admin/mockup/*`) - numer ekranu do promptów; nad paskiem dolnym telefonu */
.ux-mockup-badge {
  position: fixed;
  right: 12px;
  bottom: calc(var(--tap) + 24px + env(safe-area-inset-bottom));
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap; /* 100B-5: cztery grupy (swiat, wyglad, paleta, tryb) zawijaja sie w kolejne linie */
  max-width: calc(100% - 24px);
  padding: 6px 10px;
  background: var(--surface);
  color: var(--text);
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  font-size: 0.875rem;
}
.ux-mockup-code {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--link);
}
.ux-mockup-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ux-mockup-worlds {
  display: flex;
  gap: 6px;
}
.ux-mockup-designs-label {
  color: var(--muted);
}
.ux-mockup-worlds a[aria-current] {
  font-weight: 700;
  text-decoration: none;
}
@media (min-width: 640px) {
  .ux-mockup-badge { bottom: 12px; }
}
/* 100B-5: plakietka zwinięta na telefonie do kodu ekranu i „⋯” (przycisk dokłada `mockup.js`), rozwijana klikiem; oba wyglądy mockupu */
.ux-mockup-toggle { display: none; }
@media (max-width: 639.98px) {
  .ux-mockup-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 1.125rem;
    line-height: 1;
  }
  .ux-mockup-badge:not(.is-open) > :not(.ux-mockup-code):not(.ux-mockup-toggle) { display: none; }
  .ux-mockup-badge.is-open .ux-mockup-label { display: none; }
}

/* Plan 85A2: wskaźnik pracy asystenta (trzy kropki) w dymku oczekiwania; bez JS, tylko zmienne motywu */
.ux-chat-typing { display: inline-flex; gap: 4px; align-items: center; margin-right: 8px; vertical-align: middle; }
.ux-chat-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: ux-chat-typing 1.2s infinite ease-in-out; }
.ux-chat-typing span:nth-child(2) { animation-delay: .15s; }
.ux-chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes ux-chat-typing { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .ux-chat-typing span { animation: none; opacity: .6; } }

/* M64 (plan 104I): przegląd stanów „Połączeń” - wartość kafelka to krótki napis stanu, nie liczba: bez ucinania, mniejszym krojem */
#connections-overview {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
#connections-overview .ux-kpi-value {
  font-size: 1rem;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

/* Plan 113E2b: pole do skopiowania (makro copy_field). */
.ux-copy-code { font-family: var(--font-mono); white-space: pre; overflow-x: auto; }


/* --- 113E2a: ekrany Domu --- */
.ux-kpi p.ux-kpi-ratio {
  margin: 4px 0 0;
}
/* Liczba „3 / 4” jest już w wartości karty - tekst przy pasku zostaje tylko w `title`. */
.ux-kpi-ratio .ux-ratio-text {
  display: none;
}
.ux-period-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
}
.ux-period-title {
  white-space: nowrap;
}
.trip-day.is-today {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
}
.trip-day.is-past h3 {
  color: var(--muted);
}

/* plan 120: zegary w dodatkowych strefach (makro `world_clocks`; Start nad „Teraz”, pasek górny tylko `desk-only`) */
.ux-clocks { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 12px; padding: 0; list-style: none; color: var(--muted); font-size: 0.9rem; }
.ux-clock-time { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }
.ux-clock-day { font-size: 0.8rem; }
.topbar-clocks .ux-clocks { margin: 0; gap: 12px; flex-wrap: nowrap; white-space: nowrap; }
/* plan 122B: przegląd nocy Brain - długi tytuł encji łamie się w komórce, lista kandydatów w panelu */
#brain-review .ux-cell-main { overflow-wrap: anywhere; }
.brain-pick-list { list-style: none; margin: 12px 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.brain-pick-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.brain-pick-list li form { margin-left: auto; }
