:root {
    --bg: #f5f7fa;
    --panel: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #1d4ed8;
    --primary-text: #ffffff;
    --link: #1d4ed8;
    --top: #1f3a5f;
    --danger: #b91c1c;
    --overdue: #dc2626;
    --soon: #f59e0b;
    --ok: #16a34a;
    --hover: #eef3f9;
    --drawer-w: 340px;
}
:root.theme-dark {
        --bg: #0f172a; --panel: #1e293b; --text: #e5e7eb; --muted: #94a3b8;
        --border: #334155; --primary: #3b82f6; --top: #0b1324; --hover: #273449; --danger: #f87171; --link: #93c5fd;
    }
@media (prefers-color-scheme: dark) {
    :root:not(.theme-light) {
        --bg: #0f172a; --panel: #1e293b; --text: #e5e7eb; --muted: #94a3b8;
        --border: #334155; --primary: #3b82f6; --top: #0b1324; --hover: #273449; --danger: #f87171; --link: #93c5fd;
    }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: system-ui, -apple-system, sans-serif; color: var(--text); background: var(--bg); }
body { display: flex; flex-direction: column; }
a { color: var(--link); }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
    background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: .45rem .55rem; width: 100%;
}
button {
    background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: .4rem .8rem; cursor: pointer;
}
button:hover { background: var(--hover); }
button.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
button.primary:hover { filter: brightness(1.1); }
button.danger { color: var(--danger); }
button:disabled { opacity: .6; cursor: wait; }
button.link { border: none; background: none; padding: 0 .3rem; text-decoration: underline; font-size: .85em; }
.muted { color: var(--muted); }
.error { color: var(--danger); font-size: .9rem; min-height: 1em; margin: .4rem 0; }
.empty { color: var(--muted); text-align: center; padding: 1.5rem .5rem; }
.inline { display: inline; margin: 0; }

