/* Infinite Canvas · MIRÓ Labs. Marco Bakers (aprobado por Alonso el 2026-10-09): una ventana oscura cálida,
   ligeramente translúcida, con un riel de iconos finos, el lienzo como superficie sólida y un panel derecho tintado.
   Inter y JetBrains Mono, grises para la jerarquía, bordes finos en vez de sombras. */

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  background: var(--canvas);
  color: var(--ink);
  font: 14px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
}
button,
input {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* piezas flotantes */
.float {
  position: fixed;
  z-index: 20;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--float-shadow);
  will-change: transform;
}

.menu summary {
  list-style: none;
  height: 40px;
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: 10px;
}
.menu summary::-webkit-details-marker {
  display: none;
}
.menu summary:hover {
  background: var(--hover);
}
/* los ajustes se abren junto al engranaje del riel */
.menu-list {
  position: fixed;
  left: calc(var(--m) + var(--rail) + 8px);
  top: calc(var(--m) + 150px);
  z-index: 66;
  padding: 6px;
  display: grid;
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--float-shadow);
}
.menu-list a,
.menu-list button,
.menu-list .file {
  display: block;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  font-size: 13.5px;
  text-decoration: none;
  color: inherit;
}
.menu-list a:hover,
.menu-list button:hover,
.menu-list .file:hover {
  background: #f5f5f5;
}
.menu-list hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4px 0;
  width: 100%;
}
.menu-list .danger {
  color: #b3261e;
}
.file {
  position: relative;
  cursor: pointer;
}
.file input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* biblioteca: cajón a la derecha */
.drawer {
  top: calc(var(--top) + 8px);
  right: 8px;
  bottom: 52px;
  width: 340px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto minmax(0, 1fr);
  overflow: hidden;
}
.drawer[hidden] {
  display: none;
}

.drawer-head b {
  font-size: 14px;
  font-weight: 600;
}
.drawer-head button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: none;
  font-size: 18px;
  color: var(--soft);
}
.drawer-head button:hover {
  background: #f5f5f5;
}
.tabs {
  display: flex;
  gap: 0;
  padding: 4px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs button {
  flex: auto;
  padding: 0 7px;
  white-space: nowrap;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--soft);
}

.filter input {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
  outline: none;
}
.filter input:focus {
  border-color: var(--accent);
  background: var(--surface);
}
.lib {
  touch-action: pan-y;
  overflow-y: auto;
  padding: 4px 12px 14px;
  display: grid;
  gap: 6px;
  align-content: start;
  scrollbar-width: thin;
}
.hint {
  color: var(--soft);
  font-size: 12px;
  margin: 4px 0 0;
}

.chip {
  border-radius: 8px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.chip:active {
  cursor: grabbing;
}
/* componentes: nombre y una línea */
.chip.comp {
  padding: 6px;
  border: 1px solid var(--line);
  display: grid;
  gap: 6px;
}
.chip.comp:hover {
  border-color: var(--accent);
}
.chip.comp b {
  font-size: 12.5px;
  font-weight: 600;
  padding: 0 2px 2px;
}
/* vista previa real: la página de Componentes a 1280 px, reducida */
.thumb {
  position: relative;
  height: 150px;
  overflow: hidden;
  border-radius: 4px;
  background: #f6f6f4;
  contain: strict;
}

/* tipos: la fuente se muestra con su propio nombre */
.chip.font {
  display: grid;
  height: 54px;
  padding: 6px 10px;
  border: 1px solid transparent;
  contain: paint;
  align-content: center;
}
.chip.font .name {
  font-size: 20px;
  line-height: 26px;
  height: 26px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip.font small {
  color: var(--soft);
  font-size: 11px;
  line-height: 14px;
}
.chip.font:hover {
  border-color: var(--line);
  background: #fafafa;
}
/* color y patrones: solo la muestra */
.grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.chip.wada {
  display: flex;
  height: 28px;
  overflow: hidden;
  outline: 1px solid #00000010;
  outline-offset: -1px;
}
.chip.wada i {
  flex: 1;
}
/* un estilo guardado: sus colores con el área que ocupan */
.chip.estilo {
  display: grid;
  gap: 4px;
  padding: 6px;
}
.chip.estilo .sw {
  display: flex;
  height: 22px;
  border-radius: 3px;
  overflow: hidden;
}
.chip.wada:hover,
.chip.estilo:hover,
.chip.pat:hover {
  box-shadow: 0 0 0 2px var(--accent);
}
.chip.pat {
  overflow: hidden;
  outline: 1px solid #00000010;
  outline-offset: -1px;
}

/* mesa seleccionada */
.inspector {
  left: calc(var(--rail) + 8px);
  top: calc(var(--top) + 8px);
  width: 272px;
  max-height: calc(100vh - var(--top) - 130px);
  overflow-y: auto;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  font-size: 13px;
}
.inspector > *,
.inspector .val {
  min-width: 0;
}
.inspector[hidden] {
  display: none;
}
.inspector .name {
  font-weight: 600;
  font-size: 14px;
  border: 0;
  padding: 2px 4px;
  margin: -2px -4px;
  border-radius: 4px;
  background: none;
  width: 100%;
}
.inspector .name:hover {
  background: #f5f5f5;
}
.inspector .row {
  display: grid;
  gap: 4px;
}
.inspector .label {
  font: 10.5px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--soft);
}
.inspector .val {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
}
.inspector .val span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inspector .val .sw {
  display: flex;
  width: 44px;
  height: 18px;
  border-radius: 3px;
  overflow: hidden;
  flex: none;
}
.inspector .val .sw i {
  flex: 1;
}
.inspector .empty {
  color: #a3a3a3;
}
.inspector button.x {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--soft);
  flex: none;
}
.inspector button.x:hover {
  background: #f5f5f5;
  color: #b3261e;
}
.inspector button.mode {
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: #fff;
  font-size: 11px;
  flex: none;
}
.inspector ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 2px;
}

.inspector li span {
  flex: 1;
}
.inspector li button {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--soft);
}
.inspector li button:hover {
  background: #f5f5f5;
}
.inspector li button:disabled {
  visibility: hidden;
}

/* lienzo */

.viewport.panning {
  cursor: grabbing;
}
.viewport.drop {
  box-shadow: inset 0 0 0 2px var(--accent);
}
.world {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
}

/* piezas del lienzo */
.item {
  position: absolute;
}

.item.sel .handle {
  display: block;
}

.frame .page {
  position: relative;
  width: 100%;
  min-height: 100%;
  background: var(--background, #fff);
  color: var(--foreground, #171717);
  overflow: hidden;
  box-shadow:
    0 0 0 1px #0000000f,
    0 12px 32px -16px #00000026;
}
.frame iframe {
  display: block;
  width: 100%;
  border: 0;
  pointer-events: none;
  background: transparent;
}
.frame .slot {
  position: relative;
}
.slot-banco {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: 12px var(--ui);
  opacity: 0;
  pointer-events: none;
}
.slot:hover .slot-banco,
.frame.sel .slot-banco,
.slot:focus-within .slot-banco {
  opacity: 1;
  pointer-events: auto;
}
.slot-banco:hover {
  background: var(--hover);
}
.banco {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  color: var(--ink);
  font: 13px var(--ui);
}
.banco[hidden] {
  display: none;
}
.banco-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.banco-sp {
  flex: 1;
}
.banco-mesa {
  color: var(--soft);
}
.banco button {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 6px 9px;
  cursor: pointer;
}
.banco button:hover {
  background: var(--hover);
}
.banco button[aria-pressed="true"],
.banco-parte.on > button {
  background: var(--hover);
  border-color: var(--soft);
}
.banco-cuerpo {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 270px;
  flex: 1;
  min-height: 0;
}
.banco-partes,
.banco-panel {
  overflow: auto;
  padding: 16px;
  background: var(--surface);
}
.banco-partes {
  border-right: 1px solid var(--line);
}
.banco-panel {
  border-left: 1px solid var(--line);
}
.banco-h {
  margin: 0 0 12px;
  font-weight: 600;
}
.banco-ayuda {
  color: var(--soft);
  line-height: 1.6;
}
.banco-parte {
  margin-bottom: 10px;
}
.banco-parte > button {
  width: 100%;
  text-align: left;
}
.banco-parte label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  font-size: 11px;
  color: var(--soft);
}
.banco-parte.oculta > button {
  color: var(--soft);
}
.banco-escena {
  min-width: 0;
  overflow: auto;
  padding: 24px;
}
.banco-marco {
  position: relative;
  background: #fff;
  box-shadow: 0 2px 20px #00000015;
  margin: 0 auto;
}
.banco iframe {
  display: block;
  border: 0;
  transform-origin: 0 0;
}
.banco-campo {
  display: block;
  margin: 0 0 16px;
}
.banco-campo input,
.banco-campo textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: var(--canvas);
  color: var(--ink);
  font: inherit;
}
.banco-campo textarea {
  resize: vertical;
}
.banco-opciones,
.banco-seg,
.banco-wada,
.banco-imgs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.banco-wada input {
  width: 64px;
  margin: 0;
}
.banco-sw {
  display: flex;
  gap: 2px;
}
.banco-sw i {
  display: block;
  width: 14px;
  height: 20px;
  border: 1px solid #80808040;
}
.banco-imgs button {
  padding: 3px;
}
.banco-imgs img {
  display: block;
  width: 54px;
  height: 54px;
  object-fit: cover;
}
.banco-estilo {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.banco-grupo {
  margin-bottom: 10px;
}
.banco-grupo summary {
  padding: 4px 0;
  color: var(--soft);
  cursor: pointer;
}
.banco-grupo[open] summary {
  margin-bottom: 6px;
  color: var(--ink);
}
.banco-grupo .banco-parte {
  margin-left: 10px;
}
/* angosto (el panel de Codex, ~760 px): partes en una franja arriba y la edición abajo; el componente usa todo el ancho */
@media (max-width: 900px) {
  .banco-cuerpo {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(120px, 1fr) minmax(100px, 35vh);
  }
  .banco-partes,
  .banco-panel {
    padding: 10px;
  }
  .banco-partes {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-height: 30vh;
    overflow: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .banco-grupo {
    flex-shrink: 0;
    margin: 0;
  }
  .banco-grupo .banco-parte {
    margin: 0 0 6px;
  }
  .banco-partes .banco-h {
    display: none;
  }
  .banco-parte {
    flex-shrink: 0;
    margin: 0;
  }
  .banco-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .banco-mesa {
    display: none;
  }
}
/* con la mesa seleccionada, los componentes se usan de verdad; la mesa se mueve desde su nombre */
.frame.sel iframe {
  pointer-events: auto;
}
body.dragging .frame iframe,
.viewport.panning .frame iframe {
  pointer-events: none;
}
.frame.target .page {
  outline: 3px solid var(--accent);
  outline-offset: 6px;
}
.ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  padding: 6px 12px;
  border-radius: 99px;
  background: var(--ink);
  color: var(--on-accent);
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 6px 16px #00000030;
}
.ghost.on-frame {
  background: var(--accent);
}
body.dragging,
body.dragging * {
  cursor: grabbing !important;
  user-select: none;
}
.frame .band {
  display: block;
  width: 100%;
  height: 260px;
}
.specimen {
  padding: 72px 80px;
  display: grid;
  gap: 20px;
}
.specimen .k {
  font: 12px var(--mono);
  color: var(--muted-foreground, #5c5c5c);
}
.specimen h1 {
  margin: 0;
  font-family: var(--ft-display, var(--ft-texto, var(--ui)));
  font-weight: 600;
  font-size: 72px;
  line-height: 1.02;
  letter-spacing: -0.02em;
  max-width: 14ch;
}
.specimen p {
  margin: 0;
  font-family: var(--ft-texto, var(--ui));
  font-size: 19px;
  line-height: 1.6;
  max-width: 52ch;
  color: var(--muted-foreground, #5c5c5c);
}
.specimen .btns {
  display: flex;
  gap: 12px;
}
.specimen .btns span {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 22px;
  border-radius: 99px;
  font-family: var(--ft-texto, var(--ui));
  font-weight: 600;
}
.specimen .btns .p {
  background: var(--primary, #171717);
  color: var(--primary-foreground, #fff);
}
.specimen .btns .o {
  border: 1px solid var(--border, #ddd);
}
.specimen .sw {
  display: flex;
  height: 40px;
  max-width: 360px;
}
.specimen .sw i {
  flex: 1;
}
.specimen .empty {
  font: 13px var(--mono);
  color: var(--muted-foreground, #5c5c5c);
  border: 1px dashed var(--border, #ccc);
  padding: 16px;
}
.frame.celular .specimen {
  padding: 40px 24px;
}
.frame.celular .specimen h1 {
  font-size: 40px;
}

.note[contenteditable="true"] {
  cursor: text;
  outline: 2px solid var(--accent);
}
.image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  border-radius: 4px;
  box-shadow: 0 1px 3px #0000001a;
}
.link {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  display: grid;
  gap: 4px;
  cursor: move;
  overflow: hidden;
}
.link b {
  font-size: 15px;
}
.link a {
  color: var(--accent);
  font-size: 13px;
  word-break: break-all;
}
.ref {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  display: grid;
  gap: 8px;
  cursor: move;
  overflow: hidden;
}
.ref .k {
  font: 11px var(--mono);
  color: var(--soft);
}
.ref .sw {
  display: flex;
  height: 100%;
  min-height: 60px;
}
.ref .sw i {
  flex: 1;
}
.ref .sample {
  font-size: 44px;
  line-height: 1.1;
}
.ref patron-fondo {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 120px;
}

.status {
  position: fixed;
  left: 50%;
  top: calc(var(--top) + 10px);
  transform: translateX(-50%);
  z-index: 30;
  margin: 0;
  padding: 7px 14px;
  background: var(--ink);
  color: var(--on-accent);
  border-radius: 99px;
  font-size: 12.5px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  white-space: nowrap;
}
.status.on {
  opacity: 1;
}

@media (max-width: 720px) {
  .toolbar > button kbd {
    display: none;
  }
  .recipe {
    padding: 0 12px;
  }
  .drawer {
    left: calc(var(--rail) + 8px);
    width: auto;
    top: auto;
    height: 55vh;
    bottom: 16px;
  }
  .inspector {
    display: none;
  }
}

/* menú de clic derecho sobre un componente */
.ctx {
  z-index: 60;
  width: 230px;
  padding: 6px;
  display: grid;
}
.ctx[hidden] {
  display: none;
}
.ctx button {
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  font-size: 13.5px;
}
.ctx button:hover {
  background: #f5f5f5;
}
.inspector .chg {
  color: var(--accent);
  font-size: 11px;
}
.inspector li button.reset {
  width: auto;
  padding: 0 6px;
  font-size: 11px;
  color: var(--accent);
}
.inspector li {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

/* agente: barra abajo al centro, respuesta encima */

.ask textarea::placeholder {
  color: var(--soft);
  opacity: 1;
}

.ask.on button[type="submit"] {
  background: var(--ink);
  color: var(--on-accent);
}
.ask.busy button[type="submit"] {
  background: var(--accent);
  color: var(--on-accent);
  animation: pulse 1s ease-in-out infinite alternate;
}
@keyframes pulse {
  to {
    opacity: 0.45;
  }
}

.reply[hidden] {
  display: none;
}
.reply p {
  margin: 0 0 6px;
}
.reply p:last-of-type {
  margin-bottom: 0;
}
.reply .q {
  color: var(--soft);
  font-size: 12.5px;
}
.reply .wait {
  color: var(--accent);
}
.reply code {
  font: 12px var(--mono);
  background: #f5f5f5;
  padding: 1px 5px;
  border-radius: 4px;
}
.reply .acts {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.reply .acts button {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--bk-line2, var(--line));
  border-radius: 99px;
  background: #fff;
  font-size: 12.5px;
}
.reply .acts button:hover {
  background: var(--tinte);
}
.reply .close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--soft);
  font-size: 17px;
}

/* variantes, variar y estilo */
.reply .hint2 {
  color: var(--soft);
  font-size: 12.5px;
}
.inspector .pick {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  background: #f3f7f5;
}
.inspector .pick p {
  margin: 0;
  font-size: 12.5px;
  color: #525252;
}
.inspector .pick button {
  height: 30px;
  border: 0;
  border-radius: 99px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-size: 13px;
}
.inspector .vary {
  display: flex;
  align-items: center;
  gap: 6px;
}
.inspector .vary .label {
  flex: 1;
}
.inspector .vary button {
  height: 26px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: #fff;
  font-size: 12px;
}
.inspector .vary button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.inspector .code {
  flex: 1;
  font: 10.5px var(--mono);
  color: #525252;
  background: #f5f5f5;
  padding: 3px 6px;
  border-radius: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gusto {
  top: calc(var(--top) + 8px);
  right: 8px;
  width: 340px;
  padding: 0 14px 14px;
  display: grid;
  gap: 10px;
}
.gusto[hidden] {
  display: none;
}
.gusto .drawer-head {
  padding: 12px 0 0;
}
.gusto textarea {
  width: 100%;
  resize: vertical;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
  font: 13px/1.5 var(--ui);
  outline: none;
}
.gusto textarea:focus {
  border-color: var(--accent);
  background: var(--surface);
}
.gusto .primary {
  height: 36px;
  border: 0;
  border-radius: 99px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
.gusto .primary:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* proyecto abierto: su nombre abre el menú de proyectos */

.ptitle button:hover,
.ptitle button[aria-expanded="true"] {
  background: #f5f5f5;
}

.ptitle svg {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--soft);
}

#saveState::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: var(--accent);
}
#saveState[data-st="saving"]::before {
  background: #c9a227;
}
#saveState[data-st="local"]::before {
  background: #b3261e;
}
@media (max-width: 1100px) {
  #saveState {
    display: none;
  }
}

/* menú de proyectos */

.projects[hidden] {
  display: none;
}

.projects .where code {
  font: 11px var(--mono);
  background: #f5f5f5;
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--ink);
}
.plist {
  overflow-y: auto;
  padding: 0 6px 6px;
  display: grid;
  gap: 2px;
  align-content: start;
  scrollbar-width: thin;
}

.prow:hover {
  background: #f5f5f5;
}
.prow.on {
  background: #f0f0f0;
}

.pthumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pthumb .sw {
  display: flex;
  width: 100%;
  height: 100%;
}
.pthumb .sw i {
  flex: 1;
}
.pthumb .initial {
  font:
    500 20px "Newsreader",
    Georgia,
    serif;
  color: #b9b9b4;
}
.pinfo {
  display: grid;
  min-width: 0;
}

.pnew {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--line);
}
.pnew input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
  outline: none;
  font-size: 13px;
}
.pnew input:focus {
  border-color: var(--accent);
  background: var(--surface);
}

