:root {
    --bg: #0f1419;
    --surface: #171d25;
    --surface-2: #1f2732;
    --border: #2d3744;
    --text: #eef2f7;
    --muted: #9aa7b8;
    --primary: #4f8cff;
    --primary-hover: #3d78e6;
    --danger: #ff6b6b;
    --success: #4cd964;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: linear-gradient(180deg, #0b1015 0%, #121821 100%);
    color: var(--text);
}

a {
    color: var(--primary);
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #000;
    background: #000;
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand, .viewer-brand {
    display: flex;
    align-items: center;
    min-width: 0;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text);
}

.logo {
    display: block;
    height: 88px;
    width: auto;
    max-width: min(760px, 78vw);
    object-fit: contain;
    object-position: left center;
}

@media (max-width: 720px) {
    .site-header {
        flex-wrap: wrap;
        justify-content: center;
        padding: 0.35rem 0;
        gap: 0.45rem;
    }

    .brand {
        width: 100%;
        justify-content: center;
    }

    .logo {
        height: auto;
        width: 100%;
        max-width: 100%;
        object-position: center;
    }

    .site-header nav:not(:has(a)) {
        display: none;
    }

    .site-header nav {
        width: 100%;
        justify-content: center;
        padding: 0 0.75rem 0.35rem;
    }
}

.site-header nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.site-main {
    width: min(1100px, calc(100% - 2rem));
    margin: 2rem auto 4rem;
}

.hero {
    padding: 2rem 0 3rem;
}

.eyebrow {
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
    margin: 0 0 0.75rem;
}

@media (max-width: 720px) {
    .site-main {
        width: min(1100px, calc(100% - 1rem));
        margin: 0.45rem auto 2rem;
    }

    .hero {
        padding: 0.2rem 0 0.35rem;
    }

    .eyebrow {
        font-size: clamp(1.55rem, 7.2vw, 2.1rem);
        font-weight: 800;
        letter-spacing: 0.08em;
        margin: 0;
        text-align: center;
        line-height: 1.15;
    }

    .panel-header {
        margin-bottom: 0.85rem;
    }
}

h1, h2, h3 {
    margin: 0 0 0.75rem;
    line-height: 1.2;
}

