.service-map-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: none;
  color: #1f2937;
  box-sizing: border-box;
}

.service-map-card {
  width: 100%;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
  overflow: hidden;
  box-sizing: border-box;
}

.service-map-card-header {
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.service-map-detail-header {
  align-items: flex-end;
  flex-wrap: wrap;
}

.service-map-header-control {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 230px;
  max-width: 300px;
  font-weight: 700;
}

.service-map-header-control label {
  font-size: 12px;
  font-weight: 800;
  color: #374151;
}

.service-map-header-control select {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
  background: #fff;
  color: #111827;
  box-sizing: border-box;
}

.service-map-header-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

.service-map-customer-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  padding: 28px 14px;
  background: rgba(15, 23, 42, 0.55);
}

.service-map-customer-picker-overlay.active {
  display: flex;
}

.service-map-customer-picker-box {
  width: min(900px, 100%);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

.service-map-customer-picker-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 18px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}

.service-map-customer-picker-head h3 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 900;
  color: #0f172a;
}

.service-map-customer-picker-head p {
  margin: 0;
  color: #64748b;
  font-size: 13px;
}

.service-map-customer-picker-close {
  border: 0;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  cursor: pointer;
}

.service-map-customer-picker-body {
  padding: 16px 20px 20px;
}

.service-map-customer-picker-search {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.service-map-customer-picker-search input {
  flex: 1;
  min-width: 260px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}

.service-map-customer-picker-results {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
}

.service-map-customer-card {
  width: 100%;
  border: 1px solid #e5e7eb !important;
  border-radius: 12px;
  background: #ffffff !important;
  color: #0f172a !important;
  padding: 11px 12px;
  text-align: left;
  cursor: pointer;
  box-shadow: none !important;
  transform: none !important;
  filter: none !important;
}

.service-map-customer-card.sc-tone-danger,
.service-map-customer-card.sc-tone-success,
.service-map-customer-card.sc-tone-add,
.service-map-customer-card.sc-tone-clear,
.service-map-customer-card.sc-tone-edit,
.service-map-customer-card.sc-tone-search,
.service-map-customer-card.sc-tone-refresh,
.service-map-customer-card.sc-tone-reset,
.service-map-customer-card.sc-tone-export,
.service-map-customer-card.sc-tone-period,
.service-map-customer-card.sc-tone-upload,
.service-map-customer-card.sc-tone-pdf {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #e5e7eb !important;
  box-shadow: none !important;
  transform: none !important;
  filter: none !important;
}

.service-map-customer-card *,
.service-map-customer-card.sc-tone-danger *,
.service-map-customer-card.sc-tone-success *,
.service-map-customer-card.sc-tone-add *,
.service-map-customer-card.sc-tone-clear *,
.service-map-customer-card.sc-tone-edit *,
.service-map-customer-card.sc-tone-search *,
.service-map-customer-card.sc-tone-refresh *,
.service-map-customer-card.sc-tone-reset *,
.service-map-customer-card.sc-tone-export *,
.service-map-customer-card.sc-tone-period *,
.service-map-customer-card.sc-tone-upload *,
.service-map-customer-card.sc-tone-pdf * {
  color: inherit !important;
}

.service-map-customer-card:hover,
.service-map-customer-card:focus {
  background: #eff6ff !important;
  border-color: #bfdbfe !important;
  color: #0f172a !important;
}

.service-map-customer-card strong {
  display: block;
  color: #0f172a;
  margin-bottom: 3px;
}

.service-map-customer-card .muted {
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

.service-map-card-body {
  padding: 16px;
}

.service-map-muted {
  color: #6b7280;
  font-size: 12px;
}

.service-map-hint {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 14px;
}

.service-map-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  align-items: start;
}

.service-map-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  min-width: 0;
}

.service-map-field label,
.service-map-section-label {
  font-size: 12px;
  font-weight: 800;
  color: #374151;
}