/* documento: se lee como página y se escribe dentro de la misma caja */

.doc .dtitle::placeholder {
  color: #a3a3a3;
}
.doc .md {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  font-size: calc(16px * var(--doc-escala, 1));
  line-height: 1.6;
  color: #262626;
  -webkit-mask-image: linear-gradient(#000 80%, transparent);
  mask-image: linear-gradient(#000 80%, transparent);
}
.doc .md p,
.doc .md ul,
.doc .md ol,
.doc .deditor p,
.doc .deditor ul,
.doc .deditor ol {
  margin: 0 0 10px;
}

.doc .md .empty {
  color: #a3a3a3;
  font-style: italic;
}
.doc .dtext,
.doc .deditor {
  display: none;
  flex: 1;
  min-height: 0;
  width: 100%;
  padding: 0;
  border: 0;
  outline: none;
  resize: none;
  background: none;
  font:
    calc(16px * var(--doc-escala, 1)) / 1.6 "Newsreader",
    Georgia,
    serif;
  color: #262626;
  overflow-y: auto;
  scrollbar-width: thin;
}
.doc .dtext::placeholder {
  color: #a3a3a3;
}
.doc .words {
  position: absolute;
  left: 24px;
  bottom: 9px;
  font: 10.5px var(--mono);
  color: #a3a3a3;
  opacity: 0;
  transition: opacity 0.15s;
}
.doc.sel .words,
.doc.editing .words {
  opacity: 1;
}
.doc.editing .md {
  display: none;
}
.doc-actions {
  position: absolute;
  right: 12px;
  bottom: 6px;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
}
.marco-top #editDocBtn {
  width: auto;
  padding: 0 8px;
}
.doc:hover .doc-actions,
.doc.sel .doc-actions,
.doc:focus-within .doc-actions {
  opacity: 1;
  pointer-events: auto;
}
.doc.editing .doc-actions {
  display: none;
}
.doc.editing .dtitle {
  pointer-events: auto;
  cursor: text;
}
.doc-actions button {
  border: 1px solid currentColor;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: 11px var(--ui);
  min-height: 24px;
  padding: 2px 6px;
}
.doc-actions button:hover {
  background: color-mix(in srgb, currentColor 10%, transparent);
}
.doc .deditor {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  cursor: text;
}
.doc .deditor h1 {
  font-size: 2em;
}
.doc .deditor h2 {
  font-size: 1.5em;
}
.doc .deditor h3 {
  font-size: 1.25em;
}
.doc .md h4[data-level="1"],
.doc .deditor h4[data-level="1"] {
  font-size: 2em;
}
.doc .md h4[data-level="2"],
.doc .deditor h4[data-level="2"] {
  font-size: 1.5em;
}
.doc .md h4[data-level="3"],
.doc .deditor h4[data-level="3"] {
  font-size: 1.25em;
}
.doc .deditor:focus-visible,
.doc-actions :focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* Editor de documentos: el Document Editor de editorcn en HTML/CSS a mano (medidas de investigacion/editor/medidas-editorcn.json).
   Cabecera 48 · barra flotante pegajosa · hoja de 768 · pie 36. Claro y oscuro; con paleta Sanzo Wada usa los colores del documento. */
.doc.editing,
.doc.compact.editing {
  --ed-papel: var(--doc-bg, #fff);
  --ed-texto: var(--doc-ink, #171717);
  --ed-gris: color-mix(in srgb, var(--ed-papel) 97%, #000);
  --ed-borde: color-mix(in srgb, var(--ed-texto) 14%, transparent);
  --ed-suave: color-mix(in srgb, var(--ed-texto) 58%, transparent);
  --ed-activo: color-mix(in srgb, var(--ed-texto) 8%, transparent);
  padding: 0;
  border: 1px solid var(--ed-borde);
  border-radius: 14px;
  background: var(--ed-papel);
  color: var(--ed-texto);
  box-shadow:
    0 1px 3px #0000001a,
    0 1px 2px -1px #0000001a;
  outline: 0;
  cursor: default;
}
:root[data-theme="dark"] .doc.editing:not(.con-paleta) {
  --ed-papel: #0a0a0a;
  --ed-texto: #fafafa;
  --ed-gris: #1a1a1a;
  --ed-borde: #ffffff1a;
  --ed-suave: #a1a1a1;
  --ed-activo: #262626;
}
.doc .ed-cab {
  display: contents;
}
.doc:not(.editing) .ed-ruta,
.doc:not(.editing) .ed-acc,
.doc:not(.editing) .ed-scroll,
.doc:not(.editing) .ed-pie {
  display: none;
}
.doc.editing .ed-cab {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  height: 48px;
  padding: 0 12px;
  border-bottom: 1px solid var(--ed-borde);
  border-radius: 13px 13px 0 0;
  background: var(--ed-papel);
  color: var(--ed-suave);
  font: 14px/20px var(--ui);
}
.doc .ed-ruta,
.doc .ed-acc,
.doc .ed-guardado {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  white-space: nowrap;
}
.doc .ed-ruta svg {
  width: 20px;
  height: 20px;
}
.doc .ed-guardado {
  gap: 6px;
  margin-right: 4px;
  font: 12px var(--ui);
}
.doc .ed-guardado i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22a06b;
}
.doc .ed-guardado em {
  font-style: normal;
}
.doc .ed-acc button {
  height: 28px;
  min-height: 0;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ed-suave);
  font: 500 12px var(--ui);
}
.doc .ed-acc button:hover,
.doc .ed-acc button:focus-visible {
  background: var(--ed-activo);
  color: var(--ed-texto);
}
.doc .ed-acc [data-doc-done] {
  color: var(--ed-texto);
}
.doc.editing .ed-cab .dtitle {
  flex: 1;
  min-width: 0;
  height: 28px;
  margin: 0;
  padding: 0 6px;
  border-radius: 6px;
  font: 14px/20px var(--ui);
  letter-spacing: 0;
  color: var(--ed-texto);
}
.doc.editing .ed-cab .dtitle:focus {
  background: var(--ed-activo);
}
.doc.editing .ed-scroll {
  display: block;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  background: var(--ed-gris);
  color: var(--ed-texto);
}
.doc.editing .ed-pie {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  height: 36px;
  padding: 0 12px;
  border-top: 1px solid var(--ed-borde);
  border-radius: 0 0 13px 13px;
  background: var(--ed-papel);
  color: var(--ed-suave);
  font: 12px var(--ui);
  font-variant-numeric: tabular-nums;
}
.doc.editing .words {
  display: none;
}
/* barra de formato: una sola píldora flotante pegajosa */
.doc-format {
  display: none;
}
.doc .ed-barra {
  position: sticky;
  top: 12px;
  z-index: 3;
  width: fit-content;
  max-width: calc(100% - 24px);
  margin: 12px auto 4px;
}
.doc.editing .doc-format {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  border: 1px solid var(--ed-borde);
  border-radius: 14px;
  background: var(--ed-papel);
  color: var(--ed-texto);
  box-shadow: 0 1px 3px #00000014;
  font: 500 12px var(--ui);
}
.doc-format .g {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
}
.doc-format .g + .g {
  padding-left: 6px;
  border-left: 1px solid var(--ed-borde);
}
.doc-format button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 32px;
  height: 32px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: inherit;
  font: 500 12px var(--ui);
  opacity: 0.85;
}
.doc-format button:hover,
.doc-format button[aria-pressed="true"],
.doc-format button[aria-expanded="true"] {
  background: var(--ed-activo);
  opacity: 1;
}
.doc-format button:disabled,
.doc-format select:disabled,
.doc-format input:disabled {
  opacity: 0.4;
}
.doc-format button.ed-ins {
  width: auto;
  padding: 0 6px;
}
.doc-format svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.doc-format .ed-ins svg:last-child,
.doc-format .ed-sel svg {
  width: 14px;
  height: 14px;
}
.doc-format .ed-sel {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.doc-format .ed-sel svg {
  position: absolute;
  right: 6px;
  pointer-events: none;
  opacity: 0.6;
}
.doc-format select {
  width: 88px;
  height: 32px;
  min-height: 0;
  padding: 0 22px 0 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: inherit;
  font: 500 12px var(--ui);
  text-overflow: ellipsis;
  -webkit-appearance: none;
  appearance: none;
}
.doc-format .ed-fuente select {
  width: 96px;
}
.doc-format select:hover {
  background: var(--ed-activo);
}
.doc-format .ed-tam {
  display: inline-flex;
  align-items: center;
  height: 28px;
  margin: 0 2px;
  border: 1px solid var(--ed-borde);
  border-radius: 8px;
}
.doc-format .ed-tam button {
  width: 24px;
  height: 26px;
  border-radius: 7px;
  font-size: 14px;
}
.doc-format input.doc-font-size {
  width: 40px;
  height: 26px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: 500 12px var(--ui);
  font-variant-numeric: tabular-nums;
  text-align: center;
  -moz-appearance: textfield;
}
.doc-format input.doc-font-size::-webkit-inner-spin-button {
  -webkit-appearance: none;
}
.doc .ed-pop {
  color: var(--ed-texto);
  font: 12px var(--ui);
  position: absolute;
  top: calc(100% + 6px);
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 236px;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--ed-borde);
  border-radius: 10px;
  background: var(--ed-papel);
  box-shadow: 0 8px 24px #0000002e;
}
.doc .ed-pop[hidden] {
  display: none;
}
.doc .ed-pop button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  height: 30px;
  min-height: 0;
  padding: 0 8px;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: inherit;
  font: 500 12px var(--ui);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.doc .ed-pop button:hover {
  background: var(--ed-activo);
}
.doc .ed-pop svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  width: 16px;
  height: 16px;
}
.doc .ed-pop input[type="url"] {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--ed-borde);
  border-radius: 8px;
  background: none;
  color: inherit;
  font: 12px var(--ui);
}
.doc .ed-pop .ed-fila {
  display: flex;
  gap: 4px;
}
.doc .ed-pop .ed-fila button {
  justify-content: center;
}
.doc .ed-pop .ed-aviso {
  margin: 4px 2px;
  color: var(--ed-suave);
  font-size: 12px;
  white-space: normal;
}
.doc-format :focus-visible,
.doc .ed-acc :focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -2px;
}
/* piezas angostas: la cabecera y el pie se resumen y la barra se desplaza de lado */
.doc.editing {
  container: documento / inline-size;
}
@container documento (max-width: 560px) {
  .doc .ed-ruta > span,
  .doc .ed-guardado em,
  .doc.editing .ed-pie [data-pie="c"] {
    display: none;
  }
}
/* la hoja: 768 máx., relleno 48/56, borde fino, radio 10 */
.doc.editing .deditor,
.doc.editing .dtext {
  display: none;
  box-sizing: border-box;
  flex: none;
  width: auto;
  max-width: 768px;
  min-height: 240px;
  margin: 16px max(12px, calc((100% - 768px) / 2)) 24px;
  padding: clamp(24px, 7%, 48px) clamp(18px, 7%, 56px);
  border: 1px solid var(--ed-borde);
  border-radius: 10px;
  background: var(--ed-papel);
  box-shadow: 0 1px 2px #0000000d;
  color: var(--ed-texto);
  font-size: calc(16px * var(--doc-escala, 1));
  line-height: 1.75;
  overflow: visible;
}
.doc.editing .deditor {
  display: block;
}
.doc.editing.source .deditor {
  display: none;
}
.doc.editing.source .dtext {
  display: block;
  min-height: 420px;
  font: 13px/1.6 var(--mono);
  resize: none;
  overflow: auto;
}
.doc.editing .deditor:focus-visible {
  outline: 0;
}
.doc.editing .deditor p,
.doc.editing .deditor ul,
.doc.editing .deditor ol {
  margin: 0 0 12px;
}
.doc.editing .deditor ul,
.doc.editing .deditor ol {
  padding-left: 24px;
}
.doc.editing .deditor li {
  margin-top: 2px;
}
.doc.editing .deditor h1,
.doc.editing .deditor h4[data-level="1"] {
  margin: 0 0 16px;
  font: 700 calc(30px * var(--doc-escala, 1)) / 1.2 var(--doc-title-font);
  letter-spacing: -0.025em;
}
.doc.editing .deditor h2,
.doc.editing .deditor h4[data-level="2"] {
  margin: 20px 0 12px;
  font: 600 calc(20px * var(--doc-escala, 1)) / 1.5 var(--doc-title-font);
  letter-spacing: -0.025em;
}
.doc.editing .deditor h3,
.doc.editing .deditor h4[data-level="3"] {
  margin: 16px 0 8px;
  font: 600 calc(18px * var(--doc-escala, 1)) / 1.5 var(--doc-title-font);
}
.doc.editing .deditor [style*="font-size"] {
  line-height: 1.3;
}
.doc.editing .deditor mark,
.doc.editing .deditor [style*="255, 240, 166"] {
  padding: 0 2px;
  border-radius: 6px;
  background: #facc1566;
  color: inherit;
}
.doc.editing .deditor a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.doc.editing .deditor img {
  max-width: 100%;
  border-radius: 6px;
}

