label {
  display: grid;
  gap: 7px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #101316;
  color: var(--text);
  min-height: 39px;
  padding: 9px 11px;
  outline: none;
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    box-shadow 140ms ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #46515c;
  background: #12171a;
}

input::placeholder,
textarea::placeholder {
  color: #77838f;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(78, 161, 255, 0.17);
  background: #101519;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(114, 182, 255, 0.48);
  outline-offset: 2px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.form-section {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.024);
}

.form-section legend {
  padding: 0 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.form-grid > .span-two,
.form-grid > .span-three {
  grid-column: 1 / -1;
}

.source-panel[hidden],
.command-panel[hidden] {
  display: none !important;
}

.source-panel {
  border: 0;
  margin: 0;
  padding: 0;
}

.command-panel {
  border: 1px solid rgba(255, 101, 101, 0.32);
  border-radius: var(--radius);
  margin: 0;
  padding: 12px;
  background: rgba(255, 101, 101, 0.06);
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  min-height: 36px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

.checkbox-grid .checkbox-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
}

.checkbox-grid .checkbox-row input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
}

.marker-grid .empty-state {
  grid-column: 1 / -1;
}

.primary-button,
.secondary-button,
.danger-button,
.command-button,
.icon-button,
.mini-button {
  border: 1px solid transparent;
  border-radius: 7px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
}

.primary-button {
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  color: #06111d;
  font-weight: 800;
  padding: 0 16px;
  box-shadow: 0 6px 16px rgba(78, 161, 255, 0.18);
}

.secondary-button {
  background: var(--surface-2);
  border-color: var(--line);
  padding: 0 14px;
}

.danger-button {
  background: linear-gradient(180deg, rgba(255, 118, 118, 0.22), rgba(255, 101, 101, 0.14));
  border-color: rgba(255, 101, 101, 0.45);
  color: #ffb4b4;
  padding: 0 14px;
}

.command-button {
  background: linear-gradient(180deg, #272e35, #1b2025);
  border-color: var(--line);
  padding: 0 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.14);
}

.icon-button {
  width: 38px;
  background: var(--surface-2);
  border-color: var(--line);
  padding: 0;
}

.mini-button {
  min-height: 30px;
  padding: 0 9px;
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line-soft);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.mini-button.danger-mini {
  color: #ffb4b4;
  background: rgba(255, 101, 101, 0.13);
  border-color: rgba(255, 101, 101, 0.36);
}

.mini-button.danger-mini:hover {
  background: rgba(255, 101, 101, 0.22);
}

.mini-button:disabled,
.danger-button:disabled,
.primary-button:disabled,
.secondary-button:disabled,
.command-button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  filter: none;
}

.primary-button:not(:disabled):hover,
.command-button:not(:disabled):hover,
.icon-button:not(:disabled):hover,
.secondary-button:not(:disabled):hover,
.mini-button:not(:disabled):hover {
  filter: brightness(1.08);
}

.primary-button:not(:disabled):active,
.command-button:not(:disabled):active,
.icon-button:not(:disabled):active,
.secondary-button:not(:disabled):active,
.mini-button:not(:disabled):active,
.danger-button:not(:disabled):active {
  transform: translateY(1px);
}

.danger-button:not(:disabled):hover {
  background: rgba(255, 101, 101, 0.24);
}

.icon-button svg,
.command-button svg,
.mini-button svg {
  width: 16px;
  height: 16px;
}

.badge,
.status-chip,
.priority-chip,
.service-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.priority-chip.immediate,
.priority-chip.category-1,
.priority-chip.emergency,
.priority-chip.high,
.priority-chip.critical,
.priority-chip.mayday {
  color: #ffe1e1;
  background: rgba(255, 101, 101, 0.18);
  border-color: rgba(255, 101, 101, 0.42);
}

.priority-chip.prompt,
.priority-chip.category-2,
.priority-chip.urgent,
.priority-chip.pan-pan {
  color: #ffe8bc;
  background: rgba(240, 184, 79, 0.15);
  border-color: rgba(240, 184, 79, 0.38);
}

.priority-chip.routine,
.priority-chip.category-3,
.priority-chip.category-4 {
  color: #cce9ff;
  background: rgba(106, 182, 255, 0.13);
  border-color: rgba(106, 182, 255, 0.34);
}

.status-chip.available,
.status-chip.state-1,
.status-chip.state-2,
.status-chip.mobile {
  color: #c7ffe9;
  background: rgba(48, 196, 141, 0.15);
  border-color: rgba(48, 196, 141, 0.36);
}

.status-chip.enroute,
.status-chip.en-route,
.status-chip.state-5,
.status-chip.responding,
.status-chip.proceeding,
.status-chip.returning {
  color: #d5ecff;
  background: rgba(106, 182, 255, 0.14);
  border-color: rgba(106, 182, 255, 0.34);
}

