:root {
  --pr: #006853; --prd: #004232; --prl: #E7F3EF; --gold: #C9A227; --goldd: #8B7324;
  --bg: #F5EFE3; --bg2: #EFE6D4; --card: #FFFDF9; --ink: #1E1A14; --mut: #6E6556; --line: #E6DCC8; --danger: #C62845;
  --field: #FFFFFF; --field-line: #D6CAB2; --top-bg: rgba(255, 251, 243, .94); --soft: #FAF5EB;
  --r: 14px; --sh: 0 8px 26px rgba(80, 60, 20, .08);
  --font: 'Almarai', 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  --top: 62px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { scroll-padding-top: calc(var(--top) + 10px); }
body { font-family: var(--font); background: var(--bg) radial-gradient(circle at 100% 0, #FBF6EC 0, transparent 45%); color: var(--ink); line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column; }
body.no-scroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: var(--pr); }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; flex-shrink: 0; }
.muted { color: var(--mut); font-size: 13px; }
.center { text-align: center; }
.small { font-size: 12px; }
.mt6 { margin-top: 6px; }

/* ---------- أزرار ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 18px; border-radius: 10px; font-weight: 800; font-size: 14px; border: 1.5px solid transparent; transition: .18s; text-decoration: none; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--pr); color: #fff; }
.btn-primary:hover { background: var(--prd); }
.btn-gold { background: var(--gold); color: #1d1605; }
.btn-gold:hover { background: #b89220; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--pr); color: var(--pr); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-wa { background: #25D366; color: #fff; }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-xs { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 14px 24px; font-size: 16px; }
.btn.block { width: 100%; margin: 10px 0; }
.btn.danger, .btn-ghost.danger { color: var(--danger); }
.link { color: var(--pr); font-weight: 800; text-decoration: underline; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); font-size: 22px; }
.icon-btn:hover { background: var(--prl); }
.icon-btn.light { color: #fff; }
.icon-btn.light:hover { background: rgba(255,255,255,.15); }

/* ---------- الترويسة ---------- */
.topbar { position: sticky; top: 0; z-index: 60; height: var(--top); background: var(--top-bg); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; padding: 0 12px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand img { width: 38px; height: 38px; object-fit: contain; border-radius: 9px; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; }
.brand b { font-size: 17px; font-weight: 900; }
.brand em { font-style: normal; color: var(--gold); }
.brand small { font-size: 11px; color: var(--mut); font-weight: 700; }
.top-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.save-chip { font-size: 11.5px; font-weight: 800; padding: 5px 10px; border-radius: 20px; background: #EEF2F0; color: var(--mut); white-space: nowrap; }
.save-chip.cloud { background: #DCF5E6; color: #146C3A; }
.save-chip.sync { background: #FFF6DB; color: #8A6A0B; }
.save-chip.err { background: #FDE7EA; color: var(--danger); }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; border: 1.5px solid var(--line); border-radius: 30px; background: #fff; position: relative; }
.user-chip:hover { border-color: var(--pr); }
.user-chip img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.uc-text { display: flex; flex-direction: column; line-height: 1.1; text-align: start; }
.uc-text small { font-size: 10.5px; color: var(--mut); }
.uc-text b { font-size: 13.5px; }
.uc-bal { font-size: 11px; font-weight: 800; background: var(--prl); color: var(--pr); padding: 3px 9px; border-radius: 20px; }
.user-chip .dot { position: absolute; top: 2px; right: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); border: 2px solid #fff; }

/* ---------- القائمة الجانبية ---------- */
.drawer-mask { position: fixed; inset: 0; background: rgba(8, 20, 16, .45); z-index: 90; opacity: 0; pointer-events: none; transition: .25s; }
.drawer-mask.show { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; bottom: 0; right: 0; width: min(330px, 88vw); background: var(--card); z-index: 100; transform: translateX(105%); transition: transform .28s ease; display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0,0,0,.15); }
.drawer.open { transform: none; }
.drawer-head { background: linear-gradient(135deg, var(--prd), var(--pr)); color: #fff; padding: 20px 16px 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.dh-user { display: flex; gap: 12px; align-items: center; min-width: 0; }
.dh-user img, .av-ph { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); background: rgba(255,255,255,.15); display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.dh-user div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dh-user small { opacity: .8; font-size: 12px; }
.dh-user b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dh-bal { font-size: 12px; background: rgba(255,255,255,.16); padding: 2px 10px; border-radius: 20px; align-self: flex-start; }
.dh-user .btn { margin-top: 6px; align-self: flex-start; }
.drawer-nav { flex: 1; overflow-y: auto; padding: 8px 8px 20px; }
.drawer-nav button, .drawer-nav a { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; font-weight: 700; font-size: 14.5px; color: var(--ink); text-decoration: none; text-align: start; }
.drawer-nav button:hover, .drawer-nav a:hover { background: var(--prl); color: var(--pr); }
.drawer-nav .ic { color: var(--pr); }
.drawer-nav .danger, .drawer-nav .danger .ic { color: var(--danger); }
.dn-label { font-size: 11.5px; font-weight: 800; color: var(--mut); padding: 14px 12px 4px; }
.dn-sep { height: 1px; background: var(--line); margin: 10px 6px; }

/* ---------- الهيكل ---------- */
.app { width: 100%; max-width: 1180px; margin: 0 auto; padding: 14px 12px 40px; flex: 1; }
.invite-banner { display: flex; gap: 10px; align-items: center; background: linear-gradient(90deg, #FFF6DB, #FFFDF5); border: 1px solid #F1D98A; border-radius: var(--r); padding: 12px 14px; font-size: 13.5px; margin-bottom: 12px; }
.invite-banner .ic { color: var(--goldd); width: 24px; height: 24px; }
.doc-bar { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.doc-title { flex: 1; min-width: 220px; display: flex; flex-direction: column; }
.doc-title label { font-size: 11.5px; font-weight: 800; color: var(--mut); margin-bottom: 3px; }
.doc-title input { background: transparent; border: none; border-bottom: 2px dashed var(--line); font-size: 19px; font-weight: 900; padding: 2px 0 4px; border-radius: 0; }
.doc-title input:focus { outline: none; border-bottom-color: var(--pr); }
.doc-bar-actions { display: flex; gap: 8px; }

.stepper { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 4px 2px 8px; }
.stepper::-webkit-scrollbar { display: none; }
.st-btn { flex: 1; min-width: 104px; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 12px; border-radius: 12px; background: #fff; border: 1.5px solid var(--line); font-weight: 800; font-size: 13.5px; color: var(--mut); white-space: nowrap; }
.st-btn i { font-style: normal; }
.st-btn.done { color: var(--pr); border-color: #BFE0D3; }
.st-btn.on { background: var(--pr); border-color: var(--pr); color: #fff; box-shadow: 0 6px 16px rgba(0,104,83,.25); }
.progress { display: flex; align-items: center; gap: 10px; margin: 2px 2px 16px; }
.progress-track { flex: 1; height: 7px; background: #E1E8E4; border-radius: 10px; overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--pr)); transition: width .4s; }
.progress small { font-size: 12px; font-weight: 800; color: var(--mut); white-space: nowrap; }

/* ---------- البطاقات والنماذج ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--sh); margin-bottom: 14px; }
.card.slim { padding: 14px 16px; }
.card-h { margin-bottom: 14px; }
.card-h.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-h h2 { font-size: 17.5px; font-weight: 900; color: var(--prd); }
.card-h p { font-size: 13px; color: var(--mut); margin-top: 3px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.tight { margin-top: 10px; }
.span2 { grid-column: span 2; }
.fg { display: flex; flex-direction: column; min-width: 0; }
.fg label { font-size: 13.5px; font-weight: 800; margin-bottom: 6px; color: var(--ink); }
.fg label b { color: var(--danger); }
input, select, textarea { width: 100%; border: 1.5px solid var(--field-line); border-radius: 10px; padding: 11px 13px; background: var(--field); font-size: 15px; transition: .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pr); box-shadow: 0 0 0 3px rgba(0,104,83,.12); }
textarea { resize: vertical; line-height: 1.7; }
input.bad { border-color: #E9A23B; }
input.good { border-color: #2E9E62; }
.ltr-input { text-align: left; letter-spacing: 1px; }
.hint { font-size: 11.5px; color: var(--mut); margin-top: 4px; display: block; }
.hint.ok { color: #1E8A4F; font-weight: 700; }
.hint.warn { color: #A96A06; font-weight: 700; }
.hint.center { text-align: center; }
.seg { display: flex; background: #EEF2F0; border-radius: 11px; padding: 4px; gap: 4px; }
.seg button { flex: 1; padding: 8px 10px; border-radius: 8px; font-weight: 800; color: var(--mut); }
.seg button.on { background: #fff; color: var(--pr); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.seg.wide button { padding: 10px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; flex-shrink: 0; }
.switch input { display: none; }
.switch span { width: 42px; height: 24px; background: #CDD7D2; border-radius: 20px; position: relative; transition: .2s; flex-shrink: 0; }
.switch span:after { content: ''; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--pr); }
.switch input:checked + span:after { right: 21px; }
.switch em { font-style: normal; font-size: 13px; font-weight: 700; }
.switch.inline { margin-top: 12px; }
.sub-h { font-size: 13.5px; font-weight: 900; color: var(--prd); margin: 16px 0 8px; display: flex; align-items: center; gap: 8px; }
.sub-h:after { content: ''; flex: 1; height: 1px; background: var(--line); }
.pane-nav { display: flex; justify-content: space-between; gap: 10px; margin: 18px 0 10px; }

/* ---------- الشواهد ---------- */
.el-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 10px; box-shadow: var(--sh); overflow: hidden; border-inline-start: 5px solid #CAD5D0; }
.el-card:has(.el-badge.ok) { border-inline-start-color: var(--pr); }
.el-card.is-skipped { opacity: .72; }
.el-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 13px 14px; text-align: start; }
.el-num { width: 36px; height: 36px; border-radius: 10px; background: var(--prl); color: var(--pr); font-weight: 900; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.el-title { flex: 1; display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.el-title b { font-size: 15px; }
.el-title small { font-size: 11.5px; color: var(--mut); }
.el-badge { font-size: 11px; font-weight: 800; padding: 4px 10px; border-radius: 20px; white-space: nowrap; }
.el-badge.ok { background: #DCF5E6; color: #146C3A; }
.el-badge.wait { background: #FDF0DA; color: #8A5A0B; }
.el-badge.skip { background: #EEF0F3; color: #5B6472; }
.chev { font-style: normal; font-size: 18px; color: var(--mut); transition: .2s; }
.el-card.open .chev { transform: rotate(180deg); }
.el-body { display: none; padding: 0 14px 16px; border-top: 1px solid var(--line); }
.el-card.open .el-body { display: block; }
.el-body > .fg { margin-top: 12px; }
.guide { background: #F2FBF7; border: 1px solid #CFEBDD; color: #16573D; font-size: 12.5px; border-radius: 10px; padding: 9px 12px; margin-top: 12px; }
.custom-text { margin-top: 12px; border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; }
.en-fields { border: 1px dashed var(--line); border-radius: 12px; padding: 10px 14px; background: #FAFCFB; }
.en-fields summary { cursor: pointer; font-weight: 800; font-size: 13.5px; color: var(--pr); }
.en-fields .grid { margin-top: 12px; }
.custom-text summary { cursor: pointer; font-weight: 800; font-size: 13px; color: var(--pr); }
.custom-text .fg { margin-top: 10px; }
.ct-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-top: 12px; }
.thumb { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; position: relative; }
.th-img { height: 96px; background: #F5F7F6 center/cover no-repeat; }
.th-tools { position: absolute; top: 5px; left: 5px; display: flex; gap: 4px; }
.th-tools button { width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.95); box-shadow: 0 1px 4px rgba(0,0,0,.2); font-size: 13px; font-weight: 900; }
.th-tools .del { background: var(--danger); color: #fff; }
.th-cap { background: var(--card); border: none; border-top: 1px solid var(--line); border-radius: 0; font-size: 11.5px; padding: 6px 8px; }
.add-tile { min-height: 128px; border: 2px dashed #B8CCC4; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; color: var(--pr); text-align: center; padding: 8px; background: #FAFCFB; transition: .15s; }
.add-tile:hover { border-color: var(--pr); background: var(--prl); }
.add-tile b { font-size: 26px; line-height: 1; }
.add-tile span { font-size: 12.5px; font-weight: 800; }
.add-tile small { font-size: 10.5px; color: var(--mut); }
.add-tile.small { min-height: 96px; }
.single-prev { display: flex; align-items: center; gap: 10px; }
.single-prev img { max-width: 110px; max-height: 80px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: #fff; }

/* ---------- الأقسام الإضافية ---------- */
.x-card.off > *:not(.card-h) { opacity: .45; pointer-events: none; }
.rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.row-item { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; background: #FAFCFB; border: 1px solid var(--line); border-radius: 12px; padding: 10px; position: relative; }
.row-item .fg { flex: 1 1 140px; }
.row-item .fg.grow { flex: 3 1 220px; }
.row-item .fg.sm { flex: 1 1 110px; }
.row-item .fg.xs { flex: 0 1 80px; }
.row-item .fg label { font-size: 11.5px; }
.row-item input, .row-item select { padding: 8px 10px; font-size: 14px; }
.row-del { width: 34px; height: 38px; border-radius: 9px; color: var(--danger); font-weight: 900; background: #FDE7EA; }
.table-scroll { overflow-x: auto; margin: 4px 0; }
.grid-table { border-collapse: separate; border-spacing: 4px; min-width: 640px; width: 100%; }
.grid-table th { font-size: 12px; font-weight: 800; color: var(--prd); background: var(--prl); padding: 6px; border-radius: 8px; white-space: nowrap; }
.grid-table td input { padding: 7px 6px; font-size: 13px; text-align: center; border-radius: 8px; }
.sig-pad { border: 2px dashed #B8CCC4; border-radius: 12px; padding: 8px; background: #FAFCFB; }
#sigCanvas { width: 100%; height: 170px; background: #fff; border-radius: 8px; touch-action: none; cursor: crosshair; display: block; box-shadow: inset 0 0 0 1px var(--line); }
.sig-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.sig-actions small { color: var(--mut); font-size: 11.5px; }

/* ---------- استوديو التصميم ---------- */
.studio { display: grid; grid-template-columns: 1fr 440px; gap: 16px; align-items: start; }
.studio-preview { position: -webkit-sticky; position: sticky; top: calc(var(--top) + 12px); align-self: start; background: #E6ECE9; border-radius: var(--r); padding: 12px; max-height: calc(100vh - var(--top) - 24px); }
.pv-toolbar { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; }
.pv-toolbar span { font-weight: 800; font-size: 13px; min-width: 54px; text-align: center; }
.pv-toolbar .icon-btn { background: #fff; font-size: 22px; font-weight: 900; }
.pv-toolbar .btn { margin-inline-start: auto; }
.pv-viewer { display: flex; justify-content: center; }
.pv-page { position: relative; overflow: hidden; background: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.18); border-radius: 4px; }
.pv-inner { position: absolute; top: 0; left: 0; width: 794px; transform-origin: 0 0; }
.opt-h { font-weight: 900; font-size: 14.5px; margin-bottom: 10px; color: var(--prd); }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.opt-grid.disabled { opacity: .45; pointer-events: none; }
.opt { border: 2px solid var(--line); border-radius: 12px; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; background: #fff; font-size: 12.5px; font-weight: 800; text-align: center; transition: .15s; }
.opt:hover { border-color: var(--gold); }
.opt.on { border-color: var(--pr); background: var(--prl); color: var(--prd); box-shadow: 0 0 0 3px rgba(0,104,83,.1); }
.opt.sw i { width: 36px; height: 36px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.tpl-opt img { width: 100%; height: 110px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); }
.tpl-ph { width: 100%; height: 110px; border-radius: 7px; background: repeating-linear-gradient(45deg, #F1F4F3, #F1F4F3 8px, #E8EDEB 8px, #E8EDEB 16px); display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 24px; }
.tpl-ph.built { background: linear-gradient(135deg, var(--pr), var(--prd)); color: var(--gold); }
.opt.soon { opacity: .6; cursor: default; }
.opt.soon small { color: var(--mut); font-size: 10.5px; }
.cv-ic { width: 46px; height: 60px; border-radius: 4px; background: #fff; border: 1px solid #ddd; position: relative; overflow: hidden; display: block; }
.cv-royal:before { content: ''; position: absolute; top: 4px; left: 4px; right: 4px; bottom: 4px; border: 2px solid var(--a); }
.cv-royal:after { content: ''; position: absolute; top: 24px; left: 12px; right: 12px; height: 5px; background: var(--p); }
.cv-pencils:before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 14px; background: var(--p); }
.cv-pencils:after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 12px; background: repeating-linear-gradient(90deg, #E63946 0 6px, #F4A261 6px 12px, #2A9D8F 12px 18px, #9B5DE5 18px 24px); }
.cv-geometric:before { content: ''; position: absolute; top: -10px; left: -10px; width: 30px; height: 30px; border-radius: 50%; background: var(--p); opacity: .5; }
.cv-geometric:after { content: ''; position: absolute; bottom: -8px; right: -8px; width: 22px; height: 22px; background: var(--a); transform: rotate(30deg); }
.cv-waves:before { content: ''; position: absolute; top: 0; left: -10px; right: -10px; height: 22px; background: var(--p); border-radius: 0 0 50% 50%; }
.cv-waves:after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 6px; background: var(--a); }
.cv-islamic:before, .cv-islamic:after { content: ''; position: absolute; left: 0; right: 0; height: 9px; background: repeating-linear-gradient(45deg, var(--p) 0 3px, var(--a) 3px 5px); }
.cv-islamic:before { top: 0; } .cv-islamic:after { bottom: 0; }
.cv-minimal:before { content: ''; position: absolute; top: 20px; left: 10px; right: 10px; height: 3px; background: var(--p); }
.cv-minimal:after { content: ''; position: absolute; top: 28px; left: 16px; right: 16px; height: 2px; background: var(--a); }
.logo-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.logo-row small { font-size: 11.5px; color: var(--mut); display: block; margin-bottom: 5px; }

/* ---------- المراجعة والتصدير ---------- */
.review { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; align-items: start; }
.check { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.check button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; text-align: start; font-size: 13.5px; font-weight: 700; }
.check button:hover { background: var(--soft); }
.check i { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-style: normal; font-weight: 900; font-size: 13px; flex-shrink: 0; }
.check .ok i { background: #DCF5E6; color: #146C3A; }
.check .no i { background: #FDF0DA; color: #A96A06; }
.check .no span { color: #6B4A0B; }
.export-card { position: sticky; top: calc(var(--top) + 12px); }
.ex-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.exs { background: var(--prl); border-radius: 12px; padding: 12px 6px; text-align: center; }
.exs b { display: block; font-size: 22px; font-weight: 900; color: var(--prd); }
.exs small { font-size: 11.5px; color: var(--mut); font-weight: 700; }
.ex-actions { display: flex; flex-direction: column; gap: 8px; }
.acc-line { margin-top: 14px; font-size: 13px; background: #F7F9F8; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }

/* ---------- النوافذ ---------- */
.modal { position: fixed; inset: 0; z-index: 200; background: rgba(8, 20, 16, .55); display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; opacity: 0; transition: opacity .2s; }
.modal.show { opacity: 1; }
.modal-card { background: var(--card); color: var(--ink); width: 100%; max-width: 640px; border-radius: 20px; padding: 24px 22px; position: relative; box-shadow: 0 30px 80px rgba(0,0,0,.3); margin: auto; animation: pop .22s ease; }
.modal-card.narrow { max-width: 440px; }
.modal-card.wide { max-width: 860px; }
@keyframes pop { from { transform: translateY(14px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-x { position: absolute; top: 12px; left: 12px; width: 36px; height: 36px; border-radius: 50%; background: #F1F4F3; display: flex; align-items: center; justify-content: center; z-index: 2; }
.modal-x:hover { background: #FDE7EA; color: var(--danger); }
.modal-x.static { position: static; }
.m-title { font-size: 20px; font-weight: 900; color: var(--prd); }
.m-sub { font-size: 13.5px; color: var(--mut); margin: 4px 0 16px; }
.dialog h3 { font-size: 18px; font-weight: 900; margin-bottom: 6px; }
.dialog p { font-size: 14px; color: var(--mut); margin-bottom: 12px; }
.dialog input { margin-bottom: 14px; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
.modal.full { padding: 0; }
.modal-card.full { max-width: none; min-height: 100%; border-radius: 0; padding: 0; background: #DDE4E1; animation: none; }
.full-bar { position: sticky; top: 0; z-index: 3; background: var(--card); display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.full-bar span { color: var(--mut); font-size: 13px; margin-inline-end: auto; }
.full-pages { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 18px 12px 40px; }

.login-hero { text-align: center; margin: 6px 0 16px; }
.login-hero img { width: 64px; height: 64px; object-fit: contain; margin: 0 auto 8px; }
.login-hero h3 { font-size: 20px; font-weight: 900; }
.login-hero p { font-size: 13.5px; color: var(--mut); margin-top: 4px; }
.gsi-slot { display: flex; justify-content: center; min-height: 46px; }
.gsi-fallback { background: #FDF0DA; color: #7A5208; font-size: 13px; padding: 10px; border-radius: 10px; text-align: center; }
.perks { list-style: none; margin-top: 18px; display: flex; flex-direction: column; gap: 7px; font-size: 13px; background: #F6F9F8; border-radius: 12px; padding: 12px 14px; }

/* الملف الشخصي */
.pf-head { display: flex; align-items: center; gap: 14px; padding-bottom: 14px; margin-bottom: 4px; }
.pf-head img, .av-ph.big { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 3px solid var(--gold); }
.av-ph.big { background: var(--prl); }
.pf-head div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pf-head h3 { font-size: 19px; font-weight: 900; }
.pf-head span { font-size: 13px; color: var(--mut); overflow: hidden; text-overflow: ellipsis; text-align: end; }
.pf-head small { font-size: 11.5px; color: var(--mut); }
.pf-out { margin-inline-end: 34px; }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs button { padding: 10px 14px; font-weight: 800; font-size: 14px; color: var(--mut); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; position: relative; }
.tabs button.on { color: var(--pr); border-bottom-color: var(--pr); }
.badge { display: inline-flex; min-width: 18px; height: 18px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 11px; font-style: normal; align-items: center; justify-content: center; padding: 0 5px; margin-inline-start: 4px; }
.bal-card { background: linear-gradient(135deg, var(--prd), var(--pr)); color: #fff; border-radius: 18px; padding: 18px 20px; display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; align-items: center; }
.bal-card.empty { background: linear-gradient(135deg, #5B6770, #3E4850); }
.bal-card small { opacity: .8; font-size: 12px; display: block; }
.bal-card b { font-size: 18px; font-weight: 900; }
.bal-num { font-size: 40px; font-weight: 900; line-height: 1; text-align: center; color: var(--gold); }
.bal-num small { font-size: 11.5px; color: #fff; opacity: .85; margin-top: 4px; }
.bal-bar { grid-column: 1 / -1; height: 8px; background: rgba(255,255,255,.2); border-radius: 10px; overflow: hidden; }
.bal-bar span { display: block; height: 100%; background: var(--gold); }
.bal-meta { grid-column: 1 / -1; }
.redeem { margin-top: 16px; background: #F6F9F8; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.redeem label { font-weight: 900; font-size: 14px; display: block; margin-bottom: 8px; }
.redeem-row { display: flex; gap: 8px; }
.redeem-row input { font-size: 20px; font-weight: 900; letter-spacing: 6px; text-align: center; text-transform: uppercase; }
.packages { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.pkg { border: 2px solid var(--line); border-radius: 16px; padding: 16px 14px; display: flex; flex-direction: column; gap: 8px; position: relative; background: #fff; }
.pkg.hl { border-color: var(--gold); background: linear-gradient(180deg, #FFFBEF, #fff); }
.pkg-badge { position: absolute; top: -11px; right: 50%; transform: translateX(50%); background: var(--gold); font-size: 11px; font-weight: 900; padding: 3px 12px; border-radius: 20px; white-space: nowrap; }
.pkg-name { font-size: 15px; font-weight: 900; color: var(--prd); }
.pkg-price { font-size: 26px; font-weight: 900; }
.pkg-price small { font-size: 13px; color: var(--mut); }
.pkg ul { list-style: none; font-size: 12.5px; color: var(--mut); flex: 1; }
.pkg li:before { content: '✓ '; color: var(--pr); font-weight: 900; }
.packages.compact .pkg { padding: 12px; }
.packages.compact .pkg-price { font-size: 21px; }
.pkg-cta { text-align: center; margin-top: 16px; }
.packages.two { grid-template-columns: repeat(auto-fit, minmax(240px, 380px)); justify-content: center; }
.office-sec { margin-top: 22px; padding-top: 18px; border-top: 2px dashed var(--line); }
.m-title.sm { font-size: 17px; }
.office-note { margin-top: 12px; background: #EEF4FF; border: 1px solid #C8D8F5; color: #1E3A6B; border-radius: 12px; padding: 10px 14px; font-size: 13px; }
.drafts-search { flex: 1 1 100%; margin-top: 4px; }
.draft[hidden] { display: none !important; }
.hist { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.hist li { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 8px 10px; background: #F7F9F8; border-radius: 9px; }
.hist em { font-style: normal; color: var(--mut); font-size: 12px; white-space: nowrap; }
.drafts-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.drafts { display: flex; flex-direction: column; gap: 8px; }
.draft { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.draft.current { border-color: var(--pr); background: var(--prl); }
.dr-info { display: flex; flex-direction: column; min-width: 0; }
.dr-info b { font-size: 14.5px; }
.dr-info small { color: var(--mut); font-size: 12px; }
.dr-info em { color: var(--pr); font-style: normal; font-weight: 800; }
.dr-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.loading { text-align: center; padding: 30px; color: var(--mut); }
.invite-hero { display: flex; gap: 14px; background: linear-gradient(135deg, #FFF6DB, #FFFDF4); border: 1px solid #F1D98A; border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.ih-emoji { font-size: 38px; }
.invite-hero b { font-size: 15.5px; }
.invite-hero p { font-size: 13px; color: #5E4B12; margin-top: 4px; }
.ref-box { display: flex; gap: 8px; margin-bottom: 10px; }
.ref-box input { font-size: 13px; }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.ref-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ref-stats div { background: var(--prl); border-radius: 12px; padding: 14px; text-align: center; }
.ref-stats b { display: block; font-size: 26px; font-weight: 900; color: var(--prd); }
.ref-stats small { font-size: 12px; color: var(--mut); }
.notes { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.notes li { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.notes li.unread { border-color: var(--gold); background: #FFFBEF; }
.notes li.t-referral_reward { border-inline-start: 4px solid var(--gold); }
.notes p { font-size: 13.5px; }
.notes small { color: var(--mut); font-size: 11.5px; }
.ex-confirm { text-align: center; }
.ex-ic { font-size: 44px; }
.ex-confirm h3 { font-size: 19px; font-weight: 900; margin: 4px 0 8px; }
.ex-confirm p { margin-bottom: 6px; }
.ex-confirm .dlg-actions { justify-content: center; margin-top: 14px; }
.ex-progress { text-align: center; padding: 10px 0; }
.ex-progress h3 { font-size: 18px; font-weight: 900; margin: 12px 0 4px; }
.ex-progress p { color: var(--mut); font-size: 13.5px; margin-bottom: 12px; }
.ex-progress .bar { height: 10px; background: #EEF2F0; border-radius: 10px; overflow: hidden; }
.ex-progress .bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--pr)); transition: width .3s; }
.spinner { width: 46px; height: 46px; border: 4px solid var(--prl); border-top-color: var(--pr); border-radius: 50%; margin: 0 auto; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.about { text-align: center; }
.about img { width: 70px; height: 70px; object-fit: contain; margin: 0 auto 8px; }
.about h3 { font-size: 22px; font-weight: 900; color: var(--prd); margin-bottom: 10px; }
.about p { font-size: 14.5px; line-height: 1.95; margin-bottom: 12px; text-align: justify; }
.about .lead { font-size: 16px; font-weight: 800; color: var(--prd); text-align: center; }
.about-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; text-align: start; }
.about-grid div { background: #F6F9F8; border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.about-grid b { font-size: 14.5px; color: var(--prd); }
.about-grid span { font-size: 12.5px; color: var(--mut); line-height: 1.7; }
.about .muted { text-align: center; }
.support-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
#supportDirect a { font-size: 13px; font-weight: 800; text-decoration: none; margin-inline-end: 10px; }

/* ---------- التذييل ---------- */
.site-footer { background: #0B1F19; color: #C7D3CE; margin-top: 30px; }
.sf-in { max-width: 1180px; margin: 0 auto; padding: 22px 16px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.sf-brand { display: flex; align-items: center; gap: 10px; }
.sf-brand img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: #fff; padding: 3px; }
.sf-brand div { display: flex; flex-direction: column; line-height: 1.3; }
.sf-brand b { color: #fff; font-size: 15px; }
.sf-brand small { font-size: 12px; opacity: .75; }
.sf-links { display: flex; gap: 4px 16px; flex-wrap: wrap; }
.sf-links button, .sf-links a { color: #C7D3CE; font-size: 13px; font-weight: 700; text-decoration: none; }
.sf-links button:hover, .sf-links a:hover { color: var(--gold); }
.sf-bottom { border-top: 1px solid rgba(255,255,255,.08); text-align: center; font-size: 11.5px; opacity: .7; padding: 12px 16px 18px; }

/* ---------- التنبيهات ---------- */
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(92vw, 440px); pointer-events: none; }
.toast { background: #10231D; color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 13.5px; font-weight: 700; box-shadow: 0 10px 30px rgba(0,0,0,.25); pointer-events: auto; animation: tin .3s ease; border-inline-start: 4px solid #2E9E62; width: 100%; }
.toast.err { border-inline-start-color: #E5484D; background: #3A1116; }
.toast.info { border-inline-start-color: #5B9BD5; }
.toast.gold { border-inline-start-color: var(--gold); background: #2B230A; }
.toast.out { opacity: 0; transform: translateY(10px); transition: .3s; }
@keyframes tin { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- مسرح التصدير والطباعة ---------- */
#exportStage { position: fixed; left: -12000px; top: 0; width: 794px; pointer-events: none; }
#printRoot { display: none; }
@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff !important; display: block; }
  body > *:not(#printRoot) { display: none !important; }
  #printRoot { display: block !important; }
  #printRoot .pg { page-break-after: always; break-after: page; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-block { padding: 80px 40px; text-align: center; font-family: var(--font); }
}

/* ---------- الجوال ---------- */
@media (max-width: 980px) {
  .studio { grid-template-columns: 1fr; }
  .studio-preview { position: static; order: -1; }
  .review { grid-template-columns: 1fr; }
  .export-card { position: static; }
}
@media (max-width: 680px) {
  :root { --top: 58px; }
  .app { padding: 10px 10px 30px; }
  .brand small { display: none; }
  .brand b { font-size: 15.5px; }
  .brand img { width: 34px; height: 34px; }
  #btnLoginTop span { display: none; }
  #btnLoginTop { padding: 8px 10px; }
  .uc-text { display: none; }
  .user-chip { padding: 3px 3px 3px 8px; }
  .save-chip { display: none; }
  .card { padding: 14px; border-radius: 12px; }
  .grid, .grid.three { grid-template-columns: 1fr; }
  .grid.three { grid-template-columns: 1fr 1fr; }
  .span2 { grid-column: auto; }
  .doc-bar-actions { width: 100%; }
  .doc-bar-actions .btn { flex: 1; }
  .st-btn { min-width: 86px; padding: 9px 8px; font-size: 12.5px; flex-direction: column; gap: 1px; }
  .card-h.row { flex-direction: column; }
  .el-title b { font-size: 14px; }
  .el-badge { font-size: 10.5px; padding: 3px 8px; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .packages, .packages.two { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; }
  .modal { padding: 0; align-items: flex-end; }
  .modal-card { border-radius: 20px 20px 0 0; max-height: 94vh; overflow-y: auto; padding: 20px 16px 26px; }
  .modal-card.full { max-height: none; border-radius: 0; }
  .pf-head { flex-wrap: wrap; }
  .pf-out { order: 3; margin: 0; }
  .pf-head span { text-align: start; }
  .logo-row { grid-template-columns: 1fr; }
  .pane-nav .btn { flex: 1; }
  .ref-box { flex-direction: column; }
  .sf-in { flex-direction: column; text-align: center; }
  .sf-links { justify-content: center; }
  .redeem-row { flex-direction: column; }
}


/* ---------- إضافات 4.1 ---------- */
.mt12 { margin-top: 12px; }
.icon-btn.on { color: var(--gold); }
.card-h h2 { position: relative; }
.pane > .card:first-child .card-h h2:before, .x-card .card-h h2:before { content: none; }
.grid > .fg { background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.grid > .fg.span2 { background: var(--soft); }
.grid.three > .fg, .grid.tight > .fg, .row-item .fg { background: transparent; border: none; padding: 0; }
.grid > details { padding: 10px 14px; }
.st-btn { background: var(--card); }
.el-card, .thumb, .opt, .draft, .pkg, .seg button.on, .user-chip, .btn-ghost { background: var(--card); }
.row-item, .add-tile, .sig-pad, .redeem, .perks, .hist li, .acc-line, .about-grid div { background: var(--soft); }
.ref-hint { margin-top: 14px; background: #FFF6DB; border: 1px solid #F1D98A; color: #5E4B12; border-radius: 12px; padding: 10px 14px; font-size: 13px; }
.ref-hint.strong { margin: 12px 0 0; }
.share-card .share-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.appr-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.appr-list li { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; background: var(--card); }
.appr-list li em { font-style: normal; font-weight: 800; font-size: 12px; margin-inline-start: auto; }
.appr-list li small { flex-basis: 100%; color: var(--mut); font-size: 12px; }
.appr-list li.st-approved { border-color: #BFE6CF; }
.appr-list li.st-returned { border-color: #F1C98A; }
.ok-box { background: #EEF9F2; border: 1px solid #BFE6CF; color: #145C35; border-radius: 12px; padding: 12px 14px; font-size: 13px; margin: 12px 0; line-height: 1.9; }
.ok-box .share-row { margin: 8px 0 0; }
.dlg-actions.wrap { flex-wrap: wrap; justify-content: center; }
.share-box { text-align: center; }
.share-qr { width: 200px; height: 200px; margin: 6px auto 14px; display: block; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: #fff; }
.center-row { justify-content: center; }
.review-layout { display: grid; grid-template-columns: 1fr 340px; align-items: start; }
.rev-panel { position: sticky; top: 56px; padding: 18px 16px; }
.rev-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--sh); }
.rev-card h3 { font-size: 17px; font-weight: 900; color: var(--prd); margin-bottom: 6px; }
.rev-card #revSig { width: 100%; height: 150px; background: #fff; border-radius: 8px; touch-action: none; display: block; box-shadow: inset 0 0 0 1px var(--line); }
.rev-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.view-empty { background: var(--card); border-radius: 16px; padding: 40px 24px; text-align: center; font-weight: 800; max-width: 460px; }
.full-bar .btn { margin-inline-start: auto; }

/* ---------- الوضع الليلي ---------- */
html[data-ui="dark"] {
  --pr: #2BB08A; --prd: #7FD8BC; --prl: #16322A; --gold: #D8B23E; --goldd: #E3C466;
  --bg: #121615; --bg2: #0E1211; --card: #1A201E; --ink: #E7ECE9; --mut: #9AA8A2; --line: #2A3431; --danger: #F0617A;
  --field: #111614; --field-line: #34413C; --top-bg: rgba(20, 26, 24, .94); --soft: #161C1A;
  --sh: 0 8px 26px rgba(0, 0, 0, .35);
}
html[data-ui="dark"] body { background: var(--bg); }
html[data-ui="dark"] .btn-primary { color: #06140F; }
html[data-ui="dark"] .st-btn.on { color: #06140F; }
html[data-ui="dark"] .seg { background: #0E1311; }
html[data-ui="dark"] .guide { background: #122A21; border-color: #1F4536; color: #9BE0C4; }
html[data-ui="dark"] .el-badge.ok, html[data-ui="dark"] .check .ok i { background: #173A2A; color: #8FE3B6; }
html[data-ui="dark"] .el-badge.wait, html[data-ui="dark"] .check .no i { background: #3A2E12; color: #F0C76A; }
html[data-ui="dark"] .invite-banner, html[data-ui="dark"] .invite-hero, html[data-ui="dark"] .ref-hint, html[data-ui="dark"] .pkg.hl { background: #2A2410; border-color: #4D4218; color: #F1DC9A; }
html[data-ui="dark"] .invite-hero p { color: #E3D39B; }
html[data-ui="dark"] .ok-box { background: #12291E; border-color: #1F4A35; color: #9BE0C4; }
html[data-ui="dark"] .office-note { background: #142033; border-color: #243852; color: #A9C4EE; }
html[data-ui="dark"] .th-tools button { background: #2A3431; color: #E7ECE9; }
html[data-ui="dark"] .modal-x { background: #242C29; color: var(--ink); }
html[data-ui="dark"] .modal-card.full { background: #0B0F0E; }
html[data-ui="dark"] .studio-preview { background: #0E1311; }
html[data-ui="dark"] .grid-table th { background: #16322A; }
html[data-ui="dark"] .save-chip { background: #222A27; }
html[data-ui="dark"] .save-chip.cloud { background: #173A2A; color: #8FE3B6; }
html[data-ui="dark"] .save-chip.sync { background: #3A2E12; color: #F0C76A; }
html[data-ui="dark"] .bal-card.empty { background: linear-gradient(135deg, #2B3135, #1C2124); }
html[data-ui="dark"] .notes li.unread { background: #2A2410; }
html[data-ui="dark"] .tpl-ph { background: repeating-linear-gradient(45deg, #1C2321, #1C2321 8px, #181E1C 8px, #181E1C 16px); }
html[data-ui="dark"] #toasts .toast { box-shadow: 0 10px 30px rgba(0,0,0,.5); }

@media (max-width: 980px) {
  .review-layout { grid-template-columns: 1fr; }
  .rev-panel { position: static; order: -1; }
}
@media (max-width: 680px) {
  .save-chip { display: inline-block; font-size: 10px; padding: 4px 7px; max-width: 92px; overflow: hidden; text-overflow: ellipsis; }
  .grid > .fg { padding: 9px 10px; }
  #btnTheme { width: 36px; height: 36px; }
}

#mDialog { z-index: 320; }
#mShare, #mRequest { z-index: 260; }
.full-bar { flex-wrap: wrap; }
@media (max-width: 680px) { .full-bar b { font-size: 14.5px; } .full-bar span { font-size: 11.5px; } .full-bar .btn { font-size: 12px; padding: 6px 10px; } }

.btn-admin { background: #10231D; color: #F1DC9A; border-color: #10231D; }
.btn-admin:hover { background: #000; }
.drawer-nav .admin-link { background: #10231D; color: #F1DC9A; margin: 6px 0; }
.drawer-nav .admin-link:hover { background: #000; color: #F1DC9A; }
html[data-ui="dark"] .btn-admin, html[data-ui="dark"] .drawer-nav .admin-link { background: #2A2410; border-color: #4D4218; }
@media (max-width: 680px) { #btnAdmin span { display: none; } #btnAdmin { padding: 7px 9px; } }

/* ---------- 4.2: مصغّرات التصميم ---------- */
.opt-h small { font-size: 11.5px; color: var(--mut); font-weight: 700; }
.opt-grid.thumbs { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.opt-grid.thumbs.frames { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.opt.big { padding: 8px 6px 8px; gap: 6px; }
.thumb-slot { display: block; }
.thumb-box { display: block; position: relative; overflow: hidden; border-radius: 6px; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.12); pointer-events: none; }
.thumb-box.page { width: 104px; height: 147px; }
.thumb-box.page .thumb-scale { position: absolute; top: 0; left: 0; width: 794px; transform: scale(.131); transform-origin: 0 0; }
.thumb-box.frame { width: 130px; height: 100px; }
.thumb-box.frame .thumb-scale { position: absolute; top: 0; left: 0; width: 260px; transform: scale(.5); transform-origin: 0 0; }
.thumb-slot:empty { width: 104px; height: 147px; border-radius: 6px; background: linear-gradient(90deg, var(--soft), var(--line), var(--soft)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.frames .thumb-slot:empty { width: 130px; height: 100px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.opt small { font-size: 11px; color: var(--mut); font-weight: 600; }
.warn-box { background: #FFF4E0; border: 1px solid #F1C98A; color: #7A4B06; border-radius: 10px; padding: 9px 12px; font-size: 12.5px; margin-top: 10px; }
html[data-ui="dark"] .warn-box { background: #33260F; border-color: #5C4518; color: #F3CF86; }

/* ---------- تسجيل الدخول ---------- */
.perks-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.perk { background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; text-align: start; }
.perk i { font-style: normal; font-size: 20px; }
.perk b { font-size: 13.5px; color: var(--prd); }
.perk span { font-size: 11.5px; color: var(--mut); line-height: 1.6; }
.login-note { font-size: 11.5px; color: var(--mut); text-align: center; margin-top: 12px; line-height: 1.7; }

/* ---------- زر المعاينة العائم ---------- */
.fab-preview { position: fixed; left: 16px; bottom: 20px; z-index: 70; width: 54px; height: 54px; border-radius: 50%; background: var(--pr); color: #fff; box-shadow: 0 10px 24px rgba(0,60,45,.35); display: flex; align-items: center; justify-content: center; transform: translateY(90px) scale(.8); opacity: 0; transition: .28s cubic-bezier(.2,.8,.3,1.2); }
.fab-preview .ic { width: 24px; height: 24px; }
.fab-preview.show { transform: none; opacity: 1; }
html[data-ui="dark"] .fab-preview { color: #06140F; }

/* ---------- شريط التثبيت ---------- */
.install-bar { position: fixed; top: 8px; left: 50%; transform: translate(-50%, -140%); z-index: 150; width: min(560px, calc(100vw - 16px)); background: var(--card); border: 1.5px solid var(--gold); border-radius: 16px; box-shadow: 0 16px 40px rgba(0,0,0,.2); display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 8px; transition: transform .35s ease; }
.install-bar.show { transform: translate(-50%, 0); }
.install-bar img { width: 44px; height: 44px; border-radius: 11px; flex-shrink: 0; }
.install-bar #installText { flex: 1; font-size: 13px; line-height: 1.6; }
.ios-share { display: inline-block; border: 1.5px solid currentColor; border-radius: 5px; padding: 0 4px; font-size: 11px; }

/* ---------- عدم الانزياح الأفقي على الجوال ---------- */
/* منع الانزياح الأفقي بدون تعطيل التصاق لوحة المعاينة (overflow على body يكسر sticky) */
html { overflow-x: hidden; }
@supports (overflow: clip) { html { overflow-x: clip; } }
body { max-width: 100%; }
.full-pages { overflow-x: hidden; }
.pv-viewer { max-width: 100%; overflow: hidden; }
#exportStage { position: fixed; left: 0; top: 0; width: 794px; z-index: -5; pointer-events: none; }
@media (max-width: 680px) {
  .opt-grid.thumbs { grid-template-columns: repeat(3, 1fr); }
  .opt-grid.thumbs.frames { grid-template-columns: repeat(2, 1fr); }
  .thumb-box.page { width: 92px; height: 130px; }
  .thumb-box.page .thumb-scale { transform: scale(.1159); }
  .thumb-slot:empty { width: 92px; height: 130px; }
  .perks-grid { gap: 6px; } .perk { padding: 8px 10px; } .perk span { font-size: 10.5px; } .perk i { font-size: 17px; }
}

/* ---------- المتاجر المعتمدة ---------- */
.stores-sec { margin-top: 22px; padding-top: 18px; border-top: 2px dashed var(--line); }
.stores { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.store { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 12px 14px; text-decoration: none; color: var(--ink); transition: .18s; }
.store:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: var(--sh); }
.st-logo { width: 54px; height: 54px; border-radius: 14px; background: var(--c); flex-shrink: 0; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.st-logo b { color: #fff; font-size: 24px; font-weight: 900; font-family: Arial, sans-serif; }
.st-logo img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; background: #fff; }
.st-info { flex: 1; display: flex; flex-direction: column; min-width: 0; line-height: 1.5; }
.st-info b { font-size: 15px; }
.st-info small { font-size: 12px; color: var(--mut); }
.st-info em { font-style: normal; font-size: 11.5px; color: var(--pr); font-weight: 700; text-align: end; }
.st-badge { display: inline-block; font-style: normal; font-size: 10.5px; font-weight: 800; background: #DCF5E6; color: #146C3A; padding: 1px 8px; border-radius: 10px; vertical-align: middle; }
.st-badge.partner { background: #EEF4FF; color: #1E3A6B; }
.st-go { font-size: 12.5px; font-weight: 800; color: var(--pr); white-space: nowrap; }
.store.compact { padding: 9px 12px; }
.store.compact .st-logo { width: 42px; height: 42px; border-radius: 11px; }
.store.compact .st-logo b { font-size: 19px; }
html[data-ui="dark"] .st-badge { background: #173A2A; color: #8FE3B6; }
html[data-ui="dark"] .st-badge.partner { background: #142033; color: #A9C4EE; }

/* ---------- إصلاح عرض الجوال: لا عنصر يدفع الصفحة أعرض من الشاشة ---------- */
.studio > *, .studio-opts, .studio-opts .card, .opt-grid > *, .pane, .grid2 > *, .grid3 > * { min-width: 0; }
.seg { flex-wrap: wrap; }
.seg button { min-width: 0; white-space: normal; line-height: 1.35; }
.thumb-box { overflow: hidden; }
@media (max-width: 980px) {
  .studio { grid-template-columns: minmax(0, 1fr); }
}
.thumb-slot { width: 100%; }
.thumb-box.page, .thumb-box.page:is(*) { width: 100%; max-width: 104px; height: auto; aspect-ratio: 794 / 1123; margin: 0 auto; }
.thumb-box.frame { width: 100%; max-width: 130px; height: auto; aspect-ratio: 130 / 100; margin: 0 auto; }
.thumb-slot:empty { width: 100%; max-width: 104px; height: auto; aspect-ratio: 794 / 1123; margin: 0 auto; }
.frames .thumb-slot:empty { max-width: 130px; aspect-ratio: 130 / 100; }
.opt.big { min-width: 0; }
@media (max-width: 680px) {
  .thumb-box.page, .thumb-slot:empty { width: 100%; height: auto; }
}
.pane-nav .btn { min-width: 0; white-space: normal; line-height: 1.35; text-align: center; }
@media (max-width: 680px) {
  .pane-nav .btn-ghost { flex: 0 0 auto; padding-inline: 14px; }
  .pane-nav .btn-primary { flex: 1 1 auto; }
}

/* ---------- 4.3: شريط علوي نظيف ومنظّم على الجوال ---------- */
.uc-av { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--pr); color: #fff; font-weight: 900; font-size: 15px; flex-shrink: 0; }
.uc-av[hidden] { display: none; }
.save-chip { cursor: default; }
@keyframes dotPulse { 50% { opacity: .35; } }
@media (max-width: 680px) {
  .topbar { gap: 4px; padding: 0 8px 0 10px; }
  .brand { gap: 7px; }
  .brand img { width: 32px; height: 32px; }
  .brand b { font-size: 16.5px; white-space: nowrap; }
  .brand small { display: none; }
  #btnTheme, #btnAdmin { display: none !important; }
  .top-actions { gap: 10px; align-items: center; }
  .save-chip { display: inline-block !important; font-size: 0 !important; width: 11px; height: 11px; min-width: 11px; padding: 0 !important; max-width: none !important; border-radius: 50%; background: #A7B2AD !important; cursor: pointer; box-shadow: 0 0 0 3px rgba(0,0,0,.04); }
  .save-chip[hidden] { display: none !important; }
  .save-chip.cloud { background: #22A55B !important; }
  .save-chip.sync { background: #E0A21B !important; animation: dotPulse 1s infinite; }
  .save-chip.err { background: var(--danger) !important; }
  .user-chip { padding: 0; border: none; background: none !important; overflow: visible; }
  .user-chip img, .user-chip .uc-av { width: 36px; height: 36px; box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px var(--line); }
  .uc-bal { position: absolute; bottom: -6px; left: -9px; padding: 1px 6px; font-size: 10.5px; line-height: 1.35; background: var(--pr) !important; color: #fff !important; border: 2px solid var(--card); border-radius: 12px; }
  .uc-bal span { display: none; }
  .user-chip .dot { top: -2px; right: -2px; }
}
/* القائمة الجانبية المغلقة: بلا ظل يظهر على حافة الشاشة ولا تُقرأ بلمس الشاشة */
.drawer { box-shadow: none; visibility: hidden; transition: transform .28s ease, visibility 0s linear .28s; }
.drawer.open { box-shadow: -10px 0 40px rgba(0,0,0,.15); visibility: visible; transition: transform .28s ease, visibility 0s; }
/* ---------- 4.3: قائمة ما بعد التصدير ---------- */
.ex-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.ex-menu .btn { width: 100%; justify-content: center; white-space: normal; min-width: 0; padding: 11px 10px; }
.ex-menu .btn .ic { width: 18px; height: 18px; flex-shrink: 0; }
.ex-menu .btn-primary { grid-column: 1 / -1; padding: 13px; font-size: 15px; }
.ex-menu .subtle { grid-column: 1 / -1; border-color: transparent; background: transparent; color: var(--mut); }
.free-note { background: #E8F7EE; color: #146C3A; border: 1px solid #BFE6CF; border-radius: 12px; padding: 10px 12px; font-size: 13.5px; margin: 8px 0; }
html[data-ui="dark"] .free-note { background: #173A2A; color: #8FE3B6; border-color: #24553D; }

.view-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.view-empty .ve-ic { font-size: 38px; }
.view-empty b { font-size: 17px; }
.view-empty p { color: var(--mut); font-size: 14px; max-width: 420px; line-height: 1.8; }
.view-empty .btn { margin-top: 6px; }

/* ---------- 4.3.1: شاشة معالجة التصدير معتمة وثابتة ---------- */
.modal.busy { background: var(--bg); backdrop-filter: none; }
html[data-ui="dark"] .modal.busy { background: #0E1311; }
.modal.busy .modal-x { display: none; }
.modal.busy .modal-card { box-shadow: 0 20px 60px rgba(80, 60, 20, .12); }
.ex-progress .bar + p { margin-top: 14px; }

/* ---------- 4.3.1: عرض اليوم الوطني ---------- */
.promo-bar { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; text-align: center; background: linear-gradient(90deg, #006C35, #0B8F4A); color: #fff; border-radius: 14px; padding: 10px 14px; margin: 0 0 14px; box-shadow: 0 8px 20px rgba(0, 108, 53, .2); }
.promo-bar b { font-size: 15.5px; }
.promo-bar span { font-size: 13px; opacity: .92; }
.pkg-promo { display: inline-block; align-self: flex-start; background: #E4F4EA; color: #006C35; border: 1px solid #B9E2C8; font-size: 11.5px; font-weight: 800; padding: 2px 10px; border-radius: 12px; margin: 2px 0 2px; }
.pkg-old { font-size: .55em; color: #B0443B; opacity: .85; font-weight: 800; margin-inline-end: 4px; text-decoration-thickness: 2px; }
.pkg-save { display: inline-block; align-self: flex-start; font-size: 12px; font-weight: 800; color: #146C3A; background: #E8F7EE; padding: 2px 10px; border-radius: 10px; margin-top: -4px; }
html[data-ui="dark"] .pkg-promo, html[data-ui="dark"] .pkg-save { background: #173A2A; color: #8FE3B6; border-color: #24553D; }

/* ---------- 4.3.2: ردود الدعم في حساب العميل ---------- */
.sup-thread { max-height: 300px; overflow-y: auto; margin: 4px 0 14px; padding: 10px; background: var(--soft); border: 1px solid var(--line); border-radius: 14px; }
.sup-h { font-weight: 900; font-size: 14px; margin-bottom: 8px; }
.sup-msg { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.sup-msg:last-child { border-bottom: 0; }
.sup-msg small { display: block; font-size: 11px; color: var(--mut); font-weight: 700; margin-bottom: 2px; }
.sup-me, .sup-rep { white-space: pre-wrap; font-size: 13.5px; line-height: 1.7; border-radius: 12px; padding: 8px 12px; max-width: 92%; }
.sup-me { background: var(--card); border: 1px solid var(--line); align-self: flex-start; }
.sup-rep { background: #E8F7EE; border: 1px solid #BFE6CF; align-self: flex-end; }
.sup-wait { font-size: 12px; color: var(--mut); align-self: flex-end; }
html[data-ui="dark"] .sup-rep { background: #173A2A; border-color: #24553D; }

/* ---------- 4.4: مؤشر رفع المرفقات ---------- */
.up-prog { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); opacity: 0; transition: .25s; z-index: 300; display: flex; align-items: center; gap: 12px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; box-shadow: 0 14px 40px rgba(0,0,0,.18); width: min(92vw, 380px); }
.up-prog.show { opacity: 1; transform: translate(-50%, 0); }
.up-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.up-t b { font-size: 14px; }
.up-t small { font-size: 12px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-t i { display: block; height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; }
.up-t i span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--pr)); transition: width .3s; }
.spinner.sm { width: 26px; height: 26px; border-width: 3px; flex-shrink: 0; }
.th-img { position: relative; }
.th-pdf { position: absolute; top: 4px; right: 4px; background: #B0443B; color: #fff; font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 6px; direction: ltr; }
.edit-note { background: #FFF4E0; color: #7A4B06; border: 1px solid #F1C98A; border-radius: 12px; padding: 10px 12px; font-size: 13.5px; margin: 10px 0; line-height: 1.7; }
html[data-ui="dark"] .edit-note { background: #3A2A10; color: #F5D28E; border-color: #6B4E1C; }

.save-chip.err { cursor: pointer; }
.save-help .sh-cloud { position: relative; font-size: 52px; line-height: 1; margin-bottom: 6px; }
.save-help .sh-cloud span { position: absolute; bottom: 2px; left: 50%; transform: translateX(6px); width: 22px; height: 22px; border-radius: 50%; background: var(--danger); color: #fff; font-size: 14px; font-weight: 900; display: flex; align-items: center; justify-content: center; border: 2px solid var(--card); }
.save-help .sh-why, .save-help .sh-fix { text-align: right; border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 1.75; margin: 6px 0; }
.save-help .sh-why { background: #FDECEC; color: #8A2A2A; }
.save-help .sh-fix { background: #E8F7EE; color: #146C3A; }
html[data-ui="dark"] .save-help .sh-why { background: #3A1A1A; color: #F2B6B6; }
html[data-ui="dark"] .save-help .sh-fix { background: #173A2A; color: #8FE3B6; }

/* ---------- 4.4: تبويبات الدعم ---------- */
.sup-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--soft); border: 1px solid var(--line); border-radius: 14px; padding: 5px; margin-bottom: 14px; }
.sup-tabs[hidden] { display: none; }
.sup-tabs button { border: 0; background: transparent; font: inherit; font-weight: 800; font-size: 14px; color: var(--mut); padding: 10px 6px; border-radius: 10px; cursor: pointer; position: relative; }
.sup-tabs button.on { background: var(--card); color: var(--pr); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.sup-tabs i { font-style: normal; display: inline-flex; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; align-items: center; justify-content: center; margin-inline-start: 4px; }
.sup-thread { max-height: min(60vh, 460px); margin: 0 0 8px; }
.sup-chat { display: flex; flex-direction: column; gap: 8px; }
.sup-new { display: block; margin: 12px auto 4px; }
.sup-thread .center { text-align: center; }

.live-badge { display: flex; align-items: center; justify-content: center; gap: 8px; width: fit-content; margin: 6px auto 0; font-size: 12.5px; font-weight: 700; color: var(--pr); background: var(--prl, #E7F3EF); border-radius: 20px; padding: 4px 14px; }
.live-badge[hidden] { display: none; }
.live-badge i { width: 8px; height: 8px; border-radius: 50%; background: #22A55B; box-shadow: 0 0 0 0 rgba(34,165,91,.5); animation: livePulse 1.8s infinite; }
@keyframes livePulse { 70% { box-shadow: 0 0 0 7px rgba(34,165,91,0); } 100% { box-shadow: 0 0 0 0 rgba(34,165,91,0); } }
.sup-me small, .sup-rep small { display: block; font-size: 11px; color: var(--mut); font-weight: 700; margin-bottom: 3px; }
.sup-chat .sup-wait { font-size: 12px; color: var(--mut); align-self: flex-end; }

/* شريط التحكم بملف PDF داخل معرض الشواهد */
.pdf-bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #FDF1EF; border: 1px solid #F0C9C2; border-radius: 12px; padding: 8px 10px; }
.pdf-bar .pb-t { flex: 1; min-width: 140px; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-bar .pb-t small { color: var(--mut); font-weight: 700; }
.pb-seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.pb-seg button { border: 0; background: transparent; font: inherit; font-size: 12.5px; font-weight: 800; color: var(--mut); padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.pb-seg button.on { background: var(--pr); color: #fff; }
.pb-del { border: 0; background: transparent; color: var(--danger); font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; padding: 6px 4px; }
html[data-ui="dark"] .pdf-bar { background: #2A1B19; border-color: #5A302A; }
html[data-ui="dark"] .pb-seg { background: #0E1311; }
.th-pdf { top: auto !important; bottom: 4px; }

/* 4.4.2: حالة «محفوظ على جهازك» هادئة، وشرحها بألوان معلوماتية لا تحذيرية */
.save-help .sh-cloud { font-size: 46px; }
.save-help .sh-why { background: #EEF4FF; color: #1E3A6B; }
html[data-ui="dark"] .save-help .sh-why { background: #142033; color: #A9C4EE; }
.save-chip.big { cursor: pointer; }

/* 4.4.3: عداد تصدير فوري */
.ex-progress .ex-pct { font-size: 40px; font-weight: 800; color: var(--pr); line-height: 1; margin: 6px 0 10px; font-variant-numeric: tabular-nums; }
.ex-progress .bar.live span { background-image: linear-gradient(90deg, var(--gold), var(--pr)), repeating-linear-gradient(45deg, rgba(255,255,255,.25) 0 8px, transparent 8px 16px); background-blend-mode: overlay; background-size: 100% 100%, 32px 32px; animation: barMove .8s linear infinite; transition: width .25s ease; }
@keyframes barMove { to { background-position: 0 0, 32px 0; } }

/* 4.5: مرفقات الدعم والتقييم */
.sup-attach { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; cursor: pointer; border: 1.5px dashed var(--line); border-radius: 12px; padding: 10px 12px; font-weight: 700; color: var(--pr); }
.sup-attach em { font-style: normal; font-size: 12.5px; color: #146C3A; }
.sup-imgbtn { display: block; border: 1px solid var(--line); background: var(--soft); border-radius: 10px; padding: 6px 10px; margin: 4px 0 6px; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--pr); cursor: pointer; }
.sup-rep.auto { background: #EEF4FF; border-color: #C9D8F0; }
.sup-rate { text-align: center; background: #FFF9EC; border: 1px solid #F1DDAE; border-radius: 14px; padding: 12px; margin-top: 10px; }
.sup-rate div { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.sup-rate button { font: inherit; font-weight: 800; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 16px; cursor: pointer; }
html[data-ui="dark"] .sup-rep.auto { background: #142033; border-color: #2A3E5C; }
html[data-ui="dark"] .sup-rate { background: #2A2412; border-color: #54451F; }

/* =====================================================================
   4.6: هوية لوحة الدعم على المنصة — شريط علوي أخضر بخط ذهبي وخلفية نعناعية
   ===================================================================== */
:root {
  --bg: #F3F7F5; --bg2: #E8F0EC; --card: #FFFFFF; --ink: #0F1B17; --mut: #5E6B66;
  --line: #E1E8E4; --soft: #F7FAF8; --field-line: #CFDCD6; --prl: #E4F2EC;
  --sh: 0 8px 26px rgba(0, 66, 50, .07);
}
body { background: var(--bg); }
.topbar { background: linear-gradient(135deg, var(--prd), var(--pr)); border-bottom: 4px solid var(--gold); backdrop-filter: none; color: #fff; box-shadow: 0 6px 20px rgba(0, 66, 50, .18); }
.topbar .brand, .topbar .brand b { color: #fff; }
.topbar .brand em { color: #F2CD55; }
.topbar .brand small { color: rgba(255, 255, 255, .72); }
.topbar .brand img { background: #fff; padding: 3px; }
.topbar .icon-btn { color: #fff; }
.topbar .icon-btn:hover { background: rgba(255, 255, 255, .14); }
.topbar .save-chip { background: rgba(255, 255, 255, .14); color: #fff; }
.topbar .save-chip.cloud { background: rgba(126, 231, 170, .2); color: #CFF7DF; }
.topbar .save-chip.sync { background: rgba(242, 205, 85, .22); color: #FCE9A8; }
.topbar .user-chip { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .28); color: #fff; }
.topbar .user-chip:hover { border-color: #F2CD55; }
.topbar .uc-text small { color: rgba(255, 255, 255, .7); }
.topbar .uc-text b { color: #fff; }
.topbar .uc-bal { background: #F2CD55; color: #2B2105; }
.topbar .btn-admin { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .28); }
/* على الجوال: رقم الرصيد وإطار الصورة يناسبان الخلفية الخضراء */
@media (max-width: 680px) {
  .topbar .uc-bal { background: #F2CD55 !important; color: #2B2105 !important; border-color: var(--pr); }
  .topbar .user-chip img, .topbar .user-chip .uc-av { box-shadow: 0 0 0 2px var(--pr), 0 0 0 3.5px rgba(255, 255, 255, .6); }
  .topbar .user-chip .uc-av { background: #F2CD55; color: #2B2105; }
  .topbar .save-chip { box-shadow: 0 0 0 3px rgba(255, 255, 255, .15); }
}
/* الوضع الليلي: نفس الهوية بدرجات أعمق */
html[data-ui="dark"] .topbar { background: linear-gradient(135deg, #062A21, #0B4436); border-bottom-color: #A8861F; }

/* ---------- 4.6: زر المساعدة العائم ولوحة الأسئلة الشائعة ---------- */
.help-fab { position: fixed; right: 16px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 75; display: flex; align-items: center; gap: 8px; border: 0; cursor: pointer; font: inherit; font-weight: 800; font-size: 14.5px; color: #fff; background: linear-gradient(135deg, var(--prd), var(--pr)); border: 2px solid var(--gold); border-radius: 30px; padding: 7px 16px 7px 7px; box-shadow: 0 10px 26px rgba(0, 66, 50, .35); transition: transform .2s; }
.help-fab:hover { transform: translateY(-2px); }
.help-fab .hf-q { width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: #1d1605; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 900; }
.help-fab[hidden] { display: none; }
.help-tip { position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); z-index: 76; width: min(270px, calc(100vw - 32px)); background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; padding: 12px 34px 12px 14px; box-shadow: 0 14px 34px rgba(0,0,0,.16); cursor: pointer; animation: tipIn .35s ease; }
.help-tip::after { content: ''; position: absolute; bottom: -8px; right: 30px; width: 14px; height: 14px; background: var(--card); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); transform: rotate(45deg); }
.help-tip b { display: block; font-size: 14.5px; } .help-tip span { font-size: 12.5px; color: var(--mut); }
.help-tip button { position: absolute; top: 6px; right: 8px; border: 0; background: transparent; color: var(--mut); cursor: pointer; font-size: 13px; }
.help-tip[hidden] { display: none; }
@keyframes tipIn { from { opacity: 0; transform: translateY(8px); } }
.help-mask { position: fixed; inset: 0; background: rgba(8, 20, 16, .45); z-index: 180; opacity: 0; pointer-events: none; transition: .25s; }
.help-mask.show { opacity: 1; pointer-events: auto; }
.help-panel { position: fixed; top: 0; bottom: 0; right: 0; width: min(420px, 100vw); z-index: 190; background: var(--bg); display: flex; flex-direction: column; transform: translateX(105%); visibility: hidden; transition: transform .3s ease, visibility 0s linear .3s; box-shadow: -12px 0 40px rgba(0,0,0,.18); }
.help-panel.open { transform: none; visibility: visible; transition: transform .3s ease, visibility 0s; }
.hp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 16px; color: #fff; background: linear-gradient(135deg, var(--prd), var(--pr)); border-bottom: 4px solid var(--gold); }
.hp-head b { display: block; font-size: 18px; } .hp-head small { color: rgba(255,255,255,.75); font-size: 12.5px; }
.hp-search { padding: 12px 14px 4px; }
.hp-search input { width: 100%; font: inherit; padding: 11px 14px; border: 1px solid var(--field-line); border-radius: 12px; background: var(--card); color: var(--ink); }
.hp-body { flex: 1; overflow-y: auto; padding: 8px 14px 14px; }
.hp-group h4 { font-size: 14px; margin: 14px 2px 8px; color: var(--prd); }
html[data-ui="dark"] .hp-group h4 { color: #8FE3B6; }
.hp-group details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 7px; overflow: hidden; }
.hp-group summary { list-style: none; cursor: pointer; padding: 12px 14px; font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.hp-group summary::-webkit-details-marker { display: none; }
.hp-group summary::after { content: '+'; font-size: 18px; font-weight: 800; color: var(--pr); flex-shrink: 0; transition: transform .2s; }
.hp-group details[open] summary::after { transform: rotate(45deg); }
.hp-group details[open] summary { color: var(--pr); }
.hp-group details p { padding: 0 14px 13px; color: var(--mut); font-size: 13.5px; line-height: 1.85; }
.hp-none { text-align: center; color: var(--mut); padding: 30px 10px; line-height: 2; }
.hp-foot { padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--card); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hp-foot p { width: 100%; font-weight: 800; font-size: 13.5px; color: var(--mut); }
.hp-foot .btn-primary { flex: 1; }
@media (max-width: 680px) {
  .help-fab { padding: 6px; } .help-fab .hf-t { display: none; }
  .help-fab .hf-q { width: 40px; height: 40px; }
}
/* مساحة أسفل المحتوى حتى لا يغطي زر المساعدة أزرار «التالي/السابق» */
main.app, .app { padding-bottom: 96px; }

/* رابط المكتبة المجانية في القائمة الجانبية */
.drawer .drawer-link { display: flex; align-items: center; gap: 10px; padding: 11px 14px; margin: 4px 10px; border-radius: 12px; font-weight: 800; font-size: 14.5px; text-decoration: none; color: var(--prd); background: linear-gradient(135deg, #E4F2EC, #FFF9E6); border: 1px solid #CFE6DC; }
.drawer .drawer-link .dl-ic { font-size: 18px; }
.drawer .drawer-link em { font-style: normal; margin-inline-start: auto; font-size: 11px; background: var(--gold); color: #1d1605; padding: 1px 8px; border-radius: 8px; }
html[data-ui="dark"] .drawer .drawer-link { background: #10261E; border-color: #24553D; color: #9FE0BE; }

/* =====================================================================
   4.13: خانات أخف وأيقونات موحّدة وتفاصيل تجربة الاستخدام
   ===================================================================== */
/* (1) الخانات بدون لوحات حولها: عنوان فوق الخانة مباشرة */
.grid > .fg, .grid > .fg.span2 { background: transparent; border: none; padding: 0; border-radius: 0; }
.grid { row-gap: 16px; }
.fg > label, .fg > .lbl { margin-bottom: 6px; }
.fg input, .fg select, .fg textarea { background: var(--card); }
.fg input:focus, .fg select:focus, .fg textarea:focus { border-color: var(--pr); box-shadow: 0 0 0 3px rgba(0, 104, 83, .12); outline: none; }
/* (2) أيقونات شريط الخطوات */
.st-btn i { display: inline-flex; align-items: center; justify-content: center; }
.st-btn i svg { display: block; }
/* (7) شريط التقدم */
.pg-tip { color: #8A5A00; font-weight: 700; } .pg-tip.ok { color: #146C3A; }
.pg-go { border: 0; background: var(--pr); color: #fff; font: inherit; font-size: 12px; font-weight: 800; border-radius: 9px; padding: 3px 10px; cursor: pointer; margin-inline-start: 6px; }
/* (8) حالة الفراغ في الشواهد */
.gal-empty { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 3px; background: var(--prl, #E4F2EC); border: 1px dashed #BFD9CE; border-radius: 12px; padding: 10px 12px; font-size: 13px; color: var(--mut); line-height: 1.7; }
.gal-empty b { color: var(--prd); font-size: 13.5px; }
html[data-ui="dark"] .gal-empty { background: #10261E; border-color: #24553D; }
/* (9) رسالة التراجع */
.toast.undo { display: flex; align-items: center; gap: 12px; }
.toast.undo button { border: 0; background: rgba(255,255,255,.18); color: inherit; font: inherit; font-weight: 800; border-radius: 8px; padding: 4px 10px; cursor: pointer; white-space: nowrap; }

/* (3) قائمة الحساب على الكمبيوتر: الإدارة والوضع الليلي داخلها بدل الشريط */
@media (min-width: 681px) {
  #btnTheme, #btnAdmin { display: none !important; }
  .top-actions { position: relative; }
}
.acc-menu { position: absolute; top: calc(100% + 10px); left: 0; z-index: 120; width: 260px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 40px rgba(0, 40, 30, .2); padding: 6px; display: flex; flex-direction: column; animation: pop .18s ease; }
.acc-menu[hidden] { display: none; }
.acc-menu .am-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; gap: 2px; }
.acc-menu .am-head b { font-size: 15px; } .acc-menu .am-head small { color: var(--mut); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.acc-menu .am-bal { align-self: flex-start; margin-top: 6px; background: #F6ECCB; color: #6B5208; font-size: 12px; font-weight: 800; padding: 2px 10px; border-radius: 10px; }
.acc-menu button, .acc-menu a { text-align: start; border: 0; background: transparent; font: inherit; font-size: 14px; font-weight: 700; color: var(--ink); padding: 10px 12px; border-radius: 10px; cursor: pointer; text-decoration: none; }
.acc-menu button:hover, .acc-menu a:hover { background: var(--soft); }
.acc-menu .am-out { color: var(--danger); border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; margin-top: 4px; }

/* (5) الجولة الترحيبية */
.tour .tour-card { text-align: center; padding: 30px 24px 22px; }
.tour-ic { font-size: 54px; line-height: 1; margin-bottom: 10px; }
.tour-card h3 { font-size: 21px; margin-bottom: 8px; } .tour-card p { color: var(--mut); line-height: 1.9; font-size: 15px; }
.tour-dots { display: flex; justify-content: center; gap: 6px; margin: 18px 0; }
.tour-dots i { width: 8px; height: 8px; border-radius: 4px; background: var(--line); transition: .2s; } .tour-dots i.on { width: 22px; background: var(--pr); }
.tour-acts { display: flex; gap: 8px; } .tour-acts .btn { flex: 1; }
/* (6) التحقق الفوري */
.fv { display: block; min-height: 0; font-size: 12px; font-weight: 700; margin-top: 4px; }
.fv.ok { color: #146C3A; } .fv.bad { color: #B0443B; }
input.is-ok { border-color: #7CC49A !important; } input.is-bad { border-color: #E0908A !important; }
/* نص التقدم ينكسر على الشاشات الصغيرة بدل أن يدفع الصفحة للخارج */
.progress { flex-wrap: wrap; row-gap: 6px; }
#progressText { white-space: normal; min-width: 0; flex: 1 1 200px; line-height: 1.7; }

/* 4.15: قلم تعديل اسم الملف */
.dt-wrap { display: flex; align-items: center; gap: 6px; }
.dt-wrap input { border-bottom: 1.5px dashed transparent !important; transition: border-color .2s; }
.dt-wrap:hover input, .dt-wrap input:focus { border-bottom-color: var(--gold) !important; }
.dt-edit { flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--pr); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.dt-edit:hover { background: var(--prl, #E4F2EC); border-color: var(--pr); }
/* أيقونة المساعدة المرسومة */
.help-fab .hf-q svg { display: block; }
/* خلفيات الصفحات في خطوة التصميم */
.opt-grid.bgs { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); }
.bgopt i { display: block; width: 100%; aspect-ratio: 1 / 1.25; border-radius: 10px; border: 1px solid var(--line); margin-bottom: 4px; }
.bgopt.on i { box-shadow: 0 0 0 3px var(--pr); }
.free-design { background: linear-gradient(135deg, #E8F7EE, #FFF9E6); border: 1px solid #BFE6CF; color: #0F4A32; border-radius: 14px; padding: 11px 14px; font-size: 13.5px; line-height: 1.8; margin-bottom: 12px; }
html[data-ui="dark"] .free-design { background: #10261E; border-color: #24553D; color: #9FE0BE; }
/* ---------- 4.16 ---------- */
/* (17) النوافذ في التطبيق المثبّت: زر الإغلاق دائماً ظاهر أسفل شريط الحالة */
.modal { padding-top: calc(16px + env(safe-area-inset-top, 0px)); padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
.modal-x { position: sticky; top: 0; float: left; z-index: 5; background: var(--card); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
@media (display-mode: standalone) { .modal-card { margin-top: 8px; } }
/* (8) نافذة الحساب بحجم ثابت بين التبويبات */
#mProfile .modal-card { height: min(86vh, 760px); display: flex; flex-direction: column; overflow: hidden; }
#mProfile #pfTabs { flex-shrink: 0; }
#mProfile .modal-card > .pf-body, #mProfile .modal-card > [id^="pfPane"], #mProfile .pf-pane { flex: 1; min-height: 0; overflow-y: auto; }
/* (5) الميزة المجانية بعد التصدير */
.free-note.big { display: flex; flex-direction: column; gap: 4px; text-align: right; font-size: 14px; line-height: 1.8; border: 2px solid #7CC49A; background: linear-gradient(135deg, #E8F7EE, #F4FBF7); padding: 12px 14px; }
.free-note.big b:first-child { font-size: 15px; }
/* (15) قلم بجانب العنوان */
.doc-title .dt-wrap { justify-content: flex-start; }
.doc-title .dt-wrap input { flex: 0 1 auto; min-width: 8ch; max-width: 100%; }
/* (3) أزرار الإضافة ثابتة في بداية الشواهد */
.gallery .add-tile { order: -1; }
#mProfile .tab-pane { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 2px 8px; }
#mProfile .tab-pane[hidden] { display: none; }
#mProfile #pfTabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; background: var(--soft); border: 1px solid var(--line); border-radius: 14px; padding: 4px; margin-bottom: 12px; }
#mProfile #pfTabs button { flex: 1 0 auto; white-space: nowrap; border-radius: 10px; }
@media (max-width: 680px) { #mProfile .modal-card { height: 92vh; } }
/* ملفاتي: علامة التصدير ونافذة الاختيار */
.dr-exp { display: inline-block; font-size: 11px; font-weight: 800; background: #E8F7EE; color: #146C3A; padding: 1px 8px; border-radius: 8px; margin-inline-start: 6px; vertical-align: middle; }
.choose .ch-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; text-align: right; }
.ch-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; border: 1.5px solid var(--line); background: var(--card); border-radius: 14px; padding: 12px 14px; cursor: pointer; font: inherit; color: var(--ink); text-align: right; }
.ch-item:hover { border-color: var(--pr); background: var(--soft); }
.ch-item b { font-size: 15px; } .ch-item small { grid-column: 1; color: var(--mut); font-size: 12px; } .ch-item span { grid-row: 1 / 3; grid-column: 2; color: var(--pr); font-weight: 800; font-size: 13px; }
/* (13) قائمة جانبية مختصرة */
.drawer-nav { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px 16px; overflow-y: auto; }
.dn-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.dn-group small, .dn-more summary { font-size: 11.5px; font-weight: 800; color: var(--mut); padding: 6px 10px 2px; letter-spacing: .3px; }
.drawer-nav button, .drawer-nav .admin-link { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; border: 0; background: transparent; font: inherit; font-size: 14.5px; font-weight: 700; color: var(--ink); padding: 10px 12px; border-radius: 12px; cursor: pointer; text-decoration: none; }
.drawer-nav button:hover { background: var(--soft); }
.drawer-nav button .ic { width: 19px; height: 19px; color: var(--pr); flex-shrink: 0; }
.drawer-nav .danger, .drawer-nav .danger .ic { color: var(--danger); }
.dn-more { border-top: 1px solid var(--line); padding-top: 4px; }
.dn-more summary { cursor: pointer; list-style: none; padding: 8px 12px; font-size: 13px; }
.dn-more summary::after { content: ' ▾'; } .dn-more[open] summary::after { content: ' ▴'; }
.dn-legal { margin-top: 10px; text-align: center; color: var(--mut); font-size: 12px; }
.dn-legal button { display: inline; width: auto; padding: 2px 4px; font-size: 12px; font-weight: 700; color: var(--mut); text-decoration: underline; }
/* نافذة الشروط والخصوصية */
.legal-card { max-height: 88vh; overflow-y: auto; }
.legal-body { line-height: 1.95; font-size: 14.5px; }
.legal-body .lg-title { font-size: 21px; margin-bottom: 10px; color: var(--prd); }
.legal-body section { background: var(--soft); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; margin-bottom: 10px; }
.legal-body h2 { font-size: 16px; color: var(--pr); margin-bottom: 4px; }
.legal-body ul { padding-inline-start: 20px; } .legal-body li { margin: 3px 0; }
.legal-body .updated { color: var(--mut); font-size: 12.5px; text-align: center; }

/* (16) زر 💡 وشرح الميزات */
.tips-fab { position: fixed; right: 22px; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); z-index: 75; width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--gold); background: #FFF9E6; color: #8A6A10; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 8px 20px rgba(0,0,0,.18); }
.tips-fab:hover { background: #FFF1C6; }
@media (max-width: 680px) { .tips-fab { right: 18px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); width: 40px; height: 40px; } }
.tip-ov { position: fixed; inset: 0; z-index: 400; }
.tip-hole { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(8, 20, 16, .62); outline: 3px solid var(--gold); transition: all .25s ease; pointer-events: none; }
.tip-pop { position: fixed; background: var(--card); color: var(--ink); border-radius: 16px; padding: 14px 16px; box-shadow: 0 18px 40px rgba(0,0,0,.3); transition: top .25s, left .25s; }
.tip-pop small { color: var(--mut); font-size: 11.5px; font-weight: 700; } .tip-pop b { display: block; font-size: 16px; margin: 2px 0 4px; color: var(--prd); }
.tip-pop p { font-size: 13.5px; line-height: 1.8; color: var(--mut); }
.tip-acts { display: flex; gap: 6px; justify-content: flex-end; margin-top: 10px; }
.tip-acts button { border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 13px; font-weight: 800; border-radius: 10px; padding: 6px 12px; cursor: pointer; }
.tip-acts .pri { background: var(--pr); color: #fff; border-color: var(--pr); }
