/* ==========================================================================
   Umbrella Docs · Umbrellasofts
   ========================================================================== */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../../lib/fonts/inter-latin-wght-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../../lib/fonts/inter-latin-ext-wght-normal.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --bg: #f5f6fb;
    --surface: #ffffff;
    --surface-2: #f8f9fc;
    --ink: #151a2d;
    --ink-2: #4a5270;
    --muted: #8a91aa;
    --line: #e6e8f0;
    --line-2: #d8dbe7;
    --accent: #4f46e5;
    --accent-2: #7c3aed;
    --accent-soft: #eef0ff;
    --accent-ink: #3730a3;
    --ok: #059669;
    --ok-soft: #e7f8f1;
    --warn: #d97706;
    --warn-soft: #fff6e6;
    --danger: #dc2626;
    --danger-soft: #fdeeee;
    --word: #2b579a;
    --pdf: #d93831;
    --zip: #a16207;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow-sm: 0 1px 2px rgba(21, 26, 45, .06);
    --shadow: 0 1px 2px rgba(21, 26, 45, .05), 0 8px 24px -8px rgba(21, 26, 45, .12);
    --shadow-lg: 0 24px 60px -20px rgba(49, 46, 129, .35);
    --ease: cubic-bezier(.22, 1, .36, 1);
    --spring: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    min-height: 100vh;
    padding-bottom: 96px;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
b, strong { font-weight: 650; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: var(--ink); }
[hidden] { display: none !important; }
code.var, .var {
    font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
    font-size: .88em;
    background: var(--accent-soft);
    color: var(--accent-ink);
    padding: 1px 7px;
    border-radius: 6px;
    white-space: nowrap;
}
.ico { width: 18px; height: 18px; flex-shrink: 0; }

