/* tools.css — piezas de las herramientas (unir, dividir, comprimir, JPG a PDF,
   PDF a JPG, foto a Excel) y de la sección «Herramientas». Usa los mismos
   tokens de color que styles.css, así que funciona en modo claro y oscuro. */

/* Estado «editar»: la lista de archivos o páginas antes de procesar */
.tool-card[data-state="edit"] .st-edit { display: block; animation: fade-in .45s var(--ease); }

.edit-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }
.edit-head .file-name { margin: 0; }
.edit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.add-more { display: inline-flex; align-items: center; gap: .4em; cursor: pointer; }
.add-more svg { flex: none; }

/* Lista de archivos ordenable */
.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.file-item {
  display: grid; grid-template-columns: auto 64px 1fr auto; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 16px; background: var(--card);
  transition: border-color .2s, box-shadow .2s, transform .25s var(--ease);
  animation: row-in .45s var(--ease) both;
}
.file-item:hover { border-color: color-mix(in srgb, var(--g-400) 60%, var(--line)); }
.file-item.is-drag { opacity: .45; }
.file-item.is-target { border-color: var(--g-500); box-shadow: 0 0 0 4px var(--accent-soft); transform: translateY(2px); }
.fi-handle { cursor: grab; color: var(--muted); display: grid; place-items: center; width: 22px; }
.fi-handle:active { cursor: grabbing; }
.fi-thumb {
  width: 64px; height: 80px; border-radius: 8px; border: 1px solid var(--line); background: #fff;
  display: grid; place-items: center; overflow: hidden;
}
.fi-thumb canvas, .fi-thumb img { max-width: 100%; max-height: 100%; display: block; }
.fi-info { min-width: 0; }
.fi-name { margin: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fi-meta { margin: 0; font-size: .85rem; color: var(--muted); }
.fi-btns { display: flex; gap: 4px; }
.icon-btn {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2); font: inherit; font-weight: 700;
  transition: border-color .2s, background .2s, transform .2s var(--ease);
}
.icon-btn:hover { border-color: var(--g-400); transform: translateY(-1px); }
.icon-btn:disabled { opacity: .35; cursor: default; transform: none; }
.icon-btn.danger:hover { border-color: var(--error); color: var(--error); }

/* Cuadrícula de páginas o imágenes */
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; max-height: 470px; overflow: auto; padding: 4px; }
.thumb {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 8px 6px;
  border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); cursor: pointer; user-select: none;
  transition: border-color .2s, box-shadow .2s, transform .25s var(--ease);
  animation: fade-in .4s var(--ease) both;
}
.thumb:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--g-400) 60%, var(--line)); }
.thumb.is-on { border-color: var(--g-500); box-shadow: 0 0 0 3px var(--accent-soft); }
.thumb.is-drag { opacity: .45; }
.thumb.is-target { border-color: var(--g-500); box-shadow: 0 0 0 4px var(--accent-soft); }
.thumb-img { width: 100%; aspect-ratio: 3 / 4; display: grid; place-items: center; background: #fff; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.thumb-img canvas, .thumb-img img { max-width: 100%; max-height: 100%; display: block; transition: transform .3s var(--ease); }
.thumb-num { font-size: .8rem; font-weight: 700; color: var(--muted); }
.thumb-check {
  position: absolute; top: 12px; left: 12px; width: 24px; height: 24px; border-radius: 8px;
  display: grid; place-items: center; font-size: .8rem; font-weight: 800; color: transparent;
  background: var(--card); border: 1.5px solid var(--line); box-shadow: var(--shadow-sm);
}
.thumb.is-on .thumb-check { background: var(--grad); border-color: transparent; color: #fff; }
.thumb-tools { position: absolute; top: 10px; right: 10px; display: flex; gap: 4px; opacity: 0; transition: opacity .2s; }
.thumb:hover .thumb-tools, .thumb:focus-within .thumb-tools { opacity: 1; }
.thumb-tools .icon-btn { width: 28px; height: 28px; border-radius: 8px; font-size: .85rem; }
@media (hover: none) { .thumb-tools { opacity: 1; } }

.sel-bar[hidden], .pages-bar[hidden], .camera-btn[hidden] { display: none; }
.sel-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 12px 0 0; font-size: .92rem; color: var(--muted); }
.range-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.range-row input {
  flex: 1 1 240px; min-width: 0; font: inherit; padding: .7em 1em; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--bg); color: var(--ink);
}
.range-row input:focus { outline: none; border-color: var(--g-400); box-shadow: 0 0 0 4px var(--accent-soft); }
.range-row[hidden] { display: none; }
.field-hint { font-size: .85rem; color: var(--muted); margin: 6px 0 0; }
.field-error { font-size: .88rem; color: var(--error); margin: 6px 0 0; font-weight: 650; }
.field-error[hidden] { display: none; }

