/* =====================================================================
   ENOSISWORKS — PANEL ADMINISTRACYJNY
   Warstwa aplikacyjna na tokenach marki (css/enosisworks-tokens.css).
   Reguły marki 2.1, których ten arkusz pilnuje:
     · DM Sans: Light 300 dla nagłówków, Medium 500 to najcięższa waga
     · przyciski ZAWSZE wielkimi literami, tracking +.07em
     · letter-spacing nigdy nie jest zmniejszany
     · promienie 2 / 4 / 6 / 8 px — nic bardziej okrągłego
     · karty: włos 1 px zamiast cienia; cień tylko pod oknem modalnym
     · gradient marki jest akcentem: jedno pole na ekran, moduł na marginesie
   [1] mapowanie tokenów  [2] reset  [3] układ  [4] pasek górny  [5] menu boczne
   [6] typografia  [7] przyciski  [8] formularze  [9] karty, KPI  [10] tabela
   [11] odznaki  [12] zakładki  [13] oś czasu  [14] okna  [15] stany
   [16] paginacja  [17] narzędzia  [18] responsywność
   ===================================================================== */

/* krój pisma — pliki lokalne, panel działa bez internetu */
@font-face { font-family: "DM Sans"; src: url("../fonts/DMSans-Light.ttf") format("truetype");   font-weight: 300; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("../fonts/DMSans-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("../fonts/DMSans-Medium.ttf") format("truetype");  font-weight: 500; font-display: swap; }

/* -------------------------------------------- [1] mapowanie tokenów marki */
:root {
  --brand:      var(--ew-violet);
  --brand-dk:   var(--ew-violet-dk);
  --brand-soft: var(--ew-violet-soft);
  --brand-tint: var(--ew-violet-50);
  --accent:     var(--ew-ember);

  --bg:          var(--ew-paper);
  --surface:     var(--ew-white);
  --surface-2:   #FBFBFD;
  --sidebar-bg:  var(--ew-ink);
  --sidebar-fg:  rgba(255,255,255,.74);
  --sidebar-fg-2:rgba(255,255,255,.42);
  --sidebar-line:rgba(255,255,255,.10);
  --ink:         var(--ew-ink);
  --muted:       var(--ew-muted);
  --faint:       var(--ew-faint);
  --line:        var(--ew-line);
  --line-strong: #D9D9E2;

  --ok:   #1B7F4C; --ok-bg:   #E9F5EE;
  --warn: var(--ew-ember-700); --warn-bg: var(--ew-ember-50);
  --err:  var(--ew-error); --err-bg:  var(--ew-error-bg);
  --info: var(--ew-violet-700); --info-bg: var(--ew-violet-50);

  --r-1: var(--ew-r-xs); --r-2: var(--ew-r-sm); --r-3: var(--ew-r-md); --r-4: var(--ew-r-lg);
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px;
  --font: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* skala tekstu aplikacji: gęstsza od strony, te same proporcje */
  --t-xs: 11.5px; --t-sm: 13px; --t-md: 14.5px; --t-lg: 16px; --t-xl: 21px; --t-2xl: 30px; --t-3xl: 40px;

  --hair: inset 0 0 0 1px var(--line);
  --sh-modal: 0 24px 64px rgba(20,20,26,.22);
  --sidebar-w: 260px;
  --sidebar-w-min: 72px;
  --topbar-h: 64px;
  --focus: 2px solid var(--ew-violet);
  --ease: var(--ew-ease); --d-fast: var(--ew-d-fast); --d: var(--ew-d);
}

/* tryb ciemny: pole Ink z brandbooka */
[data-theme="dark"] {
  --bg:          #0E0E13;
  --surface:     #17171F;
  --surface-2:   #1D1D26;
  --sidebar-bg:  #0A0A0F;
  --ink:         #F4F4F8;
  --muted:       #A2A2B0;
  --faint:       #7C7C8A;
  --line:        #2A2A36;
  --line-strong: #3A3A48;
  --brand-tint:  #1E1130;
  --ok-bg:#12281D; --warn-bg:#2A1D0C; --err-bg:#2E1512; --info-bg:#1A1030;
  --sh-modal: 0 24px 64px rgba(0,0,0,.6);
}

/* ------------------------------------------------------------- [2] reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: var(--t-md); font-weight: 400;
  line-height: var(--ew-lh-body); letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4,p,figure { margin: 0; text-wrap: balance; }
a { color: inherit; text-decoration: none; }
b, strong { font-weight: 500; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
:focus-visible { outline: var(--focus); outline-offset: 3px; border-radius: var(--r-1); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none;
        stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
svg.i--sm { width: 15px; height: 15px; }
svg.i--lg { width: 22px; height: 22px; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------- [3] układ */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.app--collapsed { grid-template-columns: var(--sidebar-w-min) 1fr; }
.main { display: flex; flex-direction: column; min-width: 0; }
.content { padding: var(--s-6) var(--s-6) var(--s-7); max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: var(--s-5); margin-bottom: var(--s-6); flex-wrap: wrap; }
.page-head__text { flex: 1 1 340px; min-width: 0; }
.page-head__actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.grid { display: grid; gap: var(--s-4); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--2-1 { grid-template-columns: 2fr 1fr; }
.stack { display: flex; flex-direction: column; gap: var(--s-4); }
.row { display: flex; align-items: center; gap: var(--s-2); }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* -------------------------------------------------------- [4] pasek górny */
.topbar {
  flex: none; position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h); display: flex; align-items: center; gap: var(--s-3);
  padding: 0 var(--s-6); background: var(--surface);
  box-shadow: inset 0 -1px 0 var(--line);
}
.topbar__crumbs { display: flex; align-items: center; gap: var(--s-2); color: var(--muted);
  font-size: var(--t-sm); min-width: 0; overflow: hidden; white-space: nowrap; }
.topbar__crumbs a { position: relative; opacity: .86; }
.topbar__crumbs a:hover { opacity: 1; color: var(--ink); }
.topbar__crumbs .sep { color: var(--faint); }
.topbar__crumbs strong { color: var(--ink); font-weight: 500; }

/* wyszukiwarka: linia zamiast pudełka — jak pola na stronie */
.topbar__search { position: relative; flex: 0 1 320px; min-width: 160px; margin-left: auto; }
.topbar__search input {
  width: 100%; height: 38px; padding: 0 var(--s-6) 0 28px;
  background: transparent; border: 0; box-shadow: inset 0 -1px 0 var(--line);
  border-radius: 0; font-size: var(--t-sm);
}
.topbar__search input:focus { outline: none; box-shadow: inset 0 -1px 0 var(--brand); }
.topbar__search .i { position: absolute; left: 2px; top: 10px; color: var(--faint); }
.topbar__search kbd {
  position: absolute; right: 2px; top: 10px; font-family: var(--font); font-size: var(--t-xs);
  color: var(--faint); letter-spacing: .04em;
}
.topbar__tools { display: flex; align-items: center; gap: var(--s-1); }
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: 0; border-radius: var(--r-2);
  background: transparent; color: var(--muted); cursor: pointer;
  transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); box-shadow: var(--hair); }
