/* ---------- motyw ---------- */
:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #efefec;
  --column: #ececE8;
  --border: #e2e2dd;
  --text: #22252a;
  --muted: #6c7178;
  --accent: #3f6f8f;
  --accent-soft: #e3edf3;
  --danger: #b4443b;
  --shadow: 0 1px 2px rgba(20, 22, 26, .06), 0 1px 1px rgba(20, 22, 26, .04);
  --shadow-lg: 0 10px 40px rgba(20, 22, 26, .18);
  --radius: 10px;
  --tap: 40px;

  --gray-bg: #ececea;   --gray-fg: #5d6168;   --gray-dot: #9a9ea5;
  --blue-bg: #e2ecf4;   --blue-fg: #2f5d80;   --blue-dot: #5b8db5;
  --green-bg: #e3f0e6;  --green-fg: #2f6a3f;  --green-dot: #5aa06c;
  --yellow-bg: #f6efd6; --yellow-fg: #7a6118; --yellow-dot: #c9a73c;
  --orange-bg: #f8e8dc; --orange-fg: #8a4a1f; --orange-dot: #d0834f;
  --red-bg: #f7e1df;    --red-fg: #93352d;    --red-dot: #cc6359;
  --purple-bg: #ece6f4; --purple-fg: #5b4682;  --purple-dot: #8f78b8;
  --teal-bg: #dff0ee;   --teal-fg: #2b6660;   --teal-dot: #4f9d94;
  --pink-bg: #f6e3ec;   --pink-fg: #873e60;   --pink-dot: #c36f96;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18191b; --surface: #222327; --surface-2: #2a2c30; --column: #1f2023; --border: #33353a;
    --text: #e6e6e3; --muted: #9a9ea6; --accent: #7fb0d0; --accent-soft: #24343f; --danger: #e07a70;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
    --gray-bg: #2e3034;   --gray-fg: #b7bac0;
    --blue-bg: #213342;   --blue-fg: #9cc3e2;
    --green-bg: #213629;  --green-fg: #9bd0a8;
    --yellow-bg: #3a3320; --yellow-fg: #e3cb7d;
    --orange-bg: #3d2b1f; --orange-fg: #eab08a;
    --red-bg: #3e2423;    --red-fg: #f0a39b;
    --purple-bg: #2f2a3d; --purple-fg: #c5b5e3;
    --teal-bg: #1f3634;   --teal-fg: #94d0c8;
    --pink-bg: #3a2530;   --pink-fg: #eaa9c7;
    color-scheme: dark;
  }
}
.c-gray { --c-bg: var(--gray-bg); --c-fg: var(--gray-fg); --c-dot: var(--gray-dot); }
.c-blue { --c-bg: var(--blue-bg); --c-fg: var(--blue-fg); --c-dot: var(--blue-dot); }
.c-green { --c-bg: var(--green-bg); --c-fg: var(--green-fg); --c-dot: var(--green-dot); }
.c-yellow { --c-bg: var(--yellow-bg); --c-fg: var(--yellow-fg); --c-dot: var(--yellow-dot); }
.c-orange { --c-bg: var(--orange-bg); --c-fg: var(--orange-fg); --c-dot: var(--orange-dot); }
.c-red { --c-bg: var(--red-bg); --c-fg: var(--red-fg); --c-dot: var(--red-dot); }
.c-purple { --c-bg: var(--purple-bg); --c-fg: var(--purple-fg); --c-dot: var(--purple-dot); }
.c-teal { --c-bg: var(--teal-bg); --c-fg: var(--teal-fg); --c-dot: var(--teal-dot); }
.c-pink { --c-bg: var(--pink-bg); --c-fg: var(--pink-fg); --c-dot: var(--pink-dot); }

