* { box-sizing: border-box; }

/* Atrybut hidden z UA-stylesheet ma display:none o zerowej specyficzności, więc każda nasza reguła
   z display (np. .field{display:flex}) go unieważnia. To ukrywało pola tylko-CV w edytorze LISTU. */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }

/* Nagłówek dostarcza wspólny komponent (data-platform-header / platform-header.css).
   Wrapper .cv-platform-header ustawia tylko margines; stary, własny nagłówek usunięto. */
.cv-platform-header {
  margin: 18px auto 20px;
}

.app-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 30px 42px;
}

.dashboard-view,
.editor-view {
  min-width: 0;
}

.dashboard-summary {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 28px 0 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.dashboard-summary h1,
.editor-heading h1 {
  margin: 0;
}
.dashboard-summary h1 {
  font-size: var(--text-xl, 1.375rem);
  letter-spacing: -0.01em;
}
.dashboard-lede {
  margin: 6px 0 0;
  max-width: 52ch;
  color: var(--muted);
  font-size: var(--text-base, 0.875rem);
}

.dashboard-metrics {
  display: flex;
  gap: 20px;
  color: var(--muted);
  font-size: var(--text-sm, 0.8125rem);
  white-space: nowrap;
}

/* > span (dzieci, nie potomkowie): wewnątrz metryk siedzą teraz spany-owijki i18n
   (data-i18n na słowie) — selektor potomny nadawałby im flex/min-width na mobile. */
.dashboard-metrics > span {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.dashboard-metrics > span + span {
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.dashboard-metrics strong {
  /* Bierna statystyka — dominuje rozmiarem, nie kolorem CTA. */
  color: var(--text);
  font-size: var(--text-lg, 1.125rem);
  font-weight: 600;
}

.document-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  border-bottom: 1px solid var(--line);
}

.document-tabs {
  display: flex;
  gap: 26px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.document-tabs::-webkit-scrollbar {
  display: none;
}

.preview-tab {
  position: relative;
  min-height: 48px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--text-md, 1rem);
  white-space: nowrap;
  transition: color 0.15s ease;
}

.preview-tab.active {
  color: var(--text);
}

.preview-tab.active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--brand);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
}

/* Dzielnik PIONOWY toolbara — receptura shared (.platform-divider…) jest dla
   POZIOMYCH hairline'ów (height 1px, margin 8px 0) i robiła z niego punkt 1×1;
   lokalne wymiary wygrywają remis specyficzności (arkusz app po shared). */
.toolbar-divider {
  width: 1px;
  height: 28px;
  margin: 0 4px;
  background: var(--line);
}

/* Bazę .btn (metryka, kolory, warianty primary/outline/ghost/danger + dracula ink)
   dostarcza shared/platform-header.css (kanon + sekcja KIT) — tu tylko dopełnienie.
   Dawne lokalne .btn-muted/.btn-danger zastąpione w markupie przez
   .platform-button--outline/--danger. */
.btn {
  white-space: nowrap;
}

/* Przełącznik Kafelki|Lista: tor i stan aktywny dostarcza kit .platform-seg. */

.document-manager {
  padding: 22px 0 28px;
}

.document-collection.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(292px, 1fr));
  gap: 22px;
}

.doc-card {
  display: grid;
  gap: var(--space-3, 12px);
  min-height: 300px;
  padding: var(--space-4, 16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.doc-card:hover {
  border-color: color-mix(in srgb, var(--brand) 30%, var(--border));
  box-shadow: var(--shadow-lg);
}

/* Pasek kompletności w karcie */
.doc-progress {
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--panel-soft);
  overflow: hidden;
}
.doc-progress > span {
  display: block;
  height: 100%;
  /* Metadana, nie druga belka akcentu pod akcentową miniaturą. */
  background: color-mix(in srgb, var(--brand) 78%, var(--surface));
}

/* Kafel afordancji "Nowy dokument" — wypełnia siatkę, otwiera edytor */
.doc-card--new {
  appearance: none;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 300px;
  padding: 16px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  /* Afordancja = najcichszy element siatki: bez wypełnienia (hover przywraca
     pełne tło), przerywana ramka wystarcza. */
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.doc-card--new .plus {
  font-size: var(--text-2xl, 1.75rem);
  line-height: 1;
  color: var(--brand);
}
.doc-card--new strong {
  color: var(--text);
  font-size: var(--text-md, 1rem);
}
.doc-card--new small {
  font-size: var(--text-xs, 0.75rem);
}
.doc-card--new:hover {
  border-color: var(--brand);
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
}

/* Wiersz "Nowy" w widoku listy */
.doc-list-new {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  margin-top: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--text-base, 0.875rem);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
/* Glass: wiersz leży wprost na aurorze (żaden panel go nie ratuje), a --line
   to biel 0.1 — bez tych wartości afordancja znikała. Kafel kartowy dostaje
   z powrotem transparent + własny hover, bo shared glass-override .doc-card
   (późniejszy w kaskadzie) klobrował i cichy spoczynek, i hover. */
:root[data-theme="glass"] .doc-list-new {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.26);
}
:root[data-theme="glass"] .doc-card.doc-card--new {
  background: rgba(255, 255, 255, 0.07);
  border: 1px dashed rgba(255, 255, 255, 0.3);
  box-shadow: none;
}
:root[data-theme="glass"] .doc-card.doc-card--new:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--brand);
}
.doc-list-new .plus {
  color: var(--brand);
  font-size: var(--text-lg, 1.125rem);
  line-height: 1;
}
.doc-list-new:hover {
  border-color: var(--brand);
  background: var(--surface);
  color: var(--text);
}

.doc-card-head,
.doc-actions,
.doc-action,
.doc-list-row,
.doc-list-main {
  display: flex;
  align-items: center;
}

.doc-card-head {
  justify-content: space-between;
  gap: 12px;
}

.doc-title {
  min-width: 0;
}

.doc-title strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-md, 1rem);
}

.doc-title small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: var(--text-xs, 0.75rem);
}

/* „Zmień" w języku akcji drugorzędnych karty (muted → brand na hover),
   nie szóstka akcentowych pseudo-przycisków konkurujących z CTA. */
.doc-edit {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: var(--text-sm, 0.8125rem);
  cursor: pointer;
  transition: color 0.15s ease;
}
.doc-edit:hover,
.doc-edit:focus-visible {
  color: var(--brand);
}

.doc-preview {
  position: relative;
  min-height: 160px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.doc-preview::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 62px;
  background: linear-gradient(180deg, var(--brand), color-mix(in srgb, var(--brand) 14%, var(--panel)));
}

.doc-preview::after {
  content: "";
  position: absolute;
  top: 34px;
  right: 22px;
  left: 86px;
  height: 94px;
  background:
    linear-gradient(color-mix(in srgb, var(--brand) 65%, transparent) 0 0) 0 0 / 45% 7px no-repeat,
    linear-gradient(var(--line) 0 0) 0 24px / 88% 5px no-repeat,
    linear-gradient(var(--line) 0 0) 0 42px / 74% 5px no-repeat,
    linear-gradient(var(--line) 0 0) 0 60px / 92% 5px no-repeat,
    linear-gradient(var(--line) 0 0) 0 78px / 62% 5px no-repeat;
}

