:root {
    --ink: #17202a;
    --muted: #5f6b76;
    --line: #d9e1e7;
    --accent: #0a7b6c;
    --accent-soft: #eaf6f3;
    --paper: #ffffff;
    --bg: #eef2f4;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-width: 0;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    line-height: 1.45;
}
a { color: inherit; }
.cv-toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(20, 28, 34, .96);
    color: white;
    padding: 10px 18px 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,.16);
}
.cv-toolbar-inner {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    gap: 12px;
    align-items: center;
}
.cv-home { text-decoration: none; font-weight: 700; white-space: nowrap; }
.cv-toolbar-controls {
    display: flex;
    flex-direction: column;
    gap: 7px;
    flex: 1;
    min-width: 0;
}
.cv-toggle-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}
.cv-toggle-label {
    font-size: 12px;
    font-weight: 800;
    color: rgba(255,255,255,.78);
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
}
.cv-toggle-options {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}
.cv-toggle-option {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}
.cv-toggle-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.cv-toggle-option span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 27px;
    padding: 4px 9px 4px 7px;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 999px;
    background: rgba(255,255,255,.055);
    color: rgba(255,255,255,.88);
    font-size: 11.5px;
    font-weight: 650;
    line-height: 1;
    transition: background .14s ease, border-color .14s ease, color .14s ease, transform .14s ease;
}
.cv-toggle-option span::before {
    content: "";
    display: inline-grid;
    place-items: center;
    width: 13px;
    height: 13px;
    border: 1px solid rgba(255,255,255,.42);
    border-radius: 4px;
    background: rgba(0,0,0,.08);
    color: white;
    font-size: 9px;
    font-weight: 900;
    line-height: 1;
}
.cv-toggle-option:hover span {
    border-color: rgba(255,255,255,.42);
    background: rgba(255,255,255,.10);
}
.cv-toggle-option input:focus-visible + span {
    outline: 2px solid rgba(255,255,255,.72);
    outline-offset: 2px;
}
.cv-toggle-option input:checked + span {
    border-color: #35b6a3;
    background: var(--accent);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.cv-toggle-option input:checked + span::before {
    content: "✓";
    border-color: rgba(255,255,255,.82);
    background: rgba(255,255,255,.14);
}
.cv-toggle-clear {
    border: 1px solid rgba(255,255,255,.22) !important;
    border-radius: 999px !important;
    padding: 5px 10px !important;
    font-size: 11.5px;
    line-height: 1.2;
    color: rgba(255,255,255,.9);
    background: transparent !important;
}
.cv-toggle-clear:not(:disabled):hover {
    background: rgba(255,255,255,.09) !important;
    border-color: rgba(255,255,255,.38) !important;
}
.cv-toggle-clear:disabled {
    opacity: .34;
    cursor: default;
}

.cv-content-group {
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,.12);
}
.cv-content-option input:checked + span {
    background: rgba(10,123,108,.52);
    border-color: #52c6b5;
}
.cv-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.cv-languages {
    display: flex;
    gap: 4px;
    padding-left: 5px;
    border-left: 1px solid rgba(255,255,255,.2);
}
.cv-languages a { padding: 5px 8px; font-weight: 700; }
.cv-languages a.active { background: white; color: #17202a; border-color: white; }
.cv-toolbar button {
    border: 0;
    border-radius: 7px;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 700;
}
.cv-page {
    width: 210mm;
    min-height: 297mm;
    margin: 22px auto;
    background: var(--paper);
    padding: 14mm 15mm;
    box-shadow: 0 10px 35px rgba(0,0,0,.12);
}
.cv-header {
    display: grid;
    grid-template-columns: 94px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--accent);
}
.cv-header-no-photo {
    grid-template-columns: minmax(0, 1fr);
}
.cv-photo-wrap {
    width: 94px;
    height: 94px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--accent-soft);
    box-shadow: 0 0 0 1px #a9d2ca;
    background: #f6f8f9;
}
.cv-photo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 24%;
    transform: scale(1.18);
    transform-origin: center 28%;
}

