/* sofor — the driver app, in Flow's design language (owner 09-24): Flow's
   palette and type, 3px corners, thin translucent borders, the house focus
   ring. Tokens are the same block public/track/app.css copies from Flow's
   tokens.css / flow-core.css — keep the two in step. Touch targets are at
   least 44 px tall (gloves, thumbs). */
:root {
  --primary: #003c91;
  --primary-hover: #0047ab;
  --primary-lt: #e4ecfa;
  --primary-rgb: 0, 60, 145;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: rgba(4, 32, 69, .1);
  --input-line: rgba(4, 32, 69, .18);
  --page: #f9fafb;
  --surface: #ffffff;
  --success: #1f9d55;
  --success-lt: #e3f5e8;
  --success-dark: #166534;
  --danger: #dc2626;
  --danger-lt: #fde8e8;
  --danger-dark: #991b1b;
  --warning: #f59f00;
  --info: #0284c7;
  --radius: 3px;
  --ring: 0 0 0 3px rgba(var(--primary-rgb), .15);
  --shadow: 0 1px 2px rgba(4, 32, 69, .06), 0 4px 14px rgba(4, 32, 69, .12);
  --tap: 44px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
/* The family and the font features come from fonts.css (:root, the house type), never named here. */
body {
  font-size: 14px; line-height: 1.4; color: var(--ink); background: var(--page);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
h1, h2 { margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 14px; font: inherit; font-size: 14px; font-weight: 600; line-height: 1.2;
  border: 1px solid transparent; border-radius: var(--radius); cursor: pointer; text-decoration: none;
  background: none; color: var(--ink); touch-action: manipulation; user-select: none;
}
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: default; pointer-events: none; }
.btn-block { display: flex; width: 100%; }
.btn-lg { min-height: 52px; font-size: 15px; }
.btn-sm { min-height: var(--tap); padding: 8px 12px; font-size: 13px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-secondary { background: var(--surface); border-color: var(--input-line); color: var(--primary); }
.btn-secondary:hover { background: var(--primary-lt); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-ghost { background: none; color: var(--muted); }
.btn-ghost:hover { background: rgba(4, 32, 69, .05); }
.btn-ghost-light { background: none; color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn-ghost-light:hover { background: rgba(255, 255, 255, .1); }
/* Flow's house modal law: cancel is a ghost red button, hard left. */
.btn-danger-ghost { background: none; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-lt); }
.btn-danger-outline { background: var(--surface); border-color: color-mix(in srgb, var(--danger) 35%, white); color: var(--danger); }
.btn-danger-outline:hover { background: var(--danger-lt); }
.btn-secondary.btn-danger-text { color: var(--danger); }
.btn-icon { width: var(--tap); padding: 0; flex: 0 0 auto; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; }
.form label:not(.check) { font-size: 14px; font-weight: 600; margin: 12px 0 6px; }
.form label:first-child { margin-top: 0; }
input:not([type="checkbox"]) {
  font: inherit; font-size: 16px; line-height: 20px; padding: 11px 12px; min-height: var(--tap); width: 100%;
  color: var(--ink); background: #fff; border: 1px solid var(--input-line); border-radius: var(--radius); outline: none;
}
input::placeholder { color: #9ca3af; }
input:focus { border-color: var(--primary); box-shadow: var(--ring); }
input.invalid { border-color: var(--danger); }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); margin-top: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--primary); }
.form .btn-primary { margin-top: 14px; }
.form .btn-ghost { margin-top: 6px; }

/* ── Alerts — Flow's recipe: one hue, text darkest, border lighter, background lightest ── */
.alert { padding: 10px 12px; border: 1px solid; border-radius: var(--radius); font-size: 13px; line-height: 1.4; }
.alert-info    { --hue: var(--info); }
.alert-success { --hue: var(--success); }
.alert-warning { --hue: var(--warning); }
.alert-danger  { --hue: var(--danger); }
.alert-info, .alert-success, .alert-warning, .alert-danger {
  color: color-mix(in srgb, var(--hue) 72%, black);
  background: color-mix(in srgb, var(--hue) 8%, white);
  border-color: color-mix(in srgb, var(--hue) 35%, white);
}
.form .alert { margin-top: 12px; }
.form .alert-info { margin-bottom: 4px; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; letter-spacing: .02em;
  padding: 3px 7px; border-radius: var(--radius); white-space: nowrap; line-height: 1.2;
}
.badge-primary { background: var(--primary-lt); color: var(--primary); }
.badge-success { background: var(--success-lt); color: var(--success-dark); }
.badge-muted   { background: rgba(4, 32, 69, .06); color: var(--muted); }
.badge-warning { background: #fff1d6; color: #b45309; }
.badge-danger  { background: var(--danger-lt); color: var(--danger-dark); }
/* An irsaliye number (IRS2026000012345) never breaks mid-number; a plate neither. */
.irs-no, .nowrap { white-space: nowrap; }
/* Figures (the irsaliye number, the route times, the goods quantities): the house mono, which is Inter itself
   (Flow ruling D1), with tabular numerals, so they line up and keep the open 6 and 9. */
.irs-no, .opt-box-time, .goods-qty { font-family: var(--flow-font-mono); font-variant-numeric: tabular-nums; }
/* Meta items read "İrsaliye IRS… · 24.09.2026 · 35 ABC 123"; badges carry no dot. The dot trails
   its item, so a wrapped line never starts with one. */
.mi:has(+ .mi)::after { content: "·"; margin-left: 6px; color: var(--muted); }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 0 4px rgba(31, 41, 55, .04);
}
.card + .card { margin-top: 12px; }
.card-head {
  display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.card-head h1, .card-head h2 { font-size: 16px; font-weight: 700; color: var(--primary); }
.card-head h2 { flex: 1; min-width: 0; }
.card-mark { width: 22px; height: 22px; display: block; }
.card-body { padding: 14px; }
.card-foot { padding: 12px 14px 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.count { color: var(--muted); font-weight: 500; }
.head-meta { font-size: 12px; color: var(--muted); text-align: right; }
.empty { padding: 18px 14px; color: var(--muted); font-size: 13px; text-align: center; }

/* ── Boot + login ────────────────────────────────────────────────────────── */
/* Pinned to the visible screen, not 100vh (taller than the screen on iPhone), so the logo is truly centred (owner 09-24). */
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.boot[hidden] { display: none; }
.boot img { width: 48px; height: 48px; opacity: .85; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.login { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
.login-col { width: 100%; max-width: 400px; }
.login-owner { text-align: center; margin-bottom: 20px; }
/* The bare transparent SVG, no frame (owner 2026-09-24, as Flow's .login-logo).
   54px = the artwork's height inside the retired frame: 76 − 2×8 padding − 2×3 border. */
.owner-logo { height: 54px; width: auto; }
.login-owner p { margin: 12px 0 0; font-size: 14px; font-weight: 700; color: var(--muted); }

/* ── App shell ───────────────────────────────────────────────────────────── */
/* The top bar like IT Center's (owner 09-24): the Flow mark, "Flow Teslimat" large, PROVA on the right. */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; min-height: 56px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: var(--primary); color: #fff;
}
.topbar-mark { width: 32px; height: 32px; padding: 5px; background: #fff; border-radius: var(--radius); flex: 0 0 auto; }
.topbar-title { flex: 1; min-width: 0; font-size: 19px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.topbar .badge-prova { font-size: 12px; padding: 4px 8px; }
/* The account button, header right (owner 09-24). */
.topbar-btn {
  flex: 0 0 auto; width: 40px; height: 40px; display: grid; place-items: center; padding: 0; margin-right: -4px;
  border: 0; border-radius: var(--radius); background: none; color: #fff; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.topbar-btn .ic { width: 24px; height: 24px; }
.topbar-btn:hover, .topbar-btn[aria-current="page"] { background: rgba(255, 255, 255, .18); }
.topbar-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, .45); }
/* Prova modu (rehearsal) — amber, so a test route never passes for a real one. */
.badge-prova { background: #fff1d6; color: #b45309; letter-spacing: .06em; }
.main { max-width: 720px; margin: 0 auto; padding: 12px 12px 24px; }
/* The app shell (owner 09-24: "fix header where logo is at so it doesnt move when page is
   pulled"): the page itself never scrolls — the top bar sits still and only the area under it
   scrolls, so iOS's pull/bounce moves the content, never the bar. */
html, body { overscroll-behavior-y: none; }
.app:not([hidden]) { position: fixed; inset: 0; display: flex; flex-direction: column; }
.app > .topbar { position: relative; flex: 0 0 auto; }
.app-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; }
/* Where that did not reach: overscroll-behavior does nothing on a scroller with nothing to scroll
   (iOS Safari; Android Chrome before 144) — a short page (Hesap, an empty list, a one-stop Rota) —
   and a drag that starts on the top bar or the tab bar never touches the scroll area. So the scroll
   area always has 1 px to scroll (touch screens only: a mouse desktop would show a scrollbar), and
   the two bars take no drag (their taps still work). Body has no 100vh floor: taller than the
   visible screen while the browser's toolbar shows, it let the document scroll under the shell. */
@media (pointer: coarse) {
  .app-scroll > .main { min-height: calc(100% + 1px); }
}
.topbar, .tabbar { touch-action: none; }

/* The bottom tab bar (owner 09-24: "lets use bottom menu like this so we dont cramp everything in
   one page") — a flex item under the scroll area, so it never moves; clear of the home indicator. */
.tabbar {
  flex: 0 0 auto; display: flex; justify-content: center; background: var(--surface);
  border-top: 1px solid var(--line); box-shadow: 0 -2px 10px rgba(4, 32, 69, .06);
  /* Just clear of the iPhone home bar — the full inset looked like a wasted margin (owner 09-24). */
  padding: 0 4px max(2px, calc(env(safe-area-inset-bottom) - 16px));
}
.tab {
  flex: 1 1 0; max-width: 144px; min-width: 0; min-height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 4px 2px 3px; border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer;   /* thinner (owner 09-24) */
  position: relative; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.tab .ic { width: 21px; height: 21px; }
.tab span { font-size: 11px; font-weight: 600; line-height: 1.1; white-space: nowrap; }
.tab[aria-current="page"] { color: var(--primary); }
.tab[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary);
}
.tab:focus-visible { outline: none; box-shadow: inset var(--ring); }

.notices { display: flex; flex-direction: column; gap: 8px; }
.notices:not(:empty) { margin-bottom: 12px; }
.notice { display: flex; align-items: flex-start; gap: 8px; }
.notice-text { flex: 1; min-width: 0; padding-top: 2px; }
.notice-title { display: block; font-weight: 700; overflow-wrap: anywhere; }
.notice-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.notice .btn-close { min-height: 32px; width: 32px; padding: 0; margin: -4px -6px -4px 0; color: inherit; font-size: 18px; font-weight: 500; }

.btn-scan { min-height: 64px; font-size: 16px; }
.btn-scan .ic { width: 24px; height: 24px; }
.manual { display: flex; gap: 8px; margin-top: 10px; }
.manual input { flex: 1; min-width: 0; }

/* List pages (Teslimatlar, İrsaliyeler) */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.list-meta { font-size: 12px; color: var(--muted); }
.list-body .group-title:first-child { margin-top: 0; }
.list-body .card + .group-title { margin-top: 14px; }
.search { display: flex; gap: 8px; margin-bottom: 12px; }
.search input { flex: 1; min-width: 0; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.back-btn { color: var(--primary); padding-left: 4px; margin: -4px 0 8px; gap: 4px; }
.irs-row {
  display: block; width: 100%; padding: 12px 14px; border: 0; background: none; color: inherit; font: inherit;
  text-align: left; cursor: pointer; touch-action: manipulation;
}
.irs-row:hover { background: rgba(4, 32, 69, .03); }
.irs-row:focus-visible { outline: none; box-shadow: inset var(--ring); }
.irs-row .stop-name { display: block; }
.dl-row.dl-row-tap { padding: 0; }
.wrap-title { overflow-wrap: anywhere; line-height: 1.3; }
.goods { list-style: none; margin: 0; padding: 0; max-height: 55vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.goods-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.goods-row:last-child { border-bottom: 0; }
.goods-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.goods-qty { flex: 0 0 auto; font-weight: 600; white-space: nowrap; }
.notes { margin: 0; padding: 10px 14px 12px 32px; }
.notes li { margin: 4px 0; overflow-wrap: anywhere; }

/* Key/value rows: Hesap, an irsaliye's head */
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 14px; margin: 0; padding: 14px; }
.kv dt { font-size: 13px; color: var(--muted); padding-top: 1px; }
.kv dd { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.kv-text { overflow-wrap: anywhere; }

/* ── Stops ───────────────────────────────────────────────────────────────── */
.stops { list-style: none; margin: 0; padding: 0; }
.stop { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.stop:last-child { border-bottom: 0; }
.stop-top { display: flex; gap: 10px; align-items: flex-start; }
.stop-no {
  flex: 0 0 28px; height: 28px; border-radius: 50%; border: 2px solid var(--primary); color: var(--primary);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-top: 1px;
}
/* Completed (delivered or cancelled) — pinned on top, compact: no arrows, no Teslim Et; the map and
   the pin sit where the arrows were (owner 09-24). */
.stop-done { padding: 9px 14px; --row-bg: #fbfcfd; background: var(--row-bg); }
.stop-done .stop-name { font-size: 14px; }
.stop-mark {
  flex: 0 0 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px;
  background: var(--success); color: #fff;
}
.stop-mark .ic { width: 16px; height: 16px; stroke-width: 2.4; }
.is-cancelled .stop-mark { background: var(--danger-lt); color: var(--danger); }
.stop-reason { margin-top: 4px; font-size: 13px; color: var(--ink); overflow-wrap: anywhere; }
.stop-main { flex: 1; min-width: 0; }
.stop-name { font-weight: 700; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.stop-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 3px; font-size: 12px; color: var(--muted); }
.stop-addr { margin-top: 6px; font-size: 13px; color: var(--ink); overflow-wrap: anywhere; }
.stop-warn { margin-top: 8px; }
.stop-order { display: flex; flex-direction: column; gap: 4px; flex: 0 0 auto; }
.stop-order .btn { min-height: var(--tap); width: var(--tap); }
.stop-actions { display: grid; grid-template-columns: 1fr 1fr var(--tap); gap: 8px; margin-top: 10px; }
.stop-actions .btn { padding-left: 8px; padding-right: 8px; white-space: nowrap; }
@media (max-width: 380px) {
  /* 360 px phones: "Haritada Aç" and "Teslim Et" stay on one line. */
  .stop-actions { gap: 6px; }
  .stop-actions .btn { gap: 5px; padding-left: 5px; padding-right: 5px; font-size: 13px; }
  .stop-actions .ic { width: 18px; height: 18px; }
}

/* Yükleme's staging list (Yüklenenler): the Rota row's pieces, Rotadan Çıkar on the right. */
.load-row .stop-top { align-items: center; }
.load-row .btn { flex: 0 0 auto; }

/* Swipe actions (owner 09-24: "add swipe actions to cards in sofor app too"): the card's content
   and its background (::before) slide by --sx (app.js) over a tray of the card's own buttons.
   pan-y: a vertical drag stays the browser's scroll; a sideways one is the swipe's. Clipped, so
   nothing slides past the list's edge (clip, not hidden: the row never becomes a scroller). */
.swipe {
  --sx: 0px; position: relative; isolation: isolate; overflow: hidden; overflow: clip;
}
/* Two-finger zoom stays where the browser knows the pinch-zoom keyword; pan-y alone where it does not. */
.swipe, .swipe * { touch-action: pan-y; touch-action: pan-y pinch-zoom; }
.swipe::before {
  content: ""; position: absolute; inset: 0; z-index: 1; background: var(--row-bg, var(--surface));
}
.swipe > :not(.swipe-tray) { position: relative; z-index: 2; }
.swipe::before, .swipe > :not(.swipe-tray) {
  transform: translateX(var(--sx)); transition: transform .22s cubic-bezier(.2, .8, .2, 1);
}
.swipe.is-dragging::before, .swipe.is-dragging > :not(.swipe-tray) { transition: none; }
.swipe.is-dragging { -webkit-user-select: none; user-select: none; }
/* The tray: behind the card, shown only on the side the card has moved away from (kept until the
   card is back, then hidden — out of the tab order while the card covers it). */
.swipe-tray {
  position: absolute; top: 0; bottom: 0; z-index: 0; display: flex; align-items: center; gap: 8px; padding: 0 10px;
  background: rgba(4, 32, 69, .06); visibility: hidden; transition: visibility 0s linear .22s;
}
.swipe-tray-start { left: 0; }
.swipe-tray-end { right: 0; }
.swipe.show-start > .swipe-tray-start, .swipe.show-end > .swipe-tray-end { visibility: visible; transition-delay: 0s; }
.swipe-btn { flex: 0 0 auto; width: 92px; padding: 8px 6px; font-size: 13px; line-height: 1.25; white-space: normal; text-align: center; }
@media (prefers-reduced-motion: reduce) {
  .swipe::before, .swipe > :not(.swipe-tray), .swipe-tray { transition: none; }
}

/* Teslimatlar's pull-to-refresh: the ring grows in with the pull and spins while the list reloads. */
.ptr { display: flex; align-items: center; justify-content: center; height: 0; overflow: hidden; transition: height .15s ease-out; }
.ptr.is-pulling { transition: none; }
.ptr.is-loading { height: 44px; }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--primary-lt); border-top-color: var(--primary); }
.ptr.is-loading .spinner { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Dialogs ─────────────────────────────────────────────────────────────── */
dialog.modal { border: 0; padding: 0; background: transparent; color: inherit; max-width: none; max-height: none; }
dialog.modal::backdrop { background: rgba(17, 24, 39, .45); }
dialog.modal:not(.modal-full) { width: min(440px, calc(100vw - 24px)); }
.modal-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.modal-head { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 16px; font-weight: 700; color: var(--primary); overflow-wrap: anywhere; }
.modal-body { padding: 14px; }
.modal-foot { display: flex; justify-content: space-between; gap: 8px; padding: 10px 14px 14px; }
.modal-foot .btn-primary { margin-left: auto; }
.confirm-text { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.4; }
.confirm-sub { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.menu-list { display: flex; flex-direction: column; gap: 8px; padding: 14px 14px 4px; }
.drawer-sub { margin-top: 3px; font-size: 13px; font-weight: 500; color: var(--muted); overflow-wrap: anywhere; }
.confirm-body { padding: 2px 0 8px; text-align: center; }
/* Bottom drawer (owner 09-24: "too much excess space and use drawer style from bottom. buttons
   centered always. handle on top of drawer"): pinned to the bottom edge, as tall as its content
   and never taller than 85% of the screen, a handle bar on top, every button full width with
   centred text. */
dialog.modal.modal-bottom:not(.modal-full) {   /* beats the centred-dialog width rule above */
  position: fixed; inset: auto 0 0 0; margin: 0 auto; width: min(480px, 100%);
  height: auto; max-height: 85vh; max-height: 85dvh; overflow: hidden;
}
dialog.modal-bottom[open] { animation: drawer-up .2s ease-out; }
/* The on-screen keyboard (app.js: while a text field in the drawer has the focus — the Diğer reason):
   the drawer sits on the keyboard, not under it, at most 85% of what the keyboard leaves, and its
   buttons stay at its bottom while the rest scrolls. */
:root.kb-open dialog.modal.modal-bottom:not(.modal-full) { bottom: var(--kb, 0px); max-height: calc(var(--kb-vh, 100vh) * .85); }
:root.kb-open dialog.modal-bottom .modal-foot { position: sticky; bottom: 0; z-index: 1; background: var(--surface); }
@keyframes drawer-up { from { transform: translateY(100%); } to { transform: none; } }
dialog.modal-bottom .modal-card {
  border: 0; border-radius: var(--radius) var(--radius) 0 0; box-shadow: 0 -4px 18px rgba(4, 32, 69, .16);
  padding: 4px 16px max(10px, calc(env(safe-area-inset-bottom) - 12px)); max-height: inherit; overflow-y: auto;   /* owner 09-24: no excess bottom margin */
}
.drawer-handle {
  display: block; width: 100%; height: 20px; padding: 0; margin: 0 0 2px; border: 0; background: none; cursor: pointer; position: relative;
  outline: none;   /* showModal() focuses it first — the bar itself shows keyboard focus instead */
}
.drawer-handle:focus-visible::after { background: var(--primary); }
.drawer-handle::after {
  content: ""; position: absolute; left: 50%; top: 8px; width: 40px; height: 5px; margin-left: -20px;
  border-radius: 3px; background: rgba(4, 32, 69, .2);
}
dialog.modal-bottom .modal-head { padding: 0 0 10px; border-bottom: 0; text-align: center; }
dialog.modal-bottom .modal-head h2 { font-size: 15px; }
dialog.modal-bottom .menu-list { padding: 0; gap: 8px; }
dialog.modal-bottom .modal-foot { padding: 8px 0 0; justify-content: center; }
dialog.modal-bottom .modal-foot-stack { flex-direction: column; gap: 6px; }
dialog.modal-bottom .modal-foot-stack .btn-primary { margin-left: 0; }
dialog.modal-bottom .alert { margin-bottom: 4px; }
.drawer-alert { margin-top: 10px; }
.drawer-state { padding: 22px 0 14px; text-align: center; color: var(--muted); font-weight: 600; }
/* A picked reason reads as chosen: the primary fill. */
.reason-opt.is-selected, .reason-opt.is-selected:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.reason-text { margin-top: 10px; }
.reason-text label { display: block; font-size: 14px; font-weight: 600; margin: 0 0 6px; }
textarea {
  display: block; width: 100%; min-height: 84px; resize: vertical; font: inherit; font-size: 16px; line-height: 1.4;
  padding: 10px 12px; color: var(--ink); background: #fff; border: 1px solid var(--input-line); border-radius: var(--radius); outline: none;
}
textarea:focus { border-color: var(--primary); box-shadow: var(--ring); }
/* En Kısa Rotayı Hesapla — the suggestion next to the current order */
.opt-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 8px; text-align: center; }
.opt-box.is-suggested { background: var(--primary-lt); border-color: color-mix(in srgb, var(--primary) 30%, white); }
.opt-box-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.opt-box-time { margin-top: 2px; font-size: 18px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.is-suggested .opt-box-time { color: var(--primary); }
.opt-box-dist { font-size: 13px; color: var(--muted); white-space: nowrap; }
.opt-result .alert { margin-top: 8px; }
.opt-list {
  list-style: none; margin: 10px 0 0; padding: 0; text-align: left; max-height: 40vh; max-height: 40dvh; overflow-y: auto;
  border-top: 1px solid var(--line); -webkit-overflow-scrolling: touch;
}
.opt-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.opt-no {
  flex: 0 0 24px; height: 24px; border-radius: 50%; border: 2px solid var(--primary); color: var(--primary);
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
}
.opt-row.is-unplaced .opt-no { border-color: #9ca3af; color: var(--muted); }
.opt-main { flex: 1; min-width: 0; }
.opt-name { font-weight: 600; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.opt-was { color: var(--muted); }
.opt-group { font-size: 12px; font-weight: 700; color: var(--muted); padding: 10px 2px 4px; border-bottom: 1px solid var(--line); }
dialog.modal-bottom .btn { justify-content: center; text-align: center; }
/* A drawer whose content can run long (the scanned irsaliye): only the middle scrolls, the buttons stay. */
dialog.modal-bottom .modal-card.drawer-flex { display: flex; flex-direction: column; overflow: hidden; }
.drawer-flex > .drawer-handle, .drawer-flex > .modal-head, .drawer-flex > .modal-foot { flex: 0 0 auto; }
.drawer-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.drawer-scroll .goods { max-height: none; overflow: visible; }
.veh-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; max-height: 50vh; overflow-y: auto; }

dialog.modal-full { width: 100vw; height: 100vh; height: 100dvh; margin: 0; inset: 0; }
.sheet { height: 100%; display: flex; flex-direction: column; background: var(--page); }
.sheet-head {
  display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.sheet-head h2 { flex: 1; font-size: 16px; font-weight: 700; color: var(--primary); }
.sheet-head .back-btn { margin: 0 0 0 -6px; }
/* Teslim Et — the photo of the signed irsaliye: who, the preview, then Tekrar Çek / Kullan. */
.proof-who { padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.proof-name { font-size: 15px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.proof-no { margin-top: 2px; font-size: 12px; color: var(--muted); }
.proof-view { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; background: #0b1220; overflow: hidden; }
.proof-view img { width: 100%; height: 100%; object-fit: contain; }
.proof-state { color: #fff; font-size: 14px; padding: 16px; text-align: center; }
.proof-foot, .sheet-foot {
  display: flex; flex-direction: column; gap: 10px; padding: 12px 14px max(12px, calc(env(safe-area-inset-bottom) - 10px));
  background: var(--surface); border-top: 1px solid var(--line);
}
.proof-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.progress { height: 6px; border-radius: 3px; background: var(--primary-lt); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--primary); transition: width .2s linear; }
.group-title { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; margin: 10px 2px 6px; }
.dl { list-style: none; margin: 0; padding: 0; }
.dl-row { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.dl-row:last-child { border-bottom: 0; }
.dl-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.dl-actions-one { grid-template-columns: 1fr; }

/* Scanner */
.modal-dark .scan { height: 100%; display: flex; flex-direction: column; background: #0b1220; color: #fff; }
.scan-head { display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; }
.scan-head h2 { flex: 1; font-size: 16px; font-weight: 700; }
.scan-view { position: relative; flex: 1; overflow: hidden; }
.scan-view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame {
  position: absolute; left: 50%; top: 50%; width: min(70vw, 280px); aspect-ratio: 1; transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, .85); border-radius: var(--radius); box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35);
}
.scan-msg { padding: 14px 16px max(14px, calc(env(safe-area-inset-bottom) - 8px)); font-size: 14px; text-align: center; min-height: 56px; }

@media (min-width: 720px) {
  .main { padding-top: 20px; }
}

/* Last, so it beats every single-class display rule above without !important. */
[hidden] { display: none; }

/* The left-edge swipe's cue: a round back arrow that slides in with the finger (static chevron). */
.edge-back {
  position: fixed; left: 0; top: 50%; z-index: 100; width: 44px; height: 44px; margin-top: -22px;
  display: grid; place-items: center; border-radius: 50%; background: var(--primary); color: #fff;
  box-shadow: 0 2px 10px rgba(4, 32, 69, .3); pointer-events: none; opacity: 0;
  transform: translateX(calc(-100% + var(--p, 0) * 60px));
}
.edge-back.on { opacity: calc(var(--p, 0) * 1); }
.edge-back svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
