/* ============================================================
   CloudERP — App layer (jedyny autorski CSS)
   Ładowany PO tokens.css + components.css. Wszystko na tokenach
   z design handoffu (Wycena Web). Tu mieszka:
   - skalowanie czcionki (A−/A/A+ + auto media-query)
   - alias --pico-* → tokeny (re-theming istniejących szablonów)
   - warstwa zastępująca Pico dla natywnych elementów
   - chrome CloudERP (app-shell, splittery, drzewo, modale…)
   - --dxf-canvas-bg (czarne płótno DXF, NIEzależne od motywu)
   ============================================================ */

/* ---------- Skala czcionki: A−/A/A+ + auto fallback ----------
   Tokeny w handoffie są w px — skalujemy je tym samym współczynnikiem
   co root font-size, żeby cała aplikacja (rem + komponenty) rosła/malała
   spójnie po kliknięciu A−/A/A+. */
:root { --font-scale: 1; }
@media (max-width: 1599px) { :root { --font-scale: 0.9; } }
@media (max-width: 1365px) { :root { --font-scale: 0.85; } }

html, body { font-size: calc(16px * var(--font-scale)); }
:root {
  --fs-11: calc(11px * var(--font-scale));
  --fs-12: calc(12px * var(--font-scale));
  --fs-13: calc(13px * var(--font-scale));
  --fs-14: calc(14px * var(--font-scale));
  --fs-15: calc(15px * var(--font-scale));
  --fs-16: calc(16px * var(--font-scale));
  --fs-18: calc(18px * var(--font-scale));
  --fs-20: calc(20px * var(--font-scale));
  --fs-24: calc(24px * var(--font-scale));
  --fs-32: calc(32px * var(--font-scale));
  --fs-44: calc(44px * var(--font-scale));

  /* Czarne płótno renderu DXF/SVG — celowo POZA systemem motywów.
     Light theme NIE może rozjaśnić podglądu CAD. */
  --dxf-canvas-bg: #000;
}
body { min-width: 1280px; margin: 0; padding: 0; }

/* ---------- (usunięto) Alias --pico-* → tokeny ----------
   Po migracji szablonów na system komponentów (NewDesin handoff)
   żaden template ani CSS nie odwołuje się już do var(--pico-*).
   Blok aliasów usunięty — jedynym źródłem są tokeny --c-* z tokens.css. */

/* ---------- Warstwa zastępująca Pico (natywne elementy) ----------
   Pico CDN usunięte — natywne <form>/<table>/<button>/<code> muszą
   dostać styl z tokenów żeby nie były „gołe". */
h1 { font-size: var(--fs-32); }
h2 { font-size: var(--fs-24); }
h3 { font-size: var(--fs-20); }
h4 { font-size: var(--fs-18); }
h5, h6 { font-size: var(--fs-16); }
p { margin: 0; }
small { font-size: var(--fs-12); }
strong { font-weight: var(--fw-semibold); }
hr { border: none; height: 1px; background: var(--c-surface-3); margin: var(--s-4) 0; }
ul, ol { margin: var(--s-2) 0; padding-left: var(--s-5); }
li { margin: 2px 0; }
code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
code {
  background: var(--c-surface-1); color: var(--c-text);
  padding: 1px 6px; border-radius: var(--r-xs); font-size: .9em;
}
pre {
  background: var(--c-surface-1); color: var(--c-text);
  padding: var(--s-3); border-radius: var(--r-md);
  border: 1px solid var(--c-surface-3); overflow: auto;
}
pre code { background: transparent; padding: 0; }
kbd {
  display: inline-block; padding: 1px 6px; min-width: 1.2em; text-align: center;
  background: var(--c-surface-2); color: var(--c-text);
  border: 1px solid var(--c-surface-3); border-radius: var(--r-xs);
  font-size: .85em;
}
article {
  background: var(--c-surface-1); border: 1px solid var(--c-surface-3);
  border-radius: var(--r-xl); padding: var(--s-4) var(--s-5);
  margin-bottom: var(--s-4);
}