/* Archivo en la Biblioteca */
.chip.arch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border: 1px solid transparent;
}
.chip.arch:hover {
  border-color: var(--line);
  background: #fafafa;
}
.athumb {
  width: 56px;
  height: 44px;
  flex: none;
  border-radius: 5px;
  overflow: hidden;
  background: #f0f0f0;
}
.athumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.ainfo {
  display: grid;
  min-width: 0;
  flex: 1;
}
.ainfo b {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ainfo small {
  font-size: 11.5px;
  color: var(--soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip.arch .more {
  font: 10px var(--mono);
  color: var(--soft);
  white-space: nowrap;
}
.aimgs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 0 6px 8px 72px;
}
.chip.aimg {
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 4px;
  outline: 1px solid #0000000d;
  outline-offset: -1px;
}
.chip.aimg:hover {
  box-shadow: 0 0 0 2px var(--accent);
}
.chip.aimg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.drawer .tabs button {
  padding: 0 6px;
}
/* una ficha de Archivo en el lienzo */
.ref.archref {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 0 14px;
}
.ref.archref img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
  pointer-events: none;
  flex: none;
}
.ref.archref .k,
.ref.archref b,
.ref.archref p,
.ref.archref a {
  margin: 0 14px;
}
.ref.archref b {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
}
.ref.archref p {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.5;
  color: #525252;
  -webkit-mask-image: linear-gradient(#000 70%, transparent);
  mask-image: linear-gradient(#000 70%, transparent);
}
.ref.archref a {
  font-size: 12.5px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

/* qué agente trabaja */

.ask .agent-pick:focus {
  outline: none;
  border-color: var(--accent);
}

/* web: una página dentro del lienzo */
.web {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px #0000001a,
    0 14px 36px -16px #00000040;
}
.wbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 10px 0 16px;
  background: #f6f6f4;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  cursor: move;
}
.wbar b {
  flex: 1 1 120px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.wbar span {
  font: 12px var(--mono);
  color: var(--soft);
  white-space: nowrap;
  margin-right: auto;
}
.wbody {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #fff;
}
.wbody iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
}
.web.sel .wbody iframe {
  pointer-events: auto;
}
body.dragging .web .wbody iframe,
.viewport.panning .web .wbody iframe {
  pointer-events: none;
}
.wbody img {
  width: 100%;
  display: block;
  pointer-events: none;
}
.wwait {
  margin: 0;
  padding: 40px;
  color: var(--soft);
  font-size: 16px;
}
.webpanel {
  top: calc(var(--top) + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 32px));
  padding: 0 14px 14px;
  display: grid;
  gap: 10px;
  z-index: 30;
}
.webpanel[hidden] {
  display: none;
}
.webpanel .drawer-head {
  padding: 12px 0 0;
}
.webpanel form {
  display: flex;
  gap: 6px;
}
.webpanel input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
  outline: none;
  font-size: 14px;
}
.webpanel input:focus {
  border-color: var(--accent);
  background: var(--surface);
}
.webpanel form button {
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 99px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
/* Post de X: progreso o error con la alternativa de pegar el texto */
.webpanel .post-status {
  margin: 10px 2px 0;
  color: var(--soft);
  font-size: 12.5px;
  line-height: 1.45;
}
.webpanel .post-status[role="alert"] {
  color: var(--ink);
}
.webpanel .post-paste {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}
.webpanel .post-paste[hidden],
.webpanel .post-status[hidden] {
  display: none;
}
.webpanel .post-paste textarea {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  font: 13px/1.5 var(--ui);
  resize: vertical;
}
.webpanel .post-paste button {
  justify-self: start;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface);
  color: var(--ink);
}
.wtabs {
  display: grid;
  gap: 2px;
  max-height: 40vh;
  overflow-y: auto;
}
.wtabs .k {
  font: 500 10.5px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--soft);
  padding: 4px 8px;
}
.wtab {
  display: grid;
  text-align: left;
  padding: 7px 8px;
  border: 0;
  border-radius: 7px;
  background: none;
  font: inherit;
  color: inherit;
}
.wtab:hover {
  background: var(--hover);
}
.wtab b {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wtab small {
  font: 11px var(--mono);
  color: var(--soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- columna de herramientas (como el menú lateral de Craft) ---------- */

.toolbar > button svg,
.toolbar .capsula svg {
  width: 18px;
  height: 18px;
}
.toolbar .lib-btn {
  font-size: 13.5px;
  font-weight: 500;
  padding: 0;
}
/* etiqueta con keycap al pasar el mouse o al llegar con el teclado (la dibuja canvas-taller.js desde data-tip y data-key) */
.tip {
  position: fixed;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 4px 8px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--on-accent);
  font: 500 12px/1.4 var(--ui);
  white-space: nowrap;
  pointer-events: none;
}
.tip[hidden] {
  display: none;
}
.tip:not(:has(kbd)) {
  padding-right: 8px;
}
.tip kbd {
  padding: 0 5px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--on-accent) 22%, transparent);
  font: 11px/16px var(--mono);
}

/* ---------- arriba: menú, proyecto y receta ---------- */
.menu summary {
  position: relative;
  width: 32px;
  height: 32px;
  color: var(--soft);
}
.ptitle b {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.recipe {
  top: 16px;
  right: 16px;
  border: 0;
  color: var(--on-accent);
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--ink);
  font-weight: 500;
  font-size: 13px;
}
.recipe:hover {
  background: var(--ink);
}

/* ---------- lienzo ---------- */
.item.sel {
  outline: 1.5px solid var(--ink);
  outline-offset: 4px;
}
.frame {
  z-index: 0;
}
.item:not(.frame) {
  z-index: 1;
}
.item.sel:not(.frame) {
  z-index: 2;
}
/* varias piezas se mueven juntas; sus iframes no se quedan con el clic */
body.multi-select .item iframe,
body.shift-select .item iframe {
  pointer-events: none;
}
body.multi-select .item .handle {
  display: none;
}
.edit-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 4px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}
.edit-actions > button,
.edit-actions .grupo-b > button,
.edit-actions .mas-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.edit-actions button:hover:not(:disabled) {
  background: var(--hover);
}
/* las acciones de la selección aparecen al seleccionar algo */
.edit-actions[hidden],
.edit-actions .sel-only:disabled {
  display: none;
}
.edit-actions button:disabled {
  opacity: 0.3;
  cursor: default;
}
.edit-actions svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#selectionCount {
  font: 11px var(--ui);
  color: var(--soft);
  padding: 0 6px;
}
#selectionCount:empty {
  display: none;
}
.handle {
  position: absolute;
  right: -9px;
  bottom: -9px;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 2px solid var(--accent);
  cursor: nwse-resize;
  display: none;
  border-width: 1.5px;
  border-radius: 4px;
}
.note .handle,
.link .handle,
.ref .handle,
.web .handle {
  right: 2px;
  bottom: 2px;
}
.frame .title {
  position: absolute;
  left: 0;
  bottom: 100%;
  padding-bottom: 8px;
  white-space: nowrap;
  cursor: move;
  font: 500 14px/1.3 var(--ui);
  color: var(--soft);
}
.frame.sel .title {
  color: var(--ink);
}
.inspector {
  left: calc(var(--rail) + 8px);
}