.icon-btn__dot {
  position: absolute; top: 5px; right: 5px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--r-1); background: var(--accent); color: var(--ew-ink);
  font-size: 10px; font-weight: 500; line-height: 16px; text-align: center;
}
.env-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: var(--r-2); background: var(--ew-ember-50); color: var(--ew-ember-700);
  font-size: var(--ew-t-label); font-weight: 500; letter-spacing: .07em; text-transform: uppercase;
}
.env-pill--prod { background: var(--ok-bg); color: var(--ok); }

.switcher { display: flex; align-items: center; gap: var(--s-2); height: 40px; padding: 0 12px 0 8px;
  border: 0; border-radius: var(--r-2); background: transparent; box-shadow: var(--hair);
  cursor: pointer; white-space: nowrap; transition: box-shadow var(--d-fast) var(--ease); }
.switcher:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.switcher__text { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; line-height: 1.25; }
.switcher__name { font-weight: 500; font-size: var(--t-sm); }
.switcher__sub { font-size: var(--t-xs); color: var(--muted); }

.user-btn { display: flex; align-items: center; gap: var(--s-2); height: 40px; padding: 0 8px 0 4px;
  border: 0; border-radius: var(--r-2); background: transparent; cursor: pointer; white-space: nowrap; }
.user-btn:hover { background: var(--surface-2); box-shadow: var(--hair); }
.avatar { width: 30px; height: 30px; border-radius: var(--r-2); display: grid; place-items: center;
  background: var(--ew-g-violet); color: #fff; font-size: var(--t-sm); font-weight: 500; flex: none; }
.avatar--lg { width: 44px; height: 44px; border-radius: var(--r-3); font-size: var(--t-lg); }
.avatar--sm { width: 26px; height: 26px; font-size: var(--t-xs); }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 244px;
  background: var(--surface); border-radius: var(--r-3); box-shadow: var(--hair), var(--sh-modal);
  padding: var(--s-2); display: none;
}
.menu[data-open] { display: block; }
.menu--left { right: auto; left: 0; }
.menu__head { padding: var(--s-3); box-shadow: inset 0 -1px 0 var(--line); margin-bottom: var(--s-2); }
.menu__item {
  display: flex; align-items: center; gap: var(--s-3); width: 100%;
  padding: 9px 10px; border: 0; border-radius: var(--r-2); background: transparent;
  cursor: pointer; text-align: left; font-size: var(--t-md); color: var(--ink);
  transition: background var(--d-fast) var(--ease);
}
.menu__item:hover { background: var(--brand-tint); }
.menu__item--danger { color: var(--err); }
.menu__item .i { color: var(--muted); }
.menu__item--danger .i { color: var(--err); }
.menu__sep { height: 1px; background: var(--line); margin: var(--s-2) 0; }
.menu__label { padding: 8px 10px 4px; font-size: var(--ew-t-label); text-transform: uppercase;
  letter-spacing: .07em; color: var(--faint); }

