/* Co-pilot AI · lo propio de la aplicación, con los tokens del kit (kit.css). Mismo lenguaje que la simulación
   aprobada (design/explorations/co-pilot-ai-simulacion.html). */
:root {
  /* la terminal es oscura, como la de verdad; sus colores también son tokens */
  --term-bg: #1C1D20; --term-fg: #E6E6E6; --term-dim: #A0A3A9; --term-ok: #7FD1B9; --term-aviso: #F2C46B;
  --term-yo: #2B2D31; --term-linea: #3A3D42; --term-error: #F28B82;
}
html, body { height: 100% }
body { padding-block: 12px }
.wrap { max-width: none; height: 100%; grid-template-rows: minmax(0, 1fr) }
.app { height: auto; min-height: 0 }

/* barra lateral */
.tipo { font: 600 11px/14px var(--sans); color: var(--gray-30); background: var(--surface); border-radius: 4px; padding: 0 5px; margin-right: 4px }
/* el estado va con prefijo «e-»: «libre» a secas choca con la fila de texto libre del kit */
.ses.e-espera { background: var(--atencion-fill); box-shadow: inset 0 0 0 1px var(--atencion-line) }
.ses.e-espera[aria-current="true"] { background: var(--atencion-fill); box-shadow: inset 0 0 0 1.5px var(--atencion) }
.ses.e-espera .nom { font-weight: 600 }
.ses .sim.s-libre, .ses .sim.s-fin { color: var(--muted) }
.ses .nom, .ses .meta { white-space: normal; overflow-wrap: anywhere }
.ses.copia { margin-left: 18px; width: calc(100% - 18px) }
.ses.copia .nom { font-size: 13px }
.flecha { color: var(--muted); margin-right: 4px }
.ses.apagada .nom { color: var(--muted) }
a.ses { color: inherit; text-decoration: none }
.mas-ses { all: unset; box-sizing: border-box; cursor: pointer; font-size: 12px; line-height: 16px; color: var(--enlace); padding: 6px 8px; border-radius: 6px }
.mas-ses:hover { background: var(--surface); text-decoration: underline }
.mas-ses:focus-visible { outline: 2px solid var(--resalte) }
/* filtros de la barra lateral: plegados en una línea que dice lo que está puesto */
.filtros { border: 1px solid var(--line); border-radius: var(--r-msg); font-size: 12px; line-height: 16px }
.filtros summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: baseline; padding: 7px 10px; list-style: none; border-radius: var(--r-msg) }
.filtros summary::-webkit-details-marker { display: none }
.filtros summary::before { content: "▸"; color: var(--muted) }
.filtros[open] summary::before { content: "▾" }
.filtros summary:hover { background: var(--surface) }
.f-res { color: var(--muted); overflow-wrap: anywhere }
.f-cuerpo { display: grid; gap: 10px; padding: 4px 10px 10px }
.f-fila { display: grid; gap: 4px }
.f-et { color: var(--muted); font-weight: 600 }
.f-fila select { font: 13px/18px var(--sans); color: var(--fg); padding: 4px 8px; min-height: 30px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--panel); min-width: 0; width: 100% }
.filtros .letra { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-radius: var(--r-msg) }
.filtros .letra button { justify-content: center; text-align: center; border-radius: 6px; padding: 4px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.plegadas { margin-top: 2px }
.plegadas summary { cursor: pointer; font-size: 12px; line-height: 16px; color: var(--muted); padding: 6px 8px; border-radius: 6px; list-style-position: inside }
.plegadas summary:hover { background: var(--surface) }
.plegadas summary:focus-visible { outline: 2px solid var(--resalte) }
.e-origen { font-size: 11px; line-height: 14px; color: var(--muted); text-transform: none }
.btn.peligro { color: var(--red-30); box-shadow: inset 0 0 0 1px var(--red-30) }
.ep-libre, .ep-fin { background: var(--surface); color: var(--gray-30) }
.otro-ord { font-size: 12px; line-height: 16px; color: var(--muted); padding: 0 8px }
.lat-pie { padding: 8px 12px 12px; display: grid; gap: 8px; border-top: 1px solid var(--line) }
.lat-pie .btn { width: 100% }
/* la barra lateral lleva filtros y nombres largos: un poco más ancha que la del kit entre 760 y 1099 px */
@media (min-width: 760px) and (max-width: 1099px) { .app { grid-template-columns: 244px minmax(0, 1fr) } }
@media (min-width: 1100px) { .app { grid-template-columns: minmax(244px, 2fr) 10fr } }
/* tamaño del texto: --zoom lo pone app.js. El navegador ya resuelve el 100 % de alto en la escala nueva: no compensar */
:root { --zoom: 1 }
.wrap { zoom: var(--zoom) }
.tam-texto { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; color: var(--muted) }
.tam-texto span { flex: 1 }
.tam-texto output { min-width: 4ch; text-align: center; font-variant-numeric: tabular-nums; color: var(--fg) }
.tecla-t { all: unset; box-sizing: border-box; cursor: pointer; min-width: 32px; min-height: 28px; display: inline-grid; place-items: center; border: 1px solid var(--line-2); border-radius: 6px; font: 600 12px/16px var(--sans); color: var(--fg); background: var(--panel) }
.tecla-t:hover:not(:disabled) { background: var(--surface) }
.tecla-t:focus-visible { outline: 2px solid var(--resalte); outline-offset: 1px }
.tecla-t:disabled { opacity: .4; cursor: default }
.cabecera.te-espera { border-color: var(--atencion); box-shadow: inset 0 0 0 1px var(--atencion) }

/* recursos: ordenadores, tres cifras cada uno */
.maq-pts { grid-template-columns: minmax(0, 1fr) auto auto auto; container-type: inline-size }
@container (max-width: 319px) { .mq-n { grid-column: 1 / -1 } .mq-n + .mq-v { grid-column: 2 } }
.sin-dato { color: var(--muted); font-weight: 400 }

/* terminal de una sesión de línea de órdenes (tmux) */
.sec.term-sec { grid-template-rows: auto minmax(0, 1fr) auto }
.term-caja { margin: 0 12px; display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; background: var(--term-bg); color: var(--term-fg); border-radius: var(--r-msg); overflow: hidden; font: 13px/18px var(--mono) }
.term { overflow: auto; padding: 10px 12px 6px; min-height: 0; margin: 0; white-space: pre; font: inherit; overscroll-behavior: contain; outline: none }
.term:focus-visible { box-shadow: inset 0 0 0 2px var(--term-ok) }
.term .cur { background: var(--term-fg); color: var(--term-bg) }
.term-in { padding: 8px 12px 10px; border-top: 1px solid var(--term-linea); display: grid; gap: 6px }
.t-caja { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--term-linea); border-radius: 6px; padding: 6px 10px }
.t-caja:focus-within { border-color: var(--term-dim) }
.t-caja span { color: var(--term-dim) }
.t-caja textarea { all: unset; flex: 1; min-width: 0; color: var(--term-fg); font: 13px/20px var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 160px; overflow: auto; field-sizing: content; min-height: 20px }
.t-caja textarea::placeholder { color: var(--term-dim) }
.t-pie { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 8px; color: var(--term-dim); font-size: 12px; line-height: 16px; align-items: center }
.teclas { display: flex; flex-wrap: wrap; gap: 4px }
.tecla { all: unset; box-sizing: border-box; cursor: pointer; font: 500 11px/14px var(--mono); padding: 3px 7px; border-radius: 4px; border: 1px solid var(--term-linea); color: var(--term-fg) }
.tecla:hover { background: var(--term-yo) }
.tecla:focus-visible { outline: 2px solid var(--term-ok) }
.term-aviso { padding: 10px 12px; color: var(--muted); font-size: 12px; line-height: 16px }

