/* =====================================================================================
   Resume Builder – dashboard shell, cards, modals (PDF viewer, login), toasts
   ===================================================================================== */

/* colours = Rirekisho Builder site (assets/css/header.css: --_newh_primary …) */
:root {
    --cvd-bg: #f7f6fb;
    --cvd-surface: #ffffff;
    --cvd-text: #1f2937;
    --cvd-muted: #6b7280;
    --cvd-border: #ebe8f3;
    --cvd-brand: #6c3cf0;
    --cvd-brand-dark: #5228d9;
    --cvd-brand-soft: #f4f0ff;
    --cvd-brand-grad: linear-gradient(135deg, rgba(47, 28, 106, 1) 0%, rgba(80, 37, 209, 1) 55%, rgba(103, 61, 230, 1) 100%);
    --cvd-side-bg: #ffffff;
    --cvd-side-text: #374151;
    --cvd-side-w: 248px;
    --cvd-side-mini: 76px;
    --cvd-top-h: 64px;
    --cvd-radius: 16px;
    --cvd-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
}

html, body { height: 100%; }
body.cvd-body { margin: 0; background: var(--cvd-bg); color: var(--cvd-text); font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 15px; -webkit-font-smoothing: antialiased; }
.cvd-body a { text-decoration: none; }

/* ------------------------------------------------------------------ shell */
.cvd-shell { min-height: 100vh; }
.cvd-main { min-height: 100vh; margin-left: var(--cvd-side-w); display: flex; flex-direction: column; transition: margin-left .22s ease; }
.cvd-mini .cvd-main { margin-left: var(--cvd-side-mini); }

/* ------------------------------------------------------------------ sidebar */
.cvd-sidebar {
    position: fixed; z-index: 1040; left: 0; top: 0; bottom: 0; width: var(--cvd-side-w);
    display: flex; flex-direction: column; padding: 14px 12px;
    background: var(--cvd-side-bg); color: var(--cvd-side-text); border-right: 1px solid var(--cvd-border);
    transition: width .22s ease, transform .22s ease; overflow-x: hidden; overflow-y: auto;
}
.cvd-mini .cvd-sidebar { width: var(--cvd-side-mini); }

.cvd-brand { display: flex; align-items: center; justify-content: space-between; height: 44px; margin: 0 0 18px; padding: 0 6px; }
.cvd-brand-link { display: flex; align-items: center; gap: 10px; color: var(--cvd-text); white-space: nowrap; }
.cvd-brand-mark { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; background: var(--cvd-brand-grad); box-shadow: 0 6px 16px rgba(108, 60, 240, .32); }
.cvd-brand-mark img { width: 24px; height: 24px; filter: brightness(0) invert(1); }   /* the site logo, in white */
.cvd-brand-text { font-size: 17px; font-weight: 800; letter-spacing: -.4px; color: var(--cvd-text); }