.status-chip.scene,
.status-chip.on-scene,
.status-chip.in-attendance,
.status-chip.state-6,
.status-chip.on-scene {
  color: #eee1ff;
  background: rgba(172, 140, 255, 0.16);
  border-color: rgba(172, 140, 255, 0.36);
}

.status-chip.tasked,
.status-chip.traffic-management,
.status-chip.recovering {
  color: #ffe8bc;
  background: rgba(240, 184, 79, 0.15);
  border-color: rgba(240, 184, 79, 0.38);
}

.status-chip.holding,
.status-chip.standby {
  color: #f1e5ff;
  background: rgba(172, 140, 255, 0.14);
  border-color: rgba(172, 140, 255, 0.32);
}

.status-chip.unavailable,
.status-chip.state-3,
.status-chip.state-9 {
  color: #ffc8c8;
  background: rgba(255, 101, 101, 0.13);
  border-color: rgba(255, 101, 101, 0.32);
}

.status-chip.closed,
.status-chip.resolved {
  color: #d6dde4;
  background: rgba(127, 139, 151, 0.13);
  border-color: rgba(127, 139, 151, 0.32);
}

.record-card,
.incident-card,
.unit-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.018)),
    var(--surface-raised);
  padding: 12px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.035) inset,
    0 10px 24px rgba(0, 0, 0, 0.14);
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    box-shadow 140ms ease;
}

.record-card:hover,
.incident-card:hover,
.unit-card:hover {
  border-color: #46515c;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.045) inset,
    0 14px 28px rgba(0, 0, 0, 0.18);
}

.record-card.is-major,
.incident-card.is-major {
  border-color: rgba(255, 101, 101, 0.72);
  box-shadow: 0 0 0 1px rgba(255, 101, 101, 0.18) inset;
}

.record-card.is-closed {
  border-color: rgba(127, 139, 151, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.012)),
    #14181b;
}

.record-card.is-closed .card-title {
  color: #d6dde4;
}

.card-topline,
.card-actions,
.unit-line,
.audit-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.inline-cluster {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.card-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-top: 10px;
}

.card-title {
  margin: 8px 0 4px;
  font-size: 15.5px;
  line-height: 1.25;
}

.card-meta,
.field-note,
.audit-meta {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.risk-list,
.resource-list,
.timeline-list,
.notes-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.risk-list li,
.resource-list li,
.timeline-list li,
.notes-list li {
  padding: 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line-soft);
}

.major-banner,
.multi-banner,
.danger-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  font-weight: 850;
  margin-bottom: 9px;
}

.major-banner {
  background: rgba(255, 101, 101, 0.16);
  border: 1px solid rgba(255, 101, 101, 0.46);
  color: #ffd5d5;
}

.danger-notice {
  display: grid;
  align-items: start;
  background: rgba(255, 101, 101, 0.14);
  border: 1px solid rgba(255, 101, 101, 0.42);
  color: #ffd5d5;
}

.danger-notice p {
  margin: 0;
  color: #ffb4b4;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.multi-banner {
  background: rgba(106, 182, 255, 0.14);
  border: 1px solid rgba(106, 182, 255, 0.36);
  color: #d5ecff;
}

.modal-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

.modal-root.has-modal {
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(2px);
}

.modal {
  position: absolute;
  inset: 4vh 50%;
  transform: translateX(-50%);
  width: min(920px, calc(100vw - 28px));
  max-height: 92vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 160px),
    #15191d;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal.wide {
  width: min(1180px, calc(100vw - 28px));
}

.modal.compact {
  width: min(560px, calc(100vw - 28px));
  inset: 8vh auto auto 50%;
  max-height: calc(100vh - 16vh);
}

.modal.compact .modal-body {
  max-height: min(560px, calc(100vh - 240px));
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
  background: rgba(10, 12, 14, 0.3);
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.modal-body {
  overflow: auto;
  padding: 16px;
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 28px));
}

.toast {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015)),
    #181c20;
  box-shadow: var(--shadow);
  padding: 12px;
}

.toast strong {
  display: block;
  margin-bottom: 4px;
}

.toast p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.warning {
  border-left-color: var(--warning);
}

.toast.info {
  border-left-color: var(--info);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  padding: 10px 9px;
  vertical-align: middle;
}

.data-table th {
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.search-hit {
  width: 100%;
  color: var(--text);
  text-align: left;
}

.admin-tabs {
  margin-bottom: 12px;
}

.admin-panel {
  display: none;
}

.admin-panel.is-active {
  display: block;
}

@media (max-width: 720px) {
  .form-grid.two,
  .form-grid.three,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    inset-top: 14px;
    max-height: calc(100vh - 28px);
  }
}
