/* ============================================
   VISORIA DASHBOARD
   ============================================ */

.dashboard-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.dashboard-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(244, 240, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(142, 112, 255, 0.15);
}

.dashboard-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dashboard-logo-img {
    height: 40px;
    width: auto;
}

.dashboard-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dashboard-user-email {
    font-size: 0.9rem;
    color: var(--text-light);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-signout {
    background: none;
    border: 1px solid rgba(142, 112, 255, 0.4);
    color: var(--primary-purple);
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    cursor: pointer;
}

.dashboard-signout:hover {
    background: rgba(142, 112, 255, 0.08);
}

.dashboard-body {
    flex: 1;
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 1rem;
}

.dashboard-nav {
    flex-shrink: 0;
    width: 200px;
    padding-right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.dashboard-nav-link {
    padding: 0.5rem 0.75rem;
    border-radius: 12px;
    color: var(--text-light);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (min-width: 769px) {
    .dashboard-nav-link:hover {
        background: rgba(142, 112, 255, 0.08);
        color: var(--text-dark);
    }
}

.dashboard-nav-link--active {
    background: rgba(142, 112, 255, 0.12);
    color: var(--primary-purple);
}

.dashboard-nav--disabled {
    pointer-events: none;
    opacity: 0.55;
}
.dashboard-nav--disabled .dashboard-nav-link {
    cursor: not-allowed;
}

.dashboard-main {
    flex: 1;
    min-width: 0;
}

.dashboard-section {
    display: none;
}

.dashboard-section--active {
    display: block;
}

.dashboard-section--hidden {
    display: none !important;
}

.dashboard-page-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.dashboard-subtitle {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.dashboard-muted {
    color: var(--text-light);
    font-size: 0.95rem;
}

.dashboard-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 10px 40px var(--shadow-purple);
}

.dashboard-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row-reverse; /* text on left, icon on right */
    gap: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(142, 112, 255, 0.18);
}

.dashboard-nav-icon,
.dashboard-title-icon,
.dashboard-btn-icon {
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .dashboard-nav-icon {
        font-size: 1.6rem;
        margin-bottom: 0.02rem;
    }

    .dashboard-nav-link span {
        font-size: 0.72rem;
        margin-top: 0.05rem;
    }

    .dashboard-nav-link--active,
    .dashboard-nav-link--active:hover {
        background: rgba(255, 255, 255, 0.18);
        color: #ffffff;
    }

    .dashboard-nav-link--active .dashboard-nav-icon,
    .dashboard-nav-link--active:hover .dashboard-nav-icon {
        color: #ffffff;
    }
}

.dashboard-card-icon {
    font-size: 1.65rem; /* 50% bigger than base icons */
}

.dashboard-title-icon {
    margin-right: 0.25rem;
}

.dashboard-profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.6fr);
    gap: 1.25rem;
}

.dashboard-profile-card {
    align-self: flex-start;
}

.dashboard-card--danger {
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(231, 76, 60, 0.4);
    background: linear-gradient(135deg, rgba(255, 235, 238, 0.95), rgba(255, 248, 240, 0.95));
}

.dashboard-card--inactive {
    max-width: 480px;
    border: 1px solid rgba(220, 38, 38, 0.3);
    background: linear-gradient(135deg, rgba(254, 242, 242, 0.98), rgba(255, 251, 235, 0.98));
}
.dashboard-card--inactive .dashboard-title { color: #991b1b; }
.dashboard-card--inactive .dashboard-btn { margin-top: 1rem; }

.dashboard-danger-text {
    font-size: 0.9rem;
    color: #b33426;
    margin-bottom: 1rem;
}

#dashboard-manage-subscription-btn {
    margin-top: 0;
    margin-bottom: 0;
}

.dashboard-plan-row-icon {
    font-size: 1rem;
}

#dashboard-delete-confirm-input {
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
}

.dashboard-modal-actions {
    margin-top: 1rem;
}

.dashboard-delete-modal-box .dashboard-modal-actions {
    margin-top: 1rem;
    padding-bottom: 0.25rem;
}

.dashboard-modal-actions .dashboard-btn {
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
}

.dashboard-plan-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
}

.dashboard-plan-actions .dashboard-btn {
    min-width: 0;
}

.dashboard-home-actions {
    margin-top: 1.2rem;
}

