/* ============================================================================
   Estify v6 — Dark mode tokens + komponenty
   Source: v0 output (real-estate-crm-dashboard) — adapted to Jinja makra
   Aktualizowane: 2026-05-28
   ============================================================================ */

/* Skala typografii kanon (DESIGN.md) — JEDEN system zamiast 18 ad-hoc rozmiarow px na calym panelu
   (audyt typografii 2026-06-30: 104 hardcode'y px, 0 tokenow = "rozjazd czcionek"). Theme-independent. */
:root {
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-md: 16px;
  --text-lg: 18px;
  --text-xl: 22px;
  --text-2xl: 26px;
  --text-3xl: 36px;
}

:root[data-theme="dark"],
.theme-dark {
  /* Surfaces */
  --v6-bg: #0a0f0d;
  --v6-card: #111916;
  --v6-card-2: #151d19;
  /* hover bg */
  --v6-secondary: #1a2420;
  /* secondary buttons */
  --v6-secondary-h: #243028;
  /* hover */
  --v6-secondary-a: #2a3830;
  /* active */

  /* Borders */
  --v6-border: #2a3d33;
  /* 2026-06-23 audyt: było #1f2e26 = 1,36:1 (FAIL WCAG 1.4.11); teraz ~3:1 — karty/KPI mają krawędź */
  --v6-border-strong: #1a3d28;

  /* Sidebar */
  --v6-sidebar-bg: #0d2818;
  --v6-sidebar-active: #143520;
  --v6-sidebar-h: rgba(20, 53, 32, 0.5);

  /* Ink */
  --v6-text: #ffffff;
  --v6-muted: #8a9a8f;

  /* Brand */
  --v6-green: #00A551;
  --v6-green-h: #00B85E;
  --v6-green-a: #009648;
  --v6-green-15: rgba(0, 165, 81, 0.15);
  --v6-green-30: rgba(0, 165, 81, 0.30);
  --v6-focus: #00B85E;
  /* focus-ring — jasny zielony czytelny na ciemnym tle (≥3:1) */
  --v6-green-text: #00A551;
  /* zielony tekst (np. aktywna zakładka) — OK na ciemnym */

  /* Elewacja powierzchni — biel podnosi na ciemnym tle (w jasnym motywie = czerń) */
  --v6-fill-1: rgba(255, 255, 255, 0.03);
  /* subtelne tło karty/kafla */
  --v6-fill-2: rgba(255, 255, 255, 0.05);
  /* hover / mocniejsze */
  --v6-recess: rgba(0, 0, 0, 0.25);
  /* wklęsła pastylka / nagłówek tabeli */
  --v6-on-green-soft: rgba(255, 255, 255, 0.18);
  /* badge na zielonej pastylce */

  /* Hero gradient */
  --v6-hero-grad: linear-gradient(135deg, #111916 0%, #0d1f14 50%, #111916 100%);
  --v6-hero-glow: radial-gradient(circle, #00A551 0%, transparent 70%);

  /* Sizing */
  --v6-radius-sm: 8px;
  --v6-radius-md: 12px;
  --v6-radius-lg: 16px;
  --v6-radius-pill: 9999px;

  --v6-touch-min: 44px;
  --v6-cta-min: 52px;

  /* ── BRIDGE: tokeny v5 (today.html) na motyw DARK (2026-06-22, migracja na base_v6).
     Statusy = półprzezroczyste tinty (NIE białe bloki) + foregroundy rozjaśnione (EAA dark). ── */
  --paper: var(--v6-card);
  --paper-2: var(--v6-bg);
  --line: #2f4338;
  /* audyt: granica sekcji ~3:1 na ciemnym (było alias 1,36:1) */
  --ink: var(--v6-text);
  --ink-2: #c9d6cf;
  --ink-3: #9aa89f;
  --green-primary: var(--v6-green);
  --green-deep: #00B85E;
  --green-darker: #13352C;
  --green-soft: rgba(0, 165, 81, 0.15);
  --green-border: rgba(0, 165, 81, 0.32);
  /* statusy = derywaty palety księgi (red #FF585F / blue #3B82E5 / yellow #F8E498), rozjaśnione na dark */
  --hot: #FF7E84;
  --hot-bg: rgba(255, 88, 95, 0.20);
  --cool: #5BA8E0;
  --cool-bg: rgba(59, 130, 229, 0.20);
  --warm: #F8E498;
  --warm-bg: rgba(248, 228, 152, 0.18);
  --amber-bg: rgba(248, 228, 152, 0.16);
  --amber-text: #F8E498;
  --side-bg: var(--v6-sidebar-bg);
  --side-text: var(--v6-text);
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-full: 9999px;
  --sh-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --sh-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --sh-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --focus-ring: 0 0 0 3px rgba(0, 184, 94, 0.45);
}

/* ============ MOTYW JASNY (do wyboru przez usera) ============ */
:root[data-theme="light"],
.theme-light {
  --v6-bg: #f4f7f5;
  --v6-card: #ffffff;
  --v6-card-2: #eef3f0;
  /* hover bg */
  --v6-secondary: #e9f0eb;
  --v6-secondary-h: #dde8e0;
  --v6-secondary-a: #d1e0d6;

  --v6-border: #e3ebe6;
  --v6-border-strong: #c5dccd;

  --v6-sidebar-bg: #ffffff;
  --v6-sidebar-active: #e3f1e9;
  --v6-sidebar-h: rgba(0, 165, 81, 0.08);

  --v6-text: #0f1d15;
  --v6-muted: #5d6f63;

  --v6-green: #00A551;
  /* brand — bez zmian w obu motywach */
  --v6-green-h: #00B85E;
  --v6-green-a: #009648;
  --v6-green-15: rgba(0, 165, 81, 0.12);
  --v6-green-30: rgba(0, 165, 81, 0.28);
  --v6-focus: #047a3c;
  /* focus-ring — ciemniejszy zielen, czytelny na JASNYM tle (≥3:1; jasny #00B85E dawał ~2.4) */
  --v6-green-text: #047a3c;
  /* zielony tekst na jasnym tle — ≥4.5:1 (brand #00A551 dawał 3.23) */

  /* Elewacja — na jasnym tle biel jest niewidoczna, więc delikatna czerń */
  --v6-fill-1: rgba(0, 0, 0, 0.025);
  --v6-fill-2: rgba(0, 0, 0, 0.05);
  --v6-recess: rgba(0, 0, 0, 0.05);
  --v6-on-green-soft: rgba(255, 255, 255, 0.30);

  --v6-hero-grad: linear-gradient(135deg, #ffffff 0%, #eef6f1 50%, #ffffff 100%);
  --v6-hero-glow: radial-gradient(circle, rgba(0, 165, 81, 0.12) 0%, transparent 70%);

  --v6-radius-sm: 8px;
  --v6-radius-md: 12px;
  --v6-radius-lg: 16px;
  --v6-radius-pill: 9999px;
  --v6-touch-min: 44px;
  --v6-cta-min: 52px;

  /* ── BRIDGE: tokeny v5 (today.html) na motyw LIGHT = dokładne wartości base.html
     (ciepła biel, EAA-zweryfikowane na bieli; źródło prawdy designu). ── */
  --paper: #ffffff;
  --paper-2: #f6faf7;
  --line: #e0ebe4;
  --ink: #0a1f15;
  --ink-2: #2d3d34;
  --ink-3: #5a6a60;
  --green-primary: #00A551;
  --green-deep: #006634;
  --green-darker: #13352C;
  --green-soft: #E8F9D5;
  --green-border: #C8E6D4;
  /* statusy = derywaty AA palety księgi (red #FF585F→#E03B43 4,6:1 / blue #3B82E5→#2563C9 5,4:1 / yellow #F8E498→#8A5A00 tekst) */
  --hot: #E03B43;
  --hot-bg: rgba(255, 88, 95, 0.12);
  --cool: #2563C9;
  --cool-bg: rgba(59, 130, 229, 0.12);
  --warm: #8A5A00;
  --warm-bg: rgba(248, 228, 152, 0.22);
  --amber-bg: #FDF6DD;
  --amber-text: #8A5A00;
  --side-bg: #13352C;
  --side-text: #E8F9D5;
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-full: 9999px;
  --sh-sm: 0 1px 2px rgba(0, 102, 52, 0.06);
  --sh-md: 0 4px 12px rgba(0, 102, 52, 0.08);
  --sh-lg: 0 12px 32px rgba(0, 102, 52, 0.10);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --focus-ring: 0 0 0 3px rgba(0, 165, 81, 0.35);
}

/* Box-sizing reset — źródło v0/Tailwind zakłada border-box. Bez niego width:100%+padding
   wystaje poza kontener: CTA przycinany przez overflow:hidden hero (kanciasty prawy róg)
   i elementy rozpychane paddingiem. Przywraca pierwotny, premium layout. */
.v6-page,
.v6-page *,
.v6-page *::before,
.v6-page *::after {
  box-sizing: border-box;
}

/* przełącznik motywu — pokaż ikonę aktualnego trybu */
:root[data-theme="dark"] .theme-ico-sun,
:root[data-theme="light"] .theme-ico-moon {
  display: none;
}

/* Stały przełącznik motywu — prawy górny róg, nad treścią */
.v6-theme-toggle {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 70;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--v6-radius-pill);
  background-color: var(--v6-card);
  border: 1px solid var(--v6-border);
  color: var(--v6-text);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  transition: background-color 160ms, border-color 160ms, transform 160ms;
}

.v6-theme-toggle:hover {
  border-color: var(--v6-green-30);
  background-color: var(--v6-card-2);
  transform: translateY(-1px);
}

.v6-theme-toggle:focus-visible {
  outline: 2px solid var(--v6-focus);
  outline-offset: 2px;
}

/* respektuj safe-area na mobile (notch) */
@supports (top: env(safe-area-inset-top)) {
  .v6-theme-toggle {
    top: calc(14px + env(safe-area-inset-top));
  }
}

/* <button> z klasą sidebar-item — reset do wyglądu linku */
button.v6-sidebar__item {
  background: none;
  border: 0;
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

/* ============ LAYOUT ============ */

.v6-page {
  min-height: 100vh;
  background-color: var(--v6-bg);
  color: var(--v6-text);
  font-family: 'Outfit', system-ui, sans-serif;
}

.v6-main {
  padding: 12px;
  /* dolna przestrzeń = bottom-nav (76px) + Adam FAB (bottom:84px) → dolna treść/CTA nie chowa się pod nimi
     (design-review 2026-06-09: FAB nachodził na CTA/ceny). */
  padding-bottom: calc(148px + env(safe-area-inset-bottom));
}

@media (min-width: 768px) {

  /* desktop = sidebar po lewej, bottom-nav ukryty, ale Adam FAB pływa → clearance na dole, by treść go mijała */
  .v6-main {
    padding: 32px 32px 112px;
    margin-left: 240px;
  }
}

.v6-content {
  max-width: 1152px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 768px) {
  .v6-content {
    gap: 32px;
  }
}

/* ============ SIDEBAR (desktop) ============ */

.v6-sidebar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 240px;
  flex-direction: column;
  box-sizing: border-box;
  padding: 20px 14px 28px;
  background-color: var(--v6-sidebar-bg);
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  z-index: 50;
}

.v6-sidebar::-webkit-scrollbar {
  display: none;
}

@media (min-width: 768px) {
  .v6-sidebar {
    display: flex;
  }
}

/* Logo Estify + tagline */
.v6-sidebar__brand-link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0px;
  padding: 0px 8px 8px;
  margin-bottom: 8px;
  text-decoration: none;
}

/* Karta konta / organizacji — pod logo, wejście do Profilu (2026-06-29).
   Wzorzec: avatar (inicjał) + nazwa biura + meta (plan · agenci) + chevron. */
.v6-org-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  margin-bottom: 12px;
  border-radius: var(--v6-radius-md);
  background: var(--v6-secondary);
  border: 1px solid var(--v6-border);
  text-decoration: none;
  min-height: var(--v6-touch-min);
  /* WCAG target-size */
  box-sizing: border-box;
  transition: background 180ms, border-color 180ms;
}