.go-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 18px; }
.go-row .muted { font-size: .9rem; }

/* Resultado */
.result { text-align: center; padding: 18px 6px 6px; }
.result-ic {
  display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; margin-bottom: 12px;
  background: var(--grad); color: #fff; box-shadow: 0 14px 28px -12px rgba(14, 138, 87, .7);
  animation: pop .6s var(--ease) both;
}
@keyframes pop { from { transform: scale(.6) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }
.result-title { font-family: var(--display); font-weight: 800; font-size: 1.4rem; margin: 0 0 4px; }
.result-meta { color: var(--muted); margin: 0 0 18px; }
.result .downloads { justify-content: center; }
.result-again { margin-top: 14px; }

/* Comparación de tamaño (comprimir) */
.size-compare { display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap; margin: 6px 0 14px; }
.size-box { padding: 10px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-alt); min-width: 130px; }
.size-box b { display: block; font-family: var(--display); font-size: 1.35rem; }
.size-box span { font-size: .8rem; color: var(--muted); font-weight: 650; }
.size-box.after { border-color: color-mix(in srgb, var(--g-400) 60%, var(--line)); background: var(--accent-soft); }
.size-box.after b { color: var(--num); }
.save-bar { max-width: 420px; height: 12px; margin: 0 auto 6px; border-radius: 99px; background: var(--bg-alt); overflow: hidden; }
.save-bar span { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--grad); transition: width 1.1s var(--ease); }
.save-pct { font-weight: 800; color: var(--num); margin: 0 0 16px; }

/* Vista previa de imagen (foto a Excel) */
.photo-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.photo-list .thumb-img { aspect-ratio: auto; height: 190px; }

/* Opciones en tarjeta de edición */
.st-edit .options { margin-top: 18px; }

/* Botón de cámara (solo móviles con cámara) */
.camera-btn { margin-top: 4px; }

@media (max-width: 640px) {
  .file-item { grid-template-columns: 48px 1fr auto; }
  .fi-handle { display: none; }
  .fi-thumb { width: 48px; height: 60px; }
  .thumb-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); max-height: 420px; }
  .go-row .btn-big { width: 100%; }
}