.lead {
    color: var(--muted);
    max-width: 60ch;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.panel.narrow {
    width: min(480px, 100%);
    margin: 0 auto;
}

.panel-header {
    margin-bottom: 1.5rem;
}

.panel-header.split {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.sort-tabs {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.sort-tabs a {
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.sort-tabs a.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.65rem 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s ease;
}

.btn-sm {
    padding: 0.45rem 0.8rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.85rem 1.4rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover,
.btn-secondary.active {
    border-color: var(--primary);
    color: white;
}

.btn-success {
    background: var(--success);
    color: #083312;
}

.btn-success:hover {
    background: #3cc456;
}

.btn.is-disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

.btn-facebook {
    background: #1877f2;
    color: #fff;
}

.btn-facebook:hover {
    background: #0d65d9;
}

.btn-facebook:disabled {
    opacity: 0.7;
    cursor: wait;
}

.share-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.85rem 0 0;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #e85a5a;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.link-button {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 0;
    font: inherit;
}

.form-stack {
    display: grid;
    gap: 1rem;
}

.form-stack > label:not(.choice-card):not(.form-check),
.visibility-fieldset {
    display: grid;
    gap: 0.5rem;
}

.form-stack input[type="text"],
.form-stack input[type="password"],
.form-stack input[type="date"],
.form-stack input[type="time"],
.form-stack select {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
}

.status-select-label {
    display: grid;
    gap: 0.5rem;
    font-weight: 700;
}

.form-stack select {
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    padding-right: 2.75rem;
    background-image: linear-gradient(45deg, transparent 50%, #cfd8e3 50%), linear-gradient(135deg, #cfd8e3 50%, transparent 50%);
    background-position: calc(100% - 1.25rem) center, calc(100% - 0.85rem) center;
    background-size: 0.42rem 0.42rem, 0.42rem 0.42rem;
    background-repeat: no-repeat;
}

.form-stack select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.25);
}

.form-stack select option {
    background: var(--surface);
    color: var(--text);
}

.slug-preview {
    color: var(--muted);
}

.slug-preview code {
    display: block;
    margin-top: 0.35rem;
    word-break: break-all;
}

.status-fieldset,
.visibility-fieldset {
    border: none;
    padding: 0;
    display: grid;
    gap: 0.75rem;
}

.status-fieldset legend,
.visibility-fieldset legend {
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.choice-card {
    display: flex;
    gap: 0.85rem;
    align-items: center;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.choice-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice-indicator {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    border: 3px solid #7d8b9c;
    border-radius: 50%;
    background: transparent;
    box-shadow: inset 0 0 0 0 transparent;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}

.choice-indicator-square {
    border-radius: 7px;
}

.choice-indicator-lg {
    width: 1.9rem;
    height: 1.9rem;
    border-width: 3px;
    margin-top: 0;
}

.choice-card:hover {
    border-color: rgba(79, 140, 255, 0.55);
}

.choice-card:has(input:checked) {
    border-color: var(--primary);
    background: rgba(79, 140, 255, 0.12);
    box-shadow: 0 0 0 1px rgba(79, 140, 255, 0.35);
}

.choice-card:has(input:checked) .choice-indicator {
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: inset 0 0 0 4px #171d25;
}

.choice-card:has(input:checked) .choice-indicator-square {
    box-shadow: none;
    background: var(--primary);
    position: relative;
}

.choice-card:has(input:checked) .choice-indicator-square::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 46%;
    width: 0.4rem;
    height: 0.8rem;
    border: solid #fff;
    border-width: 0 3px 3px 0;
    transform: translate(-50%, -50%) rotate(45deg);
}

.choice-card strong {
    display: block;
    margin-bottom: 0.2rem;
}

.choice-card small,
.form-check small {
    color: var(--muted);
    line-height: 1.35;
}

.access-password {
    display: block;
    margin-top: 0.45rem;
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 600;
}

.lead .access-password {
    display: inline;
    margin-top: 0;
    font-weight: 700;
}

.access-password code {
    display: inline-block;
    margin-left: 0.15rem;
    padding: 0.12rem 0.4rem;
    border-radius: 6px;
    background: rgba(255, 180, 90, 0.16);
    color: #ffb45a;
    font-size: 0.92em;
}

.access-password.is-missing {
    color: #ffb45a;
    font-weight: 500;
}

.form-check {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    cursor: pointer;
    padding: 0.15rem 0;
}

.form-check-input {
    appearance: none;
    -webkit-appearance: none;
    width: 1.5rem;
    height: 1.5rem;
    margin: 0.2rem 0 0;
    flex-shrink: 0;
    border: 2px solid #9aa7b8;
    border-radius: 0.35rem;
    background: #fff;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 0.95rem;
}

.form-check-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.25);
}

.form-check strong {
    display: block;
    margin-bottom: 0.2rem;
}

.wa-cta {
    display: grid;
    gap: 0.85rem;
    max-width: 640px;
    margin: 1.5rem auto 0;
    padding: 1rem 1.15rem;
    border: 1px solid rgba(37, 211, 102, 0.35);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(37, 211, 102, 0.1), rgba(37, 211, 102, 0.03));
}

.wa-cta-intro {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.wa-cta-icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    background: #25d366;
    color: #06371a;
}

.wa-cta-icon svg {
    width: 1.55rem;
    height: 1.55rem;
}

.wa-cta-intro h2 {
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.25;
}

