/* Lo que añade a la entrega de diseño: el dibujo que calcula el motor, los formularios de datos y poco más.
   Usa solo las variables de styles.css. */

/* Unifilar */
.viewer svg.drawing { height: auto; padding: 8px; }
.viewer.sheet { display: flex; flex-direction: column; overflow: hidden; min-height: 360px; }
.viewer.sheet .viewer-tools { position: absolute; right: 8px; top: 8px; margin: 0; float: none; }
.sheet-scroll { flex: 1 1 0; min-height: 220px; overflow: auto; margin-top: 52px; }
.sheet-foot { flex: none; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px; background: var(--panel); border-top: 1px solid var(--line); }
.viewer.sheet .viewer-note { position: static; padding: 0 12px 8px; }
.viewer.sheet .title-block { position: static; border: 0; width: auto; margin-left: auto; grid-template-columns: repeat(4, auto); grid-auto-flow: column; grid-template-rows: auto auto; }
.viewer.sheet .title-block > * { border-bottom: 0; border-left: 1px solid var(--line); }
.viewer.sheet .title-block > :nth-child(odd) { color: var(--muted); }
.source-row > a, .source-row a.btn { flex: none; white-space: nowrap; }
#chat-reset { flex: none; white-space: nowrap; }
.drawing .sym-node, svg.preview .sym-node { stroke: var(--navy); color: var(--navy); stroke-width: 1.1; fill: none; }
.drawing .sym-node { cursor: pointer; }
.drawing .sym-node.new, svg.preview .sym-node.new { stroke: var(--select); color: var(--select); }
.drawing .sym-node.modified, svg.preview .sym-node.modified { stroke: var(--warn); color: var(--warn); }
.drawing .sym-node.removed, svg.preview .sym-node.removed { stroke: var(--line-strong); color: var(--line-strong); stroke-dasharray: 4 3; }
.drawing .sym-node.proposed, svg.preview .sym-node.proposed { stroke: var(--action); color: var(--action); stroke-dasharray: 4 3; }
.drawing rect.hit, svg.preview rect.hit { fill: transparent; stroke: none; }
.drawing .sym-node.sel rect.hit { fill: var(--navy-bg); stroke: var(--navy); stroke-width: 1; stroke-dasharray: none; }
.drawing .sym-node:focus { outline: none; }
.drawing .sym-node:focus-visible rect.hit { stroke: var(--action); stroke-width: 2; }
.drawing text, svg.preview text { fill: var(--navy); stroke: none; stroke-dasharray: none; font: 3.4px var(--font-mono); }
.drawing text.id, svg.preview text.id { font-size: 4.5px; font-weight: 700; }
.drawing text.nombre, svg.preview text.nombre { font: 700 7.5px var(--font-sans); }
.drawing text.resumen, svg.preview text.resumen { font: 6.5px var(--font-mono); fill: var(--muted); }
.drawing text.sym-text, svg.preview text.sym-text { fill: currentColor; font-family: var(--font-sans); }
.drawing text.tag, svg.preview text.tag { fill: var(--action); font: 700 6px var(--font-sans); }
.drawing circle.unverified, svg.preview circle.unverified { fill: var(--warn-bg); stroke: var(--warn); stroke-width: 0.8; stroke-dasharray: none; }
.drawing .wire, svg.preview .wire { stroke: var(--navy); stroke-width: 1.1; fill: none; }
.drawing .wire.retired, svg.preview .wire.retired { stroke: var(--line-strong); stroke-dasharray: 5 3; }
.drawing .cross { stroke: var(--line-strong); stroke-width: 1; }
.compare .viewer svg.drawing { padding: 28px 8px 8px; min-height: 0 !important; height: auto !important; }
svg.preview { display: block; width: 100%; height: 100%; min-height: 220px; }
.viewer.preview-viewer { flex: none; min-height: 240px; height: 34vh; overflow: hidden; }