/* Formularze — natywne kontrolki w stylu .input z components.css */
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=submit]):not([type=button]),
select,
textarea {
  display: block; width: 100%;
  font-family: var(--font-ui); font-size: var(--fs-13); color: var(--c-text);
  background: var(--c-surface-1);
  border: 1px solid var(--c-surface-3);
  border-radius: var(--r-md);
  padding: 0 var(--s-3); height: var(--hit-desktop);
  outline: none;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
textarea {
  padding: var(--s-2) var(--s-3); height: auto; min-height: 70px;
  line-height: var(--lh-base); resize: vertical;
}
select {
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--c-text-muted) 50%),
                    linear-gradient(135deg, var(--c-text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  padding-right: var(--s-8);
}
input:hover, select:hover, textarea:hover { border-color: var(--c-surface-4); }
input:focus, select:focus, textarea:focus { border-color: var(--c-blue-500); }
input::placeholder, textarea::placeholder { color: var(--c-text-subtle); }
input[type=file] {
  font-size: var(--fs-12); color: var(--c-text-muted);
}
input[type=checkbox], input[type=radio] {
  accent-color: var(--c-blue-500); width: auto; cursor: pointer;
}
label { color: var(--c-text); font-size: var(--fs-13); }

/* Natywne <button> i Pico-utility (role=button / .secondary / .outline /
   .contrast) — neutralny .btn. Specyficzne klasy chrome niżej je nadpiszą. */
button,
[role=button],
a.secondary, a.contrast, a.outline,
button.secondary, button.contrast, button.outline {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  font-family: var(--font-ui); font-size: var(--fs-13); font-weight: var(--fw-medium);
  color: var(--c-text);
  background: var(--c-surface-1);
  border: 1px solid var(--c-surface-3);
  border-radius: var(--r-md);
  padding: 0 var(--s-4); min-height: var(--hit-desktop);
  cursor: pointer; user-select: none; white-space: nowrap;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
button:hover,
[role=button]:hover,
a.secondary:hover, a.contrast:hover, a.outline:hover,
button.secondary:hover, button.contrast:hover, button.outline:hover {
  background: var(--c-surface-2); border-color: var(--c-surface-4);
  color: var(--c-text);
}
button:active, [role=button]:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
a.outline, button.outline { background: transparent; }

/* Komponenty .btn z components.css mają priorytet nad fallbackiem natywnego
   <button> — bez tego min-height natywnego psułoby .btn--sm / .btn--lg. */
button.btn { min-height: 0; }

/* Tabele — token table (components.css .table) zaaplikowane na natywne
   table.compact używane w job_detail / jobs_list / tickets / layout_view. */
table { width: 100%; border-collapse: collapse; font-size: var(--fs-13); color: var(--c-text); }
table th {
  text-align: left; padding: var(--s-2) var(--s-3); color: var(--c-text-link);
  font-weight: var(--fw-semibold); border-bottom: 1px solid var(--c-surface-3);
}
table td { padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--c-surface-2); }
table.striped tbody tr:nth-child(even) td { background: var(--c-surface-1); }
table.compact td, table.compact th { padding: 6px 10px; font-size: var(--fs-13); }
table.compact thead th {
  font-weight: var(--fw-bold); color: var(--c-text-link);
  letter-spacing: .02em;
}
table.compact { margin-bottom: var(--s-2); }

/* ============================================================
   CHROME CloudERP — przeniesione z base.html <style>,
   przetokenizowane (hex → tokeny, #000 → --dxf-canvas-bg).
   ============================================================ */

nav.topbar { padding: var(--s-2) var(--s-4); border-bottom: 1px solid var(--c-surface-3); background: var(--c-surface-0); }
nav.topbar ul { margin: 0; }
nav.topbar .right { margin-left: auto; }

/* App shell — sidebar zawsze widoczny; .with-preview dodaje prawą kolumnę */
:root { --sidebar-w: 320px; --preview-w: 360px; --layout-aside-w: 360px; }
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 5px minmax(0, 1fr);
  gap: 0; min-height: calc(100vh - 50px);
}
.app-shell.with-preview {
  grid-template-columns: var(--sidebar-w) 5px minmax(0, 1fr) 5px var(--preview-w);
}

