/* Master Fishing CRM | app.css: baza, powłoka aplikacji i komponenty wspólne.
   Właściciel: A2 (design system). Kontrakt klas: docs/UI-KIT.md. Moduły dokładają style w css/modules/<moduł>.css
   i NIE nadpisują klas z tego pliku. Tokeny: tokens.css (marka 1:1 ze sklepem).
   Język: „spokojny panel premium”. Hierarchia przez wagę i odstęp, jeden akcent marki, ruch tylko transform/opacity. */

/* ---------- tokeny aplikacji ---------- */
:root {
  --app-sidebar-w: 256px;
  --app-topbar-h: 60px;
  --app-content-max: 1480px;
  --app-bg: var(--mf-gray-25);
  --app-sidebar-bg: #f1f5f8;              /* cięższy materiał dla regionu strukturalnego */
  --app-row-h: 48px;
  --app-text-table: 0.875rem;
  --app-hover: rgba(1, 33, 51, 0.04);     /* tło hover dla wierszy i pozycji listy */
  --app-press: rgba(1, 33, 51, 0.07);
  --app-hairline: rgba(1, 33, 51, 0.07);
  --app-card-shadow: 0 1px 2px rgba(1, 33, 51, 0.04), 0 0 0 1px var(--app-hairline);
  --app-card-shadow-hover: 0 2px 4px rgba(1, 33, 51, 0.04), 0 10px 28px rgba(1, 33, 51, 0.08), 0 0 0 1px var(--app-hairline);
  /* kanały sprzedaży: paleta kategoryczna sprawdzona walidatorem (CVD ΔE ≥ 8, kontrast ≥ 3:1) */
  --app-ch-allegro: #ff5a00;
  --app-ch-presta: var(--mf-brand-500);
  --app-ch-pos: #7c5cc4;
  /* wykresy: jedna seria = odcień marki, siatka stonowana */
  --app-chart-bar: var(--mf-brand-400);
  --app-chart-bar-now: var(--mf-brand-600);
  --app-chart-grid: var(--mf-gray-100);
  --app-chart-axis: var(--mf-gray-300);
  --app-chart-text: var(--mf-text-muted);
  color-scheme: light;
}

