/* ==========================================================================
   SellSpace design system — v1
   Tokeny → reset → typografia → shell → komponenty → moduły (dopisywane na końcu)
   ZASADA: nie nadpisuj tego pliku; moduły dopisują bloki `/* === MODUŁ === *\/` na końcu.
   ========================================================================== */

/* ---------- Tokeny ---------- */
:root {
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  --bg: #f5f6fa;
  --bg-2: #eceef3;
  --panel: #ffffff;
  --panel-2: #f9fafc;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e4e7ee;
  --line-2: #d4d9e3;

  --brand: #0350ff;
  --brand-600: #0340d6;
  --brand-soft: #edf2ff;
  --brand-violet: #7a36fd;
  --brand-cyan: #00aeff;
  --brand-grad: linear-gradient(135deg, #00aeff 0%, #0350ff 45%, #7a36fd 100%);
  --brand-ink: #ffffff;
  --accent: #14b8a6;
  --accent-soft: #ccfbf1;

  --ok: #16a34a; --ok-bg: #ecfdf3; --ok-ink: #15803d;
  --warn: #d97706; --warn-bg: #fffbeb; --warn-ink: #b45309;
  --danger: #dc2626; --danger-bg: #fef2f2; --danger-ink: #b91c1c;
  --info: #2563eb; --info-bg: #eff6ff; --info-ink: #1d4ed8;
  --violet: #7c3aed; --violet-bg: #f5f3ff; --violet-ink: #6d28d9;
  --neutral-bg: #f1f5f9; --neutral-ink: #475569;

  --r-sm: 6px; --r: 10px; --r-lg: 14px; --r-xl: 20px;
  --sh-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --sh: 0 1px 3px rgba(15, 23, 42, .06), 0 4px 14px -6px rgba(15, 23, 42, .08);
  --sh-lg: 0 12px 40px -12px rgba(15, 23, 42, .25);
  --ring: 0 0 0 3px rgba(3, 80, 255, .22);

  --sidebar-w: 248px;
  --topbar-h: 56px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020; --bg-2: #0f1629; --panel: #111a2e; --panel-2: #16203a;
    --ink: #e7ecf5; --ink-2: #c7d0e0; --muted: #8b97ad; --muted-2: #6b7891;
    --line: #1f2b45; --line-2: #2a3856;
    --brand: #5b8cff; --brand-600: #3d74ff; --brand-soft: #16234d; --brand-ink: #0b1020;
    --accent: #2dd4bf; --accent-soft: #113b38;
    --ok-bg: #0f2a1b; --ok-ink: #4ade80; --warn-bg: #2b2208; --warn-ink: #fbbf24; --danger-bg: #2c1316; --danger-ink: #f87171;
    --info-bg: #0f1f3d; --info-ink: #60a5fa; --violet-bg: #1f1538; --violet-ink: #a78bfa; --neutral-bg: #1a2338; --neutral-ink: #c7d0e0;
    --sh: 0 1px 3px rgba(0,0,0,.4), 0 4px 14px -6px rgba(0,0,0,.5); --sh-lg: 0 12px 40px -12px rgba(0,0,0,.7);
    --ring: 0 0 0 3px rgba(91, 140, 255, .3);
  }
}
:root[data-theme="dark"] {
  --bg: #0b1020; --bg-2: #0f1629; --panel: #111a2e; --panel-2: #16203a;
  --ink: #e7ecf5; --ink-2: #c7d0e0; --muted: #8b97ad; --muted-2: #6b7891;
  --line: #1f2b45; --line-2: #2a3856;
  --brand: #5b8cff; --brand-600: #3d74ff; --brand-soft: #16234d; --brand-ink: #0b1020;
  --accent: #2dd4bf; --accent-soft: #113b38;
  --ok-bg: #0f2a1b; --ok-ink: #4ade80; --warn-bg: #2b2208; --warn-ink: #fbbf24; --danger-bg: #2c1316; --danger-ink: #f87171;
  --info-bg: #0f1f3d; --info-ink: #60a5fa; --violet-bg: #1f1538; --violet-ink: #a78bfa; --neutral-bg: #1a2338; --neutral-ink: #c7d0e0;
  --sh: 0 1px 3px rgba(0,0,0,.4), 0 4px 14px -6px rgba(0,0,0,.5); --sh-lg: 0 12px 40px -12px rgba(0,0,0,.7);
  --ring: 0 0 0 3px rgba(91, 140, 255, .3);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; line-height: 1.25; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 13px; }
p { margin: 0 0 .75em; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ic { width: 18px; height: 18px; stroke-width: 1.9; flex: none; }
.ic.sm { width: 15px; height: 15px; }
.ic.lg { width: 22px; height: 22px; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }
::selection { background: var(--brand-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Shell: sidebar + topbar + content ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 30; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; font-weight: 750; font-size: 16px; letter-spacing: -.02em; color: var(--ink); }
.sidebar .brand:hover { text-decoration: none; }
.logo { width: 30px; height: 30px; border-radius: 9px; background: var(--brand-grad); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; box-shadow: 0 4px 12px -4px rgba(3,80,255,.6); }
.sidebar .org { margin: 0 12px 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--ink-2); background: var(--panel-2); }
.sidebar .org b { display: block; color: var(--ink); font-size: 13px; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 4px 10px; display: flex; flex-direction: column; gap: 2px; }
.sidebar nav .sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); padding: 14px 10px 6px; font-weight: 650; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); font-weight: 500; font-size: 13.5px; transition: background .15s var(--ease), color .15s; }
.sidebar nav a .ic { color: var(--muted); }
.sidebar nav a:hover { background: var(--bg); text-decoration: none; color: var(--ink); }
.sidebar nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.sidebar nav a.active .ic { color: var(--brand); }
.sidebar nav a .cnt { margin-left: auto; font-size: 11px; font-weight: 600; background: var(--neutral-bg); color: var(--neutral-ink); border-radius: 999px; padding: 1px 7px; }
.sidebar nav a.active .cnt { background: var(--brand); color: var(--brand-ink); }
.sidebar .who { border-top: 1px solid var(--line); padding: 12px 14px; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.sidebar .who .meta { min-width: 0; flex: 1; }
.sidebar .who .meta b { display: block; font-size: 13px; }
.sidebar .who .meta span { display: block; color: var(--muted); font-size: 11.5px; }
.sidebar .who a.ghost-ic { color: var(--muted); padding: 6px; border-radius: 8px; }
.sidebar .who a.ghost-ic:hover { background: var(--bg); color: var(--danger); text-decoration: none; }
.sidebar .who a.ghost-ic.profile:hover { color: var(--brand); } /* link do profilu w panelu operatora: hover marki, nie czerwony jak wylogowanie */

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 24px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 85%, transparent); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }
.topbar .crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.topbar .crumbs b { color: var(--ink); font-weight: 600; }
.topbar .spacer { flex: 1; }
.topbar .search { position: relative; width: 300px; max-width: 40vw; }
.topbar .search input { padding-left: 36px; height: 36px; background: var(--bg); border-color: transparent; }
.topbar .search .ic { position: absolute; left: 11px; top: 10px; color: var(--muted); width: 16px; height: 16px; }
.content { padding: 24px 28px 48px; flex: 1; }
.content.narrow { max-width: 880px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin: 3px 0 0; font-size: 13px; }
.page-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.burger { display: none; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid transparent; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; background: var(--brand); color: var(--brand-ink); transition: transform .08s, background .15s, box-shadow .15s; box-shadow: var(--sh-sm); text-decoration: none !important; }
.btn:hover { background: var(--brand-600); }
.btn:active { transform: translateY(1px); }
.btn .ic { width: 16px; height: 16px; }
.btn.secondary { background: var(--panel); color: var(--ink); border-color: var(--line-2); }
.btn.secondary:hover { background: var(--bg); }
.btn.ghost { background: transparent; color: var(--ink-2); box-shadow: none; }
.btn.ghost:hover { background: var(--bg-2); color: var(--ink); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: var(--danger-ink); }
.btn.ok { background: var(--ok); color: #fff; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.sm .ic { width: 14px; height: 14px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; border-radius: var(--r); }
.btn.icon { width: 36px; padding: 0; }
.btn.icon.sm { width: 30px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.btn-group .btn:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.btn-group .btn + .btn { margin-left: -1px; }
.btn-group .btn.secondary.active { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); position: relative; z-index: 1; }

/* ---------- Forms ---------- */
label, .label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=time], input[type=url], input[type=search], input[type=tel], select, textarea {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--panel); color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--brand); vertical-align: -3px; margin: 0 6px 0 0; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.field { margin-bottom: 14px; }
.field.error input, .field.error select, .field.error textarea, .is-invalid { border-color: var(--danger) !important; }
.field .err { color: var(--danger-ink); font-size: 12px; margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.input-group { display: flex; }
.input-group > * { border-radius: 0; }
.input-group > *:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.input-group > *:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.input-group .addon { display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid var(--line-2); border-left: 0; background: var(--panel-2); color: var(--muted); font-size: 13px; }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: var(--line-2); border-radius: 999px; transition: .2s; }
.switch i::after { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: var(--sh-sm); }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(16px); }