/* Splitter — przeciągany pasek */
.app-shell .splitter,
.layout-view-grid > .splitter,
.local-viewer-grid > .splitter {
  cursor: col-resize; background: transparent;
  transition: background var(--dur-fast); user-select: none;
  position: relative; z-index: 5;
}
.app-shell .splitter:hover,
.app-shell .splitter.dragging,
.layout-view-grid > .splitter:hover,
.layout-view-grid > .splitter.dragging,
.local-viewer-grid > .splitter:hover,
.local-viewer-grid > .splitter.dragging { background: var(--c-blue-500); }
.app-shell .splitter::after {
  content: ''; position: absolute; left: 2px; top: 0; bottom: 0; width: 1px;
  background: var(--c-surface-3);
}
body.is-resizing, body.is-resizing * { cursor: col-resize !important; user-select: none; }

aside.sidebar {
  background: var(--c-panel-cool);
  border-right: 1px solid var(--c-surface-3);
  padding: var(--s-2); overflow-y: auto; overflow-x: hidden;
  max-height: calc(100vh - 50px);
  display: flex; flex-direction: column;
}
main.content { padding: var(--s-4) var(--s-6); overflow: auto; max-height: calc(100vh - 50px); }
aside.preview {
  background: var(--c-panel-warm);
  border-left: 1px solid var(--c-surface-3);
  padding: var(--s-4); overflow-y: auto; max-height: calc(100vh - 50px);
}

