/* ═══════════════════════════════════════════════════════════════
   CV Color Themes — أضف على <body> أحد:
   cv-theme-teal (افتراضي) | cv-theme-navy | cv-theme-slate
   cv-theme-royal | cv-theme-forest | cv-theme-burgundy
   ═══════════════════════════════════════════════════════════════ */

:root,
body.cv-theme-teal,
.cv-document.cv-theme-teal {
    --teal: #3ea39f;
    --teal-dark: #2e8f8c;
    --teal-soft: #e4f4f2;
    --gold: #efc55f;
    --gold-soft: #faedd0;
    --paper: #fffdf9;
    --stone: #e0d7cb;
    --stone-soft: #f2ede6;
    --ink: #665d56;
    --muted: #8f8781;
    --bg: linear-gradient(135deg, #f5fbfb 0%, #fff9ef 45%, #eef4f7 100%);
    --shadow: 0 20px 55px rgba(46, 76, 85, 0.14);
    --header-gradient: linear-gradient(135deg, #44aaa5, #2f8c87);
    --header-bar: linear-gradient(90deg, transparent 0 88%, var(--gold) 88% 100%);
    --header-shadow: 0 12px 28px rgba(45, 91, 95, 0.18);
    --photo-gradient: linear-gradient(180deg, #4aa9a5 0%, #3f9f9b 48%, #358f8d 100%);
    --photo-border: rgba(42, 127, 124, 0.45);
    --photo-shadow: rgba(42, 89, 92, 0.18);
    --table-head-gradient: linear-gradient(180deg, #42a8a4, #349a97);
    --brand-tint-a: rgba(62, 163, 159, 0.08);
    --brand-tint-b: rgba(239, 197, 95, 0.12);
    --brand-shadow: rgba(51, 79, 82, 0.08);
    --qr-border: rgba(58, 152, 149, 0.25);
    --heading-accent: #e8b84b;
    --skill-icon: #32a0a0;
    --skill-label: #59a8aa;
    --border-warm: #d7d0c5;
    --border-table: #cfc6b9;
    --panel-muted: #5f7074;
}

/* كحلي — مناسب للمكاتب الرسمية والشركات الكبرى */
body.cv-theme-navy,
.cv-document.cv-theme-navy {
    --teal: #1e4a7a;
    --teal-dark: #163860;
    --teal-soft: #e8eef5;
    --gold: #c9a227;
    --gold-soft: #f3ead0;
    --paper: #fdfcf9;
    --stone: #d5dce6;
    --stone-soft: #eef1f6;
    --ink: #3d4654;
    --muted: #6b7280;
    --bg: linear-gradient(135deg, #eef2f7 0%, #faf8f2 45%, #e4eaf2 100%);
    --shadow: 0 20px 55px rgba(22, 56, 96, 0.12);
    --header-gradient: linear-gradient(135deg, #245a8f, #163860);
    --header-bar: linear-gradient(90deg, transparent 0 88%, var(--gold) 88% 100%);
    --header-shadow: 0 12px 28px rgba(22, 56, 96, 0.2);
    --photo-gradient: linear-gradient(180deg, #2a5f96 0%, #1e4a7a 48%, #163860 100%);
    --photo-border: rgba(22, 56, 96, 0.4);
    --photo-shadow: rgba(22, 56, 96, 0.2);
    --table-head-gradient: linear-gradient(180deg, #2a5f96, #1e4a7a);
    --brand-tint-a: rgba(30, 74, 122, 0.08);
    --brand-tint-b: rgba(201, 162, 39, 0.12);
    --brand-shadow: rgba(22, 56, 96, 0.08);
    --qr-border: rgba(30, 74, 122, 0.22);
    --heading-accent: #c9a227;
    --skill-icon: #1e4a7a;
    --skill-label: #2a5f96;
    --border-warm: #cdd5df;
    --border-table: #c5ced8;
    --panel-muted: #5a6578;
}

/* رمادي محايد — الأنسب لشعار أي عميل */
body.cv-theme-slate,
.cv-document.cv-theme-slate {
    --teal: #475569;
    --teal-dark: #334155;
    --teal-soft: #eef2f6;
    --gold: #b8956b;
    --gold-soft: #f2ebe3;
    --paper: #ffffff;
    --stone: #d8dee6;
    --stone-soft: #f1f5f9;
    --ink: #334155;
    --muted: #64748b;
    --bg: linear-gradient(135deg, #f8fafc 0%, #faf9f7 45%, #f1f5f9 100%);
    --shadow: 0 20px 55px rgba(51, 65, 85, 0.1);
    --header-gradient: linear-gradient(135deg, #64748b, #475569);
    --header-bar: linear-gradient(90deg, transparent 0 88%, var(--gold) 88% 100%);
    --header-shadow: 0 12px 28px rgba(51, 65, 85, 0.16);
    --photo-gradient: linear-gradient(180deg, #64748b 0%, #475569 48%, #334155 100%);
    --photo-border: rgba(71, 85, 105, 0.35);
    --photo-shadow: rgba(51, 65, 85, 0.16);
    --table-head-gradient: linear-gradient(180deg, #64748b, #475569);
    --brand-tint-a: rgba(71, 85, 105, 0.06);
    --brand-tint-b: rgba(184, 149, 107, 0.1);
    --brand-shadow: rgba(51, 65, 85, 0.06);
    --qr-border: rgba(71, 85, 105, 0.2);
    --heading-accent: #b8956b;
    --skill-icon: #475569;
    --skill-label: #64748b;
    --border-warm: #d8dee6;
    --border-table: #cbd5e1;
    --panel-muted: #64748b;
}

/* أزرق ملكي — عصري وواسع الانتشار */
body.cv-theme-royal,
.cv-document.cv-theme-royal {
    --teal: #2563eb;
    --teal-dark: #1d4ed8;
    --teal-soft: #eff6ff;
    --gold: #f59e0b;
    --gold-soft: #fef3c7;
    --paper: #fefefe;
    --stone: #dbeafe;
    --stone-soft: #eff6ff;
    --ink: #1e3a5f;
    --muted: #64748b;
    --bg: linear-gradient(135deg, #eff6ff 0%, #fffbeb 45%, #f0f9ff 100%);
    --shadow: 0 20px 55px rgba(37, 99, 235, 0.12);
    --header-gradient: linear-gradient(135deg, #3b82f6, #1d4ed8);
    --header-bar: linear-gradient(90deg, transparent 0 88%, var(--gold) 88% 100%);
    --header-shadow: 0 12px 28px rgba(29, 78, 216, 0.18);
    --photo-gradient: linear-gradient(180deg, #3b82f6 0%, #2563eb 48%, #1d4ed8 100%);
    --photo-border: rgba(37, 99, 235, 0.35);
    --photo-shadow: rgba(29, 78, 216, 0.18);
    --table-head-gradient: linear-gradient(180deg, #3b82f6, #2563eb);
    --brand-tint-a: rgba(37, 99, 235, 0.07);
    --brand-tint-b: rgba(245, 158, 11, 0.1);
    --brand-shadow: rgba(29, 78, 216, 0.08);
    --qr-border: rgba(37, 99, 235, 0.2);
    --heading-accent: #f59e0b;
    --skill-icon: #2563eb;
    --skill-label: #3b82f6;
    --border-warm: #bfdbfe;
    --border-table: #93c5fd;
    --panel-muted: #5b7094;
}

/* أخضر — هادئ ومناسب لقطاع الاستقدام */
body.cv-theme-forest,
.cv-document.cv-theme-forest {
    --teal: #2d6a4f;
    --teal-dark: #1b4332;
    --teal-soft: #e8f3ed;
    --gold: #d4a373;
    --gold-soft: #faeedc;
    --paper: #fdfcf8;
    --stone: #d8e2dc;
    --stone-soft: #eef4f0;
    --ink: #3d4f44;
    --muted: #6b7c72;
    --bg: linear-gradient(135deg, #eef4f0 0%, #faf7f0 45%, #e8f3ed 100%);
    --shadow: 0 20px 55px rgba(27, 67, 50, 0.12);
    --header-gradient: linear-gradient(135deg, #40916c, #1b4332);
    --header-bar: linear-gradient(90deg, transparent 0 88%, var(--gold) 88% 100%);
    --header-shadow: 0 12px 28px rgba(27, 67, 50, 0.18);
    --photo-gradient: linear-gradient(180deg, #40916c 0%, #2d6a4f 48%, #1b4332 100%);
    --photo-border: rgba(45, 106, 79, 0.4);
    --photo-shadow: rgba(27, 67, 50, 0.18);
    --table-head-gradient: linear-gradient(180deg, #40916c, #2d6a4f);
    --brand-tint-a: rgba(45, 106, 79, 0.08);
    --brand-tint-b: rgba(212, 163, 115, 0.12);
    --brand-shadow: rgba(27, 67, 50, 0.08);
    --qr-border: rgba(45, 106, 79, 0.22);
    --heading-accent: #d4a373;
    --skill-icon: #2d6a4f;
    --skill-label: #40916c;
    --border-warm: #cdd8d2;
    --border-table: #c5d4cb;
    --panel-muted: #5a6d62;
}

/* خمري — فخم للمكاتب الراقية */
body.cv-theme-burgundy,
.cv-document.cv-theme-burgundy {
    --teal: #7f2945;
    --teal-dark: #5c1a30;
    --teal-soft: #f7eef1;
    --gold: #c9a227;
    --gold-soft: #f5ecd2;
    --paper: #fffdfb;
    --stone: #e8dce0;
    --stone-soft: #f5eef1;
    --ink: #4a3540;
    --muted: #7a6670;
    --bg: linear-gradient(135deg, #f7eef1 0%, #faf8f2 45%, #f0e8eb 100%);
    --shadow: 0 20px 55px rgba(92, 26, 48, 0.12);
    --header-gradient: linear-gradient(135deg, #9b3a5a, #5c1a30);
    --header-bar: linear-gradient(90deg, transparent 0 88%, var(--gold) 88% 100%);
    --header-shadow: 0 12px 28px rgba(92, 26, 48, 0.18);
    --photo-gradient: linear-gradient(180deg, #9b3a5a 0%, #7f2945 48%, #5c1a30 100%);
    --photo-border: rgba(127, 41, 69, 0.38);
    --photo-shadow: rgba(92, 26, 48, 0.18);
    --table-head-gradient: linear-gradient(180deg, #9b3a5a, #7f2945);
    --brand-tint-a: rgba(127, 41, 69, 0.07);
    --brand-tint-b: rgba(201, 162, 39, 0.11);
    --brand-shadow: rgba(92, 26, 48, 0.08);
    --qr-border: rgba(127, 41, 69, 0.2);
    --heading-accent: #c9a227;
    --skill-icon: #7f2945;
    --skill-label: #9b3a5a;
    --border-warm: #dccfd4;
    --border-table: #d4c4ca;
    --panel-muted: #6d5862;
}

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

html {
    height: 100%;
    scroll-behavior: smooth;
}

body {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: #22353f;
    font-family: "Cairo", sans-serif;
}

.shell-header {
    flex: 0 0 auto;
    position: relative;
    overflow: hidden;
    padding: 28px 22px 24px;
    background:
        var(--header-bar),
        var(--header-gradient);
    color: #fff;
    box-shadow: var(--header-shadow);
}

.shell-header__accent {
    position: absolute;
    inset: auto auto -46px -36px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 68%);
}

.shell-header__copy {
    position: relative;
    max-width: 1300px;
    margin: 0 auto;
}

.shell-header__content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    max-width: 1300px;
    margin: 0 auto;
}

.shell-header__copy {
    flex: 1;
    max-width: none;
    margin: 0;
}

.shell-header__logo-wrap {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 108px;
    height: 108px;
    border-radius: 28px;
    background: rgb(255, 255, 255);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
}

.shell-header__logo {
    width: 74px;
    height: 74px;
    object-fit: contain;
    filter: drop-shadow(0 6px 10px rgba(21, 58, 62, 0.18));
}

.shell-header__eyebrow {
    margin-bottom: 5px;
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.shell-header h1 {
    font-size: clamp(1.4rem, 2vw, 2rem);
    font-weight: 800;
}

.shell-header p:last-child {
    max-width: 760px;
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.94);
}

@media (max-width: 720px) {
    .shell-header__content {
        flex-direction: column-reverse;
        align-items: flex-start;
    }

    .shell-header__logo-wrap {
        width: 88px;
        height: 88px;
        border-radius: 22px;
    }

    .shell-header__logo {
        width: 60px;
        height: 60px;
    }
}

.workspace {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    width: min(100%, 1500px);
    margin: 0 auto;
    padding: 22px;
}

.editor-panel,
.preview-panel {
    border-radius: 26px;
    box-shadow: var(--shadow);
}

.editor-panel {
    flex: 1 1 430px;
    min-height: 0;
    height: 100%;
    padding: 24px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    overflow-y: auto;
}

.panel-intro {
    padding: 16px 18px;
    margin-bottom: 20px;
    border: 1px solid rgba(62, 163, 159, 0.12);
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(62, 163, 159, 0.11), rgba(239, 197, 95, 0.08));
}

.panel-intro h2 {
    margin-bottom: 6px;
    color: var(--teal-dark);
    font-size: 1.15rem;
}

.panel-intro p {
    color: #5c747a;
    font-size: 0.94rem;
}

.form-block + .form-block {
    margin-top: 22px;
}

.form-block.is-hidden,
.experience-preview-block.is-hidden {
    display: none;
}

.form-block h3 {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(62, 163, 159, 0.16);
    color: var(--teal-dark);
    font-size: 1rem;
}

.form-grid {
    display: grid;
    gap: 14px;
}

.form-grid--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.experience-form-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.experience-row {
    margin: 0;
}

.experience-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.field--wide {
    grid-column: 1 / -1;
}

.field span {
    color: #35515a;
    font-size: 0.9rem;
    font-weight: 700;
}

.field input,
.field select {
    width: 100%;
    min-height: 46px;
    padding: 11px 14px;
    border: 1px solid rgba(128, 148, 156, 0.3);
    border-radius: 14px;
    background: #fff;
    color: #1f3238;
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field select {
    appearance: none;
    cursor: pointer;
    background-image:
        linear-gradient(45deg, transparent 50%, #6d8d92 50%),
        linear-gradient(135deg, #6d8d92 50%, transparent 50%);
    background-position:
        calc(14px) calc(50% - 1px),
        calc(8px) calc(50% - 1px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(62, 163, 159, 0.15);
}

.field input::placeholder {
    color: #97a3a9;
}

.field--file input {
    padding: 7px 8px;
    background: linear-gradient(180deg, #fff, #fbfcfd);
    color: #52656d;
    cursor: pointer;
}

.field--file input::file-selector-button {
    margin-inline-end: 10px;
    padding: 9px 14px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--teal-soft), #d2ece9);
    color: var(--teal-dark);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

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

.skills-picker label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(62, 163, 159, 0.16);
    border-radius: 16px;
    background: #fff;
    color: #465d66;
    font-size: 0.93rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.skills-picker label:hover {
    transform: translateY(-1px);
    border-color: rgba(62, 163, 159, 0.35);
    box-shadow: 0 10px 22px rgba(62, 163, 159, 0.08);
}

.skills-picker input {
    margin-top: 4px;
    accent-color: var(--teal);
}

.skill-option {
    justify-content: space-between;
    min-height: 74px;
}

.skill-option input {
    flex: 0 0 auto;
    margin-top: 2px;
}

.skill-option__text {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 3px;
    text-align: right;
}

.skill-option__ar {
    color: #4a6169;
    font-size: 0.93rem;
    font-weight: 800;
    line-height: 1.35;
}

.skill-option__en {
    color: #8a969c;
    direction: ltr;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.25;
}

.form-actions {
    position: sticky;
    bottom: -24px;
    padding-top: 18px;
    margin-top: 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.96) 35%);
}

.download-btn {
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--teal), var(--teal-dark));
    color: #fff;
    font: inherit;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 14px 28px rgba(46, 143, 140, 0.22);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.download-btn i {
    margin-left: 8px;
}

.secondary-btn {
    min-width: 178px;
    padding: 11px 16px;
    border: 1px solid rgba(62, 163, 159, 0.22);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(62, 163, 159, 0.12), rgba(239, 197, 95, 0.08));
    color: var(--teal-dark);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.secondary-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(62, 163, 159, 0.1);
}

.secondary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 32px rgba(46, 143, 140, 0.24);
    filter: saturate(1.05);
}

.preview-panel {
    flex: 1 1 660px;
    min-height: 0;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 18px;
    overflow: auto;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.88)),
        linear-gradient(135deg, #dbe8ea, #f7f1e3);
    overflow-y: auto;
}

.cv-stage {
    position: relative;
    width: 100%;
    min-height: 200px;
}

.cv-wrapper {
    position: absolute;
    top: 0;
    left: 50%;
    width: 210mm;
    height: 297mm;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(45, 60, 76, 0.16);
    overflow: hidden;
    transform: translateX(-50%) scale(1);
    transform-origin: top center;
}

.cv-document {
    position: relative;
    width: 210mm;
    height: 297mm;
    overflow: hidden;
    background: var(--paper);
    color: var(--ink);
    font-family:  "Cairo", sans-serif;
}

.pdf-export-host {
    position: fixed;
    top: 0;
    left: 0;
    z-index: -1;
    width: 210mm;
    height: 297mm;
    overflow: hidden;
    background: var(--paper);
    pointer-events: none;
    opacity: 0;
}

.pdf-export-host .cv-document {
    position: relative;
    width: 210mm;
    height: 297mm;
    min-width: 210mm;
    min-height: 297mm;
    border-radius: 0;
    box-shadow: none;
    transform: none !important;
}

.cv-top-strip {
    height: 7mm;
    background: linear-gradient(90deg, var(--teal) 0 87%, var(--gold) 87% 100%);
}

.cv-watermark {
    position: absolute;
    inset: 12mm 5mm 8mm;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 7mm 7mm;
    pointer-events: none;
}

.watermark-tile {
    display: flex;
    align-items: center;
    justify-content: center;
}

.watermark-tile img {
    width: 40mm;
    height: 20mm;
    object-fit: contain;
    opacity: 0.075;
}

.cv-page {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: calc(100% - 7mm);
    padding: 5.5mm 5.5mm 3.5mm;
}

.cv-main-layout,
.cv-content-grid {
    display: grid;
    grid-template-columns: 52mm 1fr;
    gap: 3.4mm;
    align-items: start;
}

.cv-content-grid {
    flex: 1;
    min-height: 0;
    margin-top: 3mm;
}

.cv-content-grid .qr-card--grid {
    grid-column: 1;
    grid-row: 1 / span 2;
    margin: 0 auto 0 10mm;
}

.cv-content-grid .cv-side-column {
    grid-column: 1;
    grid-row: 1;
}

.cv-content-grid .cv-primary-column {
    grid-column: 2;
    grid-row: 1;
}

.brand-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 4mm;
    min-height: 24mm;
    padding: 2.4mm 3.2mm;
    border-bottom: 0.7mm solid var(--gold);
    border-radius: 2.4mm;
    background:
        linear-gradient(90deg, var(--brand-tint-a), transparent 31%, transparent 69%, var(--brand-tint-b)),
        rgba(255, 253, 249, 0.98);
    box-shadow: 0 1.4mm 3.4mm var(--brand-shadow);
}

.brand-copy {
    grid-column: 3;
    justify-self: end;
    max-width: 72mm;
    text-align: right;
    direction: rtl;
}

.brand-copy h1,
.brand-copy h4 {
    color: var(--teal-dark);
    font-family: "Cairo", sans-serif;
    font-size: 4.6mm;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: normal;
    word-break: normal;
    overflow-wrap: break-word;
    white-space: normal;
    text-transform: none;
}

.cv-side-column {
    display: flex;
    flex-direction: column;
    gap: 3mm;
}

.qr-card {
    width: 29mm;
    height: 29mm;
    margin-inline-start: 10mm;
    border: 0.6mm solid var(--qr-border);
    background: rgba(255, 255, 255, 0.95);
}

.qr-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-panel {
    position: relative;
    height: 158.5mm;
    border-radius: 3.4mm;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0.03)),
        var(--photo-gradient);
    border: 0.35mm solid var(--photo-border);
    box-shadow: 0 1.8mm 4.2mm var(--photo-shadow), inset 0 0 0 0.5mm rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.photo-panel__frame {
    position: absolute;
    inset: 1.5mm;
    border: 0.25mm solid rgba(255, 255, 255, 0.28);
    border-radius: 2.7mm;
}

.photo-panel__band {
    position: absolute;
    top: 55.8mm;
    left: 3.4mm;
    right: 3.4mm;
    z-index: 4;
    padding: 1.45mm 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.93);
    color: var(--panel-muted);
    text-align: center;
    font-size: 3.25mm;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 0.6mm 1.6mm rgba(45, 76, 81, 0.16);
}

.photo-panel__personal {
    position: absolute;
    top: 4.2mm;
    left: 0;
    right: 0;
    height: 48mm;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5mm 6mm 6mm;
}

.photo-panel__sample-box {
    position: relative;
    z-index: 2;
    width: 31mm;
    height: 39.5mm;
    padding: 10mm 0 0;
    border: 0.8mm solid rgba(255, 255, 255, 0.94);
    border-radius: 2mm;
    background: #f5f3ef;
    color: #9b9894;
    text-align: center;
    font-size: 4mm;
    line-height: 1.15;
    letter-spacing: 0.24em;
    box-shadow: 0 1.2mm 2.6mm rgba(47, 79, 83, 0.2);
    text-transform: lowercase;
}

.photo-panel__personal-image {
    position: relative;
    z-index: 3;
    width: 31mm;
    height: 39.5mm;
    border: 0.85mm solid rgba(255, 255, 255, 0.94);
    border-radius: 2mm;
    background: #fff;
    box-shadow: 0 1.2mm 2.8mm rgba(47, 79, 83, 0.2);
    object-fit: cover;
    object-position: center top;
}

.photo-panel__full {
    position: absolute;
    top: 68.5mm;
    left: 3.4mm;
    right: 3.4mm;
    bottom: 3.4mm;
    z-index: 2;
    border: 0.35mm solid rgba(255, 255, 255, 0.28);
    border-radius: 2.4mm;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.photo-panel__full-image {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    background: #fff;
    object-fit: contain;
    object-position: center bottom;
}

.photo-panel__placeholder {
    position: absolute;
    inset: 0;
    z-index: 0;
    border: 0.35mm solid rgba(255, 255, 255, 0.16);
    border-radius: 2mm;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
        linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(255, 255, 255, 0.02));
}

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

.cv-primary-column {
    display: flex;
    flex-direction: column;
}

.brand-logo {
    grid-column: 1;
    flex: 0 0 auto;
    justify-self: start;
    width: 45mm;
    height: 30mm;
    padding: 1.2mm;
    border-radius: 2mm;
    background: #fff;
    box-shadow: 0 0.8mm 2mm rgba(48, 86, 90, 0.1);
    object-fit: contain;
}

.brand-copy p {
    margin-top: 0.8mm;
    color: #7f8589;
    font-size: 3.45mm;
    font-weight: 700;
    direction: ltr;
    text-align: right;
}

.resume-heading {
    grid-column: 2;
    justify-self: center;
    margin: 0;
    padding-inline-start: 2mm;
    text-align: center;
    line-height: 1.02;
}

.resume-heading strong {
    display: block;
    color: var(--teal);
    font-family: "Cairo", sans-serif;
    font-size: 6.4mm;
    font-weight: 800;
}

.resume-heading span {
    display: block;
    margin-top: 0.4mm;
    color: var(--heading-accent);
    font-size: 4.9mm;
    font-weight: 800;
}

.meta-table,
.mini-table,
.details-table,
.experience-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: rgba(255, 253, 249, 0.95);
}

.meta-table {
    margin-top: 0;
    overflow: hidden;
    border-radius: 1.2mm 1.2mm 0 0;
}

.meta-table th,
.experience-table th {
    padding: 1.7mm 1.4mm 1.25mm;
    border: 0.25mm solid var(--border-table);
    background: var(--table-head-gradient);
    color: #fff;
    font-size: 2.9mm;
    font-weight: 800;
    line-height: 1.05;
    text-align: center;
}

.meta-table th span,
.experience-table th span {
    display: block;
    margin-top: 0.4mm;
    font-family: "Cairo", sans-serif;
    font-size: 2.55mm;
}

.meta-table td,
.experience-table td {
    height: 6.1mm;
    border: 0.25mm solid var(--border-warm);
    color: #635a54;
    font-size: 3.05mm;
    font-weight: 700;
    text-align: center;
}

.mini-table {
    margin-top: 1.1mm;
}

.mini-table td,
.details-table td {
    height: 5.55mm;
    border: 0.25mm solid var(--border-warm);
}

.label-cell {
    width: 28%;
    padding: 0 1.4mm;
    background: var(--stone-soft);
    color: #7a726b;
    font-size: 2.75mm;
    font-weight: 800;
}

.value-cell {
    width: 40%;
    padding: 0 2mm;
    color: #635952;
    font-size: 3.05mm;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
}

.arabic-cell {
    width: 32%;
    padding: 0 1.6mm;
    background: var(--stone-soft);
    color: #756a64;
    direction: rtl;
    text-align: right;
    font-family: "Cairo", sans-serif;
    font-size: 2.95mm;
    font-weight: 800;
}

.section-bar {
    height: 3.5mm;
    margin: 1.8mm 0 1.2mm;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--teal), var(--teal-dark));
}

.experience-table {
    margin-top: 2.2mm;
}

.skills-section {
    margin-top: auto;
    padding-top: 5mm;
}

.skills-row {
    display: grid;
    gap: 1.2mm;
}

.skills-row + .skills-row {
    margin-top: 1.4mm;
}

.skills-row--top {
    grid-template-columns: repeat(4, 1fr);
}

.skills-row--bottom {
    grid-template-columns: repeat(5, 1fr);
}

.skill-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 24.6mm;
    padding: 2.2mm 1.4mm 1.6mm;
    border: 0.25mm solid #e5ddd1;
    border-radius: 1.2mm;
    background: rgba(250, 247, 241, 0.96);
    text-align: center;
}

.skill-icon {
    color: var(--skill-icon);
    font-size: 5.2mm;
}

.skill-ar {
    min-height: 8mm;
    margin-top: 1.2mm;
    color: #6b635d;
    direction: rtl;
    font-family: "Cairo", sans-serif;
    font-size: 2.7mm;
    font-weight: 800;
    line-height: 1.08;
}

.skill-en {
    min-height: 5.4mm;
    margin-top: 0.6mm;
    color: #8d837d;
    font-size: 2.25mm;
    font-weight: 700;
    line-height: 1.08;
}

.skill-check {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 8.4mm;
    height: 8.4mm;
    margin-top: auto;
    border: 0.4mm solid var(--gold);
    background: #fff;
    color: var(--teal);
    font-size: 3.8mm;
    font-weight: 800;
}

.cv-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2mm;
    padding-top: 2.4mm;
    margin-top: 2.2mm;
    color: var(--skill-label);
    font-size: 1.9mm;
    font-weight: 700;
}

@media (max-width: 1180px) {
    .editor-panel,
    .preview-panel {
        height: 100%;
    }
}

@media (max-width: 920px) {
    body {
        height: auto;
        overflow: auto;
    }

    .workspace {
        flex: 0 0 auto;
        min-height: auto;
        padding: 16px;
        width: 100%;
    }

    .form-grid--two,
    .form-grid--three,
    .skills-picker {
        grid-template-columns: 1fr;
    }

    .preview-panel {
        height: auto;
        padding: 12px;
    }

    .editor-panel {
        height: auto;
    }

    .cv-stage {
        min-width: 340px;
    }

    .cv-wrapper {
        left: 0;
        transform: scale(1);
        transform-origin: top left;
    }
}

@media print {
    body {
        background: #fff;
    }

    body * {
        visibility: hidden;
    }

    .cv-wrapper,
    .cv-wrapper * {
        visibility: visible;
    }

    .cv-wrapper {
        position: absolute;
        inset: 0;
        width: 210mm;
        height: 297mm;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .cv-document,
    .cv-document * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* ── Preview mode (laborers_view popup) ── */
body.cv-mode-preview {
    overflow: auto;
    height: auto;
    min-height: 100vh;
    display: block;
    background: #f5f5f5;
}

.cv-preview-toolbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid #e0d7cb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.cv-preview-toolbar__title {
    font-size: 18px;
    font-weight: 700;
    color: #22353f;
}

.cv-preview-toolbar__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cv-preview-main {
    display: flex;
    justify-content: center;
    padding: 24px 16px 40px;
}

.cv-stage--preview {
    width: 100%;
    max-width: 900px;
}

.cv-wrapper--preview {
    position: relative;
    left: auto;
    transform: none !important;
    margin: 0 auto;
}

.download-btn--compact {
    padding: 10px 16px;
    font-size: 14px;
}

@media print {
    .cv-preview-toolbar {
        display: none !important;
    }

    body.cv-mode-preview {
        background: #fff;
    }

    .cv-preview-main {
        padding: 0;
    }
}

/* ── Auto-download mode ── */
body.cv-mode-download {
    overflow: hidden;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}

.cv-download-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.96);
    color: #22353f;
    font-size: 18px;
    font-weight: 600;
}

.cv-download-overlay i {
    font-size: 32px;
    color: #c9a227;
}

.cv-preview-main--download {
    position: fixed;
    top: 0;
    left: 0;
    z-index: -1;
    width: 210mm;
    height: 297mm;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    padding: 0;
    margin: 0;
}

.cv-preview-main--download .cv-stage,
.cv-preview-main--download .cv-wrapper {
    position: relative;
    left: auto;
    top: auto;
    transform: none !important;
    width: 210mm;
    height: 297mm;
    margin: 0;
    box-shadow: none;
    border-radius: 0;
}