.dashboard-home-last-story {
    display: flex;
    flex-direction: column;
}

.dashboard-home-last-story-body {
    display: flex;
    align-items: stretch;
    gap: 1.5rem;
    margin-top: 0.75rem;
}

.dashboard-home-last-story-info {
    flex: 1 1 0;
}

.dashboard-home-last-story-book {
    flex: 0 0 180px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.dashboard-home-book-mockup {
    position: relative;
    width: 200px;
    max-width: 100%;
}

.dashboard-home-book-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 14px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.38);
}

.dashboard-home-book-title {
    position: absolute;
    text-align: center;
    left: 50%;
    top: 69%;
    width: 190px;
    transform: translateX(-50%);
    font-size: 0.55rem;
    font-weight: 800;
    line-height: 1.1;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
    white-space: normal; /* dashboard: allow 2 lines */
    overflow: visible;
    font-family: 'Quicksand', 'Nunito', sans-serif;
}

@media (min-width: 541px) {
    .dashboard-home-book-title {
        left: 50%;
        top: 69%;
        width: 220px;
        transform: translateX(-50%);
        font-size: 0.6rem;
        white-space: normal; /* desktop: wrap into 2 lines */
        word-break: break-word;
    }
}

@media (max-width: 768px) {
    .dashboard-home-last-story-body {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-home-last-story-book {
        align-self: center;
    }
}

/* Mobile: make main form/profile buttons full-width; toolbar uses left CTA + refresh icon */
@media (max-width: 768px) {
    .dashboard-btn:not(.dashboard-btn--small) {
        width: 100%;
        justify-content: center;
    }

    .dashboard-plan-actions,
    .dashboard-home-actions,
    .dashboard-form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-plan-actions .dashboard-btn,
    .dashboard-form-actions .dashboard-btn {
        width: 100%;
    }

    .dashboard-toolbar,
    .dashboard-toolbar--stories {
        flex-direction: row;
        align-items: center;
        gap: 0.75rem;
    }

    .dashboard-toolbar .dashboard-btn,
    .dashboard-toolbar--stories .dashboard-btn {
        width: auto;
    }
}

/* Refresh icon button: small white pill with icon, aligned right */
.dashboard-refresh-btn {
    background: #fff;
    border: 1px solid rgba(142, 112, 255, 0.18);
    box-shadow: 0 4px 10px rgba(142, 112, 255, 0.12);
    padding: 0.4rem 1rem;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 999px;
}

.dashboard-refresh-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 6px 14px rgba(142, 112, 255, 0.18);
}

.dashboard-refresh-icon {
    font-size: 1.5rem;
    color: var(--primary-purple);
}

.dashboard-refresh-btn .dashboard-btn-label {
    display: none;
}

.dashboard-toolbar .dashboard-refresh-btn,
.dashboard-toolbar--stories .dashboard-refresh-btn {
    margin-left: auto;
}

@media (max-width: 900px) {
    .dashboard-profile-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.dashboard-dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.35rem 1.5rem;
    font-size: 0.95rem;
}

.dashboard-dl dt {
    color: var(--text-light);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.dashboard-dl dd {
    margin: 0;
    color: var(--text-dark);
}

.dashboard-status {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.dashboard-status--pending {
    background: rgba(255, 193, 7, 0.2);
    color: #b38600;
}

.dashboard-status--generated {
    background: rgba(46, 204, 113, 0.2);
    color: #1e8b51;
}

.dashboard-status--generating {
    background: #e74c3c;
    color: #fff;
}

.dashboard-status--failed {
    background: rgba(231, 76, 60, 0.15);
    color: #b33426;
}

/* Forms */
.dashboard-form {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    max-width: 400px;
}

.dashboard-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.dashboard-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
}

.dashboard-input {
    border-radius: 12px;
    border: 1px solid rgba(142, 112, 255, 0.25);
    padding: 0.6rem 0.9rem;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.9);
}

.dashboard-input:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 1px rgba(142, 112, 255, 0.2);
}

.dashboard-input[readonly] {
    background: rgba(244, 240, 255, 0.5);
    color: var(--text-light);
}

.dashboard-field--checkbox {
    margin-top: 0.25rem;
}

.dashboard-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-dark);
    cursor: pointer;
}