/* Tree */
.tree-counter {
  font-size: var(--fs-13); color: var(--c-text-muted);
  padding: var(--s-1) var(--s-2); margin-bottom: var(--s-1);
}
.tree-counter strong { color: var(--c-text); }
#tree-filter, input#tree-filter {
  width: 100%; margin: 0 0 var(--s-2) 0; box-sizing: border-box;
}
.job-tree { flex: 1 1 auto; overflow-y: auto; }
.job-tree details { padding: 0; margin: 0; }
.job-tree details > summary {
  cursor: pointer; padding: var(--s-1) var(--s-1); border-radius: var(--r-xs);
  font-weight: var(--fw-semibold); user-select: none; list-style: none;
  display: flex; align-items: center; gap: 6px; font-size: var(--fs-15);
}
.job-tree details > summary::before {
  content: '▸'; display: inline-block; transition: transform .1s;
  font-size: var(--fs-11); color: var(--c-text-muted);
}
.job-tree details[open] > summary::before { transform: rotate(90deg); }
.job-tree details > summary:hover { background: var(--c-surface-2); }
.job-tree details details > summary { font-weight: var(--fw-medium); padding-left: var(--s-1); font-size: var(--fs-13); }
.job-tree .tree-children {
  padding-left: var(--s-3); border-left: 1px solid var(--c-surface-3); margin-left: 9px;
}
.job-tree .tree-counter-inline { margin-left: auto; color: var(--c-text-muted); font-weight: 400; font-size: .85em; }
.job-tree .tree-job {
  display: block; padding: var(--s-1) var(--s-2); font-size: var(--fs-13);
  text-decoration: none; color: var(--c-text); border-radius: var(--r-xs);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.job-tree .tree-job:hover { background: var(--c-surface-2); }
.job-tree .tree-job.active {
  background: var(--c-blue-600); color: var(--c-text-on-accent); font-weight: var(--fw-semibold);
}
.job-tree .tree-job.has-unack {
  position: relative; padding-right: 22px;
  background: var(--c-tint-amber);
  border-left: 3px solid var(--c-amber-500);
  padding-left: 7px;
}
.job-tree .tree-job.has-unack::after {
  content: '●'; position: absolute; right: 7px; top: 50%;
  transform: translateY(-50%); color: var(--c-amber-500);
  font-size: .7rem; animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot { 0%,100% { opacity: .6; } 50% { opacity: 1; } }
.job-tree .tree-job.has-unack.active { background: var(--c-blue-600); }
.job-tree .tree-job.has-unack.active::after { color: var(--c-text-on-accent); }

.tree-actions { padding: var(--s-2) var(--s-1) 0; border-top: 1px solid var(--c-surface-3); }
.tree-actions a[role=button], .tree-actions button { width: 100%; margin-bottom: var(--s-1); }

/* Workflow breadcrumb */
.workflow-bar { display: flex; gap: var(--s-1); margin: var(--s-2) 0 var(--s-4); flex-wrap: wrap; }
.workflow-bar .step {
  padding: var(--s-1) var(--s-3); border-radius: var(--r-xs); font-size: var(--fs-11);
  color: #fff; opacity: .55; font-weight: var(--fw-semibold); letter-spacing: .04em;
}
.workflow-bar .step.active { opacity: 1; }
.workflow-bar .arrow { color: var(--c-text-muted); align-self: center; }

/* Job header */
.job-header h2 { margin: 0 0 var(--s-1) 0; }
.job-header .meta { font-size: var(--fs-15); color: var(--c-text); display: flex; gap: var(--s-6); flex-wrap: wrap; }
.job-header .meta strong { color: var(--c-text); }

/* Nagłówki sekcji */
main.content section > h3 {
  font-size: var(--fs-20); color: var(--c-text-link);
  margin-top: var(--s-5); margin-bottom: var(--s-2);
  padding-bottom: var(--s-1); border-bottom: 1px solid var(--c-surface-3);
}
main.content section > h3 small { font-size: var(--fs-13); color: var(--c-text-muted); font-weight: 400; }

/* Utility: czerwony tekst (zastępuje dawne .err) */
.t-danger { color: var(--c-red-500); }

/* Parts table — clickable rows */
#parts-table tbody tr { cursor: pointer; }
#parts-table tbody tr.selected { background: var(--c-panel-accent); }
#parts-table tbody tr:hover { background: var(--c-surface-2); }

/* Status colors */
.status-ok      { color: var(--c-emerald-500); font-weight: var(--fw-semibold); }
.status-partial { color: var(--c-amber-500);   font-weight: var(--fw-semibold); }
.status-pending { color: var(--c-amber-500);   font-weight: var(--fw-medium); }
.status-error   { color: var(--c-red-500);     font-weight: var(--fw-semibold); }
/* .status-badge / .alert-banner usunięte — zastąpione .pill* / .callout* z components.css */

/* Pasek postępu produkcji (sekcja "Status realizacji" w job_detail) */
.prod-progress {
  width: 100%; height: 8px; background: var(--c-surface-2);
  border-radius: var(--r-full); overflow: hidden;
}
.prod-progress__bar {
  height: 100%; background: var(--grad-primary); border-radius: var(--r-full);
  transition: width var(--dur-base) var(--ease-out);
}

/* Preview panel */
.preview-thumb-wrap {
  width: 100%; height: 280px; background: var(--dxf-canvas-bg);
  border: 1px solid var(--c-surface-3); border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; margin-bottom: var(--s-4);
}
.preview-thumb-wrap img { max-width: 100%; max-height: 100%; object-fit: contain; }
.preview-meta { font-size: var(--fs-12); }
.preview-meta .row { padding: 3px 0; border-bottom: 1px solid var(--c-surface-2); }
.preview-meta .row:last-child { border: none; }
.preview-meta .lbl { color: var(--c-text-muted); display: inline-block; min-width: 80px; }

section { margin-bottom: var(--s-5); }
section h3 { font-size: var(--fs-16); margin-bottom: var(--s-1); }

/* SVG container (DXF viewer) — czarne płótno */
.svg-container {
  width: 100%; height: calc(100vh - 240px); min-height: 600px;
  background: var(--dxf-canvas-bg);
  border: 0; border-radius: 0; overflow: hidden; position: relative;
}
.svg-container svg, .svg-container object {
  width: 100%; height: 100%; display: block; background: var(--dxf-canvas-bg);
}

/* Layout view grid */
.layout-view-grid {
  display: grid;
  grid-template-columns: var(--layout-aside-w) 5px minmax(0, 1fr);
  gap: 0; align-items: stretch; background: var(--dxf-canvas-bg);
}
.layout-view-grid > aside {
  background: var(--c-panel-cool); color: var(--c-text);
  padding: var(--s-2) var(--s-3); margin: 0;
  border-right: 1px solid var(--c-surface-3);
}
.layout-view-grid > aside table.compact,
.layout-view-grid > aside table.compact tr,
.layout-view-grid > aside table.compact td,
.layout-view-grid > aside table.compact th,
.layout-view-grid > aside table.compact tbody tr:nth-child(odd),
.layout-view-grid > aside table.compact tbody tr:nth-child(even) {
  background: transparent;
}
.layout-view-grid > .svg-container { margin: 0; }

/* Topbar — brand + nav */
.topbar { display: flex; align-items: center; gap: var(--s-4); }
.topbar .brand { display: flex; align-items: center; gap: var(--s-2); }
.topbar .brand strong { font-size: var(--fs-18); line-height: 1.1; }
.topbar .brand .subtitle { font-size: var(--fs-12); color: var(--c-text-muted); display: block; }
.topbar .nav-links { display: flex; gap: var(--s-2); align-items: center; margin-left: var(--s-6); }
.topbar .nav-links a {
  text-decoration: none; padding: var(--s-1) var(--s-3); border-radius: var(--r-sm);
  font-size: var(--fs-15); font-weight: var(--fw-medium); color: var(--c-text);
}
.topbar .nav-links a:hover { background: var(--c-surface-2); color: var(--c-text); }
.topbar .right { margin-left: auto; font-size: var(--fs-13); color: var(--c-text); display: flex; gap: var(--s-3); align-items: center; }

/* Badge przy nav linkach */
.nav-link-with-badge { display: inline-flex; align-items: center; gap: var(--s-1); }
.nav-badge {
  background: var(--c-red-500); color: #fff;
  border-radius: var(--r-full); padding: 1px var(--s-2);
  font-size: var(--fs-11); font-weight: var(--fw-bold);
  min-width: 1.25rem; text-align: center; line-height: 1.3;
}
.nav-badge-orange { background: var(--c-amber-500); color: #fff; }

/* Reload-banner */
#reload-banner {
  position: fixed; bottom: var(--s-4); right: var(--s-4);
  background: var(--c-amber-500); color: #fff;
  padding: var(--s-2) var(--s-4); border-radius: var(--r-md);
  box-shadow: var(--elev-pop); z-index: var(--z-toast); font-weight: var(--fw-semibold);
  animation: reload-banner-in .25s ease-out;
}
#reload-banner a { color: inherit; text-decoration: underline; }
@keyframes reload-banner-in { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Komentarze (partial _job_comments.html) */
.comments-header { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-2); }
.comments-header h3 { margin: 0; }
.ack-all-form { margin-left: auto; }
.comments-list { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-4); }
.comment {
  background: var(--c-surface-1);
  border: 1px solid var(--c-surface-3);
  border-left: 3px solid var(--c-blue-500);
  border-radius: var(--r-md); padding: var(--s-3) var(--s-4);
}
.comment.unack { border-left-color: var(--c-amber-500); background: var(--c-tint-amber); }
.comment-header { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-1); font-size: var(--fs-13); }
.comment-author strong { color: var(--c-text); }
.comment-new-badge {
  background: var(--c-amber-500); color: #fff;
  padding: 1px var(--s-1); border-radius: var(--r-xs);
  font-size: var(--fs-11); font-weight: var(--fw-bold); letter-spacing: .04em;
}
.comment-date { color: var(--c-text-muted); font-size: var(--fs-12); }
.comment-actions { margin-left: auto; display: flex; gap: var(--s-1); align-items: center; }
/* .comment-ack / .comment-delete usunięte — teraz .btn .btn--ghost/.btn--danger .btn--sm */
.comment-body { line-height: var(--lh-base); word-wrap: break-word; }
.comments-empty { color: var(--c-text-muted); font-style: italic; }
.comment-form { margin-top: var(--s-1); }
.comment-form textarea { width: 100%; font-size: var(--fs-13); resize: vertical; min-height: 70px; }