/* ---------- podstawy ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
body.modal-open { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 22px; font-weight: 600; margin: 4px 0 16px; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 10px; }
h4 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
input, select, textarea, button { font: inherit; color: inherit; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-height: var(--tap);
  width: 100%; outline: none; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 60px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; }
.icon { flex: none; vertical-align: middle; }
.rot90 { transform: rotate(90deg); }
.spacer { flex: 1; }
.hint { color: var(--muted); font-size: 12.5px; }
.center { text-align: center; }
.error { color: var(--danger); }
.muted { opacity: .55; }
.row { display: flex; align-items: center; }
.row.gap, .gap { gap: 8px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.full { flex-basis: 100%; }
.desktop-only { display: flex; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.loading.full { height: 100vh; display: grid; place-items: center; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }

/* ---------- przyciski ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #10161a; } }
.btn.primary:hover { filter: brightness(1.06); }
.btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 30px; padding: 3px 9px; font-size: 13px; }
.btn.block { width: 100%; }
.file-btn { cursor: pointer; }
.icon-btn {
  display: inline-grid; place-items: center; min-width: 34px; min-height: 34px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer; position: relative; padding: 0;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: .35; }
.link-btn { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12.5px; padding: 0 4px; }
.link-btn:hover { color: var(--accent); }
.placeholder-btn { width: 100%; text-align: left; border: 1px dashed var(--border); border-radius: 8px; background: none; padding: 12px; color: var(--muted); cursor: pointer; }

/* ---------- etykiety (chip) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 1px 8px; border-radius: 999px;
  background: var(--c-bg, var(--gray-bg)); color: var(--c-fg, var(--gray-fg)); font-size: 12px; font-weight: 500; line-height: 20px; border: 1px solid transparent;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c-dot, var(--gray-dot)); flex: none; }
.chip.clickable { cursor: pointer; min-height: 32px; padding: 3px 11px; font-size: 13px; opacity: .75; }
.chip.clickable:hover { opacity: 1; }
.chip.clickable.active { opacity: 1; border-color: var(--c-fg, var(--gray-fg)); box-shadow: inset 0 0 0 1px var(--c-fg, var(--gray-fg)); }
.chip.person { background: var(--surface); border-color: var(--border); color: var(--text); min-height: 34px; padding: 3px 11px 3px 4px; cursor: pointer; opacity: .8; font-size: 13px; }
.chip.person.active { opacity: 1; background: var(--accent-soft); border-color: var(--accent); }
.chip.add { padding: 3px 12px; }
.avatar {
  display: inline-grid; place-items: center; border-radius: 50%; background: var(--c-bg, var(--blue-bg)); color: var(--c-fg, var(--blue-fg));
  font-weight: 600; flex: none; letter-spacing: -.02em; border: 2px solid var(--surface);
}
.avatars { display: inline-flex; }
.avatars .avatar + .avatar { margin-left: -6px; }

/* ---------- górny pasek ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.app.on-board { height: 100vh; height: 100dvh; overflow: hidden; }
main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top));
  background: var(--bg); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--text); font-size: 15px; }
.brand.big { font-size: 22px; justify-content: center; margin-bottom: 20px; }
.logo { width: 24px; height: 24px; border-radius: 6px; background: url(/icons/icon.svg) center/cover; flex: none; }
.brand.big .logo { width: 34px; height: 34px; }
.board-select { width: auto !important; max-width: 260px; font-weight: 600; border-color: transparent !important; background: transparent !important; }
.board-select:hover { background: var(--surface-2) !important; }
.nav { gap: 2px; }
.nav-link { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; color: var(--muted); border: 0; background: none; cursor: pointer; text-align: left; width: 100%; min-height: var(--tap); }
.nav .nav-link { width: auto; }
.nav-link:hover, .nav-link.active { background: var(--surface-2); color: var(--text); }
.menu-list { display: flex; flex-direction: column; gap: 2px; }
.badge {
  position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center;
}

/* ---------- tablica ---------- */
.board { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; flex-wrap: wrap; }
.search { position: relative; display: flex; align-items: center; flex: 0 1 280px; min-width: 160px; }
.search .icon { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 32px !important; min-height: 36px; }
.search.big { flex: none; max-width: 640px; margin-bottom: 10px; }
.search.big input { min-height: 46px; font-size: 16px; padding-left: 38px !important; }
.search.big .icon { left: 12px; }
.columns { flex: 1; min-height: 0; display: flex; gap: 12px; padding: 0 16px 16px; overflow-x: auto; align-items: flex-start; }
.column {
  flex: 0 0 290px; max-height: 100%; display: flex; flex-direction: column; background: var(--column);
  border-radius: 12px; padding: 6px;
}
.column-head { display: flex; align-items: center; gap: 6px; padding: 4px 4px 6px 8px; cursor: grab; }
.column-head h3 { margin: 0; font-size: 13.5px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-rule { display: block; font-size: 11px; font-weight: 500; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.count { color: var(--muted); font-size: 12px; font-weight: 500; }
.card-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 2px; min-height: 40px; }
.column-empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 10px; }
.drop-placeholder { height: 46px; border-radius: 8px; border: 2px dashed var(--accent); background: var(--accent-soft); flex: none; }
.add-card-btn, .add-column {
  display: flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--muted); padding: 8px; border-radius: 8px;
  cursor: pointer; min-height: var(--tap); text-align: left;
}
.add-card-btn:hover, .add-column:hover { background: var(--surface-2); color: var(--text); }
.add-column { flex: 0 0 220px; background: var(--column); opacity: .8; }
.add-card { padding: 4px 2px; display: flex; flex-direction: column; gap: 6px; }
.add-card textarea { min-height: 60px; }