/* ---------- baza ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--app-topbar-h) + 16px); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--app-bg); color: var(--mf-text);
  font: var(--mf-weight-regular) var(--mf-text-ui) / var(--mf-leading-ui) var(--mf-font-sans);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-variant-numeric: tabular-nums;
  font-optical-sizing: auto; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5 { margin: 0; color: var(--mf-text-strong); font-weight: var(--mf-weight-semibold); text-wrap: balance; }
h1 { font-size: var(--mf-text-h2); line-height: var(--mf-leading-h2); letter-spacing: var(--mf-tracking-h2); }
h2 { font-size: var(--mf-text-h5); line-height: var(--mf-leading-h5); letter-spacing: var(--mf-tracking-h5); }
h3 { font-size: var(--mf-text-h6); line-height: var(--mf-leading-h6); letter-spacing: var(--mf-tracking-h6); }
p { margin: 0; }
a { color: var(--mf-link); text-decoration: none; }
a:hover { color: var(--mf-link-hover); text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--mf-focus) !important; outline-offset: 2px; }
img, svg { display: block; max-width: 100%; }
mark { background: var(--mf-brand-100); color: var(--mf-brand-900); border-radius: 3px; padding: 0 1px; }
::selection { background: var(--mf-brand-100); color: var(--mf-brand-950); }
hr { border: 0; height: 1px; background: var(--mf-border); margin: var(--mf-space-4) 0; }
.icon { display: inline-block; vertical-align: -0.2em; width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 22px; height: 22px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: var(--mf-space-4); top: -100px; z-index: var(--mf-z-toast); padding: var(--mf-space-2) var(--mf-space-4); background: var(--mf-surface); border-radius: var(--mf-radius-md); box-shadow: var(--mf-shadow-md); }
.skip-link:focus { top: var(--mf-space-3); }
.muted { color: var(--mf-text-muted); }
.small { font-size: var(--mf-text-sm); }
.strong { font-weight: var(--mf-weight-semibold); color: var(--mf-text-strong); }
.mono { font-family: var(--mf-font-mono); font-size: 0.92em; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-width: 0; }
.overline { font-size: var(--mf-text-caption); font-weight: var(--mf-weight-semibold); letter-spacing: var(--mf-tracking-overline); text-transform: uppercase; color: var(--mf-text-muted); }
.link-quiet { color: inherit; }
.link-quiet:hover { color: var(--mf-link); }

/* ---------- powłoka ---------- */
.app { display: grid; grid-template-columns: var(--app-sidebar-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; background: var(--app-sidebar-bg);
  box-shadow: inset -1px 0 0 var(--app-hairline); padding: var(--mf-space-4) var(--mf-space-3);
  scrollbar-width: thin;
}
.brand { display: flex; align-items: center; gap: var(--mf-space-3); padding: var(--mf-space-1) var(--mf-space-2) var(--mf-space-6); color: var(--mf-text-strong); }
.brand:hover { text-decoration: none; color: var(--mf-text-strong); }
.brand__mark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; flex: none;
  background: linear-gradient(180deg, var(--mf-brand-500), var(--mf-brand-700));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(1, 33, 51, .18), 0 4px 10px rgba(0, 101, 148, .18);
}
.brand__name { font-weight: var(--mf-weight-bold); letter-spacing: -0.012em; line-height: 1.15; }
.brand__sub { display: block; font-size: var(--mf-text-caption); color: var(--mf-text-muted); font-weight: var(--mf-weight-medium); letter-spacing: 0; }
.nav { display: flex; flex-direction: column; gap: var(--mf-space-5); }
.nav__section { display: flex; flex-direction: column; gap: 2px; }
.nav__label { padding: 0 var(--mf-space-3) var(--mf-space-1); font-size: 0.6875rem; }
.nav__link {
  position: relative; display: flex; align-items: center; gap: var(--mf-space-3); min-height: 38px; padding: 0 var(--mf-space-3);
  border-radius: var(--mf-radius-md); color: var(--mf-gray-700); font-weight: var(--mf-weight-medium);
  transition: background-color var(--mf-dur-fast) var(--mf-ease-out), color var(--mf-dur-fast) var(--mf-ease-out), transform var(--mf-dur-instant) var(--mf-ease-press);
}
.nav__link .icon { color: var(--mf-gray-500); transition: color var(--mf-dur-fast) var(--mf-ease-out); }
.nav__link:hover { background: var(--app-hover); color: var(--mf-text-strong); text-decoration: none; }
.nav__link:hover .icon { color: var(--mf-gray-700); }
.nav__link:active { transform: scale(var(--mf-press-scale)); background: var(--app-press); }
.nav__link[aria-current="page"] { background: var(--mf-surface); color: var(--mf-text-strong); box-shadow: 0 1px 2px rgba(1, 33, 51, .06), 0 0 0 1px var(--app-hairline); }
.nav__link[aria-current="page"] .icon { color: var(--mf-brand-600); }
.nav__count {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px; border-radius: var(--mf-radius-full);
  background: var(--mf-brand-600); color: #fff; font-size: 0.72rem; font-weight: var(--mf-weight-semibold);
  display: grid; place-items: center; font-variant-numeric: tabular-nums;
}
.nav__link[aria-current="page"] .nav__count { background: var(--mf-brand-600); }
.sidebar__foot { margin-top: auto; padding-top: var(--mf-space-5); display: flex; flex-direction: column; gap: var(--mf-space-3); }
.sidebar .sidebar__close { display: none; }
.demo-note { display: flex; gap: var(--mf-space-2); align-items: flex-start; padding: var(--mf-space-3); border-radius: var(--mf-radius-md); background: var(--mf-surface); box-shadow: 0 0 0 1px var(--app-hairline); font-size: var(--mf-text-caption); line-height: var(--mf-leading-caption); color: var(--mf-text-muted); }
.demo-note .icon { color: var(--mf-warning-700); margin-top: 1px; }
.demo-note strong { color: var(--mf-text-strong); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: var(--mf-z-sticky); height: var(--app-topbar-h);
  display: flex; align-items: center; gap: var(--mf-space-3); padding: 0 var(--mf-gutter);
  background: var(--mf-material-bar); -webkit-backdrop-filter: var(--mf-material-blur); backdrop-filter: var(--mf-material-blur);
  box-shadow: 0 1px 0 transparent; transition: box-shadow var(--mf-dur-base) var(--mf-ease-out);
}
/* krawędź przewijania: miękki cień dopiero, gdy treść wchodzi pod pasek */
.is-scrolled .topbar { box-shadow: 0 1px 0 var(--app-hairline), 0 6px 16px -10px rgba(1, 33, 51, .18); }
.topbar .topbar__menu { display: none; }
.search-trigger {
  flex: 1; max-width: 520px; display: flex; align-items: center; gap: var(--mf-space-2); height: 40px; padding: 0 6px 0 var(--mf-space-3);
  border: 0; border-radius: var(--mf-radius-md); background: var(--mf-surface); color: var(--mf-text-muted);
  box-shadow: 0 0 0 1px var(--mf-border), 0 1px 2px rgba(1, 33, 51, .04);
  font: inherit; cursor: pointer; text-align: left;
  transition: box-shadow var(--mf-dur-fast) var(--mf-ease-out), transform var(--mf-dur-instant) var(--mf-ease-press);
}
.search-trigger:hover { box-shadow: 0 0 0 1px var(--mf-border-strong), 0 2px 6px rgba(1, 33, 51, .06); }
.search-trigger:active { transform: scale(.99); }
.search-trigger > span:not(.sr-only) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-trigger kbd { margin-left: auto; white-space: nowrap; }
.topbar__spacer { flex: 1; }
.demo-badge { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--mf-radius-full); background: var(--mf-warning-50); color: var(--mf-warning-700); font-size: var(--mf-text-sm); font-weight: var(--mf-weight-semibold); box-shadow: inset 0 0 0 1px #f3d39a; }
.user-chip { display: flex; align-items: center; gap: var(--mf-space-2); }
.user-chip__name { line-height: 1.2; font-size: var(--mf-text-sm); }
.user-chip__role { font-size: var(--mf-text-caption); color: var(--mf-text-muted); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--mf-brand-100); color: var(--mf-brand-800); font-weight: var(--mf-weight-semibold); font-size: var(--mf-text-sm);
  letter-spacing: 0.01em; box-shadow: inset 0 0 0 1px rgba(0, 101, 148, .08);
}
.avatar--sm { width: 28px; height: 28px; font-size: 0.72rem; }
.avatar--lg { width: 56px; height: 56px; font-size: var(--mf-text-lg); border-radius: 18px; }
.content { width: 100%; max-width: var(--app-content-max); margin: 0 auto; padding: var(--mf-space-6) var(--mf-gutter) var(--mf-space-16); display: flex; flex-direction: column; gap: var(--mf-space-6); }
.content:focus { outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--mf-space-4); flex-wrap: wrap; padding-top: var(--mf-space-2); }
.page-head__title { display: flex; flex-direction: column; gap: var(--mf-space-1); min-width: 0; }
.page-head__sub { color: var(--mf-text-muted); font-size: var(--mf-text-ui); }
.page-head__meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--mf-space-2) var(--mf-space-3); margin-top: var(--mf-space-1); color: var(--mf-text-muted); font-size: var(--mf-text-sm); }
.page-head__actions { display: flex; gap: var(--mf-space-2); flex-wrap: wrap; align-items: center; }
.breadcrumbs { display: flex; align-items: center; gap: var(--mf-space-1); font-size: var(--mf-text-sm); color: var(--mf-text-muted); flex-wrap: wrap; }
.breadcrumbs a { color: var(--mf-text-muted); display: inline-flex; align-items: center; gap: 4px; }
.breadcrumbs a:hover { color: var(--mf-link); }
.breadcrumbs .icon { width: 14px; height: 14px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: var(--mf-space-3); }