.v6-org-card:hover {
  background: var(--v6-secondary-h);
  border-color: var(--v6-border-strong);
}

.v6-org-card:focus-visible {
  outline: 2px solid var(--v6-green);
  outline-offset: 2px;
}

.v6-org-card--active {
  border-color: var(--v6-green);
  background: var(--v6-secondary-a);
}

.v6-org-card__avatar {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  /* okrągły awatar osoby (ikona człowieka, nie inicjał biura) */
  background: var(--v6-bg);
  border: 1px solid var(--v6-border);
  color: var(--v6-text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.v6-org-card__body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  /* pozwala na ellipsis */
  flex: 1 1 auto;
}

.v6-org-card__name {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--v6-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v6-org-card__meta {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--v6-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v6-org-card__chev {
  flex: 0 0 auto;
  color: var(--v6-muted);
  display: flex;
}

.v6-sidebar__brand-img {
  display: block;
  width: auto;
  height: auto;
  max-height: 56px;
  max-width: 172px;
  object-fit: contain;
  /* Logo brand-logo-horizontal.png — PNG jest dark-on-white.
     Jasny motyw: oryginał bez filtra. Ciemny: invert na biały (reguła niżej). */
}

:root[data-theme="dark"] .v6-sidebar__brand-img,
.theme-dark .v6-sidebar__brand-img {
  filter: brightness(0) invert(1);
}

.v6-sidebar__tagline {
  padding-left: 50px;
  color: var(--v6-text);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
}

.v6-sidebar__nav {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: visible;
}

.v6-sidebar__nav::-webkit-scrollbar {
  display: none;
}

.v6-sidebar__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: var(--v6-radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--v6-muted);
  /* Sidebar desktop-only (pointer) → kompaktowo jak referencja. 34px > 24px (WCAG 2.5.8 AA).
     Mobile (touch) używa v6-mobile-nav z pełnym 44px (--v6-touch-min) — niezmienione. */
  min-height: 34px;
  text-decoration: none;
  transition: all 180ms;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  white-space: nowrap;
}

.v6-sidebar__item:hover {
  color: var(--v6-text);
  background-color: var(--v6-sidebar-h);
}

.v6-sidebar__item--active {
  background-color: var(--v6-sidebar-active);
  color: var(--v6-text);
}

.v6-sidebar__footer {
  margin-top: 8px;
  border-top: 1px solid var(--v6-border-strong);
  padding-top: 14px;
}

.v6-sidebar__item--foot {
  box-sizing: border-box;
}

/* Osobna sekcja menu (np. Akademia) — wydzielona linią od narzędzi operacyjnych */
.v6-sidebar__section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--v6-border-strong);
}

.v6-sidebar__section-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--v6-muted);
  padding: 4px 12px 6px;
}

.v6-sidebar__item-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.v6-sidebar__item-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v6-sidebar__badge {
  margin-left: auto;
  font-size: var(--text-xs);
  padding: 2px 7px;
  border-radius: var(--v6-radius-pill);
  background-color: var(--v6-green);
  color: var(--v6-text);
  font-weight: 700;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.v6-sidebar__badge--live {
  background-color: #dc2626;
  animation: v6-pulse 2s ease-in-out infinite;
}

.v6-sidebar__badge--new {
  background-color: var(--v6-green);
}

/* „wkrótce" / roadmap (np. Analityka Q4) — neutralny, nie krzyczy jak zielony badge */
.v6-sidebar__badge--soon {
  background-color: var(--v6-secondary-a);
  color: var(--v6-muted);
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
}

/* ============ MOBILE BOTTOM NAV ============ */

.v6-mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background-color: var(--v6-sidebar-bg);
  border-top: 1px solid var(--v6-border);
}

