:root {
  /* ALVORA — acento de marca, mantido tal cal */
  --orange: #ff7a1c;
  --orange-dark: #ca5706;
  --orange-text: #a14606; /* acento sobre fondo claro (pestanas activas, etc.) */

  /* Apple Design System — superficies e grises neutros */
  --bg: #ffffff;
  --surface: #f5f5f7;
  --panel: #ffffff;
  --soft: #f5f5f7;
  --elevated: #fbfbfd;
  --dark: #1d1d1f;
  --muted: #86868b;
  --line: #e5e5ea;

  /* Cor funcional do mapa (ferramentas activas) */
  --blue: #0071e3;

  /* Tokens semánticos de estado — un só par bg/border/text por estado, reutilizado en todas partes */
  --ok: #34c759;
  --ok-bg: #e9f9ee; --ok-border: #bce8c8; --ok-text: #1a7a43;
  --warn: #ff9500;
  --warn-bg: #fff4e0; --warn-border: #ffd699; --warn-text: #8a5a00;
  --danger: #ff3b30;
  --bad-bg: #ffece9; --bad-border: #ffc9c2; --bad-text: #b8281c;

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .09);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, .12);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, .16);
  --shadow: var(--shadow-lg); /* compat: paineis flotantes (drawer / sheet móbil) */

  /* Radios — escala Apple literal (nunca por debaixo de 8px) */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 980px;

  /* Movemento */
  --ease: cubic-bezier(.25, .1, .25, 1);

  --topbar-h: 68px;
  --panel-w: 410px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  color: var(--dark);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body.busy { cursor: progress; }

/* Foco de teclado visible en todos os elementos interactivos (WCAG 2.4.7).
   Antes só os inputs tiñan un anel de foco propio; botóns, pestanas e
   ligazóns dependían do outline por defecto do navegador, inconsistente
   entre eles. */
:focus-visible {
  outline: 2px solid var(--dark);
  outline-offset: 2px;
  border-radius: 4px;
}

button, input, select, textarea, .button-link { font: inherit; }