/* ---------- panel derecho: conversación y detalles (Bakers): cabecera pequeña, estado, filas y compositor al pie ---------- */
.agent {
  position: fixed;
  top: calc(var(--visible-top) + var(--m) + 8px);
  right: calc(var(--visible-right) + var(--m) + 8px);
  bottom: calc(var(--visible-bottom) + var(--m) + var(--bottom));
  /* por encima del lienzo y de los paneles flotantes que abre el riel */
  z-index: 32;
  width: var(--pw);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bk-panel);
  border: 1px solid var(--bk-line2);
  border-radius: 10px;
  color: var(--ink);
  font: 12.5px/1.5 var(--ui);
}
.agent[hidden] {
  display: none;
}
body.panel-izq .agent {
  right: auto;
  left: calc(var(--visible-left) + var(--m) + var(--rail));
}
/* Flotante: cambia la posición, conserva el material del panel anclado. */
body.panel-flota .agent {
  top: calc(var(--visible-top) + var(--m) + var(--top) + 16px);
  right: calc(var(--visible-right) + var(--m) + 16px);
  bottom: calc(var(--visible-bottom) + var(--m) + var(--bottom) + 12px);
  box-shadow: 0 16px 40px #00000040;
}
body.panel-flota .agent[style*="left"] {
  right: auto;
  bottom: auto;
}
body.panel-flota .panel-cab {
  cursor: move;
}
body.panel-hoja .agent {
  top: auto;
  left: calc(var(--visible-left) + 8px);
  right: calc(var(--visible-right) + 8px);
  bottom: calc(var(--visible-bottom) + var(--bottom) + 6px);
  width: auto;
  height: min(calc(var(--visible-height) * 0.62), 520px);
  box-shadow: 0 -12px 40px #00000040;
}
.panel-cab {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  flex: none;
  padding: 0 6px 0 12px;
  color: var(--soft);
}
.panel-cab .panel-icono {
  flex: none;
  width: 15px;
  height: 15px;
}
.panel-vistas {
  margin-right: auto;
}
.agent .panel-vistas button {
  min-width: 0;
  height: 26px;
  padding: 0 10px;
  color: var(--soft);
}
.agent .panel-vistas button[aria-selected="true"] {
  background: none;
  color: var(--ink);
}
.agent .panel-vistas button:hover:not([aria-selected="true"]) {
  background: none;
  color: var(--ink);
}
.panel-vistas .punto {
  display: none;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--bk-acento);
}
.panel-vistas .aviso .punto {
  display: block;
}
.panel-estado {
  flex: none;
  margin: 0 14px;
  padding: 2px 0 10px;
  border-bottom: 1px solid var(--bk-line);
}
.panel-estado:empty {
  display: none;
}
.panel-vista {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.panel-vista[hidden] {
  display: none;
}
.panel-filas {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  align-items: center;
  gap: 4px 8px;
  flex: none;
  margin: 0 14px;
  padding: 8px 0 10px;
  border-bottom: 1px solid var(--bk-line);
}
.fila-nombre {
  color: var(--faint);
  font-size: 12px;
}
.fila-valor {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  min-width: 0;
}
.ask-ctx {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  color: var(--ink);
  font: 12px var(--ui);
  white-space: nowrap;
}
.ask-ctx span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent .ask-senales {
  display: inline-flex;
  min-width: 0;
  height: 24px;
  padding: 0 10px;
  border: 1px solid var(--bk-line2);
  border-radius: 99px;
  color: #e8590c;
  font: 12px var(--ui);
}
.agent .ask-senales[hidden] {
  display: none;
}
/* turnos anteriores que viajan con el pedido (decisión 9): quitados, se ven tachados y tenues */
.agent .ask-previos {
  display: inline-flex;
  min-width: 0;
  height: 24px;
  padding: 0 10px;
  border: 1px solid var(--bk-line2);
  border-radius: 99px;
  color: var(--ink);
  font: 12px var(--ui);
}
.agent .ask-previos[hidden] {
  display: none;
}
.agent .ask-previos[aria-pressed="false"] {
  color: var(--faint);
  text-decoration: line-through;
}
.ask-ctx svg {
  flex: none;
  width: 14px;
  height: 14px;
}
.chat-hilo {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
#panelDet {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 14px;
}
.panel-vacio {
  margin: 4px 0;
  color: var(--faint);
  font-size: 12px;
}
.panel-vacio[hidden] {
  display: none;
}
/* el inspector vive en Detalles: sin caja propia, sigue el ritmo del panel */
.agent .inspector {
  position: static;
  width: auto;
  max-height: none;
  padding: 0;
  background: none;
  box-shadow: none;
  font-size: 12.5px;
}
/* El menú nativo del Mac puede seguir blanco en oscuro: sus opciones usan siempre tinta sobre papel. */
.ask-agente select,
.ask-sel select,
.agent-options select {
  color-scheme: light;
}
.ask-agente option,
.ask-sel option,
.agent-options option,
.agent-options optgroup {
  color: #171717;
  background: #fff;
}

/* agente, modelo y esfuerzo: selectores nativos con forma de etiqueta */
.ask-agente,
.ask-sel {
  position: relative;
  flex: none;
  min-width: 0;
}
.ask-agente::after,
.ask-sel::after {
  content: "";
  position: absolute;
  right: 8px;
  top: 50%;
  width: 4px;
  height: 4px;
  border: solid var(--soft);
  border-width: 0 1.25px 1.25px 0;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.ask-agente select,
.ask-sel select {
  -webkit-appearance: none;
  appearance: none;
  height: 28px;
  max-width: 150px;
  padding: 0 20px 0 7px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font: 12px var(--ui);
  text-overflow: ellipsis;
  cursor: pointer;
}
.ask-agente select:hover,
.ask-sel select:hover:not(:disabled) {
  background: var(--tinte);
}
.ask-sel select:focus-visible,
.ic-mini:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 0;
}
.ask-sel select:disabled {
  color: var(--soft);
  cursor: default;
}
.agent button {
  display: grid;
  place-items: center;
  flex: none;
  min-width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--soft);
}
.agent button:hover:not(:disabled) {
  background: var(--bk-sel);
  color: var(--ink);
}
.agent button svg {
  width: 15px;
  height: 15px;
}
.agent .reply {
  flex: 0 1 auto;
  max-height: none;
  margin: 0;
  padding: 10px 14px;
  border-top: 1px solid var(--bk-line);
  border-bottom: 0;
  overflow: auto;
  overscroll-behavior: contain;
  font-size: 12.5px;
}
/* compositor compacto al pie, como el de Bakers: campo, chips y flecha */
.agent .ask {
  display: flex;
  flex-direction: column;
  flex: none;
  margin: 8px 10px 10px;
  border: 1px solid var(--bk-line2);
  border-radius: 10px;
  background: var(--bk-compo);
}
.agent .ask:focus-within {
  border-color: color-mix(in srgb, var(--soft) 55%, var(--bk-line2));
}
#askInput {
  min-height: 40px;
  resize: none;
  padding: 10px 12px 4px;
  border: 0;
  outline: none;
  background: none;
  color: var(--ink);
  font: 13px/1.5 var(--ui);
  overflow-y: hidden;
}
#askInput::placeholder {
  color: var(--faint);
}
.ask-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 2px 6px 6px;
}
/* agente · modelo · esfuerzo: tres <select> nativos con piel de disparador de texto, agrupados y sin caja */
.ask-disparadores {
  display: flex;
  align-items: center;
  min-width: 0;
  margin: 0 2px;
  padding-left: 4px;
  border-left: 1px solid var(--bk-line2);
}
.ask-disparadores .ask-sel + .ask-sel {
  margin-left: 6px;
}
.ask-disparadores .ask-sel + .ask-sel::before {
  content: "·";
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-55%);
  color: var(--soft);
}
.agent .ic-mini {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--soft);
}
.agent .ic-mini svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.agent .ic-mini:hover:not(:disabled) {
  background: var(--tinte);
  color: var(--ink);
}
.agent .ic-mini:disabled {
  opacity: 0.4;
}
.agent .ic-mini[aria-pressed="true"],
.agent .ic-mini[aria-expanded="true"] {
  background: var(--tinte-on);
  box-shadow: var(--luz-borde);
  color: #e8590c;
}
.agent .ic-mini[aria-expanded="true"] {
  color: var(--ink);
}
.agent .chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--bk-line2);
  border-radius: 7px;
  background: var(--bk-chip);
  color: var(--ink);
  font: 11.5px var(--ui);
}
.agent .chip svg {
  width: 13px;
  height: 13px;
}
.agent .chip[aria-pressed="true"] {
  border-color: #e8590c;
  color: #e8590c;
}
.ask .ask-enviar {
  margin-left: auto;
  min-width: 0;
  width: 28px;
  height: 28px;
  border: 1px solid var(--bk-line2);
  border-radius: 8px;
  background: none;
  color: var(--soft);
}
.ask .ask-enviar:hover:not(:disabled) {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}
/* la única acción con relleno del compositor */
.agent .ask .ask-enviar.lleno {
  border-color: transparent;
  background: var(--ink);
  color: var(--surface);
}
.agent .ask .ask-enviar.lleno:hover:not(:disabled) {
  background: var(--ink);
  opacity: 0.86;
}
.agent .ask .ask-enviar:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.ask .ask-enviar svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#askAgent {
  max-width: 96px;
}
.ask-sel #askModel {
  max-width: 116px;
}
.ask-sel #askEffort {
  max-width: 76px;
}
/* ancho del panel: una raya en su borde que se arrastra o se mueve con las flechas */
.agent .panel-asa {
  position: absolute;
  left: -5px;
  top: 14px;
  bottom: 14px;
  width: 9px;
  min-width: 0;
  height: auto;
  border-radius: 0;
  cursor: ew-resize;
}
.agent .panel-asa::after {
  content: "";
  position: absolute;
  left: 3.5px;
  top: calc(50% - 16px);
  width: 2px;
  height: 32px;
  border-radius: 2px;
  background: var(--bk-line2);
}
.agent .panel-asa:hover,
.agent .panel-asa:focus-visible {
  background: none;
}
.agent .panel-asa:hover::after,
.agent .panel-asa:focus-visible::after {
  background: var(--bk-acento);
}
body.panel-izq .agent .panel-asa {
  left: auto;
  right: -5px;
}
body.panel-hoja .agent .panel-asa {
  display: none;
}
.panel-menu {
  position: absolute;
  top: 38px;
  right: 6px;
  z-index: 70;
  display: grid;
  min-width: 220px;
  padding: 6px;
  border-radius: 10px;
}
.panel-menu[hidden] {
  display: none;
}
.agent .panel-menu button {
  display: flex;
  justify-content: space-between;
  width: 100%;
  height: 30px;
  padding: 0 10px;
  color: var(--ink);
  font: 12.5px var(--ui);
  text-align: left;
}
.agent .panel-menu button[aria-checked="true"]::after {
  content: "✓";
  color: var(--soft);
}
.panel-menu hr {
  width: 100%;
  margin: 4px 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.tool-menu kbd,
.panel-menu kbd,
.zoom-menu kbd,
.mas-menu kbd {
  min-width: 18px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--tinte);
  box-shadow: var(--luz-borde);
  text-align: center;
}
.panel-menu kbd,
.zoom-menu kbd {
  color: var(--soft);
  font: 11px var(--mono);
}
/* minimizado: una pastilla abajo a la derecha; el punto avisa de actividad o respuesta */
.agent-pill {
  position: fixed;
  right: calc(var(--visible-right) + var(--m) + 16px);
  bottom: calc(var(--visible-bottom) + var(--m) + var(--bottom) + 10px);
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--bk-line2);
  border-radius: 99px;
  background: var(--bk-panel-solido);
  color: var(--ink);
  font: 12px var(--ui);
  box-shadow: 0 6px 20px #00000026;
}
.agent-pill svg {
  width: 14px;
  height: 14px;
}
.agent-pill[hidden] {
  display: none;
}
.agent-pill:hover {
  background: var(--hover);
}
.agent-pill .punto {
  display: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bk-acento);
}
.agent-pill.aviso .punto {
  display: block;
}

/* paneles: textos y botones en el tono de Craft */
.drawer-head b,
.projects .drawer-head b {
  font-weight: 600;
  font-size: 13.5px;
}
.chip.comp:hover,
.chip.aimg:hover,
.chip.wada:hover,
.chip.estilo:hover,
.chip.pat:hover {
  box-shadow: 0 0 0 1.5px var(--ink);
}
.tabs button[aria-selected="true"] {
  color: var(--ink);
  background: #f0f0f0;
}

/* angosto (el panel de navegador de Codex): la barra del chat ocupa el ancho de abajo */
@media (max-width: 900px) {
  .recipe {
    padding: 0 12px;
  }
  .inspector,
  .drawer,
  .gusto {
    top: calc(var(--top) + 8px);
  }
}

/* Taller ajustable: el tema de la interfaz no altera el contenido del proyecto. */

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #ededeb;
  --soft: #a7a7a2;
  --faint: #777772;
  --line: #393936;
  --canvas: #191a19;
  --surface: #252624;
  --hover: #343531;
  --field: #1e1f1d;
  --dot: #343530;
  --accent: #ededeb;
  --on-accent: #171717;
  --focus: #d8d9d4;
  --float-shadow: 0 0 0 1px #ffffff12, 0 8px 30px #00000035;
}
button[hidden],
aside[hidden],
input[hidden] {
  display: none !important;
}
.float,
.menu-list,
.ctx,
.projects,
.drawer,
.inspector,
.gusto,
.code-panel {
  background: var(--surface);
}

.menu-list {
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  width: 248px;
}
.menu-list label:not(.file) {
  display: flex;
  justify-content: space-between;
  padding: 8px 10px;
  font-size: 13px;
}
.menu-list select {
  max-width: 130px;
  border: 0;
  padding: 3px;
  border-radius: 4px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
}
.menu-list button:hover,
.menu-list a:hover,
.toolbar > button:hover,
.toolbar .capsula > button:hover,
.drawer-head button:hover,
.tabs button[aria-selected="true"],
.edit-actions button:hover:not(:disabled),
.ctx button:hover {
  background: var(--hover);
}
/* Barra lateral pegada al borde: herramientas arriba, ajustes abajo; plegada, el lienzo ocupa su franja. */
/* Barra lateral pegada al borde: herramientas arriba, ajustes abajo; plegada, el lienzo ocupa su franja. */
.toolbar {
  position: fixed;
  inset: calc(var(--visible-top) + var(--m)) auto calc(var(--visible-bottom) + var(--m) + var(--bottom))
    calc(var(--visible-left) + var(--m));
  z-index: 25;
  width: var(--rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 0 6px;
  background: none;
}
.toolbar .rail-marca {
  width: 32px;
  height: 32px;
  margin-bottom: 14px;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
}
.toolbar .rail-marca svg {
  width: 26px;
  height: 22px;
  fill: currentColor;
  stroke: none;
}
.toolbar .rail-marca:hover {
  background: var(--hover);
}
.rail-hueco {
  flex: 1;
}
.toolbar .rail-taller i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
}
.rail-taller[data-estado="local"] i,
.rail-taller[data-estado="puente"] i {
  background: var(--bk-ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bk-ok) 18%, transparent);
}
.rail-taller[data-estado="apagado"] i {
  background: var(--bk-warn);
}
body.rail-plegada .toolbar {
  display: none;
}
.toolbar > button,
.toolbar .capsula > button {
  position: relative;
  border: 0;
  background: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-width: 0;
  padding: 0;
  border-radius: 8px;
  color: var(--soft);
  font-size: 16px;
}
/* Más herramientas: lista con nombre y atajo junto a la barra; una herramienta activa adentro se señala en Más. */
.tool-menu {
  position: fixed;
  z-index: 66;
  display: grid;
  min-width: min(228px, calc(100vw - var(--visible-left) - var(--visible-right) - 16px));
  max-width: calc(100vw - var(--visible-left) - var(--visible-right) - 16px);
  max-height: calc(var(--visible-height) - 16px);
  overflow-y: auto;
  padding: 6px;
  border-radius: 10px;
}
.tool-menu[hidden] {
  display: none;
}
.tool-menu button {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  justify-items: start;
  gap: 10px;
  border: 0;
  border-radius: 7px;
  padding: 7px 10px;
  background: none;
  color: var(--ink);
  font: 13px var(--ui);
  text-align: left;
}
.tool-menu button:hover,
.tool-menu button[aria-pressed="true"],
.tool-menu button[aria-expanded="true"] {
  background: var(--hover);
}
.tool-menu svg {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--soft);
}
.tool-menu kbd {
  color: var(--soft);
  font: 11px/18px var(--mono);
}
.tool-menu .tool-group {
  margin: 8px 10px 2px;
  color: var(--soft);
  font: 11px var(--ui);
}
.tool-menu .tool-group:first-child {
  margin-top: 2px;
}
/* familia B: el riel es una cápsula; lo activo es un cuadrado tintado con luz de borde, sin depender del color */
.capsula {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  border: 1px solid var(--bk-line2);
  background: var(--bk-chip);
  box-shadow: inset 0 1px 0 var(--tinte);
}
.sep-r {
  width: 18px;
  height: 1px;
  margin: 3px 0;
  background: var(--bk-line2);
}
.toolbar .capsula > button[aria-expanded="true"],
.toolbar .capsula > button.activo,
.toolbar .capsula > button[aria-pressed="true"],
.toolbar .menu[open] > summary {
  color: var(--ink);
  background: var(--tinte-on);
  box-shadow: var(--luz-borde);
}
.toolbar :is(button, summary):focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}
.drawer {
  resize: horizontal;
  min-width: 300px;
  max-width: calc(100vw - 100px);
}
.inspector {
  z-index: 30;
}
.filter input,
.pnew input,
.webpanel input,
.gusto textarea {
  background: var(--field);
  color: var(--ink);
  border-color: var(--line);
}
.filter input::placeholder,
.pnew input::placeholder,
.webpanel input::placeholder,
.gusto textarea::placeholder {
  color: var(--soft);
  opacity: 1;
}
.webpanel select {
  min-width: 0;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
}
.webpanel .wtab {
  background: transparent;
  color: var(--ink);
}
.webpanel .wtab:hover,
.webpanel .wtab:focus-visible {
  background: var(--hover);
}
.inspector button.mode,
.inspector .vary button,
.reply .acts button {
  background: var(--surface);
  color: var(--ink);
}

