/* Polkrys CRM v2 – nowoczesny wygląd, kolory Polkrys, półprzezroczyste elementy, origami w tle */
:root {
  --navy: #002776; --blue: #579ADE; --blue2: #3F7AB6; --soft: #DDEBF8; --soft2: #EEF5FC;
  --bg: #F2F5FA; --surface: #ffffff; --surface-2: #F7F8FA; --line: #E1E5EC; --line2: #CDD4DB;
  --text: #1F2537; --muted: #6B7287; --orange: #E6643E; --red: #E94F37; --green: #2E9E6E; --yellow: #E2B700; --purple: #8E4EC6;
  --glass: rgba(255, 255, 255, .70); --glass-strong: rgba(255, 255, 255, .88); --glass-line: rgba(255, 255, 255, .75);
  --shadow: 0 6px 24px rgba(0, 39, 118, .07); --r: 8px;
  --c-red: #E94F37; --c-orange: #F28C28; --c-yellow: #E2B700; --c-green: #2E9E6E; --c-blue: #3b82f6; --c-purple: #8E4EC6;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0A1430; --surface: #0F1E46; --surface-2: #142753; --line: #22397A; --line2: #2C4690; --text: #E8EEF8; --muted: #9AA8C8;
    --soft: #1A3770; --soft2: #16305F; --navy: #8FB8F2; --glass: rgba(15, 30, 70, .70); --glass-strong: rgba(15, 30, 70, .9); --glass-line: rgba(120, 160, 230, .18);
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 13.5px/1.45 "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; color: var(--text); background: var(--bg); -webkit-text-size-adjust: 100%; }
/* tło: gradient + origami Polkrys (40% przezroczystości) */
body::before { content: ""; position: fixed; inset: 0; z-index: -2;
  background: radial-gradient(900px 520px at 88% 8%, rgba(87,154,222,.40), transparent 62%), radial-gradient(700px 480px at 30% 105%, rgba(0,39,118,.26), transparent 65%),
    radial-gradient(520px 380px at 62% 48%, rgba(76,185,234,.20), transparent 70%), linear-gradient(135deg, #E3ECF8 0%, #F2F5FA 45%, #E4EDF9 100%); }
body::after { content: ""; position: fixed; inset: 0; z-index: -1; opacity: .40; pointer-events: none;
  background: url(/brand/golabek-blekitny.svg) left 250px bottom 30px / 230px auto no-repeat, url(/brand/key-visual-03.svg) left 470px bottom 18px / 900px auto no-repeat,
    url(/brand/golabek-blekitny.svg) right 60px top 80px / 110px auto no-repeat, url(/brand/key-visual-04.svg) right -60px top 140px / 780px auto no-repeat; }
@media (prefers-color-scheme: dark) { body::before { background: radial-gradient(900px 520px at 88% 8%, rgba(87,154,222,.25), transparent 62%), linear-gradient(135deg, #081230, #0B1838); } body::after { opacity: .22; } }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--blue2); }
[hidden] { display: none !important; }
.glass { background: var(--glass); backdrop-filter: blur(16px) saturate(150%); -webkit-backdrop-filter: blur(16px) saturate(150%); border: 1px solid var(--glass-line); }
.glass-strong { background: var(--glass-strong); backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%); }
.m { color: var(--muted); } .small { font-size: 12px; } .center { text-align: center; } .pad { padding: 12px 14px; } .grow { flex: 1; min-width: 0; } .spacer { flex: 1; }
.mt { margin-top: 14px !important; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; max-width: 100%; vertical-align: bottom; }
.splash { display: grid; place-items: center; height: 100vh; }

/* ---------- przyciski i pola ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; justify-content: center; height: 32px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 7px;
  background: var(--glass); color: var(--text); cursor: pointer; white-space: nowrap; text-decoration: none; font-weight: 500; font-size: 13px; }
.btn:hover { border-color: var(--blue); }
.btn.pri { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.pri:hover { background: #0a3a96; }
@media (prefers-color-scheme: dark) { .btn.pri { background: #2f5fc4; border-color: #2f5fc4; } }
.btn.sm { height: 27px; padding: 0 9px; font-size: 12px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--blue2); }
.btn.danger { color: var(--red); }
.btn.danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.block { width: 100%; height: 40px; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.upload { position: relative; overflow: hidden; } .btn.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.icon-btn { border: 0; background: transparent; cursor: pointer; padding: 3px 6px; border-radius: 6px; color: var(--muted); line-height: 1; font-size: 14px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); } .icon-btn.del:hover { color: var(--red); } .icon-btn.has { color: var(--blue2); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.link { border: 0; background: none; color: var(--blue2); cursor: pointer; padding: 0; text-align: left; font: inherit; display: inline-flex; gap: 6px; align-items: center; min-width: 0; }
input[type=text], input:not([type]), input[type=email], input[type=tel], input[type=password], input[type=search], input[type=number], input[type=date], input[type=time], input[type=datetime-local], input[type=month], select, textarea {
  width: 100%; border: 1px solid var(--line2); background: var(--glass-strong); border-radius: 7px; padding: 7px 10px; outline: none; min-width: 0; }
input:focus, textarea:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(87,154,222,.2); }
input:disabled, select:disabled, textarea[readonly] { opacity: .8; background: transparent; }
textarea { resize: vertical; }
label.field { display: block; margin-bottom: 10px; } label.field > span, .field > .lbl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; font-weight: 500; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
.grid4 { display: grid; grid-template-columns: 1.2fr 1fr 1fr .8fr auto; gap: 8px; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; } .btn-row.end { justify-content: flex-end; margin-top: 14px; }
.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; white-space: nowrap; }
.chk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 12px; margin: 4px 0 8px; } .chk-grid label { display: flex; gap: 6px; align-items: center; }
.hint { background: var(--soft2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; color: var(--muted); }
.error { color: var(--red); font-size: 13px; min-height: 18px; }

/* ---------- znaczniki ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 10px; font-size: 11px; font-weight: 600; white-space: nowrap; border: 0; cursor: default; }
button.pill { cursor: pointer; }
.pill.blue { background: var(--soft); color: var(--navy); } .pill.navy { background: var(--navy); color: #fff; } .pill.grey { background: rgba(140,150,170,.16); color: var(--muted); }
.pill.red { background: #FDE3E0; color: #B8321F; } .pill.orange { background: #FDE7DC; color: #B44A22; } .pill.green { background: #DDF2E7; color: #1d7a4f; }
.pill.yellow { background: #FFF4C9; color: #8a6d00; } .pill.purple { background: #EEE3F8; color: #6E36A5; }
.flag { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: none; vertical-align: middle; } .flag.big { width: 16px; height: 16px; }
.av { width: 30px; height: 30px; border-radius: 50%; color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: 11px; flex: none; position: relative; vertical-align: middle; background: var(--navy); }
.av.s { width: 22px; height: 22px; font-size: 9px; } .av.grp { background: var(--purple); }
.av.on::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px; border-radius: 50%; background: var(--green); border: 2px solid var(--surface); }
.bok-t { color: #B44A22; }
.dot { flex: none; width: 13px; height: 13px; border-radius: 50%; border: 2px dashed var(--line2); background: transparent; padding: 0; cursor: pointer; display: inline-block; vertical-align: middle; }
.dot:disabled { cursor: default; } .dot:disabled:not([class*="c-"]) { visibility: hidden; }
.dot.c-red, li.col-red { --c: var(--c-red); } .dot.c-orange, li.col-orange { --c: var(--c-orange); } .dot.c-yellow, li.col-yellow { --c: var(--c-yellow); }
.dot.c-green, li.col-green { --c: var(--c-green); } .dot.c-blue, li.col-blue { --c: var(--c-blue); } .dot.c-purple, li.col-purple { --c: var(--c-purple); }
.dot[class*="c-"] { background: var(--c); border: 2px solid var(--c); }
.prog { width: 54px; height: 5px; border-radius: 3px; background: rgba(140,150,170,.2); display: inline-block; vertical-align: middle; overflow: hidden; } .prog i { display: block; height: 100%; background: var(--green); }

/* ---------- logowanie ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 380px; border-radius: 14px; padding: 26px; box-shadow: var(--shadow); border-top: 4px solid var(--blue) !important; }
.auth-logo { display: block; height: 58px; margin: 0 auto 14px; } .auth-card h1 { font-size: 20px; margin: 0 0 2px; color: var(--navy); }

/* ---------- szkielet ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; border-width: 0 1px 0 0 !important; z-index: 30; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px 14px; border-bottom: 1px solid var(--glass-line); }
.brand img { height: 32px; } .brand .tag { font-size: 10px; font-weight: 700; color: var(--blue); letter-spacing: .14em; border-left: 1px solid var(--line2); padding-left: 9px; }
@media (prefers-color-scheme: dark) { .brand img, .auth-logo { filter: brightness(0) invert(1); } }
.navg { padding: 12px 18px 4px; font-size: 10.5px; font-weight: 700; color: #9aa1b3; letter-spacing: .1em; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: 9px; padding: 7px 10px; margin: 1px 8px; border-radius: 6px; color: var(--text); text-decoration: none; font-weight: 500; position: relative; opacity: .88; }
.nav a:hover { background: rgba(87,154,222,.12); opacity: 1; }
.nav a .ic { width: 18px; text-align: center; color: var(--muted); } .nav a .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a .cnt { font-size: 11px; color: var(--muted); background: rgba(140,150,170,.15); border-radius: 9px; padding: 0 7px; } .nav a .cnt.red { background: #FDE3E0; color: #B8321F; }
.nav a.act { background: rgba(221,235,248,.85); color: var(--navy); font-weight: 600; opacity: 1; }
@media (prefers-color-scheme: dark) { .nav a.act { background: rgba(60,100,180,.35); } }
.nav a.act::before { content: ""; position: absolute; left: -8px; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: var(--navy); }
.nav a .grip { position: absolute; left: -3px; color: #b9bfcc; font-size: 10px; opacity: 0; cursor: grab; } .nav a:hover .grip { opacity: 1; }
.nav a.dragging { opacity: .4; }
.nav-add { margin: 4px 18px; border: 0; background: none; color: var(--blue2); font-weight: 600; cursor: pointer; text-align: left; padding: 4px 0; }
.side-bottom { margin-top: auto; border-top: 1px solid var(--glass-line); padding: 8px; position: relative; }
.me { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: none; padding: 6px; border-radius: 8px; cursor: pointer; text-align: left; }
.me:hover { background: rgba(87,154,222,.12); } .me b { display: block; font-size: 12.5px; } .me small { color: var(--muted); font-size: 11px; } .me span:nth-child(2) { flex: 1; } .me .dots { color: var(--muted); }
.menu { position: absolute; left: 8px; right: 8px; bottom: calc(100% - 4px); background: var(--glass-strong); backdrop-filter: blur(20px); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,20,60,.18); padding: 6px; display: none; z-index: 40; }
.menu.open { display: block; } .menu button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.menu button:hover { background: rgba(87,154,222,.12); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 20px; border-width: 0 0 1px 0 !important; }
.top h1 { margin: 0; font-size: 17px; font-weight: 600; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top h1.editable { cursor: text; } .top h1.editable:hover::after { content: " ✎"; color: #a0a7b8; font-size: 12px; font-weight: 400; }
.burger { display: none; font-size: 20px; }
.search { margin-left: auto; width: 340px; display: flex; align-items: center; gap: 6px; border: 1px solid var(--line2); border-radius: 7px; padding: 0 10px; background: var(--glass-strong); }
.search span { color: #9aa1b3; } .search input { border: 0 !important; background: transparent !important; box-shadow: none !important; padding: 7px 0; }
.ibtn { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 7px; display: grid; place-items: center; background: var(--glass); cursor: pointer; position: relative; flex: none; }
.ibtn .bd { position: absolute; top: -6px; right: -6px; background: var(--orange); color: #fff; font-size: 10px; font-weight: 700; border-radius: 9px; padding: 0 5px; border: 2px solid var(--surface); line-height: 14px; }
.ibtn .bd.blue { background: var(--blue); } .ibtn .bd.green { top: auto; bottom: -6px; background: var(--green); }
.view { padding: 16px 20px 40px; min-width: 0; }
.side-scrim { display: none; }

/* ---------- pasek narzędzi / filtry ---------- */
.toolbar { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 12px; position: relative; z-index: 6; }
.chip-sel { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 4px 0 10px; border: 1px solid var(--line2); border-radius: 7px; background: var(--glass); font-size: 12px; color: var(--muted); cursor: pointer; }
.chip-sel select, .chip-sel input { border: 0 !important; background: transparent !important; box-shadow: none !important; padding: 0 4px; height: 28px; font-size: 12.5px; color: var(--text); width: auto; max-width: 150px; }
.chip-sel input { width: 110px; }
.chip-sel.on { border-color: var(--blue); background: rgba(221,235,248,.85); color: var(--navy); font-weight: 600; }
.chip-sel.warn { color: #B8321F; font-weight: 600; padding-right: 10px; } .chip-sel.warn.on { background: #FFF0EC; border-color: var(--red); }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 7px; overflow: hidden; background: var(--glass); }
.seg button, .seg label { border: 0; background: transparent; padding: 6px 11px; font-size: 12.5px; cursor: pointer; color: var(--muted); border-right: 1px solid var(--line2); white-space: nowrap; }
.seg > *:last-child { border-right: 0; } .seg .on, .seg label:has(input:checked) { background: var(--navy); color: #fff; }
.seg input { position: absolute; opacity: 0; pointer-events: none; } .seg.full { display: flex; margin-bottom: 12px; } .seg.full > * { flex: 1; text-align: center; } .seg.wrap { flex-wrap: wrap; }
.dd-wrap { position: relative; }
.dd { position: absolute; left: 0; top: 36px; width: 320px; border-radius: 9px; box-shadow: 0 12px 30px rgba(0,20,60,.18); padding: 6px; display: none; z-index: 30; background: var(--glass-strong) !important; }
.dd.open { display: block; } .dd-h { font-size: 10.5px; font-weight: 700; color: #9aa1b3; letter-spacing: .08em; padding: 4px 8px; text-transform: uppercase; }
.dd-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; } .dd-row:hover { background: rgba(87,154,222,.1); }
.dd-row span { flex: 1; } .dd-row b { color: #C43B25; font-size: 12px; } .mini-num { width: 52px !important; padding: 2px 5px !important; display: inline-block; }
.dd-f { display: flex; justify-content: space-between; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }

/* ---------- karty / tabele ---------- */
.card { border-radius: var(--r); box-shadow: var(--shadow); }
.ch { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--glass-line); } .ch h3 { margin: 0; font-size: 13.5px; color: var(--navy); flex: 1; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.loading { padding: 14px; color: var(--muted); }
.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.t th { position: sticky; top: 0; background: rgba(247,248,250,.75); color: var(--muted); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none; }
@media (prefers-color-scheme: dark) { .t th { background: rgba(20,39,83,.8); } }
.t th.th-red { color: #B8321F; } .t th.th-bok { color: #B44A22; }
.t td { padding: 6px 10px; border-bottom: 1px solid rgba(205,212,219,.5); vertical-align: middle; white-space: nowrap; }
.t td .m.ellip { max-width: 230px; }
.t tr.r { cursor: pointer; } .t tr.r:hover td { background: rgba(255,255,255,.5); } .t tr.r.open td { background: rgba(238,245,252,.75); }
@media (prefers-color-scheme: dark) { .t tr.r:hover td { background: rgba(255,255,255,.04); } .t tr.r.open td { background: rgba(60,100,180,.15); } }
.t td.nm b { color: var(--navy); font-weight: 600; } .t td.nm small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; }
.w-ch { width: 22px; padding-right: 0 !important; } .chev { color: #9aa1b3; }
.t tr.exp > td { padding: 0; background: rgba(251,252,254,.65); white-space: normal; border-bottom: 1px solid var(--line); }
@media (prefers-color-scheme: dark) { .t tr.exp > td { background: rgba(10,20,50,.4); } }
.list-foot { color: var(--muted); font-size: 12px; margin-top: 8px; }
.flash { animation: flash 1.8s ease; } @keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--blue) inset; } 100% { box-shadow: none; } }

/* ---------- szczegóły klienta ---------- */
.detail { display: grid; grid-template-columns: 1.1fr 1.1fr 1.1fr 1fr; gap: 16px; padding: 12px 14px 14px 32px; }
.blk { min-width: 0; } .blk h4 { margin: 0 0 7px; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 6px; }
.owners { display: grid; gap: 4px; margin-bottom: 8px; }
.kv-row { display: grid; grid-template-columns: 110px 1fr; gap: 6px; align-items: center; font-size: 12px; } .kv-row > span { color: var(--muted); }
.kv-row input, .kv-row select { padding: 4px 7px; font-size: 12.5px; }
.collapse { border: 1px solid var(--line); border-radius: 7px; background: var(--glass); }
.collapse summary { cursor: pointer; padding: 7px 10px; font-weight: 600; color: var(--navy); font-size: 12.5px; list-style: none; display: flex; gap: 8px; align-items: baseline; }
.collapse summary::-webkit-details-marker { display: none; } .collapse summary::before { content: "▸"; color: var(--muted); } .collapse[open] summary::before { content: "▾"; }
.collapse summary .m { font-weight: 400; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv { display: grid; gap: 4px; padding: 4px 10px 8px; border-top: 1px solid var(--line); }
.tel { display: flex; gap: 4px; } .tel select { width: 92px; flex: none; }
.contacts { padding: 6px 10px 10px; border-top: 1px solid var(--line); } .sub-h { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.contact-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1.2fr auto auto; gap: 4px; margin-bottom: 4px; align-items: center; } .contact-row input { padding: 4px 6px; font-size: 12px; }
.note-add { display: flex; gap: 6px; align-items: flex-end; margin-bottom: 6px; } .note-add textarea { min-height: 38px; font-size: 12.5px; }
.notes { max-height: 340px; overflow-y: auto; }
.note { border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; margin-bottom: 6px; background: var(--glass-strong); font-size: 12.5px; }
.note.bok { border-left: 3px solid var(--orange); } .note .by { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); margin-bottom: 2px; } .note .by b { color: var(--text); }
.note .nb { white-space: pre-wrap; word-break: break-word; }
ul.tasks, ul.evs { list-style: none; margin: 0 0 6px; padding: 0; }
ul.tasks li { display: flex; align-items: center; gap: 6px; padding: 3px 0 3px 4px; flex-wrap: wrap; border-radius: 4px; }
ul.tasks li[class*="col-"] { border-left: 3px solid var(--c); padding-left: 5px; }
ul.tasks li.col-red { background: rgba(233,79,55,.06); } ul.tasks li.col-red:not(.done) .tx { font-weight: 600; }
ul.tasks li input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--green); flex: none; margin: 0; }
ul.tasks .tx { flex: 1; min-width: 80px; outline: none; border-radius: 4px; padding: 1px 3px; word-break: break-word; } ul.tasks .tx:focus { background: var(--surface); box-shadow: 0 0 0 1px var(--line2); }
ul.tasks li.done .tx { text-decoration: line-through; color: var(--muted); }
.tmeta { display: inline-flex; gap: 3px; align-items: center; flex-wrap: wrap; }
.item-note { width: calc(100% - 24px); margin-left: 24px; min-height: 40px; font-size: 12.5px; }
ul.evs li { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 12.5px; min-width: 0; } ul.evs li.done .grow { text-decoration: line-through; color: var(--muted); }
ul.evs li > a.ellip { flex: 1; }
.inline-add { display: flex; gap: 4px; flex-wrap: wrap; } .inline-add input[name=text] { flex: 1 1 140px; } .inline-add input, .inline-add select { padding: 5px 7px; font-size: 12.5px; width: auto; }
.inline-add input[type=datetime-local] { flex: 0 1 170px; } .inline-add select { flex: 0 1 140px; }
.inline-add.big input[name=text] { font-size: 17px; padding: 11px 13px; border-radius: 10px; } .inline-add.big .btn { width: 52px; height: auto; font-size: 22px; border-radius: 10px; }

/* ---------- karty klientów (telefon) ---------- */
.cards { display: grid; gap: 8px; }
.ccard { border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.cc-h { display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; }
.cc-main { flex: 1; min-width: 0; } .cc-main b { color: var(--navy); font-size: 15px; display: block; } .cc-main small { color: var(--muted); display: block; }
.cc-meta { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; align-items: center; }
.cc-av { display: flex; gap: 2px; }
.ccard .detail-host { border-top: 1px solid var(--line); }

/* ---------- Pulpit ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.kpi { border-radius: var(--r); padding: 10px 14px; box-shadow: var(--shadow); } .kpi span { display: block; font-size: 11.5px; color: var(--muted); } .kpi b { font-size: 24px; color: var(--navy); }
.kpi.bad b { color: #C43B25; }
.dash { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; align-items: start; }
.dcol.red { border-color: #F4C4B8 !important; } .dcol.red .ch { background: rgba(255,240,236,.7); } .dcol.red h3 { color: #B8321F; }
.dcol-b { max-height: 520px; overflow-y: auto; }
.ev { display: flex; gap: 10px; padding: 8px 14px; border-bottom: 1px solid rgba(205,212,219,.45); cursor: pointer; } .ev:last-child { border: 0; } .ev:hover { background: rgba(255,255,255,.4); }
.ev .when { flex: none; width: 70px; font-size: 11.5px; font-weight: 600; color: var(--navy); } .ev .when small { display: block; color: var(--muted); font-weight: 400; }
.ev.over .when { color: #C43B25; } .ev-b { min-width: 0; flex: 1; } .ev-b b { display: block; font-weight: 600; font-size: 12.5px; } .ev-b > span { font-size: 11.5px; color: var(--muted); }

/* ---------- Kalendarz ---------- */
.cal-title { margin: 0 6px; font-size: 16px; text-transform: capitalize; color: var(--navy); }
.cal-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 12px; align-items: start; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { padding: 7px; font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; border-bottom: 1px solid var(--line); }
.cal-day { min-height: 98px; border-right: 1px solid rgba(205,212,219,.5); border-bottom: 1px solid rgba(205,212,219,.5); padding: 4px; cursor: pointer; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; } .cal-day:hover { background: rgba(255,255,255,.45); } .cal-day.other { background: rgba(140,150,170,.07); color: var(--muted); }
.cal-day .num { font-size: 12px; font-weight: 600; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; }
.cal-day.today .num { background: var(--navy); color: #fff; }
.chip { display: block; font-size: 11px; border-radius: 4px; padding: 1px 5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--soft); color: var(--navy); }
.chip i { font-style: normal; } .chip.meet { background: var(--navy); color: #fff; } .chip.task { background: transparent; border: 1px solid var(--blue); } .chip.goal { background: #EEE3F8; color: #6E36A5; }
.chip.past { opacity: .55; } .chip.more { background: transparent; color: var(--muted); }
.cal-legend { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border-top: 1px solid var(--line); align-items: center; } .cal-legend .chip { display: inline-block; margin: 0; }
.agenda .ev .when { width: 74px; }

/* ---------- Zadania ---------- */
.wins { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; align-items: start; }
.win { border-radius: var(--r); box-shadow: var(--shadow); padding: 0 12px 12px; min-width: 0; }
.win.add { display: grid; place-items: center; min-height: 110px; border-style: dashed !important; color: var(--blue2); font-weight: 600; cursor: pointer; padding: 12px; }
.win-h { display: flex; align-items: center; gap: 6px; padding: 9px 0 8px; border-bottom: 1px solid var(--glass-line); margin-bottom: 6px; }
.win-title { border: 1px solid transparent !important; background: transparent !important; font-weight: 600; color: var(--navy); font-size: 14px; padding: 3px 5px !important; box-shadow: none !important; }
.win-title:hover, .win-title:focus { border-color: var(--line2) !important; background: var(--glass-strong) !important; }
.nb-area { min-height: 180px; background: var(--glass-strong); font-size: 13px; line-height: 1.55; } .nb-area.big { min-height: 60vh; font-size: 16px; }
.sec-h { display: flex; align-items: center; gap: 10px; margin: 22px 0 8px; flex-wrap: wrap; } .sec-h h3 { margin: 0; color: var(--navy); font-size: 15px; }
.meet-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; }
.mcard { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--r); cursor: pointer; box-shadow: var(--shadow); }
.mc-h { flex: 1; min-width: 0; } .mc-h b { display: block; color: var(--navy); } .mc-h .m { font-size: 12px; }

/* ---------- Pełny ekran / panel ---------- */
body.fs-open { overflow: hidden; }
.fs { position: fixed; inset: 0; z-index: 45; display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.fs.as-panel { left: auto; width: min(700px, 100%); box-shadow: -10px 0 40px rgba(0,0,0,.2); }
.fs-backdrop { position: fixed; inset: 0; background: rgba(10,15,35,.3); z-index: 44; }
.fs-head { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); border-bottom: 1px solid var(--line); border-top: 4px solid var(--blue); }
.fs-close { font-size: 22px; } .fs-title { flex: 1; min-width: 0; } .fs-title b { font-size: 19px; color: var(--navy); }
.fs-title-input { font-size: 19px !important; font-weight: 700; color: var(--navy); border-color: transparent !important; background: transparent !important; padding: 3px 6px !important; box-shadow: none !important; }
.fs-title-input:focus { border-color: var(--line2) !important; background: var(--surface) !important; }
.fs-details summary { cursor: pointer; font-size: 13px; color: var(--muted); padding: 3px 6px; list-style: none; } .fs-details summary::-webkit-details-marker { display: none; } .fs-details summary::after { content: " ▾"; }
.fs.as-panel .fs-details summary { display: none; }
.fs-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; } .fs-meta input, .fs-meta select { width: auto; padding: 5px 8px; font-size: 13px; }
.fs-body { flex: 1; overflow-y: auto; padding: 14px 16px 20px; width: 100%; max-width: 900px; margin: 0 auto; }
.tasks.big li { padding: 6px 0 6px 4px; font-size: 17px; } .tasks.big input[type=checkbox] { width: 22px; height: 22px; } .tasks.big .dot { width: 17px; height: 17px; }
.fs.as-panel .tasks.big li { font-size: 14px; } .fs.as-panel .tasks.big input[type=checkbox] { width: 16px; height: 16px; }
.fs-notes { margin-top: 16px; } .fs-notes summary { cursor: pointer; font-weight: 600; color: var(--navy); padding: 6px 0; } .fs-notes textarea { min-height: 160px; font-size: 15px; }
.fs-foot { border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); } .fs-foot .inline-add { max-width: 900px; margin: 0 auto; }

/* ---------- Reklamacje / Pliki ---------- */
.drop { display: block; border: 1.5px dashed var(--line2); border-radius: 8px; padding: 12px; text-align: center; color: var(--muted); cursor: pointer; position: relative; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; } .drop.big { padding: 22px; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.file { border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.file .th { height: 96px; display: grid; place-items: center; font-size: 24px; font-weight: 800; color: #fff; background: #8a94ab; text-decoration: none; overflow: hidden; }
.file .th img { width: 100%; height: 100%; object-fit: cover; } .file .th.k-pdf { background: #C43B25; } .file .th.k-xls { background: #2E9E6E; } .file .th.k-doc { background: #3F7AB6; }
.file .fb { padding: 8px 10px 10px; } .file .fb b { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .file .fb small { display: block; color: var(--muted); font-size: 11px; }
.vis { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; margin-top: 5px; font-size: 11px; color: var(--muted); }
.pick { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }

/* ---------- Czat ---------- */
.chat { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - 56px - 56px); min-height: 420px; border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.chat-list { border-right: 1px solid var(--glass-line); display: flex; flex-direction: column; min-height: 0; }
.chat-lh { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--glass-line); } .chat-lh b { font-size: 15px; color: var(--navy); }
.chat-scroll { overflow-y: auto; flex: 1; }
.contact { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 12px; border: 0; background: transparent; text-align: left; cursor: pointer; border-bottom: 1px solid rgba(205,212,219,.35); }
.contact:hover { background: rgba(255,255,255,.4); } .contact.active { background: rgba(221,235,248,.85); }
.c-main { flex: 1; min-width: 0; display: flex; flex-direction: column; } .c-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--orange); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.st { font-size: 11.5px; color: var(--muted); display: block; } .st.on { color: var(--green); font-weight: 600; }
.chat-conv { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-ch { display: flex; align-items: center; gap: 9px; padding: 9px 14px; border-bottom: 1px solid var(--glass-line); } .who { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.day-sep { align-self: center; font-size: 11.5px; color: var(--muted); background: var(--glass-strong); border: 1px solid var(--line); border-radius: 99px; padding: 1px 10px; margin: 6px 0; }
.msg { max-width: 72%; align-self: flex-start; display: flex; flex-direction: column; } .msg.me { align-self: flex-end; align-items: flex-end; }
.msg .mw { font-size: 11px; color: var(--muted); margin: 0 0 2px 2px; display: flex; gap: 5px; align-items: center; }
.bub { background: var(--glass-strong); border: 1px solid var(--line); padding: 7px 11px; border-radius: 12px 12px 12px 3px; white-space: pre-wrap; word-break: break-word; }
.msg.me .bub { background: var(--navy); border-color: var(--navy); color: #fff; border-radius: 12px 12px 3px 12px; }
.msg .meta { font-size: 10.5px; color: var(--muted); margin: 2px 4px 0; }
.chat-input { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--glass-line); }
.chat-input textarea { min-height: 40px; max-height: 140px; resize: none; border-radius: 20px; padding: 9px 14px; } .chat-input .btn { border-radius: 50%; width: 40px; height: 40px; padding: 0; flex: none; }
.chat-empty { flex: 1; display: grid; place-items: center; } .chat .back { display: none; font-size: 22px; }

/* ---------- Administracja ---------- */
.card.pad { padding: 14px 16px; } .card h3 { margin: 4px 0 6px; font-size: 14px; color: var(--navy); }
.adm-list { display: grid; gap: 4px; }
.adm-row { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 7px; background: var(--glass-strong); flex-wrap: wrap; }
.adm-row > input { flex: 1 1 160px; padding: 5px 8px; } .adm-row .ico { flex: 0 0 52px; text-align: center; } .adm-row select { width: auto; padding: 5px 8px; }
.adm-row .ord { display: inline-flex; flex-direction: column; } .adm-row .ord .icon-btn { padding: 0 4px; font-size: 10px; }
.adm-row .flt { display: flex; gap: 4px; flex-wrap: wrap; flex: 1 1 100%; padding-left: 30px; } .adm-row .flt select, .adm-row .flt input { width: auto; max-width: 180px; font-size: 12px; padding: 4px 6px; }
.matrix td, .matrix th { text-align: left; } .matrix select { padding: 3px 6px; font-size: 12px; } .matrix tr.grp td { background: rgba(221,235,248,.6); font-weight: 700; color: var(--navy); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.log-list { max-height: 420px; overflow-y: auto; } .log-row { display: flex; gap: 8px; padding: 6px 12px; font-size: 12.5px; border-bottom: 1px solid var(--line); } .log-row.bad { background: rgba(233,79,55,.07); }
.color-field { display: flex !important; align-items: center; gap: 8px; } .color-field .dot { margin: 0; cursor: default; }
.qr { text-align: center; margin: 10px 0; } .qr img { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 6px; }
.secret { font-size: 14px; background: var(--surface-2); padding: 3px 8px; border-radius: 6px; display: inline-block; user-select: all; }

/* ---------- okna dialogowe / toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(10,15,35,.32); display: grid; place-items: center; z-index: 60; padding: 14px; }
.modal { background: var(--glass-strong); backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%); border: 1px solid var(--glass-line);
  border-radius: 14px; width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; padding: 18px 20px; box-shadow: 0 20px 60px rgba(0,20,60,.3); }
.modal.wide { max-width: 640px; } .modal.xwide { max-width: 900px; }
.modal-h { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; } .modal-h h2 { margin: 0; font-size: 17px; color: var(--navy); flex: 1; }
.modal h3 { font-size: 14px; margin: 14px 0 6px; color: var(--navy); } .modal .muted, .muted { color: var(--muted); }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; position: sticky; bottom: -18px; }
#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--navy); color: #fff;
  padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .2s; z-index: 70; max-width: 90vw; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); } #toast.err { background: var(--red); }

/* ================= Responsywność ================= */
@media (max-width: 1280px) { .detail { grid-template-columns: 1fr 1fr; } }
@media (max-width: 1100px) { .cal-wrap { grid-template-columns: 1fr; } .search { width: 240px; } }
@media (max-width: 900px) {
  body::after { background: url(/brand/golabek-blekitny.svg) left 10px bottom 20px / 150px auto no-repeat, url(/brand/key-visual-03.svg) left 140px bottom 10px / 600px auto no-repeat; }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-105%); transition: transform .2s; box-shadow: 10px 0 40px rgba(0,0,0,.2); background: var(--glass-strong); }
  .shell.side-open .side { transform: none; }
  .shell.side-open .side-scrim { display: block; position: fixed; inset: 0; background: rgba(10,15,35,.3); z-index: 25; }
  .burger { display: inline-block; }
  .top { padding: 0 10px; padding-top: env(safe-area-inset-top); height: calc(54px + env(safe-area-inset-top)); gap: 6px; }
  .top h1 { font-size: 16px; flex: 1; }
  .search { position: absolute; left: 10px; right: 10px; top: calc(54px + env(safe-area-inset-top)); width: auto; display: none; }
  body[data-view="clients"] .search, body[data-view="leads"] .search, body[data-view="clientlist"] .search { display: flex; position: static; flex: 0 1 46%; margin-left: 0; }
  .view { padding: 10px 10px calc(40px + env(safe-area-inset-bottom)); }
  .toolbar { gap: 5px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .toolbar::-webkit-scrollbar { display: none; }
  .toolbar > * { flex: none; }
  .dd { position: fixed; left: 10px; right: 10px; top: auto; bottom: 10px; width: auto; }
  .detail { grid-template-columns: 1fr; padding: 10px 12px 12px; gap: 14px; }
  .kv-row { grid-template-columns: 105px 1fr; }
  .contact-row { grid-template-columns: 1fr 1fr; } .contact-row .icon-btn { justify-self: start; }
  .dash { grid-template-columns: 1fr; } .kpis { grid-template-columns: repeat(2, 1fr); }
  .cal-day { min-height: 62px; padding: 2px; } .chip i, .chip .cn { display: none; } .chip { text-align: center; font-size: 10px; font-weight: 600; padding: 1px 2px; }
  .wins, .meet-list { grid-template-columns: 1fr; }
  .grid2, .grid3 { grid-template-columns: 1fr; } .grid4 { grid-template-columns: 1fr; }
  .chat { grid-template-columns: 1fr; height: calc(100dvh - 54px - 30px - env(safe-area-inset-top)); }
  .chat.has-conv .chat-list { display: none; } .chat:not(.has-conv) .chat-conv { display: none; } .chat .back { display: inline-block; }
  .msg { max-width: 88%; }
  .modal-bg { place-items: end center; padding: 0; } .modal { border-radius: 16px 16px 0 0; max-height: 94vh; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .inline-add select, .inline-add input[type=datetime-local] { flex: 1 1 45%; }
  input, textarea, select { font-size: 16px !important; } /* iOS: bez powiększania */
  .chip-sel select, .chip-sel input { font-size: 14px !important; }
  .files { grid-template-columns: repeat(2, 1fr); }
  .fs.as-panel { width: 100%; }
}

/* ---------- Banery powiadomień (gdy CRM jest otwarty) ---------- */
#banners { position: fixed; top: calc(64px + env(safe-area-inset-top)); right: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 24px)); pointer-events: none; }
.banner { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--glass-line); border-left: 4px solid var(--blue);
  box-shadow: 0 12px 34px rgba(0,20,60,.22); cursor: pointer; animation: banner-in .25s ease; transition: opacity .5s, transform .5s; }
.banner img { width: 34px; height: 34px; border-radius: 8px; flex: none; } .banner b { display: block; color: var(--navy); font-size: 13px; } .banner span { font-size: 12.5px; color: var(--muted); }
.banner.out { opacity: 0; transform: translateX(30px); }
@keyframes banner-in { from { opacity: 0; transform: translateX(40px); } }
@media (max-width: 900px) { #banners { right: 12px; left: 12px; width: auto; } }