.dashboard-checkbox-label input {
    accent-color: var(--primary-purple);
}

.dashboard-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.25rem;
}

.dashboard-form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.dashboard-message {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    display: none;
}

.dashboard-message--success {
    display: block;
    color: #1e8b51;
}

.dashboard-message--error {
    display: block;
    color: #b33426;
}

/* Buttons */
.dashboard-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.dashboard-btn--primary {
    background: linear-gradient(135deg, var(--primary-purple), var(--purple-light));
    color: #fff;
    box-shadow: 0 6px 20px var(--shadow-purple);
}

.dashboard-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px var(--shadow-strong);
}

.dashboard-btn--secondary {
    background: #fff;
    color: var(--primary-purple);
    border: 1px solid rgba(142, 112, 255, 0.35);
}

.dashboard-btn--secondary:hover {
    background: rgba(142, 112, 255, 0.06);
}

.dashboard-btn--small {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

/* Loading state: spinner + disabled */
.dashboard-btn--loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.dashboard-btn--loading::after {
    content: '';
    position: absolute;
    width: 1.1em;
    height: 1.1em;
    top: 50%;
    left: 50%;
    margin-top: -0.55em;
    margin-left: -0.55em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: dashboard-spin 0.6s linear infinite;
}

.dashboard-btn--loading.dashboard-btn--primary::after {
    border-color: rgba(255, 255, 255, 0.4);
    border-right-color: #fff;
}

.dashboard-btn--loading.dashboard-btn--secondary::after {
    border-color: rgba(142, 112, 255, 0.35);
    border-right-color: var(--primary-purple);
}

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

.dashboard-btn--danger {
    background: #b33426;
    color: #fff;
    box-shadow: 0 6px 20px rgba(179, 52, 38, 0.35);
}

.dashboard-btn--danger:hover {
    background: #92291f;
    box-shadow: 0 8px 24px rgba(179, 52, 38, 0.4);
}

.dashboard-link {
    color: var(--primary-purple);
    text-decoration: underline;
}

.dashboard-link:hover {
    text-decoration-thickness: 2px;
}

/* Children list */
.dashboard-children-ul {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
}

.dashboard-child-li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(142, 112, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.dashboard-child-name {
    font-weight: 600;
    color: var(--text-dark);
}

.dashboard-child-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dashboard-child-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(142, 112, 255, 0.12);
}

.dashboard-child-avatar--boy {
    background: linear-gradient(135deg, #a5b4fc, #22d3ee);
}

.dashboard-child-avatar--girl {
    background: linear-gradient(135deg, #f9a8d4, #facc15);
}

.dashboard-child-avatar-icon {
    font-size: 1.4rem;
    color: #fff;
}

.dashboard-child-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.dashboard-child-meta {
    font-size: 0.85rem;
    color: var(--text-light);
}

.dashboard-child-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Global toast / popup message */
.dashboard-toast {
    position: fixed;
    left: 50%;
    bottom: 2rem;
    transform: translateX(-50%) translateY(12px);
    padding: 0.75rem 1.5rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-dark);
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.22);
    font-size: 0.9rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 60;
}

.dashboard-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.dashboard-toast--error {
    background: rgba(248, 113, 113, 0.98);
    color: #fff;
}

.dashboard-toast--success {
    background: rgba(74, 222, 128, 0.98);
    color: #022c22;
}

.dashboard-children-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
}

.dashboard-form-card {
    margin-top: 1rem;
}

/* Form card titles (e.g. Edit child / Add child) */
.dashboard-form-card .dashboard-subtitle {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(142, 112, 255, 0.18);
}

/* Stories: desktop table */
.dashboard-stories-mobile {
    display: none;
}

.dashboard-table-wrap {
    overflow-x: auto;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.dashboard-table th,
.dashboard-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(142, 112, 255, 0.1);
}

.dashboard-table th {
    font-weight: 700;
    color: var(--text-light);
}

.dashboard-table td {
    color: var(--text-dark);
}

.dashboard-story-actions-cell {
    white-space: nowrap;
}

.dashboard-link--loading {
    pointer-events: none;
    opacity: 0.7;
}

.dashboard-story-credits {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(142, 112, 255, 0.18);
    box-shadow: 0 4px 16px rgba(142, 112, 255, 0.08);
    font-size: 0.95rem;
    color: var(--text-dark);
}

