/* ============================================================
   DESIGN SYSTEM
   ============================================================ */
:root {
    --ink:         #18181b;
    --ink-muted:   #71717a;
    --ink-light:   #a1a1aa;
    --bg:          #f4f4f5;
    --surface:     #ffffff;
    --border:      #e4e4e7;
    --border-mid:  #d1d1d6;
    --accent:      #2563eb;
    --accent-sub:  #eff6ff;
    --danger:      #dc2626;
    --radius:      6px;
    --hdr-h:       52px;
    --mob-tabs-h:  44px;
    --footer-h:    36px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--ink);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Skip link (a11y + SEO) ── */
.skip-link {
    position: absolute;
    top: -100px;
    left: 12px;
    background: var(--accent);
    color: #fff;
    padding: 8px 14px;
    border-radius: 0 0 var(--radius) var(--radius);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    z-index: 9999;
    transition: top .15s;
}
.skip-link:focus { top: 0; }

/* ============================================================
   HEADER
   ============================================================ */
.app-header {
    background: #18181b;
    color: #fafafa;
    height: var(--hdr-h);
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    z-index: 50;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-link {
    text-decoration: none;
    display: flex;
    align-items: center;
}

.brand-mark {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d4d4d8;
    flex-shrink: 0;
    transition: background .15s;
}
.brand-link:hover .brand-mark { background: rgba(255,255,255,.12); }

.brand-text { display: flex; flex-direction: column; gap: 1px; }

.brand-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: #fafafa;
    letter-spacing: -.3px;
    line-height: 1;
}

.brand-sub {
    font-size: 0.67rem;
    color: #52525b;
    line-height: 1;
}

.header-right { display: flex; align-items: center; gap: 12px; }

.lang-toggle { display: flex; align-items: center; gap: 2px; }
.lang-sep { color: #3f3f46; font-size: 0.78rem; margin: 0 2px; }

.lang-btn {
    padding: 4px 10px;
    border: 1px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    background: transparent;
    color: #52525b;
    font-family: inherit;
    letter-spacing: .8px;
    transition: all .15s;
}
.lang-btn:hover  { color: #fafafa; }
.lang-btn.active {
    background: rgba(255,255,255,.09);
    border-color: rgba(255,255,255,.12);
    color: #fafafa;
}

/* ============================================================
   MOBILE TAB BAR
   ============================================================ */
.mobile-tabs {
    display: none; /* hidden on desktop */
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    height: var(--mob-tabs-h);
    flex-shrink: 0;
}

.mob-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 100%;
    border: none;
    background: transparent;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--ink-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all .15s;
}
.mob-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.app-main {
    display: grid;
    grid-template-columns: 390px 1fr;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ============================================================
   FORM PANEL
   ============================================================ */
.form-panel {
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 0 0 40px;
    display: flex;
    flex-direction: column;
}

.form-section {
    padding: 18px 18px 18px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.form-section:last-child { border-bottom: none; }

.section-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--ink-muted);
    margin-bottom: 14px;
}

.stitle-icon {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    opacity: .65;
}

.badge-optional {
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--ink-light);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 99px;
    padding: 1px 7px;
    text-transform: none;
    letter-spacing: 0;
}

/* ── Photo ── */
.photo-upload-area {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    border: 1.5px dashed var(--border-mid);
    margin: 0 auto 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    background: var(--bg);
    transition: border-color .15s;
}
.photo-upload-area:hover,
.photo-upload-area:focus { border-color: var(--accent); outline: none; }
.photo-upload-area:focus-visible { box-shadow: 0 0 0 2px var(--accent); }

#photoPlaceholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: var(--ink-light);
    pointer-events: none;
}
#photoPlaceholder p { font-size: 0.6rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }

.photo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.42);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    opacity: 0;
    transition: opacity .15s;
}
.photo-upload-area:hover .photo-overlay,
.photo-upload-area:focus .photo-overlay { opacity: 1; }

/* ── Form groups ── */
.form-group { margin-bottom: 10px; }
.form-group:last-child { margin-bottom: 0; }

.form-group label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--ink-muted);
    margin-bottom: 4px;
    letter-spacing: .1px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.84rem;
    font-family: inherit;
    color: var(--ink);
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
    resize: vertical;
    line-height: 1.5;
    -webkit-appearance: none;
    appearance: none;
}