.cvd-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.cvd-nav-label { margin: 16px 0 6px; padding: 0 14px; font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: #9ca3af; white-space: nowrap; height: 16px; }
.cvd-nav-link {
    display: flex; align-items: center; gap: 13px; width: 100%; padding: 11px 14px; border: 0; border-radius: 11px;
    background: none; color: var(--cvd-side-text); font-size: 14.5px; font-weight: 500; white-space: nowrap; text-align: left;
    transition: background .15s ease, color .15s ease;
}
.cvd-nav-link i { flex-shrink: 0; width: 22px; font-size: 18px; text-align: center; }
.cvd-nav-link:hover { background: var(--cvd-brand-soft); color: var(--cvd-brand); }
.cvd-nav-link.active { background: var(--cvd-brand-soft); color: var(--cvd-brand); font-weight: 700; box-shadow: inset 3px 0 0 var(--cvd-brand); }
.cvd-nav-sub { font-size: 13.5px; padding-top: 9px; padding-bottom: 9px; }
.cvd-nav-home { color: var(--cvd-brand); font-weight: 600; }
.cvd-side-bottom { display: flex; flex-direction: column; gap: 3px; padding-top: 12px; border-top: 1px solid var(--cvd-border); }

.cvd-mini .cvd-brand-text, .cvd-mini .cvd-nav-link span, .cvd-mini .cvd-nav-label span { display: none; }
.cvd-mini .cvd-brand { justify-content: center; padding: 0; }
.cvd-mini .cvd-nav-link { justify-content: center; padding-left: 0; padding-right: 0; }
.cvd-mini .cvd-nav-label { margin: 14px 10px 8px; border-top: 1px solid var(--cvd-border); }
.cvd-mini .cvd-collapse-btn i { transform: scaleX(-1); }

.cvd-backdrop { display: none; }

/* ------------------------------------------------------------------ top bar */
.cvd-topbar {
    position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; gap: 12px; height: var(--cvd-top-h); padding: 0 24px;
    background: rgba(255, 255, 255, .85); backdrop-filter: saturate(180%) blur(10px); -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--cvd-border);
}
.cvd-topbar-title { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cvd-topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.cvd-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; border-radius: 11px; background: transparent; color: inherit; font-size: 21px; }
.cvd-icon-btn:hover { background: rgba(100, 116, 139, .12); }
.cvd-btn-ghost { align-items: center; gap: 6px; border: 1px solid var(--cvd-border); border-radius: 10px; background: #fff; color: var(--cvd-text); font-weight: 600; padding: 7px 13px; }
.cvd-btn-ghost:hover { background: #f8fafc; border-color: #cbd5e1; }
.cvd-login-btn { display: inline-flex; align-items: center; gap: 7px; border-radius: 10px; font-weight: 600; padding: 7px 14px; }
.cvd-user { display: flex; align-items: center; gap: 9px; padding: 4px 10px 4px 4px; border: 1px solid var(--cvd-border); border-radius: 100px; background: #fff; color: var(--cvd-text); font-weight: 600; font-size: 14px; }
.cvd-user:hover { border-color: #cbd5e1; }
.cvd-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.cvd-avatar-txt { display: inline-flex; align-items: center; justify-content: center; background: var(--cvd-brand); color: #fff; font-weight: 700; }

.cvd-content { flex: 1; padding: 28px; }

/* ------------------------------------------------------------------ mobile */
@media (max-width: 991.98px) {
    .cvd-main, .cvd-mini .cvd-main { margin-left: 0; }
    .cvd-sidebar, .cvd-mini .cvd-sidebar { width: 280px; transform: translateX(-100%); box-shadow: 0 0 40px rgba(2, 6, 23, .3); }
    .cvd-open .cvd-sidebar { transform: translateX(0); }
    .cvd-mini .cvd-nav-link span, .cvd-mini .cvd-nav-label span { display: inline; }
    .cvd-mini .cvd-brand-text { display: inline; }
    .cvd-mini .cvd-brand { justify-content: space-between; padding: 0 6px; }
    .cvd-mini .cvd-nav-link { justify-content: flex-start; padding: 11px 14px; }
    .cvd-mini .cvd-nav-label { margin: 16px 0 6px; border: 0; }
    .cvd-open .cvd-backdrop { display: block; position: fixed; inset: 0; z-index: 1035; background: rgba(15, 23, 42, .5); }
    .cvd-topbar { padding: 0 12px; }
    .cvd-content { padding: 18px 14px; }
}

/* ------------------------------------------------------------------ common bits */
.cvd-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.cvd-page-head h1 { margin: 0 0 4px; font-size: 26px; font-weight: 800; letter-spacing: -.6px; }
.cvd-page-head p { margin: 0; color: var(--cvd-muted); }
.cvd-btn-primary { display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border: 0; border-radius: 12px; background: var(--cvd-brand); color: #fff; font-weight: 700; box-shadow: 0 8px 20px rgba(108, 60, 240, .28); transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.cvd-btn-primary:hover { background: var(--cvd-brand-dark); color: #fff; transform: translateY(-1px); box-shadow: 0 12px 26px rgba(108, 60, 240, .34); }
.cvd-panel { background: var(--cvd-surface); border: 1px solid var(--cvd-border); border-radius: var(--cvd-radius); box-shadow: var(--cvd-shadow); }

.cvd-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 26px; }
.cvd-stat { display: flex; align-items: center; gap: 14px; padding: 18px; }
.cvd-stat-icon { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 13px; background: var(--cvd-brand-soft); color: var(--cvd-brand); font-size: 20px; }
.cvd-stat b { display: block; font-size: 22px; font-weight: 800; line-height: 1.1; }
.cvd-stat span { color: var(--cvd-muted); font-size: 13px; }
@media (max-width: 767.98px) {
    .cvd-stats { gap: 8px; margin-bottom: 18px; }
    .cvd-stat { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
    .cvd-stat-icon { width: 34px; height: 34px; border-radius: 10px; font-size: 15px; }
    .cvd-stat b { font-size: 16px; }
    .cvd-stat span { font-size: 11.5px; }
    .cvd-page-head h1 { font-size: 22px; }
    .cvd-new-card { min-height: 150px; flex-direction: row; text-align: left; }
    .cvd-new-card i { flex-shrink: 0; }
    .cvd-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .cvd-new-card { grid-column: 1 / -1; }
    .cvd-card-body { padding: 10px 10px 4px; }
    .cvd-card-title { font-size: 13.5px; }
    .cvd-card-actions { padding: 8px 8px 10px; gap: 4px; }
}

/* ------------------------------------------------------------------ resume cards */
.cvd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.cvd-card { display: flex; flex-direction: column; overflow: hidden; transition: transform .18s ease, box-shadow .18s ease, opacity .25s ease; }
.cvd-card:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(15, 23, 42, .1); }
.cvd-card-removing { opacity: 0; transform: scale(.96); }
.cvd-thumb { position: relative; display: block; overflow: hidden; background: #e9edf5; border-bottom: 1px solid var(--cvd-border); }
.cvd-thumb iframe { position: absolute; left: 0; top: 0; width: 794px; height: 1123px; border: 0; transform-origin: 0 0; pointer-events: none; background: #fff; }
.cvd-thumb::after { content: ""; position: absolute; inset: 0; }
.cvd-thumb-edit { position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center; background: rgba(15, 23, 42, .0); opacity: 0; transition: opacity .18s ease, background .18s ease; }
.cvd-thumb-edit span { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 100px; background: #fff; color: var(--cvd-text); font-weight: 700; font-size: 14px; box-shadow: 0 8px 20px rgba(2, 6, 23, .2); }
.cvd-card:hover .cvd-thumb-edit { opacity: 1; background: rgba(15, 23, 42, .35); }
.cvd-card-body { padding: 14px 16px 6px; }
.cvd-card-title { display: block; overflow: hidden; color: var(--cvd-text); font-weight: 700; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.cvd-card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 4px; color: var(--cvd-muted); font-size: 12.5px; }
.cvd-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 100px; background: var(--cvd-brand-soft); color: var(--cvd-brand); font-size: 11.5px; font-weight: 600; }
.cvd-card-actions { display: flex; gap: 6px; padding: 10px 12px 14px; }
.cvd-card-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 10px; font-size: 13.5px; font-weight: 600; }
.cvd-card-actions .btn-edit { flex: 1; }

.cvd-new-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 320px; padding: 24px; border: 2px dashed #dccfff; border-radius: var(--cvd-radius); background: linear-gradient(180deg, #fbfcff, #f6f2ff); color: var(--cvd-brand); text-align: center; transition: border-color .15s ease, background .15s ease; }
.cvd-new-card:hover { border-color: var(--cvd-brand); background: #f4f0ff; color: var(--cvd-brand); }
.cvd-new-card i { display: inline-flex; align-items: center; justify-content: center; width: 58px; height: 58px; border-radius: 18px; background: #fff; font-size: 26px; box-shadow: var(--cvd-shadow); }
.cvd-new-card b { color: var(--cvd-text); font-size: 16px; }
.cvd-new-card small { color: var(--cvd-muted); }

/* ------------------------------------------------------------------ empty / guest */
.cvd-hero { position: relative; overflow: hidden; padding: 44px; border-radius: 22px; background: radial-gradient(circle at 85% 10%, rgba(255, 255, 255, .16), transparent 45%), var(--cvd-brand-grad); color: #fff; }
.cvd-hero h1 { max-width: 560px; margin: 0 0 12px; font-size: 32px; font-weight: 800; letter-spacing: -.8px; line-height: 1.15; }
.cvd-hero p { max-width: 520px; margin: 0 0 24px; color: #e9e2ff; font-size: 16px; }
.cvd-hero .btn-light { border-radius: 12px; font-weight: 700; padding: 11px 18px; }
.cvd-hero .btn-outline-light { border-radius: 12px; font-weight: 600; padding: 11px 18px; }
.cvd-hero-art { position: absolute; right: 40px; bottom: -30px; display: flex; gap: 14px; transform: rotate(-6deg); opacity: .95; }
.cvd-hero-art div { width: 120px; height: 170px; border-radius: 10px; background: #fff; box-shadow: 0 20px 40px rgba(0, 0, 0, .35); }
.cvd-hero-art div:nth-child(2) { transform: translateY(-26px); }
.cvd-hero-art div::before { content: ""; display: block; height: 34px; border-radius: 10px 10px 0 0; background: #6c3cf0; }
.cvd-hero-art div:nth-child(2)::before { background: #0f766e; }
.cvd-hero-art div:nth-child(3)::before { background: #1e3a5f; width: 40%; height: 100%; border-radius: 10px 0 0 10px; }
@media (max-width: 991.98px) { .cvd-hero-art { display: none; } .cvd-hero { padding: 28px 22px; } .cvd-hero h1 { font-size: 25px; } }

.cvd-features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 22px; }
.cvd-feature { padding: 20px; }
.cvd-feature i { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; margin-bottom: 10px; border-radius: 12px; background: var(--cvd-brand-soft); color: var(--cvd-brand); font-size: 19px; }
.cvd-feature b { display: block; margin-bottom: 4px; }
.cvd-feature p { margin: 0; color: var(--cvd-muted); font-size: 14px; }
@media (max-width: 767.98px) { .cvd-features { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ create: steps, template & sample cards */
.cvd-steps { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; font-size: 13.5px; font-weight: 600; color: var(--cvd-muted); }
.cvd-step { display: inline-flex; align-items: center; gap: 8px; }
.cvd-step b { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: #e2e8f0; color: #475569; font-size: 12.5px; }
.cvd-step.active { color: var(--cvd-text); }
.cvd-step.active b { background: var(--cvd-brand); color: #fff; }
.cvd-step.done b { background: #16a34a; color: #fff; }
.cvd-step-line { width: 30px; height: 2px; border-radius: 2px; background: #e2e8f0; }

.cvd-tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
.cvd-tpl { display: flex; flex-direction: column; overflow: hidden; color: var(--cvd-text); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.cvd-tpl:hover { transform: translateY(-4px); border-color: #dccfff; box-shadow: 0 22px 46px rgba(108, 60, 240, .14); color: var(--cvd-text); }
.cvd-tpl.selected { border: 2px solid var(--cvd-brand); }
.cvd-tpl .cvd-thumb { margin: 14px 14px 0; border: 1px solid var(--cvd-border); border-radius: 10px; box-shadow: 0 10px 24px rgba(15, 23, 42, .08); }
.cvd-tpl-body { padding: 14px 18px 18px; }
.cvd-tpl-body h3 { margin: 0 0 4px; font-size: 17px; font-weight: 800; }
.cvd-tpl-body p { margin: 0 0 10px; color: var(--cvd-muted); font-size: 13.5px; }
.cvd-tpl-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.cvd-tpl-cta { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; color: var(--cvd-brand); font-weight: 700; font-size: 14px; }

.cvd-start-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.cvd-start { display: flex; flex-direction: column; gap: 10px; padding: 20px; color: var(--cvd-text); transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.cvd-start:hover { transform: translateY(-3px); border-color: #dccfff; box-shadow: 0 16px 34px rgba(108, 60, 240, .12); color: var(--cvd-text); }
.cvd-start i { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 14px; background: var(--cvd-brand-soft); color: var(--cvd-brand); font-size: 22px; }
.cvd-start b { font-size: 16px; }
.cvd-start small { color: var(--cvd-muted); font-size: 13.5px; }
.cvd-start-blank i { background: #f1f5f9; color: #334155; }
.cvd-start-go { margin-top: auto; color: var(--cvd-brand); font-size: 13.5px; font-weight: 700; }
.cvd-chosen { display: flex; align-items: center; gap: 16px; padding: 14px; margin-bottom: 22px; }
.cvd-chosen .cvd-thumb { flex-shrink: 0; width: 84px; border-radius: 6px; border: 1px solid var(--cvd-border); }

/* ------------------------------------------------------------------ toasts */
.cvm-toasts { position: fixed; right: 18px; bottom: 18px; z-index: 3100; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.cvm-toast { display: flex; align-items: center; gap: 10px; max-width: 360px; padding: 12px 16px; border-radius: 12px; background: #0f172a; color: #fff; font-size: 14px; font-weight: 500; box-shadow: 0 12px 30px rgba(2, 6, 23, .3); opacity: 0; transform: translateY(10px); transition: opacity .25s ease, transform .25s ease; pointer-events: auto; }
.cvm-toast.show { opacity: 1; transform: none; }
.cvm-toast i { font-size: 18px; color: #4ade80; }
.cvm-toast-error i { color: #f87171; }
.cvm-toast-info i { color: #93c5fd; }
@media (max-width: 575.98px) { .cvm-toasts { left: 12px; right: 12px; bottom: 12px; } .cvm-toast { max-width: none; } }

/* ------------------------------------------------------------------ confirm & login modals */
.cvm-confirm { border: 0; border-radius: 20px; }
.cvm-confirm-icon { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; margin-bottom: 12px; border-radius: 50%; background: #fef2f2; color: #dc2626; font-size: 24px; }
.cvm-auth .modal-content { position: relative; border: 0; border-radius: 22px; box-shadow: 0 30px 80px rgba(2, 6, 23, .35); }
.cvm-auth-close { position: absolute; right: 16px; top: 16px; z-index: 2; }
.cvm-auth-head { padding: 28px 28px 8px; text-align: center; }
.cvm-auth-icon { display: inline-flex; align-items: center; justify-content: center; width: 54px; height: 54px; margin-bottom: 12px; border-radius: 16px; background: var(--cvd-brand-soft); color: var(--cvd-brand); font-size: 24px; }
.cvm-auth-tabs { margin: 12px 28px 0; padding: 4px; border-radius: 12px; background: #f1f5f9; }
.cvm-auth-tabs .nav-item { flex: 1; }
.cvm-auth-tabs .nav-link { width: 100%; padding: 8px; border-radius: 9px; color: var(--cvd-muted); font-weight: 600; font-size: 14px; }
.cvm-auth-tabs .nav-link.active { background: #fff; color: var(--cvd-text); box-shadow: 0 1px 4px rgba(15, 23, 42, .1); }
.cvm-auth .modal-body { padding: 18px 28px 28px; }
.cvm-auth .form-control { border-radius: 10px; padding: 10px 12px; }
.cvm-auth .btn-dark { border-radius: 11px; }

/* ------------------------------------------------------------------ PDF: creating overlay + viewer modal (from tally tools) */
@keyframes cvp-spin { to { transform: rotate(360deg); } }
@keyframes cvp-pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes cvp-ring { 0% { transform: scale(.8); opacity: 1; } 100% { transform: scale(1.35); opacity: 0; } }
body.cvp-busy { overflow: hidden; }
.cvp-loading { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(11, 17, 32, .6); backdrop-filter: blur(4px); }
.cvp-loading[hidden] { display: none; }
.cvp-loading-box { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 30px 40px; border-radius: 20px; background: #fff; text-align: center; box-shadow: 0 30px 60px rgba(2, 6, 23, .4); }
.cvp-loading-box strong { font-size: 18px; }
.cvp-loading-box p { margin: 0; color: var(--cvd-muted); font-size: 14px; }
.cvp-loading-icon { position: relative; display: flex; align-items: center; justify-content: center; width: 72px; height: 72px; margin: 0 0 10px; border-radius: 20px; background: #fef2f2; color: #dc2626; font-size: 30px; }
.cvp-loading-icon span { position: absolute; inset: -6px; border: 3px solid #fecaca; border-top-color: #dc2626; border-radius: 24px; animation: cvp-spin 1s linear infinite; }

.cvp-modal .modal-dialog { max-width: 1200px; padding: 0 12px; }
.cvp-modal .modal-content { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: minmax(0, 1fr); overflow: hidden; height: min(88vh, 900px); border: 0; border-radius: 26px; background: #fff; box-shadow: 0 40px 100px rgba(2, 6, 23, .45); }
body.cvp-showing .modal-backdrop.show { opacity: .65; }
.cvp-close { position: absolute; right: 14px; top: 14px; z-index: 3; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #f1f5f9; color: #475569; font-size: 16px; transition: background .15s ease, transform .15s ease; }
.cvp-close:hover { background: #e2e8f0; transform: rotate(90deg); }
.cvp-view { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: radial-gradient(circle at 30% 0%, #f4f0ff, transparent 60%), #e5e9f0; }
.cvp-view iframe { display: block; width: 100%; height: 100%; border: 0; }
.cvp-view iframe[hidden], .cvp-nopreview[hidden] { display: none; }
.cvp-pages { flex: 1; min-height: 0; overflow: auto; padding: 22px 8px 80px; -webkit-overflow-scrolling: touch; outline: none; }
.cvp-pages[hidden] { display: none; }
.cvp-pages canvas { display: block; margin: 0 auto 18px; background: #fff; border-radius: 4px; box-shadow: 0 10px 30px rgba(15, 23, 42, .18); }
.cvp-bar { position: absolute; left: 50%; bottom: 16px; z-index: 2; display: flex; align-items: center; gap: 4px; padding: 5px; border-radius: 100px; background: rgba(15, 23, 42, .88); color: #fff; box-shadow: 0 10px 24px rgba(2, 6, 23, .3); transform: translateX(-50%); backdrop-filter: blur(6px); }
.cvp-bar[hidden] { display: none; }
.cvp-bar button { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 10px; border: 0; border-radius: 100px; background: transparent; color: #fff; font-size: 13px; font-weight: 700; }
.cvp-bar button:hover { background: rgba(255, 255, 255, .14); }
.cvp-bar span { min-width: 50px; font-size: 13px; font-weight: 800; text-align: center; }
.cvp-bar .cvp-fit { margin-left: 2px; border-left: 1px solid rgba(255, 255, 255, .2); border-radius: 0 100px 100px 0; }
.cvp-wait { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; color: #475569; font-size: 15px; font-weight: 700; }
.cvp-wait[hidden] { display: none; }
.cvp-nopreview { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; height: 100%; padding: 30px; text-align: center; }
.cvp-nopreview p { max-width: 300px; margin: 0; color: var(--cvd-muted); }
.cvp-paper { position: relative; width: 120px; height: 156px; padding: 44px 18px 0; border-radius: 12px; background: #fff; box-shadow: 0 18px 40px rgba(15, 23, 42, .15); }
.cvp-paper i { position: absolute; left: 50%; top: -22px; display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 14px; background: #dc2626; color: #fff; font-size: 20px; transform: translateX(-50%); }
.cvp-paper span { display: block; height: 8px; margin: 0 0 10px; border-radius: 4px; background: #e2e8f0; }
.cvp-paper span:nth-child(3) { width: 70%; }
.cvp-printer { position: fixed; right: 0; bottom: 0; width: 0; height: 0; border: 0; }

.cvp-side { display: flex; flex-direction: column; min-height: 0; padding: 34px 26px 22px; overflow-y: auto; border-left: 1px solid var(--cvd-border); }
.cvp-success { position: relative; display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 62px; height: 62px; margin: 6px 0 18px; border-radius: 50%; background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; font-size: 28px; box-shadow: 0 12px 26px rgba(22, 163, 74, .35); animation: cvp-pop .45s cubic-bezier(.2, 1.4, .4, 1) both; }
.cvp-success::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid rgba(34, 197, 94, .35); animation: cvp-ring 1.6s ease-out .3s both; }
.cvp-side h2 { margin: 0 0 6px; font-size: 24px; font-weight: 800; letter-spacing: -.6px; }
.cvp-sub { margin: 0 0 20px; color: var(--cvd-muted); font-size: 14.5px; line-height: 1.6; }
.cvp-file { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; padding: 12px; border: 1px solid var(--cvd-border); border-radius: 14px; background: #f8fafc; }
.cvp-file > div { min-width: 0; }
.cvp-file-icon { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 11px; background: #fef2f2; color: #dc2626; font-size: 19px; }
.cvp-file b { display: block; overflow: hidden; font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }
.cvp-file small { color: var(--cvd-muted); font-size: 12.5px; font-weight: 600; }
.cvp-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cvp-buttons .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; border-radius: 14px; font-size: 15px; font-weight: 700; padding: 12px 10px; }
.cvp-buttons .btn-light { border: 1px solid var(--cvd-border); }
.cvp-buttons .cvp-main { grid-column: 1 / -1; box-shadow: 0 10px 24px rgba(15, 23, 42, .25); }
.cvp-meta-m { display: none; }
.cvp-notes { margin: 20px 0 0; padding: 0; list-style: none; }
.cvp-notes li { display: flex; gap: 9px; margin: 0 0 9px; color: #475569; font-size: 13px; line-height: 1.5; }
.cvp-notes li[hidden] { display: none; }
.cvp-notes i { color: #16a34a; }
.cvp-back { display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin: auto 0 0; padding: 12px; border: 0; border-radius: 12px; background: none; color: var(--cvd-muted); font-size: 14px; font-weight: 700; }
.cvp-back:hover { background: #f1f5f9; color: var(--cvd-text); }

@media (max-width: 991.98px) {
    .cvp-modal .modal-content { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; height: 92vh; height: 92dvh; }
    .cvp-pages { padding: 62px 10px 70px; }
    .cvp-side { flex-direction: row; align-items: center; gap: 10px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); overflow: visible; border-left: 0; border-top: 1px solid var(--cvd-border); }
    .cvp-heading { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
    .cvp-success { width: 36px; height: 36px; margin: 0; font-size: 17px; box-shadow: 0 6px 14px rgba(22, 163, 74, .3); }
    .cvp-success::after { inset: -5px; }
    .cvp-heading-text { min-width: 0; }
    .cvp-side h2 { overflow: hidden; margin: 0; font-size: 16.5px; letter-spacing: -.3px; text-overflow: ellipsis; white-space: nowrap; }
    .cvp-meta-m { display: block; color: var(--cvd-muted); font-size: 12px; font-weight: 600; }
    .cvp-sub, .cvp-file, .cvp-notes, .cvp-back, .cvp-open, .cvp-label { display: none !important; }
    .cvp-buttons { display: flex; flex-shrink: 0; gap: 8px; }
    .cvp-buttons .btn { width: 48px; min-height: 48px; padding: 0; font-size: 18px; }
    .cvp-buttons .cvp-main { grid-column: auto; }
}
@media (max-width: 767.98px) {
    .cvp-modal .modal-dialog { padding: 0 8px; }
    .cvp-modal.cvp-noview .modal-content { grid-template-rows: auto auto; height: auto; }
    .cvp-modal.cvp-noview .cvp-view { padding: 30px 0 10px; }
}

/* ------------------------------------------------------------------ template picker filter (many designs) */
.cvd-tpl-filter { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.cvd-chips-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; max-width: 100%; }
.cvd-chips-scroll::-webkit-scrollbar { display: none; }
.cvd-filter { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--cvd-border); border-radius: 100px; background: #fff; color: #334155; font-size: 14px; font-weight: 600; white-space: nowrap; }
.cvd-filter span { padding: 0 7px; border-radius: 100px; background: #f1f5f9; color: var(--cvd-muted); font-size: 12px; }
.cvd-filter:hover { border-color: #cbd5e1; }
.cvd-filter.active { border-color: var(--cvd-text); background: var(--cvd-text); color: #fff; }
.cvd-filter.active span { background: rgba(255, 255, 255, .18); color: #fff; }
.cvd-search { position: relative; flex: 0 1 260px; }
.cvd-search i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: #94a3b8; }
.cvd-search input { width: 100%; padding: 9px 12px 9px 36px; border: 1px solid var(--cvd-border); border-radius: 100px; background: #fff; font-size: 14px; }
.cvd-search input:focus { outline: none; border-color: var(--cvd-brand); box-shadow: 0 0 0 3px rgba(108, 60, 240, .13); }
.cvd-new-badge { position: absolute; right: 10px; top: 10px; z-index: 2; padding: 2px 9px; border-radius: 100px; background: #16a34a; color: #fff; font-size: 11px; font-weight: 700; }
@media (max-width: 575.98px) { .cvd-search { flex-basis: 100%; } .cvd-tpl-grid { grid-template-columns: 1fr 1fr; gap: 12px; } .cvd-tpl-body { padding: 10px 12px 12px; } .cvd-tpl-body p, .cvd-tpl-tags { display: none; } .cvd-tpl-body h3 { font-size: 14px; } .cvd-tpl .cvd-thumb { margin: 8px 8px 0; } .cvd-tpl-cta { font-size: 12.5px; margin-top: 6px; } }

/* ------------------------------------------------------------------ Rirekisho Builder theme (purple buttons everywhere) */
.cvd-body .btn-dark, .cvd-login-btn { background: var(--cvd-brand); border-color: var(--cvd-brand); color: #fff; }
.cvd-body .btn-dark:hover, .cvd-body .btn-dark:focus, .cvd-login-btn:hover { background: var(--cvd-brand-dark); border-color: var(--cvd-brand-dark); color: #fff; }
.cvd-body .btn-dark:disabled { background: var(--cvd-brand); border-color: var(--cvd-brand); opacity: .65; }
.cvd-filter.active { border-color: var(--cvd-brand); background: var(--cvd-brand); }
.cvd-step.active b { background: var(--cvd-brand); }
.cvd-body .form-check-input:checked { background-color: var(--cvd-brand); border-color: var(--cvd-brand); }
.cvd-body .form-control:focus, .cvd-body .form-select:focus { border-color: var(--cvd-brand); box-shadow: 0 0 0 3px rgba(108, 60, 240, .14); }
/* plain text links only (never buttons or cards) */
.cvd-body .form-text a, .cvd-body .cvm-auth form a, .cvd-body p a { color: var(--cvd-brand); }
.cvd-btn-primary, .cvd-btn-primary:hover, .cvd-btn-primary:focus { color: #fff !important; }
.cvd-hero .btn-light, .cvd-hero .btn-light:hover { color: var(--cvd-brand-dark) !important; }
.cvd-hero .btn-outline-light { color: #fff !important; }
.cvd-hero .btn-outline-light:hover { color: var(--cvd-brand-dark) !important; }
.cvd-btn-ghost, .cvd-btn-ghost:hover { color: var(--cvd-text) !important; }
.cvd-body .dropdown-item:active { background: var(--cvd-brand); }
.cvp-buttons .cvp-main { box-shadow: 0 10px 24px rgba(108, 60, 240, .3); }

/* ------------------------------------------------------------------ dark sidebar (deep purple of the Rirekisho Builder site) */
.cvd-sidebar { background: linear-gradient(180deg, #2f1c6a 0%, #24145a 55%, #1b0f45 100%); color: #ddd6fe; border-right: 0; box-shadow: 4px 0 24px rgba(27, 15, 69, .12); }
.cvd-brand { height: 52px; margin-bottom: 22px; }
.cvd-brand-link { gap: 12px; }
.cvd-brand-mark { width: 44px; height: 44px; border-radius: 13px; background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.cvd-brand-mark img { width: 26px; height: 26px; filter: brightness(0) invert(1); }   /* site logo → white */
.cvd-brand-text { display: flex; flex-direction: column; line-height: 1.1; color: #fff; }
.cvd-brand-text b { font-size: 18px; font-weight: 800; letter-spacing: -.4px; color: #fff; }
.cvd-brand-text small { margin-top: 3px; font-size: 11.5px; font-weight: 500; letter-spacing: .2px; color: #c4b5fd; }
.cvd-sidebar .cvd-icon-btn { color: #fff; }
.cvd-nav-link { color: #d4ccf5; }
.cvd-nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.cvd-nav-link.active { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: inset 3px 0 0 #a78bfa; }
.cvd-nav-label { color: #9b8fcf; }
.cvd-nav-home { color: #c4b5fd; }
.cvd-side-bottom { border-top-color: rgba(255, 255, 255, .1); }
.cvd-mini .cvd-nav-label { border-top-color: rgba(255, 255, 255, .1); }
@media (max-width: 991.98px) { .cvd-mini .cvd-brand-text { display: flex; } }

/* ------------------------------------------------------------------ create step 2: empty or sample data */
.cvd-start-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 22px; align-items: start; }
.cvd-chosen-card { position: sticky; top: calc(var(--cvd-top-h) + 16px); overflow: hidden; }
.cvd-chosen-card .cvd-thumb { margin: 14px 14px 0; border: 1px solid var(--cvd-border); border-radius: 10px; }
.cvd-chosen-info { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 18px; }
.cvd-chosen-info b { font-size: 16px; }
.cvd-chosen-label { display: inline-flex; align-items: center; gap: 6px; color: #16a34a; font-size: 12.5px; font-weight: 700; }
.cvd-start-options { display: flex; flex-direction: column; gap: 18px; }
.cvd-option { position: relative; display: flex; align-items: center; gap: 16px; padding: 22px 24px; color: var(--cvd-text); transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
a.cvd-option:hover { border-color: #cbb8ff; box-shadow: 0 16px 36px rgba(108, 60, 240, .12); transform: translateY(-2px); color: var(--cvd-text); }
.cvd-option-sample { flex-direction: column; align-items: stretch; gap: 18px; }
.cvd-option-head { display: flex; align-items: center; gap: 16px; }
.cvd-option-num { position: absolute; left: -11px; top: -11px; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--cvd-brand); color: #fff; font-size: 13px; font-weight: 800; box-shadow: 0 4px 10px rgba(108, 60, 240, .35); }
.cvd-option-icon { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 54px; height: 54px; border-radius: 16px; background: var(--cvd-brand-soft); color: var(--cvd-brand); font-size: 24px; }
.cvd-option-text { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.cvd-option-text b { font-size: 17px; }
.cvd-option-text small { color: var(--cvd-muted); font-size: 14px; }
.cvd-option-go { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border-radius: 12px; background: var(--cvd-brand-soft); color: var(--cvd-brand); font-weight: 700; font-size: 14px; }
a.cvd-option:hover .cvd-option-go { background: var(--cvd-brand); color: #fff; }
.cvd-profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.cvd-profile { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid var(--cvd-border); border-radius: 13px; background: #fff; color: var(--cvd-text); transition: border-color .15s ease, background .15s ease; }
.cvd-profile:hover { border-color: var(--cvd-brand); background: var(--cvd-brand-soft); color: var(--cvd-text); }
.cvd-profile > i:first-child { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 11px; background: var(--cvd-brand-soft); color: var(--cvd-brand); font-size: 18px; }
.cvd-profile:hover > i:first-child { background: var(--cvd-brand); color: #fff; }
.cvd-profile span { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.cvd-profile b { font-size: 14.5px; }
.cvd-profile small { color: var(--cvd-muted); font-size: 12.5px; line-height: 1.35; }
.cvd-profile-go { color: #b4a6e8; }
@media (max-width: 991.98px) {
    .cvd-start-layout { grid-template-columns: 1fr; }
    .cvd-chosen-card { position: static; display: flex; align-items: center; }
    .cvd-chosen-card .cvd-thumb { flex-shrink: 0; width: 86px; margin: 12px; }
    .cvd-chosen-info { padding: 12px 12px 12px 0; }
    .cvd-option { flex-wrap: wrap; padding: 18px; }
    .cvd-option-go { width: 100%; justify-content: center; }
    .cvd-option-icon { width: 46px; height: 46px; font-size: 21px; }
    .cvd-option-num { left: -8px; top: -8px; }
}

/* ------------------------------------------------------------------ phones: 16px fields (iPhone zooms in on smaller fields) */
@media (max-width: 991.98px) {
    .cvd-body input.form-control, .cvd-body textarea.form-control, .cvd-body select.form-select,
    .cvd-body .cve-title, .cvd-body .cvd-search input, .cvd-body input[type="search"] { font-size: 16px !important; }
}

/* PDF viewer: pages centred with plain margins (no flexbox – iOS Safari mis-places flex children in a
   scrolling box). Vertical centring of a page that fits is done in JS (cv-dashboard.js → centerPages). */
.cvp-pages { display: block; text-align: center; }
.cvp-pages canvas { display: block; max-width: none; margin-left: auto; margin-right: auto; }

/* sidebar template list */
.cvd-nav-new { margin-left: 4px; padding: 1px 6px; border-radius: 100px; background: #22c55e; color: #fff; font-size: 9.5px; font-style: normal; font-weight: 700; vertical-align: 1px; }
.cvd-nav-all { color: #c4b5fd; font-weight: 600; }
.cvd-nav-all span i { font-size: 12px; width: auto; }

/* dashboard home: "Start with a template" row */
.cvd-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 34px 0 14px; }
.cvd-section-head h2 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.3px; }
.cvd-section-head a { color: var(--cvd-brand) !important; font-weight: 700; font-size: 14px; }
.cvd-tpl-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(170px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.cvd-tpl-mini { display: flex; flex-direction: column; overflow: hidden; color: var(--cvd-text); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.cvd-tpl-mini:hover { transform: translateY(-3px); border-color: #cbb8ff; box-shadow: 0 16px 32px rgba(108, 60, 240, .12); color: var(--cvd-text); }
.cvd-tpl-mini .cvd-thumb { margin: 10px 10px 0; border: 1px solid var(--cvd-border); border-radius: 8px; }
.cvd-tpl-mini b { padding: 10px 12px 12px; font-size: 13.5px; }
@media (max-width: 575.98px) { .cvd-tpl-row { grid-auto-columns: 150px; } }

/* ------------------------------------------------------------------ template filter bar (style / layout / photo / search) */
.cv-tf { margin-bottom: 18px; }
.cv-tf-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cv-tf-row { display: flex; align-items: center; gap: 8px; overflow-x: auto; max-width: 100%; padding-bottom: 2px; scrollbar-width: none; }
.cv-tf-row::-webkit-scrollbar { display: none; }
.cv-tf-search { position: relative; flex: 0 1 260px; margin: 0; }
.cv-tf-sub { margin-top: 10px; padding-top: 10px; border-top: 1px dashed #e5e1f0; }
.cv-tf-sub .cvd-filter { padding: 6px 12px; font-size: 13px; }
.cv-tf-label { flex-shrink: 0; margin-right: 2px; color: #6b7280; font-size: 12px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }
.cv-tf-gap { flex-shrink: 0; width: 1px; height: 22px; margin: 0 6px; background: #e5e1f0; }
.cv-tf-reset { flex-shrink: 0; display: inline-flex; align-items: center; gap: 5px; margin-left: 4px; padding: 6px 10px; border: 0; border-radius: 100px; background: none; color: #dc2626; font-size: 13px; font-weight: 600; }
.cv-tf-reset:hover { background: #fef2f2; }
.cv-tf-reset[hidden] { display: none; }
@media (max-width: 575.98px) { .cv-tf-search { flex-basis: 100%; } }
.cv-tf-search input { width: 100%; padding: 9px 12px 9px 36px; border: 1px solid var(--cvd-border); border-radius: 100px; background: #fff; }
.cv-tf-search i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: #94a3b8; }

/* ------------------------------------------------------------------ paged template list (20 at a time) */
.cv-tl-more { display: flex; justify-content: center; margin: 22px 0 6px; }
.cv-tl-btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 22px; border: 1.5px solid #ddd3fb; border-radius: 100px; background: #fff; color: #6c3cf0 !important; font-weight: 700; font-size: 14.5px; text-decoration: none; }
.cv-tl-btn:hover { border-color: #6c3cf0; background: #f4f0ff; }
.cv-tl-btn[hidden], .cv-tl-loading[hidden], .cv-tl-empty[hidden] { display: none !important; }
.cv-tl-loading { display: inline-flex; align-items: center; gap: 8px; color: #6b7280; font-weight: 600; font-size: 14px; }
.cv-tl-loading .spinner-border { width: 16px; height: 16px; border-width: 2px; color: #6c3cf0; }
.cv-tl-empty { margin-top: 6px; padding: 26px; border: 1px dashed #d5c8fb; border-radius: 16px; background: #fff; color: #6b7280; text-align: center; }
#cvTplSentinel { height: 1px; }

/* design preview image (assets/previews/) – same A4 shape as the live iframe preview */
.cv-tpl-img { display: block; width: 100%; aspect-ratio: 794 / 1123; object-fit: contain; object-position: top center; background: #fff; }   /* contain: the whole page is visible, never cut */
