.field-map-card,
.map-card {
  position: relative;
}

.ups-map-data-legend {
  position: absolute;
  z-index: 520;
  left: 12px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100% - 96px);
  pointer-events: none;
}

.ups-map-data-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 3px 12px rgba(28, 50, 36, 0.16);
  color: #354a3b;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(5px);
}

.ups-map-data-legend span::before {
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(45, 60, 49, 0.18);
  content: "";
}

.ups-map-data-legend .is-history::before {
  background: #8a6432;
}

.ups-map-data-legend .is-live::before {
  background: #2f78a8;
}

.ups-live-tooltip {
  border: 1px solid rgba(44, 75, 57, 0.18);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 3px 10px rgba(29, 52, 38, 0.18);
  color: #244c35;
  font-size: 11px;
  font-weight: 800;
}

.ups-live-tooltip::before {
  border-top-color: rgba(255, 255, 255, 0.95);
}

.ups-map-detail {
  display: grid;
  gap: 6px;
  color: #293a2f;
  line-height: 1.45;
}

.ups-map-detail > strong {
  font-size: 17px;
}

.ups-map-detail > em {
  color: #6c786f;
  font-size: 12px;
}

.ups-map-detail-badge {
  justify-self: start;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f0e4ce;
  color: #68491f;
  font-size: 11px;
  font-weight: 800;
}

.ups-map-detail-live .ups-map-detail-badge {
  background: #dbeaf4;
  color: #235b7e;
}

.ups-map-detail-lines {
  display: grid;
  gap: 3px;
  padding-top: 3px;
  border-top: 1px solid #e2e8e3;
  font-size: 12px;
}

.ups-map-detail-lines span {
  display: block;
}

.ups-map-detail p {
  margin: 3px 0 0;
  padding: 7px 9px;
  border-radius: 8px;
  background: #fff4df;
  color: #6e4b18;
  font-size: 12px;
  font-weight: 700;
}

.ups-share-control {
  display: grid;
  grid-template-columns: auto minmax(90px, 1fr);
  align-items: center;
  gap: 5px 10px;
  margin: 8px 0 12px;
  padding: 10px 12px;
  border: 1px solid #ccddd0;
  border-radius: 13px;
  background: #f7fbf8;
}

.ups-share-control label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #244d35;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.ups-share-control input {
  width: 18px;
  height: 18px;
  accent-color: #2c6a45;
}

.ups-share-name {
  justify-self: end;
  max-width: 180px;
  padding: 5px 9px;
  overflow: hidden;
  border: 1px solid #b8cec0;
  border-radius: 9px;
  background: #fff;
  color: #315b41;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.ups-share-status {
  grid-column: 1 / -1;
  color: #6a786e;
  font-size: 11px;
}

.ups-share-status.is-success {
  color: #247044;
}

.ups-share-status.is-warning {
  color: #a14c30;
}

.ups-history-card {
  width: min(980px, calc(100vw - 24px));
}

.ups-history-toolbar {
  flex-wrap: wrap;
}

.ups-history-notice {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #cddbd1;
  border-radius: 10px;
  background: #f3f8f4;
  color: #355641;
  line-height: 1.55;
}

.ups-history-notice.is-success {
  border-color: #a8ceb4;
  background: #eaf7ed;
  color: #21653c;
}

.ups-history-notice.is-warning {
  border-color: #e6c8a9;
  background: #fff5e9;
  color: #8d4e22;
}

.ups-history-summary {
  display: block;
  margin: 14px 0 5px;
  color: #244d35;
  font-size: 15px;
}

.ups-history-requirement,
.ups-history-table-note,
.ups-history-import-report {
  margin: 5px 0 10px;
  color: #66736a;
  font-size: 12px;
  line-height: 1.55;
}

.ups-history-import-report {
  padding: 8px 10px;
  border: 1px solid #e7c59e;
  border-radius: 9px;
  background: #fff6e9;
  color: #8a4d22;
}

.ups-historical-records {
  display: grid;
  gap: 10px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px dashed #cfb78f;
}

.ups-historical-records > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 0 3px;
  color: #654a26;
}

.ups-historical-records > header strong {
  font-size: 14px;
}

.ups-historical-records > header small {
  color: #85725a;
  font-size: 11px;
  text-align: right;
}

.ups-history-record-search {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid #d4c3a4;
  border-radius: 10px;
  background: #fffdf8;
  color: #3f4f43;
  font: inherit;
  font-size: 13px;
}

.ups-history-record-result {
  color: #7a6c58;
  font-size: 11px;
}

.ups-history-record-cards {
  display: grid;
  gap: 10px;
}

.record-list .ups-history-record-card {
  border-color: #decdae;
  background: linear-gradient(135deg, #fffdf8, #fbf5e9);
}

.ups-history-record-badge {
  background: #8a6432 !important;
}

.ups-history-record-view {
  border-color: #ceb992 !important;
  background: #fffaf0 !important;
  color: #6b4b21 !important;
}

.ups-history-record-readonly {
  margin-bottom: 12px;
  padding: 9px 11px;
  border: 1px solid #dcc69f;
  border-radius: 10px;
  background: #fff8e9;
  color: #6d4c20;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.ups-history-record-detail {
  width: min(720px, calc(100vw - 24px));
}

.ups-history-record-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ups-history-record-detail-grid > div {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid #e1e7e2;
  border-radius: 9px;
  background: #fbfdfb;
}

.ups-history-record-detail-grid span {
  color: #758078;
  font-size: 11px;
}

.ups-history-record-detail-grid strong {
  overflow-wrap: anywhere;
  color: #304737;
  font-size: 13px;
}

.ups-history-table-wrap {
  max-height: 48vh;
  overflow: auto;
  border: 1px solid #d9e2db;
  border-radius: 11px;
  background: #fff;
}

.ups-history-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  white-space: nowrap;
}

.ups-history-table-wrap th,
.ups-history-table-wrap td {
  padding: 9px 10px;
  border-bottom: 1px solid #e6ebe7;
  text-align: left;
}

.ups-history-table-wrap th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: #edf4ef;
  color: #2f513b;
}

@media (max-width: 680px) {
  .ups-history-record-detail-grid {
    grid-template-columns: 1fr;
  }

  .ups-historical-records > header {
    align-items: flex-start;
    flex-direction: column;
  }

  .ups-historical-records > header small {
    text-align: left;
  }

  .ups-map-data-legend {
    left: 8px;
    bottom: 8px;
    max-width: calc(100% - 86px);
  }

  .ups-map-data-legend span {
    min-height: 25px;
    padding: 3px 7px;
    font-size: 10px;
  }

  .ups-share-control {
    grid-template-columns: 1fr auto;
  }

  .ups-history-card {
    width: calc(100vw - 12px);
  }
}