/* ---------- siatki ---------- */
.grid { display: grid; gap: var(--mf-space-4); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--aside { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.grid--wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: var(--mf-space-4); }
.stack--sm { gap: var(--mf-space-2); }
.stack--lg { gap: var(--mf-space-6); }
.row { display: flex; align-items: center; gap: var(--mf-space-3); flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--tight { gap: var(--mf-space-2); }
.row--nowrap { flex-wrap: nowrap; }
.grow { flex: 1; min-width: 0; }

/* ---------- karta ---------- */
.card { position: relative; background: var(--mf-surface); border-radius: var(--mf-radius-lg); box-shadow: var(--app-card-shadow); min-width: 0; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--mf-space-3); min-height: 56px; padding: var(--mf-space-3) var(--mf-space-5); border-bottom: 1px solid var(--mf-gray-100); }
.card__head h2, .card__head h3 { font-size: var(--mf-text-h6); line-height: var(--mf-leading-h6); letter-spacing: -0.006em; }
.card__title { display: flex; align-items: center; gap: var(--mf-space-2); min-width: 0; }
.card__title .icon { color: var(--mf-text-muted); }
.card__head--plain { border-bottom: 0; padding-bottom: 0; min-height: 48px; }
.card__body { padding: var(--mf-space-5); }
.card__body--flush { padding: 0; }
.card__foot { padding: var(--mf-space-3) var(--mf-space-5); border-top: 1px solid var(--mf-gray-100); background: var(--mf-gray-25); border-radius: 0 0 var(--mf-radius-lg) var(--mf-radius-lg); font-size: var(--mf-text-sm); }
.card__foot a { display: inline-flex; align-items: center; gap: 4px; font-weight: var(--mf-weight-medium); }
.card--link { display: block; color: inherit; transition: box-shadow var(--mf-dur-base) var(--mf-ease-out), transform var(--mf-dur-instant) var(--mf-ease-press); }
.card--link:hover { box-shadow: var(--app-card-shadow-hover); text-decoration: none; color: inherit; }
.card--link:active { transform: scale(.99); }
.card--sunken { background: var(--mf-gray-25); box-shadow: inset 0 0 0 1px var(--app-hairline); }

/* ---------- kafel statystyki ---------- */
.stat { padding: var(--mf-space-5); display: flex; flex-direction: column; gap: var(--mf-space-2); overflow: hidden; }
.stat__label { display: flex; align-items: center; gap: var(--mf-space-2); color: var(--mf-text-muted); font-size: var(--mf-text-sm); font-weight: var(--mf-weight-medium); }
.stat__value { font-size: var(--mf-text-h2); font-weight: var(--mf-weight-semibold); letter-spacing: -0.024em; color: var(--mf-text-strong); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat__delta { font-size: var(--mf-text-sm); font-weight: var(--mf-weight-medium); display: flex; align-items: center; gap: var(--mf-space-2); flex-wrap: wrap; color: var(--mf-text-muted); }
.stat__delta--up { color: var(--mf-success-700); }
.stat__delta--down { color: var(--mf-error-700); }
.stat__hint { font-size: var(--mf-text-sm); color: var(--mf-text-muted); }
.stat__foot { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--mf-space-3); margin-top: auto; min-height: 34px; }
.stat .spark { width: 46%; max-width: 128px; height: 34px; flex: none; }

.delta { display: inline-flex; align-items: center; gap: 2px; height: 22px; padding: 0 7px 0 4px; border-radius: var(--mf-radius-full); font-size: 0.78rem; font-weight: var(--mf-weight-semibold); background: var(--mf-gray-100); color: var(--mf-gray-700); }
.delta .icon { width: 14px; height: 14px; stroke-width: 2.25; }
.delta--up { background: var(--mf-success-50); color: var(--mf-success-700); }
.delta--down { background: var(--mf-error-50); color: var(--mf-error-700); }
.delta--flat { padding-left: 7px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px; background: var(--mf-gray-100); border-radius: var(--mf-radius-lg); overflow: hidden; box-shadow: var(--app-card-shadow); }
.kpi { background: var(--mf-surface); padding: var(--mf-space-4) var(--mf-space-5); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi__label { font-size: var(--mf-text-sm); color: var(--mf-text-muted); }
.kpi__value { font-size: var(--mf-text-h4); font-weight: var(--mf-weight-semibold); color: var(--mf-text-strong); letter-spacing: -0.016em; line-height: 1.25; font-variant-numeric: tabular-nums; }
.kpi__hint { font-size: var(--mf-text-caption); color: var(--mf-text-muted); }

/* ---------- przyciski ---------- */
.btn {
  --btn-bg: var(--mf-surface); --btn-fg: var(--mf-text-strong); --btn-bd: var(--mf-border-strong);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--mf-space-2);
  min-height: 40px; padding: 0 var(--mf-space-4); border: 1px solid var(--btn-bd); border-radius: var(--mf-radius-md);
  background: var(--btn-bg); color: var(--btn-fg); font: var(--mf-weight-semibold) var(--mf-text-ui)/1 var(--mf-font-sans);
  cursor: pointer; white-space: nowrap; text-decoration: none; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background-color var(--mf-dur-fast) var(--mf-ease-out), border-color var(--mf-dur-fast) var(--mf-ease-out), box-shadow var(--mf-dur-fast) var(--mf-ease-out), transform var(--mf-dur-instant) var(--mf-ease-press);
}
.btn:not(.btn--ghost):not(.btn--secondary) { box-shadow: 0 1px 2px rgba(1, 33, 51, .05); }
.btn:hover { text-decoration: none; color: var(--btn-fg); background: var(--mf-gray-50); }
.btn:active { transform: scale(var(--mf-press-scale)); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn--primary { --btn-bg: var(--mf-btn-primary-bg); --btn-fg: #fff; --btn-bd: transparent; }
.btn--primary:not(.btn--ghost) { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 1px 2px rgba(1, 33, 51, .16), 0 2px 8px rgba(0, 101, 148, .16); }
.btn--primary:hover { background: var(--mf-btn-primary-bg-hover); }
.btn--primary:active { background: var(--mf-btn-primary-bg-active); }
.btn--secondary { --btn-bg: var(--mf-btn-secondary-bg); --btn-fg: var(--mf-btn-secondary-fg); --btn-bd: transparent; }
.btn--secondary:hover { background: var(--mf-btn-secondary-bg-hover); }
.btn--ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--mf-gray-700); }
.btn--ghost:hover { background: var(--mf-btn-ghost-bg-hover); }
.btn--danger { --btn-bg: var(--mf-error-600); --btn-fg: #fff; --btn-bd: transparent; }
.btn--danger:hover { background: var(--mf-error-700); }
.btn--sm { min-height: 32px; padding: 0 var(--mf-space-3); font-size: var(--mf-text-sm); border-radius: 8px; }
.btn--sm::after { content: ""; position: absolute; inset: -6px 0; } /* cel dotyku ≥ 44 px */
.btn--lg { min-height: 52px; padding: 0 var(--mf-space-6); font-size: var(--mf-text-lg); border-radius: 12px; }
.btn--icon { padding: 0; width: 40px; }
.btn--sm.btn--icon { width: 32px; }
.btn--block { width: 100%; }
.btn .spinner { display: none; }
.htmx-request .btn .spinner, .btn.htmx-request .spinner { display: inline-block; }
.btn.is-done { --btn-bg: var(--mf-success-50); --btn-fg: var(--mf-success-700); --btn-bd: transparent; }

/* ---------- formularze ---------- */
.field { display: flex; flex-direction: column; gap: var(--mf-space-1); min-width: 0; }
.field__label { font-size: var(--mf-text-sm); font-weight: var(--mf-weight-medium); color: var(--mf-text); }
.field__hint { font-size: var(--mf-text-caption); color: var(--mf-text-muted); }
.field__error { font-size: var(--mf-text-sm); color: var(--mf-error-700); display: flex; gap: 6px; align-items: center; }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 0 var(--mf-space-3); border: 1px solid var(--mf-border-control); border-radius: var(--mf-radius-md);
  background: var(--mf-surface); color: var(--mf-text); font: var(--mf-text-base)/1.4 var(--mf-font-sans);
  transition: border-color var(--mf-dur-fast) var(--mf-ease-out), box-shadow var(--mf-dur-fast) var(--mf-ease-out);
}
.input::placeholder, .textarea::placeholder { color: var(--mf-gray-500); }
.select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23616a71' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.textarea { padding: var(--mf-space-2) var(--mf-space-3); min-height: 96px; resize: vertical; line-height: var(--mf-leading-base); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--mf-gray-600); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--mf-focus); box-shadow: 0 0 0 3px var(--mf-brand-100); }
.input[aria-invalid="true"] { border-color: var(--mf-error-600); }
.input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--mf-text-muted); pointer-events: none; }
.input-icon .input { padding-left: 38px; }
.input-group { display: flex; align-items: center; gap: var(--mf-space-2); }
.input-group .input { min-width: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--mf-space-3); }
.toolbar .field { min-width: 150px; }
.toolbar__search { flex: 1 1 280px; }
.checkbox { display: inline-flex; align-items: center; gap: var(--mf-space-2); cursor: pointer; min-height: var(--mf-tap); }
.checkbox input { width: 18px; height: 18px; accent-color: var(--mf-brand-600); }

