.hm-osm-metadata {
  margin: 12px 0;
  border: 1px solid #d7e1e9;
  border-radius: 9px;
  background: #f8fafc;
}
.hm-osm-metadata summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  cursor: pointer;
  color: #173b5b;
}
.hm-osm-metadata summary span {
  color: #526170;
  font-size: 0.85em;
  text-align: right;
  overflow-wrap: anywhere;
}
.hm-osm-metadata-fields {
  display: grid;
  gap: 10px;
  padding: 0 13px 13px;
}
.hm-osm-metadata-fields label {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.hm-osm-metadata-fields input {
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #b8c8d6;
  border-radius: 6px;
  background: #fff;
  color: #102c45;
  font: inherit;
}
.hm-osm-metadata-fields small { color: #526170; }
.hm-edit-provenance { display: block; margin: 5px 0; color: #526170; overflow-wrap: anywhere; }
.hm-edit-toolbar-button {
  position: relative;
  color: #173b5b;
  font: 700 19px/1 system-ui, sans-serif;
}
.hm-edit-pending-sync {
  padding: 14px;
  border: 1px solid #d2a64b;
  border-radius: 8px;
  background: #fffaf0;
}
.hm-edit-pending-sync h3 { margin: 0 0 10px; }
.hm-edit-sync-conflict {
  margin: 10px 0;
  padding: 12px;
  border: 1px solid #e2c990;
  border-radius: 8px;
  background: #fff;
}
.hm-edit-sync-conflict h4 { margin: 0; }
.hm-edit-sync-versions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 10px;
  margin: 10px 0;
}
.hm-edit-sync-versions div {
  min-width: 0;
  overflow-wrap: anywhere;
  display: flex;
  flex-direction: column;
  padding: 8px;
  border-radius: 6px;
  background: #f3f6f9;
}
.hm-edit-sync-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.hm-edit-toolbar-button.active { color: #c52b3d; }
.hm-edit-toolbar-button.has-pending::before,
.hm-edit-control button.has-pending::before {
  content: '!';
  position: absolute;
  left: -7px;
  bottom: -7px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #a55a00;
  color: #fff;
  font: 800 12px/1 system-ui, sans-serif;
}
.hm-edit-toolbar-button[data-count]:not([data-count=""])::after {
  content: attr(data-count);
  position: absolute;
  top: -8px;
  right: -9px;
  min-width: 18px;
  padding: 2px 4px;
  border-radius: 20px;
  background: #c52b3d;
  color: #fff;
  font: 700 11px/1.2 system-ui, sans-serif;
}
.hm-mobile .hm-edit-toolbar-button { order: 1; }
.survey-work-map .hm-edit-control {
  position: relative;
  z-index: 1;
  overflow: visible;
  border: 1px solid #c7d3df;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(18, 32, 48, 0.18);
}
.survey-work-map .hm-edit-control button {
  width: 42px;
  height: 42px;
  border-radius: 7px;
}
@media (max-width: 767px) {
  .survey-work-map .hm-edit-control button {
    width: 44px;
    height: 44px;
  }
}
.hm-edit-control button {
  position: relative;
  width: 34px;
  height: 34px;
  border: 0;
  background: #fff;
  color: #173b5b;
  font: 700 19px/1 system-ui, sans-serif;
  cursor: pointer;
}
.hm-edit-control button.active { color: #c52b3d; }
.hm-edit-control button[data-count]:not([data-count=""])::after {
  content: attr(data-count);
  position: absolute;
  top: -8px;
  right: -9px;
  min-width: 18px;
  padding: 2px 4px;
  border-radius: 20px;
  background: #c52b3d;
  color: #fff;
  font: 700 11px/1.2 system-ui, sans-serif;
}
.hm-edit-dialog {
  box-sizing: border-box;
  width: min(760px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  height: min(900px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  border: 1px solid #c7d3df;
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 18px 60px #102c4566;
  color: #17344b;
  background: #fff;
  z-index: 11000;
}
.hm-edit-dialog::backdrop { background: #102c45a6; }
.hm-edit-dialog-content {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  font: 15px/1.45 system-ui, sans-serif;
}
.hm-edit-dialog header,
.hm-edit-dialog footer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.hm-edit-dialog header { justify-content: space-between; }
.hm-edit-dialog header,
.hm-edit-dialog footer,
.hm-edit-steps { flex-shrink: 0; }
.hm-edit-dialog footer { padding-top: 12px; border-top: 1px solid #d8e0e7; background: #fff; }
.hm-edit-dialog h2, .hm-edit-dialog h3 { margin: 0; }
.hm-edit-dialog button {
  min-height: 36px;
  border: 1px solid #b8c9d9;
  border-radius: 6px;
  padding: 6px 12px;
  color: #173b5b;
  background: #fff;
  cursor: pointer;
}
.hm-edit-dialog button:disabled { opacity: .48; cursor: not-allowed; }
.hm-edit-dialog .hm-edit-primary { color: #fff; background: #116b9e; border-color: #116b9e; }
.hm-edit-dialog footer [data-edit-cancel] + [data-edit-review],
.hm-edit-dialog footer [data-edit-next] {
  color: #205b35;
  background: #e8f5eb;
  border-color: #a9d2b3;
  font-weight: 700;
}
.hm-edit-dialog footer [data-edit-cancel] + [data-edit-review]:hover:not(:disabled),
.hm-edit-dialog footer [data-edit-next]:hover:not(:disabled) {
  background: #d9efdf;
  border-color: #83be93;
}
.hm-edit-list { margin: 0; padding-left: 24px; }
.hm-edit-list li { padding: 7px 0; border-bottom: 1px solid #e8edf2; }
.hm-edit-list small { color: #617181; }
.hm-edit-kind { display: inline-block; min-width: 78px; font-weight: 700; }
.hm-edit-kind.create { color: #17834b; }
.hm-edit-kind.modify { color: #176fba; }
.hm-edit-kind.delete { color: #bc283c; }
.hm-edit-comment { display: flex; flex-direction: column; gap: 5px; }
.hm-edit-comment input { min-height: 40px; padding: 7px; border: 1px solid #b8c9d9; border-radius: 6px; font: inherit; }
.hm-edit-review-row { min-width: 0; padding: 12px; border: 1px solid #d8e0e7; border-radius: 8px; overflow-wrap: anywhere; }
.hm-edit-conflict, .hm-edit-warning, .hm-edit-error { padding: 9px; border-radius: 6px; background: #fff3e1; }
.hm-edit-error { color: #9a2236; background: #fff0f1; }
.hm-edit-ready { color: #116339; font-weight: 700; }
.hm-edit-review-mode { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; border-radius: 8px; background: #edf7fc; }
.hm-edit-review-mode button { margin-left: auto; }
.hm-edit-outcome-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hm-edit-outcome-counts span { padding: 9px; border-radius: 7px; background: #f2f6f9; text-align: center; }
.hm-edit-outcome { display: inline-block; margin: 4px 0 10px 8px; padding: 2px 7px; border-radius: 10px; background: #e9f3fa; color: #174d72; font-size: 12px; font-weight: 700; }
.hm-edit-review-skipped { background: #f7f8f9; border-color: #cbd3da; }
.hm-edit-review-skipped .hm-edit-outcome { background: #e6e9ec; color: #475664; }
.hm-edit-duplicate-candidate { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 12px; margin: 8px 0; padding: 10px; border: 1px solid #e2c990; border-radius: 7px; background: #fffaf0; }
.hm-edit-duplicate-candidate small { flex: 1 1 180px; overflow-wrap: anywhere; }
.hm-edit-duplicate-candidate button { min-height: 42px; }
.hm-edit-duplicate-map { box-sizing: border-box; width: 100%; min-height: 225px; border: 1px solid #cbd7e2; border-radius: 8px; overflow: hidden; }
.hm-edit-confirm { display: flex; align-items: center; gap: 8px; }
@media (max-width: 600px) {
  .hm-edit-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; }
  .hm-edit-dialog-content { padding: 14px; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .hm-edit-dialog header [data-edit-close] { width: 44px; min-width: 44px; min-height: 44px; padding: 0; font-size: 24px; }
  .hm-edit-dialog footer { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-top: 10px; }
  .hm-edit-dialog footer button { width: 100%; min-width: 0; min-height: 50px; font-size: 15px; line-height: 1.25; }
  .hm-edit-dialog footer [data-edit-close] { display: none; }
  .hm-edit-dialog footer [data-edit-back],
  .hm-edit-dialog footer [data-edit-next] { min-height: 56px; font-size: 17px; font-weight: 700; }
  .hm-edit-outcome-counts { grid-template-columns: 1fr 1fr; }
  .hm-edit-outcome-counts span:last-child { grid-column: 1 / -1; }
  .hm-edit-review-mode button { width: 100%; }
}

.hm-edit-diff { width: 100%; table-layout: fixed; border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.hm-edit-diff th, .hm-edit-diff td { border: 1px solid #d8e0e7; padding: 5px; text-align: left; overflow-wrap: anywhere; }
.hm-edit-change-list { display: grid; gap: 1px; overflow: hidden; border: 1px solid #d8e0e7; border-radius: 8px; background: #d8e0e7; }
.hm-edit-change-row { min-width: 0; display: grid; gap: 7px; padding: 10px 12px; background: #fff; }
.hm-edit-change-label { overflow-wrap: anywhere; }
.hm-edit-change-values { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 9px; align-items: center; }
.hm-edit-change-origin { width: fit-content; padding: 2px 7px; border-radius: 10px; color: #705016; background: #fff1d7; font-size: 12px; font-weight: 650; }
.hm-edit-change-external { margin: 0; color: #52697c; overflow-wrap: anywhere; }
.hm-edit-change-values span, .hm-edit-conflict-values span { min-width: 0; }
.hm-edit-change-values small, .hm-edit-conflict-values small { display: block; margin-bottom: 3px; color: #617181; font-size: 12px; }
.hm-edit-change-values bdi, .hm-edit-conflict-values bdi { display: block; overflow-wrap: anywhere; font-weight: 650; }
.hm-edit-change-arrow { color: #617181; font-weight: 700; }
.hm-edit-conflict-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 8px 0 12px; }
.hm-edit-raw-tags { margin-top: 10px; font-size: 12px; }
.hm-edit-raw-tags summary { width: fit-content; cursor: pointer; color: #52697c; }
.hm-edit-raw-tags div { display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #e8edf2; }
.hm-edit-raw-tags code, .hm-edit-raw-tags span { overflow-wrap: anywhere; }

.hm-edit-dialog main { display: flex; flex: 1 1 auto; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
.hm-edit-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 4px 0 10px; background: #fff; }
.hm-edit-steps button { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; min-height: 48px; overflow-wrap: anywhere; }
.hm-edit-steps button b { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; color: #fff; background: #7890a4; }
.hm-edit-steps button.active { border-color: #116b9e; color: #116b9e; background: #edf7fc; }
.hm-edit-steps button.active b { background: #116b9e; }
.hm-edit-summary { padding: 14px; border: 1px solid #d8e0e7; border-radius: 9px; background: #f8fafc; }
.hm-edit-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.hm-edit-counts span { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-left: 4px solid #7890a4; border-radius: 6px; background: #fff; }
.hm-edit-counts span.create { border-color: #17834b; }
.hm-edit-counts span.modify { border-color: #176fba; }
.hm-edit-counts span.delete { border-color: #bc283c; }
.hm-edit-counts span.local { border-color: #7052a3; }
.hm-edit-counts b { font-size: 20px; }
.hm-edit-preview-map { box-sizing: border-box; width: 100%; min-height: 300px; border: 1px solid #cbd7e2; border-radius: 9px; overflow: hidden; }
.hm-edit-operation-form { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; padding: 12px; border-radius: 8px; background: #f3f7fa; }
.hm-edit-operation-form h4 { margin: 0; }
.hm-edit-operation-form label { display: flex; flex-direction: column; gap: 4px; }
.hm-edit-operation-form input { box-sizing: border-box; width: 100%; min-height: 38px; padding: 6px 8px; border: 1px solid #b8c9d9; border-radius: 5px; font: inherit; }
.hm-edit-coordinate-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hm-edit-tag-row { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr) auto; gap: 7px; margin: 6px 0; }
.hm-edit-kind.local { color: #7052a3; }
@media (max-width: 700px) {
  .hm-edit-steps { grid-template-columns: repeat(4, 1fr); gap: 3px; }
  .hm-edit-steps button { min-width: 0; padding: 5px 2px; flex-direction: column; font-size: 11px; }
  .hm-edit-steps button b { width: 22px; height: 22px; }
  .hm-edit-counts { grid-template-columns: 1fr 1fr; }
  .hm-edit-preview-map { min-height: 240px; }
  .hm-edit-coordinate-row, .hm-edit-tag-row { grid-template-columns: 1fr; }
}