.agent-pick {
  color: var(--ink);
  background: var(--surface);
}
.note {
  padding: 14px 16px;
  box-shadow: 0 1px 2px #0000001a;
  font: 16px/1.45 var(--ui);
  white-space: pre-wrap;
  overflow: hidden;
  cursor: move;
  border-radius: 6px;
  font-size: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
}
.doc,
.link,
.ref {
  background: var(--surface);
  color: var(--ink);
}
.dtext,
.dtitle {
  color: var(--ink);
}
.workspace-exit {
  display: flex;
  gap: 4px;
}
.workspace-exit:not(:has(button:not([hidden]))) {
  display: none;
}
.workspace-exit button {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font: 12px var(--ui);
}
.workspace-exit button:hover {
  background: var(--hover);
}
/* Vista en la esquina del marco: zoom, ver todo, encuadrar y enfocar */
/* Barra de estado: el uso del agente elegido siempre a la vista; zoom, Ver todo, Encuadrar y Enfocar a la derecha */
.marco-estado {
  position: fixed;
  left: calc(var(--visible-left) + var(--m));
  right: calc(var(--visible-right) + var(--m));
  bottom: calc(var(--visible-bottom) + var(--m));
  height: var(--bottom);
  z-index: 24;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 0 10px;
  background: none;
  color: var(--soft);
  font: 11.5px var(--ui);
}
.estado-punto {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
}
.estado-agente {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 22px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--soft);
  font: 11.5px var(--ui);
  white-space: nowrap;
  overflow: hidden;
}
.estado-agente:hover {
  background: var(--hover);
  color: var(--ink);
}
.estado-nombre {
  color: var(--ink);
}
.estado-uso {
  display: flex;
  gap: 14px;
}
.estado-ventana {
  display: flex;
  align-items: center;
  gap: 6px;
}
.estado-ventana i {
  width: 34px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--soft) var(--p), var(--line) var(--p));
}
.estado-ventana.alto i {
  background: linear-gradient(90deg, #b7791f var(--p), var(--line) var(--p));
}
.estado-ventana.critico i {
  background: linear-gradient(90deg, #c2410c var(--p), var(--line) var(--p));
}
.marco-vista {
  --gh: 20px;
  margin-left: auto;
}
.marco-vista button {
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 20px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ink);
  font: 12px var(--ui);
}
.marco-vista button:hover:not(:disabled) {
  background: var(--tinte);
}
.marco-vista button:disabled {
  opacity: 0.4;
  cursor: default;
}
.marco-vista svg {
  width: 14px;
  height: 14px;
}
.marco-vista .zoom-btn {
  display: flex;
  gap: 4px;
  padding: 0 6px;
}
.marco-vista .zoom-btn svg {
  width: 12px;
  height: 12px;
  color: var(--soft);
}
.marco-vista output {
  font: 11.5px var(--ui);
  font-variant-numeric: tabular-nums;
}
/* zoom y vista: el menú que abre el porcentaje */
.zoom-menu {
  display: grid;
  min-width: min(210px, calc(100vw - var(--visible-left) - var(--visible-right) - 16px));
  max-width: calc(100vw - var(--visible-left) - var(--visible-right) - 16px);
  max-height: calc(var(--visible-height) - 16px);
  overflow-y: auto;
  padding: 6px;
  z-index: 66;
}
.zoom-menu[hidden] {
  display: none;
}
.zoom-menu button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--ink);
  font: 12.5px var(--ui);
  text-align: left;
}
.zoom-menu button:hover:not(:disabled),
.zoom-menu button:focus-visible {
  background: var(--hover);
}
.zoom-menu button:disabled {
  opacity: 0.4;
  cursor: default;
}
.frame iframe,
.web .wbody iframe,
.experiment iframe {
  pointer-events: none !important;
}
.item.interacting iframe {
  pointer-events: auto !important;
}
body.multi-select .item iframe,
body.shift-select .item iframe,
body.dragging .item iframe,
.viewport.panning .item iframe {
  pointer-events: none !important;
}
.frame .title .grupo-b {
  --gh: 22px;
  margin-left: 4px;
  vertical-align: middle;
  background: var(--surface);
}
.frame .title .grupo-b > button {
  font-size: 11px;
}
.inspiration::after {
  content: "Referencia";
  position: absolute;
  top: -23px;
  right: 0;
  font: 11px var(--ui);
  color: var(--soft);
}
.experiment,
.terminal,
.attachment {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--float-shadow);
}
.block-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font: 12px var(--ui);
}
.block-bar b {
  flex: 1;
  font-weight: 500;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.file-preview button {
  border: 0;
  border-radius: 5px;
  padding: 4px 7px;
  background: var(--hover);
  color: var(--ink);
  font: 11px var(--ui);
  white-space: nowrap;
}
.experiment iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: white;
}

.terminal .block-bar {
  background: var(--surface);
}
.terminal-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font: 11px var(--ui);
}
.terminal-state {
  margin-left: auto;
  color: #9ca697;
}
.terminal-output {
  margin: 0;
  padding: 12px 16px;
  overflow: auto;
  font: 12px/1.65 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  touch-action: pan-y;
  user-select: text;
}
.terminal-form {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 8px;
  border-top: 1px solid #ffffff20;
}
.terminal-form input {
  width: 100%;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: inherit;
  font: 12px var(--mono);
}
.terminal-form button {
  background: #e4e9df;
  color: #171a18;
  border: 0;
  border-radius: 5px;
  padding: 5px 9px;
  font: 12px var(--ui);
}
.file-preview {
  overflow: auto;
  padding: 14px;
  touch-action: pan-y;
}
.file-preview iframe,
.file-preview video,
.file-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border: 0;
}
.file-preview pre {
  white-space: pre-wrap;
  font: 13px/1.6 var(--mono);
}
.file-preview table {
  width: 100%;
  border-collapse: collapse;
  font: 13px var(--ui);
}
.file-preview td {
  padding: 9px;
  border-bottom: 1px solid var(--line);
}
.code-panel {
  z-index: 70;
  top: calc(var(--top) + 8px);
  right: 8px;
  bottom: 52px;
  width: min(540px, calc(100vw - 100px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 8px;
  gap: 8px;
}
.code-panel textarea {
  resize: none;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: var(--field);
  color: var(--ink);
  font: 12px/1.6 var(--mono);
  touch-action: pan-y;
}
.code-panel > button {
  border: 0;
  background: var(--ink);
  color: var(--surface);
  border-radius: 6px;
  padding: 9px;
}
body.focus-mode .world {
  transform: none !important;
}
body.focus-mode .item:not(.focused) {
  display: none;
}
body.focus-mode .item.focused {
  position: fixed;
  left: 24px !important;
  top: 16px !important;
  width: calc(100% - 48px) !important;
  /* deja libre lo que ocupa el chat (o su pastilla) */
  height: calc(100% - var(--chat-alto, 96px) - 24px) !important;
  min-height: 0 !important;
}
body.focus-mode .item.focused.frame {
  overflow: auto;
}
body.focus-mode .inspector {
  display: none;
}
@media (max-width: 900px) {
  #selectionCount {
    display: none;
  }
  .drawer {
    top: calc(var(--top) + 8px);
    bottom: 52px;
    height: auto;
  }
}

.ask.on button[type="submit"] {
  color: var(--surface);
}
.menu .menu-list summary {
  width: auto;
  height: auto;
  padding: 8px 10px;
  display: block;
  font-size: 13px;
}

#sourceKind {
  background: var(--field);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 4px;
  font: 12px var(--ui);
}
#sourceKind[hidden] {
  display: none;
}
.preview-error {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px;
  background: #8d241f;
  color: white;
  font: 12px var(--ui);
}
.file-hint {
  color: var(--soft);
  font-size: 11px;
  line-height: 1.5;
}

@media (max-width: 900px) {
  body.focus-mode .item.focused {
  }
}

/* Texto y Biblioteca comparten las mismas fuentes y paletas. */
.doc {
  display: flex;
  flex-direction: column;
  border-radius: 6px;
  box-shadow:
    0 0 0 1px #0000000f,
    0 10px 28px -14px #00000033;
  padding: 20px 24px 30px;
  overflow: visible;
  cursor: move;
  background: var(--doc-bg, var(--surface));
  color: var(--doc-ink, var(--ink));
  font-family: var(--doc-font);
}
.doc .dtitle {
  flex: none;
  width: 100%;
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  outline: none;
  background: none;
  font:
    500 24px/1.25 "Newsreader",
    Georgia,
    serif;
  letter-spacing: -0.01em;
  pointer-events: none;
  text-overflow: ellipsis;
  font-family: var(--doc-title-font);
  color: inherit;
}
.doc .md,
.doc .dtext,
.doc .deditor {
  font-family: var(--doc-font);
  color: inherit;
}
.doc .md h4,
.doc .deditor h4 {
  margin: 12px 0 6px;
  font:
    500 calc(18px * var(--doc-escala, 1))/1.3 "Newsreader",
    Georgia,
    serif;
  font-family: var(--doc-title-font);
}
.doc.compact {
  padding: 14px 16px 25px;
}
.doc.compact .dtitle {
  font-size: 18px;
}
.doc.compact .md,
.doc.compact .dtext,
.doc.compact .deditor {
  font-size: calc(16px * var(--doc-escala, 1));
}
.doc .empty,
.doc .words,
.doc .dtext::placeholder,
.doc .dtitle::placeholder {
  color: inherit;
  opacity: 0.55;
}
.inspector select,
.filter select {
  width: 100%;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: 12px var(--ui);
}
.filter {
  padding: 6px 12px;
  display: grid;
  gap: 6px;
}
.filter .hint:empty {
  display: none;
}
.chip.comp small {
  padding: 0 2px 4px;
  color: var(--soft);
  font: 10px var(--mono);
}
.archive-origin {
  font-size: 11px;
  color: var(--soft);
  overflow-wrap: anywhere;
}
.archive-recent {
  font-size: 12px;
  margin-top: 10px;
}
.archive-recent summary {
  padding: 8px 0;
  cursor: pointer;
  color: var(--soft);
}

/* Todos los paneles tienen un agarre, sin convertir sus botones en zonas de arrastre. */
.panel-grip {
  flex: none;
  width: 18px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--soft);
  cursor: grab;
  touch-action: none;
  font: 15px var(--ui);
}
.panel-grip:hover {
  background: var(--hover);
  color: var(--ink);
}
.panel-grip:active {
  cursor: grabbing;
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 12px 4px 14px;
  gap: 6px;
}
.drawer-head .panel-grip {
  width: 18px;
  height: 24px;
  font-size: 15px;
}
.drawer-head > b {
  flex: 1;
}
.projects .drawer-head {
  gap: 2px;
  padding: 12px 14px 8px;
  display: flex;
  flex-wrap: wrap;
}
.projects .where {
  font-size: 12px;
  color: var(--soft);
  width: 100%;
}
.inspector > .panel-grip {
  justify-self: end;
  margin-bottom: -6px;
}
/* Barra superior tipo título: plegar la barra lateral, deshacer/rehacer y la pestaña del proyecto; las acciones
   de la selección y las salidas de enfoque aparecen cuando corresponden. */