@media (min-width: 768px) {
  .v6-mobile-nav {
    display: none;
  }
}

.v6-mobile-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 4px 8px;
}

.v6-mobile-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 44px;
  min-height: 56px;
  padding: 8px 12px;
  border-radius: var(--v6-radius-sm);
  color: var(--v6-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: color 200ms;
}

.v6-mobile-nav__item:active {
  color: var(--v6-text);
}

.v6-mobile-nav__item--active {
  color: var(--v6-green-text);
  font-weight: 700;
}

.v6-mobile-nav__item-icon {
  width: 24px;
  height: 24px;
}

.v6-mobile-nav__item-label {
  font-size: var(--text-xs);
  font-weight: 500;
}

.v6-mobile-nav__safe-area {
  height: env(safe-area-inset-bottom);
  background-color: var(--v6-sidebar-bg);
}

/* ============ HERO CARD ============ */

.v6-hero {
  position: relative;
  border-radius: var(--v6-radius-lg);
  padding: 16px;
  overflow: hidden;
  background: var(--v6-hero-grad);
  border: 1px solid var(--v6-border);
}

@media (min-width: 768px) {
  .v6-hero {
    padding: 28px 32px;
  }
}

.v6-hero__glow {
  position: absolute;
  top: 0;
  right: 0;
  width: 192px;
  height: 192px;
  opacity: 0.18;
  filter: blur(48px);
  pointer-events: none;
  background: var(--v6-hero-glow);
}

@media (min-width: 768px) {
  .v6-hero__glow {
    width: 280px;
    height: 280px;
  }
}

/* GREETING BAR: „Cześć Katarzyno" (lewo) + data (prawo) */
.v6-hero__greet {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  margin-bottom: 14px;
}

@media (min-width: 640px) {
  .v6-hero__greet {
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    /* miejsce dla stałego przełącznika motywu w prawym górnym rogu (40px + odstęp) */
    padding-right: 56px;
  }
}

.v6-hero__greet-text {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--v6-text);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

@media (min-width: 768px) {
  .v6-hero__greet-text {
    font-size: var(--text-2xl);
  }
}

.v6-hero__greet-date {
  font-size: var(--text-sm);
  color: var(--v6-muted);
  text-transform: capitalize;
  font-weight: 500;
}

@media (min-width: 768px) {
  .v6-hero__greet-date {
    font-size: var(--text-base);
  }
}

/* VALUE BAR: zielony pasek „Maja zarobiła Ci dziś X zł" */
.v6-value-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--v6-radius-md);
  background: linear-gradient(90deg, rgba(0, 165, 81, 0.18) 0%, rgba(0, 165, 81, 0.06) 100%);
  border: 1px solid var(--v6-green-30);
  margin-bottom: 18px;
  color: var(--v6-text);
}

.v6-value-bar__icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--v6-radius-sm);
  background-color: var(--v6-green-15);
  color: var(--v6-green);
  flex-shrink: 0;
}

.v6-value-bar__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.v6-value-bar__label {
  font-size: var(--text-sm);
  color: var(--v6-muted);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.v6-value-bar__value {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--v6-text);
  letter-spacing: -0.02em;
  line-height: 1;
}

@media (min-width: 768px) {
  .v6-value-bar__value {
    font-size: var(--text-xl);
  }
}

.v6-value-bar__savings {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: var(--v6-radius-pill);
  background-color: var(--v6-recess);
  color: var(--v6-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .v6-value-bar__savings {
    font-size: var(--text-sm);
  }
}

.v6-hero__inner {
  position: relative;
}

/* MAJA STATUS BADGE (INBOUND-FIRST) */
.v6-hero__badge {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--v6-radius-md);
  background-color: var(--v6-green-15);
  border: 1px solid var(--v6-green-30);
  margin-bottom: 16px;
  color: var(--v6-green);
  font-size: var(--text-sm);
}

@media (min-width: 768px) {
  .v6-hero__badge {
    margin-bottom: 18px;
    font-size: var(--text-base);
    padding: 12px 16px;
  }
}

.v6-hero__badge-label {
  font-weight: 600;
}

.v6-hero__badge-meta {
  margin-left: auto;
  color: var(--v6-muted);
  font-size: var(--text-xs);
  font-weight: 500;
}

@media (min-width: 768px) {
  .v6-hero__badge-meta {
    font-size: var(--text-sm);
  }
}

.v6-hero__pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--v6-green);
  animation: v6-pulse 2s ease-in-out infinite;
}

@keyframes v6-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.v6-hero__title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--v6-text);
  letter-spacing: -0.01em;
  margin-bottom: 14px;
  line-height: 1.25;
}

@media (min-width: 768px) {
  .v6-hero__title {
    font-size: var(--text-xl);
    margin-bottom: 18px;
  }
}

.v6-hero__actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.v6-hero__cta {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--v6-radius-md);
  background: linear-gradient(135deg, var(--v6-green) 0%, var(--v6-green-h) 100%);
  color: #fff;
  /* zielony brand → zawsze biały tekst (oba motywy) */
  font-weight: 600;
  font-size: var(--text-base);
  min-height: 56px;
  width: 100%;
  border: none;
  cursor: pointer;
  text-decoration: none;
  text-align: left;
  box-shadow: 0 10px 24px rgba(0, 165, 81, 0.26);
  transition: box-shadow 200ms, transform 200ms;
  letter-spacing: -0.01em;
}

.v6-hero__cta:hover {
  box-shadow: 0 14px 30px rgba(0, 165, 81, 0.34);
  transform: translateY(-1px);
}

.v6-hero__cta:active {
  transform: translateY(0);
}

/* okrągły chip pod ikoną telefonu — odcina ikonę od tła, dodaje głębi */
.v6-hero__cta-chip {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
}

.v6-hero__cta-label {
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}

/* strzałka dokotwiczona po prawej — czytelna afordancja „przejdź do leada" */
.v6-hero__cta-arrow {
  flex-shrink: 0;
  display: inline-flex;
  opacity: 0.92;
  transition: transform 200ms;
}

.v6-hero__cta:hover .v6-hero__cta-arrow {
  transform: translateX(3px);
}

@media (min-width: 768px) {
  .v6-hero__cta {
    padding: 16px 22px;
    font-size: var(--text-md);
    min-height: 64px;
    gap: 16px;
  }
}

/* TOOLBOX (7-akcji): grid 2 col mobile, 4 col tablet, 7 col desktop */
.v6-hero__toolbox {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (min-width: 640px) {
  .v6-hero__toolbox {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1024px) {
  .v6-hero__toolbox {
    grid-template-columns: repeat(7, 1fr);
  }
}

.v6-hero__tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: var(--v6-radius-sm);
  background-color: var(--v6-fill-1);
  color: var(--v6-text);
  font-weight: 500;
  font-size: var(--text-sm);
  min-height: 64px;
  border: 1px solid var(--v6-border);
  cursor: pointer;
  text-decoration: none;
  transition: all 180ms;
  text-align: center;
}

.v6-hero__tool:hover {
  background-color: var(--v6-secondary-h);
  border-color: var(--v6-green-30);
  color: var(--v6-green);
}

.v6-hero__tool-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--v6-muted);
  transition: color 180ms;
}

.v6-hero__tool:hover .v6-hero__tool-icon {
  color: var(--v6-green);
}

.v6-hero__tool-label {
  line-height: 1.2;
  letter-spacing: 0;
}

/* ============ KPI CARDS ============ */