.doc-preview.letter::before {
  width: 100%;
  height: 44px;
  background: color-mix(in srgb, var(--text) 72%, var(--panel));
}

.doc-preview.letter::after {
  top: 72px;
  left: 26px;
}

.doc-card-meta {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm, 0.8125rem);
  line-height: 1.4;
}

.doc-actions {
  justify-content: flex-start;
  gap: 14px;
  margin-top: auto;
  padding-top: var(--space-3, 12px);
  border-top: 1px solid var(--line);
}

.doc-action {
  flex-direction: row;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--text-xs, 0.75rem);
  transition: color 0.15s ease;
}
.doc-action:hover {
  color: var(--brand);
}

.doc-action span {
  font-size: var(--text-md, 1rem);
  line-height: 1;
}

.document-collection.list {
  display: grid;
  gap: 0;
}

.document-collection.list .doc-card {
  min-height: 0;
  display: none;
}

.doc-list-row {
  justify-content: space-between;
  gap: 16px;
  min-height: 82px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
}

.doc-list-main {
  min-width: 0;
  gap: 18px;
}

.doc-thumb {
  width: 54px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--brand) 0 18%, var(--surface) 18%);
}

.doc-list-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.editor-topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.editor-heading {
  min-width: 0;
}

.editor-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.workspace {
  display: grid;
  grid-template-columns: 200px minmax(340px, 0.85fr) minmax(430px, 1fr);
  gap: 20px;
  padding-top: var(--space-5, 24px);
  min-width: 0;
}

.panel,
.document {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.editor-nav {
  position: sticky;
  top: 18px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: none;
}

.editor-panel {
  align-self: start;
  padding: 20px;
}

.panel-header,
.section-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3, 12px);
  margin-bottom: var(--space-4, 16px);
}
.panel-header {
  padding-bottom: var(--space-4, 16px);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--brand);
  font-size: var(--text-xs, 0.75rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
/* letter-spacing h1 dostarcza shared (h1,h2 = -0.02em) — lokalne 0 było maskowane
   przed flipem kolejności arkuszy, więc go nie przywracamy (remis wygrywa teraz app). */
h1 { margin-bottom: 0; font-size: var(--text-xl, 1.375rem); }
h2 { margin-bottom: 0; font-size: var(--text-lg, 1.125rem); }

/* Ocenę (pigułka z liczbą) dostarcza kit .platform-metric-pill;
   paski kategorii — kit .platform-meter (markup w app.js). */

.tab {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--text-sm, 0.8125rem);
  padding: 8px 12px;
  white-space: nowrap;
}

.editor-nav .tab {
  justify-content: flex-start;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: var(--text-base, 0.875rem);
  font-weight: 500;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}
.editor-nav .tab:hover {
  background: var(--panel-soft);
  color: var(--text);
}

.editor-nav .tab.active {
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 600;
  /* Akcentowy pasek po lewej — wyraźny stan bieżącego kroku (stepper, nie zwykła lista). */
  box-shadow: inset 3px 0 0 var(--brand);
}

.editor-nav .tab[hidden] {
  display: none;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: var(--text-xs, 0.75rem);
  /* font-weight (bold) dostarcza shared — lokalne 600 było maskowane przed flipem. */
}
.editor-nav .tab.active .nav-icon {
  background: var(--surface);
  color: var(--brand-strong);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3, 12px);
}

/* Etykiety zdaniowe (nie WERSALIKI) — spokojniejsze, czytelniejsze, bardziej „SaaS" (Notion/Linear). */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: var(--space-3, 12px);
  color: color-mix(in srgb, var(--text) 62%, var(--muted));
  font-size: var(--text-sm, 0.8125rem);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

/* Metryka pól wyrównana do kanonu .platform-field (shared): min-height 38px,
   padding 8px 12px, line-height 1.4. Pól jest dużo i markup jest generowany —
   wyrównanie w CSS zamiast klasy platform-field na każdym elemencie. */
input,
textarea,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--field);
  color: var(--text);
  font-size: var(--text-base, 0.875rem);
  letter-spacing: 0;
  line-height: 1.4;
  outline: none;
  padding: 8px 12px;
  text-transform: none;
}

/* Checkboxy (mini-toggle, checkbox-row, panel wyglądu) nie podlegają metryce pola tekstowego. */
input[type="checkbox"] { min-height: 0; }

textarea { resize: vertical; }
/* Martwe select{appearance:auto} usunięte — chevron selectów dostarcza shared. */

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); /* kanon .platform-field */
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  color: var(--text);
  font-size: var(--text-base, 0.875rem);
}

.checkbox-row input { width: 18px; height: 18px; accent-color: var(--brand); }

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3, 12px);
}