.service-map-field input,
.service-map-field select,
.service-map-field textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 14px;
  background: #fff;
  color: #111827;
  box-sizing: border-box;
  min-width: 0;
}

#serviceMapDetailCard,
#serviceMapDetailCard .service-map-card-body {
  overflow: visible;
}

.service-map-province-field {
  position: relative;
  z-index: 30;
}

.service-map-province-button {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 9px 36px 9px 10px;
  font-size: 14px;
  background: #fff;
  color: #111827;
  box-sizing: border-box;
  min-width: 0;
  text-align: left;
  cursor: pointer;
  position: relative;
}

.service-map-province-button::after {
  content: "▾";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  pointer-events: none;
}

.service-map-province-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 9999;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.18);
  padding: 6px;
}

.service-map-province-dropdown[hidden] {
  display: none;
}

.service-map-province-option {
  width: 100%;
  display: block;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #111827;
}

.service-map-province-option:hover,
.service-map-province-option.active {
  background: #e0f2fe;
  color: #075985;
  font-weight: 800;
}

.service-map-field textarea {
  min-height: 72px;
  resize: vertical;
}

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

.service-map-field:has(#smDescription) {
  grid-column: 1 / span 2;
}

.service-map-field:has(#smNote) {
  grid-column: span 2;
}

.service-map-material-section {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid #e5e7eb;
  padding-top: 12px;
  overflow: visible;
}

.service-map-material-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.service-map-material-heading #smAddItemBtn {
  width: auto;
  min-width: 118px;
  padding: 8px 12px;
  white-space: nowrap;
}

.service-map-items-box {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow-x: auto;
  width: 100%;
  box-sizing: border-box;
  overflow: visible;
}

.service-map-items-header,
.service-map-item-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) minmax(240px, 1.45fr) minmax(120px, 0.55fr) minmax(120px, 0.6fr) 58px;
  gap: 8px;
  align-items: center;
  padding: 8px;
  min-width: 860px;
  box-sizing: border-box;
  overflow: visible;
}

.service-map-items-header {
  background: #f9fafb;
  font-size: 12px;
  font-weight: 800;
  color: #4b5563;
  border-bottom: 1px solid #e5e7eb;
}

.service-map-item-row + .service-map-item-row {
  border-top: 1px solid #f3f4f6;
}

.service-map-item-row input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 9px;
  padding: 8px;
  box-sizing: border-box;
  min-width: 0;
}

.service-map-item-row input[data-item-field="qty"] {
  min-width: 120px;
  text-align: right;
}

.service-map-item-row button[data-remove-item] {
  padding-left: 10px;
  padding-right: 10px;
  white-space: nowrap;
}

.service-map-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0;
}

.service-map-btn {
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  background: #e5e7eb;
  color: #111827;
}

.service-map-btn.primary {
  background: #2563eb;
  color: #fff;
}

.service-map-btn.danger {
  background: #dc2626;
  color: #fff;
}

.service-map-btn.ghost {
  background: #f3f4f6;
  color: #374151;
}

.service-map-map-card #serviceMapCanvas {
  width: 100%;
  height: 430px;
  background: #e5e7eb;
}

.service-map-map-detail {
  border-top: 1px solid #e5e7eb;
  padding: 14px 16px;
  background: #f9fafb;
  font-size: 14px;
  line-height: 1.5;
}

.service-map-detail-title {
  font-weight: 800;
  margin-bottom: 6px;
}

.service-map-filter {
  display: grid;
  grid-template-columns: minmax(220px, 420px) minmax(150px, 210px) auto;
  justify-content: start;
  gap: 8px;
  align-items: end;
}

.service-map-table-wrap {
  overflow-x: auto;
  width: 100%;
}

.service-map-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  table-layout: fixed;
  font-size: 13px;
}

.service-map-table th,
.service-map-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-map-table th {
  background: #f9fafb;
  font-size: 12px;
  color: #374151;
  white-space: nowrap;
}