/* pasek filtrów nad listą */
.filterbar { display: flex; flex-direction: column; gap: var(--mf-space-3); padding: var(--mf-space-4) var(--mf-space-5); }
.filterbar + .card__body--flush, .filterbar + * { border-top: 1px solid var(--mf-gray-100); }

/* przełącznik segmentowy (szybkie okresy, widoki) */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--mf-radius-md); background: var(--mf-gray-50); box-shadow: inset 0 0 0 1px var(--app-hairline); min-height: 40px; }
.segmented__item { position: relative; display: inline-flex; }
.segmented__item input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented__item > span, a.segmented__item {
  display: inline-flex; align-items: center; gap: 6px; padding: 0 var(--mf-space-3); min-height: 34px; border-radius: 8px;
  font-size: var(--mf-text-sm); font-weight: var(--mf-weight-medium); color: var(--mf-gray-700); white-space: nowrap; cursor: pointer;
  transition: background-color var(--mf-dur-fast) var(--mf-ease-out), color var(--mf-dur-fast) var(--mf-ease-out), box-shadow var(--mf-dur-fast) var(--mf-ease-out);
}
.segmented__item:hover > span, a.segmented__item:hover { color: var(--mf-text-strong); text-decoration: none; }
.segmented__item input:checked + span, a.segmented__item[aria-current="true"], a.segmented__item[aria-current="page"] { background: var(--mf-surface); color: var(--mf-text-strong); box-shadow: 0 1px 2px rgba(1, 33, 51, .08), 0 0 0 1px var(--app-hairline); }
.segmented__item input:focus-visible + span { outline: 2px solid var(--mf-focus); outline-offset: 1px; }

/* pigułki: aktywne filtry i segmenty */
.chips { display: flex; flex-wrap: wrap; gap: var(--mf-space-2); align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 var(--mf-space-3); border-radius: var(--mf-radius-full);
  background: var(--mf-surface); color: var(--mf-gray-800); font-size: var(--mf-text-sm); font-weight: var(--mf-weight-medium);
  box-shadow: inset 0 0 0 1px var(--mf-border); white-space: nowrap;
  transition: background-color var(--mf-dur-fast) var(--mf-ease-out), box-shadow var(--mf-dur-fast) var(--mf-ease-out), transform var(--mf-dur-instant) var(--mf-ease-press);
}
a.chip:hover, button.chip:hover { text-decoration: none; color: var(--mf-text-strong); box-shadow: inset 0 0 0 1px var(--mf-border-strong); background: var(--mf-gray-25); }
a.chip:active, button.chip:active { transform: scale(var(--mf-press-scale)); }
.chip[aria-current="true"], .chip[aria-pressed="true"] { background: var(--mf-gray-900); color: #fff; box-shadow: none; }
.chip[aria-current="true"] .chip__count, .chip[aria-pressed="true"] .chip__count { background: rgba(255, 255, 255, .18); color: #fff; }
.chip__count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--mf-radius-full); background: var(--mf-gray-100); color: var(--mf-gray-700); font-size: 0.72rem; font-weight: var(--mf-weight-semibold); display: inline-grid; place-items: center; }
.chip--filter { background: var(--mf-brand-50); color: var(--mf-brand-900); box-shadow: inset 0 0 0 1px var(--mf-brand-100); padding-right: 6px; }
.chip--filter .icon { width: 14px; height: 14px; color: var(--mf-brand-700); }
a.chip--filter:hover { background: var(--mf-brand-100); box-shadow: inset 0 0 0 1px var(--mf-brand-200); }
button.chip { border: 0; font-family: inherit; cursor: pointer; }

