/* DIWAN DELIVERY — brand: Diwan Al Sultan orange #C65000 on warm cream */
:root {
  --brand: #c65000; --brand-d: #9e3f00; --brand-dd: #5e2604; --brand-soft: #fbe6d2;
  --bg: #fbf6ee; --card: #fff; --ink: #2b211b; --muted: #7d6f66; --line: #ebdfd0;
  --ok: #2e7d4f; --ok-soft: #e3f2e8; --warn: #a86300; --warn-soft: #fff1d9;
  --info: #1f5f8b; --info-soft: #e2eef7; --bad: #b3261e; --bad-soft: #fbe4e2;
  --violet: #5a3f9a; --violet-soft: #ece6f7;
  --r: 14px;
  --font: "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Sans", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 20px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
.ltr { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .ltr { text-align: right; }
.muted { color: var(--muted); }
.boot { text-align: center; color: var(--muted); padding: 40vh 0 0; }
[hidden] { display: none !important; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; padding: 10px 16px;
  font-weight: 700; font-size: 14px; border: 1px solid transparent; cursor: pointer; white-space: nowrap; text-decoration: none;
  min-height: 42px; transition: filter .15s, background .15s; }
.btn:hover { filter: brightness(.96); }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, .inp:focus-visible, a:focus-visible { outline: 3px solid rgba(198, 80, 0, .35); outline-offset: 2px; }
.btn.p { background: var(--brand); color: #fff; }
.btn.o { background: #fff; border-color: var(--line); }
.btn.bad { background: #fff; color: var(--bad); border-color: #efc4bf; }
.btn.ok { background: var(--ok); color: #fff; }
.btn.wa { background: #1fa855; color: #fff; }
.btn.blk { display: flex; width: 100%; }
.btn.sm { padding: 5px 10px; min-height: 32px; font-size: 12px; border-radius: 9px; }
.btn.link { background: none; border: 0; color: var(--muted); font-weight: 600; min-height: 0; padding: 6px; }
.btn.link.light { color: rgba(255, 255, 255, .75); }
.inp { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fffdf9; min-height: 42px; }
textarea.inp { resize: vertical; line-height: 1.6; }
.inp:disabled { background: #f4eee6; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field .lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.hint { font-size: 11px; color: var(--muted); }
.form-err { color: var(--bad); font-size: 13px; margin: 0; min-height: 0; }
.form-err:empty { display: none; }
.checks { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: #fff; }
.lang button { border: 0; background: none; padding: 5px 12px; cursor: pointer; font-size: 12px; }
.lang button.on { background: var(--brand); color: #fff; }

.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 10px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.s-new { background: #eef0f3; color: #4b5563; } .s-preparing { background: var(--warn-soft); color: var(--warn); }
.s-ready { background: var(--info-soft); color: var(--info); } .s-assigned { background: var(--violet-soft); color: var(--violet); }
.s-picked_up { background: #f6e5ef; color: #8b2c64; } .s-on_the_way { background: var(--brand-soft); color: var(--brand-d); }
.s-done, .s-delivered { background: var(--ok-soft); color: var(--ok); } .s-cancelled { background: var(--bad-soft); color: var(--bad); }
.role-tag { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 1px 8px; background: #f2ebe2; }
.role-tag.admin { background: var(--brand-soft); color: var(--brand-d); }
.role-tag.driver { background: var(--info-soft); color: var(--info); }
.dot-tag { display: inline-block; margin-inline-start: 8px; font-size: 11px; color: var(--muted); }
.dot-tag.ok { color: var(--ok); }
.av { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-d); display: inline-grid; place-items: center; font-weight: 700; font-size: 12px; flex: 0 0 auto; }
.av.big { width: 54px; height: 54px; font-size: 18px; }

/* ---------- cards / layout ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.stack > * + * { margin-top: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; align-items: start; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.form-grid .checks, .form-grid .form-err { grid-column: 1 / -1; }
.set-row { display: flex; gap: 8px; align-items: flex-end; }
.set-row .field { flex: 1; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.soon { text-align: center; padding: 40px 16px; }
.me { display: flex; gap: 14px; align-items: center; }
.cred { background: var(--bg); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 14px; margin-top: 10px; font-size: 15px; }

table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: start; color: var(--muted); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12px; }
table.t td { padding: 10px; border-bottom: 1px solid #f3ece2; vertical-align: middle; }
table.t tr.dim td { opacity: .55; }
.table-card { padding: 4px 8px; overflow-x: auto; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- login ---------- */
.login-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(circle at 20% 0%, #fde9d6 0, transparent 50%), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 28px 24px;
  box-shadow: 0 18px 40px rgba(94, 38, 4, .08); display: flex; flex-direction: column; gap: 14px; }
.brand-block { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; margin-bottom: 6px; }
.brand-mark { width: 74px; height: auto; margin-bottom: 8px; }
.brand-block b { font-size: 20px; color: var(--brand); }
.brand-block span { font-size: 11px; letter-spacing: 1.5px; color: var(--muted); direction: ltr; }
.login-lang { text-align: center; margin-top: 4px; }
.dev-banner { background: #3b2a20; color: #ffd9b8; text-align: center; font-size: 12px; padding: 4px 8px; width: 100%; }
.login-page .dev-banner { position: fixed; top: 0; inset-inline: 0; }
.center-box { padding: 40px 16px; text-align: center; }

/* ---------- shell ---------- */
.shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.shell-row { display: flex; flex: 1; min-height: 0; }
.side { width: 228px; flex: 0 0 228px; background: var(--brand-dd); color: #f6e7dc; padding: 16px 12px; display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh; height: 100dvh; }
.side .logo { display: flex; gap: 10px; align-items: center; text-decoration: none; }
.side .logo b { display: block; font-size: 13px; letter-spacing: .4px; }
.side .logo small { opacity: .7; font-size: 11px; }
.mono { width: 40px; height: 40px; border-radius: 12px; background: var(--brand) url(assets/mark-white.png) center / 62% no-repeat; flex: 0 0 auto; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a, .side-foot a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; text-decoration: none; font-size: 14px; }
.side nav a:hover, .side-foot a:hover { background: rgba(255, 255, 255, .07); }
.side nav a.on, .side-foot a.on { background: rgba(255, 255, 255, .14); color: #fff; }
.side .ic { width: 20px; text-align: center; opacity: .9; }
.side-foot { border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 10px; }
.side-foot b { display: block; font-size: 13px; }
.side-foot small { opacity: .7; font-size: 11px; }
.side-foot .av { background: rgba(255, 255, 255, .15); color: #fff; }
.main { flex: 1; min-width: 0; padding: 22px 26px 40px; }
.bottom-nav { display: none; }

/* ---------- banners, misc ---------- */
.banner { border-radius: 12px; padding: 10px 12px; font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.banner.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid #bfe0cb; }
.banner.warn { background: var(--warn-soft); color: #7a4a00; border: 1px solid #f0d3a0; }
.banner.bad { background: var(--bad-soft); color: var(--bad); border: 1px solid #efc4bf; }
.banner.info { background: var(--info-soft); color: var(--info); border: 1px solid #c5dbee; }
.banner > div { flex: 1; min-width: 0; }
.stack-sm > * + * { margin-top: 6px; }
.hint.ok { color: var(--ok); } .hint.err { color: var(--bad); }
.warn-text { color: var(--warn); font-weight: 600; }
.req { color: var(--bad); }
.inp.ok { border-color: var(--ok); } .inp.err { border-color: var(--bad); background: #fff7f6; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; }
.check input, .checks input { width: 18px; height: 18px; accent-color: var(--brand); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; align-self: flex-start; }
.seg button { border: 0; background: none; padding: 7px 14px; cursor: pointer; font-size: 13px; }
.seg button + button { border-inline-start: 1px solid var(--line); }
.seg button.on { background: var(--brand); color: #fff; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; }
.link-box { background: var(--bg); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; word-break: break-all; font-size: 13px; text-align: left; }
.grid2.tight { margin-bottom: 0; gap: 12px; }

/* ---------- new order ---------- */
.new-order { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 16px; align-items: start; }
.phone-row { display: flex; gap: 6px; }
.phone-row .cc { width: 96px; flex: 0 0 96px; }
.auto-info { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); background: var(--bg); border-radius: 10px; padding: 8px 12px; }
.auto-info b { color: var(--ink); }
.saved { max-width: 640px; }

/* ---------- map picker ---------- */
.picker { display: flex; flex-direction: column; gap: 10px; }
.picker-search { display: flex; gap: 6px; position: relative; }
.search-results { position: absolute; top: 100%; inset-inline: 0; margin: 4px 0 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .12); z-index: 1000; max-height: 280px; overflow: auto; }
.search-results li { padding: 2px; font-size: 13px; }
.search-results li.muted, .search-results li.form-err { padding: 10px; }
.search-results button { width: 100%; text-align: start; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; line-height: 1.4; }
.search-results button:hover { background: var(--bg); }
.map-box { height: 380px; border-radius: 12px; border: 1px solid var(--line); overflow: hidden; background: #eae6dc; z-index: 0; }
.picker-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.picker.has-value .coords { color: var(--ok); font-weight: 600; }
.picker-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.row-inp { display: flex; gap: 6px; }
.leaflet-container { font: inherit; }
.leaflet-container a { color: var(--brand-d); }
.pin-icon span { display: block; width: 30px; height: 40px; background: url(assets/pin.svg) center / contain no-repeat; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); }
.rest-icon span { display: block; width: 30px; height: 30px; border-radius: 9px; border: 2px solid #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .3);
  background: var(--brand) url(assets/mark-white.png) center / 64% no-repeat; }
.leaflet-marker-draggable.pin-icon { cursor: grab; }

/* ---------- orders ---------- */
.filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) auto; gap: 10px; align-items: end; margin-bottom: 14px; padding: 12px 14px; }
.filters .inp { min-height: 38px; padding: 6px 10px; }
.filters > .muted { padding-bottom: 9px; white-space: nowrap; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #fcf7f0; }
td.empty { text-align: center; color: var(--muted); padding: 30px; }
.only-phone { display: none; }
.dup-tag { margin-inline-start: 6px; font-size: 10px; font-weight: 700; background: var(--warn-soft); color: var(--warn); border-radius: 5px; padding: 0 5px; }
.back-link { font-size: 14px; color: var(--muted); text-decoration: none; font-weight: 600; }
.page-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.order-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.map-box.small { height: 260px; }
.assign { border-top: 1px solid var(--line); padding-top: 12px; }
.drv-icon span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(198, 80, 0, .2), 0 2px 6px rgba(0, 0, 0, .3); font-size: 15px; }
.drv-icon.stale span { background: #9aa0a6; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.wa-card .btn.wa { font-size: 14px; }
.btn.dis { opacity: .45; }
.wa-preview summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.wa-msg { background: #dcf8c6; border-radius: 10px; padding: 10px 12px; font-size: 13px; white-space: pre-line; margin-top: 8px; }
.saved-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; max-width: 1100px; }
.saved-grid .saved { max-width: none; }

/* timeline */
.tl { list-style: none; margin: 10px 0 0; padding: 0; }
.tl li { display: flex; gap: 10px; position: relative; padding-bottom: 12px; }
.tl li:not(:last-child)::after { content: ""; position: absolute; inset-inline-start: 10px; top: 22px; bottom: 0; width: 2px; background: var(--line); }
.tl li.d:not(:last-child)::after { background: var(--ok); }
.tl .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); background: #fff; flex: 0 0 22px; display: grid; place-items: center;
  font-size: 11px; color: #fff; z-index: 1; }
.tl li.d .dot { background: var(--ok); border-color: var(--ok); }
.tl li.c .dot { border-color: var(--brand); background: var(--brand); box-shadow: 0 0 0 5px rgba(198, 80, 0, .2); }
.tl li.x .dot { background: var(--bad); border-color: var(--bad); }
.tl b { font-size: 13px; display: block; }
.tl small { color: var(--muted); font-size: 11px; }
.tl li:not(.d):not(.c):not(.x) b { color: #b5aaa0; font-weight: 600; }

/* history */
.events { list-style: none; margin: 10px 0 0; padding: 0; max-height: 420px; overflow: auto; }
.events li { padding: 9px 0; border-bottom: 1px solid #f3ece2; font-size: 13px; }
.events li:last-child { border-bottom: 0; }
.ev-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ev-head .muted { font-size: 11px; }
.ev-diff { font-size: 12px; margin-top: 4px; }
.ev-diff s { color: var(--muted); }
.ev-note { margin-top: 4px; background: var(--bg); border-radius: 8px; padding: 6px 8px; font-size: 12px; }
.modal.wide { max-width: 860px; }

/* ---------- driver (mobile first) ---------- */
.role-driver .main { max-width: 640px; margin: 0 auto; width: 100%; }
.btn.g { background: #e9a866; color: var(--brand-dd); }
.btn.big { min-height: 56px; font-size: 16px; border-radius: 14px; }
.btn-row.two > * { flex: 1; }
.d-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.d-head b { font-size: 18px; display: block; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .slider { width: 46px; height: 26px; border-radius: 999px; background: #d9cfc3; position: relative; transition: .2s; flex: 0 0 auto; }
.switch .slider::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider::after { inset-inline-start: 23px; }
.switch input:focus-visible + .slider { outline: 3px solid rgba(198, 80, 0, .35); outline-offset: 2px; }
.tabs { display: flex; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.tabs button { flex: 1; border: 0; background: none; padding: 9px 4px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button.on { background: var(--brand); color: #fff; }
.d-list { display: flex; flex-direction: column; gap: 10px; }
.d-card { display: flex; flex-direction: column; gap: 4px; text-decoration: none; border-inline-start: 4px solid var(--line); }
.d-card.s-border-assigned { border-inline-start-color: var(--violet); }
.d-card.s-border-picked_up, .d-card.s-border-on_the_way { border-inline-start-color: var(--brand); }
.d-card.s-border-delivered { border-inline-start-color: var(--ok); }
.d-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.d-addr { font-size: 13px; }
.d-live { text-decoration: none; margin-bottom: 12px; }
.d-order-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.d-order-head b { font-size: 17px; flex: 1; }
.map-box.d-map { height: 240px; margin-bottom: 12px; }
.note-hl { background: var(--warn-soft); border-radius: 6px; padding: 2px 6px; }
.gps { display: flex; gap: 10px; align-items: center; border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.gps b { display: block; }
.gps small { opacity: .85; }
.gps.on { background: var(--ok-soft); color: var(--ok); }
.gps.off { background: var(--bad-soft); color: var(--bad); }
.gps .btn { margin-top: 6px; }
.blink { width: 12px; height: 12px; border-radius: 50%; background: currentColor; flex: 0 0 12px; animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(46, 125, 79, .5); } 70% { box-shadow: 0 0 0 10px rgba(46, 125, 79, 0); } 100% { box-shadow: 0 0 0 0 rgba(46, 125, 79, 0); } }
@media (prefers-reduced-motion: reduce) { .blink { animation: none; } }
.stale-note { font-size: 12px; color: var(--warn); }

/* ---------- customer tracking page ---------- */
.track-body { background: var(--bg); }
.c-top { background: linear-gradient(160deg, var(--brand), var(--brand-dd)); color: #fff; text-align: center; padding: 14px 16px 54px; position: relative; }
.c-top b { display: block; font-size: 18px; letter-spacing: .3px; }
.c-top small { opacity: .75; font-size: 11px; letter-spacing: 1.5px; }
.c-mark { width: 44px; height: auto; display: block; margin: 8px auto 6px; }
.c-lang { display: flex; justify-content: center; gap: 4px; }
.c-lang button { border: 1px solid rgba(255, 255, 255, .35); background: none; color: #fff; border-radius: 999px; padding: 2px 10px; font-size: 11px; cursor: pointer; }
.c-lang button.on { background: #fff; color: var(--brand-d); }
.c-main { max-width: 560px; margin: -40px auto 0; padding: 0 12px 30px; position: relative; display: flex; flex-direction: column; gap: 12px; }
.c-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: 0 6px 18px rgba(94, 38, 4, .06); }
.c-card.center { text-align: center; }
.c-card h1 { font-size: 20px; margin: 2px 0; }
.c-card h2 { font-size: 15px; margin-bottom: 4px; }
.c-big-ic { font-size: 40px; margin-bottom: 6px; }
.c-status-row { display: flex; gap: 12px; align-items: center; }
.c-ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 26px; flex: 0 0 52px; background: var(--brand-soft); }
.c-ic.s-delivered { background: var(--ok-soft); color: var(--ok); font-weight: 800; }
.c-ic.s-cancelled { background: var(--bad-soft); color: var(--bad); font-weight: 800; }
.c-ic.s-preparing { background: var(--warn-soft); }
.c-sub { margin: 10px 0 0; font-size: 14px; }
.c-sub.ok { color: var(--ok); font-weight: 600; }
.c-map-card { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.map-box.c-map { height: 340px; border-radius: 12px; }
.c-live.banner { margin: 0; }
.c-live .blink { margin-top: 3px; }
.c-share-need { border-color: #f0d3a0; background: #fffaf1; }
.c-share-need p { margin: 0 0 10px; }
.c-foot { text-align: center; font-size: 11px; }

/* ---------- dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; border-top: 3px solid var(--line); min-width: 0; }
.kpi small { display: block; color: var(--muted); font-size: 12px; }
.kpi b { font-size: 24px; line-height: 1.3; display: block; color: var(--ink); }
.kpi i { font-style: normal; font-size: 11px; color: var(--muted); }
.kpi.k-warn { border-top-color: var(--warn); } .kpi.k-info { border-top-color: var(--info); } .kpi.k-brand { border-top-color: var(--brand); }
.kpi.k-ok { border-top-color: var(--ok); } .kpi.k-bad { border-top-color: var(--bad); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 16px; align-items: start; }
table.t td .ltr, table.t td b.ltr { white-space: nowrap; }
.map-box.dash-map { height: 340px; }
.road-list { list-style: none; margin: 0; padding: 0; }
.road-list li { padding: 8px 0; border-bottom: 1px solid #f3ece2; font-size: 13px; }
.road-list li:last-child { border-bottom: 0; }
.road-list a { text-decoration: none; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.road-list small { flex-basis: 100%; }
.ok-text { color: var(--ok); }
.card-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 6px 4px; }
.card-pad { padding: 12px 6px 4px; }
.live-dot { font-size: 12px; color: var(--ok); }
.leaflet-tooltip.drv-tip { font: inherit; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 8px; }

/* ---------- reports ---------- */
.r-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; padding: 10px 12px; }
.r-bar .tabs { margin: 0; min-width: 280px; }
.r-inputs { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.r-inputs .inp { width: auto; min-height: 38px; }
.r-title { font-size: 17px; }
.print-only { display: none; }
/* single-series bar chart: one hue, thin bars, rounded data end, recessive grid */
.bars { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 8px; margin-top: 10px; }
.bars-grid { display: flex; flex-direction: column; justify-content: space-between; height: 160px; font-size: 10px; color: var(--muted); text-align: end; padding-bottom: 18px; }
.bars-row { display: flex; align-items: stretch; gap: 2px; height: 178px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.bar-col { flex: 1 0 14px; display: flex; flex-direction: column; align-items: center; gap: 2px; outline: none; cursor: default; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bar { width: min(70%, 22px); min-height: 0; background: var(--brand); border-radius: 4px 4px 0 0; }
.bar-col:hover .bar, .bar-col:focus-visible .bar { background: var(--brand-d); }
.bar-col small { font-size: 9px; color: var(--muted); white-space: nowrap; height: 16px; }
.chart-tip { position: absolute; top: -6px; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 2; }
[dir="rtl"] .chart-tip { transform: translateX(-50%); }

@media print {
  .side, .bottom-nav, .dev-banner, .no-print, .page-tools, .toast { display: none !important; }
  .print-only { display: flex !important; }
  .print-head { gap: 12px; align-items: center; margin-bottom: 12px; border-bottom: 2px solid var(--brand); padding-bottom: 8px; }
  .print-head img { width: 40px; }
  body, .main { background: #fff !important; padding: 0 !important; }
  .page-head h1 { font-size: 16px; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
  .kpis { grid-template-columns: repeat(4, 1fr) !important; }
  table.resp thead { display: table-header-group !important; }
  table.resp, table.resp tbody { display: table !important; width: 100%; }
  table.resp tbody { display: table-row-group !important; }
  table.resp tr { display: table-row !important; }
  table.resp td { display: table-cell !important; padding: 4px 6px !important; border-bottom: 1px solid #eee !important; }
  table.resp td[data-l]::before { display: none !important; }
  .bars-row { overflow: visible; }
  @page { margin: 12mm; }
}

/* ---------- install / update ---------- */
.install-card { align-items: center; margin-bottom: 14px; }
.install-card .btn-row { margin-top: 8px; }
.install-ic { width: 44px; height: 44px; border-radius: 10px; flex: 0 0 44px; }
.install-slot .install-card { margin: 10px 16px 0; }
.login-install { width: 100%; max-width: 380px; margin-top: 14px; }
.update-bar { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 70; background: var(--ink); color: #fff; border-radius: 12px;
  padding: 8px 10px 8px 14px; display: flex; gap: 12px; align-items: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); font-size: 13px; max-width: calc(100vw - 24px); }
.update-bar .btn { background: #fff; color: var(--ink); }

/* ---------- modal / toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(43, 33, 27, .45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 18px; padding: 20px; width: 100%; max-width: 560px; max-height: calc(100dvh - 32px); overflow: auto;
  display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 30px); opacity: 0; transition: .25s;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 60; max-width: calc(100vw - 32px); font-size: 14px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--bad); }

/* ---------- phone ---------- */
@media (max-width: 860px) {
  .side { display: none; }
  .main { padding: 16px 16px 90px; }
  .grid2, .form-grid, .new-order, .order-grid, .saved-grid, .dash-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .r-bar .tabs { min-width: 0; width: 100%; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters > .field:nth-child(5) { grid-column: 1 / -1; }
  .only-phone { display: inline-flex; }
  table.resp td.only-wide { display: none; }
  .new-order > .card:last-child { order: 0; }
  .map-box { height: 320px; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; inset-inline: 0; background: #fff; border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 20; }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; text-decoration: none; color: var(--muted);
    padding: 4px 2px; border-radius: 10px; font-size: 18px; min-width: 0; }
  .bottom-nav a small { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .bottom-nav a.on { color: var(--brand); background: var(--brand-soft); }
  .toast { bottom: 84px; }
  table.t .row-actions { justify-content: flex-start; }
  /* tables become cards */
  table.resp thead { display: none; }
  table.resp, table.resp tbody { display: block; }
  table.resp tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 12px 6px; border-bottom: 1px solid var(--line); }
  table.resp td { border: 0; padding: 0; }
  table.resp td.cell-title, table.resp td.row-actions { grid-column: 1 / -1; }
  table.resp td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; color: var(--muted); }
  .table-card { padding: 0 10px; }
}
