/* ProSpectra AI – układ jak w Nozbe Classic: ciemny pasek nawigacji po lewej, jasny obszar roboczy,
   panel szczegółów zadania po prawej. */
/* Motyw domyślny: antracyt + szkło (jak w iOS). Jasny wariant włącza Ustawienia → Wygląd. */
:root {
  --side-bg: rgba(20, 21, 25, 0.55);
  --side-active: rgba(255, 255, 255, 0.07);
  --side-fg: #ececf0;
  --side-muted: #8d8f98;
  --side-line: rgba(255, 255, 255, 0.07);
  --bg: #121316;
  --bg-deep: #0c0d0f;
  --glow-1: rgba(48, 209, 88, 0.2);
  --glow-2: rgba(94, 120, 255, 0.2);
  --glow-3: rgba(191, 90, 242, 0.1);
  --surface: rgba(38, 40, 46, 0.55);
  --surface-strong: rgba(32, 34, 39, 0.82);
  --surface-solid: #202227;
  --input-bg: rgba(255, 255, 255, 0.05);
  --fg: #f2f2f5;
  --muted: #979aa4;
  --line: rgba(255, 255, 255, 0.08);
  --edge: rgba(255, 255, 255, 0.12);
  --sheen: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --accent: #30d158;
  --accent-ink: #5be27e;
  --accent-soft: rgba(48, 209, 88, 0.16);
  --on-accent: #06210f;
  --warn: #ffb340;
  --danger: #ff5f57;
  --star: #ffcc00;
  --hover: rgba(255, 255, 255, 0.06);
  --overlay: rgba(6, 7, 9, 0.5);
  --toast-bg: rgba(44, 46, 52, 0.86);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.25);
  --glass: saturate(170%) blur(24px);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI Variable Text', 'Segoe UI', Inter, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --radius: 12px;
  --radius-lg: 18px;
  color-scheme: dark;
}
:root[data-theme='light'] {
  --side-bg: rgba(246, 247, 250, 0.6); --side-active: rgba(20, 22, 30, 0.06); --side-fg: #1d1e22; --side-muted: #6f727c; --side-line: rgba(20, 22, 30, 0.08);
  --bg: #e8e9ee; --bg-deep: #dfe1e7; --glow-1: rgba(48, 199, 89, 0.16); --glow-2: rgba(94, 120, 255, 0.14); --glow-3: rgba(191, 90, 242, 0.08);
  --surface: rgba(255, 255, 255, 0.6); --surface-strong: rgba(255, 255, 255, 0.86); --surface-solid: #ffffff; --input-bg: rgba(20, 22, 30, 0.04);
  --fg: #1c1d21; --muted: #6c6f79; --line: rgba(20, 22, 30, 0.09); --edge: rgba(255, 255, 255, 0.7); --sheen: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  --accent: #28b14c; --accent-ink: #1d8a3a; --accent-soft: rgba(40, 177, 76, 0.14); --on-accent: #ffffff;
  --warn: #c77800; --danger: #d93a30; --star: #e9a800; --hover: rgba(20, 22, 30, 0.05); --overlay: rgba(30, 32, 40, 0.28);
  --toast-bg: rgba(30, 31, 36, 0.86); --shadow: 0 18px 50px rgba(30, 35, 50, 0.16), 0 2px 8px rgba(30, 35, 50, 0.08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; }
body { margin: 0; font: 15px/1.45 var(--font); color: var(--fg); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
svg.i { width: 24px; height: 24px; fill: currentColor; flex: none; }

/* ---------- Szkielet ---------- */
.app { display: grid; grid-template-columns: 300px 1fr; height: 100%; }
.side { background: var(--side-bg); color: var(--side-fg); display: flex; flex-direction: column; min-height: 0; }
.nav { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 18px; padding: 15px 16px; color: var(--side-fg);
  text-decoration: none; font-size: 17px; position: relative;
}
.nav a:hover { background: var(--side-active); }
.nav a[aria-current='page'] { background: var(--side-active); color: var(--accent); }
.nav .ico { position: relative; display: grid; place-items: center; width: 30px; color: var(--side-muted); }
.nav a[aria-current='page'] .ico { color: var(--accent); }
.nav .badge {
  position: absolute; top: -9px; right: -9px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--surface); color: var(--fg); font-size: 11px; font-weight: 600; display: grid; place-items: center;
  border: 2px solid var(--side-bg); font-variant-numeric: tabular-nums;
}
.nav .badge.dot { min-width: 10px; height: 10px; padding: 0; top: -6px; right: -4px; background: var(--warn); }
.nav .badge.warn { background: var(--warn); color: #1d1d1d; }
.nav .count { margin-left: auto; font-size: 13px; color: var(--side-muted); font-variant-numeric: tabular-nums; }

.side-foot { border-top: 1px solid var(--side-line); padding: 16px; display: grid; gap: 12px; font-size: 13px; color: var(--side-muted); }
.ws-switch { width: 100%; background: transparent; border: 1px solid var(--side-line); color: var(--side-fg); padding: 8px; border-radius: var(--radius); }
.ws-switch option { color: #111; }
.who { display: flex; align-items: center; gap: 10px; color: var(--side-fg); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center;
  font-weight: 600; font-size: 13px; flex: none;
}
.avatar.sm { width: 22px; height: 22px; font-size: 10px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.topbar {
  height: 58px; background: var(--surface); border-bottom: 1px solid var(--line); display: grid;
  grid-template-columns: 58px 1fr 58px; align-items: center; flex: none;
}
.topbar h1 { margin: 0; font-size: 17px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: none; border: 0; padding: 8px; display: grid; place-items: center; color: var(--fg); border-radius: var(--radius); }
.icon-btn:hover { background: var(--hover); }
.icon-btn.spin svg { animation: spin 0.8s linear; }
@keyframes spin { to { transform: rotate(360deg); } }
.menu-btn { display: none; }

.content { flex: 1; overflow-y: auto; min-height: 0; }
.view { max-width: 980px; margin: 0 auto; padding: 24px 24px 120px; }
.bottombar {
  height: 52px; border-top: 1px solid var(--line); background: var(--bg); display: flex; align-items: center;
  justify-content: flex-end; gap: 8px; padding: 0 12px; flex: none;
}
.quickadd { flex: 1; display: flex; gap: 8px; }
.quickadd input { flex: 1; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }

/* ---------- Stan pusty ---------- */
.empty { text-align: center; padding: 90px 16px 40px; color: var(--muted); }
.empty svg.i { width: 110px; height: 110px; color: #a8aaae; }
.empty p { margin: 14px 0 0; }
.btn {
  background: var(--surface); border: 1px solid var(--line); padding: 9px 20px; border-radius: var(--radius);
  font-weight: 500; color: var(--fg);
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(0.95); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.empty .btn { margin-top: 36px; font-size: 17px; }

/* ---------- Lista zadań ---------- */
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.list > li + li { border-top: 1px solid var(--line); }
.task { display: flex; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer; }
.task:hover { background: var(--hover); }
.task.active { background: var(--hover); box-shadow: inset 3px 0 0 var(--accent); }
.check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid #b9bbc0; background: transparent; flex: none; padding: 0;
  display: grid; place-items: center; color: transparent;
}
.check:hover { border-color: var(--accent); }
.check.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.check svg.i { width: 14px; height: 14px; }
.task .body { flex: 1; min-width: 0; }
.task .title { overflow-wrap: anywhere; }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: 12px; color: var(--muted); margin-top: 2px; align-items: center; }
.meta:empty { display: none; }
.meta span { display: inline-flex; align-items: center; gap: 4px; }
.meta svg.i { width: 14px; height: 14px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.chip { padding: 1px 8px; border-radius: 10px; font-size: 12px; color: #fff; }
.overdue { color: var(--danger) !important; }
.star { background: none; border: 0; padding: 4px; color: #c4c6ca; display: grid; }
.star.on { color: var(--star); }
.star svg.i { width: 20px; height: 20px; }

.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 24px 0 8px; font-weight: 600; }
.section-title:first-child { margin-top: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.toggle { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }

/* ---------- Karty list (projekty, kategorie, szablony, zespół) ---------- */
.rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.rows li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.rows li + li { border-top: 1px solid var(--line); }
.rows a.row-link { flex: 1; color: inherit; text-decoration: none; display: flex; gap: 12px; align-items: center; min-width: 0; }
.rows a.row-link:hover .name { color: var(--accent-ink); }
.rows .name { overflow-wrap: anywhere; }
.rows .sub { color: var(--muted); font-size: 13px; }
.rows .num { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.swatch { width: 14px; height: 14px; border-radius: 3px; flex: none; }

/* ---------- Panel zadania ---------- */
.panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: var(--surface);
  border-left: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; z-index: 20;
}
.panel-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.panel-head .grow { flex: 1; }
.panel-body { overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; flex: 1; min-height: 0; }
.panel-body > * { flex: none; min-width: 0; max-width: 100%; }
.panel textarea.title-edit { font-size: 18px; font-weight: 600; border: 0; resize: none; padding: 4px 0; background: transparent; width: 100%; }
.field { display: grid; grid-template-columns: 120px 1fr; gap: 8px; align-items: center; font-size: 14px; }
.field > label { color: var(--muted); }
.field input, .field select, textarea.notes, .form input, .form select, .card select, .chat-select {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg);
}
textarea.notes { min-height: 90px; resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-toggle { border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 2px 10px; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.chip-toggle.on { border-color: currentColor; font-weight: 600; }
.psection { border-top: 1px solid var(--line); padding-top: 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.psection h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

.comment { display: flex; gap: 10px; }
.comment .c-body { flex: 1; min-width: 0; background: var(--bg); border-radius: var(--radius); padding: 8px 10px; }
.comment .c-head { font-size: 12px; color: var(--muted); display: flex; gap: 8px; }
.comment .c-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.inline-form { display: flex; gap: 8px; }
.inline-form textarea, .inline-form input { flex: 1; padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); min-width: 0; }

.file { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.file a { color: var(--accent-ink); overflow-wrap: anywhere; flex: 1; min-width: 0; }
.file .size { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }
.dropzone.over { border-color: var(--accent); color: var(--accent-ink); }
.dropzone { display: grid; gap: 6px; justify-items: center; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { width: 84px; height: 84px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg); cursor: zoom-in; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.modal:has(.file-preview) { width: min(960px, 100%); }
.file-preview { max-height: 75vh; overflow: auto; }
.file-preview img { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.file-preview iframe { width: 100%; height: 70vh; border: 0; background: #fff; }
.file-preview pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; margin: 0; }
.ai-actions { display: grid; gap: 8px; margin-top: 10px; }
.ai-action { display: flex; gap: 10px; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; background: var(--surface); }
.ai-action.done, .ai-action.skipped { opacity: .65; }
.ai-action-text { min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.ai-action-btns { display: flex; gap: 6px; flex-shrink: 0; }
@media (max-width: 760px) { .ai-action { flex-direction: column; align-items: stretch; } }
.share-box { background: var(--bg); padding: 8px; border-radius: var(--radius); font-size: 12px; display: grid; gap: 6px; }
.share-box input { width: 100%; font-size: 12px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }

/* ---------- Kalendarz ---------- */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-head h2 { margin: 0; font-size: 18px; flex: 1; text-transform: capitalize; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--line); gap: 1px; border: 1px solid var(--line); }
.cal .dow { background: var(--surface); padding: 6px; font-size: 12px; color: var(--muted); text-align: center; font-weight: 600; }
.cal .day { background: var(--surface); min-height: 96px; padding: 4px 6px; font-size: 12px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; }
.cal .day.other { background: var(--bg); color: var(--muted); }
.cal .day.today .n { background: var(--accent); color: #fff; border-radius: 10px; padding: 0 6px; }
.cal .n { align-self: flex-end; font-variant-numeric: tabular-nums; }
.cal .ev { background: var(--hover); border-left: 3px solid var(--accent); padding: 1px 4px; border-radius: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .ev.done { text-decoration: line-through; color: var(--muted); }

/* ---------- Aktualności / komentarze ---------- */
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.feed li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 12px; }
.feed li.unread { box-shadow: inset 3px 0 0 var(--warn); }
.feed .f-body { flex: 1; min-width: 0; }
.feed .f-when { color: var(--muted); font-size: 12px; }
.feed a { color: var(--accent-ink); cursor: pointer; }

/* ---------- Ustawienia ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; margin-bottom: 16px; }
.card h2 { margin: 0; font-size: 16px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }
.form { display: grid; gap: 10px; max-width: 420px; }
.switch-row { display: flex; align-items: center; gap: 10px; }
.switch-row .sub { color: var(--muted); font-size: 13px; }

/* ---------- Logowanie ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: var(--side-bg); }
.auth-box { background: var(--surface); width: min(400px, 100%); padding: 28px; border-radius: 6px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.auth-box h1 { margin: 0; font-size: 24px; display: flex; gap: 10px; align-items: center; }
.auth-box h1 svg.i { color: var(--accent); width: 30px; height: 30px; }
.auth-box .form { max-width: none; }
.auth-box .switch { background: none; border: 0; color: var(--accent-ink); padding: 0; text-align: left; }
.error { color: var(--danger); font-size: 14px; min-height: 1em; }

/* ---------- Modal / toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 16, 18, 0.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border-radius: 6px; width: min(420px, 100%); padding: 20px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.modal h2 { margin: 0; font-size: 17px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; }
.toast {
  position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%); background: #26272b; color: #fff; padding: 10px 16px;
  border-radius: 6px; z-index: 60; font-size: 14px; box-shadow: var(--shadow); max-width: calc(100% - 32px);
}

/* ---------- Telefon ---------- */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 85%); z-index: 40; transform: translateX(-100%); transition: transform 0.2s; }
  .app.nav-open .side { transform: none; box-shadow: var(--shadow); }
  .menu-btn { display: grid; }
  .view { padding: 16px 16px 120px; }
  .field { grid-template-columns: 1fr; gap: 4px; }
  .cal .day { min-height: 64px; }
  .cal .ev { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.topbar > div { display: flex; align-items: center; }
.topbar > div:last-child { justify-content: flex-end; padding-right: 6px; }
.switch-row select { width: auto; }

/* ---------- Flagi ---------- */
.flags { display: inline-flex; gap: 2px; align-items: center; }
.flag { display: inline-grid; place-items: center; }
.meta .flag svg.i, .rows .flag svg.i, summary .flag svg.i { width: 16px; height: 16px; }
.rows .flags { margin-left: 4px; }
.flag-editor { display: grid; gap: 8px; }
.flag-group { display: grid; gap: 4px; }
.flag-group-name { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.flag-toggle svg.i { width: 15px; height: 15px; }
.flag-toggle span { color: var(--fg); }
.flag-toggle.on { background: var(--surface); box-shadow: inset 0 0 0 1px currentColor; }
.field-top { align-items: start; }
.project-flags { padding: 10px 14px; gap: 10px; }
.project-flags summary { cursor: pointer; display: flex; gap: 10px; align-items: center; font-weight: 600; }
.toggle select { padding: 4px 6px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--fg); }
.toggle svg.i { width: 16px; height: 16px; }

/* ---------- Asystent AI ---------- */
.chat { display: grid; gap: 12px; }
.bubble { max-width: 85%; padding: 10px 12px; border-radius: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.user { justify-self: end; background: var(--accent); color: #fff; border-bottom-right-radius: 2px; }
.bubble.assistant { justify-self: start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 2px; }
.bubble.pending { color: var(--muted); font-style: italic; }
.bubble-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.chat-input { position: sticky; bottom: 0; background: var(--bg); padding-top: 12px; display: grid; gap: 8px; }
.chat-input .inline-form textarea { min-height: 44px; resize: vertical; }
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.suggestions button { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 4px 12px; font-size: 13px; }
.suggestions button:hover { border-color: var(--accent); }
.ai-meta { font-size: 12px; color: var(--muted); }
.ai-answer { background: var(--bg); border-radius: var(--radius); padding: 8px 10px; white-space: pre-wrap; font-size: 14px; overflow-wrap: anywhere; }

/* ---------- Administracja ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 2px; }
.stat strong { font-size: 26px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.warn strong { color: var(--warn); }
.stat.bad strong { color: var(--danger); }
.toolbar .grow input { width: 100%; max-width: 380px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.user-cell { flex: 1; min-width: 0; display: grid; gap: 2px; }
.user-cell .chips:empty { display: none; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 1px 8px; border-radius: 10px; border: 1px solid currentColor; }
.pill svg.i { width: 13px; height: 13px; }
.pill.admin { color: var(--accent-ink); }
.pill.warn { color: var(--warn); }
.pill.bad { color: var(--danger); }
.muted-row { opacity: 0.6; }
.rows .when { margin-left: 0; min-width: 120px; text-align: right; }
.modal .actions { flex-wrap: wrap; }
.creds { width: 100%; font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 13px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); resize: none; }
.auth-hint { margin: 0; color: var(--muted); font-size: 14px; }
.sub { color: var(--muted); font-size: 13px; margin: 0; }
@media (max-width: 760px) {
  .rows .when { display: none; }
}
.project-portal { padding: 10px 14px; gap: 10px; }
.project-portal summary { cursor: pointer; display: flex; gap: 10px; align-items: center; font-weight: 600; }
.project-portal .rows li { padding: 10px 12px; }

/* ---------- Kody QR i skaner ---------- */
.qr-preview { display: grid; gap: 12px; justify-items: center; }
.qr-label { display: flex; gap: 12px; align-items: center; border: 1px dashed var(--line); border-radius: 6px; padding: 10px 12px; background: #fff; color: #111; width: 100%; max-width: 360px; }
.qr-label svg.qr { flex: none; width: 112px; height: 112px; }
.qr-text { display: grid; gap: 2px; min-width: 0; }
.qr-text strong { font-size: 15px; overflow-wrap: anywhere; }
.qr-text span, .qr-text small { color: #555; font-size: 12px; }
.scanner { display: grid; gap: 14px; max-width: 520px; margin: 0 auto; }
.scan-frame { position: relative; aspect-ratio: 1; max-width: 100%; background: #111; border-radius: 10px; overflow: hidden; display: grid; place-items: center; }
.scan-video { width: 100%; height: 100%; object-fit: cover; }
.scan-target { position: absolute; inset: 18%; border: 3px solid var(--accent); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35); }
.btn svg.i { width: 18px; height: 18px; vertical-align: -4px; }
.print-sheet { display: none; }
@media print {
  @page { size: A4; margin: 10mm; }
  body.printing > *:not(.print-sheet) { display: none !important; }
  body.printing .print-sheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6mm; }
  body.printing .qr-label { break-inside: avoid; border: 1px dashed #999; max-width: none; }
  body.printing { background: #fff; }
}

/* ---------- Budżet AI ---------- */
.budget-meter { display: grid; gap: 8px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.budget-head strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.budget-meter .bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.budget-meter .bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.budget-meter.warn .bar span { background: var(--warn); }
.budget-meter.bad .bar span { background: var(--danger); }
.price-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) 1fr 1fr 40px; gap: 6px 10px; align-items: center; margin-top: 8px; }
.price-grid span { overflow-wrap: anywhere; font-size: 13px; }
.price-grid input { min-width: 0; }
.price-grid .btn { padding-inline: 6px; }
.price-add { grid-template-columns: minmax(0, 1.6fr) 1fr 1fr auto; margin-bottom: 6px; }
.rows.compact li { padding: 8px 12px; }
.rows .grow { flex: 1; min-width: 0; }
.budget-table + .budget-table { margin-top: 4px; }

/* ---------- Odczyt dokumentów ---------- */
.ocr-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0; padding: 10px 12px; background: var(--hover); border-radius: var(--radius); font-size: 14px; }
.ocr-facts dt { color: var(--muted); }
.ocr-facts dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.check-row { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check-row input { margin-top: 3px; flex: none; width: auto; }
@media (max-width: 480px) { .ocr-facts { grid-template-columns: minmax(0, 1fr); } .ocr-facts dd { margin-bottom: 6px; } }

/* ---------- Przesyłki ---------- */
.ship { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.ship + .ship, .ship-group .ship + .ship { margin-top: 8px; }
.ship-head > * { min-width: 0; }
.ship-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ship-head svg.i { width: 18px; height: 18px; color: var(--muted); }
.ship-head .num { font-variant-numeric: tabular-nums; font-size: 13px; overflow-wrap: anywhere; color: var(--accent-ink); }
.ship-head .ship-pill { margin-left: auto; }
.ship-pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--hover); color: var(--muted); white-space: nowrap; }
.ship-pill.delivered { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-ink); }
.ship-pill.out_for_delivery, .ship-pill.ready_pickup { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--fg); }
.ship-pill.exception, .ship-pill.returned { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.ship-last { font-size: 13px; overflow-wrap: anywhere; }
.ship-error { font-size: 13px; color: var(--danger); }
.ship-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ship select { width: auto; max-width: 100%; padding: 5px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--fg); font-size: 13px; }
.ship-events summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.ship-events ol { margin: 6px 0 0; padding-left: 18px; font-size: 13px; display: grid; gap: 2px; }
.ship-events .when { color: var(--muted); font-variant-numeric: tabular-nums; }
.ship-form { margin-top: 8px; }
.ship-form select { width: auto; flex: none; padding: 5px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--fg); }
.ship-task a { color: inherit; font-weight: 600; }
.ship-group + .ship-group { margin-top: 18px; }
.ship-task { font-size: 14px; }
.ship-meta { display: inline-flex; align-items: center; gap: 3px; }
.ship-meta.delivered { color: var(--accent-ink); }
.ship-meta.exception, .ship-meta.returned { color: var(--danger); }
.ship-meta.out_for_delivery, .ship-meta.ready_pickup { color: var(--warn); }
.bad-text { color: var(--danger); }

/* ---------- Raport wąskich gardeł ---------- */
.stage-bars { display: grid; gap: 10px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.stage-row { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr) minmax(0, 8rem); gap: 12px; align-items: center; font-size: 14px; }
.stage-track { position: relative; height: 12px; }
.stage-track::before { content: ''; position: absolute; inset: 5px 0; height: 2px; background: var(--line); border-radius: 1px; }
.stage-bar { position: absolute; left: 0; top: 0; bottom: 0; min-width: 4px; background: var(--accent); border-radius: 0 4px 4px 0; }
.stage-p90 { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--muted); border-radius: 1px; }
.stage-value { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
@media (max-width: 560px) { .stage-row { grid-template-columns: minmax(0, 1fr) auto; } .stage-track { grid-column: 1 / -1; grid-row: 2; } }
.rows .grow > a { color: var(--fg); text-decoration: none; font-weight: 500; }
.rows .grow > a:hover { text-decoration: underline; }

/* =====================================================================
   Premium: antracyt + szkło. Warstwa nadpisań nad bazowym układem –
   tło z miękkimi poświatami, półprzezroczyste panele z rozmyciem (backdrop-filter),
   zaokrąglenia i cienie w stylu iOS.
   ===================================================================== */
html { background: var(--bg-deep); }
body {
  background:
    radial-gradient(1100px 760px at 88% -12%, var(--glow-2), transparent 62%),
    radial-gradient(900px 700px at -8% 108%, var(--glow-1), transparent 60%),
    radial-gradient(700px 520px at 46% 52%, var(--glow-3), transparent 70%),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.006em;
}
* { scrollbar-width: thin; scrollbar-color: var(--edge) transparent; }
::selection { background: var(--accent-soft); }

/* Szkło: wspólny wygląd paneli i kart */
.side, .topbar, .bottombar, .list, .rows, .card, .feed li, .stat, .ship, .stage-bars, .budget-meter,
.bubble.assistant, .chat-input, .cal, .demo-note {
  background: var(--surface);
  -webkit-backdrop-filter: var(--glass);
  backdrop-filter: var(--glass);
  border: 1px solid var(--line);
  box-shadow: var(--sheen);
}
.panel, .modal, .auth-box, .toast {
  background: var(--surface-strong);
  -webkit-backdrop-filter: var(--glass);
  backdrop-filter: var(--glass);
  border: 1px solid var(--edge);
  box-shadow: var(--shadow), var(--sheen);
}
.list, .rows, .card, .feed li, .stat, .ship, .stage-bars, .budget-meter, .cal { border-radius: var(--radius-lg); }
.list, .rows { overflow: hidden; }
.card { padding: 18px 20px; }

/* Pasek boczny */
.side { border-width: 0 1px 0 0; border-radius: 0; }
.nav { padding: 10px; display: grid; gap: 2px; align-content: start; }
.nav a { border-radius: 12px; padding: 11px 14px; gap: 14px; font-size: 15.5px; font-weight: 500; transition: background 0.15s; }
.nav a:hover { background: var(--hover); }
.nav a[aria-current='page'] { background: var(--side-active); color: var(--side-fg); box-shadow: var(--sheen); }
.nav .ico { width: 26px; }
.nav .ico svg.i { width: 22px; height: 22px; }
.nav .badge { background: var(--danger); color: #fff; border: 0; box-shadow: 0 0 0 2px var(--bg-deep); top: -7px; right: -8px; min-width: 18px; height: 18px; font-size: 10.5px; }
.nav .badge.dot { background: var(--warn); }
.nav-group { margin-top: 6px; }
.nav-group:first-child { margin-top: 0; }
.nav-group-btn { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 8px 14px 4px; background: none; border: 0; cursor: pointer;
  color: var(--side-muted); font: inherit; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.nav-group-btn:hover { color: var(--side-fg); }
.nav-group-btn svg.i { width: 18px; height: 18px; transition: transform 0.15s; }
.nav-group-btn[aria-expanded='false'] svg.i { transform: rotate(-90deg); }
.nav li[hidden] { display: none; }
.section-tabs { margin-bottom: 12px; }
.section-tabs a.btn { text-decoration: none; }
.side-foot { border-top-color: var(--side-line); }
.ws-switch { border-radius: 10px; background: var(--input-bg); border-color: var(--line); }
option { background: var(--surface-solid); color: var(--fg); }

/* Górny i dolny pasek */
.topbar { border-width: 0 0 1px; border-radius: 0; position: relative; z-index: 5; }
.topbar h1 { font-size: 16px; letter-spacing: -0.01em; }
.bottombar { border-width: 1px 0 0; border-radius: 0; background: var(--surface); }
.icon-btn { border-radius: 10px; color: var(--fg); }
.icon-btn:hover { background: var(--hover); }

/* Przyciski */
.btn { background: var(--input-bg); border: 1px solid var(--line); border-radius: 10px; color: var(--fg); font-weight: 500; transition: background 0.15s, transform 0.1s; }
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(0.98); }
.btn.primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, #fff), var(--accent));
  border-color: transparent; color: var(--on-accent); font-weight: 600;
  box-shadow: 0 6px 18px var(--accent-soft), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.btn.primary:hover { filter: brightness(1.05); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, #fff), var(--accent)); }
.btn.danger { color: var(--danger); }

/* Pola formularzy */
.field input, .field select, textarea.notes, .form input, .form select, .card select, .chat-select, .inline-form textarea, .inline-form input,
.quickadd input, .toggle select, .toolbar > select, .toolbar > input[type=search], .pick-row input.rate, .share-box input, .ship select, .ship-form select, .form textarea, .card textarea {
  background: var(--input-bg); border: 1px solid var(--line); border-radius: 10px; color: var(--fg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
:is(input, select, textarea):focus { outline: none; border-color: color-mix(in srgb, var(--accent) 70%, transparent); box-shadow: 0 0 0 3px var(--accent-soft); }
::placeholder { color: var(--muted); opacity: 0.8; }
.panel textarea.title-edit { background: transparent; border: 0; box-shadow: none; font-size: 20px; letter-spacing: -0.015em; }
.chip-toggle { background: var(--input-bg); border-color: var(--line); border-radius: 999px; padding: 3px 11px; }
.flag-toggle.on { background: var(--surface-strong); }

/* Lista zadań */
.task { padding: 11px 14px; transition: background 0.12s; }
.task:hover { background: var(--hover); }
.task.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.check { border-color: color-mix(in srgb, var(--muted) 75%, transparent); }
.check.on { color: var(--on-accent); }
.star { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.star.on { color: var(--star); }
.avatar { color: var(--on-accent); background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent)); }
.chip { border-radius: 999px; padding: 1px 9px; }
.empty svg.i { color: var(--muted); opacity: 0.45; }
.section-title { color: var(--muted); letter-spacing: 0.08em; }

/* Panel zadania: unosząca się karta jak arkusz w iOS */
.panel { border-radius: 22px; }
@media (min-width: 761px) {
  .panel { top: 10px; right: 10px; bottom: 10px; width: min(440px, calc(100% - 20px)); }
}
.panel-head { border-bottom-color: var(--line); padding: 12px 14px; }
.psection { border-top-color: var(--line); }
.comment .c-body, .ai-answer, .share-box { background: var(--input-bg); border-radius: 12px; }
.dropzone { border-color: var(--edge); border-radius: 14px; }

/* Okna, toast, logowanie */
.overlay { background: var(--overlay); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal { border-radius: 22px; padding: 22px; }
.toast { background: var(--toast-bg); color: #fff; border-radius: 14px; border-color: rgba(255, 255, 255, 0.1); }
.auth { background: transparent; }
.auth-box { border-radius: 24px; padding: 32px; }

/* Pozostałe widoki */
.cal { gap: 0; overflow: hidden; }
.cal .dow, .cal .day { background: transparent; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal .day.other { background: var(--hover); }
.cal .day.today .n { color: var(--on-accent); }
.cal .ev { border-radius: 4px; }
.bubble { border-radius: 16px; }
.bubble.user { color: var(--on-accent); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, #fff), var(--accent)); }
.chat-input { border-radius: var(--radius-lg); padding: 12px; bottom: 12px; }
.suggestions button { background: var(--input-bg); border-color: var(--line); border-radius: 999px; }
.stat strong { letter-spacing: -0.02em; }
.stat strong.long { font-size: 20px; white-space: nowrap; }
.ship-pill { border-radius: 999px; }
.stage-track::before { background: var(--line); }

/* Telefon: menu jako wysuwana tafla szkła */
@media (max-width: 760px) {
  .side { background: var(--surface-strong); border-radius: 0 22px 22px 0; }
  .panel { border-radius: 0; border-width: 0; }
}
/* Ikony flag mają kolory dobrane do jasnego tła – na antracycie lekko je rozjaśniamy. */
:root:not([data-theme]) .flag, :root:not([data-theme]) .flag-toggle svg.i { filter: brightness(1.45) saturate(1.15); }

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --surface: var(--surface-solid); --surface-strong: var(--surface-solid); }
}

/* ---------- Marka: ProSpectra AI by pro4IT ---------- */
.brand { display: grid; gap: 4px; }
.brand-name { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.02em; color: var(--fg); }
.brand-name svg.i { color: var(--accent); flex-shrink: 0; }
.brand-name b { color: var(--accent); font-weight: 800; }
.brand-by { display: flex; align-items: baseline; gap: 6px; font-size: 11px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.brand.lg .brand-name { font-size: 26px; }
.brand.lg .brand-name svg.i { width: 32px; height: 32px; }
.brand.lg .brand-by { padding-left: 42px; }
.brand.lg .pro4it { font-size: 20px; }
.side-brand { padding: 18px 18px 10px; border-bottom: 1px solid var(--side-line); }
.side-brand .brand-name { font-size: 18px; color: var(--side-fg, var(--fg)); }
.side-brand .brand-name svg.i { width: 24px; height: 24px; }
.side-brand .brand-by { padding-left: 34px; color: var(--side-muted, var(--muted)); }
.side-brand .pro4it { font-size: 15px; }

/* Logo pro4IT: cienkie „pro” z kreską nad, zielona „4”, pogrubione „IT” w kolorze tekstu motywu */
.pro4it { display: inline-flex; align-items: baseline; font-family: var(--font); line-height: 1; letter-spacing: -0.02em; text-transform: none; white-space: nowrap; }
.p4-pro { position: relative; font-weight: 300; color: var(--muted); }
.p4-pro::before { content: ''; position: absolute; left: 0; top: -0.22em; width: 1.25em; height: max(1px, 0.06em); background: currentColor; opacity: 0.7; }
.p4-4 { font-weight: 800; color: var(--accent); margin-left: 0.02em; }
.p4-it { font-weight: 800; color: var(--fg); }
.side .p4-it { color: var(--side-fg, var(--fg)); }
.field .field-hint { grid-column: 2; font-size: 12px; }
.ops-grid { display: grid; gap: 8px; }
.error-row { display: grid; gap: 2px; }
.error-row code { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.error-row details pre { white-space: pre-wrap; font-size: 11px; max-height: 240px; overflow: auto; margin: 6px 0 0; }

/* Asystent: rozmowy, załączniki, dyktowanie */
.chat-bar { flex-wrap: wrap; gap: 8px; }
.chat-select { flex: 1 1 220px; min-width: 0; max-width: 100%; }
.chat-files { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-files:empty { display: none; }
.file-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; overflow-wrap: anywhere; }
.file-chip .icon-btn { width: 22px; height: 22px; }
.chat-attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chat-thumb { max-width: 160px; max-height: 120px; border-radius: var(--radius); display: block; object-fit: cover; }
.bubble.failed { border: 1px solid var(--danger); }
.btn.mic.on { background: var(--danger); color: #fff; border-color: transparent; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .6; } }

/* Podzadania */
.cl-progress { height: 6px; }
.cl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.cl-item { display: flex; align-items: flex-start; gap: 10px; padding: 6px 4px; border-radius: var(--radius); }
.cl-item:hover { background: var(--side-active, rgba(127,127,127,.08)); }
.cl-item input[type=checkbox] { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }
.cl-item.done .cl-text { text-decoration: line-through; color: var(--muted); }
.cl-item.dragging { opacity: .4; }
.cl-item.drop { box-shadow: inset 0 2px 0 var(--accent); }
.cl-body { flex: 1; min-width: 0; }
.cl-text { cursor: text; overflow-wrap: anywhere; font-size: 14px; }
.cl-edit { width: 100%; font-size: 14px; }
.cl-meta { display: flex; gap: 10px; font-size: 12px; color: var(--muted); }
.cl-meta span { display: inline-flex; align-items: center; gap: 3px; }
.cl-meta svg.i { width: 13px; height: 13px; }
.cl-meta .overdue { color: var(--danger); }
.cl-item .icon-btn { opacity: .6; }
.cl-tools { flex-wrap: wrap; gap: 6px; }
.cl-alldone { background: var(--accent-soft); color: var(--accent-ink); padding: 8px 10px; border-radius: var(--radius); font-size: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cl-complete { color: var(--accent-ink); }
.tpl-list { max-height: 60vh; overflow: auto; }
.tpl-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tpl-row .sub { font-size: 12px; }
.cl-progress { border-radius: 4px; background: var(--line); overflow: hidden; }
.cl-progress span { display: block; height: 100%; background: var(--accent); transition: width .2s; }

/* Tablica: tydzień i Kanban */
.board-bar { flex-wrap: wrap; gap: 8px; align-items: center; }
.board-bar .seg { display: inline-flex; gap: 4px; align-items: center; }
.board-range { margin: 4px 0 10px; }
.board { display: grid; grid-auto-flow: column; gap: 10px; overflow-x: auto; padding-bottom: 8px; align-items: start; scroll-snap-type: x proximity; }
.board.week { grid-auto-columns: minmax(170px, 1fr); }
.board.kanban { grid-auto-columns: minmax(230px, 1fr); }
.bcol { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; display: grid; grid-template-rows: auto 1fr; min-height: 180px; scroll-snap-align: start; }
.bcol.today { border-color: var(--accent); }
.bcol.over { box-shadow: 0 0 0 2px var(--accent); }
.bcol-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px 6px; font-size: 13px; text-transform: capitalize; }
.bcol-head .count { color: var(--muted); font-variant-numeric: tabular-nums; }
.bcol-body { display: grid; gap: 6px; padding: 6px 8px 10px; align-content: start; }
.bcol-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 14px 0; border: 1px dashed var(--line); border-radius: 10px; }
.bcard { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: grab; display: grid; gap: 4px; font-size: 13px; }
.bcard:hover { border-color: var(--accent); }
.bcard.dragging { opacity: .4; }
.bcard.done .bcard-title { text-decoration: line-through; color: var(--muted); }
.bcard-title { overflow-wrap: anywhere; display: flex; gap: 4px; align-items: flex-start; }
.bcard-title svg.i { width: 14px; height: 14px; color: #f5b400; flex-shrink: 0; margin-top: 2px; }
.bcard-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; }
.bcard-meta span { display: inline-flex; align-items: center; gap: 3px; }
.bcard-meta svg.i { width: 12px; height: 12px; }
.bcard-meta .overdue { color: var(--danger); }
.card-move { display: none; font-size: 12px; padding: 4px; }
@media (hover: none), (max-width: 760px) {
  .card-move { display: block; width: 100%; }
  .board.week, .board.kanban { grid-auto-columns: 82%; }
}

/* Znajdź: trafienia w plikach */
.file-hits li { cursor: pointer; align-items: flex-start; }
.file-hits .file-ico { color: var(--muted); padding-top: 2px; }
.snippet { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.45; word-break: break-word; }
.snippet mark { background: var(--accent-soft); color: var(--fg); border-radius: 3px; padding: 0 2px; }
pre.file-text { white-space: pre-wrap; max-height: 50vh; overflow: auto; font-size: 13px; background: var(--input-bg); border: 1px solid var(--line); padding: 12px; border-radius: 8px; }

/* Propozycje asystenta: wybór, które zapisać */
.ai-action .ai-pick { flex-shrink: 0; width: 18px; height: 18px; accent-color: var(--accent); align-self: flex-start; margin-top: 2px; }
.ai-action .ai-action-text { flex: 1; }
.ai-action.unpicked { opacity: .55; }
.ai-sub { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 2px; font-size: 13px; }
.ai-sub .check-row { padding: 2px 0; }
.ai-bulk { flex-wrap: wrap; gap: 6px; }
@media (max-width: 760px) { .ai-action .ai-pick { align-self: flex-start; } }

/* Raport projektów */
.table-wrap { overflow-x: auto; margin: 12px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.report-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.report-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.report-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.report-table tr:last-child td { border-bottom: 0; }
.report-table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.report-table tr.muted { opacity: .6; }
.mini-bar { display: block; width: 56px; height: 4px; margin: 4px 0 0 auto; border-radius: 2px; background: var(--line); overflow: hidden; }
.mini-bar span { display: block; height: 100%; background: var(--accent); }

/* Wynajem */
.seg { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.rental-tabs { margin-bottom: 12px; }
.rental-head { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 12px; }
.rental-head h2 { margin: 0 0 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rental-notes { white-space: pre-wrap; color: var(--muted); font-size: 14px; }
.stat.clickable { cursor: pointer; }
.stat.clickable:hover { border-color: var(--edge); }
.pay-rows li, .rows li { flex-wrap: wrap; }
.pay-amount { display: grid; text-align: right; font-variant-numeric: tabular-nums; min-width: 90px; }
.row-actions { display: flex; gap: 4px; align-items: center; }
.rental-form { max-width: none; }
.rental-form.wide { min-width: 0; }
.rf { display: grid; gap: 4px; font-size: 14px; align-content: start; }
.rf > span { color: var(--muted); font-size: 13px; }
.rf textarea { width: 100%; }
.rf-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick-list { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.pick-row { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.pick-row:last-child { border-bottom: 0; }
.pick-row .rate { width: 90px; text-align: right; }
.modal .rental-form input, .modal .rental-form select, .modal .rental-form textarea { width: 100%; box-sizing: border-box; }
.modal .pick-row input[type=checkbox] { width: auto; }
@media (max-width: 760px) { .rf-2 { grid-template-columns: 1fr; } .rental-form.wide { min-width: 0; } .pay-amount { text-align: left; } }
.modal:has(.rental-form) { width: min(620px, 100%); max-height: 90vh; overflow: auto; }
.modal .pick-row input.rate { width: 96px; flex: none; }
.toolbar > select, .toolbar > input[type=search] { padding: 6px 10px; min-height: 32px; }
.toolbar > input[type=search] { flex: 1; min-width: 180px; max-width: 360px; }
.board.kanban { grid-auto-columns: minmax(190px, 1fr); }
.board.kanban .bcol-head { text-transform: none; }
@media (hover: none), (max-width: 760px) { .board.kanban { grid-auto-columns: 82%; } }
@media (max-width: 760px) { .pay-rows li > .grow, .rows li > .grow { flex-basis: 100%; } .pay-rows li { gap: 8px; } }

/* Wzmianki @ */
.mention-wrap { position: relative; display: grid; flex: 1; min-width: 0; }
.mention-box { position: absolute; left: 0; top: 100%; z-index: 40; min-width: 220px; margin-top: 4px; background: var(--surface-solid); border: 1px solid var(--edge); border-radius: 12px; box-shadow: var(--shadow); padding: 4px; }
.mention-box[hidden] { display: none; }
.mention-item { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.mention-item.active, .mention-item:hover { background: var(--hover); }
.mention { color: var(--accent-ink); font-weight: 600; }

/* Bezpieczeństwo */
pre.codes { font-size: 17px; letter-spacing: .08em; line-height: 1.8; padding: 12px 16px; background: var(--input-bg); border: 1px solid var(--line); border-radius: 10px; columns: 2; text-align: center; }
.alert-list { display: grid; gap: 4px; }
.sec-log td { font-size: 13px; }
.project-people { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: -4px 0 12px; }
/* Wynajem: klient (firma / osoba), adres wysyłki, stali klienci, import sprzętu, wzór umowy */
.ship-box { border-left: 3px solid var(--line); padding-left: 10px; display: grid; gap: 8px; }
.rf-2.rf-end { align-items: end; }
.rf-fav { align-self: end; padding-bottom: 8px; }
.modal .rental-form .check-row input[type=checkbox] { width: auto; }
.icon-btn.fav { color: var(--muted); padding: 4px; opacity: .55; }
.icon-btn.fav.on { color: var(--warn); opacity: 1; }
.icon-btn.fav.on svg { fill: currentColor; }
.import-row { display: grid; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.import-row:last-child { border-bottom: 0; }
.rental-form textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.45; }
.btn.link { background: none; border: 0; padding: 0 2px; color: var(--accent-ink); text-decoration: underline; min-height: 0; font-size: inherit; }
a.btn, a.btn:hover { text-decoration: none; }
.rental-warn { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px; margin: 8px 0 12px; border: 1px solid var(--warn); border-radius: var(--radius); color: var(--fg); }
.rental-warn > svg { color: var(--warn); flex: none; }
.sign-preview img { max-height: 90px; max-width: 280px; background: #fff; border-radius: 8px; padding: 6px; }

/* ---------- Ekran startowy ---------- */
.splash { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: var(--bg); color: var(--fg); overflow: hidden; transition: opacity .5s ease, visibility .5s ease; animation: splash-failsafe .4s ease 8s forwards; }
.splash.out { opacity: 0; visibility: hidden; pointer-events: none; }
.splash.out .splash-inner { transform: scale(1.06); }
.splash-glow { position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; background: radial-gradient(circle, rgba(48, 209, 88, .22) 0%, rgba(94, 120, 255, .10) 40%, transparent 70%); animation: splash-breathe 2.6s ease-in-out infinite; }
.splash-inner { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; transition: transform .5s ease; }
.splash-mark { width: 112px; height: 112px; filter: drop-shadow(0 0 18px rgba(48, 209, 88, .45)); animation: splash-pop .7s cubic-bezier(.2, 1.4, .4, 1) both; }
.splash-mark circle, .splash-mark path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.splash-ring-bg { stroke: rgba(127, 127, 140, .2); stroke-width: 4; }
.splash-ring { stroke: var(--accent); stroke-width: 4; stroke-dasharray: 151; stroke-dashoffset: 151; transform: rotate(-90deg); transform-origin: 32px 32px; animation: splash-draw 1.1s ease-out .2s forwards; }
.splash-check { stroke: var(--accent); stroke-width: 5; stroke-dasharray: 40; stroke-dashoffset: 40; animation: splash-draw .5s ease-out 1.1s forwards; }
.splash-title { margin: 8px 0 0; font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.splash-title span, .splash-title em { display: inline-block; opacity: 0; animation: splash-up .6s ease-out forwards; }
.splash-title span:nth-child(1) { animation-delay: .5s; }
.splash-title span:nth-child(2) { animation-delay: .65s; }
.splash-title em { font-style: normal; color: var(--accent); animation-delay: .85s; }
.splash-sub { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 13px; opacity: 0; color: var(--muted); animation: splash-up .6s ease-out 1.1s forwards; }
.splash-sub { text-transform: uppercase; letter-spacing: .08em; font-size: 12px; }
.splash-sub .pro4it { font-size: 20px; }
.splash-bar { width: 180px; height: 3px; margin-top: 18px; border-radius: 3px; background: rgba(127, 127, 140, .2); overflow: hidden; }
.splash-bar span { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #5e78ff); transform: scaleX(0); transform-origin: left; animation: splash-load 2.3s cubic-bezier(.4, 0, .2, 1) forwards; }
@keyframes splash-draw { to { stroke-dashoffset: 0; } }
@keyframes splash-pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes splash-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes splash-load { to { transform: scaleX(1); } }
@keyframes splash-breathe { 0%, 100% { transform: scale(.9); opacity: .7; } 50% { transform: scale(1.05); opacity: 1; } }
@keyframes splash-failsafe { to { opacity: 0; visibility: hidden; pointer-events: none; } }
@media (prefers-reduced-motion: reduce) {
  .splash *, .splash { animation-duration: 1ms !important; animation-delay: 0s !important; }
  .splash { animation-delay: 8s !important; animation-duration: .4s !important; }
}

/* ---------- Poczta e-mail ---------- */
.mail-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.mail-steps li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.mail-steps li.ok { color: var(--fg); }
.mail-dot { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; flex: none; font-size: 12px; font-weight: 700; background: var(--line); color: var(--muted); }
.mail-steps li.ok .mail-dot, .mail-dot.ok { background: var(--accent-soft); color: var(--accent-ink); }
.mail-dot.bad { background: rgba(255, 69, 58, .15); color: var(--danger); }
.dns-list li { align-items: flex-start; }
code.dns-value { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.mail-log td { vertical-align: top; }
.mail-log td:nth-child(3) { min-width: 180px; }
.tf-qr { display: grid; place-items: center; padding: 12px; background: #fff; border-radius: 12px; width: max-content; }
.tf-secret { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .08em; overflow-wrap: anywhere; }

/* ---------- Kody kreskowe: etykiety sprzętu ---------- */
.bc-label { display: grid; gap: 4px; background: #fff; color: #111; border: 1px dashed var(--line); border-radius: 6px; padding: 8px 10px; width: 100%; max-width: 360px; box-sizing: border-box; }
.bc-head { display: grid; gap: 1px; min-width: 0; }
.bc-head strong { font-size: 13px; line-height: 1.2; overflow-wrap: anywhere; }
.bc-head span { font-size: 11px; color: #555; }
.bc-body { display: flex; align-items: center; gap: 8px; }
.bc-code { display: grid; justify-items: center; flex: 1; min-width: 0; }
.bc-code svg.barcode { width: 100%; max-width: 260px; height: 44px; }
.bc-text { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; letter-spacing: .06em; }
.bc-body svg.qr { flex: none; width: 56px; height: 56px; }
.bc-inline { margin: 4px 0 8px; }
.bc-preview { display: grid; gap: 8px; }
.toolbar.tight { margin: 0; gap: 6px; }
@media print {
  body.printing .bc-label { break-inside: avoid; border: 1px dashed #999; max-width: none; }
  @page roll { size: 50mm 30mm; margin: 0; }
  body.printing .print-sheet.roll { display: block; }
  body.printing .print-sheet.roll .bc-label { page: roll; break-after: page; width: 50mm; height: 30mm; padding: 1.5mm 2mm; border: 0; border-radius: 0; gap: .5mm; overflow: hidden; }
  body.printing .print-sheet.roll .bc-head strong { font-size: 7.5pt; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.printing .print-sheet.roll .bc-head span { font-size: 6pt; }
  body.printing .print-sheet.roll .bc-code svg.barcode { height: 13mm; max-width: none; }
  body.printing .print-sheet.roll .bc-text { font-size: 7pt; }
  body.printing .print-sheet.roll .bc-body svg.qr { width: 13mm; height: 13mm; }
}

/* ---------- Skaner ---------- */
.scan-frame.off { display: none; }
.scanner > * { min-width: 0; }
.scan-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.scan-mode .btn, .scan-actions .btn { width: 100%; min-width: 0; }
.scan-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn.big { min-height: 48px; font-size: 16px; justify-content: center; display: inline-flex; align-items: center; gap: 6px; }
.scan-form input { font-size: 17px; min-height: 48px; letter-spacing: .02em; }
.series-list li { gap: 10px; }
.series-list li.unknown strong { color: var(--danger); }
.series-count { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 36px; color: var(--accent-ink); }
.dw-steps { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; }

/* ---------- Start: kafelki ---------- */
.home-hello { margin: 0 0 14px; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.tiles-main { grid-template-columns: 1fr 1fr; margin-bottom: 10px; }
.tile { position: relative; display: grid; justify-items: center; align-content: center; gap: 8px; min-height: 104px; padding: 14px 8px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line); color: var(--fg); text-decoration: none; font: inherit; cursor: pointer; text-align: center; box-shadow: var(--sheen, none); }
.tile:hover { background: var(--hover); }
.tile:active { transform: scale(.97); }
.tile-ico { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); }
.tile-ico svg.i { width: 26px; height: 26px; }
.tile-label { font-size: 14px; font-weight: 600; line-height: 1.2; }
.tile .badge { position: absolute; top: -6px; right: -10px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.tile .badge.dot { min-width: 12px; height: 12px; padding: 0; background: var(--warn); }
.tile .badge.warn { background: var(--warn); color: #1d1d1d; }
.tile-accent { background: var(--accent); border-color: transparent; color: var(--on-accent, #0b1a10); }
.tile-accent .tile-ico { background: rgba(255, 255, 255, .22); color: inherit; }

/* Dolny pasek skrótów: tylko telefon i terminal */
.dock { display: none; flex: 1; gap: 4px; }
.dock-btn { display: grid; justify-items: center; gap: 2px; padding: 4px 12px; border-radius: 10px; background: none; border: 0; color: var(--muted); font: inherit; font-size: 11px; text-decoration: none; cursor: pointer; }
.dock-btn svg.i { width: 22px; height: 22px; }
.dock-btn[aria-current='page'] { color: var(--accent-ink); }
.bottombar:has(.quickadd:not([hidden])) .dock { display: none !important; }

/* Tryb kafelków (html.tile-mode): przełącznik w górnym pasku i w menu */
html.tile-mode .dock { display: flex; }
html.tile-mode .bottombar { position: relative; z-index: 45; }
html.tile-mode .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px; }
html.tile-mode .nav a { flex-direction: column; justify-content: center; text-align: center; gap: 6px; min-height: 86px; padding: 10px 4px; font-size: 13px; line-height: 1.2;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
html.tile-mode .nav a[aria-current='page'] { border-color: var(--accent); }
html.tile-mode .nav .ico { width: auto; }
html.tile-mode .nav .ico svg.i { width: 26px; height: 26px; }
html.tile-mode .nav-group { grid-column: 1 / -1; }

@media (max-width: 760px) {
  html.tile-mode .bottombar { height: 60px; padding-bottom: env(safe-area-inset-bottom); }
  /* Menu jako kafelki na całym ekranie */
  html.tile-mode .side { background: var(--surface-solid); width: 100%; border-radius: 0; inset: 0 0 calc(60px + env(safe-area-inset-bottom)) 0; overflow-y: auto; }
  html.tile-mode .nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .side-brand { display: flex; justify-content: space-between; align-items: center; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .tile { min-height: 96px; padding: 10px 4px; }
  .tile-label { font-size: 13px; }
}

/* Przełącznik Kafelki / Lista */
.topbar { grid-template-columns: minmax(58px, 1fr) minmax(0, auto) minmax(58px, 1fr); }
.topbar-end { gap: 4px; }
.layout-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--line);
  background: var(--surface); color: var(--fg); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.layout-btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.layout-btn svg.i { width: 18px; height: 18px; }
.layout-seg { display: flex; align-items: center; gap: 4px; margin: 10px 12px 0; padding: 4px; border-radius: 12px; background: var(--hover); }
.layout-seg-label { font-size: 12px; color: var(--side-muted, var(--muted)); padding: 0 6px; }
.layout-seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; border: 0; border-radius: 9px;
  background: none; color: var(--side-fg, var(--fg)); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.layout-seg button svg.i { width: 16px; height: 16px; }
.layout-seg button[aria-pressed='true'] { background: var(--surface); box-shadow: var(--sheen, 0 1px 2px rgba(0,0,0,.15)); color: var(--accent-ink); }
@media (max-width: 350px) { .layout-btn span { display: none; } .layout-btn { padding: 0 9px; } }

/* ---------- Tryb terminala (Zebra itp.): duże cele dotyku, czytelne pisma ---------- */
html.terminal { font-size: 17px; }
html.terminal body { font-size: 17px; }
html.terminal .bottombar { height: 68px; }
html.terminal .dock-btn { padding: 6px 16px; font-size: 12px; }
html.terminal .dock-btn svg.i { width: 26px; height: 26px; }
html.terminal .btn { min-height: 48px; padding-inline: 16px; font-size: 16px; }
html.terminal .btn.sm { min-height: 44px; font-size: 15px; }
html.terminal .icon-btn { width: 48px; height: 48px; }
html.terminal input, html.terminal select, html.terminal textarea { min-height: 48px; font-size: 17px; }
html.terminal input[type='checkbox'], html.terminal input[type='radio'] { width: 24px; height: 24px; min-height: 0; }
html.terminal .rows li { padding: 14px 14px; min-height: 56px; }
html.terminal .rows .sub { font-size: 14px; }
html.terminal .nav a { min-height: 52px; font-size: 17px; }
html.terminal .tile { min-height: 120px; }
html.terminal .tile-label { font-size: 15px; }
html.terminal .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html.terminal .scan-frame { max-height: 38vh; aspect-ratio: auto; }
html.terminal .view { padding: 12px 12px 120px; }
.rows.series-list li { flex-wrap: nowrap; align-items: center; }
.rows.series-list li > .grow { flex-basis: auto; }
.scan-mode .btn { min-height: 48px; }

/* Nieznany kod i pamięć skanów */
.unknown-code .code-value { font: 600 22px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; margin: 0 0 6px; word-break: break-all; }
.modal:has(.unknown-code) .actions { justify-content: stretch; }
.modal:has(.unknown-code) .actions .btn { flex: 1 1 calc(50% - 8px); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--accent-ink); cursor: pointer; text-align: left; word-break: break-all; }
.series.recent { margin-top: 8px; }

/* =====================================================================
   Motyw Windows 98 (Ustawienia → Wygląd): pulpit w kolorze morskim, szare okna
   z wypukłymi ramkami, granatowe paski tytułu i pasek zadań na dole.
   ===================================================================== */
:root[data-theme='retro'] {
  --w-face: #c0c0c0; --w-light: #ffffff; --w-hi: #dfdfdf; --w-shadow: #808080; --w-dark: #0a0a0a;
  --w-title: linear-gradient(90deg, #000080, #1084d0);
  --w-out: inset -1px -1px var(--w-dark), inset 1px 1px var(--w-light), inset -2px -2px var(--w-shadow), inset 2px 2px var(--w-hi);
  --w-in: inset -1px -1px var(--w-light), inset 1px 1px var(--w-shadow), inset -2px -2px var(--w-hi), inset 2px 2px var(--w-dark);
  --w-field: inset -1px -1px var(--w-light), inset 1px 1px var(--w-shadow), inset -2px -2px var(--w-hi), inset 2px 2px var(--w-dark);
  --side-bg: var(--w-face); --side-active: #000080; --side-fg: #000; --side-muted: #444; --side-line: var(--w-shadow);
  --bg: #008080; --bg-deep: #008080; --surface: var(--w-face); --surface-strong: var(--w-face); --surface-solid: var(--w-face);
  --input-bg: #fff; --fg: #000; --muted: #3c3c3c; --line: var(--w-shadow); --edge: var(--w-shadow); --sheen: none;
  --accent: #000080; --accent-ink: #000080; --accent-soft: rgba(0, 0, 128, .15); --on-accent: #fff;
  --warn: #808000; --danger: #c00000; --star: #808000; --hover: #e4e4e4; --overlay: rgba(0, 0, 0, .25);
  --toast-bg: #ffffe1; --shadow: none; --glass: none;
  --font: Tahoma, 'MS Sans Serif', 'Microsoft Sans Serif', 'Segoe UI', Geneva, Verdana, sans-serif;
  --radius: 0; --radius-lg: 0;
  color-scheme: light;
  background: #008080;
}
:root[data-theme='retro'] body { background: #008080; font-size: 13px; letter-spacing: 0; -webkit-font-smoothing: none; }
:root[data-theme='retro'] * { border-radius: 0 !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; transition: none !important; text-shadow: none !important; }
:root[data-theme='retro'] ::selection { background: #000080; color: #fff; }
:root[data-theme='retro'] :focus-visible { outline: 1px dotted #000; outline-offset: -4px; }
:root[data-theme='retro'] * { scrollbar-width: auto; scrollbar-color: var(--w-face) #e0e0e0; }
:root[data-theme='retro'] ::-webkit-scrollbar { width: 16px; height: 16px; background: #e0e0e0; }
:root[data-theme='retro'] ::-webkit-scrollbar-thumb { background: var(--w-face); box-shadow: var(--w-out); }

/* Okna: szare z wypukłą ramką */
:root[data-theme='retro'] :is(.side, .list, .rows, .card, .feed li, .stat, .ship, .stage-bars, .budget-meter, .bubble.assistant, .chat-input, .cal, .demo-note, .panel, .modal, .auth-box, .tile, .series) {
  background: var(--w-face); border: 0; box-shadow: var(--w-out); color: #000;
}
:root[data-theme='retro'] :is(.list, .rows) { box-shadow: var(--w-field); background: #fff; padding: 2px; }
:root[data-theme='retro'] .card { padding: 0 12px 12px; }
:root[data-theme='retro'] :is(.card, .modal) > h2:first-child { margin: 3px -9px 4px; padding: 3px 6px; background: var(--w-title); color: #fff; font-size: 13px; font-weight: 700; letter-spacing: 0; }
:root[data-theme='retro'] .modal { padding: 3px 12px 12px; gap: 10px; }
:root[data-theme='retro'] .modal > h2:first-child { margin: 0 -9px 4px; display: flex; justify-content: space-between; }
:root[data-theme='retro'] .modal > h2:first-child::after { content: '×'; width: 16px; height: 14px; line-height: 12px; text-align: center; font-size: 13px; color: #000; background: var(--w-face); box-shadow: var(--w-out); }
:root[data-theme='retro'] .card p, :root[data-theme='retro'] .sub { color: #3c3c3c; }
:root[data-theme='retro'] .overlay { background: rgba(0, 0, 0, .15); }

/* Pasek tytułu okna aplikacji */
:root[data-theme='retro'] .topbar { background: var(--w-title); color: #fff; border: 0; box-shadow: none; height: 34px; }
:root[data-theme='retro'] .topbar h1 { color: #fff; font-size: 13px; font-weight: 700; text-align: left; }
:root[data-theme='retro'] .topbar .icon-btn { width: 24px; height: 22px; color: #000; background: var(--w-face); box-shadow: var(--w-out); margin: 0 1px; }
:root[data-theme='retro'] .topbar .icon-btn svg.i { width: 15px; height: 15px; }
:root[data-theme='retro'] .layout-btn { height: 22px; padding: 0 8px; color: #000; background: var(--w-face); border: 0; box-shadow: var(--w-out); font-size: 12px; font-weight: 400; }
:root[data-theme='retro'] .layout-btn svg.i { width: 14px; height: 14px; }

/* Menu boczne jak Eksplorator */
:root[data-theme='retro'] .side { box-shadow: inset -1px 0 var(--w-dark), inset -2px 0 var(--w-shadow); }
:root[data-theme='retro'] .side-brand { border-bottom: 1px solid var(--w-shadow); box-shadow: 0 1px var(--w-light); }
:root[data-theme='retro'] .side-brand .brand-name, :root[data-theme='retro'] .side-brand * { color: #000 !important; }
:root[data-theme='retro'] .nav a { color: #000; font-size: 13px; padding: 6px 8px; font-weight: 400; }
:root[data-theme='retro'] .nav a:hover { background: transparent; text-decoration: underline; }
:root[data-theme='retro'] .nav a[aria-current='page'] { background: #000080; color: #fff; box-shadow: none; }
:root[data-theme='retro'] .nav a[aria-current='page'] .ico { color: #fff; }
:root[data-theme='retro'] .nav .ico { color: #000; }
:root[data-theme='retro'] .side-foot { border-top: 1px solid var(--w-shadow); color: #000; }
:root[data-theme='retro'] .avatar { background: #000080; color: #fff; }
:root[data-theme='retro'] .layout-seg { background: var(--w-face); box-shadow: var(--w-field); padding: 3px; }
:root[data-theme='retro'] .layout-seg button { color: #000; height: 26px; box-shadow: var(--w-out); background: var(--w-face); font-weight: 400; }
:root[data-theme='retro'] .layout-seg button[aria-pressed='true'] { box-shadow: var(--w-in); background: #e8e8e8; color: #000; }
:root[data-theme='retro'] .layout-seg-label { color: #000; }

/* Przyciski */
:root[data-theme='retro'] :is(.btn, .icon-btn, .dock-btn, .tile, .seg button) { transform: none !important; }
:root[data-theme='retro'] .btn { background: var(--w-face); color: #000; border: 0; box-shadow: var(--w-out); font-weight: 400; min-height: 26px; padding: 4px 14px; }
:root[data-theme='retro'] .btn:hover { background: var(--w-face); filter: none; }
:root[data-theme='retro'] .btn:active, :root[data-theme='retro'] .btn[aria-pressed='true'] { box-shadow: var(--w-in); }
:root[data-theme='retro'] .btn.primary { background: var(--w-face); color: #000; box-shadow: inset 0 0 0 1px #000, var(--w-out); outline: none; font-weight: 700; }
:root[data-theme='retro'] .btn.primary:hover { background: var(--w-face); }
:root[data-theme='retro'] .btn.danger { color: #c00000; }
:root[data-theme='retro'] .icon-btn { color: #000; }
:root[data-theme='retro'] .icon-btn:hover { background: transparent; box-shadow: var(--w-out); }

/* Pola tekstowe: wklęsłe, białe */
:root[data-theme='retro'] :is(input:not([type='checkbox']):not([type='radio']):not([type='range']):not([type='color']), select, textarea, .ws-switch) {
  background: #fff; color: #000; border: 0; box-shadow: var(--w-field);
}
:root[data-theme='retro'] :is(input, select, textarea):focus { box-shadow: var(--w-field); outline: 1px dotted #000; outline-offset: -4px; }
:root[data-theme='retro'] option { background: #fff; color: #000; }
:root[data-theme='retro'] input[type='checkbox'], :root[data-theme='retro'] input[type='radio'] { accent-color: #000080; }

/* Zadania */
:root[data-theme='retro'] .task { color: #000; border-bottom: 1px dotted #c0c0c0; }
:root[data-theme='retro'] .task:hover { background: #e8e8f8; }
:root[data-theme='retro'] .task.active { background: #000080; color: #fff; box-shadow: none; }
:root[data-theme='retro'] .task.active .sub, :root[data-theme='retro'] .task.active svg.i { color: #fff; }

/* Pasek zadań z przyciskiem Start */
:root[data-theme='retro'] .bottombar { background: var(--w-face); border: 0; box-shadow: inset 0 1px var(--w-hi), inset 0 2px var(--w-light); }
:root[data-theme='retro'] .dock-btn { flex-direction: row; display: inline-flex; align-items: center; gap: 4px; color: #000; font-size: 12px; padding: 2px 8px; height: 30px; margin: auto 0; background: var(--w-face); box-shadow: var(--w-out); }
:root[data-theme='retro'] .dock-btn svg.i { width: 16px; height: 16px; }
:root[data-theme='retro'] .dock-btn[data-nav='home'] { font-weight: 700; }
:root[data-theme='retro'] .dock-btn[data-nav='home']::before { content: ''; width: 16px; height: 16px; flex: none; margin-right: 2px;
  background: linear-gradient(90deg, #f00 0 47%, transparent 47% 53%, #0a0 53%) top / 100% 47% no-repeat,
              linear-gradient(90deg, #00f 0 47%, transparent 47% 53%, #fc0 53%) bottom / 100% 47% no-repeat; transform: skewY(-6deg); }
:root[data-theme='retro'] .dock-btn[data-nav='home'] svg.i { display: none; }
:root[data-theme='retro'] .dock-btn[aria-current='page'] { box-shadow: var(--w-in); background: #e8e8e8; color: #000; }
:root[data-theme='retro'] #quick-toggle { width: 30px; height: 28px; background: var(--w-face); box-shadow: var(--w-out); }

/* Kafelki jak ikony na pulpicie */
:root[data-theme='retro'] .tile { color: #000; }
:root[data-theme='retro'] .tile:hover { background: var(--w-face); }
:root[data-theme='retro'] .tile:active { box-shadow: var(--w-in); }
:root[data-theme='retro'] .tile-ico { background: transparent; color: #000080; }
:root[data-theme='retro'] .tile-accent { background: var(--w-face); color: #000; box-shadow: inset 0 0 0 1px #000, var(--w-out); }
:root[data-theme='retro'] .tile-accent .tile-ico { background: transparent; color: #000080; }
:root[data-theme='retro'] .badge { border-radius: 0 !important; box-shadow: none !important; }

/* Panel szczegółów, dymki, toast */
:root[data-theme='retro'] .panel-head { background: var(--w-title); color: #fff; border: 0; }
:root[data-theme='retro'] .panel-head .icon-btn { color: #000; background: var(--w-face); box-shadow: var(--w-out); width: 24px; height: 22px; }
:root[data-theme='retro'] .panel-head .icon-btn svg.i { width: 15px; height: 15px; }
:root[data-theme='retro'] .toast { background: #ffffe1; color: #000; border: 1px solid #000; box-shadow: 2px 2px 0 rgba(0, 0, 0, .35); }
:root[data-theme='retro'] a { color: #0000ee; }
:root[data-theme='retro'] .nav a, :root[data-theme='retro'] .tile, :root[data-theme='retro'] .dock-btn { text-decoration: none; }
:root[data-theme='retro'] .link-btn { color: #0000ee; text-decoration: underline; }

/* Ekran startowy: logo i pasek postępu z kratek */
:root[data-theme='retro'] .splash { background: #008080; color: #fff; }
:root[data-theme='retro'] .splash-glow { display: none; }
:root[data-theme='retro'] .splash-bar { background: #fff; box-shadow: var(--w-field); height: 18px; padding: 3px; }
:root[data-theme='retro'] .splash-bar span { background: repeating-linear-gradient(90deg, #000080 0 9px, transparent 9px 11px); }
:root[data-theme='retro'] :is(.topbar, .panel-head) .icon-btn { display: inline-grid; place-items: center; padding: 0; }
:root[data-theme='retro'] .topbar > div { height: 100%; gap: 2px; }
:root[data-theme='retro'] .splash-title, :root[data-theme='retro'] .splash-title * { color: #fff; }

/* Asystent AI Open */
.aiopen-settings { gap: 8px; align-items: center; }
.aiopen-settings .model-select { width: auto; max-width: min(320px, 60vw); }
.bubble .code-block { margin: 8px 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg-deep); white-space: normal; }
.bubble .code-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 8px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); }
.bubble .code-block pre { margin: 0; padding: 10px; overflow-x: auto; white-space: pre; font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.system-edit { width: 100%; min-height: 160px; resize: vertical; }
:root[data-theme='retro'] .bubble .code-block { background: #fff; border: 0; box-shadow: var(--w-field); }
.aiopen-chat { grid-template-columns: minmax(0, 1fr); }
.aiopen-chat .bubble { min-width: 0; }
.aiopen-chat .bubble.assistant { max-width: min(85%, 100%); }
.aiopen-chat .code-block { max-width: 100%; }
.view:has(> .aiopen-chat) { grid-template-columns: minmax(0, 1fr); } .view > .aiopen-chat, .view:has(> .aiopen-chat) > * { min-width: 0; }
.chat-input { grid-template-columns: minmax(0, 1fr); } .chat-input .inline-form textarea { width: auto; }

/* Ustawienia: rozwijane sekcje */
.set-groups { display: grid; gap: 10px; margin-bottom: 16px; }
.set-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--sheen); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); }
.set-group > summary { list-style: none; display: flex; align-items: center; gap: 14px; padding: 14px 18px; cursor: pointer; user-select: none; }
.set-group > summary::-webkit-details-marker { display: none; }
.set-group > summary:hover { background: var(--hover); border-radius: var(--radius-lg); }
.set-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); flex: none; }
.set-ico svg.i { width: 22px; height: 22px; }
.set-title { display: grid; gap: 2px; flex: 1; min-width: 0; }
.set-title strong { font-size: 16px; }
.set-title .sub { font-size: 13px; color: var(--muted); }
.set-chev { color: var(--muted); transition: transform .2s; }
.set-group[open] > summary .set-chev { transform: rotate(180deg); }
.set-group[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.set-body { padding: 14px; }
.set-body > .card:last-child { margin-bottom: 0; }
.sound-test { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sound-test .sub { margin-right: 4px; }
input[type='range'] { accent-color: var(--accent); width: min(260px, 100%); }
:root[data-theme='retro'] .set-group { box-shadow: var(--w-out); border: 0; background: var(--w-face); }
:root[data-theme='retro'] .set-group > summary:hover { background: transparent; }
:root[data-theme='retro'] .set-group[open] > summary { background: var(--w-title); color: #fff; border: 0; }
:root[data-theme='retro'] .set-group[open] > summary .sub, :root[data-theme='retro'] .set-group[open] > summary .set-chev { color: #ddd; }
:root[data-theme='retro'] .set-ico { background: transparent; color: #000080; }
:root[data-theme='retro'] .set-group[open] .set-ico { color: #fff; }
.set-groups { grid-template-columns: minmax(0, 1fr); }
.set-group, .set-body, .set-body > * { min-width: 0; }
.set-body .switch-row select { min-width: 0; max-width: 100%; }
@media (max-width: 760px) { .set-body { padding: 8px; } .set-group > summary { padding: 12px 14px; gap: 10px; } }
.set-body .card { grid-template-columns: minmax(0, 1fr); }
.set-body .switch-row select { flex: 1 1 160px; width: 100%; }

/* Odpowiedzi AI w Markdown */
.bubble .md { white-space: normal; display: grid; gap: 6px; }
.bubble .md > * { margin: 0; }
.md .md-h { margin: 6px 0 0; font-size: 1.05em; line-height: 1.3; }
.md h3.md-h { font-size: 1.15em; }
.md ul, .md ol { padding-left: 22px; margin: 0; }
.md li { margin: 2px 0; }
.md li > ul, .md li > ol { margin-top: 2px; }
.md blockquote { margin: 0; padding-left: 10px; border-left: 3px solid var(--line); color: var(--muted); }
.md code { font: 0.92em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--hover); padding: 1px 4px; border-radius: 4px; }
.md pre code { background: none; padding: 0; }
.md hr { border: 0; border-top: 1px solid var(--line); width: 100%; }
.md a { color: var(--accent-ink); }
.md-table { overflow-x: auto; max-width: 100%; }
.md-table table { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.md-table th, .md-table td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; vertical-align: top; }
.md-table th { background: var(--hover); font-weight: 600; }
.print-frame { position: fixed; width: 0; height: 0; border: 0; visibility: hidden; }
:root[data-theme='retro'] .md-table table { background: #fff; }
:root[data-theme='retro'] .md-table th { background: var(--w-face); }

/* Konwerter */
.conv-drop { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 92px; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted); cursor: pointer; text-align: center; padding: 12px; }
.conv-drop:hover, .conv-drop.over { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.conv-tool .set-body { display: grid; gap: 10px; }
.conv-files:empty { display: none; }
.conv-files .icon-btn svg.i { transform: rotate(180deg); }
.conv-files .icon-btn[aria-label^='Usuń'] svg.i { transform: none; }
.conv-status { margin: 0; }
.conv-preview { max-height: 420px; overflow: auto; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
#conv-pages { max-width: 260px; }
:root[data-theme='retro'] .conv-drop { border-color: var(--w-shadow); }

/* ---------- Masowe zaznaczanie ---------- */
.bulk-cb { display: none; flex: none; width: 18px; height: 18px; margin: 0; cursor: pointer; }
.bulk-on .bulk-cb { display: inline-block; }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; margin: 6px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--card, var(--bg)); position: sticky; top: 0; z-index: 3; }
.bulk-bar[hidden] { display: none; }
.bulk-bar .check-row { align-items: center; }
.bulk-count { font-size: 13px; }
.bulk-confirm .bulk-names { margin: 6px 0; padding-left: 20px; max-height: 40vh; overflow: auto; }
.bulk-confirm .bulk-names li { overflow-wrap: anywhere; }
.bulk-on .rows > li { cursor: default; }

/* ---------- Magazyn ---------- */
.stock-editor .stock-lines { display: grid; gap: 8px; }
.stock-line { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.sl-top { display: flex; gap: 6px; align-items: center; }
.sl-top .sl-name { flex: 1; min-width: 0; }
.sl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 6px; align-items: center; }
.sl-q { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sl-q input { min-width: 0; }
.sl-sn { align-items: center; }
.sl-units { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 10px; max-height: 180px; overflow: auto; padding: 4px 0; }
.sl-units .check-row { align-items: center; font-size: 13px; }
.stock-total { font-size: 13px; }
.sl-sn-list { overflow-wrap: anywhere; }
.warn-text { color: var(--warn, #b26b00); }
.bc-note { font-size: 10px; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media print { body.printing .print-sheet.roll .bc-note { font-size: 5.5pt; } }
p.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.btn.primary.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
:root[data-theme='retro'] .btn.primary.danger { background: #c00000; color: #fff; }
.bulk-on .rows > li, .bulk-on .file, .bulk-on .ship { user-select: none; -webkit-user-select: none; }
@media (max-width: 640px) { .stock-products > li > .file-ico { display: none; } }
.sl-grid .sl-sn { grid-column: span 2; }

/* Waluta i kurs w formularzach */
.fx-picker { display: flex; gap: 6px; align-items: center; min-width: 0; }
.rental-form .fx-picker select { flex: 0 0 6.5em; width: 6.5em; min-width: 0; }
.rental-form .fx-picker input { flex: 1 1 0; width: auto; min-width: 0; }
.fx-rate { display: flex; flex: 1 1 0; min-width: 0; }
.fx-rate[hidden] { display: none; }
.fx-info { display: block; margin: -4px 0 6px; }

/* ---------- Menu boczne „smart” (komputer, widok listy) ---------- */
.side-top { display: flex; align-items: flex-start; }
.side-top .side-brand { flex: 1; min-width: 0; }
.side-pin { display: none; margin: 14px 10px 0 0; flex: none; color: var(--side-muted, var(--muted)); }
@media (min-width: 761px) {
  html:not(.tile-mode) .side-pin { display: grid; }
  html:not(.tile-mode) .side-top { border-bottom: 1px solid var(--side-line); }
  html:not(.tile-mode) .side-top .side-brand { border-bottom: 0; }
  html:not(.tile-mode) .app.side-auto { grid-template-columns: 76px 1fr; }
  html:not(.tile-mode) .app.side-auto .side { position: relative; z-index: 35; width: 76px; overflow: hidden; transition: width 0.18s ease, box-shadow 0.18s; }
  html:not(.tile-mode) .app.side-auto.side-open .side { width: 300px; box-shadow: var(--shadow); }
  html:not(.tile-mode) .app.side-auto:not(.side-open) .side :is(.nav a > span:not(.ico), .nav-group-btn, .layout-seg, .side-brand .brand-by, .side-brand .brand-name > :not(svg), .side-pin, .who > div, .ws-switch, .demo-ribbon) { opacity: 0; pointer-events: none; }
  html:not(.tile-mode) .app.side-auto:not(.side-open) .nav-group { height: 1px; margin: 8px 14px; background: var(--side-line); }
  html:not(.tile-mode) .app.side-auto:not(.side-open) .nav { overflow-y: hidden; }
  html:not(.tile-mode) .app.side-auto:not(.side-open) .nav-group-btn { display: none; }
  html:not(.tile-mode) .app.side-auto .side :is(.nav a > span:not(.ico), .nav-group-btn, .layout-seg, .who > div) { transition: opacity 0.15s; white-space: nowrap; }
  html:not(.tile-mode) .app.side-auto:not(.side-open) .layout-seg { height: 0; margin-top: 0; padding: 0; overflow: hidden; }
}

/* Start: kategorie */
.tiles-cats { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tile-cat { min-height: 128px; }
.tile-sub { display: block; font-size: 12px; line-height: 1.3; color: var(--muted); font-weight: 400; text-align: center; padding: 0 6px; }
.tile-badges { position: absolute; top: -6px; right: -10px; display: flex; gap: 3px; }
.tile-badges .badge { position: static; }
.home-cat-title { font-size: 17px; margin-left: 4px; }
@media (max-width: 760px) { .tiles-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
html.terminal .tiles-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- Kalkulator kontenera FCL ---------- */
.cargo-setup { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; }
.cargo-cell { display: grid; gap: 4px; min-width: 0; font-size: 14px; }
.cargo-cell > span { color: var(--muted); font-size: 12px; }
.cargo-cell input, .cargo-cell select, .cargo-paste {
  width: 100%; min-width: 0; padding: 7px 9px; background: var(--input-bg); border: 1px solid var(--line); border-radius: 10px; color: var(--fg);
}
.cargo-setup .cargo-cell select { min-width: 220px; }
.cargo-types { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cargo-types .chip-toggle input { margin: 0; accent-color: var(--accent); }
.cargo-rows { display: grid; gap: 6px; }
.cargo-row { display: grid; grid-template-columns: 12px minmax(140px, 2.2fr) repeat(4, minmax(64px, 1fr)) minmax(56px, 0.8fr) minmax(136px, 1.3fr) minmax(84px, 0.8fr) auto; gap: 8px; align-items: center; }
.cargo-head { font-size: 12px; color: var(--muted); padding: 0 2px; }
.cargo-row:not(.cargo-head) .cargo-cell > span { display: none; }
.cargo-swatch { width: 12px; height: 12px; border-radius: 4px; display: inline-block; flex: none; }
.cargo-row > .cargo-swatch { height: 32px; }
.cargo-check { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.cargo-check input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.cargo-row .cargo-check > span.cargo-check-text { display: inline; color: var(--fg); font-size: 13px; }
.cargo-row .row-actions .icon-btn { padding: 6px; }
.cargo-row .row-actions svg.i { width: 20px; height: 20px; }
.cargo-add { margin: 10px 0 0; }
.cargo-paste-box summary { cursor: pointer; color: var(--accent-ink); font-size: 14px; }
.cargo-paste { margin: 8px 0; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; resize: vertical; }
.cargo-stale { margin: 0; color: var(--warn); }
.cargo-summary h2 { display: flex; align-items: center; gap: 6px; font-size: 18px; }
.cargo-summary .stats, .cargo-detail .stats { margin-bottom: 0; }
.cargo-errors p, .cargo-warn p { color: var(--danger); margin: 0; }
.cargo-warn p { color: var(--warn); }
.cargo-viewer { display: grid; gap: 8px; }
.cargo-canvas {
  width: 100%; height: clamp(260px, 42vw, 520px); display: block; touch-action: none; cursor: grab; border-radius: var(--radius);
  background: radial-gradient(ellipse at 50% 30%, color-mix(in srgb, var(--surface-solid) 70%, transparent), transparent 75%), var(--input-bg);
  border: 1px solid var(--line);
}
.cargo-canvas:active { cursor: grabbing; }
.cargo-hint { font-size: 12px; }
.cargo-controls .seg { gap: 4px; }
.cargo-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.cargo-chip { display: inline-flex; align-items: center; gap: 6px; }
.cargo-spare { font-size: 14px; color: var(--muted); }
.cargo-spare strong { color: var(--fg); font-weight: 600; }
@media (max-width: 900px) {
  .cargo-head { display: none; }
  .cargo-row { grid-template-columns: repeat(6, minmax(0, 1fr)); padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--input-bg); position: relative; }
  .cargo-row:not(.cargo-head) .cargo-cell > span { display: block; }
  .cargo-row > .cargo-swatch { position: absolute; left: 0; top: 10px; bottom: 10px; height: auto; width: 4px; border-radius: 0 4px 4px 0; }
  .cargo-row .c-name { grid-column: 1 / -1; }
  .cargo-row .c-l, .cargo-row .c-w, .cargo-row .c-h { grid-column: span 2; }
  .cargo-row .c-kg, .cargo-row .c-qty { grid-column: span 3; }
  .cargo-row .c-rot { grid-column: span 3; }
  .cargo-row .c-stack { grid-column: span 3; align-self: end; padding-bottom: 8px; }
  .cargo-row .row-actions { position: absolute; top: 2px; right: 4px; }
  .cargo-setup .cargo-cell select { min-width: 0; }
  .cargo-setup > .cargo-cell { flex: 1 1 100%; }
  .cargo-controls .grow { display: none; }
}

/* Administracja → Moduły */
.mod-switches li.off .name { color: var(--muted); text-decoration: line-through; }
.mod-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.mod-tag { font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.mod-tag.bg { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }

/* ---------- v20: rdzeń zadań – osoby, quick-pill, przewijanie wirtualne, tematy, przebiegi, pomoc ---------- */
.avatar.xs, i.avatar.xs { width: 18px; height: 18px; font-size: 9px; font-style: normal; display: inline-grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); flex: none; }
.mention { display: inline-flex; align-items: center; gap: 4px; padding: 0 7px 0 2px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; vertical-align: baseline; }
.mention .avatar.xs { width: 16px; height: 16px; font-size: 8px; background: transparent; }

/* Osoby zadania */
.people-field { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; position: relative; }
.person-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 4px 2px 3px; border: 1px solid var(--line); border-radius: 14px; font-size: 13px; background: var(--input-bg); color: var(--fg); text-decoration: none; max-width: 100%; }
.person-pill.primary { border-color: var(--accent); }
.person-pill small { color: var(--muted); font-size: 11px; }
.person-pill > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-pill .dot, .quick-preview .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.pill-x { border: 0; background: none; color: var(--muted); padding: 1px; display: grid; place-items: center; border-radius: 50%; }
.pill-x:hover { color: var(--fg); background: var(--hover); }
.pill-x svg.i { width: 14px; height: 14px; }
.person-add { display: inline-flex; align-items: center; gap: 4px; border: 1px dashed var(--edge); background: none; color: var(--muted); border-radius: 14px; padding: 2px 9px 2px 5px; font-size: 13px; }
.person-add:hover { color: var(--fg); border-color: var(--accent); }
.person-add svg.i { width: 16px; height: 16px; }
.people-pop { position: absolute; z-index: 45; top: calc(100% + 6px); left: 0; width: min(320px, 86vw); background: var(--surface-solid); border: 1px solid var(--edge); border-radius: 14px; box-shadow: var(--shadow); padding: 10px; display: grid; gap: 8px; }
.people-pop-head { display: flex; align-items: center; justify-content: space-between; }
.people-pop input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--input-bg); color: var(--fg); }
.people-list { max-height: 220px; overflow: auto; display: grid; }
.people-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 0; background: none; color: var(--fg); border-radius: 8px; text-align: left; }
.people-item.active, .people-item:hover { background: var(--hover); }
.people-item .sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.quick-pills, .assign-offer { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.quick-pill { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--input-bg); color: var(--fg); border-radius: 14px; padding: 3px 10px 3px 4px; font-size: 13px; }
.quick-pill:hover { border-color: var(--accent); }
.quick-pill small { color: var(--muted); font-size: 11px; }
.assign-offer { padding: 8px 10px; border: 1px dashed var(--edge); border-radius: 12px; }

/* Wiersz zadania: osoby */
.people-meta { display: inline-flex; align-items: center; gap: 6px; }
.avatars { display: inline-flex; }
.avatars .avatar { margin-left: -3px; box-shadow: 0 0 0 1.5px var(--surface-solid); }
.avatars .avatar:first-child { margin-left: 0; }
.avatar.more { background: var(--hover); color: var(--muted); font-style: normal; }

/* Panel zadania: zwarty blok właściwości i „Więcej” */
.props { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--input-bg); }
.due-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.due-row input { flex: 1 1 180px; }
.due-chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.due-chips .chip-toggle { font-size: 12px; padding: 2px 8px; }
.panel-more { border: 1px solid var(--line); border-radius: var(--radius); padding: 0 12px; }
.panel-more[open] { padding-bottom: 12px; }
.panel-more > summary { list-style: none; cursor: pointer; display: flex; gap: 8px; align-items: center; padding: 10px 0; font-size: 14px; }
.panel-more > summary::-webkit-details-marker { display: none; }
.panel-more > summary .sub { color: var(--muted); font-size: 12px; margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-more > summary svg.i { width: 16px; height: 16px; transform: rotate(-90deg); transition: transform .15s; }
.panel-more[open] > summary svg.i { transform: none; }
.panel-more > .field { margin-top: 8px; }
.flag-all { color: var(--muted) !important; border-style: dashed !important; }
.link-btn { background: none; border: 0; color: var(--accent-ink); padding: 4px 0; font-size: 13px; justify-self: start; }

/* Szybkie dodawanie: podgląd rozpoznanych osób i projektu; podpowiedzi otwierają się w górę */
.quick-field { flex: 1; display: grid; gap: 4px; min-width: 0; }
.quick-field .mention-wrap input { width: 100%; }
.quickadd .mention-box { top: auto; bottom: 100%; margin: 0 0 6px; }
.quick-preview { display: flex; flex-wrap: wrap; gap: 4px; }
.quick-preview:empty { display: none; }

/* Przewijanie wirtualne */
.list.virtual, .rows.virtual { position: relative; }
.list.virtual > li, .rows.virtual > li { position: absolute; left: 0; right: 0; box-sizing: border-box; overflow: hidden; }
.list.virtual > li + li, .rows.virtual > li + li { border-top: 0; }
.list.virtual > li, .rows.virtual > li { border-bottom: 1px solid var(--line); }
.list.virtual .task .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list.virtual .task .meta { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; }
.vlist-more { position: absolute; left: 0; right: 0; padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }

/* Tematy */
.topic-row .topic-name { display: grid; min-width: 0; }
.topic-row .topic-name .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topic-row .topic-name small { font-size: 12px; }
.rows.virtual .topic-row .name { white-space: nowrap; }
.pin-btn { background: none; border: 0; color: color-mix(in srgb, var(--muted) 70%, transparent); padding: 6px; display: grid; border-radius: 8px; }
.pin-btn:hover { background: var(--hover); color: var(--fg); }
.pin-btn.on { color: var(--star); }
.pin-btn svg.i { width: 18px; height: 18px; }
.topic-tabs .btn { white-space: nowrap; }
.toolbar .grow input[type=search] { width: 100%; max-width: 380px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--fg); }
.empty-line { padding: 18px; text-align: center; }
.project-people { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.topic-desc { width: 100%; margin: 0 0 4px; color: var(--muted); font-size: 14px; }
.topic-form { gap: 10px; }
.role-list .pick-row select { flex: none; width: auto; min-width: 150px; }
.color-row { display: flex; flex-wrap: wrap; gap: 6px; }
.color-dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; padding: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }
.color-dot.on { border-color: var(--fg); }
.color-row.sm .color-dot { width: 16px; height: 16px; border-width: 1.5px; }

/* Menu „⋯” */
.menu-wrap { position: relative; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 45; min-width: 230px; background: var(--surface-solid); border: 1px solid var(--edge); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; display: grid; }
.menu-pop[hidden] { display: none; }
.menu-pop .menu-item, .menu-pop .btn.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; justify-content: flex-start; text-align: left; background: none; border: 0; border-radius: 8px; padding: 8px 10px; color: var(--fg); font-size: 14px; }
.menu-pop .menu-item:hover { background: var(--hover); }
.menu-pop .menu-item.danger { color: var(--danger); }
.menu-pop .menu-item svg.i { width: 18px; height: 18px; color: var(--muted); }

/* Projektant przebiegów */
.pl-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.pl-card { border-top: 3px solid var(--pl); }
.pl-card-head { display: flex; align-items: center; gap: 10px; }
.pl-card-actions { margin: 0; }
.pl-strip { display: flex; gap: 3px; border-radius: 8px; overflow: hidden; }
.pl-seg { flex: 1; min-width: 0; padding: 5px 6px; font-size: 11px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-presets { display: grid; gap: 8px; }
.pl-preset { display: grid; gap: 6px; text-align: left; padding: 12px; border: 1px solid var(--line); background: var(--input-bg); color: var(--fg); border-radius: 12px; }
.pl-preset.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.pl-designer { display: grid; gap: 14px; }
.pl-head { display: grid; gap: 10px; }
.pl-name { font-size: 22px; font-weight: 700; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--fg); padding: 6px 0; }
.pl-head textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--input-bg); color: var(--fg); }
.pl-lane-wrap { overflow-x: auto; padding: 4px 2px 14px; }
.pl-lane { display: flex; align-items: stretch; gap: 0; min-width: min-content; }
.pl-stage { width: 220px; flex: none; display: grid; gap: 8px; align-content: start; padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--stage); cursor: grab; }
.pl-stage.final { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--stage) 50%, transparent); }
.pl-stage.dragging { opacity: .5; }
.pl-stage.over { outline: 2px dashed var(--accent); outline-offset: 2px; }
.pl-stage-top { display: flex; align-items: center; gap: 6px; }
.pl-stage-no { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--stage); flex: none; }
.pl-stage-name { flex: 1; min-width: 0; font-weight: 600; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--fg); padding: 3px 0; }
.pl-stage-flags { display: flex; gap: 4px; flex-wrap: wrap; min-height: 22px; align-items: center; }
.pl-stage-more summary { cursor: pointer; font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.pl-stage-more svg.i { width: 14px; height: 14px; }
.pl-flag-pop { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.pl-flag-pop .chip-toggle { font-size: 12px; padding: 2px 8px; }
.pl-stage-field { display: grid; gap: 3px; }
.pl-stage-field select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--input-bg); color: var(--fg); }
.pl-stage .check-row { font-size: 13px; }
.pl-stage-move { display: flex; justify-content: space-between; }
.pl-join { flex: none; width: 34px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; position: relative; }
.pl-join .pl-arrow { font-size: 20px; }
.pl-join .pl-plus { position: absolute; opacity: 0; transition: opacity .15s; background: var(--accent); color: var(--on-accent); border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; }
.pl-join:hover .pl-plus, .pl-join:focus-visible .pl-plus { opacity: 1; }
.pl-join .pl-plus svg.i { width: 16px; height: 16px; }
.pl-add-stage { flex: none; width: 120px; margin-left: 12px; border: 2px dashed var(--edge); background: none; color: var(--muted); border-radius: 14px; display: grid; place-items: center; align-content: center; gap: 4px; }
.pl-add-stage:hover { color: var(--fg); border-color: var(--accent); }
.pl-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.pl-grid .card { margin: 0; }
.pl-tasks-card { grid-column: 1 / -1; }
.pl-tasks { display: grid; gap: 8px; }
.pl-task { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pl-task > input { flex: 1 1 220px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--input-bg); color: var(--fg); }
.pl-task select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--input-bg); color: var(--fg); }
.pl-days { display: inline-flex; align-items: center; gap: 4px; }
.pl-days input { width: 64px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--input-bg); color: var(--fg); }
.btn.pulse { box-shadow: 0 0 0 3px var(--accent-soft); }
.pipeline-board .bcol { border-top: 3px solid var(--stage, var(--line)); }

/* Pomoc */
.help-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); margin-bottom: 8px; }
.help-card { margin: 0; gap: 8px; }
.help-card > summary { list-style: none; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.help-card > summary::-webkit-details-marker { display: none; }
.help-title { display: grid; gap: 2px; flex: 1; }
.help-title .sub { color: var(--muted); font-size: 13px; }
.help-card[open] .set-chev svg.i { transform: rotate(180deg); }
.help-steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; }
.help-actions { margin: 0; }
.help-toc { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.help-toc a { padding: 4px 10px; border: 1px solid var(--line); border-radius: 14px; font-size: 13px; color: var(--fg); text-decoration: none; }
.help-chapter { margin-bottom: 22px; }
.help-chapter h2 { font-size: 18px; margin: 0 0 8px; }
.help-article { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 10px; display: grid; gap: 8px; }
.help-article h3 { margin: 0; font-size: 16px; }
.help-article p { margin: 0; color: var(--muted); line-height: 1.5; font-size: 14px; }
.help-article .btn { justify-self: start; }
.help-howto { display: grid; gap: 4px; font-size: 14px; }
.help-hint { display: flex; gap: 10px; align-items: flex-start; }

/* „Pokaż mi” – podświetlenie miejsca w aplikacji */
.spot-layer { position: fixed; inset: 0; z-index: 200; pointer-events: none; }
.spot-hole { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55), 0 0 0 3px var(--accent); pointer-events: none; }
.spot-hole.glide { transition: all .25s ease; }
.spot-layer.no-target .spot-hole { left: 50% !important; top: 40% !important; width: 0 !important; height: 0 !important; }
.spot-tip { position: fixed; width: min(340px, calc(100vw - 24px)); background: var(--surface-solid); color: var(--fg); border: 1px solid var(--edge); border-radius: 14px; box-shadow: var(--shadow); padding: 14px; display: grid; gap: 8px; pointer-events: auto; }
.spot-layer.no-target .spot-tip { left: 50% !important; top: 40% !important; bottom: auto !important; transform: translate(-50%, -50%); }
.spot-head { display: flex; justify-content: space-between; gap: 8px; }
.spot-tip p { margin: 0; font-size: 14px; line-height: 1.45; }
.spot-actions { display: flex; gap: 6px; align-items: center; }
.spot-actions .grow { flex: 1; }
@media (max-width: 640px) {
  .spot-tip { left: 12px; right: 12px; bottom: 84px; width: auto; }
  .spot-layer.no-target .spot-tip { transform: translateY(-50%); left: 12px !important; }
  .field { grid-template-columns: 96px 1fr; }
  .pl-stage { width: 200px; }
}
@media (prefers-reduced-motion: reduce) { .spot-hole.glide { transition: none; } }
.panel .people-pop { left: auto; right: 0; }
.panel-body { overflow-x: hidden; }
.quick-field { position: relative; }
.quick-preview { position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 30; padding: 4px; border-radius: 14px; background: var(--surface-solid); box-shadow: var(--shadow); }
.avatars .avatar { margin-left: -3px; }
.help-grid { align-items: start; }
.spot-tip[hidden] { display: none; }
.pl-stage > * { min-width: 0; }
.pl-stage select { width: 100%; min-width: 0; }
.pl-stage .check-row { align-items: flex-start; }
.pl-stage .check-row span { white-space: normal; }
@media (max-width: 640px) {
  .toolbar .topic-tabs + .grow, .toolbar .seg + .grow { flex: 1 1 100%; order: 3; }
  .toolbar .grow > input[type="search"] { width: 100%; }
}

/* Skan dokumentu: „Gdzie przypiąć” */
.modal .ocr-place-form { gap: 10px; max-width: none; width: 100%; }
.ocr-doc { display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: var(--hover); border-radius: var(--radius); }
.ocr-doc > svg.i { width: 26px; height: 26px; flex: none; color: var(--accent-ink); }
.ocr-doc-body { display: grid; gap: 2px; min-width: 0; }
.ocr-doc-body select { justify-self: start; font-weight: 600; }
.ocr-doc-body .sub { overflow-wrap: anywhere; }
.ocr-places { display: grid; gap: 6px; }
.form .ocr-place { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.ocr-place:hover { background: var(--hover); }
.ocr-place.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.form .ocr-place input[type=radio] { margin: 3px 0 0; flex: none; width: auto; padding: 0; }
.ocr-place-body { display: grid; gap: 3px; min-width: 0; flex: 1; }
.ocr-place-body strong { overflow-wrap: anywhere; }
.ocr-place-body .sub { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.ocr-why { display: flex; gap: 4px; flex-wrap: wrap; }
.ocr-reason { font-size: 11px; padding: 0 7px; border-radius: 999px; background: var(--hover); color: var(--muted); }
.ocr-pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ocr-pickers select, .ocr-place-body > input { width: 100%; min-width: 0; }
.ocr-title { display: grid; gap: 8px; }
.ocr-title label { display: grid; gap: 4px; }
.ocr-title[hidden] { display: none; }
.ocr-due, .quick-due { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.quickadd { flex-wrap: wrap; }
.quick-due { flex-basis: 100%; }
.quick-due .chip-toggle, .ocr-due .chip-toggle { font-size: 12px; padding: 2px 10px; }
.quick-due .chip-toggle.on, .ocr-due .chip-toggle.on { border-color: var(--accent); color: var(--accent-ink); }
@media (max-width: 480px) { .ocr-pickers { grid-template-columns: 1fr; } }
.modal:has(.ocr-place-form) { width: min(560px, 100%); max-height: 90vh; overflow: auto; }
/* Długie okna (np. odczytany dokument na telefonie) przewijają się w sobie – przyciski zawsze osiągalne. */
.modal { max-height: calc(100dvh - 24px); overflow: auto; overscroll-behavior: contain; }

/* Magazyn: marża */
.good-text { color: var(--accent-ink); }
.sm-margin { min-width: 96px; }
.margin-bars { display: grid; gap: 6px; margin: 4px 0 12px; }
.mb-row { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.mb-label { color: var(--muted); font-variant-numeric: tabular-nums; }
.mb-track { position: relative; height: 14px; border-radius: 7px; background: var(--input-bg); overflow: hidden; }
.mb-rev { position: absolute; inset: 0 auto 0 0; background: var(--accent-soft); border-radius: 7px; }
.mb-mar { position: absolute; inset: 3px auto 3px 0; background: var(--accent); border-radius: 4px; }
.mb-mar.neg { background: var(--danger); }
.mb-val { font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 560px) { .mb-row { grid-template-columns: 52px 1fr; } .mb-val { grid-column: 2; font-size: 12px; color: var(--muted); } }

/* Kontener: koszty importu */
.cargo-import { margin-top: 16px; }
.ci-head { display: flex; align-items: flex-start; gap: 12px; }
.ci-rows { display: grid; gap: 10px; margin-bottom: 8px; }
.ci-row { display: grid; grid-template-columns: minmax(160px, 2fr) 90px 120px minmax(170px, 1.4fr) 80px 100px; gap: 8px; align-items: end; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.ci-row .ci-meta { grid-column: 1 / -1; margin-top: -4px; }
.ci-cost { display: grid; grid-template-columns: minmax(160px, 2fr) 120px 90px minmax(170px, 1.4fr) 36px; gap: 8px; align-items: end; }
.ci-cn-in { display: flex; gap: 4px; align-items: center; }
.ci-cn-in input { flex: 1; min-width: 0; }
.cargo-landed td .sub { font-size: 12px; }
@media (max-width: 760px) {
  .ci-row { grid-template-columns: 1fr 1fr; }
  .ci-row .ci-name, .ci-row .ci-cn { grid-column: 1 / -1; }
  .ci-cost { grid-template-columns: 1fr 1fr; }
  .ci-cost .ci-name, .ci-cost .ci-part { grid-column: 1 / -1; }
}

/* Automaty */
.rule-form .section-title { margin-top: 10px; }
.rule-action { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.rule-action > select { width: auto; min-width: 180px; }
.rule-action textarea { flex: 1 1 260px; }
.rule-params { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 260px; align-items: center; }
.rule-params > input:first-child { flex: 1 1 220px; }
.rule-params select { width: auto; }
.rule-inline { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
.rule-inline input { width: 56px; }
.rule-recipes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.rule-recipe { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.rule-recipe .small { font-size: 13px; margin: 0; flex: 1; }
.rule-recipe .btn { align-self: flex-start; }
.rule-on { font-size: 12px; color: var(--muted); }
.rule-status { font-size: 12px; border-radius: 999px; padding: 1px 9px; background: var(--input-bg); color: var(--muted); white-space: nowrap; }
.rule-status.done { background: var(--accent-soft); color: var(--accent-ink); }
.rule-status.error { color: var(--danger); }
.rule-status.scheduled { color: var(--warn); }

/* Wynajem: protokół zdjęciowy */
.pp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pp-col h3 { margin: 0 0 8px; font-size: 15px; }
.pp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.pp-photo { position: relative; margin: 0; }
.pp-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; cursor: zoom-in; display: block; background: var(--input-bg); }
.pp-photo figcaption { font-size: 11px; color: var(--muted); margin-top: 3px; }
.pp-del { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; min-width: 0; min-height: 0; padding: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.55); color: #fff; border-radius: 8px; }
.pp-del svg { width: 15px; height: 15px; }
.pp-add { aspect-ratio: 4 / 3; border: 1.5px dashed var(--edge); border-radius: 10px; background: var(--input-bg); color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; font: inherit; font-size: 13px; }
.pp-add:hover { color: var(--fg); border-color: var(--accent); }
.pp-slider { position: relative; max-width: 600px; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--input-bg); user-select: none; }
.pp-slider > img, .pp-top img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pp-top { position: absolute; inset: 0; }
.pp-slider::after { content: ''; position: absolute; top: 0; bottom: 0; left: var(--cut, 50%); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25); pointer-events: none; }
.pp-range { position: absolute; left: 12px; right: 12px; bottom: 10px; width: calc(100% - 24px); max-width: none; margin: 0; accent-color: var(--accent); }
.pp-tag { position: absolute; top: 10px; padding: 2px 9px; border-radius: 999px; font-size: 12px; background: rgba(0, 0, 0, 0.55); color: #fff; }
.pp-tag.l { left: 10px; } .pp-tag.r { right: 10px; }
.pp-result.damage { border-color: var(--danger); }
.pp-findings li { align-items: flex-start; }
.pp-thumb { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; cursor: pointer; flex: none; }
.pp-badge { display: inline-flex; align-items: center; gap: 4px; }
.pp-badge .pill { margin-left: 4px; }
@media (max-width: 700px) { .pp-cols { grid-template-columns: 1fr; } .pp-grid { grid-template-columns: repeat(3, 1fr); } }
.ci-stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.ci-stats strong { font-size: 20px; white-space: nowrap; }
.cargo-import .toolbar select { width: auto; }
.ci-cands { display: grid; gap: 8px; margin-bottom: 8px; }
.ci-cand { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.ci-cand:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.ci-cand input { margin-top: 4px; }
.rule-actions { display: grid; gap: 10px; margin-bottom: 8px; }
.rule-step { border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: grid; gap: 8px; background: var(--input-bg); }
.rule-step-head { display: flex; gap: 8px; align-items: center; }
.rule-step-head select { flex: 1; }
.rule-step-n { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: inline-grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.rule-step .rule-params { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rule-step .rule-params > input:first-child { grid-column: 1 / -1; }
.rule-step .rule-params select { width: 100%; }
.rule-step .rule-inline { white-space: nowrap; }
.rule-step > textarea { width: 100%; }
@media (max-width: 560px) { .rule-step .rule-params { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .rule-list .file-ico { display: none; } }

/* ---------- Komunikator ---------- */
.content:has(.chat-app) { overflow: hidden; }
.view:has(.chat-app) { max-width: 1280px; height: 100%; padding: 12px 16px; box-sizing: border-box; display: flex; flex-direction: column; }
.view:has(.chat-app) > div:last-child { flex: 1; min-height: 0; }
.chat-app { height: 100%; display: grid; grid-template-columns: 300px minmax(0, 1fr); border: 1px solid var(--line); border-radius: var(--radius-lg, 14px); overflow: hidden; background: var(--surface); box-shadow: var(--sheen); }
.chat-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.chat-side-head { display: flex; gap: 8px; padding: 10px; border-bottom: 1px solid var(--line); }
.chat-side-head .chat-search { flex: 1; min-width: 0; }
.chat-side-head .btn { display: inline-flex; align-items: center; gap: 4px; }
.chat-side-head .btn .i { width: 18px; height: 18px; }
.chat-rooms { flex: 1; overflow-y: auto; }
.chat-room { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); background: none; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.chat-room:hover { background: var(--hover); }
.chat-room.active { background: var(--accent-soft); }
.chat-room-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.chat-room-top { display: flex; justify-content: space-between; gap: 8px; }
.chat-room-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.chat-room-time { color: var(--muted); font-size: 12px; flex: none; }
.chat-room-last { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-room.unread .chat-room-last { color: var(--fg); font-weight: 600; }
.chat-room .chat-unread { position: static; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; display: grid; place-items: center; flex: none; }
.chat-muted .i { width: 16px; height: 16px; fill: var(--muted); }
.chat-av-wrap { position: relative; flex: none; display: inline-grid; }
.chat-av { width: 40px; height: 40px; font-size: 14px; }
.chat-av.sm { width: 28px; height: 28px; font-size: 11px; }
.chat-av.xs { width: 18px; height: 18px; font-size: 8px; }
.chat-av.group { background: var(--accent-soft) !important; }
.chat-av.group .i { width: 22px; height: 22px; fill: var(--accent-ink); }
.online-dot { position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; background: #30d158; box-shadow: 0 0 0 2px var(--surface-solid); }
.online-dot.inline { position: static; display: inline-block; width: 8px; height: 8px; box-shadow: none; }
.online-text { color: #30d158; }
.typing-text { color: var(--accent-ink); font-style: italic; }
.chat-empty-list, .chat-welcome { display: grid; justify-items: center; gap: 8px; padding: 32px 16px; text-align: center; }
.chat-welcome { align-content: center; height: 100%; }
.chat-welcome h3 { margin: 0; }

.chat-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; }
.chat-pane.drop::after { content: 'Upuść pliki, aby wysłać'; position: absolute; inset: 8px; display: grid; place-items: center; border: 2px dashed var(--accent); border-radius: 12px; background: var(--overlay); color: #fff; font-weight: 600; z-index: 3; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.chat-head-text { flex: 1; min-width: 0; }
.chat-head-text strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head-sub { font-size: 12px; color: var(--muted); min-height: 16px; }
.chat-back { display: none; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 12px 14px 4px; overscroll-behavior: contain; }
.chat-older { display: block; margin: 0 auto 10px; }
.chat-track { display: flex; flex-direction: column; }
.day-sep { flex-basis: 100%; text-align: center; margin: 14px 0 8px; }
.day-sep span { font-size: 12px; color: var(--muted); background: var(--input-bg); border: 1px solid var(--line); padding: 2px 10px; border-radius: 10px; }

.cm-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; margin-top: 8px; position: relative; }
.cm-row.cont { margin-top: 2px; }
.cm-row.cont > .cm-av { visibility: hidden; }
.cm-row.mine { flex-direction: row-reverse; }
.cm-row.mine > .day-sep { order: -1; }
.cm-main { display: grid; gap: 2px; max-width: min(72%, 560px); min-width: 0; }
.cm-row.mine .cm-main { justify-items: end; }
.cm-author { font-size: 12px; font-weight: 600; padding: 0 10px; }
.cm-row.cont .cm-author { display: none; }
.cm-bubble { padding: 7px 10px 5px; border-radius: 16px; background: var(--surface-strong); border: 1px solid var(--line); overflow-wrap: anywhere; white-space: pre-wrap; min-width: 0; max-width: 100%; }
.cm-row.mine .cm-bubble { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.cm-row:not(.mine).cont .cm-bubble { border-top-left-radius: 6px; }
.cm-row.mine.cont .cm-bubble { border-top-right-radius: 6px; }
.cm-bubble.deleted { opacity: .7; }
.cm-text a { color: inherit; text-decoration: underline; }
.cm-meta { display: block; text-align: right; font-size: 11px; opacity: .7; margin-top: 1px; white-space: nowrap; }
.cm-row.pending .cm-bubble { opacity: .65; }
.cm-row.failed .cm-bubble { outline: 1px solid var(--danger); }
.cm-retry { align-self: center; }
.cm-row.flash .cm-bubble { animation: cm-flash 1.4s ease; }
@keyframes cm-flash { 30% { box-shadow: 0 0 0 3px var(--warn); } }
.cm-row:not(.cont) { animation: cm-in .22s ease-out; }
@keyframes cm-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.cm-big { display: flex; gap: 4px; padding: 2px 0; }
.cm-quote { display: grid; gap: 1px; width: 100%; text-align: left; margin: 0 0 4px; padding: 4px 8px; border: 0; border-left: 3px solid currentColor; border-radius: 6px; background: rgba(127, 127, 127, .16); color: inherit; font: inherit; font-size: 12.5px; cursor: pointer; white-space: normal; }
.cm-quote span { opacity: .85; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cm-image img { display: block; max-width: min(320px, 100%); max-height: 320px; border-radius: 10px; margin: 2px 0; }
.cm-file { display: flex; align-items: center; gap: 8px; padding: 6px 4px; color: inherit; text-decoration: none; white-space: normal; }
.cm-file .i { width: 22px; height: 22px; fill: currentColor; flex: none; }
.cm-file small { display: block; opacity: .75; }
.cm-reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: -4px; padding: 0 6px; position: relative; z-index: 1; }
.cm-react { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px 1px 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-solid); color: var(--fg); font-size: 12px; cursor: pointer; }
.cm-react.mine { border-color: var(--accent); background: var(--accent-soft); }
.cm-seen { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); padding: 0 4px; }
.cm-seen .i { width: 13px; height: 13px; fill: var(--accent-ink); }
.cm-tools { align-self: center; display: flex; gap: 1px; padding: 2px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-solid); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .12s; }
.cm-row:hover > .cm-tools, .cm-row.tools-open > .cm-tools, .cm-tools:focus-within { opacity: 1; pointer-events: auto; }
.cm-tool { width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; font-size: 16px; padding: 0; }
.cm-tool:hover { background: var(--hover); transform: scale(1.15); }
.cm-tool .i { width: 16px; height: 16px; fill: currentColor; }

.chat-typing { min-height: 20px; padding: 0 16px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: typing 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .15s; } .typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.chat-composer { position: relative; padding: 6px 10px 10px; border-top: 1px solid var(--line); }
.chat-compose-row { display: flex; align-items: flex-end; gap: 4px; }
.chat-text { flex: 1; min-width: 0; resize: none; min-height: 40px; max-height: 160px; padding: 9px 12px; border-radius: 20px; line-height: 1.35; }
.chat-send { background: var(--accent); color: var(--on-accent); border-radius: 50%; }
.chat-send .i { fill: var(--on-accent); }
.chat-context { display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin-bottom: 6px; border-left: 3px solid var(--accent); border-radius: 6px; background: var(--input-bg); font-size: 13px; }
.chat-context .i { width: 18px; height: 18px; fill: var(--accent-ink); flex: none; }
.chat-context-text { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.chat-picker-wrap { position: absolute; bottom: calc(100% + 4px); left: 10px; z-index: 4; }
.chat-people { display: flex; flex-wrap: wrap; gap: 6px; }

/* Emotki */
.emo { position: relative; display: inline-grid; place-items: center; line-height: 1; vertical-align: -0.2em; flex: none; }
.emo-glyph { font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; }
.emo-anim { position: absolute; inset: 0; }
.emo-anim svg { display: block; }
.emo.ready > .emo-glyph { visibility: hidden; }
.emo.inline { margin: 0 1px; }
.emo.pop { animation: emo-pop .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes emo-pop { 0% { transform: scale(.4); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }
.emo-picker { width: min(340px, calc(100vw - 40px)); border: 1px solid var(--line); border-radius: 14px; background: var(--surface-solid); box-shadow: var(--shadow); overflow: hidden; }
.emo-tabs { display: flex; border-bottom: 1px solid var(--line); }
.emo-tab { flex: 1; padding: 6px; border: 0; background: none; font-size: 20px; cursor: pointer; }
.emo-tab[aria-selected='true'] { background: var(--accent-soft); }
.emo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); max-height: 240px; overflow-y: auto; padding: 6px; }
.emo-btn { height: 40px; font-size: 25px; border: 0; border-radius: 8px; background: none; cursor: pointer; display: grid; place-items: center; padding: 0; }
.emo-btn:hover { background: var(--hover); }
.emo-quick { font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; }

@media (max-width: 760px) {
  .view:has(.chat-app) { padding: 0; }
  .chat-app { grid-template-columns: minmax(0, 1fr); border: 0; border-radius: 0; }
  .chat-side { border-right: 0; }
  .chat-app.in-room .chat-side, .chat-app:not(.in-room) .chat-pane { display: none; }
  .chat-back { display: grid; }
  .cm-main { max-width: 82%; }
  .cm-tools { position: absolute; bottom: calc(100% - 4px); z-index: 2; }
  .cm-row:not(.mine) > .cm-tools { left: 34px; }
  .cm-row.mine > .cm-tools { right: 0; }
  .cm-row:hover > .cm-tools { opacity: 0; pointer-events: none; }
  .cm-row.tools-open > .cm-tools { opacity: 1; pointer-events: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .cm-row:not(.cont), .emo.pop, .typing-dots i { animation: none; }
}