.entry {
  position: relative;                 /* pod ::before/::after wskaźnika drop (funkcja #2) */
  padding: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.entry-title {
  color: var(--text);
  font-size: var(--text-base, 0.875rem);
}

/* ── Drag-drop reorder (funkcja #2): uchwyt + wskaźniki miejsca upuszczenia ── */
.entry-head-left,
.order-row-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.entry-head-left .entry-title,
.order-row-left span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Zwijanie wpisu — nagłówek jest przyciskiem, ↑/↓/Usuń zostają POZA nim (zagnieżdżone
   kontrolki łamałyby klikalność i dostępność). */
.entry-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.entry-caret { flex: 0 0 auto; color: var(--muted); font-size: var(--text-2xs, 0.6875rem); }
.entry-toggle:hover .entry-title { color: var(--brand-strong, var(--text)); }
.entry-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.entry-body[hidden] { display: none; }

.entry-grip {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 30px; padding: 0;
  border: 0; background: transparent;
  color: var(--muted);
  font-size: var(--text-md, 1rem); line-height: 1;
  border-radius: 6px;
  cursor: grab;
  touch-action: manipulation;         /* na dotyku uchwyt bezczynny — tam działają ↑/↓ */
}
/* Hover MUSI odróżniać się od tła .entry (które też jest --panel-soft) — stąd tint akcentu. */
.entry-grip:hover { color: var(--brand-strong, var(--text)); background: color-mix(in srgb, var(--brand) 16%, transparent); }
.entry-grip:active { cursor: grabbing; }
.entry-grip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Na urządzeniach bez precyzyjnego wskaźnika HTML5 drag-and-drop NIE działa — nie pokazuj
   uchwytu, bo to fałszywa afordancja. Reorder na dotyku odbywa się przyciskami ↑/↓. */
@media (hover: none) and (pointer: coarse) {
  .entry-grip { display: none; }
  /* Skoro ↑/↓ to jedyny reorder na dotyku, muszą mieć palcowalne pole (WCAG 2.5.5). */
  .entry-tools .order-btn,
  .order-row .order-btn { width: 44px; height: 44px; }
}

.order-row { position: relative; }
.entry--dragging,
.order-row--dragging { opacity: 0.45; }

.entry--drop-before::before,
.entry--drop-after::after,
.order-row--drop-before::before,
.order-row--drop-after::after {
  content: ""; position: absolute; left: 0; right: 0;
  height: 3px; border-radius: 2px; background: var(--brand);
  pointer-events: none;
}
.entry--drop-before::before,
.order-row--drop-before::before { top: -7px; }
.entry--drop-after::after,
.order-row--drop-after::after { bottom: -7px; }

.stack--dragging { user-select: none; }

/* Domyślnie ukryty — pokazywany dopiero w @media (max-width: 1080px), gdzie kolumny się układają
   jedna pod drugą. Na desktopie edytor i podgląd są obok siebie, więc przełącznik nie ma sensu. */
.mobile-view-switch { display: none; }

.preview-column {
  min-width: 0;
}

.document {
  min-height: 780px;
  /* Pochodne zmienne paddingu kartki: --doc-padding jest ustawiane INLINE przez JS, więc nie da się
     go nadpisać z arkusza (np. na telefonie). Układy liczą ujemne marginesy od TYCH zmiennych,
     dzięki czemu media query może je zmienić i panel boczny nie wychodzi poza papier. */
  --doc-pad-y: var(--doc-padding, 44px);
  --doc-pad-x: var(--doc-padding, 44px);
  padding: var(--doc-pad-y) var(--doc-pad-x);
  overflow: hidden;
  background: var(--paper);
  color: #20282a;
  font-family: var(--doc-body-font, Arial, sans-serif);
  /* Pochodna, żeby szablon mógł skalować pismo — --doc-body-size jest ustawiane INLINE przez JS,
     więc reguła arkusza nigdy by go nie nadpisała (stąd martwe .template-compact{--doc-body-size}). */
  --doc-body-eff: var(--doc-body-size, 13px);
  font-size: var(--doc-body-eff);
  box-shadow: 0 18px 50px rgba(36, 42, 39, 0.14);
}

.hidden { display: none; }

.cv-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  padding-bottom: 18px;
  /* 2px zamiast 3px — cieńsza linia-sygnatura czyta się jak premium, nie jak gruba kreska drukarska. */
  border-bottom: 2px solid var(--doc-accent, #0b4f9f);
}

.cv-head h2,
.cv-main-head h2 {
  margin: 0 0 5px;
  color: #1d2b2d;
  font-family: var(--doc-heading-font, Arial, sans-serif);
  font-size: var(--doc-heading-size, 28px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.cv-head .role,
.cv-main-head .role {
  color: var(--doc-accent, #0b4f9f);
  font-weight: 700;
  font-size: 0.86em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.contact {
  color: #5e6968;
  font-size: 0.84em;
  line-height: 1.7;
  text-align: right;
}

/* Ikony kontaktu (funkcja #4). Tekst zostaje realnym tekstem (ATS); ikona = currentColor. */
.contact-line { display: flex; align-items: center; gap: 6px; }
.contact-line + .contact-line { margin-top: 3px; }            /* odstęp między wierszami (brak <br>) */
/* overflow-wrap:anywhere łamie DOPIERO gdy token nie mieści się w linii i preferuje granice —
   word-break:break-word ciął e-mail w środku słowa („example.co / m"). */
.contact-line > span,
.contact-line > a { min-width: 0; word-break: normal; overflow-wrap: anywhere; }
/* Klikalny kontakt ma wyglądać jak tekst dokumentu — podkreślenie dopiero na hover. */
.contact-link { color: inherit; text-decoration: none; }
.contact-link:hover { text-decoration: underline; }
.contact-ico { flex: 0 0 auto; width: 14px; height: 14px; opacity: 0.9; }
/* Prawostronny blok (classic/modern/compact/timeline/minimal): grupa [ikona tekst] do prawej. */
.contact .contact-line { justify-content: flex-end; }

/* Wyraźniejszy rytm „sekcja > wpis": duży odstęp nad sekcją, mniejszy między wpisami. */
.doc-section {
  margin-top: var(--doc-section-gap, 28px);
}

/* Krótki akcent pod ETYKIETĄ sekcji zamiast pełnowymiarowej linii do prawej krawędzi —
   to była najbardziej „wordowa" cecha dokumentu. Belka w pełnym nasyceniu akcentu = „projektowany" rytm. */
.doc-section h3 {
  position: relative;
  margin: 0 0 12px;
  padding-bottom: 9px;
  color: var(--doc-accent, #0b4f9f);
  font-family: var(--doc-heading-font, Arial, sans-serif);
  font-size: 0.82em;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.doc-section h3::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 34px;
  height: 2px;
  border-radius: 2px;
  background: var(--doc-accent, #0b4f9f);
}

.doc-item {
  margin-bottom: 14px;
}

.doc-item-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

.doc-item strong { color: #1d2b2d; }
/* Daty jako spokojne, idealnie wyrównane metadane: cyfry tabularne, delikatniejsza szarość. */
.period { color: #97a09c; font-size: 0.78em; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; white-space: nowrap; }
/* Zwarty rytm treści — interlinia 1.45 zamiast 1.55, mniejszy odstęp akapitów. */
.doc-item p,
.letter-body p { color: #394447; line-height: var(--doc-line-height, 1.45); margin: 0 0 6px; }

/* Osiągnięcia w doświadczeniu/timeline jako lista z subtelnym punktorem w kolorze akcentu —
   wiąże zdania pod rolą w jedną jednostkę zamiast luźnych, pływających akapitów. */
.doc-section-experience .doc-item p,
.doc-section-education .doc-item p,
.doc-section .doc-item p {
  position: relative;
  padding-left: 14px;
}
.doc-section-experience .doc-item p::before,
.doc-section-education .doc-item p::before,
.doc-section .doc-item p::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--doc-accent, #1f4e79) 55%, #6d7775);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  padding: 5px 11px;
  /* Wyraźniejszy, ale stonowany fill — dawniej chipy były tak jasne, że wyglądały jak znak wodny. */
  background: color-mix(in srgb, var(--doc-accent, #1f4e79) 15%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--doc-accent, #1f4e79) 38%, #ffffff);
  border-radius: 7px;
  color: color-mix(in srgb, var(--doc-accent, #1f4e79) 82%, #1c2426);
  font-size: 0.82em;
  font-weight: 600;
}

.consent {
  margin-top: 28px;
  color: #6d7775;
  font-size: 0.68em;
  line-height: 1.45;
}

.letter-meta {
  /* Jeden blok po prawej (data+miejscowość+adresat) — lewa kolumna powtarzała nadawcę z nagłówka. */
  display: block;
  text-align: right;
  margin-bottom: 46px;
  color: #52605f;
  line-height: 1.6;
}

.letter-salutation { margin: 0 0 12px; }
.letter-valediction { margin: 28px 0 0; text-align: right; }

.letter-title {
  margin-bottom: 28px;
  color: #1d2b2d;
  font-family: var(--doc-heading-font, Arial, sans-serif);
  font-size: 1.35em;
  text-align: center;
}

.signature {
  margin-top: 42px;
  text-align: right;
}

.language-line {
  margin-top: 12px;
}

.letter-head {
  margin: calc(var(--doc-pad-y) * -1) calc(var(--doc-pad-x) * -1) 34px;
  padding: 28px var(--doc-pad-x);
  background: var(--doc-accent, #414b5b);
  color: white;
}

.letter-head h2 {
  margin: 0 0 8px;
  font-family: var(--doc-heading-font, Arial, sans-serif);
  font-size: var(--doc-heading-size, 28px);
}

.letter-head p {
  margin: 0;
  opacity: 0.86;
}

.cv-sidebar-layout {
  display: grid;
  grid-template-columns: minmax(170px, 31%) 1fr;
  min-height: calc(780px - (var(--doc-pad-y) * 2));
  margin: calc(var(--doc-pad-y) * -1) calc(var(--doc-pad-x) * -1);
}

.cv-sidebar {
  padding: var(--doc-pad-y) 24px;
  background: color-mix(in srgb, var(--doc-accent, #414b5b) 86%, #20282a);
  color: white;
}

.cv-sidebar h2 {
  margin: 0 0 6px;
  font-family: var(--doc-heading-font, Arial, sans-serif);
  /* Mniejsze, ale INTENCJONALNE nazwisko w wąskim panelu — dawniej dziedziczyło 28px i łamało się
     przypadkowo („Anna / Nowak"). clamp trzyma je w 1–2 kontrolowanych liniach. */
  font-size: clamp(21px, calc(var(--doc-heading-size, 28px) * 0.82), 24px);
  line-height: 1.12;
}

.cv-sidebar .role {
  margin-bottom: 28px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.82em;
  letter-spacing: 0.02em;
  font-weight: 700;
}

.sidebar-block {
  margin-top: 24px;
}

.sidebar-block h3 {
  margin-bottom: 8px;
  color: white;
  font-size: 0.82em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-block p {
  color: rgba(255, 255, 255, 0.82);
  line-height: var(--doc-line-height, 1.55);
}

.cv-main {
  min-width: 0;
  padding: var(--doc-pad-y) var(--doc-pad-x);
}

/* ── Dwukolumnowy szablon premium (template two-column) ──
   Kolorowy panel boczny (zdjęcie, kontakt, umiejętności, języki) + główna kolumna
   z nagłówkiem nazwiska i treścią. Kolory śledzą --doc-accent (papier zawsze jasny → theme-safe). */
.cv-twocol-layout {
  display: grid;
  grid-template-columns: minmax(196px, 34%) 1fr;
  min-height: calc(780px - (var(--doc-pad-y) * 2));
  margin: calc(var(--doc-pad-y) * -1) calc(var(--doc-pad-x) * -1);
}

.cv-aside {
  padding: var(--doc-pad-y) 26px;
  background:
    linear-gradient(165deg,
      var(--doc-accent, #414b5b),
      color-mix(in srgb, var(--doc-accent, #414b5b) 78%, #10151c));
  color: rgba(255, 255, 255, 0.9);
}

.cv-aside .cv-photo {
  display: block;
  width: 118px;
  height: 118px;
  aspect-ratio: 1 / 1;
  margin: 0 auto 22px;
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.5);
}

.cv-aside .sidebar-block { margin-top: 26px; }
.cv-aside .sidebar-block:first-child { margin-top: 0; }
.cv-aside .doc-section { margin-top: 26px; }

.cv-aside .sidebar-block h3,
.cv-aside .doc-section h3 {
  position: relative;
  margin: 0 0 9px;
  padding-bottom: 8px;
  color: #ffffff;
  font-family: var(--doc-heading-font, Arial, sans-serif);
  font-size: 0.78em;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
/* Krótki biały akcent zamiast pełnowymiarowej białej linii — mniej „kratki" w panelu.
   (Bazowy ::after używa --doc-accent, który na panelu-w-kolorze-akcentu byłby niewidoczny.) */
.cv-aside .sidebar-block h3::after,
.cv-aside .doc-section h3::after,
.cv-sidebar .sidebar-block h3::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 28px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.5);
}
.cv-sidebar .sidebar-block h3 { position: relative; padding-bottom: 8px; }

/* Bliżej pełnej bieli — czytelność druku kolorowego panelu. */
.cv-aside .sidebar-block p,
.cv-aside .doc-section p,
.cv-sidebar .sidebar-block p {
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.82em;
  line-height: var(--doc-line-height, 1.45);
}

/* Mniejszy font kontaktu w wąskim panelu → typowy e-mail/link mieści się bez łamania. */
.cv-aside .sidebar-block .contact-line,
.cv-sidebar .sidebar-block .contact-line { font-size: 0.9em; letter-spacing: -0.01em; }

.cv-aside .chips { gap: 6px; }
.cv-aside .chip {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.36);
  color: #ffffff;
  font-weight: 600;
}
/* Punktory osiągnięć są dla papieru — w kolorowym panelu bocznym zbędne. */
.cv-aside .doc-section .doc-item p,
.cv-sidebar .sidebar-block p { padding-left: 0; }
.cv-aside .doc-section .doc-item p::before { content: none; }

.cv-main-head {
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--doc-accent, #0b4f9f);
}

/* h2 i .role dziedziczą reguły z .cv-head (scalone selektory wyżej) — nagłówek dwukolumnowego
   był ich kopią 1:1. Tutaj zostaje wyłącznie to, co go odróżnia (akcentowa belka nad treścią). */

.template-modern .cv-head {
  align-items: end;
  border-bottom: 0;
  padding: 24px;
  background: color-mix(in srgb, var(--doc-accent, #0b4f9f) 12%, white);
  border-left: 8px solid var(--doc-accent, #0b4f9f);
}

/* Modern korzysta z bazowego krótkiego akcentu (::after) — bez pełnowymiarowej linii. */

.template-compact {
  /* Mnożnik, nie sztywne 12px — szablon nadal respektuje suwak rozmiaru pisma. */
  --doc-body-eff: calc(var(--doc-body-size, 13px) * 0.92);
}

.template-compact .doc-section {
  margin-top: calc(var(--doc-section-gap, 22px) * 0.72);
}

.template-compact .cv-head {
  padding-bottom: 14px;
}

.template-timeline .doc-section-experience .doc-item {
  position: relative;
  padding-left: 24px;
}

.template-timeline .doc-section-experience .doc-item::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 0;
  width: 10px;
  height: 10px;
  border: 2px solid var(--doc-accent, #0b4f9f);
  border-radius: 999px;
  background: white;
}

.template-minimal .cv-head {
  border-bottom-width: 1px;
}

/* Minimalny = naprawdę bez ozdobników: ciemny nagłówek zdaniowy, ZERO akcentu/kreski. */
.template-minimal .doc-section h3 {
  color: #30383a;
  letter-spacing: 0;
  text-transform: none;
  padding-bottom: 0;
}
.template-minimal .doc-section h3::after { content: none; }

.paper-letter {
  min-height: 740px;
}

.page-number {
  margin-top: 28px;
  color: #7c8685;
  /* em, nie rem: numer strony należy do DOKUMENTU i ma skalować się z jego rozmiarem pisma,
     a nie z suwakiem dostępności platformy (--platform-text-scale przez token --text-xs). */
  font-size: 0.72em;
  text-align: center;
}

.appearance-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  justify-items: center;
  align-items: start;
  overflow: auto;
  padding: 70px 22px 22px;
  background: rgba(9, 14, 24, 0.54);
}

.appearance-overlay.hidden {
  display: none;
}

.appearance-dialog {
  position: relative;   /* kotwica dla .appearance-close (dawniej liczył się od overlaya) */
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(980px, calc(100vw - 44px));
  height: min(820px, calc(100vh - 92px));
  max-height: calc(100vh - 92px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
}

.appearance-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.appearance-header h2 {
  font-size: var(--text-xl, 1.375rem);
}
/* Tytuł dostaje fokus przy otwarciu modala (a11y) — domyślny czarny prostokąt wyglądał jak input.
   Dyskretny miękki ring tylko dla klawiatury; przy fokusie programowym brak twardej ramki. */
.appearance-header h2:focus { outline: none; }
.appearance-header h2:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent);
  outline-offset: 6px;
  border-radius: var(--radius-sm);
}

.appearance-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.appearance-close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  font-size: var(--text-xl, 1.375rem);
  line-height: 1;
}

.appearance-tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.appearance-tabs::-webkit-scrollbar {
  display: none;
}

.appearance-tab {
  min-height: 54px;
  padding: 0 20px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.appearance-tab.active {
  color: var(--brand);
  box-shadow: inset 0 -3px 0 var(--brand);
}

.appearance-body {
  overflow: auto;
  padding: 20px;
}

.appearance-section + .appearance-section {
  margin-top: var(--space-5, 24px);
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.appearance-section h3 {
  margin-bottom: 12px;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.template-card,
.font-card,
.swatch-btn,
.order-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
}

.template-card {
  position: relative;
  display: grid;
  gap: 9px;
  align-content: start;
  min-height: auto;
  padding: 12px;
  cursor: pointer;
  text-align: left;
}

.template-card.active,
.font-card.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}
/* Wyraźny stan wybranego szablonu: tint + znacznik ✓ w rogu (przy 7 kaflach sama ramka ginęła). */
.template-card.active { background: color-mix(in srgb, var(--brand) 6%, var(--panel-soft)); }
.template-card.active::after {
  content: "✓";
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: var(--text-xs, 0.75rem);
  font-weight: 700;
}
/* Pierścień wybranej próbki neutralny (grafit), nie pomarańczowy — inaczej gryzł się z barwą próbki. */
.swatch-btn.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px color-mix(in srgb, var(--text) 28%, transparent);
}

.template-card small,
.font-card span {
  color: var(--muted);
  font-size: var(--text-xs, 0.75rem);
  line-height: 1.35;
}

.template-mini {
  position: relative;
  display: block;
  height: 86px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
}

.template-mini::before,
.template-mini::after {
  content: "";
  position: absolute;
}

/* Miniatury śledzą KOLOR DOKUMENTU (--doc-accent ustawiany na modalu w app.js), nie kolor marki —
   dzięki temu wybór koloru natychmiast przemalowuje wszystkie kafle. Fallback na --brand. */
.template-mini::before {
  inset: 12px 14px auto;
  height: 10px;
  background: var(--doc-accent, var(--brand));
}

.template-mini::after {
  inset: 34px 14px auto;
  height: 34px;
  background:
    linear-gradient(#cbd5e1 0 0) 0 0 / 76% 5px no-repeat,
    linear-gradient(#cbd5e1 0 0) 0 14px / 92% 5px no-repeat,
    linear-gradient(#cbd5e1 0 0) 0 28px / 62% 5px no-repeat;
}

.template-mini-sidebar::before {
  inset: 0 auto 0 0;
  width: 34%;
  height: auto;
  background: color-mix(in srgb, var(--doc-accent, var(--brand)) 88%, #10151c);
}

/* Dwukolumnowy premium: kolorowy panel boczny ze zdjęciem (biały krążek) + treść po prawej. */
.template-mini-two-column::before {
  inset: 0 auto 0 0;
  width: 40%;
  height: auto;
  background:
    radial-gradient(circle at 50% 20px, #ffffff 0 8px, transparent 9px),
    color-mix(in srgb, var(--doc-accent, var(--brand)) 88%, #10151c);
}
.template-mini-two-column::after {
  top: 12px;
  right: 12px;
  left: auto;
  width: 46%;
  height: 44px;
  background:
    linear-gradient(var(--doc-accent, var(--brand)) 0 0) 0 0 / 70% 6px no-repeat,
    linear-gradient(#cbd5e1 0 0) 0 16px / 92% 5px no-repeat,
    linear-gradient(#cbd5e1 0 0) 0 30px / 74% 5px no-repeat;
}

/* Klasyczny: wyśrodkowany, węższy nagłówek — inny niż lewostronny domyślny. */
.template-mini-classic::before {
  left: 50%;
  transform: translateX(-50%);
  width: 56%;
}

/* Nowoczesny: pełnoszerokościowy, ciężki blok nagłówka (tint akcentu, nie sztywny błękit). */
.template-mini-modern {
  background: color-mix(in srgb, var(--doc-accent, var(--brand)) 7%, #ffffff);
}
.template-mini-modern::before {
  inset: 0 0 auto 0;
  height: 24px;
}
.template-mini-modern::after { top: 34px; }

/* Kompaktowy: więcej gęstych wierszy. */
.template-mini-compact::after {
  height: 50px;
  background:
    linear-gradient(#cbd5e1 0 0) 0 0 / 84% 4px no-repeat,
    linear-gradient(#cbd5e1 0 0) 0 10px / 90% 4px no-repeat,
    linear-gradient(#cbd5e1 0 0) 0 20px / 76% 4px no-repeat,
    linear-gradient(#cbd5e1 0 0) 0 30px / 90% 4px no-repeat,
    linear-gradient(#cbd5e1 0 0) 0 40px / 66% 4px no-repeat;
}

/* Oś czasu: pionowa oś z kropką w kolorze akcentu po lewej. */
.template-mini-timeline::before {
  inset: 12px auto 12px 20px;
  width: 3px;
  height: auto;
  background: color-mix(in srgb, var(--doc-accent, var(--brand)) 55%, #cbd5e1);
}
.template-mini-timeline::after {
  left: 32px;
  right: 12px;
  top: 16px;
  background:
    radial-gradient(circle at -11px 3px, var(--doc-accent, var(--brand)) 0 3px, transparent 4px) 0 0 / 100% 14px repeat-y,
    linear-gradient(#cbd5e1 0 0) 0 2px / 72% 5px no-repeat,
    linear-gradient(#cbd5e1 0 0) 0 16px / 58% 5px no-repeat,
    linear-gradient(#cbd5e1 0 0) 0 30px / 64% 5px no-repeat;
}

/* Minimalny: cienka linia akcentu zamiast ciężkiej belki — spokojny, bez ramek. */
.template-mini-minimal::before {
  inset: 16px 14px auto;
  height: 3px;
  background: color-mix(in srgb, var(--doc-accent, var(--brand)) 55%, transparent);
}

.swatch-grid,
.font-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
  gap: 10px;
}

.swatch-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 8px 10px;
  cursor: pointer;
}

.swatch {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 7px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
}

.font-card {
  display: grid;
  gap: 8px;
  min-height: 78px;
  padding: 12px;
  cursor: pointer;
  text-align: left;
}

.two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.appearance-field {
  display: grid;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: var(--text-xs, 0.75rem);
  text-transform: uppercase;
}

/* Tor, pastylki i stan aktywny dostarcza kit .platform-seg —
   lokalnie tylko układ (segmenty równej szerokości, palcowalna wysokość). */
.appearance-segments {
  display: flex;
}
.appearance-segments button {
  flex: 1;
  justify-content: center;
  min-height: 38px;
}

.order-list {
  display: grid;
  gap: 8px;
}

.order-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 10px 12px;
}

.order-row div {
  display: flex;
  gap: 6px;
}

.order-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.order-btn:disabled {
  cursor: not-allowed;
  opacity: 0.36;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.toggle-row + .toggle-row { margin-top: 12px; }

.toggle-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--brand);
}

/* Toast (prawy dół, znikanie z visibility) dostarcza kit .platform-toast
   + .platform-toast__action — lokalna kopia usunięta. */

@media (max-width: 1080px) {
  .document-toolbar { align-items: stretch; flex-direction: column; gap: 10px; }
  .toolbar-actions { flex-wrap: wrap; padding-bottom: 14px; }
  .editor-topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .editor-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .workspace { grid-template-columns: 1fr; }
  /* Przełącznik Edycja ↔ Podgląd — na wąskim ekranie kolumny leżą jedna pod drugą.
     Tor/pastylki/stan aktywny dostarcza kit .platform-seg; tu tylko pozycjonowanie
     pływającego przełącznika + palcowalna wysokość segmentów. */
  .mobile-view-switch {
    position: fixed;
    left: 50%;
    bottom: 14px;
    z-index: 40;
    transform: translateX(-50%);
    display: flex;
    box-shadow: var(--shadow-lg);
  }
  .mobile-view-switch button {
    justify-content: center;
    min-height: 40px;
    padding: 8px 20px;
    font-size: var(--text-base, 0.875rem);
  }
  .workspace--edit .preview-column { display: none; }
  .workspace--preview .editor-nav,
  .workspace--preview .editor-panel { display: none; }
  .editor-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .editor-nav::-webkit-scrollbar { display: none; }
  .editor-nav .tab {
    flex: 0 0 auto;
    width: auto;
    min-width: 162px;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding-right: 16px;
    padding-left: 16px;
  }
  .dashboard-summary {
    align-items: flex-start;
    flex-direction: column;
  }
  .dashboard-metrics {
    width: 100%;
    flex-wrap: wrap;
  }
  .dashboard-metrics > span {
    flex: 1;
    min-width: 132px;
  }
  .document-tabs { gap: 18px; }
  .toolbar-actions { align-items: stretch; flex-direction: column; }
  .editor-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .toolbar-divider { display: none; }
  .view-switch { width: 100%; }
  .view-btn { flex: 1; justify-content: center; }
  .document-collection.cards { grid-template-columns: 1fr; }
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .panel-header .platform-metric-pill {
    width: 100%;
    text-align: left;
  }
  .doc-list-row {
    align-items: stretch;
    flex-direction: column;
  }
  .doc-list-actions {
    justify-content: space-between;
    gap: 8px;
  }
  .grid-2 { grid-template-columns: 1fr; }
  /* Zmieniamy tylko pochodne zmienne — padding kartki i ujemne marginesy layoutów wyliczą się
     z nich same, więc panel boczny nie wystaje poza papier (--doc-padding jest inline z JS). */
  .document { --doc-pad-y: 26px; --doc-pad-x: 20px; min-height: 0; }
  .cv-head,
  .letter-meta { grid-template-columns: 1fr; }
  .cv-sidebar-layout,
  .cv-twocol-layout { grid-template-columns: 1fr; }
  .contact { text-align: left; }
  .contact .contact-line { justify-content: flex-start; }
  .doc-item-head { flex-direction: column; gap: 2px; }
  .appearance-overlay {
    align-items: end;
    overflow: hidden;
    padding: 0;
  }
  .appearance-dialog,
  .phrase-dialog {
    width: 100%;
    height: 94vh;
    max-height: 94vh;
    border-radius: 14px 14px 0 0;
  }
  .share-dialog {
    width: 100%;
    height: auto;              /* krótki modal nie ma się rozciągać na pełny ekran */
    max-height: 94vh;
    border-radius: 14px 14px 0 0;
  }
  .appearance-header,
  .appearance-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .appearance-actions .btn {
    width: 100%;
  }
  .appearance-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 1;
  }
  .two-columns {
    grid-template-columns: 1fr;
  }
  .template-grid,
  .swatch-grid,
  .font-grid {
    grid-template-columns: 1fr;
  }
  .appearance-segments {
    flex-direction: column;
  }
}

@media print {
  @page { margin: 14mm; }
  body { background: white; }
  .editor-view.hidden { display: block !important; }
  .cv-platform-header,
  .dashboard-view,
  .editor-topbar,
  .editor-nav,
  .document-toolbar,
  .document-manager,
  .editor-panel,
  .appearance-overlay,
  .mobile-view-switch,
  .platform-toast { display: none !important; }
  .app-shell,
  .workspace { display: block; padding: 0; max-width: none; }
  .preview-column { width: 100%; }
  .document {
    display: block !important;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    /* Ekranowe overflow:hidden (pas bezpieczeństwa dla zaokrągleń) MUSI zniknąć przy druku —
       inaczej obcięłoby treść przechodzącą na kolejną stronę. */
    overflow: visible;
    /* Zachowaj tła/akcenty (pasek boczny, baner modern, nagłówek listu, chipy) — bez tego drukują się BIAŁE. */
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  /* Układy z panelem bocznym pozycjonują się UJEMNYM marginesem względem paddingu kartki,
     a przy druku .document ma padding:0 — bez wyzerowania wychodziły poza obszar @page.
     min-height też trzeba zdjąć, inaczej krótkie CV rezerwuje ~700 px i wypycha pustą 2. stronę. */
  .cv-sidebar-layout,
  .cv-twocol-layout { margin: 0; min-height: 0; }
  .letter-head { margin: 0 0 24px; padding: 20px var(--doc-padding, 44px); }
  /* Nie łam POJEDYNCZYCH wpisów; nie osieroć nagłówka na dole strony.
     ŚWIADOMIE bez .cv-sidebar-layout/.cv-twocol-layout i bez .doc-section: to kontenery obejmujące
     cały dokument / całe doświadczenie, więc dla CV dłuższego niż strona reguła jest niespełnialna —
     przeglądarka albo ją ignoruje (panel boczny traci tło na 2. stronie), albo wypycha całość
     na nową stronę. Ochronę przed rozerwaniem daje .doc-item. */
  .doc-item,
  .letter-head,
  .letter-meta { break-inside: avoid; }
  .doc-section h3 { break-after: avoid; }
  /* Wydruk ma wyglądać identycznie jak podgląd — bez niebieskich linków i bez dopisywania URL-i. */
  .contact-link { color: inherit !important; text-decoration: none !important; }
  .document.hidden { display: none !important; }
}

/* „Co poprawić" — JEDNA lista braków z wyjaśnieniem „dlaczego" (zastąpiła checklistę pigułek
   + osobny blok wskazówek, które mówiły to samo i zjadały pion panelu). */
.score-fixes { margin: 0 0 12px; }
.score-fixes__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.score-fixes__list li {
  display: grid;
  gap: 2px;
  padding-left: 16px;
  position: relative;
  line-height: 1.35;
}
.score-fixes__list li::before {
  content: "○";
  position: absolute;
  left: 0;
  top: 1px;
  color: var(--accent, #c15f3c);
  font-size: var(--text-2xs, 0.6875rem);
  font-weight: 700;
}
.score-fixes__label { font-size: var(--text-xs, 0.75rem); color: var(--text); }
.score-fixes__why { font-size: var(--text-xs, 0.75rem); color: var(--muted); line-height: 1.35; }
.score-fixes__done {
  margin: 0;
  font-size: var(--text-sm, 0.8125rem);
  color: var(--pass-fg, #4a7a35);
  font-weight: 600;
}
.score-fixes__toggle {
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  cursor: pointer;
  font-size: var(--text-xs, 0.75rem);
  text-decoration: underline;
}

/* ============================ ROZSZERZENIA RDZENIA (2026-07-15) ============================ */

/* Status zapisu / synchronizacji */
.dashboard-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
/* Status zapisu dostarcza kit .platform-sync + __dot + [data-state]
   (JS mapuje "syncing" → "pending"); lokalna pigułka .storage-status usunięta. */
.platform-sync { white-space: nowrap; }

/* Nazwa dokumentu w edytorze (klikalna) */
.editor-title-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
}
.editor-title-btn h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-title-edit { color: var(--muted); font-size: var(--text-base, 0.875rem); flex: 0 0 auto; opacity: 0; transition: opacity 0.15s ease; }
.editor-title-btn:hover .editor-title-edit { opacity: 1; }

/* Menu dokumentu w karcie */
.doc-card { position: relative; }
.doc-menu {
  position: absolute;
  right: 14px;
  bottom: 52px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  min-width: 168px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.doc-menu.hidden { display: none; }
.doc-menu button {
  border: 0;
  border-radius: calc(var(--radius-sm) - 2px);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: var(--text-base, 0.875rem);
  padding: 9px 11px;
  text-align: left;
}
.doc-menu button:hover { background: var(--panel-soft); }
.doc-menu .doc-menu-danger { color: var(--danger); }

/* Zdjęcie kandydata */
.photo-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.photo-preview {
  width: 84px;
  height: 84px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-soft) center / cover no-repeat;
  color: var(--muted);
  font-size: var(--text-xs, 0.75rem);
}
.photo-preview.has-photo { border-style: solid; }
.photo-controls { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.photo-label { color: var(--text); font-size: var(--text-base, 0.875rem); font-weight: 600; }
.photo-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.cv-photo {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.5);
}
.cv-sidebar .cv-photo { width: 100%; height: auto; aspect-ratio: 1 / 1; margin-bottom: 16px; border: 0; }
.cv-head-main { display: flex; align-items: center; gap: 16px; min-width: 0; }
.cv-head-main .cv-photo { border-color: color-mix(in srgb, var(--doc-accent) 30%, #ffffff); }

/* Mini-przełączniki / widoczność pól */
.mini-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: var(--text-sm, 0.8125rem);
  text-transform: none;
  cursor: pointer;
}
.mini-toggle input { width: 16px; height: 16px; accent-color: var(--brand); }
.visibility-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}
.visibility-label { color: var(--muted); font-size: var(--text-xs, 0.75rem); text-transform: uppercase; }

/* Podpowiedzi walidacji */
.field-hint {
  color: var(--muted);
  font-size: var(--text-xs, 0.75rem);
  text-transform: none;
  line-height: 1.35;
}
.field-hint:empty { display: none; }
.field-hint--error { color: var(--danger); }

/* Stopka pola: przycisk zwrotów + licznik */
.field-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
}
.phrase-btn {
  border: 1px solid var(--border);
  border-radius: var(--radius-pill, 999px);
  background: var(--brand-soft);
  color: var(--brand-strong);
  cursor: pointer;
  font-size: var(--text-xs, 0.75rem);
  padding: 4px 11px;
  text-transform: none;
}
.phrase-btn:hover { background: color-mix(in srgb, var(--brand) 22%, var(--surface)); }
.char-counter { color: var(--muted); font-size: var(--text-xs, 0.75rem); text-transform: none; white-space: nowrap; }
.char-counter--warn { color: var(--accent, #c15f3c); }

/* Podsekcje / listy pomocnicze */
.subsection { margin-top: 20px; padding-top: var(--space-4, 16px); border-top: 1px solid var(--line); }
.panel-lede { margin: -4px 0 14px; color: var(--muted); font-size: var(--text-base, 0.875rem); }
.panel-empty { color: var(--muted); font-size: var(--text-sm, 0.8125rem); margin: 4px 0; }

/* Języki */
.language-list { display: flex; flex-direction: column; gap: 8px; }
.language-row { display: grid; grid-template-columns: 1fr 120px auto; gap: 8px; align-items: center; }
.language-row .language-name,
.language-row .language-level { margin: 0; }

/* Klauzula RODO */
.rodo-options { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.rodo-options[hidden] { display: none; }
.rodo-note {
  margin: 4px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--brand);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: var(--text-xs, 0.75rem);
  line-height: 1.45;
}

/* Sekcje dodatkowe */
.section-templates { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.section-template-btn {
  border: 1px dashed var(--border);
  border-radius: var(--radius-pill, 999px);
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  font-size: var(--text-sm, 0.8125rem);
  padding: 6px 13px;
}
.section-template-btn:hover { border-color: var(--brand); color: var(--brand-strong); background: var(--brand-soft); }
.extra-sections { display: flex; flex-direction: column; gap: 14px; }
.extra-section {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.extra-section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.extra-section-title { font-weight: 600; }
.entry-tools { display: flex; align-items: center; gap: 6px; }

/* Dopasowanie do oferty */
.match-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 12px 0 16px; }
.match-score { color: var(--brand-strong); font-size: var(--text-base, 0.875rem); font-weight: 600; }
.match-results { display: flex; flex-direction: column; gap: 18px; }
.match-group h4 { margin: 0 0 4px; font-size: var(--text-base, 0.875rem); }
.match-hint { margin: 0 0 8px; color: var(--muted); font-size: var(--text-xs, 0.75rem); }
.match-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.match-chip {
  border: 1px solid var(--border);
  border-radius: var(--radius-pill, 999px);
  font-size: var(--text-xs, 0.75rem);
  padding: 4px 11px;
}
.match-chip--missing {
  background: color-mix(in srgb, var(--accent, #c15f3c) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--accent, #c15f3c) 40%, transparent);
  color: var(--accent, #c15f3c);
  cursor: pointer;
}
.match-chip--missing:hover { background: color-mix(in srgb, var(--accent, #c15f3c) 22%, var(--surface)); }
.match-chip--present {
  background: var(--pass-bg, #eaf2e5);
  border-color: var(--pass-fg, #4a7a35);
  color: var(--pass-fg, #4a7a35);
}

/* Dialog biblioteki zwrotów */
.phrase-dialog {
  position: relative;   /* kotwica dla .appearance-close (dawniej liczył się od overlaya) */
  display: grid;
  /* header · search · toolbar · body. `auto` na toolbarze, bo dla wstępów/zakończeń listu jest on
     ukryty (.hidden) — przy sztywnym wierszu body traciło wtedy swój minmax i dialog nie przewijał się. */
  grid-template-rows: auto auto auto minmax(0, 1fr);
  width: min(760px, calc(100vw - 44px));
  height: min(760px, calc(100vh - 92px));
  max-height: calc(100vh - 92px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
}
/* Wyszukiwarka w bibliotece zwrotów (funkcja #3) */
.phrase-search { padding: 12px 20px 0; }
.phrase-search-input {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: var(--text-base, 0.875rem); padding: 9px 12px;
}
.phrase-search-input::placeholder { color: var(--muted); }
.phrase-search-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.phrase-body mark {
  background: color-mix(in srgb, var(--brand) 26%, transparent);
  color: inherit; border-radius: 3px; padding: 0 1px;
}
.phrase-item-fam {
  align-self: flex-start; font-size: var(--text-2xs, 0.6875rem); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
}
.phrase-group-label { margin: 6px 0 2px; font-size: var(--text-xs, 0.75rem); font-weight: 600; color: var(--muted); }
.phrase-count { margin: 0 0 2px; font-size: var(--text-xs, 0.75rem); color: var(--muted); }

/* 22 rodziny w chipach zajmowały 4 rzędy (~195 px) i spychały wyniki poza ekran.
   Ograniczamy wysokość i przewijamy w pionie — pasek nigdy nie zjada więcej niż 2 rzędy. */
.phrase-toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-content: flex-start;
  max-height: 104px;   /* border-box: 2 rzędy chipów (~58px) + padding 2×14px + zapas */
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.phrase-toolbar.hidden { display: none; }
.phrase-family {
  border: 1px solid var(--border);
  border-radius: var(--radius-pill, 999px);
  background: var(--panel-soft);
  color: var(--muted);
  cursor: pointer;
  font-size: var(--text-xs, 0.75rem);
  padding: 5px 12px;
}
.phrase-family.active { background: var(--brand); border-color: var(--brand); color: var(--paper); }
[data-theme="dracula"] .phrase-family.active { color: var(--bg); }
.phrase-body { overflow: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.phrase-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 12px 14px;
  text-align: left;
  line-height: 1.45;
  font-size: var(--text-base, 0.875rem);
}
.phrase-item:hover { border-color: var(--brand); background: var(--brand-soft); }
.phrase-item strong { color: var(--brand-strong); font-size: var(--text-sm, 0.8125rem); }

/* Modal udostępniania (CV jako strona WWW) */
.share-dialog {
  position: relative;   /* kotwica dla .appearance-close (dawniej liczył się od overlaya) */
  display: flex;
  flex-direction: column;
  width: min(560px, calc(100vw - 44px));
  max-height: calc(100vh - 92px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
}
.share-body { overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.share-error {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--danger);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
  font-size: var(--text-sm, 0.8125rem);
  line-height: 1.45;
}
.share-link-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.share-link-row input {
  flex: 1;
  min-width: 180px;
  font-size: var(--text-base, 0.875rem);
  color: var(--brand-strong);
}
.share-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.share-email-toggle { font-size: var(--text-sm, 0.8125rem); }
.share-stats { display: flex; gap: 26px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.share-stat { display: flex; flex-direction: column; gap: 2px; }
.share-stat strong { color: var(--brand); font-size: var(--text-xl, 1.375rem); }
.share-stat span { color: var(--muted); font-size: var(--text-xs, 0.75rem); text-transform: uppercase; letter-spacing: 0.04em; }
.share-spark { display: flex; align-items: flex-end; gap: 3px; height: 46px; padding-top: 4px; }
.share-spark-bar { flex: 1; min-width: 4px; background: var(--brand); border-radius: 2px 2px 0 0; opacity: 0.85; }

/* ── Cykl 2: liczniki, wskazówki, undo-toast, onboarding ── */
.char-counter--ok { color: var(--pass-fg, #4a7a35); }

/* Rozbicie wyniku na kategorie z paskami (funkcja #5): paski, kolory pasm i stan
   „pending" dostarcza kit .platform-meter (markup w app.js) — tu tylko margines
   sekcji i lokalna mikro-CTA pod paskiem. */
.score-breakdown { margin: 2px 0 12px; }
.score-cat__cta {
  margin-top: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  cursor: pointer;
  font-size: var(--text-xs, 0.75rem);
  text-decoration: underline;
}
.onboarding-chooser { padding: 34px 16px 26px; text-align: center; }
.onboarding-chooser h2 { margin: 0 0 6px; font-size: var(--text-xl, 1.375rem); }
.onboarding-lede { margin: 0 auto 22px; max-width: 46ch; color: var(--muted); font-size: var(--text-base, 0.875rem); }
.onboarding-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
  gap: 14px;
  max-width: 720px;
  margin: 0 auto;
}
.onboarding-card {
  display: grid;
  gap: 5px;
  align-content: start;
  padding: 22px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.onboarding-card:hover { border-color: var(--brand); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.onboarding-ico { font-size: var(--text-2xl, 1.75rem); line-height: 1; }
.onboarding-card strong { color: var(--text); font-size: var(--text-md, 1rem); }
.onboarding-card small { color: var(--muted); font-size: var(--text-sm, 0.8125rem); line-height: 1.35; }

@media (max-width: 680px) {
  .dashboard-side { align-items: flex-start; width: 100%; }
  .language-row { grid-template-columns: 1fr; }
  .photo-row { flex-direction: column; }
  .editor-actions .platform-sync { order: -1; }
}
