:root {
  --app-bg: #edf4f8;
  --surface: #ffffff;
  --surface-soft: #f7fafc;
  --surface-glass: rgba(255, 255, 255, 0.9);
  --ink: #14202a;
  --muted: #607080;
  --line: #d9e3ea;
  --line-strong: #bfd0dc;
  --shadow: 0 18px 46px rgba(20, 32, 42, 0.18);
  --shadow-soft: 0 10px 28px rgba(20, 32, 42, 0.1);
  --accent: #1769e0;
  --accent-dark: #0f4fac;
  --accent-soft: #e7f0ff;
  --teal: #0f9f8f;
  --amber: #f59e0b;
  --violet: #7c3aed;
  --danger: #b42318;
  --visited: #0f9f8f;
  --pending: #b7791f;
  --revisit: #3154a3;
  --paused: #64748b;
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 10%, rgba(15, 159, 143, 0.13), transparent 28%),
    radial-gradient(circle at 88% 0%, rgba(245, 158, 11, 0.14), transparent 22%),
    var(--app-bg);
  color: var(--ink);
}

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

a {
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.app-shell {
  min-height: 100vh;
  padding: 18px 18px 88px;
}

.app-header,
.search-card,
.category-strip,
.workspace {
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 27px;
  line-height: 1.12;
}

h2 {
  font-size: 22px;
  line-height: 1.2;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.icon-button,
.ghost-button,
.primary-button,
.danger-button,
.plain-icon,
.mobile-nav-item,
.card-icon-button {
  border: 0;
}

.icon-button,
.ghost-button,
.primary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  white-space: nowrap;
  text-decoration: none;
  font-weight: 750;
}

.icon-button,
.ghost-button {
  background: #eef3f7;
  color: #2e4051;
  border: 1px solid var(--line);
}

.icon-button:hover,
.ghost-button:hover {
  background: #e4edf4;
}

.primary-button {
  background: var(--accent);
  color: white;
  box-shadow: 0 10px 22px rgba(23, 105, 224, 0.24);
}

.primary-button:hover {
  background: var(--accent-dark);
}

.danger-button {
  background: #fde8e5;
  color: var(--danger);
  border: 1px solid #f6c4bd;
}

.compact {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.search-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(191, 208, 220, 0.86);
  border-radius: 8px;
  background: var(--surface-glass);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.search-symbol {
  color: var(--muted);
  font-size: 20px;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
}

.category-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.category-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 52px;
  padding: 8px 10px;
  border: 1px solid rgba(191, 208, 220, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 6px 18px rgba(20, 32, 42, 0.06);
}

.category-chip.active {
  border-color: rgba(23, 105, 224, 0.52);
  background: #f4f8ff;
  box-shadow: 0 8px 22px rgba(23, 105, 224, 0.16);
}

.category-name {
  display: block;
  font-size: 13px;
  font-weight: 800;
}

.category-count {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.category-icon,
.pin-icon {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: white;
  font-size: 14px;
  font-weight: 900;
  flex: 0 0 auto;
  box-shadow: inset 0 -8px 18px rgba(0, 0, 0, 0.12);
}

.category-icon.type-all,
.pin-icon.type-all {
  border-radius: 999px;
}

.category-icon.type-packaging,
.pin-icon.type-packaging {
  border-radius: 8px;
}

.category-icon.type-medical,
.pin-icon.type-medical {
  border-radius: 999px;
}

.category-icon.type-equipment,
.pin-icon.type-equipment {
  border-radius: 3px;
  clip-path: polygon(30% 0, 70% 0, 70% 18%, 100% 30%, 82% 50%, 100% 70%, 70% 82%, 70% 100%, 30% 100%, 30% 82%, 0 70%, 18% 50%, 0 30%, 30% 18%);
}

.category-icon.type-dealer,
.pin-icon.type-dealer {
  border-radius: 13px 13px 6px 6px;
}

.category-icon.type-pending,
.pin-icon.type-pending {
  border-radius: 6px;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(370px, 0.78fr);
  gap: 14px;
  align-items: start;
}

.map-section,
.detail-card,
.list-card {
  border: 1px solid rgba(191, 208, 220, 0.78);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.map-section {
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.map-toolbar,
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.map-toolbar strong,
.list-head strong {
  display: block;
  font-size: 15px;
}

.map-toolbar span,
.list-head span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.map-canvas {
  position: relative;
  height: min(72vh, 720px);
  min-height: 560px;
  background: #dbe8ef;
  overflow: hidden;
}

.real-map,
.fallback-map {
  position: absolute;
  inset: 0;
}

.fallback-map {
  --marker-counter-scale: 1;
  background:
    linear-gradient(180deg, rgba(17, 36, 54, 0.05), transparent 34%),
    #d5e6ee;
  touch-action: none;
  user-select: none;
}

.fallback-viewport {
  position: absolute;
  left: 0;
  top: 0;
  width: 1600px;
  height: 900px;
  transform-origin: 0 0;
  will-change: transform;
}

.geo-base-map {
  position: absolute;
  inset: 0;
  width: 1600px;
  height: 900px;
  pointer-events: none;
}

.ocean {
  fill: #d7e8ef;
}

.map-graticule {
  fill: none;
  stroke: rgba(65, 88, 105, 0.14);
  stroke-width: 1.4;
}

.eurasia-land {
  fill: #eef3ec;
  stroke: rgba(82, 105, 90, 0.25);
  stroke-width: 2;
}

.china-fill {
  fill: rgba(238, 183, 69, 0.34);
}

.china-outline {
  fill: none;
  stroke: rgba(179, 111, 24, 0.72);
  stroke-width: 4;
  stroke-linejoin: round;
}

.route-line {
  fill: none;
  stroke: rgba(23, 105, 224, 0.28);
  stroke-width: 6;
  stroke-linecap: round;
}

.route-line.muted {
  stroke: rgba(15, 159, 143, 0.24);
  stroke-width: 5;
}

.region-dot {
  fill: rgba(23, 105, 224, 0.7);
  stroke: white;
  stroke-width: 4;
}

.map-label {
  fill: rgba(39, 58, 75, 0.44);
  font-size: 31px;
  font-weight: 850;
  letter-spacing: 0;
}

.map-label.major {
  fill: rgba(107, 70, 26, 0.72);
  font-size: 44px;
}

.map-grid {
  position: absolute;
  inset: 0;
  opacity: 0.45;
  background-image:
    linear-gradient(rgba(73, 94, 112, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(73, 94, 112, 0.16) 1px, transparent 1px);
  background-size: 40px 40px;
}

.road {
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.28), 0 8px 18px rgba(75, 85, 99, 0.12);
}

.road-a {
  left: -10%;
  top: 41%;
  width: 122%;
  height: 18px;
  transform: rotate(-7deg);
}

.road-b {
  left: 42%;
  top: -12%;
  width: 17px;
  height: 126%;
  transform: rotate(16deg);
}

.road-c {
  left: 15%;
  bottom: 18%;
  width: 82%;
  height: 14px;
  transform: rotate(21deg);
}

.river {
  position: absolute;
  left: -6%;
  top: 13%;
  width: 112%;
  height: 86px;
  border-radius: 50%;
  border-bottom: 18px solid rgba(46, 160, 190, 0.34);
  transform: rotate(-8deg);
}

.district {
  position: absolute;
  color: rgba(39, 58, 75, 0.34);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.d1 {
  left: 13%;
  top: 20%;
}

.d2 {
  right: 15%;
  top: 38%;
}

.d3 {
  left: 28%;
  bottom: 18%;
}

.marker-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 1600px;
  height: 900px;
}

.map-zoom-controls {
  position: absolute;
  right: 14px;
  bottom: 178px;
  z-index: 6;
  display: grid;
  gap: 7px;
}

.map-zoom-controls button,
.map-zoom-controls output {
  display: grid;
  place-items: center;
  min-width: 42px;
  height: 40px;
  border: 1px solid rgba(191, 208, 220, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(20, 32, 42, 0.14);
  font-weight: 900;
}

.map-zoom-controls output {
  height: 32px;
  background: rgba(20, 32, 42, 0.88);
  color: white;
  font-size: 12px;
  pointer-events: none;
}

.map-zoom-controls button:active {
  transform: translateY(1px);
}

.customer-marker {
  position: absolute;
  display: grid;
  place-items: center;
  width: 46px;
  height: 54px;
  transform: translate(-50%, -100%) scale(var(--marker-counter-scale));
  transform-origin: 50% 100%;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--accent);
}

.customer-marker::after,
.amap-customer-marker::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 11px;
  height: 11px;
  background: currentColor;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
  box-shadow: 0 7px 13px rgba(20, 32, 42, 0.26);
}

.customer-marker .pin-icon,
.amap-customer-marker .pin-icon {
  position: relative;
  z-index: 1;
  width: 38px;
  height: 38px;
  border: 3px solid white;
  box-shadow: 0 8px 16px rgba(20, 32, 42, 0.24);
}

.customer-marker.selected .pin-icon,
.amap-customer-marker.selected .pin-icon {
  outline: 4px solid rgba(23, 105, 224, 0.28);
  transform: translateY(-2px) scale(1.06);
}

.marker-label {
  position: absolute;
  top: 41px;
  left: 50%;
  z-index: 2;
  max-width: 116px;
  transform: translateX(-50%);
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  padding: 4px 8px;
  box-shadow: 0 8px 18px rgba(20, 32, 42, 0.15);
  font-size: 11px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-marker.selected .marker-label,
.customer-marker:hover .marker-label {
  opacity: 1;
}

.amap-customer-marker {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 54px;
  color: var(--accent);
}

.map-selected-card {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 7;
  border: 1px solid rgba(191, 208, 220, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  padding: 13px;
  backdrop-filter: blur(16px);
}

.selected-card-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 10px;
}

.selected-card-head .pin-icon {
  width: 38px;
  height: 38px;
}

.selected-card-title {
  min-width: 0;
}

.selected-card-title strong {
  display: block;
  overflow: hidden;
  font-size: 17px;
  line-height: 1.22;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-card-title span,
.selected-card-address,
.map-card-empty span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.selected-card-address {
  margin: 8px 0 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 26px;
  line-height: 1;
  font-weight: 800;
}

.selected-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.selected-card-metrics span {
  min-width: 0;
  border-radius: 8px;
  background: #f3f7fa;
  padding: 8px;
}

.selected-card-metrics b {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-card-metrics small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.selected-card-actions {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.8fr;
  gap: 8px;
}

.map-card-empty {
  display: grid;
  gap: 4px;
  min-height: 88px;
  align-content: center;
}

.map-card-empty strong {
  font-size: 16px;
}

.side-panel {
  display: grid;
  gap: 14px;
}

.detail-card {
  min-height: 238px;
  padding: 14px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 196px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.detail-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.detail-head h3 {
  margin: 0 0 4px;
  font-size: 19px;
  line-height: 1.2;
}

.detail-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  background: #edf3f7;
  color: #425567;
  font-size: 12px;
  font-weight: 800;
}

.badge.status-待拜访 {
  background: #fff5dc;
  color: var(--pending);
}

.badge.status-已拜访 {
  background: #ddf8f4;
  color: var(--visited);
}

.badge.status-复访 {
  background: #e7efff;
  color: var(--revisit);
}

.badge.status-暂停 {
  background: #eef2f6;
  color: var(--paused);
}

.badge.due-overdue,
.row-meta .due-overdue {
  background: #fde2df;
  color: #b42318;
}

.badge.due-today,
.row-meta .due-today {
  background: #fff1c2;
  color: #9a5b00;
}

.badge.due-upcoming,
.row-meta .due-upcoming {
  background: #e7efff;
  color: #3154a3;
}

.detail-line {
  margin: 8px 0;
  color: #2e4051;
  font-size: 14px;
  line-height: 1.55;
}

.detail-line span {
  color: var(--muted);
}

.detail-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.list-card {
  overflow: hidden;
}

.list-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(104px, 1fr));
  gap: 8px;
}

.list-head select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 8px;
}

.customer-list {
  max-height: 430px;
  overflow: auto;
}

.customer-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 12px 14px;
  text-align: left;
  color: inherit;
}

.customer-row:last-child {
  border-bottom: 0;
}

.customer-row.active,
.customer-row:hover {
  background: #f4f8ff;
}

.customer-row h3 {
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-row p {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.row-meta span {
  border-radius: 999px;
  background: #edf3f7;
  padding: 3px 7px;
  color: #526577;
  font-size: 11px;
  font-weight: 750;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: end center;
}

.sheet[hidden] {
  display: none;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 32, 42, 0.42);
}

.sheet-panel {
  position: relative;
  width: min(640px, calc(100vw - 24px));
  max-height: min(86vh, 780px);
  overflow: auto;
  margin: 0 12px 14px;
  padding: 18px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.settings-panel {
  width: min(560px, calc(100vw - 24px));
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.plain-icon {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #edf3f7;
  color: #2e4051;
  font-size: 26px;
  line-height: 1;
}

.field,
.advanced-fields {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field span,
.advanced-fields summary {
  color: #425567;
  font-size: 13px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--ink);
  outline: 0;
  padding: 10px 11px;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.14);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.advanced-fields {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 10px;
}

.advanced-fields .field-row {
  margin-top: 10px;
}

.advanced-fields .field {
  margin-bottom: 0;
}

.sheet-actions,
.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.settings-note {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f2f7fb;
  color: #425567;
  font-size: 13px;
  line-height: 1.55;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 80;
  max-width: calc(100vw - 24px);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  border-radius: 999px;
  background: #14202a;
  color: white;
  padding: 10px 14px;
  font-size: 14px;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.mobile-nav {
  display: none;
}

@media (max-width: 980px) {
  body {
    background: var(--app-bg);
  }

  .app-shell {
    padding: 10px 10px 86px;
  }

  .app-header {
    gap: 10px;
    margin-bottom: 8px;
  }

  .eyebrow {
    display: none;
  }

  h1 {
    font-size: 20px;
  }

  .header-actions {
    gap: 6px;
  }

  .icon-button {
    min-height: 34px;
    padding: 0 10px;
    font-size: 12px;
  }

  .search-card {
    position: sticky;
    top: 6px;
    z-index: 12;
    grid-template-columns: 1fr;
    margin-bottom: 8px;
  }

  .search-card .primary-button {
    display: none;
  }

  .search-box {
    min-height: 46px;
    border-radius: 8px;
  }

  .category-strip {
    position: relative;
    z-index: 10;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 0 7px;
    margin-bottom: 8px;
    scrollbar-width: none;
  }

  .category-strip::-webkit-scrollbar {
    display: none;
  }

  .category-chip {
    min-width: 112px;
    min-height: 42px;
    border-radius: 8px;
    padding: 6px 8px;
  }

  .category-icon {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .category-name {
    font-size: 12px;
  }

  .category-count {
    font-size: 11px;
  }

  .workspace {
    display: block;
  }

  .map-section,
  .side-panel {
    display: none;
  }

  .app-shell.view-map .map-section,
  .app-shell.view-list .side-panel,
  .app-shell.view-detail .side-panel {
    display: grid;
  }

  .app-shell.view-detail .list-card {
    display: none;
  }

  .app-shell.view-list .detail-card {
    display: none;
  }

  .map-section {
    border-radius: 8px;
  }

  .map-toolbar {
    display: none;
  }

  .map-canvas {
    height: calc(100vh - 178px);
    min-height: 520px;
  }

  @supports (height: 100dvh) {
    .map-canvas {
      height: calc(100dvh - 178px);
    }
  }

  .map-zoom-controls {
    right: 11px;
    bottom: 304px;
  }

  .map-selected-card {
    left: 10px;
    right: 10px;
    bottom: 82px;
    padding: 11px;
  }

  .selected-card-actions {
    grid-template-columns: 1.35fr 0.8fr 0.8fr;
  }

  .selected-card-actions .primary-button,
  .selected-card-actions .ghost-button {
    min-height: 42px;
    padding: 0 8px;
    font-size: 13px;
  }

  .side-panel {
    gap: 12px;
  }

  .customer-list {
    max-height: calc(100vh - 250px);
  }

  @supports (height: 100dvh) {
    .customer-list {
      max-height: calc(100dvh - 250px);
    }
  }

  .detail-card,
  .list-card {
    border-radius: 8px;
  }

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

  .mobile-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 6px;
    border: 1px solid rgba(191, 208, 220, 0.9);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
  }

  .mobile-nav-item {
    min-height: 42px;
    border-radius: 8px;
    background: transparent;
    color: #425567;
    font-weight: 800;
  }

  .mobile-nav-item.active {
    background: var(--accent-soft);
    color: var(--accent);
  }

  .mobile-nav-item.add {
    background: var(--accent);
    color: white;
    box-shadow: 0 10px 20px rgba(23, 105, 224, 0.25);
  }

  .toast {
    bottom: calc(88px + env(safe-area-inset-bottom));
  }

  .field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

@media (max-width: 520px) {
  .app-header {
    align-items: center;
  }

  .header-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .icon-button {
    padding: 0 8px;
    font-size: 12px;
  }

  .map-canvas {
    min-height: 500px;
  }

  .selected-card-title strong {
    font-size: 16px;
  }

  .selected-card-metrics {
    gap: 6px;
  }

  .selected-card-metrics span {
    padding: 7px 6px;
  }

  .sheet-panel {
    width: 100%;
    max-height: 92vh;
    margin: 0;
    border-radius: 8px 8px 0 0;
  }

  .sheet-actions,
  .settings-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .list-head {
    align-items: stretch;
    flex-direction: column;
    padding: 11px 12px;
  }

  .list-tools {
    grid-template-columns: 1fr 1fr;
  }

  .detail-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 370px) {
  .selected-card-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .selected-card-metrics span:last-child {
    display: none;
  }

  .selected-card-actions {
    grid-template-columns: 1fr 1fr;
  }

  .selected-card-actions .ghost-button:last-child {
    display: none;
  }
}

@media (max-width: 980px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    min-height: 100dvh;
    padding: 0;
    background: #d5e6ee;
  }

  .app-header {
    display: none;
  }

  .mobile-nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: auto;
    left: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    height: 45px;
    gap: 0;
    padding: 0 8px;
    border: 0;
    border-radius: 0;
    background: #348ff0;
    box-shadow: none;
    backdrop-filter: none;
  }

  .mobile-nav-item,
  .mobile-nav-item.add,
  .mobile-nav-item.active {
    min-height: 45px;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: rgba(255, 255, 255, 0.72);
    font-size: 16px;
    font-weight: 850;
  }

  .mobile-nav-item.active,
  .mobile-nav-item.add {
    color: white;
  }

  .search-card {
    position: fixed;
    top: 45px;
    right: 0;
    left: 0;
    z-index: 49;
    display: block;
    width: 100%;
    max-width: none;
    height: 42px;
    margin: 0;
    padding: 5px 10px;
    background: #348ff0;
  }

  .search-card .primary-button {
    display: none;
  }

  .search-box {
    min-height: 32px;
    height: 32px;
    gap: 8px;
    border: 0;
    border-radius: 5px;
    background: rgba(16, 82, 158, 0.34);
    box-shadow: none;
    backdrop-filter: none;
  }

  .search-symbol {
    color: rgba(255, 255, 255, 0.68);
  }

  .search-box input {
    color: white;
    font-size: 18px;
    font-weight: 650;
  }

  .search-box input::placeholder {
    color: rgba(255, 255, 255, 0.68);
    opacity: 1;
  }

  .category-strip {
    position: fixed;
    top: 96px;
    right: 58px;
    left: 8px;
    z-index: 36;
    max-width: none;
    height: 42px;
    margin: 0;
    padding: 0;
    overflow-x: auto;
  }

  .app-shell.view-list .category-strip,
  .app-shell.view-detail .category-strip {
    display: none;
  }

  .category-chip {
    min-width: 124px;
    min-height: 36px;
    padding: 5px 7px 5px 10px;
    border-color: rgba(191, 208, 220, 0.88);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 14px rgba(20, 32, 42, 0.16);
  }

  .category-chip.active {
    background: white;
  }

  .category-name {
    font-size: 12px;
    white-space: nowrap;
  }

  .category-count {
    display: none;
  }

  .category-icon {
    width: 28px;
    height: 28px;
  }

  .workspace {
    position: fixed;
    inset: 87px 0 0;
    display: block;
    max-width: none;
    margin: 0;
  }

  .map-section {
    position: absolute;
    inset: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: hidden;
  }

  .app-shell.view-map .map-section {
    display: block;
  }

  .map-canvas {
    height: 100%;
    min-height: 0;
  }

  @supports (height: 100dvh) {
    .map-canvas {
      height: 100%;
    }
  }

  .side-panel {
    position: fixed;
    inset: 87px 0 0;
    z-index: 35;
    display: block;
    overflow: auto;
    padding: 10px;
    background: var(--app-bg);
  }

  .app-shell.view-map .side-panel,
  .app-shell.view-map .list-card,
  .app-shell.view-map .detail-card {
    display: none;
  }

  .map-zoom-controls {
    right: 8px;
    bottom: 276px;
    z-index: 20;
    gap: 0;
    border-radius: 12px;
    filter: drop-shadow(0 5px 14px rgba(20, 32, 42, 0.2));
  }

  .map-zoom-controls button,
  .map-zoom-controls output {
    min-width: 40px;
    width: 40px;
    height: 42px;
    border-radius: 0;
    border-color: rgba(208, 218, 226, 0.95);
    background: rgba(255, 255, 255, 0.97);
    box-shadow: none;
    color: #111b24;
    font-size: 18px;
  }

  .map-zoom-controls button:first-child {
    border-radius: 12px 12px 0 0;
  }

  .map-zoom-controls button:last-child {
    border-radius: 0 0 12px 12px;
  }

  .map-zoom-controls output {
    height: 32px;
    background: #14202a;
    color: white;
    font-size: 13px;
  }

  .map-zoom-controls button[data-zoom-action="china"],
  .map-zoom-controls button[data-zoom-action="eurasia"] {
    font-size: 14px;
    line-height: 1;
    white-space: nowrap;
  }

  .map-selected-card {
    right: 58px;
    bottom: 12px;
    left: 10px;
    z-index: 18;
    padding: 11px;
    border-radius: 8px;
  }

  .selected-card-metrics {
    margin-bottom: 8px;
  }

  .selected-card-actions .primary-button,
  .selected-card-actions .ghost-button {
    min-height: 40px;
  }

  .toast {
    bottom: calc(20px + env(safe-area-inset-bottom));
  }
}
