/* ANWS — giełda zleceń (lista-zlecen.html) */

:root {
  --an-create: linear-gradient(135deg, #52305A 0%, #3A1F3D 60%, #2C1630 100%);
  --row-bg: rgba(255, 255, 255, 0.55);
  --row-hover: rgba(255, 255, 255, 0.85);
  --row-urgent: rgba(233, 201, 138, 0.22);
  --head-bg: rgba(244, 239, 232, 0.86);
  --gold: #E9C98A;
  --gold-ink: #3A2410;
}
:root[data-theme="dark"] {
  --an-create: linear-gradient(135deg, #6A4170 0%, #4A2950 60%, #34203A 100%);
  --row-bg: rgba(27, 29, 34, 0.62);
  --row-hover: rgba(40, 43, 50, 0.9);
  --row-urgent: rgba(233, 201, 138, 0.1);
  --head-bg: rgba(15, 16, 19, 0.88);
}

.js-guard .app-head, .js-guard .app-main { visibility: hidden; }

body.app { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }

/* ---------- menu giełdy ---------- */

.app-head {
  position: relative; z-index: 1100; flex-shrink: 0;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px;
  padding: 10px 18px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(170%); backdrop-filter: blur(var(--blur)) saturate(170%);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .05);
}
.app-head .logo { --logo-w: 92px; }
.app-nav { display: flex; justify-content: center; gap: 8px; }
.an-btn {
  position: relative; display: inline-flex; align-items: center; gap: 9px;
  min-height: 46px; padding: 0 18px 0 7px; border-radius: 999px;
  border: 1px solid var(--ib-border); background: var(--ib-bg); color: var(--ink);
  font: 600 14.5px var(--font-body); white-space: nowrap; cursor: pointer;
  transition: transform .2s var(--ease-out), background-color .25s, color .25s, box-shadow .25s;
}
.an-btn:hover { transform: translateY(-1px); background: var(--ib-hover); }
.an-ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: #EDE6DC; flex-shrink: 0; }
.an-list .an-ic { background: var(--bubble-olive); }
.an-urgent .an-ic { background: var(--bubble-gold); }

/* „Utwórz zlecenie” — wyróżniony: fioletowy gradient z kafelka, oliwkowy plus, puls */
.an-create { background: var(--an-create); color: #EDE6DC; border-color: transparent; box-shadow: 0 8px 22px rgba(58, 31, 61, .32), inset 0 1px 0 rgba(255, 255, 255, .2); }
.an-create:hover { background: var(--an-create); box-shadow: 0 12px 28px rgba(58, 31, 61, .42), inset 0 1px 0 rgba(255, 255, 255, .25); }
.an-create .an-ic { background: var(--bubble-olive); box-shadow: 0 0 0 0 rgba(181, 199, 127, .6); animation: an-pulse 2.8s ease-out infinite; }
@keyframes an-pulse { 0% { box-shadow: 0 0 0 0 rgba(181, 199, 127, .55); } 70%, 100% { box-shadow: 0 0 0 10px rgba(181, 199, 127, 0); } }
.an-create:hover .an-ic svg { transform: rotate(90deg); transition: transform .45s var(--ease-spring); }

.an-list[aria-pressed="true"] { background: var(--tile2); color: var(--tile-ink); border-color: transparent; }
.an-urgent[aria-pressed="true"] { background: var(--tile3); color: var(--tile-ink); border-color: transparent; }
.an-count { min-width: 22px; padding: 2px 7px; border-radius: 999px; background: var(--gold); color: var(--gold-ink); font: 700 12px var(--font-body); text-align: center; }

.app-tools { display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 3px 12px 3px 3px; border-radius: 999px; background: var(--ib-bg); border: 1px solid var(--ib-border); min-width: 0; }
.uc-avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--bubble-olive); color: #EDE6DC; font: 700 13px var(--font-display); flex-shrink: 0; }
.uc-text { display: grid; line-height: 1.15; min-width: 0; }
.uc-text b { font-size: 13px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uc-plan { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); white-space: nowrap; }
.user-chip[data-plan="sub"] .uc-plan, .user-chip[data-plan="free"] .uc-plan { color: var(--ok-ink); }
.user-chip[data-plan="need"] .uc-plan { color: var(--err-ink); }
.user-chip[data-plan="admin"] .uc-plan { color: var(--accent-text); }
.user-chip[data-plan="admin"] .uc-avatar { background: var(--btn-bg); color: var(--btn-ink); }
a.user-chip { color: var(--ink); text-decoration: none; transition: background-color .2s; }
a.user-chip:hover { background: var(--ib-hover); color: var(--ink); }

/* ---------- układ: lista | uchwyt | mapa ---------- */

.app-main {
  --split: 58%;
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: minmax(0, var(--split)) 14px minmax(0, 1fr);
}
.app-main[data-view="list"] { grid-template-columns: minmax(0, 1fr); }
.app-main[data-view="list"] .pane-resizer, .app-main[data-view="list"] .pane-map { display: none; }
.app-main[data-view="map"] { grid-template-columns: minmax(0, 1fr); }
.app-main[data-view="map"] .pane-resizer, .app-main[data-view="map"] .pane-list { display: none; }
.app-main.is-dragging { cursor: col-resize; user-select: none; }

.pane { min-height: 0; min-width: 0; }
.pane-list { display: flex; flex-direction: column; container-type: inline-size; container-name: list; }
/* w trybie „tylko mapa” przełącznik układu musi zostać pod ręką — pokazujemy go na mapie */
.view-switch.map-views { display: none; }
.app-main[data-view="map"] .view-switch.map-views { display: inline-flex; }

.pane-resizer { position: relative; display: grid; place-items: center; cursor: col-resize; touch-action: none; background: transparent; }
.pane-resizer::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: var(--line); }
.grip { position: relative; width: 6px; height: 54px; border-radius: 6px; background: var(--ib-border); transition: background-color .2s, height .2s; }
.pane-resizer:hover .grip, .pane-resizer:focus-visible .grip, .is-dragging .grip { background: var(--accent); height: 72px; }
.pane-resizer:focus-visible { outline: none; }
.pane-resizer:focus-visible .grip { box-shadow: 0 0 0 3px var(--focus); }

