body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f3f4f6;
    color: #222;
}

.cv-app {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 24px;
    padding: 24px;
}

.cv-form-panel,
.cv-preview-panel {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .08);
    box-sizing: border-box;
}

.cv-form-panel h1 {
    margin-top: 0;
}

.cv-form-panel h2 {
    margin-top: 28px;
    font-size: 18px;
}

.hint,
.preview-note {
    color: #666;
    font-size: 14px;
}

label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    margin-top: 12px;
}

input,
textarea,
select {
    width: 100%;
    box-sizing: border-box;
    padding: 9px;
    margin-top: 4px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
}

textarea {
    min-height: 70px;
}

button {
    margin-top: 14px;
    padding: 10px 14px;
    border: 0;
    border-radius: 6px;
    background: #1f2937;
    color: white;
    cursor: pointer;
}

button.primary {
    width: 100%;
    background: #0f766e;
    font-weight: bold;
}

.station {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
    background: #fafafa;
}

.actions {
    margin-top: 24px;
}

.cv-preview-page {
    width: 794px;
    min-height: 1123px;
    background: white;
    padding: 56px;
    box-sizing: border-box;
    margin: 20px auto 0;
    border: 1px solid #ddd;
    font-family: Georgia, serif;
}

.cv-header.classic {
    border-bottom: 2px solid #222;
    padding-bottom: 14px;
    margin-bottom: 28px;
}

.cv-header.split {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 2px solid #222;
    padding-bottom: 14px;
    margin-bottom: 28px;
}

.cv-header.compact {
    text-align: center;
    border-bottom: 1px solid #999;
    padding-bottom: 10px;
    margin-bottom: 24px;
}

.cv-name {
    font-size: 30px;
    font-weight: bold;
    margin-bottom: 8px;
}

.cv-contact {
    font-size: 13px;
    line-height: 1.5;
}

.cv-section {
    margin-top: 24px;
}

.cv-section h2 {
    font-size: 17px;
    border-bottom: 1px solid #aaa;
    padding-bottom: 4px;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.cv-entry {
    margin-bottom: 16px;
}

.cv-entry-date {
    font-weight: bold;
    font-size: 14px;
}

.cv-entry-title {
    font-weight: bold;
    font-size: 15px;
}

.cv-entry-company {
    font-size: 14px;
    color: #444;
}

.cv-entry-tasks {
    margin-top: 4px;
    font-size: 14px;
    line-height: 1.45;
}

.cv-entry.side {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 16px;
}

@media (max-width: 1100px) {
    .cv-app {
        padding: 12px;
        gap: 12px;
    }

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

    .preview-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 10px 12px;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        cursor: pointer;
        font-size: 14px;
        font-weight: 600;
        color: #1e293b;
        margin-bottom: 12px;
    }

    .preview-toggle:hover {
        background: #f1f5f9;
    }

    .preview-toggle::after {
        content: "▼";
        font-size: 12px;
    }

    .preview-toggle[aria-expanded="true"]::after {
        content: "▲";
    }

    .cv-preview-page.collapsed {
        display: none;
    }

    .cv-app {
        grid-template-columns: 1fr;
    }

    .cv-preview-page {
        width: 100%;
        min-height: auto;
        padding: 28px 20px;
    }

    .cv-preview-panel {
        padding: 12px 16px;
    }

    #createCvButton {
        width: 100% !important;
        max-width: 400px;
        margin: 0;
    }
}

@media (min-width: 1101px) {
    .preview-toggle {
        display: none;
    }
}
.accordion {
    margin-top: 20px;
}

.accordion-item {
    border: 1px solid #ddd;
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
    background: #fff;
}

.accordion-toggle {
    width: 100%;
    margin: 0;
    padding: 14px 16px;
    background: #f9fafb;
    color: #111;
    text-align: left;
    font-weight: bold;
    border-radius: 0;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
    min-height: 44px;
}

.accordion-toggle::before {
    content: "▶ ";
}

.accordion-item.open .accordion-toggle::before {
    content: "▼ ";
}

.accordion-content {
    display: none;
    padding: 16px;
}

.accordion-item.open .accordion-content {
    display: block;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.modal.open {
    display: block;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    position: relative;
    width: 700px;
    max-width: 95%;
    max-height: 90vh;
    margin: 5vh auto;
    background: white;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #ddd;
}

.modal-header #modalClose {
    min-width: 44px;
    min-height: 44px;
    display: grid;
    place-items: center;
    margin: 0;
    font-size: 1.4rem;
}

.modal-body {
    padding: 16px;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px;
    border-top: 1px solid #ddd;
    text-align: right;
}

.modal-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-count {
    font-size: 12px;
    font-weight: normal;
    color: #666;
}

.accordion-modal {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-station {
    margin-bottom: 14px;
}

.station-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

button.small {
    margin-top: 0;
    padding: 6px 10px;
    font-size: 12px;
}

@media (max-width: 1100px) {
    button.small {
        min-width: 44px;
        min-height: 44px;
        padding: 10px 14px;
        font-size: 13px;
    }
}

button.danger {
    background: #991b1b;
}

@media (max-width: 600px) {
    .field-row {
        grid-template-columns: 1fr;
    }
}

.section-edit-button {
    width: 100%;
    margin-top: 0;
    background: #f9fafb;
    color: #111;
    border: 1px solid #ddd;
    text-align: left;
    font-weight: bold;
}

.section-edit-button:hover {
    background: #eef2f7;
}

.cv-download-box {
    margin-top: 1rem;
}

.download-card {
    padding: 1rem;
    border-radius: 12px;
    background: #f4f7f5;
    border: 1px solid #d8e2dc;
}

.download-card.error {
    background: #fff1f1;
    border-color: #e0b4b4;
}

.download-card.loading {
    background: #f6f6f6;
}

.download-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.download-btn {
    display: inline-block;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    background: #e9ecef;
    color: #222;
    font-weight: 600;
}

.download-btn.primary {
    background: #1f7a4d;
    color: #fff;
}

.download-btn.secondary {
    background: #ffffff;
    border: 1px solid #ccc;
}

.preview-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    position: static;
}

