/* pKier 2 web – elementy ekranów aplikacji kierowcy (pKier2.App, Views/*.xaml).
   Kolory, czcionki i wspólne klasy (card, hero, segmented, field, btn-primary…) – app.css z pTrax 2 web (podlinkowany). */

/* ---------- Podstawy ---------- */
.page-wrap { max-width: 720px; padding: 12px 16px 24px; }
.block { display: block; }
h3, dl { margin: 0; }
.row.top { align-items: flex-start; }
.strong { font-weight: 700; }
.break { overflow-wrap: anywhere; text-align: right; }
.small-caption { font-size: 11.5px; }
.accent-strong { color: var(--accent); font-weight: 600; }
.blue { color: #3B82F6; }
.link.left { align-self: flex-start; text-align: left; padding: 4px 0; }
.icon.spin { animation: spin .8s linear infinite; }
.progress.green > span { background: var(--green); }
.note-box { padding: 8px 10px; border-radius: 10px; background: var(--sunken); color: var(--text2); font-size: 13px; }
.btn.wide { width: 100%; }
.btn.tall { height: 48px; font-weight: 800; }
.btn-hero { height: 44px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .18); background: transparent; color: var(--hero-text); font-weight: 800; }
.two-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.two-buttons.wide-first { grid-template-columns: 1.35fr 1fr; }
.three-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.icon-btn { box-shadow: none; }
.icon-btn.call { background: var(--green-bg); border-color: transparent; color: var(--green-text); }
.icon-btn.accent-btn { background: var(--accent-gradient); border: 0; color: var(--on-accent); }
.icon-btn.small-btn { width: 38px; height: 38px; border-radius: 10px; }
.icon-chip.red { background: var(--red-bg); color: var(--red-text); }
.card .muted + .muted { margin-top: 2px; }

/* Wybór pliku: przycisk to <label> z ukrytym <input type="file"> – dotknięcie otwiera aparat / galerię / pliki telefonu */
.pick { position: relative; cursor: pointer; text-align: center; }
.pick input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.pick.disabled { opacity: .6; pointer-events: none; }
label.btn-primary, label.btn { user-select: none; }

/* Pigułki wyboru (ChoicePills) */
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { padding: 7px 12px; border-radius: 17px; border: 1px solid var(--line2); background: var(--surface); color: var(--text2); font-size: 13px; font-weight: 800; }
.pill.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* Pierścień tachografu (TachoRing) */
.tacho-ring { flex: none; display: block; }
.tacho-ring .rest { stroke: var(--green); }
.tacho-ring .used { stroke: #F15322; }
.tacho-ring.muted .rest { stroke: var(--line2); }
.tacho-ring.muted .used { stroke: var(--muted); }

/* Numer punktu trasy */
.seq-badge { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: none; background: var(--accent-gradient); color: var(--on-accent); font-weight: 800; font-size: 14px; }
.seq-badge.big { width: 32px; height: 32px; font-size: 15px; }
.seq-ring { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; flex: none; border: 2px solid var(--line2); color: var(--text2); font-weight: 800; font-size: 13px; }
.done-dot { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; flex: none; background: var(--green); color: #fff; }
.done-dot.big { width: 28px; height: 28px; }

/* Karta "hero" (bieżące zlecenie, następny punkt, profil) */
.hero-caption { font-size: 12px; font-weight: 800; letter-spacing: .8px; color: var(--hero-muted); }
.hero-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; color: var(--hero-green); }
.hero-status .dot { width: 7px; height: 7px; background: var(--hero-green); }
.hero-muted { color: var(--hero-muted); font-size: 13px; font-weight: 600; }
.hero-green { color: var(--hero-green); font-size: 13px; font-weight: 800; }
.hero-note { padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .08); color: var(--hero-text); font-size: 13px; }
.hero-avatar { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; flex: none; background: var(--accent-gradient); color: var(--on-accent); font-size: 18px; font-weight: 800; }

/* Wysuwany arkusz (zmiana etapu) */
.sheet-backdrop { position: fixed; inset: 0; z-index: 800; background: rgba(8, 10, 14, .5); }
.bottom-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 801; max-height: 88vh; overflow-y: auto; margin: 0 auto; max-width: 720px;
                padding: 10px 16px calc(20px + var(--safe-bottom)); background: var(--surface); border: 1px solid var(--line2); border-bottom: 0;
                border-radius: 22px 22px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, .25); }