/* ---------- Cards / panels ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh); }
.card .card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card .card-head h2, .card .card-head h3 { font-size: 14px; }
.card .card-body { padding: 18px; }
.card .card-foot { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--panel-2); border-radius: 0 0 var(--r-lg) var(--r-lg); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card.flat { box-shadow: none; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.main-aside { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .mt-sm { margin-top: 8px; } .mb-sm { margin-bottom: 8px; }
.right { text-align: right; } .center { text-align: center; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--sh); position: relative; overflow: hidden; }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .l .ic { width: 15px; height: 15px; }
.kpi .n { font-size: 26px; font-weight: 750; letter-spacing: -.02em; margin-top: 6px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .d { font-size: 12px; margin-top: 6px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.kpi .d.up { color: var(--ok-ink); } .kpi .d.down { color: var(--danger-ink); }
.kpi .spark { position: absolute; right: 12px; bottom: 10px; opacity: .9; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th, .table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13.5px; }
.table th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; background: var(--panel-2); position: sticky; top: 0; }
.table th:first-child { border-radius: var(--r-lg) 0 0 0; } .table th:last-child { border-radius: 0 var(--r-lg) 0 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--panel-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .row-actions { opacity: .55; transition: opacity .15s; display: inline-flex; gap: 2px; }
.table tr:hover .row-actions { opacity: 1; }
.table a.rowlink { color: var(--ink); font-weight: 600; }
.table a.rowlink:hover { color: var(--brand); }
.table.compact th, .table.compact td { padding: 7px 10px; font-size: 13px; }
.table.clickable tbody tr { cursor: pointer; }
.cell-user { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- Badges / tags / avatars ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.6; background: var(--neutral-bg); color: var(--neutral-ink); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge.danger { background: var(--danger-bg); color: var(--danger-ink); }
.badge.info { background: var(--info-bg); color: var(--info-ink); }
.badge.violet { background: var(--violet-bg); color: var(--violet-ink); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.neutral { background: var(--neutral-bg); color: var(--neutral-ink); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tag { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: var(--r-sm); font-size: 11.5px; font-weight: 600; background: var(--bg-2); color: var(--muted); border: 1px solid var(--line); }
.avatar { --av: var(--brand); width: 28px; height: 28px; border-radius: 50%; background: var(--av); color: #fff; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; letter-spacing: 0; text-shadow: 0 1px 1px rgba(0,0,0,.15); }
.avatar.sm { width: 22px; height: 22px; font-size: 9px; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.avatar.xl { width: 56px; height: 56px; font-size: 20px; }
.avatars { display: inline-flex; }
.avatars .avatar { border: 2px solid var(--panel); margin-left: -8px; }
.avatars .avatar:first-child { margin-left: 0; }
.dot-status { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

/* ---------- Flash / alerts / toasts ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); margin-bottom: 16px; font-size: 13.5px; }
.alert .ic { margin-top: 1px; }
.alert.ok { background: var(--ok-bg); color: var(--ok-ink); border-color: transparent; }
.alert.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }
.alert.danger { background: var(--danger-bg); color: var(--danger-ink); border-color: transparent; }
.alert.info { background: var(--info-bg); color: var(--info-ink); border-color: transparent; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--ink); color: #fff; padding: 11px 14px; border-radius: var(--r); box-shadow: var(--sh-lg); font-size: 13.5px; display: flex; gap: 10px; align-items: center; animation: toast-in .25s var(--ease); max-width: 380px; }
.toast.ok { background: var(--ok); } .toast.danger { background: var(--danger); } .toast.warn { background: var(--warn); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty .ic { width: 40px; height: 40px; margin: 0 auto 12px; color: var(--muted-2); stroke-width: 1.4; }
.empty .btn .ic, .empty a:not(.btn) .ic { width: 18px; height: 18px; margin: 0; color: inherit; stroke-width: 1.9; } /* ikony w przyciskach pustego stanu w zwykłym rozmiarze */
.empty h3 { color: var(--ink); margin-bottom: 4px; }
.empty p { max-width: 420px; margin: 0 auto 14px; }

/* ---------- Tabs / pills / dropdown ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 600; font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }
.tabs a .cnt { margin-left: 6px; font-size: 11px; background: var(--neutral-bg); color: var(--neutral-ink); border-radius: 999px; padding: 1px 6px; }
.pills { display: inline-flex; background: var(--bg-2); padding: 3px; border-radius: var(--r-sm); gap: 2px; }
.pills a, .pills button { padding: 5px 11px; border-radius: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); border: 0; background: transparent; cursor: pointer; }
.pills a.active, .pills button.active { background: var(--panel); color: var(--ink); box-shadow: var(--sh-sm); }
.pills a:hover { text-decoration: none; color: var(--ink); }
.dropdown { position: relative; display: inline-block; }
.dropdown .menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-lg); padding: 6px; display: none; z-index: 40; }
.dropdown.open .menu { display: block; } /* :focus-within usunięte — menu pokazuje tylko klasa .open (JS pozycjonuje je w tabelach) */
.dropdown .menu a, .dropdown .menu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border-radius: 6px; color: var(--ink-2); font-size: 13px; background: none; border: 0; cursor: pointer; text-align: left; }
.dropdown .menu a:hover, .dropdown .menu button:hover { background: var(--bg); text-decoration: none; color: var(--ink); }
.dropdown .menu .sep { height: 1px; background: var(--line); margin: 5px 0; }
.dropdown .menu .danger { color: var(--danger-ink); }

/* ---------- Modal (dialog) ---------- */
dialog.modal { border: 0; padding: 0; border-radius: var(--r-xl); background: var(--panel); color: var(--ink); box-shadow: var(--sh-lg); width: min(560px, calc(100vw - 32px)); }
dialog.modal.lg { width: min(820px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
dialog.modal .modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
dialog.modal .modal-body { padding: 20px; max-height: 70vh; overflow: auto; }
dialog.modal .modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: var(--panel-2); border-radius: 0 0 var(--r-xl) var(--r-xl); }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline .item { position: relative; padding: 4px 0 18px; }
.timeline .item .pt { position: absolute; left: -26px; top: 6px; width: 20px; height: 20px; border-radius: 50%; background: var(--panel); border: 2px solid var(--line-2); display: grid; place-items: center; }
.timeline .item .pt .ic { width: 11px; height: 11px; color: var(--muted); }
.timeline .item.ok .pt { border-color: var(--ok); } .timeline .item.ok .pt .ic { color: var(--ok); }
.timeline .item.info .pt { border-color: var(--info); } .timeline .item.info .pt .ic { color: var(--info); }
.timeline .item.violet .pt { border-color: var(--violet); } .timeline .item.violet .pt .ic { color: var(--violet); }
.timeline .item.warn .pt { border-color: var(--warn); } .timeline .item.warn .pt .ic { color: var(--warn); }
.timeline .item .t { font-size: 12px; color: var(--muted); }
.timeline .item .s { font-weight: 600; }
.timeline .item .b { color: var(--ink-2); margin-top: 3px; font-size: 13px; white-space: pre-line; }

/* ---------- Meta list (detail aside) ---------- */
.meta-list { display: flex; flex-direction: column; }
.meta-list .row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.meta-list .row:last-child { border-bottom: 0; }
.meta-list .row .k { color: var(--muted); }
.meta-list .row .v { font-weight: 550; text-align: right; }

/* ---------- Progress / funnel ---------- */
.progress { height: 6px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .4s var(--ease); }
.progress.ok > i { background: var(--ok); } .progress.warn > i { background: var(--warn); }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 4px; list-style: none; padding: 0; margin: 14px 0 0; justify-content: flex-end; }
.pagination li a, .pagination li span { display: inline-flex; min-width: 32px; height: 32px; padding: 0 8px; align-items: center; justify-content: center; border-radius: var(--r-sm); border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; background: var(--panel); }
.pagination li.active a, .pagination li a.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.pagination li a:hover { text-decoration: none; background: var(--bg); }

/* ---------- Filter bar ---------- */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filters input, .filters select { height: 34px; width: auto; min-width: 140px; }
.filters .search { position: relative; }
.filters .search input { padding-left: 32px; min-width: 220px; }
.filters .search .ic { position: absolute; left: 10px; top: 9px; width: 15px; height: 15px; color: var(--muted); }

