/* ==========================================================================
   Generátor kódov – vzhľad (nadväzuje na Bootstrap 5.3)
   ========================================================================== */

@font-face { font-family: "Poppins"; font-weight: 400; font-display: swap; src: url("fonts/Poppins-Regular.ttf") format("truetype"); }
@font-face { font-family: "Poppins"; font-weight: 500 600; font-display: swap; src: url("fonts/Poppins-Medium.ttf") format("truetype"); }
@font-face { font-family: "Poppins"; font-weight: 700 800; font-display: swap; src: url("fonts/Poppins-Bold.ttf") format("truetype"); }
@font-face { font-family: "CodeMono"; font-weight: 400; font-display: swap; src: url("fonts/DejaVuSansMono.ttf") format("truetype"); }

:root,
[data-bs-theme="light"] {
    --brand: #4f46e5;
    --brand-rgb: 79, 70, 229;
    --brand-deep: #312e81;
    --accent: #14b8a6;
    --surface: #ffffff;
    --surface-2: #f1f1f8;
    --page-bg: #f6f6fb;
    --soft-bg: #e0e7ff;
    --soft-fg: #312e81;
    --chip-border: #dcdcea;
    --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 8px 28px rgba(49, 46, 129, .07);

    --bs-primary: var(--brand);
    --bs-primary-rgb: var(--brand-rgb);
    --bs-link-color: var(--brand);
    --bs-link-color-rgb: var(--brand-rgb);
    --bs-link-hover-color: var(--brand-deep);
    --bs-body-bg: var(--page-bg);
    --bs-body-font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --bs-border-radius: .75rem;
    --bs-border-radius-lg: 1rem;
    --bs-border-radius-xl: 1.5rem;
    --bs-focus-ring-color: rgba(var(--brand-rgb), .25);
}

[data-bs-theme="dark"] {
    --brand: #a5b4fc;
    --brand-rgb: 165, 180, 252;
    --brand-deep: #c7d2fe;
    --accent: #5eead4;
    --surface: #17182b;
    --surface-2: #202139;
    --page-bg: #0e0f1d;
    --soft-bg: #2b2a5e;
    --soft-fg: #e0e7ff;
    --chip-border: #2f3150;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);

    --bs-body-bg: var(--page-bg);
    --bs-body-color: #e6e7f2;
    --bs-secondary-color: #a3a6c4;
    --bs-tertiary-bg: var(--surface-2);
    --bs-border-color: #2c2e4a;
    --bs-primary: var(--brand);
    --bs-primary-rgb: var(--brand-rgb);
    --bs-link-color: var(--brand);
    --bs-link-color-rgb: var(--brand-rgb);
}

body {
    background:
        radial-gradient(1100px 500px at 100% -10%, rgba(var(--brand-rgb), .10), transparent 60%),
        radial-gradient(900px 500px at -10% 10%, rgba(20, 184, 166, .07), transparent 60%),
        var(--page-bg);
    background-attachment: fixed;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Tlačidlá ---------- */
.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: #4338ca;
    --bs-btn-hover-border-color: #4338ca;
    --bs-btn-active-bg: #3730a3;
    --bs-btn-active-border-color: #3730a3;
    --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
    --bs-btn-focus-shadow-rgb: var(--brand-rgb);
}
[data-bs-theme="dark"] .btn-primary {
    --bs-btn-color: #1e1b4b;
    --bs-btn-hover-color: #1e1b4b;
    --bs-btn-active-color: #1e1b4b;
    --bs-btn-disabled-color: #1e1b4b;
    --bs-btn-hover-bg: #c7d2fe;
    --bs-btn-hover-border-color: #c7d2fe;
    --bs-btn-active-bg: #e0e7ff;
    --bs-btn-active-border-color: #e0e7ff;
}
.btn-outline-primary {
    --bs-btn-color: var(--brand);
    --bs-btn-border-color: rgba(var(--brand-rgb), .45);
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand);
    --bs-btn-active-border-color: var(--brand);
    --bs-btn-focus-shadow-rgb: var(--brand-rgb);
}
[data-bs-theme="dark"] .btn-outline-primary {
    --bs-btn-hover-color: #1e1b4b;
    --bs-btn-active-color: #1e1b4b;
}
.btn-soft {
    background: var(--soft-bg);
    color: var(--soft-fg);
    border: 0;
    font-weight: 500;
}
.btn-soft:hover, .btn-soft:focus-visible, .btn-soft.show { background: rgba(var(--brand-rgb), .22); color: var(--soft-fg); }
.btn-action { border-radius: 1rem; font-weight: 600; padding-top: .8rem; padding-bottom: .8rem; }
.btn-action.btn-lg { padding-top: .95rem; padding-bottom: .95rem; font-size: 1.02rem; }
.btn-icon {
    width: 40px; height: 40px; border-radius: 12px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--bs-body-color); border: 0; font-size: 1.1rem;
}
.btn-icon:hover { background: rgba(var(--brand-rgb), .1); color: var(--brand); }
#btnPalette { color: var(--brand); }

