:root {
  --bg: #0d1117;
  --glass: rgba(17, 22, 30, 0.74);
  --glass-strong: rgba(17, 22, 30, 0.9);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #e5e9f0;
  --muted: #8b95a5;
  --accent: #2f9bff;
  --accent-soft: rgba(47, 155, 255, 0.18);
  --cut: #e5534b;
  --fill: #3fb950;
  --warn: #d29922;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "Cascadia Mono", Consolas, ui-monospace, monospace;
  --left-w: 280px;
  --right-w: 300px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font: 13px/1.4 var(--font); }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
.hidden { display: none !important; }

#app { position: fixed; inset: 0; }
#viewport { position: absolute; inset: 0; z-index: 0; isolation: isolate; }   /* las etiquetas 3D (z-index propio) no pasan por encima de los paneles */
#viewport canvas { display: block; outline: none; }
#viewport.tool-active canvas { cursor: crosshair; }

.glass {
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

/* ---------- Top bar ---------- */
#topbar {
  position: absolute; top: 10px; left: 10px; right: 10px; height: 48px;
  display: flex; align-items: center; gap: 6px; padding: 0 8px; z-index: 20;
  overflow-x: auto; scrollbar-width: none;
}
.brand { display: flex; align-items: center; gap: 8px; padding: 0 8px 0 4px; white-space: nowrap; font-size: 14px; }
/* flechas de la barra cuando no caben todos los botones (js/ui/barra.js) */
.tb-flecha {
  position: sticky; z-index: 2; flex: none; align-self: stretch; width: 26px; margin: 4px 0; border: 0; border-radius: 8px;
  font-size: 22px; line-height: 1; color: var(--text); cursor: pointer; background: var(--glass-strong);
  box-shadow: 0 0 12px 6px var(--glass-strong);
}
.tb-flecha:hover { color: var(--accent); }
.tb-flecha-izq { left: 0; order: -1; }
.tb-flecha-der { right: 0; margin-left: auto; }
.tb-flecha.hidden { display: none; }
.brand b { color: var(--accent); }
.logo svg { width: 22px; height: 22px; color: var(--accent); }
.tb-group { display: flex; align-items: center; gap: 2px; padding: 0 6px; border-left: 1px solid var(--line); }
.tb-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 9px;
  background: transparent; border: 1px solid transparent; border-radius: 7px; cursor: pointer; white-space: nowrap;
  color: var(--text);
}
.tb-btn:hover { background: rgba(255, 255, 255, 0.06); }
.tb-btn.active { background: var(--accent-soft); border-color: rgba(47, 155, 255, 0.45); color: #cfe6ff; }
.tb-btn svg { width: 18px; height: 18px; }
.tb-btn .lbl { font-size: 12px; }
@media (max-width: 1400px) { .tb-btn .lbl { display: none; } }

/* ---------- Side panels ---------- */
.panel { position: absolute; top: 68px; bottom: 50px; display: flex; flex-direction: column; z-index: 10; transition: transform .2s ease; }
#left { left: 10px; width: var(--left-w); }
#right { right: 10px; width: var(--right-w); top: 200px; }
#left.collapsed { transform: translateX(calc(-100% + 34px)); }
#right.collapsed { transform: translateX(calc(100% - 34px)); }
.panel.collapsed .panel-body { visibility: hidden; }
/* El botón de contraer queda siempre en el borde que permanece visible */
#right .panel-head [data-toggle] { order: -1; margin-left: -6px; }
.panel [data-toggle] { transition: transform .2s ease; }
.panel.collapsed [data-toggle] { transform: rotate(180deg); color: var(--accent); }
.panel.collapsed .panel-head { cursor: pointer; }
.panel.collapsed .panel-head:hover { background: rgba(47, 155, 255, 0.12); }
#app.profile-open .panel { bottom: 280px; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 8px 12px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 13px; font-weight: 600; flex: 1; letter-spacing: .2px; }
.panel-head svg { width: 16px; height: 16px; color: var(--accent); }
.panel-body { overflow: auto; padding: 8px 6px 10px; flex: 1; }
.icon-btn { background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; padding: 2px 6px; border-radius: 6px; }
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.empty { color: var(--muted); padding: 10px; font-size: 12.5px; }

/* ---------- Layer tree ---------- */
.lt-group { margin-bottom: 6px; }
.lt-group-head { display: flex; align-items: center; gap: 6px; padding: 5px 6px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; cursor: pointer; user-select: none; }
.lt-group-head .count { margin-left: auto; background: rgba(255,255,255,.07); border-radius: 8px; padding: 0 6px; font-size: 10.5px; }
.lt-item { border-radius: 7px; margin: 1px 0; }
.lt-row { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 7px; cursor: pointer; }
.lt-row:hover { background: rgba(255, 255, 255, 0.05); }
.lt-item.selected > .lt-row { background: var(--accent-soft); }
.lt-row .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.lt-row .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lt-row .act { opacity: 0; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 3px; }
.lt-row:hover .act { opacity: 1; }
.lt-row .act:hover { color: var(--text); }
.lt-row input[type=checkbox] { accent-color: var(--accent); margin: 0; }
.lt-extra { display: none; padding: 2px 8px 8px 30px; color: var(--muted); font-size: 11.5px; }
.lt-item.open .lt-extra { display: block; }
.lt-extra label { display: flex; align-items: center; gap: 8px; }
.lt-extra input[type=range] { flex: 1; }

/* ---------- Inspector ---------- */
.section { margin: 6px 4px 12px; }
.section h3, #inspector h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 10px 4px 6px; display: flex; align-items: center; gap: 6px; }
.kv { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.kv td { padding: 3px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.kv td:first-child { color: var(--muted); width: 46%; }
.kv td:last-child { font-family: var(--mono); font-size: 12px; text-align: right; word-break: break-word; }
.title-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px 2px; }
.title-row .badge { font-size: 10.5px; padding: 1px 7px; border-radius: 10px; background: var(--accent-soft); color: #9ccfff; }
.title-row b { font-size: 14px; }
.cut { color: var(--cut); } .fill { color: var(--fill); }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; font-size: 11px; text-transform: none; letter-spacing: 0; margin-left: auto; }
.tpl-form { display: grid; grid-template-columns: 1fr 104px; gap: 4px 8px; padding: 4px 6px; font-size: 12px; align-items: center; }
.tpl-form select { width: 100%; background: rgba(0,0,0,.25); border: 1px solid var(--line); border-radius: 5px; padding: 2px 4px; }
.tpl-form select option { background: #1b2230; }
.tpl-form input[type=checkbox] { width: auto; justify-self: end; accent-color: var(--accent); }
.tpl-form input { width: 100%; background: rgba(0,0,0,.25); border: 1px solid var(--line); border-radius: 5px; padding: 2px 5px; text-align: right; }
.btn-primary { background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 5px 10px; cursor: pointer; margin: 6px; }
.btn-primary:hover { filter: brightness(1.1); }

/* ---------- Measurements ---------- */
.m-item { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; margin: 4px; font-size: 12px; }
.m-item .m-title { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.m-item .m-val { font-family: var(--mono); }
.m-label {
  background: rgba(10, 14, 20, 0.85); color: #fff; border: 1px solid rgba(255, 210, 60, .7); border-radius: 6px;
  padding: 2px 7px; font: 11.5px/1.35 var(--mono); white-space: nowrap; transform: translateY(-14px); pointer-events: none;
}
.sta-label { color: #fff; font: 600 11px var(--mono); text-shadow: 0 1px 3px #000, 0 0 2px #000; pointer-events: none; transform: translateY(-12px); white-space: nowrap; }
.sta-label::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #ff4d4f; margin-right: 4px; vertical-align: middle; }
.obj-label { color: #e7f2ff; font: 11px var(--font); background: rgba(12,16,22,.7); border-radius: 4px; padding: 1px 5px; pointer-events: none; transform: translateY(-14px); white-space: nowrap; }

/* ---------- Legend ---------- */
.legend-bar { height: 10px; border-radius: 5px; margin: 4px 6px; }
.legend-scale { display: flex; justify-content: space-between; font: 11px var(--mono); color: var(--muted); padding: 0 6px; }
.legend-classes { display: grid; grid-template-columns: 14px 1fr; gap: 3px 8px; padding: 2px 8px; font-size: 12px; align-items: center; }
.legend-classes i { width: 14px; height: 10px; border-radius: 3px; display: block; }

/* ---------- Profile ---------- */
#profile { position: absolute; left: calc(var(--left-w) + 20px); right: calc(var(--right-w) + 20px); bottom: 50px; height: 220px; z-index: 12; display: flex; flex-direction: column; }
#profile.collapsed { display: none; }
.profile-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 12px; }
.profile-head b { white-space: nowrap; }
#fly-controls { flex-wrap: wrap; }
.profile-head svg { width: 16px; height: 16px; color: var(--accent); }
.profile-head select { background: rgba(0,0,0,.3); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; max-width: 220px; }
.readout { font-family: var(--mono); color: var(--muted); font-size: 11.5px; }
.spacer { flex: 1; }
#profile-canvas { flex: 1; width: 100%; min-height: 0; cursor: crosshair; }
#fly-controls { display: inline-flex; gap: 8px; align-items: center; }
#fly-controls label { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
#fly-sta { width: 86px; background: rgba(0,0,0,.3); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; font-family: var(--mono); font-size: 12px; }

/* ---------- Status bar ---------- */
#statusbar {
  position: absolute; left: 10px; right: 10px; bottom: 10px; height: 32px; z-index: 15;
  display: flex; align-items: center; gap: 14px; padding: 0 12px; font-size: 12px; white-space: nowrap; overflow: hidden;
}
#statusbar i { color: var(--muted); font-style: normal; margin-right: 3px; }
#statusbar b { font-family: var(--mono); font-weight: 500; }
#statusbar .sep { width: 1px; height: 16px; background: var(--line-strong); }
.chip { border: 1px solid var(--line-strong); border-radius: 10px; padding: 1px 8px; color: var(--muted); font-size: 11px; }
.mini { background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; cursor: pointer; font-size: 12px; }
.mini:hover { background: rgba(255,255,255,.12); }
.mini.active { background: var(--accent-soft); border-color: var(--accent); }

/* ---------- Walk HUD ---------- */
#walk-hud { position: absolute; left: 50%; transform: translateX(-50%); bottom: 54px; z-index: 16; display: flex; gap: 14px; align-items: center; padding: 10px 14px; }
#app.profile-open #walk-hud { bottom: 284px; }
.walk-pad { display: grid; grid-template-columns: repeat(3, 38px); gap: 4px; }
.walk-pad .mini { height: 34px; font-size: 14px; padding: 0; user-select: none; touch-action: none; }
.walk-opts { display: flex; flex-direction: column; gap: 4px; font-size: 12px; max-width: 330px; }
.walk-opts label { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.walk-opts label input { flex: 1; }
.walk-opts b { color: var(--text); font-family: var(--mono); min-width: 28px; text-align: right; }
.walk-opts .hint { margin: 2px 0 0; }

/* ---------- Tráfico ---------- */
#veh-list { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; max-height: 220px; overflow: auto; }
.veh-item { display: flex; align-items: center; gap: 4px; font-size: 12px; padding: 3px 6px; border-radius: 6px; background: rgba(255,255,255,.03); }
.veh-item span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); font-size: 11px; }
.veh-item.active { background: var(--accent-soft); }
#pop-traffic .form label { display: flex; align-items: center; gap: 6px; }

/* ---------- Corte 3D de capas ---------- */
#cut-hud { position: absolute; left: 50%; transform: translateX(-50%); bottom: 54px; z-index: 16; padding: 8px 12px; min-width: 300px; max-width: min(560px, calc(100vw - 32px)); }
#app.profile-open #cut-hud { bottom: 284px; }
.cut-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.cut-head svg { width: 16px; height: 16px; color: var(--accent); }
#cut-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0; font-size: 12px; }
#cut-legend span { display: inline-flex; align-items: center; gap: 6px; }
#cut-legend i { width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(255,255,255,.25); display: inline-block; }
#cut-legend small { color: var(--muted); }
.cut-actions { display: flex; gap: 6px; }
#cut-hud .hint { margin: 6px 0 0; }
.cut-label { background: rgba(17,22,30,.82); border: 1px solid rgba(255,255,255,.18); color: #e6edf3; font-size: 11px; padding: 2px 7px; border-radius: 6px; white-space: nowrap; transform: translate(0, -50%); display: inline-flex; gap: 6px; align-items: center; }
.cut-label i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; border: 1px solid rgba(255,255,255,.3); }
.lt-item.suppressed .name { opacity: .5; font-style: italic; }

/* ---------- View cube & compass ---------- */
#viewcube { position: absolute; top: 66px; right: calc(var(--right-w) - 112px); width: 120px; height: 120px; z-index: 11; }
#right.collapsed ~ #viewcube { right: 50px; }
#compass {
  position: absolute; top: 76px; right: calc(var(--right-w) - 2px); width: 40px; height: 40px; border-radius: 50%; z-index: 11;
  background: rgba(17,22,30,.65); border: 1px solid var(--line-strong); cursor: pointer;
}
#right.collapsed ~ #compass { right: 172px; }
#compass .needle { position: absolute; inset: 0; transition: transform .05s linear; }
#compass .needle::before { content: ""; position: absolute; left: 50%; top: 5px; transform: translateX(-50%); border: 6px solid transparent; border-bottom: 14px solid #ff4d4f; border-top: 0; }
#compass .needle::after { content: ""; position: absolute; left: 50%; bottom: 5px; transform: translateX(-50%); border: 6px solid transparent; border-top: 14px solid #c9d1d9; border-bottom: 0; }
#compass .needle span { position: absolute; left: 50%; top: -15px; transform: translateX(-50%); font: 700 10px var(--font); color: #ff7b7d; }

/* ---------- Popovers ---------- */
.popover { position: absolute; top: 66px; z-index: 30; width: 330px; padding: 10px 12px; background: var(--glass-strong); }
.popover-wide { width: min(560px, calc(100vw - 20px)); max-height: calc(100vh - 140px); overflow: auto; }
.imp-file { border-top: 1px solid var(--line, rgba(255,255,255,.12)); padding: 8px 0; }
.imp-file:first-child { border-top: 0; }
.imp-file h4 { margin: 0 0 4px; font-size: 13px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.imp-chip { font-size: 11px; padding: 1px 7px; border-radius: 10px; background: rgba(60,207,145,.18); color: #3ccf91; }
.imp-chip.warn { background: rgba(224,184,74,.18); color: #e0b84a; }
.imp-chip.err { background: rgba(255,107,94,.18); color: #ff6b5e; }
.imp-grid { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; font-size: 12px; margin: 4px 0; }
.imp-grid span:nth-child(odd) { color: var(--muted); }
.imp-list { margin: 2px 0 6px; padding-left: 18px; font-size: 12px; }
.imp-list li { margin: 1px 0; }
.imp-list .lin { color: var(--muted); font-variant-numeric: tabular-nums; }
.imp-file details summary { cursor: pointer; font-size: 12px; color: var(--muted); margin-top: 4px; }
.popover h3 { margin: 4px 0 8px; font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .6px; }
.popover .form { display: flex; flex-direction: column; gap: 8px; }
.popover .form label { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.popover .form label input[type=range] { flex: 1; }
.popover select, .popover input[type=number], .popover input[type=date], .popover input:not([type]) {
  background: rgba(0,0,0,.3); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; color-scheme: dark;
}
.popover select { max-width: 200px; }
.popover .row { display: flex; gap: 6px; margin-bottom: 8px; }
.popover .row.wrap { flex-wrap: wrap; }
.popover .row input { flex: 1; }
.hint { color: var(--muted); font-size: 11.5px; margin: 8px 0 2px; }
.clip-row { display: grid; grid-template-columns: 100px 1fr auto; gap: 8px; align-items: center; margin: 6px 0; }
.view-item { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 6px; }
.view-item:hover { background: rgba(255,255,255,.05); }
.view-item span { flex: 1; cursor: pointer; }

/* ---------- Metrados ---------- */
#metrados { position: absolute; left: 50%; top: 66px; transform: translateX(-50%); z-index: 40; width: min(1180px, calc(100vw - 32px)); height: calc(100vh - 120px); display: flex; flex-direction: column; background: var(--glass-strong); overflow: hidden; }
.mt-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.mt-head h2 { margin: 0; font-size: 14px; font-weight: 600; flex: 1; }
.mt-head svg { width: 18px; height: 18px; color: var(--accent); }
.mt-controls { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.mt-controls label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.mt-controls input, .mt-controls select { background: rgba(255,255,255,.06); border: 1px solid var(--line-strong); border-radius: 6px; padding: 3px 6px; color: var(--text); font-family: var(--mono); font-size: 12px; }
.mt-controls input[type=number] { width: 64px; }
.mt-controls select option { background: #1b2230; }
.mt-controls .btn-primary { margin: 0; }
.mt-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; padding: 10px 12px 4px; }
.mt-card { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: rgba(255,255,255,.03); }
.mt-card .t { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.mt-card .v { font: 600 18px var(--mono); margin: 2px 0; }
.mt-card .s { color: var(--muted); font-size: 11px; }
.mt-chart-wrap { padding: 4px 12px 0; }
.mt-chart-title { color: var(--muted); font-size: 11px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mt-readout { font-family: var(--mono); color: var(--text); }
.mt-chart { display: block; width: 100%; height: 150px; cursor: crosshair; }
.mt-table-wrap { flex: 1; overflow: auto; margin: 6px 12px 0; border: 1px solid var(--line); border-radius: 8px; min-height: 120px; }
.mt-table { border-collapse: separate; border-spacing: 0; width: 100%; font: 12px var(--mono); }
.mt-table th { position: sticky; top: 0; background: #1a212d; color: var(--muted); font: 600 11px var(--font); text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.mt-table td { text-align: right; padding: 3px 8px; border-bottom: 1px solid rgba(255,255,255,.04); white-space: nowrap; }
.mt-table th:first-child, .mt-table td:first-child { text-align: left; position: sticky; left: 0; background: #161c27; }
.mt-table th:first-child { z-index: 1; background: #1a212d; }
.mt-table tbody tr { cursor: pointer; }
.mt-table tbody tr:hover td { background: rgba(47,155,255,.10); }
.mt-table tbody tr.sel td { background: var(--accent-soft); }
.mt-table td.zero { color: rgba(139,149,165,.55); }
.mt-table tfoot td { position: sticky; bottom: 0; background: #1a212d; font-weight: 700; border-top: 1px solid var(--line-strong); padding: 6px 8px; }
.mt-foot { display: flex; align-items: center; gap: 8px; padding: 8px 12px; }
.mt-foot .mt-note { flex: 1; margin: 0; }
.mt-foot .btn-primary { margin: 0; }
.mt-foot button:disabled { opacity: .5; cursor: default; }
.mt-tabs { display: flex; gap: 2px; background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 8px; padding: 2px; margin-right: 8px; }
.mt-tabs button { background: none; border: 0; border-radius: 6px; padding: 4px 12px; cursor: pointer; color: var(--muted); font-size: 12.5px; }
.mt-tabs button:hover { color: var(--text); }
.mt-tabs button.active { background: var(--accent-soft); color: #cfe6ff; }
.mt-opts { display: contents; }
.mt-opts.hidden { display: none !important; }
.mt-sep { width: 1px; align-self: stretch; background: var(--line); }
.mt-controls input[type=checkbox] { accent-color: var(--accent); }
.mt-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.mt-split { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(260px, 380px) 1fr; gap: 12px; padding: 6px 12px 0; }
.mt-diagram { border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: rgba(255,255,255,.02); display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.mt-dg { display: block; width: 100%; height: 230px; }
.mt-dg-note { margin: 0; }
.mt-tables { display: flex; flex-direction: column; min-height: 0; overflow: auto; }
.mt-tables h4 { margin: 2px 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.mt-tables .mt-table-wrap { flex: none; margin: 0 0 10px; min-height: 0; }
.mt-table td.txt { text-align: left; font-family: var(--font); white-space: normal; min-width: 64px; }
.mt-partidas td:nth-child(2) { min-width: 220px; }
.mt-partidas th:nth-child(2), .mt-partidas th:nth-child(3) { text-align: left; }
.mt-table td.q { color: #cfe6ff; font-weight: 700; }
.mt-partidas tbody tr, .mt-partidas td:first-child { cursor: default; }
@media (max-width: 900px) { .mt-split { grid-template-columns: 1fr; overflow: auto; } }

/* ---------- Visor de secciones transversales ---------- */
#xsec { position: absolute; right: calc(var(--right-w) + 22px); top: 66px; z-index: 35; width: min(640px, calc(100vw - 32px)); height: 430px; min-width: 380px; min-height: 280px; display: flex; flex-direction: column; background: var(--glass-strong); resize: both; overflow: hidden; outline: none; }
.xs-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); cursor: move; user-select: none; }
.xs-head h2 { margin: 0; font-size: 13px; font-weight: 600; flex: 1; }
.xs-head svg { width: 17px; height: 17px; color: var(--accent); }
.xs-head select, .xs-bar select, .xs-bar input:not([type]) { background: rgba(255,255,255,.06); border: 1px solid var(--line-strong); border-radius: 6px; padding: 2px 6px; color: var(--text); font-family: var(--mono); font-size: 12px; }
.xs-head select option, .xs-bar select option { background: #1b2230; }
.xs-bar { display: flex; align-items: center; gap: 6px; padding: 6px 10px; flex-wrap: wrap; }
.xs-bar input[type=range] { flex: 1; min-width: 90px; accent-color: var(--accent); }
.xs-bar label { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
.xs-bar input[type=checkbox] { accent-color: var(--accent); }
.xs-canvas { flex: 1; min-height: 0; width: 100%; display: block; cursor: crosshair; }
.xs-info { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 6px 10px 8px; border-top: 1px solid var(--line); font: 11.5px var(--mono); }
.xs-info i { color: var(--muted); font-style: normal; font-family: var(--font); margin-right: 3px; }

.xs-legend { display: flex; flex-wrap: wrap; gap: 2px 12px; padding: 0 10px 2px; font-size: 11.5px; color: var(--muted); }
.xs-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.xs-legend i.dash { background: repeating-linear-gradient(90deg, #ffd60a 0 4px, transparent 4px 7px); }

/* ---------- Roles de superficies ---------- */
#roles { position: absolute; left: 50%; top: 90px; transform: translateX(-50%); z-index: 45; width: min(560px, calc(100vw - 32px)); background: var(--glass-strong); padding-bottom: 8px; }
.roles-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.roles-head h2 { margin: 0; font-size: 13.5px; font-weight: 600; flex: 1; }
.roles-head svg { width: 17px; height: 17px; color: var(--accent); }
#roles .hint { padding: 0 12px; }
.roles-list { display: flex; flex-direction: column; gap: 6px; padding: 6px 12px; max-height: 50vh; overflow: auto; }
.roles-row { display: flex; align-items: center; gap: 10px; }
.roles-row span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roles-row select, .tpl-form select[data-role-layer] { background: rgba(255,255,255,.06); border: 1px solid var(--line-strong); border-radius: 6px; padding: 3px 6px; color: var(--text); }
.roles-row select option { background: #1b2230; }
.roles-foot { display: flex; justify-content: flex-end; padding: 4px 12px 0; }
.role-badge { font-size: 10px; padding: 0 6px; border-radius: 8px; margin-left: 4px; cursor: pointer; white-space: nowrap; border: 1px solid var(--line-strong); color: var(--muted); }
.role-badge.tn { color: #e3b47a; border-color: rgba(227,180,122,.5); }
.role-badge.diseno { color: #9ccfff; border-color: rgba(47,155,255,.55); }
.role-badge.none { color: var(--warn); border-color: rgba(210,153,34,.6); }

/* ---------- Metrados: mensajes y capas ---------- */
.mt-msg { margin: 8px 12px 0; padding: 7px 10px; border-radius: 8px; background: rgba(210,153,34,.10); border: 1px solid rgba(210,153,34,.35); color: #e8d3a2; font-size: 12px; line-height: 1.45; }
.mt-msg.hidden { display: none; }
.mt-layers { padding: 8px 12px 0; }
.mt-layers h4, .mt-pane > .mt-tables h4 { margin: 2px 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.mt-layer { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; flex-wrap: wrap; }
.mt-layer input, .mt-layer select { background: rgba(255,255,255,.06); border: 1px solid var(--line-strong); border-radius: 6px; padding: 3px 6px; color: var(--text); font-size: 12px; }
.mt-layer select option { background: #1b2230; }
.mt-layer label { display: inline-flex; gap: 5px; align-items: center; color: var(--muted); font-size: 12px; }
.mt-pane > .mt-tables { flex: 1; min-height: 0; padding: 6px 12px 0; }
.mt-pane > .mt-summary:empty { display: none; }

/* ---------- Loader / toasts / dropzone ---------- */
#loader { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 50; display: flex; gap: 14px; align-items: center; padding: 16px 20px; min-width: 320px; background: var(--glass-strong); }
#loader-msg { color: var(--muted); font-size: 12px; margin: 2px 0 6px; }
.bar { height: 4px; background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.spinner { width: 26px; height: 26px; border: 3px solid rgba(255,255,255,.12); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#toasts { position: absolute; bottom: 54px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.toast { background: var(--glass-strong); border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 14px; font-size: 12.5px; box-shadow: 0 6px 20px rgba(0,0,0,.4); animation: fadein .2s; }
.toast.error { border-color: var(--cut); }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }
#dropzone { position: absolute; inset: 0; z-index: 70; background: rgba(47,155,255,.12); border: 3px dashed var(--accent); display: grid; place-items: center; font-size: 22px; text-align: center; pointer-events: none; }
#dropzone small { color: var(--muted); font-size: 13px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }

@media (max-width: 900px) {
  :root { --left-w: 230px; --right-w: 240px; }
  #profile { left: 10px; right: 10px; }
}

/* ---- Fase 2: origen de los datos, acciones de selección, árbol con búsqueda ---- */
.org { display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 8px; font-size: 10px; line-height: 15px; vertical-align: 1px; cursor: help; white-space: nowrap; }
.org-A { background: rgba(60,207,145,.16); color: #3ccf91; }
.org-D { background: rgba(90,160,255,.16); color: #7db4ff; }
.org-S { background: rgba(224,184,74,.18); color: #e0b84a; }
.org-ley { margin-top: 10px; font-size: 11px; color: var(--muted); line-height: 1.6; }
.org-src { font-size: 11px; color: var(--muted); margin: -2px 0 6px; }
.sel-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 4px; }
.sel-actions .sel-op { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.sel-actions .sel-op input { width: 90px; }
.pt-tools { display: flex; gap: 6px; padding: 0 0 8px; position: sticky; top: 0; z-index: 1; }
.pt-search { flex: 1; min-width: 0; }
.pt-modo { width: auto; }
.lt-item .exp, .lt-item .exp-sp { width: 16px; flex: none; }
.lt-subs { margin: 2px 0 4px 26px; max-height: 260px; overflow: auto; font-size: 11.5px; }
.lt-sub { padding: 2px 6px; border-radius: 4px; cursor: pointer; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lt-sub:hover { background: rgba(255,255,255,.06); color: inherit; }
.lt-sub.selected { background: rgba(0,170,255,.18); color: inherit; }
.lt-sub.muted { cursor: default; }
.pt-sets { margin-top: 10px; border-top: 1px solid rgba(255,255,255,.08); padding-top: 8px; font-size: 12px; }
.pt-sets-head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: .5px; margin-bottom: 4px; }
.pt-set { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.pt-set .act { margin-left: auto; }

/* ---- Fase 3: escala gráfica (ortográfica) ---- */
#escala { position: absolute; left: calc(var(--left-w) + 22px); bottom: 50px; z-index: 11; padding: 4px 8px; font: 11px var(--mono); display: flex; align-items: center; gap: 8px; pointer-events: none; }
#escala .barra { height: 6px; border: 1.5px solid var(--text); border-top: 0; }
#escala .esc { color: var(--muted); }

/* ---- Fase 3: modo revisión (planta + 3D + perfil + sección) ---- */
#plan-view { position: absolute; left: 10px; top: 66px; right: calc(50% + 5px); bottom: 370px; z-index: 11; display: flex; flex-direction: column; pointer-events: none; border: 1px solid rgba(255,255,255,.18); border-radius: 10px; overflow: hidden; }
#plan-view .pv-head { display: flex; align-items: center; gap: 8px; padding: 4px 8px; font-size: 12px; pointer-events: auto; border-radius: 0; }
#plan-view .pv-head .spacer { flex: 1; }
#plan-view .pv-info { color: var(--muted); }
#plan-view .pv-body { flex: 1; pointer-events: auto; cursor: crosshair; }
body.revision #profile { left: 10px !important; right: calc(50% + 5px) !important; bottom: 50px !important; height: 300px !important; }
body.revision #xsec { left: calc(50% + 5px) !important; right: 10px !important; top: auto !important; bottom: 50px !important; height: 300px !important; width: auto !important; min-width: 0; resize: none; }
body.revision #escala { left: 22px; bottom: 360px; }

/* ---- Fase 3: paleta de comandos y menú contextual ---- */
#paleta { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.25); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; }
#paleta.hidden { display: none; }
.pal-box { width: min(620px, calc(100vw - 32px)); max-height: 70vh; display: flex; flex-direction: column; padding: 8px; background: var(--glass-strong); }
.pal-in { font-size: 15px; padding: 9px 12px; width: 100%; }
.pal-list { overflow: auto; margin-top: 6px; }
.pal-grupo { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 8px 10px 3px; }
.pal-item { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.pal-item.sel, .pal-item:hover { background: var(--accent-soft); }
.pal-vacio { color: var(--muted); padding: 12px; }
.pal-pie { color: var(--muted); font-size: 11px; padding: 6px 4px 0; border-top: 1px solid var(--line); margin-top: 6px; }
kbd { font: 11px var(--mono); padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--muted); margin-left: 12px; white-space: nowrap; }
#menu-ctx { position: fixed; z-index: 80; min-width: 230px; padding: 4px; background: var(--glass-strong); font-size: 12.5px; }
#menu-ctx.hidden { display: none; }
#menu-ctx .mc-tit { color: var(--muted); font-size: 11px; padding: 4px 10px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 340px; }
#menu-ctx .mc-item { display: flex; justify-content: space-between; padding: 5px 10px; border-radius: 5px; cursor: pointer; }
#menu-ctx .mc-item:hover { background: var(--accent-soft); }
#menu-ctx .mc-sep { height: 1px; background: var(--line); margin: 4px 0; }

/* ---- Fase 3: tema claro (los gráficos de perfil y sección conservan su fondo oscuro) ---- */
:root[data-theme="light"] {
  --bg: #e9edf2; --glass: rgba(248, 250, 252, 0.84); --glass-strong: rgba(248, 250, 252, 0.96);
  --line: rgba(0, 0, 0, 0.09); --line-strong: rgba(0, 0, 0, 0.2); --text: #1c2330; --muted: #5a6474;
  --accent-soft: rgba(47, 155, 255, 0.14);
}
:root[data-theme="light"] #profile-canvas, :root[data-theme="light"] .xs-canvas { background: #1b2129; border-radius: 6px; }
:root[data-theme="light"] input, :root[data-theme="light"] select { background: #fff; color: var(--text); border-color: var(--line-strong); }
:root[data-theme="light"] .lt-row:hover, :root[data-theme="light"] .lt-sub:hover { background: rgba(0, 0, 0, 0.05); }
:root[data-theme="light"] #plan-view { border-color: rgba(0, 0, 0, 0.25); }

/* ---- Fase 4: perfil libre y etiquetas de curvas ---- */
#perfil-libre { position: absolute; left: calc(var(--left-w) + 20px); right: calc(var(--right-w) + 20px); top: 70px; height: 300px; z-index: 34; display: flex; flex-direction: column; padding: 6px 10px; background: var(--glass-strong); resize: vertical; overflow: hidden; }
#perfil-libre.hidden { display: none; }
#perfil-libre .pl-head { display: flex; align-items: center; gap: 8px; font-size: 12px; }
#perfil-libre .pl-head .spacer { flex: 1; }
#perfil-libre .pl-info { color: var(--muted); }
#perfil-libre .pl-cv { flex: 1; width: 100%; min-height: 0; background: #1b2129; border-radius: 6px; margin-top: 4px; cursor: crosshair; }
#perfil-libre .pl-lee { font: 11px var(--mono); color: var(--muted); padding-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.curva-label { font: 10px var(--mono); color: #fff3c4; background: rgba(0, 0, 0, .45); padding: 0 3px; border-radius: 3px; pointer-events: none; white-space: nowrap; }
/* ---- observaciones de revisión ---- */
.obs-form { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.obs-form input, .obs-form textarea, .obs-form select { background: rgba(0,0,0,.25); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; font: inherit; font-size: 12px; }
.obs-form textarea { resize: vertical; }
.obs-bar { align-items: center; border-top: 1px solid var(--line); padding-top: 6px; }
.obs-bar .hint { margin: 0 0 0 auto; }
.btn-file { display: inline-flex; align-items: center; }
.obs-lista { display: flex; flex-direction: column; gap: 6px; }
.obs-item { display: flex; gap: 8px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.03); }
.obs-item.cerrada { opacity: .55; }
.obs-item img, .obs-sin { width: 112px; height: 70px; object-fit: cover; border-radius: 5px; flex: none; background: rgba(0,0,0,.3); }
.obs-txt { flex: 1; min-width: 0; font-size: 12px; }
.obs-txt .hint { margin: 2px 0; }
.obs-txt .row { margin: 2px 0 0; gap: 10px; }
.obs-com { white-space: pre-wrap; margin: 2px 0; }
.obs-est, .obs-pri { font-size: 10.5px; padding: 0 5px; border-radius: 4px; border: 1px solid var(--line); }
.obs-est.e-Abierta { border-color: #e0a030; color: #e0a030; }
.obs-est.e-Enrevisión { border-color: #4aa3ff; color: #4aa3ff; }
.obs-est.e-Cerrada { border-color: #5fbf6a; color: #5fbf6a; }
.obs-pin { background: #e0a030; color: #111; font: 600 11px/1 system-ui, sans-serif; padding: 3px 6px; border-radius: 10px 10px 10px 2px; box-shadow: 0 1px 4px rgba(0,0,0,.5); pointer-events: none; white-space: nowrap; transform: translate(50%, -50%); }
.obs-pin.alta { background: #e5534b; color: #fff; }

/* ---- comparación de versiones ---- */
.ver-estado { padding: 5px 8px; border-radius: 6px; margin: 6px 0; font-size: 12px; }
.ver-estado.ok { background: rgba(95,191,106,.15); border: 1px solid #5fbf6a; }
.ver-estado.dif { background: rgba(224,160,48,.15); border: 1px solid #e0a030; }
.ver-tabla { width: 100%; border-collapse: collapse; font-size: 11.5px; margin: 4px 0 8px; }
.ver-tabla th, .ver-tabla td { text-align: left; padding: 2px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ver-tabla th { color: var(--muted); font-weight: 500; }
.ver-tabla tr.cambio td { color: #e0a030; font-weight: 600; }
#ver-res h4 { margin: 8px 0 2px; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

/* ---- conexión con Civil 3D ---- */
.c3d-btn { position: relative; opacity: .6; }
.c3d-btn.c3d-on { opacity: 1; }
.c3d-btn.c3d-on::after { content: ''; position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: #5fbf6a; box-shadow: 0 0 0 2px var(--glass-strong); }
.c3d-btn.c3d-on.c3d-cambios::after { background: #e0a030; }
.c3d-est { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #5fbf6a; }
.c3d-punto { width: 8px; height: 8px; border-radius: 50%; background: #5fbf6a; }
#c3d-panel p { font-size: 12px; margin: 6px 0; }
.c3d-cambios { border: 1px solid #e0a030; border-radius: 6px; padding: 4px 8px; font-size: 11.5px; margin: 6px 0; }
.c3d-cambios ul { margin: 2px 0 0; padding-left: 16px; }
.c3d-ir { margin-top: 8px; }

/* ---- inventario y presentación ---- */
.inv-tipos { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.inv-chip { font-size: 11.5px; padding: 2px 8px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; opacity: .55; user-select: none; }
.inv-chip.on { opacity: 1; background: var(--accent-soft); border-color: var(--accent); }
.inv-chip b { font-weight: 600; margin-left: 2px; }
.inv-filtros { align-items: center; gap: 6px; font-size: 12px; }
.inv-filtros input { background: rgba(0,0,0,.25); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; font: inherit; font-size: 12px; }
.inv-lista { max-height: 52vh; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.inv-item { display: grid; grid-template-columns: 22px 78px 1fr auto; gap: 6px; align-items: center; padding: 5px 6px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.inv-item:hover { background: rgba(255,255,255,.07); }
.inv-ico { text-align: center; font-size: 14px; }
.inv-ico.t-alcantarilla { color: #4aa3ff; } .inv-ico.t-puente { color: #e0a030; } .inv-ico.t-relleno { color: #c9a26b; }
.inv-ico.t-corte { color: #c96b5a; } .inv-ico.t-curva { color: #9fd36b; } .inv-ico.t-observacion { color: #e5534b; }
.inv-sta { font-family: var(--mono, monospace); font-size: 11.5px; color: var(--muted); }
.inv-txt { min-width: 0; } .inv-txt b { display: block; font-weight: 600; } .inv-txt small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-or { font-size: 10px; padding: 0 5px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); }
.inv-or.o-A { border-color: #3d9e5a; color: #5fbf6a; } .inv-or.o-D { border-color: #3a6ea8; color: #6fa8e8; }
/* modo presentación: pantalla limpia */
body.presentando #topbar, body.presentando #left, body.presentando #right, body.presentando #statusbar,
body.presentando #profile, body.presentando #viewcube, body.presentando #compass, body.presentando .popover,
body.presentando #escala, body.presentando .toast, body.presentando #revision { display: none !important; }
#presentacion { position: absolute; inset: 0; pointer-events: none; z-index: 40; }
#presentacion.hidden { display: none; }
.pr-titulo { position: absolute; left: 40px; bottom: 96px; max-width: min(640px, calc(100% - 80px)); color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.65); opacity: 0; transform: translateY(12px); transition: opacity .9s ease, transform .9s ease; }
.pr-titulo.visible { opacity: 1; transform: none; }
.pr-titulo .pr-num { font-size: 12px; letter-spacing: 2px; opacity: .8; }
.pr-titulo h2 { margin: 4px 0 6px; font-size: clamp(22px, 3.2vw, 38px); font-weight: 600; letter-spacing: .5px; }
.pr-titulo p { margin: 0; font-size: clamp(13px, 1.4vw, 16px); opacity: .92; }
.pr-ctrl { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 6px 10px; pointer-events: auto; border-radius: 22px; }
.pr-ctrl button { background: none; border: 0; color: var(--text); font-size: 15px; width: 32px; height: 28px; cursor: pointer; border-radius: 14px; }
.pr-ctrl button:hover { background: rgba(255,255,255,.12); }
.pr-puntos { display: flex; gap: 4px; padding: 0 6px; }
.pr-puntos i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.3); }
.pr-puntos i.on { background: #fff; }
@media (max-width: 700px) { .pr-titulo { left: 16px; bottom: 80px; } }

@media (max-width: 900px) { #perfil-libre { left: 10px; right: 10px; } }

/* ---------- minimapa (js/ui/minimapa.js) ---------- */
#minimapa { position: absolute; z-index: 11; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
#minimapa canvas { display: block; width: 220px; height: 220px; border-radius: 6px; background: rgba(8, 12, 18, 0.55); cursor: crosshair; }
.mm-barra { display: flex; gap: 4px; }
.mm-barra button { flex: 0 0 auto; min-width: 26px; height: 22px; padding: 0 6px; font-size: 11.5px; background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: 5px; cursor: pointer; }
.mm-barra button:first-child { flex: 1; }
.mm-barra button:hover { background: var(--accent-soft); border-color: var(--accent); }
body.presentando #minimapa, body.presentando #ficha { display: none !important; }

/* ---------- ficha rápida (js/ui/ficha.js) ---------- */
#ficha { position: absolute; z-index: 25; width: 308px; padding: 8px 10px 9px; font-size: 12px; background: var(--glass-strong); }
.fi-cab { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.fi-cab b { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fi-cab button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 2px; }
.fi-cab button:hover { color: var(--text); }
.fi-tipo { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--accent); }
#ficha table { width: 100%; border-collapse: collapse; }
#ficha td { padding: 2px 0; vertical-align: top; }
#ficha td:first-child { color: var(--muted); padding-right: 8px; white-space: nowrap; }
#ficha td:last-child { text-align: right; font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }
.fi-o { font-style: normal; font-size: 9px; padding: 0 3px; border-radius: 3px; border: 1px solid var(--line); vertical-align: 1px; }
.fi-o.o-A { border-color: #3d9e5a; color: #5fbf6a; } .fi-o.o-D { border-color: #3a6ea8; color: #6fa8e8; }
.fi-pie { display: flex; justify-content: flex-end; gap: 6px; margin-top: 7px; }
.fi-pie button { padding: 3px 9px; font-size: 11.5px; background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: 5px; cursor: pointer; }
.fi-pie button:hover { background: var(--accent-soft); border-color: var(--accent); }
@media (max-width: 700px) { #minimapa canvas { width: 150px; height: 150px; } }
.veh-creditos { font-size: 10.5px; line-height: 1.45; margin-top: 4px; }
.veh-creditos a { color: var(--muted); text-decoration: underline dotted; }

/* ---------- persona (js/core/persona.js) ---------- */
#persona-hud { position: absolute; left: 50%; bottom: 58px; transform: translateX(-50%); z-index: 22; padding: 7px 14px; font-size: 12.5px; white-space: nowrap; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
body.presentando #persona-hud { display: none !important; }

/* proyecto federado: portada y ficha del modelo (js/app/proyecto.js) */
.pj-fondo { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(3px); }
.pj-caja { width: min(680px, 100%); max-height: 90vh; overflow: auto; padding: 20px 22px; border-radius: 12px; background: var(--glass-strong); border: 1px solid var(--line-strong); color: var(--text); box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45); }
.pj-caja h2 { margin: 4px 0 6px; font-size: 22px; }
.pj-caja h3 { margin: 0 0 12px; font-size: 15px; }
.pj-marca { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.pj-desc { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.pj-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 12px 0; }
.pj-kpi { position: relative; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); }
.pj-kpi b { display: block; font-size: 20px; }
.pj-kpi span { font-size: 12px; color: var(--muted); }
.pj-kpi i { position: absolute; top: 6px; right: 8px; font-style: normal; font-size: 10px; color: var(--muted); }
.pj-esp { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pj-esp span { padding: 3px 8px; border-radius: 999px; font-size: 12px; background: var(--accent-soft); }
.pj-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.pj-form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.pj-form .pj-ancho { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 6px; }
.pj-form input, .pj-form select { padding: 5px 7px; border-radius: 6px; border: 1px solid var(--line-strong); background: rgba(0, 0, 0, 0.2); color: var(--text); }
.pj-sub { margin-top: 6px; font-size: 12px; color: var(--muted); }
.pj-botones { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.pj-botones button { padding: 7px 14px; border-radius: 7px; border: 1px solid var(--line-strong); background: transparent; color: var(--text); cursor: pointer; }
.pj-botones .pj-si { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (max-width: 520px) { .pj-form { grid-template-columns: 1fr; } }

/* consultas por propiedad y visibilidad de parada (js/ui/consultas.js, js/ui/visibilidad.js) */
.cq { position: fixed; top: 64px; right: 16px; z-index: 40; width: min(600px, calc(100vw - 32px)); max-height: calc(100vh - 140px); overflow: auto; padding: 12px 14px; border-radius: 10px; background: var(--glass-strong); border: 1px solid var(--line-strong); color: var(--text); font-size: 12.5px; }
.cq.hidden { display: none; }
.cq-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cq-x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 14px; }
.cq-fila { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.cq-fila select, .cq-fila input { flex: 1; min-width: 80px; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line-strong); background: rgba(0, 0, 0, 0.2); color: var(--text); }
.cq-fila .cq-op { flex: 0 0 auto; min-width: 0; }
.cq button { padding: 5px 10px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--accent-soft); color: var(--text); cursor: pointer; }
.cq button:disabled { opacity: 0.45; cursor: default; }
.cq-estado { color: var(--muted); }
.cq-tit { margin: 8px 0 4px; font-weight: 600; }
.cq-ley { display: flex; gap: 8px; align-items: center; padding: 2px 0; }
.cq-ley i { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.cq-ley span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cq-tabla { max-height: 260px; overflow: auto; margin: 6px 0; border: 1px solid var(--line); border-radius: 6px; }
.cq-tabla table { width: 100%; border-collapse: collapse; }
.cq-tabla th, .cq-tabla td { padding: 3px 6px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.cq-tabla th { position: sticky; top: 0; background: var(--glass-strong); }
.cq-tabla tr[data-i] { cursor: pointer; }
.cq-tabla tr[data-i]:hover { background: var(--accent-soft); }
.cq-pie { color: var(--muted); font-size: 11.5px; margin: 4px 0; }
.vs-params { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.vs-params label { display: flex; flex-direction: column; gap: 2px; color: var(--muted); font-size: 11.5px; }
.vs-params input { padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line-strong); background: rgba(0, 0, 0, 0.2); color: var(--text); }
.vs-graf { width: 100%; height: auto; background: rgba(0, 0, 0, 0.15); border-radius: 6px; }
.vs-o { font-style: normal; color: var(--muted); font-size: 10px; }

/* portada del proyecto (js/ui/portada.js): foto de carretera a pantalla completa y un letrero pequeño color asfalto */
body.con-portada #app > *:not(#viewport):not(#loader):not(#toasts), body.con-portada .sta-label, body.con-portada .curva-label { visibility: hidden !important; }
.lam { --cartel: rgba(30, 32, 36, 0.8); --acento: #f3c623; --btn-texto: #1d1f22; --texto: #ffffff; --tenue: rgba(255, 255, 255, 0.78);
  position: fixed; inset: 0; z-index: 70; color: var(--texto); font-family: "Segoe UI", system-ui, sans-serif; animation: lamEntra 0.7s ease both; }
.lam.sale { animation: lamSale 0.42s ease both; }
@keyframes lamEntra { from { opacity: 0; } to { opacity: 1; } }
@keyframes lamSale { to { opacity: 0; } }
.lam-fotos { position: absolute; inset: 0; overflow: hidden; background: #1b1d20; }
.lam-foto { position: absolute; inset: -3%; background-size: cover; background-position: center; opacity: 0; transition: opacity 1.2s ease; }
.lam-foto.activa { opacity: 1; animation: lamZoom 30s ease-out both; }
@keyframes lamZoom { from { transform: scale(1.02); } to { transform: scale(1.1); } }
.lam-velo { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(20deg, rgba(0, 0, 0, 0.5), transparent 45%); }
/* letrero */
.lam-cartel { position: absolute; left: 32px; bottom: 32px; width: min(400px, calc(100% - 64px)); padding: 18px 20px 16px 22px;
  background: var(--cartel); backdrop-filter: blur(6px); border-left: 4px solid var(--acento); border-radius: 0; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.35);
  animation: lamCartel 0.7s 0.2s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes lamCartel { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.lam-datos { font-size: 11.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--acento); font-weight: 600; }
.lam h1 { margin: 6px 0 6px; font-size: 26px; font-weight: 700; line-height: 1.15; }
.lam-desc { margin: 0 0 14px; font-size: 13px; line-height: 1.5; color: var(--tenue); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lam-entrar { display: inline-flex; align-items: center; gap: 10px; padding: 9px 16px; border: 0; border-radius: 2px; background: var(--acento); color: var(--btn-texto); font: 700 13px "Segoe UI", system-ui, sans-serif; letter-spacing: 0.04em; text-transform: uppercase; cursor: pointer; }
.lam-entrar span { font-size: 16px; transition: transform 0.18s ease; }
.lam-entrar:hover span { transform: translateX(4px); }
.lam-entrar:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
/* esquina: elegir foto y crédito */
.lam-esquina { position: absolute; right: 24px; bottom: 20px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; max-width: calc(100% - 48px); }
.lam-botones { display: flex; gap: 6px; }
.lam-cambiar { padding: 6px 12px; border: 1px solid rgba(255, 255, 255, 0.45); border-radius: 999px; background: rgba(20, 22, 25, 0.55); color: #fff; font: 12px "Segoe UI", system-ui, sans-serif; cursor: pointer; backdrop-filter: blur(4px); }
.lam-cambiar:hover { background: rgba(20, 22, 25, 0.8); }
.lam-credito { font-size: 11px; color: rgba(255, 255, 255, 0.82); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7); text-align: right; }
.lam-galeria { padding: 10px 12px; background: rgba(20, 22, 25, 0.82); backdrop-filter: blur(6px); display: flex; flex-direction: column; gap: 8px; }
.lam-galeria[hidden] { display: none; }
.lam-grupo { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lam-grupo span { width: 44px; font-size: 11px; color: var(--tenue); }
.lam-grupo button { width: 84px; height: 52px; border: 2px solid transparent; background-size: cover; background-position: center; cursor: pointer; padding: 0; }
.lam-grupo button[aria-pressed="true"] { border-color: var(--acento); }
.lam-grupo button:hover { border-color: rgba(255, 255, 255, 0.7); }
@media (max-width: 700px) {
  .lam-cartel { left: 16px; right: 16px; bottom: 64px; width: auto; }
  .lam-esquina { right: 16px; bottom: 14px; }
  .lam-grupo button { width: 64px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) { .lam, .lam-cartel, .lam-foto.activa { animation: none; } }
.pj-form .pj-col { flex-direction: column; align-items: stretch; }
.pj-form textarea { padding: 5px 7px; border-radius: 6px; border: 1px solid var(--line-strong); background: rgba(0, 0, 0, 0.2); color: var(--text); font: inherit; resize: vertical; }
