:root {
    --accent: #6c5ce7;
    --accent-soft: rgba(108, 92, 231, 0.14);
    --accent-hover: #7d70ef;
    --bg: #0f1117;
    --bg-elevated: #10131b;
    --card: #171a23;
    --text: #f5f6fa;
    --muted: #a4a9b8;
    --border: #2a2f3d;
    --error: #ff6b6b;
    --success: #2ecc71;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --shadow-soft: 0 14px 40px rgba(0, 0, 0, 0.22);
    --line-height: 1.6;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: var(--line-height);
    -webkit-font-smoothing: antialiased;
}

body.auth-page .app-main {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 2.5rem;
}

a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
}

a:hover {
    color: var(--accent-hover);
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: rgba(15, 17, 23, 0.96);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    display: grid;
    gap: 0.1rem;
    text-decoration: none;
    color: var(--text);
    min-width: 0;
}

.brand-name {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}

.brand-tag {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 500;
}

.app-nav {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.app-nav .nav-link {
    color: var(--muted);
    text-decoration: none;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 500;
    transition: color 0.15s ease, background 0.15s ease;
}

.app-nav .nav-link:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
}

.app-nav .nav-link.is-active {
    color: #fff;
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px rgba(108, 92, 231, 0.35);
}

.app-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1rem 4rem;
}

.app-footer {
    text-align: center;
    padding: 2rem 1rem 2.5rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.15);
}

.footer-brand {
    margin: 0 0 0.35rem;
    color: var(--text);
    font-weight: 600;
}

.footer-note,
.footer-copy {
    margin: 0.25rem 0 0;
    font-size: 0.88rem;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-soft);
}