.bottom-sheet .sheet-grip { width: 40px; height: 5px; border-radius: 3px; margin: 0 auto 10px; }
.sheet-title { margin-bottom: 4px; }
.sheet-buttons { display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px; margin-top: 12px; }

/* Okno podglądu zdjęcia */
.viewer { position: fixed; inset: 0; z-index: 900; background: rgba(0, 0, 0, .95); display: flex; align-items: center; justify-content: center; padding: 60px 8px 24px; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-close { position: absolute; top: calc(16px + env(safe-area-inset-top, 0px)); right: 16px; }

/* Pasek powiadomienia (nowa wiadomość / zlecenie) */
.notify-banner { position: fixed; top: calc(8px + env(safe-area-inset-top, 0px)); left: 8px; right: 8px; z-index: 850; max-width: 560px; margin: 0 auto;
                 display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line2);
                 box-shadow: var(--shadow); animation: notify-in .25s ease-out; }
.notify-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px; border: 0; background: none; text-align: left; color: var(--text); }
.notify-main strong { display: block; font-size: 14.5px; font-weight: 800; }
.notify-body { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; color: var(--text2); }
.notify-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex: none; background: var(--accent-gradient); color: var(--on-accent); }
.notify-close { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 12px; background: none; color: var(--muted); flex: none; }
@keyframes notify-in { from { transform: translateY(-20px); opacity: 0; } }

