:root {
  --bg: #f3f6f5;
  --surface: #ffffff;
  --surface-soft: #f7f9f8;
  --border: #dce5e2;
  --text: #17231f;
  --muted: #66756f;
  --brand: #0f766e;
  --brand-strong: #0b5e57;
  --brand-soft: #e3f4f1;
  --accent: #c77f2a;
  --accent-soft: #fff3df;
  --danger: #b83a3a;
  --danger-soft: #fdeaea;
  --shadow: 0 8px 24px rgba(19, 44, 37, 0.07);
  --radius: 8px;
  --sidebar-width: 256px;
  --mobile-nav-height: 68px;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  background: #102c26;
  color: #eaf4f1;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
}

.brand-mark svg {
  width: 23px;
  height: 23px;
  color: #8ce2d7;
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-sub {
  margin-top: 3px;
  color: #aac1bb;
  font-size: 12px;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.nav-item,
.mobile-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #c3d7d1;
  text-align: left;
  transition: background 160ms ease, color 160ms ease;
}

.nav-item {
  min-height: 46px;
  padding: 10px 12px;
}

.nav-item svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

.nav-item span {
  font-size: 14px;
}

.nav-item:hover,
.mobile-nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-item.is-active {
  background: #eaf8f4;
  color: #0d5b52;
  font-weight: 650;
}

.nav-item.is-active svg {
  color: var(--brand);
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #5fd7a8;
  box-shadow: 0 0 0 4px rgba(95, 215, 168, 0.14);
  flex: 0 0 auto;
}

.foot-title {
  font-size: 12px;
  color: #dcece7;
}

.foot-sub {
  margin-top: 2px;
  font-size: 11px;
  color: #91aaa2;
}

.workspace {
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 0 30px 40px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 4px 10px;
  background: rgba(243, 246, 245, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(220, 229, 226, 0.7);
}

.topbar-kicker {
  margin-bottom: 3px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.topbar h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.2;
  letter-spacing: 0;
}

.today-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 13px;
}

.today-chip svg {
  width: 16px;
  height: 16px;
  color: var(--brand);
}

.content {
  max-width: 1180px;
  padding-top: 22px;
}

.view {
  animation: fade-in 180ms ease both;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 24px 0 14px;
}

.section-head:first-child {
  margin-top: 0;
}

.section-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

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

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

.kpi-card {
  min-height: 108px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.kpi-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
}

.kpi-icon.warm {
  background: var(--accent-soft);
  color: var(--accent);
}

.kpi-icon.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.kpi-icon svg {
  width: 18px;
  height: 18px;
}

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

.kpi-value {
  margin-top: 8px;
  font-size: 25px;
  font-weight: 750;
  line-height: 1;
}

.kpi-change {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

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

.module-card {
  display: block;
  min-height: 148px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease;
}

.module-card:hover {
  transform: translateY(-2px);
  border-color: #a9c7bf;
}

.module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.module-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
}

.module-icon.amber {
  background: var(--accent-soft);
  color: var(--accent);
}

.module-icon.blue {
  background: #e7f0fc;
  color: #2c67a5;
}

.module-icon svg {
  width: 21px;
  height: 21px;
}

.module-title {
  margin-top: 15px;
  font-size: 15px;
  font-weight: 700;
}

.module-desc {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.task-list,
.result-list,
.record-list,
.enterprise-list {
  display: grid;
  gap: 10px;
}

.task-item,
.result-item,
.record-item,
.enterprise-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.task-dot {
  display: block;
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}

.task-dot.done {
  background: #31a477;
}

.task-main {
  min-width: 0;
  flex: 1;
}

.task-title {
  font-size: 14px;
  font-weight: 650;
}

.task-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.task-status {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #8c5a1f;
  font-size: 11px;
  font-weight: 650;
}

.task-status.done {
  background: #e2f4ed;
  color: #1f7d5c;
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr);
  gap: 16px;
  align-items: start;
}

.panel {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel h3 {
  margin: 0;
  font-size: 15px;
}

.panel .section-note {
  margin-top: 5px;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: #42514c;
  font-size: 12px;
  font-weight: 650;
}

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

.field textarea {
  min-height: 78px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #5ba79b;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.actions-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.btn {
  min-height: 38px;
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--brand);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--brand-strong);
}

.btn-secondary {
  border-color: var(--border);
  background: var(--surface);
  color: #34453f;
}