/* ---------- górna część listy ---------- */

.gl-top { display: grid; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.gl-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gl-title-row h1 { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: clamp(22px, 2.2vw, 28px); letter-spacing: -0.02em; }
.gl-count { font-family: var(--font-body); font-size: 14px; font-weight: 600; color: var(--ink-muted); }

.view-switch, .map-mode, .chip-row { display: inline-flex; gap: 3px; padding: 3px; border-radius: 999px; background: var(--ib-bg); border: 1px solid var(--ib-border); }
.view-switch button, .map-views button { display: grid; place-items: center; width: 40px; height: 36px; border: 0; border-radius: 999px; background: none; color: var(--ink-muted); cursor: pointer; transition: background-color .2s, color .2s; }
.view-switch button:hover, .map-views button:hover { color: var(--ink); }
.view-switch button[aria-pressed="true"], .map-views button[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-ink); }

.gl-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.gl-search { flex: 1 1 220px; min-width: 0; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--input-border); background: var(--input-bg); color: var(--ink-muted); transition: border-color .2s, box-shadow .2s; }
.gl-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--input-ring); }
.gl-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: var(--ink); font: 500 15px var(--font-body); outline: none; }
.fchip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 13px; border-radius: 999px; border: 0; background: none; color: var(--ink-muted); font: 600 13.5px var(--font-body); white-space: nowrap; cursor: pointer; transition: background-color .2s, color .2s; }
.fchip:hover { color: var(--ink); }
.fchip[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-ink); }
.gl-filters > .fchip { min-height: 44px; border: 1px solid var(--ib-border); background: var(--ib-bg); }
.gl-filters > .fchip-urgent[aria-pressed="true"] { background: var(--gold); color: var(--gold-ink); border-color: transparent; }
.gl-filters > .fchip-more[aria-expanded="true"] { border-color: var(--accent); }
.fchip-more b { min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--accent); color: var(--bg); font-size: 11.5px; }
.fchip-more b[hidden] { display: none; }