.wa-cta-intro p {
    margin: 0.15rem 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.wa-cta-form {
    display: grid;
    gap: 0.55rem;
}

.wa-cta-field {
    display: flex;
    gap: 0.5rem;
}

.wa-cta-field input {
    flex: 1;
    min-width: 0;
    padding: 0.55rem 0.75rem;
    font-size: 0.95rem;
}

.wa-cta-field input:focus {
    outline: none;
    border-color: #25d366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.22);
}

.btn-whatsapp {
    flex-shrink: 0;
    padding: 0.55rem 1.05rem;
    border: none;
    border-radius: 0.55rem;
    background: #25d366;
    color: #04301a;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-whatsapp:hover {
    background: #1eb85a;
}

.btn-whatsapp:disabled {
    opacity: 0.6;
    cursor: default;
}

.wa-cta-consent {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.35;
    cursor: pointer;
}

.wa-cta-consent input {
    width: 1.05rem;
    height: 1.05rem;
    margin: 0.1rem 0 0;
    flex-shrink: 0;
    accent-color: #25d366;
    cursor: pointer;
}

.wa-cta-foot {
    margin: 0;
    text-align: right;
}

.link-quiet {
    padding: 0;
    border: none;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 0.78rem;
    text-decoration: underline;
    cursor: pointer;
}

.link-quiet:hover {
    color: var(--text);
}

@media (max-width: 520px) {
    .wa-cta-field {
        flex-direction: column;
    }

    .wa-cta-foot {
        text-align: center;
    }
}

.subscribe-feedback {
    margin: 0;
    font-weight: 600;
}

.subscribe-feedback.is-success {
    color: var(--primary);
}

.subscribe-feedback.is-error {
    color: var(--danger);
}

.publish-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
}

.publish-row .status-select-label,
.publish-row .schedule-fields {
    min-width: 0;
}

.schedule-fields {
    display: grid;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    border: 0;
}

.publish-row .schedule-fields .form-row {
    gap: 0.6rem;
}

@media (max-width: 700px) {
    .publish-row {
        grid-template-columns: 1fr;
    }
}

.readonly-date {
    display: grid;
    gap: 0.25rem;
}

.readonly-date p {
    margin: 0;
    font-weight: 600;
}

.readonly-date small {
    color: var(--muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-row label {
    display: grid;
    gap: 0.5rem;
}

.schedule-hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 0.55rem;
}

.card-badge {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.card-badge.is-scheduled {
    background: rgba(79, 140, 255, 0.22);
    color: #8fb8ff;
}

.card-badge.is-draft {
    background: rgba(232, 140, 48, 0.22);
    color: #ffb45a;
}

.card-badge.is-published {
    background: rgba(76, 217, 100, 0.18);
    color: #6ee08a;
}

.card-badge.is-facebook {
    background: rgba(24, 119, 242, 0.18);
    color: #8cb8ff;
}

.card-icons {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 999px;
    flex-shrink: 0;
}

.card-icon svg {
    width: 0.9rem;
    height: 0.9rem;
}

.card-icon.is-clock {
    background: rgba(79, 140, 255, 0.18);
    color: #8fb8ff;
}

.card-icon.is-lock {
    background: rgba(255, 107, 107, 0.18);
    color: #ff8a8a;
}

.card-icon.is-eye {
    background: rgba(76, 217, 100, 0.14);
    color: #6ee08a;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.meta-form {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.radio-card {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
    cursor: pointer;
}

.radio-card input {
    margin-top: 0.2rem;
}

.radio-card strong {
    display: block;
}

.radio-card small {
    color: var(--muted);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.danger-zone {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 107, 107, 0.28);
}

.danger-zone h2 {
    margin: 0 0 0.4rem;
    color: var(--danger);
}

.danger-zone p {
    margin: 0 0 1rem;
    color: var(--muted);
}

body.modal-open {
    overflow: hidden;
}

.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.confirm-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
}

.confirm-modal-dialog {
    position: relative;
    width: min(460px, 100%);
    background: var(--surface);
    border: 1px solid rgba(255, 107, 107, 0.35);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.4rem 1.35rem 1.25rem;
}

.confirm-modal-dialog h2 {
    margin: 0 0 0.6rem;
}

.confirm-modal-dialog p {
    margin: 0 0 1.2rem;
    color: var(--muted);
    line-height: 1.45;
}

.confirm-modal-dialog .form-actions {
    justify-content: flex-end;
}

.hidden {
    display: none !important;
}

.alert {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.alert-error {
    background: rgba(255, 107, 107, 0.12);
    border: 1px solid rgba(255, 107, 107, 0.35);
}

.alert-info {
    background: rgba(79, 140, 255, 0.12);
    border: 1px solid rgba(79, 140, 255, 0.35);
}

.alert code {
    display: block;
    margin-top: 0.5rem;
    word-break: break-all;
}

.publication-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

@media (max-width: 700px) {
    .publication-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.7rem;
    }

    .publication-card {
        border-radius: 12px;
    }

    .card-body {
        padding: 0.75rem;
    }

    .card-body h3 {
        font-size: 0.95rem;
        margin-bottom: 0.4rem;
    }

    .card-body p {
        font-size: 0.8rem;
    }

    .card-actions {
        gap: 0.35rem;
    }

    .card-actions .btn-sm {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
    }
}

.publication-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

.card-cover {
    aspect-ratio: 3 / 4;
    background: #0b1015;
    display: grid;
    place-items: center;
}

.card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-placeholder {
    color: var(--muted);
}

.card-body {
    padding: 1rem;
}

.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--muted);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.pagination-btn,
.pagination-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.4rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
    background: var(--surface-2);
}

