@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap");
:root {
  color-scheme: dark;
  --bg: #0c1015;
  --surface: #131920;
  --raised: #1b232d;
  --line: #28323f;
  --muted: #96a3b4;
  --red: #ff4e48;
  --green: #63deb4;
  --text: #edf2f8;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    14px Manrope,
    system-ui,
    sans-serif;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raised);
  color: var(--text);
  padding: 10px 15px;
  cursor: pointer;
  font-weight: 700;
}
button:hover {
  filter: brightness(1.16);
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button.danger {
  border-color: #a64249;
  background: #682a31;
  color: #fff;
}
button.danger:hover {
  background: #85343d;
}
input,
textarea,
select {
  width: 100%;
  background: #0e141b;
  color: var(--text);
  border: 1px solid #303d4c;
  border-radius: 8px;
  padding: 11px;
  outline: none;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--red);
}
label {
  display: block;
  color: #b9c4d1;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 17px;
}
label input,
label textarea,
label select {
  margin-top: 7px;
}
h1 {
  font-size: 26px;
  letter-spacing: -0.8px;
}
h2 {
  font-size: 14px;
  margin: 0;
  font-weight: 800;
}
p {
  line-height: 1.6;
}
small,
.muted,
.hint {
  color: var(--muted);
}
.hint {
  font-size: 11px;
  margin: 7px 0 18px;
}
.primary {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  width: 100%;
  padding: 14px;
  box-shadow: 0 5px 24px #ff4e4818;
}
.ghost {
  background: transparent;
}
.wide {
  width: 100%;
  margin-top: 8px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: 1px;
}
.brand small {
  display: block;
  font-size: 8px;
  letter-spacing: 1.8px;
  margin-top: 3px;
}
.brand em {
  color: var(--red);
  font-style: normal;
  font-size: 12px;
  letter-spacing: 2px;
}
.logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--red);
  font-size: 29px;
  color: white;
}
.logo-image {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
}
.report summary { cursor: pointer; font-weight: 700; }
.report p { white-space: pre-wrap; overflow-wrap: anywhere; }
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 80% 15%, #54262344, transparent 55%), var(--bg);
}
.authbox {
  width: min(440px, 95vw);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 38px;
  border-radius: 18px;
}
.authbox h1 {
  margin-top: 36px;
}
.authbox p {
  color: var(--muted);
}
#auth-error {
  color: #ff928b;
}
header {
  height: 88px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  background: var(--surface);
}
.topright {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 12px;
}
#clock {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.7px;
  padding: 6px 9px;
  background: #243038;
  border: 1px solid #37434f;
  border-radius: 5px;
  white-space: nowrap;
}
.badge.green {
  color: var(--green);
  background: #16312b;
}
.badge.red {
  color: #ff9e97;
  background: #352120;
  border-color: #5e302e;
}
nav {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px 30px;
  border-bottom: 1px solid var(--line);
}
nav button {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  font-size: 12px;
}
nav button.active {
  color: white;
  background: #252d38;
  border-color: #3a4553;
}
#summary {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}
.operational {
  display: grid;
  grid-template-columns: 365px minmax(0, 1fr);
  min-height: calc(100vh - 153px);
}
aside {
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 24px;
}
.section-heading,
.unit-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}
.section-heading h2 {
  font-size: 16px;
}
.twocol {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.readout {
  display: block;
  margin-top: 7px;
  padding: 13px 4px;
  color: var(--muted);
  font-size: 10px;
}
.input-action {
  display: flex;
  gap: 7px;
  align-items: center;
}
.input-action input {
  min-width: 0;
}
.input-action button {
  margin-top: 7px;
}
.recipients {
  max-height: 220px;
  overflow: auto;
  margin-bottom: 16px;
}
.recipient {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
  margin: 0;
  font-size: 12px;
}
.recipient input,
.check input {
  width: auto;
  margin: 0;
  accent-color: var(--red);
}
.recipient span {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted);
}
.operations {
  padding: 20px;
  min-width: 0;
}
.map-shell {
  position: relative;
  height: 390px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
}
#map {
  height: 100%;
  background: #19222a;
}
.map-label {
  position: absolute;
  z-index: 500;
  top: 14px;
  left: 14px;
  background: #121922eb;
  padding: 12px 16px;
  border: 1px solid #384351;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  pointer-events: none;
}
.map-label small {
  display: block;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0;
  margin-top: 5px;
}
.live-dot {
  display: inline-block;
  height: 7px;
  width: 7px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 5px;
}
.leaflet-tile-pane {
  filter: brightness(0.65) saturate(0.6);
}
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--surface);
  color: var(--text);
}
.unit-heading {
  margin: 24px 0 13px;
}
.unit-heading span {
  font-size: 11px;
  color: var(--muted);
}
.units {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}
.unit {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}
.unit .initials {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #283340;
  color: #d5dfeb;
  font-weight: 800;
  margin-right: 9px;
}
.unit-top {
  display: flex;
  align-items: center;
}
.unit-status {
  margin-top: 15px;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
}
.unit small {
  display: block;
  font-size: 10px;
  margin-top: 12px;
}
.dot {
  height: 7px;
  width: 7px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
  background: var(--green);
}
.dot.alarm,
.dot.noanswer {
  background: var(--red);
}
.dot.enroute {
  background: #ffc567;
}
.dot.intervention {
  background: #89a5ff;
}
.dot.rejected {
  background: #ff91b3;
}
.active-incidents {
  display: grid;
  gap: 10px;
}
.incident-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: 8px;
}
.incident-card .grow {
  flex: 1;
}
.incident-card h3 {
  margin: 0 0 5px;
  font-size: 13px;
}
.incident-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}
.padded {
  padding: 30px;
}
.surface {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 24px;
}
.surface h2 {
  margin: 0 0 20px;
}
.history-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
}
.history-item {
  display: block;
  text-align: left;
  width: 100%;
  margin-bottom: 10px;
  padding: 17px;
}
.history-item small {
  display: block;
  margin-top: 8px;
  font-weight: 400;
}
.history-item.selected {
  border-color: var(--red);
}
.search {
  max-width: 320px;
}
.admin-grid {
  display: grid;
  grid-template-columns: 300px minmax(260px, 1fr) minmax(260px, 1fr);
  gap: 20px;
}
.list-row {
  display: flex;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}
