/* ============================================================
   CV Maker v2 — app UI + 8 CV templates + print styles
   ============================================================ */

:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #101828;
  --muted: #667085;
  --line: #e4e7ec;
  --brand: #0e7490;
  --brand-soft: #ecfeff;
  --brand-ink: #ffffff;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 6px 24px rgba(16, 24, 40, .07);
  --shadow-lg: 0 24px 64px rgba(16, 24, 40, .22);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Tajawal", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--brand); }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px; min-height: 56px;
}
.topbar .logo { font-weight: 800; font-size: 17px; text-decoration: none; color: var(--ink); white-space: nowrap; letter-spacing: -.02em; }
.topbar .logo span { color: var(--brand); }
.topbar .spacer { flex: 1; }
.topbar .save-state { font-size: 12.5px; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.topbar .save-state .dot { width: 8px; height: 8px; border-radius: 50%; background: #12b76a; }
.topbar .save-state.pending .dot { background: #f79009; }
.topbar .save-state.error .dot { background: var(--danger); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: 9px 15px; border-radius: 10px; font-size: 14px; font-weight: 600;
  text-decoration: none; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #f9fafb; border-color: #d0d5dd; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); box-shadow: 0 1px 2px rgba(16,24,40,.1); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.ai { border-color: #d9d6fe; background: #f4f3ff; color: #5925dc; }
.btn.ai:hover { background: #ebe9fe; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .spin, .spin {
  display: inline-block; width: 13px; height: 13px; border: 2px solid currentColor;
  border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--panel); color: var(--muted); font-size: 16px;
}
.iconbtn:hover { color: var(--ink); background: #f9fafb; }
.iconbtn.danger:hover { color: var(--danger); }

/* ---------- generic ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 26px 18px 80px; }
.muted { color: var(--muted); }
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 99px; background: var(--brand-soft); color: var(--brand);
}
.badge.ar { background: #fdf2fa; color: #c11574; }
.badge.link { background: #f4f3ff; color: #5925dc; }
h1.page-title { font-size: 24px; margin: 4px 0 6px; letter-spacing: -.02em; }
.page-sub { color: var(--muted); margin: 0 0 22px; }

/* ---------- notice banner ---------- */
.banner {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  background: #fffaeb; border: 1px solid #fedf89; color: #93370d;
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 20px;
}
.banner .grow { flex: 1; min-width: 200px; }

/* ---------- CV list ---------- */
.cv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 18px; }
.cv-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column;
  transition: transform .15s, box-shadow .15s;
}
.cv-card:hover { transform: translateY(-3px); box-shadow: 0 4px 8px rgba(16,24,40,.08), 0 12px 36px rgba(16,24,40,.12); }
.cv-thumb {
  height: 190px; overflow: hidden; cursor: pointer; position: relative;
  background: #eef1f4; display: flex; justify-content: center;
}
.cv-thumb .cv-page { pointer-events: none; box-shadow: 0 2px 12px rgba(16,24,40,.14); margin-top: 14px; }
.cv-thumb::after { content: ""; position: absolute; inset: 0; }
.cv-card .card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.cv-card .name { font-weight: 700; font-size: 15px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-card .name:hover { color: var(--brand); }
.cv-card .meta { font-size: 12px; color: var(--muted); }
.cv-card .actions { display: flex; gap: 6px; }
.new-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }

/* new CV "card" buttons */
.start-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 18px; margin-bottom: 26px; }
.start-card {
  border: 1.5px dashed #cbd2da; border-radius: var(--radius); background: transparent;
  padding: 22px 16px; text-align: center; color: var(--muted); transition: all .15s;
}
.start-card:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.start-card .ico { font-size: 26px; display: block; margin-bottom: 6px; }
.start-card strong { display: block; color: inherit; font-size: 14.5px; }
.start-card span.sub { font-size: 12.5px; }

.empty-state {
  text-align: center; padding: 48px 20px; color: var(--muted);
  background: var(--panel); border: 1px dashed #cbd2da; border-radius: var(--radius);
}
.empty-state .big { font-size: 42px; }

/* ---------- editor layout ---------- */
.editor-wrap { display: grid; grid-template-columns: minmax(400px, 540px) 1fr; height: calc(100vh - 56px); }
.editor-form { overflow-y: auto; padding: 16px 16px 90px; background: var(--panel); border-inline-end: 1px solid var(--line); }
.editor-preview { overflow-y: auto; padding: 26px 16px 90px; background: #d6dce3; }
#preview-holder { width: 100%; display: flex; justify-content: center; }

/* mobile bottom action bar */
.bottombar { display: none; }

@media (max-width: 920px) {
  .topbar { padding: 8px 10px; gap: 8px; }
  .topbar .hide-mobile { display: none !important; }
  .editor-wrap { grid-template-columns: 1fr; height: auto; }
  .editor-form, .editor-preview { border: none; min-height: calc(100vh - 130px); padding-bottom: 110px; }
  .bottombar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
    background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottombar button, .bottombar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    border: none; background: none; color: var(--muted); font-size: 10.5px; font-weight: 600;
    padding: 5px 2px; text-decoration: none; border-radius: 10px;
  }
  .bottombar .ico { font-size: 19px; line-height: 1.2; }
  .bottombar .active { color: var(--brand); }
  .container { padding-bottom: 110px; }
}

/* ---------- form elements ---------- */
.fld { margin-bottom: 11px; }
.fld label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.fld input[type=text], .fld input[type=email], .fld input[type=url], .fld input[type=password],
.fld textarea, .fld select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.fld input:focus, .fld textarea:focus, .fld select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,116,144,.13); }
.fld textarea { resize: vertical; min-height: 70px; }
.fld-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .fld-row { grid-template-columns: 1fr; gap: 0; } }