.f-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; padding: 14px 16px; border-radius: 18px; background: var(--ib-bg); }
.f-panel[hidden] { display: none; }
.f-panel .field input { min-height: 42px; }
.f-sort { width: 100%; min-height: 42px; }
.link-btn { padding: 8px 0; border: 0; background: none; color: var(--accent-text); font: 600 14px var(--font-body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; justify-self: start; }

/* ---------- tabela zleceń ---------- */

.gl-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 12px 24px; scroll-padding-top: 52px; }
.gl-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
.gl-table thead th { position: sticky; top: 0; z-index: 2; padding: 10px 10px 4px; text-align: left; background: var(--head-bg); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); white-space: nowrap; }
.gl-table th.num, .gl-table td.num { text-align: right; }
.gl-table td:nth-child(1), .gl-table td:nth-child(3) { min-width: 170px; }
.gl-table td:nth-child(7) { width: 1%; }
.th-sort { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; margin: 0 -8px; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.th-sort:hover { color: var(--ink); background: var(--ib-bg); }
.num .th-sort { flex-direction: row-reverse; }
.sort-ic { width: 8px; height: 12px; opacity: .45; background: linear-gradient(currentColor, currentColor) 50% 0 / 0 0 no-repeat; position: relative; }
.sort-ic::before, .sort-ic::after { content: ""; position: absolute; left: 0; border: 4px solid transparent; }
.sort-ic::before { top: -3px; border-bottom-color: currentColor; }
.sort-ic::after { bottom: -3px; border-top-color: currentColor; }
th[aria-sort="ascending"] .sort-ic, th[aria-sort="descending"] .sort-ic { opacity: 1; color: var(--accent-text); }
th[aria-sort="ascending"] .sort-ic::after, th[aria-sort="descending"] .sort-ic::before { opacity: 0; }
th[aria-sort="ascending"] .th-sort, th[aria-sort="descending"] .th-sort { color: var(--ink); }

.order td { padding: 14px 10px; vertical-align: middle; background: var(--row-bg); font-size: 14.5px; transition: background-color .2s, box-shadow .2s; }
.order td:first-child { border-radius: 18px 0 0 18px; padding-left: 14px; }
.order td:last-child { border-radius: 0 18px 18px 0; padding-right: 14px; }
.order:hover td, .order.is-hl td, .order.is-selected td { background: var(--row-hover); }
.order.is-hl td, .order.is-selected td { box-shadow: inset 0 2px 0 var(--accent), inset 0 -2px 0 var(--accent); }
.order.is-hl td:first-child, .order.is-selected td:first-child { box-shadow: inset 2px 2px 0 var(--accent), inset 2px -2px 0 var(--accent); }
.order.is-hl td:last-child, .order.is-selected td:last-child { box-shadow: inset -2px 2px 0 var(--accent), inset -2px -2px 0 var(--accent); }
.order.is-urgent td { background: linear-gradient(var(--row-urgent), var(--row-urgent)), var(--row-bg); }
.order.is-urgent:hover td { background: linear-gradient(var(--row-urgent), var(--row-urgent)), var(--row-hover); }
.order.is-flash td { animation: row-flash 1.2s ease; }
@keyframes row-flash { 0%, 40% { background: rgba(181, 199, 127, .45); } }
/* przygaszamy treść, nie komórki — tło wiersza zostaje równe (bez jaśniejszej plamy przy przyciskach) */
.order.is-done td:not(:last-child) > * { opacity: .62; }

.pl { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.pin {
  flex-shrink: 0; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--ib-bg); border: 1px solid var(--ib-border); color: var(--accent-text);
  transition: background-color .2s, color .2s, transform .2s var(--ease-spring);
}
.pin:hover { background: var(--bubble-olive); color: #fff; transform: translateY(-1px) scale(1.06); }
.pin-to { color: var(--ln-a); }
.pin-to:hover { background: var(--ln-a); color: var(--ln-a-ink); }
.pl-text { display: grid; gap: 3px; min-width: 0; }
.pl-name { font-weight: 600; line-height: 1.3; overflow-wrap: break-word; hyphens: auto; }
.pl-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--ink-muted); }
.tag-urgent { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 6px; border-radius: 999px; background: var(--gold); color: var(--gold-ink); font-size: 11.5px; font-weight: 700; letter-spacing: .02em; }