/* rozwijane sekcje */
.disclosure > summary { list-style: none; display: inline-flex; align-items: center; gap: var(--mf-space-2); cursor: pointer; font-size: var(--mf-text-sm); font-weight: var(--mf-weight-medium); color: var(--mf-link); min-height: 32px; border-radius: 8px; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary .icon { transition: transform var(--mf-dur-base) var(--mf-ease-out); }
.disclosure[open] > summary .icon { transform: rotate(180deg); }
.disclosure__body { padding-top: var(--mf-space-3); }

/* ---------- tabela ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--app-text-table); }
.table th {
  position: sticky; top: 0; z-index: 1; background: var(--mf-gray-25); text-align: left; font-weight: var(--mf-weight-medium);
  color: var(--mf-text-muted); font-size: 0.78rem; letter-spacing: 0.01em; padding: var(--mf-space-2) var(--mf-space-4); height: 40px;
  border-bottom: 1px solid var(--mf-gray-100); white-space: nowrap;
}
.table th:first-child, .table td:first-child { padding-left: var(--mf-space-5); }
.table th:last-child, .table td:last-child { padding-right: var(--mf-space-5); }
.table th a { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.table th a:hover { color: var(--mf-text-strong); text-decoration: none; }
.table th[aria-sort] a { color: var(--mf-text-strong); }
.table th .icon { width: 14px; height: 14px; }
.table td { padding: var(--mf-space-2) var(--mf-space-4); border-bottom: 1px solid var(--mf-gray-100); vertical-align: middle; height: var(--app-row-h); }
.table tbody tr { transition: background-color var(--mf-dur-fast) var(--mf-ease-out); }
.table tbody tr:hover { background: var(--app-hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr[data-href] { cursor: pointer; }
.table tr[data-href]:active { background: var(--app-press); }
.table .num { text-align: right; }
.table tfoot td { font-weight: var(--mf-weight-semibold); color: var(--mf-text-strong); border-top: 1px solid var(--mf-border); border-bottom: 0; }
.table--compact td { padding-top: var(--mf-space-2); padding-bottom: var(--mf-space-2); height: 40px; }
.table .cell-main { display: flex; align-items: center; gap: var(--mf-space-3); min-width: 0; }
.table .cell-main > div { min-width: 0; }
.table .cell-title { font-weight: var(--mf-weight-medium); color: var(--mf-text-strong); }
.table .cell-sub { font-size: var(--mf-text-caption); color: var(--mf-text-muted); }
.table .cell-sub.truncate, .table td > .truncate { display: block; max-width: 240px; }
.table-summary { display: flex; align-items: center; justify-content: space-between; gap: var(--mf-space-3); flex-wrap: wrap; padding: var(--mf-space-3) var(--mf-space-5); font-size: var(--mf-text-sm); color: var(--mf-text-muted); border-bottom: 1px solid var(--mf-gray-100); }
.table-summary strong { color: var(--mf-text-strong); }

/* ---------- odznaki i tagi ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: var(--mf-radius-full); font-size: 0.78rem; font-weight: var(--mf-weight-semibold); white-space: nowrap; background: var(--mf-gray-100); color: var(--mf-gray-800); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; flex: none; }
.badge--plain::before { display: none; }
.badge--brand { background: var(--mf-brand-50); color: var(--mf-brand-800); }
.badge--success { background: var(--mf-success-50); color: var(--mf-success-700); }
.badge--warning { background: var(--mf-warning-50); color: var(--mf-warning-700); }
.badge--error { background: var(--mf-error-50); color: var(--mf-error-700); }
.badge--neutral { background: var(--mf-gray-100); color: var(--mf-gray-700); }
.badge--demo { background: var(--mf-warning-500); color: var(--mf-gray-950); }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: var(--mf-radius-sm); font-size: 0.78rem; font-weight: var(--mf-weight-medium); background: var(--mf-gray-100); color: var(--mf-gray-800); white-space: nowrap; }
.tag--brand { background: var(--mf-brand-50); color: var(--mf-brand-800); box-shadow: inset 0 0 0 1px var(--mf-brand-100); }
.tag--success { background: var(--mf-success-50); color: var(--mf-success-700); box-shadow: inset 0 0 0 1px #cfeedd; }
.tag--warning { background: var(--mf-warning-50); color: var(--mf-warning-700); box-shadow: inset 0 0 0 1px #f8e2b8; }
.tag--error { background: var(--mf-error-50); color: var(--mf-error-700); box-shadow: inset 0 0 0 1px #f6d2d2; }
.tag--neutral { background: var(--mf-gray-100); color: var(--mf-gray-800); }
.tag__remove { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: -4px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: inherit; cursor: pointer; opacity: .65; }
.tag__remove:hover { opacity: 1; background: rgba(1, 33, 51, .08); }
.tag__remove .icon { width: 12px; height: 12px; stroke-width: 2.25; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.channel { display: inline-flex; align-items: center; gap: 7px; font-weight: var(--mf-weight-medium); font-size: var(--mf-text-sm); white-space: nowrap; }
.channel__dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.channel--allegro .channel__dot { background: var(--app-ch-allegro); }
.channel--presta .channel__dot { background: var(--app-ch-presta); }
.channel--pos .channel__dot { background: var(--app-ch-pos); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mf-gray-400); flex: none; display: inline-block; }
.dot--success { background: var(--mf-success-600); box-shadow: 0 0 0 3px var(--mf-success-50); }
.dot--warning { background: var(--mf-warning-500); box-shadow: 0 0 0 3px var(--mf-warning-50); }
.dot--error { background: var(--mf-error-600); box-shadow: 0 0 0 3px var(--mf-error-50); }
.dot--brand { background: var(--mf-brand-500); box-shadow: 0 0 0 3px var(--mf-brand-50); }

/* ---------- alerty ---------- */
.alert { display: flex; gap: var(--mf-space-3); align-items: flex-start; padding: var(--mf-space-3) var(--mf-space-4); border-radius: var(--mf-radius-md); background: var(--mf-brand-50); color: var(--mf-brand-900); font-size: var(--mf-text-sm); box-shadow: inset 0 0 0 1px rgba(0, 101, 148, .08); }
.alert .icon { margin-top: 1px; }
.alert--success { background: var(--mf-success-50); color: var(--mf-success-700); }
.alert--warning { background: var(--mf-warning-50); color: var(--mf-warning-700); }
.alert--error { background: var(--mf-error-50); color: var(--mf-error-700); }
.alert strong { color: inherit; }

/* ---------- zakładki ---------- */
.tabs { display: flex; gap: var(--mf-space-1); border-bottom: 1px solid var(--mf-border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: var(--mf-space-2); min-height: 44px; padding: 0 var(--mf-space-3); color: var(--mf-text-muted); font: var(--mf-weight-medium) var(--mf-text-ui)/1 var(--mf-font-sans); border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; cursor: pointer; transition: color var(--mf-dur-fast) var(--mf-ease-out), border-color var(--mf-dur-fast) var(--mf-ease-out); }
.tab:hover { color: var(--mf-text-strong); text-decoration: none; }
.tab[aria-selected="true"], .tab[aria-current="page"] { color: var(--mf-text-strong); border-bottom-color: var(--mf-brand-600); }
.tab .chip__count { height: 18px; min-width: 18px; }
.tabpanel[hidden] { display: none; }

/* ---------- lista opisowa ---------- */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: var(--mf-space-2) var(--mf-space-5); margin: 0; font-size: var(--mf-text-sm); }
.dl dt { color: var(--mf-text-muted); }
.dl dd { margin: 0; color: var(--mf-text); min-width: 0; overflow-wrap: anywhere; }

/* ---------- listy w kartach ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list__item { display: flex; align-items: center; gap: var(--mf-space-3); padding: var(--mf-space-3) var(--mf-space-5); border-bottom: 1px solid var(--mf-gray-100); min-height: 56px; color: inherit; }
.list__item:last-child { border-bottom: 0; }
a.list__item { transition: background-color var(--mf-dur-fast) var(--mf-ease-out); }
a.list__item:hover { background: var(--app-hover); text-decoration: none; color: inherit; }
a.list__item:active { background: var(--app-press); }
.list__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list__title { font-weight: var(--mf-weight-medium); color: var(--mf-text-strong); font-size: var(--mf-text-sm); }
.list__sub { font-size: var(--mf-text-caption); color: var(--mf-text-muted); }
.list__aside { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: var(--mf-text-sm); white-space: nowrap; }

/* miniatura produktu */
.thumb { width: 40px; height: 40px; border-radius: 10px; background: var(--mf-surface-sunken); box-shadow: inset 0 0 0 1px var(--app-hairline); display: grid; place-items: center; overflow: hidden; flex: none; color: var(--mf-gray-400); }
.thumb img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.thumb--sm { width: 32px; height: 32px; border-radius: 8px; }
.thumb--lg { width: 96px; height: 96px; border-radius: var(--mf-radius-lg); }
.thumb--xl { width: 100%; height: auto; aspect-ratio: 1; border-radius: var(--mf-radius-lg); }

/* pasek wartości i podział */
.meter { position: relative; height: 6px; border-radius: var(--mf-radius-full); background: var(--mf-gray-100); overflow: hidden; }
.meter__fill { position: absolute; inset: 0 auto 0 0; width: var(--v, 0%); border-radius: inherit; background: var(--mf-brand-500); }
.meter--warning .meter__fill { background: var(--mf-warning-500); }
.meter--error .meter__fill { background: var(--mf-error-600); }
.splitbar { display: flex; gap: 2px; height: 12px; border-radius: var(--mf-radius-full); overflow: hidden; background: var(--mf-gray-100); }
.splitbar__seg { flex: 0 0 var(--v, 0%); min-width: 3px; }
.splitbar__seg--allegro { background: var(--app-ch-allegro); }
.splitbar__seg--presta { background: var(--app-ch-presta); }
.splitbar__seg--pos { background: var(--app-ch-pos); }
.legend { display: flex; flex-direction: column; gap: var(--mf-space-3); list-style: none; margin: 0; padding: 0; }
.legend__item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--mf-space-3); font-size: var(--mf-text-sm); }
.legend__label { display: flex; flex-direction: column; min-width: 0; }
.legend__value { text-align: right; font-weight: var(--mf-weight-semibold); color: var(--mf-text-strong); font-variant-numeric: tabular-nums; }
.legend__value small { display: block; font-weight: var(--mf-weight-regular); color: var(--mf-text-muted); font-size: var(--mf-text-caption); }