.pagination-btn:hover,
.pagination-num:hover {
    border-color: var(--primary);
    color: #fff;
}

.pagination-num.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.pagination-btn.is-disabled {
    opacity: 0.4;
    pointer-events: none;
}

.pagination-ellipsis {
    color: var(--muted);
    padding: 0 0.2rem;
}

.pagination-meta {
    margin: 0.85rem 0 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
}

.wizard-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.wizard-step {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    color: var(--muted);
}

.wizard-step span {
    display: inline-grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--surface-2);
    margin-right: 0.5rem;
    font-size: 0.85rem;
}

.wizard-step.active,
.wizard-step.completed {
    color: var(--text);
    border-color: var(--primary);
}

.dropzone {
    border: 2px dashed var(--border);
    border-radius: 14px;
    padding: 2rem;
    text-align: center;
    color: var(--muted);
    transition: 0.2s ease;
    margin: 1rem 0;
    cursor: pointer;
}

.upload-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(6, 9, 13, 0.82);
    backdrop-filter: blur(2px);
}

.upload-overlay.hidden {
    display: none;
}

body.upload-locked {
    overflow: hidden;
}

.upload-overlay-card {
    width: min(380px, 100%);
    padding: 1.75rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    text-align: center;
}

.upload-overlay-card h3 {
    margin: 0.9rem 0 0.35rem;
    font-size: 1.15rem;
}

.upload-overlay-card p {
    margin: 0 0 1rem;
    color: var(--text);
    font-weight: 600;
}

.upload-overlay-card small {
    color: var(--muted);
}

.upload-spinner {
    width: 2.75rem;
    height: 2.75rem;
    margin: 0 auto;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--primary);
    animation: upload-spin 0.8s linear infinite;
}

@keyframes upload-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .upload-spinner {
        animation-duration: 2s;
    }

    .upload-progress-bar.is-indeterminate {
        animation: none;
        width: 70%;
    }
}

