.tpl-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    grid-template-rows: 1fr auto;
    background: rgba(20, 18, 16, 0.72);
    backdrop-filter: blur(10px);
}
.tpl-modal.hidden { display: none; }
.tpl-modal-scrim { position: absolute; inset: 0; }
.tpl-modal-stage {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    padding: 1.5rem 4.5rem 0.5rem;
    overflow: auto;
}
.tpl-modal-shell {
    width: min(560px, calc(100vw - 6rem));
    background: #ddd4c6;
    border-radius: 0.4rem;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.45);
    aspect-ratio: auto !important;
    height: min(68vh, 900px);
    overflow: auto !important;
    align-items: flex-start !important;
}
.tpl-preview-pages {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.tpl-preview-sheet .cv-page {
    width: 794px !important;
    height: 1123px !important;
    max-height: 1123px !important;
    min-height: 1123px !important;
    margin: 0 !important;
    box-shadow: none;
}
.tpl-modal-bar {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 1rem 1.5rem 1.25rem;
    background: #fffaf4;
    border-top: 1px solid #e7e0d6;
}
.tpl-modal-kicker {
    margin: 0;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #c2410c;
}
.tpl-modal-bar h2 { margin: 0.15rem 0 0; font-size: 1.25rem; }
.tpl-modal-bar p { margin: 0.2rem 0 0; color: #78716c; font-size: 0.88rem; max-width: 36rem; }
.tpl-modal-actions { display: flex; gap: 0.55rem; flex-shrink: 0; }
.tpl-modal-ghost {
    border: 1px solid #e7e0d6;
    background: #fff;
    border-radius: 999px;
    padding: 0.65rem 1rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.tpl-modal-nav {
    position: absolute;
    top: 42%;
    z-index: 3;
    width: 3rem;
    height: 3rem;
    border: none;
    border-radius: 999px;
    background: #fff;
    font-size: 1.6rem;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}
.tpl-modal-prev { left: 1rem; }
.tpl-modal-next { right: 1rem; }

@media (max-width: 720px) {
    .tpl-modal-stage { padding: 1rem 0.75rem; }
    .tpl-modal-nav { display: none; }
    .tpl-modal-bar { flex-direction: column; align-items: stretch; }
}

/* New layout structures */
.cv-modern-layout-right { grid-template-columns: 1fr 32%; }
.cv-modern-layout-right .cv-sidebar { order: 2; }

.cv-timeline { border-left: 2px solid #e7e5e4; padding-left: 1rem; }
.cv-timeline .cv-entry { position: relative; }
.cv-timeline .cv-entry::before {
    content: "";
    position: absolute;
    left: -1.28rem;
    top: 0.35rem;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: #c2410c;
    box-shadow: 0 0 0 3px #fff;
}

.cv-mag-banner {
    display: grid;
    grid-template-columns: 40mm 1fr;
    gap: 10mm;
    align-items: center;
    padding: 9mm 13mm 7mm;
    background: #1c1917;
    color: #fffaf4;
}
.cv-mag-banner .cv-photo {
    width: 36mm;
    height: 44mm;
    border-radius: 0.35rem;
    object-fit: cover;
    border: 0;
}
.cv-mag-banner .cv-name {
    color: #fffaf4;
    font-family: "Fraunces", Georgia, serif;
    font-weight: 500;
    font-size: 2.15rem;
    line-height: 1.05;
    margin: 0;
}
.cv-mag-banner .cv-title { color: #fdba74; margin: 0.35rem 0 0; font-size: 1rem; }
.cv-kicker { margin: 0 0 0.35rem; letter-spacing: 0.16em; text-transform: uppercase; font-size: 0.68rem; opacity: 0.7; }
.cv-layout-magazine {
    display: flex;
    flex-direction: column;
}
.cv-mag-body {
    display: grid;
    grid-template-columns: 1.4fr 0.8fr;
    gap: 8mm;
    padding: 6mm 13mm 11mm;
    flex: 1;
    align-items: start;
}
.cv-mag-main .cv-section { margin-bottom: 0.85rem; }
.cv-mag-main .cv-section h3 { font-size: 0.72rem; letter-spacing: 0.12em; }
.cv-mag-main .cv-entry { margin-bottom: 0.7rem; }
.cv-mag-main .cv-entry p { font-size: 0.8rem; line-height: 1.38; margin: 0.25rem 0 0; }
.cv-mag-main > .cv-section:first-child p { font-size: 0.86rem; line-height: 1.42; }
.cv-mag-side {
    background: #faf7f2;
    padding: 5mm 5.5mm 6mm;
    border-radius: 0.2rem;
}
.cv-mag-side .cv-section { margin-bottom: 0.85rem; }
.cv-mag-side .cv-section h3 { font-size: 0.68rem; }
.cv-mag-side p { font-size: 0.78rem; margin: 0 0 0.25rem; line-height: 1.35; overflow-wrap: anywhere; }
.cv-mag-side .skill-chip { font-size: 0.68rem; }
.template-atelier .cv-mag-banner { background: #3f3a36; }
.template-atelier .cv-mag-banner .cv-title { color: #fdba74; }
.template-atelier .cv-mag-side { background: #f3eee6; }

.cv-centered-head { text-align: center; margin-bottom: 1.1rem; }
.cv-centered-head .cv-photo { margin: 0 auto 0.7rem; display: block; }
.cv-centered-head .cv-name { font-family: "Fraunces", Georgia, serif; font-weight: 500; font-size: 2.15rem; }
.cv-contact-center { justify-content: center; }

.cv-folio { display: grid; grid-template-columns: 38% 1fr; min-height: 297mm; }
.cv-folio-photo { background: #111827; color: #fff; padding: 12mm 9mm; }
.cv-folio-photo .cv-photo { width: 100%; height: 70mm; border-radius: 0.4rem; object-fit: cover; border: 0; margin-bottom: 1rem; }
.cv-folio-main { padding: 14mm 12mm 16mm; }
.cv-folio .skill-meter-bar { background: rgba(255,255,255,.2); }

.cv-rail-page { display: grid; grid-template-columns: 8mm 1fr; min-height: 297mm; }
.cv-rail { background: linear-gradient(180deg, #c2410c, #9a3412); }
.cv-rail-body { padding: 14mm 14mm 16mm 10mm; }

.cv-layout-frame { padding: 8mm; background: #fff; }
.cv-frame-inner { border: 1.4px solid #1c1917; padding: 10mm 12mm 14mm; height: calc(297mm - 16mm); box-sizing: border-box; }

.cv-hero-banner {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 14mm 16mm;
    background: linear-gradient(120deg, #0f172a, #1e3a5f);
    color: #fff;
}
.cv-hero-banner .cv-name { color: #fff; font-family: "Fraunces", Georgia, serif; font-weight: 500; font-size: 2rem; }
.cv-hero-banner .cv-title, .cv-hero-banner .cv-contact { color: #e2e8f0; }
.cv-hero-banner .cv-photo { width: 32mm; height: 32mm; border-color: #94a3b8; }
.cv-banner-body { padding: 10mm 16mm 16mm; }

.cv-split-cols { display: grid; grid-template-columns: 1.4fr 0.9fr; gap: 8mm; }
.cv-editorial-head { border-bottom: 3px solid #1c1917; padding-bottom: 0.6rem; margin-bottom: 1rem; }
.cv-editorial-head .cv-name {
    font-family: "Fraunces", Georgia, serif;
    font-size: 2.4rem;
    font-weight: 500;
    letter-spacing: -0.04em;
}
.cv-editorial-grid { display: grid; grid-template-columns: 1.2fr 0.9fr; gap: 10mm; column-gap: 12mm; }

.template-aurora .cv-sidebar { background: linear-gradient(180deg, #0369a1, #0e7490); }
.template-chronicle .cv-timeline .cv-entry::before { background: #1e3a8a; }
.template-folio .cv-folio-photo { background: #431407; }
.template-signal .cv-rail { background: linear-gradient(180deg, #7c3aed, #4f46e5); }
.template-masthead .cv-hero-banner { background: linear-gradient(120deg, #111827, #be123c); }
.template-quartz .cv-frame-inner { border-color: #78716c; }
.template-zenith .cv-centered-head .cv-name { letter-spacing: 0.08em; text-transform: uppercase; font-size: 1.6rem; }
.template-column .cv-split-cols { border-top: 1px solid #e7e5e4; padding-top: 0.75rem; }
.template-serif-news .cv-editorial-head { border-bottom-width: 6px; }

.thumb-aurora { background: linear-gradient(270deg, #0369a1 35%, white 35%); }
.thumb-chronicle { background: linear-gradient(90deg, #c2410c 8px, white 8px); }
.thumb-atelier { background: linear-gradient(180deg, #1c1917 28%, white 28%); }
.thumb-zenith { background: radial-gradient(circle at 50% 22%, #e7e5e4 18%, white 19%); }
.thumb-folio { background: linear-gradient(90deg, #431407 40%, white 40%); }
.thumb-signal { background: linear-gradient(90deg, #7c3aed 8px, white 8px); }
.thumb-quartz { background: white; box-shadow: inset 0 0 0 6px white, inset 0 0 0 8px #1c1917; }
.thumb-masthead { background: linear-gradient(180deg, #0f172a 30%, white 30%); }
.thumb-column { background: linear-gradient(90deg, white 62%, #f5f0ea 62%); }
.thumb-serif-news { background: linear-gradient(180deg, #1c1917 0 10%, white 10%); }
