body.address-editor-open { overflow: hidden; }

.address-editor-wrap {
  position: fixed;
  z-index: 13000;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  font-family: var(--font-ui);
}

.address-editor-wrap.open { display: flex; }

.address-editor-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 18, 70, .58);
  backdrop-filter: blur(2px);
}

.address-editor-modal {
  position: relative;
  width: min(640px, calc(100vw - 36px));
  max-height: min(610px, calc(100vh - 36px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 8px;
  box-shadow: 0 24px 65px rgba(0, 19, 89, .28);
}

.address-editor-modal::before {
  content: '';
  height: 3px;
  flex: 0 0 3px;
  background: var(--accent);
}

.address-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 17px 13px;
  border-bottom: 1px solid var(--border);
}

.address-editor-head span { color: var(--accent); font: 850 8px var(--font-ui); text-transform: uppercase; }
.address-editor-head h2 { margin: 3px 0 0; color: var(--text); font: 850 15px/1.2 var(--font-ui); }
.address-editor-head p { margin: 5px 0 0; color: var(--text-muted); font: 600 10px/1.4 var(--font-ui); }

.address-editor-icon-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
}

.address-editor-icon-btn:hover,
.address-editor-icon-btn:focus-visible { color: var(--accent); background: var(--accent-dim); border-color: color-mix(in srgb, var(--accent) 30%, transparent); outline: 0; }
.address-editor-icon-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 2; }

.address-editor-body {
  min-height: 0;
  padding: 16px 17px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.address-editor-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 11px;
}

.address-editor-grid label { min-width: 0; display: grid; gap: 5px; }
.address-editor-grid label > span { color: var(--text-dim); font: 800 9px var(--font-ui); text-transform: uppercase; }
.address-editor-grid .span-2 { grid-column: span 2; }
.address-editor-grid .span-4 { grid-column: span 4; }
.address-editor-grid .span-5 { grid-column: span 5; }
.address-editor-grid .span-7 { grid-column: span 7; }
.address-editor-grid .span-8 { grid-column: span 8; }

.address-editor-grid input {
  width: 100%;
  height: 36px;
  min-width: 0;
  box-sizing: border-box;
  padding: 0 10px;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  font: 650 11px var(--font-ui);
}

.address-editor-grid input:focus-visible,
.address-editor-cep-control button:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent); outline: 0; }

.address-editor-cep-control { display: grid; grid-template-columns: minmax(0, 1fr) 36px; }
.address-editor-cep-control input { border-radius: 8px 0 0 8px; }
.address-editor-cep-control button {
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 0 8px 8px 0;
  cursor: pointer;
}
.address-editor-cep-control button:disabled { opacity: .65; cursor: wait; }
.address-editor-cep-control svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 2; }

.address-editor-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255,255,255,.38);
  border-top-color: #fff;
  border-radius: 50%;
  animation: address-editor-spin .7s linear infinite;
}

.address-editor-status {
  min-height: 34px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  margin-top: 13px;
  padding: 8px 10px;
  color: var(--text-dim);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font: 650 10px/1.35 var(--font-ui);
}

.address-editor-status.is-loading { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 38%, var(--border)); }
.address-editor-status.is-success { color: #17834f; background: color-mix(in srgb, #17834f 7%, var(--surface)); border-color: color-mix(in srgb, #17834f 30%, var(--border)); }
.address-editor-status.is-error { color: var(--danger); background: color-mix(in srgb, var(--danger) 7%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }

.address-editor-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 11px 17px;
  background: var(--surface2);
  border-top: 1px solid var(--border);
}

.jarbis-scrollbar { scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb, var(--border2)) transparent; }
.jarbis-scrollbar::-webkit-scrollbar { width: 5px; height: 5px; }
.jarbis-scrollbar::-webkit-scrollbar-track { background: transparent; }
.jarbis-scrollbar::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb, var(--border2)); border-radius: 8px; }

html[data-theme='dark'] .address-editor-modal { box-shadow: 0 24px 70px rgba(0, 0, 0, .58); }

@keyframes address-editor-spin { to { transform: rotate(360deg); } }

@media (max-width: 620px) {
  .address-editor-wrap { padding: 10px; }
  .address-editor-modal { width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
  .address-editor-grid > * { grid-column: 1 / -1 !important; }
}

@media (prefers-reduced-motion: reduce) {
  .address-editor-spinner { animation-duration: 1.4s; }
}
