@font-face {
  font-family: "CS Lettering";
  src: url("fonts/ComicNeue-Bold.ttf") format("truetype");
  font-weight: 400 900;
}

@font-face {
  font-family: "CS comic-neue";
  src: url("fonts/ComicNeue-Bold.ttf") format("truetype");
  font-weight: 100 900;
}
@font-face {
  font-family: "CS patrick-hand";
  src: url("fonts/PatrickHand-Regular.ttf") format("truetype");
  font-weight: 100 900;
}
@font-face {
  font-family: "CS bangers";
  src: url("fonts/Bangers-Regular.ttf") format("truetype");
  font-weight: 100 900;
}
@font-face {
  font-family: "CS permanent-marker";
  src: url("fonts/PermanentMarker-Regular.ttf") format("truetype");
  font-weight: 100 900;
}
@font-face {
  font-family: "CS luckiest-guy";
  src: url("fonts/LuckiestGuy-Regular.ttf") format("truetype");
  font-weight: 100 900;
}
@font-face { font-family: "CS cinzel"; src: url("fonts/CinzelDecorative-Bold.ttf") format("truetype"); font-weight: 100 900; }
@font-face { font-family: "CS bebas"; src: url("fonts/BebasNeue-Regular.ttf") format("truetype"); font-weight: 100 900; }
@font-face { font-family: "CS crimson"; src: url("fonts/CrimsonText-Regular.ttf") format("truetype"); font-weight: 100 900; }

@font-face { font-family: "CS display"; src: url("fonts/ArchivoBlack-Regular.ttf") format("truetype"); }

