/* SHO CRM — closerzy. Tokeny jak w panelu SHO (shoelite.club): Space Grotesk + DM Sans, granat #06060E, fiolet hsl(250 85% 62%). Tylko ciemny motyw. */

:root {
  color-scheme: dark;
  --bg: #06060E;
  --bg-2: hsl(248 38% 9%);
  --fg: hsl(225 25% 95%);
  --muted: hsl(232 16% 66%);
  --dim: hsl(232 12% 46%);
  --card: rgba(13, 13, 28, 0.66);
  --card-solid: hsl(240 38% 8%);
  --card-hover: rgba(22, 20, 44, 0.78);
  --secondary: hsl(240 32% 12%);
  --border: hsl(245 30% 18%);
  --hairline: hsla(215, 90%, 65%, 0.16);
  --primary: hsl(250 85% 62%);
  --primary-soft: hsla(250, 85%, 62%, 0.16);
  --accent: hsl(210 95% 62%);
  --success: #3ddc97;
  --danger: hsl(0 72% 60%);
  --red: #ff7b7b;
  --gold: #f3c969;
  --gradient-brand: linear-gradient(120deg, hsl(205 100% 70%), hsl(230 95% 68%) 45%, hsl(275 90% 72%));
  --gradient-violet: linear-gradient(135deg, hsl(215 95% 58%), hsl(272 85% 66%));
  --shadow-lux: 0 30px 80px -40px hsla(250, 85%, 55%, 0.6);

  --font-heading: "Space Grotesk", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --radius: 16px;
  --radius-sm: 12px;
  --sidebar: 236px;
  --gutter: 16px;
  --tabbar: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--bg); }
body {
  background: var(--bg);
  color: var(--fg);
  font: 400 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}
body.noscroll { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { flex-shrink: 0; }
::selection { background: var(--primary); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; }
.red { color: var(--red); }
.gold { color: var(--gold); }
.ok { color: var(--success); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; }
.wrap { flex-wrap: wrap; }
.mt { margin-top: 14px; }
code { font-size: 12.5px; background: rgba(255,255,255,.06); padding: 1px 6px; border-radius: 6px; word-break: break-all; }

/* ---------- tło ---------- */
.bg-fx { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.glow { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; }
.glow-gold { width: 620px; height: 620px; right: -260px; top: -280px; background: radial-gradient(circle, hsla(40, 80%, 45%, .32), transparent 65%); }
.glow-violet { width: 820px; height: 820px; left: -10%; bottom: -560px; background: radial-gradient(circle, hsla(255, 85%, 55%, .30), transparent 65%); }

.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 12px; position: relative; z-index: 1; }
.boot-logo { font: 800 30px var(--font-heading); background: var(--gradient-brand); -webkit-background-clip: text; background-clip: text; color: transparent; letter-spacing: .04em; }

/* ---------- układ ---------- */
#app { position: relative; z-index: 1; }
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 22px;
  padding: 22px 14px 18px;
  background: linear-gradient(180deg, rgba(10, 10, 24, .92), rgba(8, 8, 20, .88));
  border-right: 1px solid var(--hairline);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 8px; }
