/* Nodus TopoLab - Estilo CAD oscuro de alto contraste */
:root {
  --bg-0: #0b0e13;
  --bg-1: #12161d;
  --bg-2: #1a1f28;
  --bg-3: #232a36;
  --line: #2f3845;
  --line-hi: #3f4b5c;
  --fg: #e6ebf2;
  --fg-dim: #9aa6b8;
  --fg-mute: #8792a3; /* UI-11: antes #667284 (≈3.9:1 sobre el fondo); ahora ≥4.5:1 en todos los paneles */
  --accent: #2fd0ff;
  --accent-2: #ffb020;
  --ok: #3ddc84;
  --warn: #ffb020;
  --err: #ff4d5e;
  --cad-red: #ff3b3b;
  --cad-yellow: #ffe63b;
  --cad-green: #3bff5e;
  --cad-cyan: #3bffff;
  --cad-blue: #3b6cff;
  --cad-magenta: #ff3bff;
  --cad-white: #ffffff;
  --font: "Segoe UI", "Inter", system-ui, sans-serif;
  --mono: "Cascadia Code", "Consolas", "JetBrains Mono", monospace;
  --toolbar-h: 48px;
  --statusbar-h: 26px;
  --side-w: 300px;
  --bottom-h: 300px;
  /* UI-13: tokens para lo que antes eran colores fijos */
  --hud-bg: rgba(11,14,19,.85);
  --active-bg: #0e3b4b;
  --primary-bg: #0f4a5e;
  --canvas-bg: #0b0e13;
  --canvas-grid: #1f2733;
  --shadow: rgba(0,0,0,.55);
}
/* UI-13: tema claro (campo a pleno sol): alto contraste sobre fondo claro */
:root[data-theme="light"] {
  --bg-0: #f4f6f9; --bg-1: #ffffff; --bg-2: #eef1f5; --bg-3: #e2e7ee;
  --line: #c3ccd8; --line-hi: #9aa8ba;
  --fg: #101722; --fg-dim: #3d4a5c; --fg-mute: #56647a;
  --accent: #006e96; --accent-2: #9a5a00; --ok: #117a3e; --warn: #9a5a00; --err: #c01830;
  --hud-bg: rgba(255,255,255,.92); --active-bg: #cfe9f3; --primary-bg: #cde6f0;
  --canvas-bg: #ffffff; --canvas-grid: #e3e8ef; --shadow: rgba(20,30,50,.25);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg-0); color: var(--fg); font-family: var(--font); font-size: 13px; overflow: hidden; }
button, input, select, textarea { font-family: inherit; font-size: 12px; color: var(--fg); background: var(--bg-2); border: 1px solid var(--line); border-radius: 3px; padding: 4px 6px; }
button { cursor: pointer; background: var(--bg-3); }
button:hover { border-color: var(--accent); }
button.active, .tool.active { background: var(--active-bg); border-color: var(--accent); color: var(--accent); }
button.primary { background: var(--primary-bg); border-color: var(--accent); }
button.danger { border-color: var(--err); color: var(--err); }
/* Funciones del plan Pro: candado para quien no lo tiene (el servidor las niega igual) */
/* Pro Drones: nubes LiDAR y fotogrametría, también bloqueadas en Pro */
:root[data-plan="pro"] [data-pro="drones"]::after { content: "DRONES"; margin-left: 6px; padding: 0 4px; border-radius: 3px; font-size: 9px; font-weight: 700; letter-spacing: .04em; vertical-align: 1px; color: var(--accent-2); border: 1px solid var(--accent-2); }
:root[data-plan="libre"] [data-pro="drones"]::after, :root[data-plan="demo"] [data-pro="drones"]::after { content: "DRONES" !important; }
:root[data-plan="pro"] [data-pro="drones"] { color: var(--fg-dim); }
:root[data-plan="libre"] [data-pro]::after, :root[data-plan="demo"] [data-pro]::after { content: "PRO"; margin-left: 6px; padding: 0 4px; border-radius: 3px; font-size: 9px; font-weight: 700; letter-spacing: .04em; vertical-align: 1px; color: var(--accent-2); border: 1px solid var(--accent-2); }
:root[data-plan="libre"] [data-pro], :root[data-plan="demo"] [data-pro] { color: var(--fg-dim); }
#toolbar .modules [data-pro]::after { margin-left: 3px; padding: 0 2px; font-size: 8px; }
img.sym { width: 16px; height: 16px; vertical-align: middle; background: #333a46; border-radius: 3px; }
button:disabled { opacity: .45; cursor: not-allowed; }
input[type="number"], input[type="text"] { width: 100%; }
input[type="range"] { width: 100%; padding: 0; }
label { color: var(--fg-dim); font-size: 11px; display: block; margin-bottom: 2px; }
h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin: 10px 0 6px; }
h4 { font-size: 11px; color: var(--fg-dim); margin: 8px 0 4px; text-transform: uppercase; letter-spacing: .05em; }
small, .hint { color: var(--fg-mute); font-size: 11px; }
.mono { font-family: var(--mono); }

#app { display: grid; height: 100vh; grid-template-rows: var(--toolbar-h) 1fr var(--statusbar-h); grid-template-columns: var(--side-w) 1fr; grid-template-areas: "toolbar toolbar" "side main" "status status"; }
/* UI-01: la barra ya no se desplaza entera (ocultaba el logo); solo la fila de módulos se ajusta si falta espacio */
#toolbar { grid-area: toolbar; display: flex; align-items: center; gap: 6px; padding: 0 10px; background: var(--bg-1); border-bottom: 1px solid var(--line); white-space: nowrap; position: relative; z-index: 40; }
#toolbar .brand { font-weight: 700; letter-spacing: .04em; color: var(--accent); margin-right: 6px; }
#toolbar .brand b { color: var(--fg); }
#toolbar .modules { flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
#toolbar .group.right { margin-left: auto; }
#toolbar .group { display: flex; align-items: center; gap: 4px; padding: 0 8px; border-left: 1px solid var(--line); height: 32px; }
#toolbar select { min-width: 120px; }
#toolbar .modules button { padding: 4px 8px; }

#side { grid-area: side; background: var(--bg-1); border-right: 1px solid var(--line); overflow-y: auto; padding: 8px 10px 20px; }
.panel { display: none; }
.panel.active { display: block; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 6px; }
.row.three { grid-template-columns: 1fr 1fr 1fr; }
.row.single { grid-template-columns: 1fr; }
/* HIDRO-02: un <input>/<select> puesto directo como hijo de .row (en vez del <div> envolvente
   habitual) no se encogía por debajo de su ancho de contenido intrínseco (comportamiento por
   defecto de CSS Grid para elementos reemplazados/de formulario) — el <select> del catálogo de
   Manning, más ancho, dejaba el <input> de rugosidad reducido a una franja casi invisible. */
.row > input, .row > select, .row > textarea { min-width: 0; }
.field { margin-bottom: 6px; }
.tools { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; margin: 6px 0; }
.tools.three { grid-template-columns: repeat(3, 1fr); }
.tool { padding: 6px 4px; font-size: 11px; text-align: center; }
.list { max-height: 160px; overflow-y: auto; border: 1px solid var(--line); border-radius: 3px; background: var(--bg-0); }
.list .item { padding: 4px 6px; border-bottom: 1px solid var(--line); cursor: pointer; display: flex; justify-content: space-between; gap: 6px; }
.list .item:hover { background: var(--bg-3); }
.list .item.sel { background: var(--active-bg); }
.list .item .del { color: var(--err); cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 10px; padding: 2px 6px; border-radius: 10px; background: var(--bg-3); border: 1px solid var(--line); cursor: pointer; }
.chip.active { background: var(--active-bg); border-color: var(--accent); color: var(--accent); }
.chip-group { margin-bottom: 6px; }
.chip-group-title { font-size: 10px; color: var(--accent-2); text-transform: uppercase; letter-spacing: .04em; margin: 4px 0 2px; }
#asset-search { width: 100%; margin-bottom: 6px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-family: var(--mono); font-size: 12px; }
.kv div:nth-child(even) { text-align: right; color: var(--accent-2); }
.badge { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; background: var(--bg-3); border: 1px solid var(--line); }
.badge.ok { color: var(--ok); border-color: var(--ok); }
.badge.warn { color: var(--warn); border-color: var(--warn); }
.badge.err { color: var(--err); border-color: var(--err); }
.legend { display: grid; grid-template-columns: 14px 1fr auto; gap: 4px 6px; align-items: center; font-size: 11px; }
.legend .sw { width: 14px; height: 10px; border: 1px solid #000; }

#main { grid-area: main; display: grid; grid-template-rows: 1fr 6px var(--bottom-h); min-height: 0; }
#map-wrap { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; background: #000; }
#map-hud { position: absolute; left: 8px; top: 8px; display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
#map-hud .hud { background: var(--hud-bg); border: 1px solid var(--line); border-radius: 3px; padding: 4px 8px; font-family: var(--mono); font-size: 11px; color: var(--fg-dim); pointer-events: auto; }
#map-hud .hud b { color: var(--accent); }
#map-hud .hud.warn { color: var(--warn); border-color: var(--warn); }
#map-controls { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 4px; }
#map-controls button { width: 32px; height: 32px; padding: 0; font-size: 14px; }
#drawing-tip { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); background: var(--hud-bg); border: 1px solid var(--accent); color: var(--accent); padding: 4px 12px; border-radius: 3px; font-size: 12px; display: none; }
#drawing-tip.show { display: block; }

#splitter { background: var(--line); cursor: row-resize; }
#splitter:hover { background: var(--accent); }
#bottom { display: grid; grid-template-rows: 30px 1fr; min-height: 0; background: var(--bg-1); }
#tabs { display: flex; gap: 2px; padding: 3px 6px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
#tabs button { border-bottom: none; border-radius: 3px 3px 0 0; background: var(--bg-2); padding: 4px 12px; white-space: nowrap; flex: none; }
#tabs button.active { background: var(--bg-3); color: var(--accent); border-color: var(--accent); }
#tab-content { position: relative; min-height: 0; overflow: hidden; }
.tab { display: none; position: absolute; inset: 0; overflow: auto; padding: 6px 8px; }
.tab.active { display: block; }
.tab-toolbar { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.tab-toolbar select { min-width: 200px; }

table.grid { border-collapse: collapse; width: 100%; font-family: var(--mono); font-size: 11px; }
table.grid th, table.grid td { border: 1px solid var(--line); padding: 3px 6px; text-align: center; white-space: nowrap; }
table.grid th { background: var(--bg-3); color: var(--accent); position: sticky; top: 0; }
table.grid td[contenteditable="true"] { background: var(--bg-2); outline: none; }
table.grid td[contenteditable="true"]:focus { border-color: var(--accent); }
table.grid tfoot td { color: var(--accent-2); font-weight: 600; text-align: left; }
table.grid tr:hover td { background: var(--bg-3); }
.table-title { font-weight: 700; color: var(--fg); margin: 6px 0; text-align: center; letter-spacing: .05em; }

canvas.section { width: 100%; height: 100%; display: block; background: var(--bg-0); }
.canvas-wrap { position: absolute; left: 0; right: 0; top: 34px; bottom: 0; }
.canvas-wrap.split { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.canvas-wrap.split > div { position: relative; }
.canvas-wrap.split canvas { position: absolute; inset: 0; }

#statusbar { grid-area: status; display: flex; align-items: center; gap: 16px; padding: 0 10px; background: var(--bg-1); border-top: 1px solid var(--line); font-family: var(--mono); font-size: 11px; color: var(--fg-dim); }
#statusbar > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#statusbar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fg-mute); display: inline-block; margin-right: 4px; }
#statusbar .dot.ok { background: var(--ok); }
#statusbar .dot.err { background: var(--err); }
#statusbar .fps { color: var(--ok); }
#statusbar .msg { margin-left: auto; color: var(--fg); }
/* BUG-44: indicador de cálculo en curso (antes `progress()` buscaba elementos .progress inexistentes). */
#statusbar .progress { width: 90px; margin: 0; visibility: hidden; }
#statusbar .progress.on { visibility: visible; }
body.busy button.primary { opacity: .6; pointer-events: none; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; align-items: center; justify-content: center; z-index: 50; }
.modal-backdrop.show { display: flex; }
.modal { width: min(920px, 94vw); max-height: 90vh; overflow: auto; background: var(--bg-1); border: 1px solid var(--line-hi); border-radius: 6px; padding: 14px 16px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.modal header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.modal header h2 { margin: 0; font-size: 14px; color: var(--accent); }
.modal textarea { width: 100%; min-height: 200px; font-family: var(--mono); font-size: 12px; background: var(--bg-0); }
.modal footer { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; }
.preview-grid { max-height: 220px; overflow: auto; margin-top: 8px; }

/* Grips y marcadores */
.grip { width: 12px; height: 12px; border: 2px solid #fff; background: var(--accent); border-radius: 2px; cursor: move; box-shadow: 0 0 0 1px #000; }
.grip.vertex-poly { background: var(--cad-red); }
.grip.vertex-axis { background: var(--cad-cyan); border-radius: 50%; }
.grip.vertex-reach { background: var(--cad-blue); border-radius: 50%; }
.grip.asset { width: 14px; height: 14px; background: var(--cad-yellow); border-radius: 50%; }
.grip.rot { width: 10px; height: 10px; background: var(--cad-magenta); border-radius: 50%; cursor: grab; }
.grip.label { color: #fff; font-size: 10px; font-family: var(--mono); background: rgba(0,0,0,.7); padding: 1px 3px; border: none; width: auto; height: auto; border-radius: 2px; pointer-events: none; white-space: nowrap; }
.maplibregl-ctrl-attrib, .maplibregl-ctrl-logo { opacity: .5; }
.maplibregl-marker { cursor: move; }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-hi); border-radius: 4px; }
::-webkit-scrollbar-track { background: var(--bg-0); }

.alert { padding: 6px 8px; border-radius: 3px; margin: 6px 0; font-size: 11px; }
.alert.warn { background: rgba(255,176,32,.12); border: 1px solid var(--warn); color: var(--warn); }
.alert.err { background: rgba(255,77,94,.12); border: 1px solid var(--err); color: var(--err); }
.alert.ok { background: rgba(61,220,132,.12); border: 1px solid var(--ok); color: var(--ok); }
.progress { height: 3px; background: var(--bg-3); position: relative; overflow: hidden; margin: 4px 0; }
.progress.on::after { content: ""; position: absolute; left: -40%; width: 40%; height: 100%; background: var(--accent); animation: slide 1s linear infinite; }
@keyframes slide { to { left: 100%; } }

/* ---------------------------------------------------------------- Fase 16: interfaz base */
/* UI-01: menús desplegables */
.menu { position: relative; }
.menu-btn { padding: 4px 10px; }
.menu-list { display: none; position: absolute; top: calc(100% + 4px); left: 0; min-width: 240px; flex-direction: column; gap: 2px; padding: 6px; background: var(--bg-1); border: 1px solid var(--line-hi); border-radius: 6px; box-shadow: 0 12px 40px var(--shadow); z-index: 70; }
.menu.open .menu-list { display: flex; }
.menu-list > button { display: flex; justify-content: space-between; gap: 16px; text-align: left; background: transparent; border-color: transparent; padding: 6px 8px; }
.menu-list > button:hover, .menu-list > button:focus-visible { background: var(--bg-3); border-color: var(--line); }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.menu-list.menu-form { padding: 10px; gap: 4px; }
.menu-list.menu-form select { width: 100%; margin-bottom: 6px; }
kbd { font-family: var(--mono); font-size: 10px; color: var(--fg-dim); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; padding: 0 4px; background: var(--bg-0); }
.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; }

/* UI-02: secciones plegables del panel lateral */
details.sec { border: 1px solid var(--line); border-radius: 4px; margin: 6px 0; background: var(--bg-1); }
details.sec > summary { cursor: pointer; padding: 6px 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-dim); list-style: none; display: flex; align-items: center; gap: 6px; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::before { content: "▸"; color: var(--accent); transition: transform .15s; }
details.sec[open] > summary::before { transform: rotate(90deg); }
details.sec[open] > summary { border-bottom: 1px solid var(--line); color: var(--fg); }
details.sec > :not(summary) { margin-left: 8px; margin-right: 8px; }
details.sec > :last-child { margin-bottom: 8px; }
label.check { display: flex; align-items: center; gap: 6px; margin: 4px 0; color: var(--fg-dim); font-size: 11px; }
label.check input { width: auto; }
fieldset.field { border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px; }
fieldset.field legend { color: var(--fg-dim); font-size: 11px; padding: 0 4px; }
abbr[title] { text-decoration: underline dotted; cursor: help; }

/* UI-11: foco visible con teclado */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button:focus:not(:focus-visible) { outline: none; }

/* UI-03 / UI-06: cancelar y centro de mensajes */
button.small { padding: 1px 8px; font-size: 11px; }
#statusbar button.msg { margin-left: auto; background: transparent; border: none; color: var(--fg); font-family: var(--mono); font-size: 11px; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
#statusbar button.msg:hover { text-decoration: underline; }
.popover { position: fixed; right: 10px; bottom: calc(var(--statusbar-h) + 6px); width: min(560px, 94vw); max-height: 45vh; overflow: auto; background: var(--bg-1); border: 1px solid var(--line-hi); border-radius: 6px; box-shadow: 0 12px 40px var(--shadow); z-index: 80; font-family: var(--mono); font-size: 11px; }
.popover .log-row { display: grid; grid-template-columns: 70px 1fr; gap: 8px; padding: 4px 8px; border-bottom: 1px solid var(--line); white-space: normal; }
.popover .log-row .t { color: var(--fg-mute); }
.popover .log-row.err { color: var(--err); } .popover .log-row.warn { color: var(--warn); } .popover .log-row.ok { color: var(--ok); }
.popover .empty { padding: 10px; color: var(--fg-mute); }
#dlg-body p { margin: 0 0 8px; white-space: pre-line; }
#dlg-body .field input { width: 100%; }
table.shortcuts td:first-child { text-align: left; white-space: nowrap; }
table.shortcuts td:last-child { text-align: left; }

/* UI-01: pantallas angostas — el subtítulo y los rótulos largos ceden espacio */
@media (max-width: 1280px) {
  #toolbar .modules button { padding: 4px 6px; font-size: 11px; }
  /* rótulo corto del módulo (el completo queda en title) para que quepan los siete sin desplazar */
  #toolbar .modules button[data-short] { font-size: 0; }
  #toolbar .modules button[data-short]::before { content: attr(data-short); font-size: 11px; }
  #crs-label, #st-zone, #st-fps { display: none; }
}

/* ---------------------------------------------------------------- Fase 17: capas */
#layers-panel { position: absolute; right: 48px; top: 8px; width: min(380px, calc(100% - 64px)); max-height: calc(100% - 16px); overflow: auto; background: var(--bg-1); border: 1px solid var(--line-hi); border-radius: 6px; padding: 8px 10px 10px; box-shadow: 0 12px 40px var(--shadow); z-index: 30; }
#layers-panel header { display: flex; justify-content: space-between; align-items: center; }
#layers-panel header h2 { margin: 0; font-size: 13px; color: var(--accent); }
#layers-panel h4 small { text-transform: none; letter-spacing: 0; }
#layers-overlays { max-height: 40vh; }
#layers-overlays .ov { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 6px; align-items: center; padding: 5px 6px; border-bottom: 1px solid var(--line); cursor: default; }
#layers-overlays .ov .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#layers-overlays .ov .name small { display: block; }
#layers-overlays .ov .acts { display: flex; gap: 2px; }
#layers-overlays .ov .acts button { padding: 1px 5px; font-size: 11px; }
#layers-overlays .ov input[type=range] { grid-column: 2 / 4; }
#layers-overlays .ov.out-of-range .name { color: var(--fg-mute); }
#layers-overlays .ov img.legend { grid-column: 1 / 4; max-width: 100%; background: #fff; border-radius: 3px; }
.list.catalog .cat-group { padding: 4px 8px; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-2); background: var(--bg-2); position: sticky; top: 0; }
.list.catalog .cat-item { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.list.catalog .cat-item small { display: block; }
#identify-out table.identify { margin-bottom: 6px; }
#identify-out table.identify td, #identify-out table.identify th { white-space: normal; text-align: left; }
#identify-out h4 { margin: 10px 0 4px; }

/* Fase 19 — UI-07: HUD de coordenadas con formato y copia; UI-08: escala 1:n, barra y norte */
#hud-coords-wrap { display: flex; align-items: center; gap: 6px; }
#map-hud .hud-btn { height: 18px; min-width: 0; padding: 0 5px; font-size: 10px; line-height: 16px; background: transparent; border: 1px solid var(--line); color: var(--fg-dim); border-radius: 3px; cursor: pointer; }
#map-hud .hud-btn:hover { color: var(--accent); border-color: var(--accent); }
#map-scale { position: absolute; left: 8px; bottom: 26px; display: flex; align-items: flex-end; gap: 6px; pointer-events: none; }
#map-wrap.google #map-scale { bottom: 64px; }
#map-scale > * { pointer-events: auto; }
#scale-n { height: 22px; padding: 0 7px; font-family: var(--mono); font-size: 11px; background: var(--hud-bg); border: 1px solid var(--line); color: var(--fg); border-radius: 3px; }
#map-scale .scale-bar { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 3px 6px 2px; background: var(--hud-bg); border: 1px solid var(--line); border-radius: 3px; }
#scale-bar { display: block; height: 6px; border: 2px solid var(--fg); border-top: none; min-width: 10px; }
#scale-len { font-family: var(--mono); font-size: 10px; color: var(--fg-dim); }
#map-north { position: absolute; right: 48px; top: 8px; width: 34px; height: 42px; padding: 2px 0 0; display: flex; flex-direction: column; align-items: center; gap: 0; background: var(--hud-bg); border: 1px solid var(--line); border-radius: 4px; }
#map-north span { display: block; color: var(--err); font-size: 16px; line-height: 18px; transition: transform .15s; }
#map-north b { font-size: 11px; color: var(--fg); }
#gs-results .item { cursor: pointer; }
#gs-results .item.sel { background: var(--bg-3, rgba(47,208,255,.12)); }
#gt-table td input { width: 100%; min-width: 80px; }
#gt-table tr.bad td { color: var(--err); }
#map-north[hidden] { display: none; }
.geo-out { font-size: 12px; line-height: 1.55; margin-top: 6px; } .geo-out b { color: var(--accent); font-family: var(--mono); }
/* MEM-02: memoria en la pestaña inferior */
.memo-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; } .memo-bar label { margin: 0; } .memo-bar select { width: auto; } .memo-bar button { width: auto; }
.memo table.grid { width: auto; max-width: 100%; min-width: 360px; }
.memo { font-size: 12px; line-height: 1.5; max-width: 1100px; }
.memo h2 { font-size: 14px; color: var(--accent); margin: 12px 0 4px; } .memo h3 { font-size: 12.5px; margin: 10px 0 4px; } .memo h4 { font-size: 12px; margin: 8px 0 3px; color: var(--fg-mute); }
.memo p { margin: 3px 0 6px; } .memo ul { margin: 3px 0 6px 18px; padding: 0; }
.memo table.sign td { border: none; background: none; }
.memo-toc { border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px; margin: 6px 0 10px; } .memo-toc ol { margin: 4px 0 0 18px; padding: 0; }

/* Fase 20 — UI-09: línea de comandos CAD */
#cad-cmd-box { position: absolute; left: 50%; bottom: 44px; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 4px 8px; background: var(--hud-bg); border: 1px solid var(--accent); border-radius: 4px; width: min(620px, 80%); }
#cad-cmd-box[hidden] { display: none; }
#cad-cmd-box label { font-size: 11px; color: var(--accent); margin: 0; }
#cad-cmd { flex: 1; font-family: var(--mono); font-size: 12px; }
#cad-cmd-hint { font-family: var(--mono); font-size: 10px; color: var(--fg-dim); white-space: nowrap; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
#map-controls button.active { border-color: var(--accent); color: var(--accent); background: rgba(47,208,255,.12); }
.cogo-out table.grid td, .cogo-out table.grid th { font-size: 11px; }
.cogo-out .bad { color: var(--err); }
.cogo-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 10px; }
.cogo-fields .pick { display: flex; gap: 4px; }
.cogo-fields .pick input { flex: 1; }
.cogo-fields .pick button { padding: 0 6px; }

/* ---------------------------------------------------------------- Fase 21: UI-12 adaptable */
#side-toggle { width: 30px; padding: 2px 0; font-size: 15px; }
#side-splitter { grid-area: side; justify-self: end; width: 6px; cursor: col-resize; z-index: 5; position: relative; right: -3px; }
#side-splitter:hover, #side-splitter.drag { background: var(--accent); opacity: .4; }
body.side-collapsed #app { grid-template-columns: 0 1fr; }
body.side-collapsed #side, body.side-collapsed #side-splitter { display: none; }
#main { grid-template-rows: 1fr 6px min(var(--bottom-h), 45vh); }
#map-wrap { min-height: 180px; }
.tpl-row select { flex: 1; min-width: 0; }
@media (max-width: 1366px) {
  :root { --side-w: 270px; }
  html, body { font-size: 12px; }
  #toolbar .menu-btn { padding: 4px 6px; }
}
@media (max-width: 1100px) {
  :root { --side-w: 250px; --bottom-h: 220px; }
  #toolbar .brand { display: none; }
  #toolbar select { min-width: 90px; }
}
/* Tabletas en campo: panel lateral sobrepuesto y controles táctiles más grandes */
@media (max-width: 900px) {
  #app { grid-template-columns: 0 1fr; }
  #side { position: fixed; left: 0; top: var(--toolbar-h); bottom: var(--statusbar-h); width: min(88vw, 340px); z-index: 45; box-shadow: 8px 0 24px var(--shadow); }
  body:not(.side-open) #side { display: none; }
  body.side-open #side { display: block; } /* aunque esté plegado en escritorio */
  #side-splitter { display: none; }
  #toolbar .modules { display: none; }
}
@media (pointer: coarse) {
  button, select, input { min-height: 34px; }
  #map-controls button { width: 40px; height: 40px; }
}
.theme-btn { width: 30px; padding: 2px 0; }

/* Fase 23: [hidden] siempre oculta (.row, inputs y otros bloques fijan display y lo anulaban) */
[hidden] { display: none !important; }
#gn-list input.gn-d { width: 100%; min-width: 280px; font-family: inherit; }
#gn-list input.gn-k { font-family: var(--mono); }
#gn-list td:nth-child(3) { text-align: left; }

/* CAM-01: panel de modo campo (controles grandes para uso táctil) */
#campo-panel { position: absolute; left: 8px; top: 8px; width: min(360px, calc(100% - 64px)); max-height: calc(100% - 16px); overflow: auto; background: var(--bg-1); border: 1px solid var(--line-hi); border-radius: 6px; padding: 8px 10px 10px; box-shadow: 0 12px 40px var(--shadow); z-index: 31; }
/* LIC-02: planes de pago en «Mi cuenta» */
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; margin-top: 10px; }
.plan-card { border: 1px solid var(--line-hi); border-radius: 6px; padding: 8px 10px; background: var(--bg-2); }
.plan-card.current { border-color: var(--ok); }
.plan-card h4 { margin: 0 0 4px; color: var(--accent); font-size: 13px; text-transform: none; letter-spacing: 0; }
.plan-card ul { margin: 0 0 6px; padding-left: 16px; color: var(--fg-dim); font-size: 11.5px; }
.plan-card .price { font-size: 18px; font-weight: 700; } .plan-card .price small, .plan-card .price2 { font-size: 11px; color: var(--fg-mute); font-weight: 400; }
.plan-card .buy { display: flex; gap: 6px; margin-top: 6px; } .plan-card .buy button { flex: 1; }
.plan-card .now { color: var(--ok); font-weight: 600; margin-top: 6px; }
#map-legend { position: absolute; left: 8px; bottom: 56px; width: min(260px, calc(100% - 64px)); max-height: 60%; overflow: auto; background: var(--hud-bg); border: 1px solid var(--line-hi); border-radius: 6px; padding: 6px 10px 8px; z-index: 30; font-size: 12px; }
#map-legend header { display: flex; justify-content: space-between; align-items: center; }
#map-legend h2 { margin: 0; font-size: 12px; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
#map-legend .lg-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
#map-legend .lg-row small { margin-left: auto; color: var(--fg-mute); }
#map-legend .lg-line { width: 22px; height: 0; border-top: 2px solid; flex: none; }
#map-legend img.sym { background: transparent; }
#campo-panel header { display: flex; justify-content: space-between; align-items: center; }
#campo-panel header h2 { margin: 0; font-size: 13px; color: var(--accent); }
#campo-panel button, #campo-panel select, #campo-panel input { min-height: 38px; }
#campo-panel button.big { width: 100%; min-height: 48px; font-size: 15px; margin: 6px 0; }
#campo-panel .cp-attrs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; margin: 4px 0; }
.btn-file { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; background: var(--bg-2, transparent); }

/* CTA-01: mensajes en ventanas (cuenta) */
.modal .msg.err { color: var(--err); }
.modal .msg.ok { color: var(--ok); }

/* G3: botón con aspecto de enlace y aviso de almacenamiento (como en FastPlan Railway y Roads) */
button.link { background: none; border: none; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; }
.aviso-almacen { position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%); z-index: 3000; max-width: min(720px, 94vw);
  display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 8px; background: var(--bg-2); color: var(--fg);
  border: 1px solid var(--line-hi); box-shadow: var(--shadow); font-size: 12.5px; }
.aviso-almacen a { color: var(--accent); }