.service-map-table th:nth-child(1), .service-map-table td:nth-child(1) { width: 92px; }
.service-map-table th:nth-child(2), .service-map-table td:nth-child(2) { width: 118px; }
.service-map-table th:nth-child(3), .service-map-table td:nth-child(3) { width: 150px; }
.service-map-table th:nth-child(4), .service-map-table td:nth-child(4) { width: 135px; }
.service-map-table th:nth-child(5), .service-map-table td:nth-child(5) { width: 130px; }
.service-map-table th:nth-child(6), .service-map-table td:nth-child(6) { width: 115px; }
.service-map-table th:nth-child(7), .service-map-table td:nth-child(7) { width: 230px; }
.service-map-table th:nth-child(8), .service-map-table td:nth-child(8) { width: 145px; }
.service-map-table th:nth-child(9), .service-map-table td:nth-child(9) { width: 160px; }

.service-map-table td.actions {
  white-space: nowrap;
}

.service-map-item-list {
  margin: 8px 0 0;
  padding-left: 22px;
}

.service-map-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
}

.sm-smart-select {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: stretch;
  min-width: 0;
  z-index: 20;
}

.sm-smart-select input {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

.sm-smart-toggle {
  border: 1px solid #d1d5db;
  border-left: 0;
  border-radius: 0 9px 9px 0;
  background: #ffffff;
  color: #111827;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
}

.sm-smart-options {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 5px);
  z-index: 99999;
  max-height: 260px;
  overflow: auto;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
  padding: 6px;
}

.sm-smart-options[hidden] {
  display: none;
}

.sm-smart-option {
  width: 100%;
  border: 0;
  background: #ffffff;
  color: #111827;
  text-align: left;
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
  line-height: 1.35;
}

.sm-smart-option:hover,
.sm-smart-option:focus {
  background: #e0f2fe;
  color: #075985;
  outline: none;
}

.sm-smart-option strong {
  display: block;
  font-weight: 900;
  color: inherit;
}

.sm-smart-option span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: #64748b;
}

.service-map-card-list {
  display: grid;
  gap: 12px;
  padding: 0 16px 16px;
}

.service-map-point-card {
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #ffffff;
  padding: 14px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.service-map-point-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.service-map-point-card-no {
  color: #2563eb;
  font-weight: 900;
  margin-bottom: 4px;
}

.service-map-point-card-title {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 900;
  color: #111827;
  line-height: 1.35;
}

.service-map-point-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.service-map-point-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 14px;
  font-size: 13px;
  line-height: 1.45;
}

.service-map-point-card-grid b {
  display: block;
  color: #475569;
  font-size: 12px;
  margin-bottom: 2px;
}

.service-map-point-card-material {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.45;
}

.service-map-detail-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.55);
}

.service-map-detail-popup-overlay.active {
  display: flex;
}

.service-map-detail-popup-box {
  width: min(720px, 96vw);
  max-height: 88vh;
  overflow: auto;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.30);
  border: 1px solid #e5e7eb;
}

.service-map-detail-popup-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}

.service-map-detail-popup-head h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  color: #111827;
}

.service-map-detail-popup-body {
  padding: 18px 20px;
  line-height: 1.55;
  color: #111827;
}

.service-map-detail-popup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  margin-bottom: 14px;
}

.service-map-detail-popup-grid b {
  display: block;
  color: #475569;
  font-size: 12px;
  margin-bottom: 2px;
}

.service-map-detail-popup-actions {
  padding: 14px 20px 18px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 1100px) {
  .service-map-form-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

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

  .service-map-map-card #serviceMapCanvas {
    height: 380px;
  }
}

@media (max-width: 720px) {
  .service-map-form-grid,
  .service-map-filter {
    grid-template-columns: 1fr;
  }

  .service-map-items-header {
    display: none;
  }

  .service-map-item-row {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .service-map-map-card #serviceMapCanvas {
    height: 330px;
  }
}
