:root {
  --bg: #f3f5f7; --paper: #fff; --ink: #282e36; --muted: #657080;
  --line: #dce1e7; --accent: #244c7d; --soft: #edf2f8; --radius: 9px;
  --pending: #b68120; --delivered: #39805d; --failed: #b54b49;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light; font-synthesis: none;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; width: 100%; height: 100%; }
body { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); color: var(--ink); font: 14px/1.4 var(--font); font-variant-numeric: tabular-nums; }
h1, h2, h3, p, dl { margin: 0; }
h1, h2, h3, strong, b { font-weight: 600; }
h1, h2 { letter-spacing: -.035em; line-height: 1.3; }
h3 { font-size: 13px; line-height: 1.4; margin: 12px 0 8px; }
button, input, textarea, select { font: inherit; color: inherit; }
button, a, select, summary { touch-action: manipulation; }
button { cursor: pointer; min-width: 44px; min-height: 44px; border: 1px solid transparent; border-radius: var(--radius); line-height: 1.2; background: var(--paper); font-weight: 600; }
button:disabled { opacity: .45; cursor: default; }
button:not(:disabled):active { filter: brightness(.96); }
a { color: var(--accent); text-decoration: none; }
svg { width: 20px; height: 20px; flex: none; }
.leaflet-container svg { width: auto; height: auto; }
[hidden] { display: none !important; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input:not([type=hidden]), textarea, select {
  display: block; width: 100%; max-width: 100%; min-width: 0; min-height: 48px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); color: var(--ink); font-size: 16px; line-height: 1.4;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
textarea { resize: vertical; min-height: 64px; }
input[readonly], textarea[readonly] { background: var(--bg); }
.field-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 7px; }
.field { min-width: 0; margin-bottom: 16px; }
.field-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.btn { min-height: 50px; padding: 12px 18px; display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 14px; }
.btn.primary { color: white; background: var(--accent); }
.btn.ok { background: #326c4e; color: white; }
.btn.bad { color: #a23e3b; border-color: #e4c7c5; background: var(--paper); }
.btn.ghost { border-color: var(--line); background: var(--paper); color: var(--ink); }
.close { display: grid; place-items: center; padding: 0; width: 44px; height: 44px; flex: none; color: var(--muted); background: transparent; }
.close svg { width: 20px; height: 20px; }

#app-header { flex: none; position: relative; z-index: 1100; display: grid; grid-template-columns: minmax(0,1fr) minmax(100px,143px) 44px; grid-template-areas: "brand prog tools" "search search search"; gap: 12px 14px; padding: calc(14px + env(safe-area-inset-top,0px)) 16px 16px; background: var(--paper); border-bottom: 1px solid var(--line); }
.brand { grid-area: brand; min-width: 0; }
.section-title { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
#sectionName { font-size: 20px; line-height: 1.3; letter-spacing: -.035em; }
.city-button { position: relative; width: fit-content; max-width: 100%; display: flex; gap: 4px; align-items: center; min-height: 20px; min-width: 0; padding: 0; border: 0; border-radius: 0; margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--muted); background: none; }
.city-button.selectable { padding-right: 14px; }
.city-button.selectable::after { content: '⌄'; position: absolute; right: 0; pointer-events: none; }
.city-button:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
#cityName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#citySelect { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.header-progress { grid-area: prog; align-self: center; min-width: 0; }
.progress small { display: block; font-size: 11px; color: var(--muted); }
.progress strong { color: var(--ink); }
.bar { height: 3px; margin-top: 8px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar i { display: block; width: 0; height: 100%; background: var(--delivered); border-radius: 3px; }
.tools { grid-area: tools; display: flex; align-items: center; gap: 8px; }
.tool { width: 44px; height: 44px; padding: 0; display: grid; place-items: center; }
.profile-button { color: var(--accent); background: var(--soft); font-size: 12px; }
#whoName { display: none; }
#roleTools { display: none; gap: 8px; }
.role-tool { display: flex; align-items: center; justify-content: center; gap: 6px; border-color: var(--line); padding: 0 12px; color: var(--accent); background: var(--paper); font-size: 13px; }
.search { grid-area: search; min-width: 0; display: block; }
.search-box { position: relative; min-width: 0; }
.search-box svg { position: absolute; top: 12px; left: 12px; color: var(--muted); pointer-events: none; }
#q { padding: 10px 12px 10px 39px; min-height: 44px; height: 44px; background: var(--bg); }

#workspace { position: relative; flex: 1; min-height: 0; background: #edf0ec; }
#map { position: absolute; inset: 0; background: #edf0ec; }
.leaflet-container { font: inherit; }
.leaflet-tile-pane { filter: saturate(.35) brightness(1.03); }
.leaflet-control-attribution { font-size: 10px; background: #ffffffdf !important; }
.store-pin { display: grid; place-items: center; background: transparent; border: 0; }
.map-dot { width: 20px; height: 20px; border: 2px solid white; border-radius: 50%; }
.map-dot.idle { width: 14px; height: 14px; }
.map-dot.missing { outline: 2px solid var(--ink); outline-offset: 1px; }
.chips { position: absolute; inset: 0 0 auto; z-index: 950; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 10px 16px; pointer-events: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { pointer-events: auto; flex: none; min-height: 44px; border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius); padding: 10px 12px; font-size: 12px; font-weight: 500; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.chip.on { color: var(--accent); border-color: var(--accent); background: var(--soft); }
.chip b { font-weight: 600; }
select.chip { width: auto; max-width: 190px; font-size: 13px; }
.dot { width: 6px; height: 6px; border-radius: 50%; flex: none; display: inline-block; }
.pending-dot { background: var(--pending); }
.delivered-dot { background: var(--delivered); }
.failed-dot { background: var(--failed); }
.missing-dot { background: var(--ink); }
#map-fallback, #map-empty { position: absolute; top: 70px; left: 16px; max-width: calc(100% - 32px); z-index: 810; padding: 8px 10px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); font-size: 12px; pointer-events: none; }
#map-empty { top: 116px; }
#locate, .map-zoom, .floating-actions { position: absolute; z-index: 900; bottom: calc(32px + env(safe-area-inset-bottom,0px)); }
#locate { right: 16px; width: 44px; height: 44px; padding: 0; display: grid; place-items: center; border-color: var(--line); }
.map-zoom { right: 16px; bottom: calc(88px + env(safe-area-inset-bottom,0px)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.map-zoom button { width: 44px; border: 0; border-radius: 0; font-size: 22px; color: var(--accent); }
.map-zoom button + button { border-top: 1px solid var(--line); }
.floating-actions { left: 16px; display: flex; gap: 8px; }

.panel { position: absolute; z-index: 1000; background: var(--paper); border: 1px solid var(--line); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.panel.map-sheet { position: absolute; inset: var(--sheet-top,50%) 0 var(--sheet-bottom,0px); height: auto; width: auto; transform: none; z-index: 1000; border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; background: var(--paper); display: flex; flex-direction: column; overflow: hidden; transition: top 200ms ease; }
.map-sheet.dragging { transition: none; }
.sheet-handle { display: grid; place-items: center; width: 100%; min-height: 28px; height: 28px; padding: 0; border: 0; border-radius: 0; background: var(--paper); flex: none; touch-action: none; cursor: ns-resize; }
.sheet-handle span { width: 32px; height: 3px; border-radius: 2px; background: var(--line); }
.sheet-handle:focus-visible { outline-offset: -3px; }
.sheet-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px 10px; scrollbar-width: thin; overscroll-behavior: contain; }
.sh-head { display: flex; gap: 8px; align-items: center; flex: none; padding: 0 16px 16px; }
.sh-head .close { border-radius: 50%; background: var(--bg); }
.sh-head > div { min-width: 0; flex: 1; }
.sh-head h2 { font-size: 19px; overflow-wrap: anywhere; }
.sh-head p { margin-top: 3px; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.sh-head p:empty { display: none; }
.meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 3px 8px; border-radius: 5px; font-size: 11px; font-weight: 500; }
.pill.pending { color: #805a16; background: #fbf2df; }
.pill.delivered { color: #326c4e; background: #edf4ef; }
.pill.failed { color: #a23e3b; background: #fbefee; }
.pill.none, .pill.cancelled { color: var(--muted); background: var(--bg); }
.store-contact { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.store-contact a { display: flex; align-items: center; gap: 6px; min-height: 44px; font-size: 12px; }
.store-contact small { overflow-wrap: anywhere; color: var(--muted); }
.store-primary { width: 100%; }
.sheet-footer > .btn { width: 100%; }
.order-payment { width: 100%; margin-top: 8px; }
.ledger { margin: 12px 0 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 10px; overflow: hidden; }
.ledger > div { display: flex; align-items: center; justify-content: space-between; min-height: 28px; gap: 6px; }
.ledger > div + div { border-top: 1px solid var(--line); }
.ledger dt { font-size: 12px; color: var(--muted); min-width: 0; }
.ledger dd { max-width: 58%; margin: 0; font-size: 14px; font-weight: 600; text-align: right; flex: none; }
.ledger .debt dt, .ledger .debt dd { color: var(--accent); font-weight: 600; }
.ledger .store-debt { margin-inline: -10px; padding-inline: 10px; background: var(--soft); }
.order-card { padding: 12px 0; border-top: 1px solid var(--line); }
.order-card:first-of-type { border-top: 0; }
.order-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.order-id { font-size: 11px; color: var(--muted); }
.single-courier-order .order-card-top .pill { display: none; }
.single-courier-order .order-card { padding-top: 8px; }
.single-courier-order .order-card .ledger { margin-top: 6px; }
.section-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 8px; }
.section-label h3 { margin: 0; }
.section-label > span { font-size: 11px; color: var(--muted); }
.line-items { display: flex; flex-direction: column; }
.line-item { min-height: 44px; display: grid; grid-template-columns: 36px minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 3px 0; }
.line-item + .line-item { border-top: 1px solid var(--line); }
.line-item img { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; }
.item-name { display: block; font-size: 12px; font-weight: 500; overflow-wrap: anywhere; }
.line-item small { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }
.line-item b { max-width: 132px; font-size: 12px; text-align: right; }
.line-item b, .ledger dd { overflow-wrap: anywhere; }
.order-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.order-meta > span { min-width: 0; overflow-wrap: anywhere; }
.order-meta svg { width: 14px; height: 14px; }
.order-comment { margin-top: 8px; padding: 8px 10px; border-radius: 6px; background: var(--bg); font-size: 11px; overflow-wrap: anywhere; }
.order-comment.reason { color: #a23e3b; background: #fbefee; }
.order-actions { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(0,1fr); gap: 8px; margin-top: 12px; }
.order-actions:empty { display: none; }
.order-actions .btn { padding-inline: 8px; }
.order-actions .btn:only-child { grid-column: 1/-1; }
.sheet-footer { flex: none; background: var(--paper); border-top: 1px solid var(--line); padding: 12px 16px calc(12px + env(safe-area-inset-bottom,0px)); }
.sheet-footer .order-actions { margin: 0; }
.links { display: flex; gap: 8px; margin-top: 2px; }
.links a { display: flex; gap: 5px; align-items: center; justify-content: center; min-height: 44px; flex: 1; font-size: 12px; color: var(--muted); }
.links svg { width: 15px; height: 15px; }
.stock-block, .contact-block { border-top: 1px solid var(--line); margin-top: 12px; }
summary { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; font-size: 12px; font-weight: 500; }
summary small { margin-left: auto; color: var(--muted); font-weight: 400; }
.stock-row { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding: 6px 0; }
.stock-row > span { flex: 1; min-width: 0; font-size: 12px; overflow-wrap: anywhere; }
.seg { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; flex: none; }
.seg button { min-width: 44px; padding: 4px; border-radius: 0; color: var(--muted); font-size: 11px; }
.seg button + button { border-left-color: var(--line); }
.seg .on { color: var(--accent); background: var(--soft); }
.seg button:disabled { opacity: 1; }
#contactsForm { padding-top: 8px; }
.item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; text-align: left; }
.item > div { flex: 1; min-width: 0; }
.item strong, .item small { display: block; overflow-wrap: anywhere; }
.item small { margin-top: 3px; line-height: 1.4; }
.item small, .item em { color: var(--muted); font-size: 11px; font-weight: 400; font-style: normal; }
.item-status { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; max-width: 44%; }
.item-status .pill { text-align: left; }
.empty { color: var(--muted); font-size: 12px; margin-top: 8px; }
.empty-state { padding: 28px 12px; text-align: center; color: var(--muted); }
.empty-state > svg { display: block; margin: 0 auto 12px; width: 28px; height: 28px; }
.empty-state strong { display: block; color: var(--ink); }
.empty-state p { margin: 8px 0 16px; font-size: 12px; }
.empty-state .btn { margin: auto; }

.screen { position: fixed; inset: 0; z-index: 1500; display: flex; flex-direction: column; overflow: hidden; border: 0; background: var(--bg); }
.screen-head { min-height: 76px; flex: none; display: flex; align-items: center; gap: 8px; padding: calc(16px + env(safe-area-inset-top,0px)) 16px 16px; border-bottom: 1px solid var(--line); background: var(--paper); }
.screen-head > div { min-width: 0; }
.screen-head h1 { font-size: 19px; overflow-wrap: anywhere; }
.screen-head p { overflow-wrap: anywhere; margin-top: 3px; font-size: 11px; color: var(--muted); }
.screen-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.catalog-tabs { flex: none; display: flex; gap: 24px; padding-inline: 16px; background: var(--paper); border-bottom: 1px solid var(--line); }
.catalog-tabs button { display: flex; align-items: center; gap: 9px; min-height: 52px; padding: 0 2px; color: var(--muted); border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; font-size: 13px; }
.catalog-tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.catalog-tabs span { padding: 2px 5px; border-radius: 4px; background: var(--bg); font-size: 11px; }
.catalog-intro { display: flex; justify-content: space-between; gap: 8px; margin: 2px 0 16px; color: var(--muted); font-size: 11px; }
.products-grid { display: grid; grid-template-columns: minmax(0,1fr); margin-inline: -4px; }
.product { display: grid; grid-template-columns: 56px minmax(0,1fr) auto; align-items: center; gap: 8px; min-height: 88px; padding: 12px 6px; border-bottom: 1px solid var(--line); }
.product.selected { background: var(--soft); border-radius: var(--radius); }
.product-photo { width: 56px; height: 56px; object-fit: cover; border-radius: 7px; }
.product-copy { min-width: 0; }
.product h2 { font-size: 12px; line-height: 1.35; font-weight: 500; letter-spacing: 0; overflow-wrap: anywhere; }
.product-price { font-size: 12px; color: var(--muted); margin-top: 6px; }
.stock-warning { display: flex; gap: 3px; align-items: center; color: #805a16; font-size: 10px; margin-top: 4px; }
.stock-warning svg { width: 12px; height: 12px; }
.counter { width: 112px; display: grid; grid-template-columns: 44px minmax(0,1fr) 44px; align-items: center; background: var(--paper); border-radius: var(--radius); outline: 1px solid var(--line); }
.counter.wide, .counter:has(input) { width: 144px; }
.counter button { min-width: 0; height: 44px; padding: 0; background: none; font-size: 20px; font-weight: 400; color: var(--accent); }
.counter .quantity { min-width: 0; width: 100%; text-align: center; font-size: 14px; font-weight: 600; color: var(--ink); }
.counter input.quantity { min-height: 44px; padding: 0; border: 0; border-radius: 0; font-size: 16px; }
.screen-footer { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom,0px)); border-top: 1px solid var(--line); background: var(--paper); }
.footer-total { min-width: 0; }
.footer-total small { display: block; color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.footer-total strong { display: block; font-size: 22px; line-height: 1.2; overflow-wrap: anywhere; }
.screen-footer .btn { min-width: 132px; }
.review-screen { background: var(--paper); }
.review-screen .section-label { margin: 0 0 8px; }
.review-items .line-item { min-height: 54px; grid-template-columns: 48px minmax(0,1fr) auto; gap: 10px; }
.review-items img { width: 48px; height: 48px; }
.order-total { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 55px; border-top: 1px solid var(--line); margin-top: 8px; }
.order-total > span { font-size: 14px; font-weight: 500; }
.order-total strong { max-width: 75%; font-size: 22px; text-align: right; overflow-wrap: anywhere; }
.payment { padding: 10px; margin-top: 4px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.payment input { font-size: 20px; font-weight: 600; height: 48px; }
.choice-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.choice-chip { min-height: 44px; padding: 10px 12px; border-color: var(--line); background: var(--paper); color: var(--ink); font-size: 12px; font-weight: 500; }
.choice-chip.on { color: var(--accent); border-color: var(--accent); background: var(--soft); }
.payment-chips { display: flex; gap: 8px; margin-top: 8px; }
.payment-chips .choice-chip { flex: 1; }
.debt-result { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 10px; color: var(--accent); font-size: 13px; }
.debt-result.invalid { color: #a23e3b; }
.when { margin-top: 12px; }
.when h3 { margin: 0 0 8px; }
.time-chips { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
.comment-label { margin-top: 12px; }
#order-comment { height: 64px; }
.review-screen .screen-footer .footer-total { display: none; }
.review-screen .screen-footer .btn { width: 100%; justify-content: space-between; }

#crosshair { position: absolute; left: 50%; top: 25%; width: 42px; height: 42px; transform: translate(-50%,-50%); z-index: 980; pointer-events: none; }
#crosshair span { display: block; width: 42px; height: 42px; border: 2px solid var(--accent); border-radius: 50%; background: linear-gradient(var(--accent),var(--accent)) center/2px 16px no-repeat,linear-gradient(var(--accent),var(--accent)) center/16px 2px no-repeat; }
#workspace.has-map-sheet #locate { bottom: calc(100% - var(--sheet-top) + 12px); }
#workspace.has-map-sheet .map-zoom { bottom: calc(100% - var(--sheet-top) + 64px); }
#workspace.sheet-expanded #locate, #workspace.sheet-expanded .map-zoom, #workspace.sheet-expanded #crosshair { visibility: hidden; }
#screen-backdrop { display: none; position: fixed; inset: 0; z-index: 1400; background: #282e3659; }
#modal { position: fixed; inset: 0; z-index: 2000; background: #282e3659; display: flex; align-items: center; justify-content: center; padding: calc(16px + env(safe-area-inset-top,0px)) 16px calc(16px + env(safe-area-inset-bottom,0px)); }
.dialog { position: relative; width: 100%; max-width: 440px; max-height: 100%; display: flex; flex-direction: column; overflow: hidden; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); scrollbar-width: thin; }
.dialog-title { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 16px; }
.dialog h2 { font-size: 19px; overflow-wrap: anywhere; }
.dialog p { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.dialog > form { display: contents; }
.dialog-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.dialog-footer { flex: none; display: grid; gap: 12px; padding-top: 16px; }
.dialog .btn { width: 100%; }
.dialog-footer p { margin: 0; }
.dialog-footer p:empty, .staff-error:empty { display: none; }
.dialog-scroll > p:first-child { font-size: 11px; }
.payment h3:first-child { margin-top: 0; }
.toast-dock { flex: none; display: grid; gap: 8px; padding: 8px 16px; background: var(--paper); }
.toast-dock.floating { position: fixed; z-index: 3100; transform: translateX(-50%); padding: 0; background: transparent; }
.dialog .toast-dock { padding: 12px 0 0; }
.toast-dock #toast, .toast-dock #sync { position: static; transform: none; width: 100%; max-width: 100%; max-height: 96px; overflow-y: auto; }

.dialog .choice-chips { margin-bottom: 16px; }
.dialog textarea { margin-top: 0; }
.dialog .payment { margin-bottom: 16px; }
#paymentForm .dialog-scroll > .field-label { margin-top: 12px; }
#toast, #sync { position: fixed; z-index: 3100; left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); color: var(--ink); text-align: center; font-size: 12px; overflow-wrap: anywhere; }
#sync { bottom: calc(12px + env(safe-area-inset-bottom,0px)); background: var(--soft); color: var(--accent); }
#toast { bottom: calc(88px + env(safe-area-inset-bottom,0px)); overflow-y: auto; }

body.login-page { display: block; overflow: auto; }
.login-shell { width: min(100%,438px); margin: 0 auto; padding: max(32px,calc((100dvh - 844px)/2 + 182px)) 24px 32px; }
.login-intro { margin: 0 6px 24px; position: relative; }
.login-intro h1 { font-size: 32px; letter-spacing: -.045em; }
.login-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; background: var(--paper); }
.login-card .field { margin-bottom: 22px; }
.login-card .field:last-of-type { margin-bottom: 0; }
.login-card .btn { width: 100%; margin-top: 28px; }
.login-card .btn + .btn { margin-top: 10px; }
.logout-text { font-size: 15px; color: var(--ink); overflow-wrap: anywhere; }
.login-error { color: #a23e3b; font-size: 12px; margin-top: 16px; }
.password-field { position: relative; }
.password-field input { padding-right: 52px; }
.password-field input::-ms-reveal { display: none; }
.password-toggle { position: absolute; top: 2px; right: 2px; bottom: 2px; width: 44px; min-height: 0; padding: 0; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); }
.password-toggle[aria-pressed="false"] .eye-slash { display: none; }

@media (min-width: 820px) {
  #app-header { grid-template-columns: minmax(0,1fr) 143px auto; }
  #roleTools { display: flex; }
  .floating-actions { display: none; }
  #workspace { --side-sheet-width: 410px; }
  #workspace.has-list.has-right-sheet { --side-sheet-width: min(410px, calc((100% - 160px) / 2)); }
  .panel.map-sheet { inset: 74px 20px 20px auto; width: var(--side-sheet-width); border-radius: var(--radius); transition: none; }
  #list.map-sheet { left: 20px; right: auto; }
  .sheet-handle { display: none; }
  .sh-head { padding-top: 16px; }
  #screen-backdrop { display: block; }
  .screen { inset: calc(24px + env(safe-area-inset-top,0px)) auto calc(24px + env(safe-area-inset-bottom,0px)) 50%; transform: translateX(-50%); width: min(900px,calc(100% - 48px)); border: 1px solid var(--line); border-radius: var(--radius); }
  .screen-head { padding-top: 16px; }
  .screen.compact-screen, .screen.review-screen { width: min(760px,calc(100% - 48px)); }
  .products-grid { grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 16px; }
  .time-chips { grid-template-columns: repeat(4,minmax(0,1fr)); }
  #workspace.has-map-sheet #locate { bottom: 32px; }
  #workspace.has-map-sheet .map-zoom { bottom: 88px; }
  #workspace.has-right-sheet #locate, #workspace.has-right-sheet .map-zoom { right: calc(var(--side-sheet-width) + 40px); }
}
@media (min-width: 1024px) {
  #app-header { grid-template-columns: minmax(160px,auto) 143px minmax(240px,1fr) auto; grid-template-areas: "brand prog search tools"; align-items: center; padding-bottom: 14px; }
}
@media (max-width: 374px) {
  #app-header { padding-inline: 12px; column-gap: 8px; grid-template-columns: minmax(0,1fr) 110px 44px; }
  .screen-footer { gap: 8px; }
  .screen-footer .btn { min-width: 120px; padding-inline: 12px; }
  .footer-total strong { font-size: 20px; }
  .dialog { padding: 16px; }
  .line-item { gap: 6px; }
  .item-status .pill { max-width: 100px; }
}
@media (max-height: 620px) { .login-shell { padding-top: 32px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

.money-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.money-fields input { width: 100%; min-width: 0; }
.debt-order { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 2px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.debt-order > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.debt-order > strong { color: var(--accent); text-align: right; overflow-wrap: anywhere; max-width: 42%; }
.debt-pay { flex: none; padding: 4px; font-size: 12px; color: var(--accent); background: transparent; }
.order-lock { margin-top: 12px; font-size: 12px; color: var(--muted); }
.today-orders { margin-top: 12px; border-top: 1px solid var(--line); }
.today-orders > summary::after { content: '⌄'; margin-left: auto; }
.today-orders[open] > summary::after { transform: rotate(180deg); }
.carry-secondary { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.text-action { display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; font-size: 12px; color: var(--accent); background: transparent; font-weight: 500; }

.transit-dot { background: var(--accent); }
.pill.transit { color: var(--accent); background: #edf2f8; }
.staff-error { color: var(--failed); }
.staff-filters { display: flex; gap: 8px; margin-bottom: 16px; }
.staff-filters select { min-width: 0; flex: 1; }
.staff-secret { white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; font-family: monospace; font-size: 13px; line-height: 1.6; }
.staff-password-field { display: flex; gap: 8px; align-items: center; }
.staff-password-field input { min-width: 0; flex: 1; font-family: monospace; }
.staff-password-field .btn { width: auto; flex: none; padding: 12px; }
.staff-hint { color: var(--muted); font-size: 12px; line-height: 1.5; }

.staff-row, #staff-form-error { overflow-wrap: anywhere; }
#staffForm .field-label:not(:first-child) { margin-top: 12px; }

.staff-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; align-items: center; width: 100%; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; text-align: left; font-weight: 400; }
.staff-row strong, .staff-row small { display: block; }
.staff-row small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.staff-state { text-align: right; color: var(--muted); font-size: 12px; }
@media (width < 820px) { .map-zoom { display: none; } }

.add-store-screen .add-address-input { display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); }
.add-store-screen .add-address-input input { min-width: 0; flex: 1; border: 0; }
.add-store-screen #add-find { display: inline-flex; align-items: center; gap: 6px; padding: 12px 8px; color: var(--accent); white-space: nowrap; }
.add-store-screen #add-geo { font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.add-store-screen #add-geo:empty { display: none; }
.add-store-screen #add-geo > * { margin-top: 8px; }
.add-store-screen #add-geo small { display: block; font-size: 11px; }
.add-store-screen #add-geo a { color: inherit; }
.add-store-screen .add-point-address .text-action { display: inline; padding: 0; }
.add-store-screen .add-address-results { list-style: none; padding: 0; margin: 0; }
.add-store-screen .add-address-results button { width: 100%; text-align: left; padding: 10px 0; border-bottom: 1px solid var(--line); }