/* ---------- Navigácia ---------- */
.app-navbar {
    background: color-mix(in srgb, var(--page-bg) 78%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid color-mix(in srgb, var(--bs-border-color) 60%, transparent);
}
.app-logo { border-radius: 10px; box-shadow: 0 4px 14px rgba(79, 70, 229, .35); }
.app-tabs { gap: .25rem; background: var(--surface-2); padding: .3rem; border-radius: 14px; }
.app-tabs .nav-link {
    --bs-nav-pills-link-active-bg: var(--surface);
    --bs-nav-pills-link-active-color: var(--brand);
    color: var(--bs-secondary-color);
    border-radius: 11px; font-weight: 500; padding: .45rem 1rem; border: 0; background: transparent;
}
.app-tabs .nav-link.active { background: var(--surface); color: var(--brand); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.app-tabs .nav-link:hover:not(.active) { color: var(--bs-body-color); }
.app-tabs .badge { font-size: .68rem; vertical-align: 1px; }

.bottom-nav {
    position: fixed; inset: auto 0 0 0; z-index: 1030;
    display: grid; grid-template-columns: repeat(4, 1fr);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--bs-border-color);
    padding: .35rem .5rem calc(.35rem + env(safe-area-inset-bottom));
}
.bottom-nav button {
    position: relative; border: 0; background: none; color: var(--bs-secondary-color);
    display: flex; flex-direction: column; align-items: center; gap: .15rem;
    font-size: .72rem; font-weight: 500; padding: .3rem 0;
}
.bottom-nav button i {
    font-size: 1.2rem; width: 56px; height: 30px; border-radius: 15px;
    display: flex; align-items: center; justify-content: center; transition: background .2s;
}
.bottom-nav button.active { color: var(--brand); }
.bottom-nav button.active i { background: var(--soft-bg); }
.bottom-nav .badge { position: absolute; top: 0; left: 55%; font-size: .6rem; }
@media (max-width: 991.98px) {
    .app-main { padding-bottom: 6.5rem !important; }
}

/* ---------- Karty a sekcie ---------- */
.app-card {
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--bs-border-color) 55%, transparent);
    border-radius: 1.5rem;
    box-shadow: var(--shadow);
}
.hero-card { background: linear-gradient(160deg, var(--soft-bg), color-mix(in srgb, var(--soft-bg) 55%, var(--surface))); border: 0; }
.section-title {
    font-size: .95rem; font-weight: 600; margin-bottom: .6rem;
    display: flex; align-items: center; gap: .45rem;
}
.section-title i { color: var(--brand); }
.preview-sticky { top: 84px; z-index: 1; }
.alert-info-soft { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border: 0; border-radius: 1.25rem; color: var(--bs-body-color); }
.alert-info-soft i { color: var(--accent); }