.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    padding-right: 28px;
    cursor: pointer;
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--ink-light); font-size: 0.82rem; }

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2.5px rgba(37,99,235,.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* ── Date pickers ── */
.datepicker-3 {
    display: grid;
    grid-template-columns: 60px 1fr 72px;
    gap: 5px;
}
.mypicker { display: flex; gap: 5px; }
.mypicker select { flex: 1; min-width: 0; }
.mypicker input[type="number"] { width: 72px; flex-shrink: 0; }

.datepicker-3 input[type="number"],
.mypicker input[type="number"] { -moz-appearance: textfield; }
.datepicker-3 input::-webkit-outer-spin-button,
.datepicker-3 input::-webkit-inner-spin-button,
.mypicker input::-webkit-outer-spin-button,
.mypicker input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ── List items ── */
.list-item {
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 11px 12px;
    margin-bottom: 8px;
}

.skill-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 6px 6px 12px;
    margin-bottom: 8px;
    transition: border-color .15s, box-shadow .15s;
}
.skill-item:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 2.5px rgba(37,99,235,.1);
}
.skill-item input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0;
    font-size: 0.84rem;
    color: var(--ink);
    outline: none;
    min-width: 0;
}

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

.item-label {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--ink-light);
    text-transform: uppercase;
    letter-spacing: .8px;
}

.remove-btn {
    width: 22px;
    height: 22px;
    border: none;
    background: #fef2f2;
    color: var(--danger);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    flex-shrink: 0;
}
.remove-btn:hover { background: #fee2e2; }

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 7px 0;
}
.checkbox-group input[type="checkbox"] {
    width: 13px;
    height: 13px;
    cursor: pointer;
    accent-color: var(--accent);
}
.checkbox-group label {
    font-size: 0.77rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--ink-muted);
}

.skill-row-simple {
    display: flex;
    gap: 6px;
    align-items: center;
}
.skill-row-simple input { flex: 1; }

/* Social media input with prefix */
.social-field {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color .15s, box-shadow .15s;
}
.social-field:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 2.5px rgba(37,99,235,.1);
}
.social-field .social-prefix {
    padding: 7px 8px 7px 10px;
    font-size: 0.8rem;
    color: var(--ink-light);
    background: var(--bg);
    border-right: 1px solid var(--border);
    white-space: nowrap;
    line-height: 1.5;
    user-select: none;
}
.social-field input {
    flex: 1;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0;
    padding: 7px 10px;
    min-width: 0;
}

.add-btn {
    width: 100%;
    padding: 8px;
    border: 1.5px dashed var(--border-mid);
    background: transparent;
    color: var(--ink-muted);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.77rem;
    font-weight: 600;
    font-family: inherit;
    transition: all .15s;
    margin-top: 4px;
    letter-spacing: .1px;
}
.add-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-sub);
}

/* ============================================================
   PREVIEW PANEL
   ============================================================ */
.preview-panel {
    display: flex;
    flex-direction: column;
    background: #e8e8eb;
    overflow: hidden;
    min-height: 0;
}

.preview-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 10px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.preview-header-left { display: flex; align-items: center; gap: 8px; }
.preview-header h2 { font-size: 0.8rem; font-weight: 700; color: var(--ink); }

.paper-size-hint {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--ink-light);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    letter-spacing: .5px;
}

.export-buttons { display: flex; gap: 6px; }

.export-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 13px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.77rem;
    font-weight: 600;
    font-family: inherit;
    transition: all .15s;
    letter-spacing: .1px;
    white-space: nowrap;
}

.pdf-btn { background: #18181b; color: #fafafa; }
.pdf-btn:hover { background: #27272a; }
.png-btn { background: var(--bg); color: var(--ink); border: 1px solid var(--border-mid); }
.png-btn:hover { background: #e8e8ea; }

/* ── Template Selector ── */
.template-selector {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 8px 16px 10px;
    flex-shrink: 0;
}

.tpl-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--ink-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 7px;
}

.template-options {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--border);
}
.template-options::-webkit-scrollbar { height: 6px; }
.template-options::-webkit-scrollbar-track { background: var(--border); border-radius: 4px; }
.template-options::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }

.template-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 5px 7px 6px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    cursor: pointer;
    font-size: 0.6rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--ink-muted);
    transition: all .15s;
    white-space: nowrap;
}
.template-btn:hover  { border-color: var(--accent); color: var(--accent); background: var(--accent-sub); }
.template-btn.active { border-color: var(--accent); background: var(--accent-sub); color: var(--accent); font-weight: 700; }