.brand-logo { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; font: 800 12px var(--font-heading); letter-spacing: .04em; background: var(--gradient-violet); color: #fff; box-shadow: 0 0 22px hsla(265, 85%, 60%, .45); }
.brand-title { font: 700 16px/1.1 var(--font-heading); letter-spacing: -.01em; }
.eyebrow { font: 600 10px/1.2 var(--font-body); letter-spacing: .26em; text-transform: uppercase; color: hsl(255 90% 74%); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500; font-size: 14.5px;
  transition: background .18s, color .18s;
}
.nav a svg, .tabbar a svg, .btn svg, .icon-btn svg, .menu button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { color: var(--fg); background: rgba(255, 255, 255, .035); }
.nav a.active {
  color: #fff; background: linear-gradient(90deg, hsla(250, 85%, 62%, .26), hsla(250, 85%, 62%, .06));
  box-shadow: inset 0 0 0 1px hsla(250, 85%, 70%, .28);
}
.nav a.active::before {
  content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--gradient-brand); box-shadow: 0 0 14px hsl(250 85% 62%);
}
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11px; font-weight: 700; display: grid; place-items: center; background: var(--danger); color: #fff; }
.nav-badge:empty { display: none; }
.sidebar-foot { margin-top: auto; font-size: 12px; color: var(--dim); padding: 0 8px; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 28px; min-height: 60px;
  background: rgba(6, 6, 14, .78); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hairline);
}
.topbar .brand { display: none; padding: 0; }
.topbar-title { font: 700 17px var(--font-heading); letter-spacing: -.01em; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; position: relative; }
.user-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px 0 6px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--secondary); font-weight: 600; font-size: 13.5px;
}
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font: 700 13px var(--font-heading); color: #fff; background: var(--c, var(--primary)); }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; z-index: 40;
  background: var(--card-solid); border: 1px solid var(--hairline); border-radius: var(--radius-sm); padding: 6px;
  box-shadow: var(--shadow-lux); display: flex; flex-direction: column; gap: 2px;
}
.menu[hidden] { display: none; }
.menu-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--hairline); margin-bottom: 4px; }
.menu-head b { display: block; }
.menu button { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: 0; background: transparent; border-radius: 10px; text-align: left; font-weight: 500; }
.menu button:hover { background: rgba(255,255,255,.05); }