/* Font-scaler → wygląd segmented control */
.font-scaler {
  display: inline-flex; gap: 3px; background: var(--c-surface-0);
  border: 1px solid var(--c-surface-3); border-radius: var(--r-md); padding: 3px;
}
.font-scaler button {
  background: transparent; border: 1px solid transparent; color: var(--c-text-muted);
  padding: var(--s-1) var(--s-3); font-family: inherit; cursor: pointer;
  font-size: var(--fs-12); font-weight: var(--fw-medium);
  border-radius: var(--r-sm); min-height: 0; transition: all var(--dur-fast) var(--ease-out);
}
.font-scaler button:hover { background: transparent; color: var(--c-text); border-color: transparent; }
.font-scaler button.active { background: var(--c-surface-2); color: var(--c-text); border-color: var(--c-surface-3); }
.font-scaler .small { font-size: var(--fs-11); }
.font-scaler .large { font-size: var(--fs-15); }

/* Theme segmented control + help button */
.theme-seg { display: inline-flex; }
.theme-seg .seg__item { font-size: var(--fs-12); padding: 6px var(--s-2); }
.help-toggle {
  background: transparent; border: 1px solid var(--c-surface-3); border-radius: var(--r-md);
  cursor: pointer; padding: var(--s-1) var(--s-3); font-size: var(--fs-15);
  line-height: 1; color: var(--c-text); font-weight: var(--fw-bold);
  min-height: var(--hit-desktop); transition: background var(--dur-fast);
}
.help-toggle:hover { background: var(--c-surface-2); }