/* -------------------------------------------------------- [5] menu boczne */
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--sidebar-bg); color: var(--sidebar-fg); overflow: hidden;
}
/* jeden moduł jako akcent na marginesie pola Ink */
.sidebar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 56px; height: 120px;
  background: url("../assets/brand/schody-echo.svg") 24px bottom / 132px auto no-repeat;
  opacity: 1; pointer-events: none;
}
.sidebar__brand { display: flex; align-items: center; height: var(--topbar-h);
  padding: 0 var(--s-5); box-shadow: inset 0 -1px 0 var(--sidebar-line); }
.sidebar__brand img { height: 22px; width: auto; }
.sidebar__mark { display: none; height: 24px; }
.sidebar__nav { flex: 1; overflow-y: auto; padding: var(--s-5) var(--s-3); position: relative; z-index: 1; }
.nav__section { margin-bottom: var(--s-6); }
.nav__label { padding: 0 10px var(--s-3); font-size: var(--ew-t-label); text-transform: uppercase;
  letter-spacing: .07em; color: var(--sidebar-fg-2); white-space: nowrap; }
.nav__item {
  display: flex; align-items: center; gap: var(--s-3); width: 100%;
  padding: 9px 10px; margin-bottom: 1px; border: 0; border-radius: var(--r-2);
  background: transparent; color: var(--sidebar-fg); cursor: pointer; text-align: left;
  font-size: var(--t-md); white-space: nowrap;
  transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease);
}
.nav__item:hover { background: rgba(255,255,255,.06); color: #fff; }
/* aktywna pozycja: cienka linia marki + pole Szept, bez pełnego gradientu */
.nav__item[aria-current="page"] {
  color: #fff; background: rgba(255,255,255,.07);
  box-shadow: inset 2px 0 0 var(--ew-violet-300);
}
.nav__item .i { color: currentColor; opacity: .85; }
.nav__item[aria-current="page"] .i { opacity: 1; color: var(--ew-violet-200); }
.nav__count { margin-left: auto; font-size: var(--t-xs); padding: 1px 7px; border-radius: var(--r-1);
  background: rgba(255,255,255,.10); color: #fff; }
.nav__sub { padding-left: 40px; display: none; }
.nav__item--parent[aria-expanded="true"] + .nav__sub { display: block; }
.nav__item--parent .chev { margin-left: auto; transition: transform var(--d-fast) var(--ease); }
.nav__item--parent[aria-expanded="true"] .chev { transform: rotate(90deg); }
.sidebar__foot { position: relative; z-index: 1; padding: var(--s-4) var(--s-5); white-space: nowrap;
  box-shadow: inset 0 1px 0 var(--sidebar-line); font-size: var(--t-xs); color: var(--sidebar-fg-2);
  display: flex; align-items: center; gap: var(--s-2); }
.dot { width: 6px; height: 6px; border-radius: var(--r-1); background: #4ADE80; flex: none; }

.app--collapsed .sidebar__brand img { display: none; }
.app--collapsed .sidebar__mark { display: block; }
.app--collapsed .sidebar__brand { padding: 0; justify-content: center; }
.app--collapsed .nav__label,
.app--collapsed .nav__item span,
.app--collapsed .nav__count,
.app--collapsed .sidebar__foot span { display: none; }
.app--collapsed .nav__item { justify-content: center; padding: 11px; }
.app--collapsed .nav__sub { display: none !important; }
.app--collapsed .sidebar::after { display: none; }

/* --------------------------------------------------------- [6] typografia */
.h1 { font-size: var(--t-2xl); font-weight: 300; line-height: 1.08; letter-spacing: 0; }
.h2 { font-size: var(--t-xl); font-weight: 300; line-height: 1.15; }
.h3 { font-size: var(--t-lg); font-weight: 400; line-height: var(--ew-lh-title); }
.sub { color: var(--muted); font-size: var(--t-md); font-weight: 300; line-height: 1.5; }
.small { font-size: var(--t-sm); }
.xs { font-size: var(--t-xs); }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }
.mono.small, .small.mono { font-size: var(--t-sm); }
/* nadtytuł: zwykły tekst, nigdy numerowany (reguła 2.1) */
.k { font-size: var(--ew-t-eyebrow); color: var(--muted); display: block; margin-bottom: var(--s-2); }
.label { font-size: var(--ew-t-label); text-transform: uppercase; letter-spacing: .07em; color: var(--faint); }

/* --------------------------------------------------------- [7] przyciski */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: 40px; padding: 0 18px; border: 0; border-radius: var(--ew-btn-radius);
  background: var(--brand); color: #fff; cursor: pointer;
  font-size: var(--ew-btn-size); font-weight: var(--ew-btn-weight);
  letter-spacing: var(--ew-btn-tracking); text-transform: var(--ew-btn-transform);
  line-height: 1; white-space: nowrap;
  transition: background var(--d-fast) var(--ease), box-shadow var(--d-fast) var(--ease), color var(--d-fast) var(--ease);
}
.btn:hover { background: var(--brand-dk); }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dk); }
/* drugorzędny i obrysowy: włos zamiast wypełnienia, jak na stronie */
.btn, .btn--ghost, .btn--quiet { }
.btn--ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px rgba(20,20,26,.26); }
.btn--ghost:hover { background: var(--ink); color: var(--surface); box-shadow: inset 0 0 0 1px var(--ink); }
[data-theme="dark"] .btn--ghost { box-shadow: inset 0 0 0 1px rgba(255,255,255,.28); }
[data-theme="dark"] .btn--ghost:hover { background: #fff; color: var(--ew-ink); }
.btn--quiet { background: transparent; color: var(--muted); }
.btn--quiet:hover { background: var(--surface-2); color: var(--ink); }
.btn--danger { background: var(--err); color: #fff; }
.btn--danger:hover { filter: brightness(.9); }
.btn--rev { background: #fff; color: var(--brand-dk); }
.btn--rev:hover { background: var(--ew-violet-50); }
.btn--sm { height: 32px; padding: 0 12px; font-size: 12px; }
.btn--lg { height: 48px; padding: 0 24px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn .i { stroke-width: 1.7; }
.btn-group { display: inline-flex; border-radius: var(--r-2); box-shadow: var(--hair); overflow: hidden; }
.btn-group .btn { height: 34px; border-radius: 0; background: transparent; color: var(--muted); }
.btn-group .btn:hover { background: var(--surface-2); color: var(--ink); box-shadow: none; }
.btn-group .btn + .btn { box-shadow: inset 1px 0 0 var(--line); }
.btn-group .btn[aria-pressed="true"] { background: var(--brand-tint); color: var(--brand-dk); }

/* -------------------------------------------------------- [8] formularze */
.field { display: flex; flex-direction: column; gap: 7px; }
.field__label { font-size: var(--t-sm); font-weight: 500; }
.field__hint { font-size: var(--t-sm); color: var(--muted); }
.field__err { font-size: var(--t-sm); color: var(--err); }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 10px 14px; background: var(--surface);
  border: 0; box-shadow: inset 0 0 0 1px var(--line-strong); border-radius: var(--r-2);
  color: var(--ink); font-size: var(--t-md);
  transition: box-shadow var(--d-fast) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--brand); }
.input--err { box-shadow: inset 0 0 0 1px var(--err); }
.textarea { min-height: 104px; resize: vertical; line-height: 1.55; }
.select { appearance: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px; background-size: 5px 5px; background-repeat: no-repeat; }
.input-group { position: relative; }
.input-group .i { position: absolute; left: 13px; top: 12px; color: var(--faint); }
.input-group .input { padding-left: 38px; }
.switch { position: relative; width: 42px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch__track { position: absolute; inset: 0; background: var(--line-strong); border-radius: var(--r-1);
  transition: background var(--d-fast) var(--ease); }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 1.5px; background: #fff; transition: transform var(--d-fast) var(--ease); }
.switch input:checked + .switch__track { background: var(--ew-g-violet); }
.switch input:checked + .switch__track::after { transform: translateX(20px); }
.check { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }
.choice { display: flex; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-3);
  box-shadow: var(--hair); cursor: pointer; background: var(--surface);
  transition: box-shadow var(--d-fast) var(--ease), background var(--d-fast) var(--ease); }
.choice:hover { box-shadow: inset 0 0 0 1px var(--brand-soft); }
.choice input { margin-top: 3px; accent-color: var(--brand); }
.choice--on { box-shadow: inset 0 0 0 1.5px var(--brand); background: var(--brand-tint); }
.form-section { display: grid; grid-template-columns: 260px 1fr; gap: var(--s-6);
  padding: var(--s-6) 0; box-shadow: inset 0 -1px 0 var(--line); }
.form-section:last-child { box-shadow: none; }
.save-bar { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: var(--s-2);
  padding: var(--s-4) var(--s-5); background: var(--surface); box-shadow: inset 0 1px 0 var(--line); }
.dropzone { display: grid; place-items: center; gap: 8px; padding: var(--s-7); text-align: center;
  border: 1px dashed var(--line-strong); border-radius: var(--r-3); color: var(--muted); background: var(--surface-2); }
.dropzone:hover { border-color: var(--brand); color: var(--brand-dk); }

/* --------------------------------------------------- [9] karty, KPI, pola */
.card { position: relative; background: var(--surface); border-radius: var(--r-3); box-shadow: var(--hair); }
.card__head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-5) var(--s-5) var(--s-3); }
.card__title { font-weight: 500; font-size: var(--t-md); }
.card__body { padding: var(--s-5); }
.card__body--flush { padding: 0; }
.card__foot { padding: var(--s-4) var(--s-5); box-shadow: inset 0 1px 0 var(--line); }
/* karta na polu marki — najwyżej jedna na ekran */
.card--accent { background: var(--ew-f-violet); color: #fff; box-shadow: none; }
.card--accent .sub, .card--accent .kpi__label { color: rgba(255,255,255,.78); }
.card--accent .kpi__value { color: #fff; }
/* moduł jako znak firmowy w rogu pola */
.card__mod { position: absolute; right: var(--s-5); bottom: var(--s-5); width: 64px; opacity: .9; }

.kpi { padding: var(--s-5); }
.kpi__label { font-size: var(--t-sm); color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi__value { font-size: var(--t-3xl); font-weight: 300; line-height: 1.02; letter-spacing: 0; margin-top: 10px; }
.kpi__delta { display: inline-flex; align-items: center; gap: 5px; font-size: var(--t-sm); margin-top: 8px; color: var(--muted); }
.kpi__delta--up { color: var(--ok); } .kpi__delta--down { color: var(--ew-ember-700); }
.kpi__spark { margin-top: var(--s-4); height: 34px; width: 100%; }
.progress { height: 4px; border-radius: var(--r-1); background: var(--line); overflow: hidden; }
.progress__bar { height: 100%; border-radius: var(--r-1); background: var(--ew-g-violet); }
.legend { display: flex; gap: var(--s-4); flex-wrap: wrap; font-size: var(--t-sm); color: var(--muted); }
.legend__key { width: 9px; height: 9px; border-radius: 1.5px; display: inline-block; margin-right: 7px; }

.feed { display: flex; flex-direction: column; }
.feed__item { display: flex; gap: var(--s-3); padding: var(--s-4) var(--s-5); box-shadow: inset 0 -1px 0 var(--line); }
.feed__item:last-child { box-shadow: none; }
.feed__dot { width: 6px; height: 6px; border-radius: 1.5px; background: var(--brand); margin-top: 8px; flex: none; }
.list { display: flex; flex-direction: column; }
.list__item { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-4) var(--s-5);
  box-shadow: inset 0 -1px 0 var(--line); transition: background var(--d-fast) var(--ease); }
.list__item:last-child { box-shadow: none; }
.list__item:hover { background: var(--surface-2); }

/* ----------------------------------------------------------- [10] tabela */
.toolbar { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-4) var(--s-5);
  box-shadow: inset 0 -1px 0 var(--line); flex-wrap: wrap; }
.chips { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center;
  padding: var(--s-3) var(--s-5); box-shadow: inset 0 -1px 0 var(--line); }
/* chip zgodny ze stroną: kwadratowa kropka, promień 4 */
.chip { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 6px 0 11px;
  border: 0; border-radius: var(--r-2); background: var(--surface); box-shadow: var(--hair);
  font-size: var(--t-sm); color: var(--ink); cursor: pointer; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 1.5px; background: var(--brand); flex: none; }
.chip--add { color: var(--muted); padding-right: 11px; }
.chip--add::before { display: none; }
.chip--on { background: var(--brand-tint); color: var(--brand-dk); box-shadow: inset 0 0 0 1px var(--ew-violet-100); }
.chip__x { display: grid; place-items: center; width: 20px; height: 20px; border-radius: var(--r-1);
  background: transparent; border: 0; color: inherit; cursor: pointer; }
.chip__x:hover { background: rgba(20,20,26,.08); }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: var(--t-md); }
.table th, .table td { text-align: left; padding: 14px var(--s-5); box-shadow: inset 0 -1px 0 var(--line); vertical-align: middle; }
.table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); color: var(--faint);
  font-size: var(--ew-t-label); font-weight: 400; text-transform: uppercase; letter-spacing: .07em;
  white-space: nowrap; padding-top: 12px; padding-bottom: 12px; box-shadow: inset 0 -1px 0 var(--ink); }