.tm { display: grid; gap: 2px; white-space: nowrap; }
.tm-day { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted); }
.tm-time { font-family: var(--font-display); font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tm-rel { justify-self: start; margin-top: 2px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--ok-bg); color: var(--ok-ink); }
.tm-rel.is-soon { background: var(--gold); color: var(--gold-ink); }
.tm-rel.is-over { background: var(--ib-border); color: var(--ink-muted); }
.km { font-family: var(--font-display); font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rate { display: grid; gap: 2px; justify-items: end; white-space: nowrap; }
.rate b { font-family: var(--font-display); font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rate span { font-size: 12px; color: var(--ink-muted); }

.acts { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.g-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; font: 600 13.5px var(--font-body); white-space: nowrap; cursor: pointer; transition: transform .15s, background-color .2s, color .2s; }
.g-btn:hover:not([disabled]) { transform: translateY(-1px); }
.g-btn-ghost { border: 1px solid var(--ib-border); background: var(--ib-bg); color: var(--ink); }
.g-btn-ghost:hover:not([disabled]) { background: var(--ib-hover); }
.g-btn-primary { border: 0; background: var(--btn-bg); color: var(--btn-ink); }
.g-btn-primary:hover:not([disabled]) { background: var(--btn-hover); }
.g-btn[disabled] { cursor: default; opacity: .55; }
.g-btn.is-mine { opacity: 1; background: var(--ok-bg); color: var(--ok-ink); border: 1px solid var(--ok-border); }
.g-btn[hidden] { display: none; }
.g-btn-danger { border: 1px solid var(--err-border); background: var(--err-bg); color: var(--err-ink); }
.g-btn-danger:hover:not([disabled]) { background: var(--err-ink); border-color: var(--err-ink); color: var(--input-bg, #fff); }
.offer-note.is-warn { color: var(--err-ink); font-weight: 600; }
.offer-note { display: block; margin-top: 6px; font-size: 12px; color: var(--ok-ink); text-align: right; white-space: nowrap; }

.gl-empty { display: grid; justify-items: center; gap: 12px; padding: 48px 20px; text-align: center; color: var(--ink-muted); }
.gl-empty[hidden] { display: none; }

/* wąska lista (np. po poszerzeniu mapy) — wiersze zamieniają się w karty */
/* (karty włącza skrypt, gdy tabela nie mieści się w szerokości listy — klasa .is-cards) */
.pane-list.is-cards .gl-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.pane-list.is-cards .gl-table, .pane-list.is-cards .gl-table tbody { display: block; }
.pane-list.is-cards .gl-table tbody { display: grid; gap: 10px; padding-top: 10px; }
.pane-list.is-cards .order { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 4px; padding: 14px 14px 12px; border-radius: 20px; background: var(--row-bg); transition: background-color .2s, box-shadow .2s; }
.pane-list.is-cards .order.is-urgent { background: linear-gradient(var(--row-urgent), var(--row-urgent)), var(--row-bg); }
.pane-list.is-cards .order:hover, .pane-list.is-cards .order.is-hl, .pane-list.is-cards .order.is-selected { background: var(--row-hover); }
.pane-list.is-cards .order.is-hl, .pane-list.is-cards .order.is-selected { box-shadow: inset 0 0 0 2px var(--accent); }
.pane-list.is-cards .order td, .pane-list.is-cards .order td:first-child, .pane-list.is-cards .order td:last-child { display: block; padding: 4px 0; background: none !important; border-radius: 0; box-shadow: none !important; }
.pane-list.is-cards .order td:nth-child(1) { grid-column: 1; grid-row: 1; }
.pane-list.is-cards .order td:nth-child(2) { grid-column: 2; grid-row: 1; text-align: right; }
.pane-list.is-cards .order td:nth-child(3) { grid-column: 1; grid-row: 2; position: relative; }
.pane-list.is-cards .order td:nth-child(4) { grid-column: 2; grid-row: 2; text-align: right; }
.pane-list.is-cards .order td:nth-child(5) { grid-column: 1; grid-row: 3; text-align: left; align-self: center; }
.pane-list.is-cards .order td:nth-child(6) { grid-column: 2; grid-row: 3; }
.pane-list.is-cards .order td:nth-child(7) { grid-column: 1 / -1; grid-row: 4; padding-top: 10px; }
.pane-list.is-cards .order td:nth-child(2) .tm, .pane-list.is-cards .order td:nth-child(4) .tm { justify-items: end; }
.pane-list.is-cards .order td:nth-child(2) .tm-rel { justify-self: end; }
/* łącznik trasy między pinezką „skąd” i „dokąd” */
.pane-list.is-cards .order td:nth-child(3)::before { content: ""; position: absolute; left: 16px; top: -10px; height: 12px; border-left: 2px dashed var(--ib-border); }
.pane-list.is-cards .order td:nth-child(5) .km::before { content: ""; }
.pane-list.is-cards .order td:nth-child(7) { width: auto; min-width: 0; }
.pane-list.is-cards .order td:nth-child(1), .pane-list.is-cards .order td:nth-child(3) { min-width: 0; }
.pane-list.is-cards .acts { justify-content: stretch; }
.pane-list.is-cards .acts .g-btn { flex: 1; }
.pane-list.is-cards .offer-note { text-align: left; }

/* ---------- mapa ---------- */

.pane-map { position: relative; display: flex; flex-direction: column; }
.map-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; justify-content: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.map-mode button { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: none; color: var(--ink-muted); font: 600 13.5px var(--font-body); cursor: pointer; }
.map-mode button[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-ink); }
.mm-dot { width: 10px; height: 10px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); }
.mm-dep { background: var(--bubble-olive); }
.mm-arr { background: var(--ln-a); }
.map-note { flex: 1; font-size: 13px; color: var(--ink-muted); }
.map { flex: 1; min-height: 0; background: var(--bg-soft); }
.leaflet-container { font-family: var(--font-body); background: var(--bg-soft); }
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.88) contrast(.92) saturate(.55); }
.leaflet-control-attribution { font-size: 10.5px; }
.leaflet-bar a { color: #1B1D22; }

/* pinezki w kształcie kropli */
.mk { position: relative; display: block; width: 30px; height: 30px; }
.mk i { position: absolute; inset: 0; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--bubble-olive); box-shadow: 0 6px 14px rgba(0, 0, 0, .28), inset 0 0 0 3px rgba(255, 255, 255, .9); transition: transform .2s var(--ease-spring); }
.mk b { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font: 700 11px var(--font-display); }
.mk-arr i { background: var(--ln-a); }
.mk-urgent i { background: #C08A3E; }
.mk.is-hl i { transform: rotate(-45deg) scale(1.3); }
.leaflet-marker-icon.is-hl-wrap { z-index: 999 !important; }
.mk-a i { background: var(--bubble-olive); }

/* skupienie na zleceniu: pozostałe pinezki gasną, punkty zlecenia „wyskakują”, trasa rysuje się linią */
.map .leaflet-marker-icon { transition: opacity .3s ease; }
.map .leaflet-marker-icon.is-dim { opacity: 0 !important; pointer-events: none; }
.map .leaflet-tile-pane { transition: filter .45s ease; }
:root:not([data-theme="dark"]) .map.is-focus .leaflet-tile-pane { filter: saturate(.5) brightness(1.03); }
:root[data-theme="dark"] .map.is-focus .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.72) contrast(.92) saturate(.35); }
.mk.mk-pop { transform-origin: 50% 100%; animation: mk-pop .5s var(--ease-spring) backwards; }
@keyframes mk-pop { from { opacity: 0; transform: translateY(10px) scale(.2); } }
.rt-line, .rt-casing { pointer-events: none; }
.rt-fade { animation: rt-fade .35s ease both; }
@keyframes rt-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .mk.mk-pop, .rt-fade { animation: none; } .map .leaflet-marker-icon, .map .leaflet-tile-pane { transition: none; } }
.mk-b i { background: var(--ln-a); }
.mk-c i { background: var(--bubble-gold); }