.dashboard-story-credits__title {
    margin: 0 0 0.5rem 0;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--primary-purple);
}

.dashboard-story-credits__list {
    margin: 0;
    padding-left: 1.25rem;
}

.dashboard-story-credits__list li {
    margin: 0.2rem 0;
}

.dashboard-story-credits__empty {
    margin: 0;
    color: var(--text-muted, #5c5670);
}

.dashboard-story-credits__hint {
    margin: 0;
}

.dashboard-toolbar {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.dashboard-toolbar--stories {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Plan / pay modal – solid background, radius like My Stories list cards */
.dashboard-plan-modal-box.glass-card {
    background: #f8f6fc;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid rgba(142, 112, 255, 0.2);
    box-shadow: 0 12px 40px rgba(142, 112, 255, 0.2);
    border-radius: 12px;
}

.dashboard-plan-modal-box {
    max-width: 520px;
}

/* Align "Your free story..." with the title (same horizontal padding as header) */
.dashboard-plan-modal-box > .dashboard-subtitle {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.dashboard-plan-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1rem 0;
}

.dashboard-plan-option {
    padding: 1.25rem;
    text-align: center;
    border-radius: 16px;
    border: 1px solid rgba(142, 112, 255, 0.15);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 6px 18px rgba(142, 112, 255, 0.12);
    margin: 0 1rem;
}

.dashboard-plan-option h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: var(--text-dark);
}

.dashboard-plan-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-purple);
    margin: 0 0 0.25rem 0;
}

.dashboard-plan-price span {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
}

.dashboard-plan-desc {
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 0 0 0.75rem 0;
}

.dashboard-plan-btn {
    width: 100%;
    min-width: 0;
}

.dashboard-plan-note {
    font-size: 0.75rem;
    color: var(--text-light);
    margin: 0.5rem 0 0 0;
}

.dashboard-plan-simulate {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed rgba(142, 112, 255, 0.2);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.dashboard-plan-simulate .dashboard-muted {
    margin: 0;
    width: 100%;
}

@media (max-width: 540px) {
    .dashboard-plan-options {
        grid-template-columns: 1fr;
    }
}

/* Story view modal */
.dashboard-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

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

.dashboard-modal-box {
    position: relative;
    max-width: 640px;
    width: 100%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 20px;
}

.dashboard-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(142, 112, 255, 0.15);
    flex-shrink: 0;
}

.dashboard-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
}

.dashboard-modal-meta {
    font-size: 0.85rem;
    color: var(--text-light);
}

.dashboard-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.25rem;
}

.dashboard-modal-close:hover {
    color: var(--text-dark);
}

.dashboard-modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.dashboard-story-body {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-dark);
}

.dashboard-story-body img {
    max-width: 100%;
    height: auto;
}

/* Storybook view: story + images, book-like layout */
.dashboard-modal-box--storybook {
    max-width: 720px;
}
.visoria-pdf-modal .dashboard-modal-box--storybook {
    max-width: 720px;
}

.visoria-storybook-brand {
    text-align: center;
    margin-bottom: 1rem;
}

.visoria-storybook-brand a {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: var(--primary-purple, #5b21b6);
    color: #fff;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    font-family: 'Quicksand', 'Nunito', sans-serif;
}

.visoria-storybook-brand a:hover {
    opacity: 0.9;
}

.visoria-storybook {
    background: linear-gradient(180deg, #fef9f0 0%, #f5ede0 100%);
    border-radius: 12px;
    padding: 1.5rem;
    font-family: Georgia, "Times New Roman", serif;
}

.visoria-storybook-title {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c1810;
    text-align: center;
    margin: 0 0 1.25rem 0;
    line-height: 1.3;
}

/* Storybook cover: book mockup + title as first page */
.visoria-storybook-cover {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
}

.visoria-storybook-cover-mockup {
    position: relative;
    width: 220px;
    max-width: 100%;
}

.visoria-storybook-cover-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 14px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.38);
}

.visoria-storybook-cover-title {
    position: absolute;
    text-align: center;
    left: 50%;
    top: 63%;
    width: 160px;
    transform: translateX(-50%);
    font-size: 0.6rem;
    font-weight: 800;
    line-height: 1.1;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
    white-space: normal;
    overflow: visible;
    font-family: 'Quicksand', 'Nunito', sans-serif;

}