.marco-top {
  position: fixed;
  top: calc(var(--visible-top) + var(--m) + 8px);
  right: calc(var(--visible-right) + var(--m) + 8px + var(--pr, 0px));
  left: calc(var(--visible-left) + var(--m) + var(--rail) + var(--pl, 0px));
  height: var(--top);
  z-index: 24;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px 0 6px;
  background: var(--canvas);
  border: 1px solid var(--bk-line);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
}
.marco-top #foldTools {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--soft);
}
.marco-top #foldTools:hover,
.marco-top #foldTools[aria-expanded="false"] {
  background: var(--hover);
  color: var(--ink);
}
.marco-top #foldTools svg {
  width: 15px;
  height: 15px;
}
.ptitle {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 4px;
  height: 28px;
  margin-right: auto;
  padding: 0 4px 0 0;
  font-size: 13px;
}
.ptitle button {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  border: 0;
  background: none;
  border-radius: 7px;
  color: var(--soft);
  font-size: 13px;
  height: 28px;
  padding: 0 6px;
}
.ptitle button b {
  font-weight: 400;
}
.ptitle button svg {
  width: 13px;
  height: 13px;
}
.marco-top .historial {
  margin-left: 6px;
}
.marco-top .historial button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--ink);
}
.marco-top .historial button:hover:not(:disabled) {
  background: var(--tinte);
}
.marco-top .historial button:disabled {
  opacity: 0.4;
  cursor: default;
  background: none;
}
.marco-top .historial svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ptitle #homeBtn {
  max-width: min(260px, 32vw);
}
#saveState {
  color: var(--soft);
  align-items: center;
  gap: 6px;
  display: flex;
  font: 10px var(--ui);
  font-size: 10px;
  white-space: nowrap;
}
.ptitle button:hover,
.ptitle button[aria-expanded="true"],
.prow:hover,
.prow.on,
.inspector .name:hover {
  background: var(--hover);
  color: var(--ink);
}
.pnew input,
.projects .where code {
  background: var(--surface);
  color: var(--ink);
}
.pnew button {
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 99px;
  font-weight: 600;
  font-size: 13px;
  background: var(--ink);
  color: var(--surface);
}
.projects {
  top: calc(var(--top) + 4px);
  left: calc(var(--rail) + 8px);
  max-height: calc(100vh - 160px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  z-index: 30;
  width: min(310px, calc(100vw - 96px));
}
.prow {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
  font: inherit;
  color: inherit;
  padding: 8px 10px;
}
.pthumb {
  flex: none;
  border-radius: 5px;
  overflow: hidden;
  background: #f0f0f0;
  display: grid;
  place-items: center;
  outline: 1px solid #0000000d;
  outline-offset: -1px;
  width: 38px;
  height: 38px;
}
.pinfo b {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
}
.pinfo small {
  color: var(--soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 10px;
}
.ask .agent-pick {
  border: 1px solid var(--line);
  border-radius: 99px;
  font: 500 12.5px var(--ui);
  cursor: pointer;
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
  -webkit-appearance: none;
  appearance: none;
  max-width: 100px;
  height: 27px;
  font-size: 11px;
  padding: 0 6px;
}
.terminal {
  background: #171a18;
  color: #e5e9e2;
  grid-template-rows: auto auto minmax(0, 1fr);
}
.terminal-screen {
  min-height: 0;
  min-width: 0;
  padding: 6px 10px 10px;
  overflow: hidden;
  cursor: text;
}
.terminal-screen .xterm {
  height: 100%;
}
.terminal-screen .xterm-viewport {
  scrollbar-width: thin;
}
@media (max-width: 900px) {
  .inspector:not([hidden]) {
    display: grid;
    max-width: calc(100vw - 96px);
  }
}
.inspector[data-kind="doc"] {
  left: auto;
  right: 8px;
}
.drawer {
  z-index: 35;
}
/* El lienzo se mueve por su vista, no por scrollIntoView al enfocar un iframe. */
.viewport {
  position: fixed;
  inset: calc(var(--visible-top) + var(--m) + 8px + var(--top))
    calc(var(--visible-right) + var(--m) + 8px + var(--pr, 0px)) calc(var(--visible-bottom) + var(--m) + var(--bottom))
    calc(var(--visible-left) + var(--m) + var(--rail) + var(--pl, 0px));
  border: 1px solid var(--bk-line);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  z-index: 0;
  outline: none;
  cursor: default;
  background-color: var(--canvas);
  background-image: radial-gradient(var(--dot) 0.7px, transparent 0.7px);
  background-size: 24px 24px;
  contain: strict;
  isolation: isolate;
  overflow: clip;
}

/* El zoom aparece a pedido desde Vista; el movimiento comunica su apertura. */
:root {
  --visible-top: 0px;
  --visible-right: 0px;
  --visible-bottom: 0px;
  --visible-left: 0px;
  --visible-height: 100vh;
  --ink: #171717;
  --soft: #737373;
  --faint: #a3a3a3;
  --line: #e5e5e5;
  --canvas: #fafafa;
  --accent: #171717;
  --on-accent: #fff;
  --float-shadow: 0 0 0 1px #0000000d, 0 1px 2px #0000000a, 0 6px 16px -6px #00000014;
  color-scheme: light;
  --surface: #fff;
  --hover: #f3f3f2;
  --field: #fafafa;
  --dot: #d9d9d7;
  --focus: #171717;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ui: "Inter", ui-sans-serif, system-ui, sans-serif;
  --motion-reveal: 140ms;
  --motion-feedback: 100ms;
  /* marco Bakers: riel, cabecera y barra de estado alrededor del lienzo; --m es el margen de la ventana (atmósfera)
     y --pw el ancho del panel derecho */
  --rail: 48px;
  --top: 40px;
  --bottom: 28px;
  --m: 0px;
  --pw: 340px;
  --marco: #ecebe7;
  --bk-frame: rgba(236, 234, 229, 0.9);
  --bk-panel: rgba(214, 224, 236, 0.55);
  --bk-panel-solido: #e6ebf1;
  --bk-compo: rgba(255, 255, 255, 0.7);
  --bk-chip: rgba(255, 255, 255, 0.6);
  --bk-sel: rgba(0, 0, 0, 0.06);
  --bk-line: rgba(0, 0, 0, 0.07);
  --bk-line2: rgba(0, 0, 0, 0.12);
  --bk-acento: #3b82f6;
  --bk-ok: #1f9d55;
  --bk-warn: #b7791f;
  --bk-err: #c2410c;
  /* controles con identidad (familias A, B y C): pista, pulgar, tinte y luz de borde */
  --pista: rgba(0, 0, 0, 0.06);
  --pulgar: #fff;
  --pulgar-sombra: 0 1px 2px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.06);
  --tinte: rgba(0, 0, 0, 0.06);
  --tinte-on: rgba(0, 0, 0, 0.1);
  --luz-borde: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  --bk-fondo:
    radial-gradient(60% 70% at 6% 18%, #e9c98f 0, transparent 62%),
    radial-gradient(50% 60% at 28% 100%, #c9c79a 0, transparent 60%),
    radial-gradient(55% 70% at 88% 6%, #a9c3e3 0, transparent 60%),
    radial-gradient(60% 60% at 98% 92%, #ead2a0 0, transparent 60%), #e4e0d6;
}
:root[data-theme="dark"] {
  --marco: #1b1a18;
  --bk-frame: rgba(26, 25, 23, 0.86);
  --bk-panel: rgba(58, 78, 104, 0.28);
  --bk-panel-solido: #232a33;
  --bk-compo: rgba(20, 22, 26, 0.55);
  --bk-chip: rgba(255, 255, 255, 0.04);
  --bk-sel: rgba(255, 255, 255, 0.07);
  --bk-line: rgba(255, 255, 255, 0.07);
  --bk-line2: rgba(255, 255, 255, 0.12);
  --bk-ok: #5fcf7f;
  --bk-warn: #e3b55a;
  --bk-err: #ef7a6a;
  --pista: rgba(0, 0, 0, 0.22);
  --pulgar: rgba(255, 255, 255, 0.13);
  --pulgar-sombra: 0 1px 2px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  --tinte: rgba(255, 255, 255, 0.07);
  --tinte-on: rgba(255, 255, 255, 0.12);
  --luz-borde: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  --bk-fondo:
    radial-gradient(60% 70% at 6% 18%, #9c6d26 0, transparent 62%),
    radial-gradient(50% 60% at 28% 100%, #5a5a24 0, transparent 60%),
    radial-gradient(55% 70% at 88% 6%, #2f5d93 0, transparent 60%),
    radial-gradient(60% 60% at 98% 92%, #a57f37 0, transparent 60%), #241f19;
}
/* riel plegado: el lienzo llega casi al borde; los atajos siguen funcionando */
body.rail-plegada {
  --rail: 8px;
}
/* atmósfera (desde 1280 px, apagable en Ajustes): la ventana flota 8 px sobre un fondo cálido hecho con degradados
   fijos, sin desenfoque en vivo; la translucidez del marco deja ver ese fondo sin costo para los iframes */
body.atmosfera {
  --m: 8px;
  background: var(--bk-fondo);
}
.marco-fondo {
  position: fixed;
  inset: calc(var(--visible-top) + var(--m)) calc(var(--visible-right) + var(--m))
    calc(var(--visible-bottom) + var(--m)) calc(var(--visible-left) + var(--m));
  z-index: 0;
  background: var(--marco);
  pointer-events: none;
}
body.atmosfera .marco-fondo {
  border: 1px solid var(--bk-line2);
  border-radius: 14px;
  background: var(--bk-frame);
}
/* Fondo (Ajustes › Fondo): la obra elegida detrás del marco, en capas estáticas (sin desenfoque en vivo):
   degradado cálido → copia muy desenfocada (cover) → obra completa (contain) → velo → marco → lienzo velado → panel de vidrio.
   Valores de materiales/variantes.json; canvas-taller.js interpola Sutil (0) → Presente (100) en las variables --f*. */
:root {
  --f-obra: 0.62;
  --f-lienzo: 0.78;
  --f-blur: 30px;
  --f-sat: 1.5;
  --fd-velo: 0.42;
  --fd-p1: 0.42;
  --fd-p2: 0.56;
  --fd-borde: 0.13;
  --fd-luz: 0.13;
  --fd-sombra: 0.4;
  --fl-velo: 0.42;
  --fl-p1: 0.5;
  --fl-p2: 0.62;
  --fl-borde: 0.12;
  --fl-luz: 0.9;
  --fl-sombra: 0.18;
  --g-velo: rgba(244, 241, 234, var(--fl-velo));
  --g-lienzo: rgba(250, 250, 250, var(--f-lienzo));
  --g-p1: rgba(251, 251, 252, var(--fl-p1));
  --g-p2: rgba(238, 241, 245, var(--fl-p2));
  --g-borde: rgba(0, 0, 0, var(--fl-borde));
  --g-luz: rgba(255, 255, 255, var(--fl-luz));
  --g-sombra: rgba(40, 40, 40, var(--fl-sombra));
  /* gris sólido para el texto secundario dentro del marco y del panel; nunca opacidad */
  --soft-vidrio: #55554f;
  /* Apagado: lienzo limpio */
  --g-limpio: #fff;
  --g-limpio-p1: rgba(255, 255, 255, 0.94);
  --g-limpio-p2: rgba(246, 246, 246, 0.96);
  --g-limpio-borde: rgba(0, 0, 0, 0.08);
}
:root[data-theme="dark"] {
  --g-velo: rgba(26, 23, 20, var(--fd-velo));
  --g-lienzo: rgba(25, 26, 25, var(--f-lienzo));
  --g-p1: rgba(34, 40, 49, var(--fd-p1));
  --g-p2: rgba(22, 26, 33, var(--fd-p2));
  --g-borde: rgba(255, 255, 255, var(--fd-borde));
  --g-luz: rgba(255, 255, 255, var(--fd-luz));
  --g-sombra: rgba(0, 0, 0, var(--fd-sombra));
  --soft-vidrio: #c4c4bf;
  --g-limpio: #0f0f0f;
  --g-limpio-p1: rgba(26, 26, 26, 0.94);
  --g-limpio-p2: rgba(20, 20, 20, 0.96);
  --g-limpio-borde: rgba(255, 255, 255, 0.08);
}
.obra-fondo {
  position: fixed;
  inset: var(--visible-top) var(--visible-right) var(--visible-bottom) var(--visible-left);
  z-index: 0;
  display: none;
  overflow: hidden;
  pointer-events: none;
}
.obra-fondo > * {
  position: absolute;
  inset: 0;
}
.obra-blur {
  background: var(--obra-blur) center / cover no-repeat;
  opacity: var(--f-obra);
}
.obra-nitida {
  background: var(--obra-nitida) center / contain no-repeat;
  opacity: var(--f-obra);
}
/* la obra completa ocupa una caja con su propia proporción; sus bordes se funden con la copia desenfocada
   para que no se vea un corte, sin recortar la pintura */
.obra-fondo > .obra-nitida {
  inset: 0;
  margin: auto;
  aspect-ratio: var(--obra-proporcion, 1);
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  -webkit-mask-image:
    linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent),
    linear-gradient(180deg, transparent, #000 5%, #000 95%, transparent);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent),
    linear-gradient(180deg, transparent, #000 5%, #000 95%, transparent);
  mask-composite: intersect;
}
.obra-velo {
  background: var(--g-velo);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  body.con-obra .obra-fondo {
    display: block;
  }
  /* el marco deja ver la obra; el lienzo y su cabecera quedan velados (las piezas siguen opacas) */
  body.con-obra .marco-fondo {
    background: none;
  }
  body.con-obra .viewport,
  body.con-obra .marco-top {
    background-color: var(--g-lienzo);
  }
  /* El material es el mismo al anclar, flotar o pasar a hoja inferior. */
  body.con-obra .agent {
    background: linear-gradient(180deg, var(--g-p1), var(--g-p2));
    border-color: var(--g-borde);
    box-shadow:
      inset 0 1px 0 var(--g-luz),
      0 18px 44px var(--g-sombra);
    -webkit-backdrop-filter: blur(var(--f-blur)) saturate(var(--f-sat));
    backdrop-filter: blur(var(--f-blur)) saturate(var(--f-sat));
  }
}
body.con-obra :is(.toolbar, .marco-top, .marco-estado, .agent),
body.fondo-limpio :is(.toolbar, .marco-top, .marco-estado, .agent) {
  --soft: var(--soft-vidrio);
}
body.fondo-limpio {
  background: var(--g-limpio);
}
body.fondo-limpio .marco-fondo,
body.fondo-limpio .marco-top {
  background: var(--g-limpio);
}
body.fondo-limpio .viewport {
  background-color: var(--g-limpio);
}
body.fondo-limpio .agent {
  background: linear-gradient(180deg, var(--g-limpio-p1), var(--g-limpio-p2));
  border-color: var(--g-limpio-borde);
}
@media (prefers-reduced-transparency: reduce) {
  body.con-obra .obra-fondo {
    display: none;
  }
  body.con-obra .marco-fondo {
    background: var(--marco);
  }
  body.con-obra.atmosfera .marco-fondo {
    background: var(--bk-frame);
  }
  body.con-obra .viewport,
  body.con-obra .marco-top {
    background-color: var(--canvas);
  }
  body.con-obra .agent {
    background: var(--bk-panel-solido);
    border-color: var(--bk-line2);
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
body.panel-der {
  --pr: calc(var(--pw) + 8px);
}
body.panel-izq {
  --pl: var(--pw);
}
.study-panel {
  width: 268px;
  max-width: calc(100vw - var(--visible-left) - var(--visible-right) - 16px);
  max-height: calc(var(--visible-height) - var(--top) - var(--bottom) - 16px);
  overflow-y: auto;
  padding: 10px;
  z-index: 55;
  animation: view-reveal var(--motion-reveal) ease-out;
}
.study-panel label,
.study-panel p {
  display: block;
  font: 11px var(--ui);
  color: var(--soft);
  margin: 8px 0;
}
.study-panel select {
  width: 100%;
  padding: 7px;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: 12px var(--ui);
}
.study-panel > button {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 8px;
  text-align: left;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
}
.study-panel .grupo {
  margin: 12px 8px 2px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.study-panel small {
  color: var(--soft);
  font: 11px var(--ui);
}
.study-panel > button:hover:not(:disabled) {
  background: var(--hover);
}
.study-panel button:disabled {
  opacity: 0.4;
  cursor: default;
}
.export-result {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 6px 10px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: 12px var(--ui);
}
@keyframes view-reveal {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .study-panel,
  .ask.busy button[type="submit"] {
    animation: none;
  }
  .status,
  .doc .words {
    transition: none;
  }
}

/* Miniaturas del catálogo: tamaño propio, sin inflar sus píxeles. */
.thumb iframe {
  position: absolute;
  left: 0;
  top: 0;
  border: 0;
  transform: scale(0.2);
  transform-origin: 0 0;
  pointer-events: none;
  width: 640px;
  height: 400px;
}
.preview-status {
  display: block;
  padding: 20px;
  font-size: 12px;
  color: #555;
}
.chip.pat small {
  display: block;
  padding: 6px;
  color: var(--soft);
  font-size: 11px;
}
.chip canvas {
  width: 100%;
  aspect-ratio: 1;
  display: block;
  image-rendering: auto;
}

.web-reader {
  overflow: auto;
  flex: 1;
  padding: 28px 10%;
  background: var(--surface);
  color: var(--ink);
  font:
    16px/1.65 Georgia,
    serif;
  user-select: text;
  cursor: text;
  min-height: 0;
}
.web-reader h1 {
  font-size: 1.4em;
  line-height: 1.25;
  margin: 0 0 16px;
}
.web-reader a {
  color: inherit;
  text-decoration: underline;
}
.web-status {
  padding: 8px 14px;
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  flex-shrink: 0;
}
.item.web .wbar {
  background: var(--surface);
  color: var(--ink);
  flex-wrap: wrap;
  height: auto;
  min-height: 42px;
}
.item.web .wbar b {
  color: var(--ink);
}
.web-shot {
  width: 100%;
  height: calc(100% - 50px);
  object-fit: contain;
}

.selection-box {
  position: absolute;
  border: 1px solid var(--ink);
  background: #8883;
  pointer-events: none;
  z-index: 1000;
}
body.area-select .item iframe,
body.area-select .terminal-screen,
body.shift-select .terminal-screen {
  pointer-events: none !important;
}
#selectArea[aria-pressed="true"] {
  background: var(--ink);
  color: var(--surface);
}
#groupDialog {
  width: min(460px, 90vw);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  background: var(--surface);
  color: var(--ink);
}
#groupDialog::backdrop {
  background: #0005;
}
#groupDialog label {
  display: grid;
  gap: 6px;
  margin: 16px 0;
}
#groupDialog input,
#groupDialog textarea {
  font: inherit;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 10px;
  border-radius: 6px;
  width: 100%;
  box-sizing: border-box;
}
#groupDialog form {
  float: right;
}
#groupDialog button {
  padding: 8px;
}
#groupDialog p {
  font-size: 13px;
}
.web .wbody {
  flex: 1;
  min-height: 0;
}
.web .web-reader {
  height: auto;
}
.web-reader p {
  white-space: pre-wrap;
  pointer-events: auto;
}

#libraryPreview {
  width: min(850px, 90vw);
  max-height: 85vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  background: var(--surface);
  color: var(--ink);
}
#libraryPreview::backdrop {
  background: #0006;
}
#libraryPreview form {
  float: right;
}
#previewContent iframe {
  width: 100%;
  height: 55vh;
  border: 0;
  background: #fafafa;
}
#previewContent canvas {
  width: min(500px, 100%);
  height: auto;
  display: block;
  margin: auto;
}
.palette-detail {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.palette-detail > div {
  flex: 1;
  min-width: 100px;
  display: grid;
  gap: 6px;
}
.palette-detail i {
  display: block;
  height: 120px;
  border: 1px solid #8885;
}
.palette-detail code {
  font-size: 12px;
}
#groupDialog button,
#libraryPreview button {
  background: var(--hover);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  padding: 8px 12px;
}

