:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --line: #dbe2e8;
  --line-strong: #b7c3ce;
  --text: #18222d;
  --muted: #647384;
  --primary: #2563eb;
  --primary-soft: #e8f0ff;
  --green: #159a6a;
  --green-soft: #e4f6ef;
  --red: #d64545;
  --red-soft: #fdecec;
  --amber: #b7791f;
  --amber-soft: #fff3d6;
  --cyan: #0e7490;
  --cyan-soft: #e1f5f9;
  --violet: #6d5bd0;
  --violet-soft: #efedff;
  --shadow: 0 12px 30px rgba(16, 24, 40, 0.08);
  --radius: 8px;
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Noto Sans CJK SC",
    Arial,
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #111827;
  color: #e5edf6;
}

.brand {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  background: #1f2937;
}

.brand-mark svg,
.icon-button svg,
.nav-item svg,
.button svg,
.small-action svg,
.metric-icon svg,
.table-action svg,
.phone-tab svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.brand h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.brand p {
  margin: 4px 0 0;
  color: #9fb0c4;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
  padding: 14px 10px;
}

.nav-item {
  display: grid;
  min-height: 42px;
  grid-template-columns: 22px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 0 12px;
  border-radius: var(--radius);
  color: #cbd5e1;
  cursor: pointer;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-item .count {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #d7e3f2;
  font-size: 12px;
  text-align: center;
}

.side-footer {
  margin-top: auto;
  padding: 14px 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: #9fb0c4;
  font-size: 12px;
  line-height: 1.7;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 246, 248, 0.92);
  padding: 14px 24px;
  backdrop-filter: blur(14px);
}

.topbar h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 750;
}

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

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.breadcrumbs a:hover {
  color: var(--primary);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.content {
  display: grid;
  gap: 16px;
  padding: 18px 24px 28px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
}

.metric-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary);
}

.metric:nth-child(2) .metric-icon {
  background: var(--green-soft);
  color: var(--green);
}

.metric:nth-child(3) .metric-icon {
  background: var(--amber-soft);
  color: var(--amber);
}

.metric:nth-child(4) .metric-icon {
  background: var(--red-soft);
  color: var(--red);
}

.metric strong {
  display: block;
  font-size: 24px;
  line-height: 1.1;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.layout-two,
.layout-three,
.gis-grid,
.mobile-grid {
  display: grid;
  gap: 16px;
}

.layout-two {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.8fr);
}

.layout-three {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(280px, 0.8fr);
}

.gis-grid {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.mobile-grid {
  grid-template-columns: 390px minmax(0, 1fr);
  align-items: start;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.route-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

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

.route-card {
  display: grid;
  min-height: 118px;
  gap: 8px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
}

.route-card:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.08);
}

.route-card svg {
  width: 20px;
  height: 20px;
  color: var(--primary);
}

.route-card strong {
  font-size: 15px;
}

.route-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.entity-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 16px;
}

.entity-header h2 {
  margin: 8px 0 4px;
  font-size: 22px;
}

.entity-header p {
  margin: 0;
  color: var(--muted);
}

.panel-header {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
}

.panel-header h3,
.section-title {
  margin: 0;
  font-size: 16px;
  font-weight: 720;
}

.panel-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.panel-body {
  padding: 14px;
}

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

.field,
.search {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 0 10px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
}