/* Desktop: center the title on the cover banner */
@media (min-width: 541px) {
    .visoria-storybook-cover-title {
        left: 50%;
        top: 70%;
        width: 320px;
        transform: translateX(-50%);
        font-size: 1.08rem;
    }
}

.visoria-storybook-fallback {
    margin-top: 0.5rem;
}

/* Story view only: full-width cover */
.visoria-storybook-cover--full-width .visoria-storybook-cover-mockup {
    width: 100%;
    max-width: 100%;
}

.visoria-storybook-page {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 2px 12px rgba(44, 24, 16, 0.08);
    border: 1px solid rgba(44, 24, 16, 0.06);
}

/* PDF export: flow layout, plain white background */
.visoria-pdf-modal .visoria-pdf-export {
    background: #fff;
    border-radius: 0;
    padding: 1.5rem;
    font-family: Georgia, "Times New Roman", serif;
}
.visoria-pdf-export .visoria-pdf-content {
    background: transparent;
    padding-top: 1.5rem;
    page-break-before: always;
    break-before: page;
}
.visoria-pdf-export .visoria-pdf-cover {
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    page-break-after: auto;
    min-height: 90vh;
}

/* Mobile / lite PDF cover: same brand feel as desktop mockup, without heavy image (faster html2canvas). */
.visoria-pdf-cover--lite {
    min-height: 85vh;
    background: linear-gradient(165deg, #f4f0ff 0%, #ede9fe 35%, #e0f7fa 70%, #fff0f6 100%);
    border-radius: 16px;
    box-sizing: border-box;
    padding: 2.5rem 1.75rem;
}
.visoria-pdf-cover-lite-inner {
    text-align: center;
    max-width: 420px;
    margin: 0 auto;
}
.visoria-pdf-cover-lite-eyebrow {
    font-family: "Nunito", system-ui, sans-serif;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: #8e70ff;
    margin: 0 0 1.25rem;
}
.visoria-pdf-cover-lite-title {
    font-family: "Quicksand", "Nunito", Georgia, serif;
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.25;
    color: #1e1b4b;
    margin: 0 0 1rem;
}
.visoria-pdf-cover-lite-tagline {
    font-family: "Nunito", Georgia, serif;
    font-size: 0.95rem;
    color: #64748b;
    margin: 0;
}

/* Fixed “paper” width for html2canvas on phones (avoids tiny narrow PDF). */
.visoria-pdf-modal--mobile-capture .dashboard-modal-box--storybook {
    width: 794px;
    max-width: none;
    margin: 0 auto;
    box-sizing: border-box;
}
.visoria-pdf-modal--mobile-capture .dashboard-modal-body {
    overflow: visible;
}
@media (max-width: 820px) {
    .visoria-pdf-modal--mobile-capture .dashboard-modal-box--storybook {
        margin-left: max(12px, calc(50vw - 397px));
    }
}
.visoria-pdf-export .visoria-pdf-cover .visoria-storybook-cover-mockup {
    position: relative;
    width: 100%;
    max-width: 100%;
}
.visoria-pdf-export .visoria-pdf-cover .visoria-storybook-cover-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 14px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.38);
}
.visoria-pdf-export .visoria-pdf-cover .visoria-storybook-cover-title {
    font-size: 1.4rem;
    width: 360px;
    left: 50%;
    top: 63%;
    transform: translateX(-50%);
}
.visoria-pdf-export .visoria-storybook-page-text,
.visoria-pdf-export .visoria-pdf-cover {
    page-break-inside: avoid;
}
.visoria-pdf-export .visoria-pdf-float-image {
    width: 50%;
    max-width: 340px;
    border-radius: 8px;
    overflow: hidden;
    page-break-inside: avoid;
    break-inside: avoid;
}
.visoria-pdf-export .visoria-pdf-float-image--right {
    float: right;
    margin: 0.25rem 0 0.75rem 1.25rem;
}
.visoria-pdf-export .visoria-pdf-float-image--left {
    float: left;
    margin: 0.25rem 1.25rem 0.75rem 0;
}
.visoria-pdf-export .visoria-pdf-float-image img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}
.visoria-pdf-export .visoria-pdf-clearfix {
    clear: both;
}
.visoria-pdf-export .visoria-storybook-page-text {
    text-align: justify;
    line-height: 1.6;
    font-size: 15px;
    margin-bottom: 0.75em;
}