.sec { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; background: #fff; }
.sec > .sec-head { display: flex; align-items: center; gap: 9px; padding: 12px 14px; cursor: pointer; user-select: none; }
.sec > .sec-head h3 { margin: 0; font-size: 14.5px; flex: 1; }
.sec > .sec-head .chev { transition: transform .15s; color: var(--muted); font-size: 11px; }
.sec.open > .sec-head .chev { transform: rotate(90deg); }
.sec > .sec-body { display: none; padding: 6px 14px 14px; border-top: 1px solid var(--line); }
.sec.open > .sec-body { display: block; }
.sec-count { font-size: 11.5px; color: var(--muted); background: #f2f4f7; border-radius: 99px; padding: 1px 8px; }

.subitem {
  border: 1px solid var(--line); border-radius: 11px; padding: 12px; margin-bottom: 10px; background: #fcfcfd;
  position: relative;
}
.subitem .item-tools {
  position: absolute; top: 7px; inset-inline-end: 7px; display: flex; gap: 2px;
}
.subitem .item-tools button {
  border: none; background: none; color: var(--muted); font-size: 14px; line-height: 1;
  padding: 5px 6px; border-radius: 6px;
}
.subitem .item-tools button:hover { background: #f2f4f7; color: var(--ink); }
.subitem .item-tools button.rm:hover { color: var(--danger); }
.bullet-row { display: flex; gap: 6px; margin-bottom: 6px; align-items: flex-start; }
.bullet-row textarea { flex: 1; min-height: 40px; }
.bullet-row .btn { flex-shrink: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; background: #f2f4f7; border: 1px solid var(--line);
  padding: 5px 11px; border-radius: 99px; font-size: 13px; font-weight: 500;
}
.chip button { border: none; background: none; padding: 0; color: var(--muted); font-size: 14px; }
.chip button:hover { color: var(--danger); }
.chip.suggested { background: #f4f3ff; border-color: #d9d6fe; color: #5925dc; cursor: pointer; }
.chip.suggested:hover { background: #ebe9fe; }

.toolrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 12px; }
.photo-thumb { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }

/* ---------- modal (bottom sheet on mobile) ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .55); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fadein .15s ease;
}
@keyframes fadein { from { opacity: 0; } }
.modal {
  background: var(--panel); border-radius: 16px; max-width: 680px; width: 100%;
  max-height: 88vh; overflow-y: auto; padding: 22px; box-shadow: var(--shadow-lg);
}
.modal h2 { margin: 0 0 14px; font-size: 18px; letter-spacing: -.01em; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
@media (max-width: 920px) {
  .modal-back { align-items: flex-end; padding: 0; }
  .modal {
    border-radius: 18px 18px 0 0; max-height: 86vh;
    animation: sheetup .22s cubic-bezier(.2,.9,.3,1);
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
  }
  @keyframes sheetup { from { transform: translateY(40%); opacity: .4; } }
  .modal .modal-actions .btn { flex: 1; }
}

/* big tappable menu options (AI tools) */
.menu-opt {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: start;
  border: 1px solid var(--line); background: #fff; border-radius: 12px;
  padding: 14px; margin-bottom: 10px; transition: border-color .15s, background .15s;
}
.menu-opt:hover { border-color: var(--brand); background: var(--brand-soft); }
.menu-opt .ico { font-size: 22px; width: 40px; height: 40px; border-radius: 10px; background: #f2f4f7; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.menu-opt strong { display: block; font-size: 14.5px; }
.menu-opt span.sub { font-size: 12.5px; color: var(--muted); }

/* ---------- design gallery ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 12px; }
.tpl-card { border: 2px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; background: #fff; transition: border-color .15s, transform .1s; }
.tpl-card:hover { transform: translateY(-2px); }
.tpl-card.sel { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,116,144,.18); }
.tpl-thumb { height: 150px; overflow: hidden; background: #eef1f4; display: flex; justify-content: center; pointer-events: none; }
.tpl-thumb .cv-page { box-shadow: 0 1px 6px rgba(16,24,40,.15); margin-top: 8px; }
.tpl-card .tpl-name { padding: 8px 10px 2px; font-weight: 700; font-size: 13px; }
.tpl-card .tpl-desc { padding: 0 10px 9px; font-size: 11px; color: var(--muted); line-height: 1.35; }
.accent-row { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-top: 8px; }
.accent-dot { width: 30px; height: 30px; border-radius: 50%; border: 2.5px solid transparent; padding: 0; outline-offset: 2px; }
.accent-dot.sel { outline: 2.5px solid var(--ink); }
.accent-custom { width: 30px; height: 30px; padding: 0; border: 1px dashed #98a2b3; border-radius: 50%; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); overflow: hidden; }
.accent-custom input { opacity: 0; width: 100%; height: 100%; cursor: pointer; }

/* ---------- rating ---------- */
.score-wrap { display: flex; align-items: center; gap: 18px; margin-bottom: 14px; }
.score-circle {
  width: 96px; height: 96px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800; color: #fff;
}
.subscores { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 14px 0; }
.subscore { background: #f9fafb; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; }
.subscore .lbl { font-size: 12px; color: var(--muted); }
.subscore .bar { height: 6px; border-radius: 3px; background: #e4e7ec; margin-top: 6px; overflow: hidden; }
.subscore .bar i { display: block; height: 100%; border-radius: 3px; }
.imp-item { border-inline-start: 3px solid #f79009; background: #fffaeb; padding: 9px 13px; border-radius: 0 10px 10px 0; margin-bottom: 8px; }
.imp-item .sec-name { font-size: 11.5px; font-weight: 800; color: #b54708; text-transform: uppercase; letter-spacing: .04em; }
.str-item { border-inline-start: 3px solid #12b76a; background: #ecfdf3; padding: 9px 13px; border-radius: 0 10px 10px 0; margin-bottom: 8px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(8px); z-index: 300;
  background: #101828; color: #fff; padding: 11px 20px; border-radius: 11px; font-size: 14px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; max-width: 92vw;
  box-shadow: var(--shadow-lg);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--danger); }
@media (max-width: 920px) { #toast { bottom: 86px; } }

/* ---------- overlay loader ---------- */
#busy {
  position: fixed; inset: 0; z-index: 250; background: rgba(255,255,255,.8);
  display: flex; flex-direction: column; gap: 16px; align-items: center; justify-content: center;
  backdrop-filter: blur(3px); text-align: center; padding: 20px;
}
#busy .ring { width: 44px; height: 44px; border: 4px solid #a5f3fc; border-top-color: var(--brand); border-radius: 50%; animation: spin .9s linear infinite; }
#busy p { color: var(--ink); font-weight: 600; max-width: 320px; margin: 0; }

/* skeleton */
.skel { background: linear-gradient(90deg, #eef1f4 25%, #f7f9fa 50%, #eef1f4 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ============================================================
   CV PAGE — A4 sheet shared by all templates
   ============================================================ */
.cv-page {
  --accent: #0e7490;
  width: 794px;            /* A4 @ 96dpi */
  min-height: 1123px;
  background: #fff;
  box-shadow: 0 6px 28px rgba(16,24,40,.22);
  color: #1f2937;
  font-size: 13.2px;
  line-height: 1.5;
  font-family: var(--font);
}
.cv-page[dir=rtl] { font-family: "Tajawal", "Inter", "Segoe UI", system-ui, sans-serif; }
.cv-page a { color: inherit; text-decoration: none; }
.cv-page h1 { font-size: 27px; margin: 0; line-height: 1.15; letter-spacing: -.01em; }
.cv-page .jobtitle { color: var(--accent); font-weight: 600; font-size: 15px; margin: 3px 0 0; }
.cv-page .cvs { margin-bottom: 14px; }
.cv-page .cvs h2 {
  font-size: 12.6px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--accent); margin: 0 0 7px; padding-bottom: 3px; border-bottom: 2px solid var(--accent);
}
.cv-page[dir=rtl] .cvs h2 { letter-spacing: 0; }
.cv-page .item { margin-bottom: 10px; }
.cv-page .item-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.cv-page .role { font-weight: 700; }
.cv-page .at { color: #374151; }
.cv-page .loc { color: #6b7280; font-size: 12px; }
.cv-page .dates { color: #6b7280; font-size: 12px; white-space: nowrap; }
.cv-page ul { margin: 4px 0 0; padding-inline-start: 18px; }
.cv-page ul.plain { list-style: none; padding: 0; margin: 0; }
.cv-page ul.plain li { margin-bottom: 4px; }
.cv-page li { margin-bottom: 2.5px; }
.cv-page .details { margin: 3px 0 0; }
.cv-page .prewrap { white-space: pre-wrap; }
.cv-page .tags { display: flex; flex-wrap: wrap; gap: 5px; }
.cv-page .tag {
  background: color-mix(in srgb, var(--accent) 9%, #fff);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, #fff);
  color: color-mix(in srgb, var(--accent) 80%, #000);
  padding: 2px 9px; border-radius: 99px; font-size: 11.8px;
}
.cv-page .photo { width: 108px; height: 108px; border-radius: 50%; object-fit: cover; display: block; }
.cv-page .lvl { color: #6b7280; }
.cv-page .inline-list { margin: 0; }
.cv-page .contactline { color: #4b5563; font-size: 12.3px; margin: 7px 0 0; }
.cv-page .sep { margin: 0 7px; color: #9ca3af; }

/* — modern: accent sidebar — */
.cv-modern { display: grid; grid-template-columns: 245px 1fr; min-height: 1123px; }
.cv-modern aside { background: color-mix(in srgb, var(--accent) 92%, #000); color: #f0fdfa; padding: 26px 20px; }
.cv-modern aside .photo { margin: 0 auto 18px; border: 3px solid rgba(255,255,255,.4); }
.cv-modern aside .cvs h2 { color: #fff; border-bottom-color: rgba(255,255,255,.45); }
.cv-modern aside a { color: #f0fdfa; }
.cv-modern aside .contact li { word-break: break-word; font-size: 12.3px; }
.cv-modern aside .tag { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.35); color: #fff; }
.cv-modern aside .lvl, .cv-modern aside .dates { color: rgba(240,253,250,.75); }
.cv-modern main { padding: 26px 28px; }
.cv-modern main header { margin-bottom: 16px; }

/* — classic: centered serif — */
.cv-classic { padding: 34px 44px; font-family: Georgia, "Times New Roman", serif; }
.cv-page[dir=rtl] .cv-classic { font-family: "Tajawal", Georgia, serif; }
.cv-classic header.center { text-align: center; margin-bottom: 18px; }
.cv-classic header .photo { margin: 0 auto 12px; }
.cv-classic .cvs h2 { text-align: center; border-bottom: 1px solid #94a3b8; color: #1f2937; letter-spacing: .15em; }
.cv-page[dir=rtl] .cv-classic .cvs h2 { letter-spacing: 0; }

/* — minimal: airy single column — */
.cv-minimal { padding: 38px 46px; }
.cv-minimal header { border-bottom: 3px solid var(--accent); padding-bottom: 14px; margin-bottom: 16px; }
.cv-minimal .head-row { display: flex; gap: 18px; align-items: center; }
.cv-minimal .photo { width: 84px; height: 84px; }
.cv-minimal .cvs h2 { border-bottom: none; padding-bottom: 0; }
.cv-minimal .lead { font-size: 13.8px; color: #374151; margin: 0 0 16px; }

/* — executive: dark header band + right rail — */
.cv-executive { min-height: 1123px; display: flex; flex-direction: column; }
.cv-executive .exec-head {
  background: #1a2230; color: #fff; padding: 30px 36px 24px;
}
.cv-executive .exec-id { display: flex; gap: 20px; align-items: center; }
.cv-executive .exec-head .photo { width: 86px; height: 86px; border: 2px solid color-mix(in srgb, var(--accent) 70%, #fff); }
.cv-executive .exec-head h1 { color: #fff; font-size: 29px; }
.cv-executive .exec-head .jobtitle { color: color-mix(in srgb, var(--accent) 45%, #fff); }
.cv-executive .exec-head .contactline { color: #cbd5e1; margin-top: 12px; }
.cv-executive .exec-head a { color: #e2e8f0; }
.cv-executive .exec-body { display: grid; grid-template-columns: 1fr 218px; gap: 28px; padding: 24px 36px; flex: 1; }
.cv-executive .exec-body aside .cvs h2 { border-bottom-width: 1px; }

/* — creative: bold accent header — */
.cv-creative { min-height: 1123px; }
.cv-creative .cre-head {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000));
  color: #fff; padding: 34px 40px; display: flex; gap: 24px; align-items: center;
}
.cv-creative .cre-head h1 { color: #fff; font-size: 30px; }
.cv-creative .cre-head .jobtitle { color: rgba(255,255,255,.85); font-size: 16px; }
.cv-creative .cre-head .contactline { color: rgba(255,255,255,.85); margin-top: 10px; }
.cv-creative .cre-head a { color: #fff; }
.cv-creative .cre-head .photo { width: 96px; height: 96px; border: 3px solid rgba(255,255,255,.55); flex-shrink: 0; }
.cv-creative .cre-body { padding: 26px 40px; }
.cv-creative .cre-body .lead { background: color-mix(in srgb, var(--accent) 6%, #fff); border-inline-start: 3px solid var(--accent); padding: 10px 14px; border-radius: 0 10px 10px 0; margin: 0 0 18px; }

/* — elegant: refined serif — */
.cv-elegant { padding: 44px 52px; font-family: Georgia, "Palatino Linotype", serif; }
.cv-page[dir=rtl] .cv-elegant { font-family: "Tajawal", Georgia, serif; }
.cv-elegant header.center { text-align: center; margin-bottom: 20px; }
.cv-elegant header .photo { width: 92px; height: 92px; margin: 0 auto 14px; }
.cv-elegant h1 { font-weight: 600; font-size: 30px; letter-spacing: .04em; }
.cv-elegant .jobtitle { color: #4b5563; font-weight: 400; font-style: italic; font-size: 14.5px; }
.cv-elegant .jobtitle::first-letter { text-transform: uppercase; }
.cv-elegant header .rule { width: 64px; height: 2px; background: var(--accent); margin: 16px auto 0; }
.cv-elegant .cvs h2 {
  text-align: center; border: none; color: #1f2937; letter-spacing: .22em; font-weight: 600;
  display: flex; align-items: center; gap: 14px;
}
.cv-elegant .cvs h2::before, .cv-elegant .cvs h2::after { content: ""; flex: 1; height: 1px; background: #d1d5db; }
.cv-page[dir=rtl] .cv-elegant .cvs h2 { letter-spacing: 0; }

/* — compact: dense — */
.cv-compact { padding: 26px 32px; font-size: 12.2px; line-height: 1.42; }
.cv-compact header { margin-bottom: 10px; }
.cv-compact .head-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.cv-compact h1 { font-size: 22px; }
.cv-compact .photo { width: 64px; height: 64px; }
.cv-compact .cvs { margin-bottom: 9px; }
.cv-compact .cvs h2 { font-size: 11.5px; margin-bottom: 4px; padding-bottom: 2px; border-bottom-width: 1px; }
.cv-compact .item { margin-bottom: 6px; }
.cv-compact ul { margin-top: 2px; }

/* — ats: machine-readable plain — */
.cv-ats { padding: 40px 48px; font-family: Arial, Helvetica, sans-serif; color: #111; }
.cv-page[dir=rtl] .cv-ats { font-family: "Tajawal", Arial, sans-serif; }
.cv-ats h1 { font-size: 24px; }
.cv-ats .jobtitle { color: #111; font-weight: 700; }
.cv-ats .photo { display: none; }
.cv-ats .cvs h2 { color: #111; border-bottom: 1px solid #111; letter-spacing: .04em; }
.cv-ats .dates, .cv-ats .loc, .cv-ats .lvl, .cv-ats .contactline { color: #333; }

/* ---------- preview scaling ---------- */
.preview-scale { transform-origin: top center; }
.thumb-scale { transform-origin: top center; }

/* ---------- print ---------- */
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .cv-page { box-shadow: none; width: auto; min-height: 0; }
  .cv-modern, .cv-executive, .cv-creative { min-height: 100vh; }
  .cv-page * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { size: A4; margin: 0; }
}

/* ---------- cover letter page ---------- */
.letter-page {
  width: 794px; min-height: 1123px; background: #fff; box-shadow: 0 6px 28px rgba(16,24,40,.22);
  padding: 60px 70px; font-size: 14.5px; line-height: 1.75; white-space: pre-wrap; color: #1f2937;
  font-family: var(--font);
}
.letter-page[dir=rtl] { font-family: "Tajawal", "Inter", sans-serif; }
@media print { .letter-page { box-shadow: none; width: auto; min-height: 0; padding: 0; } }
@media (max-width: 920px) { .letter-page { width: 100%; padding: 24px; min-height: 0; } }

/* ---------- auth screens ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 16px; gap: 18px;
}
.auth-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-lg); padding: 30px 28px; width: 100%; max-width: 400px;
}
.auth-card h1 { font-size: 21px; margin: 0 0 6px; letter-spacing: -.02em; }
.auth-card p.muted { margin: 0 0 18px; font-size: 13.5px; }
.auth-logo { font-weight: 800; font-size: 22px; margin-bottom: 18px; letter-spacing: -.02em; }
.auth-logo span { color: var(--brand); }

/* ---------- copyright footer ---------- */
.app-footer {
  text-align: center; color: var(--muted); font-size: 12.5px; padding: 28px 16px 10px;
}
.app-footer strong { color: #475467; font-weight: 600; }

/* ---------- AI interview chat ---------- */
.chat-box {
  height: min(46vh, 420px); overflow-y: auto; background: #f4f6f8;
  border: 1px solid var(--line); border-radius: 12px; padding: 14px;
  display: flex; flex-direction: column; gap: 9px; margin-bottom: 10px;
}
.bubble {
  max-width: 85%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word; animation: bubblein .18s ease;
}
@keyframes bubblein { from { opacity: 0; transform: translateY(5px); } }
.bubble.ai { background: #fff; border: 1px solid var(--line); align-self: flex-start; border-start-start-radius: 4px; }
.bubble.me { background: var(--brand); color: #fff; align-self: flex-end; border-start-end-radius: 4px; }
.bubble.err { border-color: #fda29b; background: #fef3f2; color: #b42318; }
.bubble.typing { display: flex; gap: 4px; padding: 13px 16px; }
.bubble.typing span {
  width: 7px; height: 7px; border-radius: 50%; background: #98a2b3;
  animation: blink 1.1s infinite both;
}
.bubble.typing span:nth-child(2) { animation-delay: .18s; }
.bubble.typing span:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chat-input { display: flex; gap: 8px; align-items: flex-end; }
.chat-input textarea {
  flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px;
  resize: none; outline: none; max-height: 120px;
}
.chat-input textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,116,144,.13); }
.chat-input .btn { height: 44px; min-width: 52px; font-size: 16px; }

/* ---------- settings ---------- */
.settings-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; max-width: 560px; box-shadow: var(--shadow); }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