/* ---------- Kanban (shared by Deals board) ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(268px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: start; min-height: 60vh; }
.col { background: var(--bg-2); border-radius: var(--r-lg); display: flex; flex-direction: column; max-height: calc(100vh - 220px); }
.col .col-head { padding: 12px 14px 8px; display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 13px; position: sticky; top: 0; }
.col .col-head .dot { width: 9px; height: 9px; border-radius: 50%; }
.col .col-head .cnt { color: var(--muted); font-weight: 600; font-size: 12px; }
.col .col-head .sum { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.col .col-body { padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 80px; flex: 1; }
.col .col-body.drag-over { background: var(--brand-soft); border-radius: var(--r); }
.kcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 11px 12px; box-shadow: var(--sh-sm); cursor: grab; transition: box-shadow .15s, transform .15s; position: relative; }
.kcard:hover { box-shadow: var(--sh); transform: translateY(-1px); }
.kcard.sortable-ghost { opacity: .4; }
.kcard.sortable-chosen { cursor: grabbing; box-shadow: var(--sh-lg); }
.kcard .t { font-weight: 600; font-size: 13.5px; line-height: 1.35; color: var(--ink); display: block; }
.kcard .t:hover { color: var(--brand); text-decoration: none; }
.kcard .c { color: var(--muted); font-size: 12.5px; margin-top: 3px; display: flex; align-items: center; gap: 5px; }
.kcard .f { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.kcard .v { font-weight: 700; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.kcard .due { font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.kcard .due.late { color: var(--danger-ink); font-weight: 600; }
.kcard .rot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.kcard .rot.bad { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }

/* ---------- Auth (public card) ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-aside { background: linear-gradient(160deg, #09123a 0%, #12207a 50%, #4321a8 115%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-aside::after { content: ""; position: absolute; inset: auto -120px -160px auto; width: 460px; height: 460px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255,255,255,.18), transparent); }
.auth-aside .brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 18px; color: #fff; }
.auth-aside h2 { font-size: 30px; line-height: 1.15; letter-spacing: -.02em; max-width: 440px; }
.auth-aside p { color: rgba(255,255,255,.78); max-width: 420px; font-size: 15px; }
.auth-aside .quote { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15); border-radius: var(--r-lg); padding: 18px; max-width: 460px; backdrop-filter: blur(4px); }
.auth-aside .quote b { display: block; margin-top: 10px; font-size: 13px; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 24px; margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); margin-bottom: 22px; }
.auth-card .foot { margin-top: 18px; font-size: 13px; color: var(--muted); text-align: center; }

/* ---------- Utilities ---------- */
.flex-1 { flex: 1; } .gap-sm { gap: 6px; } .hidden { display: none !important; }
.text-ok { color: var(--ok-ink); } .text-danger { color: var(--danger-ink); } .text-warn { color: var(--warn-ink); } .text-brand { color: var(--brand); }
.w-100 { width: 100%; }
.num { font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.skeleton { background: linear-gradient(90deg, var(--bg-2) 25%, var(--panel-2) 50%, var(--bg-2) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r-sm); }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.main-aside { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: var(--sh-lg); }
  .sidebar.open { transform: none; }
  .burger { display: inline-flex; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .topbar .search { display: none; }
  .form-grid, .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .page-head { flex-direction: column; align-items: stretch; }
  .board { grid-auto-columns: minmax(240px, 80vw); }
}
.scrim { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 25; }
.scrim.open { display: block; }

@media print {
  .sidebar, .topbar, .page-head .actions, .filters, .btn { display: none !important; }
  .shell { grid-template-columns: 1fr; }
  .content { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

/* === CRM === */
.crm-sub { font-size: 12px; margin-top: 2px; }
.crm-owner { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.crm-person { display: flex; align-items: center; gap: 10px; }
.crm-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, #94a3b8); margin-right: 6px; vertical-align: middle; }
.crm-note { margin-bottom: 14px; }
.crm-note textarea { width: 100%; resize: vertical; }
.crm-kpis { grid-template-columns: 1fr 1fr; }
.crm-kpis .kpi .n { font-size: 20px; }
.crm-check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; margin-top: 26px; }
.crm-check input { width: auto; }
.crm-pre { white-space: pre-line; font-size: 13px; color: var(--ink-2); }
.crm-code { background: var(--bg-2); border-radius: var(--r-sm); padding: 10px 12px; font-size: 12px; overflow-x: auto; }

/* === DEALS === */
.stepper { display: flex; gap: 4px; padding: 6px; overflow-x: auto; }
.stepper .step { flex: 1; min-width: 120px; }
.stepper .step button { width: 100%; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 0; border-radius: var(--r-sm); background: var(--bg-2); color: var(--muted); font-weight: 600; font-size: 12.5px; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; position: relative; }
.stepper .step button .n { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); color: var(--muted); font-size: 11px; font-weight: 700; flex: none; }
.stepper .step button small { margin-left: auto; font-weight: 500; opacity: .8; }
.stepper .step.done button { background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); }
.stepper .step.done button .n { background: var(--c); color: #fff; }
.stepper .step.current button { background: var(--c); color: #fff; box-shadow: 0 6px 16px -8px var(--c); }
.stepper .step.current button .n { background: rgba(255,255,255,.25); color: #fff; }
.stepper .step button:hover { filter: brightness(.96); }
.quick-note textarea { min-height: 64px; }
.kcard.saving { opacity: .6; pointer-events: none; }
.col.won .col-head, .col.lost .col-head { opacity: .85; }
.col.won .col-body, .col.lost .col-body { min-height: 120px; border: 2px dashed transparent; border-radius: var(--r); }
.col.won .col-body:empty::after { content: "Przeciągnij tutaj wygraną szansę 🎉"; display: block; text-align: center; color: var(--muted); font-size: 12.5px; padding: 28px 10px; }
.col.lost .col-body:empty::after { content: "Przeciągnij tutaj przegraną"; display: block; text-align: center; color: var(--muted); font-size: 12.5px; padding: 28px 10px; }

/* === SETTINGS === */
.invite-link { width: 240px; font-size: 12px; padding: 6px 8px; }
.stage-row input[type="text"] { min-width: 0; }
.stage-row .btn.danger { color: var(--danger-ink); }

/* === ACTIVITIES === */
.act-quick { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.act-quick input { flex: 1; border: 0; background: transparent; font: inherit; padding: 6px 0; outline: none; color: var(--ink); }
.act-group { padding: 4px 0 8px; }
.act-group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 12px 16px 4px; }
.act-group.is-overdue h3 { color: var(--danger-ink); }
.act { display: flex; align-items: center; gap: 12px; padding: 9px 16px; border-top: 1px solid var(--line); transition: background .15s, opacity .2s; }
.act:hover { background: var(--bg); }
.act-toggle { margin: 0; }
.act-check { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--line-2); background: var(--panel); display: grid; place-items: center; cursor: pointer; color: transparent; padding: 0; }
.act-check:hover { border-color: var(--brand); color: var(--muted-2); }
.act-check .ic { width: 14px; height: 14px; }
.act.done .act-check { background: var(--ok); border-color: var(--ok); color: #fff; }
.act.done .act-subj { text-decoration: line-through; color: var(--muted); }
.act.done { opacity: .7; }
.act-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--brand-soft); color: var(--brand); }
.act-ic.t-call { background: var(--info-bg); color: var(--info-ink); } .act-ic.t-meeting { background: var(--violet-bg); color: var(--violet-ink); }
.act-ic.t-email { background: var(--warn-bg); color: var(--warn-ink); } .act-ic.t-note { background: var(--bg-2); color: var(--muted); }
.act-main { flex: 1; min-width: 0; }
.act-subj { font-weight: 600; color: var(--ink); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-ctx { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; }
.act-ctx a { color: var(--muted); display: inline-flex; align-items: center; gap: 4px; } .act-ctx a:hover { color: var(--brand); }
.act-ctx .ic { width: 12px; height: 12px; }
.act-side { display: flex; align-items: center; gap: 8px; flex: none; }
.act-due { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.act-due.is-overdue { color: var(--danger-ink); font-weight: 600; }
.act-side .menu form { margin: 0; }
.act-side .menu button.danger { color: var(--danger-ink); }
.act-types label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.act-types input { position: absolute; opacity: 0; width: 0; height: 0; }
.act-types label.active, .act-types label:has(input:checked) { background: var(--panel); color: var(--ink); box-shadow: var(--sh); }
.cal-bar { justify-content: space-between; }
.cal-title { font-size: 15px; margin-left: 6px; }
.cal-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.cal-check input { width: auto; }
.cal-month { overflow: hidden; }
.cal-head, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div { padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
.cal-day { min-height: 112px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-week .cal-day:last-child { border-right: 0; }
.cal-day.out { background: var(--bg); } .cal-day.out .cal-num { color: var(--muted-2); }
.cal-num { font-size: 12px; font-weight: 600; color: var(--ink-2); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; }
.cal-day.today .cal-num { background: var(--brand); color: var(--brand-ink); }
.cal-ev { --c: var(--brand); display: flex; align-items: center; gap: 4px; font-size: 11.5px; line-height: 1.3; padding: 2px 6px; border-radius: 5px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); min-width: 0; }
.cal-ev span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev .ic { width: 12px; height: 12px; flex: none; }
.t-meeting { --c: var(--violet); } .t-call { --c: var(--info); } .t-email { --c: var(--warn); } .t-close { --c: var(--ok); } .t-note { --c: var(--muted); }
.cal-ev.done, .cw-ev.done { opacity: .5; text-decoration: line-through; }
.cal-more { font-size: 11.5px; color: var(--muted); padding: 0 6px; }
.cw-scroll { overflow-x: auto; }
.cw-row { display: grid; grid-template-columns: 56px repeat(7, minmax(110px, 1fr)); min-width: 826px; }
.cw-head > div, .cw-allday > div { border-bottom: 1px solid var(--line); }
.cw-dayhead { padding: 8px; font-size: 12px; color: var(--muted); text-align: center; }
.cw-dayhead strong { font-size: 16px; color: var(--ink); }
.cw-dayhead.today strong { color: var(--brand); }
.cw-gutter { font-size: 11px; color: var(--muted); padding: 4px 6px; text-align: right; }
.cw-body .cw-gutter { padding: 0 6px; }
.cw-hour { transform: translateY(-7px); }
.cw-allcell { padding: 4px; display: flex; flex-direction: column; gap: 3px; border-left: 1px solid var(--line); min-width: 0; }
.cw-col { position: relative; border-left: 1px solid var(--line); }
.cw-col.today { background: color-mix(in srgb, var(--brand) 4%, transparent); }
.cw-slot { display: block; border-bottom: 1px solid var(--line); }
.cw-slot:hover { background: var(--brand-soft); }
.cw-ev { --c: var(--brand); position: absolute; overflow: hidden; border-radius: 6px; padding: 3px 6px; font-size: 11.5px; line-height: 1.3; color: #fff; background: var(--c); border-left: 3px solid color-mix(in srgb, var(--c) 70%, #000); display: flex; flex-direction: column; z-index: 1; }
.cw-ev span { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 860px) {
  .cal-day { min-height: 64px; padding: 4px; flex-direction: row; flex-wrap: wrap; align-content: flex-start; }
  .cal-num { width: 100%; justify-content: start; }
  .cal-ev { width: 8px; height: 8px; padding: 0; border-radius: 50%; background: var(--c); }
  .cal-ev span, .cal-ev .ic, .cal-more { display: none; }
  .act-ctx { display: none; }
}

/* === DASHBOARD / ANALYTICS === */
a.kpi { color: inherit; text-decoration: none; transition: transform .15s, box-shadow .15s; }
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--sh-lg); text-decoration: none; }
.day-list { display: flex; flex-direction: column; }
.day-item { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); margin: 0; }
.day-item:last-child { border-bottom: 0; }
.day-item .chk { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--panel); color: transparent; display: grid; place-items: center; cursor: pointer; flex: none; transition: all .15s; padding: 0; }
.day-item .chk:hover { border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }
.day-item .ti { color: var(--muted); }
.day-item .body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.day-item .body b { font-weight: 600; }
.day-item .when { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.day-item.late { background: color-mix(in srgb, var(--danger-bg) 55%, transparent); }
.funnel-mini { display: flex; flex-direction: column; gap: 10px; }
.funnel-mini .frow { display: grid; grid-template-columns: 120px 1fr auto; align-items: center; gap: 10px; color: var(--ink); font-size: 13px; }
.funnel-mini .frow:hover { text-decoration: none; color: var(--brand); }
.funnel-mini .fb { height: 10px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.funnel-mini .fb i { display: block; height: 100%; border-radius: 999px; min-width: 4px; }
.funnel-mini .fv { font-size: 12px; color: var(--muted); white-space: nowrap; }
.card.insight { border-left: 4px solid var(--info); }
.card.insight.warn { border-left-color: var(--warn); }
.card.insight.good { border-left-color: var(--ok); }
.insight-text p { margin: 0 0 8px; font-size: 13px; line-height: 1.5; }
.insight-text p:last-child { margin-bottom: 0; }
.date-chip { width: 44px; height: 44px; border-radius: var(--r); background: var(--brand-soft); color: var(--brand); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; flex: none; }
.date-chip b { font-size: 16px; } .date-chip small { font-size: 10px; text-transform: uppercase; }
.chart-card canvas { width: 100% !important; }
.funnel-table .bar { height: 8px; border-radius: 999px; background: var(--bg-2); overflow: hidden; min-width: 120px; }
.funnel-table .bar i { display: block; height: 100%; }
.conv { font-size: 12px; color: var(--muted); }
.lb-rank { width: 26px; height: 26px; border-radius: 50%; background: var(--bg-2); color: var(--muted); display: inline-grid; place-items: center; font-weight: 700; font-size: 12px; }
.lb-rank.gold { background: #fef3c7; color: #b45309; } .lb-rank.silver { background: #e5e7eb; color: #374151; } .lb-rank.bronze { background: #fde8d7; color: #9a3412; }
.code-block { background: var(--ink); color: #e2e8f0; border-radius: var(--r); padding: 14px 16px; font-family: var(--mono); font-size: 12.5px; overflow-x: auto; white-space: pre; line-height: 1.55; }
.code-block .cm { color: #94a3b8; } .code-block .k { color: #93c5fd; } .code-block .s { color: #86efac; }
.steps { counter-reset: st; display: flex; flex-direction: column; gap: 14px; }
.steps .st { display: flex; gap: 14px; }
.steps .st::before { counter-increment: st; content: counter(st); width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.steps .st b { display: block; margin-bottom: 2px; }
.table-cat td code { background: var(--bg-2); padding: 2px 6px; border-radius: 4px; font-size: 12px; }
.copy-field { display: flex; gap: 6px; }
.copy-field input { font-family: var(--mono); font-size: 12.5px; }

/* === QUOTES === */
.quote-sub { font-size: 12px; margin-top: 2px; }
.quote-inactive td { opacity: .55; }
.quote-overdue { color: var(--danger-ink); font-weight: 600; }
.quote-author { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.quote-items input, .quote-items select { width: 100%; min-width: 0; padding: 6px 8px; font-size: 13px; }
.quote-items td.num input { text-align: right; min-width: 64px; }
.quote-items td { vertical-align: middle; }
.quote-items .line { font-weight: 600; white-space: nowrap; }
.quote-items tfoot .sum td, .quote-totals td { border-top: 0; padding-top: 4px; padding-bottom: 4px; }
.quote-items tfoot .total td, .quote-totals .total td { font-weight: 700; font-size: 15px; border-top: 1px solid var(--line); }
.print-body { background: var(--bg-2); padding: 24px 12px; }
.print-toolbar { max-width: 210mm; margin: 0 auto 12px; display: flex; gap: 8px; justify-content: flex-end; }
.print-sheet { max-width: 210mm; min-height: 297mm; margin: 0 auto; background: #fff; padding: 18mm 16mm; box-shadow: var(--sh-sm); font-size: 13px; color: #111; display: flex; flex-direction: column; }
.ps-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--brand); padding-bottom: 12px; margin-bottom: 18px; }
.ps-logo { font-size: 22px; font-weight: 800; color: var(--brand); }
.ps-title { text-align: right; }
.ps-title h1 { margin: 0; font-size: 24px; letter-spacing: .08em; }
.ps-number { font-weight: 600; }
.ps-parties { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 18px; line-height: 1.55; }
.ps-parties h4, .ps-notes h4 { margin: 0 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #666; }
.ps-dates { text-align: right; }
.ps-items, .ps-summary { width: 100%; border-collapse: collapse; }
.ps-items th { text-align: left; font-size: 11px; text-transform: uppercase; color: #555; border-bottom: 1px solid #bbb; padding: 6px 4px; }
.ps-items td { padding: 6px 4px; border-bottom: 1px solid #eee; }
.ps-items .num, .ps-summary .num { text-align: right; white-space: nowrap; }
.ps-summary { width: 50%; margin: 12px 0 0 auto; }
.ps-summary td { padding: 4px; }
.ps-summary .total td { font-weight: 800; font-size: 15px; border-top: 2px solid #111; }
.ps-notes { margin-top: 20px; line-height: 1.5; }
.ps-foot { margin-top: auto; padding-top: 24px; text-align: center; font-size: 11px; color: #888; }
@media print {
  @page { size: A4; margin: 12mm; }
  .print-body { background: #fff; padding: 0; }
  .print-toolbar { display: none !important; }
  .print-sheet { box-shadow: none; padding: 0; min-height: auto; max-width: none; }
}

/* === ONBOARDING === */
.onboard { border: 1px solid var(--brand); background: linear-gradient(135deg, var(--brand-soft), var(--panel) 60%); }
.ob-step { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); color: var(--ink); position: relative; transition: transform .15s, box-shadow .15s; }
.ob-step:hover { transform: translateY(-2px); box-shadow: var(--sh); text-decoration: none; }
.ob-step .n { position: absolute; top: 10px; right: 12px; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.ob-step .ic { color: var(--brand); width: 22px; height: 22px; }
.ob-step b { font-size: 13.5px; } .ob-step small { color: var(--muted); }

/* === CAMPAIGNS === */
.crm-sub { font-size: 12px; margin-top: 2px; }
#preview { background: #fff; }
.divider-v { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
#campaignForm textarea#body_html { width: 100%; min-height: 360px; font-family: var(--mono); font-size: 13px; resize: vertical; }
#segCount { color: var(--brand); }


/* === FIXES === */
.filters input[type=checkbox], .row input[type=checkbox] { height: auto; min-width: 0; width: 16px; }

/* === SETTINGS-2 === */
.stage-row { display: grid; grid-template-columns: auto auto 1fr 70px 140px auto auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stage-row-move { display: flex; gap: 6px; }
.stage-row-name { min-width: 120px; }
.stage-row-pct { display: flex; align-items: center; gap: 4px; }
.stage-row-pct input { width: 60px; }
.stage-row-rot { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.stage-row-rot input { width: 70px; }
.color-dot { position: relative; display: inline-block; width: 28px; height: 28px; border-radius: 50%; background: var(--dot, #64748b); overflow: hidden; flex: none; }
.color-dot input[type="color"] { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; padding: 0; opacity: 0; cursor: pointer; }
@media (max-width: 900px) {
  .stage-row { grid-template-columns: 1fr; }
}
.invite-link { width: 240px; font-size: 12px; padding: 6px 8px; }

/* === DESIGN-1 === karta firmy 2.0 + edytor kampanii (spec: docs/design/*.md) */
/* -- Karta firmy -- */
.crumbs { display: flex; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); } .crumbs a:hover { color: var(--ink); }
.crumbs [aria-current] { color: var(--ink-2); font-weight: 600; }
.company-head .company-id { display: flex; gap: 14px; align-items: center; min-width: 0; }
.company-logo { --av: var(--brand); width: 48px; height: 48px; border-radius: var(--r); background: var(--av); color: #fff; display: grid; place-items: center; font-weight: 750; font-size: 17px; flex: none; }
.anchor-nav { position: sticky; top: var(--topbar-h); z-index: 5; display: flex; gap: 2px; padding: 6px 0; margin-bottom: 16px; background: var(--bg); border-bottom: 1px solid var(--line); overflow-x: auto; }
.anchor-nav a { padding: 6px 12px; border-radius: var(--r-sm); color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
.anchor-nav a:hover, .anchor-nav a.active { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
[id="dane"], [id="reprezentanci"], [id="notatki"], [id="os-czasu"], [id="szanse"], [id="historia"] { scroll-margin-top: calc(var(--topbar-h) + 56px); }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 28px; }
.card-grid fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.card-grid legend { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; padding: 0; }
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center; gap: 8px; min-height: 34px; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: 0; }
.kv > label { font-size: 12.5px; color: var(--muted); font-weight: 500; margin: 0; }
.kv-view { overflow-wrap: anywhere; } .kv-view.is-empty { color: var(--muted-2); }
.inline-form .kv-edit, .inline-form .inline-actions { display: none; }
.inline-form.is-editing .kv-view { display: none; }
.inline-form.is-editing .kv-edit { display: block; width: 100%; }
.inline-form.is-editing .inline-actions { display: flex; }
.inline-form.is-editing .kv { border-bottom-color: transparent; padding: 3px 0; }
.inline-actions { gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.contacts-table th[data-sort] { cursor: pointer; user-select: none; }
.contacts-table th[aria-sort="ascending"]::after { content: " ↑"; color: var(--brand); }
.contacts-table th[aria-sort="descending"]::after { content: " ↓"; color: var(--brand); }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; white-space: nowrap; }
.row-actions form { display: inline; margin: 0; }
.row-actions .danger-ic:hover { color: var(--danger); background: var(--danger-bg); }
.consent { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: 12px; font-weight: 700; }
.consent.yes { background: var(--ok-bg); color: var(--ok-ink); }
.consent.no { background: var(--neutral-bg); color: var(--muted); }
.autosave-hint { font-size: 12px; color: var(--muted); min-height: 1em; }
.autosave-hint[data-state="saving"] { color: var(--muted); }
.autosave-hint[data-state="saved"] { color: var(--ok-ink); }
.autosave-hint[data-state="saved"]::before { content: "✓ "; }
.autosave-hint[data-state="dirty"] { color: var(--warn-ink); }
.autosave-hint[data-state="error"] { color: var(--danger-ink); cursor: pointer; text-decoration: underline; }
.disclosure > summary { cursor: pointer; list-style: none; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::after { content: "▾"; color: var(--muted); transition: transform .15s; }
.disclosure:not([open]) > summary { border-bottom: 0; }
.disclosure:not([open]) > summary::after { transform: rotate(-90deg); }
.event-list { list-style: none; margin: 0; padding: 8px 18px 14px; }
.event-list li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.event-list li:last-child { border-bottom: 0; }
.event-list p { margin: 0; } .event-list time { font-size: 11.5px; color: var(--muted); }
.ev-ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--neutral-bg); color: var(--neutral-ink); font-size: 13px; }
.ev-created .ev-ic { background: var(--brand-soft); color: var(--brand); }
.ev-stage .ev-ic, .ev-deal .ev-ic { background: var(--info-bg); color: var(--info-ink); }
.ev-quote .ev-ic { background: var(--violet-bg); color: var(--violet-ink); }
.ev-campaign .ev-ic { background: var(--accent-soft); color: var(--accent); }
.ev-contact .ev-ic { background: var(--ok-bg); color: var(--ok-ink); }
.ev-edit .ev-ic { background: var(--warn-bg); color: var(--warn-ink); }
.deal-mini { display: flex; align-items: center; gap: 8px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.deal-mini:last-child { border-bottom: 0; }
.deal-mini .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.deal-mini.closed { opacity: .6; }
.kpis.kpis-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpis.kpis-2 .kpi { padding: 12px 14px; } .kpis.kpis-2 .kpi .n { font-size: 20px; }

/* -- Modal (<dialog>) -- */
dialog.modal { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0; width: min(560px, calc(100vw - 32px)); background: var(--panel); color: var(--ink); box-shadow: var(--sh-lg); }
dialog.modal.wide { width: min(760px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(15, 23, 42, .45); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 15px; margin: 0; }
.modal-body { padding: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--panel-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* -- Edytor kampanii -- */
.wizard-steps { margin-bottom: 16px; }
.stepper .step.has-error button::after { content: ""; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
.wizard-pane > * + * { margin-top: 16px; }
.wizard-foot { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 30%); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.editor-shell { overflow: hidden; }
.editor-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.vars { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 12px; }
.chip { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink-2); font-size: 12px; font-weight: 600; cursor: pointer; }
.chip[style*="--c"] { border-color: var(--c, var(--line-2)); color: var(--c, var(--ink-2)); background: color-mix(in srgb, var(--c, var(--panel)) 12%, var(--panel)); }
.crm-tags { display: flex; flex-wrap: wrap; gap: 4px; max-width: 220px; }
.crm-tags .chip, .crm-tags .muted { height: 22px; padding: 0 8px; font-size: 11px; }
.crm-tags .chip { display: inline-block; max-width: 180px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; } /* długie nazwy tagów ucinane z wielokropkiem, pełna nazwa w title */
.chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.editor-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; min-height: 70vh; }
.editor-canvas { min-height: 70vh; background: var(--bg-2); position: relative; }
.editor-panel { border-left: 1px solid var(--line); background: var(--panel); overflow-y: auto; max-height: 85vh; }
.editor-tabs { margin: 0; padding: 0 8px; position: sticky; top: 0; background: var(--panel); z-index: 1; }
.editor-tabs a { cursor: pointer; padding: 9px 10px; font-size: 12.5px; }
.recipients-live .kpi-big { display: flex; align-items: baseline; gap: 8px; }
.kpi-big .n { font-size: 40px; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--brand); }
.kpi-big .l { color: var(--muted); font-weight: 600; }
.send-options, .template-pick { display: grid; gap: 10px; }
.template-pick { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.radio-card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 14px 42px; border: 1px solid var(--line-2); border-radius: var(--r); cursor: pointer; position: relative; background: var(--panel); }
.radio-card > input[type="radio"] { position: absolute; left: 16px; top: 17px; accent-color: var(--brand); }
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: var(--ring); }
.radio-card input[type="datetime-local"] { margin-top: 6px; max-width: 260px; }
.mail-thumb { height: 400px; overflow: hidden; background: var(--bg-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.mail-thumb iframe { width: 600px; height: 800px; border: 0; transform: scale(.5); transform-origin: 0 0; pointer-events: none; background: #fff; }
.mail-preview iframe { width: 100%; height: 520px; border: 0; background: #fff; display: block; }

/* -- GrapesJS w tokenach Sellos (ładować PO grapes.min.css) -- */
.editor-shell .gjs-editor, .editor-panel { font-family: var(--font); }
.editor-shell .gjs-one-bg { background-color: var(--panel); }
.editor-shell .gjs-two-color { color: var(--ink-2); }
.editor-shell .gjs-three-bg { background-color: var(--brand); color: var(--brand-ink); }
.editor-shell .gjs-four-color, .editor-shell .gjs-four-color-h:hover { color: var(--brand); }
.editor-shell .gjs-cv-canvas { background: var(--bg-2); width: 100%; top: 0; height: 100%; }
.editor-shell .gjs-pn-panels, .editor-shell .gjs-pn-views-container, .editor-shell .gjs-pn-views { display: none; }
.editor-panel .gjs-blocks-c { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 10px; }
.editor-panel .gjs-block-category .gjs-title { background: transparent; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; }
.editor-panel .gjs-block { width: auto; min-height: 76px; margin: 0; padding: 10px 6px; border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: none; background: var(--panel); color: var(--ink-2); font-size: 12px; font-weight: 600; transition: border-color .15s, background .15s; }
.editor-panel .gjs-block:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.editor-panel .gjs-block svg, .editor-panel .gjs-block-label { color: inherit; }
.editor-panel .gjs-sm-sector-title, .editor-panel .gjs-layer-title { background: var(--panel-2); border-bottom: 1px solid var(--line); color: var(--ink); font-weight: 600; }
.editor-panel .gjs-field, .editor-panel .gjs-input-holder input, .editor-panel .gjs-sm-field { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-sm); color: var(--ink); }
.editor-panel .gjs-field:focus-within { box-shadow: var(--ring); border-color: var(--brand); }
.editor-shell .gjs-selected { outline: 2px solid var(--brand) !important; outline-offset: -2px; }
.editor-shell .gjs-toolbar { background: var(--brand); border-radius: var(--r-sm); }
.editor-shell .gjs-badge { background: var(--brand); border-radius: 4px; font-family: var(--font); }
.editor-shell .gjs-placeholder-int { background: var(--brand); }
.gjs-mdl-dialog { font-family: var(--font); background: var(--panel); color: var(--ink); border-radius: var(--r-lg); box-shadow: var(--sh-lg); }
.gjs-mdl-header { border-bottom: 1px solid var(--line); }
.gjs-rte-toolbar { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--sh); }
.gjs-rte-action { color: var(--ink-2); border-right-color: var(--line); }
.gjs-rte-active { background: var(--brand-soft); color: var(--brand); }

@media (max-width: 1100px) { .editor-body { grid-template-columns: minmax(0, 1fr) 260px; } }
@media (max-width: 860px) {
  .card-grid, .form-grid.cols-3, .template-pick { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; padding: 6px 0; }
  .company-head { flex-direction: column; align-items: stretch; }
  .company-head .crm-owner { display: none; }
  .company-kpis { order: -1; }
  .contacts-table thead { display: none; }
  .contacts-table, .contacts-table tbody, .contacts-table tr, .contacts-table td { display: block; width: 100%; }
  .contacts-table tr { position: relative; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .contacts-table td { border: 0; padding: 3px 0; }
  .contacts-table td[data-label]:not(:first-child)::before { content: attr(data-label) ": "; color: var(--muted); font-size: 12px; }
  .contacts-table td.row-actions { position: absolute; top: 8px; right: 8px; width: auto; }
  .contacts-table .row-actions .btn { width: 36px; height: 36px; }
  .editor-body { grid-template-columns: 1fr; }
  .editor-canvas { min-height: 60vh; }
  .editor-panel { border-left: 0; border-top: 1px solid var(--line); max-height: none; }
}
/* === /DESIGN-1 === */

/* === CRM-2 === karta firmy 2.0 — uzupełnienia do DESIGN-1 */
.company-head h2, #dane h2, #reprezentanci h2, #notatki h2, #os-czasu h2, #szanse h2, #historia h2 { font-size: 15px; margin: 0; }
.company-head .actions { align-items: center; }
.crm-owner { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); margin-right: 4px; }
.input.sm { height: 32px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--panel); color: var(--ink); font-size: 13px; width: 180px; }
.contacts-table th .th-sort { all: unset; cursor: pointer; font: inherit; color: inherit; }
.contacts-table th .th-sort:focus-visible { box-shadow: var(--ring); border-radius: 4px; }
.contacts-table tr[hidden], .timeline .item[hidden] { display: none !important; }
.contacts-table .cell-user { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.contacts-table .center { text-align: center; } .contacts-table .right { text-align: right; }
.contacts-table .truncate { display: inline-block; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
#notatki textarea { width: 100%; resize: vertical; min-height: 110px; }
.crm-notes-foot { margin-top: 6px; font-size: 12px; }
#os-czasu .card-head { flex-wrap: wrap; gap: 8px; }
#os-czasu .quick-note { border-bottom: 1px solid var(--line); }
#os-czasu .quick-note textarea { width: 100%; }
.deal-mini .num { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.inline-form .kv-edit .row input { min-width: 0; }
.dropdown .menu form { margin: 0; } .dropdown .menu button.danger { color: var(--danger-ink); }
@media (max-width: 1100px) { .company-grid > aside { display: contents; } .company-grid .company-kpis { order: -1; } .company-grid { display: flex; flex-direction: column; } }
@media (max-width: 860px) {
  .company-head .actions .btn:not(.icon) { flex: 1; justify-content: center; }
  .company-head .actions > .btn:first-of-type { flex-basis: 100%; }
  #reprezentanci .card-head { flex-wrap: wrap; gap: 8px; } .input.sm { width: 100%; }
  .contacts-table .row-actions .btn { min-width: 36px; min-height: 36px; }
}
/* === /CRM-2 === */
.tag, .tag-chip { white-space: nowrap; }
.org-switch { display: block; margin: 0 12px 10px; }
.org-switch > .org { margin: 0; width: 100%; cursor: pointer; text-align: left; border-color: var(--line); }
.org-switch > .org:hover { background: var(--bg); }
.org-switch > .org .ic:last-child { margin-left: auto; color: var(--muted); }

/* === CAMPAIGN PREVIEW === */
.campaign-preview .pv-wrap { background: var(--bg-2); padding: 20px; display: flex; justify-content: center; }
.campaign-preview iframe { width: 100%; max-width: 100%; height: 620px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; transition: width .2s var(--ease); }

/* ===== WORK-1: projekty i zadania ===== */
.prj-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.task-card .due { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); }
.task-card .due.late { color: var(--danger); font-weight: 600; }
.task-card.prio-urgent { border-left: 3px solid var(--danger); } .task-card.prio-high { border-left: 3px solid var(--warn); }
.task-card.saving { opacity: .55; }
.col-add { padding: 0 10px 10px; } .col-add input { width: 100%; background: transparent; border: 1px dashed var(--line-2); }
.col-add input:focus { background: var(--panel); border-style: solid; }
.text-danger { color: var(--danger); }
.subtask { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.subtask .spacer { flex: 1; }
.subtask.done a { text-decoration: line-through; color: var(--muted); }
.subtask .chk { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-2); background: var(--panel); display: grid; place-items: center; cursor: pointer; padding: 0; }
.subtask.done .chk { background: var(--ok); border-color: var(--ok); color: #fff; }
.gantt-wrap { overflow-x: auto; }
.gantt { --day: 28px; min-width: calc(260px + var(--day) * var(--days)); font-size: 12px; }
.gantt .g-row { display: grid; grid-template-columns: 260px 1fr; border-bottom: 1px solid var(--line); min-height: 34px; }
.gantt .g-label { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 10px; position: sticky; left: 0; background: var(--panel); z-index: 2; border-right: 1px solid var(--line); overflow: hidden; }
.gantt .g-label a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt .g-track { position: relative; }
.gantt .g-head { min-height: 44px; font-weight: 600; color: var(--muted); }
.gantt .g-week { position: absolute; top: 4px; white-space: nowrap; font-size: 11px; }
.gantt .g-day { position: absolute; bottom: 4px; width: var(--day); text-align: center; font-size: 10px; }
.gantt .g-day.we { opacity: .6; } .gantt .g-day.today { color: var(--brand); font-weight: 700; }
.gantt .g-bg { position: absolute; top: 0; bottom: 0; width: var(--day); background: var(--bg-2); }
.gantt .g-bg.today { background: color-mix(in srgb, var(--brand) 12%, transparent); }
.gantt .g-bar { position: absolute; top: 7px; height: 20px; border-radius: 5px; color: #fff; font-size: 11px; line-height: 20px; padding: 0 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; z-index: 1; }
.gantt .g-bar.late { outline: 2px solid var(--danger); }
.timesheet .ts-today { color: var(--brand); }
.timer-pill { display: inline-flex; align-items: center; gap: 6px; background: color-mix(in srgb, var(--danger) 10%, var(--panel)); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 12px; max-width: 280px; }
.timer-pill a { display: inline-flex; align-items: center; gap: 5px; color: var(--ink); min-width: 0; font-variant-numeric: tabular-nums; }
.timer-pill button { border: 0; background: var(--danger); color: #fff; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; padding: 0; }
.timer-pill .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); animation: tpulse 1.4s infinite; }
@keyframes tpulse { 50% { opacity: .3; } }
@media (max-width: 760px) { .timer-pill .truncate { display: none; } .gantt .g-row { grid-template-columns: 150px 1fr; } .gantt { min-width: calc(150px + var(--day) * var(--days)); } }

/* === PILLS AS RADIO (activities type etc.) === */
.pills label { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; margin: 0; user-select: none; }
.pills label input[type=radio], .pills label input[type=checkbox] { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
.pills label:hover { color: var(--ink); }
.pills label.active, .pills label:has(input:checked) { background: var(--panel); color: var(--ink); box-shadow: var(--sh-sm); }
.pills label .ic { width: 15px; height: 15px; }
input[type=color] { width: 36px; height: 30px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--panel); cursor: pointer; vertical-align: middle; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; } input[type=color]::-webkit-color-swatch { border: 0; border-radius: 4px; }
input[type=file] { font-size: 13px; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; font-size: 12.5px; padding: 6px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); margin-right: 10px; cursor: pointer; }

/* === FILES-1: Menedżer plików === */
.files-layout { display: grid; grid-template-columns: 240px 1fr; gap: 18px; align-items: start; }
.files-tree { padding: 12px; }
.files-tree-space { margin-bottom: 14px; }
.files-tree-root { display: flex; align-items: center; gap: 8px; font-weight: 600; padding: 7px 8px; border-radius: var(--r-sm); color: var(--ink); }
.files-tree-root:hover, .files-tree-list a:hover { background: var(--bg); text-decoration: none; }
.files-tree-root.active, .files-tree-list a.active { background: var(--brand-bg, var(--bg-2)); color: var(--brand); }
.files-tree-list { list-style: none; margin: 4px 0 0; padding-left: 10px; }
.files-tree-list a { display: flex; align-items: center; gap: 7px; padding: 6px 8px; border-radius: var(--r-sm); color: var(--ink-2); font-size: 13px; }
.files-tree-list.nested { padding-left: 16px; }
.files-content { min-width: 0; }
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:last-child { color: var(--ink); font-weight: 600; }
.files-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.files-toolbar .flex-1 { flex: 1; }
.files-toolbar .filters { display: flex; gap: 6px; align-items: center; }
.files-toolbar .filters input, .files-toolbar .filters select { font-size: 13px; }
.inline-form { display: flex; gap: 6px; align-items: center; }
.btn-group { display: inline-flex; gap: 2px; }
.btn-group .active { background: var(--bg-2); }
.dropzone { border: 2px dashed var(--line-2); border-radius: var(--r); padding: 22px; text-align: center; color: var(--muted); font-size: 13.5px; cursor: pointer; margin-bottom: 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--bg-2); color: var(--ink); }
.dropzone .progress-list { width: 100%; }
.progress-item { font-size: 12.5px; padding: 6px 0; color: var(--ink-2); }
.progress-item.error { color: var(--danger-ink); }
.folder-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.folder-chip { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r); font-size: 13px; color: var(--ink); background: var(--panel); }
.folder-chip:hover { background: var(--bg); text-decoration: none; }
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.file-card { position: relative; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--panel); }
.file-thumb { aspect-ratio: 1; display: grid; place-items: center; background: var(--bg-2); color: var(--muted-2); cursor: pointer; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-meta { padding: 8px 10px; }
.file-name { font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-actions { position: absolute; top: 6px; right: 6px; }
.badge.green { background: var(--ok-bg); color: var(--ok-ink); }

/* === UX-2 === audyt spójności UI */
/* P1: blok kodu w trybie ciemnym (tło var(--ink) = jasne, tekst jasny → nieczytelny) */
:root[data-theme="dark"] .code-block { background: var(--bg); border: 1px solid var(--line-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .code-block { background: var(--bg); border: 1px solid var(--line-2); } }
pre.code-block.small { white-space: pre-wrap; word-break: break-all; }
/* P2: select multiple — bez strzałki, z wysokością listy */
select[multiple], select[size]:not([size="1"]) { background-image: none; padding: 6px; padding-right: 6px; min-height: 120px; }
select[multiple] option { padding: 5px 8px; border-radius: 4px; }
/* P2: focus ring dla ukrytych radio/checkbox w pigułkach i kartach wyboru */
.pills label:has(input:focus-visible), .act-types label:has(input:focus-visible), .radio-card:has(input:focus-visible) { box-shadow: var(--ring); }
/* P2: akcje formularza — przyciski jednej wysokości, główny po prawej na wąskim ekranie też */
.form-actions .btn, .modal-foot .btn { min-height: 34px; }
/* P2: tabele w kartach — daty i kwoty nie łamią się, długie nazwy ucinane */
.card .table td.nowrap, .card .table th { white-space: nowrap; }
.card .table .rowlink { display: inline-block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.dropdown .menu form button .ic { flex: none; }
@media (max-width: 860px) {
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1 1 auto; justify-content: center; }
  .card .table .rowlink { max-width: 200px; }
}

/* === STAGE BADGE (kontrast w obu motywach) === */
.badge.stage { --c: var(--brand); background: color-mix(in srgb, var(--c) 16%, var(--panel)); color: color-mix(in srgb, var(--c) 72%, var(--ink)); }
.badge.stage .dot { background: var(--c); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.stage { background: color-mix(in srgb, var(--c) 28%, var(--panel)); color: color-mix(in srgb, var(--c) 45%, #fff); } }
:root[data-theme="dark"] .badge.stage { background: color-mix(in srgb, var(--c) 28%, var(--panel)); color: color-mix(in srgb, var(--c) 45%, #fff); }

/* === CARD SPACING (karty-rodzeństwo nigdy nie stykają się) === */
.content > .card + .card, .content > .card + form > .card, .content > form + .card, .content > .card + .grid, .content > .grid + .card, .content > .card + .kpis, .content > .kpis + .card { margin-top: 16px; }

/* === LISTS-2 (przypisywanie kontaktów do list mailingowych, komponent multiselect) === */
.msel { position: relative; }
.msel-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 40px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); cursor: text; }
.msel-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.msel-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.msel-chip { gap: 6px; }
.msel-chip-x { border: 0; background: none; color: inherit; cursor: pointer; font-size: 13px; line-height: 1; padding: 0 0 0 2px; }
.msel-chip-x:hover { color: var(--danger-ink); }
.msel-input { flex: 1 1 80px; min-width: 80px; border: 0; outline: 0; background: none; font-size: 13px; color: var(--ink); padding: 2px 0; }
.msel-menu { position: absolute; left: 0; right: 0; top: calc(100% + 4px); max-height: 240px; overflow: auto; z-index: 50; display: block; }
.msel .menu.msel-menu { display: block; }
.msel-opt { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; cursor: pointer; border-radius: 6px; font-size: 13px; color: var(--ink-2); }
.msel-opt:hover { background: var(--bg); color: var(--ink); }
.msel-opt.is-selected { font-weight: 600; color: var(--brand); }
.msel-opt.is-active { background: var(--bg); }
.msel-opt.is-disabled { color: var(--muted); cursor: not-allowed; font-style: italic; }
.msel-empty { padding: 8px 10px; font-size: 13px; color: var(--muted); }
.msel-create { display: flex; gap: 6px; padding: 6px; border-top: 1px solid var(--line); }
.msel-create input { flex: 1; }
.lists-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.lists-chips .tag { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.lists-chips .more { color: var(--muted); font-size: 12px; }
@media (max-width: 1100px) { .contacts-table .col-lists { display: none; } }
.card + .card { margin-top: 16px; }
.stack > .card + .card, .grid > .card + .card { margin-top: 0; }

/* === FIX: .row-actions na <td> nie może być inline-flex (wypadało z tabeli) === */
.table td.row-actions { display: table-cell; opacity: 1; text-align: right; white-space: nowrap; }
.table td.row-actions > * { vertical-align: middle; }

/* === FIX: atrybut hidden ma zawsze wygrywać z display klas (.card-foot, .row, .flex…) === */
[hidden] { display: none !important; }
/* reprezentanci: na węższych ekranach chowamy kolumny Listy i Ostatni kontakt (dane są na karcie kontaktu), żeby akcje były widoczne bez przewijania */
@media (min-width: 861px) and (max-width: 1500px) {
  .contacts-table th:nth-child(6), .contacts-table td:nth-child(6), .contacts-table th:nth-child(7), .contacts-table td:nth-child(7) { display: none; }
}
.table td.row-actions form { display: inline; }
.table td.row-actions .btn { vertical-align: middle; }
/* reprezentanci: tabela ma się mieścić w karcie — e-mail i telefon skracane, akcje zwarte */
.contacts-table { table-layout: auto; }
.contacts-table td:nth-child(3), .contacts-table td:nth-child(4) { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contacts-table th, .contacts-table td { padding-left: 10px; padding-right: 10px; }
.contacts-table td.row-actions .btn.sm { width: 28px; height: 28px; }
@media (min-width: 861px) and (max-width: 1500px) { .contacts-table th:nth-child(2), .contacts-table td:nth-child(2) { display: none; } }

/* === FIX BURGER: na desktopie zwija sidebar, na mobile wysuwa; scrim tylko na mobile === */
.burger { display: inline-flex !important; }
@media (min-width: 861px) {
  .shell.collapsed { grid-template-columns: 0 1fr; }
  .shell.collapsed .sidebar { width: 0; overflow: hidden; border-right: 0; }
  .shell { transition: grid-template-columns .2s var(--ease); }
  .scrim.open { display: none; }
}

/* === FIX MOBILE OVERFLOW: elementy siatek/stosów nie mogą rozpychać strony === */
.grid > *, .stack > *, .content > * { min-width: 0; }
.day-item .body b, .day-item .body small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 860px) {
  .day-item { flex-wrap: wrap; row-gap: 4px; }
  .day-item .body { flex: 1 1 60%; }
  .day-item .when { white-space: normal; font-size: 12px; }
  .kpis { grid-template-columns: 1fr; }
  .page-head .actions { flex-wrap: wrap; }
}

/* === PLAN (Plan i rozliczenia: porównanie planów w aplikacji + plakietka) === */
.plan-badge { display: flex; align-items: center; gap: 9px; margin: 0 12px 12px; padding: 8px 10px; border-radius: var(--r); background: var(--brand-soft); color: var(--brand); font-size: 12.5px; line-height: 1.25; } /* PLAN-1: wiersz planu pod kartą organizacji, link do /app/settings/plan */
.plan-badge:hover { text-decoration: none; background: color-mix(in srgb, var(--brand) 16%, var(--panel)); }
.plan-badge-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.plan-badge-text b { font-weight: 700; }
.plan-badge-text small { font-size: 11.5px; font-weight: 500; color: var(--ink-2); }
.plan-badge .ic { width: 15px; height: 15px; flex: 0 0 auto; }
.plan-badge .ic:last-child { margin-left: auto; width: 14px; height: 14px; opacity: .7; }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: stretch; }
.plan { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; display: flex; flex-direction: column; position: relative; }
.plan.hot, .plan.current { border-color: var(--brand); box-shadow: 0 14px 40px -22px rgba(3,80,255,.45); }
.plan .ribbon { position: absolute; top: -12px; left: 20px; background: var(--brand); color: var(--brand-ink); font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.plan .name { font-weight: 700; font-size: 16px; }
.plan .for { color: var(--muted); font-size: 13px; margin-top: 2px; }
.plan .price { margin: 14px 0 4px; display: flex; align-items: baseline; gap: 6px; }
.plan .price b { font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.plan .price span { color: var(--muted); font-size: 13px; }
.plan .checks, .plan ul.checks { list-style: none; padding: 0; margin: 14px 0 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.plan .checks li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--ink-2); }
.plan .checks li .ic { width: 16px; height: 16px; color: var(--ok); flex: none; margin-top: 2px; }
.plan .btn.block { margin-top: auto; }
@media (max-width: 1000px) { .plans { grid-template-columns: 1fr; } }

/* === ADMIN-1 === */
.impersonate-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 20px; background: #fde68a; color: #78350f; font-size: 13px; font-weight: 500; border-bottom: 1px solid #f59e0b; }
.impersonate-bar form { display: inline; margin: 0; }
.impersonate-bar button { background: #78350f; color: #fff; border: 0; border-radius: 6px; padding: 3px 10px; font: inherit; font-weight: 600; cursor: pointer; }
.admin-badge { background: #dc2626 !important; color: #fff !important; }
.admin-panel .sidebar nav a .admin-count { margin-left: auto; }
.admin-panel .page-head .actions form { display: inline; margin: 0; }
.admin-panel .row-actions form { display: inline; margin: 0; }

/* === OPERATOR LINK (sidebar, tylko superadmin) === */
.sidebar .op-link { display: flex; align-items: center; gap: 8px; margin: 6px 12px; padding: 9px 12px; border-radius: var(--r-sm); background: var(--danger-bg); color: var(--danger-ink); font-weight: 700; font-size: 12.5px; border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent); }
.sidebar .op-link:hover { text-decoration: none; filter: brightness(.97); }
.sidebar .op-link .ic:last-child { margin-left: auto; }
.plan .plan-limits { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }
.plan .plan-limits span { display: inline-flex; align-items: center; gap: 5px; } .plan .plan-limits .ic { color: var(--brand); }

/* === FIX: karty rozdzielone <dialog> (modale między kartami nie psują odstępu) === */
dialog + .card, dialog + form > .card, dialog + .grid, dialog + .kpis { margin-top: 16px; }
.stack > dialog + .card, .grid > dialog + .card { margin-top: 0; }

/* === FIX: paski zakładek — ukryj pionowy scrollbar (margin-bottom:-1px na linkach robił 1px przewinięcia) === */
.tabs, .anchor-nav, .stepper { overflow-y: hidden; scrollbar-width: thin; }

/* === DANGER ZONE (zamknięcie konta) === */
.card.danger-zone { border-color: var(--danger); }
.card.danger-zone .card-head h3 { color: var(--danger-ink); }

/* === TEAM === */
.table tr.is-inactive td { opacity: .55; }
.table tr.is-inactive:hover td { opacity: .85; }
.team-actions .menu { min-width: 250px; }
.team-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.team-colors label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.team-colors input { margin: 0; }
.team-expired { color: var(--danger-ink); }

/* === FIX: menu akcji w przewijanej tabeli — nie przycinaj otwartego dropdownu === */
.table-wrap:has(.dropdown.open), .card:has(> .table-wrap .dropdown.open) { overflow: visible; }

/* === CAL PEEK === */
.cal-ev[data-peek], .cw-ev[data-peek] { cursor: pointer; }
.peek {
  position: fixed; width: 340px; max-height: 70vh; overflow: auto; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-lg); z-index: 60; font-size: 13px;
}
.peek::before {
  content: ''; position: absolute; width: 10px; height: 10px; background: var(--panel); border: 1px solid var(--line);
  transform: rotate(45deg); top: 16px;
}
.peek[data-arrow="left"]::before { left: -6px; border-right: 0; border-top: 0; }
.peek[data-arrow="right"]::before { right: -6px; border-left: 0; border-bottom: 0; }
.peek[data-arrow="top"]::before, .peek[data-arrow="bottom"]::before { left: 16px; top: auto; }
.peek[data-arrow="top"]::before { top: -6px; border-right: 0; border-bottom: 0; }
.peek[data-arrow="bottom"]::before { bottom: -6px; border-left: 0; border-top: 0; }
.peek-skel { height: 120px; margin: 14px; border-radius: var(--r); background: linear-gradient(90deg, var(--panel-2) 25%, var(--bg) 37%, var(--panel-2) 63%); background-size: 400% 100%; animation: peek-shimmer 1.4s ease infinite; }
@keyframes peek-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.peek-head { display: flex; align-items: flex-start; gap: 9px; padding: 14px 14px 10px; border-bottom: 1px solid var(--line); }
.peek-ic { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; align-items: center; justify-content: center; flex: none; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.peek-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.peek-type { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.peek-title strong { font-size: 14px; line-height: 1.3; word-break: break-word; }
.peek-close { margin-left: auto; flex: none; }
.peek-body { padding: 10px 14px; }
.peek-note { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 12.5px; }
.peek-note p { margin: 0 0 6px; }
.peek-foot { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 14px 14px; border-top: 1px solid var(--line); }
.peek .meta-list .row .v { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px 6px; text-align: right; min-width: 0; }
.peek .meta-list .row .v a { display: inline-flex; align-items: center; gap: 4px; }

/* === LOGO (SellSpace v2: sygnet + wordmark sell_space, pliki public/img/brand/, zasady docs/design/brand.md) === */
.logo-sellos { display: inline-flex; flex-direction: column; align-items: flex-start; gap: .3em; font-size: var(--logo-size, 20px); line-height: 1; color: var(--ink); font-family: var(--font); white-space: nowrap; }
.logo-sellos .w { display: inline-flex; align-items: center; height: var(--logo-h, 29px); }
.logo-sellos img { display: block; height: var(--logo-h, 29px); width: auto; max-width: none; }
.logo-sellos .m, .logo-sellos .lg-d { display: none; }
.logo-sellos .tagline { font-size: .4em; font-weight: 600; letter-spacing: .26em; text-transform: none; color: var(--muted); padding-left: calc(var(--logo-h, 29px) * 1.12); }
.logo-sellos.light { color: #fff; }
.logo-sellos.light .tagline { color: rgba(255, 255, 255, .72); }
.brand:hover { text-decoration: none; }
:root[data-theme="dark"] .logo-sellos:not(.light) .lg-l { display: none; }
:root[data-theme="dark"] .logo-sellos:not(.light) .lg-d { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-sellos:not(.light) .lg-l { display: none; }
  :root:not([data-theme="light"]) .logo-sellos:not(.light) .lg-d { display: block; }
}
.shell.collapsed .sidebar .logo-sellos .lg, .shell.collapsed .sidebar .logo-sellos .tagline { display: none !important; }
.shell.collapsed .sidebar .logo-sellos .m { display: block; }

/* === EDITOR BLOCKS === */
.editor-panel .gjs-block { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 84px; padding: 12px 6px 10px; background: var(--panel); color: var(--ink-2); cursor: grab; text-align: center; }
.editor-panel .gjs-block:active { cursor: grabbing; }
.editor-panel .gjs-block__media { display: flex; margin: 0; color: var(--muted); transition: color .15s; }
.editor-panel .gjs-block__media svg { width: 26px; height: 26px; display: block; stroke: currentColor; fill: none; }
.editor-panel .gjs-block-label { font-size: 11.5px; font-weight: 600; line-height: 1.25; margin: 0; }
.editor-panel .gjs-block:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.editor-panel .gjs-block:hover .gjs-block__media { color: var(--brand); }
.editor-panel .gjs-block:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* === FIX: karta będąca jednocześnie .card-body (np. meta kampanii) ma własny padding === */
.card.card-body { padding: 18px; }
.card.card-body.form-grid { padding: 18px; }
.card.card-body.form-grid > .field:last-child, .card.card-body.form-grid > .field:nth-last-child(-n+3):not(:has(~ .form-actions)) { margin-bottom: 0; }

/* === MAIL === */
.mail-layout { display: grid; grid-template-columns: 220px 380px 1fr; gap: 16px; align-items: start; }
.mail-sidebar { display: flex; flex-direction: column; gap: 12px; }
.mail-search input { width: 100%; }
.mail-folders, .mail-filters { display: flex; flex-direction: column; gap: 2px; }
.mail-folders a, .mail-filters a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--r); color: var(--ink-2); font-size: 13.5px; }
.mail-folders a:hover, .mail-filters a:hover { background: var(--panel-2); text-decoration: none; }
.mail-folders a.active, .mail-filters a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.mail-folders svg { width: 16px; height: 16px; }
.mail-list { max-height: 78vh; overflow-y: auto; padding: 0; }
.mail-rows { list-style: none; margin: 0; padding: 0; }
.mail-row { border-bottom: 1px solid var(--line); }
.mail-row-link { display: grid; grid-template-columns: 20px 1fr auto; gap: 4px 10px; padding: 10px 14px; color: var(--ink); align-items: center; }
.mail-row-link:hover { background: var(--panel-2); text-decoration: none; }
.mail-row.unread .mail-from, .mail-row.unread .mail-subject { font-weight: 700; }
.mail-from { font-size: 12.5px; color: var(--ink-2); grid-column: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mail-subject { font-size: 13.5px; grid-column: 2; display: flex; align-items: center; gap: 6px; overflow: hidden; min-width: 0; }
.mail-subject-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-subject .chip { flex: 0 0 auto; }
.mail-date { font-size: 11.5px; grid-row: 1 / span 2; grid-column: 3; align-self: center; }
.mail-flag { grid-row: 1 / span 2; color: var(--muted); }
.mail-reader { min-height: 320px; padding: 20px; }
.mail-reader-head h3 { margin: 0 0 4px; }
.mail-reader-meta { margin-bottom: 10px; }
.mail-reader-actions { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.mail-reader-link { padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mail-reader-body { line-height: 1.5; word-break: break-word; }
.mail-reader-body img { max-width: 100%; }
.mail-reader-attachments { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
#mailComposeModal { width: min(720px, 92vw); }
#mailComposeForm textarea { width: 100%; min-height: 220px; }
/* MAIL-3B2 */
.switch-field { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.mail-reader-actions-crm { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.mail-reader-images { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 8px 10px; background: var(--panel-2); border-radius: var(--r); flex-wrap: wrap; }
.mail-frame { width: 100%; min-height: 200px; border: 0; display: block; }
.mail-back { display: none; margin-bottom: 10px; }
.mail-row.mail-focused .mail-row-link { background: var(--brand-soft); }
@media (max-width: 1100px) { .mail-layout { grid-template-columns: 1fr; } .mail-sidebar { order: 1; } }
/* MAIL-3B2 pkt 5: mobile ≤760px — lista i czytanie jako osobne ekrany z przyciskiem „← Lista”. */
@media (max-width: 760px) {
  .mail-layout { gap: 10px; }
  .mail-list, .mail-reader { display: none; }
  body:not(.mail-reading) .mail-list { display: block; }
  body.mail-reading .mail-reader { display: block; }
  .mail-back { display: inline-flex; }
}

/* === MAIL-4 === jedna karta, trzy kolumny o wspólnej wysokości, gęsta lista, sticky pasek akcji */
.mail-layout { display: grid; grid-template-columns: 232px 400px minmax(0, 1fr); gap: 0; align-items: stretch; height: calc(100vh - 190px); min-height: 560px; padding: 0; overflow: hidden; }
.mail-layout > * { height: 100%; min-height: 0; min-width: 0; overflow: auto; }
.mail-sidebar { gap: 2px; padding: 12px 10px; border-right: 1px solid var(--line); background: var(--panel-2); }
.mail-search { position: relative; margin-bottom: 4px; }
.mail-search .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted-2); pointer-events: none; }
.mail-search input[type=search] { padding-left: 32px; height: 34px; }
.mail-sidebar .sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); padding: 14px 10px 6px; font-weight: 650; }
.mail-folders a, .mail-filters a { padding: 6px 10px; white-space: nowrap; }
.mail-folders a .lbl, .mail-filters a .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.mail-filters .ic, .mail-folders .ic { width: 16px; height: 16px; flex: none; }
.mail-folders a.active .badge { background: var(--panel); }
.mail-sync { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 10px 4px 0; border-top: 1px solid var(--line); font-size: 12px; }
.mail-list { max-height: none; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.mail-list-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 48px; padding: 0 10px 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); font-size: 13.5px; flex: none; }
.mail-list-head .muted { font-weight: 500; }
#mailSortBtn.asc .ic { transform: scaleY(-1); }
.mail-rows { flex: 1 0 auto; }
.mail-row { position: relative; }
.mail-row-link { grid-template-columns: 24px minmax(0, 1fr); grid-template-rows: 22px 20px; gap: 0 8px; height: 64px; padding: 10px 14px 10px 8px; box-sizing: border-box; }
.mail-row-link:hover { background: var(--panel-2); }
.mail-gutter { grid-row: 1 / span 2; grid-column: 1; display: flex; flex-direction: column; align-items: center; justify-content: space-between; height: 100%; padding: 2px 0; }
.mail-flag { grid-row: auto; display: inline-flex; color: var(--muted-2); }
.mail-flag .ic { width: 15px; height: 15px; }
.mail-flag.on { color: var(--warn); }
.mail-flag.on svg { fill: currentColor; }
.mail-gutter .dot { width: 8px; height: 8px; border-radius: 50%; background: transparent; }
.mail-row.unread .mail-gutter .dot { background: var(--brand); }
.mail-line1 { grid-column: 2; grid-row: 1; display: flex; align-items: center; gap: 6px; min-width: 0; }
.mail-from { grid-column: auto; flex: 1 1 auto; font-size: 13.5px; color: var(--ink); }
.mail-row:not(.unread) .mail-from { font-weight: 500; color: var(--ink-2); }
.mail-row.unread .mail-subject { font-weight: 600; }
.mail-clip { display: inline-flex; color: var(--muted-2); flex: none; }
.mail-clip .ic { width: 13px; height: 13px; }
.mail-date { grid-row: auto; grid-column: auto; flex: none; white-space: nowrap; font-size: 12px; }
.mail-row.unread .mail-date { color: var(--brand); font-weight: 600; }
.mail-subject { grid-column: 2; grid-row: 2; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.mail-subject .chip.sm, .mail-subject .chip { flex: 0 1 auto; max-width: 140px; height: 20px; padding: 0 8px; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; line-height: 18px; cursor: default; }
.mail-row.mail-selected .mail-row-link, .mail-row.mail-focused .mail-row-link { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.mail-list .pager { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; padding: 8px; background: var(--panel); border-top: 1px solid var(--line); flex: none; }
.mail-list .pager a { min-width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: var(--r-sm); color: var(--ink-2); font-size: 12.5px; }
.mail-list .pager a:hover { background: var(--panel-2); text-decoration: none; }
.mail-list .pager a.active { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.mail-list > .empty { margin: auto 0; }
.mail-reader { min-height: 0; padding: 0; position: relative; background: var(--panel); }
.mail-reader-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.mail-reader-empty kbd, .mail-reader-empty kbd { font-size: 11px; }
.mail-toolbar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; min-height: 48px; padding: 6px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.mail-toolbar-group { display: flex; gap: 2px; }
.mail-toolbar-group + .mail-toolbar-group { padding-left: 6px; margin-left: 2px; border-left: 1px solid var(--line); }
.mail-toolbar .btn .lbl { margin-left: 4px; }
.mail-toolbar .mail-danger:hover { color: var(--danger); background: var(--danger-bg); }
.mail-reader-inner { padding: 20px 24px 32px; }
.mail-reader-subject { font-size: 19px; line-height: 1.3; margin: 0 0 14px; }
.mail-reader-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.mail-avatar { width: 36px; height: 36px; font-size: 13px; }
.mail-reader-who { flex: 1; min-width: 0; font-size: 13.5px; }
.mail-reader-recips { margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-reader-head time { white-space: nowrap; padding-top: 2px; }
.mail-reader-link { padding: 8px 0; margin-bottom: 16px; gap: 6px; }
.mail-reader-link .chip .ic { width: 13px; height: 13px; margin-right: 4px; }
.mail-reader-frame { max-width: 760px; padding: 24px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.mail-reader-frame .mail-frame { background: #fff; border-radius: var(--r-sm); }
.mail-reader-attachments { max-width: 760px; }
.mail-reader-attachments .ic { width: 14px; height: 14px; vertical-align: -2px; }
.mail-att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 8px; }
.mail-att { display: flex; align-items: center; gap: 8px; padding: 8px 6px 8px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel-2); min-width: 0; }
.mail-att-ic { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--brand-soft); color: var(--brand); flex: none; }
.mail-att-ic .ic { width: 16px; height: 16px; vertical-align: 0; }
.mail-att-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 12.5px; }
.mail-att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--ink); }
/* ≤1680: panel czytania ~520–700 px — etykiety tylko przy Odpowiedz/Przekaż, reszta ikony z tooltipem (title) */
@media (max-width: 1680px) { .mail-toolbar-group:last-child .lbl, .mail-toolbar-group:nth-of-type(2) .lbl { display: none; } }
@media (max-width: 1360px) { .mail-layout { grid-template-columns: 220px 360px minmax(0, 1fr); } .mail-toolbar-group:nth-of-type(1) .btn:last-child .lbl { display: none; } }
/* ≤1180: kolumna folderów zwija się do paska ikon 56 px (etykiety w title = tooltip) */
@media (max-width: 1180px) {
  .mail-layout { grid-template-columns: 56px 340px minmax(0, 1fr); }
  .mail-sidebar { padding: 10px 6px; align-items: stretch; }
  .mail-sidebar .lbl, .mail-sidebar .sec, .mail-folders .badge, .mail-search input[type=search] { display: none; }
  .mail-sidebar .mail-search .ic { position: static; transform: none; display: block; margin: 8px auto; }
  .mail-folders a, .mail-filters a { justify-content: center; padding: 9px 0; position: relative; }
  .mail-filters { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
  .mail-sync { justify-content: center; padding: 8px 0 0; }
  .mail-toolbar .lbl { display: none; }
}
@media (max-width: 1100px) { .mail-layout { grid-template-columns: 56px 320px minmax(0, 1fr); } .mail-sidebar { order: 0; } }
/* ≤760: tryb mobile — lista ↔ czytanie (MAIL-3B2) w jednej karcie, folder jako pasek ikon u góry */
@media (max-width: 760px) {
  .mail-layout { display: flex; flex-direction: column; height: calc(100vh - 170px); min-height: 480px; }
  .mail-layout > * { height: auto; }
  .mail-sidebar { flex: none; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 6px; }
  .mail-folders, .mail-filters { flex-direction: row; border: 0; margin: 0; padding: 0; }
  .mail-folders a, .mail-filters a { width: 40px; }
  .mail-search, .mail-sync { display: none; }
  .mail-list, .mail-reader, body.mail-reading .mail-list { display: none; }
  body:not(.mail-reading) .mail-list, body.mail-reading .mail-reader { display: flex; flex: 1; min-height: 0; overflow: auto; }
  .mail-reader { flex-direction: column; }
  .mail-list { border-right: 0; }
  .mail-reader-inner { padding: 16px; }
  .mail-reader-frame { padding: 12px; }
  .mail-reader-head time { display: none; }
  .mail-toolbar { flex-wrap: nowrap; overflow-x: auto; }
  .mail-toolbar .lbl { display: none; }
}

/* === CALLS (CALL-1: nagrania rozmów SellSpace AI) === */
.call-rec { margin-top: 6px; }
.call-rec .call-meta { color: var(--muted); font-size: 13px; }
.call-rec .badge.muted { background: var(--line); color: var(--muted); }
.call-rec .call-summary { margin: 8px 0 4px; font-size: 14px; }
.call-rec .call-summary p { margin: 0 0 6px; }
.call-rec .call-summary ul { margin: 4px 0 6px 18px; padding: 0; }
.call-rec details summary { cursor: pointer; color: var(--muted); }
.call-rec pre.code-block { white-space: pre-wrap; word-break: break-word; max-height: 360px; margin-top: 6px; }
.call-rec audio { display: block; }
.pair-code { font-family: var(--mono); font-size: 28px; letter-spacing: .25em; font-weight: 700; margin: 8px 0; }
.pair-qr svg { width: 200px; height: 200px; display: block; }

/* === AI-2 === */
.ai-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.ai-presets .radio-card .tag { align-self: flex-start; margin-top: 4px; }
[data-ai-show][hidden] { display: none !important; }

/* === LOG-1 === */
.log-list { padding: 8px 14px; }
.log-entry { border-bottom: 1px solid var(--line); padding: 10px 0; }
.log-entry:last-child { border-bottom: 0; }
.log-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.log-head time { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.log-first { font-family: var(--mono); font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.log-trace { margin-top: 6px; }
.log-trace summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.log-trace pre.code-block, .log-cron { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; background: var(--line); padding: 10px; border-radius: 8px; margin-top: 6px; }
.log-cron { max-height: 70vh; overflow: auto; display: block; }


/* PROMO-1: promocja 0 zł w Ustawienia → Plan */
.price.promo-price s{opacity:.55;margin:0 6px;font-size:.9em}
.promo-std{font-size:12px;margin-top:-4px}
.promo-card{border-color:var(--brand,#6d28d9)}
