/* Editor de plano — complementa /styles.css */
body.app-plano { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.plano-top { max-width: none; padding: 0 12px; gap: 12px; }
.nombre-proy { flex: 1 1 160px; min-width: 0; max-width: 320px; font: inherit; font-weight: 600; border: 1px solid transparent; background: transparent; color: var(--text); padding: 6px 8px; border-radius: 8px; }
.nombre-proy:hover, .nombre-proy:focus { border-color: var(--border); background: var(--surface-2); outline: none; }
.top-actions { align-items: center; flex-wrap: nowrap; }
.top-actions .btn { white-space: nowrap; }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.15); padding: 6px; z-index: 30; min-width: 220px; display: flex; flex-direction: column; }
.menu-pop button, .menu-pop label { font: inherit; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; color: var(--text); cursor: pointer; }
.menu-pop button:hover, .menu-pop label:hover { background: var(--surface-2); }

.plano-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 72px minmax(0, 1fr) 380px; }

/* Herramientas */
.tools { background: var(--surface); border-right: 1px solid var(--border); padding: 8px 6px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.tools hr { border: 0; border-top: 1px solid var(--border); margin: 4px 2px; width: auto; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 1px solid transparent; border-radius: 10px; padding: 6px 2px; cursor: pointer; color: var(--text); font: inherit; }
.tool span { font-size: 1.05rem; line-height: 1.2; height: 22px; display: grid; place-items: center; }
.tool small { font-size: .66rem; color: var(--muted); }
.tool:hover { background: var(--surface-2); }
.tool.on { background: var(--accent-soft); border-color: var(--accent); }
.tool.on small { color: var(--accent); }
.ic-rack { width: 18px; height: 18px; border-radius: 4px; background: #0f1b2b; box-shadow: inset 0 5px 0 -3px #4da3ff, inset 0 -5px 0 -3px #4da3ff; }
.ic-bandeja { width: 22px; height: 0; border-top: 4px solid #f59e0b; border-radius: 2px; }
.ic-dev { width: 22px; height: 22px; border-radius: 50%; background: var(--c); color: #fff; font-size: .6rem !important; font-weight: 800; }

/* Lienzo */
.canvas-wrap { position: relative; background: #e9edf2; overflow: hidden; }
@media (prefers-color-scheme: dark) { .canvas-wrap { background: #0b1016; } }
#lienzo { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; }
#lienzo.t-sel { cursor: default; } #lienzo.t-pan, #lienzo.panning { cursor: grabbing; }
#lienzo.t-add { cursor: crosshair; } #lienzo.t-borrar { cursor: not-allowed; }
.hint-bar { position: absolute; left: 12px; top: 12px; max-width: calc(100% - 24px); background: rgba(15, 27, 43, .88); color: #fff; font-size: .82rem; padding: 7px 12px; border-radius: 8px; pointer-events: none; }
.hint-bar:empty { display: none; }
.zoom-ctrl { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 4px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 4px; box-shadow: var(--shadow); }
.zoom-ctrl button { width: 32px; height: 32px; border: 0; background: none; font-size: 1.1rem; cursor: pointer; border-radius: 6px; color: var(--text); }
.zoom-ctrl button:hover { background: var(--surface-2); }
.chk { font-size: .8rem; padding: 0 8px; display: flex; gap: 4px; align-items: center; color: var(--text); }
.empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; }
.empty .card { max-width: 440px; }
.empty ol { padding-left: 1.2rem; } .empty li { margin-bottom: 4px; }
.empty[hidden] { display: none; }

/* SVG */
.it-label { font: 600 12px Inter, system-ui, sans-serif; paint-order: stroke; stroke: #fff; stroke-width: 3px; fill: #0f1b2b; }
.sel-ring { fill: none; stroke: #0b6bcb; stroke-dasharray: 3 2; }

/* Panel */
.panel { background: var(--surface); border-left: 1px solid var(--border); padding: 14px; overflow-y: auto; }
.panel h3 { margin-top: 14px; }
.panel .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel .kpi b { font-size: 1.3rem; }
.panel table td, .panel table th { padding: 5px 6px; }
.panel td:first-child { white-space: normal; }
.sel-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 12px; font-size: .88rem; }
.sel-card h4 { margin: 0 0 6px; font-size: .9rem; }
.sel-card .field { margin-bottom: 6px; }
.sel-card .row-actions { margin-top: 6px; }
.params summary { cursor: pointer; font-weight: 600; margin: 14px 0 8px; }
.params .grid-params { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 1100px) { .plano-layout { grid-template-columns: 64px minmax(0, 1fr) 320px; } .topnav { display: none; } }
@media (max-width: 820px) {
  body.app-plano { height: auto; overflow: auto; }
  .plano-layout { grid-template-columns: 1fr; grid-template-rows: auto 70vh auto; }
  .tools { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .tools hr { border-top: 0; border-left: 1px solid var(--border); margin: 2px 4px; }
  .tool { min-width: 56px; }
  .panel { border-left: 0; border-top: 1px solid var(--border); }
  .nombre-proy, .top-actions #btn-ejemplo { display: none; }
}
@media (max-width: 520px) { .plano-top .brand .badge, .plano-top .brand span:not(.logo) { display: none; } .plano-top { gap: 8px; } .top-actions { gap: 6px; } }