.v6-kpi-grid {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 8px;
  margin: 0 -12px;
  padding-left: 12px;
  padding-right: 12px;
  scrollbar-width: none;
}

.v6-kpi-grid::-webkit-scrollbar {
  display: none;
}

@media (min-width: 768px) {
  .v6-kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    overflow: visible;
    margin: 0;
    padding: 0;
  }
}

.v6-kpi {
  flex-shrink: 0;
  width: 260px;
  border-radius: var(--v6-radius-md);
  padding: 14px 16px;
  background-color: var(--v6-card);
  border: 1px solid var(--v6-border);
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  min-height: 100px;
  /* równe wysokości na mobile horizontal scroll */
}

@media (min-width: 768px) {
  .v6-kpi {
    width: auto;
    padding: 20px;
    min-height: 120px;
    /* równe wysokości w gridzie */
  }
}

.v6-kpi__label {
  color: var(--v6-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  margin-bottom: 8px;
}

@media (min-width: 768px) {
  .v6-kpi__label {
    font-size: var(--text-base);
    margin-bottom: 12px;
  }
}

.v6-kpi__body {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.v6-kpi__value {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--v6-text);
  letter-spacing: -0.02em;
}

@media (min-width: 768px) {
  .v6-kpi__value {
    font-size: var(--text-2xl);
  }
}

.v6-kpi__sub {
  color: var(--v6-muted);
  font-size: var(--text-sm);
  margin-top: 4px;
}

@media (min-width: 768px) {
  .v6-kpi__sub {
    font-size: var(--text-base);
  }
}

.v6-kpi__trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-sm);
  font-weight: 500;
}

@media (min-width: 768px) {
  .v6-kpi__trend {
    font-size: var(--text-base);
  }
}

.v6-kpi__trend--up {
  color: var(--v6-green);
}

.v6-kpi__trend--down {
  color: #f87171;
}

.v6-kpi__trend--neutral {
  color: var(--v6-muted);
}

/* ============ LEAD CARD (z score ring) ============ */

.v6-leads-section {
  padding-bottom: 96px;
}

@media (min-width: 768px) {
  .v6-leads-section {
    padding-bottom: 0;
  }
}

.v6-leads-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

@media (min-width: 768px) {
  .v6-leads-section__head {
    margin-bottom: 24px;
  }
}

.v6-leads-section__title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--v6-text);
}

@media (min-width: 768px) {
  .v6-leads-section__title {
    font-size: var(--text-lg);
  }
}

.v6-leads-section__more {
  color: var(--v6-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  min-height: var(--v6-touch-min);
  min-width: var(--v6-touch-min);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: color 200ms;
}

.v6-leads-section__more:hover {
  color: var(--v6-text);
}

.v6-leads-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: stretch;
  /* równe wysokości - user feedback 2026-05-28 */
  grid-auto-rows: 1fr;
}

@media (min-width: 768px) {
  .v6-leads-grid {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
}

.v6-lead {
  display: flex;
  flex-direction: column;
  border-radius: var(--v6-radius-md);
  padding: 14px;
  background-color: var(--v6-card);
  border: 1px solid var(--v6-border);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background-color 200ms;
  min-height: 156px;
  /* równe wysokości na mobile */
}

.v6-lead:active,
.v6-lead:hover {
  background-color: var(--v6-card-2);
}

@media (min-width: 768px) {
  .v6-lead {
    padding: 24px;
  }
}

.v6-lead__body {
  display: flex;
  gap: 12px;
}

@media (min-width: 768px) {
  .v6-lead__body {
    gap: 20px;
  }
}

.v6-lead__main {
  flex: 1;
  min-width: 0;
}

.v6-lead__name {
  color: var(--v6-text);
  font-weight: 600;
  font-size: var(--text-base);
  margin-bottom: 4px;
}

@media (min-width: 768px) {
  .v6-lead__name {
    font-size: var(--text-lg);
    margin-bottom: 8px;
  }
}

.v6-lead__quote {
  color: var(--v6-muted);
  font-size: var(--text-sm);
  font-style: italic;
  line-height: 1.5;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (min-width: 768px) {
  .v6-lead__quote {
    font-size: var(--text-base);
    margin-bottom: 16px;
  }
}

.v6-lead__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.v6-lead__budget {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: var(--v6-radius-sm);
  background-color: var(--v6-secondary);
  color: var(--v6-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid var(--v6-border);
}

@media (min-width: 768px) {
  .v6-lead__budget {
    font-size: var(--text-base);
  }
}

.v6-lead__cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--v6-green);
  font-size: var(--text-sm);
  font-weight: 500;
  min-height: var(--v6-touch-min);
  min-width: var(--v6-touch-min);
  justify-content: center;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: gap 200ms;
}

.v6-lead:hover .v6-lead__cta {
  gap: 8px;
}

/* Score ring SVG */
.v6-score-ring {
  position: relative;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
}

.v6-score-ring__svg {
  transform: rotate(-90deg);
}

.v6-score-ring__bg {
  stroke: var(--v6-border);
}

.v6-score-ring__progress {
  stroke: url(#v6ScoreGradient);
  transition: stroke-dasharray 1s ease-out;
}

.v6-score-ring__label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--v6-text);
  font-weight: 600;
  font-size: var(--text-base);
}

/* ============ PIPELINE KANBAN (EST-6) ============ */

.v6-kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.v6-kanban::-webkit-scrollbar {
  height: 6px;
}

.v6-kanban::-webkit-scrollbar-thumb {
  background: var(--v6-border-strong);
  border-radius: 3px;
}

.v6-kanban::-webkit-scrollbar-track {
  background: var(--v6-card);
  border-radius: 3px;
}

.v6-kanban__col {
  background-color: var(--v6-card);
  border: 1px solid var(--v6-border);
  border-radius: var(--v6-radius-md);
  padding: 14px 12px;
  min-height: 460px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.v6-kanban__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--v6-border);
}

.v6-kanban__title {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--v6-muted);
}

.v6-kanban__count {
  font-size: var(--text-xs);
  padding: 2px 8px;
  background-color: var(--v6-green-15);
  color: var(--v6-green);
  border-radius: var(--v6-radius-pill);
  font-weight: 700;
}

.v6-kanban__cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 80px;
  border-radius: var(--v6-radius-sm);
  transition: background-color 160ms, box-shadow 160ms;
}

.v6-kanban__cards.is-drop-target {
  background-color: var(--v6-green-15);
  box-shadow: inset 0 0 0 1px var(--v6-green-30);
}

.v6-kanban__card {
  display: block;
  background-color: var(--v6-fill-1);
  border: 1px solid var(--v6-border);
  border-radius: var(--v6-radius-sm);
  padding: 10px 12px;
  text-decoration: none;
  color: var(--v6-text);
  transition: all 180ms;
  cursor: grab;
  user-select: none;
}

.v6-kanban__card:hover {
  transform: translateY(-1px);
  border-color: var(--v6-green-30);
  background-color: var(--v6-fill-2);
}

.v6-kanban__card:active {
  cursor: grabbing;
}

.v6-kanban__card.is-dragging {
  opacity: 0.48;
  transform: rotate(1deg) scale(0.98);
}

.v6-kanban__card--hot {
  border-left: 3px solid #ef4444;
}

.v6-kanban__card--warm {
  border-left: 3px solid #f59e0b;
}

/* U2 (Panel Feedback): hover NIE gasi lewego koloru tieru — lift wystarczy. */
.v6-kanban__card--hot:hover {
  border-left-color: #ef4444;
}

.v6-kanban__card--warm:hover {
  border-left-color: #f59e0b;
}

.v6-kanban__card--highlight {
  background-color: var(--v6-green-15);
  border-color: var(--v6-green-30);
}

.v6-kanban__card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.v6-kanban__card-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--v6-text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}

.v6-kanban__card-name:hover {
  color: var(--v6-green);
}

