/* TrenerFlow Panel – system projektowy */
@font-face {
  font-family: "Inter";
  src: url("fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f4f5f5;
  --surface: #ffffff;
  --surface-2: #f8f9f9;
  --surface-3: #eef0f1;
  --line: #e4e6e8;
  --line-2: #d3d7da;
  --text: #0f1214;
  --text-2: #444c53;
  --muted: #737c85;
  --primary: #0b0d0e;
  --primary-text: #ffffff;
  --mint: #16f0b5;
  --accent: #0aa57c;
  --accent-bg: #dcf9ef;
  --danger: #d33a3a;
  --danger-bg: #fdecec;
  --warn: #b86e00;
  --warn-bg: #fff3dd;
  --focus: 0 0 0 3px rgba(22, 240, 181, .35);
  --shadow-1: 0 1px 2px rgba(16, 24, 32, .05);
  --shadow-2: 0 10px 30px -12px rgba(16, 24, 32, .22);
  --shadow-3: 0 24px 64px -20px rgba(16, 24, 32, .35);
  --r: 10px;
  --r-sm: 8px;
  --side: 236px;
  --top: 56px;

  --t-blue: #2457d6; --t-blue-bg: #e8effd;
  --t-amber: #a35f00; --t-amber-bg: #fff2d9;
  --t-violet: #6d3fd1; --t-violet-bg: #f0eafd;
  --t-cyan: #0b7a8f; --t-cyan-bg: #e2f6f9;
  --t-orange: #c2410c; --t-orange-bg: #ffeddf;
  --t-green: #0a8a5a; --t-green-bg: #ddf6ea;
  --t-gray: #5b636b; --t-gray-bg: #eef0f2;
  --t-red: #c22f2f; --t-red-bg: #fde8e8;
  --t-mint: #078a68; --t-mint-bg: #dcfaf0;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b0d0e;
  --surface: #121517;
  --surface-2: #171b1e;
  --surface-3: #1e2327;
  --line: #242a2f;
  --line-2: #323a40;
  --text: #e8ecec;
  --text-2: #b6bec5;
  --muted: #88929b;
  --primary: #16f0b5;
  --primary-text: #03130e;
  --accent: #36f2c4;
  --accent-bg: rgba(54, 242, 196, .12);
  --danger: #f06262;
  --danger-bg: rgba(240, 98, 98, .12);
  --warn: #f0a640;
  --warn-bg: rgba(240, 166, 64, .12);
  --shadow-1: none;
  --shadow-2: 0 10px 30px -12px rgba(0, 0, 0, .7);
  --shadow-3: 0 24px 64px -20px rgba(0, 0, 0, .8);
  --t-blue: #8db0ff; --t-blue-bg: rgba(91, 140, 255, .14);
  --t-amber: #f3b75a; --t-amber-bg: rgba(243, 183, 90, .13);
  --t-violet: #b9a0ff; --t-violet-bg: rgba(160, 128, 255, .15);
  --t-cyan: #6fd7e8; --t-cyan-bg: rgba(80, 200, 225, .13);
  --t-orange: #ffab73; --t-orange-bg: rgba(255, 150, 90, .13);
  --t-green: #5fe0a5; --t-green-bg: rgba(80, 220, 160, .13);
  --t-gray: #a2abb3; --t-gray-bg: rgba(160, 170, 180, .12);
  --t-red: #ff8a8a; --t-red-bg: rgba(255, 110, 110, .13);
  --t-mint: #36f2c4; --t-mint-bg: rgba(54, 242, 196, .12);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a.link, .prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 680; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0 0 8px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.i { flex: none; display: inline-block; vertical-align: middle; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hidden, [hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mono { font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace; font-size: 12.5px; }
.prose { white-space: pre-wrap; word-wrap: break-word; color: var(--text-2); }
.prose p:last-child { margin-bottom: 0; }

/* ---------- układ ---------- */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 14px 10px;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 6px 10px 16px; font-weight: 750; font-size: 16px; letter-spacing: -.02em; }
.brand .mark { width: 30px; height: 21px; color: var(--accent); }
:root:not([data-theme="dark"]) .brand .mark { color: #0b0d0e; }
.brand .badge-env { margin-left: auto; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: var(--warn-bg); color: var(--warn); }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 520;
}
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.on { background: var(--primary); color: var(--primary-text); }
.nav a .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.nav a .count.hot { background: var(--danger); color: #fff; }
.nav a.on .count { background: rgba(255,255,255,.18); color: inherit; }
.nav .sep { height: 1px; background: var(--line); margin: 10px 6px; }
.nav .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 10px 10px 4px; font-weight: 650; }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.side-foot .who { min-width: 0; flex: 1; }
.side-foot .who b { display: block; font-size: 13px; font-weight: 600; }
.side-foot .who span { display: block; font-size: 11.5px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 30; height: var(--top);
  display: flex; align-items: center; gap: 12px; padding: 0 22px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.top .title { font-weight: 650; font-size: 15px; min-width: 0; }
.top .spacer { flex: 1; }
.search-btn {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 12px; min-width: 260px;
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); color: var(--muted); cursor: pointer; font: inherit;
}
.search-btn kbd { margin-left: auto; font: 11px Inter, sans-serif; border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 5px; color: var(--muted); }
.menu-btn { display: none; }
.content { padding: 22px; width: 100%; max-width: 1480px; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .grow { flex: 1; }

/* ---------- elementy ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 13px;
  border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--text);
  font: 560 13.5px/1 Inter, sans-serif; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-3); }
.btn:focus-visible, .input:focus, .select:focus, .textarea:focus, .chipbtn:focus-visible { outline: none; box-shadow: var(--focus); border-color: var(--accent); }
.btn-primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 86%, #fff); }
:root[data-theme="dark"] .btn-primary:hover { background: color-mix(in srgb, var(--primary) 85%, #000); }
.btn-accent { background: var(--mint); color: #03130e; border-color: var(--mint); }
.btn-accent:hover { background: #12d9a3; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; gap: 5px; border-radius: 7px; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.btn[disabled], .btn.htmx-request { opacity: .6; pointer-events: none; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-1); }
.card-b { padding: 16px; }
.card-h { display: flex; align-items: center; gap: 8px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.card-h h2, .card-h h3 { flex: 1; min-width: 0; }
.card-h .actions { display: flex; gap: 6px; }
.card + .card { margin-top: 14px; }
.card.flat { box-shadow: none; }
.section-t { font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 650; margin: 0 0 8px; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--t-gray-bg); color: var(--t-gray); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-sm { height: 20px; padding: 0 7px; font-size: 11px; }
.chip-blue { background: var(--t-blue-bg); color: var(--t-blue); }
.chip-amber { background: var(--t-amber-bg); color: var(--t-amber); }
.chip-violet { background: var(--t-violet-bg); color: var(--t-violet); }
.chip-cyan { background: var(--t-cyan-bg); color: var(--t-cyan); }
.chip-orange { background: var(--t-orange-bg); color: var(--t-orange); }
.chip-green { background: var(--t-green-bg); color: var(--t-green); }
.chip-gray { background: var(--t-gray-bg); color: var(--t-gray); }
.chip-red { background: var(--t-red-bg); color: var(--t-red); }
.chip-mint { background: var(--t-mint-bg); color: var(--t-mint); }
.chipbtn { cursor: pointer; border: 1px solid transparent; font: inherit; }
.chipbtn:hover { border-color: var(--line-2); }

.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--text-2); font-weight: 700; font-size: 12.5px; letter-spacing: .02em; }
.avatar.lg { width: 48px; height: 48px; font-size: 16px; }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar.mint { background: var(--accent-bg); color: var(--t-mint); }

/* formularze */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .lbl { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .help { font-size: 12px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); font: 14px Inter, sans-serif;
}
.textarea { height: auto; min-height: 84px; padding: 9px 11px; line-height: 1.5; resize: vertical; }
.textarea.auto { overflow: hidden; resize: none; }
.select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
.input-sm, .select.input-sm { height: 30px; font-size: 13px; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.tight { gap: 4px; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.check { display: inline-flex; align-items: flex-start; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.radios { display: flex; gap: 6px; flex-wrap: wrap; }
.radios label { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: 99px; cursor: pointer; font-size: 13px; font-weight: 560; background: var(--surface); }
.radios input { position: absolute; opacity: 0; pointer-events: none; }
.radios label:has(input:checked) { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.radios label:hover { border-color: var(--text-2); }

/* tabele */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { position: sticky; top: 0; text-align: left; font-size: 11.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .right { text-align: right; }
.cell-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-name b { display: block; font-weight: 620; }
.cell-name span { display: block; font-size: 12px; color: var(--muted); }

/* zakładki i segmenty */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px; border: 0; background: none; font: 560 13.5px Inter, sans-serif; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs .on { color: var(--text); border-bottom-color: var(--text); }
.tabs .count { font-size: 11px; background: var(--surface-3); border-radius: 99px; padding: 1px 6px; color: var(--text-2); }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: 9px; flex-wrap: wrap; }
.seg a, .seg button { height: 28px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; border-radius: 7px; border: 0; background: none; font: 560 12.5px Inter, sans-serif; color: var(--text-2); cursor: pointer; }
.seg .on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.seg .count { font-size: 11px; color: var(--muted); }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { padding: 14px 16px; }
.kpi .v { font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* listy */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 11px; padding: 11px 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.li:last-child { border-bottom: 0; }
a.li:hover, .li.click:hover { background: var(--surface-2); }
.li .grow { flex: 1; min-width: 0; }
.li .t { font-weight: 600; }
.li .s { font-size: 12.5px; color: var(--muted); }
.li.overdue .when { color: var(--danger); font-weight: 650; }
.when { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { padding: 26px 16px; text-align: center; color: var(--muted); }
.empty .i { color: var(--line-2); margin-bottom: 6px; }

.done-btn { width: 22px; height: 22px; border-radius: 50%; border: 1.6px solid var(--line-2); background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: none; color: transparent; padding: 0; }
.done-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- profil klienta ---------- */
.client-head { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.client-head .who { flex: 1; min-width: 260px; }
.client-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 7px; color: var(--text-2); font-size: 13px; }
.facts a, .facts span { display: inline-flex; align-items: center; gap: 5px; }
.facts a:hover { color: var(--text); text-decoration: underline; }
.head-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.status-select { height: 30px; font-weight: 600; font-size: 12.5px; border-radius: 99px; padding-left: 12px; width: auto; }

.next-step { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); margin: 14px 0; }
.next-step.none { border-style: dashed; background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.next-step.late { border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: var(--danger-bg); }
.next-step .grow { flex: 1; min-width: 0; }
.next-step .ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-bg); color: var(--t-mint); flex: none; }

.profile { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; align-items: start; }
.profile .col-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.profile .col-main { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.kv { display: grid; grid-template-columns: 112px 1fr; gap: 7px 10px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv dd a:hover { text-decoration: underline; }
.acc { border-top: 1px solid var(--line); }
.acc:first-child { border-top: 0; }
.acc > summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 12px 16px; cursor: pointer; font-weight: 620; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary .chev { margin-left: auto; color: var(--muted); transition: transform .15s; }
.acc[open] > summary .chev { transform: rotate(90deg); }
.acc .acc-b { padding: 0 16px 14px; }
.acc .fill { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.qa { margin-bottom: 10px; }
.qa .q { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.qa .a { white-space: pre-wrap; overflow-wrap: anywhere; }
.qa .a.empty-a { color: var(--line-2); }
.rate { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.rate:last-child { border-bottom: 0; }
.rate .note { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
.rate-pick { display: inline-flex; gap: 3px; }
.rate-pick label { cursor: pointer; }
.rate-pick input { position: absolute; opacity: 0; }
.rate-pick span { display: inline-block; padding: 3px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; border: 1px solid var(--line-2); color: var(--muted); }
.rate-pick input:checked + span.r-wysoka { background: var(--t-red-bg); color: var(--t-red); border-color: transparent; }
.rate-pick input:checked + span.r-średnia { background: var(--t-amber-bg); color: var(--t-amber); border-color: transparent; }
.rate-pick input:checked + span.r-niska { background: var(--t-green-bg); color: var(--t-green); border-color: transparent; }
.rate-pick input:checked + span.r-none { background: var(--surface-3); color: var(--text-2); border-color: transparent; }

/* kompozytor */
.composer .tabs { padding: 0 8px; }
.composer .pane { padding: 14px 16px; }
.composer .quick { display: flex; gap: 6px; flex-wrap: wrap; }
.call-hero { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 12px; }
.call-hero .num-big { font-size: 18px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.outcomes { display: flex; flex-wrap: wrap; gap: 6px; }
.attach-list { display: flex; flex-wrap: wrap; gap: 6px; }
.attach-list label { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border: 1px solid var(--line-2); border-radius: 99px; font-size: 12.5px; cursor: pointer; background: var(--surface); }
.attach-list label:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }
.attach-list input { accent-color: var(--accent); }
.ai-row { display: flex; gap: 6px; padding: 8px; border-radius: var(--r-sm); background: var(--accent-bg); border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent); }
.ai-row .input { background: var(--surface); }
.counter { font-size: 12px; color: var(--muted); }

/* oś czasu */
.tl-filters { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.tl { padding: 6px 16px 14px; }
.tl-day { font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 650; padding: 14px 0 6px 44px; }
.ev { display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding: 9px 0; position: relative; }
.ev::before { content: ""; position: absolute; left: 15.5px; top: 40px; bottom: -6px; width: 1px; background: var(--line); }
.ev:last-child::before { display: none; }
.ev .ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--t-gray-bg); color: var(--t-gray); position: relative; z-index: 1; }
.ev .ico.blue { background: var(--t-blue-bg); color: var(--t-blue); }
.ev .ico.violet { background: var(--t-violet-bg); color: var(--t-violet); }
.ev .ico.green { background: var(--t-green-bg); color: var(--t-green); }
.ev .ico.red { background: var(--t-red-bg); color: var(--t-red); }
.ev .ico.amber { background: var(--t-amber-bg); color: var(--t-amber); }
.ev .ico.cyan { background: var(--t-cyan-bg); color: var(--t-cyan); }
.ev .ico.mint { background: var(--t-mint-bg); color: var(--t-mint); }
.ev .body { min-width: 0; }
.ev .hd { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ev .hd .t { font-weight: 600; overflow-wrap: anywhere; }
.ev .hd .m { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ev .hd .pin { color: var(--warn); }
.ev .bx { margin-top: 6px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); font-size: 13.5px; }
.ev .bx.clamp { max-height: 168px; overflow: hidden; position: relative; }
.ev .bx.clamp::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 40px; background: linear-gradient(transparent, var(--surface-2)); }
.ev .bx.note { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 25%, transparent); color: var(--text); }
.ev .bx.ai { background: var(--accent-bg); border-color: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--text); }
.ev.compact { padding: 4px 0; }
.ev.compact .ico { width: 32px; height: 22px; background: none; }
.ev.compact .hd .t { font-weight: 500; color: var(--text-2); font-size: 13px; }
.ev .acts { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 7px; }
.ev .changes { margin: 4px 0 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--text-2); }
.ev .changes li { padding: 1px 0; }
.ev .changes s { color: var(--muted); }
.ev audio { width: 100%; max-width: 420px; height: 34px; margin-top: 7px; }
.badge-ai { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--t-mint); }

/* lejek */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; max-height: calc(100vh - 150px); }
.col-h { display: flex; align-items: center; gap: 8px; padding: 11px 12px; font-weight: 650; }
.col-h .n { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 600; }
.col-b { padding: 4px 8px 10px; overflow-y: auto; min-height: 90px; display: flex; flex-direction: column; gap: 7px; }
.kcard { display: block; padding: 10px 11px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); cursor: grab; }
.kcard:hover { border-color: var(--line-2); }
.kcard .nm { font-weight: 620; display: flex; gap: 6px; align-items: center; }
.kcard .mt { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.kcard .late { color: var(--danger); font-weight: 600; }
.kcard.sortable-ghost { opacity: .35; }
.kcard.sortable-chosen { box-shadow: var(--shadow-2); }
.temp { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.temp.hot { background: #ef4444; } .temp.warm { background: #f59e0b; } .temp.cold { background: #60a5fa; }

/* modal, dropdown, toast, paleta */
dialog.modal { border: 0; padding: 0; border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-3); width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 40px); }
dialog.modal.wide { width: min(980px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(8, 10, 12, .45); backdrop-filter: blur(2px); }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-h h2 { flex: 1; }
.modal-b { padding: 16px 18px; overflow: auto; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; padding: 13px 18px; border-top: 1px solid var(--line); background: var(--surface-2); position: sticky; bottom: 0; }
.modal-f .grow { flex: 1; }
.mail-meta { display: grid; grid-template-columns: 70px 1fr; gap: 5px 10px; font-size: 13px; margin-bottom: 12px; }
.mail-meta dt { color: var(--muted); }
.mail-meta dd { margin: 0; overflow-wrap: anywhere; }
iframe.mail { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
.sms-bubble { max-width: 340px; padding: 10px 13px; border-radius: 16px 16px 4px 16px; background: var(--primary); color: var(--primary-text); white-space: pre-wrap; margin-left: auto; }
.warnbox { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--warn-bg); color: var(--text); font-size: 13px; margin-bottom: 12px; }
.warnbox .i { color: var(--warn); margin-top: 1px; }
.okbox { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--accent-bg); font-size: 13px; }
.infobox { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); }

.dd { position: relative; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-2); padding: 6px; z-index: 50; display: none; }
.dd.open .dd-menu { display: block; }
.dd-menu a, .dd-menu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border-radius: 7px; border: 0; background: none; font: 500 13.5px Inter, sans-serif; color: var(--text); cursor: pointer; text-align: left; }
.dd-menu a:hover, .dd-menu button:hover { background: var(--surface-3); }
.dd-menu .sep { height: 1px; background: var(--line); margin: 5px 4px; }
.notif-menu { width: 380px; max-height: 70vh; overflow: auto; padding: 0; }
.notif { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.notif.unread { background: var(--accent-bg); }
.notif .t { font-weight: 600; font-size: 13px; }
.notif .s { font-size: 12.5px; color: var(--text-2); white-space: pre-wrap; }
.bell { position: relative; }
.bell .dotc { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px; padding: 11px 14px; border-radius: 11px; background: var(--primary); color: var(--primary-text); box-shadow: var(--shadow-2); font-weight: 550; animation: tin .18s ease-out; }
.toast.error { background: var(--danger); color: #fff; }
.toast.info { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

dialog.palette { margin-top: 12vh; width: min(620px, calc(100vw - 24px)); }
.palette .pi { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.palette .pi input { flex: 1; border: 0; background: none; font: 16px Inter, sans-serif; color: var(--text); outline: none; }
.palette .res { max-height: 54vh; overflow: auto; padding: 6px; }
.palette .res a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; }
.palette .res a.sel, .palette .res a:hover { background: var(--surface-3); }
.palette .hint { padding: 9px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); display: flex; gap: 14px; }

.dropzone { border: 1.5px dashed var(--line-2); border-radius: var(--r); padding: 14px; text-align: center; color: var(--muted); font-size: 13px; transition: border-color .12s, background .12s; cursor: pointer; }
.dropzone.over { border-color: var(--accent); background: var(--accent-bg); color: var(--text); }
.progress { height: 4px; background: var(--surface-3); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s; }
.file { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.file:last-child { border-bottom: 0; }
.file .ic { width: 30px; height: 30px; border-radius: 7px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-2); flex: none; }

.htmx-indicator { opacity: 0; transition: opacity .15s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* logowanie */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 80% -10%, rgba(22, 240, 181, .14), transparent 60%), var(--bg); }
.auth .card { width: min(400px, 100%); padding: 28px; }
.auth .brand { padding: 0 0 18px; font-size: 18px; }
.err { padding: 9px 12px; border-radius: var(--r-sm); background: var(--danger-bg); color: var(--danger); font-size: 13px; font-weight: 550; }

/* oferta – edytor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 46%); gap: 16px; align-items: start; }
.editor .preview { position: sticky; top: calc(var(--top) + 16px); height: calc(100vh - var(--top) - 40px); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #08090a; }
.editor .preview iframe { width: 100%; height: 100%; border: 0; }
.variant { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; background: var(--surface-2); }
.variant + .variant { margin-top: 10px; }
.item-row { display: grid; grid-template-columns: minmax(0, 1fr) 104px 124px 74px 30px; gap: 6px; margin-top: 6px; }
.totals { font-size: 12.5px; color: var(--text-2); margin-top: 8px; display: flex; gap: 14px; flex-wrap: wrap; }
.contract-doc { background: #fff; color: #111; padding: 34px 40px; border-radius: var(--r); border: 1px solid var(--line); font: 13.5px/1.6 Georgia, "Times New Roman", serif; max-height: calc(100vh - 160px); overflow: auto; }
.contract-doc h1 { font: 700 17px/1.3 Inter, sans-serif; text-align: center; margin-bottom: 14px; }
.contract-doc h2 { font: 700 14px/1.3 Inter, sans-serif; margin: 16px 0 6px; }
.contract-doc ol, .contract-doc ul { padding-left: 22px; margin: 0 0 8px; }
.contract-doc mark { background: #fff3a8; }

/* mobile */
.mobile-tabs { display: none; }
@media (max-width: 1180px) {
  .profile { grid-template-columns: 320px minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .editor { grid-template-columns: 1fr; }
  .editor .preview { position: static; height: 70vh; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 100; transform: translateX(-102%); transition: transform .2s; box-shadow: var(--shadow-3); }
  body.nav-open .side { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 90; }
  .menu-btn { display: inline-flex; }
  .top { padding: 0 12px; gap: 8px; }
  .search-btn { min-width: 0; width: 40px; padding: 0; justify-content: center; }
  .search-btn span, .search-btn kbd { display: none; }
  .content { padding: 14px 12px 90px; }
  .profile { grid-template-columns: 1fr; }
  .profile .col-side { order: 2; }
  .mobile-tabs { display: flex; position: sticky; top: var(--top); z-index: 20; background: var(--bg); padding: 8px 0; margin: -4px 0 10px; }
  .mobile-tabs .seg { width: 100%; }
  .mobile-tabs .seg button { flex: 1; justify-content: center; }
  .profile[data-mtab="info"] .col-main { display: none; }
  .profile[data-mtab="main"] .col-side { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .hide-m { display: none !important; }
  .item-row { grid-template-columns: 1fr 1fr; }
  .item-row [data-k="name"] { grid-column: 1 / -1; }
  .client-head .head-actions { width: 100%; }
  .notif-menu { width: calc(100vw - 24px); right: -50px; }
  dialog.modal { max-height: calc(100vh - 16px); }
  .table th, .table td { padding: 9px 8px; }
  .mbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; gap: 6px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  .mbar .btn { flex: 1; }
}
@media (min-width: 901px) { .mbar { display: none; } .show-m { display: none !important; } }

/* wydruk karty */
.print-page { max-width: 820px; margin: 0 auto; padding: 32px; background: #fff; color: #111; }
.print-page h1 { font-size: 22px; margin-bottom: 4px; }
.print-page h2 { font-size: 15px; margin: 22px 0 8px; padding-bottom: 5px; border-bottom: 2px solid #111; }
.print-page table { width: 100%; border-collapse: collapse; font-size: 13px; }
.print-page td, .print-page th { border: 1px solid #ccc; padding: 6px 8px; vertical-align: top; text-align: left; }
.print-page th { background: #f2f2f2; width: 34%; }
@media print { .no-print { display: none !important; } body { background: #fff; } .print-page { padding: 0; } }

/* ---------- uzupełnienia: pulpit, listy, formularze ---------- */
.dash { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.tasks-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.settings-grid.wide-r { grid-template-columns: 320px minmax(0, 1fr); }
.settings-grid.wide-l { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.settings-grid > .card + .card, .dash .card + .card { margin-top: 0; }
.stack > .card + .card { margin-top: 0; }
.li.sel { background: var(--accent-bg); }
a.kpi { display: block; transition: border-color .12s; }
a.kpi:hover { border-color: var(--line-2); }
a.warnbox:hover { text-decoration: underline; }
.btnlike { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.list > .btnlike:last-child { border-bottom: 0; }
.unread-row .t { font-weight: 700; }
.unread-row { box-shadow: inset 3px 0 0 var(--accent); }
.fic { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-2); flex: none; }
.funnel { display: flex; flex-direction: column; gap: 7px; }
.funnel-row { display: flex; align-items: center; gap: 10px; }
.funnel-row:hover .small { text-decoration: underline; }
.funnel .bar { flex: 1; height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.funnel .bar i { display: block; height: 100%; border-radius: 99px; background: var(--t-gray); }
.funnel .bar i.t-blue { background: var(--t-blue); } .funnel .bar i.t-amber { background: var(--t-amber); } .funnel .bar i.t-violet { background: var(--t-violet); }
.funnel .bar i.t-cyan { background: var(--t-cyan); } .funnel .bar i.t-orange { background: var(--t-orange); } .funnel .bar i.t-green { background: var(--t-green); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; align-items: center; }
.filters .select { width: auto; }
.search-in { position: relative; flex: 1; min-width: 220px; }
.search-in .i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search-in .input { padding-left: 34px; }
.tab-radio { display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px; font: 560 13.5px Inter, sans-serif; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tab-radio input { position: absolute; opacity: 0; pointer-events: none; }
.tab-radio:hover { color: var(--text); }
.tab-radio:has(input:checked) { color: var(--text); border-bottom-color: var(--text); }
.tab-radio:has(input:focus-visible) { box-shadow: var(--focus); }
.tab-radio .count { font-size: 11px; background: var(--surface-3); border-radius: 99px; padding: 1px 6px; color: var(--text-2); }
select.status-select { border-color: transparent; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%) !important; background-position: calc(100% - 15px) 12px, calc(100% - 10px) 12px !important; background-size: 5px 5px !important; background-repeat: no-repeat !important; cursor: pointer; }
.acc-card > summary::-webkit-details-marker, details.card > summary::-webkit-details-marker { display: none; }
details.card > summary { list-style: none; }
details.card[open] > summary { border-bottom: 1px solid var(--line); }
details.card:not([open]) > summary { border-bottom: 0; }
.sug { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); margin-top: 6px; cursor: pointer; }
.sug:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: var(--accent-bg); }
.sug input { margin-top: 3px; accent-color: var(--accent); }
.sug > span { display: flex; flex-direction: column; gap: 2px; }
.sug-new { white-space: pre-wrap; font-size: 13.5px; }
.transcript { max-height: 360px; overflow: auto; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); margin-top: 6px; }
.pay-item { display: grid; grid-template-columns: 22px minmax(0, 1fr) 110px 130px; gap: 6px; align-items: center; }
.pay-item input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.pay-item:has(input[type=checkbox]:not(:checked)) .input, .pay-item:has(input[type=checkbox]:not(:checked)) .select { opacity: .45; }
.savebar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(6px); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-2); }
.contract-wrap { position: sticky; top: calc(var(--top) + 16px); }
.editor .contract-doc { max-height: calc(100vh - var(--top) - 40px); }
.ev .bx.clamp.open { max-height: none; }
.ev .bx.clamp.open::after { display: none; }
.note-composer .textarea { min-height: 70px; }
.composer .pane .skeleton + .skeleton { margin-top: 8px; }
.tl-more .btn { margin: 0 auto; }
@media (max-width: 1180px) {
  .dash, .tasks-grid { grid-template-columns: 1fr; }
  .settings-grid, .settings-grid.wide-r, .settings-grid.wide-l { grid-template-columns: 1fr; }
  .contract-wrap { position: static; }
}
@media (max-width: 900px) {
  .filters .select, .filters .search-in { width: 100%; min-width: 0; flex: 1 1 100%; }
  .pay-item { grid-template-columns: 22px minmax(0, 1fr) 96px; }
  .pay-item .select { grid-column: 2 / -1; }
  .client-head .who { min-width: 0; }
  .client-head h1 { font-size: 19px; }
  .editor .preview { height: 75vh; }
  .savebar { bottom: 70px; }
  .tabs .count { display: none; }
}

/* ---------- poprawki po testach wizualnych ---------- */
.top .menu-btn { display: none; }
.kpis > .card, .grid > .card, .board .card { margin-top: 0; }
.board { grid-auto-columns: minmax(228px, 1fr); }
.kv dd .btn-xs { height: 20px; width: 22px; vertical-align: -3px; }
select.status-select.chip-blue { background-color: var(--t-blue-bg); color: var(--t-blue); }
select.status-select.chip-amber { background-color: var(--t-amber-bg); color: var(--t-amber); }
select.status-select.chip-violet { background-color: var(--t-violet-bg); color: var(--t-violet); }
select.status-select.chip-cyan { background-color: var(--t-cyan-bg); color: var(--t-cyan); }
select.status-select.chip-orange { background-color: var(--t-orange-bg); color: var(--t-orange); }
select.status-select.chip-green { background-color: var(--t-green-bg); color: var(--t-green); }
select.status-select.chip-gray { background-color: var(--t-gray-bg); color: var(--t-gray); }
select.status-select option { color: var(--text); background: var(--surface); }
@media (max-width: 900px) {
  .top .menu-btn { display: inline-flex; }
  .mbar .btn { min-width: 0; padding: 0 6px; gap: 5px; font-size: 13px; }
  .next-step { flex-wrap: wrap; }
  .next-step .grow { flex: 1 1 calc(100% - 50px); }
}
.dash > *, .tasks-grid > *, .settings-grid > *, .editor > *, .profile > * { min-width: 0; }
.select.input-sm { background-position: calc(100% - 15px) 12px, calc(100% - 10px) 12px; }
@media (max-width: 900px) { .page-head h1 { font-size: 20px; } .kpi .v { font-size: 20px; } }