/* ---------- oś czasu ---------- */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline__item { position: relative; padding: 0 0 var(--mf-space-5) var(--mf-space-8); font-size: var(--mf-text-sm); }
.timeline__item::before { content: ""; position: absolute; left: 6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--mf-surface); box-shadow: inset 0 0 0 2px var(--mf-brand-500), 0 0 0 4px var(--mf-surface); }
.timeline__item::after { content: ""; position: absolute; left: 10px; top: 22px; bottom: 2px; width: 2px; border-radius: 2px; background: var(--mf-gray-100); }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item:last-child::after { display: none; }
.timeline__item--success::before { box-shadow: inset 0 0 0 2px var(--mf-success-600), 0 0 0 4px var(--mf-surface); }
.timeline__item--warning::before { box-shadow: inset 0 0 0 2px var(--mf-warning-500), 0 0 0 4px var(--mf-surface); }
.timeline__item--error::before { box-shadow: inset 0 0 0 2px var(--mf-error-600), 0 0 0 4px var(--mf-surface); }
.timeline__item--muted::before { box-shadow: inset 0 0 0 2px var(--mf-gray-400), 0 0 0 4px var(--mf-surface); }
.timeline__title { font-weight: var(--mf-weight-medium); color: var(--mf-text-strong); }
.timeline__meta { font-size: var(--mf-text-caption); color: var(--mf-text-muted); margin-top: 2px; }
.timeline__body { margin-top: var(--mf-space-1); color: var(--mf-text); }

/* ---------- pusty stan ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--mf-space-3); padding: var(--mf-space-12) var(--mf-space-6); color: var(--mf-text-muted); }
.empty p { max-width: 44ch; font-size: var(--mf-text-sm); }
.empty__icon { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: linear-gradient(180deg, var(--mf-brand-50), #fff); color: var(--mf-brand-600); box-shadow: inset 0 0 0 1px rgba(0, 101, 148, .1), 0 4px 12px rgba(0, 101, 148, .08); }
.empty__title { color: var(--mf-text-strong); font-weight: var(--mf-weight-semibold); font-size: var(--mf-text-lg); letter-spacing: -0.006em; }
.empty--compact { padding: var(--mf-space-8) var(--mf-space-5); }
.empty--compact .empty__icon { width: 44px; height: 44px; border-radius: 14px; }

/* ---------- paginacja ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: var(--mf-space-3); padding: var(--mf-space-3) var(--mf-space-5); font-size: var(--mf-text-sm); color: var(--mf-text-muted); border-top: 1px solid var(--mf-gray-100); }
.pagination__pages { display: flex; gap: var(--mf-space-1); align-items: center; }

/* ---------- kbd ---------- */
kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; background: var(--mf-gray-50); box-shadow: inset 0 0 0 1px var(--mf-border), 0 1px 0 var(--mf-border); font: var(--mf-weight-medium) 0.72rem/1 var(--mf-font-sans); color: var(--mf-gray-700); }