/* conversación en solo lectura (Desktop, o línea de órdenes fuera de tmux) */
.desk-pie { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 10px 16px 12px; border-top: 1px solid var(--line); font-size: 12px; line-height: 16px; color: var(--muted) }
.m .t { white-space: pre-wrap; overflow-wrap: anywhere }
.m .t.md { white-space: normal; display: grid; gap: 8px; max-width: none }
.m .t.md p, .m .t.md ul, .m .t.md ol { margin: 0 }
.m .t.md ul { padding-left: 20px }
.tool { overflow-wrap: anywhere }
.tool small { color: var(--muted); font-family: var(--mono); font-size: 12px }

/* fichas */
.ficha.nueva { animation: llega 1.6s ease-out }
@keyframes llega { from { box-shadow: 0 0 0 6px var(--atencion-line) } to { box-shadow: 0 0 0 0 transparent } }
@media (prefers-reduced-motion: reduce) { .ficha.nueva { animation: none } }
.f-pie { font-size: 12px; line-height: 16px; color: var(--muted); overflow-wrap: anywhere }
.f-pie code { font-family: var(--mono); background: var(--surface); padding: 1px 5px; border-radius: 4px }
.f-id { font: 12px/16px var(--mono); color: var(--muted) }
.f-porque { margin: 0; padding-left: 18px; font-size: 12px; line-height: 16px; color: var(--muted) }
.f-repo { font-size: 12px; line-height: 16px; color: var(--muted) }
.f-acc { display: flex; flex-wrap: wrap; gap: 8px; align-items: center }
.f-acc .enlace { font-size: 12px }
.libre textarea { flex: 1; min-width: 0; font: 14px/20px var(--sans); color: var(--fg); padding: 6px 14px; min-height: 36px; border: 1px solid var(--line-2); border-radius: 18px; background: var(--panel); resize: vertical; field-sizing: content; max-height: 160px }
.libre textarea:focus { border-color: var(--resalte); outline: 1px solid var(--resalte) }
.op[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accion) }
.der { grid-template-rows: minmax(0, 1fr) auto }
.der.v-abierto { grid-template-rows: minmax(0, 1fr) minmax(0, 1.3fr) }