.list-row .grow {
  flex: 1;
}
.list-row small {
  display: block;
  margin-top: 4px;
}
.list-row button {
  font-size: 11px;
  padding: 7px 10px;
}
.report {
  padding: 16px;
  background: #1a242e;
  border-radius: 8px;
  margin-bottom: 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.report small {
  display: block;
  margin-bottom: 10px;
}
.kpp-card {
  padding: 0;
  overflow: hidden;
}
.kpp-card summary {
  padding: 16px;
}
.kpp-content {
  padding: 0 16px 16px;
  white-space: normal;
}
.kpp-section {
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}
.kpp-section h3 {
  margin: 0 0 10px;
  color: #b9c4d1;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.kpp-row {
  display: grid;
  grid-template-columns: minmax(170px, .8fr) minmax(0, 1.6fr);
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #28323f88;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.kpp-row > span {
  color: var(--muted);
  font-size: 12px;
}
.kpp-row > b {
  font-weight: 600;
}
.kpp-body-map {
  display: block;
  width: min(100%, 460px);
  height: auto;
  margin: 10px auto 14px;
  border-radius: 10px;
  background: #111820;
}
.kpp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.kpp-chip {
  display: inline-flex;
  padding: 6px 9px;
  border: 1px solid #ff4e4866;
  border-radius: 999px;
  background: #ff4e4818;
  color: #ffd7d5;
  font-size: 11px;
}
.kpp-attachment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #28323f88;
}
.kpp-attachment > div {
  min-width: 0;
  overflow-wrap: anywhere;
}
.kpp-attachment small {
  display: block;
  margin-top: 4px;
}
.kpp-attachment button {
  flex: 0 0 auto;
}
.timeline {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.timeline small {
  display: block;
  margin-top: 5px;
}
.check {
  display: flex;
  gap: 8px;
  align-items: center;
}
#toast {
  position: fixed;
  bottom: 25px;
  right: 25px;
  max-width: 480px;
  z-index: 2000;
  background: #263747;
  border: 1px solid #596d81;
  padding: 16px 24px;
  border-radius: 10px;
  box-shadow: 0 10px 50px #0008;
}
dialog {
  width: min(440px, 95vw);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
}
dialog::backdrop {
  background: #000b;
}
[hidden] {
  display: none !important;
}
.empty {
  padding: 26px;
  color: var(--muted);
  font-size: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}
#search-results button {
  display: block;
  width: 100%;
  text-align: left;
  font-size: 11px;
  margin-bottom: 6px;
}
@media (min-width: 1600px) {
  .map-shell {
    height: 480px;
  }
}
@media (max-width: 1100px) {
  .topright {
    gap: 9px;
  }
  #clock {
    display: none;
  }
  .operational {
    grid-template-columns: 320px 1fr;
  }
  .admin-grid {
    grid-template-columns: 1fr 1fr;
  }
  .history-grid {
    grid-template-columns: 280px 1fr;
  }
}
@media (max-width: 680px) {
  .kpp-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
@media (max-width: 760px) {
  header {
    padding: 14px;
    height: auto;
    gap: 14px;
    flex-wrap: wrap;
  }
  .brand {
    font-size: 19px;
  }
  .topright {
    flex-wrap: wrap;
  }
  nav {
    padding: 10px;
    overflow: auto;
  }
  nav button {
    white-space: nowrap;
  }
  #summary {
    display: none;
  }
  .operational {
    display: flex;
    flex-direction: column;
  }
  .operations {
    order: -1;
    padding: 12px;
  }
  .map-shell {
    height: 300px;
  }
  aside {
    border: 0;
  }
  .admin-grid,
  .history-grid {
    grid-template-columns: 1fr;
  }
  .padded {
    padding: 16px;
  }
  .section-heading {
    flex-wrap: wrap;
  }
  .incident-card {
    flex-wrap: wrap;
  }
}