/* Logout icon */
.logout-icon {
  text-decoration: none; font-size: var(--fs-16); line-height: 1;
  padding: var(--s-1) var(--s-2); border-radius: var(--r-sm); color: var(--c-text);
  transition: background var(--dur-fast), color var(--dur-fast);
}
.logout-icon:hover { background: var(--c-tint-red); color: var(--c-red-500); }

/* Help modal */
#help-modal {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  display: none; align-items: flex-start; justify-content: center;
  padding: 4vh var(--s-4); overflow-y: auto;
}
#help-modal.active { display: flex; }
#help-modal .help-box {
  background: var(--c-surface-0); color: var(--c-text);
  border: 1px solid var(--c-surface-3); border-radius: var(--r-2xl);
  max-width: 760px; width: 100%; padding: var(--s-5) var(--s-6) var(--s-6);
  box-shadow: var(--elev-modal);
}
#help-modal .help-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--s-4); padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--c-surface-3);
}
#help-modal .help-header h2 { margin: 0; font-size: var(--fs-24); }
#help-modal .help-close {
  background: transparent; border: 0; cursor: pointer;
  font-size: 1.5rem; line-height: 1; padding: var(--s-1) var(--s-2);
  color: var(--c-text); border-radius: var(--r-sm); min-height: 0;
}
#help-modal .help-close:hover { background: var(--c-surface-2); }
#help-modal h3 {
  font-size: var(--fs-16); margin: var(--s-4) 0 var(--s-1);
  color: var(--c-text-link); border-bottom: 1px solid var(--c-surface-3);
  padding-bottom: var(--s-1);
}
#help-modal h3:first-of-type { margin-top: 0; }
#help-modal ul { margin: var(--s-1) 0 var(--s-2) 0; padding-left: var(--s-5); }
#help-modal li { margin: var(--s-1) 0; line-height: var(--lh-base); font-size: var(--fs-13); }
#help-modal kbd { font-size: var(--fs-12); }
#help-modal .key-icon { font-size: 1.1em; }