/* visor */
.docs-lista { display: grid; gap: 2px; padding: 8px 12px 12px }
.docs-lista .enlace { text-align: left; font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere }
.docs-lista h3 { font: 600 12px/16px var(--sans); color: var(--muted); margin: 8px 0 4px }
.doc { max-width: 80ch; overflow-wrap: anywhere }
.doc h1, .doc h2 { font: 600 18px/24px var(--display); margin: 8px 0 0 } .doc h5, .doc h6 { font: 600 12px/16px var(--sans); margin: 4px 0 0 }
.doc ol { margin: 0; padding-left: 22px }
.doc pre { background: var(--surface); border-radius: 6px; padding: 10px 12px; overflow-x: auto; font: 12px/18px var(--mono); margin: 0 }
.doc pre code { background: none; padding: 0 }
.doc blockquote { margin: 0; padding-left: 12px; border-left: 3px solid var(--line-2); color: var(--muted) }
.doc hr { border: 0; border-top: 1px solid var(--line); width: 100% }
.doc .t-wrap { overflow-x: auto }
.doc table { border-collapse: collapse; font-size: 12px; line-height: 16px }
.doc th, .doc td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top }
.doc th { background: var(--surface) }
.doc a { color: var(--enlace) }

/* inicio */
/* arriba, juntas: nueva sesión, métrica y este ordenador; debajo, «Te toca a ti» y las sesiones a dos columnas */
.inicio { container-type: inline-size }
.ini-barra { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, .8fr); grid-template-rows: none; padding: 12px 0 }
.inicio > .sec { min-height: auto }
.ib-zona { display: grid; gap: 8px; align-content: start; padding: 0 16px; min-width: 0 }
.ib-zona + .ib-zona { border-left: 1px solid var(--line) }
.ib-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 8px }
.ib-cab .n { font-size: 12px; color: var(--muted) }
.nueva-fila { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center }
.nueva-fila select { font: 14px/20px var(--sans); color: var(--fg); padding: 5px 10px; min-height: 34px; border: 1px solid var(--line-2); border-radius: var(--r-msg); background: var(--panel); min-width: 0 }
.ib-cifras { display: grid; gap: 4px; font-size: 12px; line-height: 16px; color: var(--muted) }
.ib-cifras b { display: inline-block; min-width: 4.2em; font: 600 15px/20px var(--display); color: var(--fg); font-variant-numeric: tabular-nums }
.ib-ajustes summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; list-style: none }
.ib-ajustes summary::-webkit-details-marker { display: none }
.ib-ajustes summary .enlace { font-size: 12px }
.ib-ajustes .form { padding: 10px 0 0 }
.ib-zona > .f-pie { margin: 0 }
.bloques { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 12px; align-items: start }
@container (max-width: 860px) { .ini-barra { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); row-gap: 14px } .ini-barra > .ib-zona:first-child { grid-column: 1 / -1 } .ini-barra > .ib-zona:nth-child(2) { border-left: 0 } }
@container (max-width: 700px) { .bloques { grid-template-columns: minmax(0, 1fr) } }
@container (max-width: 520px) { .ini-barra { grid-template-columns: minmax(0, 1fr) } .ini-barra > .ib-zona { border-left: 0 } }
.bloques > .sec { min-width: 0 }
.filas-ses { list-style: none; margin: 0; padding: 0; display: grid }
.fs { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line) }
.filas-ses .fs:first-child { border-top: 0 }
.fs-t { display: grid; gap: 2px; min-width: 0 }
.fs-t .enlace, .fs-t > span:first-child { overflow-wrap: anywhere; text-align: left; justify-self: start }
.fs-meta { font-size: 12px; line-height: 16px; color: var(--muted); overflow-wrap: anywhere }
.fs.apagada .fs-t > :first-child { color: var(--muted) }
.fs-vacio { color: var(--muted); font-size: 13px; padding: 8px 0 }
.sec .plegadas { margin-top: 6px }
.sec .plegadas summary { padding-inline: 0 }
.inicio .sec { max-height: none }
.inicio .sec-cuerpo { overflow: visible }
.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; padding: 0 16px 16px }
.cifra { background: var(--surface); border-radius: var(--r-msg); padding: 10px 12px; display: grid; gap: 2px }
.cifra b { font: 600 20px/24px var(--display); font-variant-numeric: tabular-nums }
.cifra span { font-size: 12px; line-height: 16px; color: var(--muted) }
.nota { font-size: 12px; line-height: 16px; color: var(--muted); padding: 0 16px 14px }
.campo { display: grid; gap: 4px; font-size: 12px; line-height: 16px; color: var(--muted) }
.campo input, .campo select { font: 14px/20px var(--sans); color: var(--fg); padding: 6px 12px; min-height: 36px; border: 1px solid var(--line-2); border-radius: var(--r-msg); background: var(--panel) }
.form { display: grid; gap: 10px; padding: 0 16px 16px }
.fila-btn { display: flex; flex-wrap: wrap; gap: 8px; align-items: center }