.btn-secondary:hover {
  background: var(--surface-soft);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.route-visual {
  position: relative;
  min-height: 280px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(rgba(23, 35, 31, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 35, 31, 0.045) 1px, transparent 1px),
    #f8fbfa;
  background-size: 24px 24px;
  overflow: hidden;
}

.route-visual svg {
  width: 100%;
  height: 240px;
  display: block;
}

.route-line {
  fill: none;
  stroke: var(--brand);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.route-dot {
  fill: var(--surface);
  stroke: var(--brand);
  stroke-width: 2;
}

.route-label {
  fill: #33453f;
  font-size: 11px;
  font-weight: 650;
}

.route-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.summary-item {
  padding: 12px;
  border-radius: 7px;
  background: var(--surface-soft);
}

.summary-label {
  color: var(--muted);
  font-size: 11px;
}

.summary-value {
  margin-top: 5px;
  font-size: 18px;
  font-weight: 750;
}

.route-map {
  height: 300px;
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #e9f0ee;
  z-index: 0;
}

.leaflet-container {
  font-family: inherit;
}

.route-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.route-stops {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.route-stop {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-soft);
}

.route-stop-index {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--brand);
  color: #ffffff;
  font-size: 12px;
  font-weight: 750;
}

.route-stop-main {
  min-width: 0;
  flex: 1;
}

.route-stop-title {
  font-size: 13px;
  font-weight: 700;
}

.route-stop-meta,
.route-stop-time {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.route-stop-tag {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
}

.weather-card {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fbfdfc;
}

.weather-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.weather-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 700;
}

.weather-status svg {
  width: 20px;
  height: 20px;
  color: var(--brand);
}

.weather-risk {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
}

.weather-risk.low {
  background: #e2f4ed;
  color: #1f7d5c;
}

.weather-risk.medium {
  background: var(--accent-soft);
  color: #8c5a1f;
}

.weather-risk.high {
  background: var(--danger-soft);
  color: var(--danger);
}

.weather-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.weather-detail span {
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.weather-advice {
  margin: 12px 0 0;
  color: #4a5954;
  font-size: 12px;
  line-height: 1.55;
}

.weather-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.weather-actions .btn {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.inline-note {
  display: grid;
  align-items: center;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
}

.import-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.settings-card {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fbfdfc;
}

.settings-card h3 {
  margin: 0;
  font-size: 14px;
}

.settings-card .section-note {
  margin-top: 5px;
}

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

.capture-zone {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 24px;
  border: 1px dashed #9db8b0;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}

.capture-zone:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.capture-zone svg {
  width: 38px;
  height: 38px;
  color: var(--brand);
}

.capture-title {
  margin-top: 10px;
  color: var(--text);
  font-weight: 700;
}

.capture-note {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.5;
}

.preview-wrap {
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: #16211e;
}

.preview-wrap img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: #16211e;
}

.recognized-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 999px;
  background: #e2f4ed;
  color: #1f7d5c;
  font-size: 11px;
  font-weight: 700;
}

.recognized-tag svg {
  width: 14px;
  height: 14px;
}

.info-grid {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.info-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--border);
}

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

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

.info-value {
  font-size: 13px;
  font-weight: 650;
}

.review-issues {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.issue-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 11px;
  border-radius: 7px;
  background: var(--surface-soft);
  color: #3e4d48;
  font-size: 13px;
}

.issue-item.ok {
  background: #e2f4ed;
  color: #1f6e53;
}

.issue-item.warn {
  background: var(--danger-soft);
  color: var(--danger);
}

.issue-item svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.mobile-nav {
  display: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  border-radius: 7px;
  background: #17302a;
  color: #ffffff;
  font-size: 13px;
  transform: translate(-50%, 24px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

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

@media (max-width: 900px) {
  .sidebar {
    display: none;
  }

  .workspace {
    width: 100%;
    margin-left: 0;
    padding: 0 16px calc(var(--mobile-nav-height) + 20px);
  }

  .topbar {
    min-height: 72px;
    padding-top: 12px;
  }

  .topbar h1 {
    font-size: 21px;
  }

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

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

  .mobile-nav {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 30;
    height: var(--mobile-nav-height);
    display: flex;
    align-items: stretch;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    background: #ffffff;
    border-top: 1px solid var(--border);
  }

  .mobile-nav-item {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    border-radius: 7px;
    color: var(--muted);
    font-size: 10px;
  }

  .mobile-nav-item svg {
    width: 20px;
    height: 20px;
  }

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

  .today-chip {
    font-size: 12px;
  }
}

@media (max-width: 560px) {
  .kpi-grid,
  .module-grid,
  .form-grid,
  .route-summary,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .actions-row {
    width: 100%;
  }

  .btn {
    flex: 1;
  }

  .import-bar .btn {
    flex: 1;
  }

  .info-row {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .route-map {
    height: 240px;
  }

  .route-stop {
    align-items: flex-start;
  }

  .route-stop-tag {
    margin-top: 2px;
  }
}