.v6-kanban__card-score {
  font-size: var(--text-xs);
  padding: 1px 6px;
  border-radius: var(--v6-radius-pill);
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}

.v6-kanban__card-score--hot {
  background-color: #ef4444;
}

.v6-kanban__card-score--warm {
  background-color: #f59e0b;
}

.v6-kanban__card-meta {
  font-size: var(--text-xs);
  color: var(--v6-muted);
  line-height: 1.35;
  margin-bottom: 6px;
}

.v6-kanban__card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.v6-kanban__card-price {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--v6-green);
  font-variant-numeric: tabular-nums;
}

.v6-kanban__card-type {
  font-size: var(--text-xs);
  padding: 1px 6px;
  border-radius: var(--v6-radius-pill);
  background-color: var(--v6-fill-2);
  color: var(--v6-muted);
  font-weight: 500;
}

.v6-kanban__card-type--sprzedaz {
  color: var(--v6-green);
}

.v6-kanban__card-type--najem {
  color: #60a5fa;
}

.v6-kanban__card-status,
.v6-kanban__card-deadline {
  margin-top: 6px;
  font-size: var(--text-xs);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: var(--v6-radius-pill);
  background-color: var(--v6-recess);
  color: var(--v6-muted);
}

.v6-kanban__card-status--green {
  color: var(--v6-green);
}

.v6-kanban__card-actions {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.v6-kanban__action {
  width: 100%;
  min-width: 0;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--v6-border);
  border-radius: var(--v6-radius-sm);
  background-color: var(--v6-fill-1);
  color: var(--v6-muted);
  cursor: pointer;
  transition: background-color 160ms, border-color 160ms, color 160ms;
}

.v6-kanban__action:hover {
  background-color: var(--v6-sidebar-h);
  border-color: var(--v6-green-30);
  color: var(--v6-text);
}

.v6-kanban__stage-select {
  display: none;
  margin-top: 8px;
  gap: 6px;
  align-items: center;
  color: var(--v6-muted);
  font-size: var(--text-xs);
  font-weight: 600;
}

.v6-kanban__stage-select select {
  flex: 1;
  min-width: 0;
  height: 36px;
  border: 1px solid var(--v6-border);
  border-radius: var(--v6-radius-sm);
  background-color: var(--v6-card-2);
  color: var(--v6-text);
  padding: 0 9px;
  font: inherit;
  color-scheme: dark;
}

.v6-kanban__col--empty .v6-kanban__cards::after {
  content: 'Upusc lead tutaj';
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--v6-border);
  border-radius: var(--v6-radius-sm);
  color: var(--v6-muted);
  font-size: var(--text-sm);
}

.v6-kanban-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  max-width: min(360px, calc(100vw - 32px));
  padding: 11px 14px;
  border: 1px solid var(--v6-green-30);
  border-radius: var(--v6-radius-sm);
  background-color: var(--v6-card);
  color: var(--v6-text);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.32);
  font-size: var(--text-sm);
  font-weight: 600;
}

.v6-kanban-toast[hidden] {
  display: none;
}

@media (max-width: 767px) {
  .v6-kanban {
    grid-auto-columns: minmax(280px, 86vw);
    gap: 10px;
    padding-bottom: 12px;
  }

  .v6-kanban__col {
    min-height: 420px;
    padding: 12px 10px;
  }

  .v6-kanban__card {
    padding: 10px;
  }

  .v6-kanban__card-actions {
    gap: 8px;
  }

  .v6-kanban__action {
    height: 40px;
  }

  .v6-kanban__stage-select {
    display: flex;
  }

  .v6-kanban-toast {
    right: 12px;
    bottom: 84px;
    font-size: var(--text-sm);
  }

  .v6-page-head {
    align-items: stretch;
  }

  .v6-mode-switcher {
    width: 100%;
  }

  .v6-mode-switcher__btn {
    flex: 1;
    text-align: center;
    padding: 8px 7px;
  }
}

/* Pipeline header z mode switcher */
.v6-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.v6-page-head__title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--v6-text);
  letter-spacing: -0.02em;
  margin: 0;
}

@media (min-width: 768px) {
  .v6-page-head__title {
    font-size: var(--text-2xl);
  }
}

.v6-page-head__sub {
  font-size: var(--text-sm);
  color: var(--v6-muted);
  margin-top: 4px;
}

.v6-mode-switcher {
  display: inline-flex;
  gap: 3px;
  background-color: var(--v6-card);
  border: 1px solid var(--v6-border);
  padding: 3px;
  border-radius: var(--v6-radius-sm);
}

.v6-mode-switcher__btn {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: var(--text-sm);
  line-height: 1;
  font-weight: 600;
  color: var(--v6-muted);
  background: transparent;
  border: none;
  border-radius: var(--v6-radius-sm);
  cursor: pointer;
  transition: all 180ms;
  text-decoration: none;
}

.v6-mode-switcher__btn:hover {
  color: var(--v6-text);
}

.v6-mode-switcher__btn--active {
  background-color: var(--v6-secondary);
  color: var(--v6-text);
}

.v6-modal {
  background: var(--v6-card);
  color: var(--v6-text);
  border: 1px solid var(--v6-border);
  border-radius: var(--v6-radius-lg);
  padding: 0;
  max-width: 540px;
  width: 90vw;
  max-height: 90vh;
  overflow: hidden;
}

.v6-modal::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

.v6-modal__form {
  display: flex;
  flex-direction: column;
}

.v6-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--v6-border);
}

.v6-modal__close {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--v6-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--v6-radius-sm);
}

.v6-modal__close:hover {
  color: var(--v6-text);
  background: var(--v6-secondary);
}

.v6-modal__body {
  padding: 16px 20px;
  overflow-y: auto;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.v6-modal__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.v6-modal__field>span {
  font-size: var(--text-sm);
  color: var(--v6-muted);
  font-weight: 500;
}

.v6-modal__field input,
.v6-modal__field select,
.v6-modal__field textarea {
  background: var(--v6-secondary);
  color: var(--v6-text);
  border: 1px solid var(--v6-border);
  border-radius: var(--v6-radius-sm);
  padding: 10px 12px;
  font-size: var(--text-base);
  font-family: inherit;
  color-scheme: dark;
}

.v6-modal__field textarea {
  resize: vertical;
  min-height: 88px;
}

.v6-modal__field input:focus,
.v6-modal__field select:focus,
.v6-modal__field textarea:focus {
  outline: none;
  border-color: var(--v6-green-30);
}

.v6-modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--v6-border);
}

/* ============ LEADY TABLE (EST-6) ============ */

.v6-leads-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

@media (min-width: 768px) {
  .v6-leads-toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.v6-leads-toolbar__search {
  position: relative;
  flex: 1;
  max-width: 100%;
}

@media (min-width: 768px) {
  .v6-leads-toolbar__search {
    max-width: 360px;
  }
}

.v6-leads-toolbar__search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--v6-muted);
  pointer-events: none;
}

.v6-leads-toolbar__input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  background-color: var(--v6-card);
  border: 1px solid var(--v6-border);
  border-radius: var(--v6-radius-sm);
  color: var(--v6-text);
  font-size: var(--text-sm);
  font-family: inherit;
  transition: border-color 180ms;
}

.v6-leads-toolbar__input:focus {
  outline: none;
  border-color: var(--v6-green-30);
}

.v6-leads-toolbar__input::placeholder {
  color: var(--v6-muted);
}

.v6-leads-toolbar__pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.v6-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--v6-radius-pill);
  background-color: var(--v6-card);
  border: 1px solid var(--v6-border);
  color: var(--v6-muted);
  cursor: pointer;
  transition: all 180ms;
}

.v6-pill:hover {
  color: var(--v6-text);
  border-color: var(--v6-green-30);
}