.table thead th.sortable { cursor: pointer; user-select: none; }
.table thead th.sortable:hover { color: var(--ink); }
.table thead th .i { opacity: .4; }
.table thead th[aria-sort] { color: var(--brand); }
.table thead th[aria-sort] .i { opacity: 1; }
.table tbody tr { transition: background var(--d-fast) var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr[data-selected] { background: var(--brand-tint); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .col-check { width: 46px; }
.table .col-actions { width: 56px; text-align: right; }
.cell-main { display: flex; align-items: center; gap: var(--s-3); }
.cell-main__sub { font-size: var(--t-sm); color: var(--muted); }
.bulkbar { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-5);
  background: var(--brand-tint); box-shadow: inset 0 -1px 0 var(--line); color: var(--brand-dk); }

/* ---------------------------------------------------------- [11] odznaki */
.badge { display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 10px;
  border-radius: var(--r-2); font-size: var(--t-xs); font-weight: 400;
  background: var(--surface-2); color: var(--muted); box-shadow: var(--hair); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 1.5px; background: currentColor; }
.badge--plain::before { display: none; }
.badge--ok   { background: var(--ok-bg);   color: var(--ok);   box-shadow: none; }
.badge--warn { background: var(--warn-bg); color: var(--warn); box-shadow: none; }
.badge--err  { background: var(--err-bg);  color: var(--err);  box-shadow: none; }
.badge--info { background: var(--info-bg); color: var(--info); box-shadow: none; }
.badge--brand{ background: var(--brand-tint); color: var(--brand-dk); box-shadow: none; }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: var(--r-2);
  background: transparent; box-shadow: var(--hair); font-size: var(--t-xs); color: var(--muted); }