/* ---------- PDF a Word: vista previa del documento ---------- */
.doc-wrap { border: 1.5px solid var(--line); border-radius: 16px; background: var(--bg-alt); padding: 18px; }
.doc-preview {
  max-height: 460px; overflow: auto; margin: 0 auto; max-width: 720px; padding: 34px 40px;
  background: #fff; color: #1d2a24; border-radius: 6px; box-shadow: var(--shadow-sm);
  font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif; font-size: .92rem; line-height: 1.5;
}
.doc-preview h3 { font-family: inherit; font-size: 1.35rem; color: #0a6b44; margin: .8em 0 .4em; letter-spacing: 0; }
.doc-preview h4 { font-family: inherit; font-size: 1.08rem; margin: .8em 0 .3em; color: #0d1f17; }
.doc-preview p { margin: 0 0 .6em; color: #1d2a24 !important; }
.doc-preview .c { text-align: center; }
.doc-preview table { border-collapse: collapse; width: 100%; margin: .4em 0 1em; font-size: .82rem; }
.doc-preview th, .doc-preview td { border: 1px solid #bfd8cb; padding: 4px 7px; text-align: left; vertical-align: top; }
.doc-preview th { background: #e3f4ea; font-weight: 700; }
.doc-preview td.n { text-align: right; font-variant-numeric: tabular-nums; }
.doc-break { border: 0; border-top: 2px dashed #cfdcd5; margin: 26px -40px; }

/* ---------- Excel a Dashboard ---------- */
.tool-card.wide { max-width: 1120px; }
.dash-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px 18px; margin-bottom: 14px; }
.dash-head .file-name { font-size: 1.3rem; }
.dash-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dash-actions .btn { padding: .65em 1em; font-size: .92rem; }
.dash-controls { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; padding: 12px; border-radius: 14px; background: var(--bg-alt); margin-bottom: 14px; }
.dash-controls label { display: grid; gap: 4px; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.dash-controls label[hidden] { display: none; }
.dash-controls select, .gen-form select, .gen-form input[type="text"], .gen-form textarea, .table-tools input {
  font: inherit; font-size: .92rem; text-transform: none; letter-spacing: 0; color: var(--ink); font-weight: 600;
  padding: .55em .8em; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); min-width: 150px;
}
.dash-controls select:focus, .gen-form select:focus, .gen-form input:focus, .gen-form textarea:focus, .table-tools input:focus { outline: none; border-color: var(--g-400); box-shadow: 0 0 0 4px var(--accent-soft); }
.filter-chip { display: inline-flex; align-items: center; gap: 8px; padding: .45em .5em .45em .9em; border-radius: 999px; background: var(--accent-soft); border: 1.5px solid var(--g-500); font-weight: 700; font-size: .88rem; }
.filter-chip[hidden] { display: none; }
.filter-chip button { border: 0; background: var(--card); color: var(--ink); width: 24px; height: 24px; border-radius: 50%; cursor: pointer; font-weight: 800; }
.kpis { display: grid; grid-template-columns: repeat(var(--kpi-cols, 4), minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); min-width: 0; }
.kpi:first-child { background: linear-gradient(140deg, color-mix(in srgb, var(--g-400) 14%, var(--card)), var(--card)); border-color: color-mix(in srgb, var(--g-400) 45%, var(--line)); }
.kpi-label { margin: 0; font-size: .8rem; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value { margin: 2px 0 0; font-family: var(--display); font-weight: 800; font-size: 1.75rem; letter-spacing: -.02em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value.is-text { font-size: 1.25rem; padding-top: .3em; }
.kpi-sub { margin: 2px 0 0; font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.chart-card { padding: 14px 16px 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); min-width: 0; }
.chart-card[hidden] { display: none; }
.chart-card h3 { font-family: var(--font); font-size: .95rem; font-weight: 750; margin: 0 0 8px; color: var(--ink); }
.chart-box { position: relative; height: 290px; }
.chart-hint { margin: 6px 0 0; font-size: .78rem; color: var(--muted); }
.table-tools { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin: 16px 0 8px; }
.table-tools input { min-width: 240px; }
.data-table { max-height: 380px; overflow: auto; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); }
.data-table table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .84rem; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.data-table th { position: sticky; top: 0; background: var(--bg-alt); color: var(--muted); font-size: .78rem; z-index: 1; }
.data-table .num { text-align: right; color: var(--num); font-weight: 650; }
.data-table .date { color: var(--date); }
.demo-row { text-align: center; margin: 12px 0 0; color: var(--muted); font-size: .92rem; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .charts { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .chart-box { height: 250px; } .dash-controls select { min-width: 0; width: 100%; } .dash-controls label { flex: 1 1 140px; } }

/* ---------- Generador de códigos ---------- */
.gen-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--bg-alt); margin-bottom: 18px; }
.gen-tabs button { border: 0; background: transparent; font: inherit; font-weight: 750; font-size: .95rem; color: var(--ink-2); padding: .55em 1.1em; border-radius: 10px; cursor: pointer; }
.gen-tabs button.is-on { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.gen-pane[hidden] { display: none; }
.gen-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 22px; align-items: start; }
.gen-form { display: grid; gap: 14px; }
.gen-form label.field { display: grid; gap: 6px; font-weight: 700; font-size: .9rem; }
.gen-form input[type="text"], .gen-form textarea, .gen-form select { width: 100%; }
.gen-form textarea { min-height: 170px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: .88rem; line-height: 1.5; }
.gen-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gen-row[hidden] { display: none; }
.gen-form input[type="range"] { width: 100%; accent-color: var(--g-600); }
.gen-form input[type="color"] { width: 100%; height: 40px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); padding: 3px; }
.gen-check { display: flex; gap: 8px; align-items: center; font-weight: 650; font-size: .92rem; cursor: pointer; }
.gen-check input { accent-color: var(--g-600); width: 18px; height: 18px; }
.gen-preview {
  display: grid; place-items: center; min-height: 260px; padding: 22px; border-radius: 16px;
  border: 1.5px dashed var(--line); background: repeating-conic-gradient(var(--bg-alt) 0% 25%, var(--card) 0% 50%) 50% / 18px 18px;
}
.gen-preview svg { max-width: 100%; height: auto; max-height: 300px; background: #fff; border-radius: 6px; box-shadow: var(--shadow-sm); }
.gen-msg { margin: 0; font-size: .88rem; font-weight: 650; }
.gen-msg.ok { color: var(--num); }
.gen-msg.bad { color: var(--error); }
.gen-msg[hidden] { display: none; }
.gen-dl { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; justify-content: center; }
@media (max-width: 760px) { .gen-grid { grid-template-columns: 1fr; } }

/* ---------- Dashboard editable ---------- */
.edit-toggle { padding: .6em 1em; font-size: .92rem; }
.edit-toggle.is-on { border-color: var(--g-500); background: var(--accent-soft); }
.dash-editor { border: 1.5px solid color-mix(in srgb, var(--g-400) 50%, var(--line)); border-radius: 16px; background: var(--card); padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow-sm); animation: fade-in .35s var(--ease); }
.dash-editor[hidden] { display: none; }
.ed-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg-alt); margin-bottom: 14px; width: fit-content; max-width: 100%; }
.ed-tabs button { border: 0; background: transparent; font: inherit; font-weight: 750; font-size: .9rem; color: var(--ink-2); padding: .5em 1em; border-radius: 9px; cursor: pointer; }
.ed-tabs button.is-on { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.ed-pane[hidden] { display: none; }
.ed-list { display: grid; gap: 10px; max-height: 460px; overflow: auto; padding: 2px; }
.ed-row { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: var(--bg); }
.ed-row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ed-row-btns { display: flex; gap: 4px; }
.ed-row-btns .icon-btn { width: 30px; height: 30px; }
.ed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 12px; align-items: end; }
.ed-row-kpi { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(150px, 1.2fr) minmax(150px, 1.2fr) auto; gap: 10px; align-items: end; }
.ed-field { display: grid; gap: 5px; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px; }
.ed-row .ed-field, .ed-row-kpi .ed-field { margin-bottom: 0; }
.ed-field input[type="text"], .ed-field select, .ed-col input, .ed-col select {
  font: inherit; font-size: .9rem; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--ink);
  padding: .5em .7em; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); width: 100%; min-width: 0;
}
.ed-field input:focus, .ed-field select:focus, .ed-col input:focus, .ed-col select:focus { outline: none; border-color: var(--g-400); box-shadow: 0 0 0 4px var(--accent-soft); }
.ed-check { margin-bottom: 8px; text-transform: none; }
.ed-del { align-self: end; margin-bottom: 4px; }
.ed-add { margin-top: 12px; padding: .6em 1em; font-size: .9rem; }
.ed-colors { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; text-transform: none; letter-spacing: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 34px; height: 34px; border-radius: 10px; border: 2px solid var(--card); background: var(--sw); cursor: pointer; box-shadow: 0 0 0 1.5px var(--line); transition: transform .2s var(--ease), box-shadow .2s; }
.swatch:hover { transform: translateY(-2px); }
.swatch.is-on { box-shadow: 0 0 0 3px var(--ink); }
.ed-custom { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: .88rem; color: var(--ink-2); }
.ed-custom input[type="color"] { width: 44px; height: 34px; padding: 2px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); cursor: pointer; }
.ed-help { font-size: .84rem; color: var(--muted); margin: -4px 0 12px; }
.ed-sub { font-weight: 800; margin: 8px 0 8px; }
.ed-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; max-height: 340px; overflow: auto; padding: 2px; }
.ed-col { display: grid; grid-template-columns: 1fr 120px; gap: 6px; }
.ed-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-card.wide .chart-box { height: 320px; }
#dash .kpi:first-child { border-color: color-mix(in srgb, var(--dash-brand, var(--g-400)) 45%, var(--line)); background: linear-gradient(140deg, color-mix(in srgb, var(--dash-brand, var(--g-400)) 14%, var(--card)), var(--card)); }
@media (max-width: 760px) { .ed-row-kpi { grid-template-columns: 1fr 1fr; } .ed-del { grid-column: 2; justify-self: end; } }