/* kafelek */
.tile {
  background: var(--surface); border-radius: 9px; padding: 9px 10px 7px; box-shadow: var(--shadow); cursor: pointer;
  border: 1px solid transparent; display: flex; flex-direction: column; gap: 6px; flex: none; outline: none;
}
.tile:hover { border-color: var(--border); }
.tile:focus-visible { border-color: var(--accent); }
.tile.dragging { opacity: .35; }
.tile.archived { opacity: .7; }
.tile.done .tile-title { color: var(--muted); }
.tile-title { font-weight: 500; overflow-wrap: anywhere; }
.tile-sub { font-size: 12px; color: var(--muted); margin-top: -4px; }
.tile-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.tile-chips .chip { font-size: 11.5px; line-height: 18px; padding: 0 7px; }
.tile-labels { display: flex; flex-wrap: wrap; gap: 4px; }
.label-bar { background: var(--c-dot); color: #fff; font-size: 10.5px; font-weight: 600; border-radius: 4px; padding: 0 6px; line-height: 16px; min-width: 28px; height: 16px; }
.tile.compact .label-bar { height: 5px; min-width: 26px; padding: 0; }
.tile.compact { padding: 7px 9px 5px; gap: 4px; }
.tile-foot { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; min-height: 22px; }
.tile-foot .meta-item, .due { display: inline-flex; align-items: center; gap: 3px; }
.meta-item.ok { color: var(--green-fg); }
.due.overdue { color: var(--red-fg); background: var(--red-bg); border-radius: 5px; padding: 0 5px; font-weight: 600; }
.due.soon { color: var(--orange-fg); background: var(--orange-bg); border-radius: 5px; padding: 0 5px; }
.modal-moves { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.move-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 6px; padding: 2px 8px;
  font-size: 12px; min-height: 26px; cursor: pointer; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.move-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.move-btn:disabled { opacity: .5; }
.modal-moves .move-btn { min-height: 32px; font-size: 13px; padding: 4px 11px; }
@media (hover: none) { .move-btn { min-height: 32px; padding: 4px 10px; } }
.tile-menu { min-width: 28px; min-height: 26px; margin-right: -4px; opacity: 0; }
.tile:hover .tile-menu, .tile:focus-within .tile-menu { opacity: 1; }
@media (hover: none) { .tile-menu { opacity: 1; } }

/* telefon */
.col-tabs { display: flex; gap: 4px; overflow-x: auto; padding: 0 12px 8px; scrollbar-width: none; flex: none; }
.col-tabs::-webkit-scrollbar { display: none; }
.col-tab {
  flex: none; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 13px;
  min-height: 36px; cursor: pointer; display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.col-tab.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.col-tab.active .count { color: inherit; opacity: .7; }
.mobile-col-head { display: flex; align-items: center; padding: 0 16px; font-weight: 600; gap: 6px; flex: none; }
.mobile-col-head span { flex: 1; }
.columns.mobile { padding: 4px 12px 90px; overflow-x: hidden; overflow-y: auto; display: block; }
.columns.mobile .column { background: none; padding: 0; max-height: none; }
.columns.mobile .card-list { overflow: visible; gap: 8px; }
.columns.mobile .tile { padding: 11px 12px 9px; }
.fab {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%;
  border: 0; background: var(--accent); color: #fff; box-shadow: var(--shadow-lg); display: grid; place-items: center; cursor: pointer; z-index: 15;
}
.move-list { display: flex; flex-direction: column; gap: 4px; }
.move-row { display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border-radius: 8px; background: var(--surface-2); }
.move-row span { flex: 1; font-weight: 500; }
.move-row.current { outline: 2px solid var(--accent); }

/* ---------- okna ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(20, 22, 26, .38); z-index: 50; display: flex; align-items: flex-start;
  justify-content: center; overflow-y: auto; padding: 48px 16px; animation: fade .12s;
}
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--bg); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; position: relative; }
.modal.wide { max-width: 980px; }
.modal-head { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 16px; margin: 0; flex: 1; }
.pad { padding: 16px; }
.sheet-overlay { align-items: center; padding: 16px; }
.sheet {
  background: var(--bg); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: calc(100vh - 32px);
  display: flex; flex-direction: column; animation: rise .16s ease-out;
}
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--border); }
.sheet-head strong { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.sheet-actions { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 14px; }
.filter-section { display: flex; flex-direction: column; }
.toggle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.toggle { display: flex; align-items: center; gap: 8px; min-height: 32px; cursor: pointer; }
.small-toggle { font-size: 12.5px; color: var(--muted); min-height: 28px; gap: 6px; }
.small-toggle input { width: 16px; height: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12.5px; color: var(--muted); font-weight: 500; }

/* ---------- karta (szczegóły) ---------- */
.card-head { display: flex; align-items: flex-start; gap: 8px; padding: 16px 16px 10px 20px; border-bottom: 1px solid var(--border); }
.card-head-main { flex: 1; min-width: 0; }
.card-title-input {
  font-size: 19px !important; font-weight: 600; border-color: transparent !important; background: transparent !important;
  padding: 4px 6px !important; margin-left: -6px; resize: none; min-height: 0 !important; field-sizing: content; box-shadow: none !important;
}
.card-title-input:hover { background: var(--surface) !important; }
.card-title-input:focus { background: var(--surface) !important; border-color: var(--accent) !important; }
.card-sub { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.card-sub span::after { content: "›"; margin-left: 6px; }
.inline-select { width: auto !important; min-height: 30px !important; padding: 2px 8px !important; font-weight: 500; }
.banner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--yellow-bg); color: var(--yellow-fg); padding: 8px 12px; border-radius: 8px; margin: 0 0 10px; }
.banner select { width: auto; }
.card-body { display: grid; grid-template-columns: 1fr 300px; }
.card-main { padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 22px; min-width: 0; order: 1; }
.card-side { order: 2; padding: 16px; border-left: 1px solid var(--border); background: var(--surface-2); border-bottom-right-radius: 14px; }
.props { display: flex; flex-direction: column; gap: 12px; }
.assignees { display: flex; flex-direction: column; gap: 4px; }
.assignee { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 4px 4px 4px 6px; }
.assignee-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.assignee-remove { border: 0; background: none; color: var(--muted); width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; cursor: pointer; padding: 0; }
.assignee-remove:hover { background: var(--red-bg); color: var(--red-fg); }
.add-person { color: var(--accent); font-weight: 500; }
.prop { display: flex; flex-direction: column; gap: 5px; }
.prop-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.prop input[type=date] { flex: 1; }
.prop input[type=time] { width: 110px; }
.prop .amount { flex: 1; }
.prop select:not(.status-select) + select, .prop .row select { width: 90px; flex: none; }
.status-select { font-weight: 500; }
.status-select[class*=c-] { background: var(--c-bg) !important; color: var(--c-fg); border-color: transparent; }
.side-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.section h4 { margin-bottom: 10px; }
.section.drag-over { outline: 2px dashed var(--accent); outline-offset: 6px; border-radius: 6px; }
.desc { white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; }
.desc-input { min-height: 140px; margin-bottom: 8px; }
/* brief */
.brief {
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); border-left: 4px solid var(--accent);
  border-radius: 12px; background: var(--surface); padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px;
}
.brief.empty { border-style: dashed; border-left-style: solid; }
.brief-bar {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; cursor: pointer; font: inherit; color: inherit;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); border-left: 4px solid var(--accent);
  border-radius: 12px; background: var(--surface); padding: 10px 12px; min-height: 52px; transition: box-shadow .15s, border-color .15s;
}
.brief-bar:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.brief-bar.empty { border-style: dashed; border-left-style: solid; }
.brief-bar-tabs { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.brief-chip { background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 2px 9px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.brief-chip.empty { background: var(--surface-2); color: var(--muted); }
.brief-bar-empty { color: var(--muted); font-size: 13px; }
.brief-open-label { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); font-weight: 600; font-size: 13px; white-space: nowrap; }
.brief-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.brief-badge {
  display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: #fff; font-weight: 700;
  font-size: 12px; letter-spacing: .08em; padding: 3px 10px; border-radius: 6px;
}
@media (prefers-color-scheme: dark) { .brief-badge { color: #10161a; } }
.brief-empty { display: flex; flex-direction: column; gap: 10px; text-align: left; align-items: flex-start; }
.brief-empty p { margin: 0; color: var(--muted); }
.brief-tabs { display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden; border-bottom: 1px solid var(--border); scrollbar-width: thin; }
.brief-tab {
  border: 0; background: none; padding: 8px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap; font-weight: 500; min-height: 38px; border-radius: 6px 6px 0 0;
}
.brief-tab:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.brief-tab.active { color: var(--accent); border-bottom-color: var(--accent); background: var(--accent-soft); }
.brief-tab:disabled { opacity: .45; cursor: default; }
.brief-tab.add { color: var(--accent); display: inline-flex; align-items: center; gap: 4px; }
.brief-new { display: flex; align-items: center; gap: 6px; padding: 3px 0; flex: none; }
.brief-new input { width: 240px; min-height: 34px !important; padding: 5px 9px !important; }
.brief-empty .brief-new input { width: min(320px, 60vw); }
.dot-empty { display: inline-block; width: 6px; height: 6px; border-radius: 50%; border: 1px solid var(--muted); vertical-align: middle; margin-left: 2px; }
.brief-body { display: flex; flex-direction: column; gap: 8px; }
.brief-tools { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.brief-content { font-size: 14.5px; line-height: 1.55; }
.brief.fullscreen {
  position: fixed; inset: 0; z-index: 80; border-radius: 0; border: 0; padding: 18px max(16px, calc((100vw - 1100px) / 2)) 40px;
  overflow-y: auto; background: var(--bg);
}
.brief.fullscreen .desc-img img, .brief.fullscreen .desc-editor img.desc-ed-img { max-height: 75vh; }
body.brief-open { overflow: hidden; }
.brief-card-title { font-size: 17px; }
.editor-toolbar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.format-bar { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 4px; gap: 2px; }
.tb-btn {
  min-width: 32px; height: 30px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--text);
  font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 3px; padding: 0 6px;
}
.tb-btn:hover { background: var(--surface); }
.tb-btn.on { background: var(--accent-soft); color: var(--accent); }
.tb-btn.wide { font-size: 12.5px; padding: 0 9px; }
.tb-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.tb-menu { position: relative; }
.tb-pop {
  position: absolute; top: 100%; left: 0; z-index: 20; margin-top: 4px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow-lg); padding: 4px; display: flex; flex-direction: column; min-width: 170px;
}
.tb-pop.colors { flex-direction: row; flex-wrap: wrap; gap: 6px; padding: 8px; min-width: 200px; align-items: center; }
.tb-opt { border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: 6px; cursor: pointer; color: var(--text); font-size: 13.5px; }
.tb-opt:hover { background: var(--surface-2); }
.tb-opt.h1 { font-size: 19px; font-weight: 700; }
.tb-opt.h2 { font-size: 16px; font-weight: 700; }
.tb-swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); cursor: pointer; padding: 0; }
.tb-color { font-weight: 700; border-bottom: 3px solid #c0392b; line-height: 1; padding: 0 1px; }
/* formatowanie treści – w edytorze i w widoku */
.desc-editor h1, .md-h1 { font-size: 22px; font-weight: 700; line-height: 1.3; margin: 10px 0 4px; }
.desc-editor h2, .md-h2 { font-size: 17px; font-weight: 700; line-height: 1.35; margin: 8px 0 2px; }
.desc-editor ul, .desc-editor ol, .md-list { margin: 4px 0; padding-left: 24px; white-space: normal; }
.desc-editor li, .md-list li { margin: 2px 0; }
.md-p { white-space: pre-wrap; }
.tc-red { color: #c0392b; } .tc-orange { color: #d4780f; } .tc-green { color: #2e8b57; }
.tc-blue { color: #2f6fb0; } .tc-purple { color: #7d4fb0; } .tc-gray { color: #7a7f87; }
@media (prefers-color-scheme: dark) {
  .tc-red { color: #f0857a; } .tc-orange { color: #f2a65a; } .tc-green { color: #6fcf97; }
  .tc-blue { color: #7fb3e6; } .tc-purple { color: #b79ae0; } .tc-gray { color: #a8adb5; }
}
/* przeciąganie zakładek briefu */
.brief-tab.dragging { opacity: .4; }
.brief-tab.drop-before { box-shadow: inset 3px 0 0 var(--accent); }
.brief-tab.drop-after { box-shadow: inset -3px 0 0 var(--accent); }
.rich-editor .desc-editor { margin-bottom: 8px; }
.color-code { display: inline-flex; align-items: center; gap: 5px; font-family: ui-monospace, Consolas, monospace; font-size: .92em; background: var(--surface-2); border-radius: 5px; padding: 0 6px 0 3px; }
.color-code i { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .15); display: inline-block; }
.brief-mark { color: var(--accent); font-weight: 600; }
.desc-wrap { overflow: hidden; position: relative; }
.desc-wrap.collapsed::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 56px; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--bg));
}
.desc-toggle {
  margin-top: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--accent); border-radius: 8px;
  padding: 5px 12px; font-size: 13px; font-weight: 500; cursor: pointer; min-height: 32px;
}
.desc-toggle.top { margin-top: 0; min-height: 28px; padding: 2px 10px; font-size: 12px; text-transform: none; letter-spacing: 0; }
.desc-toggle:hover { border-color: var(--accent); background: var(--accent-soft); }
.desc-editor {
  min-height: 160px; max-height: 60vh; overflow-y: auto; margin-bottom: 8px; padding: 10px 12px; border: 1px solid var(--accent);
  border-radius: 8px; background: var(--surface); outline: none; box-shadow: 0 0 0 3px var(--accent-soft);
  white-space: normal; overflow-wrap: anywhere; line-height: 1.5; cursor: text;
}
.desc-editor:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.desc-editor img.desc-ed-img { display: block; max-width: 100%; max-height: 320px; margin: 6px 0; border-radius: 8px; border: 1px solid var(--border); cursor: default; }
.desc-editor img.desc-ed-img:hover { outline: 2px solid var(--accent-soft); }
.desc-editor hr, hr.desc-sep { border: 0; border-top: 2px solid var(--border); margin: 12px 0; }
.desc-img { display: block; width: fit-content; max-width: 100%; margin: 6px 0; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.desc-img img { display: block; max-width: 100%; max-height: 420px; object-fit: contain; }
.checklist { margin-bottom: 14px; }
.checklist-head { display: flex; align-items: center; gap: 6px; }
.progress { height: 4px; background: var(--surface-2); border-radius: 2px; margin: 4px 0 6px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--green-dot); transition: width .2s; }
.check-item { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.check-item.done input.plain { text-decoration: line-through; color: var(--muted); }
.add-item input { min-height: 34px; margin-top: 4px; font-size: 13px; }
input.plain, textarea.plain { border-color: transparent !important; background: transparent !important; padding: 4px 6px !important; min-height: 32px !important; box-shadow: none !important; }
input.plain:hover { background: var(--surface) !important; }
input.plain:focus { background: var(--surface) !important; border-color: var(--accent) !important; }
input.strong { font-weight: 600; }
.attachments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.attachments li { display: flex; align-items: center; gap: 10px; }
.thumb { width: 54px; height: 42px; border-radius: 6px; overflow: hidden; background: var(--surface-2); flex: none; display: grid; place-items: center; color: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.tabs.scroll { overflow-x: auto; overflow-y: hidden; margin-bottom: 16px; scrollbar-width: none; }
.row > input.plain { flex: 1; width: auto; min-width: 120px; }
.tab { border: 0; background: none; padding: 8px 12px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; min-height: var(--tap); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 500; }
.comments { display: flex; flex-direction: column; gap: 16px; }
.composer, .comment { display: flex; gap: 10px; align-items: flex-start; }
.composer-box { flex: 1; position: relative; display: flex; flex-direction: column; gap: 6px; }
.suggest { position: absolute; top: 100%; left: 0; z-index: 5; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg); min-width: 220px; padding: 4px; }
.suggest button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; background: none; cursor: pointer; border-radius: 6px; text-align: left; }
.suggest button:hover, .suggest button:first-child { background: var(--surface-2); }
.comment-body { flex: 1; min-width: 0; }
.comment-meta { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.comment-text { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px; margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
.mention { color: var(--accent); font-weight: 600; }
.history { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.history li { display: flex; flex-direction: column; font-size: 13px; padding-left: 12px; border-left: 2px solid var(--border); }

/* ---------- strony ---------- */
.page { width: 100%; max-width: 760px; margin: 0 auto; padding: 20px 16px 60px; }
.page.wide { max-width: 1100px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); margin-bottom: 8px; }
.card-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.list { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--text); min-height: 46px; }
a.list-row:hover { border-color: var(--accent); }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; margin-bottom: 18px; }
.group-title { display: flex; gap: 8px; align-items: baseline; margin-top: 18px; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.stats div { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; min-width: 110px; }
.stats strong { font-size: 18px; }
.stats span { font-size: 12px; color: var(--muted); }
.notes { white-space: pre-wrap; color: var(--muted); }
.color-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; background: var(--c-dot); cursor: pointer; padding: 0; }
.swatch.small { width: 18px; height: 18px; flex: none; }
.swatch.active { border-color: var(--text); }
.options { display: flex; flex-direction: column; gap: 4px; }
.option-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 2px 0; }
.option-row > input.plain { flex: 1; min-width: 140px; width: auto; }
.mini { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); cursor: pointer; }
.notify-table { width: 100%; border-collapse: collapse; }
.notify-table th { font-size: 12px; font-weight: 500; color: var(--muted); padding: 6px; }
.notify-table td { padding: 8px 6px; border-top: 1px solid var(--border); }
.notify-table td:not(:first-child), .notify-table th { text-align: center; }
.notifications { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.notifications button { width: 100%; text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 9px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.notifications .unread button { border-left: 3px solid var(--accent); }
.notifications .n-title { font-weight: 600; }
.notifications .n-text { white-space: pre-line; font-size: 13px; }
.linkbox { background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; }
.linkbox p { margin: 0 0 6px; }
.map-table { width: 100%; border-collapse: collapse; }
.map-table td { padding: 7px 4px; border-top: 1px solid var(--border); vertical-align: middle; }
.map-table td:last-child { width: 55%; }
.map-table select { width: auto; max-width: 100%; }
.warnings, .issues, .report, .steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.warnings { color: var(--muted); font-size: 13px; }
.issues { max-height: 320px; overflow-y: auto; font-size: 13px; }

/* weryfikacja dwuetapowa */
.auth-box.wide-box { max-width: 520px; }
.tf-icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.tf-code { font-size: 24px !important; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; max-width: 220px; }
form.stack .tf-code { margin: 0 auto; }
.tf-links { font-size: 13px; }
.tf-qr-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.tf-qr { width: 200px; height: 200px; background: #fff; border-radius: 10px; padding: 8px; border: 1px solid var(--border); }
.tf-manual { flex: 1; min-width: 180px; gap: 6px; }
.tf-secret { font-size: 13px; background: var(--surface-2); padding: 6px 8px; border-radius: 6px; word-break: break-all; user-select: all; }
.tf-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.tf-codes code { background: var(--surface-2); border-radius: 6px; padding: 6px 10px; text-align: center; font-size: 15px; letter-spacing: .05em; }
.tf-badge { display: inline-block; margin-left: 6px; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--orange-bg); color: var(--orange-fg); vertical-align: middle; }
.tf-badge.on { background: var(--green-bg); color: var(--green-fg); }

/* logowanie */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-box { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px 24px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }

/* komunikaty */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 100; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 9px; box-shadow: var(--shadow-lg); font-size: 13.5px; max-width: 90vw; animation: rise .15s; }
.toast.error { background: var(--danger); color: #fff; }
.toast.offline { background: var(--yellow-bg); color: var(--yellow-fg); }

/* ---------- asystent wycen AI ---------- */
.ai-modal { display: flex; flex-direction: column; max-height: calc(100vh - 96px); }
.ai-body { flex: 1; min-height: 240px; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.ai-intro p { margin: 0 0 12px; color: var(--muted); }
.ai-msg { border-radius: 12px; padding: 10px 14px; max-width: 92%; }
.ai-msg.user { align-self: flex-end; background: var(--accent-soft); white-space: pre-wrap; }
.ai-msg.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); }
.ai-msg.live { border-style: dashed; }
.ai-thinking { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.ai-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.ai-composer { border-top: 1px solid var(--border); padding: 10px 16px 12px; display: flex; flex-direction: column; gap: 6px; }
.ai-composer textarea { min-height: 52px; }
.ai-composer .hint { margin: 0; font-size: 11.5px; }
.ai-followups { gap: 4px; }
.ok-text { color: var(--green-fg); }
.ai-thread { display: flex; flex-direction: column; gap: 12px; }
.side-new { margin: 2px 4px 8px; justify-content: center; }
.quote-title { cursor: text; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quote-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.quotes .chat-main .ai-body { padding: 16px 20px; }
.ai-provider { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.ai-provider.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ai-provider-head { cursor: pointer; flex-wrap: wrap; }
.ai-provider .steps { font-size: 13px; color: var(--muted); }
@media (max-width: 760px) { .ai-modal { max-height: none; min-height: 100%; } .ai-msg { max-width: 100%; } }

/* ---------- rozliczenia ---------- */
.billing-filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 4px; }
.billing-filters select { width: auto; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg-btn { border: 0; background: none; padding: 7px 12px; cursor: pointer; color: var(--muted); min-height: 36px; white-space: nowrap; }
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.warn-stat { background: var(--yellow-bg) !important; border-color: transparent !important; cursor: pointer; }
.warn-stat strong, .warn-stat span { color: var(--yellow-fg) !important; }
.bill-client { margin-bottom: 14px; gap: 8px; }
.bill-client-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bill-client-head .chip { font-size: 14px; line-height: 24px; padding: 2px 12px; }
.bill-sum { font-weight: 700; font-size: 16px; }
.bill-month { border-top: 1px solid var(--border); padding-top: 6px; }
.bill-month-head { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 4px 0; text-transform: uppercase; letter-spacing: .03em; }
.bill-row { display: grid; grid-template-columns: 26px 90px 1fr auto 130px 118px; align-items: center; gap: 10px; padding: 5px 0; border-radius: 6px; }
.bill-row:hover { background: var(--surface-2); }
.bill-row.no-amount { opacity: .7; }
.bill-no { color: var(--muted); text-align: right; font-size: 12.5px; }
.bill-date { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.bill-title { border: 0; background: none; text-align: left; padding: 0; cursor: pointer; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.bill-title:hover { color: var(--accent); text-decoration: underline; }
.bill-chips { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.bill-amount { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bill-action-space { width: 1px; }

/* ---------- cennik ---------- */
.side-search { margin: 4px 4px 8px; flex: none; min-width: 0; }
.side-search input { min-height: 34px; }
.price-item { align-items: flex-start; padding: 7px 8px; }
.price-item .chat-name { display: flex; flex-direction: column; }
.price-sub { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.client-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c-dot); flex: none; margin: 5px 4px 0 6px; }
.pricing-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 20px 40px; display: flex; flex-direction: column; gap: 24px; max-width: 900px; }
.pricing-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.pricing-text { display: flex; flex-direction: column; gap: 10px; font-size: 14.5px; line-height: 1.55; tab-size: 4; }
.pricing-meta { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.pricing-input { min-height: 320px; font-size: 14.5px; line-height: 1.5; }
.placeholder-btn.big { padding: 28px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; }
.table-wrap { overflow-x: auto; }
.price-table { border-collapse: collapse; min-width: 50%; }
.price-table td { border: 1px solid var(--border); padding: 6px 10px; vertical-align: top; }
.price-table tr:first-child td { background: var(--surface-2); font-weight: 600; }
.pricing-link { align-self: flex-start; margin-top: -4px; color: var(--accent); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pricing-modal .channel-head { display: none; }
.pricing-modal .pricing-body { max-width: none; overflow: visible; }
.strong-link { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 0; }

/* ---------- czat ---------- */
.mobile-only { display: none !important; }
.icon-btn.active { color: var(--accent); background: var(--accent-soft); }
.chat { flex: 1; min-height: 0; display: grid; grid-template-columns: 260px 1fr; }
.chat-side { border-right: 1px solid var(--border); overflow-y: auto; padding: 10px 8px 20px; display: flex; flex-direction: column; gap: 1px; }
.chat-side-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.chat-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; color: var(--muted); border: 0; background: none;
  cursor: pointer; text-align: left; width: 100%; min-height: 36px; font-size: 14px;
}
.chat-item:hover { background: var(--surface-2); color: var(--text); }
.chat-item.active { background: var(--accent-soft); color: var(--accent); }
.chat-item.unread { color: var(--text); font-weight: 600; }
.chat-item .hash { width: 22px; text-align: center; opacity: .7; }
.chat-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { background: var(--danger); color: #fff; border-radius: 9px; font-size: 11px; font-weight: 700; padding: 0 6px; min-width: 18px; text-align: center; line-height: 18px; }
.side-link { padding: 4px 8px; text-align: left; }
.side-hint { padding: 4px 8px; }
.chat-main { min-height: 0; display: flex; flex-direction: column; }
.channel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.channel-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); min-height: 52px; }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 0 12px; }
.load-older { display: flex; margin: 8px auto; }
.day-sep { display: flex; align-items: center; gap: 10px; margin: 14px 16px 6px; color: var(--muted); font-size: 12px; font-weight: 500; }
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.msg { display: flex; gap: 10px; padding: 4px 16px; position: relative; }
.msg.grouped { padding-top: 1px; padding-bottom: 1px; }
.msg:hover { background: var(--surface-2); }
.msg-avatar { width: 32px; flex: none; display: flex; justify-content: center; }
.msg-time-side { font-size: 10.5px; color: var(--muted); opacity: 0; padding-top: 3px; }
.msg:hover .msg-time-side { opacity: 1; }
.msg-body { flex: 1; min-width: 0; }
.msg-meta { display: flex; align-items: baseline; gap: 8px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-actions { position: absolute; right: 12px; top: -10px; display: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); }
.msg:hover .msg-actions { display: flex; }
@media (hover: none) { .msg-actions { position: static; display: flex; border: 0; box-shadow: none; background: none; } }
.composer-bar { display: flex; align-items: flex-end; gap: 8px; padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.mention-input { flex: 1; position: relative; }
.mention-input textarea { min-height: 42px; max-height: 200px; resize: none; display: block; }
.send-btn { min-height: 42px; min-width: 46px; }
.suggest.up { top: auto; bottom: 100%; margin-bottom: 4px; }
.suggest button.sel { background: var(--surface-2); }
.suggest:has(.sel) button:first-child:not(.sel) { background: none; }
.edit-msg { margin-top: 4px; }
.channel { position: relative; }
.channel.drag-over .messages { opacity: .35; }
.drop-hint {
  position: absolute; inset: 60px 16px 80px; z-index: 5; border: 2px dashed var(--accent); border-radius: 14px; background: var(--accent-soft);
  color: var(--accent); display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 600; pointer-events: none;
}
.composer-wrap { border-top: 1px solid var(--border); }
.composer-wrap .composer-bar { border-top: 0; }
.attach-btn { min-height: 42px; min-width: 40px; }
.pending-files { display: flex; gap: 8px; padding: 10px 16px 0; overflow-x: auto; }
.pending-file {
  position: relative; flex: none; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 6px 28px 6px 6px; max-width: 240px;
}
.pending-file img, .pf-icon { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; flex: none; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.pf-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pf-remove { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--text); display: grid; place-items: center; cursor: pointer; padding: 0; }
.msg-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.msg-image { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.msg-image img { display: block; max-width: min(360px, 70vw); max-height: 280px; object-fit: contain; }
.msg-file {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); max-width: 320px; min-width: 200px;
}
.msg-file:hover { border-color: var(--accent); }

/* ---------- responsywność ---------- */
@media (max-width: 760px) {
  .desktop-only { display: none; }
  .topbar { padding: 6px 10px; padding-top: max(6px, env(safe-area-inset-top)); gap: 4px; }
  .brand-name { display: none; }
  .board-select { flex: 1; max-width: none; font-size: 16px; }
  .toolbar { padding: 8px 12px; gap: 6px; }
  .search { flex: 1 1 100%; }
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px; } /* bez powiększania na iOS */
  .overlay { padding: 0; }
  .modal, .modal.wide { border-radius: 0; min-height: 100%; max-width: none; }
  .card-head { position: sticky; top: 0; background: var(--bg); z-index: 3; padding: 10px 8px 8px 14px; padding-top: max(10px, env(safe-area-inset-top)); }
  .card-body { display: flex; flex-direction: column; }
  .card-side { order: 1; border-left: 0; border-bottom: 1px solid var(--border); border-radius: 0; }
  .card-main { order: 2; padding: 16px 14px 40px; }
  .sheet-overlay { align-items: flex-end; padding: 0; }
  .sheet { max-width: none; border-radius: 16px 16px 0 0; max-height: 88vh; padding-bottom: env(safe-area-inset-bottom); }
  .toggle-grid { grid-template-columns: 1fr; }
  .page { padding: 14px 12px 60px; }
  .map-table td { display: block; width: 100% !important; border-top: 0; padding: 3px 0; }
  .map-table tr { display: block; border-top: 1px solid var(--border); padding: 6px 0; }
  .btn.small { min-height: 34px; }
  .mobile-only { display: inline-grid !important; }
  .chat { grid-template-columns: 1fr; }
  .chat.has-channel .chat-side { display: none; }
  .chat:not(.has-channel) .chat-main { display: none; }
  .chat-side { border-right: 0; }
  .chat-item { min-height: 44px; font-size: 15px; }
  .channel-head { padding: 6px 10px; }
  .msg { padding: 4px 12px; }
  .composer-bar { padding: 8px 10px; padding-bottom: max(8px, env(safe-area-inset-bottom)); gap: 4px; }
  .pending-files { padding: 8px 10px 0; }
  .pricing-body { padding: 14px 12px 40px; }
  .pricing-input { min-height: 50vh; }
  .bill-row { grid-template-columns: 22px 1fr auto; grid-template-areas: "no title amount" "no date action" "no chips chips"; row-gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--border); }
  .bill-no { grid-area: no; align-self: start; }
  .bill-title { grid-area: title; white-space: normal; }
  .bill-date { grid-area: date; font-size: 12px; }
  .bill-amount { grid-area: amount; }
  .bill-chips { grid-area: chips; justify-content: flex-start; }
  .bill-row > .btn, .bill-action-space { grid-area: action; justify-self: end; }
  .seg { width: 100%; }
  .seg-btn { flex: 1; padding: 7px 6px; font-size: 13px; white-space: normal; }
}
@media (min-width: 761px) and (max-width: 1150px) {
  .nav .nav-link span { display: none; }
}
@media (min-width: 761px) and (max-width: 1000px) {
  .card-body { grid-template-columns: 1fr 260px; }
}

/* ---------- kolor kolumny (wyróżnienie sekcji) ---------- */
.column.col-tint { box-shadow: inset 0 3px 0 var(--c-dot); }
.column.col-tint .column-head h3 { color: var(--c-fg); }
.col-color-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.col-tab.col-tint { box-shadow: inset 0 -3px 0 var(--c-dot); }

/* ---------- kalkulator ---------- */
.calc-page h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; }
.calc-layout { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 24px; align-items: start; }
.calc { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px; box-shadow: var(--shadow); }
.calc-display { background: var(--column); border-radius: 12px; padding: 12px 14px; text-align: right; margin-bottom: 10px; min-height: 96px; }
.calc-expr { color: var(--muted); font-size: 14px; min-height: 20px; overflow-wrap: anywhere; }
.calc-main { font-size: 38px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.calc-main.long { font-size: 26px; }
.calc-error { color: var(--danger); font-size: 13px; margin-top: 4px; }
.calc-vat { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-bottom: 6px; }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.calc-key {
  min-height: 52px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 20px; font-weight: 500; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.calc-key:hover { border-color: var(--accent); }
.calc-key:active { transform: translateY(1px); }
.calc-key.fn { background: var(--column); font-size: 15px; }
.calc-vat .calc-key { min-height: 40px; font-size: 13.5px; }
.calc-key.op { color: var(--accent); font-size: 24px; background: var(--accent-soft); border-color: transparent; }
.calc-key.eq { background: var(--accent); color: #fff; border-color: transparent; font-size: 24px; grid-row: span 2; }
.calc-key.wide { grid-column: span 3; }
.calc-key.danger { color: var(--danger); }
.calc-history { min-width: 0; }
.calc-history h3 { margin: 4px 0 8px; font-size: 15px; }
.calc-hist-row { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--border); }
.calc-hist-use { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; padding: 8px 6px; background: none; border: 0; color: var(--text); cursor: pointer; text-align: right; font: inherit; }
.calc-hist-use:hover { background: var(--column); border-radius: 8px; }
.calc-hist-use .hint { overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .calc-layout { grid-template-columns: 1fr; }
  .calc-key { min-height: 56px; }
}

/* ---------- pionowa linia oddzielająca grupy kolumn ---------- */
.col-divider { flex: 0 0 1px; align-self: stretch; margin: 4px 6px; background: var(--muted); opacity: .35; }
.col-tab.divider-before { margin-left: 10px; position: relative; }
.col-tab.divider-before::before { content: ''; position: absolute; left: -8px; top: 15%; bottom: 15%; width: 1px; background: var(--muted); opacity: .35; }