.leaflet-popup-content-wrapper { border-radius: 16px; background: var(--menu-bg); color: var(--ink); box-shadow: 0 16px 40px rgba(0, 0, 0, .25); }
.leaflet-popup-tip { background: var(--menu-bg); }
.leaflet-popup-content { margin: 12px 14px; font-size: 13.5px; line-height: 1.45; }
.mp-title { font-weight: 700; margin-bottom: 2px; }
.mp-meta { color: var(--ink-muted); }
.mp-btn { margin-top: 8px; padding: 6px 12px; border: 0; border-radius: 999px; background: var(--btn-bg); color: var(--btn-ink); font: 600 12.5px var(--font-body); cursor: pointer; }


/* „Twoje zlecenia” w menu */
.an-mine .an-ic { background: var(--bubble-brown); }
.an-mine[aria-pressed="true"] { background: var(--tile1); color: var(--tile-ink); border-color: transparent; }
.an-count-mine { background: var(--ib-border); color: var(--ink); }
.an-mine[aria-pressed="true"] .an-count-mine { background: var(--tile-ink); color: var(--tile1); }

/* dodatkowe przystanki w wierszu */
.tag-stops { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; background: var(--ib-bg); border: 1px solid var(--ib-border); color: var(--ink); font-size: 11.5px; font-weight: 700; cursor: help; }

/* formularz: przełącznik „kliknięcie dodaje” i listy punktów */
.cr-mode { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 999px; background: var(--ib-bg); border: 1px solid var(--ib-border); justify-self: start; }
.cr-mode button { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 14px 0 6px; border: 0; border-radius: 999px; background: none; color: var(--ink-muted); font: 600 13.5px var(--font-body); cursor: pointer; transition: background-color .2s, color .2s; }
.cr-mode button[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-ink); }
.cr-stops { border: 0; margin: 0; padding: 12px 14px; display: grid; gap: 8px; border-radius: 16px; background: var(--ib-bg); min-width: 0; }
.cr-stops legend { float: left; width: 100%; display: flex; align-items: center; gap: 8px; padding: 0; margin-bottom: 2px; font-size: 14px; font-weight: 600; }
.stop-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; clear: both; }
.stop-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.stop-row .cr-pin { width: 30px; height: 30px; font-size: 11px; }
.stop-row input { width: 100%; min-height: 42px; padding: 0 12px; border-radius: 12px; border: 1.5px solid var(--input-border); background: var(--input-bg); color: var(--ink); font: 500 14.5px var(--font-body); }
.stop-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--input-ring); }
.stop-rm { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; color: var(--ink-muted); cursor: pointer; }
.stop-rm:hover { background: var(--err-bg); color: var(--err-ink); }
.stop-empty { font-size: 13px; color: var(--ink-muted); clear: both; }
.stop-empty[hidden] { display: none; }
.stop-field { position: relative; min-width: 0; }
.stop-field .cr-results { left: 0; right: 0; }
.stop-row.is-empty .cr-pin { opacity: .55; }
.stop-row input::placeholder { color: var(--ink-muted); opacity: .8; }
.cr-stops .link-btn { padding: 2px 0; }
.mk-a b, .mk-b b, .mk-c b { font-size: 10px; }

/* koniec trasy (C): jedno pole, domyślnie puste */
#cr-return[disabled] { opacity: .45; cursor: default; text-decoration: none; }
.tag-end { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; background: rgba(168, 121, 63, .16); color: var(--ink); font-size: 11.5px; font-weight: 700; }

/* ---------- powiadomienie (toast) ---------- */

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 60; max-width: calc(100vw - 32px); padding: 13px 20px; border-radius: 999px; background: var(--btn-bg); color: var(--btn-ink); font-weight: 600; font-size: 14.5px; box-shadow: 0 16px 36px rgba(0, 0, 0, .25); opacity: 0; transform: translate(-50%, 16px); pointer-events: none; transition: opacity .25s, transform .3s var(--ease-out); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- okna: nowe zlecenie, rezerwacja, negocjacja ---------- */

.field textarea { width: 100%; padding: 12px 16px; border-radius: 14px; border: 1.5px solid var(--input-border); background: var(--input-bg); color: var(--ink); font: 500 15px/1.5 var(--font-body); resize: vertical; transition: border-color .2s, box-shadow .2s; }
.field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--input-ring); }
.suffix-wrap { position: relative; }
.suffix-wrap input { padding-right: 46px; }
.suffix-wrap span { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-weight: 600; color: var(--ink-muted); pointer-events: none; }