button, .button-link {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 8px 11px;
  cursor: pointer;
  text-decoration: none;
  color: #344054;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: border-color .2s var(--ease), background-color .2s var(--ease), box-shadow .2s var(--ease), transform .15s var(--ease);
}
button:hover:not(:disabled), .button-link:hover { border-color: #c7c7cc; background: var(--surface); }
button:active:not(:disabled), .button-link:active { transform: scale(.98); }
button:disabled, .button-link.disabled { opacity: .46; cursor: not-allowed; pointer-events: none; }

.primary, .primary-link { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 600; }
.primary:hover, .primary-link:hover { background: var(--orange-dark) !important; border-color: var(--orange-dark) !important; color: #fff; }

.small { min-height: 31px; padding: 5px 8px; font-size: 11px; }
.full { width: 100%; }

input, select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: #111827;
  outline: none;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
input:focus, select:focus, textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(255, 122, 28, .14); }
textarea { resize: vertical; min-height: 72px; }

label, .label-title { display: grid; gap: 5px; font-size: 12px; font-weight: 600; color: #344054; }

h1, h2, h3 { color: var(--dark); font-weight: 600; }
h2 { font-size: 16px; margin: 0; }
.muted { color: var(--muted); font-size: 11px; }
.hint { font-size: 11.5px; color: var(--muted); line-height: 1.45; margin: 0 0 10px; }
.eyebrow { font-size: 9px; letter-spacing: .12em; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.top-gap { margin-top: 10px; }

/* Barra superior */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  position: relative;
  z-index: 1100;
}
.brand-block { min-width: 0; }
.brand { font-weight: 800; letter-spacing: 3px; font-size: 23px; color: var(--orange); }
.subtitle { font-size: 12px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.badge { background: #fff3ea; color: #a14606; border: 1px solid #ffd3b4; border-radius: var(--radius-full); padding: 6px 10px; font-size: 11px; font-weight: 700; }
.status-text { font-size: 11px; color: var(--muted); max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Área de traballo GIS responsive */
.autogis-body { height: 100dvh; overflow: hidden; }
.workspace { height: calc(100dvh - var(--topbar-h)); display: grid; grid-template-columns: var(--panel-w) minmax(0, 1fr); position: relative; overflow: hidden; }
.workspace-panel { background: var(--elevated); border-right: 1px solid var(--line); display: grid; grid-template-rows: auto auto minmax(0, 1fr); min-height: 0; position: relative; z-index: 700; }
.project-context { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 13px; background: #fff; border-bottom: 1px solid var(--line); }
.project-context > div { display: grid; gap: 2px; min-width: 0; }
.project-context strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-context small { font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-context-actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-button { min-width: 34px; min-height: 34px; width: 34px; padding: 0; font-size: 16px; }
.sheet-handle { display: none; }

.workspace-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 6px 7px; background: var(--surface); border-bottom: 1px solid var(--line); overflow: visible; }
.tab-btn { width: 100%; min-width: 0; min-height: 34px; padding: 6px 3px; border-color: transparent; background: transparent; font-size: 10px; font-weight: 700; white-space: nowrap; }
.tab-btn.active { background: #fff; border-color: var(--line); box-shadow: var(--shadow-sm); color: var(--orange-text); }
.tab-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 9px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.panel-section { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px; margin-bottom: 9px; box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.panel-head h2 { margin: 0; }
.form-grid { display: grid; gap: 8px; }
.form-grid.compact { gap: 7px; }
.create-project-grid { grid-template-columns: 1fr 1fr; }
.create-project-grid .wide { grid-column: 1 / -1; }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.geometry-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.geometry-buttons button { min-width: 0; padding: 7px 4px; font-size: 10px; }
.geometry-form { margin-top: 10px; display: grid; gap: 8px; padding: 10px; background: #fff7f2; border: 1px solid #ffd8bd; border-radius: var(--radius-md); }
.mode-title { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; }
.export-details, .source-details { margin-top: 10px; }
details summary { font-size: 11px; font-weight: 600; color: #4b5563; cursor: pointer; }
.empty-state { padding: 28px 14px; text-align: center; color: var(--muted); font-size: 12px; }
.access-box { margin: 8px 0 10px; padding: 10px 11px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); font-size: 11px; line-height: 1.5; }
.access-box code { font-size: 10px; overflow-wrap: anywhere; }

/* Mapa e controis flotantes */
.map-wrap { position: relative; min-width: 0; min-height: 0; background: #e5e7eb; }
#map, #reviewMap { height: 100%; width: 100%; z-index: 1; }
.map-toolbar { position: absolute; z-index: 540; left: 12px; top: 12px; display: flex; gap: 6px; flex-wrap: wrap; max-width: calc(100% - 190px); }
.map-toolbar button { min-height: 36px; padding: 6px 9px; background: rgba(255, 255, 255, .96); box-shadow: var(--shadow-md); font-size: 11px; font-weight: 700; border-color: var(--line); }
.map-toolbar button.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.measure-panel { position: absolute; z-index: 590; left: 12px; top: 56px; background: rgba(255, 255, 255, .97); border: 1px solid var(--line); box-shadow: var(--shadow-md); border-radius: var(--radius-md); padding: 9px 10px; max-width: 260px; font-size: 11px; }
.measure-panel #measureResult { margin-bottom: 7px; line-height: 1.5; }
.measure-panel .action-grid { grid-template-columns: 1fr 1fr; gap: 5px; }
.measure-panel .action-grid button { min-height: 30px; padding: 4px 6px; font-size: 9.5px; }
.measure-panel .action-grid #measureFinish { grid-column: 1 / -1; }
.map-mode-banner { position: absolute; z-index: 590; left: 50%; top: 12px; transform: translateX(-50%); max-width: min(620px, 70%); background: var(--dark); color: #fff; border-radius: var(--radius-full); padding: 9px 14px; font-size: 12px; font-weight: 700; box-shadow: var(--shadow-lg); text-align: center; }
.map-mode-banner.warn { background: var(--warn-text); }
.map-mode-banner.ok { background: var(--ok-text); }
.legend { position: absolute; z-index: 520; right: 12px; bottom: 12px; background: rgba(255, 255, 255, .95); border: 1px solid var(--line); box-shadow: var(--shadow-md); border-radius: var(--radius-md); padding: 7px 9px; display: flex; gap: 9px; flex-wrap: wrap; font-size: 9.5px; }
.legend span { display: flex; align-items: center; gap: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--ok); }
.dot.orange { background: var(--orange); }
.dot.blue { background: var(--blue); }
.dot.gray { background: #8e8e93; }
.dot.red { background: var(--danger); }
.leaflet-control-layers { font-size: 11px; }
.leaflet-popup-content { min-width: 210px; }
.popup-title { font-weight: 700; margin-bottom: 4px; }
.popup-meta { font-size: 11px; color: var(--muted); line-height: 1.4; }
.marker-dot { width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }

/* Editor fixo: o modo edición é sempre evidente */
.editor-drawer { position: absolute; z-index: 900; top: 0; bottom: 0; left: var(--panel-w); width: 420px; background: #fff; border-right: 1px solid var(--line); box-shadow: var(--shadow); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; }
.editor-drawer:has(.vulnerable-review-bar) { grid-template-rows: auto auto minmax(0, 1fr) auto; }
.editor-drawer[hidden] { display: none; }
.drawer-head { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.drawer-head h2 { font-size: 17px; margin: 2px 0 0; }
.drawer-scroll { min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 12px 14px; overscroll-behavior: contain; }
.drawer-actions { position: relative; z-index: 3; display: grid; grid-template-columns: 1.2fr 1fr; gap: 7px; padding: 10px 14px; border-top: 1px solid var(--line); background: #fff; }
.location-confirmation { padding: 10px; border-radius: var(--radius-sm); border: 1px solid #f8c5a1; background: #fff7f2; display: grid; gap: 6px; }
.location-confirmation.ready { border-color: var(--ok-border); background: var(--ok-bg); }
.location-confirmation strong { font-size: 12px; }
.location-confirmation span { font-size: 11px; color: var(--muted); }
.coords { display: flex; gap: 14px; font-size: 11px; color: var(--muted); }
.coords b { color: var(--dark); }
.draft-location-icon { width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--orange); border: 3px solid #fff; box-shadow: 0 1px 7px rgba(0, 0, 0, .3); }
.draft-location-icon:after { content: ""; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #fff; left: 7px; top: 7px; }

/* Tarxetas, estado e control */
.project-list, .entity-list { display: grid; gap: 7px; }
.project-card, .entity-card { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 9px; background: #fff; transition: border-color .2s var(--ease), box-shadow .2s var(--ease); }
.project-card { cursor: pointer; }
.project-card:hover, .entity-card:hover { border-color: #d9d9de; box-shadow: var(--shadow-sm); }
.project-card.active { border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange); }
.entity-card.discarded { opacity: .58; background: var(--surface); }
.card-title { font-size: 12.5px; font-weight: 700; }
.card-meta { font-size: 10.5px; color: var(--muted); margin-top: 3px; line-height: 1.35; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.chip { font-size: 9px; border-radius: var(--radius-full); padding: 3px 6px; background: var(--surface); display: inline-block; }
.chip.ok { background: var(--ok-bg); color: var(--ok-text); }
.chip.pending { background: var(--warn-bg); color: var(--warn-text); }
.chip.bad { background: var(--bad-bg); color: var(--bad-text); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 7px 0 10px; }
.stat { background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px; }
.stat b { display: block; font-size: 16px; }
.stat span { font-size: 7.5px; color: var(--muted); font-weight: 700; }
.entity-actions { display: flex; gap: 5px; margin-top: 7px; flex-wrap: wrap; }
.entity-actions button { min-height: 30px; padding: 4px 7px; font-size: 9.5px; }
.filter-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 6px; margin-bottom: 8px; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.checks label { display: flex; gap: 6px; align-items: center; font-weight: 500; font-size: 10.5px; }
.checks input { width: auto; min-height: 0; }
.notice { border: 1px solid var(--line); background: var(--soft); border-radius: var(--radius-sm); padding: 8px 9px; margin-top: 8px; font-size: 10.5px; line-height: 1.4; }
.notice.ok { border-color: var(--ok-border); background: var(--ok-bg); color: var(--ok-text); }
.notice.bad { border-color: var(--bad-border); background: var(--bad-bg); color: var(--bad-text); }
.notice.warn { border-color: var(--warn-border); background: var(--warn-bg); color: var(--warn-text); }
.notice.info { color: #4b5563; }
.sync-log { display: grid; gap: 5px; margin-top: 9px; }
.log-row { display: grid; grid-template-columns: 72px 90px 1fr auto; align-items: center; gap: 5px; border-top: 1px solid var(--line); padding-top: 5px; font-size: 9px; color: var(--muted); }
.log-row b { color: var(--dark); }
.log-row small { font-size: 8px; }
.log-status { font-size: 7.5px; font-weight: 700; border-radius: var(--radius-sm); padding: 2px 4px; text-align: center; }
.log-status.ok { background: var(--ok-bg); color: var(--ok-text); }
.log-status.bad { background: var(--bad-bg); color: var(--bad-text); }
.completion-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-bottom: 8px; }
.completion-summary div { background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px; }
.completion-summary b { display: block; font-size: 16px; }
.completion-summary span { font-size: 8px; color: var(--muted); }
.checklist { display: grid; gap: 4px; }
.check-row { display: grid; grid-template-columns: 20px 1fr auto; gap: 5px; align-items: center; font-size: 10px; }
.check-row code { font-size: 9px; }
.check-icon { width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; }
.check-icon.ok { background: var(--ok-bg); color: var(--ok-text); }
.check-icon.bad { background: var(--warn-bg); color: var(--warn-text); }
.pending-list { display: grid; gap: 5px; margin-top: 7px; }
.pending-item { display: grid; grid-template-columns: 1fr auto; gap: 3px 6px; border-top: 1px solid var(--line); padding-top: 5px; font-size: 10px; }
.pending-item span { grid-column: 1; color: var(--muted); }
.pending-item button { grid-row: 1 / 3; grid-column: 2; min-height: 29px; padding: 4px 6px; font-size: 9px; }
.duplicate-item { display: grid; gap: 4px; border-top: 1px solid var(--line); padding-top: 7px; margin-top: 2px; font-size: 10px; }
.duplicate-item span { color: var(--muted); }
.duplicate-actions { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.duplicate-actions button { min-height: 28px; padding: 4px 7px; font-size: 9px; }

/* Workspace de revisión do Concello */
.review-body { height: 100dvh; overflow: hidden; }
.review-workspace { height: calc(100dvh - var(--topbar-h)); display: grid; grid-template-columns: 380px minmax(0, 1fr); position: relative; overflow: hidden; }
.review-panel { background: var(--elevated); border-right: 1px solid var(--line); display: grid; grid-template-rows: auto auto minmax(0, 1fr); min-height: 0; z-index: 700; }
.review-project-context { padding: 10px 13px; background: #fff; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.review-project-context strong { display: block; font-size: 13px; }
.review-project-context small { color: var(--muted); font-size: 10px; }
.review-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; overflow: visible; padding: 6px; border-bottom: 1px solid var(--line); background: var(--surface); }
.review-tab { width: 100%; min-width: 0; min-height: 34px; padding: 6px 4px; border-color: transparent; background: transparent; white-space: nowrap; font-size: 10px; font-weight: 700; }
.review-tab.active { background: #fff; border-color: var(--line); box-shadow: var(--shadow-sm); color: var(--orange-text); }
.review-content { min-height: 0; overflow-y: auto; padding: 9px; }
.review-section { display: none; }
.review-section.active { display: block; }
.review-progress { display: flex; gap: 6px; flex-wrap: wrap; margin: 7px 0; }
.progress-pill { background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius-full); padding: 5px 8px; font-size: 9.5px; }
.review-entity-list { display: grid; gap: 7px; }
.review-entity-card { border: 1px solid var(--line); background: #fff; border-radius: var(--radius-md); padding: 9px; }
.review-entity-card.selected { border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange); }
.review-card-actions { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 7px; }
.review-card-actions button { min-height: 31px; padding: 5px 7px; font-size: 9.5px; }
.review-draw-list { display: grid; gap: 6px; margin-top: 10px; }
.gis-card { border: 1px solid var(--line); background: #fff; border-radius: var(--radius-sm); padding: 8px; font-size: 10px; }
.gis-card .gis-actions { margin-top: 5px; }
.layer-group-head { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 10px 0 2px; padding-bottom: 3px; border-bottom: 1px solid var(--line); }
.layer-group-head:first-child { margin-top: 0; }
.gis-card.required-layer { border-color: #bcd6ff; }
.gis-card.missing-required { border-color: var(--warn-border); background: var(--warn-bg); }
.gis-card.missing-required b { color: var(--warn-text); }
.gis-card-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.layer-order-btns { display: flex; gap: 2px; flex-shrink: 0; }
.icon-button.tiny { min-width: 22px; min-height: 22px; width: 22px; height: 22px; font-size: 9px; padding: 0; line-height: 1; }
.icon-button.tiny:disabled { opacity: .3; cursor: default; }
.layer-visibility { display: flex; align-items: center; gap: 6px; font-size: 10.5px; cursor: pointer; }
.layer-visibility input { width: auto; min-height: 0; margin: 0; }
.layer-required-chip { background: var(--ok-bg); color: var(--ok-text); font-size: 8px; padding: 2px 5px; border-radius: var(--radius-full); margin-left: 4px; display: inline-block; }
.review-finish-card { padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); }
.review-editor { left: 380px; }
.map-note { position: absolute; z-index: 540; left: 12px; bottom: 12px; background: rgba(255, 255, 255, .96); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 9px; box-shadow: var(--shadow-sm); font-size: 10px; color: var(--muted); max-width: 320px; }

/* Acceso / login */
.access-body {
  min-height: 100dvh;
  margin: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1100px 620px at 50% -12%, #fff2e8 0%, rgba(255, 242, 232, 0) 60%),
    var(--surface);
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  color: var(--dark);
}
.access-shell { width: min(92vw, 520px); padding: 28px 0; }
.access-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 36px 32px; box-shadow: var(--shadow-lg); }
.access-card .brand { display: block; }
.access-card .subtitle { display: block; margin-bottom: 22px; }
.access-card h1 { margin: 24px 0 8px; font-size: 1.85rem; letter-spacing: -.01em; }
.access-card h2 { margin-top: 8px; font-size: 1.15rem; }
.access-card p { line-height: 1.55; color: var(--muted); }
.access-form { margin-top: 18px; }
.access-form input { font-size: 1rem; letter-spacing: .03em; }
.access-card hr { border: none; border-top: 1px solid var(--line); margin: 26px 0; }

/* Tablet/móbil: o panel convértese nunha folla inferior, o mapa segue sempre visible */
@media (max-width: 900px) {
  :root { --topbar-h: 60px; }
  .topbar { padding: 0 10px; }
  .brand { font-size: 19px; letter-spacing: 2.5px; }
  .subtitle { font-size: 10px; }
  .status-text, .top-actions .badge { display: none; }
  .top-actions .button-link { min-height: 34px; padding: 5px 8px; font-size: 10px; }
  .workspace, .review-workspace { display: block; height: calc(100dvh - var(--topbar-h)); position: relative; }
  .main-map-wrap, .review-map-wrap { position: absolute !important; inset: 0; z-index: 1; }
  .workspace-panel, .review-panel {
    position: absolute; z-index: 760; left: 0; right: 0; bottom: 0;
    height: 43dvh; min-height: 260px; max-height: calc(100dvh - 48px);
    border: 1px solid var(--line); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-xl);
    grid-template-rows: auto auto minmax(0, 1fr);
    transition: height .3s var(--ease);
    background: var(--elevated);
  }
  .review-panel { grid-template-rows: auto auto minmax(0, 1fr); }
  .workspace-panel.expanded, .review-panel.expanded { height: 82dvh; }
  .sheet-handle { display: flex; min-height: 20px; height: 20px; border: 0; background: transparent; padding: 0; position: absolute; top: -2px; left: 50%; transform: translateX(-50%); z-index: 10; }
  .sheet-handle span { width: 38px; height: 4px; border-radius: var(--radius-full); background: #c7c7cc; }
  .project-context, .review-project-context { padding-top: 13px; }
  .workspace-tabs, .review-tabs { padding: 5px 6px; }
  .tab-scroll, .review-content { padding: 7px; }
  .editor-drawer, .review-editor { position: absolute; z-index: 980; left: 0; right: 0; top: 0; bottom: 0; width: auto; border: 0; box-shadow: none; }
  .drawer-actions { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .map-toolbar { top: 8px; left: 8px; right: 8px; max-width: none; justify-content: flex-start; }
  .map-toolbar button { min-height: 38px; }
  .map-mode-banner { top: 54px; max-width: calc(100% - 24px); width: max-content; font-size: 11px; padding: 8px 11px; }
  .legend { bottom: calc(43dvh + 8px); right: 8px; max-width: 220px; }
  .workspace-panel.expanded ~ .main-map-wrap .legend { display: none; }
  .map-note { bottom: calc(43dvh + 10px); left: 8px; max-width: 55vw; }
  .review-panel.expanded ~ .review-map-wrap .map-note { display: none; }
  .geometry-buttons { grid-template-columns: 1fr 1fr 1fr; }
  .action-grid { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .completion-summary { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .create-project-grid, .two-cols { grid-template-columns: 1fr; }
  .create-project-grid .wide { grid-column: auto; }
  .action-grid { grid-template-columns: 1fr; }
  .filter-row { grid-template-columns: 1fr; }
  .checks { grid-template-columns: 1fr; }
  .geometry-buttons { grid-template-columns: 1fr 1fr; }
  .geometry-buttons button:last-child { grid-column: 1 / -1; }
  .access-card { padding: 26px 22px; }
  .legend { font-size: 8.5px; gap: 6px; }
  .map-toolbar button { font-size: 10px; padding: 5px 7px; }
  .drawer-actions { grid-template-columns: 1fr 1fr; }
}

/* v1.7 · municipio + axudantes de importación */
.municipality-form { padding: 10px; border: 1px solid #ffd8bd; background: #fff7f2; border-radius: var(--radius-md); }
.municipality-form h3 { margin: 0; font-size: 13px; }
.create-project-grid #toggleMunicipalityForm { align-self: end; min-height: 34px; }
@media (max-width: 900px) {
  .municipality-form { padding: 9px; }
  .create-project-grid #toggleMunicipalityForm { width: 100%; }
}

/* v1.8 · ciclo de vida do proxecto + selector municipal */
button.danger, .danger { border-color: var(--danger); color: #d70015; background: var(--bad-bg); }
button.danger:hover, .danger:hover { background: #ffdcd6; }
.project-picker-card { max-width: 760px; }
.project-picker-list { display: grid; gap: 12px; margin: 22px 0; }
.project-picker-item { display: flex; flex-direction: column; gap: 5px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-md); text-decoration: none; color: inherit; background: #fff; transition: border-color .2s var(--ease), box-shadow .2s var(--ease); }
.project-picker-item:hover { border-color: var(--orange); box-shadow: var(--shadow-md); }
.project-picker-item span { font-size: .9rem; color: var(--muted); }
.sync-item.unread { border-left: 4px solid var(--orange); padding-left: 10px; }
#notificationsBtn { display: inline-flex; gap: 6px; align-items: center; }

/* v1.9 · integridade de fontes e autocompletado territorial */
.log-status.zero { background: #e8f1ff; color: #2458a6; }
.log-status.warn { background: var(--warn-bg); color: var(--warn-text); }
.log-status.fallback { background: #f3e8fd; color: #6b21a8; }
.log-detail-toggle { grid-column: 1 / -1; justify-self: start; min-height: 22px; padding: 2px 6px; font-size: 8.5px; margin-top: 2px; }
.log-detail { grid-column: 1 / -1; }
.detail-json { background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; font-size: 9px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; max-height: 280px; overflow: auto; margin-top: 4px; color: #374151; }
.micro-status { font-size: 9px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 8px; line-height: 1.35; }
.micro-status.ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-text); }
.micro-status.warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.micro-status.working { background: #eaf3ff; border-color: #bcd6ff; color: #1d5fa8; }
.popup-warning { margin: 6px 0; padding: 5px 6px; border-radius: var(--radius-sm); background: var(--warn-bg); color: var(--warn-text); font-size: 9px; font-weight: 700; }
.leaflet-popup-content .popup-meta { line-height: 1.45; min-width: 180px; }

/* v2.6.2 · navegación lateral completa e versión visible no badge existente */
@media (max-width: 420px) {
  .tab-btn { font-size: 9.2px; padding-left: 2px; padding-right: 2px; }
  .review-tab { font-size: 9.2px; padding-left: 2px; padding-right: 2px; }
}


/* Revisión cartográfica de elementos validados fóra do uso VULNERABLE */
.autogis-entity-filter{
  position:absolute;
  z-index:610;
  left:14px;
  top:148px; /* fallback; map_search.js recalcula a posición segundo a altura real do buscador */
  width:min(460px,calc(100% - 28px));
  box-sizing:border-box;
  pointer-events:auto;
  background:rgba(255,255,255,.96);
  padding:12px 14px;
  border-radius:16px!important;
  box-shadow:0 8px 24px rgba(0,0,0,.14);
  border:1px solid rgba(0,0,0,.08)!important;
  transition:top .14s ease;
}
.autogis-entity-filter label{
  display:block;
  font-size:10px;
  font-weight:800;
  letter-spacing:.06em;
  text-transform:uppercase;
  color:#6e6e73;
  margin-bottom:5px;
}
.autogis-entity-filter select{
  width:100%;
  min-height:34px;
  font:600 12px/1.2 Inter,system-ui,sans-serif;
  border:1px solid rgba(0,0,0,.12);
  border-radius:8px;
  background:#fff;
  padding:6px 8px;
  color:#1d1d1f;
}
.autogis-entity-filter-count{
  margin-top:5px;
  font:600 10.5px/1.25 Inter,system-ui,sans-serif;
  color:#6e6e73;
}
@media(max-width:700px){
  .autogis-entity-filter{left:8px;width:calc(100% - 16px);max-width:none;top:154px}
}

.autogis-entity-filter-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.autogis-entity-filter-head>div{min-width:0}
.autogis-review-btn{min-height:32px;padding:5px 10px;border-radius:8px;background:#1d1d1f;color:#fff;border:0;font-size:11px;font-weight:800;white-space:nowrap}
.autogis-review-btn:disabled{background:#e5e7eb;color:#6e6e73;cursor:default}
.autogis-review-btn.done{box-shadow:none}
.autogis-entity-filter-hint{margin-top:8px;font-size:10.5px;line-height:1.4;color:#6e6e73;max-width:none}

.vulnerable-review-bar{position:relative;z-index:4;padding:9px 12px;border-bottom:1px solid #f3c9aa;background:#fff7f2;display:grid;gap:7px;min-width:0;box-shadow:0 2px 8px rgba(0,0,0,.05)}
.vrb-copy{display:grid;gap:2px;min-width:0}
.vrb-copy span{font-size:9px;font-weight:800;letter-spacing:.08em;color:var(--orange);text-transform:uppercase}
.vrb-copy strong{font-size:12px;line-height:1.25;overflow-wrap:anywhere}
.vrb-copy small{font-size:10px;color:var(--muted)}
.vrb-actions{display:grid;grid-template-columns:42px minmax(0,1fr) minmax(0,1.15fr) 42px;gap:5px;min-width:0}
.vrb-actions button{min-width:0;min-height:34px;padding:5px 7px;font-size:9.5px;white-space:normal;line-height:1.15}
.vrb-actions button.primary{background:var(--orange);border-color:var(--orange);color:#fff}
@media(max-width:700px){
  .vrb-actions{grid-template-columns:42px 1fr 42px}
  .vrb-actions [data-vr-mark]{grid-column:2}
  .vrb-actions [data-vr-next]{grid-column:1 / -1}
  .vrb-actions [data-vr-exit]{grid-column:3;grid-row:1}
  .vrb-actions button{min-height:40px}
}
