.recovery-main {
  --recovery-bg: #f4f8fb;
  --recovery-panel: rgba(255, 255, 255, 0.94);
  --recovery-panel-soft: #f8fbfd;
  --recovery-line: rgba(39, 68, 94, 0.16);
  --recovery-text: #17324a;
  --recovery-muted: #64788d;
  --recovery-green: #16875f;
  --recovery-green-soft: rgba(22, 135, 95, 0.12);
  --recovery-blue: #2176ae;
  --recovery-sky: #5db7de;
  --recovery-amber: #d99a16;
  --recovery-red: #d64f5f;
  padding: 0 clamp(14px, 2vw, 30px) 18px;
}

body[data-page="recovery-map"] {
  color: var(--recovery-text);
  background:
    linear-gradient(180deg, #eaf6fb 0%, #f6faf7 46%, #edf4f7 100%);
}

.recovery-standalone-header {
  position: relative;
  color: var(--recovery-text);
  background: rgba(255, 255, 255, 0.86);
}

body[data-page="recovery-map"] .brand-mark {
  color: #ffffff;
  border-color: var(--recovery-green);
  background: var(--recovery-green);
}

body[data-page="recovery-map"] .eyebrow {
  color: var(--recovery-green);
}

body[data-page="recovery-map"] .site-footer {
  display: none;
  color: var(--recovery-muted);
  background: rgba(255, 255, 255, 0.7);
  border-top-color: var(--recovery-line);
}

body[data-page="recovery-map"] .site-header {
  padding: 10px clamp(14px, 2vw, 30px);
}

.standalone-header-note {
  color: var(--recovery-muted);
  font-size: 13px;
}

.recovery-standalone-footer {
  margin-top: 0;
}

.recovery-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 0 12px;
}

.recovery-header > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.recovery-header h1 {
  color: #0f3048;
  margin-bottom: 0;
  font-size: clamp(24px, 2.2vw, 34px);
  line-height: 1.18;
}

.recovery-meta {
  display: grid;
  flex: 0 0 auto;
  gap: 6px;
  min-width: 250px;
  padding: 10px 12px;
  border: 1px solid var(--recovery-line);
  border-radius: 8px;
  color: var(--recovery-text);
  background: var(--recovery-panel);
  box-shadow: 0 12px 30px rgba(36, 76, 104, 0.1);
}

.recovery-meta span,
.eta-row span,
.summary-grid span {
  color: var(--recovery-muted);
  font-size: 13px;
}

.recovery-workspace {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(360px, 3fr);
  gap: 12px;
  height: min(780px, calc(100vh - 132px));
  min-height: 520px;
}

.recovery-map-panel,
.recovery-dashboard,
.recovery-timeline,
.recovery-data-panel,
.dashboard-card {
  border: 1px solid var(--recovery-line);
  border-radius: 8px;
  color: var(--recovery-text);
  background: var(--recovery-panel);
  box-shadow: 0 18px 48px rgba(31, 68, 92, 0.13);
}

.recovery-map-panel {
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.recovery-map {
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #101820;
}

.recovery-dashboard {
  display: grid;
  grid-template-rows: minmax(360px, 0.95fr) minmax(330px, 0.85fr);
  align-content: start;
  gap: 10px;
  padding: 10px;
  overflow: auto;
  background: rgba(255, 255, 255, 0.78);
}

.dashboard-card {
  padding: 12px;
  background: var(--recovery-panel);
  box-shadow: none;
}

.dashboard-card h2 {
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.25;
}

.panel-title-row,
.eta-row,
.progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title-row > strong {
  color: var(--recovery-blue);
  font-size: 34px;
}

.road-detail-list {
  display: none;
  gap: 7px;
  margin: 0;
}

.road-photo-panel {
  display: grid;
  gap: 6px;
  margin: 0 0 10px;
}

.road-photo-panel img,
.road-photo-placeholder {
  width: 100%;
  aspect-ratio: 16 / 7;
  border: 1px solid var(--recovery-line);
  border-radius: 8px;
  background: var(--recovery-panel-soft);
}

.road-photo-panel img {
  display: block;
  object-fit: cover;
}

.road-photo-placeholder {
  display: grid;
  place-items: center;
  padding: 16px;
  color: var(--recovery-muted);
  text-align: center;
}

.road-photo-panel figcaption {
  color: var(--recovery-muted);
  font-size: 13px;
  line-height: 1.4;
}

.road-photo-thumbs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.road-photo-thumbs button {
  display: block;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.road-photo-thumbs button.active {
  border-color: var(--recovery-blue);
}

.road-photo-thumbs img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 0;
  object-fit: cover;
}

.road-detail-list div {
  display: grid;
  gap: 4px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--recovery-line);
}

.road-detail-list dt {
  color: var(--recovery-muted);
  font-size: 12px;
  text-transform: uppercase;
}

.road-detail-list dd {
  margin: 0;
  line-height: 1.5;
}

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