#help-modal .help-feature {
  display: grid; grid-template-columns: 220px 1fr; gap: var(--s-4);
  align-items: center; margin: var(--s-2) 0 var(--s-3);
  padding: var(--s-2) var(--s-3); background: var(--c-surface-1);
  border-left: 3px solid var(--c-blue-500); border-radius: var(--r-md);
}
#help-modal .help-feature-demo { display: flex; align-items: center; justify-content: center; min-height: 64px; }
#help-modal .help-feature-text { font-size: var(--fs-13); line-height: var(--lh-base); }
#help-modal .help-feature-text ul { padding-left: var(--s-4); margin: var(--s-1) 0 0; }
#help-modal .help-feature-text ul li { font-size: var(--fs-12); }

#help-modal .topbar-mockup {
  display: inline-flex; gap: var(--s-2); align-items: center;
  padding: var(--s-1) var(--s-2); background: var(--c-surface-0);
  border: 1px solid var(--c-surface-3); border-radius: var(--r-md); font-size: var(--fs-12);
}
#help-modal .topbar-mockup .nav-badge { font-size: var(--fs-11); padding: 1px var(--s-1); }
#help-modal .topbar-mockup .sep { color: var(--c-text-subtle); }

#help-modal .tree-mockup {
  background: var(--c-panel-cool); border: 1px solid var(--c-surface-3);
  border-radius: var(--r-md); padding: var(--s-1) var(--s-2); font-size: var(--fs-12); width: 195px;
}
#help-modal .tree-mockup details summary { cursor: default; font-weight: var(--fw-semibold); padding: 2px 0; list-style: none; }
#help-modal .tree-children-mock { padding-left: var(--s-2); border-left: 1px solid var(--c-surface-3); margin: var(--s-1) 0 0 3px; }
#help-modal .tree-mock-job {
  display: block; padding: 3px var(--s-2); color: var(--c-text); text-decoration: none;
  border-radius: var(--r-xs); font-size: var(--fs-12);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#help-modal .tree-mock-job.has-unack-demo {
  position: relative; padding-right: 22px; background: var(--c-tint-amber);
  border-left: 3px solid var(--c-amber-500); padding-left: 7px;
}
#help-modal .tree-mock-job.has-unack-demo::after {
  content: '●'; position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  color: var(--c-amber-500); font-size: .7rem; animation: pulse-dot 2s ease-in-out infinite;
}
#help-modal .autorefresh-icon { display: flex; flex-direction: column; align-items: center; gap: var(--s-1); color: var(--c-text-link); }
#help-modal .autorefresh-icon span { font-size: var(--fs-12); font-weight: var(--fw-semibold); letter-spacing: .03em; }
#help-modal .autorefresh-icon .clock-svg { animation: spin-slow 6s linear infinite; transform-origin: 50% 50%; }
@keyframes spin-slow { from { transform: rotate(0); } to { transform: rotate(360deg); } }
#help-modal .reload-banner-mock {
  background: var(--c-amber-500); color: #fff; padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md); font-weight: var(--fw-semibold); font-size: var(--fs-12);
  box-shadow: var(--elev-pop);
}
#help-modal .reload-banner-mock u { text-decoration: underline; }
#help-modal .comment-mockup {
  background: var(--c-tint-amber); border-left: 3px solid var(--c-amber-500);
  border-radius: var(--r-sm); padding: var(--s-2) var(--s-2); font-size: var(--fs-12); width: 195px;
}
#help-modal .comment-mockup .nowa-badge {
  background: var(--c-amber-500); color: #fff; padding: 1px var(--s-1);
  border-radius: var(--r-xs); font-size: var(--fs-11); font-weight: var(--fw-bold); letter-spacing: .04em;
}
#help-modal .comment-mockup .akceptuj-btn {
  display: inline-block; margin-top: var(--s-1); background: transparent;
  border: 1px solid var(--c-amber-500); color: var(--c-amber-500);
  padding: 2px var(--s-2); font-size: var(--fs-11); font-weight: var(--fw-semibold);
  border-radius: var(--r-xs); cursor: default; min-height: 0;
}