.upload-progress {
    height: 6px;
    margin-bottom: 0.85rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.upload-progress-bar {
    width: 0;
    height: 100%;
    border-radius: 999px;
    background: var(--primary);
    transition: width 0.25s ease;
}

.upload-progress-bar.is-indeterminate {
    width: 42%;
    transition: none;
    animation: upload-progress-indeterminate 1.15s ease-in-out infinite;
}

@keyframes upload-progress-indeterminate {
    0% {
        transform: translateX(-120%);
    }
    100% {
        transform: translateX(260%);
    }
}

.upload-status {
    margin: 0 0 1rem;
    color: var(--primary);
    font-weight: 600;
}

.dropzone.dragover,
.dropzone.is-uploading {
    border-color: var(--primary);
    background: rgba(79, 140, 255, 0.08);
}

.dropzone.is-uploading {
    pointer-events: none;
    opacity: 0.75;
}

.dropzone.is-uploading::after {
    content: "Procesando archivo…";
    display: block;
    margin-top: 0.75rem;
    color: var(--primary);
}

.page-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.page-item {
    position: relative;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.5rem;
    cursor: grab;
}

.page-item.dragging {
    opacity: 0.5;
}

.page-item img {
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.page-item span {
    font-size: 0.85rem;
    color: var(--muted);
}

.btn-icon {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.8rem;
    height: 1.8rem;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: white;
    cursor: pointer;
}

.success-text {
    color: var(--success);
}

html:has(body.viewer-page),
body.viewer-page {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
}

.viewer-page .site-header,
.viewer-page .site-main {
    width: 100%;
    margin: 0;
    max-width: none;
    height: 100%;
}

.viewer-page .site-header {
    display: none;
}

.viewer-loader {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background:
        radial-gradient(circle at 50% 42%, rgba(25, 63, 116, 0.42), transparent 48%),
        #080d13;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.38s ease, visibility 0.38s ease;
}

.viewer-loader.is-finished {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.viewer-loader-content {
    display: grid;
    justify-items: center;
    width: min(25rem, 100%);
    text-align: center;
}

.viewer-loader-logo {
    display: block;
    width: min(17.5rem, 76vw);
    height: auto;
    margin-bottom: 2rem;
}

.viewer-loader-spinner {
    width: 2.6rem;
    height: 2.6rem;
    margin-bottom: 1rem;
    border: 3px solid rgba(255, 255, 255, 0.16);
    border-top-color: #25cad0;
    border-right-color: #0d4ab9;
    border-radius: 50%;
    animation: viewer-loader-spin 0.8s linear infinite;
}

.viewer-loader-title {
    margin: 0;
    color: #fff;
    font-size: clamp(1.1rem, 4vw, 1.4rem);
    font-weight: 700;
    letter-spacing: 0.01em;
}

.viewer-loader-detail {
    min-height: 1.3em;
    margin: 0.35rem 0 0;
    color: #aab7c7;
    font-size: 0.9rem;
}

@keyframes viewer-loader-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .viewer-loader {
        transition-duration: 0.01ms;
    }

    .viewer-loader-spinner {
        animation-duration: 1.8s;
    }
}

.viewer-shell {
    height: 100vh;
    height: 100dvh;
    display: grid;
    grid-template-rows: 1fr auto;
    background: #111418;
    overscroll-behavior: none;
    touch-action: none;
}

.viewer-stage {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    min-height: 0;
    background: radial-gradient(circle at center, #1a2028 0%, #0d1014 70%);
}

.viewer-shell.viewer-single .viewer-stage {
    grid-template-columns: 1fr;
}

.viewer-shell.viewer-single:not(.viewer-mobile) .viewer-stage {
    grid-template-columns: auto 1fr auto;
}

.viewer-viewport {
    position: relative;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    display: grid;
    place-items: center;
    touch-action: none;
}

.zoom-reader {
    position: absolute;
    inset: 0;
    z-index: 6;
    overflow: hidden;
    background: #0d1014;
}

.zoom-reader.hidden {
    display: none;
}

.zoom-reader-inner {
    position: absolute;
    left: 50%;
    top: 50%;
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    width: max-content;
    min-width: max-content;
}

.zoom-reader-inner img {
    max-width: none !important;
    max-height: none !important;
    flex-shrink: 0;
    object-fit: fill;
    background: #fff;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.viewer-zoom-layer {
    display: grid;
    place-items: center;
    min-width: 80px;
    min-height: 80px;
    transform-origin: center center;
}

.viewer-shell.is-zoomed .viewer-viewport {
    cursor: grab;
}

.viewer-shell.is-zoomed .flipbook,
.viewer-shell.is-zoomed .stf__wrapper,
.viewer-shell.is-zoomed .stf__block,
.viewer-shell.is-zoomed .stf__item {
    pointer-events: none;
}

.viewer-viewport.is-panning,
.viewer-shell.is-zoomed .viewer-viewport.is-panning {
    cursor: grabbing;
}

.flipbook {
    margin: 0 auto;
    position: relative;
}

.flipbook .page {
    background: #fff;
    overflow: hidden;
}

.flipbook .page img,
.stf__item img,
.stf__block img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    background: #fff;
    pointer-events: none;
    user-select: none;
    image-rendering: auto;
}

.viewer-shell.viewer-mobile .viewer-nav,
.viewer-shell.viewer-portrait #btn-spread,
.viewer-shell.viewer-mobile #btn-fullscreen,
.viewer-shell.viewer-mobile #btn-zoom-plus {
    display: none;
}

.viewer-shell.viewer-single:not(.viewer-mobile) .viewer-nav {
    display: grid;
}

.viewer-tool-btn.is-active {
    background: rgba(79, 140, 255, 0.22);
    color: #fff;
}

.viewer-nav {
    width: 3.4rem;
    height: 3.4rem;
    margin: 0 0.75rem;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.viewer-nav svg {
    width: 1.5rem;
    height: 1.5rem;
}

.viewer-nav:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.16);
    transform: scale(1.04);
}