.summary-grid article {
  display: grid;
  gap: 6px;
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--recovery-line);
  border-radius: 8px;
  background: var(--recovery-panel-soft);
}

.summary-grid strong {
  font-size: 23px;
}

.progress-block {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.progress-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(100, 120, 141, 0.16);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--recovery-green), var(--recovery-sky));
  transition: width 700ms ease;
}

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

.layer-status-list span {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  color: var(--recovery-muted);
  font-size: 12px;
}

.layer-status-list i,
.recovery-legend i {
  display: inline-block;
  width: 18px;
  height: 8px;
  border-radius: 999px;
}

.recovery-legend {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 500;
  display: grid;
  gap: 8px;
  min-width: 170px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  color: var(--recovery-text);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 36px rgba(31, 68, 92, 0.24);
  font-size: 13px;
}

.recovery-legend span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-completed { background: var(--recovery-green); }
.status-progress { background: var(--recovery-amber); }
.status-not-started { background: var(--recovery-red); }

.leaflet-container {
  background: #101820;
  font-family: "Segoe UI", "Noto Sans TC", system-ui, sans-serif;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  color: var(--recovery-text);
  background: #ffffff;
}

.leaflet-popup-content {
  line-height: 1.5;
}

.leaflet-interactive.recovery-road-line {
  filter:
    drop-shadow(0 0 2px rgba(255, 255, 255, 0.98))
    drop-shadow(0 1px 4px rgba(3, 18, 30, 0.55));
}

.recovery-data-panel {
  padding: 12px;
  max-height: none;
  min-height: 0;
  overflow: hidden;
}

.data-panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.data-panel-heading h2 {
  margin: 0;
  font-size: 16px;
}

.data-panel-heading span {
  color: var(--recovery-muted);
  font-size: 13px;
}

.recovery-table-wrap {
  overflow: auto;
  height: min(420px, calc(56vh - 72px));
  min-height: 300px;
  border: 1px solid var(--recovery-line);
  border-radius: 8px;
  background: #ffffff;
}

.recovery-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 12px;
}

.recovery-table th,
.recovery-table td {
  padding: 8px 9px;
  font-size: 12px;
  border-bottom: 1px solid var(--recovery-line);
  text-align: left;
  vertical-align: top;
}

.recovery-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--recovery-text);
  background: #eaf4f8;
  white-space: nowrap;
}

.recovery-table tbody tr {
  cursor: pointer;
}

.recovery-table tbody tr:hover {
  background: rgba(33, 118, 174, 0.08);
}

.recovery-table tbody tr.active {
  background: rgba(22, 135, 95, 0.12);
  outline: 1px solid rgba(22, 135, 95, 0.42);
  outline-offset: -1px;
}

.road-name-cell {
  min-width: 230px;
  color: var(--recovery-text);
  font-weight: 700;
}

.table-status-completed,
.table-status-progress,
.table-status-not-started {
  white-space: nowrap;
  font-weight: 800;
}

.table-status-completed { color: var(--recovery-green); }
.table-status-progress { color: var(--recovery-amber); }
.table-status-not-started { color: var(--recovery-red); }

.recovery-timeline {
  display: none;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
}

.recovery-dashboard .dashboard-card:nth-of-type(3),
.recovery-dashboard .dashboard-card:nth-of-type(4) {
  display: none;
}

.timeline-title h2 {
  margin: 0;
  font-size: 18px;
}

.recovery-timeline-track {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.timeline-step {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 28px;
  align-items: center;
  min-height: 46px;
  padding: 9px 10px;
  border: 1px solid var(--recovery-line);
  border-radius: 8px;
  background: var(--recovery-panel-soft);
}

.timeline-step strong {
  display: block;
}

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

.timeline-step .timeline-arrow {
  color: var(--recovery-green);
  font-size: 22px;
  line-height: 1;
  text-align: center;
}

@media (max-width: 980px) {
  .recovery-header,
  .recovery-workspace,
  .data-panel-heading,
  .recovery-timeline {
    grid-template-columns: 1fr;
  }

  .recovery-header {
    align-items: stretch;
    flex-direction: column;
  }

  .data-panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .recovery-workspace {
    display: flex;
    flex-direction: column;
  }

  .recovery-map-panel,
  .recovery-map {
    min-height: 500px;
  }

  .recovery-workspace {
    height: auto;
  }
}

@media (max-width: 1180px) {
  .recovery-workspace {
    display: flex;
    flex-direction: column;
    height: auto;
  }

  .recovery-map-panel,
  .recovery-map {
    min-height: 520px;
  }

  .recovery-table-wrap {
    height: auto;
    max-height: 430px;
  }
}

@media (max-width: 620px) {
  .summary-grid,
  .layer-status-list,
  .recovery-timeline-track {
    grid-template-columns: 1fr;
  }

  .recovery-map-panel,
  .recovery-map {
    min-height: 420px;
  }
}