.card.narrow,
.auth-card {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-header h1 {
    margin: 0 0 0.45rem;
    font-size: clamp(1.45rem, 2.5vw, 1.85rem);
    letter-spacing: -0.02em;
}

.page-lead {
    margin: 0;
    color: var(--muted);
    max-width: 62ch;
    font-size: 0.98rem;
}

.field-hint {
    display: block;
    margin-top: 0.35rem;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.5;
    font-weight: 400;
}

.form-section {
    display: grid;
    gap: 1rem;
    padding: 1.1rem 1.15rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
}

.form-section-title {
    margin: 0;
    font-size: 1rem;
}

.form-section-desc {
    margin: -0.35rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.info-panel {
    padding: 1rem 1.1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
}

.info-panel strong {
    display: block;
    margin-bottom: 0.35rem;
}

.welcome-line {
    margin: 0 0 1.25rem;
    font-size: 1rem;
}

.welcome-line strong {
    color: var(--text);
}

h1, h2, h3 {
    margin-top: 0;
}

.muted {
    color: var(--muted);
}

.share-link {
    margin: 1.25rem 0 1.75rem;
    padding: 1rem 1.1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #10131b;
}

.share-link label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.share-link-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.share-link-row input {
    flex: 1 1 220px;
    min-width: 0;
    font-family: ui-monospace, monospace;
    font-size: 0.85rem;
}

.share-link-hint {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    color: var(--success);
}

.cta-links-block {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #10131b;
    display: grid;
    gap: 1rem;
}

.cta-links-header h2 {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
}

.cta-link-row {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    display: grid;
    gap: 0.75rem;
}

.cta-link-fields {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.cta-icon-picker {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.cta-icon-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #0f1117;
    color: var(--accent);
    font-size: 1.15rem;
    flex-shrink: 0;
}

.cta-icon-select {
    flex: 1;
    min-width: 0;
}

.cta-existing-file {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.is-hidden {
    display: none !important;
}

.form-grid {
    display: grid;
    gap: 1rem;
}

label {
    display: grid;
    gap: 0.4rem;
    font-size: 0.95rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="color"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    font: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.btn:focus-visible {
    outline: none;
    border-color: rgba(108, 92, 231, 0.65);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.18);
}

textarea {
    min-height: 160px;
    resize: vertical;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.2rem;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

.btn:hover {
    filter: brightness(1.08);
}

.btn-small {
    padding: 0.5rem 0.9rem;
    font-size: 0.9rem;
}

.btn-danger {
    background: var(--error);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.alert {
    padding: 0.85rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.alert.error {
    background: rgba(255, 107, 107, 0.12);
    color: #ffb3b3;
}

.alert.success {
    background: rgba(46, 204, 113, 0.12);
    color: #9cf0bd;
}

.steps {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

.step {
    display: flex;
    gap: 1rem;
    padding: 1.1rem 1.15rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    align-items: flex-start;
    background: var(--bg-elevated);
}

.step h3 {
    margin: 0 0 0.35rem;
    font-size: 1rem;
}

.step p {
    margin: 0 0 0.75rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.step p:last-child {
    margin-bottom: 0;
}

.step-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.step.done {
    border-color: rgba(46, 204, 113, 0.4);
}

.step-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--border);
    font-weight: 700;
    flex-shrink: 0;
}

.step.done .step-num {
    background: var(--success);
    color: #0f1117;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.table th,
.table td {
    padding: 0.85rem 0.9rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table code {
    font-size: 0.85rem;
    color: var(--accent-hover);
}

.table th {
    color: var(--muted);
    font-weight: 500;
}

.actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.profile-preview {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.profile-preview img,
.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

.profile-avatar.placeholder {
    display: grid;
    place-items: center;
    background: var(--border);
    font-weight: 700;
    font-size: 1.5rem;
}

.inline-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.inline-check input {
    width: auto;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.upload-block {
    display: grid;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px dashed var(--border);
    border-radius: 12px;
}

.media-preview img,
.table-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.media-preview {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.gallery-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    max-width: none;
}

.gallery-preview.is-single {
    grid-template-columns: minmax(0, 180px);
}

.gallery-preview.is-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.gallery-preview-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: auto;
    min-height: 0;
    max-height: none;
    padding: 0.65rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #10131b;
}

.gallery-preview-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
}

.gallery-preview-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card);
}

.gallery-preview-item img {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    object-fit: cover;
    object-position: center;
    border: 0;
    border-radius: 0;
}

.gallery-remove-check {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    margin: 0;
}

.item-images-block {
    display: grid;
    gap: 1rem;
}

.item-images-header h2 {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
}

.item-images-list {
    display: grid;
    gap: 0.85rem;
}

.item-image-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
    gap: 1rem;
    align-items: start;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #10131b;
}

.item-image-meta {
    display: grid;
    gap: 0.35rem;
    align-content: start;
}

.item-image-badge {
    display: inline-block;
    width: fit-content;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(108, 92, 231, 0.18);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
}

.item-image-title {
    font-size: 1rem;
}

.item-image-subtitle,
.item-image-empty-label {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.4;
}

.item-image-upload {
    display: grid;
    gap: 0.65rem;
}

.item-image-preview {
    display: grid;
    gap: 0.55rem;
}

.item-image-preview.is-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    border: 1px dashed var(--border);
    border-radius: 10px;
    background: var(--card);
}

.item-image-preview img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.item-remove-check,
.item-file-label {
    display: grid;
    gap: 0.35rem;
    font-size: 0.9rem;
    margin: 0;
}

.item-remove-check {
    grid-auto-flow: column;
    justify-content: start;
    align-items: center;
    width: fit-content;
}

@media (max-width: 720px) {
    .item-image-row {
        grid-template-columns: 1fr;
    }
}

.projects-builder-header h2 {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
}

.projects-builder-list {
    display: grid;
    gap: 1rem;
}

.project-row {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #10131b;
}

.project-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.project-row-fields {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.project-row-media {
    display: grid;
    gap: 0.65rem;
    grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
    align-items: start;
}

.project-row-media .item-image-preview {
    min-height: 140px;
}

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

.form-grid select {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
}

.color-field {
    gap: 0.65rem;
}

.color-picker-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.color-picker-row input[type="color"] {
    width: 56px;
    height: 44px;
    padding: 4px;
    cursor: pointer;
    flex-shrink: 0;
}

.color-picker-row input[type="text"] {
    flex: 1;
    font-family: ui-monospace, monospace;
    letter-spacing: 0.04em;
}

.color-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--swatch);
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.color-swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 0 0 2px var(--text);
}

.color-preview {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px dashed var(--border);
    background: #10131b;
}

.color-preview .preview-pill {
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    background: var(--preview-color, var(--accent));
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
}

.color-preview .preview-link {
    color: var(--preview-color, var(--accent));
    font-weight: 600;
    font-size: 0.9rem;
}

.cv-import-card h2 {
    margin: 0 0 0.75rem;
    font-size: 1.15rem;
}

.cv-upload-panel {
    text-align: center;
    padding: 1rem 0 0.5rem;
}

.cv-upload-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1rem;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: rgba(108, 92, 231, 0.12);
    color: var(--accent);
    font-size: 2rem;
}

.cv-upload-form {
    max-width: 420px;
    margin: 1.5rem auto;
}

.cv-file-label input[type="file"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: #10131b;
    color: var(--text);
}

.cv-help-list {
    text-align: left;
    max-width: 520px;
    margin: 1.5rem auto 0;
    padding-left: 1.2rem;
    line-height: 1.6;
}

.cv-preview-grid {
    display: grid;
    grid-template-columns: minmax(220px, 280px) 1fr;
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.cv-preview-summary,
.cv-preview-sections {
    background: #10131b;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
}

.cv-meta-list {
    margin: 0;
}

.cv-meta-list > div {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
}

.cv-meta-list > div:last-child {
    border-bottom: 0;
}

.cv-meta-list dt {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.cv-meta-list dd {
    margin: 0;
    font-weight: 500;
}

.cv-section-preview {
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.cv-section-preview summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    font-weight: 600;
}

.cv-section-preview summary::-webkit-details-marker {
    display: none;
}

.cv-section-key {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
}

.cv-section-content {
    margin: 0;
    padding: 1rem;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background: #0c0e14;
}

.cv-apply-form {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.cv-apply-options {
    border: 0;
    margin: 0 0 1.25rem;
    padding: 0;
}

.cv-apply-options legend {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.cv-radio-card {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    cursor: pointer;
    background: #10131b;
}

.cv-radio-card input {
    margin-top: 0.2rem;
}

.cv-radio-card strong {
    display: block;
    margin-bottom: 0.2rem;
}

.cv-radio-card small {
    color: var(--muted);
}

.cv-check-row {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    margin-top: 0.5rem;
}

.cv-apply-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

@media (max-width: 760px) {
    .cv-preview-grid {
        grid-template-columns: 1fr;
    }

    .app-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .app-nav {
        width: 100%;
    }

    .template-options {
        grid-template-columns: 1fr;
    }
}

.template-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
    margin-top: 0.75rem;
}

.template-option {
    display: block;
    cursor: pointer;
}

.template-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.template-option-card {
    display: grid;
    gap: 0.75rem;
    height: 100%;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.template-option input:checked + .template-option-card {
    border-color: rgba(108, 92, 231, 0.65);
    box-shadow: 0 0 0 1px rgba(108, 92, 231, 0.35);
}

.template-preview {
    display: block;
    height: 88px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.template-preview-classic {
    background: linear-gradient(135deg, #111 0%, #2d1f69 55%, #ff3366 100%);
}

.template-preview-minimal {
    background: linear-gradient(180deg, #ffffff 0%, #eef2ff 100%);
}

.template-preview-executive {
    background: linear-gradient(135deg, #0b1020 0%, #1e293b 50%, #6c5ce7 100%);
}

.template-option-body strong {
    display: block;
    margin-bottom: 0.25rem;
}

.template-option-body small {
    display: block;
    color: var(--muted);
    line-height: 1.45;
    font-size: 0.86rem;
}

.template-preview-link {
    display: inline-block;
    margin-top: 0.55rem;
    font-size: 0.86rem;
    font-weight: 600;
}
