:root { --bg: #0e141b; --panel: #161f2a; --panel-2: #1d2a38; --line: #2a3742; --text: #e6edf3; --muted: #8b9bab; --accent: #14b8a6; --accent-dim: #0d9488; --red: #ef4444; --green: #22c55e; --amber: #f59e0b; --shadow: 0 2px 10px rgba(0,0,0,.45); color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; transition: border-color .15s ease, background .15s ease, box-shadow .15s ease; }
button { cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); background: #243546; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2c3b4a; border-radius: 6px; border: 2px solid var(--panel); }
::-webkit-scrollbar-thumb:hover { background: #3a4d5f; }
a { color: #5eead4; }
.muted { color: var(--muted); }
.err { color: var(--red); }
.err:empty { display: none; }
.err.good { color: var(--green); }
.ask { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 8px; border: 1px solid var(--accent); border-radius: 8px; background: #134e4a; }
.ask b { flex: 1; }
.base-pin { font-size: 24px; line-height: 28px; text-align: center; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }

#login { max-width: 320px; margin: 12vh auto; display: grid; gap: 12px; padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
#login h1 { margin: 0 0 8px; font-size: 22px; color: #5eead4; }
#login label { display: grid; gap: 4px; }
#login button { background: var(--accent); border-color: var(--accent); font-weight: 600; }

#main { display: grid; grid-template: auto 1fr / 1fr 400px; height: 100vh; }
header { grid-column: 1 / -1; display: flex; gap: 16px; align-items: center; padding: 9px 16px; background: linear-gradient(180deg, #1b2735, #161f2a); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(255,255,255,.02); }
#brandLogo { height: 30px; width: auto; display: block; }
header > b { color: #5eead4; font-size: 15px; letter-spacing: .2px; }
header > b small { font-weight: 500; }
header nav { display: flex; gap: 2px; flex: 1; }
header nav button { background: none; border-color: transparent; border-radius: 999px; padding: 6px 13px; color: var(--muted); }
header nav button:hover:not(:disabled) { background: var(--panel-2); color: var(--text); }
header nav button.on { background: var(--accent); border-color: var(--accent); color: #04201d; font-weight: 600; }
#who { font-size: 13px; color: var(--muted); }
#map { min-height: 300px; }
aside { overflow-y: auto; padding: 12px 14px; border-left: 1px solid var(--line); background: var(--panel); }
aside h3 { margin: 16px 0 6px; font-size: 13px; letter-spacing: .3px; text-transform: uppercase; color: var(--muted); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: grid; gap: 2px; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.list li.click { cursor: pointer; }
.list li.click:hover { background: #1e2a35; }
.list li small { color: var(--muted); }
.list li.cancelled b { text-decoration: line-through; color: var(--muted); }
#team li { grid-template-columns: 14px 1fr; column-gap: 8px; align-items: center; }
#team li small { grid-column: 2; }
.dot { width: 12px; height: 12px; border-radius: 50%; }
#sync { margin-top: 12px; font-size: 12px; }

table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
th, td { text-align: left; padding: 5px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
td select { max-width: 150px; }
td small { color: var(--muted); }
tr.off td { color: var(--muted); }
#mTotals p { margin: 6px 0; }

.ptt { display: grid; place-items: center; width: 100%; height: 110px; margin: 8px 0; border-radius: 14px; font-size: 20px; font-weight: 700;
  background: #1e3a36; border: 2px solid var(--accent); user-select: none; touch-action: none; }
.ptt small { font-size: 12px; font-weight: 400; color: var(--muted); }
.ptt.on { background: var(--red); border-color: #fca5a5; }
#people li { grid-template-columns: 1fr auto; align-items: center; }
#people .row { margin: 0; }
#people button { font-size: 12px; padding: 3px 8px; }

#feeds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.feed { position: relative; background: #000; border-radius: 8px; overflow: hidden; cursor: zoom-in; aspect-ratio: 16 / 10; }
.feed video { width: 100%; height: 100%; object-fit: contain; }
.feed span { position: absolute; left: 6px; bottom: 6px; padding: 1px 6px; border-radius: 4px; background: rgba(0, 0, 0, .65); font-size: 12px; }
.feed.big { position: fixed; inset: 5vh 5vw; z-index: 2000; cursor: zoom-out; aspect-ratio: auto; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .8); }
.feed-freeze { position: absolute; inset: 0; z-index: 1; display: none; }
.feed-canvas { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.feed-tools { position: absolute; left: 6px; top: 6px; z-index: 3; display: none; gap: 4px; flex-wrap: wrap; align-items: center; max-width: 80%; background: rgba(15,20,25,.78); padding: 5px; border-radius: 9px; cursor: default; }
.feed.big .feed-tools { display: flex; }
.ft { width: 30px; height: 30px; padding: 0; font-size: 15px; line-height: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 7px; color: var(--text); }
.ft:hover { border-color: var(--accent); }
.ft.on { background: var(--accent); border-color: var(--accent); color: #04201d; }
.ft.sw { width: 22px; height: 22px; border-radius: 50%; }
.ft.sw.on { outline: 2px solid #fff; outline-offset: 1px; }

#uAdd { display: grid; gap: 8px; }
#uAdd h3 { margin: 0; }
.check { display: flex; gap: 6px; align-items: center; }

#ver { position: fixed; right: 8px; bottom: 4px; font-size: 11px; color: var(--muted); z-index: 1000; pointer-events: none; }
.leaflet-tooltip { background: rgba(15, 20, 25, .85); color: #fff; border: none; font-weight: 600; }
.leaflet-tooltip-right::before { border-right-color: rgba(15, 20, 25, .85); }

@media (max-width: 800px) {
  #main { grid-template: auto 45vh 1fr / 1fr; }
  aside { border-left: none; border-top: 1px solid var(--line); }
  header { flex-wrap: wrap; gap: 8px; }
}

/* the public install page (apps.html) */
body.page { height: auto; }
.install { max-width: 560px; margin: 0 auto; padding: 24px 16px 48px; display: grid; gap: 14px; }
.install h1 { margin: 0; color: #5eead4; }
.install h2 { margin: 0 0 8px; font-size: 17px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 8px; }
.card p, .card ol { margin: 0; }
.card.ok { border-color: var(--accent); }
a.big { display: block; text-align: center; padding: 14px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 700; text-decoration: none; font-size: 17px; }
.small { font-size: 11px; color: var(--muted); word-break: break-all; }
.search { width: 240px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 4px; box-shadow: 0 1px 4px rgba(0,0,0,0.4); }
.search input { width: 100%; box-sizing: border-box; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; font: inherit; }
.search .results { list-style: none; margin: 4px 0 0; padding: 0; max-height: 220px; overflow: auto; }
.search .results li { padding: 6px 9px; border-top: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.search .results li:first-child { border-top: 0; }
.search .results li:hover { background: #1e2a35; }
.search .results li.muted { cursor: default; }
.map-btn { width: 34px; height: 34px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); cursor: pointer; font-size: 17px; line-height: 1; transition: background .15s ease, border-color .15s ease; }
.map-btn:hover { background: var(--panel-2); border-color: var(--accent); }
.map-btn.on { background: var(--accent); border-color: var(--accent); }
.cam-pin { font-size: 18px; line-height: 26px; text-align: center; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.cam-pop { display: grid; gap: 6px; }
.cam-img { width: 100%; border-radius: 8px; background: #000; min-height: 140px; display: block; cursor: zoom-in; }
.cam-lightbox { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,.93); display: grid; place-items: center; cursor: zoom-out; padding: 20px; }
.cam-lightbox-img { max-width: 96vw; max-height: 90vh; border-radius: 8px; box-shadow: 0 12px 48px rgba(0,0,0,.7); }
.cam-lightbox-cap { position: fixed; left: 0; right: 0; bottom: 18px; text-align: center; color: #fff; font-size: 14px; }

/* ---- dark-theme the vendored Leaflet controls so they match the UI ---- */
.leaflet-bar, .leaflet-control-layers { border: 1px solid var(--line) !important; border-radius: 8px !important; box-shadow: var(--shadow) !important; overflow: hidden; }
.leaflet-bar a, .leaflet-bar a:hover { background: var(--panel); color: var(--text); border-bottom: 1px solid var(--line); width: 32px; height: 32px; line-height: 32px; }
.leaflet-bar a:hover { background: var(--panel-2); }
.leaflet-bar a.leaflet-disabled { background: var(--panel); color: #46586a; }
.leaflet-touch .leaflet-bar a:first-child { border-top-left-radius: 7px; border-top-right-radius: 7px; }
.leaflet-touch .leaflet-bar a:last-child { border-bottom-left-radius: 7px; border-bottom-right-radius: 7px; border-bottom: none; }
.leaflet-control-layers-toggle { background-color: var(--panel); width: 34px; height: 34px; background-size: 18px 18px; filter: invert(1) hue-rotate(180deg) brightness(1.1); }
.leaflet-control-layers-expanded { background: var(--panel) !important; color: var(--text); padding: 8px 10px !important; }
.leaflet-control-layers-expanded label { display: flex; align-items: center; gap: 6px; padding: 3px 0; cursor: pointer; }
.leaflet-control-layers-selector { accent-color: var(--accent); }
.leaflet-control-attribution { background: rgba(14,20,27,.7) !important; color: var(--muted) !important; border-radius: 6px 0 0 0; }
.leaflet-control-attribution a { color: #5eead4 !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.leaflet-popup-content-wrapper { border: 1px solid var(--line); border-radius: 10px; }
.leaflet-popup-content { margin: 10px 12px; }
.leaflet-popup-close-button { color: var(--muted) !important; }

/* ---- traffic free-tier quota bar ---- */
.quota { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); font-size: 12px; }
.quota-text { white-space: nowrap; color: var(--text); }
.quota-track { width: 120px; height: 6px; background: #0e141b; border-radius: 4px; overflow: hidden; }
.quota-fill { height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .4s ease, background .3s ease; }
.quota-fill.warm { background: var(--amber); }
.quota-fill.hot { background: var(--red); }
.quota-x { background: none; border: none; color: var(--muted); padding: 0 2px; font-size: 13px; box-shadow: none; }
.quota-x:hover { color: var(--text); background: none; border: none; }

/* ---- mileage report header ---- */
.report-head { margin: 4px 0 10px; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.report-head b { color: #5eead4; }

/* ---- a button that reads as a link ---- */
.linkish { background: none; border: none; padding: 0; color: #5eead4; cursor: pointer; font: inherit; }
.linkish:hover { background: none; border: none; text-decoration: underline; }
button.danger { color: #fca5a5; }
button.danger:hover:not(:disabled) { border-color: var(--red); background: #3b1d1d; }
.tsIn { width: 5.5em; }
.grow { flex: 1; min-width: 120px; }

/* ---- settings ---- */
.subnav { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.subnav button { background: none; border-color: transparent; border-radius: 999px; padding: 5px 12px; color: var(--muted); }
.subnav button:hover:not(:disabled) { background: var(--panel-2); color: var(--text); }
.subnav button.on { background: var(--accent); border-color: var(--accent); color: #04201d; font-weight: 600; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.tile-val { font-size: 24px; font-weight: 700; color: #5eead4; }
.tile-label { font-size: 12px; color: var(--text); margin-top: 2px; }
.tile .muted { font-size: 12px; }

.metric { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 10px 0; }
.metric-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.metric-title { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.metric-top b { font-size: 17px; }
.metric-sub { font-size: 12px; margin: 2px 0 6px; }
.spark { display: block; width: 100%; height: 40px; }

#usageTable td b { font-weight: 600; }

.fb { display: grid; gap: 6px; border-left: 3px solid var(--accent); padding: 10px 6px 10px 10px; }
.fb.done { border-left-color: #3a4d5f; opacity: .72; }
.fb-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fb-text { margin: 0; white-space: pre-wrap; }
.badge { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; padding: 1px 8px; border-radius: 999px; }
.badge.open { background: #134e4a; color: #5eead4; }
.badge.done { background: #26323f; color: var(--muted); }
.badge.manual { background: #4a3a13; color: #fcd34d; }
.badge.auto { background: #26323f; color: var(--muted); }
#mTable td .badge { display: inline-block; margin-top: 2px; }
#mTable td.row { gap: 4px; }
#mTable td.row button { font-size: 12px; padding: 3px 8px; }

/* ---- feedback dialog ---- */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; width: min(440px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,.6); }
dialog::backdrop { background: rgba(0,0,0,.55); }
dialog h3 { margin: 0 0 4px; }
#fbText { width: 100%; resize: vertical; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px; color: var(--text); }
#fbSend { background: var(--accent); border-color: var(--accent); color: #04201d; font-weight: 600; }
#feedback { background: none; border-color: var(--line); }
#feedback:hover:not(:disabled) { background: var(--panel-2); border-color: var(--accent); }
.call-pin { font-size: 20px; line-height: 26px; text-align: center; background: #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }

/* /open: the big Open TacTech link on a service call's calendar event */
a.button { display: block; text-align: center; padding: 14px; font-size: 1.15em; font-weight: 600; text-decoration: none; color: #fff; background: var(--accent); border-radius: 9px; }