/* Paleta base (Océano); theme.js la sustituye según la elegida en Ajustes */
:root {
  --bg: hsl(198,28%,89%);          /* mesa */
  --panel: hsl(198,34%,95%);       /* hojas: paneles laterales y diálogos */
  --paper: hsl(198,28%,98.5%);     /* campos, tarjetas */
  --ink: hsl(198,25%,8%);          /* texto y bordes */
  --line: hsl(198,22%,82%);        /* divisores */
  --pencil: hsl(198,20%,64%);      /* bordes de campos, tarjetas y botones secundarios */
  --ink-2: hsl(198,15%,22%);       /* texto de apoyo largo */
  --line-ink: hsl(198,25%,8%);     /* bordes marcados (viñetas, botón principal) */
  --muted: hsl(198,12%,32%);       /* texto secundario */
  --accent: #0b7c91;               /* acción principal */
  --accent-ink: #fff;
  --hi: #ffd21f;          /* amarillo: activo y seleccionado */
  --hi-soft: #fff3b8;
  --card: #fff;           /* fondo de tarjetas y campos sobre hoja */
  --danger: #a61b0f;
  --sel: #1f5fd1;         /* azul: selección sobre el lienzo */
  --radius: 8px;          /* controles y tarjetas */
  --radius-lg: 14px;       /* diálogos */
  /* relieve en tres niveles: plano (borde de lápiz) · entintado (seleccionado, actual, flotante) · página */
  --shadow-ink: 0 1px 3px rgba(18,18,18,.10);
  --shadow-float: 0 12px 32px rgba(18,18,18,.14);
  --shadow-page: 0 12px 32px rgba(18,18,18,.14);
  --font-display: "Space Grotesk", Inter, "Segoe UI", sans-serif;
  --font-brand: "CS bangers", "CS display", Impact, sans-serif;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px;
  --ease-out: cubic-bezier(.23, 1, .32, 1);   /* entradas y pulsaciones: arranca rápido */
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body { display: flex; flex-direction: column; overflow: hidden; }

/* botón principal: rojo entintado con sombra dura, como una viñeta */
button, .btnlike {
  font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--accent); color: var(--accent-ink);
  padding: 6px 14px; min-height: 34px; border-radius: var(--radius); cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 3px rgba(18,18,18,.10); transition: transform 120ms var(--ease-out), box-shadow 120ms var(--ease-out);
}
/* el realce al pasar solo con ratón: en pantallas táctiles se quedaría pegado tras tocar */
@media (hover: hover) and (pointer: fine) {
  button:hover:not(:disabled), .btnlike:hover { transform: none; box-shadow: 0 1px 3px rgba(18,18,18,.10); }
}
button:active:not(:disabled) { transform: none; box-shadow: 0 0 0 var(--ink); }
button:disabled { background: var(--bg); border-color: #c3d3dc; color: #6b7e8a; cursor: not-allowed; filter: none; }
button:focus-visible, .btnlike:focus-visible, a:focus-visible, [tabindex]:focus-visible, summary:focus-visible {
  outline: 3px solid var(--sel); outline-offset: 2px;
}
/* botón secundario: papel con borde de lápiz; al pasar, se entinta */
button.ghost { background: var(--paper); color: var(--ink); border: 1px solid var(--pencil); box-shadow: none; font-weight: 500; }
button.ghost:hover:not(:disabled) { border-color: var(--ink); background: var(--card); box-shadow: 0 1px 3px rgba(18,18,18,.10); }
button.ghost:disabled { background: transparent; }
button.small, .btnlike.small { padding: 4px 10px; min-height: 30px; font-size: 13px; }
button.ghost.danger { color: var(--danger); border-color: #e0b2a8; }
button.ghost.danger:hover:not(:disabled) { background: #fdebe7; border-color: var(--danger); box-shadow: 0 1px 3px rgba(18,18,18,.10); }
button.danger { color: var(--danger); }
input, select, textarea {
  font: inherit; color: inherit; background: var(--paper); border: 1px solid var(--pencil);
  border-radius: var(--radius); padding: 7px 9px; min-width: 0;
}
textarea { resize: vertical; width: 100%; line-height: 1.4; }
input:focus, select:focus, textarea:focus { outline: 3px solid color-mix(in srgb, var(--sel) 35%, transparent); border-color: var(--sel); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; }
input[type=range] { accent-color: var(--ink); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
label.check { flex-direction: row; align-items: center; gap: 6px; font-weight: 500; }
.muted { color: var(--muted); font-size: 13px; }
.spacer { flex: 1; }

h2 { font-family: var(--font-display); font-weight: 400; font-size: 14px; letter-spacing: .01em; margin: 0; }
h3 { font-family: var(--font-display); font-weight: 400; margin: 0 0 8px; font-size: 20px; letter-spacing: .01em; }

/* barra superior */

#titleInput { width: 200px; font-weight: 600; }
#styleCustom { width: 220px; }
.pill { font-size: 12px; font-weight: 600; padding: 4px 11px; min-height: 28px; border-radius: 99px; background: var(--bg); color: var(--ink-2); border: 1px solid var(--pencil); box-shadow: none; }
.pill:hover:not(:disabled) { transform: none; box-shadow: none; border-color: var(--ink); }
.engine-opt { flex-direction: row; align-items: flex-start; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); cursor: pointer; color: var(--ink); }
.engine-opt span { display: flex; flex-direction: column; gap: 2px; font-weight: 500; }
.engine-opt b { font-size: 14px; }
.engine-opt small { color: var(--muted); font-weight: 400; }
.engine-opt:has(input:checked) { border-color: var(--sel); box-shadow: 0 0 0 1px var(--sel); }
.pill.ok { background: #e2f1d6; color: #1f4d0c; border-color: #8cbb6b; }
.pill.warn { background: var(--hi-soft); color: #5a4300; border-color: #d9b84a; }
.pill.bad { background: #fde2df; color: var(--danger); border-color: #e0a59a; }

/* rejilla principal */
.layout { flex: 1; display: grid; grid-template-columns: 250px 1fr 360px; min-height: 0; }
.inspector { background: var(--panel); overflow-y: auto; padding: 12px; }

.inspector { border-left: 1px solid var(--line); }

.hint { font-size: 13px; color: var(--muted); line-height: 1.5; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.tabs button { padding: 3px 10px; min-height: 28px; font-size: 13px; font-weight: 500; background: transparent; color: var(--muted); border: 1.5px solid transparent; border-radius: 99px; box-shadow: none; }
.tabs button:hover:not(:disabled) { transform: none; box-shadow: none; color: var(--ink); border-color: var(--pencil); }
.tabs button.on { background: var(--hi); color: var(--ink); border-color: var(--ink); font-weight: 700; }


.asset {
  display: flex; gap: 8px; align-items: center; padding: 6px; border-radius: var(--radius);
  border: 1.5px solid var(--line); background: var(--paper); cursor: pointer; transition: box-shadow .08s;
}
.asset:hover { border-color: var(--ink); box-shadow: 0 1px 3px rgba(18,18,18,.10); }
.asset img, .asset .noimg {
  width: 44px; height: 44px; object-fit: cover; border-radius: 2px; border: 1px solid var(--line); background: var(--bg); flex: none;
  display: grid; place-items: center; color: var(--muted); font-size: 20px;
}
.asset b { display: block; font-size: 13px; }
.asset small { color: var(--muted); }


/* zona de trabajo */
.workspace { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pagebar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1.5px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.page-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.page-tabs button { min-width: 32px; min-height: 30px; padding: 3px 8px; font-size: 13px; font-weight: 600; background: var(--paper); color: var(--ink); border: 1px solid var(--pencil); box-shadow: none; }
.page-tabs button:hover:not(:disabled) { transform: none; border-color: var(--ink); box-shadow: 0 1px 3px rgba(18,18,18,.10); }
.page-tabs button.on { background: var(--hi); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(18,18,18,.10); }
/* mesa de trabajo con trama de puntos muy suave; la página, entintada con sombra dura */
.stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 18px 24px 24px 18px; overflow: auto;
  background-color: var(--bg); background-image: radial-gradient(rgba(15,26,33,.09) 1px, transparent 1.3px); background-size: 11px 11px; }
#pageSvg { height: 100%; max-width: 100%; aspect-ratio: 2 / 3; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-page); user-select: none; touch-action: none; }
#pageSvg .panel { cursor: pointer; }
#pageSvg .bubble { cursor: move; }
#pageSvg .handle { cursor: grab; }
#pageSvg text { font-family: "CS Lettering", "Comic Sans MS", sans-serif; font-weight: 700; }
#pageSvg .ph { font-family: Inter, system-ui, sans-serif; font-weight: 500; fill: #9a8f80; }
#pageSvg .busy { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }

/* inspector */
.inspector section { border-bottom: 1.5px dashed var(--line); padding-bottom: 14px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
/* títulos de sección subrayados con rotulador amarillo */
.inspector section > h2 { align-self: flex-start; background: linear-gradient(transparent 58%, var(--hi) 58%, var(--hi) 92%, transparent 92%); padding: 0 3px; }
.inspector .row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--paper); border: 1.5px solid var(--line); border-radius: 99px; padding: 2px 8px 2px 2px; font-size: 12px; }
.chip img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }

.cands { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cand { position: relative; border-radius: 2px; overflow: hidden; border: 2px solid var(--line); cursor: pointer; aspect-ratio: 1; background: var(--bg); }
.cand:hover { border-color: var(--ink); }
.cand img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cand.on { border: 1px solid var(--line); box-shadow: 0 0 0 3px var(--hi); }
.cand .x { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,.6); color: #fff; border: 0; border-radius: var(--radius); padding: 0 5px; font-size: 12px; }
.bubble-item { background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.bubble-item.on { border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(18,18,18,.10); }
.bubble-item textarea { min-height: 44px; }
.empty-insp { color: var(--muted); text-align: center; margin-top: 40px; line-height: 1.6; }
input[type=range] { padding: 0; }

/* diálogos */
dialog { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 0; background: var(--panel); color: var(--ink); box-shadow: var(--shadow-page); max-width: 96vw; }
dialog::backdrop { background: rgba(15,26,33,.5); }
/* entradas: los diálogos crecen desde el centro; los menús desde el botón que los abre. Al cerrar, sin animación */
dialog[open] { animation: pop-in 200ms var(--ease-out); }
dialog[open]::backdrop { animation: fade-in 200ms var(--ease-out); }
@keyframes pop-in { from { opacity: 0; transform: scale(.96); } }
@keyframes fade-in { from { opacity: 0; } }
.dlg { padding: 18px; width: 560px; max-width: 100%; display: flex; flex-direction: column; gap: 10px; }
.dlg.wide { width: 760px; }
.dlg pre { white-space: pre-wrap; background: var(--bg); padding: 10px; border-radius: var(--radius); font-size: 12px; max-height: 60vh; overflow: auto; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dlg-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.imgs-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 600; color: var(--muted); }
.asset-images { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; min-height: 40px; }
.asset-images .cand { aspect-ratio: 3/4; }
.gen-box { background: var(--bg); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 8px; }

/* menú de menciones */
.mention-menu { position: fixed; z-index: 50; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-float); min-width: 200px; max-height: 240px; overflow: auto; }
.mention-menu div { display: flex; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer; font-size: 13px; }
.mention-menu div.on, .mention-menu div:hover { background: var(--hi-soft); }
.mention-menu img, .mention-menu .noimg { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; background: var(--bg); }

/* trabajos */
.jobs-dock { position: fixed; right: 376px; bottom: 14px; display: flex; flex-direction: column; gap: 6px; z-index: 40; max-width: 320px; }
.job { background: var(--ink); color: var(--paper); border-radius: var(--radius); border-left: 5px solid var(--hi); padding: 8px 10px; font-size: 12px; display: flex; gap: 8px; align-items: center; box-shadow: 4px 4px 0 rgba(15,26,33,.35); }
.job.error { background: #8f1d14; border-left-color: #ffb4a8; }
.job .spin { width: 12px; height: 12px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin 1s linear infinite; flex: none; }
.job button { padding: 1px 8px; min-height: 24px; font-size: 12px; background: transparent; color: var(--paper); border: 1px solid rgba(255,255,255,.5); box-shadow: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 9px 16px; border-radius: var(--radius); box-shadow: 0 1px 3px rgba(18,18,18,.10); z-index: 60; font-size: 13px; max-width: calc(100vw - 32px);
  animation: toast-in 220ms var(--ease-out); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }

.edit-zone { border: 2px solid #ff3b30; border-radius: var(--radius); padding: 10px; background: #fff6f5; }

.import-preview { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; display: grid; gap: 4px; max-height: 9em; overflow: auto; }

.sheet-views { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.sheet-views > p { grid-column: 1 / -1; margin: 0; }   /* «Sin hoja todavía…» a todo el ancho */
.sheet-views figure { margin: 0; background: var(--card); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.sheet-views img { width: 100%; aspect-ratio: 3/4; object-fit: contain; background: #fff; }
.sheet-views figure.body img { aspect-ratio: 1/2; }
.sheet-views figcaption { font-size: 12px; text-align: center; color: var(--muted); padding: 2px; }

#editLayoutBtn.on { background: var(--hi); color: var(--ink); border-color: var(--ink); box-shadow: 0 1px 3px rgba(18,18,18,.10); }
.layout-zone { border-color: var(--sel); background: #f3f7ff; }

.audit-ask input { flex: 1; }
.audit-results { display: grid; gap: 10px; max-height: 55vh; overflow: auto; }
.audit-summary { background: var(--card); border-radius: var(--radius); padding: 8px 10px; margin: 0; }
.audit-issue { background: var(--card); border: 1px solid var(--line); border-left: 5px solid #a9bcc7; border-radius: var(--radius); padding: 10px; display: grid; gap: 6px; }
.audit-issue p { margin: 0; }
.audit-issue.sev-alta { border-left-color: #c8452c; }
.audit-issue.sev-media { border-left-color: #e0a12b; }
.audit-issue.sev-baja { border-left-color: #8fb3c9; }
.audit-issue.done { opacity: .6; }
.audit-issue .tag { font-size: 12px; background: var(--bg); border-radius: 99px; padding: 1px 8px; }

.sec-group { display: flex; align-items: center; gap: 3px; background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 2px 4px; }
.sec-group .sec-label { background: transparent; border: 0; box-shadow: none; color: var(--muted); font-family: var(--font-display); font-weight: 400; font-size: 13px; padding: 4px 6px; min-width: 0; min-height: 0; }
.sec-group .sec-label:hover:not(:disabled) { transform: none; box-shadow: none; }
.sec-group .sec-label:hover { color: var(--ink); }
.sec-group .sec-add { background: transparent; border: 1.5px dashed var(--pencil); box-shadow: none; color: var(--muted); min-width: 26px; min-height: 28px; padding: 2px 6px; }
.sec-group .sec-add:hover:not(:disabled) { transform: none; box-shadow: none; border-color: var(--ink); color: var(--ink); }
.sec-cover, .sec-backcover { background: var(--bg); }
.page-tabs button.hole { border-style: dashed; color: var(--muted); background: transparent; }
.page-tabs button.hole.on { background: var(--hi-soft); color: var(--ink); border-style: dashed; }
.popup-menu { position: fixed; z-index: 50; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-float); display: flex; flex-direction: column; padding: 4px; min-width: 200px;
  transform-origin: top left; animation: pop-in 150ms var(--ease-out); }
.popup-menu button { background: transparent; color: var(--ink); border: 0; box-shadow: none; font-weight: 500; text-align: left; padding: 7px 10px; }
.popup-menu button:hover:not(:disabled) { background: var(--hi-soft); transform: none; box-shadow: none; }
.popup-menu button.danger { color: #b42318; }

.styles-dlg { width: min(1100px, 96vw); }
.styles-dlg #stylesSearch { width: 240px; }
.styles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; max-height: 46vh; overflow: auto; padding: 2px; }
.style-card { background: var(--paper); border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.style-card.on { border-color: var(--ink); box-shadow: 0 1px 3px rgba(18,18,18,.10); }
.style-pic { aspect-ratio: 3/4; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.style-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.style-body { padding: 8px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.style-body p { margin: 0; font-size: 12px; line-height: 1.35; flex: 1; }
.style-body .tag { font-size: 12px; background: var(--bg); border-radius: 99px; padding: 1px 7px; margin-left: auto; }
.styles-mix { display: flex; gap: 14px; align-items: flex-start; border-top: 1px solid var(--line); padding-top: 10px; }
.styles-mix .mix-left { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.mix-list { display: flex; flex-direction: column; gap: 6px; }
.mix-item { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 8px; }
.mix-item img { width: 30px; height: 40px; object-fit: cover; border-radius: var(--radius); }
.mix-item b { min-width: 150px; }
.mix-item .weights { display: flex; gap: 4px; flex: 1; }
.mix-item .weights button { background: var(--paper); color: var(--ink); border: 1px solid var(--pencil); box-shadow: none; padding: 3px 8px; min-height: 28px; font-size: 12px; }
.mix-item .weights button.on { background: var(--hi); color: var(--ink); border-color: var(--ink); }
.mix-sample { width: 180px; border-radius: var(--radius); border: 1px solid var(--line); }
.style-pic { position: relative; }
.style-pic .redo-sample { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.55); color: #fff; border: 0; border-radius: var(--radius); padding: 2px 8px; opacity: 0; transition: opacity 150ms ease; }
.style-card:hover .redo-sample, .style-pic .redo-sample:focus { opacity: 1; }
@media (hover: none) { .style-pic .redo-sample { opacity: 1; } }

.auto-dlg { width: min(820px, 96vw); }
.auto-steps { display: grid; gap: 8px; }
.auto-step { background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 8px 10px; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.auto-step.sub { margin-left: 24px; }
.auto-step small, .auto-step .sub-opts { grid-column: 1 / -1; }
.auto-step [data-cost] { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.auto-step input.tiny { width: 52px; padding: 2px 4px; }
.auto-total { background: var(--hi-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; font-size: 16px; }
.jobs-dock .job.summary { font-weight: 600; }

#spendPill { background: var(--hi-soft); color: #4d3a00; border-color: #d9b84a; font-variant-numeric: tabular-nums; }
.spend-totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.spend-totals > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; }
.spend-totals b { font-size: 20px; font-variant-numeric: tabular-nums; }
.spend-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.spend-block { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-top: 10px; }
.spend-block table { width: 100%; border-collapse: collapse; font-size: 13px; }
.spend-block td { padding: 3px 0; border-bottom: 1px solid var(--bg); }
.spend-block td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.cover-texts .row { flex-wrap: wrap; }

#delComicBtn { padding: 6px 9px; }
#delComicBtn:hover { background: #fdeaea; border-color: #e3a3a3; }
#delGoBtn.danger { background: var(--danger); border-color: var(--ink); color: #fff; }
#delGoBtn.danger:disabled { opacity: .45; cursor: not-allowed; }
#delInfo p { margin: 4px 0; }
#delInfo .warn { color: #b03a2e; font-weight: 600; }

/* ---------------------------------------------------------------- Tinta y papel · pantallas */
button.hi { background: var(--hi); color: var(--ink); }
/* botón de tinta: acción principal que no genera (abrir, continuar, crear) */
button.ink { background: var(--ink); color: var(--paper); box-shadow: 0 1px 3px rgba(18,18,18,.10); }
button.ink:hover:not(:disabled) { box-shadow: 0 1px 3px rgba(18,18,18,.10); }


#comicSelect { max-width: 200px; font-weight: 600; }
#titleInput { width: 210px; }
.tb-pop-wrap { position: relative; }
.tb-popover { position: absolute; top: calc(100% + 8px); left: 0; z-index: 70; width: 320px; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(18,18,18,.14); padding: 12px; display: grid; gap: 10px;
  transform-origin: top left; animation: pop-in 150ms var(--ease-out); }
.tb-popover .row { display: flex; gap: 6px; }
.tb-popover .row select { flex: 1; }
.tb-popover input#styleCustom { width: 100%; }

.empty-card { border: 2px dashed var(--pencil); border-radius: var(--radius); padding: 12px; display: grid; gap: 8px; background: var(--paper); }
.empty-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.empty-card .row { display: flex; gap: 6px; flex-wrap: wrap; }
.mobile-tabs { display: none; }

/* móvil: barra compacta desplazable, una sección a la vez y pestañas abajo */

#spendPill, #statusPill { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }

#logoutBtn { min-width: 34px; padding: 6px 8px; }


/* barra de página en columna vertical entre la biblioteca y la página: el lienzo gana toda la altura */
.workspace { flex-direction: row; }
.pagebar { flex-direction: column; align-items: stretch; flex-wrap: nowrap; width: 178px; flex: none; gap: 6px;
  padding: 12px 10px; border-bottom: 0; border-right: 1.5px solid var(--line); overflow-y: auto; }
.pagebar > button, .pagebar > select { width: 100%; }
.pagebar .spacer { flex: none; height: 0; border-top: 1.5px dashed var(--line); margin: 6px 0; }
.pagebar .page-tabs { flex-direction: column; gap: 6px; }
.pagebar .sec-group { flex-wrap: wrap; }
.pagebar .sec-group .sec-label { flex: 1 0 100%; text-align: left; }
.stage { min-width: 0; }


/* desplegable del cómic */
.comic-menu-btn { font-weight: 700; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
#comicMenu { width: 300px; }
#comicMenu select, #comicMenu input { width: 100%; max-width: none; }
#comicMenu .row { display: flex; align-items: center; gap: 6px; }


/* ---------------------------------------------------------------- sin barra superior: cabeceras en las columnas */

.layout { grid-template-columns: 280px 1fr 360px; }

/* bocadillos en el inspector: tarjeta compacta, ajustes solo en el seleccionado */
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.b-head { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.b-head select { flex: 1; min-width: 0; }
.b-num { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%;
  background: var(--paper); font-family: var(--font-display); font-size: 12px; }
.bubble-item.on .b-num { background: var(--hi); }
.b-del { min-width: 30px; padding: 2px 8px; }
.b-opts { display: grid; gap: 6px; padding-top: 6px; border-top: 1.5px dashed var(--line); }
.bubble-item:not(.on) .b-opts { display: none; }
.shape-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(74px, 1fr)); gap: 5px; }
.shape-option { min-height: 70px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: #222; cursor: pointer; }
.shape-option.active { outline: 2px solid #2f6fdf; }
.shape-option svg { display: block; width: 100%; height: 43px; }
.shape-option span { display: block; font-size: 12px; line-height: 1.1; }
.b-fit { display: flex; flex-wrap: wrap; gap: 5px; }
.b-overflow { color: #b22525; font-size: 12px; font-weight: 700; }
.bubble-item:not(.on) textarea { min-height: 0; }
.b-opt { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--muted); flex-direction: row; }
.b-opt > :last-child { min-width: 0; width: 100%; }
.b-opt .row { display: flex; gap: 6px; align-items: center; }
.b-opt input[type=color] { width: 44px; height: 30px; padding: 2px; }
.b-checks { display: flex; gap: 14px; flex-wrap: wrap; padding-left: 118px; }
.b-add { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.b-add-label { font-size: 12px; font-weight: 700; color: var(--muted); margin-right: 2px; }

/* progreso del cómic */
.progress { flex: none; border-bottom: 1px solid var(--line); background: var(--panel); padding: 8px 12px 10px; }
.progress summary { cursor: pointer; font-family: var(--font-display); font-size: 13px; list-style: none; display: flex; align-items: center; gap: 6px; }
.progress summary::-webkit-details-marker { display: none; }
.progress summary::before { content: "▸"; font-family: Inter, sans-serif; }
.progress[open] summary::before { content: "▾"; }
#progressSum { margin-left: auto; font-family: Inter, sans-serif; font-weight: 700; letter-spacing: 0; background: var(--hi-soft); border: 1.5px solid #d9b84a; border-radius: 99px; padding: 0 8px; }
.progress ol { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.progress li { display: flex; align-items: center; gap: 8px; min-height: 28px; font-size: 13px; color: var(--muted); }
.progress li .p-dot { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--pencil); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.progress li.ok { color: var(--ink); }
.progress li.ok .p-dot { background: var(--ink); color: var(--hi); border-color: var(--ink); }
.progress li.next { color: var(--ink); font-weight: 700; }
.progress li.next .p-dot { background: var(--hi); border: 1px solid var(--line); }

.progress .p-count { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 12px; }
.progress li.next button { margin-left: 6px; min-height: 26px; padding: 2px 10px; font-size: 12px; }
.progress li.next .p-count + button { margin-left: 6px; }
.progress li.next:not(:has(.p-count)) button { margin-left: auto; }

/* diálogos: un solo botón rojo por diálogo, miniaturas y opciones con el estilo de tinta */
.btnlike { display: inline-flex; align-items: center; justify-content: center; }
.btnlike.ghost { background: var(--paper); color: var(--ink); border: 1px solid var(--pencil); box-shadow: none; font-weight: 500; }
.btnlike.ghost:hover { border-color: var(--ink); background: var(--card); box-shadow: 0 1px 3px rgba(18,18,18,.10); }
.cand .x { min-height: 0; padding: 0 6px; border: 0; border-radius: 3px; background: rgba(15,26,33,.75); color: #fff; box-shadow: none; font-weight: 700; line-height: 20px; }
.cand .x:hover:not(:disabled) { transform: none; box-shadow: none; background: var(--danger); }
.engine-opt { border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.engine-opt:has(input:checked) { border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(18,18,18,.10); }
.gen-box { background: var(--bg); border: 1.5px dashed var(--pencil); border-radius: var(--radius); }
.dlg pre { background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius); }
.audit-issue { background: var(--paper); border-radius: var(--radius); }
.audit-summary { background: var(--paper); border: 1.5px solid var(--line); }
.import-preview { background: var(--paper); border-width: 1.5px; }
#scriptImport .btnlike.ghost { align-self: flex-start; }
.auto-why { margin: 8px 0 0; font-size: 13px; line-height: 1.45; color: var(--ink); }
.mix-save { margin-top: 2px; }
.mix-save input { flex: 1; min-width: 160px; }
.saved-card .style-body .row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

.styles-create { border-top: 1.5px dashed var(--line); }
.styles-create textarea { width: 100%; }
.styles-grid { max-height: 38vh; }
.style-card .tag { margin-left: auto; }

/* ================================================================ reorganización: áreas Cómic · Recursos · Editor · Ajustes */
body { display: block; overflow: hidden; }
.app { display: grid; grid-template-columns: 84px minmax(0, 1fr); height: 100vh; }
.area { display: none; min-width: 0; min-height: 0; flex-direction: column; background: var(--bg); }
body[data-area="comic"] #areaComic, body[data-area="resources"] #areaResources,
body[data-area="admin"] #areaAdmin, body[data-area="editor"] #areaEditor, body[data-area="settings"] #areaSettings, body[data-area="script"] #areaScript { display: flex; }
body:not([data-area]) #areaComic { display: flex; }

/* barra de áreas */
.rail { background: var(--ink); color: var(--paper); display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 12px 8px; }
.rail-brand { font-family: var(--font-brand); font-size: 30px; text-align: center; letter-spacing: .02em; color: var(--paper); margin-bottom: 8px; line-height: 1; }
.rail-brand span { color: var(--accent); }
.rail-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 4px; min-height: 58px; background: transparent; color: #dce8ee;
  border: 2px solid transparent; box-shadow: none; font-size: 12px; font-weight: 600; white-space: normal; }
.rail-btn:hover:not(:disabled) { transform: none; box-shadow: none; border-color: #4f6877; background: #1d2e38; }
.rail-btn.on { background: var(--hi); color: var(--ink); border-color: var(--paper); }
.rail-ico { width: 22px; height: 22px; display: block; }
.rail .rail-pill { white-space: normal; font-size: 12px; max-width: none; text-align: center; padding: 4px; }
.rail-logout { background: transparent; color: #dce8ee; border-color: #4f6877; }
.rail :focus-visible { outline-color: var(--hi); }

/* cabecera de cada área */
.area-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 18px; background: var(--panel); border-bottom: 1px solid var(--line); }
.area-title { font-size: 20px; margin-right: 6px; }
.area-sub { color: var(--muted); font-size: 13px; }
.head-title { display: grid; gap: 2px; min-width: 0; flex: 1 1 280px; }
.head-title .tb-pop-wrap { justify-self: start; max-width: 100%; }
.head-title .comic-menu-btn { border: 0; background: transparent; padding: 0 4px; min-height: 30px; margin-left: -4px; }
.head-title .comic-menu-btn:hover:not(:disabled) { box-shadow: none; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.head-title .area-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.area-head .comic-menu-btn { font-family: var(--font-display); font-weight: 400; font-size: 20px; max-width: 100%; }

/* área Cómic: progreso y mosaico */
.comic-body { flex: 1; min-height: 0; overflow: auto; display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; padding: 18px 22px 40px; align-items: start; }
.progress-panel { position: sticky; top: 0; background: var(--panel); border: 1px solid var(--pencil); border-radius: var(--radius); padding: 14px 16px; }
.progress-panel h2 { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.progress-panel ol { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.progress-next { margin-top: 10px; }
.mosaic { display: grid; gap: 26px; min-width: 0; }
.mo-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.mo-head h2 { font-size: 16px; background: linear-gradient(transparent 58%, var(--hi) 58%, var(--hi) 92%, transparent 92%); padding: 0 3px; }
.mo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.mo-tile { position: relative; background: var(--paper); border: 1px solid var(--pencil); border-radius: var(--radius); display: flex; flex-direction: column; transition: border-color .1s; }
.mo-tile:hover { border-color: var(--ink); }
.mo-tile.current { border: 1px solid var(--line); box-shadow: 0 0 0 3px var(--hi), 0 12px 32px rgba(18,18,18,.14); }
.mo-open { display: block; padding: 0; border: 0; border-bottom: 1px solid var(--pencil); border-radius: 2px 2px 0 0; background: #fff; box-shadow: none; aspect-ratio: 2 / 3; overflow: hidden; }
.mo-open:hover:not(:disabled) { transform: none; box-shadow: none; filter: brightness(.97); }
.mo-open img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mo-hole { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px; text-align: center;
  color: var(--muted); background: repeating-linear-gradient(45deg, var(--panel) 0 10px, var(--bg) 10px 20px); font-weight: 600; font-size: 13px; }
.mo-hole small { font-weight: 400; font-size: 12px; }
.mo-info { padding: 8px 10px 10px; display: grid; gap: 5px; min-width: 0; }
.mo-title { display: flex; gap: 6px; align-items: baseline; min-width: 0; }
.mo-title b { font-family: var(--font-display); font-weight: 400; font-size: 16px; }
.mo-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.mo-note { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mo-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.mo-menu { position: absolute; top: 6px; right: 6px; min-height: 28px; padding: 0 8px; background: var(--paper); }
.mo-add { aspect-ratio: 2 / 3; border: 2px dashed var(--pencil); background: transparent; color: var(--muted); box-shadow: none; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; font-weight: 600; }
.mo-add span { font-size: 34px; line-height: 1; }
.mo-add:hover:not(:disabled) { transform: none; box-shadow: none; border-color: var(--ink); color: var(--ink); background: var(--paper); }

/* insignias de estado: texto e icono, no solo color */
.badge { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 99px;
  border: 1px solid var(--pencil); background: var(--paper); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: #e2f1d6; border-color: #6c9f4b; color: #1f4d0c; }
.badge.warn { background: var(--hi-soft); border-color: #c9a02d; color: #4d3a00; }
.badge.st-hole { border-style: dashed; color: var(--muted); }
.badge.st-busy { background: #e6eefc; border-color: #7d9fd8; color: #173f86; }
.badge.st-generated { background: var(--card); border-color: var(--ink); color: var(--ink); }

/* área Recursos */
#bibleRes > .res-body { flex: 1; min-height: 0; overflow: auto; padding: 14px 22px 40px; }
#resSearch { width: 280px; }
.res-kinds { margin-bottom: 14px; }
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.res-wide { grid-column: 1 / -1; }
.res-card { background: var(--paper); border: 1px solid var(--pencil); border-radius: var(--radius); display: flex; flex-direction: column; min-width: 0; transition: border-color .1s; }
.res-card:hover { border-color: var(--ink); }
.res-pic { padding: 0; border: 0; border-bottom: 1px solid var(--pencil); border-radius: 2px 2px 0 0; background: #fff; box-shadow: none; aspect-ratio: 4 / 3; overflow: hidden; display: block; }
.res-pic:hover:not(:disabled) { transform: none; box-shadow: none; filter: brightness(.97); }
.res-pic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.res-noimg { height: 100%; display: grid; place-items: center; font-size: 46px; color: var(--pencil); background: repeating-linear-gradient(45deg, var(--panel) 0 10px, var(--bg) 10px 20px); }
.res-card .res-body { padding: 10px; display: grid; gap: 6px; min-width: 0; overflow: visible; }
.res-card .row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.res-card .tag { margin-left: auto; font-size: 12px; background: var(--bg); border-radius: 99px; padding: 1px 8px; }
.res-desc { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* área Editor */
#areaEditor { overflow: hidden; }
.editor-bar { display: flex; align-items: center; gap: 8px; padding: 7px 12px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; min-height: 48px; }
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; min-width: 0; }
.crumb { background: transparent; border: 0; box-shadow: none; padding: 3px 4px; min-height: 0; color: var(--ink); font-weight: 600; font-size: 14px; }
button.crumb:hover:not(:disabled) { transform: none; box-shadow: none; text-decoration: underline; }
.crumb-page { font-family: var(--font-display); font-weight: 400; font-size: 14px; }
.crumb-title { font-family: Inter, sans-serif; font-weight: 600; }
.crumb-sep { color: var(--muted); }
.crumbs .badge { margin-left: 4px; }
.save-state { font-size: 12px; font-weight: 600; color: var(--muted); padding: 2px 8px; border-radius: 99px; border: 1.5px solid transparent; }
.save-state[data-state="pending"] { color: #5a4300; border-color: #d9b84a; background: var(--hi-soft); }
.save-state[data-state="saved"] { color: #1f4d0c; }
.save-state[data-state="error"] { color: var(--danger); border-color: #e0a59a; background: #fdebe7; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; border-radius: 0; box-shadow: none; background: var(--paper); color: var(--ink); font-weight: 600; min-height: 32px; padding: 4px 12px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-selected="true"] { background: var(--hi); }
.seg button:hover:not(:disabled) { transform: none; box-shadow: none; }
#editorLayout.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 0 minmax(0, 1fr) 360px; }
.script-col { display: none; }
.inspector-col { min-height: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--panel); }
.inspector-col > .inspector { flex: 1; min-height: 0; overflow-y: auto; border: 0; }
.workspace { flex-direction: row; min-height: 0; }
.pagebar { width: 190px; overflow-y: auto; }
.pb-head { font-family: var(--font-display); font-size: 13px; color: var(--muted); margin-top: 2px; }
.pb-danger { margin-top: 10px; padding-top: 10px; border-top: 1.5px dashed var(--line); }
.pb-danger button { width: 100%; }
.stage-wrap { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.stage-tools { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-bottom: 1.5px solid var(--line); background: var(--panel); }
.zoom-label { font-size: 12px; font-weight: 600; min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }
#panelsToggleBtn { margin-left: auto; }
body.panels-hidden .pagebar, body.panels-hidden .inspector-col, body.panels-hidden .script-col { display: none !important; }
body.panels-hidden #editorLayout.layout { grid-template-columns: 0 minmax(0, 1fr) 0; }
.stage { justify-content: safe center; align-items: safe center; }

/* área Ajustes */
.settings-grid { flex: 1; overflow: auto; padding: 18px 22px 40px; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; align-content: start; }
.set-card { background: var(--paper); border: 1px solid var(--pencil); border-radius: var(--radius); padding: 16px; display: grid; gap: 10px; }
.set-card h3 { margin: 0; font-size: 16px; }
.set-card .row { display: flex; gap: 6px; }
.set-card .row select { flex: 1; min-width: 0; }
.set-card input#styleCustom { width: 100%; }

/* pantallas estrechas: la barra de áreas pasa abajo y las columnas se apilan */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .rail { order: 2; flex-direction: row; padding: 6px; overflow-x: auto; }
  .rail-brand, .rail .spacer { display: none; }
  .rail-btn { flex: 1; min-height: 50px; }
  .comic-body { grid-template-columns: 1fr; padding: 12px; }
  .progress-panel { position: static; }
  #editorLayout.layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(60vh, 1fr) auto; overflow: auto; }
  .workspace { flex-direction: column; }
  .pagebar { width: auto; flex-direction: row; flex-wrap: wrap; }
  .inspector-col { border-left: 0; border-top: 1px solid var(--line); }
  .area-head, .editor-bar { padding: 8px 10px; }
  #resSearch { width: 100%; }
}

/* ================================================================ editor: dos vistas sobre la misma página */
#editorLayout.layout { grid-template-columns: minmax(0, 1fr) 360px; }
body[data-view="script"] #editorLayout.layout { grid-template-columns: minmax(460px, 1.15fr) minmax(0, 1fr); }
body[data-view="script"] .script-col { display: flex; }
body[data-view="script"] .inspector-col, body[data-view="script"] .pagebar { display: none; }
body.panels-hidden #editorLayout.layout { grid-template-columns: minmax(0, 1fr); }
.script-col { flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; padding: 12px 14px 40px; background: var(--panel); border-right: 1px solid var(--line); }
.sc-head { display: flex; align-items: center; gap: 6px; position: sticky; top: -12px; z-index: 3; background: var(--panel); padding: 6px 0; border-bottom: 1.5px dashed var(--line); }
.sc-head h2 { font-size: 14px; }
.sc-gen { background: var(--paper); border: 1px solid var(--pencil); border-radius: var(--radius); padding: 10px; display: grid; gap: 8px; }
.sc-gen .row { display: flex; gap: 8px; flex-wrap: wrap; }
.sc-adv summary, .sc-lib summary, .ver-archive summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.sc-adv[open], .sc-lib[open] { display: grid; gap: 8px; }
.sc-card { background: var(--paper); border: 1px solid var(--pencil); border-radius: var(--radius); padding: 10px; display: grid; gap: 8px; }
.sc-card.on { border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(18,18,18,.10); }
.sc-card-head { display: flex; align-items: center; gap: 8px; }
.sc-card-head select { max-width: 170px; }
.sc-card-body { display: grid; grid-template-columns: minmax(0, 1fr) 132px; gap: 10px; }
.sc-main { display: grid; gap: 6px; min-width: 0; }
.sc-main textarea { width: 100%; }
.sc-side { display: grid; gap: 6px; align-content: start; }
.sc-thumb { padding: 0; border: 1px solid var(--line); background: #fff; box-shadow: none; aspect-ratio: 1; overflow: hidden; position: relative; }
.sc-thumb:hover:not(:disabled) { transform: none; box-shadow: none; }
.sc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sc-thumb small { position: absolute; left: 4px; bottom: 4px; background: var(--paper); padding: 0 4px; font-size: 12px; }
.sc-noimg { aspect-ratio: 1; display: grid; place-items: center; border: 1.5px dashed var(--pencil); color: var(--muted); font-size: 12px; text-align: center; padding: 6px; }
.sc-side button { white-space: normal; }
.sc-texts { display: grid; gap: 4px; }
.sc-text { display: grid; grid-template-columns: 88px 1fr; align-items: center; gap: 6px; flex-direction: row; font-size: 12px; }
.sc-text input { width: 100%; }
.sc-texts .row { display: flex; gap: 6px; }
.sc-res { display: grid; gap: 8px; border-top: 1.5px dashed var(--line); padding-top: 12px; }
.sc-res h3 { font-size: 14px; margin: 0; }
.sc-res-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 240px; overflow: auto; }
.sc-lib input { width: 100%; }

/* menciones y referencias visuales */
.mention-line { display: flex; flex-wrap: wrap; gap: 4px; }
.chip.mchip { cursor: pointer; box-shadow: none; font-weight: 600; color: var(--ink); min-height: 26px; }
.chip.mchip:hover:not(:disabled) { transform: none; box-shadow: none; border-color: var(--ink); }
.chip.mchip.noimg { border-style: dashed; }
.chip.mchip.unknown { border-color: var(--danger); color: var(--danger); background: #fdebe7; }
.chip.mchip small { font-weight: 400; }
.refs { display: grid; gap: 4px; }
.refs-head { font-size: 13px; }
.refs-list { display: grid; gap: 4px; }
.ref { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: var(--radius); border: 1.5px solid var(--line); background: var(--card); font-size: 13px; }
.ref img, .ref-noimg { width: 30px; height: 30px; object-fit: cover; border-radius: 2px; flex: none; display: grid; place-items: center; background: var(--bg); }
.ref-name { display: grid; flex: 1; min-width: 0; font-weight: 600; }
.ref-name small { font-weight: 400; color: var(--muted); }
.ref-sent { border-color: #6c9f4b; }
.ref-sent .ref-name small { color: #1f4d0c; }
.ref-limit, .ref-skipped { opacity: .85; border-style: dashed; }
.ref button { min-height: 26px; padding: 2px 8px; }

/* inspector: cabecera y pestañas */
.insp-head { display: grid; gap: 6px; padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.insp-head .row { display: flex; align-items: center; gap: 6px; }
.insp-head h3 { margin: 0; }
.scope-note { margin: 0; font-size: 12px; color: var(--muted); }
.insp-tabs { display: flex; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.insp-tabs button { flex: 1; border: 0; border-radius: 0; box-shadow: none; background: var(--paper); color: var(--ink); font-weight: 600; min-height: 34px; padding: 4px 6px; font-size: 13px; }
.insp-tabs button + button { border-left: 1px solid var(--line); }
.insp-tabs button.on { background: var(--hi); }
.insp-tabs button:hover:not(:disabled) { transform: none; box-shadow: none; }

/* versiones */
.ver-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ver { border: 1px solid var(--pencil); border-radius: var(--radius); padding: 6px; display: grid; gap: 6px; background: var(--card); }
.ver.in-use { border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(18,18,18,.10); }
.ver.approved { border-color: #4f8a2a; }
.ver .row { display: flex; gap: 4px; flex-wrap: wrap; }
.ver .row button { padding: 2px 8px; min-height: 26px; font-size: 12px; }
.ver-pic { padding: 0; border: 0; box-shadow: none; background: var(--bg); aspect-ratio: 1; overflow: hidden; }
.ver-pic:hover:not(:disabled) { transform: none; box-shadow: none; filter: brightness(.96); }
.ver-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ver-archive { margin-top: 6px; }
.ver-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.ver-row img { width: 54px; height: 54px; object-fit: cover; border: 1.5px solid var(--line); opacity: .75; }
.cmp { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.cmp figure { margin: 0; display: grid; gap: 6px; }
.cmp img { width: 100%; max-height: 60vh; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.cmp figcaption { font-weight: 700; text-align: center; }

/* selector de composición */
.lp-dlg { width: min(1080px, 96vw); }
.lp-special { display: flex; gap: 8px; flex-wrap: wrap; }
.lp-filters { display: grid; gap: 6px; }
.lp-flabel { font-size: 12px; font-weight: 700; color: var(--muted); align-self: center; margin-right: 4px; }
.lp-body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 14px; min-height: 0; }
.lp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; max-height: 52vh; overflow: auto; padding: 4px; align-content: start; }
.lp-item { display: grid; gap: 3px; padding: 6px; background: var(--paper); color: var(--ink); border: 1px solid var(--pencil); box-shadow: none; font-weight: 600; font-size: 12px; white-space: normal; text-align: center; }
.lp-item:hover:not(:disabled) { transform: none; box-shadow: none; border-color: var(--ink); }
.lp-item.on { border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(18,18,18,.10); }
.lp-item.current small { font-weight: 700; color: var(--ink); }
.lp-item small { font-weight: 400; color: var(--muted); }
.lp-svg { width: 100%; aspect-ratio: 2 / 3; display: block; }
.lp-preview { display: grid; gap: 6px; align-content: start; }
.lp-big { width: 100%; aspect-ratio: 2 / 3; border: 1px solid var(--line); }
.lp-note { margin: 0; font-size: 13px; line-height: 1.45; padding: 6px 8px; border-radius: var(--radius); background: var(--paper); border: 1.5px solid var(--line); }
.lp-note.warn { background: var(--hi-soft); border-color: #c9a02d; }

/* ================================================================ progreso, exportación, repartir guion */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.progress-panel #progressSum { margin-left: auto; font-family: Inter, sans-serif; letter-spacing: 0; text-transform: none; font-size: 12px; font-weight: 700;
  background: var(--hi-soft); border: 1.5px solid #d9b84a; border-radius: 99px; padding: 0 8px; }
.progress-panel #progressNote { margin: 6px 0 0; }
.progress-panel li { display: flex; gap: 8px; align-items: flex-start; }
.progress-panel .p-dot { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--pencil); display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-top: 1px; }
.progress-panel li.ok .p-dot { background: var(--ink); color: var(--hi); border-color: var(--ink); }
.progress-panel .p-main { display: grid; gap: 1px; min-width: 0; flex: 1; }
.progress-panel .p-row { display: flex; align-items: baseline; gap: 6px; }
.progress-panel .p-opt { color: var(--muted); font-size: 12px; border: 1px dashed var(--pencil); border-radius: 99px; padding: 0 6px; }
.progress-panel .p-count { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px; }
.progress-panel .p-what { color: var(--muted); font-size: 12px; line-height: 1.35; }
.progress-panel li.optional b { font-weight: 600; }
.progress-next { border-top: 1.5px dashed var(--line); padding-top: 10px; display: grid; gap: 8px; }
.p-next-msg { margin: 0; font-size: 13px; line-height: 1.45; }
.progress-next .row { display: flex; gap: 6px; flex-wrap: wrap; }

.ex-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ex-preset { display: grid; gap: 4px; text-align: left; white-space: normal; background: var(--paper); color: var(--ink); border: 1px solid var(--pencil); box-shadow: none; font-weight: 400; padding: 10px; }
.ex-preset b { font-size: 14px; }
.ex-preset small { color: var(--muted); line-height: 1.4; }
.ex-preset:hover:not(:disabled) { transform: none; box-shadow: none; border-color: var(--ink); }
.ex-preset.on { border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(18,18,18,.10); }
.ex-summary { background: var(--paper); border: 1px solid var(--pencil); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; }
.ex-summary ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.ex-summary li.warn { color: #5a4300; }

.script-preview { display: grid; gap: 8px; max-height: 34vh; overflow: auto; background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 10px; }
.script-preview p { margin: 0; }
.sp-list { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 6px; }
.sp-list li { display: grid; grid-template-columns: auto auto 1fr; gap: 4px 8px; align-items: baseline; font-size: 13px; border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
.sp-list li small { grid-column: 1 / -1; color: var(--ink-2); }
.sp-text { min-width: 0; }

/* columna de página: textos largos sin cortar */
.pagebar { overflow-x: hidden; }
.pagebar button { white-space: normal; line-height: 1.25; }

.progress-panel #progressSum { white-space: nowrap; }
.progress-panel h2 { flex-wrap: wrap; }

/* importar: análisis con IA */
.ai-import { display: grid; gap: 8px; background: var(--paper); border: 1.5px dashed var(--pencil); border-radius: var(--radius); padding: 8px 10px; }
.ai-import .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ai-result { font-size: 13px; }
.ai-result p { margin: 0 0 6px; }
.ai-result ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; }
.ai-doubts-title { font-weight: 700; color: #5a4300; }

/* Ajustes: estilo actual */
.style-current { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; align-items: start; }
.style-current img, .style-noimg { width: 110px; aspect-ratio: 3 / 4; object-fit: cover; border: 1px solid var(--line); border-radius: 2px; background: var(--bg); }
.style-noimg { display: grid; place-items: center; align-content: center; gap: 8px; font-size: 34px; padding: 6px; box-sizing: border-box; }
.style-noimg button { font-size: 12px; padding: 3px 6px; white-space: normal; line-height: 1.2; }
.style-cur-text { display: grid; gap: 4px; min-width: 0; }
.style-cur-text b { font-family: var(--font-display); font-weight: 400; font-size: 16px; }
.style-cur-text small { color: var(--ink-2); line-height: 1.4; }
.style-cur-text .tag { justify-self: start; font-size: 12px; background: var(--hi-soft); border: 1.5px solid #d9b84a; border-radius: 99px; padding: 0 8px; }
.style-extra { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-top: 1px dashed var(--line); padding-top: 6px; }
.set-style #stylesBtn { justify-self: start; }
.style-basic summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.style-basic[open] { display: grid; gap: 8px; }

.set-card { align-content: start; }

.ai-hint { margin-top: 6px; color: var(--ink-2); font-size: 13px; }

/* mosaico: arrastrar páginas */
.mo-tile[draggable="true"] { cursor: grab; }
.mo-tile.dragging { opacity: .45; }
.mo-tile.drop-here { box-shadow: -6px 0 0 var(--accent); }
.mo-add.drop-here, .mo-head.drop-here { outline: 3px dashed var(--accent); outline-offset: 3px; }

/* Recursos: selección múltiple y borrado en bloque */
.res-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: -4px 0 14px; }
.res-bar button.on { background: var(--hi); border-color: var(--ink); }
.res-count { font-weight: 700; font-size: 13px; }
.res-card { position: relative; }
.res-card.selected { border-color: var(--ink); box-shadow: 0 0 0 4px var(--accent); }
.res-check { position: absolute; top: 8px; left: 8px; z-index: 2; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; display: flex; }
.res-check input { width: 20px; height: 20px; }
.bulk-mentions { display: grid; gap: 6px; }
.bulk-mentions .engine-opt small { display: block; }
button.danger-solid { background: var(--danger); color: #fff; border-color: var(--ink); }
.sc-res .row { display: flex; align-items: center; gap: 8px; }

/* prerecursos y editar zona de recursos */
.frag-box { display: grid; gap: 6px; }
.frag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.frag { display: flex; flex-direction: row; align-items: center; gap: 6px; padding: 4px 8px 4px 4px; border: 1.5px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: var(--ink); font-weight: 600; font-size: 13px; cursor: pointer; }
.frag.on { border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(18,18,18,.10); }
.frag img, .frag .ref-noimg { width: 34px; height: 34px; object-fit: cover; border-radius: 2px; }
.frag small { font-weight: 400; color: var(--muted); }
.zone-area { position: relative; align-self: center; max-width: 100%; cursor: crosshair; user-select: none; touch-action: none; }
.zone-area img { display: block; max-width: 100%; max-height: 58vh; border: 1px solid var(--line); }
.zone-mark { position: absolute; border: 3px dashed #ff3b30; background: rgba(255, 59, 48, .15); pointer-events: none; }

/* ================================================================ modo lectura */
.reader { position: fixed; inset: 0; z-index: 200; display: grid; grid-template-columns: 250px minmax(0, 1fr); background: #0f1a21; color: #dfe9ee; }
.reader[hidden] { display: none; }
.reader.no-index { grid-template-columns: minmax(0, 1fr); }
.reader.no-index .rd-index { display: none; }
.rd-index { overflow-y: auto; padding: 14px 10px 30px; border-right: 2px solid #2c3e49; background: #15222b; }
.rd-comic { font-family: var(--font-brand); font-size: 20px; letter-spacing: .03em; margin: 0 6px 12px; color: var(--hi); }
.rd-sec { margin-bottom: 12px; }
.rd-sec-title { width: 100%; text-align: left; background: transparent; border: 0; box-shadow: none; color: #dfe9ee; font-family: var(--font-display);
  font-weight: 400; font-size: 13px; padding: 6px; min-height: 0; }
.rd-sec-title:hover:not(:disabled) { transform: none; box-shadow: none; color: var(--hi); }
.rd-sec ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.rd-page { width: 100%; display: flex; gap: 8px; align-items: baseline; text-align: left; background: transparent; border: 1.5px solid transparent; box-shadow: none;
  color: #c2d2db; font-weight: 500; font-size: 13px; padding: 5px 8px; min-height: 30px; white-space: normal; }
.rd-page:hover:not(:disabled) { transform: none; box-shadow: none; border-color: #3a4f5c; color: #fff; }
.rd-page b { font-family: var(--font-display); font-weight: 400; min-width: 24px; }
.rd-page span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-page.on { background: var(--hi); color: var(--ink); border-color: var(--hi); }
.rd-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.rd-top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid #2c3e49; flex-wrap: wrap; }
.rd-title { font-weight: 600; font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-count { font-variant-numeric: tabular-nums; font-size: 13px; color: #c2d2db; }
.rd-check { flex-direction: row; align-items: center; gap: 6px; color: #c2d2db; font-weight: 500; font-size: 12px; }
.rd-btn { background: transparent; color: #dfe9ee; border: 1.5px solid #3a4f5c; box-shadow: none; font-weight: 500; min-height: 32px; }
.rd-btn:hover:not(:disabled) { transform: none; box-shadow: none; border-color: var(--hi); color: #fff; }
.rd-stage { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; padding: 14px 70px; }
.rd-stage img { max-height: 100%; max-width: 100%; object-fit: contain; background: #fff; box-shadow: 0 0 0 2px #000, 8px 8px 0 #000; cursor: pointer; user-select: none; }
.rd-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 92px; font-size: 40px; line-height: 1; padding: 0;
  background: rgba(239, 230, 210, .08); color: #dfe9ee; border: 1.5px solid #3a4f5c; box-shadow: none; }
.rd-nav:hover:not(:disabled) { transform: translateY(-50%); background: var(--hi); color: var(--ink); box-shadow: none; }
/* conservar el centrado vertical al pulsar (el :active general lo sustituiría y el botón saltaría) */
.rd-nav:active:not(:disabled) { transform: translateY(-50%) scale(.97); }
.rd-nav:disabled { opacity: .25; background: transparent; }
.rd-nav.prev { left: 10px; }
.rd-nav.next { right: 10px; }
.reader:fullscreen .rd-top { opacity: .35; transition: opacity .2s; }
.reader:fullscreen .rd-top:hover { opacity: 1; }
@media (max-width: 900px) {
  .reader { grid-template-columns: minmax(0, 1fr); }
  .rd-index { display: none; }
  .rd-stage { padding: 8px 40px; }
  .rd-nav { width: 34px; height: 70px; font-size: 30px; }
}

.pb-label { font-size: 12px; }
.pb-label select { width: 100%; }

/* sincronización entre instalaciones */
#syncDlg .dlg { width: 820px; max-width: 100%; box-sizing: border-box; }
.sync-table td:first-child { min-width: 140px; }
.sync-conn { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px 12px; align-items: end; margin: 10px 0; }
.sync-conn #syncConnState { grid-column: 1 / -1; }
.sync-progress { padding: 8px 10px; border-radius: var(--radius); background: var(--bg); margin: 8px 0; font-size: 13px; }
.sync-progress.error { background: #fbe3df; color: #8a2a1c; }
.sync-progress.done { background: #e3f1e2; color: #24572a; }
.sync-table { max-height: 46vh; overflow: auto; }
.sync-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sync-table th, .sync-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.sync-table th { font-weight: 600; font-size: 12px; color: var(--muted); }
.sync-actions { white-space: nowrap; text-align: right; }
.sync-actions button + button { margin-left: 6px; }
.sync-badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; background: var(--bg); }
.sync-badge.ok { background: #e3f1e2; color: #24572a; }
.sync-badge.up { background: #e2ecf7; color: #1f4a78; }
.sync-badge.down { background: #e8eef2; color: #6d4f12; }
.sync-badge.warn { background: #fbe3df; color: #8a2a1c; }
.sync-host { margin-top: 12px; }
.sync-host summary { cursor: pointer; font-weight: 600; font-size: 13px; }
#syncNewToken { flex: 1; min-width: 220px; font-family: monospace; font-size: 12px; }

/* capas de la viñeta */
.layer-list { display: flex; flex-direction: column; gap: 2px; margin: 6px 0; }
.layer-row { display: grid; grid-template-columns: auto 14px 1fr auto; gap: 8px; align-items: center; padding: 4px 6px; border-radius: var(--radius); cursor: pointer; }
.layer-row:hover { background: var(--hi-soft); }
.layer-row small { color: var(--muted); font-size: 12px; }
.layer-sw { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--ink); }
.layer-sw.bg { background: repeating-linear-gradient(45deg, #c3d3dc 0 3px, var(--paper) 3px 6px); }
.layer-name { font-weight: 600; }
.layer-edit { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.layer-edit .row select { flex: 1; min-width: 0; }
.layers-busy { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.row.wrap { flex-wrap: wrap; gap: 6px; }

/* negrita y cursiva en el texto del bocadillo */
.b-text { display: grid; grid-template-columns: 1fr auto; gap: 4px; align-items: start; }
.b-fmt { display: flex; flex-direction: column; gap: 3px; }
.b-fmt button { width: 28px; padding: 2px 0; font-family: Georgia, serif; }

/* continuidad de la escena */
.ref-scene img { object-fit: cover; } .ref-scene-mode { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; min-width: 0; } .ref-scene-mode select { font-size: 12px; padding: 2px 4px; min-width: 0; max-width: 100%; } .ref-scene-mode select[aria-label="Referencia de escenario"] { flex: 1 1 0; }
.ref-stage { margin: 6px 0 0; }
.ref-actions { display: grid; gap: 4px; }
.zoom-pick { display: grid; gap: 4px; margin: 6px 0 0; }
.zoom-grid { position: relative; width: 100%; max-width: 260px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.zoom-grid img { display: block; width: 100%; height: auto; }
.zoom-grid .zcell { position: absolute; width: 33.333%; height: 33.333%; padding: 0; border: 1px dashed rgba(255, 255, 255, .75); border-radius: 0; background: transparent; box-shadow: none; cursor: pointer; }
.zoom-grid .zcell:hover { background: rgba(255, 210, 31, .25); }
.zoom-grid .zcell.box { background: rgba(255, 210, 31, .2); }
.zoom-grid .zcell.on { background: rgba(208, 49, 31, .35); border: 2px solid var(--hi); }
.ref-note { display: grid; gap: 3px; margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.ref-note input { font-size: 13px; }

/* motor local */
#localEngineDlg .dlg { width: 820px; max-width: 100%; box-sizing: border-box; }
.le-steps { margin: 4px 0 4px 18px; font-size: 13px; }
.le-status { padding: 8px 10px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px; }
.le-catalog { display: flex; flex-direction: column; gap: 8px; }
.le-model { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.le-model.on { border-color: var(--ink); }
.le-state { font-size: 13px; margin-top: 4px; display: flex; gap: 8px; align-items: center; }
.le-state progress { width: 160px; }
.le-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.le-setup:empty { display: none; }
.le-setup { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.le-comfy { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.le-err { color: #8a2a1c; font-size: 13px; margin: 0; }
.le-log pre { max-height: 220px; overflow: auto; font-size: 12px; white-space: pre-wrap; background: var(--bg); padding: 6px; border-radius: var(--radius); }
.le-adv { margin-top: 10px; font-size: 13px; }
.le-adv summary { cursor: pointer; color: var(--muted); }
#leToken { flex: 1; min-width: 220px; font-family: monospace; font-size: 12px; }

/* imágenes del recurso: soltar aquí */
#assetDlg.dropping .dlg { outline: 3px dashed var(--sel); outline-offset: -8px; }
.a-drop-hint { display: block; margin-top: -4px; }

/* memoria de continuidad */
#contDlg .dlg { width: 900px; max-width: 100%; box-sizing: border-box; }
.cont-head { gap: 10px; align-items: center; }
.cont-rels { display: flex; flex-direction: column; gap: 6px; }
.cont-rel { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: center; }
.cont-scenes { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow: auto; }
.cont-scene { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; background: var(--paper); }
.cont-scene.empty { opacity: .8; }
.cont-scene > summary { cursor: pointer; font-size: 14px; }
.cont-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 10px; margin: 8px 0; }
.cont-fields label, .cont-notes label { font-size: 12px; display: grid; gap: 2px; }
.cont-notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px 10px; margin-top: 6px; }
.cont-sub > summary { cursor: pointer; font-size: 13px; color: var(--muted); }

/* capas: guardar como recurso */
.layer-row { grid-template-columns: auto 14px 1fr auto auto; }
.layer-save { padding: 1px 8px; font-size: 12px; }

/* editar zona con referencia de otra viñeta */
.edit-ref { display: flex; gap: 8px; align-items: center; margin: 6px 0; padding: 6px; border: 1px dashed var(--line); border-radius: var(--radius); }
.edit-ref img { width: 64px; height: 64px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
#editRefDlg .zone-area img { max-height: 60vh; }

/* movimiento reducido: solo fundidos, sin desplazamientos ni escalas */
@media (prefers-reduced-motion: reduce) {
  dialog[open], .popup-menu, .tb-popover, .toast { animation-name: fade-in; }
}

/* adaptador de libros por pasos */
/* área Guion */
.script-body { flex: 1; min-height: 0; overflow: auto; padding: 18px 22px 30px; }
.script-pane { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.script-pane[hidden] { display: none; }
#scriptImport #importText { min-height: 40vh; }
#scriptImport .import-preview { max-height: none; }
.script-pane.adapt { min-height: 100%; }
.script-pane.adapt .ad-body { max-height: none; overflow: visible; }
.linklike { background: none; border: 0; box-shadow: none; padding: 0; min-height: 0; color: var(--ink); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.linklike:hover:not(:disabled) { transform: none; box-shadow: none; }
.ad-badge { margin-left: 6px; font-weight: 700; }
.imp-view { display: grid; gap: 10px; align-content: start; }
.imp-view[hidden] { display: none; }
.imp-view > .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.imp-view .spacer { flex: 1; }
#spendPill.warn { background: var(--danger, #c0392b); color: #fff; border-color: var(--danger, #c0392b); }
#falBalance.warn { color: var(--danger, #c0392b); font-weight: 600; }
/* administración (solo el administrador) */
body:not(.is-admin) .admin-only { display: none !important; }
.admin-grid { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
.adm-users-card { grid-column: 1 / -1; }
.adm-table-wrap { overflow-x: auto; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm-table th, .adm-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.adm-table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.adm-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.adm-table tr.off td { opacity: .5; }
.adm-badge { display: inline-block; padding: 1px 6px; border-radius: 999px; font-size: 11px; border: 1px solid var(--line); }
.adm-badge.admin { background: var(--hi-soft, #fff3c4); border-color: var(--ink); }
.adm-badge.suspended { background: #fde2e1; border-color: #b42318; color: #b42318; }
.adm-link { display: flex; gap: 6px; align-items: center; padding: 8px; border: 1px dashed var(--pencil); border-radius: var(--radius); background: var(--paper); }
.adm-link input { flex: 1; font-family: ui-monospace, monospace; font-size: 12px; }
.adm-credits { width: 760px; max-width: 100%; }
.adm-credits .row { flex-wrap: wrap; gap: 6px; }
.adm-credits #admCreditsEur { width: 110px; }
.adm-credits #admCreditsNote { flex: 1; min-width: 160px; }
.adm-credits .adm-table-wrap { max-height: 50vh; overflow: auto; margin-top: 10px; }
.adm-table td.pos { color: #2e6b3a; }
.adm-table td.neg { color: #9a3412; }
#spendPill.credits { background: var(--paper); }
.adm-list { display: grid; gap: 4px; font-size: 13px; }
.adm-list .row { justify-content: space-between; }
.b-style { grid-column: 1 / -1; display: grid; gap: 6px; padding: 6px 0; border-top: 1px dashed var(--line); }
.b-style input[type="color"] { width: 38px; height: 26px; padding: 0 2px; }
.b-style input[type="color"]:disabled { opacity: 0.35; }
.style-imgs { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 4px 0; }
.style-thumbs { display: inline-flex; gap: 6px; }
.style-thumbs img { width: 52px; height: 52px; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; }
#styleCreateBtn { margin-top: 6px; }
.imp-view button:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.mock-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 22px; }
.mock-page { margin: 0; display: grid; gap: 6px; }
.mock-svg { width: 100%; height: auto; display: block; background: #fff; border: 1px solid var(--pencil); box-shadow: 0 1px 3px rgba(18,18,18,.10); }
.mock-page figcaption { font-size: 13px; color: var(--ink-2); }
.rail-btn.busy { position: relative; }
.rail-btn.busy::after { content: ""; position: absolute; top: 8px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--hi); box-shadow: 0 0 0 2px var(--ink); }
.ad-steps { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.ad-step { background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--ink); }
.ad-step.on { border-color: var(--ink); background: var(--hi-soft); font-weight: 600; }
.ad-step.ok { color: #2e6b3a; }
.ad-step.stale { color: #9a6700; }
.ad-step.run { color: var(--muted); font-style: italic; }
.ad-body { max-height: 62vh; overflow: auto; padding-right: 4px; display: grid; gap: 8px; align-content: start; }
.ad-body h4 { margin: 10px 0 2px; font-size: 14px; }
.ad-body textarea { width: 100%; box-sizing: border-box; font-size: 13px; }
.ad-running { background: #fff7e0; border: 1px solid #e6c870; border-radius: var(--radius); padding: 8px 10px; font-size: 13px; }
.ad-error { color: #b42318; margin: 0; }
.ad-stale { color: #9a6700; margin: 0; font-size: 13px; }
.ad-ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; font-size: 13px; }
.ad-table { display: grid; gap: 6px; }
.ad-row { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; align-items: start; border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
.ad-id { font-size: 12px; color: var(--muted); padding-top: 6px; min-width: 28px; }
.ad-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.ad-cols input { min-width: 0; font-size: 13px; }
.ad-cols .w2 { grid-column: span 2; } .ad-cols .w3 { grid-column: span 3; } .ad-cols .w4 { grid-column: 1 / -1; }
.ad-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ad-form label { display: grid; gap: 3px; font-size: 13px; }
.ad-form label.check { display: flex; align-items: center; }
.ad-form .w2 { grid-column: 1 / -1; }
.ad-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ad-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; display: grid; gap: 4px; background: var(--paper); }
.adapt .row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ad-card .row { gap: 4px; flex-wrap: nowrap; }
.ad-card .row > label { flex-direction: row; align-items: center; gap: 3px; flex: none; }
.ad-card, .ad-page, .ad-card input, .ad-page input { min-width: 0; }
.ad-body { overflow-x: hidden; }
.ad-card .grow, .ad-page .grow { flex: 1; min-width: 0; }
.ad-name { width: 130px; flex: none; font-weight: 600; }
.ad-h { width: 60px; }
.ad-pre { white-space: pre-wrap; font-size: 12px; background: var(--paper); padding: 6px 8px; border-radius: var(--radius); margin: 0; }
.ad-pages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ad-page { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; display: grid; gap: 4px; background: var(--paper); }
.ad-chapter { font-size: 12px; font-weight: 600; color: var(--ink); }
.ad-feedback { display: grid; gap: 4px; background: var(--bg); padding: 8px; border-radius: var(--radius); font-size: 13px; }
.ad-feedback button { justify-self: start; }
.ad-next { display: flex; justify-content: flex-end; }
.ad-list { display: grid; gap: 4px; font-size: 13px; }
.ad-title { width: 360px; }
.ad-batches { display: grid; gap: 6px; }
.ad-batch { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; background: var(--paper); }
.ad-batch summary { cursor: pointer; list-style: none; }
.ad-batch summary .row { display: inline-flex; gap: 8px; align-items: center; }
.ad-tag { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--paper); }
.ad-tag.ok { color: #2e6b3a; } .ad-tag.stale { color: #9a6700; }
.ad-pg { margin-top: 8px; display: grid; gap: 4px; font-size: 13px; }
.ad-pn { border-left: 3px solid var(--line); padding-left: 8px; }
.ad-pn small { color: var(--muted); }
.ad-txt { font-style: italic; color: #444; }
.ad-out { display: grid; gap: 6px; font-size: 13px; }
.ad-model-l { flex-direction: row; align-items: center; gap: 4px; font-weight: 400; }
.ad-model { font-size: 12px; padding: 2px 4px; }
.ad-feedback .ad-model-l { justify-self: start; }
/* Galería de siluetas originales agrupadas por uso. */
.shape-families { display: grid; gap: 12px; }
.shape-family h5 { margin: 0 0 5px; font-size: 12px; color: var(--muted); }
.shape-hint { margin: 0; font-size: 12px; line-height: 1.4; color: var(--muted); }
.shape-option:focus-visible { outline: 3px solid #2f6fdf; outline-offset: 2px; }
.shape-family { margin: 0; padding: 0; border: 0; }

/* libro ilustrado: pestaña «Texto» del inspector y vista de doble página */
.book-lang { display: flex; flex-direction: column; gap: 3px; }
.book-lang small { color: var(--muted); font-size: 12px; }
.book-lang textarea, .book-lang input { width: 100%; font-family: "CS crimson", Georgia, serif; font-size: 15px; line-height: 1.35; }
.book-block h3 { margin: 0; font-size: 14px; }
#bookWarnings .warn { margin: 0; color: #b03a2e; font-size: 13px; }
.spreads { display: flex; flex-direction: column; gap: 22px; max-height: 72vh; overflow: auto; padding: 4px; }
.spread { display: grid; grid-template-columns: 1fr 1fr; gap: 0; max-width: 400px; margin: 0 auto; box-shadow: 0 2px 10px rgb(0 0 0 / .18); }
.spread button { border: 0; padding: 0; background: #fff; cursor: pointer; position: relative; aspect-ratio: 2 / 3; }
.spread button img { width: 100%; height: 100%; display: block; }
.spread button.blank { cursor: default; background: #e3eaee; }
.spread button.warned { outline: 3px solid #d4a017; outline-offset: -3px; }
.spread-notes { max-width: 400px; margin: 6px auto 0; font-size: 13px; color: #b03a2e; }
.spread-notes p { margin: 2px 0; }
.spread-label { text-align: center; font-size: 12px; color: var(--muted); margin-top: 4px; }
.ex-book h4 { margin: 8px 0 4px; font-size: 14px; }
.ex-preflight { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; font-size: 13px; max-height: 190px; overflow: auto; }
.ex-preflight .pf-ok { color: #2e7d32; }
.ex-preflight .pf-aviso { color: #9a6a00; }
.ex-preflight .pf-error { color: #b03a2e; }
.inspector p.warn { color: #b03a2e; margin: 0; }

/* Apariencia (theme.js): selector de paleta y modo */
.theme-sub { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-sw { display: grid; gap: 4px; justify-items: center; padding: 6px; min-height: 0; background: var(--card); color: var(--ink); border: 1px solid var(--pencil); box-shadow: none; font-size: 12px; }
.theme-sw:hover:not(:disabled) { border-color: var(--ink); }
.theme-sw[aria-pressed="true"], .theme-modes button[aria-pressed="true"] { border-color: var(--ink); box-shadow: var(--shadow-ink); background: var(--hi-soft); }
.theme-chip { display: flex; gap: 3px; align-items: center; padding: 6px; width: 100%; border-radius: 2px; border: 1px solid var(--pencil); }
.theme-chip i { flex: 1; height: 22px; border-radius: 2px; border: 1px solid rgba(0,0,0,.2); }
.theme-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* modo oscuro: lo que el CSS fija en claro */
:root[data-mode="dark"] .rail { background: #070b0e; }
:root[data-mode="dark"] .rail-btn.on { color: #0f1a21; }
:root[data-mode="dark"] button:disabled { border-color: var(--line); color: var(--muted); }
:root[data-mode="dark"] button.ghost:hover:not(:disabled), :root[data-mode="dark"] .btnlike.ghost:hover { background: var(--panel); }
:root[data-mode="dark"] button.ghost.danger { border-color: #7a3a32; }
:root[data-mode="dark"] button.ghost.danger:hover:not(:disabled) { background: #3a1d19; }
:root[data-mode="dark"] .pill.ok, :root[data-mode="dark"] .badge.ok, :root[data-mode="dark"] .sync-progress.done, :root[data-mode="dark"] .sync-badge.ok { background: #1f3a1b; color: #b9e6a3; border-color: #4f8a2a; }
:root[data-mode="dark"] .pill.warn, :root[data-mode="dark"] .badge.warn, :root[data-mode="dark"] #spendPill, :root[data-mode="dark"] .save-state[data-state="pending"],
:root[data-mode="dark"] #progressSum, :root[data-mode="dark"] .style-cur-text .tag, :root[data-mode="dark"] .lp-note.warn { background: var(--hi-soft); color: #ffe27a; border-color: #8a7020; }
:root[data-mode="dark"] .ai-doubts-title, :root[data-mode="dark"] .ex-summary li.warn { color: #ffe27a; }
:root[data-mode="dark"] .pill.bad, :root[data-mode="dark"] .sync-progress.error, :root[data-mode="dark"] .sync-badge.warn, :root[data-mode="dark"] .chip.mchip.unknown, :root[data-mode="dark"] .save-state[data-state="error"] { background: #3a1d19; color: #ffb4a8; border-color: #7a3a32; }
:root[data-mode="dark"] .badge.st-busy, :root[data-mode="dark"] .sync-badge.up { background: #1c2c4a; color: #a9c6ff; border-color: #3f5f9c; }
:root[data-mode="dark"] .sync-badge.down { background: #3a2f17; color: #e9cf94; }
:root[data-mode="dark"] .save-state[data-state="saved"] { color: #b9e6a3; }
:root[data-mode="dark"] .edit-zone { background: #3a1d19; }
:root[data-mode="dark"] .layout-zone { background: #1c2c4a; }
:root[data-mode="dark"] .ad-running { background: #3a2f17; border-color: #8a7020; }
:root[data-mode="dark"] .ad-txt { color: var(--ink-2); }
:root[data-mode="dark"] #delComicBtn:hover { background: #3a1d19; border-color: #7a3a32; }
:root[data-mode="dark"] .popup-menu button.danger, :root[data-mode="dark"] #delInfo .warn, :root[data-mode="dark"] .b-overflow, :root[data-mode="dark"] .le-err, :root[data-mode="dark"] .ad-error,
:root[data-mode="dark"] #bookWarnings .warn, :root[data-mode="dark"] .spread-notes, :root[data-mode="dark"] .inspector p.warn, :root[data-mode="dark"] .ex-preflight .pf-error { color: #ff9c8e; }
:root[data-mode="dark"] .ad-stale, :root[data-mode="dark"] .ad-step.stale, :root[data-mode="dark"] .ad-tag.stale, :root[data-mode="dark"] .ex-preflight .pf-aviso { color: #e6b84a; }
:root[data-mode="dark"] .ad-step.ok, :root[data-mode="dark"] .ad-tag.ok, :root[data-mode="dark"] .ex-preflight .pf-ok { color: #8fd18a; }
:root[data-mode="dark"] .spread button.blank { background: #1f2a31; }
:root[data-mode="dark"] .layer-sw.bg { background: repeating-linear-gradient(45deg, var(--pencil) 0 3px, var(--paper) 3px 6px); }

/* libro ilustrado: composición de la prosa (capitular, sangrías, títulos, separadores) */
.para-tools { display: flex; flex-direction: column; gap: 8px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.para-tools .hint { margin: 0; }
.para-tools code { font-size: 12px; word-break: break-word; }
.bt-head { gap: 6px; }
.bt-head .pill { font-size: 11px; padding: 1px 8px; border-radius: 99px; background: var(--hi-soft); border: 1.5px solid #d9b84a; color: #5a4300; }
.bt-seg button { min-height: 28px; padding: 2px 10px; font-size: 13px; }
.bt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; }
.bt-grid > label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; min-width: 0; }
.bt-grid select, .bt-grid input[type="number"] { width: 100%; min-width: 0; }
.bt-grid input[type="color"] { width: 44px; height: 28px; padding: 0; }
.bt-sub { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; padding-top: 4px; border-top: 1px dashed var(--line); }
.bt-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; flex-direction: row !important; }
.bt-checks { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.bt-details > summary, .bt-drop-box > summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.bt-details[open], .bt-drop-box[open] { display: flex; flex-direction: column; gap: 8px; }
.bt-drop-box { padding: 6px 8px; border-left: 3px solid #d9b84a; background: var(--hi-soft); border-radius: 2px; }
#pageSvg .bt-pick { cursor: pointer; }
#pageSvg .bt-drop:hover { opacity: 0.8; }
:root[data-mode="dark"] .bt-head .pill { background: #3a3110; color: #f5dd8a; border-color: #7a6420; }
:root[data-mode="dark"] .bt-drop-box { background: #2c2610; }
.b-prose { display: flex; flex-direction: column; gap: 6px; margin: 4px 0; }

/* ================================================================== editor en columnas
   [iconos de página] [columna de la viñeta + panel flotante] [hoja] [bocadillos | edición] */
#editorLayout.ed-layout { display: grid; grid-template-columns: 48px var(--vcol-w, 290px) minmax(0, 1fr) var(--scol-w, 320px); min-height: 0; }
body.vc-folded #editorLayout.ed-layout { --vcol-w: 0px; }
body.sc-folded #editorLayout.ed-layout { --scol-w: 0px; }
body.pp-open #editorLayout.ed-layout { --vcol-w: 290px; }          /* el panel ocupa el sitio de la columna, aunque esté plegada */
body.pp-script #editorLayout.ed-layout { --vcol-w: 480px; }        /* el guion de página es más ancho para escribir */
body.sc-folded .inspector-col { display: none; }
body.vc-folded:not(.pp-open) .vcol-wrap { display: none; }
#editorLayout > .pagecol { grid-column: 1; } #editorLayout > .vcol-wrap { grid-column: 2; } #editorLayout > .workspace { grid-column: 3; } #editorLayout > .inspector-col { grid-column: 4; }
#editorLayout > * { grid-row: 1; min-width: 0; }

/* columna de página: solo iconos */
.pagecol { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 0; min-height: 0; }
.pagecol .spacer { flex: 1; }
.pc-btn { position: relative; width: 36px; height: 36px; min-width: 0; min-height: 0; padding: 0; display: grid; place-items: center;
  background: transparent; color: var(--ink); border: 1.5px solid transparent; box-shadow: none; }
.pc-btn svg { width: 22px; height: 22px; display: block; }
.pc-btn:hover:not(:disabled) { transform: none; box-shadow: none; background: var(--paper); border-color: var(--pencil); }
.pc-btn.pc-key { background: var(--paper); border-color: var(--ink); }
.pc-btn[aria-expanded="true"] { background: var(--hi); color: #111; border-color: var(--ink); box-shadow: 0 1px 3px rgba(18,18,18,.10); }
.pc-btn:disabled { background: transparent; border-color: transparent; color: var(--pencil); }
.pc-count { position: absolute; top: -6px; right: -7px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff;
  border: 1px solid var(--line); font-size: 11px; font-weight: 700; line-height: 15px; text-align: center; }

/* columna de la viñeta y panel flotante */
.vcol-wrap { position: relative; min-height: 0; min-width: 0; background: var(--panel); border-right: 1px solid var(--line); }
.vcol { height: 100%; overflow-y: auto; padding: 10px 12px 40px; display: flex; flex-direction: column; gap: 10px; }
.vcol > * { flex-shrink: 0; }
.pp { position: absolute; z-index: 30; left: 0; right: 8px; top: var(--pp-top, 8px); max-height: calc(100% - var(--pp-top, 8px) - 8px);
  display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-left-width: 0;
  border-radius: 0 var(--radius) var(--radius) 0; box-shadow: 0 12px 32px rgba(18,18,18,.14); }
.pp[hidden] { display: none; }
.pp-sec { display: flex; flex-direction: column; gap: 9px; padding: 10px 12px 12px; min-height: 0; overflow-y: auto; }
.pp-sec[hidden] { display: none; }
.pp-head { display: flex; align-items: center; gap: 8px; position: sticky; top: -10px; background: var(--paper); margin: -10px -12px 0; padding: 8px 8px 8px 12px; border-bottom: 1.5px solid var(--line); z-index: 1; }
.pp-head h3 { margin: 0; font-size: 17px; }
.pp-x { min-width: 30px; }
.pp-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pp-foot { display: flex; flex-direction: column; gap: 8px; border-top: 1.5px dashed var(--line); padding-top: 10px; }
.pp-foot .row { display: flex; gap: 6px; align-items: center; }
.pp-label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.pp-current { margin: 0; font-size: 13px; color: var(--muted); }
.pp-current b { color: var(--ink); }
.pp-more summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.pp-more[open] { display: flex; flex-direction: column; gap: 6px; }

/* panel Páginas: miniaturas por sección */
.pp-pages { display: flex; flex-direction: column; gap: 10px; }
.pp-pages h4 { margin: 0 0 4px; font-family: var(--font-display); font-weight: 400; font-size: 13px; color: var(--muted); }
.pp-pgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pp-pg { padding: 0; min-height: 0; background: var(--card); color: var(--ink); border: 1.5px solid var(--line); box-shadow: none; display: flex; flex-direction: column; font-weight: 600; font-size: 12px; }
.pp-pg:hover:not(:disabled) { transform: none; border-color: var(--ink); box-shadow: 0 1px 3px rgba(18,18,18,.10); }
.pp-pg img, .pp-pg .pp-hole { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; display: block; background: #fff; }
.pp-pg .pp-hole { background: repeating-linear-gradient(45deg, var(--panel) 0 6px, var(--bg) 6px 12px); }
.pp-pg span { padding: 2px 0; }
.pp-pg.on { border: 1px solid var(--line); box-shadow: 0 0 0 3px var(--hi); }
.pp-pg.ok span { background: var(--hi-soft); }

/* panel Composición: rejilla de plantillas */
.pp-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.pp-chips button { min-height: 26px; padding: 2px 8px; font-size: 12px; background: var(--paper); color: var(--ink); border: 1px solid var(--pencil); box-shadow: none; font-weight: 600; }
.pp-chips button:hover:not(:disabled) { transform: none; box-shadow: none; border-color: var(--ink); }
.pp-chips button.on { background: var(--hi); color: #111; border-color: var(--ink); }
.pp-lgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.pp-lt { padding: 4px; min-height: 0; background: var(--card); border: 1.5px solid var(--line); box-shadow: none; display: flex; flex-direction: column; gap: 2px; color: var(--ink); font-weight: 500; font-size: 11px; }
.pp-lt:hover:not(:disabled) { transform: none; border-color: var(--ink); box-shadow: 0 1px 3px rgba(18,18,18,.10); }
.pp-lt svg { width: 100%; height: auto; display: block; }
.pp-lt.on { border: 1px solid var(--line); box-shadow: 0 0 0 3px var(--hi); }
.pp-lt span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pp-lt .lp-svg { width: 100%; }

/* panel Guion de página: las fichas de la vista de guion, dentro del panel */
#ppPanel .script-col { display: flex; flex-direction: column; gap: 10px; padding: 0; background: transparent; border: 0; overflow: visible; min-height: auto; }

/* panel Revisión */
#ppPanel .audit-results { display: flex; flex-direction: column; gap: 8px; }
#ppPanel .audit-issue textarea { font-size: 13px; }

/* columna de la viñeta: cabecera, imagen en uso y secciones plegables */
.vc-head { display: flex; align-items: center; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.vc-head h3 { margin: 0; font-size: 18px; white-space: nowrap; }
.vc-head .badge { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* referencias que se envían al modelo: compactas en la columna estrecha */
.vcol .ref, #scriptCol .ref { flex-wrap: wrap; gap: 4px 8px; }
.vcol .ref-name, #scriptCol .ref-name { flex: 1 1 150px; }
.vcol .ref-name, .vcol .ref-name small, #scriptCol .ref-name small { overflow-wrap: anywhere; }
#scriptCol .sc-main { grid-template-columns: minmax(0, 1fr); }
.vcol .ref > button { margin-left: 38px; }
.vcol .ref > button + button { margin-left: 0; }
.vcol .ref-scene-mode { flex-basis: 100%; }
.vcol .refs-head { font-size: 12px; }
.vc-img { position: relative; border: 1px solid var(--line); background: #f1ede4; display: grid; place-items: center; min-height: 120px; }
.vc-img img { width: 100%; max-height: 300px; object-fit: contain; display: block; background: #fff; }
.vc-img .vc-empty { color: #6b6455; font-size: 13px; padding: 30px 10px; text-align: center; }
.vc-img .vc-tag { position: absolute; left: 6px; top: 6px; background: var(--paper); color: var(--ink); border: 1px solid var(--line); font-size: 11px; font-weight: 700; padding: 1px 6px; }
.vc-sec { border-bottom: 1.5px dashed var(--line); padding-bottom: 10px; }
.vc-sec > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.vc-sec > summary::-webkit-details-marker { display: none; }
.vc-sec > summary::before { content: "▸"; font-size: 12px; color: var(--muted); width: 10px; }
.vc-sec[open] > summary::before { content: "▾"; }
.vc-sec > summary h2 { margin: 0; font-size: 15px; background: linear-gradient(transparent 58%, var(--hi) 58%, var(--hi) 92%, transparent 92%); padding: 0 3px; }
.vc-sec > summary small { color: var(--muted); font-weight: 500; }
.vc-body { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.vc-body .row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.vc-body .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.vc-body > section { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.vc-body > section > h2 { display: none; }
.vcol .gen-main { width: 100%; }
.vcol select, .vcol textarea, .vcol input:not([type=checkbox]):not([type=radio]):not([type=range]) { width: 100%; }

/* columna derecha: pestañas Bocadillos | Edición */
.side-tabs { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.side-tabs button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 0; box-shadow: none; background: var(--paper); color: var(--ink); font-weight: 600; min-height: 36px; padding: 4px 6px; font-size: 13px; }
.side-tabs button + button { border-left: 1px solid var(--line); }
.side-tabs button.on { background: var(--hi); color: #111; }
.side-tabs button:hover:not(:disabled) { transform: none; box-shadow: none; }
.side-tabs svg { width: 18px; height: 18px; }
.ed-tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.ed-tool { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; min-height: 0; background: var(--paper); color: var(--ink); border: 1.5px solid var(--line); box-shadow: none; font-size: 11px; font-weight: 600; line-height: 1.15; text-align: center; }
.ed-tool svg { width: 22px; height: 22px; }
.ed-tool:hover:not(:disabled) { transform: none; border-color: var(--ink); box-shadow: 0 1px 3px rgba(18,18,18,.10); }
.ed-tool.on { background: var(--hi); color: #111; border: 1px solid var(--line); }
.ed-tool:disabled { opacity: .45; }
.ed-empty { color: var(--muted); font-size: 13px; margin: 0; }
.place-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.place-row > span { color: var(--muted); }

/* generar con IA cuesta dinero: color propio en todas las paletas */
button.gen-ai:not(.ghost) { background: var(--ink); color: var(--paper); box-shadow: 0 1px 3px rgba(18,18,18,.10); }
button.gen-ai:not(.ghost):hover:not(:disabled) { box-shadow: 0 1px 3px rgba(18,18,18,.10); }
button.gen-ai:not(.ghost):disabled { background: var(--bg); color: #6b7e8a; box-shadow: none; }
button.ghost.gen-ai { border-color: var(--ink); }
button.ghost.gen-ai::before { content: "✦ "; color: var(--accent); }

/* barra de la hoja: plegar columnas */
.stage-tools .spacer { flex: 1; }
.stage-tools { flex-wrap: nowrap; overflow: hidden; gap: 4px; }
.stage-tools > * { flex-shrink: 0; white-space: nowrap; }
.stage-tools .spacer { flex-shrink: 1; min-width: 0; }
body.pp-script .stage-tools #zoomLabel { display: none; }
.fold-btn[aria-pressed="true"], #panelsToggleBtn[aria-pressed="true"] { background: var(--hi); color: #111; border-color: var(--ink); }

/* Leer en la barra de áreas: recuadrado */
.rail-btn.rail-read { border: 1.5px dashed #6f8d9c; }

/* ============================================================ ComicStudio 1.0: Biblia · Estudio · Robot · Lectura */
/* Biblia: tres pestañas; cada una ocupa el alto del área y se desplaza por dentro */
.bible-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.bible-pane > * { flex: none; }
#bibleRes > .res-body { flex: 1; }
#bibleArt, #bibleCont { overflow: auto; }
.res-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 22px; border-bottom: 1px solid var(--line); background: var(--panel); }
.art-tabs { margin: 14px 22px 0; align-self: flex-start; }
.art-pane .art-grid { flex: none; overflow: visible; padding-bottom: 8px; }
.art-pane[data-apane="style"] .art-grid { grid-template-columns: minmax(320px, 560px); }
#artStyleDock { padding: 0 22px 40px; }
#bibleCont { padding: 0 22px 40px; }
#bibleCont > dialog, #scriptAuto > dialog, #artStyleDock > dialog { max-width: 1100px; }
/* diálogos integrados en su pestaña (Continuidad, Automatizar, galería de estilos): sin marco de ventana */
dialog.docked { position: static; inset: auto; margin: 0; border: 0; box-shadow: none; background: transparent; width: 100%; max-width: 100%; animation: none; }
dialog.docked > .dlg { width: auto; padding: 18px 0 0; }
dialog.docked .dlg-actions > button[value="cancel"] { display: none; }
#scriptAuto > dialog.docked > .dlg { padding-top: 0; }
#stylesDlg.docked .styles-grid { max-height: none; }
/* barra lateral: las cinco áreas arriba; motor, gasto, ajustes y admin abajo, más discretos */
.rail .rail-btn.rail-small { min-height: 0; padding: 6px 4px; font-size: 11px; gap: 1px; }
.rail .rail-btn.rail-small .rail-ico { width: 18px; height: 18px; }
.rail .rail-engine { background: transparent; color: #dce8ee; border-color: #4f6877; }
.rail .rail-engine:hover:not(:disabled) { background: #1d2e38; }
.rail-ver { display: block; font-family: var(--font-ui, inherit); font-size: 10px; letter-spacing: .08em; color: #9fb4bf; margin-top: 2px; }
.rail-btn.on:hover:not(:disabled) { background: var(--hi); color: var(--ink); border-color: var(--paper); }

/* ---- Estudio (1.0): páginas a la izquierda, inspector único a la derecha (Página › Viñeta › Bocadillos · Edición) */
#editorLayout.ed-layout { grid-template-columns: 48px var(--vcol-w, 200px) minmax(0, 1fr) var(--scol-w, 340px); }
body.pp-open #editorLayout.ed-layout { --vcol-w: 290px; }
body.pp-script #editorLayout.ed-layout { --vcol-w: 480px; }
.pagenav { height: 100%; overflow-y: auto; }
.pagenav .pp-sec { overflow: visible; }
.pagenav .pp-x, #insPage .pp-x { display: none; }
.pagenav .pp-pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pagenav .pp-head { top: 0; }
.insp-levels { flex: none; display: flex; gap: 0; padding: 8px 8px 0; border-bottom: 1.5px solid var(--line); background: var(--panel); }
.insp-levels button { flex: 1 1 auto; min-width: 0; min-height: 34px; padding: 6px 8px; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: transparent; color: var(--muted); border: 1.5px solid transparent; border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; box-shadow: none; }
.insp-levels button:hover:not(:disabled) { transform: none; box-shadow: none; color: var(--ink); background: var(--paper); }
.insp-levels button[aria-selected="true"] { color: var(--ink); background: var(--paper); border-color: var(--line); margin-bottom: -1.5px; border-bottom: 1.5px solid var(--paper); }
.insp-levels button:disabled { color: var(--pencil); }
.inspector-col > .insp-pane { flex: 1; min-height: 0; overflow-y: auto; }
.inspector-col > .insp-pane[hidden] { display: none; }
.inspector-col > #panelCol { height: auto; }
#insPage { display: flex; flex-direction: column; gap: 4px; padding: 10px 0 40px; }
#insPage > .pp-sec { overflow: visible; border-top: 1.5px dashed var(--line); }
#insPage .pp-head { position: static; margin: 0 0 2px; padding: 0; border: 0; background: transparent; }
.ip-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 12px; }
.ip-head h3 { margin: 0; font-size: 17px; }
.ip-actions { padding: 6px 12px 10px; }
#insPage > * { flex: none; }

/* ============================================================ ComicStudio 1.0 · piel de la maqueta
   Plana y con filetes finos, como la maqueta del rediseño: sin sombras duras en los controles (solo la hoja y lo
   seleccionado), títulos en la fuente de la interfaz, amarillo para lo activo y verde azulado para lo que genera.
   Va al final a propósito: cambia el relieve de las secciones anteriores sin tocar su estructura. */
:root {
  font-size: 13px;
  --font-display: Inter, "Segoe UI", system-ui, sans-serif;
  --shadow-ink: 0 1px 3px rgba(18,18,18,.10);
  --shadow-float: 0 1px 3px rgba(18,18,18,.10);
  --radius-lg: 14px;
}

/* ---- controles */
button, .btnlike { border: 1px solid var(--ink); box-shadow: none; padding: 6px 12px; min-height: 32px;
  transition: background-color 120ms var(--ease-out), border-color 120ms var(--ease-out), filter 120ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  button:hover:not(:disabled), .btnlike:hover { transform: none; box-shadow: none; filter: brightness(.96); }
}
button:active:not(:disabled) { transform: none; box-shadow: none; filter: brightness(.92); }
button:disabled { border-color: var(--line); }
button.ghost, .btnlike.ghost { border: 1px solid var(--pencil); box-shadow: none; }
button.ghost:hover:not(:disabled), .btnlike.ghost:hover { border-color: var(--ink); background: var(--card); box-shadow: none; filter: none; }
button.ghost.danger:hover:not(:disabled) { box-shadow: none; }
button.small, .btnlike.small { min-height: 28px; padding: 4px 9px; font-size: 12px; }
button.ink, button.ink:hover:not(:disabled) { box-shadow: none; }
button.gen-ai:not(.ghost) { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
button.gen-ai:not(.ghost)::before { content: "✦ "; }
button.gen-ai:not(.ghost):hover:not(:disabled) { box-shadow: none; }
button.gen-ai:not(.ghost):disabled { background: var(--bg); color: var(--muted); }
button.ghost.gen-ai { border-color: var(--pencil); }
.icon-btn { display: inline-grid; place-items: center; width: 30px; min-width: 0; padding: 0; }
.icon-btn svg { width: 16px; height: 16px; display: block; }
input, select, textarea { border: 1px solid var(--pencil); background: var(--card); }
label { font-weight: 500; }
.pill { border-width: 1px; }
.badge { border-width: 1px; }

/* ---- títulos: sin fuente de rótulo ni subrayado de rotulador */
h2, h3, .area-head .comic-menu-btn, .mo-title b, .crumb-page, .b-num, .sec-group .sec-label, .pb-head,
.rd-sec-title, .rd-page b, .style-cur-text b, .pp-pages h4, .progress summary { font-family: inherit; font-weight: 700; letter-spacing: 0; }
h2 { font-size: 14px; }
h3 { font-size: 15px; margin: 0 0 6px; }
.set-card h3 { font-size: 14px; }
.inspector section > h2, .vc-sec > summary h2, #insPage .pp-head h3, .pp-pages h4, .progress-panel h2, .shape-family h5 {
  background: none; padding: 0; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.mo-head h2 { background: none; padding: 0; font-size: 13px; }
.mo-title b { font-size: 13px; }
.style-cur-text b { font-size: 14px; }
.vc-head h3, .ip-head h3, .pp-head h3 { font-size: 14px; }

/* ---- barra de áreas: clara, con filete */
.app { grid-template-columns: 76px minmax(0, 1fr); }
.rail, :root[data-mode="dark"] .rail { background: var(--rail, var(--panel)); color: var(--ink); border-right: 1px solid var(--pencil); gap: 6px; padding: 10px 8px; }
.rail-brand { color: var(--ink); font-size: 26px; margin-bottom: 6px; }
.rail-ver { color: var(--ink-2); }
.rail-btn { color: var(--ink); border: 1px solid transparent; border-radius: 4px; font-size: 11px; font-weight: 500; min-height: 50px; padding: 7px 2px 5px; gap: 3px; }
.rail-btn:hover:not(:disabled) { background: var(--paper); border-color: var(--pencil); filter: none; }
.rail-btn.on, .rail-btn.on:hover:not(:disabled), :root[data-mode="dark"] .rail-btn.on { background: var(--hi); color: #0f161a; border-color: var(--ink); font-weight: 600; }
.rail-ico { width: 20px; height: 20px; }
.rail-btn.rail-read { border: 1px solid transparent; }
.rail-btn.busy::after { box-shadow: 0 0 0 2px var(--rail, var(--panel)); background: var(--accent); }
.rail :focus-visible { outline-color: var(--sel); }
.rail-motor { display: grid; gap: 3px; padding: 6px 4px; border: 1px solid var(--pencil); border-radius: 4px; background: var(--paper); }
.rail-motor-label { display: grid; justify-items: center; gap: 1px; font-size: 11px; font-weight: 600; }
.rail-motor-label .rail-ico { width: 18px; height: 18px; }
.rail .rail-motor .rail-pill, .rail .rail-motor .rail-engine { min-height: 0; padding: 2px; border: 0; border-radius: 3px; background: transparent; color: var(--muted);
  font-size: 10.5px; font-weight: 500; line-height: 1.25; white-space: normal; overflow-wrap: anywhere; max-width: none; }
.rail .rail-motor .rail-pill:hover:not(:disabled) { background: var(--hi-soft); color: var(--ink); filter: none; }
.rail .rail-motor #spendPill { color: var(--ink); font-weight: 600; background: transparent; }
.rail .rail-motor #spendPill.warn { color: var(--danger); background: transparent; }
/* el código cambia las clases de estos dos botones (ok, warn, bad): aquí mandan por su sitio, no por su clase */
.rail-motor #statusPill, .rail-motor #spendPill, :root[data-mode="dark"] .rail-motor #spendPill { min-height: 0; max-width: none; padding: 2px; border: 0; border-radius: 3px; background: transparent;
  font-size: 10.5px; line-height: 1.25; white-space: normal; overflow: visible; overflow-wrap: anywhere; text-align: center; }
.rail-motor #statusPill { color: var(--muted); font-weight: 500; }
.rail-motor #statusPill.bad, .rail-motor #spendPill.warn { color: var(--danger); }
.rail-motor #spendPill { color: var(--ink); font-weight: 600; }
.rail-motor #statusPill:hover:not(:disabled), .rail-motor #spendPill:hover:not(:disabled) { background: var(--hi-soft); color: var(--ink); filter: none; }
.rail .rail-btn.rail-small { min-height: 0; border-radius: 4px; }
.rail-logout { background: transparent; color: var(--ink); border-color: var(--pencil); }

/* ---- cabeceras de área */
.area-head { padding: 10px 16px; border-bottom: 1px solid var(--line); }
.area-title { font-size: 20px; letter-spacing: -.01em; margin: 0; }
.area-head .comic-menu-btn { font-size: 15px; }
.tabs-head { align-items: flex-end; gap: 8px 24px; padding: 16px 24px 0; }
.tabs-head .head-title { flex: 1 1 320px; gap: 2px; padding-bottom: 12px; }
.tabs-head .head-title .area-sub { white-space: normal; }
.tabs-head > .seg { margin-left: auto; padding-bottom: 12px; }

/* ---- pestañas: botones sueltos; lo activo, en amarillo */
.seg { flex-wrap: wrap; align-items: center; gap: 6px; border: 0; border-radius: 0; overflow: visible; }
.seg button { border: 1px solid var(--pencil); border-radius: var(--radius); font-weight: 400; min-height: 32px; padding: 6px 12px; }
.seg button + button { border-left: 1px solid var(--pencil); }
.seg button:hover:not(:disabled) { border-color: var(--ink); filter: none; }
.seg button[aria-selected="true"] { background: var(--hi); border-color: var(--ink); font-weight: 600; color: #0f161a; }
.seg-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.seg-sep { width: 1px; align-self: stretch; margin: 0 6px; background: var(--pencil); }
/* pestañas principales de la Biblia: subrayadas, a la derecha del título */
.tabs-head > .line-tabs { gap: 4px; padding-bottom: 0; }
.line-tabs button { display: inline-flex; align-items: center; gap: 7px; min-height: 0; padding: 9px 14px; border: 0; border-bottom: 3px solid transparent; border-radius: 0;
  background: transparent; color: var(--ink-2); font-weight: 500; }
.line-tabs button + button { border-left: 0; }
.line-tabs button:hover:not(:disabled) { color: var(--ink); border-bottom-color: var(--pencil); }
.line-tabs button[aria-selected="true"] { background: transparent; color: var(--ink); font-weight: 700; border-bottom-color: var(--ink); }
.line-tabs svg { width: 16px; height: 16px; flex: none; }
.insp-tabs, .side-tabs { gap: 6px; border: 0; border-radius: 0; overflow: visible; }
.insp-tabs button, .side-tabs button { border: 1px solid var(--pencil); border-radius: var(--radius); font-weight: 400; min-height: 32px; }
.insp-tabs button + button, .side-tabs button + button { border-left: 1px solid var(--pencil); }
.insp-tabs button.on, .side-tabs button.on { background: var(--hi); border-color: var(--ink); font-weight: 600; color: #0f161a; }
.tabs button { border-width: 1px; }
.tabs button.on { font-weight: 600; }
/* grupo de botones que sustituye a un desplegable corto */
.chips-src { display: none !important; }
.chip-group { display: flex; flex-wrap: wrap; gap: 5px; }
.chip-opt { flex: 1 1 auto; min-height: 30px; padding: 5px 9px; background: var(--paper); color: var(--ink); border: 1px solid var(--pencil); font-weight: 400; font-size: 13px; white-space: nowrap; }
.chip-opt:hover:not(:disabled) { border-color: var(--ink); filter: none; }
.chip-opt.on { background: var(--hi); border-color: var(--ink); font-weight: 600; color: #0f161a; }
.pp-chips button { border-width: 1px; font-weight: 400; }
.pp-chips button.on { font-weight: 600; }

/* ---- tarjetas y paneles: filete fino; lo seleccionado, entintado */
.set-card, .res-card, .mo-tile, .sc-card, .bubble-item, .ver, .progress-panel, .auto-step, .cont-scene, .style-card, .ex-preset, .lp-item,
.engine-opt, .asset, .ref, .ai-import, .gen-box, .para-tools, .empty-card, .audit-summary, .import-preview, .script-preview, .ex-summary, .lp-note { border-width: 1px; }
.set-card, .res-card, .mo-tile, .sc-card, .progress-panel, .auto-step, .cont-scene, .style-card { border-color: var(--line); border-radius: var(--radius-lg); }
.res-card:hover, .mo-tile:hover { border-color: var(--pencil); }
.res-pic, .mo-open { border-bottom-width: 1px; border-bottom-color: var(--line); border-radius: 5px 5px 0 0; }
.mo-tile.current, .style-card.on, .ver.in-use, .sc-card.on, .bubble-item.on, .engine-opt:has(input:checked) { border: 1px solid var(--ink); box-shadow: var(--shadow-ink); }
.res-card.selected { border-color: var(--ink); box-shadow: 0 0 0 2px var(--sel); }
.lp-item.on, .ex-preset.on, .frag.on, .pp-lt.on { border: 1px solid var(--ink); background: var(--hi-soft); box-shadow: none; }
.cand.on { border: 1px solid var(--line); box-shadow: 0 0 0 2px var(--hi); }
.asset:hover, .page-tabs button:hover:not(:disabled), .pp-pg:hover:not(:disabled), .pp-lt:hover:not(:disabled), .ed-tool:hover:not(:disabled) { box-shadow: none; filter: none; }
.ed-tool { border-width: 1px; font-weight: 500; }
.ed-tool.on { border: 1px solid var(--ink); }
.pp-lt, .pp-pg, .frag, .theme-sw { border-width: 1px; }
.theme-sw[aria-pressed="true"], .theme-modes button[aria-pressed="true"] { box-shadow: none; }
.auto-total { border: 1px solid var(--ink); font-size: 14px; }
.b-num { border-width: 1px; font-size: 11px; }
.vc-img, .style-current img, .style-noimg, .lp-big, .cmp img, .zone-area img { border-width: 1px; }
.mock-svg { border: 1px solid var(--ink); box-shadow: none; }

/* ---- separadores: filete continuo en vez de trazo discontinuo */
.inspector section { border-bottom: 1px solid var(--line); }
.vc-sec { border-bottom: 1px solid var(--line); }
.b-opts, .progress-next, .sc-res, .styles-create, .pb-danger, .b-style, .style-extra, .bt-sub { border-top: 1px solid var(--line); }
.pp-foot { border-top: 1px solid var(--line); }
.sc-head { border-bottom: 1px solid var(--line); }
.vc-head, .insp-head { border-bottom: 1px solid var(--line); }
.pp-head { border-bottom: 1px solid var(--line); }

/* ---- ventanas y menús */
dialog { border: 1px solid var(--ink); box-shadow: var(--shadow-float); }
.popup-menu, .tb-popover, .mention-menu { border: 1px solid var(--ink); box-shadow: var(--shadow-float); }
.pp { border: 1px solid var(--ink); border-left-width: 0; box-shadow: var(--shadow-float); }
.toast, .job { box-shadow: none; }
.job { border-left-width: 4px; }

/* ---- Estudio: páginas · hoja · inspector */
.editor-bar { min-height: 44px; padding: 6px 16px; border-bottom: 1px solid var(--line); }
.crumb { font-weight: 500; font-size: 13px; }
.crumb-page { font-size: 13px; }
#editorLayout.ed-layout { grid-template-columns: var(--vcol-w, 204px) minmax(0, 1fr) var(--scol-w, 384px); }   /* inspector: 320 px + 20 % hacia el centro */
#editorLayout > .vcol-wrap { grid-column: 1; } #editorLayout > .workspace { grid-column: 2; } #editorLayout > .inspector-col { grid-column: 3; }
.vcol-wrap { border-right: 1px solid var(--line); }
.inspector-col { border-left: 1px solid var(--line); }
.inspector { border-left: 0; }
.stage { background-image: none; padding: 16px 28px 28px 20px; }
#pageSvg { border: 1px solid var(--ink); }
.stage-tools { border-bottom: 0; background: transparent; padding: 10px 14px 0; }
/* Lienzo | Estructura: selector de dos opciones; el mismo conmutador arriba de la columna izquierda en las dos vistas */
.view-switch { display: flex; gap: 4px; }
.vs-btn { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 0; padding: 6px 2px 4px; border-radius: 4px;
  background: var(--paper); color: var(--ink); border: 1px solid var(--pencil); font-size: 11px; font-weight: 400; }
.vs-btn svg { width: 16px; height: 16px; display: block; }
.vs-btn:hover:not(:disabled) { border-color: var(--ink); filter: none; }
.vs-btn[aria-pressed="true"] { background: var(--hi); border-color: var(--ink); font-weight: 600; color: #0f161a; }   /* selector de dos opciones: la vista actual resaltada */
/* lista de páginas: miniatura, título y estado en una fila */
.pagenav .pp-sec { padding: 12px 10px 14px; gap: 10px; }
.pagenav .pp-pgrid { grid-template-columns: minmax(0, 1fr); gap: 2px; }
.pp-pages { gap: 6px; }
.pp-pages h4 { margin: 8px 6px 4px; }
.pp-pg { flex-direction: row; align-items: center; gap: 9px; padding: 5px 6px; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 4px; font-weight: 500; font-size: 13px; }
.pp-pg:hover:not(:disabled) { background: var(--paper); border-color: var(--pencil); }
.pp-pg img, .pp-pg .pp-hole { flex: none; width: 26px; border: 1px solid var(--ink); }
.pp-pg .pp-pg-text { flex: 1 1 0; min-width: 0; display: grid; gap: 0; padding: 0; background: transparent; }
.pp-pg .pp-pg-text b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-pg .pp-pg-text small { font-size: 11.5px; font-weight: 400; color: var(--muted); }
.pp-pg.on { background: var(--hi-soft); border: 1px solid var(--ink); box-shadow: none; }
.pp-pg.on .pp-pg-text b { font-weight: 600; }
.pp-pg.ok span { background: transparent; }
/* inspector: la ruta de la selección (Página › Viñeta › Bocadillos) en vez de pestañas */
.insp-levels { align-items: center; gap: 2px; min-height: 44px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.insp-levels button { flex: 0 1 auto; min-height: 0; padding: 3px 8px; border: 0; border-radius: 3px; font-size: 13px; font-weight: 400; color: var(--ink); margin: 0; }
.insp-levels button + button { margin-left: 16px; position: relative; overflow: visible; }
.insp-levels button + button::before { content: "›"; position: absolute; left: -12px; top: 50%; transform: translateY(-52%); color: var(--muted); font-weight: 400; }
.insp-levels button:hover:not(:disabled) { background: var(--paper); filter: none; }
.insp-levels button[aria-selected="true"] { background: var(--hi); border: 0; margin-bottom: 0; font-weight: 600; color: #0f161a; }
.insp-here { padding: 3px 8px; border-radius: 3px; background: var(--hi); font-weight: 600; color: #0f161a; }
#insPage > .pp-sec { border-top: 1px solid var(--line); }
.ip-count { position: static; display: inline-block; border-width: 1px; }

/* ---- mosaico: una vista del Estudio (secciones · páginas · inspector del cómic) */
.comic-bar { min-height: 44px; padding: 6px 16px; }
.comic-bar .head-title { display: flex; align-items: baseline; gap: 12px; flex: 1 1 auto; }
.comic-body { display: grid; grid-template-columns: 204px minmax(0, 1fr) 320px; gap: 0; padding: 0; overflow: hidden; align-items: stretch; }
.comic-nav { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; padding: 12px 10px 14px; background: var(--panel); border-right: 1px solid var(--line); }
.mo-nav { display: grid; gap: 2px; }
.mo-nav-item { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-height: 0; padding: 6px; text-align: left; white-space: normal;
  background: transparent; color: var(--ink); border: 1px solid transparent; border-radius: 4px; font-weight: 500; }
.mo-nav-item:hover:not(:disabled) { background: var(--paper); border-color: var(--pencil); filter: none; }
.mo-nav-item small { color: var(--muted); font-weight: 400; }
.mosaic { min-height: 0; overflow: auto; padding: 18px 22px 40px; align-content: start; }
.mo-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 14px; }
.mo-add { border-width: 1px; border-radius: var(--radius-lg); font-weight: 500; }
.comic-insp { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; background: var(--panel); border-left: 1px solid var(--line); }
.comic-insp .insp-levels { flex: none; display: flex; }
.comic-insp .progress-panel { position: static; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; padding: 12px 14px; }
.comic-insp-actions { display: grid; gap: 8px; padding: 12px 14px; }

/* ---- Biblia y Robot */
.art-tabs { margin: 16px 24px 0; }
.settings-grid { padding: 16px 24px 32px; gap: 16px; }
.res-tools { padding: 10px 24px; }
#bibleRes > .res-body { padding: 16px 24px 40px; }
.res-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
#bibleCont { padding-left: 24px; padding-right: 24px; }
/* Estilo visual: galería de autores a la izquierda; a la derecha, el estilo del cómic, la mezcla y crear uno propio */
.art-style { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; padding: 16px 24px 40px; }
#artStyleDock { padding: 0; min-width: 0; }
#artStyleDock > dialog.docked > .dlg { padding: 0; }
.art-aside { display: grid; gap: 14px; position: sticky; top: 16px; min-width: 0; }
.art-aside > .styles-mix { display: grid; gap: 8px; padding: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.art-aside .mix-item { flex-wrap: wrap; }
.art-aside .mix-item b { min-width: 0; flex: 1 1 120px; }
.art-aside .mix-save { display: flex; flex-wrap: wrap; gap: 6px; }
.art-aside .mix-save input { flex: 1 1 100%; min-width: 0; }
.art-aside .mix-save button { flex: 1 1 auto; }
.art-aside .mix-sample { width: 100%; }
.art-aside .style-current { grid-template-columns: 84px minmax(0, 1fr); gap: 10px; }
.art-aside .style-current img, .art-aside .style-noimg { width: 84px; }
.styles-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.style-pic .redo-sample { border: 0; }
/* añadir un autor a la mezcla no genera nada: botón de papel, no del color de generar */
.style-card .style-body button:not(.ghost):not(.danger) { background: var(--paper); color: var(--ink); border: 1px solid var(--pencil); font-weight: 500; }
.style-card .style-body button:not(.ghost):not(.danger):hover:not(:disabled) { border-color: var(--ink); filter: none; }
.style-card.on .style-body button:not(.ghost):not(.danger) { background: var(--hi); border-color: var(--ink); font-weight: 600; }
/* Continuidad: mapa de escenas arriba; debajo, las fichas y las relaciones */
.cont-map { display: flex; gap: 4px; height: 46px; margin: 4px 0 0; }
.cont-seg { min-width: 18px; min-height: 0; padding: 0 6px; border: 2px solid transparent; border-radius: 3px; font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.cont-seg.empty { border: 2px dashed #ffffff; }
.cont-seg:hover:not(:disabled) { filter: brightness(1.08); }
.cont-legend { margin: 0; }
.cont-cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.cont-col { display: grid; gap: 8px; min-width: 0; }
.cont-col h4 { margin: 0; font-size: 14px; }
.cont-side { padding: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.cont-scenes { max-height: none; }
.cont-rel { grid-template-columns: minmax(0, 1fr) auto auto; }
@media (max-width: 1100px) { .art-style, .cont-cols { grid-template-columns: minmax(0, 1fr); } .art-aside { position: static; } }
.script-body { padding: 18px 24px 32px; }
.ad-step { border-color: var(--pencil); }
.ad-step.on { background: var(--hi); border-color: var(--ink); }

/* ---- pantallas estrechas */
@media (max-width: 900px) {
  .rail { border-right: 0; border-top: 1px solid var(--line); }
  .rail-motor { display: none; }
  .comic-body { grid-template-columns: 1fr; overflow: auto; }
  .comic-nav, .comic-insp { border: 0; }
  .inspector-col { border-top: 1px solid var(--line); }
}

/* ================================================================== ComicStudio 1.0 · inspector de la viñeta y de la página */
/* casilla «Página aprobada», al pie del inspector de la página */
.ip-approve { border-top: 1px solid var(--line); }
.ip-check { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--pencil); border-radius: var(--radius-lg); background: var(--paper); cursor: pointer; font-weight: 400; }
.ip-check:hover { border-color: var(--ink); }
.ip-check input { flex: none; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--ink); }
.ip-check-text { display: grid; gap: 2px; min-width: 0; }
.ip-check-text b { font-size: 13px; font-weight: 600; }
.ip-check-text small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.ip-check:has(input:checked) { border-color: var(--ink); box-shadow: var(--shadow-ink); }
.ip-check:has(input:disabled) { opacity: .55; cursor: not-allowed; }

/* qué generar: Boceto | Definitiva */
.gen-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.gen-mode button.on { background: var(--hi); border-color: var(--ink); font-weight: 600; color: #0f161a; }
.gen-main { width: 100%; min-height: 36px; }

/* diálogo rápido: tipo · texto · abrir en Bocadillos */
.sc-text { grid-template-columns: 62px minmax(0, 1fr) auto; }
.sc-text > span { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-text .icon-btn { width: 28px; min-height: 28px; }
.sc-card .sc-text { grid-template-columns: 78px minmax(0, 1fr) auto; }

/* versiones: una sola tira con definitivas y bocetos */
.ver-box { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ver-strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; }
.ver-thumb { position: relative; flex: 0 0 62px; display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-height: 0; padding: 3px; border: 1px solid var(--pencil); border-radius: 4px; background: var(--paper); color: var(--ink); font-weight: 400; }
.ver-thumb:hover:not(:disabled) { border-color: var(--ink); filter: none; }
.ver-thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; border-radius: 2px; background: var(--bg); }
.ver-thumb.sketch img { filter: saturate(.55); outline: 1px dashed var(--muted); outline-offset: -2px; }
.ver-thumb.on { border-color: var(--ink); box-shadow: var(--shadow-ink); }
.ver-cap { font-size: 10px; line-height: 1.15; text-align: center; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ver-thumb.on .ver-cap { color: var(--ink); font-weight: 600; }
.ver-flag { position: absolute; left: 3px; top: 3px; padding: 0 4px; border-radius: 2px; background: var(--hi); color: #0f161a; font-size: 9px; font-weight: 700; line-height: 14px; letter-spacing: .02em; }
.ver-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ver-actions b { flex: 1 0 100%; font-size: 12px; font-weight: 600; }
.ver-actions button { min-height: 28px; padding: 3px 9px; font-size: 12px; }

/* Biblia › Recursos: la rejilla a la izquierda y, a la derecha, la ficha del recurso elegido */
.bible-pane > .res-split { flex: 1; min-height: 0; display: flex; }
.res-split > .res-body { flex: 1 1 0; min-width: 0; min-height: 0; overflow: auto; padding: 16px 24px 40px; }
.res-sheet { flex: 0 0 420px; min-width: 0; min-height: 0; overflow-y: auto; border-left: 1px solid var(--line); background: var(--panel); }
.res-sheet[hidden] { display: none; }
#assetDlg.docked > .dlg { padding: 14px 16px 0; }
#assetDlg.docked .dlg-actions { position: sticky; bottom: 0; z-index: 1; margin: 4px -16px 0; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--panel); }
#assetDlg.docked .dlg-actions > button[value="cancel"] { display: inline-block; }
#assetDlg.docked .asset-images { grid-template-columns: repeat(3, 1fr); }
.res-card.open { border-color: var(--ink); box-shadow: var(--shadow-ink); }
@media (max-width: 1180px) { .res-sheet { flex-basis: 340px; } }
@media (max-width: 900px) {
  .bible-pane > .res-split { flex-direction: column; }
  .res-sheet { flex: none; max-height: 60vh; border-left: 0; border-top: 1px solid var(--line); }
}

/* Biblia › Rotulación: forma por defecto de cada familia de bocadillos */
.set-shapes .shape-families { gap: 14px; }
.set-shapes .shape-gallery { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.shape-option { border-color: var(--pencil); border-radius: 4px; font-weight: 400; }
.shape-option:hover:not(:disabled) { border-color: var(--ink); filter: none; }
.shape-option.active { outline: 0; border-color: #0f161a; box-shadow: 0 0 0 3px var(--hi); }
.shape-option.active span { font-weight: 600; }

/* Biblia › Página: medidas del papel a medida */
.paper-custom { display: grid; grid-template-columns: minmax(0, 130px) auto minmax(0, 130px); align-items: end; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg); }
.paper-custom[hidden] { display: none; }
.paper-custom .paper-x { padding-bottom: 7px; color: var(--muted); }
.paper-custom small { grid-column: 1 / -1; }

/* ficha lateral del recurso: los campos en dos columnas no desbordan el panel */
.res-sheet { overflow-x: hidden; }
#assetDlg.docked .row2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#assetDlg.docked .row2 > label, #assetDlg.docked input, #assetDlg.docked select, #assetDlg.docked textarea { min-width: 0; max-width: 100%; }

/* El cómic abierto vive en el logo: CS 1.0 y debajo el título; al pulsar se abre el menú de cómics */
.rail-brand-wrap { margin-bottom: 4px; }
.rail .rail-brand-btn { width: 100%; white-space: normal; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 2px 5px; min-height: 0; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--ink); }
.rail .rail-brand-btn:hover:not(:disabled) { border-color: var(--pencil); background: var(--hi-soft); filter: none; box-shadow: none; }
.rail .rail-brand-btn[aria-expanded="true"] { border-color: var(--ink); }
.rail-brand-btn .rail-brand { margin: 0; }
.rail-comic { display: block; white-space: normal; word-break: normal; max-width: 100%; font-family: var(--font-ui, inherit); font-size: 10.5px; font-weight: 600; line-height: 1.2; text-align: center; overflow-wrap: anywhere; hyphens: auto; }
.rail-brand-wrap .tb-popover { top: 0; left: calc(100% + 10px); }

/* Menú del cómic: lista y etiquetas */
.cm-tagbar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.cm-tagbar[hidden] { display: none; }
.cm-chip { display: inline-flex; align-items: center; gap: 4px; min-height: 0; padding: 2px 8px; border: 1px solid var(--pencil); border-radius: 999px; background: var(--paper); color: var(--ink); font-size: 11px; font-weight: 400; line-height: 1.4; }
button.cm-chip:hover:not(:disabled) { border-color: var(--ink); filter: none; box-shadow: none; }
.cm-chip.on { background: var(--hi); border-color: var(--ink); font-weight: 600; }
.cm-chip.tag { background: var(--hi-soft); }
.cm-x { min-height: 0; padding: 0 2px; border: 0; background: transparent; color: var(--muted); font-size: 13px; line-height: 1; }
.cm-x:hover:not(:disabled) { color: var(--danger); box-shadow: none; }
.cm-list { display: flex; flex-direction: column; gap: 2px; max-height: 40vh; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.cm-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 0; padding: 5px 8px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--ink); text-align: left; font-weight: 400; }
.cm-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-row small { color: var(--muted); flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.cm-row:hover:not(:disabled) { background: var(--hi-soft); filter: none; box-shadow: none; }
.cm-row.on { background: var(--hi); border-color: var(--ink); padding: 2px; }
#comicMenu .cm-title { border: 0; background: transparent; font-weight: 600; padding: 4px 6px; }
.cm-empty { color: var(--muted); padding: 6px 2px; }
.cm-tags-edit { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.cm-tags-label { font-size: 12px; color: var(--muted); }
.cm-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.cm-chips:empty { display: none; }

/* Deshacer / rehacer y aviso de guardado, en la columna izquierda (sustituyen a la franja superior) */
.rail-history { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.rail .rail-hbtn { flex: 1 1 0; min-height: 0; padding: 6px 0; display: flex; justify-content: center; }
.rail .rail-hbtn svg { width: 18px; height: 18px; }
.rail-save { flex: 1 1 100%; text-align: center; font-size: 10px; line-height: 1.2; color: var(--muted); }
.rail-save[data-state="saved"] { visibility: hidden; height: 0; }
.rail-save[data-state="error"] { color: var(--danger); font-weight: 600; }
.editor-bar[hidden], .comic-bar[hidden] { display: none; }

/* Biblia › Página: papel, sentido de lectura y separación en tres grupos, uno al lado del otro */
.art-pane[data-apane="page"] .art-grid { grid-template-columns: minmax(0, 1fr); }
.set-page { max-width: 1100px; }
.pg-cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.pg-group { display: grid; gap: 8px; align-content: start; min-width: 0; padding-left: 20px; border-left: 1px solid var(--line); }
.pg-group:first-child { padding-left: 0; border-left: 0; }
@media (max-width: 900px) {
  .pg-cols { grid-template-columns: minmax(0, 1fr); }
  .pg-group { padding-left: 0; border-left: 0; padding-top: 12px; border-top: 1px solid var(--line); }
  .pg-group:first-child { padding-top: 0; border-top: 0; }
}

/* Etiquetas: desplegable con las existentes */
.cm-combo { position: relative; }
.cm-combo input { width: 100%; padding-right: 30px; }
.cm-combo-btn { position: absolute; right: 2px; top: 2px; bottom: 2px; min-height: 0; width: 26px; padding: 0; border: 0; background: transparent; color: var(--muted); }
.cm-tagmenu { position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 5; max-height: 168px; overflow-y: auto; background: var(--paper); border: 1px solid var(--ink); border-radius: 4px; box-shadow: var(--shadow-float); padding: 3px; }
.cm-tagmenu[hidden] { display: none; }
.cm-opt { display: flex; justify-content: space-between; width: 100%; min-height: 0; padding: 5px 8px; border: 0; border-radius: 3px; background: transparent; color: var(--ink); text-align: left; font-weight: 400; }
.cm-opt small { color: var(--muted); }
.cm-opt:hover:not(:disabled) { background: var(--hi-soft); filter: none; box-shadow: none; }
.cm-opt-empty { padding: 6px 8px; color: var(--muted); font-size: 12px; }
/* en el diálogo de «Nuevo cómic» la lista empuja el contenido en vez de flotar (el diálogo no recorta) */
#comicDlg .cm-tagmenu { position: static; margin-top: 4px; box-shadow: none; max-height: 130px; }
#comicDlg .cm-tags-edit { margin-top: 0; }
/* Deshacer / rehacer: mismo aspecto haya o no cambios que deshacer (no se atenúan) */
.rail .rail-hbtn, .rail .rail-hbtn:disabled { opacity: 1; background: var(--paper); color: var(--ink); border: 1px solid var(--pencil); filter: none; }
.rail .rail-hbtn:hover:not(:disabled) { border-color: var(--ink); }
.rail .rail-hbtn:disabled { cursor: default; }

.rail-motor[hidden] { display: none; }

/* Mosaico: a la derecha, la composición de la página elegida */
.comic-insp .pp-sec { overflow: visible; padding: 14px; gap: 10px; }
.comic-insp .pp-head { position: static; margin: 0; padding: 0; border: 0; background: transparent; }
.comic-insp .pp-head h3 { font-size: 14px; }
.progress-panel[hidden] { display: none; }

/* mosaico: página reservada con el esquema de su composición */
.mo-wire { width: 100%; height: 100%; background: #fff; display: flex; }
.mo-wire-svg { width: 100%; height: 100%; display: block; }

/* Revisión: lupa a la derecha de cada página de la lista; abre el panel del auditor */
.pp-pg-row { position: relative; display: block; }
.pp-pg-row .pp-pg { width: 100%; padding-right: 36px; }
.pp-lupa { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); min-height: 0; width: 28px; height: 28px; padding: 0; display: grid; place-items: center;
  border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--muted); }
.pp-lupa svg { width: 16px; height: 16px; display: block; }
.pp-lupa:hover:not(:disabled) { color: var(--ink); background: var(--paper); border-color: var(--pencil); transform: translateY(-50%); box-shadow: none; filter: none; }
.pp-lupa.on { color: var(--ink); background: var(--hi); border-color: var(--ink); }
.pp-lupa.warn { color: var(--danger); }
.pp-lupa i { position: absolute; top: -4px; right: -4px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 99px; background: var(--danger); color: #fff; font: 600 10px/15px var(--font-ui, inherit); text-align: center; }
body.pp-audit #editorLayout.ed-layout { --vcol-w: 380px; }
#ppPanel .ip-approve { margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--line); }

/* estructura: icono para abrir la página en el lienzo, abajo a la derecha de su ficha */
.mo-go { position: absolute; right: 8px; bottom: 8px; min-height: 0; width: 30px; height: 30px; padding: 0; display: grid; place-items: center; border: 1px solid var(--pencil); border-radius: 4px; background: var(--paper); color: var(--ink); }
.mo-go svg { width: 17px; height: 17px; display: block; }
.mo-go:hover:not(:disabled) { background: var(--hi); border-color: var(--ink); transform: none; box-shadow: none; filter: none; }

/* plegables de composición: con el aspecto de los botones de arriba (icono + rótulo, borde fino, 28 px) y un chevron a la derecha */
.pp-fold > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; min-height: 28px; padding: 4px 8px; border: 1px solid var(--pencil); border-radius: var(--radius); background: var(--paper); color: var(--ink); font-size: 12.5px; font-weight: 500; }
.pp-fold > summary::-webkit-details-marker { display: none; }
.pp-fold > summary::after { content: "▾"; margin-left: auto; font-size: 11px; color: var(--muted); transition: transform .15s var(--ease-out); }
.pp-fold:not([open]) > summary::after { transform: rotate(-90deg); }
.pp-fold > summary:hover { border-color: var(--ink); }
.pp-fold[open] > summary { border-color: var(--ink); }
.pp-fold > summary svg, .fold-ico svg { width: 15px; height: 15px; display: block; flex: none; }
.fold-ico { display: inline-flex; flex: none; }
.pp-fold-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-fold > summary small { margin-left: 4px; color: var(--muted); font-weight: 600; font-size: 11.5px; white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.pp-fold[open] > .pp-label { margin-top: 6px; }
.pp-fold > summary small[hidden] { display: none; }

/* filtros de plantillas: plegable (cerrado por defecto); los números en botones cuadrados y los tipos en píldoras */
#ppLayouts .pp-fold > .pp-chips, #ppLayouts .pp-fold > .pp-lgrid, #ppLayouts .pp-fold > p { margin-top: 6px; }
.pp-chips-n button { min-width: 28px; padding: 2px 6px; border-radius: 4px; }
.pp-chips-g button { border-radius: 999px; padding: 2px 10px; }

/* composición: tres botones pequeños con icono y rótulo corto, como el resto de botones «small» */
.lay-ico { display: inline-flex; flex-direction: row; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; }
.lay-ico svg { width: 15px; height: 15px; display: block; flex: none; }
.lay-ico.on { background: var(--hi); border-color: var(--ink); font-weight: 600; color: #0f161a; }
.comic-insp .pp-actions .lay-ico { padding-left: 7px; padding-right: 8px; font-size: 12.5px; gap: 4px; flex: 0 1 auto; }
.comic-insp .pp-actions:has(.lay-ico) { gap: 5px; flex-wrap: nowrap; }
.pp-current[hidden] { display: none; }

/* panel de composición: Con IA y Automática en dos columnas; después, las barras plegables y «Editar a mano» con el mismo aspecto */
.comic-insp .pp-actions:has(.lay-ico) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; flex-wrap: nowrap; }
.comic-insp .pp-actions .lay-ico { justify-content: center; }
.comic-insp .pp-sec[data-pp="layout"] { gap: 8px; }
.lay-bar { width: 100%; justify-content: flex-start; padding-left: 8px; min-height: 28px; }
.comic-insp .pp-actions .lay-ico { font-size: 12.5px; }

/* composición con IA: panel bajo el botón (mismo lenguaje que las barras plegables) */
.lay-ico.open { border-color: var(--ink); }
.ai-panel { display: grid; gap: 10px; padding: 10px; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-ink); animation: fade-in .15s var(--ease-out); }
.ai-panel[hidden] { display: none; }
.ai-panel textarea { width: 100%; min-height: 64px; resize: vertical; font-size: 13px; line-height: 1.4; padding: 8px 10px; border: 1px solid var(--pencil); border-radius: var(--radius); background: var(--card); }
.ai-panel textarea:focus-visible { border-color: var(--ink); }
.ai-ideas { display: flex; flex-wrap: wrap; gap: 5px; }
.ai-idea { min-height: 0; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--pencil); background: var(--paper); color: var(--ink); font-size: 12px; font-weight: 400; }
.ai-idea:hover:not(:disabled) { border-color: var(--ink); filter: none; box-shadow: none; }
.ai-idea.on { background: var(--hi); border-color: var(--ink); font-weight: 600; color: #0f161a; }
.ai-row { display: flex; align-items: center; gap: 8px; }
.ai-lbl { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ai-seg { display: flex; flex: 1; border: 1px solid var(--pencil); border-radius: var(--radius); overflow: hidden; }
.ai-seg button { flex: 1; min-height: 0; padding: 3px 4px; border: 0; border-radius: 0; background: var(--paper); color: var(--ink); font-size: 12px; font-weight: 400; box-shadow: none; }
.ai-seg button + button { border-left: 1px solid var(--pencil); }
.ai-seg button[aria-checked="true"] { background: var(--hi); font-weight: 600; color: #0f161a; }
.ai-seg button:hover:not(:disabled):not([aria-checked="true"]) { background: var(--hi-soft); filter: none; }
.ai-foot { display: flex; align-items: center; gap: 8px; }
.ai-rand { display: inline-flex; align-items: center; gap: 5px; }
.ai-rand svg { width: 15px; height: 15px; }
.ai-cost { font-size: 12px; color: var(--muted); }

/* plegar columnas: bordes sensibles con un chevron que aparece al acercar el cursor */
.stage-wrap { position: relative; }
.edge-hit { position: absolute; top: 0; bottom: 0; width: 18px; z-index: 8; display: flex; align-items: center; }
.edge-l { left: 0; justify-content: flex-start; }
.edge-r { right: 0; justify-content: flex-end; }
.edge-btn { min-height: 0; width: 20px; height: 56px; padding: 0; display: grid; place-items: center; border: 1px solid var(--pencil); background: var(--paper); color: var(--ink);
  opacity: 0; transition: opacity .15s var(--ease-out), background .15s; box-shadow: none; }
.edge-l .edge-btn { border-radius: 0 6px 6px 0; border-left: 0; }
.edge-r .edge-btn { border-radius: 6px 0 0 6px; border-right: 0; }
.edge-r .edge-btn svg { transform: rotate(180deg); }
.edge-btn.folded svg { transform: rotate(180deg); }
.edge-r .edge-btn.folded svg { transform: none; }
.edge-btn svg { width: 14px; height: 14px; display: block; }
.edge-hit:hover .edge-btn, .edge-btn:focus-visible { opacity: 1; }
.edge-btn:hover:not(:disabled) { background: var(--hi); border-color: var(--ink); transform: none; box-shadow: none; filter: none; }
@media (hover: none) { .edge-btn { opacity: .55; } }

/* zoom: píldora flotante sobre la hoja, abajo a la derecha (la franja superior se retiró) */
.zoom-pill { position: absolute; right: 30px; bottom: 16px; z-index: 9; display: flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--pencil); border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(4px); box-shadow: 0 2px 8px rgba(0,0,0,.12); opacity: .55; transition: opacity .15s var(--ease-out); }
.zoom-pill:hover, .zoom-pill:focus-within { opacity: 1; }
.zoom-pill button { min-height: 0; width: 30px; height: 30px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 999px; background: transparent; color: var(--ink); box-shadow: none; }
.zoom-pill button:hover:not(:disabled) { background: var(--hi); transform: none; box-shadow: none; filter: none; }
.zoom-pill svg { width: 16px; height: 16px; display: block; }
.stage-tools[hidden] { display: none; }

/* varita: generar las viñetas vacías; píldora translúcida al otro lado del zoom */
.wand-pill { position: absolute; left: 30px; bottom: 16px; z-index: 9; padding: 3px; border: 1px solid var(--pencil); border-radius: 999px; background: color-mix(in srgb, var(--paper) 78%, transparent); backdrop-filter: blur(4px); opacity: .6; transition: opacity .15s; }
.wand-pill[hidden] { display: none; }
.wand-pill:hover, .wand-pill:focus-within { opacity: 1; }
.wand-pill button { position: relative; min-height: 0; width: 30px; height: 30px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 999px; background: transparent; color: var(--ink); box-shadow: none; }
.wand-pill button:hover:not(:disabled) { background: var(--hi); transform: none; box-shadow: none; filter: none; }
.wand-pill svg { width: 17px; height: 17px; display: block; }
.wand-pill i { position: absolute; top: -5px; right: -5px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 99px; background: var(--ink); color: var(--paper); font: 600 10px/15px var(--font-ui, inherit); text-align: center; font-style: normal; }
.wand-pill { display: flex; gap: 2px; }
.wand-pill[hidden] { display: none; }
.wand-pill #wandBtn[aria-disabled="true"], .wand-pill #placeBtn[aria-disabled="true"] { opacity: .4; }
.wand-pill button[aria-disabled="true"] { cursor: default; }
.wand-pill i:empty { display: none; }

/* tipo de línea del marco */
#lineFold .ai-seg { margin: 8px 0 6px; }
.line-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.line-opt { min-height: 0; display: grid; justify-items: center; gap: 3px; padding: 6px 4px 5px; border: 1px solid var(--pencil); border-radius: var(--radius); background: var(--paper); color: var(--ink); font-size: 11px; font-weight: 400; box-shadow: none; }
.line-opt svg { width: 38px; height: 26px; display: block; }
.line-opt:hover:not(:disabled) { border-color: var(--ink); filter: none; box-shadow: none; }
.line-opt.on { background: var(--hi); border-color: var(--ink); font-weight: 600; color: #0f161a; }

/* abrir la imagen a tamaño completo: icono translúcido en la esquina inferior izquierda */
.vc-img { position: relative; }
.img-open { position: absolute; left: 8px; bottom: 8px; width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--pencil); border-radius: 999px; color: var(--ink);
  background: color-mix(in srgb, var(--paper) 82%, transparent); backdrop-filter: blur(4px); opacity: 0; transition: opacity .15s; text-decoration: none; }
.img-open svg { width: 16px; height: 16px; display: block; }
.vc-img:hover .img-open, .img-open:focus-visible { opacity: .9; }
.img-open:hover { opacity: 1; background: var(--hi); }
@media (hover: none) { .img-open { opacity: .75; } }

/* icono de abrir imagen sobre cada viñeta de la hoja: solo al pasar el cursor */
#pageSvg .pg-open { opacity: 0; cursor: pointer; transition: opacity .15s; }
#pageSvg g:hover > .pg-open, #pageSvg .pg-open:focus-visible { opacity: .8; }
#pageSvg .pg-open:hover { opacity: 1; }

/* versiones: iconos bajo cada miniatura (candado, comparar, archivar) */
.ver-cell { flex: 0 0 62px; display: flex; flex-direction: column; gap: 3px; }
.ver-cell .ver-thumb { flex: 0 0 auto; }
.ver-icos { display: flex; justify-content: center; gap: 0; min-height: 20px; }
.ver-ico { min-height: 0; width: 24px; height: 24px; padding: 0; display: grid; place-items: center; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--muted); box-shadow: none; }
.ver-ico svg { width: 15px; height: 15px; display: block; }
.ver-ico:hover:not(:disabled) { color: var(--ink); background: var(--paper); border-color: var(--pencil); transform: none; box-shadow: none; filter: none; }
.ver-ico.on { color: #0f161a; background: var(--hi); border-color: var(--ink); }

/* versiones: todas pequeñas; la fijada (o la que está en uso) se muestra grande */
.ver-strip { align-items: flex-start; }
.ver-cell { flex: 0 0 56px; }
.ver-cell.big { flex: 0 0 104px; }
.ver-cell .ver-cap { font-size: 9px; }
.ver-cell.big .ver-cap { font-size: 11px; }
.ver-cell:not(.big) .ver-flag { display: none; }
.ver-cell .ver-ico { width: 18px; height: 18px; }
.ver-cell .ver-ico svg { width: 13px; height: 13px; }
.ver-cell.big .ver-ico { width: 28px; height: 28px; }
.ver-cell.big .ver-ico svg { width: 18px; height: 18px; }

/* sin la pestaña «Página»: la primera visible no lleva separador */
.insp-levels #lvPage[hidden] + button { margin-left: 0; }
.insp-levels #lvPage[hidden] + button::before { content: none; }

/* guion de página: se abre como el diálogo de escribir la página (centrado, mismo tamaño) */
body.pp-script #editorLayout.ed-layout { --vcol-w: 204px; }
body.pp-script::after { content: ""; position: fixed; inset: 0; background: rgba(15,26,33,.5); z-index: 999; animation: fade-in 200ms var(--ease-out); }
body.pp-script #ppPanel { position: fixed; z-index: 1000; left: 50%; top: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%);
  width: min(940px, 94vw); max-height: 92vh; border: 1px solid var(--ink); border-radius: var(--radius-lg); background: var(--panel); box-shadow: var(--shadow-float); overflow: hidden; display: flex; flex-direction: column; }
body.pp-script #ppPanel .pp-sec[data-pp="script"] { max-height: 92vh; padding: 18px 24px 20px; }
body.pp-script #ppPanel .pp-head { top: -18px; margin: -18px -24px 0; padding: 14px 16px 14px 24px; }


/* inspector de la viñeta: selector Imagen | Texto (mismo estilo que Estructura | Lienzo) */
.insp-levels.view-switch { padding: 8px 12px; gap: 6px; align-items: stretch; min-height: 0; }
.insp-levels.view-switch .vs-btn { flex: 1 1 0; margin: 0; flex-direction: row; justify-content: center; gap: 6px; min-height: 34px; padding: 6px 10px; border: 1px solid var(--pencil); border-radius: var(--radius); font-size: 13px; font-weight: 400; background: var(--paper); color: var(--ink); }
.insp-levels.view-switch .vs-btn::before { content: none; }
.insp-levels.view-switch .vs-btn[aria-selected="true"] { background: var(--hi); border-color: var(--ink); font-weight: 600; color: #0f161a; margin-bottom: 0; }
.insp-levels.view-switch .vs-btn svg { width: 16px; height: 16px; }
.inspector-col > #inspector.vcol { height: auto; }

/* ---- columna de la viñeta: cabecera, guion plegable, selector Imagen | Texto y botón Generar con opciones ---- */
.vc-top { flex: none; padding: 10px 12px 0; background: var(--panel); }
.vc-top[hidden] { display: none; }
.vc-top .vc-head { border-bottom: 0; padding-bottom: 6px; }
.vc-num { min-width: 22px; text-align: center; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.guion-sec { border-bottom: 0; padding-bottom: 6px; }
.guion-sec .vc-body { padding-top: 6px; display: flex; flex-direction: column; gap: 8px; }
.guion-sec .gs-prev { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-weight: 400; }
.guion-sec[open] .gs-prev { display: none; }
.guion-field { position: relative; display: grid; border: 1px solid var(--pencil); border-radius: var(--radius); background: var(--card); }
.guion-field:focus-within { border-color: var(--sel); outline: 3px solid color-mix(in srgb, var(--sel) 25%, transparent); }
.guion-field > .guion-hl, .guion-field > textarea { grid-area: 1 / 1; margin: 0; border: 0; padding: 8px 34px 34px 10px; min-height: 8.5em; box-sizing: border-box;
  font-family: inherit; font-size: 13.5px; line-height: 1.5; letter-spacing: normal; white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; tab-size: 4; }
.guion-field > .guion-hl { pointer-events: none; color: var(--ink); overflow: hidden; }
.guion-field > textarea { width: 100%; height: 100%; resize: none; overflow: hidden; background: transparent; outline: 0; box-shadow: none; color: transparent; caret-color: var(--ink); }
.guion-field > textarea::placeholder { color: var(--muted); }
.guion-field > textarea::selection { background: color-mix(in srgb, var(--hi) 75%, transparent); color: transparent; }
.guion-plus { position: absolute; right: 6px; bottom: 6px; width: 26px; height: 26px; min-height: 0; padding: 0; display: grid; place-items: center; border: 1px solid var(--pencil); border-radius: 99px; background: var(--paper); color: var(--ink); box-shadow: none; }
.guion-plus svg { width: 15px; height: 15px; }
.guion-plus:hover:not(:disabled) { border-color: var(--ink); background: var(--hi-soft); transform: none; box-shadow: none; filter: none; }
:root { --mc-char: #1f5fd1; --mc-place: #0b7a55; --mc-outfit: #8a3fd1; --mc-obj: #a85a00; --mc-unknown: #b3261e; }
:root[data-mode="dark"] { --mc-char: #8fb4ff; --mc-place: #6fd1a9; --mc-outfit: #c9a0f0; --mc-obj: #f0b060; --mc-unknown: #ff9c8e; }
.mc { font-weight: 700; border-radius: 2px; background: color-mix(in srgb, currentColor 11%, transparent); }
.mc-char { color: var(--mc-char); } .mc-place { color: var(--mc-place); } .mc-outfit { color: var(--mc-outfit); } .mc-obj { color: var(--mc-obj); }
.mc-unknown { color: var(--mc-unknown); text-decoration: underline wavy; text-underline-offset: 3px; }
.resource-menu { max-height: min(70vh, 460px); overflow-y: auto; min-width: 230px; }
.resource-menu button:disabled { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 2px; opacity: 1; background: transparent; border: 0; }
.rm-item { display: inline-flex; align-items: center; gap: 8px; }
.rm-item img, .rm-item .noimg { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; font-size: 12px; background: var(--panel); }
.gen-wrap { display: flex; flex-direction: column; gap: 8px; }
.gen-split { display: flex; align-items: stretch; }
.gen-split .gen-main { width: auto; flex: 1 1 auto; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.gen-more { flex: none; width: 38px; min-height: 36px; padding: 0; display: grid; place-items: center; border: 1px solid var(--accent); border-left: 1px solid color-mix(in srgb, var(--accent-ink) 45%, transparent);
  border-radius: 0 var(--radius) var(--radius) 0; background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.gen-more svg { width: 16px; height: 16px; transition: transform .15s; }
.gen-more[aria-expanded="true"] svg { transform: rotate(180deg); }
.gen-more:hover:not(:disabled) { filter: brightness(1.1); transform: none; box-shadow: none; }
.gen-opts { display: flex; flex-direction: column; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.gen-opts[hidden] { display: none; }
.gen-sub { display: flex; flex-direction: column; gap: 4px; }
/* la columna entera se desplaza como un solo bloque: cabecera, guion, selector y panel */
.inspector-col { overflow-y: auto; overflow-x: hidden; }
.inspector-col > * { flex: none; }
.inspector-col > .insp-pane, .inspector-col > .vcol, .inspector-col > #panelCol, .inspector-col > #inspector.vcol { flex: none; height: auto; min-height: 0; overflow: visible; }
.inspector-col > .insp-pane[hidden] { display: none; }

/* ============================================================ Comic Studio 1.5 · piel del SaaS
   La del lienzo «Comic Studio SaaS»: blanco y filetes claros, azul para la acción y lo seleccionado (sin amarillo
   ni bordes negros), títulos en Space Grotesk, controles redondeados. Va la última: solo cambia el aspecto. */
:root {
  font-size: 14px;
  --font-display: "Space Grotesk", Inter, "Segoe UI", system-ui, sans-serif;
  --radius: 10px;
  --radius-lg: 16px;
  --sel-ink: #1E35D6;
  --shadow-ink: 0 1px 2px rgba(18,18,18,.06), 0 4px 12px rgba(18,18,18,.06);
  --shadow-float: 0 12px 32px rgba(18,18,18,.14);
  --shadow-page: 0 12px 32px rgba(18,18,18,.12);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
}
:root[data-mode="dark"] { --sel-ink: #C9D0FF; }

/* botones: principal azul sin borde; secundario blanco con filete claro */
button, .btnlike { border: 1px solid transparent; border-radius: var(--radius); min-height: 36px; padding: 7px 14px; font-weight: 600; }
button.small, .btnlike.small { border-radius: 8px; min-height: 30px; }
button.ghost, .btnlike.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--pencil); font-weight: 500; }
button.ghost:hover:not(:disabled), .btnlike.ghost:hover { border-color: var(--muted); background: var(--bg); }
button.ink { background: var(--ink); color: var(--bg); border-color: var(--ink); }
button.gen-ai:not(.ghost)::before { content: ""; }
button:disabled { background: var(--bg); color: var(--muted); border-color: var(--line); }
input, select, textarea { border: 1px solid var(--pencil); border-radius: 8px; padding: 8px 10px; background: var(--card); }
input:focus, select:focus, textarea:focus { outline: 3px solid color-mix(in srgb, var(--sel) 25%, transparent); border-color: var(--sel); }

/* títulos */
h2, h3, .area-title, .area-head .comic-menu-btn, .vc-head h3, .ip-head h3, .pp-head h3, .set-card h3, .mo-title b, .crumb-page {
  font-family: var(--font-display); letter-spacing: -.01em; }
.area-title { font-size: 24px; font-weight: 700; }
.rail-brand { font-family: var(--font-brand); font-weight: 400; letter-spacing: .03em; color: var(--ink); }
.rail-brand span { color: var(--accent); }

/* lo activo y seleccionado: azul suave con texto azul, sin borde negro */
.rail-btn { border-radius: 10px; }
.rail-btn.on, .rail-btn.on:hover:not(:disabled), :root[data-mode="dark"] .rail-btn.on,
.seg button[aria-selected="true"], .insp-tabs button.on, .side-tabs button.on, .chip-opt.on, .tabs button.on,
.vs-btn[aria-pressed="true"], .insp-levels button[aria-selected="true"], .insp-here, .page-tabs button.on {
  background: var(--hi); color: var(--sel-ink); border-color: var(--sel); font-weight: 600; }
.side-tabs, .insp-tabs { gap: 4px; }
.side-tabs button, .insp-tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); font-weight: 500; }
.side-tabs button + button, .insp-tabs button + button { border-left: 0; }
.side-tabs button.on, .insp-tabs button.on { background: transparent; color: var(--ink); border-bottom-color: var(--sel); }
.line-tabs button[aria-selected="true"] { border-bottom-color: var(--sel); }
.pp-pg.on, .lp-item.on, .ex-preset.on, .frag.on, .pp-lt.on { background: var(--hi); border-color: var(--sel); }
.mo-tile.current, .style-card.on, .ver.in-use, .sc-card.on, .bubble-item.on, .engine-opt:has(input:checked), .ed-tool.on {
  border: 1px solid var(--sel); box-shadow: 0 0 0 1px var(--sel); }
.cand.on { box-shadow: 0 0 0 2px var(--sel); }
.seg button, .chip-opt { border-radius: 8px; }

/* tarjetas, ventanas y menús: filete claro y sombra suave */
.set-card, .res-card, .mo-tile, .sc-card, .progress-panel, .auto-step, .cont-scene, .style-card { border-color: var(--line); border-radius: var(--radius-lg); }
.res-card:hover, .mo-tile:hover { border-color: var(--pencil); box-shadow: var(--shadow-ink); }
dialog { border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-float); }
.popup-menu, .tb-popover, .mention-menu { border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-float); }
.pp { border: 1px solid var(--line); border-left-width: 0; box-shadow: 8px 0 24px rgba(18,18,18,.08); }
.auto-total, .mock-svg { border-color: var(--line); }

/* Estudio: hoja blanca sobre mesa clara, sin borde negro */
.stage { background-color: var(--bg); }
#pageSvg { border: 0; box-shadow: var(--shadow-page); }
.pp-pg img, .pp-pg .pp-hole { border-color: var(--line); }
.editor-bar, .area-head, .comic-bar { background: var(--panel); }
/* enlace «Mis cómics» de la barra lateral: igual que sus botones */
a.rail-btn { text-decoration: none; box-sizing: border-box; }

/* monograma del logotipo: C en cursiva negra con punto bermellón */
.rail .rail-brand { font-family: "Fraunces", Georgia, serif; font-style: italic; font-weight: 900; font-size: 34px; letter-spacing: -.04em; text-transform: none; }
.rail .rail-brand span { color: #E8431F; font-style: normal; }

/* guion de página: barra de iconos, ayuda y vista previa con bocadillos */
.script-tools { display: flex; flex-wrap: wrap; align-items: stretch; gap: 2px; padding: 5px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.script-tools button { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 52px; min-height: 0; padding: 6px 6px 5px; background: transparent; border: 1px solid transparent; box-shadow: none; color: var(--ink); font-size: 10.5px; font-weight: 500; line-height: 1.1; }
.script-tools button:hover:not(:disabled) { background: var(--hi-soft); border-color: var(--line); transform: none; box-shadow: none; }
.script-tools button svg { width: 19px; height: 19px; }
.script-tools .st-sep { width: 1px; background: var(--line); margin: 3px 4px; }
#scriptText { font-size: 14px; line-height: 1.5; resize: vertical; }
.script-help { font-size: 13px; color: var(--ink-2); }
.script-help summary { cursor: pointer; color: var(--muted); }
.script-help ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.script-help code { font-size: 12px; background: var(--panel); padding: 1px 5px; border-radius: 4px; }
.sp-bubbles { grid-column: 1 / -1; display: grid; gap: 3px; color: var(--ink-2); }
.sp-b { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; }
.sp-b.warn { color: #8A4B00; }

.b-fold { min-width: 30px; padding: 2px 8px; }

/* galería de bocadillos: tipos de voz con su aspecto, dibujados con el mismo motor que la página */
.bubble-gallery-dlg { width: min(1040px, 96vw); }
.bg-dlg { width: auto; height: min(88vh, 900px); }
.bg-head { display: flex; align-items: center; gap: 8px; }
.bg-head h3 { margin: 0; flex: 1; }
.bg-intro { margin: 0; font-size: 13px; }
.bg-dlg input[type="search"] { width: 100%; }
.bg-cats { margin: 0; }
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); grid-auto-rows: max-content; align-content: start; gap: 10px; overflow-y: auto; overflow-x: hidden; flex: 1 1 auto; padding: 2px 4px 4px 2px; min-height: 240px; }
.bg-card { display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-width: 0; white-space: normal; padding: 6px 6px 9px; min-height: 0; text-align: left;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; cursor: pointer;
  transition: border-color 120ms var(--ease-out), transform 120ms var(--ease-out); }
.bg-card:hover:not(:disabled) { border-color: var(--ink); transform: translateY(-1px); box-shadow: var(--shadow-ink); }
.bg-card:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }
.bg-card.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--hi-soft); }
.bg-prev { display: block; flex: none; width: 100%; height: 106px; background: #f4f1ea; border-radius: calc(var(--radius) - 3px); pointer-events: none; }
.bg-name { font-weight: 600; font-size: 13.5px; padding: 0 3px; }
.bg-name small { font-weight: 500; color: var(--muted); }
.bg-hint { font-size: 12px; line-height: 1.3; color: var(--muted); padding: 0 3px; }
.b-kind { font-weight: 600; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-kind-caret { color: var(--muted); }
.b-gallery { font-weight: 600; }
@media (max-width: 600px) {
  .bg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .bg-hint { display: none; }
}

/* catálogo de estilos: segunda fila de pestañas (grupos de la familia elegida) y recuento */
.sub-tabs { margin-top: -4px; padding: 6px 8px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.sub-tabs[hidden] { display: none; }
.sub-tabs button { min-height: 26px; font-size: 12.5px; }
.tabs .tab-n { font-weight: 500; color: var(--muted); font-size: 11.5px; }

/* Biblia › Rotulación: fuentes propias */
.font-upload { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.font-list { display: grid; gap: 4px; width: 100%; }
.font-row { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.font-row .font-name { flex: 1; min-width: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-add { border-style: dashed; }
.font-row.on { border-color: var(--ink); }
.font-pick { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: transparent; border: 0; box-shadow: none; padding: 2px 0; color: var(--ink); text-align: left; }
.font-pick:hover:not(:disabled) { background: transparent; transform: none; box-shadow: none; }
.font-sub { margin: 6px 0 2px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.font-list[hidden] { display: none; }

/* Rotulación: pop-up de fuentes y tamaño numérico */
.size-ctl { display: grid; gap: 6px; }
.size-lbl { color: var(--muted); font-size: 13px; }
.chip-opt.size-num { display: inline-flex; align-items: center; gap: 6px; cursor: text; }
.chip-opt.size-num input { width: 64px; min-height: 0; padding: 2px 6px; font-size: 14px; }
.font-menu { z-index: 90; overflow-y: auto; overscroll-behavior: contain; padding: 4px 0; align-items: stretch; }
.font-menu .fm-head { margin: 6px 12px 2px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.font-menu .fm-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; font-size: 17px; font-weight: 400; padding: 7px 12px; }
.font-menu .fm-item.on { background: var(--hi-soft); }
.font-menu .fm-row { display: flex; align-items: center; }
.font-menu .fm-row .fm-item { flex: 1; min-width: 0; }
.font-menu .fm-del { flex: none; padding: 4px 10px; color: #b42318; }
.font-menu .fm-empty { margin: 2px 12px 6px; font-size: 12px; color: var(--muted); }
.font-menu .fm-upload { position: sticky; bottom: 0; margin-top: 4px; border-top: 1px solid var(--line); background: var(--paper); font-weight: 600; border-radius: 0; }
.font-menu { overflow-x: hidden; }
.chip-opt.size-num { padding: 4px 10px; }
.chip-opt.size-num input { width: 58px; height: 28px; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); text-align: center; }
.set-card label.chip-opt.size-num { flex-direction: row; align-items: center; gap: 6px; flex: 1 1 auto; justify-content: center; }
.set-card label.chip-opt.size-num input { width: 58px; margin: 0; }
.chip-opt.size-num input { font-family: inherit; font-size: inherit; height: auto; min-height: 30px; }
#sizeCtl .chip-opt { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; }
.shape-more { margin-top: 8px; }
.shape-more > summary { cursor: pointer; font-size: 13px; color: var(--muted); padding: 4px 0; }
.shape-sub h6 { margin: 8px 0 4px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }

/* Biblia › Formas por defecto: una fila por tipo y pop-up con scroll */
#shapeDefaults { display: grid; gap: 10px; }
.shape-row { display: grid; gap: 4px; }
.shape-row-lbl { font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.shape-row-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 6px 12px; background: #fff; color: var(--ink); border: 1px solid var(--pencil); border-radius: 6px; font-weight: 400; text-align: left; }
.shape-row-btn:hover:not(:disabled) { border-color: var(--ink); filter: none; }
.shape-row-btn svg { flex: none; width: 64px; height: 38px; }
.shape-row-btn b { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; }
.shape-row-btn i { font-style: normal; color: var(--muted); }
.shape-menu { position: fixed; z-index: 90; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; background: var(--paper); border: 1px solid var(--ink); border-radius: 12px; box-shadow: var(--shadow-float); padding: 10px 12px 12px; }
.shape-menu .sm-title { position: sticky; top: -10px; margin: -10px -12px 6px; padding: 10px 12px 6px; background: var(--paper); font-size: 13px; z-index: 1; }
.shape-menu .sm-group { margin-bottom: 10px; }
.shape-menu .sm-group h5 { margin: 0 0 5px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.shape-menu .shape-gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.shape-menu .shape-option { min-height: 62px; }
.shape-menu .shape-option svg { height: 36px; }

.shape-row-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
.shape-row-pair .shape-row-btn { padding: 6px 10px; gap: 8px; }
.shape-row-pair .shape-row-btn b { font-size: 13px; }
.shape-row-pair .shape-row-btn svg { width: 44px; height: 30px; }
.sty-sw { flex: none; width: 34px; height: 24px; border-radius: 6px; box-sizing: border-box; }
.style-menu .sm-sample { margin: 2px 0 6px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.style-menu .sm-sample svg { display: block; width: 100%; height: auto; }
.style-menu .hint { margin: 0 0 8px; font-size: 12px; }
.style-menu .b-opts { border-top: 0; padding-top: 0; }

/* Admin › Registro y capacidad */
.adm-access { display: grid; gap: 8px; }
.adm-access .adm-sub { margin: 10px 0 0; font-size: 13px; }
.adm-access .adm-line { margin: 0; font-size: 13px; }
.adm-gauge { position: relative; height: 10px; border-radius: 6px; background: var(--line); overflow: visible; }
.adm-gauge i { display: block; height: 100%; border-radius: 6px; background: #2E7D4F; }
.adm-gauge i.hot { background: #B42318; }
.adm-gauge b { position: absolute; top: -3px; width: 2px; height: 16px; background: var(--ink); }

/* Galería: cartelas a medida */
.bg-head-actions { display: inline-flex; align-items: center; gap: 8px; }
.bg-wrap { position: relative; display: flex; }
.bg-wrap > .bg-card { flex: 1; }
.bg-del { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,.85); color: #b42318; opacity: .55; }
.bg-wrap:hover .bg-del, .bg-del:focus-visible { opacity: 1; }
.cc { padding: 4px 2px 12px; }
.cc-form { display: grid; gap: 10px; max-width: 640px; }
.cc-form h4 { margin: 0; font-size: 16px; }
.cc-form textarea { width: 100%; font-size: 15px; }
.cc-result { display: grid; gap: 8px; }
.cc-prev { max-width: 420px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.cc-prev svg { display: block; width: 100%; height: auto; }

.shape-row .cc-ia { width: 100%; margin-top: 6px; justify-content: center; border-style: dashed; }
.sm-mine { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sm-mine .bg-card { padding: 4px; text-align: left; }
.sm-mine .bg-card svg { width: 100%; height: auto; }

/* Capas añadidas */
.ov-box { display: grid; gap: 8px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.ov-box h3 { margin: 0; font-size: 14px; }
.ov-row { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); cursor: pointer; }
.ov-row.on { border-color: var(--ink); box-shadow: 0 0 0 3px var(--hi); }
.ov-row.off .ov-th, .ov-row.off .ov-name { opacity: .45; }
.ov-th { width: 34px; height: 34px; object-fit: contain; flex: none; border-radius: 4px; background: repeating-conic-gradient(#e6e3da 0 25%, #fff 0 50%) 0 0 / 10px 10px; }
.ov-name { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 13px; padding: 4px; }
.ov-row .icon-btn { padding: 3px 6px; }
.ov-row .icon-btn svg { width: 16px; height: 16px; }
.ov-opts { display: grid; gap: 6px; padding: 4px 4px 2px; }
.ov-add { display: grid; gap: 6px; }
.ov-add textarea { width: 100%; }

/* Capas: una sola jerarquía (título › subtítulos pequeños › acciones del mismo ancho) */
.layers-tab > h2 { margin: 0 0 8px; font-size: 18px; }
.layers-tab .lt-sub, .layers-tab .ov-box h3 { margin: 14px 0 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.layers-tab .ov-box { margin-bottom: 8px; padding-bottom: 14px; }
.layers-tab .ov-box > .hint, .layers-tab > .hint { margin: 0; }
.layers-tab > button, .layers-tab .ov-add > button { display: block; width: 100%; min-height: 40px; }
.layers-tab .row.wrap { display: grid; grid-template-columns: 1fr; gap: 8px; }
.layers-tab .row.wrap > button { width: 100%; min-height: 40px; }
.layers-tab .ov-add > button:disabled { opacity: .55; }
.layers-tab > button + .row.wrap { margin-top: 8px; }