.main { min-width: 0; width: 100%; max-width: 1180px; padding: 24px 28px 60px; }
.view-enter { animation: enter .3s ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.tabbar { display: none; }

/* ---------- nagłówki ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 4px 0 0; font: 700 28px/1.1 var(--font-heading); letter-spacing: -.02em; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
h2.section { margin: 0; font: 700 17px/1.25 var(--font-heading); letter-spacing: -.01em; }
.section-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.sec-head { display: flex; align-items: center; gap: 10px; margin: 26px 0 10px; }
.sec-head h2 { margin: 0; font: 700 16px var(--font-heading); }
.sec-head .count { min-width: 24px; height: 22px; padding: 0 7px; border-radius: 11px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: rgba(255,255,255,.07); color: var(--muted); }
.sec-head .count.hot { background: var(--danger); color: #fff; }
.sec-head .sec-sub { font-size: 12.5px; color: var(--dim); margin-left: auto; }

/* ---------- elementy ---------- */
.card {
  position: relative; background: var(--card); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 18px; backdrop-filter: blur(12px);
}
.card + .card { margin-top: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--secondary); color: var(--fg); font-weight: 600; font-size: 14px; cursor: pointer;
  transition: transform .12s, background .18s, border-color .18s, box-shadow .18s, opacity .18s; white-space: nowrap;
  text-align: center;
}
.btn:hover { border-color: hsla(250, 85%, 70%, .5); background: hsl(240 32% 15%); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-primary { background: var(--primary); border-color: transparent; color: #fff; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; box-shadow: 0 10px 30px -12px hsla(250, 85%, 62%, .9); }
.btn-primary:hover { background: hsl(250 85% 66%); border-color: transparent; box-shadow: 0 12px 38px -10px hsla(250, 85%, 62%, 1); }
.btn-ghost { background: transparent; border-color: hsla(250, 85%, 62%, .45); color: hsl(255 90% 80%); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-danger { background: transparent; border-color: hsla(0, 72%, 60%, .4); color: #ff8b8b; }
.btn-danger:hover { background: hsla(0, 72%, 60%, .1); border-color: hsla(0, 72%, 60%, .7); }
.btn-danger-solid { background: var(--danger); border-color: transparent; color: #fff; font-weight: 700; }
.btn-call { background: var(--success); border-color: transparent; color: #04140c; font-weight: 700; box-shadow: 0 10px 26px -14px rgba(61,220,151,.9); }
.btn-call:hover { background: #55e6a7; border-color: transparent; }
.btn-gold { background: transparent; border-color: rgba(243,201,105,.5); color: var(--gold); }
.btn-gold:hover { background: rgba(243,201,105,.1); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-lg { min-height: 52px; font-size: 15px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { min-height: 40px; width: 40px; padding: 0; border-radius: 10px; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border); background: var(--secondary); color: var(--fg); }
.icon-btn:hover { border-color: hsla(250, 85%, 70%, .5); }
.link-btn { border: 0; background: none; padding: 6px 0; color: hsl(255 90% 78%); font-weight: 600; font-size: 13.5px; }
.link-btn:hover { text-decoration: underline; }
@media (pointer: coarse) { .link-btn { min-height: 44px; padding: 0 8px; display: inline-flex; align-items: center; } }

.seg { display: inline-flex; padding: 4px; gap: 2px; background: rgba(10, 10, 24, .7); border: 1px solid var(--hairline); border-radius: 13px; max-width: 100%; }
.seg button {
  min-height: 36px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--muted);
  font-weight: 600; font-size: 13px; transition: background .15s, color .15s; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.seg button:hover { color: var(--fg); }
.seg button.on { background: var(--primary); color: #fff; box-shadow: 0 6px 18px -8px hsla(250, 85%, 62%, 1); }
.seg button b { font-size: 11px; padding: 0 6px; border-radius: 8px; background: rgba(255,255,255,.1); line-height: 18px; }
.seg button.on b { background: rgba(255,255,255,.22); }
.seg button .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.seg-scroll { display: flex; overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
.seg-scroll::-webkit-scrollbar { display: none; }
.seg-full { display: flex; width: 100%; }
.seg-full button { flex: 1; justify-content: center; }

.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.chip-c { background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); }
.chip-flat { background: rgba(255, 255, 255, .06); color: var(--muted); }
.chip-ok { background: rgba(61, 220, 151, .12); color: var(--success); }
.chip-err { background: rgba(255, 90, 90, .12); color: var(--red); }
.chip-demo { background: rgba(243, 201, 105, .14); color: var(--gold); letter-spacing: .12em; font-size: 10.5px; box-shadow: inset 0 0 0 1px rgba(243,201,105,.35); }
.chip-pool { background: rgba(255,255,255,.06); color: var(--muted); border: 1px dashed rgba(255,255,255,.18); }
.chip-owner { background: rgba(255,255,255,.05); color: var(--fg); font-weight: 600; }
.chip-owner i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.chip-inactive { opacity: .7; }
.chip-inactive small { font-weight: 500; color: var(--muted, inherit); }
.chip-resub { background: rgba(243,201,105,.14); color: var(--gold); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fchip, .qchip {
  min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: rgba(10,10,24,.6);
  color: var(--muted); font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.fchip:hover, .qchip:hover { color: var(--fg); border-color: hsla(250, 85%, 70%, .5); }
.fchip.on, .qchip.on { background: var(--primary-soft); color: #fff; border-color: hsla(250, 85%, 70%, .7); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field, .field + .grid2, .grid2 + .field, .grid2 + .grid2 { margin-top: 12px; }
.field label, .label { font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.input, .select, .textarea {
  width: 100%; min-height: 46px; background: rgba(6, 6, 16, .8); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 13px; outline: none; transition: border-color .15s, box-shadow .15s; font-size: 16px;
}
.textarea { resize: vertical; min-height: 92px; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { border-color: hsla(250, 85%, 66%, .8); box-shadow: 0 0 0 3px hsla(250, 85%, 62%, .18); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9eb6' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; padding-right: 36px; }
.select option { background: var(--card-solid); }
.input[type="datetime-local"], .input[type="date"] { color-scheme: dark; }
.hint { font-size: 12.5px; color: var(--dim); line-height: 1.45; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.search { position: relative; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; fill: none; stroke: var(--dim); stroke-width: 2; stroke-linecap: round; }
.search .input { padding-left: 40px; }

.switch { position: relative; width: 48px; height: 28px; flex-shrink: 0; display: inline-block; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; z-index: 1; width: 100%; height: 100%; }
.switch span { position: absolute; inset: 0; border-radius: 14px; background: var(--secondary); border: 1px solid var(--border); transition: background .18s; }
.switch span::after { content: ""; position: absolute; top: 4px; left: 4px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform .18s, background .18s; }
.switch input:checked + span { background: var(--sw, var(--primary)); border-color: transparent; }
.switch input:checked + span::after { transform: translateX(20px); background: #fff; }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + span { opacity: .5; }

.empty { padding: 28px 18px; text-align: center; color: var(--muted); font-size: 14px; }
.empty strong { display: block; color: var(--fg); font: 600 15px var(--font-heading); margin-bottom: 4px; }
.empty-sm { padding: 14px; text-align: center; color: var(--dim); font-size: 13.5px; border: 1px dashed rgba(255,255,255,.08); border-radius: var(--radius-sm); }

.skeleton { background: linear-gradient(90deg, rgba(255,255,255,.03), rgba(255,255,255,.07), rgba(255,255,255,.03)); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: var(--radius); }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- toasty ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; min-width: 260px; max-width: 420px; padding: 12px 16px; border-radius: 12px; font-size: 14px; text-align: left;
  background: rgba(16, 16, 34, .96); border: 1px solid var(--hairline); box-shadow: var(--shadow-lux); color: var(--fg);
  animation: enter .25s ease both; border-left: 3px solid var(--primary);
}
.toast.ok { border-left-color: var(--success); }
.toast.err { border-left-color: var(--danger); }
.toast.gold { border-left-color: var(--gold); }
.toast-click { cursor: pointer; }

/* ---------- okna / arkusze ---------- */
.pm-bg { position: fixed; inset: 0; z-index: 70; background: rgba(3,3,10,.72); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; animation: fade .18s ease both; }
@keyframes fade { from { opacity: 0; } }
.pm {
  width: min(560px, 100%); max-height: min(88vh, 900px); display: flex; flex-direction: column;
  background: var(--card-solid); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-lux);
  animation: enter .22s ease both;
}
.pm-wide { width: min(820px, 100%); }
.pm-grab { display: none; }
.pm-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.pm-body { overflow-y: auto; overscroll-behavior: contain; margin: 0 -4px; padding: 0 4px 4px; }
.pm-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.pm-actions .btn { flex: 1 1 0; }
.pm p { margin: 0 0 6px; }

/* ---------- logowanie ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px var(--gutter); }
.auth-card { width: min(400px, 100%); padding: 26px 22px; }
.auth-card .brand { padding: 0; margin-bottom: 20px; }
.auth-card h1 { margin: 0 0 6px; font: 700 24px var(--font-heading); letter-spacing: -.02em; }
.auth-card p { margin: 0 0 18px; color: var(--muted); }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-err { color: var(--red); font-size: 13.5px; min-height: 0; }
.auth-err:empty { display: none; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; margin-top: 4px; flex-wrap: wrap; }

/* ---------- liczniki ---------- */
.counters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.counter { padding: 14px 16px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--hairline); text-align: left; color: var(--fg); }
button.counter:hover { background: var(--card-hover); }
.counter .c-label { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.counter .c-val { font: 700 28px/1.1 var(--font-heading); margin-top: 4px; letter-spacing: -.02em; }
.counter.hot .c-val { color: var(--red); }
.counter.gold .c-val { color: var(--gold); }

/* ---------- karta leada ---------- */
.lead-list { display: flex; flex-direction: column; gap: 10px; }
.lead-card {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--hairline); cursor: pointer; transition: background .15s, border-color .15s;
  border-left: 3px solid var(--sc, var(--hairline)); min-width: 0;
}
.lead-card:hover { background: var(--card-hover); border-color: hsla(250, 85%, 70%, .3); border-left-color: var(--sc, var(--hairline)); }
.lc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.lc-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.lc-name { font: 700 16px/1.2 var(--font-heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lc-age { margin-left: auto; font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.lc-age.late { color: var(--red); }
.lc-chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.lc-budget { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.lc-next { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; }
.lc-next svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.lc-next .t { font-weight: 700; color: var(--fg); white-space: nowrap; }
.lc-next .t.late { color: var(--red); }
.lc-next .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lc-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.lc-actions .btn { min-width: 112px; }
.more-row { display: flex; justify-content: center; margin-top: 14px; }

/* ---------- Leady ---------- */
.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.filters-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters-row .search { flex: 1 1 260px; }
.list-meta { font-size: 12.5px; color: var(--dim); margin: 4px 2px 10px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ---------- strona leada ---------- */
.lead-page { padding-bottom: 96px; }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 8px 0 0; border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 14px; }
.back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.back:hover { color: var(--fg); }
.lead-head h1 { margin: 2px 0 6px; font: 700 26px/1.15 var(--font-heading); letter-spacing: -.02em; overflow-wrap: anywhere; }
.lead-head .meta { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; font-size: 13px; color: var(--muted); }
.lead-head .meta .sep { color: var(--dim); }
.code { font: 600 12px var(--font-heading); letter-spacing: .08em; color: var(--dim); }
.contact-btns { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 16px 0 6px; }
.cbtn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 64px; padding: 8px 4px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--secondary); font-size: 12px; font-weight: 600; color: var(--fg);
}
.cbtn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cbtn:hover { border-color: hsla(250, 85%, 70%, .5); }
.cbtn.call { background: var(--success); color: #04140c; border-color: transparent; }
.cbtn.wa { color: #4ae08a; }
.cbtn.off { opacity: .35; pointer-events: none; }
.contact-line { font-size: 13.5px; color: var(--muted); display: flex; gap: 6px 16px; flex-wrap: wrap; overflow-wrap: anywhere; }
.contact-line b { color: var(--fg); font-weight: 600; }
.lead-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; margin-top: 16px; align-items: start; }
.lead-grid > div { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.lead-grid .card + .card { margin-top: 0; }
.kv { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.kv:last-child { border-bottom: 0; }
.kv .k { width: 108px; flex-shrink: 0; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.kv .v { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kv .v .select { min-height: 40px; padding-top: 7px; padding-bottom: 7px; font-size: 14px; }
.next-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.next-box .t { font: 700 16px var(--font-heading); }
.next-box .t.late { color: var(--red); }
.next-note { font-size: 13px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-top: 12px; }
.banner svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; margin-top: 1px; }
.banner.gold { background: rgba(243,201,105,.1); color: var(--gold); border: 1px solid rgba(243,201,105,.25); }
.banner.red { background: rgba(255,90,90,.08); color: var(--red); border: 1px solid rgba(255,90,90,.22); }
.banner.ok { background: rgba(61,220,151,.08); color: var(--success); border: 1px solid rgba(61,220,151,.22); }
.banner.dim { background: rgba(255,255,255,.04); color: var(--muted); border: 1px solid var(--hairline); }
.banner.dim b { color: var(--fg); }
.banner-act { margin-top: 10px; }
.banner-act .hint { margin-top: 0; }

.steps { display: flex; flex-direction: column; gap: 8px; }
.step {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 12px; width: 100%; text-align: left;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: rgba(6,6,16,.6); color: var(--fg);
}
.step .box { width: 24px; height: 24px; border-radius: 7px; border: 1.5px solid var(--border); display: grid; place-items: center; flex-shrink: 0; }
.step .box svg { width: 16px; height: 16px; fill: none; stroke: #04140c; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.step.done { border-color: rgba(61,220,151,.35); background: rgba(61,220,151,.06); }
.step.done .box { background: var(--success); border-color: var(--success); }
.step.done .box svg { opacity: 1; }
.step .s-label { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; }
.step .s-when { font-size: 12px; color: var(--muted); white-space: nowrap; }
.paybar { height: 8px; border-radius: 6px; background: rgba(255,255,255,.07); overflow: hidden; margin-top: 8px; }
.paybar i { display: block; height: 100%; background: var(--success); border-radius: 6px; }
.paysum { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.paysum b { font: 700 18px var(--font-heading); }

.answers { display: flex; flex-direction: column; }
.answer { padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.answer:last-child { border-bottom: 0; }
.answer .q { font-size: 12.5px; color: var(--muted); }
.answer .a { font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; white-space: pre-wrap; }
details.sub { margin-top: 10px; }
details.sub summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; min-height: 40px; display: flex; align-items: center; }

.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 12px; padding: 10px 0; position: relative; }
.tl-item:not(:last-child)::before { content: ""; position: absolute; left: 15px; top: 44px; bottom: -4px; width: 1px; background: rgba(255,255,255,.08); }
.tl-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: color-mix(in srgb, var(--c, var(--primary)) 16%, transparent); color: var(--c, var(--primary)); }
.tl-ico svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tl-body { flex: 1; min-width: 0; }
.tl-title { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.tl-note { font-size: 13.5px; color: var(--fg); opacity: .85; margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tl-meta { font-size: 12px; color: var(--dim); margin-top: 3px; }
.add-note { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.add-note .textarea { min-height: 64px; }

.purchase { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.05); font-size: 13.5px; }
.purchase:last-child { border-bottom: 0; }

.action-bar {
  position: fixed; left: var(--sidebar); right: 0; bottom: 0; z-index: 25;
  display: flex; gap: 10px; padding: 12px 28px calc(12px + var(--safe-b));
  background: rgba(6, 6, 14, .9); backdrop-filter: blur(14px); border-top: 1px solid var(--hairline);
}
.action-bar .inner { width: 100%; max-width: 1124px; display: flex; gap: 10px; }
.action-bar .btn { flex: 1; }
.action-bar .btn-call { flex: 0 0 auto; min-width: 140px; }

/* arkusz wyniku rozmowy */
.outcomes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.outcome {
  min-height: 52px; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: rgba(6,6,16,.6);
  font-weight: 600; font-size: 14px; text-align: left; color: var(--fg); display: flex; align-items: center; gap: 10px;
}
.outcome i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.outcome:hover { border-color: hsla(250, 85%, 70%, .5); }
.outcome.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); box-shadow: inset 0 0 0 1px var(--c); }
.ctx { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.ctx:empty { display: none; }
.ctx .field + .field { margin-top: 0; }
.stage-opts { display: flex; flex-direction: column; gap: 8px; }

/* ---------- statystyki ---------- */
.stat-head { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.team-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { padding: 14px 16px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--hairline); min-width: 0; }
.kpi .k-label { font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.kpi .k-val { font: 700 24px/1.15 var(--font-heading); margin-top: 6px; letter-spacing: -.02em; overflow-wrap: anywhere; }
.closers { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.closer-card .card-head { margin-bottom: 8px; }
.closer-name { display: flex; align-items: center; gap: 10px; font: 700 17px var(--font-heading); }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.metric { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.05); font-size: 13.5px; min-width: 0; }
.metric > span { color: var(--muted); }
.metric b { font: 700 15px var(--font-heading); white-space: nowrap; text-align: right; }
.closers .card + .card { margin-top: 0; }
.reasons { margin-top: 10px; font-size: 13px; color: var(--muted); }
.reasons .chips { margin-top: 6px; }
.funnel { display: flex; flex-direction: column; gap: 8px; }
.fbar { display: grid; grid-template-columns: 150px minmax(0, 1fr) 48px; gap: 10px; align-items: center; font-size: 13.5px; }
.fbar .track { height: 12px; border-radius: 6px; background: rgba(255,255,255,.05); overflow: hidden; }
.fbar .track i { display: block; height: 100%; border-radius: 6px; background: var(--c); min-width: 2px; }
.fbar b { text-align: right; font-family: var(--font-heading); }
.stats-cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; align-items: start; }
.stats-cols .card + .card { margin-top: 0; }
.big-num { font: 700 40px/1 var(--font-heading); letter-spacing: -.03em; }

/* ---------- ustawienia ---------- */
.set-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.05); min-height: 60px; }
.set-row:last-child { border-bottom: 0; }
.set-row .t { font-weight: 600; }
.set-row .d { font-size: 12.5px; color: var(--muted); }
.user-row .avatar { flex-shrink: 0; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.settings-grid .card + .card { margin-top: 0; }
.help ol { margin: 8px 0 0; padding-left: 20px; color: var(--muted); font-size: 13.5px; }
.help li { margin: 4px 0; }
.colors { display: flex; gap: 8px; flex-wrap: wrap; }
.color-dot { width: 36px; height: 36px; border-radius: 50%; border: 2px solid transparent; background: var(--c); }
.color-dot.on { border-color: #fff; box-shadow: 0 0 0 2px var(--c); }

/* =========================================================
   TELEFON (≤ 860 px): dolny pasek zakładek, arkusze od dołu
   ========================================================= */
@media (max-width: 1080px) {
  .team-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lead-grid, .stats-cols, .settings-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { padding: 8px var(--gutter); padding-top: max(8px, env(safe-area-inset-top, 0px)); min-height: 56px; }
  .topbar .brand { display: flex; }
  .topbar .brand-logo { width: 34px; height: 34px; border-radius: 10px; font-size: 10px; }
  .topbar-title { display: none; }
  .user-btn .uname { display: none; }
  .user-btn { padding: 0 6px; }
  .main { padding: 16px var(--gutter) calc(var(--tabbar) + var(--safe-b) + 28px); }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tabbar) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: rgba(8, 8, 18, .94); backdrop-filter: blur(16px); border-top: 1px solid var(--hairline);
  }
  .tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 44px; color: var(--dim); font-size: 11px; font-weight: 600; }
  .tabbar a.active { color: #fff; }
  .tabbar a.active svg { stroke: hsl(255 90% 78%); filter: drop-shadow(0 0 8px hsla(250, 85%, 62%, .8)); }
  .tabbar .nav-badge { position: absolute; top: 6px; left: calc(50% + 6px); margin: 0; height: 18px; min-width: 18px; font-size: 10.5px; }
  .page-head h1 { font-size: 24px; }
  .counters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lead-card { flex-direction: column; align-items: stretch; }
  .lc-actions { flex-direction: row; }
  .lc-actions .btn { flex: 1; min-width: 0; }
  .action-bar { left: 0; bottom: calc(var(--tabbar) + var(--safe-b)); padding: 10px var(--gutter); }
  .action-bar .btn-call { min-width: 0; flex: 0 0 auto; padding: 0 14px; }
  .action-bar .btn-primary { min-width: 0; white-space: normal; line-height: 1.15; letter-spacing: .02em; font-size: 13.5px; padding: 0 10px; }
  .lead-page { padding-bottom: 84px; }
  .toasts { left: var(--gutter); right: var(--gutter); bottom: auto; top: calc(env(safe-area-inset-top, 0px) + 64px); }
  .toast { min-width: 0; max-width: none; }
  .pm-bg { place-items: end stretch; padding: 0; }
  .pm {
    width: 100%; max-width: none; max-height: 92vh; border-radius: 20px 20px 0 0; border-bottom: 0;
    padding: 8px var(--gutter) calc(16px + var(--safe-b)); animation: sheet .26s cubic-bezier(.2,.8,.2,1) both;
  }
  .pm-grab { display: block; width: 40px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.18); margin: 4px auto 12px; }
  .team-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fbar { grid-template-columns: 112px minmax(0, 1fr) 40px; font-size: 13px; }
  .closers { grid-template-columns: minmax(0, 1fr); }
  .filters-row .search { flex-basis: 100%; }
}
@keyframes sheet { from { transform: translateY(100%); } to { transform: none; } }
@media (max-width: 520px) {
  .contact-btns { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .cbtn { min-height: 58px; font-size: 11px; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .outcomes { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .outcome { font-size: 13px; padding: 8px 10px; }
  .metrics { grid-template-columns: minmax(0, 1fr); }
  .kv .k { width: 88px; }
  .counter .c-val { font-size: 24px; }
  .sec-head .sec-sub { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