.cr-panel { width: min(1100px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; justify-items: stretch; text-align: left; gap: 18px; padding: 26px 26px 24px; }
.cr-head { display: flex; align-items: center; gap: 14px; padding-right: 52px; }
.cr-head .auth-badge { flex-shrink: 0; }
.cr-form { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 24px; }
.cr-mapcol { display: grid; gap: 10px; align-content: start; }
.cr-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; }
.cr-step { display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px 5px 5px; border-radius: 999px; background: var(--ib-bg); border: 1.5px solid transparent; font-size: 13.5px; font-weight: 600; color: var(--ink-muted); transition: border-color .2s, background-color .2s, color .2s; }
.cr-step.is-current { border-color: var(--accent); color: var(--ink); }
.cr-step.is-set { background: var(--ok-bg); color: var(--ink); }
.cr-pin { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; font: 700 12px var(--font-display); vertical-align: middle; }
.cr-pin-a { background: var(--bubble-olive); }
.cr-pin-b { background: var(--ln-a); color: var(--ln-a-ink); }
.cr-pin-c { background: var(--bubble-gold); }
.cr-search { position: relative; display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 14px; border-radius: 14px; border: 1.5px solid var(--input-border); background: var(--input-bg); color: var(--ink-muted); }
.cr-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--input-ring); }
.cr-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: var(--ink); font: 500 15px var(--font-body); outline: none; }
.cr-results { position: absolute; left: -1.5px; right: -1.5px; top: calc(100% + 6px); z-index: 1200; margin: 0; padding: 6px; list-style: none; border-radius: 14px; background: var(--menu-bg); border: 1px solid var(--glass-border); box-shadow: 0 18px 40px rgba(0, 0, 0, .2); max-height: 260px; overflow-y: auto; }
.cr-results[hidden] { display: none; }
.cr-results li { padding: 10px 12px; border-radius: 10px; font-size: 14px; line-height: 1.35; color: var(--ink); cursor: pointer; }
.cr-results li[aria-selected="true"], .cr-results li:hover { background: var(--ib-bg); }
.cr-results li.is-empty { color: var(--ink-muted); cursor: default; }
.cr-map { height: 430px; border-radius: 18px; overflow: hidden; border: 1px solid var(--ib-border); cursor: crosshair; }
.cr-map .leaflet-interactive, .cr-map .leaflet-marker-icon { cursor: grab; }
.cr-maprow { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 14px; }
.cr-hint { font-size: 13.5px; line-height: 1.45; color: var(--ink-muted); }
.cr-fields { display: grid; gap: 14px; align-content: start; }
.cr-fields .reg-cols { align-items: start; }
.cr-fields .reg-cols .field { align-content: start; }
.cr-fields .field label { display: flex; align-items: center; gap: 8px; }
.cr-urgent { align-items: flex-start; min-height: 0; line-height: 1.45; padding: 12px 14px; border-radius: 14px; background: var(--row-urgent); }
.cr-urgent .check-box { flex-shrink: 0; margin-top: 1px; }
.cr-urgent-help { color: var(--ink-muted); font-weight: 500; }
.cr-dlg { padding: 16px 0; }


/* ---------- węższe ekrany ---------- */