/* diálogo (relevo) */
dialog { border: 1px solid var(--line); border-radius: var(--r-card); padding: 0; width: min(720px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); background: var(--panel); color: var(--fg); box-shadow: var(--sombra) }
dialog::backdrop { background: rgba(32, 33, 36, .35) }
.dlg { display: grid; gap: 12px; padding: 16px 18px }
.dlg h2 { font: 600 18px/24px var(--display) }
.dlg pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); border-radius: var(--r-msg); padding: 12px; font: 12px/18px var(--mono); margin: 0; max-height: 46dvh; overflow: auto }

/* avisos flotantes */
.avisos { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 20; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 32px)) }
.aviso { background: var(--panel); border: 1px solid var(--atencion-line); border-radius: var(--r-card); box-shadow: var(--sombra); padding: 12px 14px; display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 4px 10px; align-items: start }
.aviso.mal { border-color: var(--red-80) }
.aviso b { font-weight: 600 }
.aviso p { color: var(--muted); font-size: 12px; line-height: 16px }
.aviso .acciones { grid-column: 2 }

/* cabecera: nada se corta; los datos y los botones bajan de línea antes que esconderse */
.cabecera { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) }
.cab-izq { justify-content: flex-start; gap: 8px }
.cab-izq .cab-fila:first-child { max-width: none; flex-wrap: nowrap }
.cab-datos { display: flex; flex-wrap: wrap; row-gap: 2px; font-size: 12px; line-height: 16px; color: var(--muted); min-width: 0 }
.cab-datos span + span::before { content: "·"; padding: 0 6px }
.acciones { flex-wrap: wrap }

/* ciclo del repo: avance, ahora, después y lo que te espera; se abre entero al pulsarlo */
.ciclo { display: grid; align-content: start; gap: 6px; padding: 8px 12px; border-radius: var(--r-msg); background: var(--surface); min-width: 0; cursor: pointer; box-shadow: inset 0 0 0 1px transparent }
.ciclo:hover, .ciclo.abierto { box-shadow: inset 0 0 0 1px var(--resalte) }
.ciclo:focus-visible { outline: 2px solid var(--resalte); outline-offset: 1px }
.c-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; min-width: 0 }
.c-pct { font: 600 17px/22px var(--display); color: var(--fg); font-variant-numeric: tabular-nums; white-space: nowrap }
.c-pct small { font-size: 12px; color: var(--muted); margin-left: 2px }
.ciclo .paso:not(.hecho):not(.actual) { background: var(--line-2) }
.c-ejes { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; line-height: 14px; color: var(--muted) }
.c-ejes span:first-child { color: var(--fg); font-weight: 600 }
.c-filas { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 10px; margin: 0; font-size: 12px; line-height: 16px }
.c-filas dt { color: var(--muted); font-weight: 600; white-space: nowrap }
.c-filas dd { margin: 0; color: var(--fg); overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden }
.ciclo.abierto .c-filas dd { display: block; -webkit-line-clamp: unset }
.c-vacio { margin: 0; font-size: 12px; line-height: 16px; color: var(--muted) }