/* ── Template Thumbnails ── */
.template-thumb {
    width: 36px;
    height: 48px;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,.14);
    flex-shrink: 0;
}

/* 1 Modern */
.thumb-1 { background: #f8f8f8; }
.thumb-1::before { content:''; position:absolute; top:0; left:0; bottom:0; width:13px; background:#1f3040; }
.thumb-1::after  { content:''; position:absolute; top:7px; left:17px; right:4px; height:1.5px; background:#c8d0da; box-shadow:0 5px 0 #dde2e8,0 10px 0 #e8ebee,0 15px 0 #e8ebee,0 20px 0 #dde2e8; }
/* 2 Classic */
.thumb-2 { background:#fff; }
.thumb-2::before { content:''; position:absolute; top:0; left:0; right:0; height:16px; background:#f0ede8; border-bottom:2px solid #1a1a1a; }
.thumb-2::after  { content:''; position:absolute; top:24px; left:4px; right:4px; height:1.5px; background:#d8d0c4; box-shadow:0 6px 0 #e8e4df,0 12px 0 #e8e4df,0 18px 0 #d8d0c4; }
/* 3 Minimal */
.thumb-3 { background:#fff; border:1px solid #e8e8e8; }
.thumb-3::before { content:''; position:absolute; top:8px; left:4px; right:4px; height:2.5px; background:#111; }
.thumb-3::after  { content:''; position:absolute; top:16px; left:4px; right:4px; height:1px; background:#e0e0e0; box-shadow:0 7px 0 #e8e8e8,0 13px 0 #e8e8e8,0 20px 0 #e0e0e0,0 27px 0 #e8e8e8; }
/* 4 Ocean */
.thumb-4 { background:#edf5f8; }
.thumb-4::before { content:''; position:absolute; top:0; left:0; right:0; height:18px; background:#0b3954; }
.thumb-4::after  { content:''; position:absolute; top:24px; left:4px; right:4px; height:1.5px; background:#a8d0dc; box-shadow:0 6px 0 #c0dce6,0 12px 0 #c0dce6; }
/* 5 Executive */
.thumb-5 { background:#f8f8f7; }
.thumb-5::before { content:''; position:absolute; top:0; left:0; right:0; height:20px; background:#1a1f2e; }
.thumb-5::after  { content:''; position:absolute; top:26px; left:4px; right:4px; height:1.5px; background:#b89940; box-shadow:0 6px 0 #e4e0d8,0 12px 0 #e4e0d8,0 18px 0 #b89940; }
/* 6 Sharp */
.thumb-6 { background:#f8f8f8; }
.thumb-6::before { content:''; position:absolute; top:0; right:0; bottom:0; width:12px; background:#1c2d3e; }
.thumb-6::after  { content:''; position:absolute; top:7px; left:4px; right:16px; height:2.5px; background:#1a1a1a; box-shadow:0 5px 0 #e0e0e0,0 10px 0 #e0e0e0; }
/* 7 Elegant */
.thumb-7 { background:#faf8f4; }
.thumb-7::before { content:''; position:absolute; top:0; left:0; right:0; height:20px; background:#3b2d4a; }
.thumb-7::after  { content:''; position:absolute; top:26px; left:4px; right:4px; height:1px; background:#d8cebc; box-shadow:0 6px 0 #e8e2d8,0 12px 0 #e8e2d8,0 18px 0 #d8cebc; }
/* 8 Dark */
.thumb-8 { background:#0d1117; }
.thumb-8::before { content:''; position:absolute; top:8px; left:4px; right:4px; height:1.5px; background:#58a6ff; }
.thumb-8::after  { content:''; position:absolute; top:15px; left:4px; right:4px; height:1px; background:#21262d; box-shadow:0 5px 0 #21262d,0 10px 0 #21262d,0 15px 0 #3fb950,0 20px 0 #21262d; }
/* 9 Timeline */
.thumb-9 { background:#fff; }
.thumb-9::before { content:''; position:absolute; top:0; left:0; right:0; height:16px; background:#1e2952; }
.thumb-9::after  { content:''; position:absolute; top:22px; left:10px; width:1.5px; height:28px; background:#dde3ee; }
/* 10 Compact */
.thumb-10 { background:#fff; }
.thumb-10::before { content:''; position:absolute; top:0; left:0; right:0; height:14px; background:#27374d; }
.thumb-10::after  { content:''; position:absolute; top:20px; left:4px; right:4px; height:1.5px; background:#ddd; box-shadow:0 5px 0 #ddd,0 10px 0 #c05a1f,0 15px 0 #ddd; }
/* 11 Sage */
.thumb-11 { background:#faf8f2; }
.thumb-11::before { content:''; position:absolute; top:0; left:0; bottom:0; width:13px; background:#3d5c38; }
.thumb-11::after  { content:''; position:absolute; top:7px; left:17px; right:4px; height:1.5px; background:#c8d8c4; box-shadow:0 5px 0 #dce8d8,0 10px 0 #e4ece0; }
/* 12 Bold */
.thumb-12 { background:#fff; border:1px solid #e0e0e0; }
.thumb-12::before { content:''; position:absolute; top:0; left:0; right:0; height:24px; background:#111; }
.thumb-12::after  { content:''; position:absolute; top:30px; left:4px; right:4px; height:2px; background:#333; box-shadow:0 6px 0 #e0e0e0,0 11px 0 #e0e0e0; }
/* 13 Nordic */
.thumb-13 { background:#eeebe4; border:1px solid #ddd8d0; }
.thumb-13::before { content:''; position:absolute; top:8px; left:4px; right:4px; height:2px; background:#2c2417; }
.thumb-13::after  { content:''; position:absolute; top:16px; left:4px; right:4px; height:1px; background:#c8c4bc; box-shadow:0 6px 0 #d4d0c8,0 12px 0 #d4d0c8,0 18px 0 #c8c4bc; }
/* 14 Coral */
.thumb-14 { background:#fff; }
.thumb-14::before { content:''; position:absolute; top:0; left:0; right:0; height:18px; background:#b5483a; }
.thumb-14::after  { content:''; position:absolute; top:24px; left:4px; right:4px; height:1.5px; background:#e8cdc8; box-shadow:0 6px 0 #f0e0dc,0 12px 0 #f0e0dc; }
/* 15 Royal */
.thumb-15 { background:#f4f6fa; }
.thumb-15::before { content:''; position:absolute; top:0; left:0; bottom:0; width:13px; background:#1c2744; }
.thumb-15::after  { content:''; position:absolute; top:7px; left:17px; right:4px; height:1.5px; background:#a8b4c8; box-shadow:0 5px 0 #c0ccd8,0 10px 0 #d0d8e4; }
/* 16 Forest */
.thumb-16 { background:#f4f8f4; }
.thumb-16::before { content:''; position:absolute; top:0; right:0; bottom:0; width:13px; background:#1e3428; }
.thumb-16::after  { content:''; position:absolute; top:7px; left:4px; right:17px; height:2px; background:#1a1a1a; box-shadow:0 6px 0 #c8d8c8,0 11px 0 #c8d8c8; }
/* 17 Warm */
.thumb-17 { background:#fdf8f0; }
.thumb-17::before { content:''; position:absolute; top:0; left:0; right:0; height:18px; background:#4a2c1a; }
.thumb-17::after  { content:''; position:absolute; top:24px; left:4px; right:4px; height:1.5px; background:#e0c8a8; box-shadow:0 6px 0 #ecdcc0,0 12px 0 #ecdcc0; }
/* 18 Studio */
.thumb-18 { background:#fff; }
.thumb-18::before { content:''; position:absolute; top:0; left:0; bottom:0; width:14px; background:#e05a7a; }
.thumb-18::after  { content:''; position:absolute; top:6px; left:18px; right:4px; height:3px; background:#111; box-shadow:0 6px 0 #e0e0e0,0 11px 0 #e0e0e0; }
/* 19 Slate */
.thumb-19 { background:#f8f9fa; }
.thumb-19::before { content:''; position:absolute; top:0; left:0; right:0; height:20px; background:#334155; }
.thumb-19::after  { content:''; position:absolute; top:26px; left:4px; right:4px; height:1.5px; background:#c8d0d8; box-shadow:0 6px 0 #dde2e8,0 12px 0 #dde2e8,0 18px 0 #c8d0d8; }
/* 20 Copper */
.thumb-20 { background:#1a1510; }
.thumb-20::before { content:''; position:absolute; top:8px; left:4px; right:4px; height:2px; background:#b8733a; }
.thumb-20::after  { content:''; position:absolute; top:16px; left:4px; right:4px; height:1px; background:#2a2420; box-shadow:0 5px 0 #2a2420,0 10px 0 #b8733a,0 15px 0 #2a2420,0 20px 0 #2a2420; }

/* ── CV Preview wrapper ── */
.cv-preview-wrapper {
    flex: 1;
    overflow: auto;
    padding: 16px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 0;
}

.cv-scaler {
    display: inline-block;
    transform-origin: top center;
}

.cv-preview {
    width: 794px;
    min-height: 1123px;
    background: #fff;
    box-shadow: 0 4px 24px rgba(0,0,0,.18), 0 1px 4px rgba(0,0,0,.08);
    flex-shrink: 0;
}

/* ============================================================
   FOOTER
   ============================================================ */
.app-footer {
    background: #18181b;
    border-top: 1px solid #27272a;
    height: var(--footer-h);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 10;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 16px;
}

.footer-copy {
    font-size: 0.7rem;
    color: #a1a1aa;
    white-space: nowrap;
}

.footer-brand-link {
    color: #c4c4c8;
    text-decoration: none;
    font-weight: 600;
    transition: color .15s;
}
.footer-brand-link:hover { color: #e4e4e7; }

.footer-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-dot { color: #71717a; font-size: 0.65rem; }

.footer-link {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.7rem;
    color: #a1a1aa;
    cursor: pointer;
    font-family: inherit;
    transition: color .15s;
    text-decoration: none;
}
.footer-link:hover { color: #e4e4e7; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }

.modal {
    background: var(--surface);
    border-radius: 12px;
    width: 100%;
    max-width: 640px;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0,0,0,.3);
    animation: modalIn .2s ease;
}

@keyframes modalIn {
    from { opacity:0; transform:scale(.96) translateY(8px); }
    to   { opacity:1; transform:scale(1) translateY(0); }
}

.modal-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ink);
}

.modal-close {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-muted);
    transition: all .15s;
    flex-shrink: 0;
}
.modal-close:hover { background: var(--bg); color: var(--ink); }

.modal-body {
    padding: 18px 20px;
    overflow-y: auto;
    flex: 1;
    font-size: 0.84rem;
    line-height: 1.75;
    color: #3f3f46;
}

.modal-body h3 {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--ink);
    margin: 18px 0 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}
.modal-body h3:first-child { margin-top: 0; }
.modal-body p  { margin-bottom: 8px; }
.modal-body ul { margin: 6px 0 10px 18px; }
.modal-body ul li { margin-bottom: 4px; }
.modal-body strong { color: var(--ink); }
.modal-body a { color: var(--accent); }
.modal-body .modal-note {
    background: var(--accent-sub);
    border-left: 3px solid var(--accent);
    padding: 10px 13px;
    border-radius: 0 4px 4px 0;
    margin: 10px 0;
    font-size: 0.82rem;
}

/* ============================================================
   EXPORT OVERLAY
   ============================================================ */
#exportOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    backdrop-filter: blur(4px);
}

.export-spinner-box {
    background: var(--surface);
    border-radius: 12px;
    padding: 30px 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.export-spinner-box p { font-size: 0.85rem; font-weight: 600; color: var(--ink-muted); }

.spinner {
    width: 34px;
    height: 34px;
    border: 3px solid var(--border);
    border-top-color: var(--ink);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform:rotate(360deg); } }

/* ============================================================
   SCROLLBARS
   ============================================================ */
.form-panel::-webkit-scrollbar,
.cv-preview-wrapper::-webkit-scrollbar,
.modal-body::-webkit-scrollbar { width: 5px; }
.form-panel::-webkit-scrollbar-track,
.cv-preview-wrapper::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track { background: transparent; }
.form-panel::-webkit-scrollbar-thumb,
.cv-preview-wrapper::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 3px; }

/* ============================================================
   RESPONSIVE — TABLET (768–1023px)
   ============================================================ */
@media (max-width: 1023px) and (min-width: 768px) {
    .app-main { grid-template-columns: 320px 1fr; }

    .export-btn span { display: none; }
    .export-btn { padding: 7px 10px; }

    .brand-sub { display: none; }
}

/* ============================================================
   RESPONSIVE — MOBILE (< 768px)
   ============================================================ */
@media (max-width: 767px) {
    body {
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }

    .brand-sub { display: none; }

    .mobile-tabs { display: flex; }

    .app-main {
        display: block;
        position: relative;
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    .form-panel {
        position: absolute;
        top: 0; left: 0; right: 0; bottom: 0;
        width: 100%; height: 100%;
        display: none;
        overflow-y: auto;
        border-right: none;
    }
    .form-panel.mob-active { display: flex; }

    .preview-panel {
        position: absolute;
        top: 0; left: 0; right: 0; bottom: 0;
        width: 100%; height: 100%;
        display: none;
        flex-direction: column;
    }
    .preview-panel.mob-active { display: flex; }

    /* Hide export text on mobile */
    .export-btn span { display: none; }
    .export-btn { padding: 7px 10px; }

    /* Preview wrapper fills remaining space */
    .cv-preview-wrapper {
        padding: 12px 8px;
    }

    /* Template selector scrolls horizontally on mobile */
    .template-options {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: thin;
        scrollbar-color: var(--border) transparent;
        padding-bottom: 3px;
    }
    .template-options::-webkit-scrollbar { height: 3px; }
    .template-options::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

    /* Footer compact on mobile */
    .footer-copy { font-size: 0.65rem; }
    .footer-link { font-size: 0.65rem; }

    /* Modal full width on mobile */
    .modal { max-height: 90vh; }
    .modal-overlay { padding: 12px; }

    /* Form compact on mobile */
    .form-section { padding: 14px 14px 14px; }
}

/* Extra small (<400px) */
@media (max-width: 399px) {
    .footer-copy { display: none; }
    .footer-links { margin: 0 auto; }
}

.thumb-21 { background:#f8fafc; }
.thumb-21::before { content:''; position:absolute; top:0; left:0; right:0; height:18px; background:linear-gradient(135deg, #4f46e5, #ec4899); }
.thumb-21::after { content:''; position:absolute; top:24px; left:4px; right:4px; height:2px; background:#e2e8f0; box-shadow:0 6px 0 #f1f5f9,0 12px 0 #f1f5f9; }

.thumb-22 { background:#fff; border:2px solid #000; }
.thumb-22::before { content:''; position:absolute; top:0; left:0; right:0; height:12px; background:#000; }
.thumb-22::after { content:''; position:absolute; top:20px; left:4px; right:4px; height:2px; background:#000; box-shadow:0 6px 0 #000,0 12px 0 #000; }

.thumb-23 { background:#fdfbf7; }
.thumb-23::before { content:''; position:absolute; top:0; left:0; right:0; height:18px; background:#e2b4bd; border-radius:4px 4px 0 0; }
.thumb-23::after { content:''; position:absolute; top:24px; left:4px; right:4px; height:2px; background:#9baba4; box-shadow:0 6px 0 #eadddd,0 12px 0 #eadddd; }

.thumb-24 { background:#0f172a; border:1px solid #334155; }
.thumb-24::before { content:''; position:absolute; top:4px; left:4px; width:12px; height:12px; background:#10b981; }
.thumb-24::after { content:''; position:absolute; top:20px; left:4px; right:4px; height:1.5px; background:#38bdf8; box-shadow:0 6px 0 #334155,0 12px 0 #334155; }

.thumb-25 { background:#fff; }
.thumb-25::before { content:''; position:absolute; top:0; left:0; right:0; height:16px; background:#fff; border-bottom:1px solid #8c1515; }
.thumb-25::after { content:''; position:absolute; top:22px; left:4px; right:4px; height:1px; background:#ddd; box-shadow:0 6px 0 #eee,0 12px 0 #eee; }

/* Custom Select for Fonts */
.custom-select-wrapper { position: relative; user-select: none; width: 100%; }
.custom-select-trigger { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; font-size: 14px; font-weight: 500; color: #374151; background: #fff; border: 1px solid #d1d5db; border-radius: 8px; cursor: pointer; transition: all 0.2s; }
.custom-select-trigger:hover { border-color: #9ca3af; }
.custom-select-options { position: absolute; display: none; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; margin-top: 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); max-height: 250px; overflow-y: auto; z-index: 100; }
.custom-select-options.open { display: block; }
.custom-option { padding: 10px 14px; font-size: 15px; cursor: pointer; color: #374151; border-bottom: 1px solid #f3f4f6; }
.custom-option:last-child { border-bottom: none; }
.custom-option:hover { background: #f9fafb; color: #111; }

/* Templates 26-35 */
.thumb-26 { background:#e0e5ec; }
.thumb-26::before { content:''; position:absolute; top:4px; left:4px; right:4px; height:10px; background:#e0e5ec; box-shadow: 2px 2px 5px rgba(163,177,198,0.6), -2px -2px 5px rgba(255,255,255, 0.5); border-radius:4px; }
.thumb-26::after { content:''; position:absolute; top:18px; left:4px; right:4px; height:2px; background:#e0e5ec; box-shadow: 1px 1px 3px rgba(163,177,198,0.6), -1px -1px 3px rgba(255,255,255, 0.5); }

.thumb-27 { background:#fff; border-left: 6px solid #1e3a8a; }
.thumb-27::before { content:''; position:absolute; top:4px; left:4px; right:4px; height:8px; background:#1e3a8a; }
.thumb-27::after { content:''; position:absolute; top:16px; left:4px; right:4px; height:1.5px; background:#93c5fd; box-shadow:0 6px 0 #bfdbfe,0 12px 0 #bfdbfe; }

.thumb-28 { background: linear-gradient(to right, #111827 30%, #f3f4f6 30%); }
.thumb-28::before { content:''; position:absolute; top:6px; left:4px; width:8px; height:8px; background:#f59e0b; border-radius:50%; }
.thumb-28::after { content:''; position:absolute; top:8px; left:16px; right:4px; height:2px; background:#d1d5db; box-shadow:0 6px 0 #d1d5db; }

.thumb-29 { background:#fff; }
.thumb-29::before { content:''; position:absolute; top:8px; left:4px; right:4px; height:4px; background:#111; }
.thumb-29::after { content:''; position:absolute; top:16px; left:4px; right:4px; height:1px; background:#ccc; box-shadow:0 8px 0 #eee,0 16px 0 #eee; }

.thumb-30 { background:#000; border: 1px solid #f0f; }
.thumb-30::before { content:''; position:absolute; top:4px; left:4px; right:4px; height:8px; background:#0ff; }
.thumb-30::after { content:''; position:absolute; top:16px; left:4px; width:20px; height:1.5px; background:#f0f; box-shadow:0 6px 0 #ff0,0 12px 0 #f0f; }

.thumb-31 { background:#fefce8; }
.thumb-31::before { content:''; position:absolute; top:0; left:0; right:0; height:14px; background:#14532d; }
.thumb-31::after { content:''; position:absolute; top:20px; left:8px; width:4px; height:16px; background:#b45309; }

.thumb-32 { background:#fff; }
.thumb-32::before { content:''; position:absolute; top:4px; right:4px; width:0; height:0; border-left: 10px solid transparent; border-bottom: 10px solid #ef4444; }
.thumb-32::after { content:''; position:absolute; top:18px; left:4px; right:4px; height:2px; background:#3b82f6; box-shadow:0 6px 0 #fcd34d; }

.thumb-33 { background:#fef3c7; border: 1px solid #d97706; }
.thumb-33::before { content:''; position:absolute; top:6px; left:4px; right:4px; height:1px; background:#d97706; box-shadow:0 6px 0 #d97706; }
.thumb-33::after { content:''; position:absolute; top:18px; left:4px; right:4px; height:1px; background:#d97706; box-shadow:0 6px 0 #d97706; }

.thumb-34 { background:#c0c0c0; border-top: 2px solid #fff; border-left: 2px solid #fff; border-right: 2px solid #000; border-bottom: 2px solid #000; }
.thumb-34::before { content:''; position:absolute; top:2px; left:2px; right:2px; height:8px; background:#000080; }
.thumb-34::after { content:''; position:absolute; top:14px; left:4px; right:4px; height:1px; background:#000; box-shadow:0 6px 0 #000; }

.thumb-35 { background:#0f0f0f; }
.thumb-35::before { content:''; position:absolute; top:6px; left:4px; right:4px; height:1.5px; background:#d4af37; }
.thumb-35::after { content:''; position:absolute; top:12px; left:4px; right:4px; height:1px; background:#d4af37; box-shadow:0 8px 0 #333,0 16px 0 #333; }

/* Thumbnails 36-55 */
.thumb-36 { background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%); border: 1px solid rgba(255,255,255,0.8); }
.thumb-36::after { content:''; position:absolute; top:20%; left:20%; width:60%; height:60%; background:rgba(255,255,255,0.4); border-radius:4px; border:1px solid rgba(255,255,255,0.6); }

.thumb-37 { background: #f3f4f6; }
.thumb-37::before { content:''; position:absolute; top:4px; left:4px; right:4px; height:8px; background:#fff; border-radius:2px; box-shadow:0 1px 2px rgba(0,0,0,0.1); }
.thumb-37::after { content:''; position:absolute; top:16px; left:4px; right:4px; height:8px; background:#fff; border-radius:2px; box-shadow:0 1px 2px rgba(0,0,0,0.1); }

.thumb-38 { background: linear-gradient(90deg, #f59e0b 0%, #ec4899 100%); }
.thumb-38::after { content:''; position:absolute; bottom:0; left:0; right:0; height:60%; background:#fff; }

.thumb-39 { background: #f0fdf4; border-top: 6px solid #ccfbf1; border-bottom: 6px solid #ccfbf1; }
.thumb-39::after { content:''; position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); width:10px; height:10px; background:#0f766e; border-radius:50%; }

.thumb-40 { background: #fdfbf7; transform: rotate(-2deg); box-shadow: 1px 1px 3px rgba(0,0,0,0.1); }
.thumb-40::after { content:''; position:absolute; top:-2px; left:30%; width:40%; height:4px; background:rgba(255,255,255,0.8); transform:rotate(-5deg); box-shadow:0 1px 2px rgba(0,0,0,0.1); }

.thumb-41 { background: #fff; border-left: 8px solid #f4f4f4; border-bottom: 4px solid #000; }
.thumb-41::after { content:''; position:absolute; top:2px; left:2px; width:40%; height:8px; background:#e60000; }

.thumb-42 { background: #fff; }
.thumb-42::after { content:''; position:absolute; top:30%; left:30%; width:60%; height:40%; background:rgba(167,192,253,0.4); border-radius:50%; filter:blur(2px); }

.thumb-43 { background: #f7fee7; border-bottom: 4px solid #d9f99d; }
.thumb-43::after { content:''; position:absolute; top:4px; left:4px; width:8px; height:8px; border:2px solid #bef264; border-radius:2px; }

.thumb-44 { background: #fff; border-bottom: 2px dashed #000; }
.thumb-44::after { content:'>'; position:absolute; top:4px; left:2px; font-size:8px; font-weight:bold; color:#000; font-family:monospace; }

.thumb-45 { background-image: linear-gradient(#e5e7eb 1px, transparent 1px), linear-gradient(90deg, #e5e7eb 1px, transparent 1px); background-size: 5px 5px; }
.thumb-45::after { content:''; position:absolute; top:2px; left:2px; right:2px; bottom:2px; border:2px solid #000; background:#fff; box-shadow: 2px 2px 0 #000; }

.thumb-46 { background: #fffaf0; border: 2px solid #d4c4b7; }
.thumb-46::after { content:''; position:absolute; top:12px; left:20%; right:20%; height:1px; background:#8a5a44; }

.thumb-47 { background: #e5e5e5; }
.thumb-47::after { content:''; position:absolute; top:2px; left:2px; width:12px; height:8px; border:2px solid #000; background:#ccff00; box-shadow:2px 2px 0 #000; }

.thumb-48 { background: #1f2937; }
.thumb-48::after { content:''; position:absolute; top:0; left:0; right:0; height:4px; background: repeating-linear-gradient(45deg, #fbbf24, #fbbf24 3px, #000 3px, #000 6px); }

.thumb-49 { background: #fef0d9; }
.thumb-49::after { content:''; position:absolute; top:-2px; right:-2px; width:14px; height:14px; background:#e76f51; border-radius:50%; }

.thumb-50 { background: #1e1e1e; border-bottom: 2px solid #333; }
.thumb-50::after { content:''; position:absolute; top:4px; left:4px; width:6px; height:2px; background:#569cd6; box-shadow:0 6px 0 #ce9178; }

.thumb-51 { background: #000; }
.thumb-51::after { content:''; position:absolute; top:4px; left:4px; width:4px; height:4px; border:1px solid #00ff00; }

.thumb-52 { background: #a3c2fa; }
.thumb-52::after { content:''; position:absolute; top:6px; left:6px; right:6px; height:10px; background:#fff; border: 2px solid #000; box-shadow: 2px 2px 0 #000; }

.thumb-53 { background: #09090b; border: 2px solid #f43f5e; }
.thumb-53::after { content:''; position:absolute; top:8px; left:4px; right:4px; height:8px; border: 1px dashed #22d3ee; }

.thumb-54 { background: #17002e; }
.thumb-54::after { content:''; position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); width:12px; height:12px; border-radius:50%; background: linear-gradient(45deg, #ff00ff, #00ffff); box-shadow: 0 0 4px #ff00ff; }

.thumb-55 { background: #0b3d91; background-image: linear-gradient(rgba(255,255,255,0.4) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.4) 1px, transparent 1px); background-size: 5px 5px; }
.thumb-55::after { content:''; position:absolute; top:2px; left:2px; right:2px; bottom:2px; border: 1px solid #fff; }