.visoria-storybook-page:last-child {
    margin-bottom: 0;
}

/* Reference layout: image can float so text wraps; page number at bottom with accent */
.visoria-storybook-page-image {
    float: right;
    width: 42%;
    max-width: 280px;
    margin: 0 0 1rem 1.25rem;
    border-radius: 8px;
    overflow: hidden;
    background: #f0ebe3;
}

/* Story view: image full width after first paragraph */
.visoria-storybook-page-image--full-width {
    float: none;
    width: 100%;
    max-width: 100%;
    margin: 1rem 0;
}

.visoria-storybook-page-image img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.visoria-storybook-page-body {
    overflow: hidden;
}

.visoria-storybook-page-text {
    font-size: 1.05rem;
    line-height: 1.75;
    color: #2c1810;
    margin: 0 0 0.75rem 0;
    text-align: justify;
    text-indent: 1.5em;
}

.visoria-storybook-page-text:first-of-type {
    margin-top: 0;
}

.visoria-storybook-page-text--has-drop-cap {
    text-indent: 0;
}

.visoria-drop-cap {
    float: left;
    font-size: 3.2em;
    line-height: 0.85;
    font-weight: 700;
    color: var(--primary-purple, #5b21b6);
    margin-right: 0.08em;
    font-family: Georgia, "Times New Roman", serif;
}

.visoria-storybook-page-num {
    clear: both;
    text-align: center;
    font-size: 0.9rem;
    color: var(--primary-purple, #5b21b6);
    margin-top: 1rem;
    padding-top: 0.5rem;
}

.visoria-storybook-page-num-flourish {
    font-size: 0.5em;
    opacity: 0.8;
    margin: 0 0.25em;
}

.visoria-storybook-page-audio {
    margin-top: 0.5rem;
}

.visoria-storybook-page-audio audio {
    width: 100%;
    max-width: 320px;
    height: 36px;
}

/* Mobile storybook */
@media (max-width: 540px) {
    .visoria-storybook {
        padding: 1rem;
    }
    .visoria-storybook-title {
        font-size: 1.25rem;
    }
    .visoria-storybook-cover-mockup {
        width: 180px;
    }
    .visoria-storybook-cover-title {
        font-size: 0.9rem;
        top:68% !important;
    }
    .visoria-storybook-page-image img {
        max-height: 220px;
    }
    .visoria-storybook-page-text {
        font-size: 1rem;
    }

    /* Hide created-at meta in story view header on small screens */
    .dashboard-modal-box--storybook .dashboard-modal-meta {
        display: none;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .dashboard-page {
        padding-bottom: 4.75rem; /* space for sticky bottom nav */
    }

    .dashboard-body {
        flex-direction: column;
        padding: 0.75rem;
    }

    .dashboard-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: space-around;
        align-items: center;
        padding: 0.45rem 0.75rem;
        gap: 0.25rem;
        background: rgb(142 112 255);
        backdrop-filter: blur(12px);
        border-top: 1px solid rgba(142, 112, 255, 0.18);
        box-shadow: 0 -4px 18px rgba(15, 23, 42, 0.12);
        z-index: 20;
    }

    .dashboard-nav-link {
        flex: 1 1 auto;
        padding: 0.2rem 0.25rem;
        font-size: 0.75rem;
        justify-content: center;
        text-align: center;
        flex-direction: column;
        color: #f9f5ff;
    }

    .dashboard-nav-link:not(.dashboard-nav-link--active):hover {
        background: transparent;
        color: #f9f5ff;
    }

    .dashboard-user-email {
        display: none;
    }

    .dashboard-user {
        gap: 0.5rem;
    }

    .dashboard-table th,
    .dashboard-table td {
        padding: 0.5rem 0.4rem;
        font-size: 0.8rem;
    }

    /* Stories: mobile carousel + full list */
    .dashboard-stories-desktop {
        display: none;
    }

    .dashboard-stories-mobile {
        display: block;
    }

    .dashboard-stories-carousel-label {
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--text-light);
        margin: 0 0 0.5rem 0;
    }

    .dashboard-stories-carousel {
        display: flex;
        gap: 0.75rem;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding: 0.25rem 0 0.75rem 0;
        margin-bottom: 1rem;
    }

.dashboard-delete-modal-box {
    max-width: 520px;
    background: #fff;
    border-radius: 20px;
}

.dashboard-delete-modal-box.glass-card {
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid rgba(231, 76, 60, 0.2);
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.35);
}

.dashboard-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

    .dashboard-story-card--carousel {
        flex: 0 0 85%;
        min-width: 260px;
        max-width: 320px;
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }

    .dashboard-story-card {
        background: rgba(255, 255, 255, 0.7);
        border-radius: 12px;
        padding: 1rem;
        border: 1px solid rgba(142, 112, 255, 0.12);
        box-shadow: 0 2px 8px rgba(142, 112, 255, 0.06);
    }

    .dashboard-story-card-title {
        font-weight: 600;
        color: var(--text-dark);
        margin: 0 0 0.35rem 0;
        font-size: 1rem;
    }

    .dashboard-story-card-meta {
        font-size: 0.8rem;
        color: var(--text-light);
        margin: 0 0 0.25rem 0;
        display: flex;
        align-items: center;
        gap: 0.4rem;
    }

    .dashboard-story-card-meta .dashboard-plan-row-icon {
        font-size: 0.95rem;
    }

    .dashboard-story-card-meta span {
        display: inline-flex;
        align-items: center;
        gap: 0.15rem;
    }

    .dashboard-story-card-meta:last-of-type {
        margin-bottom: 0.5rem;
    }

    .dashboard-story-card-actions {
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(142, 112, 255, 0.1);
    }

    .dashboard-stories-show-all {
        display: inline-block;
        color: var(--primary-purple);
        font-weight: 600;
        font-size: 0.95rem;
        text-decoration: none;
        margin-bottom: 1rem;
    }

    .dashboard-stories-show-all:hover {
        text-decoration: underline;
    }

    .dashboard-stories-full-list {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .dashboard-stories-full .dashboard-story-card {
        max-width: none;
    }
}

/* ─── PDF page-aware export (manual pagination) ───────────────────────────── */
.visoria-pdf-page {
    width: 190mm;
    min-height: 267mm;
    max-height: 267mm;
    overflow: hidden;
    padding: 10mm 12mm;
    box-sizing: border-box;
    position: relative;
    background: #fff;
    page-break-after: always;
    break-after: page;
    display: flex;
    flex-direction: column;
    font-family: Georgia, 'Times New Roman', serif;
    color: #1a1a2e;
}

.visoria-pdf-page:last-child {
    page-break-after: avoid;
    break-after: avoid;
}

.visoria-pdf-page-content {
    flex: 1;
    overflow: hidden;
}

.visoria-pdf-cover-page {
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #fff;
}

.visoria-pdf-cover-title {
    font-size: 2.2rem;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.visoria-pdf-cover-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 2rem;
}

.visoria-pdf-cover-img {
    max-width: 200px;
    max-height: 220px;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.visoria-pdf-story-image {
    display: block;
    max-width: 100%;
    max-height: 120mm;
    object-fit: contain;
    margin: 4mm auto;
    border-radius: 6px;
}

.visoria-pdf-paragraph {
    font-size: 11pt;
    line-height: 1.75;
    margin: 0 0 1.2em 0;
    text-align: justify;
    color: #1a1a2e;
}

.visoria-pdf-drop-cap::first-letter,
.visoria-pdf-drop-cap-letter {
    float: left;
    font-size: 3.5em;
    line-height: 0.85;
    margin: 0.05em 0.1em 0 0;
    color: #c8a96e;
    font-family: Georgia, serif;
}

.visoria-pdf-page-footer {
    text-align: center;
    font-size: 8pt;
    color: #888;
    padding-top: 4mm;
    border-top: 1px solid #e0d5c5;
    margin-top: auto;
    flex-shrink: 0;
}

.visoria-pdf-chapter-heading {
    font-size: 13pt;
    font-weight: bold;
    color: #6b4c8c;
    margin-bottom: 4mm;
    text-align: center;
    letter-spacing: 0.05em;
}

.visoria-pdf-wrapper {
    width: 190mm;
    margin: 0 auto;
    background: #fff;
}
