/* Control room and crew page. Same white theme, type and icons as the citizen app. */
:root {
  --bg: #ffffff; --fill: #f5f5f7; --fill-2: #ebebf0; --line: rgba(0, 0, 0, .1);
  --text: #1d1d1f; --text-2: #6e6e73; --text-3: #8e8e93;
  --red: #e0281e; --red-soft: #fdeceb; --blue: #0071e3; --blue-soft: #e8f2fd;
  --green: #1d8a44; --green-soft: #e7f6ec; --orange: #c25e00; --orange-soft: #fff3e3;
  --r-s: 10px; --r-m: 14px; --r-l: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", system-ui, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 400 15px/1.45 var(--font); letter-spacing: -.01em; -webkit-font-smoothing: antialiased; }
.muted { color: var(--text-2); }
.ic { width: 1.25em; height: 1.25em; fill: currentColor; flex: none; display: inline-block; vertical-align: -.26em; }

/* header */
.dh { height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 20px; background: var(--bg); border-bottom: .5px solid var(--line); }
.dh-brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; }
.dh-brand b { font-weight: 600; }
.dh-title { color: var(--text-2); font-weight: 400; padding-left: 10px; border-left: 1px solid var(--line); }
.logo { width: 30px; height: 30px; border-radius: 8px; display: block; }
.dh-meta { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 6px 11px; border-radius: 99px; background: var(--fill); color: var(--text-2); text-decoration: none; }
.tag.ok::before, .tag.warn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.tag.warn::before { background: var(--orange); }
.tag.link { color: var(--blue); }