/* divisor arrastrable entre la conversación y la derecha; por debajo del mínimo, la derecha se pliega en un riel */
.divisor, .riel { display: none }
@media (min-width: 760px) {
  .cuerpo.con-divisor { grid-template-columns: minmax(360px, var(--izq, 1fr)) 12px minmax(320px, 1fr); column-gap: 0 }
  .cuerpo.con-divisor.der-plegada { grid-template-columns: minmax(0, 1fr) 12px 44px }
  .divisor { display: block; position: relative; cursor: col-resize; touch-action: none; outline: none }
  .divisor::before { content: ""; position: absolute; top: 12px; bottom: 12px; left: 50%; width: 2px; transform: translateX(-50%); border-radius: var(--r-pill); background: transparent }
  .divisor::after { content: ""; position: absolute; top: 50%; left: 50%; width: 4px; height: 32px; transform: translate(-50%, -50%); border-radius: var(--r-pill); background: var(--line-2) }
  .divisor:hover::before, .divisor:focus-visible::before { background: var(--line-2) }
  .divisor:hover::after, .divisor:focus-visible::after, .cuerpo.arrastrando .divisor::after { background: var(--resalte) }
  .cuerpo.arrastrando .divisor::before { background: var(--resalte) }
  .cuerpo.arrastrando { user-select: none; cursor: col-resize }
  .cuerpo.a-plegar #der { opacity: .4 }
  .riel:not([hidden]) { display: grid; align-content: start; gap: 8px; min-height: 0 }
}
.r-btn { all: unset; box-sizing: border-box; cursor: pointer; width: 44px; padding: 12px 0; display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); font: 600 12px/16px var(--sans); color: var(--fg) }
.r-btn:hover { background: var(--surface) }
.r-btn:focus-visible { outline: 2px solid var(--resalte); outline-offset: 1px }
.r-t { writing-mode: vertical-rl; transform: rotate(180deg) }
.r-n { min-width: 20px; height: 20px; padding: 0 4px; box-sizing: border-box; border-radius: var(--r-pill); display: grid; place-items: center; font-size: 11px; background: var(--surface); color: var(--muted); font-variant-numeric: tabular-nums }
.r-btn.con { border-color: var(--atencion); box-shadow: inset 0 0 0 1px var(--atencion) }
.r-btn.con .r-n { background: var(--atencion-fill); color: var(--fg); box-shadow: inset 0 0 0 1px var(--atencion-line) }

@media (max-width: 759px) {
  .wrap { height: auto }
  .sec.term-sec { grid-template-rows: auto auto auto }
  .term { max-height: 420px; min-height: 260px }
  .der, .der.v-abierto { grid-template-rows: auto }
}
.der[hidden], .riel[hidden] { display: none !important }

/* sesión de otro ordenador: solo su resumen y cómo seguirla */
.cabecera.remota { grid-template-columns: minmax(0, 1fr) }
.remota-sec .sec-cuerpo { display: grid; gap: 10px; max-width: 75ch; padding-top: 0 }
.remota-sec p { margin: 0 }
.pasos-rc { margin: 0; padding-left: 20px; display: grid; gap: 8px }
.pasos-rc code { font-family: var(--mono); background: var(--surface); padding: 1px 5px; border-radius: 4px }
.rem-h { font: 600 13px/18px var(--sans); margin: 6px 0 0 }
.rem-fichas { margin: 0; padding-left: 20px; display: grid; gap: 4px }
/* Central: ordenadores del portal, código de alta y conexión de cada ordenador */
.ords { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px }
.ord-fila { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0 }
.ord-fila .enlace { font-size: 12px; margin-left: auto }
.codigo-alta { display: grid; gap: 4px; margin: 0 }
.codigo-alta b { font: 600 20px/26px var(--mono); letter-spacing: .08em }
.central-est { margin: 8px 0 0; overflow-wrap: anywhere }