.v6-pill--active {
  background-color: var(--v6-green);
  color: #fff;
  /* zawsze biały na zielonym brandzie (w obu motywach) */
  border-color: var(--v6-green);
}

.v6-pill__count {
  font-size: var(--text-xs);
  padding: 1px 6px;
  background-color: var(--v6-on-green-soft);
  border-radius: var(--v6-radius-pill);
  margin-left: 2px;
}

.v6-leads-table-wrap {
  background-color: var(--v6-card);
  border: 1px solid var(--v6-border);
  border-radius: var(--v6-radius-md);
  overflow: hidden;
  overflow-x: auto;
}

.v6-leads-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 100%;
}

.v6-leads-table th {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--v6-muted);
  text-align: left;
  padding: 12px 14px;
  background-color: var(--v6-recess);
  border-bottom: 1px solid var(--v6-border);
}

.v6-leads-table__th--num {
  text-align: right;
}

.v6-leads-table td {
  padding: 14px;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--v6-border);
  color: var(--v6-text);
}

.v6-leads-table tr:last-child td {
  border-bottom: none;
}

.v6-leads-table__row {
  cursor: pointer;
  transition: background-color 120ms;
}

.v6-leads-table__row:hover {
  background-color: var(--v6-card-2);
}

.v6-leads-table__row.is-hidden {
  display: none;
}

.v6-leads-table__name {
  font-weight: 600;
  color: var(--v6-text);
}

.v6-leads-table__phone {
  font-size: var(--text-xs);
  color: var(--v6-muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.v6-leads-table__num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.v6-leads-table__score {
  display: inline-block;
  padding: 4px 8px;
  border-radius: var(--v6-radius-pill);
  font-weight: 700;
  font-size: var(--text-sm);
  color: #fff;
}

.v6-leads-table__score--hot {
  background-color: #c0392b;
}

.v6-leads-table__score--warm {
  background-color: #f59e0b;
}

.v6-leads-table__score--cool {
  background-color: #60a5fa;
}

/* a11y kontrast (audyt 2026-05-29 D-4): biały na warm/cool nie spełniał WCAG AA
   (warm 2,15:1, cool 2,54:1) → ciemny tekst na jasnych tłach. hot → ciemniejsza
   czerwień (#c0392b) pod biały tekst (≥4,5:1). Dotyczy też kanban score-pills. */
.v6-leads-table__score--warm,
.v6-leads-table__score--cool,
.v6-kanban__card-score--warm {
  color: #1a1206;
}

.v6-leads-table__price {
  color: var(--v6-green);
  font-weight: 600;
}

.v6-leads-table__sub {
  font-size: var(--text-xs);
  color: var(--v6-muted);
}

.v6-source-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  padding: 3px 8px;
  border-radius: var(--v6-radius-pill);
  background-color: var(--v6-fill-2);
  border: 1px solid var(--v6-border);
  color: var(--v6-muted);
  font-weight: 600;
}

.v6-source-pill--maja {
  background-color: var(--v6-green-15);
  color: var(--v6-green);
  border-color: var(--v6-green-30);
}

.v6-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  padding: 3px 8px;
  border-radius: var(--v6-radius-pill);
  background-color: var(--v6-fill-2);
  color: var(--v6-muted);
  font-weight: 500;
}

.v6-status-pill--hot {
  background-color: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.v6-status-pill--warm {
  background-color: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
}

.v6-status-pill--green {
  background-color: var(--v6-green-15);
  color: var(--v6-green);
}

/* Jasny motyw — #fca5a5/#fcd34d są dobrane pod ciemne tło, na jasnym za jasne (WCAG). */
:root[data-theme="light"] .v6-status-pill--hot,
.theme-light .v6-status-pill--hot {
  color: #b91c1c;
}

:root[data-theme="light"] .v6-status-pill--warm,
.theme-light .v6-status-pill--warm {
  color: #8a5a06;
}

/* Mobile — hide kolumny */
@media (max-width: 767px) {

  .v6-leads-table__th--hide-sm,
  .v6-leads-table__hide-sm {
    display: none;
  }
}

@media (max-width: 1023px) {

  .v6-leads-table__th--hide-md,
  .v6-leads-table__hide-md {
    display: none;
  }
}

.v6-leads-table__empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--v6-muted);
}

.v6-leads-table__empty p {
  margin: 8px 0;
  font-size: var(--text-base);
}

/* ============ DRAWER (EST-6 fundament, pełne tabs content w EST-8) ============ */

.v6-drawer-head {
  background: linear-gradient(180deg, var(--v6-card) 0%, var(--v6-card-2) 100%);
  border: 1px solid var(--v6-border);
  border-radius: var(--v6-radius-md);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.v6-drawer-head__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.v6-drawer-head__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--v6-muted);
  padding: 6px 12px;
  background-color: var(--v6-secondary);
  border: 1px solid var(--v6-border);
  border-radius: var(--v6-radius-sm);
  text-decoration: none;
  transition: all 180ms;
}

.v6-drawer-head__back:hover {
  color: var(--v6-text);
  border-color: var(--v6-green-30);
}

.v6-drawer-head__name {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--v6-text);
  letter-spacing: -0.02em;
  margin: 0;
}

.v6-drawer-head__sub {
  font-size: var(--text-sm);
  color: var(--v6-muted);
  margin-top: 4px;
}

.v6-drawer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.v6-drawer-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--v6-radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--v6-border);
  background-color: var(--v6-secondary);
  color: var(--v6-text);
  cursor: pointer;
  transition: all 180ms;
}

.v6-drawer-action:hover {
  border-color: var(--v6-green-30);
  background-color: var(--v6-secondary-h);
}

.v6-drawer-action--primary {
  background-color: var(--v6-green);
  border-color: var(--v6-green);
}

.v6-drawer-action--primary:hover {
  background-color: var(--v6-green-h);
  border-color: var(--v6-green-h);
}

.v6-tabbar {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--v6-border);
  background-color: var(--v6-card);
  border-radius: var(--v6-radius-md) var(--v6-radius-md) 0 0;
  overflow-x: auto;
  position: sticky;
  top: 0;
  z-index: 5;
  scrollbar-width: thin;
}

.v6-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 12px 14px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--v6-muted);
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  transition: all 150ms;
}

.v6-tab:hover {
  color: var(--v6-text);
}

.v6-tab[aria-selected="true"] {
  color: var(--v6-green);
  border-bottom-color: var(--v6-green);
}

.v6-tab__count {
  margin-left: 4px;
  padding: 1px 6px;
  font-size: var(--text-xs);
  border-radius: var(--v6-radius-pill);
  font-weight: 700;
}

.v6-tab__count--green {
  background-color: var(--v6-green-15);
  color: var(--v6-green);
}

.v6-tab__count--warm {
  background-color: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}

.v6-tab__count--hot {
  background-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.v6-panel {
  padding: 20px 24px;
  background-color: var(--v6-card);
  border: 1px solid var(--v6-border);
  border-top: none;
  border-radius: 0 0 var(--v6-radius-md) var(--v6-radius-md);
}

.v6-panel[hidden] {
  display: none;
}

.v6-panel__placeholder {
  padding: 40px 16px;
  text-align: center;
  color: var(--v6-muted);
}

.v6-panel__placeholder h3 {
  color: var(--v6-text);
  font-size: var(--text-md);
  margin: 8px 0;
}

.v6-panel__placeholder p {
  font-size: var(--text-sm);
  margin: 4px 0;
}

.v6-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.v6-timeline__event {
  background-color: var(--v6-fill-1);
  border: 1px solid var(--v6-border);
  border-radius: var(--v6-radius-sm);
  padding: 12px 14px;
}

.v6-timeline__event--maja {
  border-left: 3px solid var(--v6-green);
  background: linear-gradient(90deg, var(--v6-green-15) 0%, rgba(255, 255, 255, 0.02) 25%);
}

.v6-timeline__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.v6-timeline__type {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--v6-text);
}