/* --------------------------------------------------------- [12] zakładki */
.tabs { display: flex; gap: var(--s-5); box-shadow: inset 0 -1px 0 var(--line); padding: 0 var(--s-5); }
.tab { position: relative; padding: 15px 2px; background: none; border: 0; cursor: pointer;
  color: var(--muted); font-size: var(--t-md); font-weight: 400; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); font-weight: 500; }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--brand); }
.segment { display: inline-flex; padding: 3px; background: var(--surface); box-shadow: var(--hair); border-radius: var(--r-3); }
.segment button { height: 30px; padding: 0 14px; border: 0; border-radius: var(--r-2); background: transparent;
  color: var(--muted); font-size: var(--t-sm); cursor: pointer;
  transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease); }
.segment button:hover { color: var(--ink); }
.segment button[aria-pressed="true"] { background: var(--brand-tint); color: var(--brand-dk); font-weight: 500; }

/* ------------------------------------------- [13] pary, oś czasu, kroki */
.kv { display: grid; grid-template-columns: 180px 1fr; gap: var(--s-4); }
.kv dt { color: var(--faint); font-size: var(--t-sm); }
.kv dd { margin: 0; font-size: var(--t-md); }
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 3px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.timeline__item { position: relative; padding-bottom: var(--s-5); }
.timeline__item::before { content: ""; position: absolute; left: -26px; top: 6px; width: 7px; height: 7px;
  border-radius: 1.5px; background: var(--brand); }
