:root {
    color-scheme: light;
    --ink: #092d55;
    --muted: #657184;
    --line: #cbd7df;
    --paper: #ffffff;
    --soft: #eef5f7;
    --accent: #078b92;
    --accent-dark: #07586b;
    --danger: #b3261e;
    --ok: #087f5b;
    font-family: Arial, Helvetica, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f3f4f1;
    color: var(--ink);
}

.print-body {
    background: #6b7075;
}

.print-stage {
    display: grid;
    justify-items: center;
    padding: 24px;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #8ba2b6;
    border-radius: 0;
    padding: 12px 14px;
    color: var(--ink);
    background: #fff;
}

textarea {
    resize: vertical;
}

label {
    position: relative;
    display: grid;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

label input,
label select,
label textarea {
    text-transform: none;
    font-weight: 400;
}

.app-shell {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 28px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
}

.topbar h1,
.setup-card h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 32px;
    letter-spacing: 0;
}

.eyebrow {
    display: block;
    color: var(--accent-dark);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.topbar-actions,
.section-title,
.choice-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.builder-grid {
    display: grid;
    grid-template-columns: minmax(560px, 1fr) minmax(410px, 48vw);
    min-height: calc(100vh - 82px);
}

.home-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 42px 28px;
}

.home-header {
    display: grid;
    grid-template-columns: 1fr minmax(280px, 360px);
    gap: 28px;
    align-items: end;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--line);
}

.home-header h1 {
    max-width: 680px;
    margin: 0 0 12px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 46px;
    letter-spacing: 0;
}

.home-header p {
    max-width: 690px;
    margin: 0;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.5;
}

.new-cv-panel {
    display: grid;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.template-strip,
.cv-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.template-strip {
    margin: 28px 0;
}

.template-card,
.saved-cv-card {
    display: grid;
    gap: 12px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.template-card h2,
.saved-cv-card h3,
.cv-list-section h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: 0;
}

.template-card p,
.saved-cv-card p,
.empty-state {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.saved-cv-card span {
    color: var(--accent-dark);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.mini-page {
    position: relative;
    width: 150px;
    height: 195px;
    border: 1px solid #d6e0e8;
    background: #fff;
    box-shadow: 0 10px 25px rgba(15, 36, 49, 0.12);
}

.europass-mini::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 18px;
    width: 36px;
    height: 9px;
    background: #1f5e9c;
}

.europass-mini span,
.europass-mini strong,
.europass-mini em,
.europass-mini b,
.modern-mini span,
.modern-mini strong,
.modern-mini em,
.modern-mini b {
    position: absolute;
    display: block;
    background: #d7e4ed;
}

.europass-mini span {
    left: 16px;
    top: 44px;
    width: 112px;
    height: 12px;
}

.europass-mini strong {
    left: 16px;
    top: 78px;
    width: 40px;
    height: 78px;
    background: #e8f0f6;
}

.europass-mini em {
    left: 66px;
    top: 78px;
    width: 62px;
    height: 10px;
}

.europass-mini b {
    left: 66px;
    top: 102px;
    width: 52px;
    height: 10px;
}

.european-classic-mini::before {
    content: "";
    position: absolute;
    left: 14px;
    top: 16px;
    width: 122px;
    height: 18px;
    border-bottom: 2px solid #1f5e9c;
}

.european-classic-mini span {
    left: 14px;
    top: 52px;
    width: 40px;
    height: 110px;
    background: #f0f5f8;
}

.european-classic-mini strong {
    left: 62px;
    top: 54px;
    width: 64px;
    height: 8px;
}

.european-classic-mini em {
    left: 62px;
    top: 82px;
    width: 58px;
    height: 8px;
}

.european-classic-mini b {
    left: 62px;
    top: 110px;
    width: 54px;
    height: 8px;
}

.modern-mini::before {
    content: "";
    position: absolute;
    inset: 0 96px 0 0;
    background: #e0edf1;
}

.modern-mini span {
    left: 16px;
    top: 18px;
    width: 34px;
    height: 34px;
    background: #0b6f7f;
}

.modern-mini strong {
    left: 66px;
    top: 24px;
    width: 62px;
    height: 12px;
}

.modern-mini em {
    left: 66px;
    top: 62px;
    width: 58px;
    height: 8px;
}

.modern-mini b {
    left: 66px;
    top: 84px;
    width: 48px;
    height: 8px;
}

.template-choice-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.template-choice {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    text-transform: none;
}

.template-choice input {
    width: auto;
}

.editor-panel {
    padding: 26px;
    background: var(--paper);
    border-right: 1px solid var(--line);
}

.preview-panel {
    position: sticky;
    top: 82px;
    height: calc(100vh - 82px);
    overflow: auto;
    padding: 28px;
    background: #dbe8ec;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab {
    min-height: 42px;
    border: 1px solid #aac0cf;
    background: #fff;
    color: var(--ink);
    padding: 0 16px;
    cursor: pointer;
}

.tab.active {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: grid;
    gap: 18px;
}

.tab-panel h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 34px;
    letter-spacing: 0;
}

.tab-panel h3 {
    margin: 16px 0 10px;
    font-size: 14px;
    text-transform: uppercase;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 20px;
}

.button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--accent);
    border-radius: 28px;
    padding: 0 24px;
    font-weight: 800;
    color: var(--ink);
    text-decoration: none;
    cursor: pointer;
    background: #fff;
}

