/* FastPlan Railway · tema oscuro tipo suite CAD (v2: panel lateral) */
:root {
  --bg: #14171c; --bg2: #1c2028; --bg3: #242a34; --line: #303845;
  --fg: #e6e9ef; --fg2: #9aa4b5; --accent: #3fa9f5; --ok: #34c759; --warn: #ffcc00; --bad: #ff3b30; --brown: #b87333;
  --sidebar-w: 300px; --bottom-h: 44vh; --prof-h: 50%; --tables-w: 55%;
  --font: "Segoe UI", Roboto, Arial, sans-serif; --mono: Consolas, "Courier New", monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--fg); font: 12px/1.35 var(--font); overflow: hidden; }
button, select, input { font: inherit; color: var(--fg); background: var(--bg3); border: 1px solid var(--line); border-radius: 4px; padding: 3px 7px; }
button { cursor: pointer; white-space: nowrap; }
button:hover { border-color: var(--accent); }
button.active { background: var(--accent); color: #05131f; border-color: var(--accent); }
button.danger { border-color: var(--bad); color: var(--bad); }
button.small { padding: 1px 6px; font-size: 11px; }
button:disabled { opacity: .4; cursor: default; }
input[type=number] { width: 70px; }
input[type=checkbox] { accent-color: var(--accent); margin: 0 4px 0 0; vertical-align: middle; }
label { color: var(--fg2); }
.hint { color: var(--fg2); font-size: 11px; }
.warn { color: var(--warn); } .bad { color: var(--bad); } .ok { color: var(--ok); }

#app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; }
#app.sidebar-hidden { grid-template-columns: 1fr; }
#app.sidebar-hidden #sidebar { display: none; }
#sidebar-backdrop { display: none; }   /* fuera del flujo de la cuadrícula salvo en el media query móvil */

/* ---------------- Responsive (tablet / pantallas angostas) ---------------- */
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  #app:not(.sidebar-hidden) #sidebar { position: fixed; inset: 0 18% 0 0; z-index: 40; box-shadow: 8px 0 24px #0009; }
  #app:not(.sidebar-hidden) #sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 39; background: #0008; }
  #sidebar-toggle { display: inline-flex; }
  .map-overlay { max-width: calc(100vw - 24px); }
  #pi-panel, #piv-panel { width: min(270px, calc(100vw - 32px)); }
  #alerts-panel { width: min(440px, 100vw); }
  #modal { width: min(520px, calc(100vw - 24px)); max-height: 90vh; }
  .tools { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  :root { --sidebar-w: 86vw; }
  #draw-bar { max-width: calc(100vw - 64px); }
  .tools { grid-template-columns: 1fr 1fr; }
  .grid2 { grid-template-columns: 1fr; }
}

/* ---------------- Panel lateral ---------------- */
#sidebar { background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
#sidebar .brand { padding: 8px 10px; font-weight: 700; color: var(--accent); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
#sidebar .brand small { color: var(--fg2); font-weight: 400; display: block; font-size: 10px; }
#sidebar .scroll { overflow-y: auto; overflow-x: hidden; flex: 1; min-height: 0; }
#sidebar details { border-bottom: 1px solid var(--line); }
#sidebar summary { cursor: pointer; padding: 6px 10px; background: var(--bg3); font-weight: 600; list-style: none; user-select: none; }
#sidebar summary::before { content: "▸ "; color: var(--fg2); }
#sidebar details[open] summary::before { content: "▾ "; }
#sidebar .sec { padding: 6px 10px; display: flex; flex-direction: column; gap: 5px; }
.row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row > label { flex: 1; min-width: 90px; }
.row select { flex: 1; min-width: 60px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 8px; }
.grid2 label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--fg); cursor: pointer; }
/* P-3a: minmax(0, 1fr) deja que la columna se encoja; el texto largo pasa a dos líneas
   en lugar de desbordar el panel (antes «Exportar DXF» se cortaba y salía barra horizontal) */
.tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.tools button { padding: 5px 2px; font-size: 11px; white-space: normal; line-height: 1.2; overflow-wrap: anywhere; }
#semaforo { width: 16px; height: 16px; border-radius: 50%; background: #555; box-shadow: 0 0 6px #0006; display: inline-block; cursor: pointer; vertical-align: middle; }
#semaforo.VERDE { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
#semaforo.AMARILLO { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
#semaforo.ROJO { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
#backend-url { width: 100%; font-family: var(--mono); font-size: 11px; }
#backend-dot { width: 8px; height: 8px; border-radius: 50%; background: #666; display: inline-block; margin-right: 4px; }
#backend-dot.ok { background: var(--ok); } #backend-dot.bad { background: var(--bad); }
#sidebar-toggle { position: absolute; top: 8px; left: 8px; z-index: 6; }
.cruce-item { border: 1px solid var(--line); border-radius: 4px; padding: 4px 6px; margin: 3px 0; }
.cruce-item .row { margin-top: 3px; }
#basemap-list label, #overlay-list label { display: block; color: var(--fg); cursor: pointer; }
@media print { #sidebar, #draw-bar, #map-info, .splitter, #alerts-panel, #toast, #sidebar-toggle, #map-max { display: none !important; } #app { grid-template-columns: 1fr; } }

/* ---------------- Área principal ---------------- */
#main { display: grid; grid-template-rows: 1fr 6px var(--bottom-h); min-height: 0; min-width: 0; }
#main.max-map { grid-template-rows: 1fr 6px 0; }
.splitter { background: var(--line); cursor: row-resize; position: relative; z-index: 4; }
.splitter.v { cursor: col-resize; }
.splitter:hover { background: var(--accent); }

#map-wrap { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; }
.map-overlay { position: absolute; background: #14171cd9; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; backdrop-filter: blur(3px); z-index: 5; }
#draw-bar { top: 8px; left: 48px; display: flex; gap: 4px; flex-wrap: wrap; max-width: 70%; }
#map-info { bottom: 8px; left: 8px; font-family: var(--mono); font-size: 11px; color: var(--fg2); }
#map-info b { color: var(--fg); }
#extent-warn { top: 48px; right: 48px; color: var(--warn); border-color: var(--warn); display: none; max-width: 300px; }
#extent-warn.show { display: block; }
#pi-panel { top: 48px; left: 48px; width: 270px; display: none; }
#pi-panel.show { display: block; }
#pi-panel h4, #piv-panel h4, #est-panel h4 { margin: 0 0 6px; font-size: 12px; color: var(--accent); }
#est-panel { top: 48px; left: 48px; width: min(300px, calc(100vw - 32px)); display: none; z-index: 6; max-height: calc(100% - 96px); overflow-y: auto; }
#est-panel.show { display: block; }
/* F-6: ficha de predimensionamiento ferroviario */
#est-panel { width: min(360px, calc(100vw - 32px)); }
#est-ed-calc h5 { margin: 8px 0 2px; font-size: 11px; color: var(--accent); }
.ficha-est { width: 100%; border-collapse: collapse; font-size: 11px; }
.ficha-est td, .ficha-est th { padding: 2px 4px; border-bottom: 1px solid var(--border, #333a46); text-align: left; vertical-align: top; }
.ficha-est th { color: var(--fg2); font-weight: 600; }
#est-ed-calc { font-size: 11px; margin: 4px 0; }
.form-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin: 3px 0; }
.form-row input[type=number] { width: 84px; }
#pi-avisos div { font-size: 11px; padding: 1px 0; }
#map-max { position: absolute; bottom: 8px; right: 8px; z-index: 6; }

/* ---------------- Zona inferior ---------------- */
/* grid-row/grid-column explícitos en cada hijo: si no se fijan, al ocultar un
   hermano con display:none el auto-placement de CSS Grid reacomoda el hijo
   visible restante en la primera pista libre (0px) en vez de dejarlo en su
   pista original — eso es lo que hacía que "maximizar" achicara a 0 altura
   el panel que se suponía debía crecer (tablas y sección transversal). */
#bottom { display: grid; grid-template-rows: var(--prof-h) 6px 1fr; min-height: 0; background: var(--bg2); }
#bottom.max-profile { grid-template-rows: 1fr 0 0; }
#bottom.max-lower { grid-template-rows: 0 0 1fr; }
#bottom.max-profile #lower, #bottom.max-profile #vsplit, #bottom.max-lower #profile-wrap, #bottom.max-lower #vsplit { display: none; }
#profile-wrap { grid-row: 1; }
#vsplit { grid-row: 2; }
#lower { grid-row: 3; display: grid; grid-template-columns: var(--tables-w) 6px 1fr; min-height: 0; }
#lower.max-tables { grid-template-columns: 1fr 0 0; }
#lower.max-section { grid-template-columns: 0 0 1fr; }
#lower.max-tables #section-wrap, #lower.max-tables #csplit, #lower.max-section #tables-wrap, #lower.max-section #csplit { display: none; }
#tables-wrap { grid-column: 1; }
#csplit { grid-column: 2; }
#section-wrap { grid-column: 3; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 0 8px; height: 26px; border-bottom: 1px solid var(--line); font-size: 11px; background: var(--bg3); }
.panel-head b { color: var(--fg); }
.panel-head .spacer { flex: 1; }

#profile-wrap { position: relative; min-height: 0; display: grid; grid-template-rows: 26px 1fr; }
#profile-canvas-wrap { position: relative; min-height: 0; }
#profile-canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.legend span { display: inline-block; width: 18px; height: 3px; vertical-align: middle; margin: 0 4px 0 8px; }
#piv-panel { position: absolute; top: 30px; right: 10px; width: 260px; display: none; z-index: 4; }
#piv-panel.show { display: block; }
#profile-alerts { position: absolute; bottom: 4px; left: 10px; color: var(--bad); font-size: 11px; z-index: 3; max-width: 70%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#tables-wrap { display: grid; grid-template-rows: 26px 1fr; min-height: 0; min-width: 0; }
#tables-wrap .tabs button { padding: 2px 8px; font-size: 11px; }
#tables-body { overflow: auto; min-height: 0; }
table.cad { border-collapse: collapse; width: 100%; font-family: var(--mono); font-size: 11px; }
table.cad th, table.cad td { border: 1px solid var(--line); padding: 2px 5px; text-align: right; white-space: nowrap; }
table.cad th { background: var(--bg3); color: var(--fg2); position: sticky; top: 0; text-align: center; font-weight: 600; }
table.cad td:first-child, table.cad th:first-child { text-align: left; }
table.cad tr:hover td { background: #2b3342; }
/* F-4: columnas de superestructura (material de banco, fuera de la curva masa) */
table.cad th.sup { color: #d9b77a; }
table.cad td.sup { background: rgba(217, 183, 122, 0.07); }
table.cad tr.sel td { background: #1f3a55; }
.st { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.dot-eje { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; border: 1px solid #0006; }
.st.VERDE { background: var(--ok); } .st.AMARILLO { background: var(--warn); } .st.ROJO { background: var(--bad); }
.tag { display: inline-block; padding: 0 5px; border-radius: 3px; font-size: 10px; background: var(--bg3); color: var(--fg2); }

#section-wrap { position: relative; display: grid; grid-template-rows: 26px 1fr; min-height: 0; min-width: 0; }
#section-head input[type=range] { flex: 1; accent-color: var(--accent); min-width: 80px; }
#section-head .sta { font-family: var(--mono); color: var(--accent); min-width: 80px; }
#section-canvas-wrap { position: relative; min-height: 0; }
#section-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#section-canvas.grabbing { cursor: grabbing; }
/* F-3: ficha de sección de vía */
#section-head .seg { display: inline-flex; gap: 0; margin: 0 4px; }
#section-head .seg button { border-radius: 0; margin: 0; }
#section-head .seg button:first-child { border-radius: 3px 0 0 3px; } #section-head .seg button:last-child { border-radius: 0 3px 3px 0; }
#section-head .seg button.proyecto { box-shadow: inset 0 -2px 0 var(--ok); }
#section-head select { font-size: 11px; max-width: 110px; }
.sec-lectura { position: absolute; top: 4px; right: 4px; width: 250px; max-height: calc(100% - 8px); overflow: auto; background: #14171cdd; border: 1px solid var(--line); border-radius: 4px; padding: 5px 7px; font-size: 11px; line-height: 1.35; z-index: 2; }
.sec-lectura.oculto { display: none; }
.sec-lectura h5 { margin: 5px 0 2px; font-size: 11px; color: var(--accent); }
.sec-lectura table { width: 100%; border-collapse: collapse; } .sec-lectura td { padding: 0 2px; vertical-align: top; } .sec-lectura td:last-child { text-align: right; font-family: var(--mono); white-space: nowrap; }
.sec-lectura .delta { color: var(--warn); } .sec-lectura .nhall { font-size: 10.5px; }
.sec-lectura button { margin-top: 4px; width: 100%; }

/* Panel de hallazgos */
#alerts-panel { position: fixed; top: 0; right: 0; width: 440px; max-height: 80vh; overflow: auto; background: var(--bg2); border: 1px solid var(--line); z-index: 50; display: none; box-shadow: -4px 4px 16px #0008; }
#alerts-panel.show { display: block; }
#alerts-panel header { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; background: var(--bg3); position: sticky; top: 0; }
#alerts-panel .item { padding: 5px 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
#alerts-panel .item:hover { background: var(--bg3); }
#alerts-panel .item .sta { font-family: var(--mono); color: var(--accent); margin-right: 6px; }

#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--bg3); border: 1px solid var(--line); padding: 8px 14px; border-radius: 6px; z-index: 100; display: none; max-width: 70vw; }
#toast.show { display: block; } #toast.err { border-color: var(--bad); }
#toast .msg { display: block; }
#toast .bar { margin-top: 6px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; width: 220px; max-width: 60vw; }
#toast .bar > i { display: block; height: 100%; background: var(--accent); border-radius: 2px; width: 0%; transition: width .15s linear; }
#toast.indeterminate .bar > i { width: 40% !important; animation: fp-indet 1.1s ease-in-out infinite; }
@keyframes fp-indet { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.maplibregl-ctrl-attrib { font-size: 10px !important; }
.maplibregl-canvas { cursor: crosshair; }
.maplibregl-canvas.grab { cursor: default; }

input.cell { width: 64px; padding: 0 3px; font: inherit; background: #1a2230; border: 1px solid #3a4557; color: var(--fg); text-align: right; }
input.cell.wide { width: 96px; }
input.cell:focus { border-color: var(--accent); outline: none; }
.lista-items { display: flex; flex-direction: column; gap: 3px; }
.item-row { display: grid; grid-template-columns: 1fr auto; gap: 4px; align-items: center; border: 1px solid var(--line); border-radius: 4px; padding: 3px 5px; font-size: 11px; }
.item-row .small { padding: 0 5px; }
#modal-bg { position: fixed; inset: 0; background: #0009; z-index: 200; display: none; align-items: center; justify-content: center; }
#modal-bg.show { display: flex; }
#modal { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; width: 520px; max-height: 85vh; overflow: auto; box-shadow: 0 8px 30px #000a; }
#modal h3 { margin: 0 0 8px; color: var(--accent); font-size: 14px; }
#modal .grid2 label { color: var(--fg); }
#modal .actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; }

/* ---- F-2 · Panel Normativa AREMA/FRA (D-11) ---- */
.clase-badge { margin-left: 6px; padding: 0 6px; border-radius: 3px; background: var(--bg3); border: 1px solid var(--line); color: var(--fg); font-weight: 600; font-size: 11px; }
.clase-badge.mod { border-color: var(--warn); color: var(--warn); }
.ngrupo { margin: 8px 0 2px; color: var(--accent); font-size: 11px; font-weight: 600; border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.nfield { gap: 3px; border-left: 2px solid transparent; padding-left: 3px; flex-wrap: nowrap; }
.nfield label { min-width: 74px; flex: 0 0 74px; }
.nfield input.nsi, .nfield input.nimp { width: 54px !important; padding: 2px 4px; }
.nfield .nro { font-size: 10px; line-height: 1.15; }
.nfield.mod { border-left-color: var(--warn); }
.nfield.inactivo { opacity: .5; }
.nfield .nu { color: var(--fg2); font-size: 10px; min-width: 22px; }
.nfield .nro { flex: 1; text-align: right; }
.nmark { color: var(--warn); width: 8px; font-size: 10px; }
.nreset { visibility: hidden; }
.nhall { margin: 4px 0; padding: 3px 5px; border-radius: 3px; background: var(--bg3); font-size: 11px; border-left: 3px solid var(--line); }
.nhall.AMARILLO { border-left-color: var(--warn); }
.nhall.ROJO { border-left-color: var(--bad); }
.ntol { font-size: 11px; border-collapse: collapse; width: 100%; }
.ntol td { padding: 1px 4px; border-bottom: 1px solid var(--line); }
.ntol td:last-child { text-align: right; color: var(--fg); font-family: var(--mono); }
.cita { color: var(--fg2); font-size: 10px; font-style: italic; }
/* Tablas de curvas AREMA: la equivalencia imperial va DENTRO de la celda (D-2.1) */
table.cad.via td .sub { font-size: 10px; color: var(--fg2); }
table.cad td.bad { color: var(--bad); font-weight: 600; }
table.cad td.bad .sub { color: var(--bad); }
table.cad td.warn { color: var(--warn); }
table.cad td[title] { cursor: help; }
/* Pendiente #2: proyecto vial no convertido */
#migracion-aviso { top: 48px; left: 50%; transform: translateX(-50%); color: var(--warn); border-color: var(--warn); display: none; max-width: 520px; }
#migracion-aviso.show { display: block; }

/* F-5: ficha flotante del aparato de vía */
#ap-flotante { top: 48px; right: 56px; width: min(330px, calc(100vw - 32px)); display: none; z-index: 6; max-height: calc(100% - 96px); overflow-y: auto; }
#ap-flotante.show { display: block; }
#ap-flotante h4 { margin: 0 0 6px; font-size: 12px; color: var(--accent); }
#ap-flotante .form-row select { max-width: 150px; }
.ap-fila.sel { outline: 1px solid var(--accent); }

/* F-5b: ficha del escape */
#esc-flotante { top: 48px; right: 56px; width: min(360px, calc(100vw - 32px)); display: none; z-index: 6; max-height: calc(100% - 96px); overflow-y: auto; }
#esc-flotante.show { display: block; }
#esc-flotante h4 { margin: 0 0 6px; font-size: 12px; color: var(--accent); }
body.fp-arrastre .map-overlay { pointer-events: none; }
#gen-flotante { top: 48px; right: 56px; width: min(370px, calc(100vw - 32px)); display: none; z-index: 6; max-height: calc(100% - 96px); overflow-y: auto; }
#gen-flotante.show { display: block; }
#gen-flotante h4 { margin: 0 0 6px; font-size: 12px; color: var(--accent); }
#gen-flotante .form-row label:first-child { min-width: 132px; }
#gen-flotante .form-row select { max-width: 190px; }
table.cad.mini { margin-top: 4px; font-size: 11px; }
.esc-cap { margin: 6px 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; font-size: 12px; }
.esc-cap b { font-size: 15px; color: var(--accent); }

/* ---------------------------------------------------------------- P-1b: cuenta y créditos (cuenta.js) */
.fpc-chip { margin-left: auto; margin-right: 6px; font-weight: 600; color: var(--fg); }
.fpc-chip.fpc-premium { color: #05131f; background: var(--warn); border-color: var(--warn); }
.fpc-fondo { position: fixed; inset: 0; z-index: 9999; background: rgba(0, 0, 0, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.fpc-caja { background: var(--bg2); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; width: min(460px, 100%); max-height: 88vh; overflow: auto; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); }
.fpc-caja h3 { margin: 0 0 10px; font-size: 15px; color: var(--accent); }
.fpc-caja h3 small { color: var(--fg2); font-weight: 400; }
.fpc-caja h4 { margin: 12px 0 4px; font-size: 12px; color: var(--fg2); text-transform: uppercase; letter-spacing: .04em; }
.fpc-campo { display: block; margin: 8px 0; color: var(--fg2); }
.fpc-campo input[type=email], .fpc-campo input[type=text], .fpc-campo input[type=number], .fpc-campo input[type=date], .fpc-campo input[type=password] { display: block; width: 100%; box-sizing: border-box; margin-top: 3px; }
/* P-2b: inicio de sesión con Firebase */
.fpc-google { display: block; width: 100%; padding: 8px; font-weight: 600; margin: 4px 0 2px; }
.fpc-sep { display: flex; align-items: center; gap: 8px; margin: 10px 0 2px; color: var(--fg2); font-size: 11px; }
.fpc-sep::before, .fpc-sep::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.fpc-enlace { background: none !important; border: none !important; padding: 0 !important; color: var(--accent); text-decoration: underline; cursor: pointer; font-size: inherit; }
.fpc-acciones .fpc-enlace { margin-right: auto; font-size: 11px; }
.fpc-fila { display: flex; align-items: center; gap: 4px; }
.fpc-nota { color: var(--fg2); font-size: 11px; }
.fpc-acciones { display: flex; justify-content: flex-end; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.fpc-tabla { width: 100%; border-collapse: collapse; font-size: 11px; }
.fpc-tabla th, .fpc-tabla td { padding: 3px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.fpc-tabla .num { text-align: right; font-family: var(--mono); }
.neg { color: var(--bad); }

/* P-1c: sólo con cuentas (descartar el terreno propio) y estado de la revisión .fpr */
body:not(.fp-cuentas) .solo-cuentas { display: none !important; }
#rev-estado { align-self: center; flex: 1; }

/* P-1d: demostración y recorrido guiado (recorrido.js) */
.fpc-demo { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fpr-capa { position: fixed; inset: 0; z-index: 9998; }
.fpr-marco { position: fixed; border: 2px solid var(--accent); border-radius: 6px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55); pointer-events: none; transition: all .2s; }
.fpr-caja { position: fixed; background: var(--bg2); color: var(--fg); border: 1px solid var(--accent); border-radius: 8px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.fpr-caja h3 { margin: 0 0 6px; font-size: 14px; color: var(--accent); }
.fpr-texto { font-size: 12px; line-height: 1.45; }
.fpr-pie { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.fpr-paso { color: var(--fg2); font-size: 11px; }
@media (prefers-reduced-motion: reduce) { .fpr-marco { transition: none; } }

/* P-3a: ayuda plegable dentro de una sección, tarjeta «Acerca de» y lo sólo-local */
#sidebar details.ayuda { border-bottom: none; }
#sidebar details.ayuda > summary { background: none; padding: 2px 0; font-weight: 400; color: var(--fg2); font-size: 11px; }
#sidebar details.ayuda > .hint { margin-top: 3px; }
.fp-publicada .solo-local { display: none !important; }
.acerca { margin: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg3); display: flex; flex-direction: column; gap: 8px; font-size: 11px; }
.acerca-logo { display: block; background: #fff; border-radius: 6px; padding: 6px; text-align: center; }
.acerca-logo img { display: block; width: 100%; max-width: 200px; height: auto; margin: 0 auto; }
.acerca-texto { display: flex; flex-direction: column; gap: 2px; line-height: 1.35; }
.acerca a { color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }
.acerca a:hover { text-decoration: underline; }
.acerca-wa { display: inline-flex; align-items: center; gap: 4px; color: #25d366 !important; }
.acerca-sitio { align-self: stretch; text-align: center; padding: 5px; border: 1px solid var(--accent); border-radius: 6px; font-weight: 600; }

/* P-3b: enlaces legales, casilla de aceptación y aviso de almacenamiento */
.acerca-legal { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 6px; font-size: 10.5px; color: var(--fg2); }
.fpc-legal { align-items: flex-start; font-size: 12px; }
.fpc-legal input { margin-top: 2px; flex: none; }
.fpc-arco { justify-content: flex-start; margin-top: 4px; }
.aviso-almacen { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 9990; width: min(720px, calc(100% - 32px));
  background: var(--bg2); color: var(--fg); border: 1px solid var(--accent); border-radius: 8px; padding: 10px 14px; display: flex; gap: 12px; align-items: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .45); font-size: 12px; }
.aviso-almacen a { color: var(--accent); }
.aviso-almacen button { flex: none; }
@media (max-width: 600px) { .aviso-almacen { flex-direction: column; align-items: stretch; } }
.fpc-caja a { color: var(--accent); }