/* avisos de conexión y de versión nueva (arriba al centro, sobre todo lo demás) */
.conn-banner {
  top: calc(var(--top) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  max-width: min(560px, calc(100vw - 32px));
  margin: 0;
  padding: 10px 14px;
  font: 13px/1.45 var(--ui);
  color: var(--ink);
  background: var(--surface, #fff);
  border-left: 3px solid #b3261e;
}
.conn-banner[hidden] {
  display: none;
}
#versionBanner {
  border-left-color: var(--ink);
  display: flex;
  gap: 12px;
  align-items: center;
}
#versionBanner[hidden] {
  display: none;
}
#versionBanner button {
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 99px;
  background: var(--ink);
  color: var(--canvas, #fff);
  font: 500 12.5px var(--ui);
}
/* una web en vivo o una pieza que no cargó: alternativas en vez de un rectángulo blanco */
.web-fallback {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  background: var(--surface, #fff);
  color: var(--ink);
  font: 14px/1.5 var(--ui);
  pointer-events: auto;
}
.web-fallback p {
  margin: 0;
}
.web-fallback div {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.web-fallback button,
.web-fallback a,
.load-error button {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface, #fff);
  color: var(--ink);
  font: 500 12.5px var(--ui);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.load-error {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface, #fff);
  color: var(--ink);
  border-top: 1px solid var(--line);
  font: 12.5px/1.4 var(--ui);
}
.load-error p {
  margin: 0;
}

/* Opciones del pedido: catálogo real sin ensanchar el chat. */
.agent-options {
  position: fixed;
  width: min(340px, calc(100vw - 16px));
  padding: 14px;
  display: grid;
  gap: 12px;
  overflow: auto;
  z-index: 1000;
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-sizing: border-box;
}
.agent-options[hidden] {
  display: none;
}
.agent-options label {
  display: grid;
  gap: 6px;
  font-size: 12px;
}
.agent-options select {
  width: 100%;
  max-width: none;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface, #fff);
  font: 12px var(--ui);
}
.agent-options button {
  background: var(--hover, #f0f0f0);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 0 10px;
  width: auto;
  border-radius: 8px;
  height: 32px;
  font-size: 12px;
}
.agent-options input[type="checkbox"] {
  width: 16px;
  min-width: 16px;
}
.agent-options p {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
}

.agent-options [hidden] {
  display: none;
}

.agent-options #askMode[aria-pressed="true"] {
  background: var(--ink);
  color: var(--surface);
}

/* La paleta se reconoce por sus muestras, sin abrir una lista de nombres. */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0 !important;
}
.inspector .doc-palette {
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
}
.doc-palette summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  cursor: pointer;
  font: 12px var(--ui);
  list-style: none;
}
.doc-palette summary::-webkit-details-marker {
  display: none;
}
.doc-palette summary::after {
  content: "⌄";
  margin-left: auto;
  color: var(--soft);
}
.doc-palette[open] summary::after {
  content: "⌃";
}
.doc-palette summary > span {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.doc-swatches {
  display: inline-flex;
  flex: none;
  gap: 2px;
}
.doc-swatches i,
.doc-role-swatch i {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px #8885;
}
.doc-palette-search {
  width: calc(100% - 16px);
  margin: 0 8px 6px;
  padding: 7px;
  font: 12px var(--ui);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
}
.doc-palette-search::placeholder {
  color: var(--soft);
  opacity: 1;
}
.doc-palette-options {
  max-height: 220px;
  overflow: auto;
  padding: 4px;
}
.inspector .doc-palette-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 8px 4px;
  text-align: left;
  color: var(--ink);
  background: transparent;
  font: 11px/1.4 var(--ui);
}
.doc-palette-option > span:last-child {
  min-width: 0;
}
.inspector .doc-palette-option:hover,
.inspector .doc-palette-option[aria-pressed="true"] {
  background: var(--hover);
}
.doc-role-swatch {
  display: inline-flex;
  flex: none;
  align-items: center;
  margin-right: 5px;
}

/* Conectores: solo la línea recibe clics, su caja no tapa otras piezas. */
.connector-panel {
  position: fixed;
  z-index: 65;
  display: grid;
  gap: 8px;
  padding: 14px;
  width: 260px;
  color: var(--ink);
  font: 13px var(--ui);
}
.connector-panel[hidden] {
  display: none;
}
.connector-panel button {
  padding: 8px;
  background: var(--hover);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: left;
}
.item.connector {
  pointer-events: none;
  background: none;
  box-shadow: none;
  border: 0;
  color: var(--ink);
}
/* la flecha de señal se distingue: es lo que Alonso le muestra al agente */
.item.connector.senal {
  color: #e8590c;
}
.item.connector.senal .connector-line {
  stroke-width: 2.5;
}
.item.connector.sel {
  outline: none;
}
.connector-previa {
  opacity: 0.6;
}
.connector-previa .connector-hit {
  pointer-events: none;
}
.connector-svg {
  /* ocupa toda la caja del conector: la regla general de iconos (20 px) encogía la flecha hasta casi no verse */
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.connector-hit,
.connector-label {
  pointer-events: auto;
  cursor: pointer;
}
.connector-label {
  font: 13px var(--ui);
  fill: var(--ink);
  stroke: var(--surface);
  stroke-width: 4px;
  paint-order: stroke fill;
  stroke-linejoin: round;
}
.item.connector.sel .connector-line,
.item.connector.sel .connector-tip {
  stroke: var(--accent);
}
body.connecting .item iframe,
body.connecting .terminal-screen {
  pointer-events: none !important;
}
body.connecting .viewport {
  cursor: crosshair;
}

.terminal .handle,
.experiment .handle,
.attachment .handle {
  right: 3px;
  bottom: 3px;
  width: 20px;
  height: 20px;
  z-index: 5;
  background: var(--surface);
  color: var(--ink);
  border-color: var(--ink);
}
.terminal .handle::after,
.experiment .handle::after,
.attachment .handle::after {
  content: "↘";
  display: block;
  text-align: center;
  font: 14px/17px var(--ui);
}
body.focus-mode .item.focused .handle {
  display: none;
}
.terminal-message {
  font: 12px/1.5 var(--ui);
  color: #e5e9e2;
  padding: 8px;
  white-space: normal;
}
.local-piece {
  padding: 20px;
  font: 14px/1.5 var(--ui);
  color: var(--ink);
}
.local-piece button {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--hover);
  color: var(--ink);
  font: 13px var(--ui);
}

/* Los controles no se copian al seleccionar texto de una ventana. */
body {
  -webkit-user-select: none;
  user-select: none;
}
input,
textarea,
[contenteditable="true"],
.doc .md,
.web-reader,
.file-preview,
.reply {
  -webkit-user-select: text;
  user-select: text;
}
.doc .md {
  cursor: text;
  overflow-y: auto;
  touch-action: pan-y;
}
.viewport.panning *,
body.dragging *,
body.area-select .item,
body.shift-select .item {
  -webkit-user-select: none;
  user-select: none;
}

#archiveRefresh {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 9px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
}

/* actividad real del agente: herramientas, resultados, texto y errores, tal como los ve el taller */
.reply .activity {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 2px;
  font: 12px/1.45 var(--ui);
  max-height: min(220px, 28vh);
  overflow: auto;
  scrollbar-width: thin;
}
.reply .activity li {
  display: grid;
  grid-template-columns: 34px 14px minmax(0, 1fr);
  gap: 4px;
  color: var(--soft);
}
.reply .activity .t {
  font: 11px/1.6 var(--mono);
  color: var(--faint);
}
.reply .activity .i {
  text-align: center;
}
.reply .activity .x {
  overflow-wrap: anywhere;
}
.reply .activity [data-tipo="herramienta"],
.reply .activity [data-tipo="conectado"],
.reply .activity [data-tipo="listo"] {
  color: var(--ink);
}
.reply .activity [data-tipo="texto"] .x {
  color: var(--ink);
  font-style: italic;
}
.reply .activity [data-tipo="error"] {
  color: #b3261e;
}
.reply .activity [data-tipo="aviso"] {
  color: #8a5a00;
}
:root[data-theme="dark"] .reply .activity [data-tipo="error"] {
  color: #ff8a80;
}
:root[data-theme="dark"] .reply .activity [data-tipo="aviso"] {
  color: #f2c46d;
}
.reply .usage {
  margin-top: 6px;
  color: var(--soft);
  font-size: 12px;
}

/* resaltar: ==texto== en documentos (como Obsidian) y frases de la Lectura */
.doc .md mark,
.web-reader mark {
  background: #fde68a;
  color: #171717;
  border-radius: 2px;
  padding: 0 1px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
:root[data-theme="dark"] .doc .md mark,
:root[data-theme="dark"] .web-reader mark {
  background: #a16207;
  color: #fff;
}
/* Formato del texto seleccionado: una cápsula oscura que aparece solo con una selección. */
.format-bar {
  position: fixed;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 34px;
  padding: 2px;
  border-radius: 99px;
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--float-shadow);
  font: 500 12.5px var(--ui);
}
.format-bar[hidden],
.format-bar [hidden] {
  display: none;
}
.format-bar button {
  min-width: 30px;
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 99px;
  background: none;
  color: inherit;
  font: inherit;
}
.format-bar button:hover,
.format-bar button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--surface) 22%, transparent);
}
.format-bar button:focus-visible {
  outline-color: var(--surface);
  outline-offset: -2px;
}
.format-bar .format-size:not([hidden]) {
  display: flex;
  align-items: center;
}
.format-bar .format-px {
  width: 42px;
  height: 24px;
  padding: 0 2px;
  border: 1px solid color-mix(in srgb, var(--surface) 30%, transparent);
  border-radius: 6px;
  background: none;
  color: inherit;
  text-align: center;
  font: 12px var(--mono);
  -moz-appearance: textfield;
}
.format-bar .format-px::-webkit-inner-spin-button,
.format-bar .format-px::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.format-bar .format-px:focus {
  outline: 1px solid var(--surface);
}
.format-bar .format-unidad {
  margin: 0 4px 0 3px;
  font: 11px var(--mono);
  opacity: 0.7;
}
.doc .md a {
  color: inherit;
  text-underline-offset: 3px;
}
.doc .md u {
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.doc .md .md-img {
  display: block;
  max-width: 100%;
  margin: 8px 0;
  border-radius: 6px;
}

/* renombrar el proyecto en su sitio */
.ptitle .rename-input {
  min-width: 0;
  width: min(260px, 40vw);
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font: 600 13.5px var(--ui);
  outline: none;
}
.projects .drawer-head .prename {
  justify-self: start;
  width: auto;
  height: 26px;
  margin-top: 4px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface);
  color: var(--ink);
  font: 500 12px var(--ui);
}