.steps { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: var(--s-2); padding: 9px 14px; border-radius: var(--r-2);
  box-shadow: var(--hair); font-size: var(--t-sm); color: var(--muted); background: var(--surface); }
.step--done { color: var(--ok); box-shadow: inset 0 0 0 1px rgba(27,127,76,.3); }
.step--now { color: #fff; background: var(--ew-g-violet); box-shadow: none; font-weight: 500; }
.step__n { display: grid; place-items: center; width: 20px; height: 20px; border-radius: var(--r-1);
  background: var(--surface-2); font-size: var(--t-xs); }
.step--now .step__n { background: rgba(255,255,255,.22); color: #fff; }
.step--done .step__n { background: var(--ok-bg); color: var(--ok); }

/* ------------------------------------------ [14] modal, szuflada, toast */
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(20,20,26,.5);
  display: none; align-items: center; justify-content: center; padding: var(--s-5); }
.overlay[data-open] { display: flex; }
.modal { width: min(580px, 100%); background: var(--surface); border-radius: var(--r-4);
  box-shadow: var(--sh-modal); overflow: hidden; }
.modal__head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-5);
  box-shadow: inset 0 -1px 0 var(--line); font-weight: 500; }
.modal__body { padding: var(--s-5); }
.modal__foot { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-5);
  box-shadow: inset 0 1px 0 var(--line); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 85; width: min(480px, 100%);
  background: var(--surface); box-shadow: var(--sh-modal); transform: translateX(100%);
  transition: transform var(--d) var(--ease); display: flex; flex-direction: column; }