/* na giełdzie pasek jest pełny: wylogowanie zawsze jako ikona, WhatsApp i e-mail są na pozostałych stronach */
.app-head .acct-logout { width: var(--btn, 44px); padding: 0; justify-content: center; }
.app-head .acct-logout span { display: none; }
.app-head .social { display: none; }
@media (max-width: 1700px) {
  .uc-text { display: none; }
  .user-chip { padding: 3px; }
  .app-head .phone-num { display: none; }
  .app-head .ib.call { width: var(--btn, 44px); padding: 0; justify-content: center; border-radius: 50%; }
}
@media (max-width: 1360px) and (min-width: 1181px) {
  .an-btn .an-ic { display: none; }
  .an-btn { padding: 0 16px; }
}
/* do 1180 px przyciski giełdy przechodzą na dolny pasek (jak na telefonie) */
@media (max-width: 1180px) {
  .app-head { grid-template-columns: auto 1fr; padding: 8px 12px; gap: 10px; -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--menu-bg); }
  .app-tools { justify-content: flex-end; gap: 6px; }
  .app-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    justify-content: space-around; gap: 4px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: var(--menu-bg); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(0, 0, 0, .08);
  }
  .an-btn { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 4px; min-height: 58px; padding: 6px 2px; text-align: center; line-height: 1.15; white-space: normal; border-radius: 16px; font-size: 12px; border: 0; background: none; }
  .an-btn:hover { transform: none; background: var(--ib-bg); }
  .an-create { background: var(--an-create); }
  .an-count { position: absolute; top: 4px; left: calc(50% + 10px); padding: 1px 6px; font-size: 11px; }
  .app-main { padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(90px + env(safe-area-inset-bottom)); }
}
@media (max-width: 1360px) {
  .an-btn { padding: 0 14px 0 7px; font-size: 14px; }
  .app-head .social { display: none; }
}
@media (max-width: 1240px) {
  .uc-text { display: none; }
  .user-chip { padding: 3px; }
  .app-head .phone-num { display: none; }
  .app-head .ib.call { width: var(--btn, 44px); padding: 0; justify-content: center; border-radius: 50%; }
}
@media (max-width: 1040px) {
  .an-btn { padding: 0 14px 0 7px; font-size: 14px; }
  .app-head .social { display: none; }
}
@media (max-width: 900px) {
  /* trzy główne przyciski na dolnym pasku, jak w aplikacji */
  /* bez rozmycia tła: inaczej dolny pasek (position: fixed) liczyłby się względem nagłówka, nie ekranu */
  .app-head { grid-template-columns: auto 1fr; padding: 8px 12px; gap: 10px; -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--menu-bg); }
  .app-tools { justify-content: flex-end; gap: 6px; }
  .app-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    justify-content: space-around; gap: 4px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: var(--menu-bg); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(0, 0, 0, .08);
  }
  .an-btn { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 4px; min-height: 58px; padding: 6px 2px; text-align: center; line-height: 1.15; white-space: normal; border-radius: 16px; font-size: 12px; border: 0; background: none; }
  .an-btn:hover { transform: none; background: var(--ib-bg); }
  .an-create { background: var(--an-create); }
  .an-count { position: absolute; top: 4px; left: calc(50% + 10px); padding: 1px 6px; font-size: 11px; }
  .app-main { padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
  .app-main[data-view="split"] { grid-template-columns: minmax(0, 1fr); }
  .app-main[data-view="split"] .pane-resizer, .app-main[data-view="split"] .pane-map { display: none; }
  .view-switch [data-view-btn="split"] { display: none; }
  .toast { bottom: calc(90px + env(safe-area-inset-bottom)); }
  .cr-form { grid-template-columns: 1fr; }
  .cr-map { height: 300px; }
}
@media (max-width: 640px) {
  .app-head .logo { --logo-w: 74px; }
  .app-head .user-chip, .app-head .nav-sep { display: none; }
  .app-head .ib.call { display: none; } /* brak miejsca na pasku — telefon jest na stronie głównej i w stopce */
  .app-head .acct-panel { position: fixed; top: 64px; right: 12px; }
  .gl-top { padding: 14px 14px 10px; }
  .gl-scroll { padding: 0 8px 20px; }
  .chip-row { order: 3; }
  .cr-panel { padding: 22px 16px 18px; }
  .dlg-actions { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .an-create .an-ic { animation: none; }
}

/* kontrahent przy zleceniu: nazwa od razu, telefony w dymku */
.party { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 300px; margin-right: 4px; text-align: left; }
.party-text { display: grid; gap: 1px; min-width: 0; line-height: 1.2; }
.party-text small { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); white-space: nowrap; }
.party-text b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gl-table .acts .party-text { width: 196px; } /* w tabeli kolumna przycisków jest wąska — nazwa dostaje stałe miejsce */
.party-ic { display: inline-flex; gap: 6px; flex-shrink: 0; }
.party-btn { --btn: 34px; color: var(--accent-text); }
.party-btn.is-alarm { color: var(--err-ink); }
.party-btn[aria-expanded="true"] { background: var(--btn-bg); color: var(--btn-ink); }
.phone-bub { position: fixed; z-index: 1300; width: min(340px, calc(100vw - 24px)); gap: 14px; padding: 22px 22px 20px; animation: call-in .2s var(--ease-out); }
.phone-bub[hidden] { display: none; }
.phone-bub .call-x { top: 10px; right: 10px; width: 38px; height: 38px; }
.phone-bub .call-who { padding-right: 40px; }
.phone-bub .call-avatar { width: 46px; height: 46px; border-radius: 16px; }
.phone-bub .call-name { font-size: 19px; }
.bub-company { font-size: 12.5px; color: var(--ink-muted); line-height: 1.3; margin-top: 2px; overflow-wrap: anywhere; }
.bub-kind { justify-self: center; margin-bottom: -10px; }
.phone-bub .call-num { font-size: clamp(24px, 6vw, 28px); }
.phone-bub .call-row { grid-template-columns: 1fr 1fr; }
.phone-bub .call-btn { min-height: 44px; padding: 0 12px; font-size: 14px; }
.bub-other { justify-self: stretch; text-align: center; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--ink-muted); }
.bub-other a { color: var(--accent-text); font-weight: 700; text-decoration: none; font-variant-numeric: tabular-nums; }
.pane-list.is-cards .acts .party { flex: 1 1 auto; max-width: none; }
.pane-list.is-cards .acts .party ~ .g-btn { flex: 0 0 auto; }
.pane-list.is-cards .gl-table .acts .party-text { width: auto; }
@media (max-width: 640px) {
  .phone-bub { left: 12px !important; right: 12px; top: auto !important; bottom: calc(90px + env(safe-area-inset-bottom)); width: auto; }
}