.field select,
.field input,
.search input {
  min-width: 86px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.search {
  min-width: 220px;
}

.button,
.icon-button,
.small-action,
.table-action {
  display: inline-grid;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  cursor: pointer;
}

.button {
  min-height: 36px;
  grid-auto-flow: column;
  gap: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  white-space: nowrap;
}

.button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.button.success {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.button.warning {
  border-color: #f4c76d;
  background: var(--amber-soft);
  color: #7c4d0b;
}

.button.danger {
  border-color: #f2a0a0;
  background: var(--red-soft);
  color: var(--red);
}

.icon-button,
.table-action {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.small-action {
  min-height: 30px;
  grid-auto-flow: column;
  gap: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 0 9px;
  font-size: 12px;
}

.button:hover,
.icon-button:hover,
.small-action:hover,
.table-action:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.small-action:disabled,
.button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.button.primary:hover,
.button.success:hover {
  color: #fff;
  filter: brightness(0.96);
}

.tabs,
.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 3px;
}

.tab,
.segment {
  min-height: 30px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 10px;
}

.tab.active,
.segment.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: var(--surface-soft);
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: #f3f7ff;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.status,
.tag,
.project-pin,
.legend-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.fallback-icon {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  font-size: 14px;
  font-style: normal;
  line-height: 1;
}

.status {
  min-height: 24px;
  padding: 0 9px;
}

.status.done,
.status.pass,
.status.online {
  background: var(--green-soft);
  color: var(--green);
}

.status.pending,
.status.review {
  background: var(--amber-soft);
  color: var(--amber);
}

.status.active,
.status.running {
  background: var(--primary-soft);
  color: var(--primary);
}

.status.danger,
.status.reject {
  background: var(--red-soft);
  color: var(--red);
}

.tag {
  min-height: 24px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  padding: 0 8px;
}

.progress-line {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #e7edf3;
}

.progress-line span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.detail-list {
  display: grid;
  gap: 8px;
}

.detail-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
  align-items: start;
  color: var(--muted);
  font-size: 13px;
}

.detail-row strong {
  color: var(--text);
  font-weight: 650;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.instruction-box {
  min-height: 96px;
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  padding: 10px;
}

.timeline {
  position: relative;
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding-left: 18px;
}

.timeline::before {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 5px;
  width: 2px;
  background: var(--line);
  content: "";
}

.timeline-item {
  position: relative;
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
}

.timeline-item::before {
  position: absolute;
  top: 3px;
  left: -17px;
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
  content: "";
}

.timeline-item strong {
  color: var(--text);
  font-size: 13px;
}

.task-mini-list,
.audit-list,
.message-list {
  display: grid;
  gap: 10px;
}

.task-mini,
.audit-item,
.message-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

.task-mini:hover,
.audit-item:hover {
  border-color: var(--primary);
}

.task-mini {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}

.task-mini strong,
.audit-item strong,
.message-item strong {
  display: block;
  margin-bottom: 5px;
}

.task-mini p,
.audit-item p,
.message-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.chart-grid {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.donut {
  display: grid;
  width: 160px;
  height: 160px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0 72%, var(--amber) 72% 86%, var(--red) 86% 100%);
}

.donut-core {
  display: grid;
  width: 104px;
  height: 104px;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  text-align: center;
}

.donut-core strong {
  font-size: 28px;
}

.donut-core span {
  color: var(--muted);
  font-size: 12px;
}

.legend {
  display: grid;
  gap: 8px;
}

.legend-pill {
  min-height: 26px;
  width: max-content;
  gap: 7px;
  padding: 0 9px;
  background: var(--surface-soft);
  color: var(--muted);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.bar-list {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 62px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.stacked-bar {
  overflow: hidden;
  display: flex;
  height: 14px;
  border-radius: 999px;
  background: #e7edf3;
}

.stacked-bar span:first-child {
  background: var(--primary);
}

.stacked-bar span:last-child {
  background: var(--red);
}

.history-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.audit-layout {
  display: grid;
  grid-template-columns: 410px minmax(0, 1fr);
  gap: 16px;
}

.audit-item {
  cursor: pointer;
}

.audit-item.selected {
  border-color: var(--primary);
  background: #f4f8ff;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.photo {
  overflow: hidden;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.14), transparent 42%),
    repeating-linear-gradient(45deg, #eef3f8 0 10px, #f8fafc 10px 20px);
  padding: 8px;
  color: #475569;
  font-size: 12px;
}

.photo strong {
  display: block;
  margin-top: 48px;
}

.map-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #e9eef4;
}

.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 10px;
}

.map-area {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(24, 34, 45, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(24, 34, 45, 0.04) 1px, transparent 1px),
    #edf2f6;
  background-size: 42px 42px;
}

.map-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.map-route {
  fill: none;
  stroke: #2563eb;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 7;
}

.map-route.secondary {
  stroke: #0e7490;
}

.map-route.warning {
  stroke: #b7791f;
}

.map-route.track {
  stroke: #159a6a;
  stroke-dasharray: 10 10;
  stroke-width: 4;
}

.map-buffer {
  fill: rgba(37, 99, 235, 0.1);
  stroke: rgba(37, 99, 235, 0.24);
  stroke-width: 1;
}

.map-station {
  fill: #fff;
  stroke: #111827;
  stroke-width: 2;
}

.map-label {
  fill: #334155;
  font-size: 13px;
  font-weight: 700;
}

.project-marker {
  position: absolute;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 8px 16px rgba(16, 24, 40, 0.2);
}

.project-marker.track-type {
  background: var(--amber);
}

.project-marker.report-type {
  background: var(--primary);
}

.project-marker.guard-type {
  background: var(--green);
}

.project-marker.focus {
  outline: 4px solid rgba(37, 99, 235, 0.24);
}

.drone {
  position: absolute;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  border-radius: var(--radius);
  background: #111827;
  color: #fff;
  box-shadow: 0 10px 20px rgba(16, 24, 40, 0.24);
}

.drone.pulse::after {
  position: absolute;
  inset: -7px;
  border: 2px solid rgba(37, 99, 235, 0.35);
  border-radius: 12px;
  animation: pulse 1.6s infinite;
  content: "";
}

@keyframes pulse {
  0% {
    transform: scale(0.78);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

.map-popup {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: min(340px, calc(100% - 36px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 12px;
}

.map-popup h4 {
  margin: 0 0 8px;
  font-size: 15px;
}

.map-popup p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.query-panel {
  display: grid;
  gap: 12px;
}

.switch-row,
.check-row {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.switch-row input,
.check-row input {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
}

.network {
  display: grid;
  gap: 10px;
}

.network-line {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) 44px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.network-segments {
  display: grid;
  grid-auto-flow: column;
  gap: 4px;
}

.segment-cell {
  height: 14px;
  border-radius: 4px;
  background: #e2e8f0;
}

.segment-cell.done {
  background: var(--green);
}

.segment-cell.running {
  background: var(--primary);
  animation: blink 1.2s infinite;
}

.segment-cell.pending {
  background: var(--amber);
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.42;
  }
}

.phone {
  overflow: hidden;
  border: 10px solid #111827;
  border-radius: 34px;
  background: #111827;
  box-shadow: var(--shadow);
}

.phone-screen {
  overflow: hidden;
  min-height: 740px;
  border-radius: 22px;
  background: #f8fafc;
}

.phone-status {
  display: flex;
  height: 32px;
  align-items: center;
  justify-content: space-between;
  background: #0f172a;
  color: #dbeafe;
  padding: 0 14px;
  font-size: 12px;
}

.phone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 12px 14px;
}

.phone-header h3 {
  margin: 0;
  font-size: 16px;
}

.phone-content {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.phone-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--line);
  background: #fff;
}

.phone-tab {
  display: grid;
  min-height: 58px;
  place-items: center;
  gap: 2px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.phone-tab.active {
  color: var(--primary);
}

.login-box,
.mobile-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

.mobile-card h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.mobile-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.input-grid {
  display: grid;
  gap: 8px;
}

.input-grid input,
.input-grid textarea,
.input-grid select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  padding: 0 10px;
}

.input-grid textarea {
  min-height: 82px;
  padding-top: 9px;
  resize: none;
}

.date-strip,
.type-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.date-chip,
.type-chip {
  min-width: 76px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.date-chip.active,
.type-chip.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.mobile-map {
  position: relative;
  min-height: 260px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(24, 34, 45, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(24, 34, 45, 0.05) 1px, transparent 1px),
    #eef4f8;
  background-size: 28px 28px;
}

.mobile-map svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.mobile-point {
  position: absolute;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.mobile-position {
  position: absolute;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.18);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat-tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px;
  text-align: center;
}

.stat-tile strong {
  display: block;
  font-size: 22px;
}

.stat-tile span {
  color: var(--muted);
  font-size: 12px;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 20px;
  bottom: 20px;
  display: none;
  max-width: 360px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  color: var(--text);
}

.toast.show {
  display: block;
}

.mobile-page {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 420px minmax(0, 560px);
  gap: 24px;
  align-items: start;
  justify-content: center;
  padding: 24px;
}

.mobile-device {
  width: 100%;
  max-width: 410px;
}

.mobile-side {
  margin-top: 16px;
}

.loading-mask,
.modal-backdrop {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.34);
}

.loading-mask {
  z-index: 120;
  color: #fff;
  font-weight: 700;
}

.modal {
  width: min(720px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

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

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.modal-body {
  padding: 14px;
}

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

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  padding: 0 10px;
  color: var(--text);
}

.form-grid textarea {
  min-height: 92px;
  padding-top: 9px;
  resize: vertical;
}

.span-2 {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.empty-note {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 16px;
  color: var(--muted);
  text-align: center;
}

.hide {
  display: none !important;
}

@media (max-width: 1180px) {
  .metrics,
  .layout-three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .layout-two,
  .gis-grid,
  .audit-layout,
  .mobile-grid {
    grid-template-columns: 1fr;
  }

  .phone {
    max-width: 390px;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .content {
    padding: 14px;
  }

  .metrics,
  .layout-three,
  .history-controls,
  .photo-grid,
  .stat-grid,
  .route-grid,
  .route-grid.compact,
  .mobile-page {
    grid-template-columns: 1fr;
  }

  .entity-header {
    flex-direction: column;
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .map-area {
    min-height: 430px;
  }

  .search {
    width: 100%;
  }
}