.drawer[data-open] { transform: none; }
.drawer__head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-5);
  box-shadow: inset 0 -1px 0 var(--line); font-weight: 500; }
.drawer__body { padding: var(--s-5); overflow-y: auto; flex: 1; }
.drawer__foot { padding: var(--s-5); box-shadow: inset 0 1px 0 var(--line); display: flex; gap: var(--s-2); justify-content: flex-end; }
.toasts { position: fixed; right: var(--s-6); bottom: var(--s-6); z-index: 90; display: flex; flex-direction: column; gap: var(--s-2); }
.toast { display: flex; align-items: flex-start; gap: var(--s-3); min-width: 300px; max-width: 400px;
  padding: var(--s-4) var(--s-5); background: var(--ew-ink); color: #fff; border-radius: var(--r-3);
  box-shadow: var(--sh-modal); font-size: var(--t-sm); }
.toast .i { color: var(--ew-violet-200); }
.toast--err .i { color: var(--ew-ember-300); }
.cmdk { width: min(640px, 100%); align-self: flex-start; margin-top: 12vh; background: var(--surface);
  border-radius: var(--r-4); box-shadow: var(--sh-modal); overflow: hidden; }
.cmdk__input { width: 100%; height: 58px; padding: 0 var(--s-5); border: 0; box-shadow: inset 0 -1px 0 var(--line);
  font-size: var(--t-lg); font-weight: 300; background: var(--surface); }
