/* MobilePublicSafety (web) - same look as the in-car MPS in pd_core / fd_core, as a full browser page */
:root { font-family: 'Segoe UI', Tahoma, Arial, sans-serif; }
.mps {
    /* light (default) */
    --frame: #e8ecf2; --bar: linear-gradient(#2c62c9, #1b438f); --bar-line: #12306a;
    --surface: #ffffff; --surface-2: #f3f5f9; --surface-3: #e4e9f1; --line: #c6cfdc;
    --text: #18202e; --muted: #5c6678; --head: #1d3f86; --value: #0b3aa0;
    --row-hover: #fff6d6; --row-mine: #e3f4e4; --status: #0b0f18; --ind: #dfe5ee;
}
.mps.dark {
    /* MPS night scheme: deep navy panels with bright green data text */
    --frame: #030a1d; --bar: linear-gradient(#0f2559, #091a43); --bar-line: #020814;
    --surface: #061332; --surface-2: #04102b; --surface-3: #0a1b45; --line: #16316e;
    --text: #3ff08a; --muted: #6f8fcb; --head: #5cf7a0; --value: #3ff08a;
    --row-hover: #0e2358; --row-mine: #08321f; --status: #02060f; --ind: #061230;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; background: #000; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- window (fills the browser) ---------- */
.mps { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--frame); color: var(--text); min-width: 980px; }
.mps-title { height: 28px; flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 0 0 0 8px; background: #f0f0f0; border-bottom: 1px solid #c8c8c8;
             font-size: 12px; color: #111; }
.mps.dark .mps-title { background: #071433; color: #b9c8ea; border-bottom-color: #020814; }
.app-ico { width: 16px; height: 16px; border-radius: 2px; background: linear-gradient(135deg, #e0622f, #9c2b12); box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); display: inline-block; flex-shrink: 0; }
.mps-logo { width: 19px; height: 16px; background: var(--dept-logo, url(img/opp.webp)) center / contain no-repeat; display: inline-block; flex-shrink: 0; }
.mps.fire .mps-logo { background-image: var(--dept-logo, url(img/fire.svg)); }
.mps-logo.big { width: 66px; height: 56px; }
.theme-btn { height: 20px; padding: 0 8px; font-size: 11px; font-weight: 600; border: 1px solid #a8a8a8; border-radius: 3px; background: #fff; color: #222; cursor: pointer; margin-right: 6px; font-family: inherit; }
.mps.dark .theme-btn { background: #0c1f4d; color: #3ff08a; border-color: #1f3d85; }
.title-link { color: inherit; opacity: .8; text-decoration: none; margin-right: 8px; }
.title-link:hover { text-decoration: underline; opacity: 1; }
.link-pill { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 9px; background: #d7f2d9; color: #1c6a22; margin-right: 8px; }
.link-pill.down { background: #ffd9d9; color: #a00000; }
.mps.dark .link-pill { background: #08321f; color: #3ff08a; }
.mps.dark .link-pill.down { background: #3a0b14; color: #ff7a7a; }

/* ---------- toolbar ---------- */
.mps-toolbar { display: flex; align-items: center; gap: 5px; padding: 5px 8px; flex-shrink: 0; background: linear-gradient(#1f3f86, #142b62); border-bottom: 1px solid #0a1838; overflow-x: auto; }
.mps.dark .mps-toolbar { background: linear-gradient(#0a1d4a, #061436); border-bottom-color: #020814; }
.mps-toolbar .gap { width: 60px; flex-shrink: 1; }
.mps-toolbar button, .tbtn {
    position: relative; border-radius: 4px; color: #e9edf5; font-weight: 600; font-size: 12px; cursor: pointer; font-family: inherit;
    border: 1px solid rgba(0,0,0,.55); text-shadow: 0 1px 1px rgba(0,0,0,.5);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18); }
.mps-toolbar button { width: 82px; height: 34px; padding: 13px 3px 2px; line-height: 1.05; white-space: nowrap; flex-shrink: 0; }
.mps-toolbar button.wide { width: 120px; }
.b, .tbtn.b { background: linear-gradient(#3657a8, #1d3577); }
.y, .tbtn.y { background: linear-gradient(#b49c55, #7f6b2f); }
.g, .tbtn.g { background: linear-gradient(#4f8148, #2d5228); }
.r, .tbtn.r { background: linear-gradient(#b63c3c, #7c1f1f); }
.fk { position: absolute; top: 1px; right: 5px; font-size: 8px; font-weight: 600; opacity: .85; padding: 0 1px 1px 10px; border-bottom: 1px solid rgba(255,255,255,.55); }
.mps-toolbar button:hover, .tbtn:hover { filter: brightness(1.15); }
.mps-toolbar button:disabled { filter: grayscale(.6) brightness(.7); cursor: default; }
.tbtn { padding: 6px 12px; font-size: 12px; }
.tbtn.big { min-width: 150px; height: 42px; font-size: 13px; font-weight: 500; line-height: 1.15; background: linear-gradient(#34519c, #182c63); }
.tbtn.big.r { background: linear-gradient(#b63c3c, #7c1f1f); }
.tbtn.big.g { background: linear-gradient(#4f8148, #2d5228); }
.tbtn.sm { padding: 4px 9px; font-size: 11px; }
.tbtn.full { width: 100%; height: 38px; font-size: 14px; margin-top: 4px; }
.tbtn:disabled { opacity: .55; cursor: default; }

.mps-main { flex: 1; min-height: 0; padding: 6px; background: var(--frame); position: relative; }
.mdt-content { height: 100%; overflow-y: auto; padding: 12px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 3px; color: var(--text); user-select: none; }
.mdt-content::-webkit-scrollbar { width: 10px; }
.mdt-content::-webkit-scrollbar-thumb { background: #7f95bf; border-radius: 5px; }

/* ---------- indicator strip + status line ---------- */
.mps-ind { display: flex; align-items: center; height: 34px; flex-shrink: 0; padding: 0 6px; background: #090b11; border-top: 1px solid #1a1f2c; font-size: 11px; color: #8a8f9c; }
.ind-group { display: flex; align-items: center; gap: 3px; }
.ind-group label { margin-right: 10px; color: #7d8291; font-size: 11px; }
.ind-group.disp { margin-left: 150px; }
.ind-group.inbox { margin-right: 24%; }
.ind { width: 80px; height: 26px; text-align: center; border-radius: 3px; padding: 1px 4px 0; line-height: 1.05; cursor: pointer;
       border: 1px solid rgba(255,255,255,.08); box-shadow: inset 0 1px 0 rgba(255,255,255,.07); }
.ind.small-ind { width: 44px; }
.ind span { display: block; font-size: 9px; }
.ind b { font-size: 9px; font-weight: 600; }
.ind.c-gold { background: linear-gradient(#5f5428, #4a411d); color: #a59a6c; }
.ind.c-red { background: linear-gradient(#6e2121, #561818); color: #c69090; }
.ind.c-blue { background: linear-gradient(#1f3672, #182a5a); color: #93a6d2; }
.ind.c-green { background: linear-gradient(#2a5528, #20421e); color: #93bc8f; }
.ind.lit { color: #fff; }
.mps-status { display: flex; align-items: center; gap: 8px; height: 24px; flex-shrink: 0; padding: 0 8px; background: #090b11; font-size: 13px; font-weight: 600; color: #e6e9f0; }
.st-unit { display: inline-block; min-width: 70px; margin-right: 12px; }
.st-dept { font-size: 10px; color: #8a8f9c; }
.st-status { font-weight: 700; }
.mps-status .sep { width: 1px; height: 14px; background: #3d5a99; margin: 0 4px; }
.mps-status .shield { color: #34d058; font-size: 12px; }
.mps-status .dim { color: #4f7fd6; font-weight: 600; }
.mps-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #34d058; }
.mps-status .dot.down { background: #e5484d; }

/* ---------- content pieces ---------- */
h2 { margin: 0 0 12px; font-size: 18px; color: var(--head); }
h3 { margin: 16px 0 6px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.subtabs { display: flex; gap: 2px; margin: -2px 0 10px; border-bottom: 1px solid var(--line); }
.subtabs button { background: transparent; border: 0; color: var(--muted); font-weight: 700; font-size: 13px; padding: 6px 12px; cursor: pointer; border-radius: 3px 3px 0 0; font-family: inherit; }
.subtabs button.on { background: var(--surface); color: var(--head); border: 1px solid var(--line); border-bottom-color: var(--surface); margin-bottom: -1px; }
.btn-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px 40px; padding: 14px 40px; justify-items: center; }
.btn-grid .tbtn.big { min-width: 140px; height: 48px; }
.bottom-bar { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 10px; padding: 6px; background: var(--surface-3); border: 1px solid var(--line); border-radius: 3px; }
.mps.dark .bottom-bar { background: #061232; }

.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

.card, .form, .table { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 3px; }
.card { padding: 12px; }
.form { padding: 14px 18px; }

input, select, textarea { background: var(--surface); color: var(--text); border: 1px solid #8c97aa; border-radius: 2px; padding: 6px 8px; font-size: 13px; font-family: inherit; outline: none; user-select: text; }
.mps.dark input, .mps.dark select, .mps.dark textarea { border-color: #1f3d85; background: #020b22; color: #3ff08a; }
.mps.dark input::placeholder, .mps.dark textarea::placeholder { color: #3d5a9a; }
input:disabled { opacity: .7; }
input:focus, select:focus, textarea:focus { border-color: var(--value); box-shadow: 0 0 0 1px var(--value); }
textarea { width: 100%; min-height: 110px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.field label { font-size: 11px; font-weight: 700; color: var(--muted); }
.field input, .field select { width: 100%; }

.btn { background: linear-gradient(#4f7fe0, #2347a6); color: #fff; border: 1px solid rgba(0,0,0,.45); border-radius: 3px; padding: 7px 12px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; }
.btn:hover { filter: brightness(1.12); }
.btn.sm { padding: 4px 8px; font-size: 11px; }
.btn:disabled { opacity: .5; cursor: default; }

.list { display: flex; flex-direction: column; gap: 4px; }
.item { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 2px; padding: 7px 10px; display: flex; align-items: center; gap: 10px; }
.item.click { cursor: pointer; }
.item.click:hover { background: var(--row-hover); }
.item.unread { border-left: 4px solid #4f7fe0; }
.item .main { flex: 1; min-width: 0; }
.item .title { font-weight: 700; }
.item .meta { color: var(--muted); font-size: 11px; margin-top: 2px; }
.empty { color: var(--muted); font-size: 12px; padding: 6px 0; }

.tag { display: inline-block; font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 2px; background: var(--surface-3); color: var(--muted); margin: 1px 3px 1px 0; }
.tag.red { background: #ffd9d9; color: #a00000; }
.tag.amber { background: #ffecc2; color: #8a5800; }
.tag.green { background: #d7f2d9; color: #1c6a22; }
.tag.blue { background: #dbe5ff; color: #0b3aa0; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 5px 12px; font-size: 13px; align-items: center; }
.kv .k { color: var(--muted); font-weight: 700; text-align: right; }
.kv .v, .val { color: var(--value); font-weight: 700; }
.link { color: var(--value); cursor: pointer; font-weight: 700; }
.link:hover { text-decoration: underline; }

.profile { display: flex; gap: 18px; align-items: flex-start; }
.mugshot { width: 120px; height: 150px; border: 1px solid var(--line); background: var(--surface-3); object-fit: cover; display: grid; place-items: center; color: var(--muted); font-size: 11px; text-align: center; flex-shrink: 0; }

/* ---------- log on / create account ---------- */
.auth { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px 0; }
.auth-card { width: 480px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 22px 26px; box-shadow: 0 10px 30px rgba(0,0,0,.15); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.auth-brand b { font-size: 18px; color: var(--head); }
.auth-h { margin: 0 0 12px; font-size: 13px; color: var(--head); }
.auth-alt { margin-top: 12px; font-size: 12px; color: var(--muted); text-align: center; }
.auth-note { margin-top: 14px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }
.auth-ok { text-align: center; padding: 10px 0; font-size: 13px; line-height: 1.5; }
.auth-ok .big { font-size: 34px; }
.ag-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.ag-pick button { padding: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 3px; font-weight: 700; cursor: pointer; font-family: inherit; }
.ag-pick button.on { background: var(--bar); color: #fff; border-color: var(--bar-line); }

/* ---------- dashboard ---------- */
.dash { display: grid; grid-template-columns: 1fr 250px; gap: 8px; height: calc(100% - 58px); min-height: 300px; }
.table { overflow: hidden; display: flex; flex-direction: column; }
.thead, .trow { display: grid; grid-template-columns: 100px 1fr 90px 120px; gap: 8px; padding: 6px 10px; align-items: center; }
.thead { background: var(--bar); color: #fff; font-size: 10px; font-weight: 600; }
.tbody { overflow-y: auto; flex: 1; }
.trow { border-bottom: 1px solid var(--line); cursor: pointer; background: var(--surface); }
.trow:nth-child(even) { background: var(--surface-2); }
.trow:hover { background: var(--row-hover); }
.trow.mine { background: var(--row-mine); }
.trow .dist { font-weight: 700; font-size: 15px; }
.trow .nat { font-weight: 800; font-size: 14px; color: var(--text); }
.trow .addr { font-weight: 700; font-size: 13px; color: var(--text); }
.trow .units { font-weight: 700; font-size: 14px; }
.attach { background: transparent; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); font-size: 13px; padding: 2px 8px; cursor: pointer; }
.attach:hover { background: #4f7fe0; color: #fff; }
.no-ev { padding: 14px; color: var(--muted); }
.p1 { color: #d01818 !important; }
.mps.dark .p1 { color: #ff7a7a !important; }
.side .box { background: var(--surface); border: 1px solid var(--line); border-radius: 3px; padding: 6px 10px 10px; margin-bottom: 8px; }
.side .box-h { color: var(--head); font-size: 13px; font-weight: 700; text-decoration: underline; margin-bottom: 4px; cursor: pointer; }
.side .sum { display: grid; grid-template-columns: auto auto auto auto; gap: 1px 8px; font-size: 13px; color: var(--muted); }
.side .sum.one { grid-template-columns: auto auto; justify-content: start; gap: 1px 14px; }
.side .sum b { color: var(--text); }
.side .row .tbtn { flex: 1; }

/* unit board (Who / F10) */
.ub { display: grid; grid-template-columns: 90px 1fr 140px 120px 1fr; gap: 8px; padding: 6px 10px; align-items: center; }
.ub.h { background: var(--bar); color: #fff; font-size: 10px; font-weight: 600; }
.ub.r { border-bottom: 1px solid var(--line); background: var(--surface); font-size: 13px; }
.ub.r:nth-child(even) { background: var(--surface-2); }
.ub .cs { font-weight: 800; font-size: 14px; }
.st { display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 2px; color: #fff; }
.st.AV { background: #2f8a4f; } .st.DP { background: #b48a1e; } .st.ER { background: #c66a14; } .st.OS { background: #c0392b; }
.st.TR { background: #7d55c7; } .st.BY { background: #5b6b80; } .st.OOS { background: #3a4656; } .st.EMG { background: #ff1f3d; }

/* ---------- event view ---------- */
.ev-head { background: var(--surface-3); color: var(--text); padding: 8px 12px; border: 1px solid var(--line); border-bottom: 0; display: flex; align-items: flex-start; gap: 12px; }
.ev-head .nat { font-weight: 800; font-size: 15px; }
.ev-head .addr { font-weight: 800; font-size: 13px; }
.ev-head .num { text-align: right; font-size: 12px; font-weight: 700; }
.ev-tabs { display: flex; gap: 2px; background: var(--surface-3); padding: 0 8px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.ev-tabs button { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-bottom: 0; padding: 4px 14px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; }
.ev-tabs button.on { background: var(--surface); }
.ev-body { background: var(--surface); color: var(--text); border: 1px solid var(--line); padding: 12px 16px; min-height: 280px; }
.ev-body .kv { grid-template-columns: 110px 1fr 90px 1fr; }
.remark { font-size: 12px; margin-bottom: 4px; user-select: text; }
.remark .t { color: var(--muted); font-weight: 700; margin-right: 6px; }
.remark.sys { color: var(--muted); font-style: italic; }
.ev-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; padding: 0 0 6px; }

/* ---------- dispatch notification box ---------- */
#dispatch-box { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); width: 560px; background: #fff; border: 1px solid #555;
                box-shadow: 0 18px 40px rgba(0,0,0,.55); z-index: 60; }
.db-title { height: 22px; background: linear-gradient(#f4f6fb, #d9dfea); display: flex; align-items: center; gap: 6px; padding: 0 6px; font-size: 11px; font-weight: 700; color: #111; }
.db-title .x { cursor: pointer; padding: 0 6px; }
.db-head { display: flex; align-items: flex-start; padding: 10px 14px; background: #e9e9e9; border-bottom: 1px solid #ccc; gap: 10px; }
.db-head .nat { font-size: 22px; font-weight: 800; color: #111; }
.db-head .time { font-size: 13px; color: #333; }
.db-btn { width: 82px; height: 44px; border: 1px solid rgba(0,0,0,.55); border-radius: 3px; color: #fff; font-weight: 700; font-size: 13px; cursor: pointer;
          background: linear-gradient(#4f8148, #2d5228); position: relative; font-family: inherit; text-shadow: 0 1px 1px rgba(0,0,0,.5); }
.db-btn small { position: absolute; top: 2px; right: 4px; font-size: 9px; opacity: .85; }
.db-btn:hover { filter: brightness(1.15); }
.db-body { padding: 10px 14px 14px; display: grid; grid-template-columns: 80px 1fr; gap: 4px 12px; font-size: 14px; }
.db-body .k { color: #777; font-weight: 700; text-align: right; }
.db-body .v { color: #0b3aa0; font-weight: 800; font-size: 16px; }
#dispatch-box.p1 .db-head { background: #ffe1e1; }
#dispatch-box.dark { background: #061332; border-color: #16316e; }
#dispatch-box.dark .db-title { background: #071433; color: #b9c8ea; border-bottom: 1px solid #020814; }
#dispatch-box.dark .db-head { background: #0a1b45; border-bottom-color: #16316e; }
#dispatch-box.dark .db-head .nat { color: #5cf7a0; }
#dispatch-box.dark .db-head .time, #dispatch-box.dark .db-body .k { color: #6f8fcb; }
#dispatch-box.dark .db-body .v { color: #3ff08a; }
#dispatch-box.dark.p1 .db-head { background: #3a0b14; }

#callouts { position: fixed; top: 70px; right: 24px; display: flex; flex-direction: column; gap: 6px; width: 320px; z-index: 55; }
.callout { background: #17346d; color: #fff; border: 1px solid #0b1d42; border-left: 5px solid #ffcf3a; padding: 7px 10px; font-size: 12px; box-shadow: 0 8px 20px rgba(0,0,0,.4); animation: slide .2s ease; cursor: pointer; }
.callout b { display: block; font-size: 13px; }
.callout.crit { border-left-color: #ff3b3b; background: #7a0000; animation: blink .6s 6; }
@keyframes blink { 50% { filter: brightness(.6); } }

#toasts { position: fixed; bottom: 70px; right: 24px; pointer-events: none; display: flex; flex-direction: column; gap: 8px; width: 340px; z-index: 70; }
.toast { background: rgba(14,19,32,.95); color: #fff; border: 1px solid #26324f; border-left: 4px solid #3d7bff; border-radius: 8px; padding: 10px 12px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: slide .2s ease; }
.toast.success { border-left-color: #30a46c; }
.toast.error { border-left-color: #e5484d; }
.toast.warn { border-left-color: #f5a524; }
@keyframes slide { from { transform: translateX(20px); opacity: 0; } }

/* ---------- live map (F4) ---------- */
.map-wrap { position: absolute; inset: 6px; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 3px; overflow: hidden; z-index: 5; }
.map-bar { display: flex; align-items: center; gap: 8px; padding: 5px 8px; background: var(--surface-3); border-bottom: 1px solid var(--line); font-size: 12px; }
.map-bar b { color: var(--head); }
.map-bar label { display: flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 700; cursor: pointer; }
.map-bar input { padding: 0; }
.map-svg { flex: 1; width: 100%; background: #0a1a2a; cursor: grab; display: block; }
.map-svg:active { cursor: grabbing; }
.map-svg text { font: 700 12px 'Segoe UI', Arial, sans-serif; fill: #fff; paint-order: stroke; stroke: #000; stroke-width: 3px; }
.map-svg .ev { cursor: pointer; }
.map-svg .ev.sel path { stroke: #fff; stroke-width: 2.5; }
.map-legend { display: flex; gap: 10px; flex-wrap: wrap; }
.map-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 3px; vertical-align: -1px; }

/* small screens: let the toolbar scroll, stack the dashboard */
@media (max-width: 1100px) {
    .ind-group.disp { margin-left: 20px; } .ind-group.inbox { margin-right: 10px; }
    .btn-grid { grid-template-columns: repeat(3, 1fr); padding: 10px; gap: 14px; }
}