/* Splash overlay */
#splash-overlay {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: rgba(13,17,23,.92);
  display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--s-5); backdrop-filter: blur(3px);
}
#splash-overlay.active { display: flex; }
#splash-overlay .splash-title { font-size: var(--fs-24); color: #fff; font-weight: var(--fw-semibold); letter-spacing: .02em; }
#splash-overlay .splash-subtitle { font-size: var(--fs-14); color: var(--c-text-link-2); max-width: 480px; text-align: center; }
#splash-overlay .splash-progress-wrap {
  width: 360px; height: 8px; background: rgba(255,255,255,.1);
  border-radius: var(--r-xs); overflow: hidden; position: relative;
}
#splash-overlay .splash-progress-bar {
  height: 100%; width: 0%; background: var(--grad-primary);
  border-radius: var(--r-xs); transition: width .4s ease-out;
}
#splash-overlay .splash-percent { font-size: var(--fs-12); color: rgba(255,255,255,.7); font-variant-numeric: tabular-nums; }

/* Detail modal */
#detail-modal {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: rgba(0,0,0,.85);
  display: none; align-items: center; justify-content: center;
  padding: var(--s-8); backdrop-filter: blur(4px);
}
#detail-modal.active { display: flex; }
#detail-modal .modal-card {
  background: var(--c-surface-0); border: 1px solid var(--c-surface-3); border-radius: var(--r-2xl);
  max-width: 90vw; max-height: 90vh;
  display: grid; grid-template-columns: 1fr 320px;
  overflow: hidden; box-shadow: var(--elev-modal);
}
#detail-modal .modal-img {
  background: var(--dxf-canvas-bg); display: flex; align-items: center; justify-content: center;
  min-width: 600px; min-height: 500px; padding: var(--s-4);
}
#detail-modal .modal-img img { max-width: 100%; max-height: 85vh; object-fit: contain; }
#detail-modal .modal-img .empty { color: var(--c-text-subtle); font-size: var(--fs-13); }
#detail-modal .modal-meta { padding: var(--s-5); overflow-y: auto; max-height: 90vh; border-left: 1px solid var(--c-surface-3); }
#detail-modal .modal-meta h3 { margin: 0 0 var(--s-2) 0; color: var(--c-text-link); word-break: break-word; }
#detail-modal .modal-meta .row { padding: var(--s-1) 0; border-bottom: 1px solid var(--c-surface-2); font-size: var(--fs-13); }
#detail-modal .modal-meta .row:last-child { border: none; }
#detail-modal .modal-meta .lbl { color: var(--c-text-muted); display: inline-block; min-width: 90px; }
#detail-modal .modal-close {
  position: absolute; top: var(--s-4); right: var(--s-5);
  background: var(--c-surface-2); color: var(--c-text);
  border: 0; border-radius: 50%; width: 40px; height: 40px;
  font-size: 1.4rem; cursor: pointer; line-height: 1; padding: 0;
  transition: background var(--dur-fast); min-height: 0;
}
#detail-modal .modal-close:hover { background: var(--c-red-500); color: #fff; }
#detail-modal .modal-hint { position: absolute; bottom: var(--s-4); left: 50%; transform: translateX(-50%); color: rgba(255,255,255,.5); font-size: var(--fs-11); }