/* ---------- Pulpit ---------- */
.top-head { align-items: center; }
.avatar-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; flex: none; background: var(--accent-gradient); color: var(--on-accent); font-weight: 800; }
.vehicle-line { gap: 8px; margin-top: -4px; }
.current-order { display: flex; flex-direction: column; gap: 10px; }
.hero-number { font-size: 22px; color: var(--hero-text); }
.hero-dest { font-size: 14px; color: var(--hero-text); }
.hero-dest strong { font-weight: 800; }
.tiles-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; text-align: left; color: var(--text); min-width: 0; }
.tile-card .row { gap: 6px; }
.tile-value { display: flex; flex-direction: column; margin-left: 4px; }
.tile-value strong { font-size: 19px; font-weight: 800; }
.count-pill { padding: 1px 7px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 11.5px; font-weight: 800; }
.last-message { font-size: 13.5px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.route-progress { margin: 10px 0; }
.card.alert.row { gap: 12px; }

/* ---------- Zlecenia ---------- */
.segmented { gap: 2px; }
.segmented button { min-width: 0; padding: 0 2px; font-size: 13px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; height: 36px; }
.order-card { display: flex; flex-direction: column; gap: 14px; }
.order-no { font-size: 19px; }
.status-pill { flex: none; padding: 4px 10px; border-radius: 13px; background: var(--green-bg); color: var(--green-text); font-size: 12.5px; font-weight: 800; }
.next-stage { height: 48px; }
.center-link { align-self: center; padding: 0; }
.place-card { display: flex; flex-direction: column; gap: 8px; }
.place-card .when { font-size: 13px; font-weight: 800; }
.done-row { gap: 12px; padding: 12px 14px; }

/* Pasek etapów (StageStepper) */
.stepper { display: grid; grid-template-columns: repeat(4, 1fr); }
.step { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.step .circle { position: relative; z-index: 1; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--sunken); border: 2px solid var(--line2); }
.step.done .circle { background: var(--green); border-color: var(--green); color: #fff; }
.step.now .circle { background: var(--accent-gradient); border: 0; color: var(--on-accent); }
.step .label { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.step.done .label { color: var(--text); }
.step.now .label { color: var(--text); font-weight: 800; }
.step .line { position: absolute; top: 14px; left: calc(50% + 19px); right: calc(-50% + 19px); height: 3px; border-radius: 2px; background: var(--line2); }
.step .line.done { background: var(--green); }

/* Lista statusów w arkuszu */
.status-list { display: flex; flex-direction: column; gap: 2px; }
.status-head { margin: 8px 0 2px; }
.status-option { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: 12px; border: 2px solid transparent; background: none;
                 color: var(--text); font-size: 15px; font-weight: 700; text-align: left; }
.status-option.now { background: var(--chip); }
.status-option.picked { border-color: var(--accent); }
.status-dot { position: relative; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; flex: none; border: 2px solid var(--line2); }
.status-option.done .status-dot { background: var(--green); border-color: var(--green); color: #fff; }
.status-option.now .status-dot { background: var(--accent); border-color: var(--accent); }
.status-dot .inner { width: 8px; height: 8px; border-radius: 50%; background: var(--on-accent); }

/* ---------- Szczegóły zlecenia ---------- */
.details .card { display: flex; flex-direction: column; gap: 8px; }
.caption-row { gap: 8px; }
.caption-row .link { padding: 0; }
.h3.big { font-size: 16px; }
.contact { gap: 8px; }
.contact strong { font-size: 14px; font-weight: 700; }
.kv { display: grid; grid-template-columns: 78px 1fr; gap: 8px 0; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 700; }
.order-map { position: relative; height: 230px; border-radius: 12px; overflow: hidden; background: var(--sunken); }
.temp { gap: 8px; align-items: center; font-size: 14px; }

/* ---------- Dokumenty ---------- */
.docs-page { position: absolute; inset: 0; display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; }
.docs-top { display: flex; flex-direction: column; gap: 12px; padding: 12px 16px 8px; flex: none; }
.docs-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px; display: flex; flex-direction: column; gap: 8px; }
.docs-add { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 8px 16px calc(16px + var(--safe-bottom)); }
.docs-add .pick { height: 56px; display: flex; align-items: center; justify-content: center; font-size: 13.5px; font-weight: 800; }
.doc-row { display: flex; align-items: center; gap: 4px; padding: 12px; }
.doc-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 0; border: 0; background: none; text-align: left; color: var(--text); }
.doc-open strong { font-size: 14.5px; font-weight: 800; }
.doc-thumb { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 12px; flex: none; overflow: hidden; background: var(--sunken); color: var(--muted); }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc-thumb.pdf { background: var(--red-bg); color: var(--red-text); font-size: 12px; font-weight: 800; }
.doc-thumb.big { width: 56px; height: 56px; border-radius: 14px; }
.doc-thumb.small { width: 38px; height: 38px; border-radius: 10px; font-size: 11px; }
.origin { font-size: 11.5px; font-weight: 800; color: var(--muted); }
.origin.mine { color: var(--accent-text); }
.trash { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 10px; background: none; color: var(--muted); flex: none; }

/* Nowy dokument */
.form-page { position: absolute; inset: 0; display: flex; flex-direction: column; }
.form-page > .page-wrap { flex: 1; min-height: 0; overflow-y: auto; width: 100%; gap: 10px; }
.form-buttons { flex: none; display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px; width: 100%; max-width: 720px; margin: 0 auto; padding: 8px 16px calc(16px + var(--safe-bottom)); }
.preview { height: 210px; border-radius: 16px; overflow: hidden; background: var(--sunken); display: grid; place-items: center; }
.preview img { max-width: 100%; max-height: 210px; object-fit: contain; display: block; }
/* Przewijane kolumny: elementy nie ściskają się (podgląd, karty dokumentów) */
.form-page > .page-wrap > *, .docs-list > * { flex-shrink: 0; }
.pdf-preview { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px; text-align: center; overflow-wrap: anywhere; }
.form-page .caption { margin-top: 6px; }
.form-page .field { height: 48px; border-radius: 12px; }

/* ---------- Trasa ---------- */
.route-page { position: absolute; inset: 0; display: flex; flex-direction: column; overflow-y: auto; }
.route-page.map-mode { overflow: hidden; }
.route-map { position: absolute; inset: 0; background: var(--bg); }
.route-head-wrap { position: relative; z-index: 2; padding: 8px 12px 0; flex: none; }
.route-head { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; padding: 10px 12px; border-radius: 16px; border: 1px solid transparent; }
.map-mode .route-head { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow); }
.route-title { font-size: 22px; }
.route-list { width: 100%; padding-top: 4px; }
.point { display: flex; align-items: center; gap: 12px; padding: 8px 4px; width: 100%; border: 0; background: none; text-align: left; color: var(--text); }
.point.todo { padding: 10px 4px; }
.point.todo strong { font-size: 14.5px; font-weight: 800; }
.point.done strong { font-weight: 700; color: var(--muted); }
.strike { text-decoration: line-through; }
.next-point { display: flex; flex-direction: column; gap: 10px; margin: 6px 0; }
.hero-name { font-size: 16px; font-weight: 800; color: var(--hero-text); }
.map-zoom { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); z-index: 2; display: flex; flex-direction: column; gap: 8px; }
.map-zoom .icon-btn { box-shadow: var(--shadow); }
.map-panel { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 2; max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px;
             padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.map-panel strong { font-size: 15.5px; font-weight: 800; }

/* ---------- Wiadomości ---------- */
.chat-page { position: absolute; inset: 0; max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; }
.chat-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px 10px; flex: none; }
.chat-top .titles { display: flex; flex-direction: column; min-width: 0; }
.chat-title { font-size: 22px; }
.icon-btn.flat { color: var(--text); }
.point-status { margin: 0 16px 6px; padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; flex: none; }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px 8px; overscroll-behavior: contain; }
.chat-error { margin: 4px 0; padding: 10px 14px; }
.msg { display: flex; flex-direction: column; padding: 5px 0; gap: 4px; }
.msg.mine { align-items: flex-end; }
.msg.theirs { align-items: flex-start; }
.day { align-self: center; margin: 6px 0 4px; color: var(--muted); font-size: 12px; font-weight: 800; }
.status-msg { align-self: center; padding: 5px 12px; border-radius: 13px; background: var(--green-bg); color: var(--green-text); font-size: 12.5px; font-weight: 800; text-align: center; }
.point-tag { font-size: 11.5px; font-weight: 800; color: var(--accent-text); }
.bubble { max-width: 300px; display: flex; flex-direction: column; gap: 6px; padding: 9px 12px; cursor: default;
          background: var(--surface); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; overflow: hidden; }