/* ---------- Čipy ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
    border: 1px solid var(--chip-border); background: var(--surface); color: var(--bs-body-color);
    border-radius: 999px; padding: .38rem .9rem; font-size: .88rem; font-weight: 500;
    display: inline-flex; align-items: center; gap: .35rem; transition: all .15s;
}
.chip:hover { border-color: rgba(var(--brand-rgb), .6); color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(var(--brand-rgb), .3); }
[data-bs-theme="dark"] .chip.active { color: #1e1b4b; }

/* ---------- Formuláre ---------- */
.form-control, .form-select { border-radius: .9rem; border-color: var(--bs-border-color); }
.form-control:focus, .form-select:focus { border-color: rgba(var(--brand-rgb), .6); box-shadow: 0 0 0 .25rem rgba(var(--brand-rgb), .15); }
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select { background-color: var(--surface-2); }
.content-group textarea { font-family: "CodeMono", ui-monospace, monospace; font-size: 1rem; resize: vertical; min-height: 58px; }
.content-group .btn { border-color: var(--bs-border-color); }
.content-group.is-invalid textarea { border-color: var(--bs-danger); }
.form-range::-webkit-slider-thumb { background: var(--brand); }
.form-range::-moz-range-thumb { background: var(--brand); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.btn-check:checked + .btn-outline-primary { color: #fff; }
[data-bs-theme="dark"] .btn-check:checked + .btn-outline-primary { color: #1e1b4b; }
.search-group .form-control, .search-group .input-group-text { border-radius: 999px; }
.search-group .input-group-text { background: var(--surface); border-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.search-group .form-control { border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; background: var(--surface); }

/* ---------- Náhľad kódu ---------- */
.code-stage {
    background: #fff; border-radius: 1.25rem; min-height: 220px; padding: 1.5rem;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .04);
}
.code-stage svg { display: block; max-width: 100%; }
.code-stage .code-2d { width: min(62%, 260px); }
.code-stage .code-2d.wide { width: 100%; }
.code-stage .code-1d { width: 100%; aspect-ratio: 2.4; }
.code-stage .human { font-family: "CodeMono", monospace; color: #111827; margin-top: .4rem; letter-spacing: .04em; font-size: .95rem; word-break: break-all; text-align: center; }
.code-stage .code-error { color: #6b7280; text-align: center; }
.code-stage .code-error i { font-size: 2.2rem; color: #9ca3af; display: block; margin-bottom: .4rem; }
.dim-badge { background: var(--brand); color: #fff; font-weight: 600; }
[data-bs-theme="dark"] .dim-badge { color: #1e1b4b; }

/* ---------- A4 strana ---------- */
.page-wrap { display: flex; justify-content: center; }
.a4-page {
    position: relative; width: 100%; max-width: 420px; aspect-ratio: 595.28 / 841.89;
    background: #fff; border-radius: 6px; overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 12px 32px rgba(17, 24, 39, .16);
    container-type: inline-size; color: #111827; user-select: none;
}
.editor-wrap .a4-page { max-width: 560px; }
.a4-page .el { position: absolute; transform: translate(-50%, -50%); }
.a4-page .el-code svg { display: block; width: 100%; height: 100%; }
.a4-page .el-code .bars { width: 100%; }
.a4-page .el-code .human {
    font-family: "CodeMono", monospace; text-align: center; white-space: nowrap; line-height: 1;
    overflow: visible;
}
.a4-page .el-text { font-family: "Poppins", sans-serif; white-space: nowrap; line-height: 1.3; color: #111827; text-align: center; }
.a4-page .el-text.bold { font-weight: 700; }
.a4-page .el-text.empty { color: #a5a8c0; font-style: italic; }
.a4-page .labels { position: absolute; display: grid; }
.a4-page .label-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; }
.a4-page .label-cell.cut { outline: .5px dashed #c8c8d2; }
.a4-page .label-cell .lbl { font-family: "CodeMono", monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 95%; line-height: 1.2; }
.a4-page .placeholder-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #9ca3af; font-size: 4cqw; }

/* Editor šablóny */
.a4-page.editor .el { cursor: grab; touch-action: none; }
.a4-page.editor .el.dragging { cursor: grabbing; }
.a4-page.editor .el::after {
    content: ""; position: absolute; inset: -1.1cqw; border: 1px dashed rgba(129, 140, 248, .55); border-radius: 4px; pointer-events: none;
}
.a4-page.editor .el.selected::after { border: 2px solid #4f46e5; background: rgba(79, 70, 229, .06); }
.a4-page.editor .el.selected::before {
    content: ""; position: absolute; inset: -1.6cqw; pointer-events: none;
    background:
        radial-gradient(circle, #4f46e5 45%, transparent 50%) top left / 1.6cqw 1.6cqw no-repeat,
        radial-gradient(circle, #4f46e5 45%, transparent 50%) top right / 1.6cqw 1.6cqw no-repeat,
        radial-gradient(circle, #4f46e5 45%, transparent 50%) bottom left / 1.6cqw 1.6cqw no-repeat,
        radial-gradient(circle, #4f46e5 45%, transparent 50%) bottom right / 1.6cqw 1.6cqw no-repeat;
}
.a4-page .guide-v { position: absolute; top: 0; bottom: 0; left: 50%; border-left: 1px dashed #ec4899; display: none; pointer-events: none; }
.a4-page.snap .guide-v { display: block; }

/* ---------- História ---------- */
.hist-card { cursor: pointer; transition: transform .15s, box-shadow .15s; height: 100%; }
.hist-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0, 0, 0, .05), 0 16px 36px rgba(49, 46, 129, .12); }
.hist-thumb {
    width: 76px; height: 76px; flex: 0 0 76px; background: #fff; border-radius: 16px; padding: 8px;
    display: flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .05);
}
.hist-thumb svg { max-width: 100%; max-height: 100%; }
.hist-thumb .t1d { width: 100%; height: 36px; }
.hist-type { font-size: .75rem; font-weight: 600; color: var(--brand); text-transform: uppercase; letter-spacing: .04em; }
.hist-content { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-meta { font-size: .78rem; color: var(--bs-secondary-color); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-icon {
    width: 96px; height: 96px; border-radius: 32px; margin: 0 auto; background: var(--soft-bg); color: var(--brand);
    display: flex; align-items: center; justify-content: center; font-size: 2.6rem;
}
.hist-card.removing { opacity: 0; transform: scale(.96); transition: all .25s; }

/* ---------- Modály, paleta, toasty ---------- */
.app-modal { border: 0; border-radius: 1.5rem; background: var(--surface); box-shadow: 0 24px 64px rgba(0, 0, 0, .25); }
.palette-dialog { margin-top: 12vh; }
.palette-list { max-height: 50vh; overflow-y: auto; }
.palette-list .list-group-item {
    border: 0; border-radius: .75rem; margin: 0 .5rem .15rem; padding: .6rem .8rem;
    display: flex; align-items: center; gap: .75rem; background: transparent; color: var(--bs-body-color);
}
.palette-list .list-group-item i { width: 32px; height: 32px; border-radius: 10px; background: var(--soft-bg); color: var(--brand); display: flex; align-items: center; justify-content: center; }
.palette-list .list-group-item.active { background: rgba(var(--brand-rgb), .12); color: var(--bs-body-color); }
.palette-list .list-group-item kbd { margin-left: auto; }
kbd { background: var(--surface-2); color: var(--bs-body-color); border: 1px solid var(--bs-border-color); border-bottom-width: 2px; font-size: .75rem; }
.confirm-icon { width: 64px; height: 64px; border-radius: 22px; margin: 0 auto; background: rgba(220, 53, 69, .12); color: #dc3545; display: flex; align-items: center; justify-content: center; font-size: 1.7rem; }
.app-toasts { top: 72px; right: 0; z-index: 1090; }
@media (max-width: 991.98px) { .app-toasts { top: auto; bottom: 76px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; } }
.toast { border: 0; border-radius: 1rem; background: #1f2033; color: #fff; box-shadow: 0 12px 32px rgba(0, 0, 0, .25); }
.toast .btn-link { color: #a5b4fc; font-weight: 600; text-decoration: none; }
[data-bs-theme="dark"] .toast { background: #e6e7f2; color: #111; }
[data-bs-theme="dark"] .toast .btn-link { color: #4f46e5; }
.shortcuts td:first-child { white-space: nowrap; width: 1%; padding-right: 1.25rem; }

/* ---------- Prihlásenie ---------- */
.login-card { width: 100%; max-width: 400px; border-radius: 1.75rem; background: var(--surface); }

/* Prístupnosť */
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

body.is-busy, body.is-busy * { cursor: progress !important; }

/* ==========================================================================
   Polia s premennými
   ========================================================================== */
.var-wrap { position: relative; }
.var-wrap .var-input { padding-right: 3.2rem; }
.var-field { position: relative; }
.var-wrap .var-btn {
    position: absolute; right: .45rem; top: 50%; transform: translateY(-50%); height: 2.1rem; min-width: 2.4rem; padding: 0 .55rem;
    border-radius: .7rem; border: 0; background: var(--soft-bg); color: var(--soft-fg);
    font-family: "CodeMono", ui-monospace, monospace; font-weight: 700; font-size: .85rem; z-index: 5;
}
.var-wrap .var-btn:hover { background: rgba(var(--brand-rgb), .22); }
.var-field > .form-floating > .form-control { padding-right: 3.4rem; }
.var-preview { font-size: .8rem; color: var(--brand); padding: .25rem .25rem 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.var-quick { margin-top: .4rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.var-quick::-webkit-scrollbar { display: none; }
.chip.chip-sm { padding: .2rem .65rem; font-size: .78rem; white-space: nowrap; }
.var-group { font-size: .8rem; font-weight: 600; color: var(--brand); padding: .8rem 1rem .25rem; }
.var-item { display: flex; align-items: center; border: 0; border-radius: .75rem !important; padding: .55rem 1rem; background: transparent; }
.var-item code { color: var(--brand); font-size: .78rem; }
.var-sample { max-width: 150px; color: var(--bs-body-color); }

/* ==========================================================================
   Import z Excelu
   ========================================================================== */
.mode-group { flex-wrap: wrap; }
.drop-zone {
    border: 2px dashed color-mix(in srgb, var(--brand) 40%, transparent); border-radius: 1.25rem;
    padding: 1.75rem 1rem; background: color-mix(in srgb, var(--soft-bg) 45%, transparent); cursor: pointer; transition: all .15s;
}
.drop-zone:hover { border-color: var(--brand); background: color-mix(in srgb, var(--soft-bg) 70%, transparent); }
.drop-icon { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto; background: var(--soft-bg); color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 1.8rem; }
[data-pane="batch"].drop-active .app-card { outline: 3px dashed var(--brand); outline-offset: 4px; }
.src-card { background: var(--surface-2); border-radius: 1rem; padding: .75rem 1rem; }
.excel-preview { overflow-x: auto; border-radius: 1rem; background: var(--surface-2); padding: .25rem; }
.excel-table { --bs-table-bg: transparent; font-size: .82rem; white-space: nowrap; }
.excel-table th, .excel-table td { max-width: 170px; overflow: hidden; text-overflow: ellipsis; padding: .35rem .6rem; }
.excel-table th { font-weight: 600; border-bottom-color: var(--bs-border-color); }
.excel-table .mapped { background: rgba(var(--brand-rgb), .10); }
.excel-table th.mapped { border-radius: .5rem .5rem 0 0; }
.map-card { background: var(--surface-2); border-radius: 1.25rem; padding: 1rem; }
.map-row { display: flex; align-items: center; gap: .75rem; }
.map-label { width: 4.2rem; flex: 0 0 4.2rem; font-weight: 600; display: flex; align-items: center; gap: .35rem; }
.map-sample { padding: .3rem 0 0 4.95rem; }

/* ==========================================================================
   História – séria, súbory, detail
   ========================================================================== */
.hist-thumb-wrap { position: relative; width: 76px; height: 76px; flex: 0 0 76px; }
.hist-thumb-wrap .hist-thumb { position: absolute; inset: 0; width: auto; height: auto; }
.hist-thumb-wrap.stack .hist-thumb { inset: 8px 8px 0 0; width: auto; height: auto; }
.stack-card { position: absolute; width: calc(100% - 8px); height: calc(100% - 8px); border-radius: 14px; background: #fff; border: 1px solid var(--bs-border-color); }
.stack-card.s2 { right: 0; top: 0; opacity: .55; }
.stack-card.s1 { right: 4px; top: 4px; opacity: .8; }
.stack-count { position: absolute; right: -4px; bottom: -4px; background: var(--brand); color: #fff; border-radius: 999px; font-size: .68rem; font-weight: 700; padding: 0 .4rem; z-index: 2; }
[data-bs-theme="dark"] .stack-count { color: #1e1b4b; }
.hist-thumb-wrap.big { width: 104px; height: 104px; flex-basis: 104px; }
.file-badge { font-size: .65rem; font-weight: 700; color: var(--brand); background: rgba(var(--brand-rgb), .12); border-radius: .35rem; padding: 0 .35rem; }
.btn-icon-sm { width: 40px; height: 40px; border-radius: 12px; padding: 0; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 40px; }
.file-row { display: flex; align-items: center; gap: .5rem; padding: .6rem .75rem; border-radius: 1rem; background: var(--surface-2); }
.file-row.has-file { background: color-mix(in srgb, var(--soft-bg) 65%, var(--surface)); }
.file-row .file-ic { font-size: 1.25rem; color: var(--brand); width: 1.75rem; text-align: center; }
.texts-box { background: var(--surface-2); border-radius: 1rem; padding: .85rem 1rem .4rem; }
.lbl.lbl-text { font-family: "Poppins", sans-serif !important; }

/* ==========================================================================
   Prehliadač súborov
   ========================================================================== */
.viewer-modal { background: var(--surface-2); border: 0; }
.viewer-bar {
    display: flex; align-items: center; gap: .35rem; padding: .5rem .75rem; background: var(--surface);
    border-bottom: 1px solid var(--bs-border-color); padding-top: calc(.5rem + env(safe-area-inset-top));
}
.viewer-body { flex: 1; overflow: auto; position: relative; }
.viewer-pages { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 1rem; min-width: min-content; }
.viewer-page { position: relative; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.15); border-radius: 3px; flex: 0 0 auto; }
.viewer-page canvas { width: 100%; height: 100%; display: block; }
.viewer-pno { position: absolute; right: .5rem; bottom: .4rem; font-size: .7rem; color: #9ca3af; }
.viewer-loading { display: flex; align-items: center; justify-content: center; min-height: 60vh; padding: 1rem; }
.viewer-img-wrap { display: flex; justify-content: center; padding: 1rem; min-width: min-content; }
.viewer-img { max-width: none; background: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.15); image-rendering: pixelated; }

/* Gestá – jemná animácia pri prepnutí záložky potiahnutím */
@keyframes swipeInLeft { from { opacity: .3; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes swipeInRight { from { opacity: .3; transform: translateX(-40px); } to { opacity: 1; transform: none; } }
.app-pane.swipe-left { animation: swipeInLeft .22s ease-out; }
.app-pane.swipe-right { animation: swipeInRight .22s ease-out; }