/* apps con cuenta y capturas: se dice qué es cada cosa */
.web-session {
  text-align: left;
  max-width: 560px;
  margin: auto;
  place-content: center start;
}
.web-session b {
  font-size: 15px;
}
.web-session div {
  justify-content: flex-start;
}
.shot-note {
  color: var(--soft);
  font-size: 12px;
  border-bottom: 1px solid var(--line);
}
.local-error {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
  border-top: 1px solid var(--line);
  font: 13px/1.45 var(--ui);
}
.local-error p {
  margin: 0;
  flex: 1 1 220px;
}
.local-error button,
.file-preview [data-block="puente"] {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface);
  color: var(--ink);
  font: 500 12.5px var(--ui);
}

/* barras flotantes minimizables: queda el asa y el botón para volver a mostrarlas */
.float .panel-fold.panel-fold,
.agent .ask .panel-fold.panel-fold {
  flex: none;
  width: 24px;
  min-width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--soft);
  font: 16px/1 var(--ui);
  position: relative;
  box-shadow: none;
  animation: none;
}
.float .panel-fold.panel-fold:hover,
.agent .ask .panel-fold.panel-fold:hover {
  background: var(--hover);
  color: var(--ink);
}
#inspector.panel-folded > :not(.panel-grip):not(.panel-fold) {
  display: none !important;
}
#inspector.panel-folded:not([hidden]) {
  width: auto;
  padding: 6px;
  display: flex;
  gap: 2px;
}
#inspector:not(.panel-folded) > .panel-fold.panel-fold {
  position: absolute;
  top: 12px;
  right: 10px;
}
#inspector:not(.panel-folded) > .panel-grip {
  margin-right: 26px;
}
.panel-fold.aviso::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
}

/* markdown de un agente dentro de una pieza de archivo */
.file-preview .file-md {
  font: 15px/1.6 var(--doc-font, "Newsreader", Georgia, serif);
  color: var(--ink);
}
.file-preview .file-md h4 {
  font-size: 1.15em;
  margin: 0.8em 0 0.3em;
}
.file-preview .file-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* uso y límites dentro del selector de agente */
.usage-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: 12px/1.45 var(--ui);
  color: var(--ink);
}
.usage-box:empty {
  display: none;
}
.usage-title {
  font-size: 12.5px;
}
.usage-row {
  display: grid;
  gap: 4px;
}
.usage-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.usage-head b {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.usage-bar {
  height: 6px;
  border-radius: 99px;
  background: var(--hover);
  overflow: hidden;
}
.usage-bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--ink);
}
.usage-row.alto .usage-bar i {
  background: #b45309;
}
.usage-row.critico .usage-bar i {
  background: #b3261e;
}
:root[data-theme="dark"] .usage-row.alto .usage-bar i {
  background: #f2a34a;
}
:root[data-theme="dark"] .usage-row.critico .usage-bar i {
  background: #ff7b72;
}
.usage-row small,
.usage-note {
  color: var(--soft);
  font-size: 11.5px;
  margin: 0;
}
.usage-line {
  margin: 0;
}
/* documento sobre papel blanco: el resaltado claro también en el tema oscuro */
:root[data-theme="dark"] .doc:not(.doc-oscuro) .md mark {
  background: #fde68a;
  color: #171717;
}
.doc.doc-oscuro .md mark {
  background: #a16207;
  color: #fff;
}

/* Pantalla completa conserva la misma web; solo cambia su encuadre. */
body.web-fullscreen .item.focused.web {
  left: 0 !important;
  top: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: none;
  max-height: none;
  border-radius: 0;
  outline: none;
  box-shadow: none;
}
body.web-fullscreen .item.focused.web .handle,
body.web-fullscreen .web [data-block="focus"],
body.web-fullscreen .float:not(.mas-menu),
body.web-fullscreen .marco,
body.web-fullscreen .agent,
body.web-fullscreen .agent-pill {
  display: none;
}
body.web-fullscreen .viewport {
  inset: 0;
}
body.web-fullscreen .web .wbar {
  cursor: default;
  padding: 8px 12px;
}
body.focus-mode .web .wbar {
  gap: 6px;
  padding-top: 6px;
  padding-bottom: 6px;
}
body.focus-mode .web .wbar b {
  flex: 1 1 160px;
}

/* Comentarios para el agente: una capa sobre el lienzo con un punto numerado por comentario (tamaño fijo con
   cualquier zoom) y la caja para escribirlo, como en Codex. Al comentar, la capa recibe el clic aunque haya una web
   o un estudio debajo. */
.comentarios {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}
.comentarios.activa {
  pointer-events: auto;
  cursor: crosshair;
}
.comentario-pin {
  position: absolute;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0;
  background: #e8590c;
  color: #fff;
  font: 600 12px var(--ui);
  box-shadow: 0 2px 8px #00000040;
  transform: translateY(-100%);
  pointer-events: auto;
  cursor: pointer;
}
.comentario-pin.resuelto {
  opacity: 0.45;
  background: var(--faint);
}
.comentario-pin.activo {
  outline: 2px solid #e8590c;
  outline-offset: 2px;
}
.comentario-caja {
  position: fixed;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  padding: 6px 6px 6px 14px;
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--float-shadow);
}
.comentario-caja[hidden] {
  display: none;
}
.comentario-n {
  color: #e8590c;
  font: 600 12px var(--ui);
}
.comentario-caja input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: 15px var(--ui);
  outline: none;
}
.comentario-caja button {
  flex: none;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 16px;
  background: var(--hover);
  color: var(--ink);
  font: 12px var(--ui);
}
.comentario-caja .comentario-enviar {
  width: 32px;
  padding: 0;
  background: #e8590c;
  color: #fff;
  font-size: 15px;
}
.comentario-caja.nuevo [data-c] {
  display: none;
}
.toolbar > #commentTool[aria-pressed="true"] {
  background: var(--hover);
  color: #e8590c;
}

/* ---------- controles con identidad: A pista y pulgar · B grupo unido · C compositor del agente ----------
   Tinte, pista y luz de borde salen de los tokens --pista/--pulgar/--tinte/--luz-borde; el texto secundario usa --soft,
   que sobre el vidrio ya es el gris sólido de G1. */
/* A: un solo pulgar que se desliza entre opciones iguales (transform, 180 ms; quieto con «reducir movimiento») */
.seg {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  flex: none;
  padding: 2px;
  border-radius: 9px;
  background: var(--pista);
}
.seg > .pulgar {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: calc((100% - 4px) / var(--n, 2));
  border-radius: 7px;
  background: var(--pulgar);
  box-shadow: var(--pulgar-sombra);
  transform: translateX(calc(var(--i, 0) * 100%));
  transition: transform 180ms cubic-bezier(0.3, 0.7, 0.2, 1);
  pointer-events: none;
}
.seg.sin-activo > .pulgar {
  opacity: 0;
}
.seg > [role="tab"],
.seg > [role="radio"] {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 24px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--soft);
  font: 12px var(--ui);
  white-space: nowrap;
  cursor: pointer;
}
.seg > [aria-selected="true"],
.seg > [aria-checked="true"],
.seg > [role]:hover {
  color: var(--ink);
}
.seg > [role]:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -1px;
}
@media (prefers-reduced-motion: reduce) {
  .seg > .pulgar {
    transition: none;
  }
}
.menu-list .menu-fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  font-size: 13px;
}
.oculto-fuente {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip-path: inset(50%);
  pointer-events: none;
}
.wbar .seg > [role="tab"] {
  height: 22px;
  padding: 0 9px;
}
/* B: grupo unido: un contenedor por grupo semántico; activo = cuadrado tintado; una sola acción con relleno */
.grupo-b {
  --gh: 26px;
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--bk-line2);
  border-radius: 9px;
  background: var(--bk-chip);
}
.grupo-b > button,
.grupo-b > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 26px;
  height: var(--gh);
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--ink);
  font: 12px var(--ui);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.grupo-b > button:hover:not(:disabled) {
  background: var(--tinte);
}
.grupo-b > button[aria-pressed="true"] {
  background: var(--tinte-on);
  box-shadow: var(--luz-borde);
}
.grupo-b > button:disabled {
  opacity: 0.4;
  cursor: default;
}
.grupo-b > button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -1px;
}
.grupo-b > button.lleno {
  background: var(--ink);
  color: var(--surface);
}
.grupo-b > button.lleno:hover:not(:disabled) {
  background: var(--ink);
  opacity: 0.86;
}
/* acciones de la selección: iconos de 28 px */
.edit-actions .grupo-b {
  --gh: 28px;
}
.edit-actions .grupo-b > button {
  width: 28px;
  height: 28px;
  padding: 0;
}
.marco-top .historial {
  --gh: 26px;
}
/* el «⋯»: pegado al grupo (acción principal | más), o suelto con su propio contorno */
.mas {
  position: relative;
  display: inline-flex;
  flex: none;
}
.mas-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: calc(var(--gh, 26px) + 6px);
  padding: 0;
  border: 1px solid var(--bk-line2);
  border-radius: 9px;
  background: var(--bk-chip);
  color: var(--ink);
  cursor: pointer;
}
.mas-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mas-btn:hover,
.mas-btn[aria-expanded="true"] {
  background: var(--tinte);
}
.mas-btn[aria-expanded="true"] {
  box-shadow: var(--luz-borde);
}
.mas-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}
.grupo-b:has(+ .mas) {
  border-right-width: 0;
  border-radius: 9px 0 0 9px;
}
.grupo-b + .mas .mas-btn {
  width: 28px;
  border-radius: 0 9px 9px 0;
}
.mas-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 70;
  display: grid;
  min-width: 184px;
  padding: 4px;
  border: 1px solid var(--bk-line2);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--float-shadow);
}
.mas-menu[hidden] {
  display: none;
}
.mas-menu > [role="menuitem"] {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: auto;
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ink);
  font: 12.5px var(--ui);
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.mas-menu > [role="menuitem"] svg {
  flex: none;
  width: 16px;
  height: 16px;
  margin-right: -2px;
}
.mas-menu > [role="menuitem"]:hover:not(:disabled),
.mas-menu > [role="menuitem"]:focus-visible {
  outline: 0;
  background: var(--tinte);
}
.mas-menu > [role="menuitem"]:disabled {
  opacity: 0.4;
  cursor: default;
}
/* El menú de una pieza puede sobresalir de su caja; su cuerpo conserva el recorte propio. */
.item:has(.mas-menu:not([hidden])) {
  overflow: visible;
  z-index: 70;
}
/* Las acciones de la selección se despliegan sobre el panel de conversación. */
.marco-top:has(.mas-menu:not([hidden])) {
  z-index: 80;
}
/* lo destructivo va al final, en rojo y separado por una línea */
.mas-menu > .peligro {
  margin-top: 5px;
  color: var(--bk-err);
}
.mas-menu > .peligro::before {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  top: -3px;
  height: 1px;
  background: var(--bk-line2);
}
.mas-menu > .peligro:first-child {
  margin-top: 0;
}
.mas-menu > .peligro:first-child::before {
  content: none;
}
.edit-actions .mas-menu > [role="menuitem"] {
  width: auto;
  height: 30px;
  padding: 0 10px;
}
.edit-actions .mas-menu > [role="menuitem"] span {
  order: -1;
  margin-right: auto;
}
.edit-actions .mas-menu {
  min-width: 190px;
}
/* terminal: la pieza siempre es oscura */
.terminal-controls {
  --gh: 24px;
}
.terminal-controls .grupo-b,
.terminal-controls .mas-btn {
  border-color: #ffffff1f;
  background: #ffffff0f;
}
.terminal-controls .grupo-b > button {
  color: #e5e9e2;
  font-size: 11.5px;
}
.terminal-controls .grupo-b > button.lleno {
  background: #e4e9df;
  color: #171a18;
}
.terminal-controls .grupo-b > button:hover:not(:disabled) {
  background: #ffffff1f;
}
.terminal-controls .grupo-b > button.lleno:hover:not(:disabled) {
  background: #e4e9df;
}
.terminal-controls .mas-btn {
  color: #e5e9e2;
}
.terminal-controls .mas-btn:hover,
.terminal-controls .mas-btn[aria-expanded="true"] {
  background: #ffffff1f;
}
.terminal-controls .terminal-state {
  color: #aeb8aa;
}
.block-bar {
  --gh: 24px;
}
.block-bar .grupo-b > button {
  font-size: 11.5px;
}
/* C: estado del agente como insignia (punto + texto); trabajando, un spinner del mismo tamaño */
.chat-estado-t {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.chat-estado-t::before {
  content: "";
  flex: none;
  box-sizing: border-box;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.chat-estado[data-estado="trabajando"] .chat-estado-t::before {
  background: none;
  border: 1.5px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor;
  animation: giro-insignia 0.8s linear infinite;
}
@keyframes giro-insignia {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .chat-estado[data-estado="trabajando"] .chat-estado-t::before {
    animation: none;
  }
}
