/* Pastec Design — tokens alineados con Pastec View (shell.css: --ps-*) */
:root {
  --bg: #0a100e; --side: #0c1311; --surface: #111916; --surface-2: #16201c; --surface-3: #1c2924;
  --border: #22302a; --border-strong: #31443b; --text: #e7efe9; --muted: #84968c; --faint: #5b6b62;
  --accent: #34d399; --accent-strong: #10b981; --accent-ink: #052e1f; --danger: #f87171; --warn: #fbbf24; --info: #38bdf8;
  --radius: 10px; --shadow: 0 10px 30px rgba(0,0,0,.45);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.45 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
kbd { font: 11px var(--mono); padding: 1px 5px; border: 1px solid var(--border-strong); border-radius: 4px; color: var(--muted); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* Las capas vectoriales de Leaflet (dibujo en curso, cercos) usan <svg>: no deben heredar el tamaño de ícono. */
.leaflet-container svg { width: auto; height: auto; max-width: none; stroke: none; stroke-width: initial; }

/* ---------- botones e inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface-2); cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn.primary:hover { background: #059669; }
.btn.danger { background: transparent; border-color: #7f1d1d; color: var(--danger); }
.btn.danger:hover { background: #2a1111; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.icon { width: 34px; padding: 0; border-radius: 50%; font-weight: 700; }
input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea {
  width: 100%; height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--bg); outline: none; }
textarea { height: auto; padding: 8px 10px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(52,211,153,.18); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
label.opt, label.layer-row, label.chip { flex-direction: row; color: var(--text); font-size: 12.5px; }
label.chk { flex-direction: row; align-items: center; gap: 6px; color: var(--text); cursor: pointer; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.msg { min-height: 18px; margin: 4px 0; color: var(--danger); font-size: 12px; }
.msg.ok { color: var(--accent); }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: 9px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 500; }
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }

/* ---------- login */
.auth { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 20% 10%, rgba(16,185,129,.12), transparent 60%), var(--bg); }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.auth-card form { display: flex; flex-direction: column; gap: 10px; }
.auth-logo { display: block; width: 170px; margin: 0 auto 6px; }
.auth h1 { margin: 6px 0 2px; text-align: center; font-size: 20px; }
.auth p.muted { text-align: center; margin: 0 0 18px; }
.auth .fine { margin: 16px 0 0; font-size: 11px; color: var(--faint); text-align: center; }
.pw { position: relative; display: block; }
.pw input { padding-right: 38px !important; }
.pw-eye { position: absolute; right: 4px; top: 3px; height: 28px; width: 30px; border: 0; background: transparent; cursor: pointer; opacity: .7; }

/* ---------- layout */
.app { display: grid; grid-template-rows: auto 1fr; height: 100vh; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 8px 14px; background: var(--side); border-bottom: 1px solid var(--border); min-height: 60px; z-index: 1100; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { height: 30px; }
.proj { display: flex; flex-direction: column; min-width: 0; }
.proj-name { height: 26px !important; border-color: transparent !important; background: transparent !important; font-weight: 600; font-size: 14px; padding: 0 4px !important; width: 230px !important; }
.proj-name:hover { border-color: var(--border) !important; }
.save-state { font-size: 11px; color: var(--muted); padding-left: 5px; }
.save-state.dirty { color: var(--warn); }
.metrics { display: flex; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.metric { display: flex; flex-direction: column; justify-content: center; padding: 4px 12px; border-left: 1px solid var(--border); min-width: max-content; }
.metric span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.metric b { font-size: 15px; font-variant-numeric: tabular-nums; }
.metric.total b { color: var(--accent); }
.metric.total em { font-style: normal; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.metric.flash b { animation: flash .6s ease; }
@keyframes flash { 0% { color: #fff; text-shadow: 0 0 12px var(--accent); } }
.top-actions { display: flex; align-items: center; gap: 8px; }
.dropdown { position: relative; }
.menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 270px; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 6px; box-shadow: var(--shadow); z-index: 2000; display: flex; flex-direction: column; }
.menu.right { left: auto; right: 0; }
.menu button { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.menu button:hover, .menu button:focus-visible { background: var(--surface-3); outline: none; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 2px; }
.menu-head { padding: 8px 10px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }

.workspace { display: grid; grid-template-columns: 1fr 400px; min-height: 0; }
.stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.map { position: absolute; inset: 0; background: #0b1410; }
.map.no-basemap { background: #0f1a15 repeating-linear-gradient(0deg, transparent 0 49px, rgba(255,255,255,.04) 49px 50px), repeating-linear-gradient(90deg, transparent 0 49px, rgba(255,255,255,.04) 49px 50px); }
.map[data-tool]:not([data-tool=select]) { cursor: crosshair; }
.map[data-tool=delete] .leaflet-interactive { cursor: not-allowed !important; }
.leaflet-container { font: 12px var(--font); }
.leaflet-control-attribution { background: rgba(0,0,0,.55) !important; color: #aaa !important; font-size: 10px; }
.leaflet-control-attribution a { color: #ccc !important; }
.leaflet-bar a { background: var(--surface) !important; color: var(--text) !important; border-color: var(--border) !important; }
.leaflet-control-scale-line { background: rgba(0,0,0,.5); color: #fff; border-color: #fff; }

/* ---------- toolbox */
.toolbox { position: absolute; left: 12px; top: 12px; z-index: 1000; display: flex; flex-direction: column; gap: 3px; padding: 6px;
  background: rgba(12,19,17,.92); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); backdrop-filter: blur(6px); max-height: calc(100% - 60px); overflow-y: auto; }
.toolbox button { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.toolbox button:hover { background: var(--surface-3); color: var(--text); }
.toolbox button.on { background: var(--accent-strong); color: #fff; }
.toolbox button.toggle.on { background: rgba(52,211,153,.16); color: var(--accent); }
.tb-sep { height: 1px; background: var(--border); margin: 3px 4px; }

.ctx { position: absolute; left: 64px; top: 12px; z-index: 1000; width: 280px; background: rgba(12,19,17,.95); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; box-shadow: var(--shadow); backdrop-filter: blur(6px); display: flex; flex-direction: column; gap: 10px; }
.ctx h3 { margin: 0; font-size: 13px; }
.ctx p { margin: 0; color: var(--muted); font-size: 12px; }
.opt-list { display: flex; flex-direction: column; gap: 2px; max-height: 330px; overflow-y: auto; }
.opt { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 7px; cursor: pointer; border: 1px solid transparent; }
.opt:hover { background: var(--surface-3); }
.opt.on { border-color: var(--accent); background: rgba(52,211,153,.08); }
.opt input { display: none; }
.sw { width: 22px; height: 0; border-top: 4px solid var(--c); flex: none; }
.sw.dash { border-top-style: dashed; }
.sw.area { height: 12px; border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 25%, transparent); border-radius: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 11px; border-radius: 99px; border: 1px solid var(--border-strong); background: var(--surface-2); cursor: pointer; }
.chip.on { border-color: var(--accent); background: rgba(52,211,153,.14); color: var(--accent); }
.chip.danger { color: #fca5a5; }
.chip.danger.on { border-color: #ef4444; background: rgba(239,68,68,.14); color: #fca5a5; }

.basemap { position: absolute; right: 12px; top: 12px; z-index: 1000; width: 230px; }
.basemap select { background: rgba(12,19,17,.92); }
.gee-box { margin-top: 6px; padding: 8px 10px; background: rgba(12,19,17,.92); border: 1px solid var(--border); border-radius: 10px; display: flex; flex-direction: column; gap: 6px; }
.gee-box input[type=range] { width: 100%; accent-color: var(--accent-strong); }
.ndvi-scale { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); }
.ndvi-scale i { flex: 1; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #a50026, #f46d43, #fee08b, #d9ef8b, #66bd63, #006837); }
.legend { position: absolute; left: 12px; bottom: 34px; z-index: 1000; width: 250px; background: rgba(12,19,17,.92); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.legend-head { width: 100%; display: flex; justify-content: space-between; border: 0; background: transparent; padding: 9px 12px; font-weight: 600; cursor: pointer; }
.legend.collapsed .legend-head span { transform: rotate(-90deg); }
.legend.collapsed .legend-body { display: none; }
.legend-body { padding: 0 12px 10px; max-height: 42vh; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.legend-row { display: flex; align-items: center; gap: 9px; font-size: 12px; padding: 2px 0; }
.legend-sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 6px; }
.legend-toggles { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; }

.statusbar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 999; display: flex; gap: 18px; padding: 4px 12px; font-size: 11.5px;
  background: rgba(10,16,14,.85); border-top: 1px solid var(--border); color: var(--muted); font-variant-numeric: tabular-nums; }
#st-hint { flex: 1; color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.toast { position: absolute; left: 50%; bottom: 44px; transform: translateX(-50%) translateY(20px); opacity: 0; transition: .25s; z-index: 1500;
  background: var(--surface-3); border: 1px solid var(--border-strong); padding: 9px 16px; border-radius: 99px; box-shadow: var(--shadow); pointer-events: none; }
.toast.on { opacity: 1; transform: translateX(-50%); }

/* ---------- elementos del mapa */
.cad-tip { position: absolute; left: 0; top: 0; z-index: 1200; pointer-events: none; background: rgba(5,10,8,.92); border: 1px solid var(--border-strong);
  border-radius: 7px; padding: 5px 9px; font-size: 12px; white-space: nowrap; opacity: 0; font-variant-numeric: tabular-nums; }
.cad-tip.on { opacity: 1; }
.cad-tip .ok, .ok { color: var(--accent); font-weight: 600; }
.pt { width: 18px; height: 18px; border-radius: 50%; background: rgba(0,0,0,.75); border: 2px solid var(--c); color: var(--c); display: grid; place-items: center;
  font: 700 9.5px/1 var(--font); box-shadow: 0 1px 4px rgba(0,0,0,.6); }
.pt-big { width: 26px; height: 26px; font-size: 13px; }
.pt-sel { outline: 3px solid #fff; outline-offset: 1px; }
.pt-tip { background: var(--surface) !important; color: var(--text) !important; border: 1px solid var(--border-strong) !important; box-shadow: none !important; font-size: 11.5px; }
.pt-tip::before { display: none; }
.lbl-area { transform: translate(-50%, -50%); text-align: center; pointer-events: none; white-space: nowrap; color: #fff; text-shadow: 0 1px 3px #000, 0 0 8px #000; }
.lbl-area b { display: block; font-size: 17px; line-height: 1; }
.lbl-area span { font-size: 11px; font-weight: 600; }
.lbl-area.aguada b { font-size: 11px; }
.cut300 { width: 16px; height: 16px; position: relative; }
.cut300::before, .cut300::after { content: ''; position: absolute; left: 7px; top: 0; width: 3px; height: 16px; background: #ef4444; border-radius: 2px; box-shadow: 0 0 0 1px #000; transform: rotate(45deg); }
.cut300::after { transform: rotate(-45deg); }
.node { width: 12px; height: 12px; border: 2px solid #000; }
.node.doble { background: #f97316; transform: rotate(45deg); }
.node.simple { background: #facc15; border-radius: 2px; }
.vh { width: 12px; height: 12px; background: #fff; border: 2px solid var(--accent-strong); border-radius: 3px; cursor: move; }
.vm { width: 10px; height: 10px; background: rgba(255,255,255,.5); border: 1px solid #fff; border-radius: 50%; cursor: copy; }
.cota { transform: translate(-50%, -140%); background: rgba(0,0,0,.72); color: #fff; padding: 1px 5px; border-radius: 4px; font-size: 10.5px; white-space: nowrap; pointer-events: none; }

/* ---------- panel */
.panel { display: flex; flex-direction: column; min-height: 0; background: var(--side); border-left: 1px solid var(--border); }
.tabs { display: flex; border-bottom: 1px solid var(--border); }
.tabs button { flex: 1; padding: 12px; border: 0; background: transparent; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.tab-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.card h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.kpi span { font-size: 11px; color: var(--muted); }
.kpi b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.kpi.big { grid-column: span 2; background: linear-gradient(135deg, rgba(16,185,129,.16), rgba(16,185,129,.04)); border-color: rgba(52,211,153,.35); }
.kpi.big b { font-size: 24px; color: var(--accent); }
.rubro-bars { display: flex; flex-direction: column; gap: 7px; }
.rb { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; font-size: 12px; }
.rb .bar { grid-column: span 2; height: 6px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.rb .bar i { display: block; height: 100%; background: var(--accent-strong); border-radius: 4px; }
.rb em { font-style: normal; font-variant-numeric: tabular-nums; color: var(--muted); }
.bom { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.bom th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 6px 4px; border-bottom: 1px solid var(--border); position: sticky; top: -14px; background: var(--side); }
.bom td { padding: 6px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
.bom td.n { text-align: right; white-space: nowrap; }
.bom tr.grp td { background: var(--surface-2); font-weight: 600; font-size: 11.5px; color: var(--accent); }
.bom .note { display: block; color: var(--muted); font-size: 11px; }
.ref { font-size: 9.5px; border: 1px solid var(--warn); color: var(--warn); padding: 0 4px; border-radius: 4px; margin-left: 4px; vertical-align: 1px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.empty b { display: block; color: var(--text); font-size: 14px; margin-bottom: 6px; }
.prop-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 12.5px; }
.prop-grid dt { color: var(--muted); }
.prop-grid dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.form-col { display: flex; flex-direction: column; gap: 10px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.layer-row { display: flex; align-items: center; gap: 9px; padding: 5px 4px; border-radius: 6px; }
.layer-row:hover { background: var(--surface-2); }
.layer-row .cnt { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.layer-row input { accent-color: var(--accent-strong); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; background: var(--surface-3); color: var(--muted); }
.badge.ok { background: rgba(52,211,153,.15); color: var(--accent); }

/* ---------- 3D */
.view3d { position: absolute; inset: 0; z-index: 1050; background: #0b1410; display: flex; flex-direction: column; }
.v3d-bar { display: flex; align-items: center; gap: 14px; padding: 8px 12px; background: var(--side); border-bottom: 1px solid var(--border); }
.v3d-canvas { flex: 1; position: relative; min-height: 0; }
.v3d-canvas canvas { display: block; width: 100%; height: 100%; }
.v3d-shot { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(4, 10, 7, .74); backdrop-filter: blur(3px); }
.shot-box { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; padding: 20px 22px; max-width: min(94%, 1200px); text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.shot-box p { margin: 8px 0 0; color: var(--muted); }
.shot-box img { display: block; max-width: 100%; max-height: 68vh; margin: 0 auto 10px; border-radius: 8px; }
.shot-box .btn-row { justify-content: center; margin-top: 14px; }
.shot-spin { width: 38px; height: 38px; margin: 0 auto 12px; border-radius: 50%; border: 3px solid var(--border-strong); border-top-color: var(--accent); animation: shotspin .9s linear infinite; }
@keyframes shotspin { to { transform: rotate(360deg); } }
.shot-panel { position: absolute; top: 58px; right: 12px; z-index: 25; width: 300px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; padding: 14px 16px; box-shadow: 0 16px 40px rgba(0,0,0,.45); display: flex; flex-direction: column; gap: 8px; }
.shot-panel h3 { margin: 0 0 2px; font-size: 14px; }
.shot-panel .seg.wide { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.shot-panel .seg.wide button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); cursor: pointer; text-align: left; }
.shot-panel .seg.wide button.on { border-color: var(--accent); background: rgba(52,211,153,.14); }
.shot-panel .seg.wide small { color: var(--muted); font-size: 11px; }
.shot-panel .err { color: #fca5a5; margin: 0; font-size: 12px; }
.shot-panel .btn-row { justify-content: flex-end; margin-top: 4px; }
.photo-guide { position: absolute; z-index: 5; pointer-events: none; border: 1.5px solid rgba(255,255,255,.85); box-shadow: 0 0 0 9999px rgba(0,0,0,.42); }
.photo-guide::before, .photo-guide::after { content: ''; position: absolute; inset: 33.33% 0; border-top: 1px solid rgba(255,255,255,.25); border-bottom: 1px solid rgba(255,255,255,.25); }
.photo-guide::after { inset: 0 33.33%; border: 0; border-left: 1px solid rgba(255,255,255,.25); border-right: 1px solid rgba(255,255,255,.25); }
.v3d-canvas { overflow: hidden; }
.v3d-mode button[data-v3dmode="pro"].on { background: linear-gradient(135deg, rgba(52,211,153,.25), rgba(250,204,21,.2)); color: #fef3c7; }
.v3d-mode .lock { font-size: 11px; }
.drive-hud { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.drive-hud .dh-speed { position: absolute; right: 18px; bottom: 54px; background: rgba(6,10,8,.55); border: 1px solid rgba(255,255,255,.18); border-radius: 12px; padding: 6px 14px; color: #e8fff5; text-align: right; backdrop-filter: blur(3px); }
.drive-hud .dh-speed b { font-size: 30px; display: block; line-height: 1.1; }
.drive-hud .dh-speed span { font-size: 11px; color: #a7b8b0; }
.drive-hud .dh-msg { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); background: rgba(127,29,29,.75); color: #fee2e2; padding: 6px 14px; border-radius: 99px; font-size: 13px; }
.drive-hud .dh-msg:empty { display: none; }
.drive-hud .dh-help { position: absolute; top: 12px; left: 12px; max-width: 380px; font-size: 11.5px; color: #e5efe9; background: rgba(0,0,0,.45); padding: 6px 10px; border-radius: 8px; }
.drive-hud .dh-mode { display: none; position: absolute; right: 18px; bottom: 132px; padding: 4px 12px; border-radius: 8px; background: #d97706; color: #1c1206; font-weight: 800; font-size: 13px; letter-spacing: .14em; font-style: italic; box-shadow: 0 2px 10px rgba(0,0,0,.35); }
.drive-hud.rally .dh-mode { display: block; }
.gpu-chip { font-size: 11.5px; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--border-strong); color: var(--muted); max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gpu-chip.warn { border-color: #f59e0b; color: #fcd34d; background: rgba(245,158,11,.12); cursor: help; }
.v3d-help { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); margin: 0; font-size: 11.5px; color: #dfe; background: rgba(0,0,0,.45); padding: 4px 12px; border-radius: 99px; pointer-events: none; }

/* ---------- diálogos */
.dlg { border: 1px solid var(--border-strong); border-radius: 14px; padding: 0; background: var(--surface); color: var(--text); width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow); max-height: calc(100vh - 40px); }
.dlg.wide { width: min(980px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(2px); }
.dlg-inner { display: flex; flex-direction: column; max-height: calc(100vh - 42px); }
.dlg header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.dlg h2 { margin: 0; font-size: 15px; }
.dlg .x { border: 0; background: transparent; cursor: pointer; font-size: 16px; color: var(--muted); }
.dlg-body { padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.dlg footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }
.dlg footer:empty { display: none; }
.list { display: flex; flex-direction: column; gap: 6px; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item small { color: var(--muted); display: block; }
.price-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.price-table td, .price-table th { padding: 5px 6px; border-bottom: 1px solid var(--border); text-align: left; }
.price-table th { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.price-table input { height: 30px; text-align: right; }
.sub-preview { width: 100%; height: 220px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.log { font: 12px var(--mono); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px; white-space: pre-wrap; max-height: 220px; overflow: auto; }

/* ---------- impresión A4 */
.print-doc { display: none; }
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  html, body { background: #fff !important; color: #111 !important; height: auto; }
  body > *:not(.print-doc) { display: none !important; }
  .print-doc { display: block; font: 10pt/1.4 var(--font); color: #111; }
  .print-doc h1 { font-size: 17pt; margin: 0; }
  .print-doc h2 { font-size: 11.5pt; margin: 14px 0 6px; border-bottom: 2px solid #10b981; padding-bottom: 3px; }
  .pd-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #ccc; padding-bottom: 8px; }
  .pd-head img { height: 40px; }
  .pd-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
  .pd-meta div { border: 1px solid #ddd; border-radius: 6px; padding: 6px 8px; }
  .pd-meta span { display: block; font-size: 8pt; color: #666; text-transform: uppercase; }
  .pd-meta b { font-size: 11.5pt; }
  .pd-plan { width: 100%; height: 330px; border: 1px solid #ddd; border-radius: 6px; margin-top: 8px; }
  .pd-table { width: 100%; border-collapse: collapse; font-size: 8.8pt; }
  .pd-table th { text-align: left; background: #f0f5f2; padding: 4px 5px; border-bottom: 1px solid #bbb; }
  .pd-table td { padding: 3px 5px; border-bottom: 1px solid #e3e3e3; }
  .pd-table td.n, .pd-table th.n { text-align: right; white-space: nowrap; }
  .pd-table tr.grp td { background: #f7f7f7; font-weight: 700; }
  .pd-table tr.tot td { font-weight: 700; font-size: 10.5pt; border-top: 2px solid #111; }
  .pd-foot { margin-top: 14px; font-size: 8pt; color: #555; }
  .pd-break { page-break-before: always; }
}

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 1fr; grid-template-rows: 1fr 45vh; }
  .panel { border-left: 0; border-top: 1px solid var(--border); }
  .metrics .metric:nth-child(n+3):not(.total) { display: none; }
}
@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; }
  .metrics { order: 3; flex-basis: 100%; }
  .proj-name { width: 140px !important; }
  .legend, .basemap { display: none; }
  .ctx { left: 60px; width: calc(100% - 72px); }
}