.v6-timeline__time {
  font-size: var(--text-xs);
  color: var(--v6-muted);
}

.v6-timeline__body {
  font-size: var(--text-sm);
  color: var(--v6-muted);
  line-height: 1.5;
}

/* ============ ADAM — „Zapytaj Adama" FAB + panel czatu (light) ============
   Floating bottom-right na każdym widoku. Klik otwiera LEKKI (light theme,
   niezależny od dark/light motywu panelu) panel czatu: composer z kontekstem,
   paskiem narzędzi i wysyłką do pełnego czatu Adama (/v5/chat_v6 z ?q=).
   Komponent: templates/components/_v6_adam_fab.html.
   Paleta hardkodowana (light) — NIE używa tokenów --v6-* (zmieniają się z motywem). */
.v6-adam-ask {
  --ada-panel: #ffffff;
  --ada-panel-2: #f3faf6;
  --ada-line: #d8ebe0;
  --ada-line-2: #e7f2ec;
  --ada-green: #00a551;
  /* brand */
  --ada-green-d: #00863f;
  --ada-green-s: #e6f6ee;
  --ada-ink: #143028;
  --ada-ink-2: #557067;
  --ada-muted: #8aa79a;
  position: fixed;
  bottom: 84px;
  /* nad mobile bottom-nav */
  right: 16px;
  z-index: 60;
}

@media (min-width: 768px) {
  .v6-adam-ask {
    bottom: 32px;
    right: 32px;
  }
}

/* ── Przycisk „Zapytaj Adama" — kompaktowy (44px / 14px font) ── */
.v6-adam-ask__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  white-space: nowrap;
  border: none;
  border-radius: 11px;
  background: var(--ada-green);
  color: #ffffff;
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: .1px;
  cursor: pointer;
  box-shadow: 0 8px 20px -6px rgba(0, 165, 81, 0.5);
  transition: background .15s ease, transform .12s ease;
}

.v6-adam-ask__btn:hover {
  background: var(--ada-green-d);
  transform: translateY(-1px);
}

.v6-adam-ask__btn:active {
  transform: scale(.98);
}

.v6-adam-ask__btn-icon {
  display: inline-flex;
}

.v6-adam-ask__btn-icon svg {
  width: 18px;
  height: 18px;
}

.v6-adam-ask.is-open .v6-adam-ask__btn {
  display: none;
}

/* panel otwarty → chowamy przycisk */

/* ── Panel czatu (light) ── */
.ada-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(400px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 110px));
  display: flex;
  flex-direction: column;
  background: var(--ada-panel);
  border: 1px solid var(--ada-line);
  border-radius: 18px;
  box-shadow: 0 24px 60px -18px rgba(20, 60, 42, 0.30), 0 6px 18px -10px rgba(20, 60, 42, 0.16);
  overflow: hidden;
  font-family: inherit;
  color: var(--ada-ink);
}

.ada-head,
.ada-context,
.ada-body,
.ada-tools {
  flex: none;
}

/* Logo w nagłówku (zamiast kropki statusu) */
.ada-logo {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  flex: none;
  object-fit: cover;
}

/* Wątek rozmowy (inline) */
.ada-thread {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(46vh, 360px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 14px 4px;
  border-top: 1px solid var(--ada-line-2);
}

.ada-thread[hidden] {
  display: none;
}

.ada-msg {
  display: flex;
  flex-direction: column;
  max-width: 100%;
}

.ada-msg--user {
  align-items: flex-end;
}

.ada-msg--ai,
.ada-msg--err {
  align-items: flex-start;
}

.ada-bubble {
  font-size: var(--text-base);
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ada-msg--user .ada-bubble {
  background: var(--ada-green-s);
  color: var(--ada-ink);
  padding: 9px 13px;
  border-radius: 14px 14px 4px 14px;
  max-width: 85%;
}

.ada-msg--ai .ada-bubble {
  color: var(--ada-ink);
}

.ada-msg--err .ada-bubble {
  background: #fff1f0;
  color: #b42318;
  border: 1px solid #ffd7d2;
  padding: 9px 13px;
  border-radius: 12px;
  max-width: 92%;
}

.ada-msg__actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.ada-act {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--ada-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}

.ada-act:hover {
  background: var(--ada-panel-2);
  color: var(--ada-ink-2);
}

.ada-act.is-done {
  color: var(--ada-green);
}

/* Potwierdzanie akcji Adama (pending_confirm → /api/chat/confirm) w dymku FAB */
.ada-confirm {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.ada-confirm button {
  min-height: 44px;
  padding: 9px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
}

.ada-confirm__ok {
  background: var(--ada-green);
  border: 1px solid var(--ada-green);
  color: #fff;
}

.ada-confirm__ok:hover {
  transform: translateY(-1px);
}

.ada-confirm__cancel {
  background: transparent;
  border: 1px solid var(--ada-green-s);
  color: var(--ada-ink);
}

.ada-confirm button:focus-visible {
  outline: 2px solid var(--ada-green);
  outline-offset: 2px;
}

.ada-confirm button:disabled {
  opacity: .55;
  cursor: default;
}

/* Wskaźnik pisania */
.ada-typing {
  display: inline-flex;
  gap: 4px;
  padding: 6px 2px;
}

.ada-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ada-muted);
  animation: ada-typing 1.2s infinite;
}

.ada-typing span:nth-child(2) {
  animation-delay: .15s;
}

.ada-typing span:nth-child(3) {
  animation-delay: .3s;
}

@keyframes ada-typing {

  0%,
  60%,
  100% {
    opacity: .3;
    transform: translateY(0);
  }

  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.ada-panel[hidden] {
  display: none;
}

.v6-adam-ask.is-open .ada-panel {
  animation: ada-pop .2s cubic-bezier(.2, .8, .2, 1);
}

@keyframes ada-pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.97);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* Nagłówek */
.ada-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--ada-line-2);
}

.ada-status {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  background: var(--ada-green);
  box-shadow: 0 0 0 4px var(--ada-green-s);
}

.ada-title {
  font-weight: 600;
  font-size: var(--text-base);
  letter-spacing: -.01em;
}

.ada-x {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: transparent;
  border: none;
  color: var(--ada-ink-2);
  cursor: pointer;
  transition: background .15s, color .15s;
}

.ada-x:hover {
  background: var(--ada-panel-2);
  color: var(--ada-ink);
}

.ada-x svg {
  width: 16px;
  height: 16px;
}

/* Kontekst — pigułki z ikonami */
.ada-context {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ada-line-2);
  background: var(--ada-panel-2);
  overflow-x: auto;
}

.ada-context::-webkit-scrollbar {
  height: 0;
}

.ada-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: var(--text-sm);
  color: var(--ada-ink-2);
  background: #fff;
  border: 1px solid var(--ada-line);
  white-space: nowrap;
}

.ada-chip svg {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--ada-green);
}

.ada-chip__lbl {
  color: var(--ada-muted);
  font-weight: 500;
}

.ada-chip__val {
  color: var(--ada-ink);
  font-weight: 600;
}

.ada-chip--cat {
  background: var(--ada-green-s);
  border-color: transparent;
  color: var(--ada-green-d);
  font-weight: 700;
}

/* Pole tekstowe */
.ada-body {
  padding: 16px 16px 6px;
}

.ada-field {
  width: 100%;
  border: none;
  resize: none;
  outline: none;
  background: transparent;
  color: var(--ada-ink);
  font-family: inherit;
  font-size: var(--text-base);
  line-height: 1.5;
  min-height: 64px;
  max-height: 200px;
}

.ada-field::placeholder {
  color: var(--ada-muted);
}