.cv-intro { min-width: 0; padding-top: 1px; }
h1 { font-size: 29px; line-height: 1.05; margin: 0 0 5px; }
h2 { font-size: 15.5px; margin: 0 0 7px; color: var(--accent); font-weight: 700; }
.cv-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 3px 0;
    align-items: center;
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 10.5px;
    overflow-wrap: anywhere;
}
.cv-contact > * { display: inline-flex; align-items: center; }
.cv-contact > * + *::before {
    content: "•";
    color: #a6b0b8;
    margin: 0 7px;
}
.cv-contact a { text-decoration: none; color: #34424e; }
.cv-summary { margin: 0; max-width: 670px; font-size: 12.4px; color: #35414c; }
section { margin-top: 17px; }
section > h3 {
    margin: 0 0 9px;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: 12px;
    color: var(--accent);
    border-bottom: 1px solid var(--line);
    padding-bottom: 5px;
}
.technical-profile {
    display: grid;
    gap: 5px;
}
.tech-row {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 10px;
    align-items: baseline;
    padding: 3px 0;
    border-bottom: 1px solid #edf1f3;
}
.tech-row:last-child { border-bottom: 0; }
.tech-label {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .045em;
    color: #4a5863;
}
.tech-items {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 0;
    font-size: 10.5px;
    color: #34424e;
}
.tech-items span { display: inline-flex; align-items: center; }
.tech-items span + span::before {
    content: "·";
    color: #a4adb4;
    margin: 0 7px;
}
.tech-items .tech-priority {
    color: var(--accent);
    font-weight: 700;
}
.cv-entry { margin-bottom: 12px; break-inside: avoid; }
.entry-top { display: flex; justify-content: space-between; gap: 15px; }
.cv-entry h4, .project-card h4 { margin: 0; font-size: 13px; }
.company { color: #42505c; font-size: 11.5px; font-weight: 600; }
.period { color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.cv-entry ul { margin: 6px 0 0 17px; padding: 0; font-size: 10.6px; }
.cv-entry li { margin-bottom: 2px; }
.cv-compact-list {
    display: grid;
    gap: 5px;
}
.cv-compact-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 2px 0 5px;
    border-bottom: 1px solid #edf1f3;
    font-size: 10.8px;
}
.cv-compact-item:last-child { border-bottom: 0; }
.cv-compact-item strong { display: block; font-size: 11.4px; }
.cv-compact-item span { color: #4f5d68; }
.cv-certifications {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 14px;
}
.cv-certification {
    padding: 4px 0 5px 8px;
    border-left: 2px solid #dbe3e7;
    break-inside: avoid;
}
.cv-certification-priority { border-left-color: var(--accent); }
.cv-certification strong { display: block; font-size: 10.5px; line-height: 1.25; }
.cv-certification span { display: block; margin-top: 2px; color: var(--muted); font-size: 9.6px; }
.cv-recommendation {
    margin: 0;
    padding: 10px 12px;
    border-left: 3px solid var(--accent);
    background: #f7faf9;
    break-inside: avoid;
}
.cv-recommendation p { margin: 0; font-size: 10.4px; font-style: italic; color: #35414c; }
.cv-recommendation footer { margin-top: 7px; display: flex; flex-direction: column; font-size: 9.8px; }
.cv-recommendation footer span { color: var(--muted); }
.project-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.project-card { border: 1px solid var(--line); border-radius: 6px; padding: 9px; break-inside: avoid; }
.project-priority { border-left: 3px solid var(--accent); }
.project-subtitle { font-size: 9.8px; color: var(--muted); margin-top: 1px; }
.project-stack { font-size: 9.5px; font-weight: 700; margin: 5px 0 4px; color: #34424e; }
.project-card p, .cv-footer-section p { margin: 0; font-size: 10.2px; }

@media (max-width: 900px) {
    .cv-toolbar {
        padding: 9px 12px 10px;
    }
    .cv-toolbar-inner {
        max-width: none;
        width: 100%;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 9px 10px;
        align-items: center;
    }
    .cv-home {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .cv-toolbar-controls {
        grid-column: 1 / -1;
        width: 100%;
        min-width: 0;
        gap: 8px;
    }
    .cv-toggle-group {
        width: 100%;
        min-width: 0;
        align-items: flex-start;
        gap: 6px;
    }
    .cv-toggle-label {
        flex: 0 0 100%;
        width: 100%;
    }
    .cv-toggle-options {
        width: 100%;
        min-width: 0;
        gap: 6px;
    }
    .cv-toggle-option {
        max-width: 100%;
    }
    .cv-toggle-option span {
        max-width: 100%;
    }
    .cv-content-group {
        padding-top: 8px;
    }
    .cv-toolbar-actions {
        min-width: 0;
        justify-self: end;
        margin: 0;
        gap: 7px;
    }
    .cv-languages {
        border-left: 0;
        padding-left: 0;
    }
    .cv-languages a {
        padding: 5px 7px;
    }
    .cv-toolbar button {
        padding: 7px 10px;
    }
    .cv-page {
        width: 100%;
        max-width: 100%;
        min-height: 0;
        margin: 0;
        padding: 24px 18px;
        box-shadow: none;
        overflow: hidden;
    }
    .cv-header {
        grid-template-columns: 78px minmax(0, 1fr);
        gap: 14px;
    }
    .cv-photo-wrap { width: 78px; height: 78px; }
    .cv-intro { min-width: 0; }
    .cv-contact { font-size: 10px; margin-bottom: 7px; }
    .entry-top { flex-wrap: wrap; gap: 3px 12px; }
    .entry-top .period { margin-left: auto; }
    .cv-compact-item { flex-wrap: wrap; gap: 3px 12px; }
    .cv-compact-item .period { margin-left: auto; }
    .project-grid { grid-template-columns: 1fr; }
    .cv-certifications { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .cv-toolbar {
        position: relative;
        top: auto;
        padding: 8px 10px 10px;
    }
    .cv-toolbar-inner {
        gap: 8px;
    }
    .cv-home {
        font-size: 12px;
    }
    .cv-toolbar-actions {
        gap: 5px;
    }
    .cv-languages a {
        font-size: 12px;
        padding: 4px 6px;
    }
    .cv-toolbar button {
        font-size: 11px;
        padding: 6px 8px;
        white-space: nowrap;
    }
    .cv-toggle-label {
        font-size: 10.5px;
    }
    .cv-toggle-options {
        gap: 5px;
    }
    .cv-toggle-option span {
        min-height: 25px;
        padding: 4px 8px 4px 6px;
        font-size: 10.5px;
    }
    .cv-toggle-clear {
        padding: 4px 9px !important;
        font-size: 10.5px;
    }
    .cv-page {
        padding: 20px 14px 24px;
    }
    .cv-header {
        grid-template-columns: 68px minmax(0, 1fr);
        gap: 12px;
        padding-bottom: 12px;
    }
    .cv-photo-wrap {
        width: 68px;
        height: 68px;
    }
    h1 {
        font-size: 23px;
        line-height: 1.08;
        overflow-wrap: anywhere;
    }
    h2 {
        font-size: 13px;
        line-height: 1.22;
    }
    .cv-summary {
        max-width: none;
        font-size: 11.4px;
    }
    .cv-contact {
        font-size: 9.5px;
    }
    section {
        margin-top: 14px;
    }
    .tech-row {
        grid-template-columns: 72px minmax(0, 1fr);
        gap: 8px;
    }
    .project-card {
        padding: 8px;
    }
}

@media (max-width: 380px) {
    .cv-toolbar-inner {
        grid-template-columns: 1fr;
    }
    .cv-toolbar-actions {
        justify-self: start;
    }
    .cv-toolbar-controls {
        grid-column: 1;
    }
    .cv-header {
        grid-template-columns: 58px minmax(0, 1fr);
        gap: 10px;
    }
    .cv-photo-wrap {
        width: 58px;
        height: 58px;
    }
    h1 { font-size: 21px; }
    h2 { font-size: 12.5px; }
    .tech-row {
        grid-template-columns: 1fr;
        gap: 2px;
    }
}

@page { size: A4; margin: 9mm; }
@media print {
    body { background: white; }
    .no-print { display: none !important; }
    .cv-page {
        width: auto;
        min-height: auto;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }
    .cv-header { padding-bottom: 9px; grid-template-columns: 82px minmax(0, 1fr); gap: 14px; }
    .cv-photo-wrap { width: 82px; height: 82px; }
    h1 { font-size: 27px; }
    h2 { font-size: 14.5px; }
    .cv-summary { font-size: 11.6px; }
    section { margin-top: 11px; }
    .skill-grid { gap: 4px; }
    .skill-item { min-height: 37px; padding: 4px 6px; }
    .cv-entry { margin-bottom: 8px; }
    .cv-entry ul { font-size: 10px; }
    a { text-decoration: none; }
}