/* ---------- dialog (natywny <dialog>) ---------- */
.dialog { border: 0; padding: 0; border-radius: var(--mf-radius-xl); box-shadow: var(--mf-shadow-overlay), 0 0 0 1px var(--app-hairline); width: min(560px, calc(100vw - 32px)); background: var(--mf-surface); color: var(--mf-text); overflow: hidden; }
.dialog::backdrop { background: var(--mf-scrim); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.dialog[open] { animation: dialog-in var(--mf-dur-base) var(--mf-ease-out); }
.dialog[open]::backdrop { animation: fade-in var(--mf-dur-base) var(--mf-ease-out); }
.dialog__head { padding: var(--mf-space-6) var(--mf-space-6) var(--mf-space-2); }
.dialog__body { padding: var(--mf-space-2) var(--mf-space-6) var(--mf-space-6); color: var(--mf-text); }
.dialog__foot { display: flex; justify-content: flex-end; gap: var(--mf-space-2); padding: var(--mf-space-4) var(--mf-space-6); background: var(--mf-gray-25); border-top: 1px solid var(--mf-border); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- paleta poleceń (Ctrl+K) ---------- */
.palette { width: min(680px, calc(100vw - 24px)); margin-top: 12vh; background: var(--mf-material-thick); -webkit-backdrop-filter: var(--mf-material-blur-thick); backdrop-filter: var(--mf-material-blur-thick); }
.palette .input-icon .icon { left: 18px; width: 20px; height: 20px; }
.palette .input { border: 0; border-bottom: 1px solid var(--mf-border); border-radius: 0; min-height: 60px; font-size: var(--mf-text-lg); box-shadow: none; padding-left: 52px; padding-right: 48px; background: transparent; }
.palette .input:focus { box-shadow: none; border-color: var(--mf-border); }
.palette__spinner { position: absolute; right: 18px; top: 50%; margin-top: -8px; color: var(--mf-text-muted); }
.palette__results { max-height: min(56vh, 520px); overflow-y: auto; overscroll-behavior: contain; padding: var(--mf-space-2); scroll-padding: var(--mf-space-2); }
.palette__item { display: flex; align-items: center; gap: var(--mf-space-3); min-height: 48px; padding: var(--mf-space-2) var(--mf-space-3); border-radius: var(--mf-radius-md); color: var(--mf-text); scroll-margin: var(--mf-space-2); }
.palette__item > .icon { color: var(--mf-text-muted); }
.palette__item:hover, .palette__item[aria-selected="true"] { background: var(--mf-brand-50); text-decoration: none; color: var(--mf-brand-900); }
.palette__item[aria-selected="true"] > .icon { color: var(--mf-brand-600); }
.palette__item mark { background: transparent; color: var(--mf-brand-700); font-weight: var(--mf-weight-semibold); padding: 0; }
.palette__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.palette__title { font-weight: var(--mf-weight-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette__sub { font-size: var(--mf-text-caption); color: var(--mf-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette__aside { font-size: var(--mf-text-sm); color: var(--mf-text-muted); white-space: nowrap; display: flex; align-items: center; gap: var(--mf-space-2); }
.palette__group { padding: var(--mf-space-3) var(--mf-space-3) var(--mf-space-1); }
.palette__empty { padding: var(--mf-space-8) var(--mf-space-4); text-align: center; color: var(--mf-text-muted); font-size: var(--mf-text-sm); }
.palette__foot { display: flex; gap: var(--mf-space-4); align-items: center; padding: var(--mf-space-2) var(--mf-space-4); border-top: 1px solid var(--mf-border); font-size: var(--mf-text-caption); color: var(--mf-text-muted); background: rgba(248, 250, 252, .7); }
.palette__foot span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- toasty ---------- */
.toasts { position: fixed; right: var(--mf-space-5); bottom: var(--mf-space-5); z-index: var(--mf-z-toast); display: flex; flex-direction: column; gap: var(--mf-space-2); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: var(--mf-space-3); align-items: flex-start; min-width: 280px; max-width: 420px; padding: var(--mf-space-3) var(--mf-space-4); border-radius: 14px; background: rgba(27, 35, 40, .94); -webkit-backdrop-filter: var(--mf-material-blur); backdrop-filter: var(--mf-material-blur); color: #fff; box-shadow: var(--mf-shadow-lg); font-size: var(--mf-text-sm); animation: toast-in var(--mf-dur-spring) var(--mf-ease-spring); }
.toast--success .icon { color: #7fdc9f; }
.toast--error .icon { color: #ff9b9b; }
.toast--warning .icon { color: var(--mf-warning-500); }
.toast--info .icon { color: var(--mf-brand-300); }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity var(--mf-dur-fast) var(--mf-ease-in), transform var(--mf-dur-fast) var(--mf-ease-in); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- szkielet ładowania i wskaźnik htmx ---------- */
.skeleton { border-radius: var(--mf-radius-sm); background: linear-gradient(90deg, var(--mf-gray-100), var(--mf-gray-50), var(--mf-gray-100)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton--text { height: 12px; width: 60%; }
.skeleton--title { height: 20px; width: 40%; }
.skeleton--block { height: 120px; width: 100%; border-radius: var(--mf-radius-md); }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.htmx-indicator { opacity: 0; transition: opacity var(--mf-dur-fast); }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
/* obszar wyników przy przeładowaniu: przygaszony zamiast pustego mignięcia */
.is-loading-zone { transition: opacity var(--mf-dur-fast) var(--mf-ease-out); }
.is-loading-zone.htmx-request, .htmx-request .is-loading-zone { opacity: .55; }
.topbar-progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: var(--mf-z-toast); background: var(--mf-brand-500); transform-origin: left; transform: scaleX(0); opacity: 0; pointer-events: none; }
.htmx-request.topbar-progress, body.htmx-request .topbar-progress { opacity: 1; animation: progress 1.2s var(--mf-ease-out) forwards; }
@keyframes progress { from { transform: scaleX(0); } to { transform: scaleX(.85); } }

/* ---------- wykresy (SVG z serwera) ---------- */
.chart { width: 100%; height: auto; overflow: visible; font: 500 11px/1 var(--mf-font-sans); }
.chart text { fill: var(--app-chart-text); font-variant-numeric: tabular-nums; }
.chart__grid line { stroke: var(--app-chart-grid); stroke-width: 1; }
.chart__grid line.chart__base { stroke: var(--app-chart-axis); }
.chart__bar path { fill: var(--app-chart-bar); transition: fill var(--mf-dur-fast) var(--mf-ease-out); }
.chart__bar--now path { fill: var(--app-chart-bar-now); }
.chart__bar:hover path, .chart__bar.is-active path { fill: var(--mf-brand-700); }
.chart__hit { fill: transparent; }
.chart__bar:hover .chart__hit { fill: rgba(1, 33, 51, .035); }
.chart__avg line { stroke: var(--mf-gray-500); stroke-width: 1; stroke-dasharray: 3 4; }
.chart__avg text { fill: var(--mf-text-muted); font-weight: 600; paint-order: stroke; stroke: var(--mf-surface); stroke-width: 4px; stroke-linejoin: round; }
.chart__line { fill: none; stroke: var(--mf-brand-600); stroke-width: 2; stroke-linejoin: round; }
.chart__area { fill: var(--mf-brand-50); }
.chart__pt { fill: var(--mf-surface); stroke: var(--mf-brand-600); stroke-width: 2; }
.chart__bar:hover .chart__pt { fill: var(--mf-brand-600); }
.chart-wrap { position: relative; }
.chart-tip { position: absolute; z-index: var(--mf-z-dropdown); pointer-events: none; padding: 6px 10px; border-radius: 8px; background: var(--mf-gray-900); color: #fff; font-size: var(--mf-text-caption); font-weight: var(--mf-weight-medium); white-space: nowrap; box-shadow: var(--mf-shadow-md); transform: translate(-50%, calc(-100% - 10px)); opacity: 0; transition: opacity var(--mf-dur-fast) var(--mf-ease-out); }
.chart-tip.is-visible { opacity: 1; }
.chart-data { margin-top: var(--mf-space-3); }
.chart-data > summary { font-size: var(--mf-text-sm); }
.spark { display: block; overflow: visible; }
.spark__line { fill: none; stroke: var(--mf-brand-500); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark__area { fill: var(--mf-brand-50); opacity: .9; }
.spark__dot { fill: var(--mf-brand-600); stroke: var(--mf-surface); stroke-width: 1.5; vector-effect: non-scaling-stroke; }

/* ---------- logowanie ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); background: var(--mf-surface); }
.auth__panel { display: flex; flex-direction: column; justify-content: center; padding: var(--mf-space-12) clamp(1.5rem, 6vw, 6rem); gap: var(--mf-space-8); }
.auth__form { display: flex; flex-direction: column; gap: var(--mf-space-4); max-width: 380px; width: 100%; }
.auth__visual { position: relative; overflow: hidden; background: var(--mf-brand-950); color: #fff; display: flex; flex-direction: column; justify-content: flex-end; padding: var(--mf-space-12); gap: var(--mf-space-3); }
.auth__visual::before { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 80% at 80% 0%, rgba(21, 151, 213, .55), transparent 60%), radial-gradient(80% 60% at 0% 100%, rgba(0, 124, 179, .35), transparent 60%); }
.auth__visual > * { position: relative; }
.auth__visual h2 { color: #fff; font-size: var(--mf-text-h1); line-height: var(--mf-leading-h1); letter-spacing: var(--mf-tracking-h1); max-width: 18ch; }
.auth__visual p { color: var(--mf-brand-100); max-width: 46ch; }
.auth__modules { display: flex; flex-wrap: wrap; gap: var(--mf-space-2); margin-top: var(--mf-space-4); }
.auth__modules span { padding: 6px 12px; border-radius: var(--mf-radius-full); background: rgba(255, 255, 255, .1); color: #fff; font-size: var(--mf-text-sm); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); }

/* ---------- strona błędu ---------- */
.error-page { min-height: 60vh; display: grid; place-items: center; }
.error-page .card { width: min(560px, 100%); }
.error-page__code { font-size: var(--mf-text-caption); font-weight: var(--mf-weight-semibold); letter-spacing: var(--mf-tracking-overline); text-transform: uppercase; color: var(--mf-text-muted); }

/* ---------- widoczność wg szerokości ---------- */
.show-sm, .show-md { display: none !important; }

/* ---------- responsywność ---------- */
@media (max-width: 1360px) { .hide-lg { display: none !important; } }
@media (max-width: 1200px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--aside, .grid--wide { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: var(--mf-z-drawer); transform: translateX(-102%); visibility: hidden; transition: transform var(--mf-dur-slow) var(--mf-ease-out), visibility 0s linear var(--mf-dur-slow); box-shadow: var(--mf-shadow-overlay); background: var(--mf-surface); }
  .app.is-nav-open .sidebar { transform: none; visibility: visible; transition: transform var(--mf-dur-slow) var(--mf-ease-out), visibility 0s; }
  .app.is-nav-open::after { content: ""; position: fixed; inset: 0; background: var(--mf-scrim); z-index: var(--mf-z-overlay); animation: fade-in var(--mf-dur-base) var(--mf-ease-out); }
  .sidebar .sidebar__close { display: inline-flex; position: absolute; top: var(--mf-space-3); right: var(--mf-space-3); }
  .topbar .topbar__menu { display: inline-flex; }
  .grid--3 { grid-template-columns: minmax(0, 1fr); }
  .hide-md { display: none !important; }
  .table th, .table td { padding-left: var(--mf-space-3); padding-right: var(--mf-space-3); }
  .table .cell-sub.truncate, .table td > .truncate { max-width: 180px; }
  .show-md { display: revert !important; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth__visual { display: none; }
}
@media (max-width: 640px) {
  :root { --app-topbar-h: 56px; }
  .grid--2, .grid--4 { grid-template-columns: minmax(0, 1fr); }
  .search-trigger span, .search-trigger kbd { display: none; }
  .search-trigger { flex: 0 0 40px; padding: 0; justify-content: center; }
  .user-chip__name { display: none; }
  .content { padding-top: var(--mf-space-4); gap: var(--mf-space-4); }
  .card__head, .card__body, .list__item, .filterbar, .table-summary, .pagination { padding-left: var(--mf-space-4); padding-right: var(--mf-space-4); }
  .table th:first-child, .table td:first-child { padding-left: var(--mf-space-4); }
  .table th:last-child, .table td:last-child { padding-right: var(--mf-space-4); }
  .hide-sm { display: none !important; }
  .show-sm { display: revert !important; }
  .page-head__actions { width: 100%; }
  .page-head__actions > .btn { flex: 1 1 auto; }
  .toolbar > .field, .toolbar > .segmented { flex: 1 1 100%; min-width: 0; }
  .segmented__item { flex: 1; }
  .segmented__item > span { width: 100%; justify-content: center; padding: 0 var(--mf-space-2); }
  .toasts { left: var(--mf-space-3); right: var(--mf-space-3); bottom: var(--mf-space-3); }
  .toast { min-width: 0; max-width: none; }
  .palette { margin-top: 8px; max-height: calc(100dvh - 16px); }
  /* tabela jako lista kart: <table class="table table--stack">, komórki z data-label */
  .table--stack thead { display: none; }
  .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
  .table--stack tr { padding: var(--mf-space-3) var(--mf-space-4); border-bottom: 1px solid var(--mf-gray-100); }
  .table--stack td { height: auto; padding: 2px 0 !important; border: 0; text-align: left; }
  .table--stack td.num { text-align: left; }
  .table--stack td[data-label]::before { content: attr(data-label) ": "; color: var(--mf-text-muted); font-size: var(--mf-text-caption); }
}
@media (hover: none) { .chart-tip { display: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .btn:active, .nav__link:active, .chip:active, .card--link:active { transform: none; }
}
@media (prefers-reduced-transparency: reduce) { .palette { background: var(--mf-surface); } .toast { background: var(--mf-gray-900); } }
@media (forced-colors: active) { .badge, .tag, .chip, .delta { border: 1px solid CanvasText; } .chart__bar path { fill: CanvasText; } }
@media print { .sidebar, .topbar, .toasts, .topbar-progress { display: none !important; } .app { display: block; } body { background: #fff; } .card { box-shadow: none; border: 1px solid #ccc; } }

/* ---------- kasa w osobnym oknie (app.js: window.name === "mf-kasa") ---------- */
.topbar__pos kbd { margin-left: 2px; }
.is-pos-window .app { grid-template-columns: minmax(0, 1fr); }
.is-pos-window .sidebar, .is-pos-window .search-trigger, .is-pos-window .topbar__menu, .is-pos-window .topbar__pos { display: none !important; }
.is-pos-window .content { padding-top: var(--mf-space-4); }
@media (max-width: 760px) { .topbar__pos span, .topbar__pos kbd { display: none; } }

/* atrybut hidden zawsze ukrywa (także elementy z display z klas, np. .btn) */
[hidden] { display: none !important; }
