/* 🚑 Ambulance add-on — uses the site's colours when present, with fallbacks */
.page-amb { --amb-red: #c62828; --amb-green: #137333; --amb-amber: #e0a526; }
.page-amb .wrap { max-width: 1400px; }
.amb-sos { display: flex; align-items: center; justify-content: center; gap: .5rem; padding: .6rem 1rem; margin: .4rem 0 .9rem;
  background: var(--amb-red); color: #fff !important; border-radius: 10px; text-decoration: none; font-size: 1.02rem; }
.amb-sos b { background: #fff; color: var(--amb-red); padding: .15rem .6rem; border-radius: 6px; }
.amb-hero h1 { margin: .2rem 0; } .amb-hero { margin-bottom: .8rem; }
.amb-hot { display: inline-flex; margin-top: .4rem; }
.amb-form { display: grid; gap: .7rem; }
.amb-form h2 { font-size: 1.1rem; margin: .4rem 0 0; }
.amb-loc-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.amb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.amb-grid label, .amb-form > label { display: grid; gap: .25rem; }
.amb-grid input, .amb-form input, .amb-grid select { width: 100%; min-height: 46px; box-sizing: border-box; font-size: 1rem; }
.amb-map { height: 340px; border-radius: 12px; border: 1px solid var(--line, #dde); z-index: 0; }
.amb-map-big { height: min(60vh, 520px); }
.amb-map-desk { height: calc(100vh - 170px); min-height: 420px; }
.amb-map-drv { height: 300px; margin-top: .8rem; }
.amb-types { display: flex; flex-wrap: wrap; gap: .45rem; }
.amb-types button { font: inherit; padding: .55rem .9rem; min-height: 44px; border-radius: 99px; border: 1px solid var(--line, #ccd); background: var(--surface, #fff); color: inherit; cursor: pointer; }
.amb-types button.on { background: var(--ink, #123a5a); border-color: var(--ink, #123a5a); color: #fff; }
.amb-send { width: 100%; min-height: 56px; font-size: 1.15rem !important; font-weight: 700; background: var(--amb-red) !important; border-color: var(--amb-red) !important; color: #fff !important; }
.ok-txt { color: var(--amb-green); } .warn-txt { color: var(--amb-red); }

/* map pins */
.amb-pin, .pt-pin { background: none; border: 0; }
.amb-pin .amb-pin-in { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; font-size: 24px; background: #fff;
  border: 3px solid var(--amb-red); box-shadow: 0 3px 10px rgba(0,0,0,.3); }
.amb-pin.free .amb-pin-in { border-color: var(--amb-green); }
.amb-pin.busy .amb-pin-in { border-color: var(--amb-red); animation: amb-pulse 1.6s infinite; }
.amb-pin.stale .amb-pin-in { border-color: #9aa5b1; filter: grayscale(.7); opacity: .75; }
.amb-pin em { position: absolute; top: 44px; left: 50%; transform: translateX(-50%); white-space: nowrap; font: 700 11px sans-serif; font-style: normal;
  background: rgba(255,255,255,.92); padding: 1px 5px; border-radius: 4px; color: #123; }
.pt-pin span { display: block; font-size: 38px; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); }
.pt-pin.st-new span { animation: amb-bounce 1s infinite; }
@keyframes amb-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(198,40,40,.55); } 70% { box-shadow: 0 0 0 14px rgba(198,40,40,0); } }
@keyframes amb-bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* tracking */
.amb-status { margin-top: .8rem; }
.amb-headline { font-size: 1.35rem; margin: 0 0 .6rem; }
.amb-headline.cancelled { color: var(--amb-red); } .amb-headline.completed, .amb-headline.arrived { color: var(--amb-green); }
.amb-steps { list-style: none; padding: 0; margin: .4rem 0 .8rem; display: grid; grid-template-columns: repeat(6, 1fr); gap: .3rem; }
.amb-steps li { display: grid; justify-items: center; gap: .2rem; text-align: center; font-size: .78rem; color: var(--muted, #667); }
.amb-steps li span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--paper, #f3f6f9); border: 2px solid var(--line, #dde); }
.amb-steps li.done span { background: var(--amb-green); border-color: var(--amb-green); color: #fff; }
.amb-steps li.now span { background: var(--amb-red); border-color: var(--amb-red); color: #fff; } .amb-steps li.now { color: inherit; font-weight: 700; }
.amb-driver { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; padding: .7rem .9rem; border-radius: 10px; background: var(--paper, #f3f6f9); margin-bottom: .6rem; }
.amb-call { min-height: 48px; font-size: 1.05rem; }

/* desk */
.amb-desk-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.amb-desk-head h1 { margin: 0; }
.amb-desk { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 1rem; align-items: start; }
.amb-side { display: grid; gap: .8rem; max-height: calc(100vh - 170px); overflow-y: auto; }
.amb-side .panel { margin: 0; } .amb-side h2 { margin: 0 0 .5rem; font-size: 1.1rem; display: flex; align-items: center; gap: .4rem; }
.amb-count { background: var(--amb-red); color: #fff; border-radius: 99px; font-size: .8rem; padding: .05rem .5rem; }
.amb-req { border: 1px solid var(--line, #dde); border-left: 5px solid #9aa5b1; border-radius: 8px; padding: .55rem .7rem; margin-bottom: .5rem; display: grid; gap: .25rem; }
.amb-req.st-new { border-left-color: var(--amb-red); background: #fff6f6; }
.amb-req.st-assigned, .amb-req.st-on_the_way { border-left-color: var(--amb-amber); }
.amb-req.st-arrived, .amb-req.st-to_hospital { border-left-color: #1565c0; }
.amb-req.st-completed { border-left-color: var(--amb-green); opacity: .75; } .amb-req.st-cancelled { opacity: .6; }
.amb-req header { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; } .amb-req header .tag { margin-left: auto; }
.amb-req p { margin: 0; } .amb-req footer { flex-wrap: wrap; }
.amb-fleet { display: flex; align-items: center; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--line, #eee); }
.amb-fleet > div { flex: 1; min-width: 0; } .amb-fleet.off { opacity: .5; }
.amb-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: #9aa5b1; }
.amb-dot.free { background: var(--amb-green); } .amb-dot.busy { background: var(--amb-red); }
.amb-choices { display: grid; gap: .4rem; max-height: 46vh; overflow-y: auto; }
.amb-choice { display: flex; gap: .6rem; align-items: flex-start; padding: .55rem .7rem; border: 1px solid var(--line, #dde); border-radius: 8px; cursor: pointer; }
.amb-choice:has(input:checked) { border-color: var(--ink, #123a5a); box-shadow: 0 0 0 2px rgba(18,58,90,.15); }
.amb-choice.busy { opacity: .5; cursor: not-allowed; }
.amb-choice input { margin-top: .3rem; width: 18px; height: 18px; }

/* driver */
.amb-login { max-width: 420px; margin: 1rem auto; display: grid; gap: .7rem; }
.amb-login label { display: grid; gap: .25rem; } .amb-login input { min-height: 50px; font-size: 1.1rem; }
.page-driver .wrap { max-width: 640px; }
.drv-top { display: flex; justify-content: space-between; align-items: center; gap: .8rem; }
.drv-online { display: inline-flex; align-items: center; gap: .5rem; padding: .7rem 1.1rem; min-height: 52px; border-radius: 99px; font: 700 1rem sans-serif;
  border: 2px solid #9aa5b1; background: #fff; color: #333; cursor: pointer; }
.drv-online .dot { width: 14px; height: 14px; border-radius: 50%; background: #9aa5b1; }
.drv-online.on { background: var(--amb-green); border-color: var(--amb-green); color: #fff; } .drv-online.on .dot { background: #fff; animation: amb-pulse 1.6s infinite; }
.drv-gps { margin: .2rem .2rem .7rem; color: var(--muted, #667); } .drv-gps.ok { color: var(--amb-green); } .drv-gps.bad { color: var(--amb-red); font-weight: 600; }
.drv-job { border: 2px solid var(--amb-amber); display: grid; gap: .45rem; } .drv-job h2, .drv-job p { margin: 0; }
.drv-job.st-on_the_way { border-color: var(--amb-red); } .drv-job.st-arrived, .drv-job.st-to_hospital { border-color: #1565c0; }
.drv-stage { font-weight: 800; text-transform: uppercase; letter-spacing: .05em; font-size: .8rem; color: var(--amb-red); }
.drv-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; } .drv-actions .btn { min-height: 52px; display: grid; place-items: center; text-align: center; }
.drv-next { min-height: 64px; font-size: 1.2rem !important; font-weight: 800; background: var(--amb-green) !important; border-color: var(--amb-green) !important; color: #fff !important; }
.center { text-align: center; }

@media (max-width: 900px) {
  .amb-desk { grid-template-columns: 1fr; } .amb-map-desk { height: 50vh; min-height: 300px; } .amb-side { max-height: none; }
}
@media (max-width: 600px) {
  .amb-grid { grid-template-columns: 1fr; } .amb-map { height: 280px; } .amb-map-big { height: 52vh; }
  .amb-steps { grid-template-columns: repeat(3, 1fr); row-gap: .6rem; } .drv-actions { grid-template-columns: 1fr; }
}

/* lost-link help */
.amb-find summary { cursor: pointer; padding: .2rem 0; list-style-position: inside; }
.amb-find[open] summary { margin-bottom: .6rem; }
.amb-find .err:empty { display: none; }
.amb-keep { border-top: 1px dashed var(--line, #dde); margin-top: .6rem; padding-top: .6rem; }
.amb-keep p { margin: 0 0 .5rem; }

.amb-search { display: flex; gap: .5rem; margin: .5rem 0 .2rem; } .amb-search input { flex: 1; min-width: 0; }
.amb-hits { list-style: none; margin: 0 0 .6rem; padding: .3rem; border: 1px solid var(--line, #dde); border-radius: 10px; background: var(--surface, #fff); }
.amb-hits button { width: 100%; text-align: left; font: inherit; padding: .55rem .6rem; border: 0; background: none; cursor: pointer; border-radius: 8px; color: inherit; }
.amb-hits button:hover { background: var(--paper, #f3f6f9); } .amb-hits li.muted { padding: .5rem .6rem; }