.viewer-nav:disabled {
    opacity: 0.28;
    cursor: not-allowed;
}

.viewer-bottom-bar {
    touch-action: manipulation;
    height: 80px;
    display: grid;
    grid-template-columns: minmax(140px, 200px) 1fr minmax(80px, 120px);
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem;
    background: rgba(8, 10, 13, 0.96);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    overflow: visible;
}

.viewer-bottom-left,
.viewer-bottom-right {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

a.viewer-tool-btn {
    color: inherit;
    text-decoration: none;
}

.viewer-bottom-right {
    justify-content: flex-end;
    gap: 0.35rem;
}

.viewer-bottom-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    min-width: 0;
}

.page-indicator {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #f3f5f7;
    padding-left: 0.25rem;
    white-space: nowrap;
}

#btn-bar-prev:disabled,
#btn-bar-next:disabled {
    opacity: 0.28;
    cursor: not-allowed;
}

.viewer-tool-btn {
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #d7dde5;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.2s ease, color 0.2s ease;
}

.viewer-tool-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

.viewer-tool-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

#btn-home.viewer-home-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 3.4rem;
    padding: 0.28rem;
    background: #1f2732;
    color: #fff;
    border: 1px solid rgba(79, 140, 255, 0.45);
    border-radius: 12px;
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
    flex-shrink: 0;
}

#btn-home.viewer-home-btn img {
    display: block;
    width: 5.8rem;
    height: 2.85rem;
    object-fit: cover;
    border-radius: 8px;
    background: #11161c;
}

#btn-home.viewer-home-btn .viewer-home-popover {
    position: absolute;
    left: 0;
    bottom: calc(100% + 0.6rem);
    width: max-content;
    padding: 0.55rem 0.8rem;
    background: #11161c;
    color: #fff;
    border: 1px solid rgba(79, 140, 255, 0.5);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
    z-index: 60;
}

#btn-home.viewer-home-btn .viewer-home-popover::after {
    content: "";
    position: absolute;
    left: 1.2rem;
    top: 100%;
    border: 7px solid transparent;
    border-top-color: #11161c;
}

