:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #66707a;
  --line: #dfe4e8;
  --accent: #0b6b57;
  --accent-2: #0e8a70;
  --danger: #b3261e;
  --warn: #9a6700;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 25, 35, .08), 0 4px 14px rgba(15, 25, 35, .05);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

h1 { font-size: 20px; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 18px; margin: 0; }

.muted { color: var(--muted); }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.field-label { display: inline-flex; align-items: center; gap: 3px; }
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  text-transform: none;
  cursor: help;
}
.info-btn:hover { background: #eef2f4; color: var(--ink); }
.info-btn:focus-visible { outline: 2px solid rgba(14, 138, 112, .45); background: #eef2f4; color: var(--ink); }

.tooltip-bubble {
  position: fixed;
  z-index: 3000;
  max-width: min(300px, calc(100vw - 16px));
  padding: 8px 10px;
  border-radius: 8px;
  background: #17212b;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: normal;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  pointer-events: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.brand { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.brand .muted { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.loading-status {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  transition: opacity .45s ease;
}
.loading-status.fade-out { opacity: 0; }

.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.status { font-size: 12px; color: var(--muted); }

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px 12px;
  padding: 12px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 100;
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}

.filters .grow { grid-column: span 2; }
.filters > :not(.filters-skeleton) { transition: opacity .15s ease; }
.filters-extra { display: contents; }
.filters-head { display: none; }
.filters .check {
  grid-column: span 2;
  flex-direction: row;
  align-items: center;
  align-self: end;
  gap: 6px;
  padding-bottom: 7px;
  text-transform: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}
.filters label.filter-active { color: var(--accent); }
.filters label.filter-active .field-label { color: var(--accent); }
.filters label.filter-active > input,
.filters label.filter-active > select,
.filters label.filter-active .search-wrap input,
.filters label.filter-active [data-combo] input,
.filters label.filter-active [data-combo] .combo-toggle {
  border-color: var(--accent);
  background: #f1faf7;
}

.filters-skeleton {
  display: none;
  position: absolute;
  inset: 12px 16px;
  z-index: 4;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px 12px;
  background: var(--panel);
}
body.is-loading .filters-skeleton { display: grid; }
body.is-loading .filters > :not(.filters-skeleton) { opacity: 0; pointer-events: none; }
.skeleton-field { display: flex; flex-direction: column; gap: 4px; }

.filters-backdrop {
  position: fixed;
  inset: 0;
  z-index: 940;
  background: rgba(10, 18, 25, .45);
}

.applied-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.applied-bar .filters-btn { display: none; flex: 0 0 auto; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}
.chip:hover { background: #f1f4f6; border-color: #c9d0d5; }
.chip:focus-visible { outline: 2px solid rgba(14, 138, 112, .45); outline-offset: 1px; }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.quick-filters {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
.quick-filters .chip { padding: 4px 7px; }

.search-wrap { position: relative; width: 100%; }
.search-suggestions {
  position: absolute;
  z-index: 1200;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .15);
}
.search-suggestions[hidden] { display: none; }
.search-suggestions li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
}
.search-suggestions li:hover,
.search-suggestions li[aria-selected="true"] { background: #eef2f5; }
.suggestion-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion-kind {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}

.view-toggle { display: none; }

@media (min-width: 768px) {
  .applied-bar { display: none; }
}

input, select, textarea, button { font: inherit; }

input, select {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 34px;
}

input[type="checkbox"] {
  width: 16px;
  min-width: 16px;
  max-width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(14, 138, 112, .35);
  border-color: var(--accent-2);
}

select:disabled { background: #f1f3f5; color: #8a9299; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}

.btn:hover { background: #f6f8f9; border-color: #c9d0d5; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small { padding: 5px 9px; font-size: 12px; }
.btn.danger { color: var(--danger); border-color: #e7c4c1; }
.btn.danger:hover { background: #fdf1f0; }
.btn.more { margin: 8px auto 24px; display: flex; }

main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 42%);
  gap: 12px;
  padding: 12px 16px 0;
  align-items: start;
}

.list-panel { min-width: 0; }

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.list-head #count { flex: 0 0 210px; width: 210px; font-size: 13px; white-space: nowrap; }
.list-head .sort { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); flex: 0 0 204px; margin-left: auto; }
.list-head .sort select { width: 148px; min-height: 30px; padding: 4px 8px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.card.excluded { opacity: .65; border-style: dashed; }

.skeleton-bar {
  display: block;
  border-radius: 6px;
  background: linear-gradient(90deg, #e6eaee 25%, #f1f4f6 37%, #e6eaee 63%);
  background-size: 400% 100%;
  animation: skeleton-pulse 1.3s ease-in-out infinite;
}
@keyframes skeleton-pulse {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
.skeleton-label { width: 45%; height: 9px; }
.skeleton-input { width: 100%; height: 34px; }
.skeleton-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.skeleton-thumb { width: 100%; aspect-ratio: 4 / 3; border-radius: 0; }
.skeleton-body { padding: 10px 11px 11px; display: flex; flex-direction: column; gap: 8px; }
.skeleton-line { height: 11px; }
.skeleton-line.w70 { width: 70%; }
.skeleton-line.w40 { width: 40%; }
.skeleton-line.w60 { width: 60%; }
.skeleton-pill { width: 55%; height: 20px; border-radius: 999px; margin-top: 2px; }

.thumb {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  background: #e9edf0;
  overflow: hidden;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .25s;
}

.thumb:hover img { transform: scale(1.03); }

.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}

.badge.adjusted { left: auto; right: 8px; background: #1d4ed8; }
.badge.excluded-badge { left: auto; right: 8px; background: var(--danger); }

.card-body { padding: 10px 11px 11px; display: flex; flex-direction: column; gap: 6px; flex: 1; }

.price-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.price-row strong { font-size: 17px; letter-spacing: -.02em; }
.price-row .muted { font-size: 11px; }
.price-row .valuation {
  margin-left: auto;
  min-width: 0;
  max-width: 100%;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.custom-value-line { font-size: 12px; font-weight: 600; color: #1e3a8a; }

.profit {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profit.negative { color: var(--danger); }

.addr {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: #39434c;
  min-height: 34px;
}
.addr-line {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: normal;
}
.addr-link {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-right: 14px;
  color: inherit;
  text-decoration: none;
}
.addr-link::after {
  content: "↗";
  position: absolute;
  top: 0;
  right: 0;
  font-size: 10px;
  line-height: 1.4;
  color: var(--muted);
}
.addr-link:hover .addr-line {
  color: var(--accent);
  text-decoration: underline;
}
.addr-link:hover::after { color: var(--accent); }
.addr-link:focus-visible {
  outline: 2px solid rgba(14, 138, 112, .45);
  outline-offset: 2px;
  border-radius: 4px;
}
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef2f4;
  color: #4a555f;
  white-space: nowrap;
}
.tag.fin { background: #e8f3ef; color: var(--accent); }
.tag.source { background: transparent; padding-left: 0; padding-right: 0; font-weight: 700; }
.tag.source-caixa { color: #0057b8; }
.tag.source-bb { color: #b8860b; }
.tag.source-santander { color: #d71920; }
.tag.source-itau { color: #ec7000; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}
.status-badge.fin { background: #e6f4ee; color: #0a5c47; }
.status-badge.no-fin { background: #fdecea; color: #8f1d18; }
.status-badge.needs-value { background: #fff4d6; color: #6b4a00; }
.status-badge.custom-value { background: #e8edfb; color: #1e3a8a; }

.card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }

.map-panel {
  position: sticky;
  top: 76px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#map { height: calc(100vh - 220px); min-height: 360px; width: 100%; background: #dfe7ec; }

.map-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  flex-wrap: wrap;
}

.map-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.map-status { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }

.layer-switch {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.layer-switch .layer-btn {
  border: 0;
  border-radius: 0;
  background: #fff;
  padding: 5px 8px;
  color: var(--ink);
  font-size: 12px;
}
.layer-switch .layer-btn + .layer-btn { border-left: 1px solid var(--line); }
.layer-switch .layer-btn:hover { background: #f6f8f9; }
.layer-switch .layer-btn.active { background: var(--accent); color: #fff; }

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty-title { margin: 0 0 6px; font-size: 15px; font-weight: 700; color: var(--ink); }
.empty-reason { margin: 0 auto 14px; max-width: 480px; }
.empty-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }

dialog {
  width: min(980px, 95vw);
  max-height: 90vh;
  border: 0;
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

dialog::backdrop { background: rgba(10, 18, 25, .45); }

dialog.notice-dialog { width: min(640px, 95vw); }
dialog.feedback-dialog { width: min(760px, 95vw); }
dialog.help-dialog { width: min(860px, 95vw); }
dialog.confirm-dialog { width: min(440px, 92vw); }
.confirm-form { padding: 20px; }
.confirm-form p { margin: 10px 0 0; color: #39434c; }
dialog.adjust-dialog { width: min(540px, 94vw); }
.adjust-form { padding: 20px; }
.adjust-form h2 { margin: 0 0 8px; }
.adjust-form p { margin: 0 0 12px; font-size: 13px; line-height: 1.5; color: #39434c; }
.adjust-context {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
  padding: 10px;
  background: #f6f8f9;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.adjust-context dt {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.adjust-context dd { margin: 2px 0 0; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.adjust-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.adjust-field input { font-weight: 500; letter-spacing: normal; text-transform: none; }
.form-error { margin: 8px 0 0; color: var(--danger); font-size: 12px; font-weight: 600; }
.adjust-dialog .dialog-actions { margin-top: 16px; flex-wrap: wrap; }
.help-form { padding: 22px; max-height: 88vh; overflow: auto; }
.help-form h3 { margin: 20px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.help-form h3:first-of-type { margin-top: 10px; }
.help-form p, .help-form li { font-size: 13px; line-height: 1.55; color: #39434c; }
.help-form ul { margin: 6px 0 14px 20px; padding: 0; }
.help-form li { margin: 5px 0; }
.help-form code { background: #eef2f4; padding: 1px 4px; border-radius: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--ink); }
.help-form pre { margin: 8px 0 14px; padding: 10px; overflow-x: auto; background: #f6f8f9; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; line-height: 1.5; }
.help-form pre code { background: transparent; padding: 0; }
.help-table-wrap { overflow-x: auto; }
.help-table { width: 100%; border-collapse: collapse; margin: 6px 0 14px; font-size: 12.5px; }
.help-table th, .help-table td { padding: 6px 8px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.help-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.help-table td:first-child { white-space: nowrap; font-weight: 600; }
.help-note { background: #fff8e6; border-left: 3px solid var(--warn); border-radius: 6px; padding: 8px 10px; margin: 10px 0 14px; }
.feedback-form { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.feedback-hint { font-size: 12px; margin: 0 0 4px; }
.feedback-frame { width: 100%; height: min(68vh, 700px); border: 0; border-radius: 8px; background: #fff; }
.feedback-foot { display: flex; justify-content: flex-end; font-size: 12px; }
.notice-form { padding: 22px; }
.notice-form h2 { margin: 0 0 12px; }
.notice-form p { margin: 0 0 12px; font-size: 14px; line-height: 1.55; color: #39434c; }
.notice-form p:last-of-type { margin-bottom: 0; }
.notice-form strong { color: var(--ink); }
.notice-consent { display: flex; align-items: flex-start; gap: 8px; margin: 14px 0 0; font-size: 13px; line-height: 1.45; color: #39434c; cursor: pointer; }
.notice-consent input { margin-top: 3px; flex: 0 0 16px; }
.notice-consent span { flex: 1 1 auto; min-width: 0; }
.notice-decline-hint { margin-top: 10px !important; font-size: 12px !important; color: var(--muted) !important; }
.link-button { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.notice-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.config-form { padding: 18px; overflow: auto; max-height: 88vh; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.config-form p { margin: 6px 0 14px; font-size: 12px; }
.config-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.config-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.config-title { margin: 18px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.config-hint { margin: -4px 0 4px !important; }
.config-costs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.input-group { display: flex; gap: 6px; }
.input-group select { width: 42%; }
.input-group input { width: 58%; }
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.4;
  resize: vertical;
  background: #fbfcfd;
}
.dialog-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 14px; }

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 2000;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: 10px;
  background: #17212b;
  color: #fff;
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.actionable { pointer-events: auto; }
.toast.error { background: var(--danger); }
.toast-action {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.toast-action:hover { background: rgba(255, 255, 255, .14); }
.toast-action:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Leaflet popups */
.popup { width: 230px; }
.popup img { width: 100%; height: 140px; object-fit: cover; border-radius: 6px; display: block; margin-bottom: 6px; background: #e9edf0; }
.popup strong { font-size: 15px; }
.popup .line { font-size: 12px; color: #39434c; margin-top: 3px; }
.popup a { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--accent); }

/* Combo (typeahead) components */
[data-combo] { position: relative; }
[data-combo] .combo-control { display: flex; align-items: stretch; }
[data-combo] input { width: 100%; border: 1px solid var(--line); border-right: 0; border-radius: 8px 0 0 8px; padding: 7px 9px; min-height: 34px; background: #fff; color: var(--ink); }
[data-combo] input:focus { outline: 2px solid rgba(14, 138, 112, .35); border-color: var(--accent-2); }
[data-combo] .combo-toggle { width: 34px; border: 1px solid var(--line); border-radius: 0 8px 8px 0; background: #fbfcfd; cursor: pointer; color: var(--muted); display: flex; align-items: center; justify-content: center; }
[data-combo] .combo-toggle:hover { color: var(--ink); background: #f1f3f5; }
[data-combo] input:disabled { background: #f1f3f5; color: #8a9299; }
[data-combo] .combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 1000; max-height: 240px; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.15); list-style: none; margin: 0; padding: 4px; }
[data-combo] .combo-empty { padding: 8px 10px; font-size: 12px; color: var(--muted); }
[data-combo] .combo-option { padding: 8px 10px; border-radius: 6px; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[data-combo] .combo-option:hover, [data-combo] .combo-option.active { background: #eef2f5; }
[data-combo] .combo-option.selected { font-weight: 700; color: var(--accent); }
[data-combo]:not(.open) .combo-list { display: none; }
[data-combo].disabled .combo-toggle { background: #f1f3f5; color: #c0c7cd; cursor: default; }

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; }
  .map-panel { position: static; order: -1; }
  #map { height: 45vh; min-height: 300px; }
  .filters .grow { grid-column: span 1; }
  .config-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .actions { width: 100%; justify-content: flex-start; }
  .brand { width: 100%; flex-wrap: wrap; }
  .notice-form { padding: 18px; }
  .feedback-form { padding: 14px; }
  .feedback-frame { height: 66vh; }
  .help-form { padding: 16px; }
  .help-table { font-size: 12px; }
  .empty-actions { flex-direction: column; }
  .empty-actions .btn { width: 100%; }
  .adjust-context { grid-template-columns: 1fr; }
  .adjust-dialog .dialog-actions .btn { flex: 1 1 auto; }
}

@media (max-width: 767px) {
  body.filters-open { overflow: hidden; }

  .topbar { position: static; }
  .applied-bar {
    position: sticky;
    top: 0;
    z-index: 450;
    padding: 8px 12px;
  }
  .applied-bar .filters-btn { display: inline-flex; }

  .filters {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(88vw, 360px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    overflow-y: auto;
    z-index: 1000;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    box-shadow: 0 0 40px rgba(10, 18, 25, .25);
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform .2s ease, visibility .2s ease;
  }
  body.filters-open .filters { transform: translateX(0); visibility: visible; }

  .filters-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: -14px;
    z-index: 3;
    margin: -14px -14px 2px;
    padding: 12px 14px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
  }
  .filters-head strong {
    font-size: 13px;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .filters label { width: 100%; }
  .filters .grow { grid-column: auto; }
  .filters-extra { display: contents !important; }
  .filters-skeleton { display: none !important; }
  body.is-loading .filters > :not(.filters-skeleton) { opacity: 1; pointer-events: auto; }

  main {
    display: block;
    padding: 10px 12px 92px;
  }

  .list-head { flex-wrap: wrap; }
  .list-head #count { flex: 1 1 auto; width: auto; }
  .list-head .sort { flex: 0 0 auto; width: auto; }
  .list-head .sort select { width: auto; }
  .quick-filters { order: 3; flex: 1 0 100%; padding-top: 4px; }

  .map-panel { display: none; }
  body.mobile-map-view .list-panel { display: none; }
  body.mobile-map-view .map-panel { display: flex; }
  body.mobile-map-view main { padding-bottom: 16px; }
  body.mobile-map-view #map { height: calc(100dvh - 235px); min-height: 320px; }

  .view-toggle {
    display: inline-flex;
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 850;
    padding: 11px 18px;
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(10, 18, 25, .28);
    cursor: pointer;
  }
  .view-toggle:active { transform: translateX(-50%) translateY(1px); }

  .toast { bottom: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-bar { animation: none; }
  .loading-status { transition: none; }
  .toast, .thumb img { transition: none; }
}

/* --------------------------------------------------------------------------
 * Cabeçalho com ações em ícones (padrão B1)
 * ------------------------------------------------------------------------ */

.topbar {
  min-height: 64px;
  padding: 8px 16px;
  align-items: center;
  gap: 16px;
}
.topbar .brand {
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
}
.brand-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand-head h1 { white-space: nowrap; }
.brand-logo {
  display: flex;
  align-items: center;
  margin: 0;
  line-height: 0;
}
.brand-logo img {
  display: block;
  width: auto;
  height: 42px;
}
.topbar .actions {
  flex-wrap: nowrap;
  gap: 2px;
}
.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.icon-action .ico {
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-action .ico svg { width: 14px; height: 14px; }

.topbar .actions .icon-action {
  flex-direction: column;
  gap: 3px;
  width: 78px;
  height: 56px;
  padding: 3px 2px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #39434c;
  font-size: 10.5px;
  font-weight: 700;
}
.topbar .actions .icon-action:hover {
  background: #f6f8f9;
  border-color: var(--line);
}
.topbar .actions .icon-action .ico {
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: #39434c;
}
.topbar .actions .icon-action.primary { color: var(--accent); }
.topbar .actions .icon-action.primary .ico {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

@media (max-width: 767px) {
  .topbar {
    position: relative;
    display: block;
    min-height: 0;
    padding: 10px 12px 8px;
  }
  .topbar .brand { width: 100%; }
  .brand-head {
    flex-wrap: wrap;
    gap: 3px 8px;
    padding-right: 132px;
  }
  .brand-head h1 { font-size: 19px; }
  .brand-logo img { height: 32px; }
  .brand-head #data-meta {
    flex: 1 0 100%;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar .actions {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    width: 100%;
    margin-top: 8px;
  }
  .topbar .actions .icon-action {
    flex-direction: column;
    gap: 3px;
    width: 100%;
    height: 52px;
    padding: 2px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: #39434c;
    font-size: 9px;
    font-weight: 700;
  }
  .topbar .actions .icon-action .ico {
    width: 28px;
    height: 28px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
    color: #39434c;
  }
  .topbar #btn-share {
    position: absolute;
    top: 8px;
    right: 12px;
    flex-direction: row;
    gap: 6px;
    width: auto;
    height: 36px;
    padding: 0 11px;
    border: 1px solid var(--accent);
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
  }
  .topbar #btn-share .ico {
    width: 18px;
    height: 18px;
    border: 0;
    background: transparent;
    color: #fff;
  }
  .topbar #btn-share .ico svg { width: 15px; height: 15px; }
  .topbar #btn-share .action-label { font-size: 12px; }
}

/* --------------------------------------------------------------------------
 * Paleta da marca Imovanta (Versão B)
 * ------------------------------------------------------------------------ */
:root {
  --accent: #0b2f6f;
  --accent-2: #0d5bd7;
  --brand-orange: #f26b0f;
}
.chip[aria-pressed="true"],
.quick-chip[aria-pressed="true"] {
  background: var(--brand-orange);
  border-color: var(--brand-orange);
}
input:focus,
select:focus,
textarea:focus { outline-color: rgba(13, 91, 215, .35); }
[data-combo] input:focus { outline-color: rgba(13, 91, 215, .35); }
.info-btn:focus-visible,
.chip:focus-visible,
.addr-link:focus-visible { outline-color: rgba(13, 91, 215, .45); }