/* Twoje zlecenia: wystawione / do wykonania */
.mine-tabs { justify-self: start; max-width: 100%; }
.mine-tabs[hidden] { display: none; }
.mine-tabs button { min-height: 40px; }
.mt-count { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--ib-border); color: var(--ink); font-size: 12px; font-weight: 700; text-align: center; }
.mine-tabs button[aria-pressed="true"] .mt-count { background: var(--accent); color: #fff; }
.client-note { display: grid; gap: 2px; margin-top: 8px; font-size: 12.5px; line-height: 1.4; text-align: right; color: var(--ink-muted); }
.client-note > span:first-child { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.cn-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 10px; }
.cn-links a { color: var(--accent-text, var(--accent)); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 900px) {
  .client-note { text-align: left; }
  .cn-links { justify-content: flex-start; }
  .mine-tabs { justify-self: stretch; }
  .mine-tabs button { flex: 1; justify-content: center; padding: 0 10px; }
}

/* ---------- czas pracy kierowcy ---------- */
.tag-crew { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: rgba(168, 121, 63, .16); color: var(--ink); }
.tag-crew.is-rest { background: var(--err-bg); color: var(--err-ink); }
.dr-crew { padding-left: 34px; font-size: 13px; line-height: 1.45; color: var(--ink-muted); }
.dr-crew.is-two, .dr-crew.is-rest, .dr-crew.is-ext { color: var(--ink); font-weight: 600; }
.crew-box { display: grid; gap: 8px; padding: 14px 16px; border-radius: 18px; background: var(--ib-bg); border: 1px solid transparent; font-size: 13.5px; line-height: 1.5; }
.crew-box[hidden] { display: none; }
.crew-box[data-level="two"], .crew-box[data-level="ext"] { border-color: rgba(168, 121, 63, .4); }
.crew-box[data-level="rest"] { border-color: var(--err-border); }
.crew-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14.5px; }
.crew-pill { padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.crew-pill.is-one { background: var(--ok-bg); color: var(--ok-ink); }
.crew-pill.is-ext, .crew-pill.is-two { background: var(--gold); color: var(--gold-ink); }
.crew-pill.is-rest { background: var(--err-bg); color: var(--err-ink); }
.crew-facts { margin: 0; padding-left: 18px; color: var(--ink); }
.crew-facts .is-warn { color: var(--err-ink); font-weight: 600; }
.crew-why { color: var(--ink); }
.crew-note { font-size: 12px; color: var(--ink-muted); }
.db-note.is-warn { color: var(--err-ink); font-weight: 600; }

/* ---------- znaczek weryfikacji i potwierdzenie zlecenia ---------- */
.party-text b { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; }
.party-btn.is-doc { color: var(--ink); }
.arch-btn { --btn: 34px; flex-shrink: 0; color: var(--ink-muted); }
.arch-btn:hover { color: var(--ink); }

/* ---------- propozycje stawek (zlecający) ---------- */
.offer-open { display: block; margin-left: auto; padding: 0; border: 0; background: none; font: 600 12px var(--font-body); color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.offer-open:hover { color: var(--ink); }
.of-dlg { width: min(560px, calc(100vw - 32px)); }
.of-list { display: grid; gap: 10px; max-height: min(46vh, 460px); overflow: auto; }
.of-card { display: grid; gap: 10px; padding: 14px 16px; border-radius: 18px; border: 1px solid var(--ib-border); background: var(--ib-bg); }
.of-card.is-confirm { border-color: var(--accent); box-shadow: 0 0 0 3px var(--input-ring); }
.of-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.of-who { display: grid; gap: 2px; min-width: 0; }
.of-who b { display: inline-flex; align-items: center; gap: 5px; font-size: 15px; }
.of-who small { font-size: 12.5px; color: var(--ink-muted); }
.of-price { display: grid; justify-items: end; gap: 2px; }
.of-price b { font-family: var(--font-display); font-size: 22px; white-space: nowrap; }
.of-diff { font-size: 12.5px; font-weight: 700; color: var(--ink-muted); }
.of-diff.is-up { color: var(--err-ink); }
.of-diff.is-down { color: var(--ok-ink); }
.of-msg { font-size: 14px; line-height: 1.5; color: var(--ink); font-style: italic; }
.of-acts { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; }
.of-acts .call-btn { min-height: 44px; }
.of-confirm-note { color: var(--ink); }

/* ---------- przyciski w tabeli: stałe kolumny (kontrahent, dwa przyciski, archiwum) — równe linie w każdym wierszu ---------- */
.pane-list:not(.is-cards) .gl-table .acts { display: grid; grid-template-columns: [neg] 152px [res] 152px; justify-content: end; }
.pane-list:not(.is-cards) .gl-table[data-party="1"] .acts { grid-template-columns: [party] 322px [neg] 152px [res] 152px; }
.pane-list:not(.is-cards) .gl-table[data-arch="1"] .acts { grid-template-columns: [neg] 152px [res] 152px [arch] 34px; }
.pane-list:not(.is-cards) .gl-table[data-party="1"][data-arch="1"] .acts { grid-template-columns: [party] 322px [neg] 152px [res] 152px [arch] 34px; }
.pane-list:not(.is-cards) .gl-table .acts .party { grid-column: party; grid-row: 1; max-width: none; margin-right: 0; }
.pane-list:not(.is-cards) .gl-table .acts .is-neg { grid-column: neg; grid-row: 1; }
.pane-list:not(.is-cards) .gl-table .acts .is-res { grid-column: res; grid-row: 1; }
.pane-list:not(.is-cards) .gl-table .acts .arch-btn { grid-column: arch; grid-row: 1; }
.pane-list:not(.is-cards) .gl-table .acts .g-btn { width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