/* ---------- Pasek górny ---------- */
.topbar {
    display: flex; align-items: center; gap: .6rem; padding: .45rem .75rem;
    background: var(--top); color: #fff; z-index: 1001;
}
.topbar .brand { font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.topbar .brand small { font-weight: 400; opacity: .7; margin-left: .4rem; font-size: .85rem; }
.topbar .spacer { flex: 1; }
.icon-btn { background: transparent; border: 1px solid transparent; color: inherit; padding: .35rem .6rem; }
.topbar .icon-btn:hover { background: #ffffff1f; }
.badge { display: inline-block; min-width: 1.4em; padding: 0 .35em; border-radius: 1em; background: var(--soon); color: #111; font-size: .8rem; text-align: center; }
.badge.red { background: var(--overdue); color: #fff; }
.plan { font-size: .8rem; padding: .2rem .55rem; border-radius: 1em; white-space: nowrap; }
.plan.trial { background: #ffffff22; }
.plan.expired { background: var(--overdue); }
.banner { background: #fef3c7; color: #78350f; padding: .5rem 1rem; font-size: .9rem; }
.imp-banner { background: #7f1d1d; color: #fff; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.imp-banner span { flex: 1; }
.imp-banner button { background: #fff; color: #7f1d1d; border: 0; font-weight: 600; padding: .3rem .8rem; border-radius: 6px; cursor: pointer; }
.demo-banner { background: #1e3a8a; color: #fff; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.demo-banner span { flex: 1; min-width: 14rem; }
.demo-banner a { background: #fff; color: #1e3a8a; font-weight: 700; padding: .35rem .9rem; border-radius: 8px; text-decoration: none; white-space: nowrap; }
.demo-banner a:hover { background: #dbeafe; }

/* ---------- Układ ---------- */
main { flex: 1; position: relative; display: flex; min-height: 0; }
#map { flex: 1; z-index: 0; }
.map-hint {
    position: absolute; bottom: 1.5rem; left: 50%; transform: translateX(-50%); z-index: 500; pointer-events: none;
    background: #111827cc; color: #fff; padding: .35rem .8rem; border-radius: 1em; font-size: .85rem;
}

/* ---------- Wysuwany panel ---------- */
.drawer {
    width: 0; overflow: hidden; background: var(--panel); border-right: 1px solid var(--border);
    transition: width .22s ease; display: flex; flex-direction: column; z-index: 600;
}
.drawer.open { width: var(--drawer-w); }
.drawer > * { min-width: var(--drawer-w); }
.tabs { display: flex; border-bottom: 1px solid var(--border); }
.tabs button { flex: 1; border: none; border-radius: 0; background: none; padding: .7rem; border-bottom: 2px solid transparent; }
.tabs button.active { border-bottom-color: var(--primary); font-weight: 600; }
.tab { overflow-y: auto; padding: .75rem; flex: 1; }
.range { display: flex; align-items: center; gap: .5rem; font-size: .9rem; margin-bottom: .5rem; }
.range select { width: auto; }
.tab h4 { margin: 1rem 0 .4rem; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; }
.due-list, .plain-list { list-style: none; margin: 0; padding: 0; }
.due-list li, .plain-list li {
    display: flex; align-items: center; gap: .6rem; padding: .5rem; border-radius: 6px; cursor: pointer;
    border-left: 3px solid transparent;
}
.due-list li:hover, .plain-list li:hover { background: var(--hover); }
.due-list li.st-overdue { border-left-color: var(--overdue); }
.due-list li.st-soon { border-left-color: var(--soon); }
.due-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.due-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.due-main small { color: var(--muted); }
.st-overdue .due-main small { color: var(--overdue); }
.done-btn { padding: .2rem .55rem; color: var(--ok); font-weight: 700; }
.dot { width: .75rem; height: .75rem; border-radius: 50%; flex: none; }
#search { margin-bottom: .5rem; }

/* ---------- Pinezki ---------- */
.pin-wrap { background: none; border: none; }
.pin-dot {
    position: absolute; right: -2px; top: -4px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff;
    box-shadow: 0 0 3px #0008;
}
.pin-dot.overdue { background: var(--overdue); animation: pulse 1.6s infinite; }
.pin-dot.soon { background: var(--soon); }
@keyframes pulse { 50% { transform: scale(1.3); } }

/* ---------- Dymek ---------- */
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); }
.leaflet-popup-content { margin: .8rem; }
.pp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; font-size: 1rem; }
.st { font-size: .7rem; padding: .15rem .45rem; border-radius: 1em; white-space: nowrap; background: var(--hover); }
.st-overdue.st { background: var(--overdue); color: #fff; }
.st-soon.st { background: var(--soon); color: #111; }
.st-ok.st { background: var(--ok); color: #fff; }
.pp-desc { margin: .4rem 0; white-space: pre-line; }
.pp dl { display: grid; grid-template-columns: auto 1fr; gap: .15rem .7rem; margin: .5rem 0; font-size: .85rem; }
.pp dt { color: var(--muted); }
.pp dd { margin: 0; }
.pp-photos { display: flex; gap: .3rem; flex-wrap: wrap; margin: .5rem 0; }
.pp-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; cursor: zoom-in; }
.pp-actions { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .6rem; }
.pp-actions button { padding: .3rem .6rem; font-size: .85rem; }

/* ---------- Dialogi ---------- */
dialog {
    border: none; border-radius: 10px; padding: 1.25rem; width: min(420px, 94vw); max-height: 92vh; overflow-y: auto;
    background: var(--panel); color: var(--text); box-shadow: 0 20px 50px #0006;
}
dialog.wide { width: min(640px, 96vw); }
dialog::backdrop { background: #0008; }
dialog h3 { margin: 0 0 1rem; }
dialog label { display: block; margin-bottom: .7rem; font-size: .88rem; }
dialog label > input, dialog label > textarea, dialog label > select { margin-top: .2rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .8rem; }
.span2 { grid-column: span 2; }
.coords { display: flex; gap: .5rem; }
.coords label { flex: 1; }
fieldset { border: 1px solid var(--border); border-radius: 8px; margin: .4rem 0 .8rem; padding: .6rem .8rem .8rem; }
legend { font-size: .85rem; font-weight: 600; padding: 0 .3rem; }
.buttons { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; margin: .5rem 0; }
.buttons.left { justify-content: flex-start; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .5rem; margin-bottom: .6rem; }
.ph { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; outline: 3px solid transparent; }
.ph.is-marker { outline-color: var(--primary); }
.ph img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.ph button { position: absolute; top: 3px; padding: 0 .35rem; font-size: .8rem; line-height: 1.5; background: #000a; color: #fff; border: none; }
.ph-star { left: 3px; }
.ph.is-marker .ph-star { background: var(--primary); color: #fde047; }
.ph-del { right: 3px; }
.ph-new { position: absolute; bottom: 3px; left: 3px; font-size: .65rem; background: var(--ok); color: #fff; padding: 0 .3rem; border-radius: 3px; }
.file-btn { display: inline-block; cursor: pointer; padding: .35rem .8rem; border: 1px dashed var(--border); border-radius: 6px; margin: 0; }
.file-btn:hover { background: var(--hover); }

.marker-opts { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.swatches { display: flex; gap: .3rem; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 50%; padding: 0; border: 2px solid transparent; }
.swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--panel) inset; }
.marker-opts input[type=color] { width: 40px; height: 30px; padding: 2px; }
.marker-opts .muted { font-size: .8rem; flex-basis: 100%; }

.history { list-style: none; padding: 0; margin: 0; font-size: .88rem; max-height: 180px; overflow-y: auto; }
.history li { padding: .4rem 0; border-bottom: 1px solid var(--border); }
.history li div { white-space: pre-line; color: var(--muted); }

.lightbox { padding: 0; width: auto; max-width: 96vw; background: #000; }
.lightbox img { display: block; max-width: 96vw; max-height: 90vh; }
.lightbox button { position: absolute; top: .4rem; right: .4rem; background: #000a; color: #fff; }

/* ---------- Logowanie / rejestracja ---------- */
body.auth { align-items: center; justify-content: center; padding: 1rem; }
.auth-card {
    width: min(380px, 100%); background: var(--panel); padding: 2rem; border-radius: 12px; box-shadow: 0 10px 40px #0002;
}
.auth-card .brand { display: block; font-weight: 700; font-size: 1.3rem; margin-bottom: .5rem; color: var(--text); text-decoration: none; }
.auth-card .auth-back { display: inline-block; font-size: .85rem; margin-bottom: 1rem; color: var(--muted); text-decoration: none; }
.auth-card .auth-back:hover { color: var(--primary); text-decoration: underline; }
.auth-card h1 { font-size: 1.2rem; margin: 0 0 1rem; }
.auth-card label { display: block; margin-bottom: .8rem; font-size: .9rem; }
.auth-card label input { margin-top: .25rem; }
.auth-card button { width: 100%; padding: .6rem; margin-top: .3rem; }
.auth-card .alt { text-align: center; font-size: .9rem; margin-bottom: 0; }
.auth-card a { color: var(--primary); }

/* ---------- Telefon ---------- */
@media (max-width: 700px) {
    .topbar .brand small, .topbar .brand-name, .icon-btn span { display: none; }
    .drawer { position: absolute; inset: 0 auto 0 0; box-shadow: 4px 0 20px #0004; }
    .drawer.open { width: min(var(--drawer-w), 88vw); }
    .drawer > * { min-width: min(var(--drawer-w), 88vw); }
    .grid2 { grid-template-columns: 1fr; }
    .span2 { grid-column: auto; }
    .map-hint { display: none; }
    .drawer.open ~ .map-area .onboard { display: none; }
}

/* ---------- Wspólne drobiazgi ---------- */
.small { font-size: .8rem; }
.grow { flex: 1; min-width: 0; }
.buttons .spacer { flex: 1; }
.chip {
    display: inline-block; font-size: .7rem; padding: .05rem .45rem; border-radius: 1em;
    background: var(--hover); white-space: nowrap; vertical-align: middle;
}
.chip.pr-urgent { background: var(--overdue); color: #fff; font-weight: 700; }
.chip.pr-high { background: var(--soon); color: #111; }
.chip.pr-low { opacity: .7; }
.chip.os-new { background: #dbeafe; color: #1e3a8a; }
.chip.os-in_progress { background: #ede9fe; color: #5b21b6; }
.chip.os-done { background: #dcfce7; color: #166534; }
.chip.os-cancelled { text-decoration: line-through; opacity: .7; }

/* ---------- Panel: zakładki, filtr „moje”, zlecenia ---------- */
.tab-count { font-size: .7rem; background: var(--hover); border-radius: 1em; padding: 0 .35rem; margin-left: .2rem; }
.tab-count:empty { display: none; }
.mine { display: flex; align-items: center; gap: .4rem; font-size: .85rem; padding: .5rem .75rem 0; }
.mine input { width: auto; }
.orders-list li { align-items: flex-start; border-left: 3px solid transparent; }
.orders-list li.pr-urgent { border-left-color: var(--overdue); }
.orders-list li.pr-high { border-left-color: var(--soon); }
.orders-list li.os-done, .orders-list li.os-cancelled { opacity: .65; }
.chips { display: flex; flex-direction: column; gap: .2rem; align-items: flex-end; }
.labels-btn { display: block; text-align: center; margin-top: .75rem; text-decoration: none; color: inherit; }

/* ---------- Pinezki: liczba otwartych zleceń ---------- */
.pin-orders {
    position: absolute; left: -6px; top: -4px; min-width: 18px; height: 18px; padding: 0 4px;
    border-radius: 9px; font: 700 11px/18px system-ui, sans-serif; text-align: center;
    background: #6d28d9; color: #fff; border: 2px solid #fff; box-shadow: 0 0 3px #0008;
}
.pin-orders.pr-urgent { background: var(--overdue); animation: pulse 1.2s infinite; }
.pin-orders.pr-high { background: var(--soon); color: #111; }

/* ---------- Dymek: harmonogramy i zlecenia ---------- */
.pp-sched, .pp-orders { list-style: none; padding: 0; margin: .4rem 0; font-size: .82rem; }
.pp-sched li { display: flex; justify-content: space-between; gap: .5rem; padding: .2rem .4rem; border-left: 3px solid transparent; }
.pp-sched li.st-overdue { border-left-color: var(--overdue); color: var(--overdue); }
.pp-sched li.st-soon { border-left-color: var(--soon); }
.pp-sub { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-top: .5rem; }
.pp-orders li { padding: .25rem .4rem; border-radius: 4px; cursor: pointer; }
.pp-orders li:hover { background: var(--hover); }

/* ---------- Edytor harmonogramów ---------- */
.sched-head, .sched-row { display: grid; grid-template-columns: 1fr 5.5rem 9.5rem 2rem; gap: .4rem; align-items: center; }
.sched-head { font-size: .75rem; color: var(--muted); margin-bottom: .2rem; }
.sched-row { margin-bottom: .4rem; }
.s-del { padding: .3rem; }
#schedAdd { margin-top: .2rem; }

/* ---------- Dialog serwisu ---------- */
.svc-head { font-size: .88rem; margin-bottom: .3rem; }
.svc-row { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.svc-row .chk { flex: 1; display: flex; gap: .4rem; align-items: center; margin: 0; }
.svc-row .chk input { width: auto; margin: 0; }
.svc-row .svc-next { width: 10rem; }
.svc-row .svc-next:disabled { opacity: .4; }
.reporter { background: #fef3c7; color: #78350f; padding: .5rem .7rem; border-radius: 6px; margin-bottom: .7rem; font-size: .88rem; }

/* ---------- QR i zespół ---------- */
.qr-row { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.qr-row input { flex: 1; min-width: 12rem; font-size: .8rem; }
.qr-row .file-btn { text-decoration: none; color: inherit; }
.team-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.team-table th { text-align: left; font-size: .75rem; color: var(--muted); font-weight: 500; padding: .3rem; }
.team-table td { border-top: 1px solid var(--border); padding: .45rem .3rem; vertical-align: middle; }
.team-table select { width: auto; }
.invite-form { display: flex; gap: .4rem; flex-wrap: wrap; }
.invite-form input { flex: 1; min-width: 12rem; }
.invite-form select { width: auto; }
.invite-result { background: var(--hover); padding: .6rem .8rem; border-radius: 8px; margin-top: .6rem; }
.invite-result p { margin: 0 0 .4rem; font-size: .88rem; }
.roles-help { font-size: .85rem; margin-top: .8rem; color: var(--muted); }
.roles-help summary { cursor: pointer; }
dialog h4 { margin: 1.2rem 0 .5rem; font-size: .95rem; }

/* ---------- Strona publiczna (QR) ---------- */
body.public { align-items: center; }
.pub { width: min(520px, 100%); padding: 1.25rem 16px 2rem; display: block; flex: none; } /* main w aplikacji jest flexem */
.pub-company { color: var(--muted); font-size: .9rem; margin-top: .5rem; }
.pub h1 { margin: .2rem 0 1rem; font-size: 1.5rem; }
.pub-card { background: var(--panel); border-radius: 12px; padding: 1rem 1.2rem; margin-bottom: 1rem; box-shadow: 0 2px 10px #0001; }
.pub-card h2 { font-size: 1rem; margin: 0 0 .7rem; }
.pub-card dl { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 0; }
.pub-card dt { color: var(--muted); }
.pub-card dd { margin: 0; }
.pub-card label { display: block; margin-bottom: .8rem; font-size: .9rem; }
.pub-card label > * { margin-top: .25rem; }
.pub-card button { width: 100%; padding: .65rem; }
.pub-overdue { color: var(--overdue); font-weight: 600; }
.pub-soon { color: #b45309; font-weight: 600; }
:root.theme-dark .pub-soon { color: #fbbf24; }
@media (prefers-color-scheme: dark) { :root:not(.theme-light) .pub-soon { color: #fbbf24; } }
.pub-ok { color: var(--ok); font-weight: 600; }
.pub-member { background: var(--hover); padding: .5rem .8rem; border-radius: 8px; font-size: .9rem; }
.pub-member a { color: var(--primary); }
.pub-foot { text-align: center; color: var(--muted); font-size: .75rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---------- Naklejki QR ---------- */
body.labels-page { display: block; background: #fff; color: #000; }
.labels-toolbar { padding: .75rem 1rem; display: flex; gap: .75rem; align-items: center; border-bottom: 1px solid #ddd; }
.labels { display: grid; grid-template-columns: repeat(3, 70mm); grid-auto-rows: 42.4mm; justify-content: center; }
.label {
    display: flex; gap: 3mm; align-items: center; padding: 3mm; box-sizing: border-box;
    border: 1px dashed #ccc; overflow: hidden; color: #000;
}
.label-qr { width: 34mm; height: 34mm; flex: none; }
.label-qr svg { width: 100%; height: 100%; display: block; }
.label-text { display: flex; flex-direction: column; gap: 1mm; min-width: 0; font-size: 9pt; line-height: 1.2; }
.label-text b { font-size: 10pt; overflow-wrap: anywhere; }
.label-text small { font-size: 7pt; color: #444; }
@media print {
    @page { size: A4; margin: 4mm 0; }
    .labels-toolbar { display: none; }
    .label { border-color: transparent; break-inside: avoid; }
}

@media (max-width: 700px) {
    .sched-head { display: none; }
    .sched-row { grid-template-columns: 1fr 4.5rem 2rem; }
    .sched-row .s-next { grid-column: 1 / 3; }
    .svc-row { flex-wrap: wrap; }
}

/* =====================================================================
   Przejrzystość: pasek filtrów, legenda, karta punktu, komunikaty
   ===================================================================== */
.map-area { flex: 1; position: relative; min-width: 0; }
.map-area #map { position: absolute; inset: 0; }
button.danger-fill { background: var(--overdue); border-color: var(--overdue); color: #fff; }

/* ---------- Pasek filtrów ---------- */
.map-bar {
    position: absolute; top: .6rem; left: .6rem; right: .6rem; z-index: 700;
    display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; pointer-events: none;
}
.map-bar > * { pointer-events: auto; }
.filters, .seg, .toggle {
    display: flex; background: var(--panel); border-radius: 8px; box-shadow: 0 2px 8px #0003; overflow: hidden;
}
.filters button, .seg button {
    border: none; border-radius: 0; background: none; padding: .4rem .65rem; font-size: .82rem;
    display: flex; align-items: center; gap: .35rem; white-space: nowrap;
}
.filters button + button, .seg button + button { border-left: 1px solid var(--border); }
.filters button b { font-weight: 600; color: var(--muted); font-size: .78rem; }
.filters button.active, .seg button.active { background: var(--primary); color: var(--primary-text); }
.filters button.active b { color: inherit; }
.sw { width: .7rem; height: .7rem; border-radius: 50%; display: inline-block; }
.sw.st-overdue { background: var(--overdue); }
.sw.st-soon { background: var(--soon); }
.sw.st-none { background: #94a3b8; }
.sw.sw-orders { background: #6d28d9; border-radius: 3px; }
.toggle { align-items: center; gap: .35rem; padding: .35rem .65rem; font-size: .82rem; cursor: pointer; }
.toggle input { width: auto; margin: 0; }

/* ---------- Legenda ---------- */
.legend {
    position: absolute; left: .6rem; bottom: 1.6rem; z-index: 700; background: var(--panel);
    border-radius: 8px; box-shadow: 0 2px 8px #0003; font-size: .8rem; max-width: 280px;
}
.legend summary { cursor: pointer; padding: .4rem .7rem; font-weight: 600; }
.legend > div { padding: 0 .8rem .6rem; }
.legend ul { list-style: none; margin: 0; padding: 0; }
.legend li { display: flex; align-items: center; gap: .5rem; padding: .18rem 0; }
.legend p { margin: .4rem 0 0; }
.lg-pin {
    width: 14px; height: 14px; flex: none; background: var(--c); border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
    box-shadow: -1px 1px 2px #0005; display: inline-flex; align-items: center; justify-content: center;
}
.lg-pin:empty::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.lg-photo { width: 8px; height: 8px; border-radius: 50%; background: linear-gradient(135deg, #94a3b8, #e2e8f0); display: block; }
.lg-dot { width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 2px #0008; flex: none; }
.lg-dot.overdue { background: var(--overdue); }
.lg-dot.soon { background: var(--soon); }
.lg-badge {
    min-width: 16px; height: 16px; border-radius: 8px; background: #6d28d9; color: #fff; flex: none;
    font: 700 10px/16px system-ui, sans-serif; text-align: center;
}

/* ---------- Pinezki: zaznaczenie, puls, podpowiedź ---------- */
.leaflet-tooltip.pin-tip { background: var(--panel); color: var(--text); border: 1px solid var(--border); font-size: .8rem; line-height: 1.35; }
.leaflet-tooltip.pin-tip::before { border-top-color: var(--panel); }
.leaflet-tooltip-right.pin-tip::before { border-top-color: transparent; border-right-color: var(--panel); }
.leaflet-tooltip-left.pin-tip::before { border-top-color: transparent; border-left-color: var(--panel); }

/* ---------- Ikony statusu (kolor + znak, czytelne bez rozróżniania barw) ---------- */
.st-icon {
    width: 1.35rem; height: 1.35rem; border-radius: 50%; flex: none; display: inline-flex; align-items: center;
    justify-content: center; font-size: .72rem; font-weight: 700; color: #fff; background: #94a3b8;
}
.st-icon.st-overdue { background: var(--overdue); }
.st-icon.st-soon { background: var(--soon); color: #111; }
.st-icon.st-ok { background: var(--ok); }
.due-list li.current, .plain-list li.current { background: var(--hover); outline: 1px solid var(--primary); }

/* ---------- Karta punktu ---------- */
.card {
    position: absolute; top: 0; right: 0; bottom: 0; width: min(400px, 100%); z-index: 800;
    background: var(--panel); border-left: 1px solid var(--border); box-shadow: -6px 0 24px #0003;
    display: flex; flex-direction: column; animation: card-in .18s ease-out;
}
@keyframes card-in { from { transform: translateX(30px); opacity: 0; } }
.card[hidden] { display: none; }
.card-title { display: flex; align-items: flex-start; gap: .5rem; padding: .9rem 1rem 0; }
.card-title h2 { flex: 1; margin: 0; font-size: 1.15rem; line-height: 1.3; }
.card-title .icon-btn { color: var(--muted); }
.card-meta { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; padding: .5rem 1rem; font-size: .83rem; color: var(--muted); }
.card-meta .st { font-size: .75rem; }
.card-actions { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 1rem .6rem; }
.card-actions button { font-size: .85rem; padding: .35rem .7rem; }
.card-tabs { padding: 0 .5rem; overflow-x: auto; }
.card-tabs button { flex: none; padding: .55rem .7rem; font-size: .85rem; }
.tab-count.hot { background: var(--overdue); color: #fff; }
.card-body { flex: 1; overflow-y: auto; padding: .8rem 1rem 1.5rem; }
.card-desc { white-space: pre-line; margin: 0 0 .8rem; }
h4.sub { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 1rem 0 .4rem; }
h4.sub:first-child { margin-top: 0; }
.card-sched { list-style: none; margin: 0; padding: 0; }
.card-sched li { display: flex; align-items: center; gap: .6rem; padding: .5rem .4rem; border-bottom: 1px solid var(--border); }
.card-sched li .grow { display: flex; flex-direction: column; }
.sched-date { text-align: right; font-size: .85rem; display: flex; flex-direction: column; }
.sched-date small { color: var(--muted); }
.card-sched li.st-overdue .sched-date { color: var(--overdue); font-weight: 600; }
.card-qr { text-align: center; }
.card-qr img { width: 190px; height: 190px; background: #fff; padding: 6px; border-radius: 8px; }
.card-qr .qr-row { justify-content: center; margin-top: .5rem; }
.card-photos { margin-top: .6rem; }

/* ---------- Oś czasu ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ''; position: absolute; left: .85rem; top: .5rem; bottom: .5rem; width: 2px; background: var(--border); }
.timeline li { display: flex; gap: .7rem; padding: .45rem 0; position: relative; }
.timeline li[data-order-ev] { cursor: pointer; }
.timeline li[data-order-ev]:hover .tl-body { background: var(--hover); }
.tl-icon {
    width: 1.75rem; height: 1.75rem; flex: none; border-radius: 50%; background: var(--panel);
    border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: .8rem; z-index: 1;
}
.ev-service .tl-icon { border-color: var(--ok); color: var(--ok); font-weight: 700; }
.ev-order.pr-urgent .tl-icon { border-color: var(--overdue); }
.ev-order.pr-high .tl-icon { border-color: var(--soon); }
.tl-body { flex: 1; min-width: 0; font-size: .85rem; padding: .1rem .4rem; border-radius: 6px; }
.tl-head { display: flex; justify-content: space-between; gap: .5rem; }
.tl-head .muted { white-space: nowrap; }
.tl-text { white-space: pre-line; margin-top: .15rem; }

/* ---------- Dialog punktu: zakładki ---------- */
.dlg-tabs { margin: -.4rem 0 1rem; }
.dlg-tabs button { flex: none; padding: .55rem .8rem; }
.ptab { min-height: 230px; }
.ptab .file-btn { margin-top: .3rem; }

/* ---------- Komunikaty ---------- */
.toasts {
    position: fixed; right: 1rem; bottom: 1rem; z-index: 3000; display: flex; flex-direction: column; gap: .5rem;
    align-items: flex-end; pointer-events: none;
}
.toast {
    pointer-events: auto; display: flex; align-items: center; gap: .6rem; max-width: min(420px, calc(100vw - 2rem));
    background: #1f2937; color: #fff; padding: .6rem .7rem .6rem .9rem; border-radius: 8px; box-shadow: 0 8px 24px #0005;
    font-size: .9rem; transform: translateY(10px); opacity: 0; transition: transform .2s, opacity .2s;
}
.toast.show { transform: none; opacity: 1; }
.toast-icon { color: #4ade80; font-weight: 700; }
.toast-error { background: #7f1d1d; }
.toast-error .toast-icon { color: #fecaca; }
.toast-text { flex: 1; }
.toast button { background: none; border: none; color: #93c5fd; font-weight: 600; padding: .1rem .3rem; }
.toast button.toast-x { color: #9ca3af; font-weight: 400; }
dialog.confirm { width: min(380px, 92vw); }
dialog.confirm p { margin: 0 0 1rem; }

@media (max-width: 700px) {
    .map-bar { top: .4rem; left: .4rem; right: .4rem; }
    .filters { overflow-x: auto; max-width: 100%; }
    .seg button { padding: .4rem .5rem; }
    .legend { bottom: 1.4rem; max-width: 70vw; }
    .card { top: auto; height: 70%; width: 100%; border-left: none; border-top: 1px solid var(--border); border-radius: 14px 14px 0 0; }
    .toasts { left: 1rem; right: 1rem; align-items: stretch; }
}

/* ---------- Poprawki po testach w przeglądarce ---------- */
.tabs button { white-space: nowrap; }
.drawer .tabs button { padding: .7rem .4rem; }
.map-area.with-card .map-bar { right: calc(400px + .6rem); }
.topbar { min-width: 0; overflow: hidden; }
.topbar .brand { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 700px) {
    .map-area.with-card .map-bar { right: .4rem; }
    .topbar { gap: .2rem; padding: .4rem .4rem; }
    .topbar .icon-btn { padding: .35rem .45rem; }
    .plan-long { display: none; }
    .map-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .map-bar > * { flex: none; }
    .legend:not([open]) { bottom: 1.4rem; }
}

/* =====================================================================
   Klienci i adresy
   ===================================================================== */
.row-gap { display: flex; gap: .4rem; align-items: center; margin-top: .2rem; }
.row-gap > input, .row-gap > select { flex: 1; min-width: 0; margin: 0; }
.row-gap > button { flex: none; white-space: nowrap; }
#tab-customers .row-gap { margin: 0 0 .6rem; }
#tab-customers .row-gap button { padding: .45rem .8rem; }
.file-btn { text-decoration: none; color: inherit; }
.file-btn.static { cursor: default; border-style: solid; }
.file-btn.static:hover { background: none; }

/* Wyszukiwarka adresu nad mapą */
.addr-search { position: relative; width: 280px; }
.addr-search input {
    border: none; border-radius: 8px; box-shadow: 0 2px 8px #0003; padding: .45rem .7rem; font-size: .88rem;
}
.addr-results {
    position: absolute; top: calc(100% + 4px); left: 0; width: min(380px, 90vw); list-style: none; margin: 0; padding: .3rem 0;
    background: var(--panel); border-radius: 8px; box-shadow: 0 8px 24px #0004; max-height: 60vh; overflow-y: auto;
}
.addr-results li { padding: .4rem .8rem; cursor: pointer; display: flex; flex-direction: column; font-size: .86rem; }
.addr-results li small { color: var(--muted); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addr-results li:hover, .addr-results li.active { background: var(--hover); }
.addr-results .ar-head { cursor: default; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-top: .5rem; }
.addr-results .ar-head:hover { background: none; }
.addr-results .ar-state { cursor: default; color: var(--muted); font-style: italic; }
.search-pin {
    width: 30px; height: 30px; border-radius: 50%; background: #111827; border: 3px solid #fff; box-shadow: 0 2px 8px #0008;
    display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.leaflet-popup-content button.primary { margin-top: .4rem; }

/* Filtr klienta */
.customer-chip {
    background: #4338ca; color: #fff; border: none; border-radius: 8px; box-shadow: 0 2px 8px #0003;
    padding: .4rem .7rem; font-size: .82rem; white-space: nowrap;
}
.customer-chip:hover { background: #3730a3; }
.customer-chip span { opacity: .8; margin-left: .3rem; }

/* Karta punktu: adres i klient */
.card-addr { display: flex; align-items: center; gap: .5rem; padding: 0 1rem .6rem; font-size: .85rem; }
.card-addr .file-btn { margin: 0; padding: .25rem .6rem; font-size: .82rem; white-space: nowrap; flex: none; width: auto; }
.card-addr > .grow { flex: 1; min-width: 0; }
.customer-box {
    display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between;
    background: var(--hover); border-radius: 8px; padding: .6rem .7rem; margin-bottom: .8rem;
}
.cb-main { display: flex; flex-direction: column; min-width: 0; }
.cb-name { color: var(--text); font-weight: 600; text-decoration: none; }
.cb-name:hover { text-decoration: underline; }
.cb-actions { display: flex; gap: .3rem; flex-wrap: wrap; }
.cb-actions .file-btn { margin: 0; padding: .25rem .55rem; font-size: .8rem; background: var(--panel); border-style: solid; }

/* Lista i podgląd klienta */
.customer-list li { align-items: center; }
.customer-list li .grow { display: flex; flex-direction: column; }
.customer-list b { font-weight: 500; }
.cust-avatar {
    width: 2rem; height: 2rem; border-radius: 50%; flex: none; background: #e0e7ff; color: #3730a3;
    display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.cust-avatar.big { width: 3rem; height: 3rem; font-size: 1.3rem; }
.cv-head { display: flex; gap: .8rem; align-items: center; margin-bottom: .8rem; }
.cv-head h3 { margin: 0; }
.cv-contact { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.cv-contact .file-btn { margin: 0; font-size: .85rem; border-style: solid; }
.cv-notes { white-space: pre-line; background: var(--hover); padding: .5rem .7rem; border-radius: 6px; font-size: .88rem; }
.cv-points li { align-items: center; }
#customerView.wide { width: min(880px, 96vw); }
.cv-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; margin: .6rem 0 .2rem; }
.cv-kpi { border: 1px solid var(--border); border-radius: 8px; padding: .45rem .55rem; display: flex; flex-direction: column; line-height: 1.2; }
.cv-kpi[data-cv-jump] { cursor: pointer; }
.cv-kpi[data-cv-jump]:hover { background: var(--hover); }
.cv-kpi b { font-size: 1.25rem; }
.cv-kpi span { font-size: .75rem; color: var(--muted); }
.cv-kpi.bad { border-color: var(--overdue); background: color-mix(in srgb, var(--overdue) 9%, var(--panel)); }
.cv-kpi.bad b { color: var(--overdue); }
.cv-kpi.warn { border-color: var(--soon); background: color-mix(in srgb, var(--soon) 10%, var(--panel)); }
.cv-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .9rem; margin-top: .8rem; }
.cv-map { height: 240px; border-radius: 8px; border: 1px solid var(--border); z-index: 0; }
.cv-col h4.sub:first-child { margin-top: 0; }
.cv-list li { display: flex; align-items: flex-start; gap: .5rem; padding: .35rem .3rem; cursor: pointer; border-radius: 6px; font-size: .88rem; }
.cv-list li:hover { background: var(--hover); }
.cv-list li .grow { min-width: 0; }
.cv-list li small { display: block; }
.cv-list li > .st-icon { margin-top: .05rem; }
.cv-list .visit-badge { margin-top: .15rem; display: inline-block; }
.cv-ico { width: 1.35rem; flex: none; text-align: center; }
.cv-history li { cursor: default; }
.cv-date { flex: none; width: 5.3rem; font-variant-numeric: tabular-nums; color: var(--muted); }
@media (max-width: 720px) {
    .cv-kpis { grid-template-columns: repeat(3, 1fr); }
    .cv-grid { grid-template-columns: 1fr; }
    .cv-map { height: 180px; }
    .cv-kpi:last-child { grid-column: span 2; }
    .cv-kpi { padding: .35rem .45rem; }
    .cv-kpi b { font-size: 1.1rem; }
    .cv-head { align-items: flex-start; gap: .6rem; }
    .cv-head h3 { font-size: 1.05rem; overflow-wrap: anywhere; }
    .cust-avatar.big { width: 2.4rem; height: 2.4rem; font-size: 1.1rem; }
    .cv-edit span { display: none; }
    .cv-contact .file-btn { font-size: .8rem; }
}

/* Naklejki */
.label-customer { font-weight: 600; }

@media (max-width: 700px) {
    .addr-search { width: 180px; }
    .card-addr { padding: 0 1rem .5rem; }
}

.drawer .tabs button { font-size: .85rem; padding: .7rem .3rem; flex: 1 1 auto; }

.card-tabs { scrollbar-width: none; }
.card-tabs::-webkit-scrollbar { display: none; }
.card-tabs button { padding: .55rem .5rem; font-size: .83rem; }

/* =====================================================================
   Łatwość obsługi: dodawanie, pierwsze kroki, kafelki, grupy, podpisy
   ===================================================================== */

/* Przycisk „Dodaj punkt” i tryb wskazywania */
.add-point-btn {
    background: var(--primary); color: var(--primary-text); border: none; border-radius: 8px;
    box-shadow: 0 2px 8px #0003; padding: .45rem .85rem; font-weight: 600; white-space: nowrap;
}
.add-point-btn:hover { background: var(--primary); filter: brightness(1.1); }
.add-point-btn.active { background: #111827; }
.place-banner {
    position: absolute; left: 50%; top: 3.6rem; transform: translateX(-50%); z-index: 750;
    display: flex; align-items: center; gap: .8rem; background: #111827; color: #fff;
    padding: .55rem .6rem .55rem 1rem; border-radius: 10px; box-shadow: 0 6px 20px #0005; font-size: .9rem;
    max-width: calc(100% - 1.2rem);
}
.place-banner .muted { color: #9ca3af; }
.place-banner button { background: #374151; color: #fff; border: none; white-space: nowrap; }
#map.placing, #map.placing .leaflet-interactive { cursor: crosshair !important; }
#map.placing .leaflet-grab { cursor: crosshair; }

/* Pierwsze kroki */
.onboard {
    position: absolute; right: .6rem; top: calc(var(--bar-h, 2.6rem) + 1rem); z-index: 690; width: 290px; background: var(--panel);
    border-radius: 10px; box-shadow: 0 6px 20px #0003; padding: .7rem .9rem .5rem; font-size: .88rem;
}
.map-area.with-card .onboard { display: none; }
.ob-head { display: flex; align-items: center; gap: .5rem; }
.ob-head > b { flex: 1; }
.ob-head .icon-btn { color: var(--muted); padding: .1rem .3rem; }
.ob-bar { height: 5px; background: var(--hover); border-radius: 3px; margin: .4rem 0 .5rem; overflow: hidden; }
.ob-bar i { display: block; height: 100%; background: var(--ok); transition: width .3s; }
.onboard ul { list-style: none; margin: 0; padding: 0; }
.onboard li { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; }
.onboard li.done { color: var(--muted); text-decoration: line-through; }
.onboard a { color: var(--primary); text-decoration: none; font-weight: 500; }
.onboard a:hover { text-decoration: underline; }
.ob-check {
    width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 2px solid var(--border); flex: none;
    display: inline-flex; align-items: center; justify-content: center; font-size: .65rem;
}
.onboard li.done .ob-check { background: var(--ok); border-color: var(--ok); color: #fff; }

/* Kafelki nad listą przeglądów */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin-bottom: .8rem; }
.tile {
    display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; padding: .55rem .6rem;
    border-radius: 8px; border: 1px solid var(--border); border-left-width: 4px; text-align: left;
}
.tile b { font-size: 1.35rem; line-height: 1.1; }
.tile span { font-size: .72rem; color: var(--muted); line-height: 1.2; }
.tile.t-overdue { border-left-color: var(--overdue); }
.tile.t-overdue b { color: var(--overdue); }
.tile.t-soon { border-left-color: var(--soon); }
.tile.t-orders { border-left-color: #6d28d9; }
.tile.active { background: var(--hover); outline: 2px solid var(--primary); }

/* Grupy pinezek */
.cl-wrap { background: none; border: none; }
.cl {
    width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: #fff; font: 700 14px system-ui, sans-serif; position: relative;
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--clc) 35%, transparent), 0 2px 6px #0006; background: var(--clc);
}
.cl-overdue { --clc: #dc2626; }
.cl-soon { --clc: #f59e0b; color: #111; }
.cl-ok { --clc: #16a34a; }
.cl-none { --clc: #64748b; }
.cl-neutral { --clc: #334155; }
.cl-ord { position: absolute; right: -2px; top: -2px; width: 12px; height: 12px; border-radius: 50%; background: #6d28d9; border: 2px solid #fff; }
.lg-cl {
    width: 18px; height: 18px; border-radius: 50%; background: #dc2626; color: #fff; flex: none;
    font: 700 10px/18px system-ui, sans-serif; text-align: center; box-shadow: 0 0 0 3px #dc262655;
}

/* Podpisy przy pinezkach */

/* Legenda: opcje widoku */
.legend-opts { padding: .2rem .8rem .7rem; display: flex; flex-direction: column; gap: .5rem; border-top: 1px solid var(--border); margin-top: .3rem; padding-top: .6rem; }
.legend .seg { box-shadow: none; border: 1px solid var(--border); align-self: flex-start; }
.legend .chk { display: flex; align-items: center; gap: .4rem; cursor: pointer; }
.legend .chk input { width: auto; margin: 0; }

/* Formularz: współrzędne schowane */
.coords-box { border: 1px dashed var(--border); border-radius: 8px; padding: .4rem .7rem; margin-bottom: .7rem; }
.coords-box summary { cursor: pointer; font-size: .85rem; color: var(--muted); }
.coords-box[open] summary { margin-bottom: .5rem; }
.coords-box p { margin: 0 0 .3rem; }

/* Pomoc */
.keys { border-collapse: collapse; font-size: .9rem; }
.keys td { padding: .25rem .8rem .25rem 0; }
kbd {
    display: inline-block; min-width: 1.6rem; text-align: center; padding: .1rem .4rem; border-radius: 5px;
    border: 1px solid var(--border); border-bottom-width: 2px; background: var(--hover); font: 600 .85rem system-ui, sans-serif;
}
.help-list { padding-left: 1.1rem; font-size: .9rem; line-height: 1.5; }

/* Ciemna mapa po zmroku albo z wyboru (klasa ustawiana w app.js; odwrócone kafelki, pinezki bez zmian) */
html.map-night .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.85) saturate(.7); }
html.map-night .leaflet-container { background: #1b2230; }

@media (max-width: 700px) {
    .add-point-btn span { display: none; }
    .place-banner { top: 3.2rem; font-size: .82rem; flex-wrap: wrap; justify-content: center; }
    .onboard { left: .4rem; right: .4rem; width: auto; top: 3.2rem; }
    .tile b { font-size: 1.15rem; }
}

/* Atrybut hidden zawsze ukrywa element (nawet gdy klasa ustawia display) */
[hidden] { display: none !important; }
.addr-search { width: 220px; }
/* Pasek trybu dodawania na dole mapy (nie zasłania filtrów ani „Pierwszych kroków”) */
.place-banner { top: auto; bottom: 1.6rem; }
@media (max-width: 700px) { .place-banner { top: auto; bottom: 1.2rem; } }

/* =====================================================================
   Typy urządzeń, „Co teraz?”, przełożenie terminu
   ===================================================================== */

/* Ikona typu w pinezce (zamiast białej kropki) */

/* Wybór typu w formularzu */
.field { margin-bottom: .7rem; }
.field-label { display: block; font-size: .88rem; margin-bottom: .3rem; }
.type-picker { display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem; }
.type-opt {
    display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .35rem .2rem;
    border: 1px solid var(--border); border-radius: 8px; background: var(--panel);
}
.type-opt span { font-size: 1.25rem; line-height: 1.2; }
.type-opt small { font-size: .66rem; color: var(--muted); text-align: center; line-height: 1.1; }
.type-opt.active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--panel)); box-shadow: 0 0 0 1px var(--primary); }
.type-opt.active small { color: var(--text); font-weight: 600; }

/* Filtr typu na mapie */
.type-filter {
    width: auto; border: none; border-radius: 8px; box-shadow: 0 2px 8px #0003; padding: .4rem .5rem; font-size: .82rem;
    background: var(--panel); cursor: pointer;
}
.type-filter.active { background: var(--primary); color: var(--primary-text); }

/* Pasek „Co teraz?” w karcie punktu */
.next-action {
    margin: 0 1rem .7rem; padding: .6rem .75rem; border-radius: 10px; font-size: .88rem;
    border-left: 4px solid #94a3b8; background: var(--hover);
}
.na-text { line-height: 1.35; }
.na-btns { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.na-btn {
    font-size: .82rem; padding: .3rem .65rem; border-radius: 6px; border: 1px solid var(--border);
    background: var(--panel); color: var(--text); text-decoration: none; cursor: pointer;
}
.na-btn.strong { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 600; }
.na-overdue { border-left-color: var(--overdue); background: color-mix(in srgb, var(--overdue) 10%, var(--panel)); }
.na-soon { border-left-color: var(--soon); background: color-mix(in srgb, var(--soon) 12%, var(--panel)); }
.na-order { border-left-color: #6d28d9; background: color-mix(in srgb, #6d28d9 9%, var(--panel)); }
.na-ok { border-left-color: var(--ok); color: var(--muted); }
.na-ok b { color: var(--text); }

/* Przełożenie terminu */
.quick-dates { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .7rem; }
.quick-dates button { font-size: .85rem; }
.card-sched .link { color: var(--muted); font-size: .78rem; }
.ev-postpone .tl-icon { border-color: var(--soon); }

@media (max-width: 700px) {
    .type-picker { grid-template-columns: repeat(4, 1fr); }
}

/* =====================================================================
   Widoki: przełącznik, tabela, kalendarz
   ===================================================================== */
.view-switch { display: flex; background: #ffffff1a; border-radius: 8px; padding: 2px; margin-left: .6rem; }
.view-switch button {
    background: none; border: none; color: #fff; opacity: .75; padding: .3rem .7rem; border-radius: 6px; font-size: .88rem;
}
.view-switch button:hover { opacity: 1; background: #ffffff1a; }
.view-switch button.active { background: #fff; color: var(--top); opacity: 1; font-weight: 600; }

/* Panele widoków przykrywają mapę poniżej paska filtrów */
.view-panel {
    position: absolute; left: 0; right: 0; bottom: 0; top: calc(var(--bar-h, 2.6rem) + 1rem); z-index: 650;
    background: var(--bg); display: flex; flex-direction: column; padding: 0 .8rem .8rem;
}
.map-area.with-card .view-panel { right: 400px; }
.map-area.view-table, .map-area.view-calendar { background: var(--bg); }
.map-area:is(.view-table, .view-calendar) :is(.legend, .onboard, .map-hint, .place-banner, .leaflet-control-container) { display: none !important; }
.map-area:is(.view-table, .view-calendar)::before {
    content: ''; position: absolute; inset: 0; background: var(--bg); z-index: 600;
}
.vp-toolbar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .2rem 0 .6rem; }
.vp-toolbar input[type=search] { max-width: 340px; }
.vp-toolbar .spacer { flex: 1; }
.vp-toolbar h3 { margin: 0 0 0 .4rem; font-size: 1.15rem; }

/* Tabela */
.table-wrap { flex: 1; overflow: auto; background: var(--panel); border-radius: 10px; box-shadow: 0 1px 6px #0002; }
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th {
    position: sticky; top: 0; z-index: 1; background: var(--panel); text-align: left; font-weight: 600; font-size: .78rem;
    color: var(--muted); padding: .6rem .7rem; border-bottom: 2px solid var(--border); cursor: pointer; white-space: nowrap; user-select: none;
}
.data-table th:hover { color: var(--text); }
.data-table th.sorted { color: var(--primary); }
.data-table th::after { content: attr(data-dir); margin-left: .3rem; font-size: .7rem; }
.data-table td { padding: .5rem .7rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: var(--hover); }
.data-table tbody tr.current { background: color-mix(in srgb, var(--primary) 12%, var(--panel)); }
.data-table tr.st-overdue td:first-child { box-shadow: inset 3px 0 0 var(--overdue); }
.data-table tr.st-soon td:first-child { box-shadow: inset 3px 0 0 var(--soon); }
.t-name { min-width: 180px; }
.data-table .t-sub { display: none; font-size: .75rem; font-weight: 400; margin-top: .1rem; } /* tylko na telefonie */
.t-type { display: inline-block; width: 1.4rem; }
.t-due { white-space: nowrap; }
.t-due small { display: block; color: var(--muted); font-size: .75rem; }
.due-over { color: var(--overdue); font-weight: 600; }
.data-table .empty { text-align: center; }

/* Kalendarz */
.cal-legend { font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: .3rem; }
.cal-legend .sw { margin-left: .5rem; }
.sw.st-ok { background: var(--ok); }
.cal-hint { margin: -.3rem 0 .5rem; }
.cal-grid {
    flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: auto repeat(6, minmax(0, 1fr));
    gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; min-height: 0;
}
.cal-dow { background: var(--panel); text-align: center; font-size: .75rem; font-weight: 600; color: var(--muted); padding: .35rem; }
.cal-day { background: var(--panel); padding: .25rem .3rem; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.cal-day.other { background: color-mix(in srgb, var(--panel) 70%, var(--bg)); }
.cal-day.other .cal-num { opacity: .45; }
.cal-day.weekend { background: color-mix(in srgb, var(--panel) 88%, var(--bg)); }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--primary); }
.cal-day.today .cal-num { color: var(--primary); }
.cal-day.drop { background: color-mix(in srgb, var(--primary) 15%, var(--panel)); }
.cal-num { font-size: .8rem; font-weight: 600; display: flex; justify-content: space-between; align-items: center; padding: 0 .15rem; }
.cal-num small { font-weight: 400; color: var(--muted); font-size: .68rem; }
.cal-item {
    font-size: .74rem; line-height: 1.25; padding: .15rem .35rem; border-radius: 4px; cursor: pointer;
    border-left: 3px solid #94a3b8; background: var(--hover); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-item small { display: block; color: var(--muted); font-size: .67rem; overflow: hidden; text-overflow: ellipsis; }
.cal-item:hover { filter: brightness(.95); }
.cal-item.ci-overdue { border-left-color: var(--overdue); background: color-mix(in srgb, var(--overdue) 13%, var(--panel)); }
.cal-item.ci-soon { border-left-color: var(--soon); background: color-mix(in srgb, var(--soon) 15%, var(--panel)); }
.cal-item.ci-ok { border-left-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, var(--panel)); }
.cal-item.ci-order { border-left-color: #6d28d9; background: color-mix(in srgb, #6d28d9 12%, var(--panel)); }
.cal-item.ci-order.pr-urgent { border-left-color: var(--overdue); font-weight: 600; }
.cal-item[draggable=true] { cursor: grab; }
.cal-item.dragging { opacity: .4; }
.cal-more { font-size: .7rem; padding: .05rem .3rem; border: none; background: none; color: var(--primary); text-align: left; }

@media (max-width: 700px) {
    .view-switch { margin-left: .2rem; }
    .view-switch button { padding: .3rem .45rem; }
    .view-switch span { display: none; }
    .map-area.with-card .view-panel { right: 0; }
    .cal-item small { display: none; }
    .cal-legend { display: none; }
    /* Tabela na telefonie: zaznaczenie, status, punkt (z klientem i adresem pod nazwą), termin */
    .data-table .t-hide-phone { display: none; }
    .data-table .t-sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .data-table .t-due small { white-space: normal; }
    .data-table .t-name { min-width: 0; }
    .data-table td, .data-table th { padding: .5rem .45rem; }
}

/* =====================================================================
   Wpis serwisowy: lista kontrolna, zdjęcia, podpis; protokół w historii
   ===================================================================== */
.stab { min-height: 260px; }
.tab-count.ok { background: var(--ok); color: #fff; }
.check-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.small-btn { font-size: .82rem; padding: .3rem .7rem; }
.check-list { display: flex; flex-direction: column; gap: .3rem; max-height: 340px; overflow-y: auto; }
.check-row {
    display: flex; align-items: center; gap: .6rem; padding: .4rem .5rem; border: 1px solid var(--border);
    border-left: 4px solid var(--border); border-radius: 6px;
}
.check-row.cs-ok { border-left-color: var(--ok); }
.check-row.cs-fail { border-left-color: var(--overdue); background: color-mix(in srgb, var(--overdue) 7%, var(--panel)); }
.check-row.cs-na { border-left-color: #94a3b8; }
.check-label { flex: 1; font-size: .9rem; }
.check-btns { display: flex; gap: .25rem; flex: none; }
.check-btns button { font-size: .75rem; padding: .25rem .5rem; color: var(--muted); }
.check-btns button.on[data-state=ok] { background: var(--ok); border-color: var(--ok); color: #fff; }
.check-btns button.on[data-state=fail] { background: var(--overdue); border-color: var(--overdue); color: #fff; }
.check-btns button.on[data-state=na] { background: #64748b; border-color: #64748b; color: #fff; }
.check-add { margin-top: .6rem; }
.svc-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.svc-photos .photo-grid { min-height: 60px; }
.sign-wrap { position: relative; margin-bottom: .6rem; }
#signPad {
    width: 100%; height: auto; aspect-ratio: 3 / 1; background: #fff; border: 2px dashed #cbd5e1; border-radius: 10px;
    touch-action: none; cursor: crosshair; display: block;
}
.sign-hint {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none;
    color: #94a3b8; font-size: 1.1rem; font-style: italic;
}
.sign-hint::after { content: ''; position: absolute; left: 10%; right: 10%; bottom: 28%; border-bottom: 1px solid #cbd5e1; }
.inline-chk { display: flex; align-items: center; gap: .4rem; font-size: .85rem; margin: 0; color: var(--muted); }
.inline-chk input { width: auto; margin: 0; }
.dlg-head-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.dlg-head-row h3 { margin: 0; }
.tl-photos { display: flex; gap: .3rem; flex-wrap: wrap; margin: .3rem 0; }
.tl-photos .ph { width: 54px; height: 54px; flex: none; }
.tl-actions { display: flex; flex-wrap: wrap; gap: .2rem .8rem; align-items: center; margin-top: .2rem; }
.tl-actions .link { font-size: .8rem; padding: 0; white-space: nowrap; }
a.link { color: var(--primary); }
@media (max-width: 700px) {
    .svc-photos { grid-template-columns: 1fr; }
    .check-row { flex-wrap: wrap; }
}

/* =====================================================================
   Centrum powiadomień, typowe przeglądy, edycja wpisu
   ===================================================================== */
.notif-btn { position: relative; }
.notif-btn .badge { position: absolute; top: -2px; right: -4px; font-size: .68rem; min-width: 1.2rem; }
.notif-btn.active { background: #ffffff26; }
.notif-panel {
    position: fixed; top: 3.2rem; right: .8rem; z-index: 1500; width: min(400px, calc(100vw - 1.6rem));
    max-height: min(70vh, 560px); display: flex; flex-direction: column; background: var(--panel);
    border-radius: 14px; box-shadow: 0 20px 50px #0005; border: 1px solid var(--border); overflow: hidden;
    animation: pop-in .15s ease-out;
}
@keyframes pop-in { from { transform: translateY(-6px); opacity: 0; } }
.np-head { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--border); }
.np-head .link { font-size: .8rem; color: var(--primary); }
.np-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.np-item { display: flex; gap: .7rem; padding: .7rem 1rem; cursor: pointer; border-bottom: 1px solid var(--border); position: relative; }
.np-item:hover { background: var(--hover); }
.np-item.unread { background: color-mix(in srgb, var(--primary) 6%, var(--panel)); }
.np-item.read { opacity: .72; }
.np-icon {
    width: 2.1rem; height: 2.1rem; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: var(--hover); font-size: 1rem;
}
.t-qr_report .np-icon, .t-overdue .np-icon { background: color-mix(in srgb, var(--overdue) 15%, var(--panel)); }
.t-upcoming .np-icon { background: color-mix(in srgb, var(--soon) 18%, var(--panel)); }
.t-order_assigned .np-icon { background: color-mix(in srgb, #6d28d9 14%, var(--panel)); }
.np-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; font-size: .86rem; }
.np-main span { color: var(--muted); line-height: 1.35; }
.np-main small { color: var(--muted); font-size: .72rem; }
.np-dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--primary); flex: none; margin-top: .4rem; }
.np-empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }
.np-foot { padding: .6rem 1rem; border-top: 1px solid var(--border); text-align: center; }
.np-foot .link { font-size: .82rem; color: var(--muted); text-decoration: none; }
.np-foot .link:hover { color: var(--primary); }

.type-hint {
    margin: .5rem 0 0; font-size: .82rem; color: var(--ok); background: color-mix(in srgb, var(--ok) 9%, var(--panel));
    padding: .4rem .7rem; border-radius: 8px;
}
.type-hint a { color: var(--primary); }
.svc-edit-info {
    font-size: .85rem; background: var(--hover); border-left: 3px solid var(--primary); padding: .55rem .8rem;
    border-radius: 8px; margin-bottom: .8rem; line-height: 1.45;
}
.sign-existing { margin-bottom: .6rem; }
.sign-existing img {
    width: 100%; max-height: 160px; object-fit: contain; background: #fff; border: 1px solid var(--border);
    border-radius: 10px; margin-bottom: .5rem;
}
.svc-photos .photo-grid:empty { display: none; }

/* =====================================================================
   Wygląd: typografia, kolory, przyciski, okna, karta, panele
   ===================================================================== */
:root {
    --bg: #f2f4f8; --panel: #ffffff; --text: #1a2233; --muted: #667085; --border: #e3e7ee;
    --primary: #2457d6; --hover: #f0f3f9; --top: #172b4d;
    --radius: 10px;
    --shadow-sm: 0 1px 2px #10182814, 0 1px 3px #1018281a;
    --shadow-md: 0 4px 12px #1018281a, 0 2px 4px #1018280f;
    --ring: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent);
}
:root.theme-dark {
        --bg: #0d1424; --panel: #162033; --text: #e6eaf2; --muted: #93a0b8; --border: #26324a;
        --primary: #4f83ff; --hover: #1d2a42; --top: #0a1120;
        --shadow-sm: 0 1px 3px #0006; --shadow-md: 0 6px 18px #0008;
    }
@media (prefers-color-scheme: dark) {
    :root:not(.theme-light) {
        --bg: #0d1424; --panel: #162033; --text: #e6eaf2; --muted: #93a0b8; --border: #26324a;
        --primary: #4f83ff; --hover: #1d2a42; --top: #0a1120;
        --shadow-sm: 0 1px 3px #0006; --shadow-md: 0 6px 18px #0008;
    }
}
html, body { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; font-feature-settings: 'cv11', 'ss01'; -webkit-font-smoothing: antialiased; }
body { background: var(--bg); }

/* Przyciski i pola */
button, .file-btn, .na-btn { transition: background .12s, border-color .12s, box-shadow .12s, transform .06s; }
button { border-radius: 8px; font-weight: 500; }
button:active:not(:disabled) { transform: translateY(1px); }
button.primary { box-shadow: 0 1px 2px #10182833; }
button:focus-visible, a:focus-visible, .file-btn:focus-within, summary:focus-visible { outline: none; box-shadow: var(--ring); }
input, select, textarea { border-radius: 8px; transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }

/* Pasek górny */
.topbar {
    background: linear-gradient(120deg, var(--top), color-mix(in srgb, var(--top) 70%, #2457d6));
    box-shadow: 0 2px 10px #0003; padding: .45rem .8rem; min-height: 3rem;
}
.topbar .brand { display: flex; align-items: center; gap: .45rem; letter-spacing: -.01em; }
.brand-mark {
    width: 1.8rem; height: 1.8rem; border-radius: 8px; background: #ffffff1f; display: inline-flex;
    align-items: center; justify-content: center; font-size: .95rem;
}
.topbar .icon-btn { border-radius: 8px; }
.plan.trial { background: #ffffff1c; border: 1px solid #ffffff26; }

/* Panel boczny */
.drawer { background: var(--panel); box-shadow: 1px 0 0 var(--border); }
.tabs button { font-weight: 500; color: var(--muted); }
.tabs button.active { color: var(--text); border-bottom-width: 3px; }
.tab h4 { color: var(--muted); font-weight: 600; font-size: .72rem; }
.due-list li, .plain-list li { border-radius: 8px; margin-bottom: 2px; }
.tile { box-shadow: var(--shadow-sm); background: var(--panel); border-radius: var(--radius); }
.tile:hover { box-shadow: var(--shadow-md); }
.empty { font-size: .9rem; }

/* Pasek nad mapą */
.filters, .seg, .toggle, .type-filter, .addr-search input, .add-point-btn, .legend, .onboard, .customer-chip {
    box-shadow: var(--shadow-md);
}
.filters { border-radius: 10px; }
.filters button { font-weight: 500; }
.add-point-btn { border-radius: 10px; letter-spacing: .01em; }

/* Karta punktu */
.card { box-shadow: -8px 0 30px #10182822; }
.card-title { align-items: center; gap: .7rem; }
.card-title h2 { font-size: 1.1rem; letter-spacing: -.01em; display: flex; flex-direction: column; }
.card-title h2 small { font-size: .8rem; font-weight: 500; color: var(--muted); margin-top: .1rem; }
.card-avatar {
    width: 2.6rem; height: 2.6rem; flex: none; border-radius: 12px; display: flex; align-items: center; justify-content: center;
    font-size: 1.35rem; background: var(--hover); box-shadow: inset 0 0 0 2px #94a3b8;
}
.card-avatar.st-overdue { box-shadow: inset 0 0 0 2px var(--overdue); background: color-mix(in srgb, var(--overdue) 10%, var(--panel)); }
.card-avatar.st-soon { box-shadow: inset 0 0 0 2px var(--soon); background: color-mix(in srgb, var(--soon) 12%, var(--panel)); }
.card-avatar.st-ok { box-shadow: inset 0 0 0 2px var(--ok); background: color-mix(in srgb, var(--ok) 10%, var(--panel)); }
.card-actions button { border-radius: 8px; }
.next-action { border-radius: 12px; }
.customer-box { border-radius: 12px; }
.timeline .tl-icon { box-shadow: 0 0 0 3px var(--panel); }

/* Okna dialogowe */
dialog { border-radius: 16px; box-shadow: 0 24px 60px #0b122340; padding: 1.4rem 1.5rem; }
dialog::backdrop { background: #0b1223a6; backdrop-filter: blur(2px); }
dialog h3 { font-size: 1.15rem; letter-spacing: -.01em; }
dialog > form > .buttons:last-child, dialog > div > .buttons:last-child {
    position: sticky; bottom: -1.4rem; background: var(--panel); margin: .8rem -1.5rem -1.4rem; padding: .8rem 1.5rem;
    border-top: 1px solid var(--border); border-radius: 0 0 16px 16px;
}
.dlg-tabs button { border-radius: 8px 8px 0 0; }
fieldset { border-radius: 12px; }

/* Tabela, kalendarz */
.table-wrap, .cal-grid { box-shadow: var(--shadow-sm); border-radius: 12px; }
.data-table th { text-transform: uppercase; letter-spacing: .04em; font-size: .7rem; }

/* Komunikaty */
.toast { border-radius: 12px; }

/* Cienkie paski przewijania */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent; }

/* Logowanie i rejestracja */
body.auth {
    background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--primary) 25%, transparent), transparent),
                radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, #16a34a 18%, transparent), transparent), var(--bg);
}
.auth-card { border-radius: 18px; box-shadow: 0 24px 60px #10182826; padding: 2.2rem; }
.auth-card .brand { display: flex; align-items: center; gap: .5rem; font-size: 1.35rem; letter-spacing: -.02em; }
.auth-card .brand-mark { background: var(--primary); color: #fff; }
.auth-tagline { color: var(--muted); font-size: .88rem; margin: .2rem 0 1.3rem; }

/* Strona publiczna (QR) */
.pub-card { border-radius: 16px; box-shadow: var(--shadow-md); }
.card-actions .icon-only { padding: .35rem .6rem; font-size: 1rem; line-height: 1; }
.card-actions { flex-wrap: nowrap; gap: .35rem; }
.card-actions button { padding: .38rem .6rem; font-size: .84rem; white-space: nowrap; }
.card-actions .icon-only { margin-left: auto; }

/* ---------- Dane przykładowe ---------- */
.ob-alt { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; border-top: 1px solid var(--border); margin-top: .4rem; padding-top: .55rem; }
.ob-alt .muted { width: 100%; }
.ob-demo {
    display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem; margin-top: .5rem; padding: .5rem .6rem; border-radius: 8px;
    background: color-mix(in srgb, #9333ea 10%, var(--panel)); font-size: .82rem;
}
.ob-demo .grow { flex: 1 1 calc(100% - 2rem); }
.ob-demo button { margin-left: auto; }
.onboard.only-demo { padding: .3rem .4rem; }
.onboard.only-demo .ob-demo { margin: 0; }
.chip.demo-chip { background: color-mix(in srgb, #9333ea 14%, var(--panel)); color: #7e22ce; font-size: .7rem; }
:root.theme-dark .chip.demo-chip { color: #d8b4fe; }
@media (prefers-color-scheme: dark) { :root:not(.theme-light) .chip.demo-chip { color: #d8b4fe; } }

/* ---------- Edycja wprost w karcie ---------- */
.inline-pen {
    background: none; border: none; padding: .05rem .3rem; color: var(--muted); cursor: pointer; font-size: .85rem;
    border-radius: 6px; flex: none;
}
.inline-pen:hover { background: var(--hover); color: var(--text); }
.cb-line { display: flex; align-items: center; gap: .2rem; min-width: 0; }
.inline-row { display: flex; align-items: center; gap: .45rem; font-size: .88rem; margin: 0 0 .7rem; }
.card-desc-wrap { display: flex; align-items: flex-start; gap: .3rem; }
.card-desc-wrap .card-desc { flex: 1; }
.inline-edit {
    border: 1px solid var(--primary); border-radius: 10px; padding: .6rem .7rem; margin: 0 0 .8rem;
    background: color-mix(in srgb, var(--primary) 5%, var(--panel));
}
.inline-edit label { display: block; font-size: .82rem; color: var(--muted); }
.inline-edit select, .inline-edit textarea { margin: .25rem 0 .45rem; }
.inline-edit .row-gap { flex-wrap: wrap; margin: 0; }
.rep-status { margin-top: .3rem; }
.rep-status a { color: var(--link); }

/* ---------- Tabela: zaznaczanie i operacje zbiorcze ---------- */
.data-table .t-check { width: 2.2rem; padding-right: 0; cursor: default; }
.data-table .t-check input { width: 1rem; height: 1rem; cursor: pointer; margin: 0; }
.data-table tbody tr.checked { background: color-mix(in srgb, var(--primary) 8%, var(--panel)); }
.bulk-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: 0 0 .6rem; padding: .5rem .7rem;
    border-radius: 12px; background: color-mix(in srgb, var(--primary) 10%, var(--panel)); border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
    font-size: .86rem;
}
.bulk-bar select { width: auto; max-width: 13rem; padding: .3rem .45rem; }
.bulk-bar .file-btn { border-style: solid; background: var(--panel); padding: .3rem .7rem; }
.bulk-bar .spacer { flex: 1; }
.bulk-bar button { padding: .3rem .7rem; }

/* ---------- Import z pliku ---------- */
.file-drop {
    display: flex !important; align-items: center; justify-content: center; min-height: 7rem; margin: .8rem 0 !important;
    border: 2px dashed var(--border); border-radius: 12px; cursor: pointer; text-align: center; padding: 1rem;
}
.file-drop:hover, .file-drop.over { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--panel)); }
.import-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .1rem .7rem; }
.import-map label { margin: 0 0 .35rem !important; font-size: .8rem !important; color: var(--muted); }
.import-map label.mapped { color: var(--text); font-weight: 500; }
.import-map select { padding: .3rem .4rem; font-weight: 400; }
.import-preview { max-height: 14rem; overflow: auto; }
.import-preview .data-table td { white-space: nowrap; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; cursor: default; }
.import-bar { height: 8px; margin: .6rem 0; }
.import-errors { max-height: 12rem; overflow: auto; font-size: .84rem; padding-left: 1.2rem; }
.error-text { color: var(--danger); }
.labels-btn + .labels-btn { margin-top: .4rem; }
button.file-btn { background: none; font: inherit; color: inherit; text-align: center; width: 100%; }

/* ---------- Strona publiczna: historia i status zgłoszenia ---------- */
.pub-sub { font-size: .9rem; margin: 1rem 0 .4rem; }
.pub-history { list-style: none; margin: 0; padding: 0; }
.pub-history li { display: flex; flex-wrap: wrap; gap: .1rem .6rem; padding: .4rem 0; border-top: 1px solid var(--border); font-size: .9rem; }
.pub-history small { width: 100%; }
.pub-known { background: color-mix(in srgb, var(--soon) 15%, var(--panel)); border-radius: 8px; padding: .55rem .75rem; font-size: .88rem; }
.pub-tracked { border: 2px solid var(--primary); }
.pub-desc { background: var(--hover); border-radius: 8px; padding: .5rem .7rem; font-size: .88rem; }
.pub-steps { list-style: none; display: flex; margin: .4rem 0 .8rem; padding: 0; }
.pub-steps li { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; font-size: .78rem; color: var(--muted); }
.pub-steps li span {
    width: 1.3rem; height: 1.3rem; border-radius: 50%; border: 2px solid var(--border); background: var(--panel); z-index: 1; margin-bottom: .25rem;
}
.pub-steps li::before { content: ''; position: absolute; top: .6rem; left: -50%; right: 50%; height: 2px; background: var(--border); }
.pub-steps li:first-child::before { display: none; }
.pub-steps li.done, .pub-steps li.current { color: var(--text); }
.pub-steps li.done span { background: var(--ok); border-color: var(--ok); }
.pub-steps li.done::before, .pub-steps li.current::before { background: var(--ok); }
.pub-steps li.current span { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 25%, transparent); }
.pub-steps small { color: var(--muted); }
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub-list li { display: flex; justify-content: space-between; gap: .5rem; padding: .35rem 0; border-top: 1px solid var(--border); }
.pub-list a { color: var(--link); }
.pub-status { font-size: .78rem; padding: .1rem .5rem; border-radius: 999px; background: var(--hover); white-space: nowrap; align-self: flex-start; flex: none; }
.pub-status.s-done { background: #dcfce7; color: #166534; }
.pub-status.s-in_progress { background: #ede9fe; color: #5b21b6; }
.pub-status.s-new { background: #dbeafe; color: #1e3a8a; }

/* ---------- Kalendarz na telefonie: lista dni ---------- */
.cal-grid.cal-agenda { display: block; padding: .3rem .6rem .6rem; overflow: auto; }
.ag-day h4 { margin: .8rem 0 .35rem; font-size: .85rem; color: var(--muted); }
.ag-day.today h4 { color: var(--primary); }
.ag-overdue h4 { color: var(--overdue); }
.ag-item { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; margin-bottom: .3rem; font-size: .9rem; white-space: normal; }
.ag-item small { display: block !important; font-size: .78rem; color: var(--muted); }
.ag-icon { font-size: 1.1rem; flex: none; }
.ag-late { color: var(--overdue); white-space: nowrap; font-weight: 600; }

/* ---------- Plan dnia ---------- */
.plan-panel {
    right: auto; left: .6rem; bottom: .6rem; width: min(430px, calc(100% - 1.2rem)); padding: .9rem 1rem;
    border-radius: 14px; box-shadow: var(--shadow-md, 0 6px 20px #0003); background: var(--panel); overflow: auto; display: block;
}
.map-area.view-plan :is(.legend, .map-hint) { display: none !important; }
.plan-head { display: flex; align-items: center; gap: .6rem; }
.plan-head h3 { margin: 0; font-size: 1.15rem; }
.plan-summary { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin: .7rem 0 .5rem; font-size: .86rem; }
.plan-summary:empty { display: none; }
.plan-actions { display: flex; flex-wrap: wrap; gap: .3rem; }
.plan-actions a.small-btn { text-decoration: none; border-radius: 6px; display: inline-flex; align-items: center; }
.plan-actions a.primary { background: var(--primary); color: var(--primary-text); }
.plan-list { list-style: none; margin: 0; padding: 0; }
.plan-stop {
    display: flex; align-items: flex-start; gap: .6rem; padding: .55rem .5rem; border-radius: 10px; border: 1px solid var(--border);
    margin-bottom: .35rem; background: var(--panel);
}
.plan-stop.st-overdue { border-left: 4px solid var(--overdue); }
.plan-stop.st-soon { border-left: 4px solid var(--soon); }
.plan-stop.is-order { border-left: 4px solid #6d28d9; }
.plan-stop.done { opacity: .55; }
.plan-stop.done b { text-decoration: line-through; }
.plan-num {
    flex: none; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--primary); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; margin-top: .1rem;
}
.plan-stop.done .plan-num { background: var(--ok); }
.plan-main { cursor: pointer; min-width: 0; }
.plan-main b, .plan-cand b { display: block; font-size: .92rem; }
.plan-main small, .plan-cand small { display: block; font-size: .78rem; line-height: 1.35; }
.plan-addr { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-btns { display: flex; align-items: center; gap: .1rem; flex-wrap: wrap; justify-content: flex-end; max-width: 9.5rem; }
.plan-btns .icon-btn { padding: .2rem .35rem; text-decoration: none; color: inherit; font-size: .9rem; }
.plan-move { display: inline-flex; flex-direction: column; }
.plan-move .icon-btn { font-size: .6rem; padding: 0 .3rem; line-height: 1.2; color: var(--muted); }
.plan-stop:first-child .plan-move [data-plan="up"], .plan-stop:last-child .plan-move [data-plan="down"] { visibility: hidden; }
.plan-empty { list-style: none; padding: 1rem; border: 1px dashed var(--border); border-radius: 10px; font-size: .9rem; }
.plan-add { margin-top: 1rem; }
.plan-group { margin-bottom: .7rem; }
.plan-group-head { display: flex; justify-content: space-between; align-items: baseline; font-size: .78rem; font-weight: 600; color: var(--muted); margin-bottom: .25rem; }
.plan-group-head .link { font-size: .78rem; }
.plan-cand { display: flex; align-items: center; gap: .5rem; padding: .35rem .3rem; border-radius: 8px; }
.plan-cand:hover { background: var(--hover); }
.plan-cand .grow { cursor: pointer; }
.plan-plus {
    flex: none; width: 1.8rem; height: 1.8rem; border-radius: 50%; padding: 0; font-size: 1rem; line-height: 1;
    border: 1px solid var(--primary); color: var(--primary); background: var(--panel);
}
.plan-plus:hover { background: var(--primary); color: #fff; }
.plan-pin {
    display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%;
    background: #1d4ed8; color: #fff; font-weight: 700; font-size: .8rem; border: 2px solid #fff; box-shadow: 0 2px 6px #0006;
}
.plan-pin-wrap { background: none; border: none; }
@media (max-width: 700px) {
    .plan-panel { left: 0; right: 0; bottom: 0; width: auto; top: 46%; border-radius: 16px 16px 0 0; }
    .map-area.view-plan .onboard { display: none; }
}

/* Wydruk planu dnia */
@media print {
    body.printing-plan { display: block; height: auto; background: #fff; }
    body.printing-plan > :not(main), body.printing-plan main > :not(.map-area), body.printing-plan .map-area > :not(#planView),
    body.printing-plan .plan-add, body.printing-plan .plan-btns, body.printing-plan .plan-actions, body.printing-plan #planPrint { display: none !important; }
    body.printing-plan main, body.printing-plan .map-area { display: block; position: static; }
    body.printing-plan #planView { position: static; width: auto; box-shadow: none; padding: 0 12mm; overflow: visible; }
    body.printing-plan .plan-stop { break-inside: avoid; opacity: 1; }
}

/* ---------- Pulpit ---------- */
:root { --c-done: #1d4ed8; --c-over: #dc2626; --c-due: #3b9cf0; --good: #15803d; --warn: #b45309; --bad: #b91c1c; }
:root.theme-dark { --c-done: #4f8ef7; --c-over: #ef4444; --c-due: #1a9bd7; --good: #4ade80; --warn: #fbbf24; --bad: #f87171; }
@media (prefers-color-scheme: dark) {
    :root:not(.theme-light) { --c-done: #4f8ef7; --c-over: #ef4444; --c-due: #1a9bd7; --good: #4ade80; --warn: #fbbf24; --bad: #f87171; }
}
.map-area.view-dash { background: var(--bg); }
.map-area.view-dash :is(.legend, .onboard, .map-hint, .place-banner, .leaflet-control-container) { display: none !important; }
.map-area.view-dash::before { content: ''; position: absolute; inset: 0; background: var(--bg); z-index: 600; }
/* Na pulpicie filtr statusu i dodawanie punktu nie mają znaczenia; zostają filtry klienta, typu, serwisanta i „Moje” */
.map-area.view-dash .map-bar :is(#filters, .add-point-btn, .addr-search) { display: none; }
.dash-panel { overflow: auto; display: block; }
.dash-body { max-width: 1200px; margin: 0 auto; padding-bottom: 1rem; }
.dash-head { display: flex; align-items: center; gap: .6rem; margin: .1rem 0 .7rem; }
.dash-head h3 { margin: 0; font-size: 1.25rem; }
.dash-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem; margin-bottom: .6rem; }
.dash-tile, .dash-stat {
    display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; text-align: left;
    padding: .8rem .95rem; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--border);
    box-shadow: var(--shadow-sm); border-left: 4px solid var(--border);
}
.dash-tile { cursor: pointer; }
.dash-tile:hover { box-shadow: var(--shadow-md); background: var(--panel); border-color: var(--primary); border-left-color: inherit; }
.dt-label { font-size: .8rem; color: var(--muted); font-weight: 500; }
.dt-value { font-size: 1.9rem; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; }
.dt-sub { font-size: .78rem; color: var(--muted); }
.dash-tile.is-bad { border-left-color: var(--overdue); }
.dash-tile.is-bad .dt-value { color: var(--overdue); }
.dash-tile.is-warn { border-left-color: var(--soon); }
.dash-tile.is-orders { border-left-color: #6d28d9; }
.dash-tile.is-zero .dt-value { color: var(--muted); }
.dash-tile.is-muted { border-left-color: #9ca3af; }
.dash-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .6rem; margin-bottom: .9rem; }
.dash-stat { border-left-width: 1px; }
.dash-stat .dt-value { font-size: 1.5rem; }
.dash-stat.good .dt-value { color: var(--good); }
.dash-stat.warn .dt-value { color: var(--warn); }
.dash-stat.bad .dt-value { color: var(--bad); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: .8rem; margin-bottom: .8rem; }
.dash-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: .85rem 1rem; }
.dash-card h4 { margin: 0 0 .7rem; font-size: .95rem; display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.dash-card h4 .link { margin-left: auto; font-size: .8rem; }
.dash-empty { text-align: center; padding: 3rem 1rem; }

/* Wykres słupkowy (HTML): wykonane / zaległe / zaplanowane */
.dash-chart { position: relative; height: 220px; margin: .3rem 0 0 1.8rem; }
.dc-grid { position: absolute; inset: 0 0 1.4rem 0; pointer-events: none; }
.dc-grid span { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); }
.dc-grid span:first-child { border-top-color: var(--muted); }
.dc-grid em { position: absolute; right: calc(100% + .4rem); top: -.55em; font-style: normal; font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.dc-cols { position: absolute; inset: 0; display: flex; gap: 2px; }
.dc-col { flex: 1; display: flex; flex-direction: column; align-items: center; cursor: default; outline: none; border-radius: 6px; }
.dc-col.hover, .dc-col:focus-visible { background: color-mix(in srgb, var(--primary) 7%, transparent); }
.dc-stack { position: relative; flex: 1; width: 100%; display: flex; flex-direction: column-reverse; align-items: center; gap: 2px; padding-bottom: 0; }
.dc-stack i { display: block; width: min(60%, 34px); min-height: 2px; }
.dc-stack i:last-of-type { border-radius: 4px 4px 0 0; }
.dc-done { background: var(--c-done); }
.dc-over { background: var(--c-over); }
.dc-due { background: repeating-linear-gradient(135deg, var(--c-due) 0 4px, color-mix(in srgb, var(--c-due) 55%, var(--panel)) 4px 7px); }
.dc-val { position: absolute; transform: translateY(-.2rem); font-size: .75rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.dc-x { height: 1.4rem; line-height: 1.4rem; font-size: .72rem; color: var(--muted); white-space: nowrap; }
.dc-col.now .dc-x b { color: var(--text); }
.dc-tip {
    position: absolute; top: -.4rem; transform: translate(-50%, -100%); z-index: 5; pointer-events: none;
    background: var(--text); color: var(--panel); border-radius: 8px; padding: .4rem .6rem; font-size: .78rem;
    display: flex; flex-direction: column; white-space: nowrap; box-shadow: var(--shadow-md);
}
.dc-tip[hidden] { display: none; }
.dc-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .78rem; color: var(--muted); margin-top: .5rem; }
.dc-legend i { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }

.dash-late li { display: flex; align-items: center; gap: .6rem; padding: .5rem .3rem; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 6px; }
.dash-late li:last-child { border-bottom: none; }
.dash-late li:hover { background: var(--hover); }
.dash-late small { display: block; color: var(--muted); font-size: .78rem; }
.dl-icon { font-size: 1.15rem; flex: none; }
.dl-late { text-align: right; color: var(--overdue); font-weight: 600; white-space: nowrap; font-size: .9rem; }
.dl-late small { font-weight: 400; }
.dash-team { box-shadow: none; border: 1px solid var(--border); }
.dash-team td:not(:first-child), .dash-team th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.dash-team td.dt-bad { color: var(--overdue); font-weight: 600; }
.dash-team td.dt-zero { color: var(--muted); }

@media (max-width: 900px) {
    .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .dash-tiles { grid-template-columns: 1fr 1fr; gap: .45rem; }
    .dash-stats { grid-template-columns: 1fr 1fr; gap: .45rem; }
    .dash-tile, .dash-stat { padding: .6rem .7rem; }
    .dt-value { font-size: 1.5rem; }
    .dash-stat .dt-value { font-size: 1.2rem; }
    .dash-chart { height: 180px; margin-left: 1.5rem; }
    .dc-x { font-size: .62rem; }
    .dash-team th:nth-child(2), .dash-team td:nth-child(2) { display: none; }
}

/* ---------- Przewodnik (tour.js) ---------- */
.tour-block { position: fixed; inset: 0; z-index: 3990; }
.tour-spot {
    position: fixed; z-index: 3991; border-radius: 10px; pointer-events: none;
    box-shadow: 0 0 0 3px var(--primary), 0 0 0 9999px #0f172a8c;
    transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease;
}
.tour-pop {
    position: fixed; z-index: 3992; width: min(340px, calc(100vw - 20px)); background: var(--panel); color: var(--text);
    border-radius: 12px; box-shadow: var(--shadow-md), 0 10px 30px #0004; padding: .85rem 1rem .75rem; font-size: .9rem; line-height: 1.45;
    transition: left .25s ease, top .25s ease;
}
.tour-pop::before {
    content: ''; position: absolute; left: var(--arrow, -100px); width: 12px; height: 12px; background: var(--panel);
    transform: translateX(-50%) rotate(45deg); display: none;
}
.tour-pop.below::before { display: block; top: -6px; }
.tour-pop.above::before { display: block; bottom: -6px; }
.tp-head { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .35rem; }
.tp-head b { flex: 1; font-size: 1rem; }
.tp-text kbd { font-size: .78rem; }
.tp-btns { display: flex; align-items: center; gap: .4rem; margin-top: .8rem; flex-wrap: wrap; }
.tp-btns .spacer { flex: 1; }
.tp-btns .link { padding: 0; color: var(--muted); }
.ob-toggle { flex: 1; display: flex; align-items: center; gap: .4rem; background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.ob-caret { color: var(--muted); font-size: .8rem; margin-left: auto; }
.onboard.collapsed .ob-bar { margin: .35rem 0 .3rem; }
.ob-next { font-size: .85rem; }
.ob-tour { margin-top: .35rem; padding-top: .4rem; border-top: 1px solid var(--border); font-size: .82rem; }
@media (prefers-reduced-motion: reduce) { .tour-spot, .tour-pop { transition: none; } }
.tour-pop.welcome { width: min(420px, calc(100vw - 20px)); padding: 1.1rem 1.2rem 1rem; }
.tour-pop.welcome .tp-head b { font-size: 1.15rem; }

/* ---------- Szybkie przyjęcie zgłoszenia ---------- */
.topbar .intake-btn { background: #ffffff1f; border-color: #ffffff33; font-weight: 600; }
.topbar .intake-btn:hover { background: #ffffff33; }
#tab-orders .range { display: flex; gap: .5rem; align-items: center; }
#tab-orders .range select { flex: 1; }
dialog.intake { width: min(620px, 96vw); }
.intake h3 { margin-top: 0; }
.ik-label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin: .7rem 0 .3rem; }
.ik-who .ik-label { margin-top: 0; }
#intakeSearch { font-size: 1rem; padding: .6rem .7rem; }
.ik-results { list-style: none; margin: .4rem 0 0; padding: 0; max-height: 300px; overflow: auto; }
.ik-results li button, .ik-dev {
    display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left; padding: .5rem .6rem;
    border: 1px solid transparent; border-radius: 8px; background: none;
}
.ik-results li button:hover, .ik-results li button:focus-visible { background: var(--hover); border-color: var(--border); }
.ik-results small, .ik-dev small, .ik-cust small { display: block; color: var(--muted); font-size: .78rem; }
.ik-empty { padding: .6rem; }
.ik-ic { font-size: 1.2rem; flex: none; width: 1.6rem; text-align: center; }
.ik-cust { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: 10px; background: var(--hover); }
.ik-devs { display: flex; flex-direction: column; gap: .3rem; }
.ik-dev { border-color: var(--border); }
.ik-dev:hover { border-color: var(--primary); background: var(--panel); }
.ik-dev.active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--panel)); box-shadow: inset 3px 0 0 var(--primary); }
.ik-ord { white-space: nowrap; }
.ik-none { margin: .6rem 0 0; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.ik-details { border-top: 1px solid var(--border); margin-top: .9rem; padding-top: .2rem; }
.ik-details textarea { margin-top: .4rem; }
.ik-warn { margin-top: .7rem; padding: .5rem .7rem; border-radius: 8px; font-size: .85rem;
    background: color-mix(in srgb, var(--soon) 16%, var(--panel)); border: 1px solid color-mix(in srgb, var(--soon) 45%, transparent); }
.ik-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .45rem; }
.ik-chips .chip { font-size: .8rem; padding: .25rem .65rem; border: 1px solid var(--border); background: var(--panel); cursor: pointer; }
.ik-chips .chip:hover { border-color: var(--primary); }
.ik-chips .chip.active { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.ik-row { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem 1rem; }
.ik-row > label { margin-top: .7rem; }
.ik-seg { display: flex; width: 100%; }
.ik-seg button { flex: 1; padding: .4rem .3rem; font-size: .82rem; white-space: nowrap; }
.ik-seg button.active { background: var(--primary); color: var(--primary-text); }
.ik-date { margin-top: .35rem; }
.ik-techs { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .4rem; }
.ik-tech { text-align: left; padding: .5rem .6rem; border-radius: 8px; }
.ik-tech small { display: block; color: var(--muted); font-size: .76rem; margin-top: .1rem; }
.ik-tech.active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--panel)); box-shadow: inset 0 0 0 1px var(--primary); }
.ik-best { font-size: .68rem; padding: 0 .35rem; border-radius: 1em; background: color-mix(in srgb, var(--ok) 18%, var(--panel)); color: var(--ok); font-weight: 600; }
.ik-nobody b { font-weight: 500; }
@media (max-width: 640px) {
    .ik-row { grid-template-columns: 1fr; }
    .ik-hint { display: none; }
    .topbar .intake-btn { background: transparent; border-color: transparent; }
}

/* ---------- Telefon: dolny pasek nawigacji i arkusz „Więcej” ---------- */
.bottom-nav { display: none; }
dialog.sheet { display: none; }
@media (max-width: 700px) {
    /* Górny pasek: tylko panel, logo i powiadomienia; reszta w dolnym pasku i w „Więcej” */
    .topbar :is(.view-switch, .acct, #intakeBtn, .plan) { display: none; }
    .topbar .brand-name { display: inline; }
    .bottom-nav {
        display: flex; align-items: stretch; background: var(--panel); border-top: 1px solid var(--border);
        padding-bottom: env(safe-area-inset-bottom); z-index: 1001; box-shadow: 0 -2px 10px #0000000f;
    }
    .bottom-nav button {
        flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem;
        background: none; border: none; border-radius: 0; padding: .4rem .1rem .45rem; font-size: 1.15rem; line-height: 1.1;
        color: var(--muted); min-height: 3.4rem; position: relative;
    }
    .bottom-nav button span { font-size: .66rem; font-weight: 500; }
    .bottom-nav button.active { color: var(--primary); }
    .bottom-nav button.active span { font-weight: 700; }
    .bottom-nav button.active::before {
        content: ''; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary);
    }
    .bottom-nav .bn-main i {
        font-style: normal; display: grid; place-items: center; width: 2.7rem; height: 2.7rem; margin-top: -1.1rem;
        border-radius: 50%; background: var(--primary); color: #fff; font-size: 1.15rem; box-shadow: 0 4px 12px #1d4ed855;
        border: 3px solid var(--panel);
    }
    .bottom-nav .bn-main span { color: var(--text); }
    .toasts { bottom: 4.4rem; }

    dialog.sheet[open] {
        display: block; margin: auto 0 0; width: 100%; max-width: 100%; border-radius: 18px 18px 0 0;
        padding: .4rem 1rem calc(1rem + env(safe-area-inset-bottom)); animation: sheet-up .18s ease-out;
    }
    @keyframes sheet-up { from { transform: translateY(40%); opacity: .4; } }
    .sheet-grip { width: 2.6rem; height: 5px; border-radius: 3px; background: var(--border); margin: .3rem auto .8rem; cursor: pointer; }
    .sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
    .sheet-grid button {
        display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .8rem .3rem; font-size: 1.3rem;
        border-radius: 12px; background: var(--bg);
    }
    .sheet-grid button span { font-size: .8rem; font-weight: 500; }
    .sheet-foot { text-align: center; margin: .9rem 0 0; }
}
@media (prefers-reduced-motion: reduce) { dialog.sheet[open] { animation: none; } }

/* ---------- Plan dnia: osoba, dzień, wysyłanie, zaznaczanie obszaru ---------- */
.plan-pick { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .6rem; }
.plan-pick select { width: auto; flex: 1 1 160px; min-width: 0; font-weight: 600; }
.plan-pick .plan-day button { padding: .35rem .7rem; font-size: .85rem; }
.plan-pick .plan-day button.active { background: var(--primary); color: var(--primary-text); }
.plan-pick input[type=date] { width: auto; flex: 0 1 150px; padding: .35rem .5rem; font-size: .85rem; }
.plan-panel.for-other { box-shadow: var(--shadow-md, 0 6px 20px #0003), inset 0 3px 0 #7c3aed; }
.plan-meta {
    display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .55rem; padding: .45rem .6rem; border-radius: 8px;
    background: color-mix(in srgb, #7c3aed 9%, var(--panel)); font-size: .84rem;
}
.plan-meta[hidden] { display: none; }
.plan-add h4 { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.plan-lasso-btn { margin-left: auto; font-size: .8rem; }
.plan-all { font-size: .8rem; margin: -.2rem 0 .5rem; }
.leaflet-container.lasso-mode { cursor: crosshair !important; touch-action: none; }
.leaflet-container.lasso-mode .leaflet-marker-icon, .leaflet-container.lasso-mode .leaflet-interactive { pointer-events: none; }
@media print {
    body.printing-plan :is(.plan-pick, .plan-meta button, .plan-lasso-btn, .plan-all) { display: none !important; }
}
@media (max-width: 700px) {
    .sheet-grid [data-more="logout"] { grid-column: 1 / -1; flex-direction: row; justify-content: center; padding: .6rem; font-size: 1.05rem; }
}
.dash-plan { font-weight: 600; text-decoration: none; }
.dash-plan.all-done { color: var(--ok); }

/* Górny pasek na komputerze: bez łamania napisów; przy węższym oknie część przycisków tylko z ikoną */
.view-switch button, .topbar .icon-btn { white-space: nowrap; }
@media (max-width: 1500px) and (min-width: 701px) {
    .topbar .brand small { display: none; }
}
@media (max-width: 1180px) and (min-width: 701px) {
    .view-switch button span, .topbar #drawerBtn span, .topbar .plan-long, .topbar .acct-name { display: none; }
    .view-switch button { padding: .3rem .55rem; font-size: 1rem; }
}

/* ---------- Notatka „Na miejscu” ---------- */
.site-note {
    display: flex; align-items: flex-start; gap: .5rem; margin: 0 0 .7rem; padding: .55rem .7rem; border-radius: 10px;
    background: color-mix(in srgb, #f59e0b 14%, var(--panel)); border: 1px solid color-mix(in srgb, #f59e0b 40%, transparent);
    font-size: .9rem;
}
.site-note p { margin: 0; flex: 1; white-space: pre-wrap; }
.site-note .sn-icon { flex: none; }
.site-note-add { margin: 0 0 .6rem; }
.site-note-edit textarea { margin-top: .25rem; }
.plan-note { display: block; color: #92400e; background: color-mix(in srgb, #f59e0b 12%, transparent); border-radius: 5px; padding: 0 .3rem; margin-top: .15rem; }
:root.theme-dark .plan-note { color: #fcd34d; }
@media (prefers-color-scheme: dark) { :root:not(.theme-light) .plan-note { color: #fcd34d; } }

/* ---------- Wizyty ---------- */
.visit-badge {
    display: inline-block; font-size: .74rem; font-weight: 600; padding: .05rem .45rem; border-radius: 1em; white-space: nowrap;
    vertical-align: middle; cursor: default;
}
.visit-badge.ok { background: color-mix(in srgb, var(--ok) 16%, var(--panel)); color: var(--ok); }
.visit-badge.wait { background: color-mix(in srgb, var(--primary) 12%, var(--panel)); color: var(--primary); }
.visit-badge[data-visit] { cursor: pointer; }
.visit-dialog { width: min(480px, 96vw); }
.vd-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.vd-quick { display: flex; flex-wrap: wrap; gap: .3rem; margin: .45rem 0; }
.vd-quick button { padding: .25rem .6rem; font-size: .8rem; border-radius: 1em; }
.vd-quick button.active { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.vd-sms { margin-top: .8rem; padding: .7rem; border-radius: 10px; background: var(--hover); }
.vd-sms-head { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: .35rem; font-size: .88rem; }
.vd-sms textarea { font-size: .88rem; }
.vd-sms .row-gap { margin-top: .4rem; }
.vd-sms a.file-btn { text-decoration: none; display: inline-flex; align-items: center; }
.vd-sms a[hidden] { display: none; }
.visit-time { font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }
.visit-time.ok { color: var(--ok); }
.cal-item.ci-visit { box-shadow: inset 3px 0 0 var(--primary); }

/* ---------- Kilka urządzeń w jednym miejscu ---------- */
.stack-popup .leaflet-popup-content { margin: .6rem .7rem; }
.stack-pop { display: flex; flex-direction: column; gap: .3rem; min-width: 220px; font-size: .88rem; }
.stack-pop > b { font-size: .8rem; color: var(--muted); font-weight: 600; }
.stack-pop button { display: flex; align-items: center; gap: .5rem; text-align: left; padding: .4rem .5rem; border-radius: 8px; }
.stack-pop button small { display: block; color: var(--muted); font-size: .74rem; }
.visit-dialog label.chk { display: flex; align-items: center; gap: .5rem; margin: .5rem 0 0; font-weight: 500; }
.visit-dialog label.chk input { width: auto; margin: 0; }
.vd-sms textarea { min-height: 6.5rem; }

/* Karta: luźniejszy wiersz przeglądu i sekcje informacji */
.card-sched li { align-items: flex-start; gap: .7rem; padding: .65rem .3rem; }
.card-sched li > .st-icon, .card-sched li > .done-btn { margin-top: .1rem; flex: none; }
.cs-main { min-width: 0; gap: .2rem; }
.cs-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .5rem; }
.cs-name b { font-size: .95rem; }
.cs-acts { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .35rem; margin-top: .1rem; }
.cs-acts .link { padding: 0; font-size: .8rem; color: var(--link); text-decoration: none; }
.cs-acts .link:hover { text-decoration: underline; }
.cs-dot { color: var(--muted); font-size: .8rem; }
.card-sched .sched-date { flex: none; text-align: right; white-space: nowrap; font-size: .88rem; line-height: 1.25; margin-top: .1rem; }
.card-sched .sched-date small { display: block; }
#cardBody > .inline-row, #cardBody > p.small, #cardBody > .site-note-add { margin-bottom: .85rem; line-height: 1.45; }
.inline-row { gap: .5rem; }
.inline-pen { margin-left: .15rem; }

/* ---------- Pasek filtrów: przycisk „Filtry”, okienko, etykiety włączonych filtrów ---------- */
.filters-btn {
    background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: .4rem .7rem; font-size: .88rem;
    box-shadow: var(--shadow-sm); white-space: nowrap;
}
.filters-btn.active { border-color: var(--primary); color: var(--primary); font-weight: 600; }
.filters-btn b { display: inline-block; min-width: 1.3em; margin-left: .2rem; padding: 0 .3em; border-radius: 1em; background: var(--primary); color: #fff; font-size: .75rem; text-align: center; }
.filters-btn b[hidden] { display: none; }
.active-chips { display: flex; gap: .3rem; align-items: center; flex-wrap: nowrap; }
.active-chips:empty { display: none; }
.fchip {
    display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .55rem; border-radius: 1em; font-size: .8rem; white-space: nowrap;
    background: color-mix(in srgb, var(--primary) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
    color: var(--text); box-shadow: var(--shadow-sm);
}
.fchip span { color: var(--muted); font-size: .75rem; }
.fchip:hover span { color: var(--danger); }
.fchip-all { font-size: .8rem; white-space: nowrap; background: var(--panel); border-radius: 6px; padding: .25rem .4rem; }
.filters-pop {
    position: fixed; z-index: 1200; width: 260px; display: flex; flex-direction: column; gap: .7rem; padding: .9rem 1rem;
    background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md), 0 10px 30px #0002;
}
.filters-pop[hidden] { display: none; }
.filters-pop .toggle { box-shadow: none; border: none; padding: 0; background: none; font-weight: 500; }
.fp-label { display: flex; flex-direction: column; gap: .25rem; font-size: .8rem; color: var(--muted); font-weight: 600; }
.fp-label[hidden] { display: none; }
.fp-label select { color: var(--text); font-weight: 400; font-size: .9rem; }
#filtersClear { align-self: flex-start; padding: 0; font-size: .82rem; }
#filtersClear[hidden] { display: none; }
.filters-pop .type-filter { width: 100%; max-width: none; box-shadow: none; border: 1px solid var(--border); padding: .45rem .5rem; }
.filters-pop .type-filter.active { background: var(--panel); color: var(--text); border-color: var(--primary); }

/* ---------- Pulpit: „Wymaga uwagi” ---------- */
.dash-att {
    background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--soon); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: .8rem 1rem; margin-bottom: .8rem;
}
.dash-att.ok { border-left-color: var(--ok); font-size: .9rem; }
.dash-att h4 { margin: 0 0 .5rem; font-size: 1rem; display: flex; align-items: center; gap: .5rem; }
.att-count { background: var(--soon); color: #111; border-radius: 1em; padding: 0 .5rem; font-size: .8rem; }
.att-list { list-style: none; margin: 0; padding: 0; }
.att-list li { display: flex; align-items: center; gap: .7rem; padding: .5rem .2rem; border-top: 1px solid var(--border); }
.att-list li:first-child { border-top: none; }
.att-icon { font-size: 1.1rem; flex: none; width: 1.5rem; text-align: center; }
.att-text { font-size: .9rem; line-height: 1.35; }
.att-list small { display: block; font-size: .78rem; margin-top: .1rem; }
.att-btns { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; flex: none; }
.att-btns a.small-btn { text-decoration: none; border: 1px solid var(--border); border-radius: 6px; display: inline-flex; align-items: center; color: var(--text); }
.dash-att > .link { margin-top: .4rem; font-size: .82rem; }
.nav-badge {
    display: inline-block; min-width: 1.15rem; padding: 0 .28rem; margin-left: .3rem; border-radius: 1em; font-size: .68rem; line-height: 1.15rem;
    background: var(--soon); color: #111; font-weight: 700; text-align: center; vertical-align: 1px;
}
.nav-badge[hidden] { display: none; }
.bottom-nav .nav-badge { position: absolute; top: .25rem; left: calc(50% + .35rem); margin: 0; }
@media (max-width: 640px) {
    .att-list li { flex-wrap: wrap; }
    .att-btns { width: 100%; justify-content: flex-start; padding-left: 2.2rem; }
}
.pub-visit { margin: .4rem 0 .8rem; padding: .55rem .75rem; border-radius: 10px; background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; }
:root.theme-dark .pub-visit { background: #1e3a8a33; border-color: #1e40af; color: #bfdbfe; }
@media (prefers-color-scheme: dark) { :root:not(.theme-light) .pub-visit { background: #1e3a8a33; border-color: #1e40af; color: #bfdbfe; } }

/* ---------- Menu konta w górnym pasku (zamiast osobnych ikon zespołu, pomocy i wylogowania) ---------- */
.acct-btn { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .5rem .25rem .3rem; }
.acct-btn.active { background: #ffffff26; }
.acct-av {
    width: 1.7rem; height: 1.7rem; border-radius: 50%; background: #ffffff2e; display: inline-flex;
    align-items: center; justify-content: center; font-weight: 700; font-size: .85rem;
}
.acct-name { font-size: .9rem; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }
.acct-caret { font-style: normal; font-size: .7rem; opacity: .75; }
.acct-menu {
    position: fixed; top: 3.2rem; right: .8rem; z-index: 1500; width: 260px; background: var(--panel); color: var(--text);
    border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 20px 50px #0004; padding: .35rem; animation: pop-in .12s ease-out;
}
.acct-menu[hidden] { display: none; }
.am-head { display: flex; flex-direction: column; padding: .5rem .6rem .6rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; }
.am-head small { color: var(--muted); font-size: .8rem; }
.am-head .am-plan { margin-top: .3rem; color: var(--primary); }
.am-head .am-plan.bad { color: var(--overdue); }
.acct-menu [role=menuitem] {
    display: flex; align-items: center; gap: .55rem; width: 100%; text-align: left; background: none; border: 0;
    padding: .5rem .6rem; border-radius: 8px; color: inherit; font-size: .92rem;
}
.acct-menu [role=menuitem] span { flex: 1; }
.acct-menu [role=menuitem]:is(:hover, :focus-visible) { background: var(--hover, color-mix(in srgb, var(--primary) 8%, transparent)); outline: none; }
.acct-menu kbd { font-size: .72rem; border: 1px solid var(--border); border-radius: 4px; padding: 0 .3rem; color: var(--muted); }
.am-logout { margin: .3rem 0 0; padding-top: .3rem; border-top: 1px solid var(--border); }
.am-logout [role=menuitem] { color: var(--overdue); }
.plan.trial.soon { background: #f59e0b; border-color: #f59e0b; color: #111; font-weight: 600; }
.plan.paid { background: #ffffff14; border: 1px solid #ffffff26; opacity: .9; }
.plan.paid.soon { background: #f59e0b; border-color: #f59e0b; color: #111; font-weight: 600; opacity: 1; }
.am-head .am-plan.warn { color: #b45309; }
:root.theme-dark .am-head .am-plan.warn { color: #fbbf24; }
@media (prefers-color-scheme: dark) { :root:not(.theme-light) .am-head .am-plan.warn { color: #fbbf24; } }
.nav-badge.red { background: var(--overdue); color: #fff; }

/* Karta urządzenia: status tylko w bloku „Co teraz”, opiekun i montaż w jednej drobnej linijce pod nim */
.next-action + .card-meta { padding: 0 1rem .55rem; font-size: .8rem; gap: .25rem .9rem; }
.na-sub { font-size: .8rem; color: var(--muted); margin-top: .2rem; }

/* ---------- Tabela: status słowem, zlecenia jako znaczek, krótki adres, „—” w pustych polach ---------- */
.st-pill {
    display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 1em; font-size: .78rem;
    font-weight: 600; white-space: nowrap; background: var(--hover); color: var(--muted);
}
.st-pill.st-overdue { background: color-mix(in srgb, var(--overdue) 14%, var(--panel)); color: var(--overdue); }
.st-pill.st-soon { background: color-mix(in srgb, var(--soon) 22%, var(--panel)); color: color-mix(in srgb, var(--soon) 55%, var(--text)); }
.st-pill.st-ok { background: color-mix(in srgb, var(--ok) 13%, var(--panel)); color: var(--ok); }
.ord-pill {
    display: inline-block; padding: .1rem .5rem; border-radius: 1em; font-size: .8rem; font-weight: 600; white-space: nowrap;
    background: color-mix(in srgb, #6d28d9 13%, var(--panel)); color: #6d28d9;
}
.ord-pill.urgent { background: var(--overdue); color: #fff; }
.t-none { color: var(--muted); opacity: .6; }
.data-table .t-clip { display: block; max-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.data-table .t-tech { max-width: 130px; }
@media (max-width: 1400px) { .data-table .t-clip { max-width: 130px; } .data-table .t-tech { max-width: 110px; } }
.t-noicon { filter: grayscale(1); opacity: .45; }
:root.theme-dark .ord-pill { color: #c4b5fd; }
@media (prefers-color-scheme: dark) { :root:not(.theme-light) .ord-pill { color: #c4b5fd; } }

/* W tabeli wyszukiwanie jest w pasku tabeli: bez drugiego pola „Szukaj adresu” */
.map-area.view-table .map-bar .addr-search { display: none; }

/* „Pokazano 3 z 13 · pokaż wszystkie”, gdy filtry ukrywają urządzenia */
.fshown {
    display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; font-size: .8rem; padding: .3rem .6rem;
    background: #fef3c7; color: #78350f; border-radius: 8px; box-shadow: 0 2px 8px #0002;
}
.fshown .link { font-size: .8rem; color: inherit; font-weight: 600; }
:root.theme-dark .fshown { background: #78350f; color: #fef3c7; }
@media (prefers-color-scheme: dark) { :root:not(.theme-light) .fshown { background: #78350f; color: #fef3c7; } }

/* Pasek filtrów mieści się w jednym wierszu dłużej: przy węższej mapie „Dodaj urządzenie” tylko z ikoną, węższe szukanie */
.map-bar { container: mapbar / inline-size; }
@container mapbar (max-width: 1120px) { .add-point-btn span { display: none; } }
@container mapbar (max-width: 900px) { .addr-search { width: 170px; } }
.data-table .t-due small { white-space: normal; max-width: 165px; }
.data-table th, .data-table td { padding-left: .55rem; padding-right: .55rem; }
@media (max-width: 1500px) { .data-table .t-clip { max-width: 140px; } .data-table .t-tech { max-width: 105px; } }
/* Wąska tabela (np. otwarty panel boczny): status tylko ikoną z dymkiem, krótsze teksty */
.table-wrap { container: tablewrap / inline-size; }
@container tablewrap (max-width: 1000px) {
    .st-pill .st-word { display: none; }
    .data-table .t-clip { max-width: 110px; }
    .data-table .t-tech { max-width: 90px; }
}

/* ---------- Dane urządzenia w karcie: model, numer seryjny, gwarancja ---------- */
.dev-specs {
    position: relative; margin: 0 0 .8rem; padding: .55rem .75rem; border: 1px solid var(--border); border-radius: 10px;
    display: grid; gap: .3rem; font-size: .88rem;
}
.ds-row { display: grid; grid-template-columns: 6.5rem 1fr; gap: .5rem; align-items: baseline; }
.ds-row dt { color: var(--muted); font-size: .8rem; }
.ds-row dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ds-row code { font: 600 .85rem ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em; }
.ds-copy { font-size: .75rem; margin-left: .3rem; }
.ds-edit { position: absolute; top: .35rem; right: .35rem; }
.w-pill { display: inline-block; font-size: .75rem; font-weight: 600; padding: .05rem .5rem; border-radius: 1em; white-space: nowrap; }
.w-active { background: color-mix(in srgb, var(--ok) 14%, var(--panel)); color: var(--ok); }
.w-ending { background: color-mix(in srgb, var(--soon) 25%, var(--panel)); color: color-mix(in srgb, var(--soon) 50%, var(--text)); }
.w-expired { background: var(--hover); color: var(--muted); }
.dev-add { margin: 0 0 .7rem; }
.warranty-quick { display: flex; gap: .2rem; align-items: center; margin-top: .25rem; }
.warranty-quick .link { font-size: .78rem; padding: 0 .2rem; }

/* ---------- Rozłóż zaległe ---------- */
.spread-dialog { width: min(720px, 96vw); }
.spread-opts { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: flex-end; }
.spread-opts > label { flex: 0 0 auto; margin-bottom: .5rem; }
.spread-opts input[type=number] { width: 6rem; }
.spread-days { display: flex; flex-wrap: wrap; gap: .2rem .7rem; margin: 0 0 .5rem; padding: .35rem .7rem .5rem; }
.spread-days label { display: flex; align-items: center; gap: .25rem; margin: 0; font-size: .85rem; cursor: pointer; }
.spread-days input { width: auto; margin: 0; }
.spread-preview { margin-top: .8rem; border-top: 1px solid var(--border); padding-top: .6rem; }
.spread-sum { margin: 0 0 .5rem; font-size: .92rem; }
.spread-warn { margin: 0 0 .5rem; padding: .45rem .6rem; border-radius: 8px; font-size: .85rem;
    background: color-mix(in srgb, var(--soon) 18%, var(--panel)); }
.spread-days-list { list-style: none; margin: 0; padding: 0; max-height: 42vh; overflow-y: auto; }
.spread-days-list > li { display: flex; gap: .7rem; padding: .4rem .1rem; border-top: 1px solid var(--border); }
.spread-days-list > li:first-child { border-top: none; }
.sp-date { flex: 0 0 5.2rem; font-weight: 600; font-size: .85rem; padding-top: .2rem; white-space: nowrap; }
.sp-date small { color: var(--muted); font-weight: 400; }
.sp-group { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.sp-group + .sp-group { margin-top: .3rem; }
.sp-tech { font-size: .78rem; color: var(--muted); margin-right: .2rem; }
.sp-unit { display: inline-flex; align-items: baseline; gap: .3rem; padding: .15rem .5rem; border-radius: 1em; font-size: .8rem;
    background: var(--hover); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-unit small { color: var(--overdue); font-size: .72rem; }
.spread-btn { margin: -.2rem 0 .6rem; }
@media (max-width: 560px) {
    .spread-days-list > li { flex-direction: column; gap: .25rem; }
    .sp-date { flex-basis: auto; }
}

/* ---------- Protokół e-mailem ---------- */
.svc-mail { margin: .6rem 0 0; padding: .55rem .7rem; border-radius: 8px; background: var(--hover); }
.svc-mail .inline-chk { color: var(--text); }
.svc-mail-to { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; margin-top: .45rem; }
.svc-mail-to input[type=email] { flex: 1 1 220px; margin: 0; }
.tl-mail { font-size: .8rem; margin-top: .25rem; }
.tl-mail.ok { color: var(--ok); }
.tl-mail.bad { color: var(--overdue); }
.tl-mail b { font-weight: 600; }

/* ---------- Dane urządzenia wykryte w opisie ---------- */
.detect-hint { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; margin: .4rem 0 .6rem; padding: .5rem .7rem;
    border-radius: 8px; border: 1px dashed var(--border); background: var(--hover); font-size: .85rem; }
.detect-hint .dh-text { flex: 1 1 200px; }
.detect-hint .dh-btns { display: flex; align-items: center; gap: .6rem; }
.detect-hint code, .detect-list code { font-size: .8rem; }
.detect-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; margin: 0 0 .6rem; padding: .55rem .8rem;
    border-radius: 8px; background: color-mix(in srgb, var(--primary) 9%, var(--panel)); font-size: .87rem; }
.detect-all { margin: .2rem 0 .5rem; }
.detect-list { list-style: none; margin: 0; padding: 0; max-height: 52vh; overflow-y: auto; border-top: 1px solid var(--border); }
.detect-list li { border-bottom: 1px solid var(--border); }
.detect-list .dl-row { display: flex; gap: .6rem; align-items: flex-start; padding: .5rem .2rem; margin: 0; cursor: pointer; }
.detect-list .dl-row input { width: auto; margin: .2rem 0 0; }
.dl-found { display: flex; flex-wrap: wrap; gap: .25rem; margin: .2rem 0; }
.dl-desc { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 560px; }

/* ---------- Portal klienta: karta klienta w aplikacji ---------- */
.cv-portal { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: .6rem 0 .9rem; padding: .7rem .9rem;
    border-radius: 10px; border: 1px solid var(--border); background: color-mix(in srgb, var(--primary) 6%, var(--panel)); }
.cv-portal.off { background: var(--hover); }
.cv-portal .grow { flex: 1 1 260px; min-width: 0; }
.cv-portal small { display: block; color: var(--muted); font-size: .8rem; margin-top: .15rem; }
.cv-portal-url input { width: 100%; margin-top: .35rem; font-size: .8rem; padding: .3rem .5rem; color: var(--muted); }
.cv-portal-btns { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.cv-portal-btns a.small-btn { text-decoration: none; }
.cv-portal-more { position: relative; }
.cv-portal-more summary { list-style: none; cursor: pointer; padding: .2rem .55rem; border-radius: 6px; border: 1px solid var(--border); }
.cv-portal-more summary::-webkit-details-marker { display: none; }
.cv-portal-more > div { position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; background: var(--panel); border: 1px solid var(--border);
    border-radius: 8px; padding: .4rem .6rem; display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; white-space: nowrap;
    box-shadow: 0 8px 24px #0002; }
.ok-chip { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }

/* ---------- Portal klienta: strona publiczna ---------- */
.portal-lead { color: var(--muted); margin: -.3rem 0 .9rem; }
.portal-back { margin: 0 0 .3rem; font-size: .9rem; }
.portal-contact { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.portal-btn { display: inline-flex; align-items: center; gap: .3rem; padding: .5rem .9rem; border-radius: 10px; border: 1px solid var(--border);
    background: var(--panel); color: var(--text); text-decoration: none; font-weight: 500; font-size: .92rem; }
.portal-btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.portal-btn.warn { color: var(--overdue); border-color: color-mix(in srgb, var(--overdue) 40%, var(--border)); }
.portal-btn.small { padding: .25rem .6rem; font-size: .8rem; white-space: nowrap; }
.portal-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: 1rem; }
.portal-sum div { background: var(--panel); border-radius: 12px; padding: .6rem .7rem; box-shadow: 0 2px 10px #0001; }
.portal-sum b { display: block; font-size: 1.35rem; }
.portal-sum span { font-size: .78rem; color: var(--muted); }
.portal-sum .bad b { color: var(--overdue); }
.portal-list { list-style: none; margin: 0; padding: 0; }
.portal-list li { padding: .45rem 0; border-top: 1px solid var(--border); }
.portal-list li:first-child { border-top: 0; }
.portal-list small { display: block; }
.portal-devices { list-style: none; margin: 0; padding: 0; }
.portal-devices > li { padding: .8rem 0; border-top: 1px solid var(--border); }
.portal-devices > li:first-child { border-top: 0; padding-top: .2rem; }
.pd-head { display: flex; gap: .6rem; align-items: flex-start; }
.pd-head small { display: block; }
.pd-icon { font-size: 1.4rem; line-height: 1.2; }
.pd-facts { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; margin: .5rem 0 .6rem 2.1rem; font-size: .88rem; }
.pd-facts dt { color: var(--muted); }
.pd-facts dd { margin: 0; }
.pd-btns { display: flex; gap: .5rem; margin-left: 2.1rem; flex-wrap: wrap; }
.portal-protocols li { align-items: center; }

/* Przypomnienia dla klientów (Dane firmy) */
.firm-remind { margin-top: .4rem; }
.firm-remind .inline-chk { color: var(--text); margin-bottom: .4rem; }
.firm-remind-opts { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; margin-left: 1.4rem; }
.firm-remind-opts select { width: auto; margin: 0 .2rem; padding: .2rem .4rem; }
.firm-remind-opts.dim { opacity: .55; }
#firmRemindInfo { margin: .5rem 0 0; }

.invite-send { flex-basis: 100%; margin-top: .2rem; justify-content: flex-start; }
.invite-form .invite-send input { flex: none; min-width: 0; width: auto; }

/* Parametry zależne od typu urządzenia */
.specs-box { border: 1px solid var(--border); border-radius: 10px; padding: .6rem .8rem .2rem; margin-bottom: .7rem; background: var(--hover); }
.specs-box .field-label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .4rem; }
.specs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 .8rem; }
.specs-grid label { margin-bottom: .55rem; }
.fgas-hint { margin: 0 0 .6rem; }
.fgas-req { color: var(--soon); font-weight: 600; }

/* Import: grupa parametrów urządzenia */
.import-specs { grid-column: 1 / -1; border: 1px solid var(--border); border-radius: 8px; padding: .4rem .7rem; margin-top: .3rem; }
.import-specs summary { cursor: pointer; font-weight: 600; font-size: .88rem; }
.import-specs p { margin: .4rem 0; }
.warn-text { color: var(--soon); font-weight: 600; }

/* ---------- Porządki w interfejsie ---------- */
main { position: relative; }
/* Panel nad treścią (Tabela, Kalendarz, Pulpit) */
body.drawer-overlay .drawer { position: absolute; inset: 0 auto 0 0; box-shadow: 6px 0 28px #0f172a33; z-index: 1200; }
/* Telefon: panel nad paskiem mapy i przyciskami mapy */
@media (max-width: 700px) { .drawer { z-index: 1200; } }
/* „Pierwsze kroki” nie zasłaniają planu dnia */
body[data-view="plan"] .onboard { display: none; }
/* Karta: „przykład” przy nazwie klienta, „Dodaj:” na dole */
.card-title h2 small .demo-chip { font-size: .68rem; padding: 0 .4rem; vertical-align: 1px; }
.card-adds { margin: 1rem 0 .4rem; padding-top: .7rem; border-top: 1px dashed var(--border); }
/* Wąska mapa: filtry stanu tylko kolorem i liczbą (nazwa w dymku) */
@container mapbar (max-width: 820px) {
    .filters [data-filter]:not([data-filter="all"]) .fl { display: none; }
    .filters [data-filter] { padding-left: .55rem; padding-right: .55rem; }
}

/* Pulpit: „Filtry” po prawej, nad treścią */
.map-area.view-dash .map-bar { justify-content: flex-end; }
/* Telefon: zwinięte „Pierwsze kroki” jako wąski pasek (szczegóły po rozwinięciu) */
@media (max-width: 700px) {
    .onboard.collapsed { padding: .45rem .7rem; }
    .onboard.collapsed :is(.ob-next, .ob-demo) { display: none; }
    .onboard.collapsed .ob-bar { margin-bottom: 0; }
}

/* Formularz urządzenia: zwijane „Dane techniczne” */
.tech-box { border: 1px solid var(--border); border-radius: 10px; padding: .55rem .8rem; margin-bottom: .8rem; }
.tech-box > summary { cursor: pointer; font-weight: 600; font-size: .9rem; display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.tech-box > summary .muted { font-weight: 400; }
.tech-box[open] > summary { margin-bottom: .6rem; }
.tech-box .specs-box { margin-bottom: .3rem; }
/* Kalendarz: przyciski mapy (dodawanie pinezki, adres) są tu zbędne */
.map-area.view-calendar .map-bar :is(.add-point-btn, .addr-search) { display: none; }


/* Ostatnie serwisy (karta, pulpit) i „nie wykonano” */
.svc-lines { margin: 0; }
.svc-line { display: flex; gap: .65rem; align-items: flex-start; padding: .45rem .3rem; border-bottom: 1px solid var(--border); }
.svc-line:last-child { border-bottom: none; }
.svc-line[data-point] { cursor: pointer; }
.svc-line[data-point]:hover { background: var(--hover); }
.sl-date { flex: none; width: 3.2rem; font-weight: 600; font-size: .88rem; line-height: 1.15; }
.sl-date small { display: block; font-weight: 400; color: var(--muted); font-size: .72rem; }
.sl-main { min-width: 0; font-size: .88rem; }
.sl-main > * { display: block; }
.sl-point { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-main small { font-size: .76rem; }
.sl-acts { flex: none; display: flex; gap: .5rem; align-items: center; font-size: .8rem; white-space: nowrap; }
.void-btn { color: var(--muted); }
.void-btn:hover { color: var(--overdue); }
.svc-line.voided .sl-what, .svc-line.voided .sl-date, .ev-voided .tl-head b, .cv-history li.voided .grow > a { text-decoration: line-through; color: var(--muted); }
.void-tag { color: var(--overdue); font-size: .78rem; margin-top: .15rem; }
.sub-link { margin-left: auto; font-size: .78rem; font-weight: 500; text-transform: none; letter-spacing: 0; }
h4.sub { display: flex; align-items: baseline; gap: .5rem; }
.void-effects { list-style: none; margin: 0 0 .9rem; padding: .55rem .75rem; border-radius: 8px; background: var(--hover); font-size: .86rem; }
.void-effects li { padding: .2rem 0; }
.void-quick { display: flex; flex-wrap: wrap; gap: .35rem; margin: .35rem 0 .4rem; }
.chip-btn { font-size: .8rem; padding: .25rem .6rem; border-radius: 999px; }
.dash-recent { margin-bottom: 1rem; }

/* Po zapisaniu wpisu: pasek w karcie */
.done-banner { margin: .2rem 1rem .7rem; padding: .6rem .75rem; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--ok) 45%, var(--border));
    background: color-mix(in srgb, var(--ok) 9%, var(--panel)); font-size: .86rem; animation: done-in .25s ease; }
.db-head { display: flex; align-items: center; justify-content: space-between; color: var(--ok); }
.db-head .icon-btn { padding: 0 .3rem; font-size: .85rem; }
.db-items { display: flex; flex-wrap: wrap; gap: .15rem .9rem; margin: .3rem 0 .45rem; }
.db-items .bad { color: var(--overdue); }
.db-acts { display: flex; flex-wrap: wrap; gap: .4rem; }
.db-acts a.small-btn { text-decoration: none; }
@keyframes done-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Moja lokalizacja (◎ nad przyciskami powiększania) */
.locate-btn { width: 34px; height: 34px; padding: 0; font-size: 1.15rem; line-height: 1; background: var(--panel); color: var(--text);
    border: 2px solid rgba(0,0,0,.2) !important; border-radius: 4px; cursor: pointer; margin-bottom: 6px !important; }
.locate-btn:hover { background: var(--hover); }
/* Wiadomość do klienta */
.msg-dialog { width: min(520px, 96vw); }
.msg-channel { display: inline-flex; margin: 0 0 .8rem; }
.msg-channel button:disabled { opacity: .45; cursor: not-allowed; }
.msg-when { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .8rem; }
.msg-buttons { align-items: center; }
.msg-buttons .file-btn, .msg-buttons .primary-link { margin: 0; }
.primary-link { display: inline-flex; align-items: center; gap: .3rem; padding: .5rem .9rem; border-radius: 8px; background: var(--primary);
    color: #fff; text-decoration: none; font-weight: 600; }
.primary-link[hidden], .msg-buttons [hidden] { display: none !important; }
#msgHint { margin: -.3rem 0 .3rem; }
/* Ramka klienta: SMS / e-mail obok telefonu (także na telefonie) */
.cb-actions button.file-btn { width: auto; display: inline-flex; align-items: center; gap: .3rem; margin: 0; }

/* Ustawienia: etykieta i wybór w jednej linii */
dialog label.setting-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; }
dialog label.setting-row select { width: auto; min-width: 11rem; margin: 0; }

/* ---------- Karta urządzenia: czytelność (jeden rozmiar tekstu, równe bloki) ---------- */
#cardBody { font-size: .9rem; line-height: 1.4; }
#cardBody h4.sub { margin: 1.15rem 0 .45rem; font-size: .7rem; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
#cardBody .site-note + .customer-box, #cardBody > .customer-box:first-child { margin-top: 0; }
#cardBody .customer-box { margin-bottom: 0; padding: .6rem .75rem; border-radius: 12px; }
.dev-block { position: relative; border: 1px solid var(--border); border-radius: 12px; padding: .55rem .75rem; }
.dev-block .dev-specs { border: 0; padding: 0; margin: 0; border-radius: 0; gap: .25rem; font-size: .88rem; }
.dev-block .ds-row { grid-template-columns: 8.2rem 1fr; }
.dev-block .ds-row dd .inline-pen { margin-left: .2rem; }
.dev-block .card-desc-wrap { margin-top: .5rem; padding-top: .5rem; border-top: 1px dashed var(--border); }
.dev-block .card-desc { margin: 0; font-size: .88rem; }
.dev-block .inline-edit { margin-top: .5rem; }
/* Przeglądy: nazwa i termin w pierwszej linii, reszta drobniej */
.card-sched li { padding: .55rem .15rem; gap: .6rem; }
.cs-name b { font-size: .9rem; }
.cs-name small { font-size: .78rem; }
.card-sched .sched-date { font-size: .85rem; font-weight: 600; }
.card-sched .sched-date small { font-weight: 400; font-size: .75rem; }
.card-sched li:last-child { border-bottom: none; }
/* „Co teraz”: mniej przycisków, wyraźniej */
.next-action .na-btns { margin-top: .45rem; }

/* Umów wizytę: SMS albo e-mail */
.vd-sms-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.vd-channel button { padding: .25rem .6rem; font-size: .8rem; }
.vd-channel button:disabled { opacity: .45; cursor: not-allowed; }
.vd-to { margin: .3rem 0 .35rem; }
#visitSubject { margin-bottom: .35rem; }

/* Formularz urządzenia: klient i kontakt */
.contact-box { padding: .5rem .8rem .2rem; margin-bottom: .8rem; }
.contact-box > label { margin-bottom: .35rem; }
.contact-grid { display: grid; grid-template-columns: 1.3fr 1fr 1.3fr; gap: 0 .7rem; }
.contact-grid label { margin-bottom: .6rem; }
.cust-match { margin: 0 0 .5rem; color: var(--ok); }
.cust-match.is-new { color: var(--primary); }
@media (max-width: 700px) { .contact-grid { grid-template-columns: 1fr; } }

/* Mapa pusta w tym miejscu, urządzenia gdzie indziej */
.out-of-view { position: absolute; left: 50%; bottom: 2.4rem; transform: translateX(-50%); z-index: 650; border-radius: 999px;
    padding: .5rem 1rem; background: var(--panel); border: 1px solid var(--border); box-shadow: 0 6px 20px #0f172a26; font-size: .88rem; }
.out-of-view b { color: var(--primary); }
.map-area:is(.view-table, .view-calendar, .view-dash) .out-of-view { display: none; }
@media (max-width: 700px) { .out-of-view { bottom: 1.6rem; } }

/* ---------- Twój abonament ---------- */
button.plan { font: inherit; font-size: .8rem; color: inherit; cursor: pointer; }
button.plan:hover { filter: brightness(1.15); }
button.plan.expired { border: none; color: #fff; }
.am-head button.am-plan { display: block; text-align: left; background: none; border: none; padding: 0; font: inherit; font-size: .8rem; cursor: pointer; }
.am-head button.am-plan:hover { text-decoration: underline; }
.banner [data-sub] { margin-left: .4rem; }
.sub-dialog { width: min(520px, 96vw); }
.sub-dialog .dlg-head-row h3 { margin: 0; }
.sub-flash { margin: 0 0 .8rem; padding: .55rem .75rem; border-radius: 8px; font-size: .9rem; }
.sub-flash.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); }
.sub-flash.bad { background: color-mix(in srgb, var(--overdue) 14%, transparent); }
.sub-card { --c: var(--primary); border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: 10px; padding: .8rem .9rem; }
.sub-card.ok { --c: var(--ok); }
.sub-card.warn { --c: #f59e0b; }
.sub-card.bad { --c: var(--overdue); }
.sub-card p { margin: .5rem 0 0; }
.sub-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .8rem; }
.sub-name { display: block; font-size: 1.1rem; }
.sub-days { text-align: right; line-height: 1; }
.sub-days b { display: block; font-size: 1.7rem; color: var(--c); }
.sub-days small { color: var(--muted); font-size: .75rem; }
.sub-bar { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--c) 18%, transparent); margin: .7rem 0 .3rem; overflow: hidden; }
.sub-bar i { display: block; height: 100%; background: var(--c); border-radius: 3px; }
.sub-dates { display: flex; justify-content: space-between; color: var(--muted); }
.sub-dates b { color: var(--text); }
.sub-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin: .8rem 0; }
.sub-stats div { background: var(--hover, color-mix(in srgb, var(--primary) 6%, transparent)); border-radius: 8px; padding: .5rem .3rem; text-align: center; }
.sub-stats b { display: block; font-size: 1.2rem; }
.sub-stats small { color: var(--muted); font-size: .72rem; line-height: 1.2; display: block; }
.sub-renew { border-top: 1px solid var(--border); padding-top: .7rem; }
.sub-renew p { margin: 0 0 .5rem; font-size: .9rem; line-height: 1.5; }
dialog > .sub-renew > .buttons:last-child { position: static; margin: .5rem 0 0; padding: 0; border: 0; background: none; }
.sub-promo { display: inline-block; margin-left: .3rem; font-size: .75rem; padding: .05rem .45rem; border-radius: 1em; background: #f59e0b; color: #111; font-weight: 600; }
.sub-pay { width: 100%; border-collapse: collapse; font-size: .85rem; }
.sub-pay th { text-align: left; font-size: .75rem; color: var(--muted); font-weight: 600; padding: .2rem .3rem; border-bottom: 1px solid var(--border); }
.sub-pay td { padding: .35rem .3rem; border-bottom: 1px solid var(--border); }
.sub-contact { margin: .9rem 0 0; }
@media (max-width: 480px) { .sub-stats { grid-template-columns: repeat(2, 1fr); } }
.sub-inv { border: 1px solid var(--border); border-radius: 8px; padding: .6rem .75rem; font-size: .88rem; }
.sub-inv p { margin: 0 0 .4rem; line-height: 1.45; }
.sub-inv.warn { border-color: #f59e0b; background: color-mix(in srgb, #f59e0b 8%, transparent); }
/* Kosz */
.trash-list { list-style: none; margin: 0; padding: 0; }
.trash-item { display: flex; gap: .8rem; align-items: center; padding: .6rem 0; border-top: 1px solid var(--border); }
.trash-item:first-child { border-top: 0; }
.trash-item small { display: block; font-size: .78rem; line-height: 1.4; }
.trash-btns { display: flex; flex-direction: column; gap: .3rem; align-items: stretch; }
.trash-empty { padding: 1rem 0; }
.link-danger { color: var(--overdue); background: none; border-color: transparent; }
@media (max-width: 520px) { .trash-item { flex-direction: column; align-items: stretch; } .trash-btns { flex-direction: row; } }
/* Dziennik zmian */
.act-filters { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: center; margin-bottom: .6rem; }
.act-filters select { width: auto; }
.act-day { margin: .9rem 0 .3rem; font-size: .8rem; text-transform: capitalize; color: var(--muted); }
.act-row { display: flex; gap: .5rem; align-items: baseline; padding: .3rem 0; border-top: 1px solid var(--border); font-size: .88rem; }
.act-day + .act-row { border-top: 0; }
.act-time { color: var(--muted); font-size: .78rem; width: 2.6rem; flex: none; font-variant-numeric: tabular-nums; }
.act-i { width: 1.2rem; flex: none; text-align: center; }
.act-t { min-width: 0; }
.act-t small { display: block; color: var(--muted); font-size: .78rem; }
.act-t a { color: var(--primary); }
#activityMore { margin-top: .6rem; }
.firm-data a.small-btn { display: inline-block; text-decoration: none; border: 1px solid var(--border); border-radius: 6px; color: var(--text); }
.firm-delete { margin-left: .8rem; }
a.link-danger { color: var(--overdue); }
.danger-btn { background: var(--overdue) !important; border-color: var(--overdue) !important; }
/* Tabela: klient i adres w dwóch liniach zamiast ucinania po kilkunastu znakach */
.data-table .t-clip.t-wrap2 { max-width: 240px; min-width: 120px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
@media (max-width: 1400px) { .data-table .t-clip.t-wrap2 { max-width: 190px; } }
@container tablewrap (max-width: 1000px) { .data-table .t-clip.t-wrap2 { max-width: 150px; min-width: 90px; } }
/* Wyszukiwarka wszystkiego (Ctrl+K) */
.find-btn { display: inline-flex; align-items: center; gap: .35rem; background: #ffffff14; border: 1px solid #ffffff26; color: inherit; padding: .3rem .6rem; }
.find-btn kbd { font-size: .68rem; opacity: .7; border: 1px solid #ffffff40; border-radius: 4px; padding: 0 .25rem; }
.find-dialog { width: min(620px, 96vw); padding: 0; margin-top: 10vh; overflow: hidden; display: none; flex-direction: column; max-height: 76vh; }
.find-dialog[open] { display: flex; }
.fd-box { display: flex; align-items: center; gap: .6rem; padding: .75rem 1rem; border-bottom: 1px solid var(--border); }
.fd-box input { flex: 1; border: 0; outline: 0; font-size: 1.05rem; background: transparent; padding: .2rem 0; box-shadow: none; }
.fd-esc { font-size: .7rem; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 .3rem; }
.fd-list { list-style: none; margin: 0; padding: .3rem 0; overflow-y: auto; flex: 1; }
.fd-head { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .55rem 1rem .2rem; }
.fd-item { display: flex; gap: .7rem; align-items: center; padding: .45rem 1rem; cursor: pointer; }
.fd-item.active { background: var(--hover); box-shadow: inset 3px 0 0 var(--primary); }
.fd-ic { width: 1.4rem; text-align: center; flex: none; }
.fd-t { min-width: 0; }
.fd-t b { display: block; font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fd-t small { display: block; color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fd-empty { padding: 1rem; color: var(--muted); }
.fd-foot { margin: 0; padding: .45rem 1rem; border-top: 1px solid var(--border); }
.fd-foot kbd { font-size: .7rem; border: 1px solid var(--border); border-radius: 4px; padding: 0 .25rem; margin: 0 .1rem; }
@media (max-width: 1250px) { .find-btn span, .find-btn kbd { display: none; } }
@media (max-width: 700px) { .find-dialog { margin-top: 0; max-height: 100dvh; height: 100dvh; width: 100vw; max-width: 100vw; border-radius: 0; } .fd-foot { display: none; } }
.find-btn kbd { background: transparent; color: inherit; }
.fd-close { display: none; border: 0; background: none; color: var(--primary); font-weight: 600; padding: .3rem .2rem; }
@media (max-width: 700px) { .fd-esc { display: none; } .fd-close { display: inline-block; } }
/* W pobliżu */
.near-dialog { width: min(460px, 96vw); }
.near-list { list-style: none; margin: 0; padding: 0; }
.near-item { display: flex; gap: .65rem; align-items: center; padding: .6rem .2rem; border-top: 1px solid var(--border); cursor: pointer; }
.near-item:first-child { border-top: 0; }
.near-item:hover { background: var(--hover); }
.near-item b { display: block; font-size: .95rem; }
.near-item small { display: block; color: var(--muted); font-size: .78rem; }
.near-ic { width: 1.5rem; text-align: center; flex: none; }
.near-d { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.near-here { display: block; font-size: .7rem; font-weight: 600; color: #fff; background: var(--ok); border-radius: 1em; padding: 0 .45rem; margin-bottom: .15rem; }
@media (max-width: 700px) { .near-dialog { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 16px 16px 0 0; } }
/* Kalendarz: tryb i widok tygodnia */
.cal-mode { margin-left: .8rem; }
.cal-mode button { padding: .3rem .75rem; font-size: .85rem; }
.cal-mode button.active { background: var(--primary); color: var(--primary-text, #fff); }
#icalBtn { margin-left: .4rem; }
.cal-grid.cal-week { display: block; }
.wk-head, .wk-allrow, .wk-body { display: grid; grid-template-columns: 3.6rem repeat(7, 1fr); }
.wk-head { position: sticky; top: 0; z-index: 3; background: var(--panel); border-bottom: 1px solid var(--border); }
.wk-dh { padding: .45rem .5rem; font-size: .8rem; color: var(--muted); text-align: center; }
.wk-dh b { font-size: 1.05rem; color: var(--text); margin-left: .2rem; }
.wk-dh.today b { background: var(--primary); color: #fff; border-radius: 50%; padding: .1rem .4rem; }
.wk-dh.weekend { background: color-mix(in srgb, var(--muted) 6%, transparent); }
.wk-allrow { border-bottom: 2px solid var(--border); }
.wk-lbl { font-size: .7rem; color: var(--muted); padding: .4rem .3rem; text-align: right; }
.cal-day.wk-all { min-height: 2.4rem; padding: .25rem; border-left: 1px solid var(--border); }
.wk-body { position: relative; }
.wk-hours { border-right: 1px solid var(--border); }
.wk-h { font-size: .7rem; color: var(--muted); text-align: right; padding-right: .35rem; transform: translateY(-.45rem); }
.wk-col { position: relative; border-left: 1px solid var(--border); }
.wk-col.today { background: color-mix(in srgb, var(--primary) 4%, transparent); }
.wk-slot { height: 48px; border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.wk-slot.drop { background: color-mix(in srgb, var(--primary) 15%, transparent); }
.wk-ev { position: absolute; z-index: 1; }
.wk-ev .cal-item { height: 100%; margin: 0; overflow: hidden; box-shadow: 0 1px 3px #0002; }
.wk-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--overdue); z-index: 2; }
.wk-now::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--overdue); }
.cal-grid.cal-week { background: var(--panel); overflow-y: auto; gap: 0; }
.ical-dialog { width: min(520px, 96vw); }
.ical-url { display: flex; gap: .4rem; margin: .6rem 0; }
.ical-url input { flex: 1; font-size: .8rem; font-family: ui-monospace, monospace; }
.ical-quick { display: flex; gap: .5rem; flex-wrap: wrap; }
.ical-quick a { text-decoration: none; border: 1px solid var(--border); border-radius: 6px; color: var(--text); }
/* Logo firmy */
.firm-logo { display: flex; gap: .8rem; align-items: center; margin: .4rem 0 .9rem; }
.firm-logo-box { width: 150px; height: 60px; border: 1px dashed var(--border); border-radius: 8px; display: flex; align-items: center; justify-content: center; background: repeating-conic-gradient(#0000000a 0 25%, transparent 0 50%) 0 0 / 12px 12px; flex: none; }
.firm-logo-box img { max-width: 140px; max-height: 52px; }
.firm-logo p { margin: .25rem 0 0; }
.pub-logo { display: block; max-height: 56px; max-width: 220px; margin: 0 0 .5rem; }
/* Umów kilka przeglądów na jeden termin */
.cv-terms-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.ba-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .3rem; }
.ba-list { border: 1px solid var(--border); border-radius: 8px; max-height: 260px; overflow-y: auto; margin-bottom: .8rem; }
.ba-item { display: flex !important; gap: .55rem; align-items: center; padding: .45rem .6rem; margin: 0 !important; border-top: 1px solid var(--border); cursor: pointer; }
.ba-item:first-child { border-top: 0; }
.ba-item small { display: block; }
.ba-done { background: color-mix(in srgb, var(--ok) 12%, transparent); padding: .55rem .75rem; border-radius: 8px; }
#baSms { text-decoration: none; display: inline-flex; align-items: center; }
/* Telefon: krótsze zakładki w oknach (wpis serwisowy, urządzenie) */
@media (max-width: 700px) {
    .dlg-tabs .tab-long { display: none; }
    .dlg-tabs button { padding: .5rem .55rem; font-size: .9rem; }
}
/* Ekran powitalny */
.welcome-dialog { width: min(760px, 96vw); padding: 1.6rem 1.6rem 1rem; }
.welcome-dialog h2 { margin: 0 0 .3rem; font-size: 1.5rem; }
.wel-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin: 1.2rem 0 .8rem; }
.wel-card { display: flex; flex-direction: column; gap: .35rem; text-align: left; padding: 1rem; border: 2px solid var(--border); border-radius: 14px; background: var(--panel); cursor: pointer; font: inherit; color: inherit; }
.wel-card:hover, .wel-card:focus-visible { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, transparent); outline: none; }
.wel-card b { font-size: 1rem; }
.wel-card small { color: var(--muted); font-size: .82rem; line-height: 1.4; }
.wel-ic { font-size: 1.8rem; }
.wel-foot { text-align: center; font-size: .9rem; margin: .4rem 0 0; }
@media (max-width: 700px) { .wel-cards { grid-template-columns: 1fr; } .wel-card { flex-direction: row; flex-wrap: wrap; align-items: center; } .wel-card small { flex-basis: 100%; } }
/* Plan dnia: następny przystanek z dużymi przyciskami */
.plan-stop.next { flex-wrap: wrap; border: 2px solid var(--primary); box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 18%, transparent); padding: .6rem .6rem .7rem; }
.plan-next-label { flex-basis: 100%; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--primary); }
.plan-stop.next .plan-main b { font-size: 1.02rem; }
.plan-stop.next .plan-btns .done-btn, .plan-stop.next .plan-btns a.icon-btn { display: none; }
.plan-desc { display: block; margin-top: .2rem; font-size: .8rem; }
.plan-next-actions { flex-basis: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .4rem; margin-top: .3rem; }
.pn-btn { display: flex; align-items: center; justify-content: center; gap: .3rem; min-height: 2.6rem; padding: .4rem .6rem; border-radius: 10px;
    border: 1px solid var(--border); background: var(--panel); color: var(--text); font: inherit; font-weight: 600; font-size: .9rem; text-decoration: none; cursor: pointer; }
.pn-btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.pn-btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
/* Prościej: pole adresu tylko przy dodawaniu urządzenia; serwisant bez widoków biura */
.addr-search { display: none; }
body.placing .addr-search { display: block; }
body.role-tech :is([data-view="table"], [data-view="dash"], [data-more-view="table"]) { display: none !important; }
.glossary { display: grid; grid-template-columns: max-content 1fr; gap: .35rem .8rem; font-size: .86rem; margin: 0 0 1rem; }
.glossary dt { font-weight: 600; }
.glossary dd { margin: 0; color: var(--muted); }
@media (max-width: 520px) { .glossary { grid-template-columns: 1fr; } .glossary dd { margin-bottom: .3rem; } }
/* Formularz urządzenia: mniej na wierzchu */
.contact-box { border: 0; padding: 0; margin: 0; }
.contact-more summary, .more-box > summary { cursor: pointer; color: var(--primary); font-size: .88rem; font-weight: 600; padding: .3rem 0; }
.contact-more[open] summary { margin-bottom: .4rem; }
.more-box { border-top: 1px solid var(--border); padding-top: .4rem; margin-top: .2rem; }
.more-box[open] > summary { margin-bottom: .6rem; }

/* Praca bez zasięgu: pasek stanu (offline.js) */
.net-bar { background: #e0f2fe; color: #0c4a6e; padding: .4rem 1rem; font-size: .88rem; display: flex; flex-direction: column; gap: .15rem; }
.net-bar.off { background: #fef3c7; color: #78350f; }
.net-bar.err { background: #fee2e2; color: #7f1d1d; }
.net-bar .link { color: inherit; text-decoration: underline; font-weight: 600; margin-left: .3rem; }
:root.theme-dark .net-bar { background: #0c4a6e; color: #e0f2fe; }
:root.theme-dark .net-bar.off { background: #78350f; color: #fef3c7; }
:root.theme-dark .net-bar.err { background: #7f1d1d; color: #fee2e2; }
@media (prefers-color-scheme: dark) {
    :root:not(.theme-light) .net-bar { background: #0c4a6e; color: #e0f2fe; }
    :root:not(.theme-light) .net-bar.off { background: #78350f; color: #fef3c7; }
    :root:not(.theme-light) .net-bar.err { background: #7f1d1d; color: #fee2e2; }
}

/* Strona z kodu QR: firma, kontakt, stan przeglądu, zgłoszenie */
.pub-head { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.pub-head .pub-company { margin: 0; font-weight: 600; color: var(--text); }
.pub-contact { display: flex; gap: .5rem; flex-wrap: wrap; }
.pub-btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .6rem 1rem; border-radius: 10px;
    border: 1px solid var(--border); background: var(--panel); color: var(--text); font-weight: 600; text-decoration: none; }
.pub-btn.call { background: var(--ok); border-color: var(--ok); color: #fff; flex: 1; }
.pub-btn.report { display: flex; margin: 0 0 1rem; background: var(--panel); border-color: var(--overdue); color: var(--overdue); }
.pub-device { display: flex; align-items: center; gap: .8rem; margin-bottom: .6rem; }
.pub-device h1 { margin: 0; font-size: 1.45rem; line-height: 1.2; }
.pub-photo { width: 72px; height: 72px; border-radius: 14px; object-fit: cover; flex: none; box-shadow: 0 2px 8px #0003; }
.pub-type { width: 56px; height: 56px; border-radius: 14px; background: var(--hover); display: flex; align-items: center; justify-content: center; font-size: 1.8rem; flex: none; }
.pub-state { display: flex; gap: .5rem; align-items: center; padding: .75rem 1rem; border-radius: 12px; font-weight: 600; margin-bottom: .8rem; }
.pub-state.st-ok { background: #dcfce7; color: #14532d; }
.pub-state.st-soon { background: #fef3c7; color: #78350f; }
.pub-state.st-overdue { background: #fee2e2; color: #7f1d1d; }
.pub-state.st-none { background: var(--hover); color: var(--text); }
.pub-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .6rem; }
.pub-card .pub-chips button { width: auto; padding: .35rem .7rem; border-radius: 999px; font-size: .85rem; background: var(--hover); border: 1px solid var(--border); }
:root.theme-dark .pub-state.st-ok { background: #14532d; color: #dcfce7; }
:root.theme-dark .pub-state.st-soon { background: #78350f; color: #fef3c7; }
:root.theme-dark .pub-state.st-overdue { background: #7f1d1d; color: #fee2e2; }
@media (prefers-color-scheme: dark) {
    :root:not(.theme-light) .pub-state.st-ok { background: #14532d; color: #dcfce7; }
    :root:not(.theme-light) .pub-state.st-soon { background: #78350f; color: #fef3c7; }
    :root:not(.theme-light) .pub-state.st-overdue { background: #7f1d1d; color: #fee2e2; }
}

/* Dymek pinezki: zdjęcie, klient, opis, stan */
.leaflet-tooltip.pin-tip { padding: 6px 8px; max-width: 300px; white-space: normal; }
.tip { display: flex; gap: 8px; align-items: flex-start; width: max-content; max-width: 290px; }
.tip > div > * { overflow-wrap: anywhere; }
.tip > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tip img { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; flex: none; }
.tip small { color: var(--muted); }
.tip-desc { font-size: .78rem; color: var(--text); opacity: .85; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tip-st { font-size: .78rem; font-weight: 600; }
.tip-st.st-overdue { color: var(--overdue); }
.tip-st.st-soon { color: #b45309; }
.tip-st.st-ok { color: var(--ok); }
:root.theme-dark .tip-st.st-soon { color: #fbbf24; }
@media (prefers-color-scheme: dark) { :root:not(.theme-light) .tip-st.st-soon { color: #fbbf24; } }

/* Karta: zdjęcie w nagłówku (otwiera zakładkę Zdjęcia) i opis pod nazwą */
.card-avatar.photo { width: 3.6rem; height: 3.6rem; padding: 0; border: none; position: relative; cursor: zoom-in; overflow: visible; background: none; }
.card-avatar.photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; display: block; }
.card-avatar.photo::after { content: ''; position: absolute; inset: 0; border-radius: 12px; box-shadow: inset 0 0 0 3px var(--ring, #94a3b8); pointer-events: none; }
.card-avatar.photo.st-overdue { --ring: var(--overdue); } .card-avatar.photo.st-soon { --ring: var(--soon); } .card-avatar.photo.st-ok { --ring: var(--ok); }
.card-avatar.photo span { position: absolute; right: -6px; bottom: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--panel);
    display: flex; align-items: center; justify-content: center; font-size: 12px; box-shadow: 0 1px 3px #0006; }
.card-avatar.photo span:empty { display: none; }
.card-desc { font-size: .82rem; font-weight: 400; color: var(--text); opacity: .8; margin-top: .2rem; white-space: pre-line;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Pierwsze kroki na telefonie: jedna linia */
.ob-line { display: flex; align-items: center; gap: .5rem; }
.ob-line .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
.ob-count { background: var(--hover); border: 0; border-radius: 999px; padding: .2rem .55rem; font: 600 .8rem/1.4 inherit; color: var(--text); flex: none; cursor: pointer; }
.ob-line + .ob-bar { height: 3px; margin: .35rem 0 0; }
@media (max-width: 700px) {
    .onboard { padding: .45rem .6rem; font-size: .85rem; max-height: 55vh; overflow-y: auto; }
    .onboard .ob-demo { margin-top: .35rem; padding: .3rem .5rem; flex-wrap: nowrap; }
    .onboard .ob-demo .grow { flex: 1; }
}

/* ---------- Pinezka (klasyczna kropla, SVG) i podpis nad nią ----------
   Ikona 40×52, kotwica w czubku (20, 52); białe koło: środek (20, 19.5), promień 12. */
.pin {
    position: absolute; left: 0; top: 0; width: 40px; height: 52px; transform-origin: 50% 100%;
    filter: drop-shadow(0 1px 1px rgb(0 0 0 / .3)); transition: transform .2s cubic-bezier(.3, 1.6, .5, 1);
}
.pin svg { width: 100%; height: 100%; display: block; overflow: visible; }
.pin-in {
    position: absolute; left: 9px; top: 8.5px; width: 22px; height: 22px; border-radius: 50%; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.pin-icon { font-size: 15px; line-height: 1; }
.pin.has-photo .pin-in { left: 8px; top: 7.5px; width: 24px; height: 24px; }
.pin img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Cień na ziemi: miękki owal pod czubkiem (osobny element, nie sumuje się z cieniem kropli) */
.pin-shadow { position: absolute; left: 0; top: 0; width: 40px; height: 52px; pointer-events: none; transform-origin: 20px 51.5px; }
.pin-shadow-svg { width: 100%; height: 100%; overflow: visible; display: block; filter: blur(.7px); }
.pin-shadow-svg .pin-contact { fill: rgb(0 0 0 / .35); }
:root.theme-dark .pin-shadow-svg { filter: blur(.7px) contrast(1.4); }
/* Wybrana pinezka „podskakuje”: jej cień na chwilę się kurczy i blednie */
.pin-shadow.sel { animation: shadow-pop .35s ease-out; }
@keyframes shadow-pop { 45% { transform: scale(.75); opacity: .5; } }

/* Wybrana: lekko większa, „podskakuje” przy wyborze; pod czubkiem fale w kolorze pinezki */
.pin.selected { transform: scale(1.15); filter: drop-shadow(0 2px 2px rgb(0 0 0 / .3)); animation: pin-pop .35s ease-out; }
@keyframes pin-pop { 0% { transform: scale(1); } 45% { transform: scale(1.25) translateY(-4px); } 100% { transform: scale(1.15); } }
.pin-halo { position: absolute; left: 20px; top: 52px; width: 0; height: 0; pointer-events: none; }
.pin-halo i {
    position: absolute; left: -22px; top: -8px; width: 44px; height: 16px; border-radius: 50%;
    border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 22%, transparent);
    animation: pin-wave 2.4s ease-out infinite; opacity: 0;
}
.pin-halo i + i { animation-delay: 1.2s; }
.pin-halo.sel i { animation-duration: 1.8s; }
.pin-halo.sel i + i { animation-delay: .9s; }
@keyframes pin-wave { 0% { transform: scale(.3); opacity: .9; } 100% { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pin-halo i, .pin.selected { animation: none; } .pin-halo i { opacity: .5; } }
.pin-type {
    position: absolute; right: -5px; top: 20px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 11px; box-shadow: 0 1px 3px #0007;
}

.pin-label {
    position: absolute; left: 20px; bottom: 58px; transform: translateX(-50%); display: flex; align-items: center; gap: 6px;
    background: var(--panel); color: var(--text); border-radius: 10px; padding: 4px 10px; max-width: 210px;
    font: 12.5px/1.25 system-ui, sans-serif; white-space: nowrap; pointer-events: none; /* nie zasłania sąsiednich pinezek */
    box-shadow: 0 2px 8px #0004, inset 0 -3px 0 var(--lc, #94a3b8);
}
.pin-label.with-img { padding-left: 4px; }
.pin-label::after {
    content: ''; position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
    border: 6px solid transparent; border-top-color: var(--lc, #94a3b8); border-bottom: 0;
}
.pin.selected ~ .pin-label { bottom: 66px; box-shadow: 0 4px 14px rgb(0 0 0 / .3), inset 0 -3px 0 var(--lc, #94a3b8); }
.pin-label.st-overdue { --lc: var(--overdue); }
.pin-label.st-soon { --lc: var(--soon); }
.pin-label.st-ok { --lc: var(--ok); }
.pin-label .pl-text { display: flex; flex-direction: column; min-width: 0; padding-bottom: 2px; }
.pin-label .pl-text b, .pin-label .pl-text small { overflow: hidden; text-overflow: ellipsis; }
.pin-label .pl-text b { font-weight: 700; }
.pin-label .pl-text small { font-size: 11px; color: var(--muted); }
.pin-label .pl-text .pl-street { font-size: 10px; color: var(--muted); opacity: .85; overflow: hidden; text-overflow: ellipsis; }
.pin-label img { align-self: center; }
.pin-label img { width: 30px; height: 30px; border-radius: 7px; object-fit: cover; flex: none; margin-bottom: 2px; }
.pin-label.lbl-hide { display: none; }
.leaflet-marker-icon:hover .pin-label.lbl-hide { display: flex; }
#map.far .pin-label, #map.labels-off .pin-label { display: none; }
.leaflet-marker-icon:hover .pin-label { box-shadow: 0 4px 12px #0006, inset 0 -3px 0 var(--lc, #94a3b8); }

/* Ciemna mapa: podpisy i dymki pinezek też ciemne (nie rażą po zmroku) */
html.map-night .pin-label { background: #1e293b; color: #e5e7eb; }
html.map-night .pin-label .pl-text small, html.map-night .pin-label .pl-text .pl-street { color: #94a3b8; }
html.map-night .leaflet-tooltip.pin-tip { background: #1e293b; color: #e5e7eb; border-color: #334155; }
html.map-night .leaflet-tooltip-right.pin-tip::before { border-right-color: #1e293b; }
html.map-night .leaflet-tooltip.pin-tip .tip small { color: #94a3b8; }

/* Motyw wybrany w aplikacji: kontrolki przeglądarki (pola, przewijanie) w tym samym kolorze */
:root.theme-dark { color-scheme: dark; }
:root.theme-light { color-scheme: light; }
.am-theme { padding: .35rem .6rem .5rem; border-bottom: 1px solid var(--border); margin-bottom: .2rem; }
.am-theme .seg, .sheet-theme .seg { display: flex; width: 100%; }
.am-theme .seg button, .sheet-theme .seg button { flex: 1; font-size: .8rem; padding: .3rem .2rem; white-space: nowrap; }
.sheet-theme { display: flex; flex-direction: column; gap: .3rem; margin: .6rem 0 .2rem; }

/* ==================== Animacje ====================
   Krótkie i lekkie; wszystkie wyłączone przy „ograniczaj ruch” w systemie (na dole). */

/* Pinezki spadają na mapę przy pierwszym pokazaniu, cień rośnie, gdy pinezka „ląduje” */
.pin.drop { animation: pin-drop .55s cubic-bezier(.3, 1.35, .55, 1) var(--d, 0ms) both; }
@keyframes pin-drop { 0% { transform: translateY(-60px); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; } }
.pin-shadow.drop { animation: shadow-drop .55s ease-out var(--d, 0ms) both; }
@keyframes shadow-drop { 0% { transform: scale(.3); opacity: 0; } 100% { transform: none; opacity: 1; } }
/* Grupy pinezek i podpisy pojawiają się miękko */
.marker-cluster { animation: cl-in .3s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes cl-in { from { transform: scale(.4); opacity: 0; } }
.pin-label { animation: lbl-in .25s ease-out; }
@keyframes lbl-in { from { opacity: 0; margin-bottom: -6px; } }
.leaflet-tooltip.pin-tip { animation: lbl-in .18s ease-out; }

/* Okna: wjazd z lekkim powiększeniem, tło przyciemnia się płynnie */
dialog[open]:not(.sheet) { animation: dlg-in .24s cubic-bezier(.2, .9, .3, 1.15); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
dialog[open]::backdrop { animation: fade-in .22s ease-out; }
@keyframes fade-in { from { opacity: 0; } }

/* Widoki (tabela, kalendarz, plan, pulpit) i zakładki w oknach */
.view-panel:not([hidden]) { animation: view-in .28s ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }
.stab:not([hidden]) { animation: fade-in .2s ease-out; }

/* Menu konta i powiadomienia rozwijają się z góry */
#acctMenu:not([hidden]) { animation: menu-in .18s ease-out; transform-origin: top right; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px) scale(.97); } }

/* Przyciski: delikatne uniesienie przy najechaniu (tylko mysz) */
@media (hover: hover) {
    button.primary:hover:not(:disabled), .lp-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 35%, transparent); }
    .dash-tile { transition: transform .15s, box-shadow .15s; }
    .dash-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
}

/* Kafelki pulpitu wjeżdżają po kolei */
.dash-tiles > *, .dash-stats > * { animation: view-in .35s ease-out both; }
.dash-tiles > :nth-child(2), .dash-stats > :nth-child(2) { animation-delay: .04s; }
.dash-tiles > :nth-child(3), .dash-stats > :nth-child(3) { animation-delay: .08s; }
.dash-tiles > :nth-child(4), .dash-stats > :nth-child(4) { animation-delay: .12s; }
.dash-tiles > :nth-child(n+5), .dash-stats > :nth-child(n+5) { animation-delay: .16s; }

/* Odhaczenie w „Pierwszych krokach” i na liście kontrolnej */
.onboard li.done .ob-check, .check-list .on { animation: tick .3s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes tick { from { transform: scale(.4); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after, *::backdrop { animation-duration: .01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Przeciąganie pinezki: uniesiona (cień oddala się i blednie), podpis i dymek schowane */
.pin-wrap.dragging { cursor: grabbing; z-index: 100000 !important; }
.pin-wrap.dragging .pin { transform: translateY(-14px) scale(1.12); filter: drop-shadow(0 10px 6px rgb(0 0 0 / .25)); animation: none; }
.pin-wrap.dragging .pin-shadow { transform: translate(6px, 2px) scale(1.15); opacity: .45; transition: transform .2s, opacity .2s; }
.pin-wrap.dragging :is(.pin-label, .pin-halo, .pin-orders, .pin-dot) { opacity: 0; }
.pin-wrap.dragging::after {
    content: ''; position: absolute; left: 20px; top: 52px; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
    background: var(--primary); box-shadow: 0 0 0 3px #fff8, 0 0 0 6px color-mix(in srgb, var(--primary) 30%, transparent);
}
body.pin-dragging .leaflet-container { cursor: grabbing; }
/* Upuszczenie: opada z odbiciem, cień wraca, fala w miejscu lądowania */
.pin-wrap.landed .pin { animation: pin-land .5s cubic-bezier(.3, 1.6, .5, 1) var(--ld, 0ms); }
@keyframes pin-land { 0% { transform: translateY(-14px) scale(1.12); } 55% { transform: translateY(0) scale(.94, 1.06); } 100% { transform: none; } }
.pin-wrap.landed .pin-shadow { animation: shadow-land .5s ease-out var(--ld, 0ms); }
@keyframes shadow-land { 0% { transform: translate(6px, 2px) scale(1.15); opacity: .45; } 100% { transform: none; opacity: 1; } }
.pin-wrap.landed::after {
    content: ''; position: absolute; left: 20px; top: 52px; width: 44px; height: 16px; margin: -8px 0 0 -22px; border-radius: 50%;
    border: 2px solid var(--primary); animation: land-wave .6s ease-out var(--ld, 0ms) forwards; pointer-events: none;
}
@keyframes land-wave { from { transform: scale(.2); opacity: .9; } to { transform: scale(1.5); opacity: 0; } }

/* Adres na żywo nad przeciąganą pinezką */
.drag-addr {
    position: absolute; left: 20px; bottom: 70px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center;
    background: var(--panel); color: var(--text); border-radius: 10px; padding: 5px 11px; white-space: nowrap; pointer-events: none;
    font: 13px/1.3 system-ui, sans-serif; box-shadow: 0 4px 14px rgb(0 0 0 / .3), inset 0 -3px 0 var(--primary); animation: lbl-in .2s ease-out;
}
.drag-addr::after { content: ''; position: absolute; left: 50%; top: 100%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--primary); border-bottom: 0; }
.drag-addr b { font-weight: 700; }
.drag-addr small { font-size: 11px; color: var(--muted); }
.drag-addr.busy b::after { content: ' …'; animation: busy-dots 1s infinite; }
@keyframes busy-dots { 50% { opacity: .2; } }

/* „Napisz do nas” i ogłoszenia */
.support-dialog textarea { width: 100%; margin-top: .6rem; }
.sup-kind { display: flex; }
.sup-kind button { flex: 1; }
.sup-list { list-style: none; margin: .3rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; max-height: 40vh; overflow: auto; }
.sup-list li { border: 1px solid var(--border); border-radius: 10px; padding: .55rem .7rem; font-size: .88rem; }
.sup-list li.fresh { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.sup-head { display: flex; justify-content: space-between; gap: .5rem; color: var(--muted); font-size: .8rem; }
.sup-msg { margin: .3rem 0 0; white-space: pre-line; }
.sup-reply { margin-top: .5rem; padding: .5rem .6rem; border-radius: 8px; background: color-mix(in srgb, var(--primary) 9%, var(--panel)); }
.sup-reply p { margin: .25rem 0 0; white-space: pre-line; }
.pub-status.s-closed { background: var(--hover); color: var(--muted); }
#acctBtn.has-reply, #bnMore.has-reply { position: relative; }
#acctBtn.has-reply::after, #bnMore.has-reply::after {
    content: ''; position: absolute; top: 4px; right: 4px; width: 9px; height: 9px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 2px var(--top, #1e293b);
}
.ann-bar { display: flex; flex-direction: column; }
.ann { display: flex; align-items: center; gap: .6rem; padding: .45rem 1rem; font-size: .9rem; background: #dbeafe; color: #1e3a8a; }
.ann-warn { background: #fef3c7; color: #78350f; }
.ann-new { background: #ede9fe; color: #4c1d95; }
.ann .icon-btn { color: inherit; opacity: .7; }
:root.theme-dark .ann { background: #1e3a8a; color: #dbeafe; }
:root.theme-dark .ann-warn { background: #78350f; color: #fef3c7; }
:root.theme-dark .ann-new { background: #4c1d95; color: #ede9fe; }

/* Menu konta: podpowiedź pod pozycją (np. „Dane firmy: logo, telefon, NIP”) */
.acct-menu .am-hint { margin-left: auto; font-size: .72rem; color: var(--muted); }
.firm-where { margin: -.2rem 0 .8rem; }

/* Dane do przelewu (okno „Twój abonament”): kopiowanie i kod QR dla aplikacji banku */
.transfer { margin: .6rem 0 .2rem; border: 1px solid var(--border); border-radius: 12px; padding: .75rem .9rem; background: color-mix(in srgb, var(--primary) 5%, var(--panel)); }
.tr-intro { margin: 0 0 .5rem; font-size: .9rem; }
.tr-grid { display: flex; flex-wrap: wrap; gap: .8rem 1rem; align-items: flex-start; }
.tr-data { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: .45rem; }
.tr-row { display: grid; grid-template-columns: 1fr auto; column-gap: .5rem; align-items: center; line-height: 1.3; }
.tr-row span { grid-column: 1 / -1; font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; opacity: .7; }
.tr-row b { font-weight: 600; overflow-wrap: anywhere; font-size: .95rem; }
.tr-or { margin: .2rem 0 0; font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; opacity: .7; border-top: 1px dashed currentColor; padding-top: .5rem; }
.tr-blik-hint { margin: 0; font-size: .8rem; opacity: .8; }
.tr-copy { padding: .15rem .3rem; border-radius: 6px; font-size: .85rem; line-height: 1; }
.tr-qr { margin: 0 auto; width: 150px; flex: 0 0 150px; text-align: center; }
.tr-qr img { display: block; width: 150px; height: 150px; background: #fff; border-radius: 8px; }
.tr-qr figcaption { font-size: .72rem; color: var(--muted); margin-top: .25rem; line-height: 1.25; }