.button.primary {
    color: #fff;
    background: var(--accent);
}

.button.ghost {
    color: var(--ink);
    background: #fff;
    border-color: var(--ink);
}

.button.small {
    min-height: 36px;
    padding: 0 14px;
    border-radius: 18px;
}

.notice {
    margin: 0;
    padding: 12px 14px;
    border-radius: 6px;
    border: 1px solid transparent;
}

.notice.compact {
    padding: 8px 11px;
    font-size: 13px;
    font-weight: 700;
}

.notice.success {
    color: var(--ok);
    background: #e8f7f1;
    border-color: #a8dec9;
}

.notice.error {
    color: var(--danger);
    background: #fff0ee;
    border-color: #efb7b2;
}

.repeat-card {
    position: relative;
    display: grid;
    gap: 16px;
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfe;
}

.icon-button {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: 1px solid #c4ced7;
    border-radius: 50%;
    background: #fff;
    color: var(--danger);
    cursor: pointer;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 9px;
    text-transform: none;
}

.checkbox input,
.choice input {
    width: auto;
}

.photo-tools {
    display: grid;
    grid-template-columns: minmax(220px, 320px) 1fr;
    gap: 28px;
}

.upload-box {
    min-height: 210px;
    align-content: center;
    justify-items: center;
    border: 2px dashed #89a7b7;
    background: #f9fcfd;
    cursor: pointer;
}

.upload-box input {
    display: none;
}

.choice {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    text-transform: none;
    background: #fff;
}

.experience-grid {
    display: grid;
    grid-template-columns: 1fr minmax(260px, 42%);
    gap: 18px;
}

.education-search-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.inline-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 8;
    display: grid;
    gap: 6px;
    max-height: 230px;
    overflow: auto;
    padding: 0;
    background: #fff;
    box-shadow: 0 14px 32px rgba(15, 36, 49, 0.16);
}

.inline-results:empty {
    display: none;
}

.skill-search-panel {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfe;
}

.suggestion-box {
    display: grid;
    gap: 12px;
    align-content: start;
}

.suggestions {
    display: grid;
    gap: 10px;
    max-height: 260px;
    overflow: auto;
}

.esco-results,
.esco-skills,
.external-results {
    display: grid;
    gap: 8px;
}

.esco-results,
.external-results {
    max-height: 220px;
    overflow: auto;
}