/* layout */
.dwrap { display: grid; grid-template-columns: 1fr 460px; height: calc(100vh - 56px); }
.dmap { height: 100%; background: var(--fill); }
body.picking .dmap { cursor: crosshair; outline: 3px solid var(--blue); outline-offset: -3px; }
.dpanel { background: var(--bg); border-left: .5px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.dtabs { display: flex; overflow-x: auto; padding: 3px; margin: 16px 20px 0; background: var(--fill); border-radius: 12px; }
.dtabs button { flex: 1; min-height: 36px; background: none; border: 0; border-radius: 9px; font: 500 14px var(--font); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.dtabs button.on { background: var(--bg); font-weight: 600; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.count { background: var(--red); color: #fff; border-radius: 99px; padding: 1px 7px; font-size: 12px; font-weight: 600; }
.dbody { overflow-y: auto; padding: 20px 20px 48px; flex: 1; }
.empty { color: var(--text-2); text-align: center; padding: 48px 0; }
h2 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin: 0; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--text-2); margin: 24px 0 8px; }
.dbody > div > h3:first-child, .queue h3 { margin-top: 0; }

/* queue */
.queue { display: flex; flex-direction: column; gap: 8px; }
.qrow { display: flex; gap: 14px; align-items: center; text-align: left; width: 100%; padding: 12px 14px; border-radius: var(--r-m); border: 2px solid transparent; background: var(--fill); color: var(--text); font: inherit; cursor: pointer; }
.qrow:hover { background: var(--fill-2); }
.qrow.sel { border-color: var(--blue); background: var(--blue-soft); }
.qrow.closed { opacity: .55; }
.qmain { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.qmain b { font-weight: 600; }
.qmain small { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score { min-width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 17px; font-variant-numeric: tabular-nums; }
.score.hi { background: var(--red); } .score.mid { background: #e08a00; } .score.lo { background: var(--text-3); } .score.done { background: var(--green); }
.score.big { display: inline-grid; min-width: 44px; height: 32px; border-radius: 9px; font-size: 16px; }
.st { font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 99px; background: var(--bg); text-transform: capitalize; }
.st.received { color: var(--red); } .st.dispatched { color: var(--blue); } .st.rescued { color: var(--green); } .st.cancelled { color: var(--text-2); }

/* detail */
.detail { border: .5px solid var(--line); border-radius: var(--r-l); padding: 20px; margin-bottom: 24px; background: var(--bg); box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06); }
.drow { display: flex; justify-content: space-between; align-items: center; }
.x { width: 32px; height: 32px; border-radius: 50%; background: var(--fill); border: 0; cursor: pointer; color: var(--text-2); display: grid; place-items: center; }
.ai-box { background: var(--blue-soft); border-radius: var(--r-m); padding: 12px 14px; margin: 16px 0; line-height: 1.4; }
.flag { margin-top: 6px; color: var(--red); font-weight: 600; }
.link { background: none; border: 0; color: var(--blue); cursor: pointer; font: inherit; padding: 0 4px; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.kv { display: flex; flex-direction: column; background: var(--fill); border-radius: var(--r-m); padding: 4px 14px; }
.kvrow { display: grid; grid-template-columns: 130px 1fr; gap: 12px; font-size: 14px; padding: 9px 0; }
.kvrow + .kvrow { border-top: .5px solid var(--line); }
.kvrow span { color: var(--text-2); }
.kvrow b { font-weight: 500; }
.kv > p { margin: 9px 0; }
.parts { list-style: none; padding: 4px 14px; margin: 0; background: var(--fill); border-radius: var(--r-m); }
.parts li { display: flex; justify-content: space-between; padding: 9px 0; font-size: 14px; }
.parts li + li { border-top: .5px solid var(--line); }
.parts b { color: var(--red); font-variant-numeric: tabular-nums; }
.actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 20px; }
.btn { font: 600 14px/1.2 var(--font); min-height: 42px; padding: 10px 14px; border-radius: 12px; border: 0; background: var(--fill); color: var(--text); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.btn:hover { background: var(--fill-2); }
.btn.received.on { background: var(--red); color: #fff; } .btn.dispatched.on { background: var(--blue); color: #fff; }
.btn.rescued.on { background: var(--green); color: #fff; } .btn.cancelled.on { background: var(--text); color: #fff; }
.btn.primary { background: var(--red); color: #fff; }
.btn.heli { width: 100%; margin-top: 8px; background: var(--blue-soft); color: var(--blue); }
.chatlog { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.cm { padding: 8px 12px; border-radius: 14px; background: var(--fill); max-width: 88%; align-self: flex-start; }
.cm.user { background: var(--blue-soft); align-self: flex-end; }
.cm p { margin: 2px 0 0; } .cm small { color: var(--text-2); font-size: 12px; }

/* cards */
.cards { display: flex; flex-direction: column; gap: 8px; }
.rcard { border-radius: var(--r-m); padding: 14px; display: flex; flex-direction: column; gap: 6px; background: var(--fill); }
.rcard.hidden { opacity: .55; }
.rcard b { font-weight: 600; text-transform: capitalize; }
.rcard small { color: var(--text-2); font-size: 13px; }
.rcard p { margin: 2px 0; }
.rcard img { max-width: 100%; max-height: 180px; object-fit: cover; border-radius: var(--r-s); }
.rcard .btn { background: var(--bg); align-self: flex-start; }
.rcard.signal_now { box-shadow: inset 0 0 0 2px var(--red); } .rcard.approaching { box-shadow: inset 0 0 0 2px var(--orange); }
.verdict { font-size: 13px; padding: 8px 10px; border-radius: var(--r-s); }
.verdict.matches { background: var(--green-soft); } .verdict.no_match { background: var(--red-soft); } .verdict.unclear { background: var(--orange-soft); }
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; color: var(--text-2); }
.form label span { color: var(--text); font-weight: 400; font-size: 15px; }
input, select, textarea { font: 400 15px var(--font); color: var(--text); background: var(--fill); border: 0; border-radius: 12px; padding: 11px 12px; min-height: 42px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(0, 113, 227, .45); outline-offset: 2px; }

/* map pins */
.dpin { background: #fff; border-radius: 50%; display: grid !important; place-items: center; color: var(--orange); box-shadow: 0 2px 8px rgba(0, 0, 0, .28); font: 700 13px var(--font); }
.dpin .ic { width: 18px; height: 18px; vertical-align: 0; }
.dpin.sos { color: #fff; border: 2.5px solid #fff; }
.dpin.sos.hi { background: var(--red); } .dpin.sos.mid { background: #e08a00; } .dpin.sos.lo { background: var(--text-3); } .dpin.sos.done { background: var(--green); }
.dpin.sel { box-shadow: 0 0 0 4px var(--blue), 0 2px 8px rgba(0, 0, 0, .28); }
.dpin.unit { background: var(--blue); color: #fff; }
.dpin.camp { color: var(--green); }
.dpin.centre { color: var(--red); }
.leaflet-container { font-family: var(--font); }
@media (max-width: 900px) { .dwrap { grid-template-columns: 1fr; grid-template-rows: 45vh 1fr; height: auto; } .dpanel { border-left: 0; } .dmap { height: 45vh; } }

/* crew page */
body.crew { background: var(--bg); }
body.crew .dh { position: sticky; top: 0; z-index: 2; }
.crew-main { max-width: 560px; margin: 0 auto; padding: 24px 20px 48px; }
.crew-main h2 { margin: 32px 0 12px; }
.ccard { background: var(--fill); border-radius: var(--r-l); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.ccard label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; color: var(--text-2); }
.ccard input, .ccard select { background: var(--bg); font-size: 17px; min-height: 48px; }
.ccard .btn { min-height: 52px; font-size: 16px; border-radius: var(--r-m); background: var(--bg); }
.ccard p { margin: 0; font-size: 14px; }
.btn.go { background: var(--blue) !important; color: #fff; }
.btn.stop { background: var(--red) !important; color: #fff; }
.err { color: var(--red); font-weight: 600; }
.lvl { color: var(--red) !important; font-weight: 600; }

/* Softer map colours so pins stand out */
.soft-tiles { filter: saturate(.3) brightness(1.05) contrast(.96); }
