:root {
  --bg: #0f1218;
  --panel: #171c24;
  --panel-2: #1d2430;
  --border: #2b3645;
  --text: #eef3fb;
  --muted: #9eacc0;
  --accent: #4c8dff;
  --good: #68d391;
  --bad: #fc8181;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: Arial, sans-serif; }
body { min-height: 100vh; }
.wrap { max-width: 1700px; margin: 0 auto; padding: 18px; }
.topbar { display:flex; justify-content:space-between; align-items:flex-start; gap:14px; margin-bottom:16px; }
h1 { margin:0 0 4px; font-size: 28px; }
.muted { color: var(--muted); font-size: 13px; }
.top-actions { display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-end; }
.base-input, input, select, button { border-radius: 10px; border: 1px solid var(--border); }
.base-input, input, select { background:#0d1117; color:var(--text); padding:10px 12px; }
.base-input { min-width: 260px; }
button { background: var(--accent); color: white; padding: 10px 14px; cursor: pointer; }
button:hover { filter: brightness(1.06); }
.ghost-btn { background: transparent; border: 1px solid var(--border); }
.panel { background: linear-gradient(180deg, var(--panel), var(--panel-2)); border:1px solid var(--border); border-radius:16px; padding:14px; }
.panel-title { font-weight:700; margin-bottom:10px; }
.status-grid { display:grid; grid-template-columns: 1.6fr 0.7fr 1fr; gap:14px; margin-bottom:14px; }
.stat-line { display:flex; justify-content:space-between; padding:4px 0; }
.layout { display:grid; grid-template-columns: 380px 1fr; gap:14px; }
.left-col, .map-col { display:flex; flex-direction:column; gap:14px; }
.stack { display:flex; flex-direction:column; gap:10px; }
.stack label { display:flex; flex-direction:column; gap:6px; font-size:13px; color:var(--muted); }
.button-grid { display:grid; gap:10px; }
.button-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.button-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.switch-row { display:flex; gap:14px; align-items:center; flex-wrap:wrap; }
.switch-row.compact { margin-top:10px; }
.actions-wrap button { background:#233044; }
.map-panel { padding-bottom:10px; }
.map-toolbar { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:10px; }
.pill { display:inline-flex; align-items:center; gap:6px; padding:6px 10px; border-radius:999px; background:#111721; border:1px solid var(--border); color:var(--muted); font-size:12px; }
.dot { display:inline-block; width:10px; height:10px; border-radius:50%; }
.dot.rtw { background:#4299e1; }
.dot.nef { background:#ed8936; }
.dot.fw { background:#f56565; }
.dot.pol { background:#4fd1c5; }
.dot.heli { background:#ecc94b; }
.dot.incident { background:#ff4fd8; }
#map { height: 560px; border-radius: 14px; overflow: hidden; border:1px solid var(--border); }
.split-panels { display:grid; grid-template-columns: 1fr 1fr; gap:14px; }
.list-panel { min-height: 230px; }
.units-list, .patients-list, .event-log, .clients-list { display:flex; flex-direction:column; gap:8px; max-height:320px; overflow:auto; }
.card { border:1px solid var(--border); border-radius:12px; padding:10px; background:#0f141d; cursor:pointer; }
.card:hover { background:#121a24; }
.card-title { font-weight:700; margin-bottom:4px; }
.card-row { font-size:13px; color:var(--muted); }
.event-item { border-left:3px solid var(--accent); padding:8px 10px; background:#101720; border-radius:8px; font-size:12px; }
.event-item strong { display:block; color: var(--text); margin-bottom:4px; }
pre { margin:0; padding:12px; background:#0b1016; border:1px solid var(--border); border-radius:12px; color:#d9e3f0; max-height:240px; overflow:auto; white-space:pre-wrap; }
.leaflet-popup-content-wrapper,.leaflet-popup-tip { background:#101621; color:#fff; }
.ok { color: var(--good); }
.bad { color: var(--bad); }
@media (max-width: 1200px) {
  .layout { grid-template-columns: 1fr; }
  .status-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .split-panels { grid-template-columns: 1fr; }
  .button-grid.four, .button-grid.two { grid-template-columns: 1fr 1fr; }
  #map { height: 420px; }
  .topbar { flex-direction:column; }
}


.server-ip-display {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #2d5a38;
  background: rgba(28, 64, 40, 0.55);
  color: #b8f5c8;
  font-weight: 700;
  font-size: 14px;
}


.top-actions-nav { align-items:center; }

.nav-btn {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 14px;
  border-radius:10px;
  background:#233044;
  color:#fff;
  text-decoration:none;
  border:1px solid var(--border);
  font-weight:700;
}
.nav-btn:hover { filter: brightness(1.06); }
.nav-btn-danger { background:#b83232; }
.nav-btn-danger:hover { filter: brightness(1.08); }

/* Homepage iframe should show only the map */
html.embed-maponly, body.embed-maponly {
  background: transparent !important;
}
body.embed-maponly .wrap {
  max-width: none;
  margin: 0;
  padding: 0;
}
body.embed-maponly .topbar,
body.embed-maponly .status-grid,
body.embed-maponly .left-col,
body.embed-maponly .split-panels,
body.embed-maponly .list-panel,
body.embed-maponly .panel-title,
body.embed-maponly .map-toolbar,
body.embed-maponly pre#log {
  display: none !important;
}
body.embed-maponly .layout {
  display: block !important;
  grid-template-columns: none !important;
  gap: 0 !important;
}
body.embed-maponly .map-col,
body.embed-maponly .map-panel {
  display: block !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
body.embed-maponly #map {
  height: 100vh !important;
  min-height: 460px;
  border: 0 !important;
  border-radius: 0 !important;
}