#btn-home.viewer-home-btn:hover .viewer-home-popover,
#btn-home.viewer-home-btn:focus-visible .viewer-home-popover,
#btn-home.viewer-home-btn.is-popover-open .viewer-home-popover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#btn-home.viewer-home-btn:hover,
#btn-home.viewer-home-btn:focus-visible,
#btn-home.viewer-home-btn.is-popover-open {
    background: #263140;
    border-color: var(--primary);
    color: #fff;
}

.viewer-tool-btn-close {
    font-size: 1.6rem;
    line-height: 1;
}

.zoom-control {
    flex: 1;
    max-width: 220px;
    min-width: 90px;
    display: flex;
    align-items: center;
}

#zoom-slider {
    width: 100%;
    height: 4px;
    appearance: none;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    outline: none;
    cursor: pointer;
}

#zoom-slider::-webkit-slider-thumb {
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #4f8cff;
}

#zoom-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #4f8cff;
}

.share-toast {
    position: fixed;
    left: 50%;
    bottom: 92px;
    transform: translateX(-50%);
    background: rgba(20, 24, 30, 0.95);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    z-index: 60;
    font-size: 0.9rem;
    max-width: calc(100vw - 2rem);
    text-align: center;
}

.index-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    display: grid;
    place-items: center;
    z-index: 50;
    padding: 1rem;
}

.index-modal.hidden,
.share-toast.hidden {
    display: none;
}

.index-modal,
.index-modal-content {
    touch-action: manipulation;
}

.index-modal-content {
    width: min(920px, 100%);
    max-height: 85vh;
    overflow: auto;
    background: #171b21;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1rem;
}

.index-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.index-modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.index-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.75rem;
}

.index-item {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    background: #101419;
    cursor: pointer;
    padding: 0;
    color: inherit;
}

.index-item:hover {
    border-color: #4f8cff;
}

.index-item img {
    aspect-ratio: 3 / 4;
    object-fit: cover;
    width: 100%;
}

.index-item span {
    display: block;
    padding: 0.45rem;
    font-size: 0.85rem;
    color: #c3cad3;
    text-align: center;
    font-weight: 600;
}

@media (max-width: 900px) {
    .viewer-stage {
        grid-template-columns: 1fr;
    }

    .viewer-bottom-bar {
        grid-template-columns: auto 1fr auto;
        height: 64px;
        padding: 0 0.65rem;
        gap: 0.4rem;
    }

    .viewer-bottom-left,
    .viewer-bottom-right,
    .viewer-bottom-center {
        order: 0;
    }

    .viewer-bottom-left {
        justify-content: flex-start;
        min-width: auto;
        gap: 0.15rem;
    }

    .viewer-bottom-left .page-indicator {
        padding-left: 0;
    }

    .viewer-bottom-right {
        justify-content: flex-end;
        min-width: auto;
    }

    .viewer-bottom-center {
        gap: 0.3rem;
    }

    .zoom-control {
        max-width: 88px;
        min-width: 56px;
    }

    @media (orientation: portrait) {
        .zoom-control {
            display: none;
        }
    }

    .page-indicator {
        font-size: 0.95rem;
        padding-left: 0;
    }

    #btn-home.viewer-home-btn {
        height: 2.9rem;
        padding: 0.2rem;
    }

    #btn-home.viewer-home-btn img {
        width: 4.6rem;
        height: 2.3rem;
    }
}

@media (orientation: landscape) and (max-height: 560px) {
    .viewer-bottom-bar {
        height: 52px;
        padding: 0 0.5rem;
    }

    .viewer-tool-btn {
        width: 2.1rem;
        height: 2.1rem;
    }

    .zoom-control {
        max-width: 72px;
    }

    #btn-home.viewer-home-btn {
        height: 2.4rem;
        padding: 0.15rem;
    }

    #btn-home.viewer-home-btn img {
        width: 3.8rem;
        height: 1.9rem;
    }
}

@media (max-width: 480px) {
    #btn-home.viewer-home-btn .viewer-home-popover {
        white-space: normal;
        max-width: 11rem;
    }
}