.esco-result,
.esco-skill,
.external-result {
    display: grid;
    gap: 4px;
    width: 100%;
    border: 1px solid #9db7c8;
    border-radius: 8px;
    padding: 10px;
    background: #fff;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

.esco-result strong,
.external-result strong {
    font-size: 14px;
}

.esco-result span,
.external-result span,
.helper-text {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.esco-skill {
    border-color: #c7d7e4;
    background: #f7fbfd;
    font-size: 13px;
}

.esco-skill span {
    color: var(--accent-dark);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.esco-skill.optional span {
    color: #78603a;
}

.suggestion {
    display: grid;
    grid-template-columns: 36px 1fr;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 10px;
    border: 1px solid #8bb0c4;
    border-radius: 8px;
    background: #e5f2f5;
    color: #31536a;
    text-align: left;
    cursor: pointer;
}

.suggestion strong {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #cbdbea;
    color: var(--ink);
    font-size: 20px;
}

.cv-page {
    width: min(100%, 850px);
    min-height: 1120px;
    margin: 0 auto;
    background: #fff;
    color: #38434b;
    box-shadow: 0 24px 70px rgba(4, 31, 46, 0.18);
}

.cv-template-europass {
    width: min(100%, 794px);
    min-height: 1123px;
    padding: 46px 52px;
    color: #1f2933;
    font-family: Arial, Helvetica, sans-serif;
}

.cv-template-european_classic {
    width: min(100%, 794px);
    min-height: 1123px;
    padding: 44px 50px;
    font-family: Arial, Helvetica, sans-serif;
    color: #1f2933;
}

.classic-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 22px;
    align-items: end;
    padding-bottom: 18px;
    border-bottom: 4px solid var(--theme);
}

.classic-header p {
    margin: 0 0 7px;
    color: var(--theme);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.classic-header h2 {
    margin: 0;
    color: #111827;
    font-size: 38px;
    font-weight: 400;
    letter-spacing: 0;
}

.classic-header strong {
    color: #111827;
    font-size: 19px;
    text-align: right;
    text-transform: uppercase;
}

.classic-layout {
    display: grid;
}

.classic-row {
    display: grid;
    grid-template-columns: 190px 1fr;
    gap: 24px;
    padding: 18px 0;
    border-bottom: 1px solid #d6dce2;
}

.classic-row h3 {
    margin: 0;
    color: var(--theme);
    font-size: 13px;
    line-height: 1.35;
    text-transform: uppercase;
}

.classic-row p {
    margin: 0 0 8px;
    line-height: 1.45;
}

.classic-identity {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
}

.classic-identity .photo-frame {
    width: 88px;
    height: 108px;
    background: #edf4f8;
}

.classic-identity .photo-frame img,
.classic-identity .photo-placeholder {
    width: 74px;
    height: 94px;
}

.classic-identity h4 {
    margin: 0 0 6px;
    color: #111827;
    font-size: 24px;
    text-transform: uppercase;
}

.classic-data {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 7px 14px;
    margin: 0;
}

.classic-data dt {
    color: #56636f;
    font-weight: 700;
}

.classic-data dd {
    margin: 0;
}

.cv-template-european_classic .cv-item {
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 0;
}

.cv-template-european_classic .cv-item span {
    color: #56636f;
    font-size: 13px;
}

.cv-template-european_classic .cv-item strong {
    color: #111827;
    text-transform: none;
}

.europass-header {
    display: grid;
    grid-template-columns: 1fr 112px;
    gap: 24px;
    align-items: start;
    padding-bottom: 24px;
    border-bottom: 3px solid var(--theme);
}

.europass-label {
    margin: 0 0 12px;
    color: var(--theme);
    font-size: 16px;
    font-weight: 800;
    text-transform: uppercase;
}

.europass-header h2 {
    margin: 0 0 8px;
    color: #111827;
    font-size: 34px;
    line-height: 1.15;
    letter-spacing: 0;
    text-transform: uppercase;
}

.europass-header .photo-frame {
    width: 112px;
    height: 136px;
    background: #edf4f8;
}

.europass-header .photo-frame img,
.europass-header .photo-placeholder {
    width: 96px;
    height: 120px;
}

.europass-content {
    display: grid;
    gap: 0;
}

.europass-row {
    display: grid;
    grid-template-columns: 190px 1fr;
    gap: 26px;
    padding: 18px 0;
    border-bottom: 1px solid #d7e0e8;
}

.europass-row h3 {
    margin: 0;
    color: var(--theme);
    font-size: 13px;
    line-height: 1.35;
    text-transform: uppercase;
}

.europass-data p {
    margin: 0 0 8px;
    line-height: 1.45;
}

.cv-template-europass .cv-item {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 0;
}

.cv-template-europass .cv-item strong {
    color: #111827;
    text-transform: none;
}

.skill-columns {
    columns: 2;
}

.cv-hero {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 30px;
    align-items: center;
    min-height: 250px;
    padding: 44px 38px;
    background: #deecef;
}

.cv-hero h2 {
    margin: 0 0 10px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 46px;
    line-height: 1.08;
    letter-spacing: 0;
    color: #35414a;
}

.headline {
    font-weight: 800;
    color: var(--theme);
}

.photo-frame {
    display: grid;
    place-items: center;
    width: 170px;
    height: 170px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--theme) 0 50%, #116f80 50% 100%);
}

.photo-frame img {
    width: 120px;
    height: 120px;
    object-fit: cover;
}

.photo-frame.circle img,
.photo-frame.circle .photo-placeholder {
    border-radius: 50%;
}

.photo-frame.rounded img,
.photo-frame.rounded .photo-placeholder {
    border-radius: 12px;
}

.photo-frame.rectangle img,
.photo-frame.rectangle .photo-placeholder {
    width: 135px;
    height: 100px;
}

.photo-frame.bright img {
    filter: brightness(1.18);
}

.photo-frame.soft img {
    filter: contrast(0.92) saturate(0.9);
}

.photo-frame.bw img {
    filter: grayscale(1);
}

.photo-placeholder {
    display: grid;
    place-items: center;
    width: 120px;
    height: 120px;
    color: #fff;
    background: rgba(255, 255, 255, 0.18);
    font-weight: 800;
}

.cv-body {
    display: grid;
    grid-template-columns: 245px 1fr;
}

.cv-sidebar {
    padding: 28px 22px;
    background: #e0edf1;
}

.cv-main {
    padding: 28px 34px;
}

.cv-page h3 {
    margin: 0 0 12px;
    color: #4a565e;
    font-size: 16px;
    text-transform: uppercase;
}

.cv-sidebar h3 {
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid #2b3f48;
}

.cv-sidebar h3:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.cv-item {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--theme);
}

.cv-item strong,
.cv-item b,
.cv-item span {
    display: block;
}

.cv-item strong {
    color: #28343d;
    text-transform: uppercase;
}

.cv-item b {
    margin-top: 8px;
    font-style: italic;
}

.cv-item ul,
.cv-sidebar ul {
    padding-left: 18px;
}

.setup-page,
.setup-card {
    min-height: 100vh;
}

.setup-card {
    display: grid;
    align-content: center;
    gap: 18px;
    max-width: 720px;
    margin: 0 auto;
    padding: 30px;
}

pre {
    overflow: auto;
    padding: 16px;
    background: #0f172a;
    color: #dbeafe;
}

@media screen and (max-width: 1060px) {
    .builder-grid,
    .cv-body,
    .cv-hero,
    .photo-tools,
    .experience-grid,
    .education-search-grid {
        grid-template-columns: 1fr;
    }

    .preview-panel {
        position: static;
        height: auto;
    }
}

@media screen and (max-width: 720px) {
    .topbar,
    .field-grid,
    .home-header,
    .template-strip,
    .cv-list,
    .template-choice-row {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: stretch;
        padding: 16px;
    }

    .builder-grid {
        display: block;
    }

    .editor-panel,
    .preview-panel {
        padding: 16px;
    }

    .cv-hero h2 {
        font-size: 34px;
    }
}

@media print {
    @page {
        size: A4;
        margin: 0;
    }

    body {
        background: #fff;
    }

    .topbar,
    .editor-panel,
    .home-shell,
    .print-stage script {
        display: none;
    }

    .builder-grid {
        display: block;
    }

    .preview-panel {
        position: static;
        height: auto;
        overflow: visible;
        padding: 0;
        background: #fff;
    }

    .print-body,
    .print-stage {
        display: block;
        margin: 0;
        padding: 0;
        background: #fff;
    }

    .cv-page {
        width: 210mm;
        min-height: 297mm;
        margin: 0;
        box-shadow: none;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .cv-template-modern .cv-hero {
        display: grid;
        grid-template-columns: 62mm 1fr;
        gap: 10mm;
        min-height: 74mm;
        padding: 12mm 10mm;
    }

    .cv-template-modern .cv-body {
        display: grid;
        grid-template-columns: 64mm 1fr;
    }

    .cv-template-modern .cv-sidebar {
        padding: 9mm 7mm;
    }

    .cv-template-modern .cv-main {
        padding: 9mm 9mm;
    }

    .cv-template-modern .cv-hero h2 {
        font-size: 34pt;
        line-height: 1.05;
    }

    .cv-template-modern .photo-frame {
        width: 45mm;
        height: 45mm;
    }

    .cv-template-modern .photo-frame img,
    .cv-template-modern .photo-placeholder {
        width: 32mm;
        height: 32mm;
    }

    .cv-template-europass {
        padding: 14mm 15mm;
    }

    .cv-template-european_classic {
        padding: 14mm 15mm;
    }

    .cv-template-european_classic .classic-row {
        display: grid;
        grid-template-columns: 50mm 1fr;
        gap: 7mm;
    }
}