/* ---------- Fondo decorativo ---------- */
.bg-decor { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-decor span {
    position: absolute; border-radius: 50%; filter: blur(80px); opacity: .45;
    animation: drift 22s ease-in-out infinite alternate;
}
.bg-decor span:nth-child(1) { width: 520px; height: 520px; background: #c7d2fe; top: -180px; left: -120px; }
.bg-decor span:nth-child(2) { width: 460px; height: 460px; background: #e9d5ff; top: -140px; right: -160px; animation-delay: -7s; }
.bg-decor span:nth-child(3) { width: 380px; height: 380px; background: #bae6fd; bottom: -200px; left: 35%; opacity: .3; animation-delay: -14s; }
@keyframes drift { to { transform: translate(60px, 40px) scale(1.1); } }

/* ---------- Barra superior ---------- */
.topbar {
    max-width: 1180px; margin: 0 auto; padding: 22px 24px 8px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
    width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 8px 20px -6px rgba(79, 70, 229, .6);
}
.brand-mark .ico { width: 22px; height: 22px; }
.brand-title { font-weight: 750; font-size: 17px; letter-spacing: -.01em; }
.brand-sub { color: var(--muted); font-size: 13px; }

/* ---------- Stepper ---------- */
.stepper {
    position: relative; max-width: 760px; margin: 18px auto 8px; padding: 0 24px;
    display: grid; grid-template-columns: repeat(4, 1fr);
}
.stepper-line {
    position: absolute; top: 21px; left: calc(12.5% + 24px); right: calc(12.5% + 24px);
    height: 3px; background: var(--line); border-radius: 3px; overflow: hidden;
}
.stepper-fill {
    height: 100%; width: 0; border-radius: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transition: width .7s var(--ease);
}
.step {
    position: relative; z-index: 1; background: none; border: 0; padding: 0; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.step:disabled { cursor: not-allowed; }
.step-dot {
    width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
    background: var(--surface); border: 2px solid var(--line-2); color: var(--muted);
    transition: all .45s var(--ease);
}
.step-label { font-size: 13px; font-weight: 600; color: var(--muted); transition: color .3s; }
.step.done .step-dot { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.step.done .step-label { color: var(--ink-2); }
.step.active .step-dot {
    background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff;
    transform: scale(1.12); box-shadow: 0 0 0 6px rgba(79, 70, 229, .14), 0 10px 22px -8px rgba(79, 70, 229, .7);
}
.step.active .step-label { color: var(--accent-ink); }

/* ---------- Contenedor y paneles ---------- */
.shell { max-width: 1180px; margin: 0 auto; padding: 16px 24px 24px; }
.panel {
    background: rgba(255, 255, 255, .86); backdrop-filter: blur(12px);
    border: 1px solid rgba(230, 232, 240, .9); border-radius: 24px;
    box-shadow: var(--shadow); padding: 34px 38px 38px;
}
.panel.enter-right { animation: enterRight .55s var(--ease) both; }
.panel.enter-left { animation: enterLeft .55s var(--ease) both; }
@keyframes enterRight { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes enterLeft { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }

.panel-head { margin-bottom: 22px; max-width: 760px; }
.panel-head > * { animation: fadeUp .6s var(--ease) both; }
.panel-head > *:nth-child(2) { animation-delay: .06s; }
.panel-head > *:nth-child(3) { animation-delay: .12s; }
.eyebrow {
    display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; margin-bottom: 12px;
}
.panel-head h1 { font-size: 30px; font-weight: 780; margin-bottom: 8px; }
.lead { color: var(--ink-2); font-size: 16px; margin: 0; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Botones ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid transparent; border-radius: 12px; padding: 10px 18px; cursor: pointer;
    font-weight: 600; font-size: 14.5px; white-space: nowrap; text-decoration: none;
    transition: transform .2s var(--ease), box-shadow .2s, background .2s, opacity .2s, color .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary {
    color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 8px 20px -8px rgba(79, 70, 229, .75);
}
.btn-primary:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 12px 26px -8px rgba(79, 70, 229, .85); }
.btn-soft { background: var(--accent-soft); color: var(--accent-ink); }
.btn-soft:hover { background: #e2e5ff; }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn-xl { padding: 16px 32px; font-size: 17px; border-radius: 16px; }
.btn-xl .ico { width: 22px; height: 22px; }
.btn.loading { pointer-events: none; }
.btn.loading .ico { animation: spin 1s linear infinite; }
.icon-btn {
    width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; cursor: pointer;
    background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); transition: all .2s;
}
.icon-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.link { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Ayuda ---------- */
.help {
    border: 1px solid #e3e6ff; background: linear-gradient(180deg, #f7f8ff, #fbfbff);
    border-radius: var(--radius); margin-bottom: 22px; overflow: hidden;
}
.help summary {
    cursor: pointer; list-style: none; padding: 14px 18px; font-weight: 650; color: var(--accent-ink);
    display: flex; align-items: center; gap: 10px;
}
.help summary::-webkit-details-marker { display: none; }
.help summary::after { content: '▾'; margin-left: auto; transition: transform .3s; color: var(--muted); }
.help[open] summary::after { transform: rotate(180deg); }
.help-body { padding: 0 18px 18px; animation: fadeUp .4s var(--ease); }
.help-grid { display: grid; grid-template-columns: minmax(0, 380px) 1fr; gap: 26px; align-items: center; }
.mini-sheet {
    background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: 12.5px;
    box-shadow: var(--shadow-sm);
}
.ms-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr; }
.ms-row span { padding: 6px 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-head span { background: #e8f5ec; font-weight: 700; color: #166534; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; color: var(--ink-2); }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist .ico { color: var(--ok); margin-top: 3px; background: var(--ok-soft); border-radius: 50%; padding: 3px; width: 20px; height: 20px; }

/* ---------- Dropzone ---------- */
.dropzone {
    position: relative; border: 2px dashed var(--line-2); border-radius: 22px; background: var(--surface-2);
    min-height: 240px; display: grid; place-items: center; text-align: center; cursor: pointer; padding: 30px;
    transition: border-color .25s, background .25s, transform .35s var(--spring), box-shadow .25s;
    outline: none;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); background: #f6f6ff; }
.dropzone.drag {
    border-color: var(--accent); background: var(--accent-soft); transform: scale(1.015);
    box-shadow: 0 0 0 8px rgba(79, 70, 229, .08);
}
.dropzone.drag .dz-icon { transform: translateY(-8px) scale(1.1); }
.dz-compact { min-height: 200px; }
.dz-busy { display: none; }
.dropzone.busy { cursor: progress; border-style: solid; border-color: var(--accent); background: #fafaff; }
.dropzone.busy .dz-idle { display: none; }
.dropzone.busy .dz-busy { display: grid; justify-items: center; gap: 6px; animation: fadeUp .4s var(--ease); }
.dz-icon {
    width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 22px; display: grid; place-items: center;
    background: linear-gradient(135deg, #eef0ff, #f3e8ff); color: var(--accent);
    animation: float 3.2s ease-in-out infinite; transition: transform .35s var(--spring);
}
.dz-icon .ico { width: 36px; height: 36px; }
@keyframes float { 50% { transform: translateY(-7px); } }
.dz-title { font-size: 18px; font-weight: 700; }
.dz-sub { color: var(--muted); }
.dz-formats { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.dz-formats span { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; padding: 4px 10px; border-radius: 8px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); }

.ring { position: relative; width: 84px; height: 84px; margin-bottom: 8px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4; }
.ring-bg { stroke: var(--line); }
.ring-fg { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 125.7; stroke-dashoffset: 125.7; transition: stroke-dashoffset .3s var(--ease); }
.ring.indeterminate svg { animation: spin 1.1s linear infinite; }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 15px; color: var(--accent-ink); }
.spinner {
    width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--accent-soft); border-top-color: var(--accent);
    animation: spin .9s linear infinite; margin-bottom: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Resultado de datos ---------- */
.result { margin-top: 4px; }
.file-card {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
    box-shadow: var(--shadow-sm);
}
.file-icon { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; background: #e8f5ec; color: #15803d; }
.file-icon .ico { width: 26px; height: 26px; }
.file-meta { flex: 1; min-width: 180px; }
.file-name { font-weight: 700; word-break: break-all; }
.file-sub { color: var(--muted); font-size: 13.5px; }
.file-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.field-inline { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.field-inline select, .field-inline input { padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; }
.field-inline input { width: 70px; }
.pop-in { animation: popIn .5s var(--spring) both; }
@keyframes popIn { from { opacity: 0; transform: scale(.94) translateY(8px); } to { opacity: 1; transform: none; } }

.sheet-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.sheet-card {
    text-align: left; padding: 14px 16px; border-radius: 14px; background: #fff; border: 1.5px solid var(--line); cursor: pointer;
    display: grid; gap: 6px; transition: all .3s var(--spring); animation: popIn .45s var(--spring) both;
}
.sheet-card:hover { transform: translateY(-2px); border-color: #c7cbff; box-shadow: var(--shadow); }
.sheet-card.active { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); background: linear-gradient(180deg, #fff, #f8f8ff); }
.sheet-card-top { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.sheet-card-top .ico { color: #15803d; }
.sheet-card-top .badge { white-space: nowrap; flex-shrink: 0; margin-left: auto; font-size: 11px; font-weight: 700; color: #fff; background: var(--accent); padding: 2px 8px; border-radius: 999px; }
.sheet-card small { color: var(--muted); }
.sheet-card .sheet-cols { display: flex; flex-wrap: wrap; gap: 4px; }
.sheet-card .sheet-cols span { font-size: 11.5px; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.sheet-card .sheet-cols span.new { background: #fff6e6; border-color: #fde4b8; color: #92400e; font-weight: 600; }

.section-title { font-size: 15.5px; font-weight: 700; margin: 26px 0 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section-title .ico { color: var(--accent); }
.section-title small { font-weight: 500; color: var(--muted); font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; margin: -4px 0 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none;
    padding: 7px 12px; border-radius: 10px; border: 1px solid #dfe2ff; background: #fff;
    font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 13px; color: var(--accent-ink);
    box-shadow: var(--shadow-sm); transition: transform .2s var(--spring), background .2s, border-color .2s;
    animation: chipIn .45s var(--spring) both;
}
.chip:hover { transform: translateY(-2px); border-color: var(--accent); background: var(--accent-soft); }
.chip small { font-family: 'Inter', sans-serif; color: var(--muted); font-size: 11.5px; }
.chip.sys { border-color: #e9d5ff; color: #6b21a8; }
.chip.sys:hover { background: #f5edff; border-color: var(--accent-2); }
.chips-sm .chip { padding: 5px 9px; font-size: 12px; }
@keyframes chipIn { from { opacity: 0; transform: translateY(8px) scale(.9); } to { opacity: 1; transform: none; } }

.custom-vars { margin-top: 20px; padding: 4px 18px 16px; border-radius: var(--radius); border: 1.5px dashed #d9ccff; background: linear-gradient(180deg, #fbf9ff, #fff); }
.custom-vars-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.custom-vars-head .section-title { margin-top: 14px; }
.custom-vars-head .hint { margin: -4px 0 12px; }
.chip.custom { border-color: #d9ccff; color: #6b21a8; background: #fff; }
.chip.custom:hover { background: #f5edff; border-color: var(--accent-2); }
.chip.custom .chip-x { margin-left: 2px; width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--muted); }
.chip.custom .chip-x:hover { background: var(--danger-soft); color: var(--danger); }
.chip.custom .chip-x .ico { width: 12px; height: 12px; }
.empty-custom { color: var(--muted); font-size: 13px; }
.var-form { text-align: left; display: grid; gap: 14px; margin-top: 4px; }
.var-form label { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.var-form input, .var-form select { padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; font: inherit; font-weight: 500; outline: none; }
.var-form input:focus, .var-form select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); }
.var-form .modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.var-form .mode { position: relative; }
.var-form .mode input { position: absolute; opacity: 0; }
.var-form .mode span { display: grid; gap: 2px; text-align: center; padding: 10px 8px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; font-size: 13px; transition: all .2s; }
.var-form .mode span small { color: var(--muted); font-weight: 500; font-size: 11.5px; }
.var-form .mode input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.var-form .var-key { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.var-form .var-preview { padding: 10px 12px; border-radius: 10px; background: var(--ok-soft); color: #065f46; font-size: 13.5px; }
.var-form .ins-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.var-form .ins-chips .chip { padding: 3px 7px; font-size: 11.5px; animation: none; }
.table-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.table-tools { display: flex; gap: 10px; align-items: center; }
.search { position: relative; display: flex; align-items: center; }
.search .ico { position: absolute; left: 11px; color: var(--muted); width: 16px; height: 16px; }
.search input { padding: 8px 12px 8px 34px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; width: 230px; outline: none; transition: border-color .2s, box-shadow .2s; }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); }
.table-wrap {
    border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: auto; max-height: 460px;
    /* Sombras laterales que indican que hay más columnas al deslizar */
    background:
        linear-gradient(to right, #fff 30%, rgba(255, 255, 255, 0)) left / 40px 100% no-repeat local,
        linear-gradient(to left, #fff 30%, rgba(255, 255, 255, 0)) right / 40px 100% no-repeat local,
        radial-gradient(farthest-side at 0 50%, rgba(21, 26, 45, .16), transparent) left / 14px 100% no-repeat scroll,
        radial-gradient(farthest-side at 100% 50%, rgba(21, 26, 45, .16), transparent) right / 14px 100% no-repeat scroll,
        #fff;
}
.scroll-hint {
    display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 8px 12px; border-radius: 10px;
    background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; font-weight: 600; animation: fadeUp .4s var(--ease);
}
.scroll-hint .ico { width: 16px; height: 16px; animation: nudgeX 1.6s ease-in-out infinite; }
@keyframes nudgeX { 50% { transform: translateX(5px); } }
.scroll-hint .col-jump { margin-left: auto; display: flex; gap: 6px; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.data-table th {
    position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; font-weight: 650; color: var(--ink-2);
    padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.data-table th .var { display: table; font-size: 10.5px; margin-top: 3px; font-weight: 500; }
.data-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .15s, opacity .2s; animation: rowIn .35s var(--ease) both; }
.data-table tbody tr:hover { background: #fafbff; }
.data-table tr.off td { opacity: .42; text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, .25); }
.data-table tr.off td:first-child { text-decoration: none; opacity: 1; }
.data-table .num { color: var(--muted); width: 36px; font-variant-numeric: tabular-nums; }
@keyframes rowIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.table-more { text-align: center; margin-top: 10px; }
input[type=checkbox].cb { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

.skeleton { border-radius: 8px; height: 14px; background: linear-gradient(90deg, #eef0f5 25%, #f7f8fb 50%, #eef0f5 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Alertas ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; margin-top: 16px; font-size: 14px; animation: fadeUp .4s var(--ease); }
.alert .ico { margin-top: 2px; }
.alert-warn { background: var(--warn-soft); color: #92400e; border: 1px solid #fde4b8; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #dbeafe; }
.alert-ok { background: var(--ok-soft); color: #065f46; border: 1px solid #c6eedd; }

/* ---------- Pestañas ---------- */
.tabs { position: relative; display: flex; gap: 4px; padding: 5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; width: fit-content; max-width: 100%; overflow-x: auto; margin-bottom: 22px; }
.tab { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 9px 16px; border-radius: 10px; cursor: pointer; font-weight: 600; color: var(--ink-2); white-space: nowrap; transition: color .25s; }
.tab.active { color: var(--accent-ink); }
.tab-ink { position: absolute; z-index: 0; top: 5px; bottom: 5px; background: #fff; border-radius: 10px; box-shadow: var(--shadow); transition: left .4s var(--ease), width .4s var(--ease); }
.tab-panel { animation: fadeUp .45s var(--ease); }

/* ---------- Galería ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tpl-card {
    position: relative; display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: var(--radius);
    background: #fff; border: 1.5px solid var(--line); cursor: pointer; text-align: left;
    transition: transform .3s var(--spring), box-shadow .3s, border-color .25s; animation: popIn .5s var(--spring) both;
}
.tpl-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: #c7cbff; }
.tpl-card.selected { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(79, 70, 229, .14), var(--shadow); }
.tpl-card.selected::after {
    content: '✓'; position: absolute; top: -10px; right: -10px; width: 28px; height: 28px; border-radius: 50%;
    display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--accent);
    box-shadow: 0 4px 10px rgba(79, 70, 229, .5); animation: popIn .4s var(--spring);
}
.tpl-top { display: flex; align-items: center; gap: 12px; }
.tpl-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.tpl-icon.word { background: #e8effa; color: var(--word); }
.tpl-icon.edit { background: #f5edff; color: #7e22ce; }
.tpl-name { font-weight: 700; line-height: 1.3; }
.tpl-badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tpl-desc { color: var(--ink-2); font-size: 13.5px; flex: 1; }
.tpl-vars { display: flex; flex-wrap: wrap; gap: 5px; }
.tpl-vars .var { font-size: 11px; }
.tpl-actions { display: flex; gap: 6px; margin-top: 4px; }
.tpl-actions .btn { flex: 1; }
.tpl-actions .btn-sm.icon-only { flex: 0 0 auto; padding: 7px 9px; }
.tpl-thumb {
    height: 120px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; position: relative;
}
.tpl-thumb-inner { transform: scale(.34); transform-origin: top left; width: 294%; padding: 22px 26px; font-size: 13px; color: #333; pointer-events: none; }
.tpl-thumb-inner .var { font-size: 12px; }
.tpl-thumb::after { content: ''; position: absolute; inset: auto 0 0 0; height: 40px; background: linear-gradient(transparent, var(--surface-2)); }
.tpl-thumb.word-thumb { display: grid; place-items: center; color: var(--word); }
.tpl-thumb.word-thumb .ico { width: 44px; height: 44px; opacity: .6; }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 30px; }

/* ---------- Subir Word ---------- */
.upload-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; }
.howto h3 { font-size: 17px; margin-bottom: 14px; }
.howto-steps { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 12px; }
.howto-steps li { display: flex; gap: 12px; align-items: flex-start; color: var(--ink-2); animation: fadeUp .5s var(--ease) both; }
.howto-steps li:nth-child(2) { animation-delay: .08s; } .howto-steps li:nth-child(3) { animation-delay: .16s; }
.howto-steps li > span { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.doc-mock { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px; margin-bottom: 16px; box-shadow: var(--shadow); font-size: 13.5px; color: #333; font-family: Georgia, 'Times New Roman', serif; }
.doc-mock p { margin: 0 0 8px; }
.doc-mock mark { background: #fff3c4; color: #7c5a00; border-radius: 4px; padding: 0 3px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; animation: glow 2.4s ease-in-out infinite; }
@keyframes glow { 50% { background: #ffe58a; } }
.dm-line { height: 8px; border-radius: 4px; background: #eceef4; margin: 8px 0; }
.dm-line.w40 { width: 40%; } .dm-line.w80 { width: 80%; } .dm-line.right { margin-left: auto; }
.field { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 14px; }
.field input, .field select {
    padding: 11px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; font-weight: 500; outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); }
.grow { flex: 1; }

/* ---------- Editor ---------- */
.editor-top { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.editor-top .field { margin-bottom: 0; min-width: 240px; }
.editor-actions { display: flex; gap: 10px; }
.var-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 16px 0 12px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
.var-bar-label { display: flex; align-items: center; gap: 6px; font-weight: 650; font-size: 13.5px; color: var(--ink-2); }

/* ---------- Revisar ---------- */
.review-grid { display: grid; grid-template-columns: 400px 1fr; gap: 26px; align-items: start; }
.match-summary { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 14px; margin-bottom: 14px; animation: popIn .5s var(--spring); }
.match-summary.ok { background: var(--ok-soft); color: #065f46; }
.match-summary.warn { background: var(--warn-soft); color: #92400e; }
.match-summary .ms-icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: #fff; flex-shrink: 0; }
.match-summary b { display: block; }
.match-summary small { opacity: .85; }
.map-list { display: grid; gap: 10px; }
.map-row { padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; animation: fadeUp .45s var(--ease) both; transition: border-color .3s, box-shadow .3s; }
.map-row.warn { border-color: #fbd38d; box-shadow: 0 0 0 3px rgba(217, 119, 6, .08); }
.map-row-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.map-status { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; transition: all .3s var(--spring); }
.map-status .ico { width: 13px; height: 13px; stroke-width: 3; }
.map-status.ok { background: var(--ok); color: #fff; }
.map-status.warn { background: var(--warn); color: #fff; animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(217, 119, 6, .45); } 70% { box-shadow: 0 0 0 8px rgba(217, 119, 6, 0); } 100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0); } }
.map-row.check { border-color: #c7d2fe; box-shadow: 0 0 0 3px rgba(79, 70, 229, .08); }
.map-status.check { background: var(--accent); color: #fff; }
.map-review { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--accent-ink); background: var(--accent-soft); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }
.map-review .ico { width: 15px; height: 15px; margin-top: 2px; }
.opt-btn { border: 1px solid #c7cbff; background: #fff; border-radius: 8px; padding: 2px 8px; margin: 2px 3px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--accent-ink); transition: all .2s; }
.opt-btn:hover { background: var(--accent); color: #fff; }
.opt-btn small { font-weight: 400; opacity: .75; }
.map-arrow { color: var(--muted); margin-left: auto; font-size: 12px; }
.map-row select, .map-row input { width: 100%; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; outline: none; }
.map-row select:focus, .map-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.map-row input { margin-top: 8px; }
.map-sample { font-size: 12.5px; color: var(--muted); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-sample b { color: var(--ink-2); font-weight: 600; }
.card-sub { margin-top: 18px; padding: 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.card-sub .field { margin-bottom: 10px; }
.card-sub .hint { margin: 10px 0 0; word-break: break-all; }

.review-left, .review-right { min-width: 0; }
.review-right { position: sticky; top: 16px; }
.preview-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.preview-who { flex: 1; text-align: center; min-width: 0; }
.preview-who span { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-who small { color: var(--muted); }
.preview-stage { position: relative; background: #e9ebf2; border-radius: 16px; padding: 22px; height: 640px; overflow: auto; }
.preview-loading { position: absolute; inset: 0; z-index: 3; display: grid; place-content: center; justify-items: center; gap: 4px; color: var(--ink-2); font-weight: 600; background: rgba(233, 235, 242, .75); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .25s; }
.preview-stage.loading .preview-loading { opacity: 1; }
.preview-doc { transition: opacity .3s, transform .3s var(--ease); }
.preview-stage.loading .preview-doc { opacity: .5; transform: scale(.99); }
.sheet-page { background: #fff; max-width: 720px; margin: 0 auto; min-height: 900px; padding: 64px 70px; box-shadow: 0 6px 24px rgba(0, 0, 0, .12); color: #1f2430; font-size: 14.5px; line-height: 1.55; border-radius: 3px; }
.sheet-page p { margin: 0 0 6px; }
.sheet-page h1 { font-size: 24px; margin-bottom: 12px; } .sheet-page h2 { font-size: 19px; margin: 10px 0; } .sheet-page h3 { font-size: 16px; margin: 8px 0; }
.sheet-page table { border-collapse: collapse; width: 100%; } .sheet-page td, .sheet-page th { border: 1px solid #c9ced8; padding: 5px 8px; }
.sheet-page img { max-width: 100%; }
.sheet-page .ql-align-center { text-align: center; } .sheet-page .ql-align-right { text-align: right; } .sheet-page .ql-align-justify { text-align: justify; }
.sheet-page .filled { background: #fff7cc; border-radius: 3px; box-shadow: 0 0 0 2px #fff7cc; transition: background 1.2s; }
.preview-doc .docx-wrapper { background: transparent !important; padding: 0 !important; }
.preview-doc .docx-wrapper > section.docx { box-shadow: 0 6px 24px rgba(0, 0, 0, .12) !important; margin-bottom: 18px !important; }

/* ---------- Generar ---------- */
.formats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.fmt input { position: absolute; opacity: 0; pointer-events: none; }
.fmt-box {
    position: relative; display: grid; gap: 4px; padding: 18px; border-radius: var(--radius); background: #fff; border: 1.5px solid var(--line);
    cursor: pointer; height: 100%; transition: all .3s var(--spring); animation: popIn .5s var(--spring) both;
}
.fmt:nth-child(2) .fmt-box { animation-delay: .05s; } .fmt:nth-child(3) .fmt-box { animation-delay: .1s; } .fmt:nth-child(4) .fmt-box { animation-delay: .15s; } .fmt:nth-child(5) .fmt-box { animation-delay: .2s; }
.fmt-box:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.fmt-box small { color: var(--muted); }
.fmt-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 8px; }
.fmt-icon .ico { width: 22px; height: 22px; }
.fmt-icon.word { background: #e8effa; color: var(--word); } .fmt-icon.pdf { background: #fdecec; color: var(--pdf); } .fmt-icon.zip { background: #fdf6e3; color: var(--zip); }
.fmt-check { position: absolute; top: 14px; right: 14px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; color: transparent; transition: all .3s var(--spring); }
.fmt-check .ico { width: 14px; height: 14px; stroke-width: 3; }
.fmt input:checked + .fmt-box { border-color: var(--accent); background: linear-gradient(180deg, #fff, #f8f8ff); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); }
.fmt input:checked + .fmt-box .fmt-check { background: var(--accent); border-color: var(--accent); color: #fff; transform: scale(1.1); }
.fmt input:focus-visible + .fmt-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.gen-cta { text-align: center; margin-top: 30px; }
.layout-pick .section-title { margin: 0 0 12px; }
.layout-pick .section-title:last-child { margin-top: 26px; }
.formats.layouts { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.layout-group { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 14px; }
.layout-group select { max-width: 100%; }
.layout-group .hint { flex-basis: 100%; margin: 0; }
.layout-preview .docx-wrapper { background: transparent !important; padding: 0 !important; }
.layout-preview .docx-wrapper > section.docx { box-shadow: 0 4px 18px rgba(0, 0, 0, .15) !important; margin: 0 auto 14px !important; }
.layout-preview { max-height: 70vh; overflow: auto; text-align: left; }

.progress-hero, .done-hero { text-align: center; max-width: 640px; margin: 10px auto 0; padding: 20px 0; }
.progress-hero h1, .done-hero h1 { font-size: 28px; margin: 18px 0 6px; }
.paper-stack { position: relative; width: 90px; height: 110px; margin: 0 auto; }
.paper-stack span { position: absolute; inset: 0; background: #fff; border-radius: 8px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.paper-stack span::before, .paper-stack span::after { content: ''; position: absolute; left: 14px; right: 14px; height: 6px; border-radius: 3px; background: #e5e7f0; top: 22px; box-shadow: 0 14px 0 #e5e7f0, 0 28px 0 #e5e7f0, 0 42px 0 #eef0ff; }
.paper-stack span::after { top: auto; bottom: 16px; right: 44px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); box-shadow: none; }
.paper-stack span:nth-child(1) { transform: rotate(-8deg) translate(-8px, 4px); opacity: .6; }
.paper-stack span:nth-child(2) { transform: rotate(6deg) translate(8px, 2px); opacity: .8; }
.paper-stack span:nth-child(3) { animation: deal 1.4s var(--ease) infinite; }
@keyframes deal { 0% { transform: translateY(0); opacity: 1; } 60% { transform: translate(90px, -30px) rotate(18deg); opacity: 0; } 61% { transform: translateY(20px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
.bar { height: 14px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 24px 0 8px; }
.bar-fill { position: relative; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .6s var(--ease); overflow: hidden; }
.bar-fill::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent); animation: sheen 1.6s infinite; transform: translateX(-100%); }
@keyframes sheen { to { transform: translateX(100%); } }
.prog-meta { display: flex; justify-content: space-between; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.prog-feed { list-style: none; padding: 0; margin: 22px auto 0; max-width: 420px; display: grid; gap: 6px; min-height: 150px; }
.prog-feed li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: #fff; border: 1px solid var(--line); font-size: 13.5px; text-align: left; animation: feedIn .45s var(--spring) both; }
.prog-feed li .ico { color: var(--ok); width: 16px; height: 16px; }
.prog-feed li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes feedIn { from { opacity: 0; transform: translateY(-10px) scale(.96); } to { opacity: 1; transform: none; } }
.prog-tip { color: var(--muted); font-size: 13.5px; margin-top: 16px; min-height: 22px; transition: opacity .4s; }

.check-anim { width: 96px; height: 96px; }
.check-anim circle { fill: var(--ok-soft); stroke: var(--ok); stroke-width: 4; stroke-dasharray: 227; stroke-dashoffset: 227; animation: draw .7s var(--ease) forwards; }
.check-anim path { fill: none; stroke: var(--ok); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .45s .55s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.done-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
.done-actions .btn { animation: popIn .5s var(--spring) both; }
.done-actions .btn:nth-child(2) { animation-delay: .08s; } .done-actions .btn:nth-child(3) { animation-delay: .16s; }
.dl-link { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 650; text-decoration: none; margin-right: 6px; transition: transform .2s var(--spring); }
.dl-link:hover { transform: translateY(-1px); }
.dl-link .ico { width: 14px; height: 14px; }
.dl-link.word { background: #e8effa; color: var(--word); } .dl-link.pdf { background: #fdecec; color: var(--pdf); }
.done-footer { display: flex; justify-content: center; gap: 12px; margin-top: 22px; flex-wrap: wrap; }

/* ---------- Navegación inferior ---------- */
.navbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: flex; align-items: center; gap: 16px; justify-content: space-between;
    padding: 14px max(24px, calc((100vw - 1180px) / 2 + 24px));
    background: rgba(255, 255, 255, .88); backdrop-filter: blur(14px); border-top: 1px solid var(--line);
    transition: transform .4s var(--ease);
}
.navbar.hide { transform: translateY(110%); }
.nav-hint { flex: 1; text-align: center; color: var(--ink-2); font-size: 14px; }
.nav-hint b { color: var(--accent-ink); }
#btnNext.ready { animation: nudge 2.4s ease-in-out infinite; }
@keyframes nudge { 0%, 80%, 100% { transform: none; } 85% { transform: translateX(4px); } 90% { transform: none; } 95% { transform: translateX(3px); } }

/* ---------- Toasts ---------- */
.toast-zone { position: fixed; top: 20px; right: 20px; z-index: 60; display: grid; gap: 10px; }
.toast { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); font-size: 14px; animation: toastIn .45s var(--spring) both; max-width: 360px; }
.toast.out { animation: toastOut .3s var(--ease) forwards; }
.toast.ok .ico { color: #6ee7b7; } .toast.err { background: #7f1d1d; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* SweetAlert al estilo de la app */
.swal2-popup { border-radius: 20px !important; font-family: 'Inter', sans-serif !important; }
.swal2-confirm { background: linear-gradient(135deg, var(--accent), var(--accent-2)) !important; border-radius: 12px !important; }
.swal2-cancel { border-radius: 12px !important; }
.howto-modal { text-align: left; display: grid; gap: 14px; margin-top: 6px; }
.howto-modal div { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; color: var(--ink-2); }
.howto-modal span { width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
    .review-grid, .upload-grid { grid-template-columns: 1fr; }
    .review-right { position: static; }
    .preview-stage { height: 520px; }
}
@media (max-width: 720px) {
    .panel { padding: 24px 18px; border-radius: 18px; }
    .panel-head h1 { font-size: 24px; }
    .help-grid { grid-template-columns: 1fr; }
    .step-label { font-size: 11.5px; }
    .brand-sub, #btnHowTo span, .nav-hint { display: none; }
    .search input { width: 100%; }
    .sheet-page { padding: 32px 26px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Errores con pasos para resolverlos */
.err-help { text-align: left; font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }
.err-help p { margin: 0 0 12px; }
.err-help ol { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.err-help code.var { white-space: nowrap; }
