/* CO-SYNE Driver: a phone app. On a desktop it renders inside a phone frame;
   on a phone (or installed) it fills the screen. */
body.driver {
  color-scheme: light;
  --bg: #f2f2f7; --panel: #ffffff; --panel-2: #f6f6f9; --panel-3: #ececf1;
  --line: #e2e2e8; --line-2: #d3d3db;
  --text: #111214; --muted: #6c6f76; --faint: #9a9da4;
  --brand: #0067b8; --brand-2: #005da6; --brand-bg: rgba(0, 103, 184, .1); --brand-ink: #fff;
  --ok: #1f9d55; --ok-bg: rgba(31, 157, 85, .12);
  --warn: #d97706; --warn-bg: rgba(217, 119, 6, .12);
  --danger: #e5484d; --danger-bg: rgba(229, 72, 77, .1);
  --info: #3a6ea5; --info-bg: rgba(58, 110, 165, .1);
  --primary: #0067b8; --primary-ink: #fff;
  --shadow: 0 8px 28px rgba(17, 18, 20, .14);
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, "SF Pro Text", system-ui, Roboto, sans-serif;
  background: #d9dbe0;
  font-size: 15px;
}
.stage { min-height: 100%; display: flex; align-items: center; justify-content: center; gap: 48px; padding: 24px; background: radial-gradient(circle at 30% 20%, #f4f5f7, #cfd2d8); }
.device { position: relative; width: 390px; height: 844px; max-height: calc(100vh - 48px); border-radius: 56px; background: #121316; padding: 12px; box-shadow: 0 0 0 2px #2c2e33, 0 30px 80px rgba(0, 0, 0, .35); flex: 0 0 auto; }
.island { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); width: 120px; height: 34px; border-radius: 20px; background: #000; z-index: 50; }
.screen { position: relative; width: 100%; height: 100%; border-radius: 44px; overflow: hidden; background: var(--bg); display: flex; flex-direction: column; }
.statusbar { height: 50px; flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; padding: 8px 30px 0 34px; font-weight: 600; font-size: 15px; z-index: 40; }
.sb-right { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.sb-signal { width: 17px; height: 11px; background: linear-gradient(90deg, currentColor 0 18%, transparent 18% 27%, currentColor 27% 45%, transparent 45% 54%, currentColor 54% 72%, transparent 72% 81%, currentColor 81%); clip-path: polygon(0 100%, 100% 0, 100% 100%); }
.sb-batt { width: 25px; height: 12px; border: 1.5px solid currentColor; border-radius: 4px; padding: 1.5px; opacity: .9; }
.sb-batt i { display: block; height: 100%; width: 78%; background: currentColor; border-radius: 1.5px; }
.home-indicator { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); width: 134px; height: 5px; border-radius: 3px; background: #111; opacity: .85; z-index: 60; pointer-events: none; }
.stage-note { max-width: 300px; color: #3b3f46; }
.stage-note p { font-size: .9rem; }
.stage-note .tip { color: #6c6f76; font-size: .85rem; }
.brandmark { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.brandmark b { display: block; font-size: 1.05rem; }
.brandmark span { font-size: .82rem; color: #6c6f76; }

/* Full-screen on real phones, installed app, or narrow windows. */
@media (max-width: 760px), (display-mode: standalone) {
  body.driver { background: var(--bg); }
  .stage { padding: 0; display: block; background: none; }
  .device { width: 100%; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; padding: 0; box-shadow: none; background: var(--bg); }
  .island, .home-indicator, .stage-note, .statusbar { display: none; }
  .screen { border-radius: 0; padding-top: env(safe-area-inset-top); }
}

.view { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 18px 110px; -webkit-overflow-scrolling: touch; }
.view::-webkit-scrollbar { display: none; }
.page-title { font-size: 2rem; font-weight: 750; letter-spacing: -.02em; margin: 6px 0 14px; }
.greeting { display: flex; justify-content: space-between; align-items: center; margin: 6px 0 16px; }
.greeting h1 { font-size: 1.6rem; font-weight: 750; letter-spacing: -.02em; }
.greeting .sub { color: var(--muted); font-size: .9rem; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: .78rem; font-weight: 600; }
.group { background: var(--panel); border-radius: 16px; margin-bottom: 16px; overflow: hidden; }
.group-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin: 18px 4px 7px; }
.cell { display: flex; gap: 12px; align-items: center; padding: 13px 15px; border-bottom: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; cursor: pointer; }
.cell:last-child { border-bottom: 0; }
.cell .grow b { display: block; font-weight: 600; }
.cell .grow span { color: var(--muted); font-size: .85rem; }
.cell .ico-wrap { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--panel-3); flex: 0 0 auto; }
.cell .ico-wrap .ico { width: 19px; height: 19px; }
.cell > .ico:last-child { color: var(--faint); }

/* wallet credential */
.wallet { position: relative; border-radius: 20px; padding: 18px 18px 16px; color: #f4efe2; background: linear-gradient(140deg, #24272d 0%, #16181c 55%, #2a2518 100%); box-shadow: 0 14px 30px rgba(17, 18, 20, .28); overflow: hidden; cursor: pointer; margin-bottom: 16px; }
.wallet::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; border: 1px solid rgba(224, 193, 113, .22); box-shadow: 0 0 0 26px rgba(224, 193, 113, .05); }
.wallet .w-top { display: flex; justify-content: space-between; align-items: flex-start; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: #d9c48d; }
.wallet .w-name { font-size: 1.35rem; font-weight: 650; margin: 18px 0 2px; letter-spacing: -.01em; }
.wallet .w-row { display: flex; gap: 22px; margin-top: 12px; font-size: .78rem; }
.wallet .w-row span { display: block; color: #a9a497; font-size: .66rem; text-transform: uppercase; letter-spacing: .07em; }
.wallet .w-seal { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; font-size: .75rem; color: #b9e7c9; background: rgba(31, 157, 85, .18); padding: 4px 9px; border-radius: 999px; }
.wallet .w-photo { width: 52px; height: 52px; border-radius: 12px; background: rgba(255, 255, 255, .08); display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; color: #e0c171; border: 1px solid rgba(224, 193, 113, .3); }

.tile-card { background: var(--panel); border-radius: 16px; padding: 14px 15px; margin-bottom: 14px; }
.tile-card h3 { font-size: 1rem; }
.status-line { display: flex; gap: 8px; align-items: center; font-size: .86rem; margin-top: 6px; }
.sos-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 16px; border-radius: 16px; border: 0; background: var(--danger); color: #fff; font-weight: 700; font-size: 1.05rem; cursor: pointer; margin-bottom: 14px; box-shadow: 0 8px 20px rgba(229, 72, 77, .3); }
.sos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sos { border: 0; background: var(--panel); border-radius: 18px; padding: 18px 14px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 14px; min-height: 120px; }
.sos .ico { width: 30px; height: 30px; }
.sos b { font-size: 1rem; }
.sos span { color: var(--muted); font-size: .78rem; }
.sos.red .ico { color: var(--danger); } .sos.amber .ico { color: var(--warn); } .sos.ink .ico { color: var(--text); }

.btn { border-radius: 12px; }
.btn.pill-btn { border-radius: 999px; padding: 13px 18px; font-size: 1rem; font-weight: 650; }

/* tab bar */
.tabbar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around; padding: 8px 6px 28px; background: rgba(249, 249, 251, .86); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
@media (max-width: 760px), (display-mode: standalone) { .tabbar { padding-bottom: max(10px, env(safe-area-inset-bottom)); } }
.tabbar button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: .68rem; font-weight: 600; color: var(--faint); cursor: pointer; position: relative; }
.tabbar button .ico { width: 24px; height: 24px; }
.tabbar button.on { color: var(--text); }
.tabbar button.sos-tab { color: var(--danger); }
.tabbar .badge { position: absolute; top: -2px; left: calc(50% + 6px); background: var(--danger); color: #fff; border-radius: 999px; font-size: .62rem; padding: 0 5px; min-width: 16px; line-height: 16px; }

/* overlays */
.overlay { position: absolute; inset: 0; z-index: 70; display: flex; flex-direction: column; animation: slideUp .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } }
.pullover { background: #0f1012; color: #fff; padding: 62px 20px 34px; overflow-y: auto; }
@media (max-width: 760px), (display-mode: standalone) { .pullover { padding-top: calc(20px + env(safe-area-inset-top)); } }
.pullover::before { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 6px var(--danger); animation: flash 1s steps(2) infinite; border-radius: inherit; }
@keyframes flash { 50% { box-shadow: inset 0 0 0 6px #f5a524; } }
.pullover.calm::before { animation: none; box-shadow: none; }
.po-kicker { display: flex; align-items: center; gap: 8px; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: #f5a524; font-weight: 700; }
.po-title { font-size: 1.9rem; font-weight: 750; line-height: 1.1; margin: 10px 0 18px; letter-spacing: -.02em; }
.officer-card { background: #1b1d21; border: 1px solid #2c2f35; border-radius: 18px; padding: 16px; }
.officer-card .who { display: flex; gap: 12px; align-items: center; }
.officer-card .badge-mark { width: 54px; height: 54px; border-radius: 14px; background: linear-gradient(150deg, #e0c171, #a8842c); color: #1b1608; display: grid; place-items: center; font-weight: 800; font-size: 1.1rem; flex: 0 0 auto; }
.officer-card b { font-size: 1.1rem; }
.officer-card .meta { color: #a7abb3; font-size: .86rem; }
.verify-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 9px 11px; border-radius: 12px; background: rgba(31, 157, 85, .16); color: #8fe0ae; font-size: .85rem; font-weight: 600; }
.verify-row.bad { background: rgba(229, 72, 77, .18); color: #ffadb0; }
.po-reason { margin-top: 12px; font-size: .95rem; }
.po-reason span { color: #a7abb3; display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.po-steps { margin: 16px 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: .9rem; color: #d7d9dd; }
.po-steps li { display: flex; gap: 10px; align-items: flex-start; }
.po-steps li .n { width: 22px; height: 22px; border-radius: 50%; background: #2a2d33; display: grid; place-items: center; font-size: .75rem; font-weight: 700; flex: 0 0 auto; }
.ring { margin-top: auto; background: #1b1d21; border-radius: 22px; padding: 16px; border: 1px solid #2c2f35; }
.ring .ring-title { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.ring .ring-title .ico { color: #8fe0ae; animation: wiggle 1.2s infinite; }
@keyframes wiggle { 0%, 60%, 100% { transform: rotate(0); } 10%, 30%, 50% { transform: rotate(-14deg); } 20%, 40% { transform: rotate(14deg); } }
.ring-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.round-btn { border: 0; border-radius: 16px; padding: 14px 10px; font-weight: 700; font-size: .95rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
.round-btn.accept { background: #1f9d55; color: #fff; }
.round-btn.text { background: #2a2d33; color: #fff; }
.link-danger { background: none; border: 0; color: #ff8f93; font-weight: 600; margin-top: 14px; cursor: pointer; font-size: .9rem; padding: 6px; }

/* call screen */
.callscreen { background: #000; color: #fff; }
.callscreen .remote { position: absolute; inset: 0; display: grid; }
.callscreen .remote .tile { position: absolute; inset: 0; border-radius: 0; aspect-ratio: auto; }
.callscreen .remote .tile.self { inset: auto; top: 118px; right: 14px; width: 104px; height: 150px; border-radius: 14px; z-index: 5; box-shadow: 0 6px 18px rgba(0, 0, 0, .5); border: 1px solid rgba(255, 255, 255, .2); }
.callscreen .remote .tile[data-role="dispatch"] { inset: auto; top: 278px; right: 14px; width: 104px; height: 150px; border-radius: 14px; z-index: 5; border: 1px solid rgba(255, 255, 255, .2); }
.callscreen .remote .tile .tag { font-size: .68rem; }
.callscreen .waiting { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #c7c9ce; padding: 40px; }
.call-top { position: absolute; top: 0; left: 0; right: 0; padding: 56px 18px 30px; background: linear-gradient(rgba(0, 0, 0, .65), transparent); z-index: 6; }
@media (max-width: 760px), (display-mode: standalone) { .call-top { padding-top: calc(14px + env(safe-area-inset-top)); } .callscreen .remote .tile.self { top: calc(80px + env(safe-area-inset-top)); } }
.call-top b { font-size: 1.05rem; }
.call-top .meta { font-size: .8rem; color: #d0d2d6; display: flex; gap: 8px; align-items: center; margin-top: 3px; }
.call-controls { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 18px 36px; background: linear-gradient(transparent, rgba(0, 0, 0, .75)); z-index: 6; display: flex; justify-content: space-around; }
.cc { width: 58px; height: 58px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .18); color: #fff; display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(10px); }
.cc .ico { width: 24px; height: 24px; }
.cc.off { background: #fff; color: #111; }
.cc.end { background: var(--danger); }
.cc-label { font-size: .66rem; text-align: center; margin-top: 5px; color: #e3e4e7; }
.chat-drawer { position: absolute; left: 10px; right: 10px; bottom: 120px; z-index: 7; background: rgba(20, 21, 24, .9); backdrop-filter: blur(14px); border-radius: 18px; padding: 10px; max-height: 46%; display: flex; flex-direction: column; gap: 8px; }
.chat-drawer .chat { flex: 1; min-height: 60px; }
.chat-drawer .chat .msg { background: #2a2d33; border-color: #34373e; color: #fff; }
.chat-drawer .chat .msg.me { background: #3b3f47; }
.chat-drawer .chat .msg b { color: #a7abb3; }
.chat-drawer form { display: flex; gap: 8px; }
.chat-drawer input { background: #2a2d33; border-color: #3a3e45; color: #fff; border-radius: 999px; }
.unmute { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 8; border: 0; border-radius: 999px; padding: 10px 16px; background: rgba(255, 255, 255, .9); font-weight: 700; cursor: pointer; }

/* sheet + banners */
.sheet-back { position: absolute; inset: 0; z-index: 80; background: rgba(0, 0, 0, .35); display: flex; align-items: flex-end; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-height: 92%; overflow-y: auto; background: var(--bg); border-radius: 22px 22px 0 0; padding: 10px 18px 34px; animation: slideUp .25s ease-out; }
.sheet .grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 0 auto 12px; }
.banner-host { position: absolute; top: 52px; left: 10px; right: 10px; z-index: 90; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
@media (max-width: 760px), (display-mode: standalone) { .banner-host { top: calc(8px + env(safe-area-inset-top)); } }
.banner { pointer-events: auto; background: rgba(250, 250, 252, .94); backdrop-filter: blur(20px); border-radius: 18px; padding: 11px 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); display: flex; gap: 11px; align-items: center; animation: drop .3s cubic-bezier(.2, .8, .2, 1); cursor: pointer; }
@keyframes drop { from { transform: translateY(-120%); } }
.banner .app-ico { width: 36px; height: 36px; border-radius: 9px; flex: 0 0 auto; }
.banner b { font-size: .88rem; display: block; }
.banner span { font-size: .83rem; color: #3b3f46; }
.banner small { color: var(--faint); font-size: .72rem; margin-left: auto; align-self: flex-start; }

.cit { background: var(--panel); border-radius: 16px; padding: 15px; margin-bottom: 12px; border-left: 4px solid var(--danger); }
.cit.warning { border-left-color: var(--warn); }
.cit.paid { border-left-color: var(--ok); }
.cit h3 { font-size: .98rem; }
.cit .amount { font-size: 1.6rem; font-weight: 750; letter-spacing: -.02em; margin: 6px 0; }
.cit ul { margin: 6px 0; padding-left: 18px; font-size: .88rem; }
.cit .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.timeline { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 0; }
.timeline li { display: flex; gap: 11px; font-size: .88rem; padding-bottom: 12px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 16px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .tdot { width: 16px; height: 16px; border-radius: 50%; background: var(--line-2); flex: 0 0 auto; margin-top: 2px; z-index: 1; }
.timeline li.done .tdot { background: var(--ok); }
.timeline li.now .tdot { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-bg); }

.onboard { display: flex; flex-direction: column; min-height: 100%; padding-top: 30px; }
.onboard .logo { width: 72px; height: 72px; border-radius: 20px; margin-bottom: 18px; }
.onboard h1 { font-size: 1.9rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.onboard p { color: var(--muted); }
.feature { display: flex; gap: 12px; margin: 16px 0; }
.feature .ico { width: 26px; height: 26px; color: var(--brand); }
.feature b { display: block; }
.feature span { color: var(--muted); font-size: .88rem; }
.mini-call { position: absolute; z-index: 65; top: 56px; left: 50%; transform: translateX(-50%); background: #111; color: #fff; border-radius: 999px; padding: 7px 14px; display: flex; gap: 8px; align-items: center; font-size: .82rem; font-weight: 650; cursor: pointer; box-shadow: 0 6px 18px rgba(0, 0, 0, .3); }
@media (max-width: 760px), (display-mode: standalone) { .mini-call { top: calc(8px + env(safe-area-inset-top)); } }
.danger-screen { background: #2a0b0d; color: #fff; padding: 62px 20px 30px; overflow-y: auto; }
.danger-screen h1 { font-size: 1.7rem; margin: 10px 0; }
.done-screen { background: var(--bg); padding: 70px 22px 30px; text-align: center; overflow-y: auto; }
.done-screen .big-check { width: 86px; height: 86px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: grid; place-items: center; margin: 20px auto; }
.done-screen .big-check .ico { width: 44px; height: 44px; stroke-width: 2.4; }
.pay-field { background: var(--panel); border-radius: 12px; border: 1px solid var(--line); padding: 10px 12px; margin-bottom: 10px; }
.pay-field label { margin: 0 0 3px; }
.pay-field input { border: 0; padding: 0; background: none; box-shadow: none !important; font-size: 1rem; }
.call-box { display: contents; }

.callscreen .remote .tile:not(.self):not([data-role="dispatch"]) .tag { display: none; }

/* Native-app feel on phones and when installed. */
body.driver { -webkit-tap-highlight-color: transparent; }
@media (max-width: 760px), (display-mode: standalone) {
  html, body.driver { overscroll-behavior: none; }
  .view { overscroll-behavior-y: contain; padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }
  .tabbar button, .cell, .round-btn, .sos { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  .tabbar button:active, .cell:active, .sos:active { opacity: .6; }
}
@media (display-mode: standalone) { .stage-note { display: none; } }
.offline-card { display: flex; gap: 12px; align-items: flex-start; background: var(--warn-bg); border-radius: 16px; padding: 12px 14px; margin-bottom: 14px; }
.offline-card .ico { width: 22px; height: 22px; color: var(--warn); margin-top: 2px; }
.offline-card b { display: block; }
.offline-card span { font-size: .85rem; color: var(--muted); }
.push-nudge { border: 1px solid var(--brand-bg); }
.push-nudge .ico-wrap { background: var(--brand-bg); color: var(--brand-2); }
.sheet h2 .ico { width: 20px; height: 20px; vertical-align: -3px; }

/* A landscape camera (the patrol car's) on a portrait phone: show the whole
   frame instead of cropping into the middle, so the driver sees the officer
   and their surroundings. */
@media (orientation: portrait) {
  .callscreen .remote .tile:not(.self):not([data-role="dispatch"]) { display: flex; align-items: center; background: radial-gradient(120% 60% at 50% 45%, #2a2f36 0%, #0d0f12 70%); }
  .callscreen .remote .tile:not(.self):not([data-role="dispatch"]) video { height: auto; max-height: 100%; object-fit: contain; }
}