@media (max-width: 1100px) {
    .preview-toolbar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 999;
        margin: 0;
        padding: 10px 16px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        background: rgba(255,255,255,0.96);
        backdrop-filter: blur(10px);
        border-top: 1px solid #e5e7eb;
        justify-content: center;
        box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
        box-sizing: border-box;
    }

    .preview-toolbar .preview-note {
        display: none;
    }

    #createCvButton {
        width: 100% !important;
        max-width: 400px;
        margin: 0;
        box-sizing: border-box;
    }

    .cv-preview-panel {
        padding-bottom: 70px;
    }
}

.preview-toolbar span {
    display: block;
    margin-top: 0.25rem;
    color: #6b7280;
    font-size: 0.95rem;
}

.download-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.download-modal.open {
    display: block;
}

.download-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.download-modal-card {
    position: relative;
    max-width: 520px;
    margin: 8vh auto;
    background: #fff;
    border-radius: 18px;
    padding: 2rem;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.25);
}

.download-modal-close {
    position: absolute;
    top: 0.8rem;
    right: 1rem;
    border: 0;
    background: transparent;
    font-size: 2rem;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    display: grid;
    place-items: center;
}

.download-result {
    text-align: center;
}

.download-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: grid;
    place-items: center;
    background: #e6f6ef;
    color: #13795b;
    font-size: 1.8rem;
    font-weight: 800;
}

.download-result.error .download-icon {
    background: #fff1f1;
    color: #b42318;
}

.download-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.download-btn {
    display: block;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    text-decoration: none;
    background: #e9ecef;
    color: #111827;
    font-weight: 700;
}

.download-btn.primary {
    background: #13795b;
    color: #fff;
}

.download-btn.secondary {
    background: #fff;
    border: 1px solid #d1d5db;
}

.secondary-link {
    color: #2563eb;
    font-weight: 700;
    text-decoration: none;
}

.download-spinner {
    width: 46px;
    height: 46px;
    border: 4px solid #e5e7eb;
    border-top-color: #13795b;
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: cvSpin 0.8s linear infinite;
}

@keyframes cvSpin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 800px) {
    .preview-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .download-modal-card {
        margin: 5vh 1rem;
    }
}

.download-modal-close {
    position: absolute;
    top: 0.6rem;
    right: 0.8rem;
    border: none;
    background: transparent;
    font-size: 1.8rem;
    cursor: pointer;
    color: #6b7280;
    line-height: 1;
}

.download-modal-close:hover {
    color: #111827;
}

.download-modal-close {
    position: absolute;
    top: 0.6rem;
    right: 0.8rem;
    border: none;
    background: transparent;
    font-size: 1.8rem;
    cursor: pointer;
    color: #6b7280;
    line-height: 1;
}

.download-modal-close:hover {
    color: #111827;
}

.tool-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1.2rem;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid #e5e7eb;
    backdrop-filter: blur(10px);
}

.tool-logo {
    font-weight: 800;
    color: #111827;
    text-decoration: none;
}

.tool-page-title {
    text-align: center;
    font-weight: 700;
    color: #374151;
}

.tool-menu-toggle {
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 10px;
    padding: 0.45rem 0.7rem;
    font-size: 1.3rem;
    cursor: pointer;
}

.tool-menu {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 1rem;
    display: none;
    min-width: 230px;
    padding: 0.6rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
}

.tool-menu.open {
    display: grid;
}

.tool-menu a {
    padding: 0.75rem 0.85rem;
    border-radius: 10px;
    color: #111827;
    text-decoration: none;
    font-weight: 600;
}

.tool-menu a:hover {
    background: #f3f4f6;
}

@media (max-width: 700px) {
    .tool-page-title {
        text-align: left;
        font-size: 0.95rem;
    }

    .tool-logo {
        font-size: 0.95rem;
    }
}

/* Modal entries: collapsible station cards */

.modal-station {
    margin-bottom: 0.85rem;
}

.station-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    cursor: pointer;
    padding: 0.8rem 0.9rem;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
}

.station-summary strong {
    font-size: 0.95rem;
    line-height: 1.35;
}

.station-summary::marker {
    color: #6b7280;
}

.station-summary .danger.small {
    flex-shrink: 0;
}

.station-body {
    margin-top: 0.9rem;
    padding: 0.9rem;
    border-left: 3px solid #dbeafe;
}

details.modal-station[open] .station-summary {
    background: #eef6ff;
    border-color: #bfdbfe;
}

details.modal-station:not([open]) .station-body {
    display: none;
}

/* Optional: nicer spacing inside open modal cards */

.station-body label {
    display: block;
    margin-top: 0.75rem;
}

.station-body .field-row label {
    margin-top: 0;
}

/* Small mobile polish */

@media (max-width: 700px) {
    .station-summary {
        align-items: flex-start;
    }

    .station-summary strong {
        font-size: 0.9rem;
    }

    .station-summary .danger.small {
        font-size: 0.8rem;
        padding: 0.35rem 0.55rem;
    }
}