.cmdk__input:focus { outline: none; }
.cmdk__list { max-height: 340px; overflow-y: auto; padding: var(--s-2); }

/* ------------------------------------------------------------ [15] stany */
.empty { display: grid; place-items: center; gap: var(--s-3); padding: var(--s-7) var(--s-5); text-align: center; }
/* kafelek modułu zamiast ikony w kółku — element systemu marki */
.empty__icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--r-3);
  background: var(--ew-g-mist); color: var(--brand-dk); }
.skeleton { position: relative; overflow: hidden; background: var(--line); border-radius: var(--r-1); height: 12px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent); animation: sk 1.4s infinite; }
@keyframes sk { 100% { transform: translateX(100%); } }
.banner { display: flex; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-radius: var(--r-3);
  background: var(--brand-tint); color: var(--brand-dk); font-size: var(--t-md); }
.banner--warn { background: var(--warn-bg); color: var(--warn); }
.banner--err { background: var(--err-bg); color: var(--err); }

/* ------------------------------------------------------- [16] paginacja */
.pager { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-4) var(--s-5); flex-wrap: wrap; }
.pager__btn { min-width: 34px; height: 34px; padding: 0 9px; border: 0; box-shadow: var(--hair);
  background: var(--surface); border-radius: var(--r-2); cursor: pointer; font-size: var(--t-sm); color: var(--ink); }
.pager__btn:hover { background: var(--surface-2); }
.pager__btn[aria-current="page"] { background: var(--ink); color: var(--surface); box-shadow: none; }
.pager__btn:disabled { opacity: .4; cursor: default; }

/* ------------------------------------------------------- [17] narzędzia */
.hr { height: 1px; background: var(--line); border: 0; margin: var(--s-5) 0; }
.mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); }
.mb-3 { margin-bottom: var(--s-3); } .mb-4 { margin-bottom: var(--s-4); } .mb-5 { margin-bottom: var(--s-5); }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tip { position: relative; }
.tip::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  padding: 6px 10px; background: var(--ew-ink); color: #fff; font-size: var(--t-xs); border-radius: var(--r-2);
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity var(--d-fast) var(--ease); z-index: 70; }
.tip:hover::after { opacity: 1; }
/* kafelek modułu (forma) — akcent, jeden na pole */
.tile { --u: 9px; width: 44px; height: 44px; border-radius: var(--r-3); background: var(--ew-g-mist);
  display: grid; place-items: center; }
.tile img { width: 24px; }

/* -------------------------------------------------- [18] responsywność */
@media (max-width: 1180px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--2-1, .grid--3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 70; width: var(--sidebar-w); transform: translateX(-100%);
    transition: transform var(--d) var(--ease); }
  .app--nav-open .sidebar { transform: none; }
  .topbar__search { display: none; }
  .topbar { padding: 0 var(--s-4); }
  .form-section { grid-template-columns: 1fr; }
  .grid--4, .grid--2 { grid-template-columns: 1fr; }
  .content { padding: var(--s-5) var(--s-4) var(--s-6); }
  .kv { grid-template-columns: 1fr; gap: var(--s-1) 0; }
}
@media (min-width: 861px) { .only-mobile { display: none !important; } }