/* Bez zielonego focus-ringu na polu (życzenie Janusza). Wyższa specyficzność niż
   globalny `.v6-page textarea:focus-visible` → scope pod .v6-adam-ask. */
.v6-adam-ask .ada-field:focus,
.v6-adam-ask .ada-field:focus-visible {
  outline: none;
  box-shadow: none;
}

/* Pasek narzędzi */
.ada-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 14px;
}

.ada-tool {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: transparent;
  border: none;
  color: var(--ada-ink-2);
  cursor: pointer;
  transition: background .15s, color .15s;
}

.ada-tool:hover {
  background: var(--ada-panel-2);
  color: var(--ada-green);
}

.ada-tool.is-active {
  background: var(--ada-green);
  color: #fff;
}

.ada-tool svg {
  width: 18px;
  height: 18px;
}

.ada-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.ada-bar {
  flex: 1;
  height: 5px;
  border-radius: 99px;
  background: var(--ada-line);
  overflow: hidden;
}

.ada-bar>i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ada-green);
  border-radius: 99px;
  transition: width .15s ease;
}

.ada-counter {
  font-size: var(--text-sm);
  color: var(--ada-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ada-counter.is-warn {
  color: #c2410c;
}

.ada-model {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--ada-line);
  color: var(--ada-ink);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s;
}

.ada-model:hover {
  border-color: var(--ada-green);
}

.ada-model__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ada-green);
}

.ada-model svg {
  width: 13px;
  height: 13px;
  color: var(--ada-ink-2);
}

.ada-send {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex: none;
  background: #fff;
  color: var(--ada-ink-2);
  border: 1px solid var(--ada-line);
  cursor: pointer;
  transition: transform .12s, background .15s, color .15s, border-color .15s;
}

.ada-send:not(:disabled):hover {
  background: var(--ada-green);
  color: #fff;
  border-color: var(--ada-green);
}

.ada-send:active {
  transform: scale(.92);
}

.ada-send:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.ada-send svg {
  width: 17px;
  height: 17px;
}

@media (max-width: 480px) {
  .ada-panel {
    width: calc(100vw - 32px);
  }
}

@media (prefers-reduced-motion: reduce) {

  .v6-adam-ask__btn,
  .ada-tool,
  .ada-send,
  .ada-x,
  .ada-bar>i {
    transition: none;
  }

  .v6-adam-ask.is-open .ada-panel {
    animation: none;
  }
}

/* ============ KPI alignment (user feedback 2026-05-28, 2nd iter) ============ */
/* Layout:
     label u góry
     value (big) na własnej linii lewa
     foot row: sub LEWA + trend PRAWA na tym samym poziomie ("RÓWNO z tym")
*/
.v6-kpi__value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--v6-text);
  letter-spacing: -0.02em;
  margin: 6px 0 12px 0;
  line-height: 1;
}

@media (min-width: 768px) {
  .v6-kpi__value {
    font-size: var(--text-3xl);
  }
}

.v6-kpi__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  /* pcha do dołu kafelka jeśli wysokości równe */
}

.v6-kpi__foot .v6-kpi__sub {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--v6-muted);
}

.v6-kpi__foot .v6-kpi__trend {
  flex-shrink: 0;
  font-size: var(--text-sm);
  font-weight: 600;
}

/* ── a11y (audyt 2026-05-29) ─────────────────────────────────────────────── */
/* Focus-visible: w całym v6 brakowało wskaźnika fokusu klawiatury (niewidoczny na
   dark). Jeden ring dla wszystkich interaktywnych elementów. NIE rusza :hover/mysz. */
.v6-page a:focus-visible,
.v6-page button:focus-visible,
.v6-page [role="tab"]:focus-visible,
.v6-page input:focus-visible,
.v6-page select:focus-visible,
.v6-page textarea:focus-visible,
.v6-page [tabindex]:focus-visible {
  outline: 2px solid var(--v6-focus);
  outline-offset: 2px;
  border-radius: var(--v6-radius-sm);
}

/* layout-wrapper (skip-link target, tabindex=-1) NIE rysuje focus-ringu wokół całego canvasu
   — wyglądało jak debug/prototyp (feedback 2026-06-23). Skok widoku = wystarczające wskazanie. */
.v6-main:focus,
.v6-main:focus-visible {
  outline: none;
}

/* Skip-to-content (WCAG 2.4.1) — ukryty do fokusa; stały ciemny chip = wysoki kontrast w obu motywach */
.v6-skip-link {
  position: fixed;
  left: 12px;
  top: -56px;
  z-index: 200;
  padding: 10px 16px;
  background: #0d2818;
  color: #fff;
  border-radius: var(--v6-radius-sm);
  font-weight: 700;
  text-decoration: none;
  transition: top 0.15s ease;
}

.v6-skip-link:focus {
  top: 12px;
  outline: 2px solid var(--v6-focus);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .v6-skip-link {
    transition: none;
  }
}

/* ── Command palette ⌘K (v6-cmdk.js) ───────────────────────────────────────── */
.v6-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.v6-cmdk-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  background: rgba(0, 0, 0, 0.5);
  padding: 12vh 16px 16px;
  justify-content: center;
  align-items: flex-start;
}

.v6-cmdk-overlay.is-open {
  display: flex;
}

.v6-cmdk {
  width: 100%;
  max-width: 560px;
  background: var(--v6-card);
  color: var(--v6-text);
  border: 1px solid var(--v6-border-strong);
  border-radius: var(--v6-radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}

.v6-cmdk__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--v6-border);
  color: var(--v6-muted);
}

.v6-cmdk__input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--v6-text);
  font-size: var(--text-base);
  outline: none;
}

.v6-cmdk__input::placeholder {
  color: var(--v6-muted);
}

.v6-cmdk__kbd {
  font-size: var(--text-xs);
  padding: 2px 6px;
  border: 1px solid var(--v6-border-strong);
  border-radius: 4px;
  color: var(--v6-muted);
  background: var(--v6-secondary);
}

.v6-cmdk__results {
  overflow-y: auto;
  padding: 6px;
}

.v6-cmdk__group {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--v6-muted);
  padding: 10px 10px 4px;
}

.v6-cmdk__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: var(--v6-radius-sm);
  cursor: pointer;
  min-height: 44px;
  box-sizing: border-box;
}

.v6-cmdk__item[aria-selected="true"],
.v6-cmdk__item:hover {
  background: var(--v6-secondary);
}

.v6-cmdk__badge {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  color: #fff;
}

.v6-cmdk__badge--hot {
  background: #E03B43;
}

/* derywat AA księgowego #FF585F (białe na nim ≈4,6:1) */
.v6-cmdk__badge--warm {
  background: #8A5A00;
}

/* derywat księgowego yellow #F8E498 (białe ≈4,8:1) */
.v6-cmdk__badge--cool {
  background: #2563C9;
}

/* derywat księgowego blue #3B82E5 */
.v6-cmdk__txt {
  flex: 1;
  min-width: 0;
}

.v6-cmdk__title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--v6-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v6-cmdk__sub {
  font-size: var(--text-sm);
  color: var(--v6-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v6-cmdk__foot {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-top: 1px solid var(--v6-border);
  font-size: var(--text-sm);
  color: var(--v6-muted);
}

.v6-cmdk__brand {
  margin-left: auto;
  color: var(--v6-green-text);
  font-weight: 600;
}

.v6-cmdk__empty {
  padding: 24px;
  text-align: center;
  color: var(--v6-muted);
  font-size: var(--text-sm);
}

/* Reduced-motion: reset tokens.css scopuje tylko .ops; strony v6 to .v6-page →
   animacje (v6-pulse, transitions) grały zawsze. Szanuj systemowe „Reduce Motion". */
@media (prefers-reduced-motion: reduce) {

  .v6-page *,
  .v6-page *::before,
  .v6-page *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}