.msg.mine .bubble { background: var(--accent-gradient); border: 0; border-radius: 16px 16px 4px 16px; color: var(--on-accent); }
.bubble.image { padding: 0; cursor: pointer; }
.bubble.image .text { margin: 0 12px 9px; }
.photo { display: grid; place-items: center; width: 190px; height: 140px; background: var(--sunken); color: var(--muted); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pdf-row { gap: 10px; cursor: pointer; min-width: 0; }
.pdf-row strong { font-size: 13.5px; font-weight: 800; }
.msg.mine .pdf-row .small { color: inherit; opacity: .75; }
.text { font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.mine .text { font-weight: 600; }
.meta { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 12px; background: var(--surface); border-top: 1px solid var(--line); flex: none; }
.composer .icon-btn { width: 44px; height: 44px; color: var(--text2); }
.composer textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 120px; padding: 11px 14px; resize: none; field-sizing: content;
                     border-radius: 22px; background: var(--bg); border: 1px solid var(--line2); color: var(--text); outline: 0;
                     font: 500 16px/1.35 Manrope, system-ui, sans-serif; }
.composer textarea:focus { border-color: var(--accent); }
.composer textarea::placeholder { color: var(--muted); }
.send { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; flex: none; border: 0; background: var(--accent-gradient); color: var(--on-accent); }
.busy { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(22, 13, 8, .25); border-top-color: var(--on-accent); animation: spin .8s linear infinite; }

/* ---------- Tachograf ---------- */
.tacho-main { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.activity { padding: 5px 12px; border-radius: 13px; font-size: 12.5px; font-weight: 800; background: var(--sunken); color: var(--muted); }
.activity.green { background: var(--green-bg); color: var(--green-text); }
.activity.amber { background: var(--amber-bg); color: var(--amber-text); }
.primary-title { font-size: 15px; font-weight: 800; text-align: center; }
.ring-wrap { position: relative; width: 170px; height: 170px; }
.ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-text strong { font-size: 30px; font-weight: 800; letter-spacing: -1px; }
.legend { display: flex; gap: 16px; font-size: 12px; font-weight: 600; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { width: 9px; height: 9px; }
.dot.accent-dot { background: var(--accent); }
.limits { padding: 4px 14px; }
.limit { display: flex; flex-direction: column; gap: 5px; padding: 9px 0; }
.limit + .limit { border-top: 1px solid var(--line); }
.quality { gap: 8px; font-size: 12.5px; }

/* ---------- Menu i ustawienia ---------- */
.menu { gap: 14px; }
.profile { gap: 14px; }
.profile-name { font-size: 18px; font-weight: 800; color: var(--hero-text); }
.list-row .small { display: block; }
.list-row strong { font-size: 15px; font-weight: 800; }
.sign-out-row strong { color: var(--red-text); }
.settings { gap: 10px; }
.settings .caption { margin-top: 8px; }
.settings label.list-row { cursor: pointer; }
.info .list-row strong { font-size: 14px; font-weight: 700; }
.info .list-row { gap: 16px; }

/* Wąskie telefony */
@media (max-width: 360px) {
  .three-buttons { gap: 6px; }
  .docs-add .pick { font-size: 12.5px; }
  .tile-value strong { font-size: 17px; }
}
