
:root {
    --cvb-primary: #1d4ed8;
    --cvb-text: #172033;
    --cvb-muted: #687083;
    --cvb-border: #e5e7eb;
    --cvb-bg: #f4f7fb;
    --cvb-card: #ffffff;
    --cvb-shadow: 0 16px 40px rgba(15, 23, 42, .08);
}

.cvb-app {
    font-family: Tahoma, Arial, sans-serif;
    color: var(--cvb-text);
    background: linear-gradient(180deg, #f7faff 0%, #f1f5fb 100%);
    border-radius: 28px;
    padding: 28px;
    line-height: 1.7;
}
.cvb-app * { box-sizing: border-box; }

.cvb-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    margin-bottom: 24px;
    background: radial-gradient(circle at top left, rgba(255,255,255,.16), transparent 30%), linear-gradient(135deg, #0f172a, #1d4ed8 58%, #2563eb);
    color: white;
    padding: 30px;
    border-radius: 24px;
    box-shadow: 0 14px 36px rgba(29, 78, 216, .22);
}
.cvb-header h1 { margin: 10px 0 6px; font-size: 32px; color: white; }
.cvb-header p { margin: 0; color: rgba(255,255,255,.88); max-width: 720px; }
.cvb-badge {
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 50px;
    padding: 7px 14px;
    font-size: 13px;
    display: inline-block;
}
.cvb-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.cvb-account-box {
    background: #fff;
    border: 1px solid var(--cvb-border);
    border-radius: 20px;
    box-shadow: var(--cvb-shadow);
    padding: 20px;
    margin-bottom: 22px;
}
.cvb-account-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.cvb-account-status strong { display: block; font-size: 18px; }
.cvb-account-status span { color: var(--cvb-muted); }
.cvb-account-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.cvb-account-login {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(320px, 1.4fr);
    gap: 18px;
    align-items: start;
}
.cvb-account-login h2 { margin: 0 0 6px; font-size: 22px; }
.cvb-account-login p { margin: 0; color: var(--cvb-muted); }
.cvb-auth-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.cvb-auth-tabs button {
    border: 1px solid var(--cvb-border);
    background: #fff;
    border-radius: 999px;
    padding: 8px 14px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
}
.cvb-auth-tabs button.active { background: var(--cvb-primary); color: #fff; border-color: var(--cvb-primary); }
.cvb-auth-panel { display: none; }
.cvb-auth-panel.active { display: block; }
.cvb-message { margin-top: 12px; font-weight: 700; }
.cvb-message.success { color: #15803d; }
.cvb-message.error { color: #b91c1c; }

.cvb-layout {
    display: grid;
    grid-template-columns: minmax(320px, 42%) minmax(380px, 58%);
    gap: 22px;
    align-items: start;
}
.cvb-form, .cvb-preview-wrap { min-width: 0; }
.cvb-card, .cvb-preview-wrap {
    background: var(--cvb-card);
    border: 1px solid var(--cvb-border);
    border-radius: 20px;
    box-shadow: var(--cvb-shadow);
}
.cvb-card { padding: 22px; margin-bottom: 16px; }
.cvb-card h2 { font-size: 18px; margin: 0 0 16px; }
.cvb-subtitle { margin: 12px 0 8px; font-size: 14px; }
.cvb-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cvb-app label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 12px; }
.cvb-note { display: block; color: var(--cvb-muted); font-weight: 400; margin-top: 4px; }
.cvb-app input, .cvb-app textarea, .cvb-app select {
    width: 100%;
    margin-top: 6px;
    border: 1px solid var(--cvb-border);
    border-radius: 12px;
    padding: 12px 13px;
    font-family: inherit;
    font-size: 14px;
    background: #fff;
    outline: none;
    transition: .18s ease;
}
.cvb-app textarea { min-height: 88px; resize: vertical; }
.cvb-app input:focus, .cvb-app textarea:focus, .cvb-app select:focus {
    border-color: var(--cvb-primary);
    box-shadow: 0 0 0 3px rgba(29,78,216,.12);
}

.cvb-repeat-item {
    padding: 14px;
    border: 1px dashed #cfd7e6;
    border-radius: 14px;
    margin-bottom: 12px;
    background: linear-gradient(180deg, #fcfdff, #f9fbfe);
}
.cvb-repeat-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom: 8px; }
.cvb-remove { border: 0; background: #fee2e2; color: #991b1b; border-radius: 9px; padding: 7px 10px; cursor: pointer; }

.cvb-btn {
    border: 0;
    border-radius: 12px;
    padding: 11px 16px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    transition: .2s ease;
}
.cvb-btn:hover { transform: translateY(-1px); }
.cvb-btn-primary { background: #22c55e; color: #fff; }
.cvb-btn-secondary { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.22); }
.cvb-btn-light { background: #eef4ff; color: #1d4ed8; }
.cvb-btn-save { background: var(--cvb-primary); color: #fff; }
.cvb-btn-danger { background: #fee2e2; color: #991b1b; }

.cvb-template-picker { display: grid; gap: 10px; margin-bottom: 14px; }
.cvb-template-grid-4 { grid-template-columns: repeat(2, 1fr); }
.cvb-template-picker label {
    border: 1px solid var(--cvb-border);
    border-radius: 14px;
    padding: 12px 14px;
    margin: 0;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
}
.cvb-template-picker input { width: auto; margin-inline-end: 6px; }
.cvb-template-picker label:has(input:checked) {
    border-color: var(--cvb-primary);
    box-shadow: 0 0 0 3px rgba(29,78,216,.10);
    background: #f8fbff;
}
.cvb-palette-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.cvb-palette-picker button {
    border: 1px solid var(--cvb-border);
    background: #fff;
    border-radius: 999px;
    padding: 8px 12px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
}
.cvb-palette-picker button::before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    background: var(--sw);
    border-radius: 50%;
    margin-inline-end: 6px;
    vertical-align: -1px;
}

.cvb-preview-wrap { position: sticky; top: 20px; overflow: hidden; }
.cvb-preview-toolbar {
    display:flex;
    justify-content:space-between;
    gap: 12px;
    align-items:center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--cvb-border);
    background: #fafbfc;
}
.cvb-preview-toolbar span { color: var(--cvb-muted); font-size: 13px; }
.cvb-preview { padding: 18px; overflow: auto; background: #f3f6fb; }

.cvb-cv-paper {
    width: 100%;
    max-width: 820px;
    min-height: 920px;
    margin: auto;
    background: white;
    color: #111827;
    border: 1px solid #e5e7eb;
    box-shadow: 0 10px 34px rgba(0,0,0,.08);
    padding: 42px;
}
.cvb-cv-header {
    border-bottom: 4px solid var(--cvb-primary);
    padding-bottom: 18px;
    margin-bottom: 20px;
    display: flex;
    gap: 18px;
    align-items: center;
}
.cvb-head-content { flex: 1; min-width: 0; }
.cvb-cv-header h2 { margin: 0; font-size: 34px; color: var(--cvb-primary); line-height: 1.2; }
.cvb-cv-header p { margin: 6px 0 12px; font-size: 18px; color: #374151; }
.cvb-photo-wrap {
    width: 92px;
    height: 92px;
    border-radius: 24px;
    background: #eef2ff;
    border: 3px solid #bfdbfe;
    overflow: hidden;
    flex: 0 0 92px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cvb-primary);
    font-weight: 700;
}
.cvb-photo-wrap img { width: 100%; height: 100%; object-fit: cover; display: none; }
.cvb-photo-wrap.has-photo img { display: block; }
.cvb-photo-wrap.has-photo .cvb-photo-placeholder { display: none; }
.cvb-no-photo .cvb-photo-wrap { display: none; }

.cvb-contact { display: flex; flex-wrap: wrap; gap: 8px 14px; color: #4b5563; font-size: 13px; }
.cvb-contact span { position: relative; }
.cvb-contact span:empty { display: none; }
.cvb-contact span:not(:last-child)::after {
    content: "";
    display: inline-block;
    width: 4px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 50%;
    margin-inline-start: 9px;
    vertical-align: middle;
}
.cvb-cv-section { margin: 20px 0; }
.cvb-cv-section h3 {
    color: var(--cvb-primary);
    font-size: 17px;
    margin: 0 0 10px;
    letter-spacing: .2px;
}
.cvb-cv-section p { margin: 0; white-space: pre-line; }
.cvb-entry { margin-bottom: 16px; }
.cvb-entry h4 { margin: 0; font-size: 16px; line-height: 1.45; }
.cvb-entry .cvb-meta { color: #6b7280; font-size: 13px; margin: 2px 0 5px; }
.cvb-entry p { margin: 0; white-space: pre-line; color: #374151; }
.cvb-two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.cvb-cv-section ul { padding-inline-start: 20px; margin: 0; }
.cvb-cv-section li { margin-bottom: 4px; }
.cvb-empty { color: #6b7280; font-style: italic; }
.cvb-help { margin: -6px 0 12px; color: var(--cvb-muted); font-size: 13px; }

.cvb-font-small .cvb-cv-paper { font-size: 13px; }
.cvb-font-small .cvb-cv-header h2 { font-size: 30px; }
.cvb-font-large .cvb-cv-paper { font-size: 16px; }
.cvb-font-large .cvb-cv-header h2 { font-size: 38px; }

.cvb-template-executive .cvb-cv-paper { padding: 0; border: 0; overflow: hidden; }
.cvb-template-executive .cvb-cv-header {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #fff;
    border: 0;
    padding: 34px 38px 28px;
    margin: 0 0 18px;
}
.cvb-template-executive .cvb-cv-header h2,
.cvb-template-executive .cvb-cv-header p { color: #fff; }
.cvb-template-executive .cvb-contact { color: rgba(255,255,255,.86); }
.cvb-template-executive .cvb-contact span:not(:last-child)::after { background: rgba(255,255,255,.5); }
.cvb-template-executive .cvb-photo-wrap { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.35); }
.cvb-template-executive .cvb-cv-section {
    margin: 0 36px 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e9eef5;
}
.cvb-template-executive .cvb-cv-section:last-child { border-bottom: 0; padding-bottom: 28px; }
.cvb-template-executive .cvb-cv-section h3 { color: #111827; font-size: 14px; text-transform: uppercase; letter-spacing: 1.5px; }

.cvb-template-tech .cvb-cv-paper {
    background: linear-gradient(135deg, #0b1120 0, #0b1120 170px, #ffffff 170px);
    border: 0;
    overflow: hidden;
}
.cvb-template-tech .cvb-cv-header { border: 0; color: white; margin-bottom: 26px; }
.cvb-template-tech .cvb-cv-header h2,
.cvb-template-tech .cvb-cv-header p,
.cvb-template-tech .cvb-contact { color: white; }
.cvb-template-tech .cvb-photo-wrap { background: rgba(255,255,255,.12); color: white; border-color: var(--cvb-primary); }
.cvb-template-tech .cvb-cv-section h3 {
    color: #0f172a;
    border-inline-start: 5px solid var(--cvb-primary);
    padding-inline-start: 10px;
}
.cvb-template-tech [data-out-tags="skills"] li {
    display: inline-block;
    background: #eef2ff;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    padding: 3px 9px;
    margin: 3px;
}

.cvb-template-medical .cvb-cv-paper { border-top: 8px solid #0f766e; }
.cvb-template-medical .cvb-cv-header { border-bottom: 1px solid #ccfbf1; }
.cvb-template-medical .cvb-cv-header h2,
.cvb-template-medical .cvb-cv-section h3 { color: #0f766e; }
.cvb-template-medical .cvb-cv-section {
    border-bottom: 1px solid #ecfeff;
    padding-bottom: 12px;
}

.cvb-template-academic .cvb-cv-paper {
    box-shadow: none;
    border: 1px solid #111827;
    font-family: Georgia, "Times New Roman", serif;
}
.cvb-template-academic .cvb-cv-header {
    text-align: center;
    justify-content: center;
    border-bottom: 2px solid #111827;
}
.cvb-template-academic .cvb-photo-wrap { display: none; }
.cvb-template-academic .cvb-cv-header h2,
.cvb-template-academic .cvb-cv-section h3 { color: #111827; }
.cvb-template-academic .cvb-contact { justify-content: center; }
.cvb-template-academic .cvb-cv-section h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.cvb-template-creative .cvb-cv-paper {
    padding: 0;
    border: 0;
    overflow: hidden;
    border-radius: 28px;
}
.cvb-template-creative .cvb-cv-header {
    background: radial-gradient(circle at 10% 10%, rgba(255,255,255,.24), transparent 30%), linear-gradient(135deg, var(--cvb-primary), #111827);
    color: white;
    border: 0;
    padding: 36px 40px;
    margin: 0;
}
.cvb-template-creative .cvb-cv-header h2,
.cvb-template-creative .cvb-cv-header p,
.cvb-template-creative .cvb-contact { color: white; }
.cvb-template-creative .cvb-photo-wrap { border-radius: 50%; background: rgba(255,255,255,.15); color: white; border-color: rgba(255,255,255,.45); }
.cvb-template-creative .cvb-cv-section { margin: 0; padding: 22px 40px 0; }
.cvb-template-creative .cvb-cv-section:last-child { padding-bottom: 36px; }
.cvb-template-creative .cvb-cv-section h3 { display: inline-block; border-bottom: 3px solid var(--cvb-primary); padding-bottom: 3px; }

.cvb-template-corporate .cvb-cv-paper {
    background: linear-gradient(180deg, #fff 0, #fff 140px, #f8fbff 140px, #f8fbff 100%);
    border-top: 8px solid #0f172a;
}
.cvb-template-corporate .cvb-cv-header { border-bottom: 0; background: #fff; margin-bottom: 10px; }
.cvb-template-corporate .cvb-cv-section {
    background: #fff;
    border: 1px solid #e7edf5;
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .04);
}
.cvb-template-corporate .cvb-cv-section h3 { color: #0f172a; display: inline-block; border-bottom: 2px solid var(--cvb-primary); padding-bottom: 3px; }

.cvb-template-premium .cvb-cv-paper {
    border: 1px solid #e9e2d7;
    box-shadow: 0 14px 34px rgba(73, 52, 22, .08);
    background: linear-gradient(180deg, #fffdfa, #fff);
}
.cvb-template-premium .cvb-cv-header {
    border-bottom: 2px solid #d6c6af;
}
.cvb-template-premium .cvb-photo-wrap { border-radius: 50%; border-color: #d6c6af; background: #f8f1e7; color: #7b5e3b; }
.cvb-template-premium .cvb-cv-header h2 { color: #7b5e3b; }
.cvb-template-premium .cvb-cv-section h3 {
    color: #7b5e3b;
    border-bottom: 1px solid #eadfcf;
    padding-bottom: 6px;
    text-transform: uppercase;
    font-size: 15px;
    letter-spacing: 1.1px;
}

.cvb-template-ats .cvb-cv-paper {
    box-shadow: none;
    border: 1px solid #111;
    padding: 34px;
}
.cvb-template-ats .cvb-photo-wrap { display: none; }
.cvb-template-ats .cvb-cv-header { border-bottom: 1px solid #111; display: block; }
.cvb-template-ats .cvb-cv-header h2,
.cvb-template-ats .cvb-cv-section h3 { color: #111; }
.cvb-template-ats .cvb-cv-section h3 {
    font-size: 14px;
    letter-spacing: .8px;
    text-transform: uppercase;
}

.cvb-template-sidebar .cvb-cv-paper {
    display: grid;
    grid-template-columns: 32% 68%;
    gap: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
}
.cvb-template-sidebar .cvb-cv-header {
    background: linear-gradient(180deg, #0f172a, var(--cvb-primary));
    color: white;
    border: 0;
    padding: 34px 24px;
    margin: 0;
    grid-column: 1;
    grid-row: 1 / span 10;
    display: block;
}
.cvb-template-sidebar .cvb-photo-wrap { margin-bottom: 18px; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.4); }
.cvb-template-sidebar .cvb-cv-header h2,
.cvb-template-sidebar .cvb-cv-header p { color: white; }
.cvb-template-sidebar .cvb-contact { color: rgba(255,255,255,.9); display:block; }
.cvb-template-sidebar .cvb-contact span { display:block; margin-bottom: 8px; }
.cvb-template-sidebar .cvb-contact span::after { display: none !important; }
.cvb-template-sidebar [data-section="summary"],
.cvb-template-sidebar [data-section="skills-languages"],
.cvb-template-sidebar [data-section="projects"],
.cvb-template-sidebar [data-section="certificates"] {
    grid-column: 1;
    padding: 0 24px 18px;
    background: linear-gradient(180deg, rgba(15,23,42,.96), rgba(15,23,42,.9));
    color: #e5edf8;
    margin: 0;
}
.cvb-template-sidebar [data-section="summary"] { padding-top: 8px; }
.cvb-template-sidebar [data-section="summary"] h3,
.cvb-template-sidebar [data-section="skills-languages"] h3,
.cvb-template-sidebar [data-section="projects"] h3,
.cvb-template-sidebar [data-section="certificates"] h3 { color: #fff; }
.cvb-template-sidebar [data-section="experience"],
.cvb-template-sidebar [data-section="education"] {
    grid-column: 2;
    margin: 0;
    padding: 28px 30px 0;
}
.cvb-template-sidebar [data-section="education"] { padding-bottom: 30px; }
.cvb-template-sidebar .cvb-two-cols { grid-template-columns: 1fr; gap: 16px; }
.cvb-template-sidebar .cvb-entry p,
.cvb-template-sidebar .cvb-cv-section p,
.cvb-template-sidebar .cvb-cv-section li { color: inherit; }

.cvb-template-minimal .cvb-cv-paper {
    box-shadow: none;
    border: 1px solid #d1d5db;
    padding: 34px 36px;
}
.cvb-template-minimal .cvb-photo-wrap { border-radius: 12px; }
.cvb-template-minimal .cvb-cv-header { border-bottom: 1px solid #d1d5db; }
.cvb-template-minimal .cvb-cv-header h2 { color: #111827; }
.cvb-template-minimal .cvb-cv-section { margin: 18px 0; }
.cvb-template-minimal .cvb-cv-section h3 {
    color: #111827;
    font-size: 13px;
    letter-spacing: 1.6px;
    text-transform: uppercase;
}

@media (max-width: 1100px) {
    .cvb-layout, .cvb-grid-2, .cvb-two-cols, .cvb-template-grid-4, .cvb-account-login { grid-template-columns: 1fr; }
    .cvb-header { flex-direction: column; align-items: flex-start; }
    .cvb-preview-wrap { position: static; }
}

@media (max-width: 760px) {
    .cvb-app { padding: 16px; border-radius: 18px; }
    .cvb-header { padding: 22px; }
    .cvb-header h1 { font-size: 26px; }
    .cvb-cv-paper { padding: 22px; min-height: auto; }
    .cvb-cv-header { flex-direction: column; align-items: flex-start; }
    .cvb-template-sidebar .cvb-cv-paper { grid-template-columns: 1fr; }
    .cvb-template-sidebar .cvb-cv-header,
    .cvb-template-sidebar [data-section="summary"],
    .cvb-template-sidebar [data-section="skills-languages"],
    .cvb-template-sidebar [data-section="projects"],
    .cvb-template-sidebar [data-section="certificates"],
    .cvb-template-sidebar [data-section="experience"],
    .cvb-template-sidebar [data-section="education"] {
        grid-column: auto;
        padding: 22px;
    }
}

@media print {
    body * { visibility: hidden !important; }
    #cvbPreview, #cvbPreview * { visibility: visible !important; }
    #cvbPreview {
        position: absolute;
        inset: 0;
        padding: 0 !important;
        background: #fff !important;
        overflow: visible;
    }
    .cvb-cv-paper {
        box-shadow: none !important;
        max-width: none;
        width: 100%;
        min-height: auto;
    }
    @page { size: A4; margin: 10mm; }
}