/* Fondo elegido por el usuario (claro u oscuro) aunque el sitio esté en el otro modo */
#dash.dash-light { --ink: #0d1f17; --ink-2: #2f4038; --muted: #6a7d74; --line: #d8e6de; --bg: #f6fbf8; --bg-alt: #edf6f1; --card: #ffffff; --accent-soft: #e6f7ee; --num: #0a7a4b; --date: #1d5fbf; color: var(--ink); }
#dash.dash-dark { --ink: #e9f5ef; --ink-2: #c7d9cf; --muted: #8ea49a; --line: #22362d; --bg: #07130e; --bg-alt: #0b1b14; --card: #0f2119; --accent-soft: rgba(60, 207, 142, .12); --num: #5fe0a0; --date: #8db8ff; color: var(--ink); }
#dash.dash-light, #dash.dash-dark { background: var(--bg); border-radius: 18px; padding: 14px; margin: -6px; }

/* Impresión: solo la imagen del dashboard, en horizontal y en una hoja */
#print-sheet { display: none; }
@media print {
  html.print-dash body > *:not(#print-sheet) { display: none !important; }
  html.print-dash #print-sheet { display: block !important; }
  html.print-dash #print-sheet img { width: 100%; height: auto; object-fit: contain; display: block; margin: 0 auto; }
  html.print-dash body { background: #fff !important; }
  html.print-dash body::before { display: none !important; }
}

/* Logo de la empresa */
.dash-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.dash-brand.logo-right { flex-direction: row-reverse; justify-content: flex-end; }
.dash-logo { max-height: 56px; max-width: 180px; object-fit: contain; display: block; }
.dash-logo[hidden] { display: none; }
.ed-logo { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; text-transform: none; letter-spacing: 0; }
.ed-logo img { max-height: 52px; max-width: 170px; object-fit: contain; padding: 6px; border-radius: 10px; border: 1.5px dashed var(--line); background: #fff; }
.ed-logo img[hidden], .ed-logo-opts[hidden] { display: none; }
.ed-logo-btn { padding: .55em 1em; font-size: .9rem; cursor: pointer; }
.ed-logo-opts { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ed-logo-opts select { width: auto; }

/* ---------- Fase 3: Firmar PDF ---------- */
.sign-layout { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 20px; align-items: start; margin-top: 8px; }
.sign-side { display: grid; gap: 12px; text-align: left; }
.sign-side .gen-tabs { margin-bottom: 0; }
.sign-pane[hidden] { display: none; }
.pad-wrap { position: relative; }
.sign-pad { display: block; width: 100%; height: 170px; border: 1.5px dashed var(--line); border-radius: 14px; background: #fff; touch-action: none; cursor: crosshair; }
.pad-hint { position: absolute; inset: 0; display: grid; place-items: center; color: #8a978f; font-weight: 650; pointer-events: none; }
.pad-hint[hidden] { display: none; }
.sign-line { position: absolute; left: 18px; right: 18px; bottom: 38px; border-bottom: 1px solid #d5ddd8; pointer-events: none; }
.sign-side input[type="text"] { width: 100%; font: inherit; padding: .65em .8em; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); }
.sign-side input[type="text"]:focus { outline: none; border-color: var(--g-500); }
.type-fonts { display: flex; gap: 6px; flex-wrap: wrap; }
.type-fonts button { flex: 1; min-width: 80px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px; padding: .45em .6em; font-size: 1.15rem; cursor: pointer; }
.type-fonts button.is-on, .sign-colors button.is-on { border-color: var(--g-500); box-shadow: 0 0 0 3px var(--accent-soft); }
.sig-canvas { display: block; width: 100%; max-height: 120px; object-fit: contain; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.sig-canvas[hidden] { display: none; }
.sign-colors { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: .92rem; }
.sign-colors button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--card); outline: 1px solid var(--line); cursor: pointer; padding: 0; }
.sign-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sign-actions .btn-primary { grid-column: 1 / -1; }
.sign-msg { margin: 0; padding: .55em .8em; border-radius: 10px; background: var(--warn-bg); border: 1px solid var(--warn-line); font-size: .9rem; }
.sign-msg[hidden] { display: none; }
.sign-main { min-width: 0; }
.page-nav { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 10px; font-weight: 700; }
.page-nav button { width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font-size: 1.2rem; cursor: pointer; }
.page-nav button:disabled { opacity: .35; cursor: default; }
.page-stage { position: relative; width: 100%; max-width: 760px; margin: 0 auto; background: #fff; border-radius: 6px; box-shadow: var(--shadow); overflow: hidden; touch-action: pan-y; }
.page-canvas { display: block; width: 100%; height: 100%; }
.placed { position: absolute; outline: 1.5px dashed var(--g-500); outline-offset: 2px; cursor: move; touch-action: none; border-radius: 4px; }
.placed:hover, .placed.is-active, .placed:focus-visible { outline-style: solid; background: rgba(15, 157, 98, .06); }
.placed img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; }
.placed-del { position: absolute; top: -12px; right: -12px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--error); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.placed-resize { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; border-radius: 4px; background: var(--g-500); border: 2px solid #fff; cursor: nwse-resize; }
@media (max-width: 860px) { .sign-layout { grid-template-columns: 1fr; } }

/* ---------- Fase 3: Proteger / Desbloquear ---------- */
.pw-form { display: grid; gap: 12px; max-width: 520px; margin: 14px auto 0; text-align: left; }
.pw-form label.field { display: grid; gap: 6px; font-weight: 700; font-size: .93rem; }
.pw-field { display: flex; gap: 6px; }
.pw-field input { flex: 1; min-width: 0; font: inherit; padding: .7em .85em; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); }
.pw-field input:focus { outline: none; border-color: var(--g-500); box-shadow: 0 0 0 3px var(--accent-soft); }
.pw-field button { border: 1.5px solid var(--line); background: var(--card); color: var(--ink-2); border-radius: 12px; padding: 0 .9em; font: inherit; font-weight: 650; font-size: .88rem; cursor: pointer; }
.pw-meter { height: 6px; border-radius: 6px; background: var(--bg-alt); overflow: hidden; }
.pw-meter::before { content: ""; display: block; height: 100%; width: calc(var(--s, 0) * 20%); background: var(--error); transition: width .25s var(--ease), background .25s; }
.pw-meter[data-s="3"]::before, .pw-meter[data-s="4"]::before, .pw-meter[data-s="5"]::before { background: var(--g-500); }
.pw-meter[data-s="2"]::before { background: #f59e0b; }
.pw-meter-label { font-size: .85rem; color: var(--muted); min-height: 1.2em; }
.perm-list { display: grid; gap: 6px; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 0; }
.perm-list legend { font-weight: 750; padding: 0 6px; }
.pw-error { margin: 0; color: var(--error); font-weight: 650; font-size: .92rem; }
.pw-error[hidden] { display: none; }
.unlock-info { margin: 0; padding: .7em .9em; border-radius: 12px; background: var(--accent-soft); font-size: .93rem; }
.field[hidden] { display: none !important; }

/* ---------- Fase 3: PDF a PowerPoint / Word a PDF ---------- */
.thumb-more .thumb-img { display: grid; place-items: center; font-weight: 800; font-size: 1.4rem; color: var(--muted); background: var(--bg-alt); }
.doc-preview h1, .doc-preview h2 { font-family: var(--display); line-height: 1.2; margin: .8em 0 .4em; }
.doc-preview h1 { font-size: 1.45rem; }
.doc-preview h2 { font-size: 1.2rem; }
.doc-preview h5, .doc-preview h6 { font-size: 1rem; margin: .8em 0 .3em; }
.doc-preview ul, .doc-preview ol { padding-left: 1.4em; margin: .4em 0 .8em; }
.doc-preview img { max-width: 100%; height: auto; display: block; margin: .6em auto; }

/* ---------- Fase 3: Analizador de estados de cuenta ---------- */
.map-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; margin-top: 12px; }
.map-table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.map-table th { position: sticky; top: 0; background: var(--bg-alt); padding: 8px; text-align: left; }
.map-table th select { width: 100%; min-width: 120px; font: inherit; font-weight: 650; padding: .4em .5em; border-radius: 9px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); }
.map-table td { padding: 6px 8px; border-top: 1px solid var(--line); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.map-table tr.is-head td { font-weight: 750; color: var(--muted); }
.an-result { text-align: left; }
.kpi.is-neg .kpi-value { color: var(--error); }
.data-table .num.neg { color: var(--error); }
.data-table .num.pos { color: var(--g-600); }
.cat-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: middle; }
.cat-select { font: inherit; font-size: .85rem; padding: .25em .4em; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); max-width: 190px; }
.an-tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; }
.an-tables .data-table, .an-moves .data-table { max-height: 420px; overflow: auto; }
.an-moves { margin-top: 16px; }
.an-moves h3, .an-tables h3 { font-size: 1rem; margin: 0 0 8px; }