/* Controles */
.btn-small { min-height: 30px; padding: 0 8px; font-size: 13px; }
button.tree-item { font-size: 14px; }
.item button { width: 100%; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; }
.check-list { display: flex; flex-direction: column; }
.check-list button { width: 100%; text-align: left; background: none; border: 0; cursor: pointer; font-size: 13px; }
.check-list button { border-bottom: 1px solid var(--line); }
.check-list button.is-selected { background: var(--select-bg); }
.check-list button > :last-child { flex: none; }
.checkline { display: flex; align-items: center; gap: 8px; min-height: 32px; font-size: 14px; }
.edit-form { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }
.edit-form .field { height: 36px; }
details > summary { cursor: pointer; min-height: 32px; font-weight: 700; }
img.boe { max-width: 100%; height: auto; border: 1px solid var(--line); }
pre.calc { white-space: pre-wrap; margin: 0; font-family: var(--font-mono); font-size: 13px; }
.boxed.padded { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.field-group .field { width: 100%; }

/* Tablas de datos editables */
.table.compact th, .table.compact td { padding: 6px 8px; }
.table.compact .field { height: 36px; padding: 0 8px; width: 100%; }
.table.compact select.field { min-width: 90px; }
.table.compact td:first-child, .table.compact th:first-child { position: sticky; left: 0; background: var(--panel); z-index: 1; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.table-scroll { max-width: 100%; }
/* El nombre largo de un archivo no empuja la acción fuera. */
.source-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }

/* Conversación: se conserva y se desplaza por dentro. */
.chat-log { max-height: 12vh; overflow: auto; }
.chat-log p { white-space: pre-wrap; }
.chat-proposal { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 14px; }
.chat-proposal:empty, .chat-log:empty { display: none; }
body[data-route="lectura"] .assistant, body[data-chat="off"] .assistant { display: none; }

.type-card:disabled { cursor: not-allowed; background: var(--neutral-bg); border-color: var(--line); color: var(--muted); }
.file-row .grow { overflow-wrap: anywhere; }
@media (min-width: 901px) {
  /* Las cajas del centro no se aplastan: la columna se desplaza. */
  .col-main > .boxed, .col-main > .viewer.preview-viewer, .col-main > .compare { flex-shrink: 0; }
}

/* Solo para lector de pantalla. */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.status-line { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 24px; }
.status-line .push { margin-left: auto; }
#text-size { flex: none; }
#text-size[aria-pressed="true"] { background: var(--panel); color: var(--navy); border-color: var(--panel); }

/* Texto grande, a elección: el diseño de serie no cambia. */
body.large-text { font-size: 17px; line-height: 25px; }
body.large-text :is(.small, .data, .label, .app-context, .app-steps, .status-bar, .btn-on-navy, .origin, .rows-head, .badge,
  .viewer-note, .title-block, .type-detail, .legend, .list-plain, .chat-user, .btn-small, .export-head, .file-head, pre.calc) {
  font-size: 15px; line-height: 21px;
}
body.large-text :is(.table th, .field-group label, .source-row .origin, .export-row .origin, .check-list button) { font-size: 15px; line-height: 21px; }
body.large-text :is(.table td, .kv, .source-row, .tree, .nav-list, .item, .result, .notice, .chat-log, .export-row, .file-row) { font-size: 16px; }

/* Pantallas estrechas: barra fija para saltar entre las columnas apiladas. */
.jump-bar { display: none; }
@media (max-width: 900px) {
  .jump-bar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--panel); border-top: 2px solid var(--navy); }
  .jump-bar button { min-height: 48px; border: 0; border-left: 1px solid var(--line); background: none; font: 700 14px var(--font-sans); color: var(--navy); cursor: pointer; }
  .jump-bar button:disabled { color: var(--line-strong); font-weight: 400; cursor: default; }
  body { padding-bottom: 50px; }
  /* El menú en filas y las listas largas acotadas: el contenido se ve al entrar. */
  .col-side { flex: 0 0 100%; gap: 12px; padding: 12px 16px; max-height: 46vh; overflow: auto; }
  .col-side .nav-list { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .col-side .nav-list a { padding: 8px 10px; border: 1px solid var(--line); }
  .col-side > nav > h2 { font-size: 14px; line-height: 18px; }
  .col-side > * { flex-shrink: 0; }
}

/* Planos subidos */
.drawing-scroll { cursor: grab; touch-action: pan-x pan-y; }
.drawing-scroll:active { cursor: grabbing; }
.drawing-scroll img { display: block; max-width: none; height: auto; margin: 0 auto; background: #ffffff; user-select: none; }
.layers .row { margin-bottom: 4px; }
.layer .data { overflow-wrap: anywhere; }

/* Biblioteca de símbolos */
.symbol-grid { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.symbol-grid li { display: flex; }
.symbol-card { width: 100%; align-items: center; gap: 8px; text-align: center; }
.symbol-card .badge { align-self: center; margin-top: auto; }
.symbol-thumb { display: flex; align-items: center; justify-content: center; height: 72px; width: 100%; }
.symbol-thumb img { max-width: 100%; max-height: 72px; height: 72px; object-fit: contain; }
.symbol-name { font-size: 13px; line-height: 18px; overflow-wrap: anywhere; }
.symbol-large { display: flex; align-items: center; justify-content: center; min-height: 220px; padding: 16px; border: 1px solid var(--line-strong); background: var(--panel); }
.symbol-large img { width: 100%; height: 200px; object-fit: contain; }
body.large-text .symbol-name { font-size: 15px; line-height: 20px; }
@media (min-width: 901px) { .col-main > .symbol-grid { flex-shrink: 0; } }
