:root {
  --red: #14224a;
  --red-dark: #0e1834;
  --navy: #0b1733;
  --navy-2: #081227;
  --gold: #c9a250;
  --danger: #cf111b;
  --danger-dark: #991b1b;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --soft: #f6f7f9;
  --paper-w: 210mm;
  --paper-h: 297mm;
  --radius: 18px;
  --font-arabic: 'Noto Sans Arabic','IBM Plex Sans Arabic','Cairo','Tajawal',Arial,sans-serif;
  --font-heading: 'Noto Kufi Arabic','Noto Sans Arabic','Cairo',Arial,sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: var(--font-arabic); background: #e8ecf2; color: var(--ink); }
body { display: grid; grid-template-columns: minmax(430px, 460px) 1fr; }
button, input, textarea, select { font-family: inherit; }

.builder-panel {
  position: sticky;
  top: 16px;
  height: calc(100vh - 32px);
  overflow-y: auto;
  overflow-x: hidden;
  background: #ffffff;
  border: 1px solid rgba(9, 45, 61, 0.08);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 8px 32px rgba(9, 45, 61, 0.12), 0 2px 8px rgba(9, 45, 61, 0.06);
  z-index: 20;
  margin: 16px 16px 16px 0;
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}
.builder-panel::-webkit-scrollbar { width: 4px; }
.builder-panel::-webkit-scrollbar-track { background: transparent; }
.builder-panel::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 99px; }

.brand-strip {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, #fefefe 0%, #f4f6f9 100%);
  border: 1px solid rgba(9, 45, 61, 0.09);
  border-top: 3px solid #c9a250;
  box-shadow: 0 2px 12px rgba(9, 45, 61, 0.06);
  margin-bottom: 2px;
}
.brand-strip h1 { font-size: 17px; margin: 0; font-weight: 900; color: var(--navy); line-height: 1.25; }
.brand-strip p { margin: 2px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.mini-logo {
  width: 44px; height: 44px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: #fff;
  border: 2px solid var(--red);
  box-shadow: 0 0 0 3px rgba(20,34,74,.1), 0 4px 12px rgba(20,34,74,.15);
  flex-shrink: 0;
}
.mini-logo img { width: 100%; height: 100%; object-fit: cover; }
.tool-actions { display: grid; gap: 7px; margin: 10px 0; }
.tool-actions .ta-row { display: grid; gap: 7px; }
.tool-actions .ta-row-top { grid-template-columns: 1fr auto; align-items: center; }
.tool-actions .ta-row-primary { grid-template-columns: repeat(3, 1fr); }
.tool-actions button { grid-column: auto; }
.tool-actions .primary { grid-column: auto; padding: 9px 10px; font-size: 13px; font-weight: 800; border-radius: 11px; }
.tool-actions .ta-row-primary button.primary { grid-column: auto; }
.more-tools-btn {
  background: var(--navy); border: 1px solid var(--navy-2); color: #fff;
  font-weight: 800; padding: 8px 14px; border-radius: 11px; font-size: 12.5px;
  transition: opacity .15s, transform .12s;
}
.more-tools-btn:hover { opacity: .88; transform: translateY(-1px); background: var(--navy); color: #fff; }
.more-tools-btn[aria-expanded="true"] { background: var(--navy-2); color: #c9a250; border-color: #c9a250; }
.ta-drawer {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border: 1px solid #e2e8f0; border-radius: 13px;
  box-shadow: inset 0 2px 6px rgba(9,45,61,.04);
}
.ta-drawer[hidden] { display: none; }
.ta-drawer .ghost-btn {
  background: #fff; border: 1px solid #e2e8f0; color: var(--navy);
  font-weight: 700; font-size: 12px; padding: 8px 6px; border-radius: 10px;
  text-align: center; transition: all .15s; line-height: 1.25;
}
.ta-drawer .ghost-btn:hover { border-color: var(--red); color: var(--red); background: #fff5f5; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(20,34,74,.1); }
.ta-drawer a.ghost-btn { text-decoration: none; display: block; }
.ta-drawer .logout-btn { border-color: rgba(20,34,74,.3); color: var(--danger); background: #fff5f5; }
.ta-drawer .logout-btn:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
button, .ghost-upload {
  border: 1px solid #d5dbe5;
  background: #fff;
  border-radius: 12px;
  padding: 11px 12px;
  cursor: pointer;
  font-weight: 800;
  color: var(--navy);
  text-align: center;
}
button:hover, .ghost-upload:hover { background: #f8fafc; }
button.primary { background: var(--red); color: #fff; border-color: var(--red); grid-column: 1 / -1; transition: opacity .15s, transform .12s, box-shadow .15s; box-shadow: 0 4px 12px rgba(20,34,74,.25); }
button.primary:hover { opacity: .92; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(20,34,74,.32); }
.ghost-upload input { display: none; }
.panel-tabs {
  display: flex; flex-wrap: wrap; gap: 5px; margin: 12px 0 14px;
  padding: 5px;
  background: #f1f5f9;
  border-radius: 14px;
  border: 1px solid #e8ecf1;
  box-shadow: inset 0 1px 4px rgba(9,45,61,.05);
}
.panel-tabs .tab {
  flex: 1 1 auto; min-width: max-content; padding: 8px 10px; font-size: 12.5px;
  border: 0; background: transparent; color: #64748b; font-weight: 700;
  border-radius: 9px; transition: all .15s; white-space: nowrap;
}
.panel-tabs .tab:hover { background: rgba(255,255,255,.8); color: var(--navy); }
.panel-tabs .tab.active {
  background: var(--navy); color: #fff; border-color: var(--navy);
  box-shadow: 0 3px 10px rgba(9,45,61,.22);
}

.form-grid { display: grid; gap: 14px; padding-bottom: 40px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-weight: 900; font-size: 13px; color: #334155; }
.field input, .field textarea, .field select {
  width: 100%; max-width: 100%; box-sizing: border-box; border: 1.5px solid #dde1e9; border-radius: 12px; padding: 11px 13px; background: #fdfdfe; color: #111827; outline: none; font-size: 14px; transition: border-color .15s, box-shadow .15s; text-overflow: ellipsis; }
.field textarea { min-height: 80px; resize: none; line-height: 1.85; overflow: hidden; word-wrap: break-word; overflow-wrap: break-word; white-space: pre-wrap; display: block; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(20,34,74, .09); background: #fff; }
.field input:hover:not(:focus), .field textarea:hover:not(:focus), .field select:hover:not(:focus) { border-color: #b8bfcb; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 540px) {
  .field-row { grid-template-columns: 1fr; }
}
.card-editor {
  border: 1px solid rgba(9,45,61,.08); border-radius: 16px; padding: 18px; background: #ffffff;
  display: grid; gap: 14px;
  box-shadow: 0 2px 8px rgba(9,45,61,.05);
  transition: box-shadow .15s;
}
.card-editor:focus-within { box-shadow: 0 4px 16px rgba(9,45,61,.09); }
.card-editor h3 { margin: 0 0 2px; font-size: 15.5px; color: var(--navy); font-weight: 800; letter-spacing: -.2px; }
.card-editor .danger { color: #fff; background: #991b1b; border-color: #991b1b; }
.hint { color: var(--muted); font-size: 12px; margin: -4px 0 0; }

/* ===== الكراسة الذكية (Smart Booklet) ===== */
.smart-wrap { display: grid; gap: 14px; }
.smart-head h2 { margin: 0 0 4px; color: var(--navy); font-size: 20px; }
.smart-sub { margin: 8px 0 2px; color: var(--navy); font-size: 14px; font-weight: 700; }
.smart-sep { display: flex; align-items: center; gap: 10px; margin: 4px 0; color: var(--red); font-weight: 800; font-size: 13px; }
.smart-sep::before, .smart-sep::after { content: ""; flex: 1; height: 2px; background: linear-gradient(90deg, transparent, var(--line), transparent); }
.smart-sep span { white-space: nowrap; padding: 2px 10px; background: rgba(20,34,74,.08); border-radius: 999px; }
.smart-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.smart-type-card { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 16px 10px; border: 2px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; transition: border-color .15s, transform .1s, box-shadow .15s; }
.smart-type-card:hover { border-color: var(--red); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(20,34,74,.1); }
.smart-type-card .emoji { font-size: 30px; }
.smart-type-card strong { color: var(--navy); font-size: 15px; }
.smart-type-card small { color: var(--muted); font-size: 12px; }
.smart-lib-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.smart-lib-card { display: flex; flex-direction: column; gap: 3px; text-align: right; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; transition: border-color .15s, background .15s; }
.smart-lib-card:hover { border-color: var(--navy); background: #f8fafc; }
.smart-lib-card.is-current { border-color: var(--red); background: rgba(20,34,74,.05); }
.smart-lib-card .slc-name { font-weight: 700; color: var(--navy); font-size: 13px; }
.smart-lib-card .slc-meta { color: var(--muted); font-size: 11px; }
.smart-lib-card .current-tag { background: var(--red); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 999px; }
.smart-edit-btn { background: var(--navy); color: #fff; border: none; border-radius: 10px; padding: 9px 16px; font-weight: 700; cursor: pointer; transition: opacity .15s; }
.smart-edit-btn:hover { opacity: .88; }
.smart-edit-row { display: flex; gap: 8px; flex-wrap: wrap; }
.smart-pagelist { margin: 4px 0 8px; padding-inline-start: 22px; display: grid; gap: 3px; color: var(--navy); font-size: 13px; }
.smart-pagelist li.is-hidden { color: var(--muted); }
.smart-pagelist .hidden-tag { color: var(--muted); font-size: 11px; }
.smart-actions { display: none; position: sticky; bottom: 0; padding: 10px 0 2px; background: linear-gradient(transparent, var(--bg, #fff) 40%); }
.smart-preview-btn { width: 100%; font-size: 16px; padding: 14px; }
@media (max-width: 640px) { .smart-type-grid, .smart-lib-grid { grid-template-columns: 1fr; } }

.preview-wrap {
  min-width: 0;
  padding: 24px 24px 24px 16px;
  background: #e8ecf2;
  min-height: 100vh;
}
.preview-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 auto 20px; max-width: 1050px; color: #334155;
  background: #fff; border-radius: 12px; padding: 10px 18px;
  border: 1px solid rgba(9,45,61,.07);
  box-shadow: 0 2px 8px rgba(9,45,61,.05);
}
.preview-toolbar strong { font-size: 14px; color: var(--navy); font-weight: 800; }
.preview-toolbar span { color: var(--muted); font-size: 12px; }
.document-preview { display: grid; gap: 30px; justify-content: center; }

.page {
  position: relative;
  width: var(--paper-w);
  min-height: var(--paper-h);
  height: var(--paper-h);
  background: #fff;
  color: var(--page-text, var(--ink));
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 18px 55px rgba(15, 23, 42, .16);
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.page .page-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}
.cover.cover-blank { background: #fff; }
.cover-blank-empty { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; text-align: center; padding: 20mm; color: #9ca3af; font-weight: 700; font-size: 16px; background: repeating-linear-gradient(45deg, #f8fafc, #f8fafc 14px, #f1f5f9 14px, #f1f5f9 28px); }
.content-layer { position: relative; z-index: 2; height: 100%; padding: 24mm 12mm 34mm; }
.header-logo {
  position: absolute; top: 7mm; left: 12mm; z-index: 3; display: flex; align-items: center; gap: 9px; direction: ltr; color: var(--navy);
}
.header-logo img { max-width: 28mm; max-height: 18mm; object-fit: contain; }
.logo-mark { width: 17mm; height: 17mm; border: 2px solid var(--red); border-radius: 50%; color: var(--red); display: grid; place-items: center; font-weight: 900; font-size: 13px; }
.logo-text { line-height: 1.3; font-weight: 900; font-size: 9px; white-space: nowrap; text-align: right; }
.logo-text small { display: block; font-weight: 700; color: #111; font-size: 7px; margin-top: 2px; line-height: 1.2; }
.footer-bar {
  position: absolute; z-index: 4; bottom: 3mm; left: 12mm; right: 12mm; height: 15mm;
  border-radius: 10px; background: rgba(255,255,255,.95); display: grid; grid-template-columns: 1.1fr 1.05fr 1.25fr; align-items: center; box-shadow: 0 4px 14px rgba(15,23,42,.13); border: 1px solid rgba(15,23,42,.08); overflow: hidden;
}
.footer-item { display: flex; align-items: center; justify-content: center; gap: 7px; height: 100%; font-weight: 900; font-size: 11px; color: var(--red); }
.footer-item + .footer-item { border-right: 1px solid #555; }
.footer-item .ico { width: 8mm; height: 8mm; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-size: 14px; }
.footer-item.black { color: #111; direction: ltr; }
.footer-item .foot-logo { width: 9mm; height: 9mm; border: 2px solid var(--red); border-radius: 50%; color: var(--red); display: grid; place-items: center; font-size: 8px; font-weight: 900; }
.page-number { font-size: 11px; font-weight: 800; color: var(--navy); letter-spacing: 1px; direction: ltr; margin-left: 8px; white-space: nowrap; }
.page-number-float { position: absolute; z-index: 4; bottom: 19mm; left: 0; right: 0; text-align: center; pointer-events: none; }

.title-pill {
  margin: 6mm 0 7mm auto;
  width: 180mm; min-height: 16mm; padding: 8px 22px; box-sizing: border-box;
  border-radius: 18px; background: var(--title-bg, var(--red)); color: var(--title-color, #fff);
  display: flex; align-items: center; justify-content: center; gap: 12px;
  font-weight: 900; font-size: var(--title-size, 28px); line-height: 1.3;
  font-family: var(--title-font, 'Tajawal', sans-serif);
  text-align: center; word-wrap: break-word; overflow-wrap: break-word;
  box-shadow: 0 10px 20px rgba(20,34,74, .18);
}
.title-pill > span:first-child { flex: 1; min-width: 0; }
.continuation-badge {
  position: absolute; top: 14mm; right: 12mm;
  background: var(--red); color: #fff;
  font-family: 'Tajawal', sans-serif; font-weight: 900; font-size: 16px;
  padding: 6px 16px; border-radius: 10px;
  box-shadow: 0 4px 10px rgba(20,34,74, .25);
  z-index: 3;
}
.overflow-warning {
  position: absolute; left: 10mm; right: 10mm; bottom: 20mm;
  display: flex; align-items: center; gap: 8px;
  background: #fef3c7; color: #92400e;
  border: 1.5px solid #f59e0b; border-radius: 10px;
  padding: 8px 12px; z-index: 6;
  font-family: 'Tajawal', sans-serif; font-weight: 700; font-size: 13px; line-height: 1.5;
  box-shadow: 0 6px 16px rgba(245, 158, 11, .28);
}
.overflow-warning .ow-icon { flex-shrink: 0; font-size: 18px; }
.overflow-warning .ow-text { flex: 1; }
@media print { .overflow-warning { display: none !important; } }

.title-pill.compact { font-size: 20px; white-space: nowrap; min-height: 13mm; }
.title-pill.compact > span:first-child { white-space: nowrap; overflow: hidden; }
.title-pill.compact .icon-box { font-size: calc(20px * 0.86); }
.title-pill.compact-sm { font-size: 16px; white-space: nowrap; min-height: 12mm; }
.title-pill.compact-sm > span:first-child { white-space: nowrap; overflow: hidden; }
.title-pill.compact-sm .icon-box { font-size: calc(16px * 0.86); }
.title-pill.compact-xs { font-size: 14px; white-space: nowrap; min-height: 11mm; }
.title-pill.compact-xs > span:first-child { white-space: nowrap; overflow: hidden; }
.title-pill.compact-xs .icon-box { font-size: calc(14px * 0.86); }
.title-pill .icon-box { flex-shrink: 0; font-size: calc(var(--title-size, 28px) * 0.86); font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', 'Tajawal', sans-serif; }
.list-block { font-size: calc(19px * var(--body-scale, 1)); line-height: 1.82; font-weight: 600; margin: 0; padding: 0 4px 0 0; }
.list-block li { margin-bottom: 5px; }
.list-block li::marker { font-weight: 900; }
ol.list-block.list-manual { list-style: none; }
ol.list-block.list-manual li { display: flex; gap: 6px; align-items: flex-start; padding-right: 0; }
ol.list-block.list-manual .li-marker { font-weight: 900; flex-shrink: 0; min-width: 1.3em; }
ol.list-block.list-manual li.li-none .li-marker { display: none; }
ol.list-block.list-manual .li-text { flex: 1; }
.red-word { color: var(--red); font-weight: 900; }
.section-subtitle { font-weight: 900; color: var(--red); font-size: 17px; margin: -5mm 0 7mm; text-align: center; }
.split-grid { display: grid; grid-template-columns: 350px 350px; gap: 14px; align-items: start; justify-content: center; }
.split-grid.split-stacked { width: 100%; justify-content: stretch; }
.split-grid.split-stacked .split-section { width: 100%; }
.split-section { border: 1px solid rgba(20,34,74,.14); border-radius: 18px; padding: 13px; background: rgba(255,255,255,.82); }
.split-section h2 { margin: 0 0 8px; color: var(--red); font-size: 20px; font-weight: 900; }
.split-section .list-block { font-size: calc(14.5px * var(--body-scale, 1)); line-height: 1.7; padding-right: 15px; }
.barcode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; justify-content: center; margin-top: 6mm; }
.barcode-card { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.barcode-card .title-pill { width: 100%; margin: 0 0 4px; min-height: 11mm; font-size: 18px; padding: 6px 14px; box-shadow: none; }
.barcode-box { border: 1px solid rgba(20,34,74,.25); border-radius: 14px; background: rgba(255,255,255,.92); padding: 12px; display: flex; align-items: center; justify-content: center; aspect-ratio: 1 / 1; }
.barcode-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.barcode-empty { color: #94a3b8; font-weight: 700; font-size: 14px; }
.note-box { border-right: 6px solid var(--red); padding: 12px 16px; background: rgba(20,34,74,.07); border-radius: 14px; line-height: 1.7; font-size: calc(17px * var(--body-scale, 1)); font-weight: 700; }

.cover .content-layer { padding: 14mm 13mm 42mm; }
.cover-extra-img { position: absolute; top: 0; left: 0; z-index: 4; object-fit: contain; pointer-events: none; }
.cover-gavel { position: absolute; top: 0; right: 0; width: 85mm; height: 55mm; opacity: .85; z-index: 2; }
.cover-logo { position: absolute; left: 10mm; top: 10mm; z-index: 3; text-align: center; color: var(--navy); font-weight: 900; }
.cover-logo img { max-width: 38mm; max-height: 24mm; object-fit: contain; display: block; margin: auto; }
.cover-logo .logo-mark { margin: auto; width: 20mm; height: 20mm; font-size: 17px; }
.cover-logo .ar { margin-top: 4px; font-size: 12px; }
.cover-logo .en { font-size: 9px; color: #333; direction:ltr; }
.cover-type { text-align: center; margin-top: 52mm; font-size: calc(17px * var(--cover-type-scale, 1)); font-weight: 800; color: var(--red); letter-spacing: 0; max-width: 82%; margin-left: auto; margin-right: auto; word-break: break-word; overflow-wrap: break-word; }
.cover-type.is-empty { visibility: hidden; }
.company-band {
  width: 80%; margin: 6mm auto 12mm; padding: 9mm 6mm; border-radius: 14px;
  background: var(--company-band-bg, linear-gradient(160deg, #1f2a52 0%, #131c3d 100%));
  color: var(--company-name, #fff); text-align: center; font-size: calc(32px * var(--cover-owner-scale, 1)); font-weight: 900;
  letter-spacing: 1px; box-shadow: var(--company-band-shadow, 0 10px 26px rgba(15,23,42,.22));
  position: relative; border-top: 2px solid var(--company-band-border, #c9a250);
}
.company-band::after { content: ""; display: block; width: 40mm; height: 2px; margin: 4mm auto 0; background: var(--company-band-after, linear-gradient(90deg, transparent, #c9a250, transparent)); }
.company-band-name { line-height: 1.1; }
.company-band.has-desc { padding-top: 6mm; padding-bottom: 6mm; }
.company-band.has-desc .company-band-name { font-size: calc(26px * var(--cover-owner-scale, 1)); }
.company-band.has-desc::after { margin-top: 3mm; }
.company-band-desc { margin-top: 3mm; font-size: 14px; font-weight: 600; letter-spacing: normal; line-height: 1.5; opacity: .92; }
.date-panel { background: var(--date-panel-bg, #fff); display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; min-height: 30mm; position: relative; border-radius: 16px; box-shadow: 0 10px 26px rgba(9,45,61,.10), 0 2px 6px rgba(9,45,61,.05); border: 1px solid rgba(9,45,61,.06); overflow: hidden; }
.date-card { position: relative; display: flex; align-items: flex-start; justify-content: center; gap: 3mm; padding: 5mm 3mm; text-align: right; background: transparent; overflow: hidden; }
.date-card + .date-card { border-inline-start: 1px solid rgba(9,45,61,.12); }
.date-card .date-ico { width: 11mm; height: 11mm; border-radius: 11px; background: var(--date-ico-bg, linear-gradient(145deg, #1f3a73, #14224a)); display: grid; place-items: center; color: #fff; box-shadow: 0 6px 14px rgba(20,34,74,.28), inset 0 1px 0 rgba(255,255,255,.25); flex: 0 0 auto; }
.date-card .date-ico svg { width: 6mm; height: 6mm; stroke-width: 2.1; }
.date-text { display: flex; flex-direction: column; gap: 1mm; min-width: 0; overflow: hidden; }
.date-card h3 { color: var(--date-h3, var(--navy)); margin: 0; font-size: var(--dates-label-size, calc(13px * var(--cover-dates-scale, 1))); font-family: var(--dates-label-font, inherit); font-weight: 800; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.date-card .day { font-size: calc(18px * var(--cover-dates-scale, 1)); font-family: var(--dates-value-font, inherit); font-weight: 900; color: var(--day-color, var(--red)); letter-spacing: .2px; }
.date-card .date { font-size: calc(19px * var(--cover-dates-scale, 1)); font-family: var(--dates-value-font, inherit); font-weight: 900; color: var(--date-color, var(--navy)); line-height: 1.1; white-space: nowrap; display: inline-flex; align-items: baseline; gap: 5px; justify-content: flex-start; }
.date-card .date .year { font-size: calc(19px * var(--cover-dates-scale, 1)); font-family: var(--dates-value-font, inherit); font-weight: 900; color: var(--date-color, var(--navy)); letter-spacing: .5px; }
.date-card .time { font-size: calc(13px * var(--cover-dates-scale, 1)); font-family: var(--dates-value-font, inherit); font-weight: 800; color: var(--time-color, var(--red)); display: inline-flex; align-items: center; gap: 4px; margin-top: .5mm; }
.date-card .time svg { width: calc(13px * var(--cover-dates-scale, 1)); height: calc(13px * var(--cover-dates-scale, 1)); flex: 0 0 auto; }
.cover-middle { display: grid; grid-template-columns: 48% 1fr; gap: 5mm; margin-top: 9mm; align-items: center; }
.feature-row-horizontal { display: flex; flex-direction: row-reverse; justify-content: center; align-items: center; gap: 0; flex-wrap: nowrap; padding: 0; margin-top: -4mm; direction: rtl; color: #000; }
.feature-row-horizontal .feature-line { color: #000 !important; }
.feature-row-horizontal .feature-line { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; font-weight: 800; flex: 0 0 auto; text-align: right; direction: rtl; }
.feature-row-horizontal .feature-line:not(:first-child)::before { content: ""; position: absolute; inset-inline-end: 0; top: 50%; transform: translateY(-50%); width: 1px; height: 22px; background: rgba(9,45,61,.20); }
.feature-row-horizontal .feature-line .circle { width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(145deg, rgba(20,34,74,.95), rgba(14,24,52,.85)); display: grid; place-items: center; color: #fff; flex-shrink: 0; box-shadow: 0 6px 14px rgba(20,34,74,.35), inset 0 1px 0 rgba(255,255,255,.25), inset 0 -2px 4px rgba(0,0,0,.15); }
.feature-row-horizontal .feature-line .circle svg { width: 17px; height: 17px; stroke-width: 2.2; }
.feature-row-horizontal .feature-line > span:last-child { font-size: 11px; line-height: 1.25; }
.cover-features-strip { position: absolute; left: 8mm; bottom: 9mm; z-index: 5; display: flex; flex-direction: row; align-items: stretch; gap: 0; background: linear-gradient(180deg, #ffffff, #eef2f6); border: 1px solid rgba(9,45,61,.12); border-radius: 14px; padding: 6px 4px; box-shadow: 0 10px 26px rgba(9,45,61,.18); transform-origin: bottom left; }
.cover-features-strip .cfs-item { position: relative; display: flex; flex-direction: row; align-items: center; gap: 8px; padding: 2px 13px; }
.cover-features-strip .cfs-item:not(:first-child)::before { content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 1px; height: 64%; background: rgba(9,45,61,.18); }
.cover-features-strip .cfs-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex-shrink: 0; box-shadow: 0 5px 12px rgba(20,34,74,.32), inset 0 1px 0 rgba(255,255,255,.25), inset 0 -2px 4px rgba(0,0,0,.15); }
.cover-features-strip .cfs-ico svg { width: 16px; height: 16px; stroke-width: 2.2; }
.cover-features-strip .cfs-text { font-weight: 800; font-size: 11px; line-height: 1.25; text-align: right; direction: rtl; }
.feature-slab {
  position: relative; min-height: 78mm; padding: 22px 0 22px 28px;
  color: #fff; border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: grid; gap: 6px; align-content: center; overflow: hidden;
  direction: rtl;
}
.feature-line { position: relative; display: grid; grid-template-columns: 42px 1fr; gap: 14px; align-items: center; padding: 12px 4px; font-weight: 800; font-size: 14px; letter-spacing: .3px; text-align: right; direction: rtl; }
.feature-line + .feature-line { border-top: 1px solid transparent; box-shadow: none; }
.feature-line .circle {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(145deg, rgba(20,34,74,.95), rgba(14,24,52,.85));
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 6px 14px rgba(20,34,74,.35), inset 0 1px 0 rgba(255,255,255,.25), inset 0 -2px 4px rgba(0,0,0,.15);
  position: relative;
}
.feature-line .circle::after { content: ""; position: absolute; inset: -3px; border-radius: 15px; border: 1px solid rgba(201,162,80,.35); pointer-events: none; }
.feature-line .circle svg { width: 22px; height: 22px; stroke-width: 2.2; filter: drop-shadow(0 1px 1px rgba(0,0,0,.3)); }
.feature-line > span:last-child { line-height: 1.45; text-shadow: none; }
.info-stack { display: grid; gap: 5mm; padding-inline-end: 4mm; margin-top: 8mm; }
.info-block { display: grid; gap: 6mm; }
.red-label { justify-self: center; position: relative; z-index: 2; background: var(--red); color: #fff; border-radius: 999px; padding: 8px 28px; text-align: center; font-size: 18px; font-weight: 900; box-shadow: 0 6px 14px rgba(20,34,74,.25); }
.info-block:has(.contact-card) .red-label { margin-bottom: -16px; }
.info-block:has(.contact-card) .contact-card { padding-top: 22px; }
.platform-card { border-radius: 14px; background: #fff; box-shadow: 0 8px 22px rgba(15,23,42,.12); min-height: 22mm; padding: 14px 18px; display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 19px; font-weight: 900; direction: ltr; color: #0652cc; text-decoration: none; border: 1.5px solid #fecaca; border-inline-start: 5px solid var(--red); transition: transform .15s; }
.platform-card:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(6,82,204,.22); }
.pc-icon { width: 32px; height: 32px; border-radius: 50%; background: #eaf2ff; display: grid; place-items: center; font-size: 18px; }
.pc-url { letter-spacing: .3px; }
.safety-card { border-radius: 14px; background: #fff; box-shadow: 0 8px 22px rgba(15,23,42,.12); min-height: 22mm; padding: 14px 18px; display: flex; align-items: center; gap: 14px; direction: rtl; color: #1f2937; font-size: calc(15px * var(--body-scale, 1)); line-height: 1.65; font-weight: 700; border: 1.5px solid #fecaca; border-inline-start: 5px solid var(--red); }
.safety-card .sc-icon { font-size: 28px; flex-shrink: 0; line-height: 1; }
.safety-card .sc-text { flex: 1; }
.safety-card strong { color: var(--red); font-weight: 900; }

.buyer-title { text-align: center; font-size: 25px; color: var(--buyer-title-color, var(--navy)); font-weight: 900; margin: 18mm 0 8mm; }
.buyer-table { font-size: calc(13px * var(--body-scale, 1)); }
.buyer-table th { padding: 8px 6px; font-size: calc(13px * var(--body-scale, 1)); }
.buyer-table td { padding: 6px 6px; font-size: calc(13px * var(--body-scale, 1)); }
.buyer-table .cell-bid { color: var(--buyer-bid-color, var(--red)); font-weight: 900; white-space: nowrap; }
.buyer-table .row-bid-start td { border-top: 2px solid var(--navy); }
.table-card { margin: 0 auto; width: 96%; border-radius: 18px; background: rgba(255,255,255,.95); box-shadow: 0 7px 18px rgba(15,23,42,.12); overflow: hidden; border: 1px solid #e5e7eb; }
.auction-table { width: 100%; border-collapse: collapse; font-size: calc(15px * var(--body-scale, 1)); text-align: center; }
.auction-table th { background: var(--navy); color: #fff; padding: 10px; font-weight: 900; }
.auction-table td { border-top: 1px solid #e5e7eb; padding: 10px; font-weight: 700; }
.auction-table tr:nth-child(even) td { background: #f8fafc; }
.buyer-table th { background: var(--buyer-head-bg, var(--navy)); }
.bid-label { position: absolute; top: 60mm; right: 16mm; width: 28mm; height: 28mm; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-weight: 900; line-height: 1.1; font-size: 18px; }
.contact-card { background: #fff; border-radius: 18px; padding: 14px 18px; box-shadow: 0 10px 28px rgba(15,32,73,.12); display: flex; flex-direction: column; gap: 8px; }
.contact-row { display: flex; flex-direction: row; direction: ltr; justify-content: flex-start; align-items: center; gap: 10px; border-bottom: 1px dashed #e5e7eb; padding-bottom: 6px; font-size: 14px; }
.contact-row:last-child { border-bottom: none; padding-bottom: 0; }
.contact-key { color: var(--red); font-weight: 900; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; flex-shrink: 0; order: 0; }
.contact-key svg { width: 18px; height: 18px; }
.contact-val { color: var(--navy); font-weight: 700; direction: ltr; text-align: left; order: 1; flex: 1; }
a.contact-val { text-decoration: none; cursor: pointer; }
a.contact-val:hover { color: var(--red); text-decoration: underline; }
.footer-item a.contact-link { color: inherit; text-decoration: none; cursor: pointer; }
.footer-item a.contact-link:hover { text-decoration: underline; }
a.cs-item { text-decoration: none; color: inherit; cursor: pointer; }
a.cs-item:hover .cs-handle { color: var(--red); text-decoration: underline; }
.bid-title { margin: 4mm auto 4mm; font-size: 26px; font-weight: 900; color: var(--navy); text-align: center; }
.bid-location { margin: 0 auto; font-size: 22px; font-weight: 900; color: #fff; text-align: center; background: var(--bid-location-bg, var(--red)); padding: 10px 22px; border-radius: 14px; width: fit-content; max-width: 80%; box-shadow: 0 8px 18px rgba(20,34,74,.22); }
.bid-desc { margin: 4mm auto 0; font-size: calc(16px * var(--body-scale, 1)); font-weight: 700; color: var(--bid-desc-color, var(--navy)); text-align: right; max-width: 92%; line-height: 1.9; white-space: pre-wrap; }
.bid-note { margin-top: 4mm; font-size: 16px; color: var(--bid-note-color, var(--red)); font-weight: 900; text-align: center; }
.page.photo-page .content-layer { display: flex; flex-direction: column; }
.page.photo-page .title-pill { margin-bottom: 0; }
.photo-grid { margin-top: 25mm; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10mm; }
.photo-grid-1 { grid-template-columns: 1fr; margin-top: 0; flex: 1 1 auto; min-height: 0; justify-items: center; align-content: center; }
.photo-grid-1 .photo-slot { width: auto; height: auto; max-width: 100%; max-height: min(190mm, 100%); }
.photo-grid-1 .photo-slot img { display: block; width: auto; height: auto; max-width: 100%; max-height: min(190mm, 100%); object-fit: contain; background: #f8fafc; }
.photo-grid-2 { grid-template-columns: 1fr; margin-top: 12mm; gap: 8mm; }
.photo-grid-2 .photo-slot { height: 90mm; }
.photo-grid-2 .photo-slot img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; background: #f8fafc; }
.photo-grid-3 .photo-slot:nth-child(3) { grid-column: span 2; height: 100mm; }
.photo-slot { height: 64mm; border: 2px dashed #d1d5db; border-radius: 16px; background: rgba(255,255,255,.84); display: grid; place-items: center; color: #9ca3af; font-weight: 900; overflow: hidden; position: relative; }
.photo-slot img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot .num { position: absolute; bottom: 8px; left: 10px; background: var(--red); color: #fff; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; }

@media (max-width: 1100px) {
  body { grid-template-columns: 1fr; }
  .builder-panel {
    position: relative; top: 0; height: auto;
    border-radius: 16px; margin: 12px 12px 0;
    box-shadow: 0 4px 20px rgba(9,45,61,.1);
  }
  .preview-wrap { padding: 12px; min-height: unset; }
  .page { transform: scale(.72); transform-origin: top center; margin-bottom: -74mm; }
  .smart-actions { display: block; }
}
@media (max-width: 640px) {
  .builder-panel { margin: 8px 8px 0; border-radius: 14px; padding: 14px; }
  .preview-wrap { padding: 8px; overflow-x: hidden; }
  .brand-strip h1 { font-size: 16px; }
  .mini-logo { width: 44px; height: 44px; }
  .tool-actions .ta-row-primary { grid-template-columns: 1fr 1fr; }
  /* تحجيم صفحة A4 لتناسب عرض الجوال */
  .page {
    transform: scale(var(--mob-page-scale, 0.46)) !important;
    transform-origin: top center !important;
    margin-bottom: calc(-297mm * (1 - var(--mob-page-scale, 0.46))) !important;
  }

  /* زر التبديل بين المحرر والمعاينة — جوال فقط */
  .mob-panel-toggle { display: inline-flex !important; }

  /* الوضع الافتراضي على الجوال: يظهر المحرر، يُخفى المعاينة */
  body.builder-mode .builder-panel { display: block !important; }
  body.builder-mode:not(.mob-preview) .preview-wrap .document-preview { display: none; }
  body.builder-mode:not(.mob-preview) .mob-panel-toggle .icon-eye { display: block; }
  body.builder-mode:not(.mob-preview) .mob-panel-toggle .icon-edit { display: none; }
  body.builder-mode:not(.mob-preview) .mob-toggle-label::after { content: 'معاينة'; }

  /* وضع المعاينة على الجوال */
  body.builder-mode.mob-preview .builder-panel { display: none !important; }
  body.builder-mode.mob-preview .preview-wrap .document-preview { display: grid; }
  body.builder-mode.mob-preview .mob-panel-toggle .icon-edit { display: block; }
  body.builder-mode.mob-preview .mob-panel-toggle .icon-eye { display: none; }
  body.builder-mode.mob-preview .mob-toggle-label::after { content: 'تحرير'; }

  /* زر «تحرير» داخل شريط المعاينة — يظهر فقط في وضع المعاينة */
  .mob-back-edit { display: none; }
  body.builder-mode.mob-preview .mob-back-edit { display: inline-flex !important; }
}

.mob-panel-toggle {
  display: none;
  align-items: center; gap: 5px;
  background: #c9a250; color: #fff;
  border: none; border-radius: 9px;
  padding: 8px 12px; font-size: 12px; font-weight: 700;
  cursor: pointer; font-family: inherit; direction: rtl;
  white-space: nowrap; flex: 0 0 auto;
  margin-right: auto;
}
.mob-panel-toggle:active { opacity: .85; }

.mob-back-edit {
  display: none;
  align-items: center; gap: 5px;
  background: var(--navy); color: #fff;
  border: none; border-radius: 8px;
  padding: 6px 12px; font-size: 12px; font-weight: 700;
  cursor: pointer; font-family: inherit; direction: rtl;
  white-space: nowrap;
}
.mob-back-edit:active { opacity: .85; }

.page-order-controls { display: flex; gap: 6px; margin: 8px 0 12px; }
.page-order-controls button { padding: 4px 10px; font-size: 14px; border-radius: 8px; border: 1px solid #d1d5db; background: #f3f4f6; cursor: pointer; }
.page-order-controls button:hover:not(:disabled) { background: #e5e7eb; }
.page-order-controls button:disabled { opacity: .4; cursor: not-allowed; }
.page-order-controls button.danger { background: #fee2e2; border-color: #fca5a5; color: #991b1b; margin-right: auto; }
.card-editor.page-hidden { opacity: .55; background: #f9fafb; }
.card-editor.page-hidden > summary { color: #6b7280; }
@media print {
  @page { size: A4 portrait; margin: 0; }
  body { display: block; background: #fff; }
  .builder-panel, .preview-toolbar { display: none !important; }
  .preview-wrap { padding: 0; }
  .document-preview { display: block; }
  .page {
    width: 210mm;
    height: 297mm;
    min-height: 297mm;
    box-shadow: none;
    border-radius: 0;
    margin: 0;
    page-break-after: always;
    break-after: page;
    transform: none !important;
    margin-bottom: 0 !important;
  }
}

/* Login Gate */
body.locked { overflow: hidden; }
body.locked .builder-panel, body.locked .preview-wrap, body.locked .social-modal, body.locked .app-hub, body.locked .booklet-chooser { visibility: hidden !important; }
.booklet-chooser { display: none; }
body.hub-mode .builder-panel, body.hub-mode .preview-wrap, body.hub-mode .booklet-chooser { display: none !important; }
body.builder-mode .app-hub, body.builder-mode .booklet-chooser { display: none !important; }
body.builder-mode { background: #e8ecf2; align-items: start; }
body.builder-mode .preview-wrap { background: #e8ecf2; }
body.chooser-mode .app-hub, body.chooser-mode .builder-panel, body.chooser-mode .preview-wrap { display: none !important; }
body.chooser-mode .booklet-chooser { display: flex; }
@media print { .app-hub, .booklet-chooser { display: none !important; } }

/* Booklet chooser */
.booklet-chooser {
  position: fixed; inset: 0; z-index: 10;
  background: #ffffff url('assets/hub-bg.jpg?v=2') center top / cover no-repeat fixed;
  color: #14224a; overflow: auto;
  flex-direction: column; align-items: center; padding: 40px 20px;
}
.chooser-inner { width: 100%; max-width: 1100px; margin: auto; }
.chooser-top { text-align: center; margin-bottom: 36px; position: relative; }
.chooser-top h2 { font-size: 28px; color: #14224a; margin: 0 0 8px; font-weight: 900; }
.chooser-top p { color: #475569; margin: 0; font-size: 15px; }
.chooser-back {
  position: absolute; right: 0; top: 0;
  background: #fff; border: 1px solid #e2e8f0; color: #14224a;
  padding: 9px 16px; border-radius: 10px; font-weight: 700; cursor: pointer;
  font-family: inherit; font-size: 13px;
}
.chooser-back:hover { border-color: #14224a; color: #14224a; }
.chooser-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.chooser-card {
  background: #fff; border: 2px solid #e2e8f0; border-radius: 16px;
  padding: 28px 22px; text-align: center; cursor: pointer; transition: all 0.2s;
  font-family: inherit; color: #14224a;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.chooser-card:hover { border-color: #c9a250; transform: translateY(-4px); box-shadow: 0 12px 28px rgba(20,34,74,0.12); }
.chooser-emoji { font-size: 44px; line-height: 1; }
.chooser-card h3 { margin: 0; font-size: 18px; font-weight: 800; color: #14224a; }
.chooser-card p { margin: 0; font-size: 13px; color: #64748b; line-height: 1.5; }
@media (max-width: 760px) { .chooser-grid { grid-template-columns: 1fr; } .chooser-back { position: static; margin-bottom: 14px; } }

/* Hub — Official corporate identity */
.app-hub {
  position: fixed; inset: 0; z-index: 10;
  background: #ffffff url('assets/hub-bg.jpg?v=2') center top / cover no-repeat fixed;
  color: #14224a; overflow: auto;
  display: flex; flex-direction: column;
  font-family: 'Tajawal', 'Cairo', sans-serif;
  isolation: isolate;
}

.hub-top-bar {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 5;
  display: flex; align-items: center; gap: 6px; flex-wrap: nowrap;
  max-width: calc(100vw - 40px); overflow-x: auto;
  scrollbar-width: none; -ms-overflow-style: none;
}
.hub-top-bar::-webkit-scrollbar { display: none; }

.hub-logout {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  background: #dc2626; color: #fff !important;
  border: 1px solid #dc2626; padding: 7px 14px; border-radius: 999px;
  font-weight: 800; cursor: pointer; font-size: 12px;
  transition: all .18s ease;
  box-shadow: 0 4px 12px rgba(220,38,38,.25);
}
.hub-logout:hover { background: #b91c1c; border-color: #b91c1c; transform: translateY(-1px); }

/* Admin-only elements are hidden unless the body carries the admin-role class. */
.admin-only { display: none !important; }
body.admin-role .admin-only { display: inline-flex !important; }
body.admin-role .hub-admin-group.admin-only { display: flex !important; }

.hub-admin-group {
  display: flex; gap: 6px; flex-wrap: nowrap; align-items: center;
  overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
}
.hub-admin-group::-webkit-scrollbar { display: none; }
.hub-admin {
  display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0;
  background: #fff; color: var(--navy, #122a4a) !important;
  border: 1px solid rgba(18,42,74,.25); padding: 6px 11px; border-radius: 999px;
  font-weight: 800; cursor: pointer; font-size: 11px; font-family: inherit;
  transition: all .18s ease; box-shadow: 0 4px 12px rgba(18,42,74,.1);
  white-space: nowrap;
}
.hub-admin:hover { background: var(--navy, #122a4a); color: #fff !important; border-color: var(--navy, #122a4a); transform: translateY(-1px); }

.admin-users-body { flex: 1; overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 18px; }
.admin-create-form { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px 18px; }
.admin-create-form h4 { margin: 0 0 12px; font-size: 15px; color: var(--navy, #122a4a); }
.admin-create-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.admin-create-row input { flex: 1; min-width: 160px; padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 8px; font-family: inherit; font-size: 14px; }
.admin-create-row button.primary { padding: 9px 22px; border: 0; border-radius: 8px; background: var(--red, #14224a); color: #fff; font-weight: 800; cursor: pointer; font-family: inherit; }
.admin-msg { margin-top: 10px; font-size: 13px; font-weight: 700; padding: 8px 12px; border-radius: 8px; }
.admin-msg.ok { background: #dcfce7; color: #166534; }
.admin-msg.bad { background: #fee2e2; color: #991b1b; }

.admin-users-list { display: flex; flex-direction: column; gap: 10px; }
.admin-user-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.admin-user-card.is-inactive { opacity: .6; }
.admin-user-main { flex: 1; min-width: 180px; }
.admin-user-main .au-name { font-weight: 800; color: var(--navy, #122a4a); font-size: 15px; }
.admin-user-main .au-sub { font-size: 12px; color: #64748b; margin-top: 3px; }
.admin-user-badge { font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: #e2e8f0; color: #475569; }
.admin-user-badge.admin { background: #fef3c7; color: #92400e; }
.admin-user-badge.inactive { background: #fee2e2; color: #991b1b; }
.admin-user-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-user-actions button { padding: 7px 12px; border: 1px solid #cbd5e1; border-radius: 8px; background: #f8fafc; color: #334155; font-weight: 700; cursor: pointer; font-family: inherit; font-size: 12px; transition: all .15s ease; }
.admin-user-actions button:hover { background: #eef2f7; }
.admin-user-actions button.danger { color: var(--danger, #14224a); border-color: rgba(20,34,74,.3); }
.admin-user-actions button.danger:hover { background: var(--danger, #14224a); color: #fff; }

.hub-inner {
  flex: 1; max-width: 1240px; width: 100%; margin: 0 auto;
  padding: 50px 56px 50px;
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
}

.hub-top {
  display: flex; align-items: center; justify-content: center;
  gap: 36px; margin-bottom: 46px;
  flex-wrap: wrap;
}
.hub-logo-circle {
  width: 130px; height: 130px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  background: #fff;
  border: 2px solid #14224a;
  box-shadow:
    0 0 0 4px #fff,
    0 0 0 5px rgba(201,162,80,.5),
    0 12px 30px -12px rgba(28,38,73,.25);
}
.hub-logo-circle img { width: 118px; height: 118px; object-fit: contain; }

.hub-top-text { text-align: center; }
.hub-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 800;
  color: #c9a250; padding: 7px 22px;
  border: 1.5px solid rgba(201,162,80,.55);
  border-radius: 999px; background: #fff;
  box-shadow: 0 4px 12px -4px rgba(201,162,80,.3);
  white-space: nowrap; flex-shrink: 0;
}
.hub-top-text h2 {
  margin: 16px 0 12px;
  font-size: 62px; font-weight: 900; color: #14224a;
  letter-spacing: -1px; line-height: 1.05;
}
.hub-top-text p {
  margin: 0 auto;
  font-size: 14.5px; line-height: 1.85; color: #6a7689; font-weight: 500;
}
.hub-pdf { color: #14224a; font-weight: 800; }

.hub-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(5, 1fr);
  margin-bottom: 30px;
}
.hub-card-wide {
  grid-column: 2 / 5;
  flex-direction: row !important;
  align-items: center;
  gap: 22px !important;
}
.hub-card-wide .hub-text { flex: 1; }
.hub-card-wide .hub-cta { width: auto; padding-top: 0; border-top: 0; padding-right: 16px; border-right: 1px solid rgba(28,38,73,.08); }

.hub-card {
  position: relative; isolation: isolate;
  display: flex; flex-direction: column; gap: 10px;
  background: #ffffff;
  border: 1px solid rgba(28,38,73,.07);
  border-radius: 14px; padding: 20px 16px 14px;
  text-align: right; color: #14224a; text-decoration: none;
  cursor: pointer; font: inherit;
  transition: transform .22s ease, box-shadow .22s, border-color .22s;
  box-shadow: 0 12px 28px -18px rgba(28,38,73,.28);
  overflow: visible;
  min-height: 0;
}
.hub-card:hover {
  transform: translateY(-5px);
  border-color: rgba(20,34,74,.25);
  box-shadow: 0 22px 40px -18px rgba(20,34,74,.3);
}

.hub-ribbon {
  position: absolute; top: -2px; right: 18px;
  width: 38px; padding: 8px 0 12px;
  background: #14224a;
  color: #fff; font-weight: 800; font-size: 13px;
  text-align: center; letter-spacing: .5px;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
  z-index: 2;
  box-shadow: 0 4px 8px -2px rgba(20,34,74,.4);
}

.hub-card .hub-icon {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  background: #fff;
  border-radius: 50%;
  color: #14224a;
  margin: 2px auto 0;
  border: 1.5px solid #14224a;
  box-shadow: 0 6px 18px -6px rgba(20,34,74,.35), inset 0 0 0 3px #fff;
}
.hub-card .hub-icon svg { width: 26px; height: 26px; }
.hub-card .hub-icon-logo { background: #f8fafc; padding: 0; overflow: hidden; }
.hub-card .hub-icon-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }

.hub-text { flex: 1; text-align: center; }
.hub-card h3 {
  margin: 2px 0 4px; font-size: 15px; font-weight: 900; color: #14224a;
  line-height: 1.35;
}
.hub-card p {
  margin: 0; font-size: 11.5px; line-height: 1.6;
  color: #7c8699; font-weight: 500;
}

.hub-cta {
  margin-top: 4px; display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  color: #14224a; font-weight: 800; font-size: 13px;
  padding-top: 10px; border-top: 1px solid rgba(28,38,73,.06);
}
.hub-cta-arrow {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.2px solid rgba(20,34,74,.35);
  color: #14224a;
  transition: all .22s ease;
}
.hub-card:hover .hub-cta-arrow {
  background: #14224a; color: #fff; border-color: #14224a;
  transform: translateX(-3px);
}

.hub-footer {
  background: linear-gradient(180deg, #14224a 0%, #0f1a3a 100%);
  color: #c9a250;
  padding: 16px 24px; text-align: center;
  font-size: 13px; font-weight: 600; letter-spacing: .3px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  position: relative; z-index: 2;
}
.hub-footer svg { color: #c9a250; flex-shrink: 0; }
.hub-footer p { margin: 0; }

.back-hub-btn {
  flex: 0 0 auto !important;
  background: linear-gradient(135deg, #d4af37, #c9a250, #9c7a30) !important;
  color: #14224a !important; font-weight: 900 !important;
  border: 1px solid #b8922a !important;
  box-shadow: 0 4px 12px rgba(201,162,80,.3);
  transition: transform .12s, box-shadow .15s, opacity .15s;
}
.back-hub-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(201,162,80,.4); opacity: .94; }

@media (max-width: 1100px) {
  .hub-grid { grid-template-columns: repeat(2, 1fr); }
  .hub-card-wide { grid-column: 1 / 3; flex-direction: column !important; }
  .hub-card-wide .hub-cta { width: 100%; padding-top: 14px; border-top: 1px solid rgba(28,38,73,.06); border-right: 0; padding-right: 0; }
}
@media (max-width: 720px) {
  .hub-inner { padding: 40px 22px 30px; }
  .hub-top { gap: 20px; margin-bottom: 30px; }
  .hub-logo-circle { width: 100px; height: 100px; }
  .hub-logo-circle img { width: 90px; height: 90px; }
  .hub-top-text h2 { font-size: 38px; }
  .hub-grid { grid-template-columns: 1fr; gap: 14px; }
  .hub-card-wide { grid-column: 1; }
}
.login-gate {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
  padding: 20px;
  background: #ffffff url('assets/login-bg.png?v=3') center center / cover no-repeat;
  transition: opacity .3s ease;
  overflow-y: auto;
}
@media (max-width: 720px) {
  .login-gate {
    background-image: url('assets/login-bg.png?v=3');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
  }
}
.login-gate::before { display: none !important; }
.login-gate.hide { opacity: 0; pointer-events: none; }
.login-card {
  width: min(420px, 92vw);
  background: rgba(255,255,255,.98);
  border-radius: 22px;
  padding: 32px 30px 24px;
  text-align: center;
  box-shadow: 0 30px 60px rgba(0,0,0,.4), inset 0 0 0 1px rgba(255,255,255,.6);
  border-top: 3px solid #c9a250;
  position: relative;
}
.login-logo {
  width: 84px; height: 84px; margin: 0 auto 14px;
  border-radius: 50%; overflow: hidden;
  border: 2px solid #c9a250;
  box-shadow: 0 8px 22px rgba(20,34,74,.25);
  background: #fff;
}
.login-logo img { width: 100%; height: 100%; object-fit: contain; }
.login-card h1 { color: var(--navy); font-size: 24px; margin: 6px 0 4px; font-weight: 900; }
.login-brand { color: #c9a250; }
.login-sub { color: #475569; font-weight: 700; font-size: 14px; letter-spacing: .3px; margin: 0 0 18px; }
.login-hint { color: #475569; font-size: 13px; margin: 0 0 16px; }
#loginForm { display: grid; gap: 10px; }
#loginPass, #loginUser {
  text-align: center; font-size: 22px; font-weight: 800; letter-spacing: 8px;
  padding: 13px 14px; border-radius: 12px; border: 1.5px solid #e2e8f0;
  background: #f8fafc; color: var(--navy); direction: ltr;
  transition: border-color .15s, box-shadow .15s;
}
#loginPass:focus, #loginUser:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 4px rgba(20,34,74,.12); background: #fff; }
#loginUser { margin-bottom: 10px; }
#loginForm button {
  padding: 12px; border-radius: 12px; border: 0; cursor: pointer;
  background: linear-gradient(180deg, #1f3a73, #14224a); color: #fff;
  font-size: 16px; font-weight: 900; letter-spacing: .5px;
  box-shadow: 0 8px 18px rgba(20,34,74,.3);
  transition: transform .12s, box-shadow .12s;
}
#loginForm button:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(20,34,74,.4); }
#loginForm button:active { transform: translateY(0); }
.login-error { color: var(--danger); font-weight: 700; font-size: 13px; margin-top: 4px; }
.login-footer { margin-top: 18px; color: #94a3b8; font-size: 11px; }
@media (max-width: 480px) and (max-height: 820px) {
  .login-gate { justify-content: center; padding: 16px; }
  .login-card { padding: 20px 18px 16px; border-radius: 16px; }
  .login-logo { width: 60px; height: 60px; margin-bottom: 10px; }
  .login-card h1 { font-size: 18px; margin: 4px 0 3px; }
  .login-sub { font-size: 12px; margin-bottom: 12px; }
  #loginPass, #loginUser { font-size: 16px; letter-spacing: 4px; padding: 10px 12px; }
  #loginUser { margin-bottom: 0; }
  #loginForm { gap: 8px; }
  #loginForm button { padding: 10px; font-size: 15px; }
  .login-footer { font-size: 10px; margin-top: 12px; }
}
@keyframes shake { 10%,90%{transform:translateX(-2px)} 20%,80%{transform:translateX(3px)} 30%,50%,70%{transform:translateX(-5px)} 40%,60%{transform:translateX(5px)} }
#loginForm.shake { animation: shake .4s; }
@media print { .login-gate { display: none !important; } }

/* Rows Editor */
.rows-editor { display: grid; gap: 6px; background: #f8fafc; padding: 10px; border-radius: 12px; border: 1px solid #e2e8f0; }
.rows-head { display: grid; grid-template-columns: 28px 110px 1fr 32px; gap: 8px; font-size: 12px; font-weight: 800; color: #64748b; padding: 0 4px; }
.row-edit { display: grid; grid-template-columns: 28px 110px 1fr 32px; gap: 8px; align-items: center; }
.row-edit .row-num { background: var(--navy); color: #fff; border-radius: 8px; width: 28px; height: 32px; display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.row-edit input { padding: 8px 10px; border-radius: 8px; border: 1px solid #cbd5e1; background: #fff; font: inherit; }
.row-edit input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(20,34,74,.12); }
.row-edit .row-del { background: #fee2e2; color: var(--danger); border: 0; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-weight: 900; font-size: 14px; transition: background .15s; }
.row-edit .row-del:hover { background: var(--danger); color: #fff; }
.rows-editor .row-add { margin-top: 4px; background: #fff; border: 1.5px dashed var(--red); color: var(--red); padding: 9px; border-radius: 10px; cursor: pointer; font-weight: 800; transition: background .15s; }
.rows-editor .row-add:hover { background: var(--red); color: #fff; border-style: solid; }
.bid-photo-thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.bid-photo-card { position: relative; width: 84px; background: #fff; border: 1px solid #cbd5e1; border-radius: 10px; padding: 6px; display: flex; flex-direction: column; gap: 5px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.bid-photo-card.bp-dragging { opacity: .45; }
.bid-photo-thumb { position: relative; width: 100%; height: 72px; overflow: hidden; border-radius: 6px; border: 1px solid #e2e8f0; cursor: crosshair; background: #f1f5f9; }
.bid-photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bid-photo-card .row-del.bp-del { position: absolute; top: -7px; left: -7px; width: 22px; height: 22px; border-radius: 50%; background: #fee2e2; color: var(--danger); border: 0; cursor: pointer; font-weight: 900; font-size: 12px; line-height: 1; z-index: 2; }
.bid-photo-card .row-del.bp-del:hover { background: var(--danger); color: #fff; }
.bid-photo-card .bp-zoom { width: 100%; margin: 0; cursor: pointer; accent-color: var(--red); }
.bid-photo-card .bp-grip { font-size: 11px; color: #64748b; text-align: center; cursor: grab; user-select: none; font-weight: 700; }
.bid-photo-card .bp-grip:active { cursor: grabbing; }
.assets-editor .assets-head, .assets-editor .assets-row { grid-template-columns: 28px 110px 1fr 110px 32px; }

/* Bid Signature Block */
.bid-signature { margin: 4mm auto 0; width: 96%; display: grid; gap: 2.5mm; }
.sig-price { display: grid; grid-template-columns: 1fr; gap: 2.5mm; }
.sig-price-row { display: grid; grid-template-columns: 28mm 1fr; align-items: end; gap: 4mm; border: 1.2px solid var(--red); border-radius: 10px; padding: 2mm 4mm; min-height: 10mm; }
.sig-price-row .sig-label { font-weight: 900; color: var(--red); font-size: 14px; align-self: center; }
.sig-ack { border: 1.2px solid var(--red); border-radius: 10px; padding: 3mm 5mm; font-size: 12px; line-height: 1.7; text-align: justify; font-weight: 600; color: #1f2937; }
.sig-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; }
.sig-col { display: grid; gap: 2mm; }
.sig-row { display: flex; flex-wrap: nowrap; align-items: end; gap: 3mm; min-height: 7mm; border-bottom: 1.2px dotted #475569; padding-bottom: 0.5mm; }
.sig-row .sig-label { font-weight: 900; color: var(--red); font-size: 13px; white-space: nowrap; flex-shrink: 0; }
.sig-row .sig-line { flex: 1; }
.sig-line { display: block; height: 1px; }

/* Booklets save/load */
.badge { display: inline-block; min-width: 18px; padding: 1px 6px; background: var(--red); color: #fff; border-radius: 10px; font-size: 11px; font-weight: 800; margin-inline-start: 4px; }
.badge:empty { display: none; }
.current-booklet {
  margin: 8px 0 10px; padding: 10px 14px;
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border: 1px solid #6ee7b7; border-radius: 12px; font-size: 13px;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(16,185,129,.1);
}
.current-booklet.has-new-notes { background: #fff7ed; border-color: #fdba74; animation: notesPulse 2s ease-in-out infinite; }
.cb-notes-badge { background: #14224a; color: #fff; padding: 2px 8px; border-radius: 8px; font-size: 11px; font-weight: 800; margin-right: 6px; }
.notes-badge { background: #14224a; color: #fff; padding: 2px 8px; border-radius: 8px; font-size: 11px; font-weight: 800; margin-right: 6px; display: inline-block; }
.approved-badge, .cb-approved-badge { background: linear-gradient(135deg, #1e9e55, #0f7a3d); color: #fff; padding: 2px 8px; border-radius: 8px; font-size: 11px; font-weight: 800; margin-right: 6px; display: inline-block; box-shadow: 0 2px 8px rgba(15,122,61,.3); }
.owner-approved-badge, .cb-owner-badge { background: linear-gradient(135deg, #2563eb, #1746b0) !important; box-shadow: 0 2px 8px rgba(23,70,176,.3) !important; }
.cb-auditor-badge { background: linear-gradient(135deg, #7c3aed, #5b21b6) !important; box-shadow: 0 2px 8px rgba(91,33,182,.3) !important; }
.booklet-item.has-new-notes { border-color: #fdba74 !important; background: #fff7ed; }
#bookletsCount.has-new { background: #14224a; color: #fff; }
@keyframes notesPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(20,34,74, 0); } 50% { box-shadow: 0 0 0 4px rgba(20,34,74, .15); } }
.cb-label { color: #065f46; font-weight: 700; }
.cb-name { color: #064e3b; font-weight: 900; }

.booklets-panel { display: grid; gap: 10px; }
.booklets-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.booklets-header h3 { margin: 0; color: var(--navy); font-size: 16px; font-weight: 900; }
.booklets-list { display: grid; gap: 10px; }
.empty-state { text-align: center; padding: 30px 20px; color: #64748b; font-size: 14px; }
.booklet-item { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 14px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; transition: background .15s; }
.booklet-info { min-width: 0; }
.booklet-item:hover { background: #f1f5f9; }
.booklet-item.is-current { background: #ecfdf5; border-color: #a7f3d0; }
.booklet-name { font-weight: 900; color: var(--navy); font-size: 14px; }
.current-tag { background: #10b981; color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 6px; font-weight: 800; margin-inline-start: 4px; }
.booklet-meta { color: #64748b; font-size: 12px; margin-top: 2px; }
.booklet-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.booklet-actions button { flex: 1 1 auto; white-space: nowrap; padding: 7px 10px; border-radius: 8px; border: 1px solid #cbd5e1; background: #fff; cursor: pointer; font-size: 12px; font-weight: 700; }
.booklet-actions button.primary { background: var(--red); color: #fff; border-color: var(--red); }
.booklet-actions button.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.booklet-actions button.danger:hover { background: var(--danger); color: #fff; }
@media print { .current-booklet { display: none !important; } }
.feature-edit-row { display: grid; gap: 10px; margin-bottom: 10px; padding: 12px; background: #f8fafc; border-radius: 10px; border: 1px solid #e5e7eb; }
.feature-edit-row label { font-size: 12px; font-weight: 700; color: var(--navy); margin-bottom: 4px; display: block; white-space: nowrap; }
.feature-edit-row .fe-text textarea { width: 100%; box-sizing: border-box; min-height: 60px; resize: vertical; }
.feature-edit-row .fe-controls { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.feature-edit-row .fe-icon { flex: 1; min-width: 140px; }
.feature-edit-row .fe-icon select { width: 100%; box-sizing: border-box; height: 36px; }
.feature-edit-row .color-dot { position: relative; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; border: 2px solid #fff; box-shadow: 0 0 0 2px #cbd5e1, 0 2px 6px rgba(0,0,0,.1); display: grid; place-items: center; overflow: hidden; align-self: end; }
.feature-edit-row .color-dot span { display: none; }
.feature-edit-row .color-dot input[type="color"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; padding: 0; border: 0; }
/* «ألوان الكراسة» tab */
.colors-intro { background:#eef2ff; border:1px solid #c7d2fe; color:#3730a3; border-radius:12px; padding:10px 12px; font-size:13px; font-weight:600; line-height:1.7; margin-bottom:6px; }
.colors-section-title { font-size:14px; font-weight:800; color:#1f2937; margin:16px 0 8px; padding-bottom:5px; border-bottom:2px solid #eef0f4; }
.colors-grid { display:grid; grid-template-columns:repeat(2, 1fr); gap:10px; }
.color-swatch { display:flex; align-items:center; gap:8px; padding:8px 10px; border:1.5px solid #e5e7eb; border-radius:12px; background:#fff; transition:border-color .15s, box-shadow .15s; }
.color-swatch:hover { border-color:#c7d2fe; box-shadow:0 2px 8px rgba(15,23,42,.06); }
.color-swatch .cs-pick { display:flex; align-items:center; gap:10px; min-width:0; flex:1; cursor:pointer; }
.color-swatch .cs-reset { flex:0 0 auto; width:30px; height:30px; border:1px solid #e5e7eb; border-radius:8px; background:#f8fafc; color:#6b7280; font-size:16px; cursor:pointer; line-height:1; }
.color-swatch .cs-reset:hover { background:#eef2ff; color:#3730a3; border-color:#c7d2fe; }
.color-swatch input[type="color"] { -webkit-appearance:none; appearance:none; width:36px; height:36px; flex:0 0 auto; border:none; border-radius:9px; padding:0; cursor:pointer; background:none; }
.color-swatch input[type="color"]::-webkit-color-swatch-wrapper { padding:0; }
.color-swatch input[type="color"]::-webkit-color-swatch { border:1px solid rgba(0,0,0,.18); border-radius:9px; }
.color-swatch input[type="color"]::-moz-color-swatch { border:1px solid rgba(0,0,0,.18); border-radius:9px; }
.color-swatch .cs-info { display:flex; flex-direction:column; gap:2px; min-width:0; }
.color-swatch .cs-name { font-size:13px; font-weight:700; color:#111827; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.color-swatch .cs-hex { font-size:11px; color:#6b7280; direction:ltr; }
.feature-edit-row button.danger { background: #fff; color: var(--danger); border: 1.5px solid var(--danger); border-radius: 50%; width: 38px; height: 38px; padding: 0; font-weight: 900; cursor: pointer; align-self: end; }
details.card-editor.collapsible { padding: 0; overflow: hidden; }
details.card-editor.collapsible > summary { list-style: none; cursor: pointer; padding: 12px 14px; background: linear-gradient(135deg, #f8fafc, #f1f5f9); border-bottom: 1px solid transparent; display: flex; align-items: center; gap: 8px; user-select: none; }
details.card-editor.collapsible > summary::-webkit-details-marker { display: none; }
details.card-editor.collapsible > summary::before { content: '▶'; font-size: 11px; color: var(--red); transition: transform .2s; display: inline-block; }
details.card-editor.collapsible[open] > summary::before { transform: rotate(90deg); }
details.card-editor.collapsible[open] > summary { border-bottom-color: #e5e7eb; }
details.card-editor.collapsible > summary h3 { margin: 0; font-size: 15px; color: var(--navy); flex: 1; }
details.card-editor.collapsible > *:not(summary) { padding: 0 14px; }
details.card-editor.collapsible > *:not(summary):first-of-type { padding-top: 12px; }
details.card-editor.collapsible > *:not(summary):last-child { padding-bottom: 14px; }
details.bg-group { margin-top: 8px; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; }
details.bg-group > summary.bg-group-title { list-style: none; cursor: pointer; margin: 0; font-size: 13px; font-weight: 800; color: var(--navy); padding: 8px 10px; background: #f1f5f9; border-right: 3px solid var(--red); display: flex; align-items: center; gap: 6px; user-select: none; }
details.bg-group > summary.bg-group-title::-webkit-details-marker { display: none; }
details.bg-group > summary.bg-group-title::before { content: '▶'; font-size: 9px; color: var(--red); transition: transform .2s; }
details.bg-group[open] > summary.bg-group-title::before { transform: rotate(90deg); }
.bg-group-count { font-weight: 600; color: #64748b; font-size: 12px; margin-inline-start: auto; }
details.bg-group > .bg-preset-grid { padding: 10px; }
.bg-preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 8px; }
.bg-preset { background: #fff; border: 2px solid #e5e7eb; border-radius: 10px; padding: 6px; cursor: pointer; display: grid; gap: 4px; transition: all .15s; }
.bg-preset:hover { border-color: var(--red); transform: translateY(-1px); }
.bg-preset.active { border-color: var(--red); box-shadow: 0 0 0 3px rgba(20,34,74,.15); }
.bg-preset-wrap { display: grid; gap: 4px; position: relative; }
.bg-preset.approved { border-color: #c9a250; box-shadow: 0 0 0 2px rgba(201,162,80,.25); }
.bg-preset .approved-badge { position: absolute; top: 4px; left: 4px; background: #c9a250; color: #14224a; font-size: 11px; padding: 2px 6px; border-radius: 999px; font-weight: 900; box-shadow: 0 2px 4px rgba(0,0,0,.2); }
.bg-preset { position: relative; }
.approve-btn { background: #fff; border: 1px solid #e5e7eb; border-radius: 6px; padding: 4px 6px; font-size: 11px; font-weight: 700; color: #64748b; cursor: pointer; transition: all .15s; }
.approve-btn:hover { border-color: #c9a250; color: #c9a250; }
.approve-btn.is-on { background: #c9a250; color: #14224a; border-color: #c9a250; }
.bg-preset img { width: 100%; aspect-ratio: 1/1.414; object-fit: cover; border-radius: 6px; background: #f8fafc; }
.bg-preset span { font-size: 12px; font-weight: 700; color: var(--navy); text-align: center; }
.approved-badge-inline { background: #c9a250; color: #14224a; font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 900; margin-inline-start: 6px; }
.link-btn { background: none; border: none; color: var(--red); text-decoration: underline; cursor: pointer; font-weight: 700; padding: 0; font-size: 12px; }
.check-line { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 700; color: var(--navy); padding: 6px 10px; background: #fef2f2; border: 1.5px dashed #fca5a5; border-radius: 6px; }
.check-line input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--red); cursor: pointer; margin: 0; }
.check-line:has(input:checked) { background: #fee2e2; border-style: solid; border-color: var(--red); color: var(--red); }
.bid-map-link { display: flex; align-items: center; gap: 10px; margin: 4mm 0; padding: 4mm 5mm; border: 2.5px solid var(--navy); border-radius: 10px; background: linear-gradient(135deg, #f8fafc, #eef2f7); text-decoration: none; color: var(--navy); box-shadow: 0 2px 6px rgba(20,34,74,.12); transition: all .15s; }
.bid-map-link:hover { background: var(--navy); color: #fff; }
.bid-map-link:hover .bml-cta { background: var(--gold,#c9a250); color: var(--navy); }
.bid-map-link .bml-icon { font-size: 28px; flex: 0 0 auto; }
.bid-map-link .bml-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bid-map-link .bml-text b { font-size: 15px; font-weight: 900; }
.bid-map-link .bml-text small { font-size: 11px; color: #64748b; direction: ltr; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bid-map-link:hover .bml-text small { color: #cbd5e1; }
.bid-map-link .bml-cta { flex: 0 0 auto; background: var(--navy); color: #fff; font-weight: 800; font-size: 12px; padding: 6px 12px; border-radius: 6px; }
.logout-btn { background: #fff; color: var(--danger); border: 1.5px solid var(--danger); font-weight: 800; }
.logout-btn:hover { background: var(--danger); color: #fff; }

/* Closing page (mandatory last) - uses page bg like inner pages */
.closing-new .content-layer { padding: 26mm 16mm 38mm; }
.closing-wrap { width: 100%; display: grid; gap: 7mm; text-align: center; }
.closing-hero { display: grid; gap: 3mm; justify-items: center; margin-bottom: 2mm; }
.closing-monogram { width: 22mm; height: 22mm; border-radius: 50%; background: #fff; border: 2px solid var(--red); display: grid; place-items: center; box-shadow: 0 6px 18px rgba(20,34,74,.18); overflow: hidden; }
.closing-monogram img { width: 80%; height: 80%; object-fit: contain; }
.closing-org { font-size: 18px; font-weight: 900; color: var(--navy); }
.closing-org-en { font-size: 11px; font-weight: 700; color: var(--red); letter-spacing: 1px; direction: ltr; }
.closing-divider { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--red); margin: 1mm 0; }
.closing-divider span { display: block; width: 28mm; height: 1.5px; background: linear-gradient(90deg, transparent, var(--red), transparent); }
.closing-title { font-size: 64px; font-weight: 900; color: var(--red); letter-spacing: 3px; line-height: 1; }
.closing-sub { font-size: 15px; font-weight: 700; color: var(--navy); margin-top: -3mm; }
.closing-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5mm; margin: 4mm 0 2mm; }
.closing-feat { background: linear-gradient(160deg, #ffffff 0%, #f8fafc 100%); border: 1px solid rgba(15,23,42,.08); border-top: 3px solid var(--red); border-radius: 14px; padding: 7mm 3mm; display: grid; gap: 3mm; justify-items: center; box-shadow: 0 6px 14px rgba(15,23,42,.08); }
.closing-feat .cf-circle { width: 14mm; height: 14mm; border-radius: 50%; color: #fff; display: grid; place-items: center; box-shadow: 0 4px 10px rgba(20,34,74,.3); }
.closing-feat .cf-circle svg { width: 8mm; height: 8mm; }
.closing-feat .cf-text { font-size: 13px; font-weight: 800; color: var(--navy); line-height: 1.4; }
.closing-contact-card { background: var(--contact-card-bg, linear-gradient(160deg, #1f2a52 0%, #131c3d 100%)); border-radius: 16px; padding: 6mm 5mm; color: #fff; box-shadow: 0 8px 22px rgba(9,45,61,.25); border-top: 3px solid #c9a250; }
.closing-contact-card .ccc-head { font-size: 14px; font-weight: 900; color: var(--contact-title, #c9a250); letter-spacing: 2px; margin-bottom: 4mm; }
.closing-contact-card .ccc-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4mm 6mm; text-align: right; }
.closing-contact-card .ccc-item { display: flex; align-items: center; gap: 8px; direction: rtl; }
.closing-contact-card .ccc-ic { width: 9mm; height: 9mm; border-radius: 50%; background: var(--contact-ic-bg, var(--red)); color: #fff; display: grid; place-items: center; flex-shrink: 0; box-shadow: 0 3px 8px rgba(20,34,74,.4); }
.closing-contact-card .ccc-ic svg { width: 5mm; height: 5mm; }
.closing-contact-card .ccc-text { display: grid; line-height: 1.2; min-width: 0; flex: 1; }
.closing-contact-card .ccc-lbl { font-size: 9px; font-weight: 700; color: var(--contact-title, #c9a250); letter-spacing: .5px; }
.closing-contact-card .ccc-val { font-size: 12px; font-weight: 900; color: #fff; direction: ltr; text-align: right; word-break: break-all; }
.closing-greeting { font-size: 13px; font-weight: 800; color: var(--navy); margin-top: 1mm; font-style: italic; }
.page.contact-page .content-layer { display: flex; flex-direction: column; justify-content: center; }
.contact-page-wrap { width: 100%; max-width: 130mm; margin: 0 auto; display: grid; gap: 9mm; text-align: center; }
.contact-page-title { font-size: 34px; font-weight: 900; color: var(--navy); margin: 0; letter-spacing: 1px; }
.contact-page .info-block { max-width: 110mm; margin: 0 auto; width: 100%; }
.contact-page .info-block.contact-platform { max-width: 120mm; display: grid; gap: 5mm; }
.contact-page .info-block.contact-platform .platform-card,
.contact-page .info-block.contact-platform .safety-card { min-height: auto; }
.contact-page .red-label { font-size: 20px; }
.contact-page .contact-card { padding: 20px 22px; gap: 12px; }
.cover-info-cards { width: 100%; max-width: 120mm; margin: 6mm auto 0; display: grid; gap: 6mm; text-align: center; }
.cover-info-cards .info-block { max-width: 110mm; margin: 0 auto; width: 100%; }
.cover-info-cards .info-block.contact-platform { display: grid; gap: 5mm; }
.cover-info-cards .info-block.contact-platform .platform-card,
.cover-info-cards .info-block.contact-platform .safety-card { min-height: auto; }
.contact-page .contact-row { font-size: 17px; padding-bottom: 10px; }
.contact-page .contact-key { width: 26px; height: 26px; }
.contact-page .contact-key svg { width: 22px; height: 22px; }
.closing-social { display: grid; gap: 3mm; justify-items: center; }
.closing-social .cs-head { font-size: 11px; font-weight: 800; color: var(--navy); letter-spacing: 1px; }
.closing-social .cs-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 4mm 5mm; direction: rtl; }
.closing-social .cs-item { display: flex; align-items: center; gap: 5px; }
.closing-social .cs-ic { width: 8mm; height: 8mm; border-radius: 50%; display: grid; place-items: center; box-shadow: 0 3px 8px rgba(15,23,42,.15); }
.closing-social .cs-ic svg { width: 4.5mm; height: 4.5mm; }
.closing-social .cs-handle { font-size: 11px; font-weight: 800; color: var(--navy); direction: ltr; }

/* ===== User Guide ===== */
.guide-wrap { display: grid; gap: 16px; padding-bottom: 20px; }
.guide-hero { display: flex; gap: 14px; align-items: center; padding: 18px 20px; background: linear-gradient(135deg, #1f2a52, #131c3d); color: #fff; border-radius: 14px; border-top: 3px solid #c9a250; }
.guide-hero-icon { font-size: 38px; }
.guide-hero h2 { margin: 0 0 4px; font-size: 18px; font-weight: 900; }
.guide-hero p { margin: 0; font-size: 13px; opacity: .85; }
.guide-section { display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding: 16px; background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; box-shadow: 0 2px 8px rgba(15,23,42,.04); }
.guide-num { width: 36px; height: 36px; display: grid; place-items: center; background: var(--red); color: #fff; border-radius: 50%; font-weight: 900; font-size: 16px; }
.guide-content h3 { margin: 0 0 8px; color: var(--navy); font-size: 16px; font-weight: 900; }
.guide-content h4 { margin: 14px 0 6px; color: var(--red); font-size: 13px; font-weight: 800; }
.guide-content p { margin: 0 0 10px; font-size: 13px; color: #334155; line-height: 1.7; }
.guide-tips { margin: 10px 0 0; padding-inline-start: 18px; font-size: 12.5px; color: #475569; line-height: 1.85; }
.guide-tips li { margin-bottom: 3px; }
.guide-tips b { color: var(--navy); }
.guide-steps { margin: 0; padding-inline-start: 18px; font-size: 13px; color: #334155; line-height: 1.9; }
.guide-foot { text-align: center; padding: 14px; font-size: 12px; color: #94a3b8; border-top: 1px dashed #e2e8f0; margin-top: 6px; }
.guide-section-star { border: 1.5px solid var(--red); box-shadow: 0 6px 22px rgba(220,38,38,.12); background: linear-gradient(180deg,#fff,#fff7f7); position: relative; }
.guide-section-star .guide-num { background: linear-gradient(135deg,var(--red),var(--navy)); }
.guide-star-badge { display: inline-block; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 999px; margin-bottom: 8px; }
.guide-lead { font-size: 13.5px !important; color: var(--navy) !important; font-weight: 700; line-height: 1.85 !important; }
.guide-subhead { margin: 16px 0 6px !important; color: var(--navy) !important; font-size: 14px !important; font-weight: 900 !important; border-inline-start: 4px solid var(--red); padding-inline-start: 8px; }
.guide-shot { margin: 10px 0; padding: 0; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; background: #f8fafc; box-shadow: 0 4px 14px rgba(15,23,42,.08); }
.guide-shot img { display: block; width: 100%; height: auto; }
.guide-shot figcaption { padding: 8px 12px; font-size: 12px; font-weight: 700; color: #475569; background: #fff; border-top: 1px solid #e2e8f0; text-align: center; }

/* Mockup elements */
.mock { background: #f8fafc; border: 1.5px dashed #cbd5e1; border-radius: 10px; padding: 12px; margin: 8px 0; display: grid; gap: 8px; }
.mock-card { background: #fff; padding: 16px; border-radius: 10px; box-shadow: 0 4px 12px rgba(0,0,0,.06); text-align: center; max-width: 220px; margin: 0 auto; }
.mock-title { font-weight: 900; color: var(--navy); margin-bottom: 10px; font-size: 13px; }
.mock-input { background: #fff; border: 1px solid #cbd5e1; border-radius: 6px; padding: 6px 10px; font-size: 12px; color: #1e293b; text-align: start; }
.mock-input.small { padding: 4px 8px; font-size: 11px; }
.mock-btn { display: inline-block; padding: 6px 12px; border-radius: 8px; background: #e2e8f0; color: #475569; font-size: 12px; font-weight: 700; }
.mock-btn.primary { background: var(--red); color: #fff; }
.mock-btn.danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.mock-btn.small { padding: 3px 8px; font-size: 11px; }
.mock-toolbar { display: flex; flex-wrap: wrap; gap: 6px; }
.mock-form .mock-field { display: grid; gap: 4px; }
.mock-form label { font-size: 11px; color: var(--red); font-weight: 800; }
.mock-pages .mock-page-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 12px; color: #334155; }
.mock-chip { background: #1f2a52; color: #fff; font-size: 10px; padding: 2px 8px; border-radius: 6px; font-weight: 700; }
.mock-chip.alt { background: var(--red); }
.mock-mini-btns { margin-inline-start: auto; color: #94a3b8; font-size: 11px; }
.mock-add { padding: 8px; text-align: center; border: 1.5px dashed var(--red); color: var(--red); border-radius: 8px; font-size: 12px; font-weight: 800; }
.mock-table { font-family: monospace; font-size: 11px; }
.mock-th { background: var(--navy); color: #fff; padding: 6px 10px; border-radius: 6px; font-weight: 800; }
.mock-tr { padding: 5px 10px; background: #fff; border-bottom: 1px solid #e2e8f0; }
.mock-row-header { display: grid; grid-template-columns: 30px 1fr 1fr 30px; gap: 6px; padding: 6px; background: var(--navy); color: #fff; font-size: 11px; font-weight: 800; border-radius: 6px; }
.mock-row { display: grid; grid-template-columns: 30px 1fr 1fr 30px; gap: 6px; align-items: center; padding: 4px; }
.mock-x { color: var(--red); text-align: center; font-weight: 800; }
.mock-signature { background: #fff; border: 1px solid var(--red); }
.mock-sig-row { padding: 6px 8px; border: 1px solid #fecaca; border-radius: 6px; font-size: 12px; }
.mock-sig-ack { padding: 8px; border: 1px solid #fecaca; border-radius: 6px; font-size: 11.5px; line-height: 1.7; color: #475569; }
.mock-sig-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 11.5px; color: #475569; }
.mock-identity { display: grid; gap: 10px; }
.mock-color { width: 100%; height: 24px; border-radius: 6px; border: 1px solid rgba(0,0,0,.1); }
.mock-upload { background: #fff; border: 1.5px dashed #cbd5e1; padding: 10px; text-align: center; border-radius: 8px; font-size: 12px; color: #64748b; }
.mock-save-btn { background: var(--red); color: #fff; padding: 8px 12px; border-radius: 8px; text-align: center; font-weight: 800; font-size: 12px; }
.mock-booklet-item { display: flex; justify-content: space-between; align-items: center; padding: 10px; background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 11.5px; gap: 8px; }
.mock-booklet-item.current { background: #ecfdf5; border-color: #a7f3d0; }
.mock-tag { background: #10b981; color: #fff; font-size: 9px; padding: 1px 5px; border-radius: 4px; font-weight: 800; }
.mock-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; justify-content: center; }
.flow-item { background: var(--navy); color: #fff; padding: 6px 10px; border-radius: 8px; font-size: 11.5px; font-weight: 700; }
.flow-item.closing { background: var(--red); }
.flow-arrow { color: #94a3b8; font-weight: 800; }
.guide-download { padding: 14px; background: linear-gradient(135deg, #fff7ed, #fef3c7); border: 1.5px solid var(--gold, #c9a250); border-radius: 12px; text-align: center; }
.guide-pdf-btn { display: inline-block; background: var(--red); color: #fff !important; padding: 10px 18px; border-radius: 10px; font-weight: 800; text-decoration: none; font-size: 14px; }
.guide-pdf-btn:hover { background: var(--navy); }
.guide-download .hint { margin: 8px 0 0; color: #92400e; font-weight: 600; }

.footer-row { border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; margin: 8px 0; background: #f8fafc; }
.footer-row-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.footer-row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.footer-row-actions button { padding: 4px 10px; font-size: 13px; }
.footer-row-actions .check-line { font-size: 12px; font-weight: 600; }
.footer-row .field { margin: 6px 0; }
.card-editor code { background: #fef3c7; padding: 1px 6px; border-radius: 4px; font-size: 12px; color: #92400e; }

.section-card { background: #fafbfc; border: 1px dashed #cbd5e1; }
.section-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; flex-wrap: wrap; gap: 6px; }
.section-card-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.section-card-actions button { padding: 3px 9px; font-size: 12px; }
.dims-editor { margin-top: 10px; background: #f0f9ff; border-color: #bae6fd; }
.dims-editor > summary { cursor: pointer; color: var(--navy); font-size: 13.5px; }
.dims-group { padding: 8px 0; border-bottom: 1px dashed #cbd5e1; }
.dims-group:last-child { border-bottom: none; }
.dims-group > strong { display: block; margin: 2px 0 6px; color: var(--navy); font-size: 13px; }
.dims-group .field-row { gap: 12px; margin: 0 0 6px; }

.page-ack { margin: 5mm 6mm 0; padding: 4mm; border: 1.5px solid var(--red); border-radius: 4mm; background: #fff7f7; page-break-inside: avoid; }
.page-ack .page-ack-text { font-size: 12.5px; line-height: 1.7; color: #1f2937; margin-bottom: 4mm; font-weight: 600; }
.page-ack .sig-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 5mm 8mm; align-items: start; }
.page-ack .sig-col { display: grid; grid-auto-rows: 9mm; gap: 3mm; }
.page-ack .sig-row { display: grid; grid-template-columns: 42mm 1fr; align-items: end; gap: 2mm; min-height: 9mm; border-bottom: 1.2px dotted #475569; padding-bottom: 0.5mm; }
.page-ack .sig-row .sig-label { font-weight: 900; color: var(--red); font-size: 13px; white-space: nowrap; text-align: start; }
.page-ack .sig-row .sig-line { display: block; }
.page-ack .sig-stamp { min-height: 9mm; }

.add-page-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.add-page-actions button { flex: 1; min-width: 180px; }

.page-ack-note { margin-top: 4mm; padding: 2mm 3mm; background: #fef3c7; border-inline-start: 3px solid #d97706; border-radius: 2mm; font-size: 11.5px; font-weight: 700; color: #92400e; text-align: center; }

/* === Social Media Posts Modal === */
.social-modal { position: fixed; inset: 0; background: rgba(15,23,42,.92); z-index: 9999; display: flex; flex-direction: column; }
.social-modal[hidden] { display: none; }
.social-modal-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 18px; background: var(--navy); color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.social-modal-bar strong { font-size: 17px; }
.social-modal-bar .social-hint { color: #cbd5e1; font-size: 13px; flex: 1; min-width: 200px; }
.social-modal-bar button { padding: 8px 16px; border-radius: 8px; border: 0; cursor: pointer; font-weight: 800; font-family: inherit; }
.social-modal-bar button.primary { background: var(--red); color: #fff; }
.social-modal-bar button.danger { background: #fff; color: var(--danger); }
.social-grid { flex: 1; overflow: auto; padding: 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; align-content: start; }
.social-card { background: #fff; border-radius: 12px; padding: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.2); display: flex; flex-direction: column; gap: 10px; }
.social-card-head { display: flex; justify-content: space-between; align-items: center; }
.social-card-head h3 { margin: 0; font-size: 15px; color: var(--navy); }
.social-card-head .dims { font-size: 12px; color: #64748b; font-weight: 700; }
.social-canvas-wrap { background: #0f172a; border-radius: 8px; overflow: hidden; position: relative; }
.social-canvas-frame { position: relative; transform-origin: top right; }
.social-card button.download-social { background: var(--red); color: #fff; border: 0; padding: 9px; border-radius: 8px; cursor: pointer; font-weight: 800; font-family: inherit; }
.social-card button.download-social:hover { background: var(--navy); }
.social-card button.download-social:disabled { opacity: .6; cursor: wait; }
.social-card button.download-video { background: linear-gradient(135deg, #14224a, #14224a); }
.social-card button.download-video:hover { background: linear-gradient(135deg, #14224a, #14224a); }
.social-section-title { grid-column: 1 / -1; color: #fff; font-size: 18px; font-weight: 900; padding: 14px 4px 6px; border-bottom: 2px solid rgba(255,255,255,.15); margin-bottom: 4px; }
.video-fmt-group { border: 2px solid #14224a; }
.video-badge { display: inline-block; background: #14224a; color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 6px; margin-inline-start: 6px; font-weight: 800; vertical-align: middle; }
.social-canvas-wrap { position: relative; }
.video-play-badge { position: absolute; inset: 0; display: grid; place-items: center; font-size: 56px; color: rgba(255,255,255,.92); text-shadow: 0 4px 16px rgba(0,0,0,.6); pointer-events: none; }
.video-combined-card { width: 100%; }
.scene-list { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 4px 4px; max-height: 90px; overflow-y: auto; }
.scene-chip { display: inline-block; background: rgba(201,162,80,.18); color: #c9a250; border: 1px solid rgba(201,162,80,.4); font-size: 11px; padding: 3px 8px; border-radius: 10px; font-weight: 700; }
.ct-scene .ct-row { display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,.06); padding: 8px 14px; border-radius: 999px; backdrop-filter: blur(4px); }
.ct-scene .ct-ic { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; flex-shrink: 0; font-weight: 900; }
.ct-scene .sp-accent-top, .ct-scene .sp-accent-bot { position: absolute; left: 0; right: 0; height: 6px; }
.ct-scene .sp-accent-top { top: 0; }
.ct-scene .sp-accent-bot { bottom: 0; }

/* === Owner notes box (organizer preview) === */
.owner-note-box { position: relative; z-index: 20; margin: 0 0 6mm 0; padding: 10px 12px; background: linear-gradient(135deg, #fff8e1, #fff3c4); border: 2px dashed #c9a250; border-radius: 10px; box-shadow: 0 4px 14px rgba(201,162,80,.25); font-family: inherit; }
.owner-note-box .onb-head { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 13px; color: #7a5c10; margin-bottom: 6px; }
.owner-note-box .onb-icon { font-size: 16px; }
.owner-note-box .onb-item { background: #fff; border: 1px solid #f2d98f; border-radius: 8px; padding: 8px 10px; margin-top: 6px; }
.owner-note-box .onb-text { color: #1f2937; font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.owner-note-box .onb-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.owner-note-box .onb-ts { font-size: 10px; color: #92732a; }
.owner-note-box .onb-del { background: #fee2e2; color: var(--danger); border: 1px solid #fecaca; border-radius: 6px; padding: 3px 10px; font-size: 11px; font-weight: 800; cursor: pointer; font-family: inherit; }
.owner-note-box .onb-del:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
@media print { .owner-note-box { display: none !important; } }
body.review-mode .owner-note-box { display: none !important; }
.review-page-card.rpc-readonly { opacity: .75; }
.review-page-card .rpc-readonly-note { background: rgba(201,162,80,.15); color: #c9a250; border: 1px dashed #c9a250; border-radius: 6px; padding: 8px 10px; font-size: 11px; font-weight: 700; text-align: center; }

/* Hide review sidebar entirely outside review mode */
body:not(.review-mode) #reviewSidebar,
body:not(.review-mode) .review-sidebar,
body:not(.review-mode) .review-sidebar-toggle { display: none !important; }

/* === Review mode === */
body.review-mode .builder-panel,
body.review-mode .app-hub,
body.review-mode .hub-section,
body.review-mode .hub-top { display: none !important; }
body.review-mode { display: grid !important; grid-template-columns: 1fr 340px; min-height: 100vh; }
body.review-mode.review-collapsed { grid-template-columns: 1fr 36px; }
body.review-mode .preview-wrap { display: block !important; grid-column: 1; margin: 0 !important; padding: 16px; box-sizing: border-box; overflow: auto; text-align: center; }
body.review-mode .preview-toolbar { display: inline-flex !important; width: auto !important; max-width: none !important; margin: 0 auto 14px !important; }
body.review-mode .document-preview { display: inline-grid !important; gap: 26px; margin: 0 auto !important; justify-content: center; vertical-align: top; }
body.review-mode .document-preview .page {
  transform-origin: top center;
  transform: scale(var(--landscape-review-scale, 0.72));
  margin-bottom: calc(-297mm * (1 - var(--landscape-review-scale, 0.72))) !important;
}
@media (min-width: 1500px) { body.review-mode .document-preview .page { transform: scale(0.95); margin-bottom: calc(-297mm * 0.05) !important; } }
@media (min-width: 1750px) { body.review-mode .document-preview .page { transform: none; margin-bottom: 0 !important; } }
body.review-mode.review-collapsed .document-preview .page { transform: none; margin-bottom: 0 !important; }

/* === Review mode — portrait mobile only (toggle + overlay) === */
@media (max-width: 820px) and (orientation: portrait) {
  body.review-mode { grid-template-columns: 1fr !important; }
  body.review-mode.review-collapsed { grid-template-columns: 1fr !important; }
  body.review-mode .preview-wrap { padding: 8px !important; overflow: auto !important; }
  body.review-mode .review-sidebar {
    position: fixed !important; top: 0; right: 0; bottom: 0; left: auto;
    width: 86vw !important; max-width: 340px; height: 100vh; height: 100dvh;
    transform: translateX(0); transition: transform .25s ease;
    grid-column: auto !important;
  }
  body.review-collapsed .review-sidebar { width: 86vw !important; max-width: 340px; transform: translateX(100%); }
  body.review-mode .review-sidebar-toggle {
    right: min(86vw, 340px) !important;
  }
  body.review-collapsed .review-sidebar-toggle {
    right: 0 !important;
    transform: translateY(-50%) rotate(180deg) !important;
  }
}
/* Page scale for mobile (portrait or landscape) — applied via JS variables */
@media (max-width: 820px) and (orientation: portrait),
       (orientation: landscape) and (max-height: 600px) {
  body.review-mode .document-preview .page {
    transform: scale(var(--mobile-review-scale, 0.42)) !important;
    margin-bottom: calc(-297mm * (1 - var(--mobile-review-scale, 0.42))) !important;
  }
  body.review-mode.review-collapsed .document-preview .page {
    transform: scale(var(--mobile-review-scale-full, 0.46)) !important;
    margin-bottom: calc(-297mm * (1 - var(--mobile-review-scale-full, 0.46))) !important;
  }
}
/* Landscape mobile — overlay + toggle */
@media (orientation: landscape) and (max-height: 600px) {
  body.review-mode { grid-template-columns: 1fr !important; }
  body.review-mode.review-collapsed { grid-template-columns: 1fr !important; }
  body.review-mode .preview-wrap {
    padding: 8px min(320px, 60vw) 8px 8px !important;
    overflow: auto !important;
    transition: padding .25s ease;
  }
  body.review-mode.review-collapsed .preview-wrap { padding: 8px !important; }
  body.review-mode .review-sidebar {
    position: fixed !important; top: 0; right: 0; bottom: 0; left: auto;
    width: 320px !important; max-width: 60vw; height: 100vh; height: 100dvh;
    transform: translateX(0); transition: transform .25s ease;
    grid-column: auto !important;
  }
  body.review-collapsed .review-sidebar { transform: translateX(100%); }
  body.review-mode .review-sidebar-toggle { right: min(320px, 60vw) !important; }
  body.review-collapsed .review-sidebar-toggle {
    right: 0 !important;
    transform: translateY(-50%) rotate(180deg) !important;
  }
}
/* Large screens / desktop: panel always fixed, no collapse */
@media (min-width: 821px) and (min-height: 601px) {
  body.review-mode.review-collapsed { grid-template-columns: 1fr 340px !important; }
  body.review-mode.review-collapsed .review-sidebar { width: 340px !important; transform: none !important; }
  body.review-mode.review-collapsed .review-sidebar .review-sidebar-inner { opacity: 1 !important; pointer-events: auto !important; }
}
.review-sidebar { grid-column: 2; }
body.review-mode .preview-toolbar { background: #14224a; color: #fff; padding: 12px 18px; border-radius: 10px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; }
body.review-mode .preview-toolbar strong { color: #c9a250; }

.review-sidebar { position: sticky; top: 0; align-self: start; width: 340px; height: 100vh; height: 100dvh; background: #0d1736; color: #fff; display: flex; flex-direction: column; box-shadow: -4px 0 24px rgba(0,0,0,.4); z-index: 50; transition: transform .25s ease, width .25s ease; grid-column: 2; }
body.review-collapsed .review-sidebar { width: 36px; }
.review-sidebar-inner { display: flex; flex-direction: column; flex: 1; min-height: 0; }
body.review-mode .review-sidebar-toggle { display: none !important; }
@media (max-width: 820px) and (orientation: portrait),
       (orientation: landscape) and (max-height: 600px) {
  body.review-mode .review-sidebar-toggle { display: grid !important; }
}
.review-sidebar-toggle {
  position: fixed; top: 50%; right: 340px;
  transform: translateY(-50%);
  width: 36px; height: 56px; border-radius: 10px 0 0 10px;
  background: #c9a250; color: #14224a; border: 0;
  font-size: 22px; font-weight: 900; cursor: pointer;
  box-shadow: -3px 3px 10px rgba(0,0,0,.35);
  z-index: 60; place-items: center;
  transition: right .25s ease, transform .25s ease;
}
.review-sidebar-toggle:hover { background: #d8b365; }
body.review-collapsed .review-sidebar-toggle { right: 36px; transform: translateY(-50%) rotate(180deg); }
body.review-collapsed .review-sidebar .review-sidebar-inner { opacity: 0; pointer-events: none; }
.review-side-head { padding: 14px 16px; background: linear-gradient(135deg,#14224a,#0d1736); border-bottom: 2px solid #c9a250; }
.review-side-head strong { display: block; font-size: 16px; color: #c9a250; }
.review-side-sub { display: block; font-size: 11px; opacity: .8; margin-top: 4px; }
.review-side-list { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.review-sidebar * { box-sizing: border-box; }
.review-page-card { background: rgba(255,255,255,.06) !important; border: 1px solid rgba(201,162,80,.25); border-radius: 10px; padding: 10px; color: #fff; }
.review-page-card .rpc-head { background: transparent !important; }
.review-page-card .rpc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 8px; }
.review-page-card .rpc-num { background: #14224a; color: #fff; font-weight: 900; font-size: 11px; padding: 2px 8px; border-radius: 999px; }
.review-page-card .rpc-title { font-size: 12px; font-weight: 700; flex: 1; text-align: right; color: #fff; }
.review-page-card textarea { width: 100%; min-height: 60px; max-height: 160px; padding: 8px; border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.3); color: #fff; border-radius: 6px; font-size: 12px; font-family: inherit; resize: vertical; box-sizing: border-box; }
.review-page-card textarea:focus { outline: none; border-color: #c9a250; }
.review-page-card .rpc-prev { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.review-page-card .rpc-prev-note { font-size: 11px; background: rgba(201,162,80,.12); border-right: 3px solid #c9a250; padding: 5px 8px; border-radius: 4px; opacity: .9; }
.review-send-btn { margin: 12px; padding: 12px; font-size: 15px; font-weight: 800; flex-shrink: 0; }

/* === Lawyer review === */
.lawyer-only { display: none !important; }
body.lawyer-mode .lawyer-only { display: block !important; }
.owner-only { display: none !important; }
body.owner-mode .owner-only { display: block !important; }
.auditor-only { display: none !important; }
body.auditor-mode .auditor-only { display: block !important; }
.review-approve-btn { margin: 0 12px 12px; padding: 12px; font-size: 15px; font-weight: 800; flex-shrink: 0; border: none; border-radius: 10px; cursor: pointer; color: #fff; background: linear-gradient(135deg, #1e9e55, #0f7a3d); box-shadow: 0 6px 16px rgba(15,122,61,.4); transition: transform .12s ease, box-shadow .12s ease; }
.review-approve-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(15,122,61,.5); }
.review-approve-btn:disabled { background: linear-gradient(135deg, #2bb96a, #1c8f4d); opacity: .9; cursor: default; }
.owner-approve-btn { background: linear-gradient(135deg, #2563eb, #1746b0); box-shadow: 0 6px 16px rgba(23,70,176,.4); }
.owner-approve-btn:hover:not(:disabled) { box-shadow: 0 8px 20px rgba(23,70,176,.5); }
.auditor-approve-btn { background: linear-gradient(135deg, #7c3aed, #5b21b6); box-shadow: 0 6px 16px rgba(91,33,182,.4); }
.auditor-approve-btn:hover:not(:disabled) { box-shadow: 0 8px 20px rgba(91,33,182,.5); }
.auditor-approve-btn:disabled { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.owner-approve-btn:disabled { background: linear-gradient(135deg, #3b82f6, #2563eb); opacity: .9; }

/* Approval stamp — floating overlay, never part of the booklet pages or PDF */
.lawyer-approved-stamp { position: fixed; top: 90px; inset-inline-start: 28px; z-index: 60; pointer-events: none; animation: lawStampIn .5s cubic-bezier(.2,.9,.3,1.4); }
.lawyer-approved-stamp .las-ring { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 150px; height: 150px; border-radius: 50%; border: 4px solid #0f7a3d; color: #0f7a3d; background: rgba(255,255,255,.92); box-shadow: 0 10px 30px rgba(15,122,61,.35), inset 0 0 0 3px rgba(15,122,61,.25); transform: rotate(-14deg); text-align: center; }
.lawyer-approved-stamp .las-check { font-size: 30px; line-height: 1; }
.lawyer-approved-stamp .las-text { font-size: 17px; font-weight: 900; padding: 0 8px; line-height: 1.25; letter-spacing: .2px; }
.lawyer-approved-stamp .las-date { font-size: 11px; font-weight: 700; opacity: .75; }
@keyframes lawStampIn { 0% { opacity: 0; transform: scale(1.6); } 100% { opacity: 1; transform: scale(1); } }
@media (max-width: 820px) { .lawyer-approved-stamp { top: auto; bottom: 80px; inset-inline-start: 14px; } .lawyer-approved-stamp .las-ring { width: 118px; height: 118px; } .lawyer-approved-stamp .las-text { font-size: 14px; } }
@media print { .lawyer-approved-stamp { display: none !important; } }
.owner-approved-stamp .las-ring { border-color: #1746b0; color: #1746b0; box-shadow: 0 10px 30px rgba(23,70,176,.35), inset 0 0 0 3px rgba(23,70,176,.25); }
.auditor-approved-stamp .las-ring { border-color: #5b21b6; color: #5b21b6; box-shadow: 0 10px 30px rgba(91,33,182,.35), inset 0 0 0 3px rgba(91,33,182,.25); }
/* When multiple stamps are shown, offset later ones so they never overlap (in any review role). */
#lawyerApprovedStamp:not([hidden]) ~ #ownerApprovedStamp:not([hidden]) { top: 256px; }
#lawyerApprovedStamp:not([hidden]) ~ #auditorApprovedStamp:not([hidden]),
#ownerApprovedStamp:not([hidden]) ~ #auditorApprovedStamp:not([hidden]) { top: 256px; }
#lawyerApprovedStamp:not([hidden]) ~ #ownerApprovedStamp:not([hidden]) ~ #auditorApprovedStamp:not([hidden]) { top: 422px; }
@media (max-width: 820px) {
  #lawyerApprovedStamp:not([hidden]) ~ #ownerApprovedStamp:not([hidden]) { top: auto; bottom: 220px; }
  #lawyerApprovedStamp:not([hidden]) ~ #auditorApprovedStamp:not([hidden]),
  #ownerApprovedStamp:not([hidden]) ~ #auditorApprovedStamp:not([hidden]) { top: auto; bottom: 220px; }
  #lawyerApprovedStamp:not([hidden]) ~ #ownerApprovedStamp:not([hidden]) ~ #auditorApprovedStamp:not([hidden]) { top: auto; bottom: 360px; }
}

body.review-mode .document-preview .page-controls,
body.review-mode .document-preview [data-edit] { display: none !important; }
body.review-mode .document-preview .page { pointer-events: none; }

.review-link-body { padding: 18px; }
.review-hint { color: #fff; font-size: 13px; margin-bottom: 12px; opacity: .9; }
.review-link-row { display: flex; gap: 8px; }
.review-link-row input { flex: 1; padding: 10px; border: 2px solid #c9a250; border-radius: 8px; font-size: 13px; direction: ltr; background: #fff; color: #14224a; font-family: 'Menlo','Consolas','Courier New',monospace; }
.review-status { margin-top: 10px; font-size: 13px; color: #c9a250; min-height: 18px; }
.review-security-panel { margin-top: 16px; border: 1px solid rgba(201,162,80,.4); border-radius: 10px; overflow: hidden; }
.review-security-panel summary { padding: 10px 14px; cursor: pointer; color: #c9a250; font-size: 13px; font-weight: 700; list-style: none; user-select: none; }
.review-security-panel summary::-webkit-details-marker { display: none; }
.review-security-panel[open] summary { border-bottom: 1px solid rgba(201,162,80,.3); }
.review-security-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.review-sec-row { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 13px; cursor: pointer; }
.review-sec-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: #c9a250; cursor: pointer; }
.review-sec-row input[type="datetime-local"],
.review-sec-row input[type="password"] { padding: 7px 10px; border: 1px solid rgba(201,162,80,.5); border-radius: 7px; background: rgba(255,255,255,.08); color: #fff; font-size: 13px; font-family: inherit; }
.review-sec-row input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(1); opacity: .6; }
.sm-btn { padding: 5px 10px; border: 1px solid rgba(255,255,255,.25); border-radius: 6px; background: rgba(255,255,255,.1); color: #fff; font-size: 12px; cursor: pointer; white-space: nowrap; }
.sm-btn:hover { background: rgba(255,255,255,.2); }
.review-sec-indicators { font-size: 12px; color: #94a3b8; display: flex; gap: 10px; flex-wrap: wrap; }
.review-sec-badge { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.review-sec-badge.active { background: rgba(34,197,94,.2); color: #4ade80; }
.review-sec-badge.inactive { background: rgba(100,116,139,.2); color: #94a3b8; }

.owner-notes-body { padding: 18px; overflow-y: auto; max-height: calc(100vh - 80px); }
.owner-note-group { background: #fff; color: #14224a; border-radius: 10px; padding: 14px; margin-bottom: 12px; border-right: 4px solid #14224a; }
.owner-note-group h4 { margin: 0 0 10px; font-size: 15px; color: #14224a; display: flex; gap: 8px; align-items: center; }
.owner-note-group .ong-num { background: #14224a; color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 900; }
.owner-note-item { background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px; margin-bottom: 8px; display: flex; gap: 10px; align-items: flex-start; }
.owner-note-item .oni-text { flex: 1; font-size: 13px; line-height: 1.6; white-space: pre-wrap; }
.owner-note-item .oni-ts { font-size: 10px; opacity: .6; margin-bottom: 4px; }
.owner-note-item button { background: #14224a; color: #fff; border: none; padding: 4px 10px; border-radius: 6px; font-size: 11px; cursor: pointer; font-weight: 700; }
.owner-notes-empty { color: #c9a250; text-align: center; padding: 40px 20px; font-size: 15px; }

/* The actual social post — drawn at real pixel dimensions, scaled visually */
.sp { position: relative; overflow: hidden; color: var(--navy); font-family: 'Tajawal', 'Cairo', sans-serif; direction: rtl; }
.sp-bg { position: absolute; inset: 0; background: #ffffff; }
.sp-bg::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at top right, rgba(20,34,74,.10), transparent 55%), radial-gradient(ellipse at bottom left, rgba(9,45,61,.08), transparent 55%); }
.sp-accent-top { position: absolute; top: 0; left: 0; right: 0; height: 8px; background: linear-gradient(90deg, var(--red), #d4af37, var(--red)); }
.sp-accent-bot { position: absolute; bottom: 0; left: 0; right: 0; height: 8px; background: linear-gradient(90deg, var(--red), #d4af37, var(--red)); }
.sp-content { position: relative; height: 100%; display: flex; flex-direction: column; box-sizing: border-box; }
.sp-content-h .sp-h-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.sp-content-h .sp-h-mid { flex: 1; display: grid; grid-template-columns: 1fr 1fr; align-items: center; min-height: 0; }
.sp-content-h .sp-h-left { display: flex; flex-direction: column; justify-content: center; }
.sp-content-h .sp-h-right { display: flex; align-items: center; }
.sp-content-h .sp-h-right .sp-dates { width: 100%; }
.sp-logo { display: flex; align-items: center; gap: 12px; }
.sp-logo img { object-fit: contain; background: transparent; border: 0; border-radius: 0; padding: 0; mix-blend-mode: multiply; }
.sp-logo .sp-org { font-weight: 900; color: var(--navy); line-height: 1.2; }
.sp-logo .sp-org small { display: block; color: #64748b; font-weight: 600; }
.sp-type { display: inline-block; background: linear-gradient(135deg, var(--red), #0e1834); color: #fff; padding: 8px 20px; border-radius: 999px; font-weight: 900; align-self: center; box-shadow: 0 4px 12px rgba(20,34,74,.35); white-space: nowrap; flex-shrink: 0; }
.sp-h-top { flex-wrap: wrap; }
.sp-h-top .sp-logo { min-width: 0; flex-shrink: 1; }
.sp-h-top .sp-org { min-width: 0; }
.sp-title-band { background: var(--navy); border: 2px solid #d4af37; border-radius: 14px; padding: 18px 24px; text-align: center; }
.sp-title-band .sp-company { color: #fff; font-weight: 900; line-height: 1.2; }
.sp-dates { display: grid; gap: 12px; }
.sp-date { background: #f8fafc; border: 1.5px solid #e2e8f0; border-radius: 12px; padding: 12px 16px; text-align: center; }
.sp-date h4 { margin: 0 0 6px; color: var(--red); font-weight: 900; }
.sp-date .day { color: var(--navy); font-weight: 900; }
.sp-date .date { color: #334155; font-weight: 700; }
.sp-date .date .yr { color: #94a3b8; }
.sp-foot { display: flex; justify-content: space-between; align-items: center; color: var(--navy); font-weight: 800; gap: 12px; flex-wrap: wrap; border-top: 2px solid #e2e8f0; padding-top: 10px; }
.sp-foot .sp-web { color: var(--red); }
.sp-features { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.sp-feature { display: flex; flex-direction: column; align-items: center; gap: 4px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 8px 10px; min-width: 80px; }
.sp-feature .ic { display: grid; place-items: center; background: var(--red); border-radius: 50%; }
.sp-feature .ic svg { stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sp-feature .lbl { color: #092d3d !important; font-weight: 800; text-align: center; line-height: 1.2; opacity: 1; }
.sp-social { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; color: #092d3d; font-weight: 800; width: 100%; row-gap: 6px; }
.sp-social-item { display: inline-flex; align-items: center; gap: 5px; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 999px; padding: 4px 8px; white-space: nowrap; flex-shrink: 0; }
.sp-social-ic { display: inline-grid; place-items: center; border-radius: 50%; font-weight: 900; line-height: 1; flex-shrink: 0; overflow: hidden; }
.sp-social-ic svg { width: 100%; height: 100%; display: block; }
.social-fmt-group { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 14px; padding: 14px; margin-bottom: 16px; }
.social-fmt-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.social-fmt-head h3 { margin: 0; color: var(--navy); font-size: 18px; }
.social-fmt-head .dims { color: #64748b; font-weight: 700; font-size: 13px; }
.social-fmt-head .variant-count { background: var(--red); color: #fff; padding: 2px 10px; border-radius: 999px; font-weight: 800; font-size: 12px; }
.social-variant-row { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.social-card-sub { font-weight: 800; color: var(--navy); text-align: center; padding: 4px 8px; background: #fff; border-radius: 8px; border: 1px solid #e2e8f0; margin-bottom: 8px; font-size: 13px; }
.sp-photos { width: 100%; }
.sp-photo { background-size: cover; background-position: center; border-radius: 14px; border: 3px solid #fff; box-shadow: 0 4px 12px rgba(0,0,0,.15); min-height: 0; }
.client-logo { position: absolute; top: 7mm; right: 12mm; z-index: 3; display: flex; align-items: center; gap: 6px; direction: rtl; color: var(--navy); }
.client-logo .cl-name { order: 2; }
.client-logo img { order: 1; }
.client-logo img { max-width: 28mm; max-height: 18mm; object-fit: contain; background: transparent; }
.client-logo .cl-name { line-height: 1.05; font-weight: 900; font-size: 9px; white-space: nowrap; }
.client-logo-cover { top: 10mm; right: 10mm; display: block; text-align: center; }
.client-logo-cover img { max-width: 42mm; max-height: 26mm; display: block; margin: auto; }
.client-logo-cover .cl-name { margin-top: 3px; font-size: 12px; line-height: 1.15; white-space: normal; }
.sp-client img { object-fit: contain; background: transparent; border-radius: 8px; padding: 4px; mix-blend-mode: multiply; }

/* Developer-only zone */
.dev-zone { margin: 24px 0 12px; padding: 14px 16px; background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%); border: 2px dashed #c9a250; border-radius: 12px; }
.dev-zone-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.dev-zone-icon { font-size: 24px; flex-shrink: 0; }
.dev-zone-head strong { display: block; font-size: 14px; color: #8b6914; font-weight: 900; margin-bottom: 4px; }
.dev-zone-head p { font-size: 11px; color: #6b5410; line-height: 1.5; margin: 0; }
.dev-zone-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dev-zone-actions button, .dev-zone-actions .ghost-upload { font-size: 12px; padding: 6px 12px; }

/* ===== Rich text editor (terms/section content) ===== */
.rte { border: 1px solid #cfd6e4; border-radius: 10px; overflow: hidden; background: #fff; }
.rte-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; padding: 6px; background: #f3f5fa; border-bottom: 1px solid #e2e7f0; }
.rte-toolbar button { min-width: 28px; height: 28px; padding: 0 6px; border: 1px solid #d3d9e6; background: #fff; border-radius: 6px; cursor: pointer; font-size: 14px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; color: #1f2a44; }
.rte-toolbar button:hover { background: #e7ecf6; }
.rte-toolbar select { height: 28px; border: 1px solid #d3d9e6; background: #fff; border-radius: 6px; font-size: 12px; padding: 0 4px; cursor: pointer; max-width: 110px; }
.rte-toolbar .rte-sep { width: 1px; height: 20px; background: #d3d9e6; margin: 0 3px; }
.rte-toolbar .rte-colors { display: inline-flex; gap: 2px; }
.rte-swatch { width: 18px !important; min-width: 18px !important; height: 18px; padding: 0 !important; border: 1px solid #b9c2d6; border-radius: 4px; cursor: pointer; font-size: 11px; }
.rte-area { min-height: 120px; max-height: 420px; overflow-y: auto; padding: 12px 14px; outline: none; direction: rtl; text-align: right; font-family: 'Tajawal', sans-serif; font-size: 16px; line-height: 1.8; color: #1f2937; }
.rte-area:focus { box-shadow: inset 0 0 0 2px rgba(29,58,138,.18); }
.rte-area ol, .rte-area ul { padding-inline-start: 1.6em; margin: 0 0 8px; }
.rte-area p { margin: 0 0 8px; }
.rte-area table { border-collapse: collapse; width: 100%; }
.rte-area table td, .rte-area table th { border: 1px solid #94a3b8; padding: 4px 8px; min-width: 30px; word-break: break-word; }
.rte-area table:has(colgroup), .rte-content table:has(colgroup) { table-layout: fixed; }
.rte-area img { max-width: 100%; height: auto; }
.rte-area a { color: #1d4ed8; }

/* Contextual table toolbar (shown when caret is inside a table) */
.rte-table-bar {
  position: fixed; z-index: 9999; display: none; gap: 3px; align-items: center;
  padding: 4px 6px; background: #1d3a8a; border-radius: 8px;
  box-shadow: 0 6px 20px rgba(15,23,42,.28); direction: rtl;
}
.rte-table-bar button {
  background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 5px;
  padding: 3px 7px; font-size: 12px; font-weight: 700; cursor: pointer;
  font-family: 'Tajawal', sans-serif; line-height: 1.4; white-space: nowrap;
}
.rte-table-bar button:hover { background: rgba(255,255,255,.28); }
.rte-table-bar .rte-sep { width: 1px; height: 16px; background: rgba(255,255,255,.3); margin: 0 2px; }
body.rte-resizing, body.rte-resizing * { cursor: col-resize !important; user-select: none !important; }

/* ===== Rendered rich content in the A4 preview / export ===== */
.rte-content { font-size: 19px; line-height: 1.82; font-weight: 600; direction: rtl; text-align: right; }
.rte-content p { margin: 0 0 6px; }
.rte-content ol, .rte-content ul { margin: 0 0 6px; padding-inline-start: 1.7em; }
.rte-content li { margin-bottom: 5px; }
.rte-content li::marker { font-weight: 900; }
.rte-content h1, .rte-content h2, .rte-content h3 { margin: 6px 0; font-weight: 900; color: var(--navy); }
.rte-content a { color: #1d4ed8; text-decoration: underline; }
.rte-content img { max-width: 100%; height: auto; border-radius: 6px; }
.rte-content table { border-collapse: collapse; width: 100%; margin: 6px 0; direction: rtl; }
.rte-content table td, .rte-content table th { border: 1px solid #64748b; padding: 6px 10px; text-align: right; vertical-align: top; }
.rte-content table th { background: rgba(20,34,74,.08); font-weight: 900; }
.split-section .rte-content { font-size: 14.5px; line-height: 1.7; }

/* === Template library (feature 6) === */
.templates-panel { display: flex; flex-direction: column; gap: 16px; }
.templates-panel .vars-header h2 { margin: 0 0 4px; color: var(--navy); font-size: 20px; }
.templates-toolbar { display: flex; gap: 10px; flex-wrap: wrap; }
.template-item .booklet-name { color: var(--navy); }

/* === Design templates (قوالب التصميم) === */
.design-templates-panel { display: flex; flex-direction: column; gap: 14px; }
.design-templates-panel .vars-header h2 { margin: 0 0 4px; color: var(--navy); font-size: 20px; }
.design-templates-panel .hint { font-size: 13px; color: #5b6577; line-height: 1.8; margin: 0; }
.dt-toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 6px; }
.dt-save-btn, .dt-refresh-btn, .dt-set-default-btn { font-family: inherit; font-weight: 800; font-size: 14px; padding: 10px 18px; border-radius: 10px; cursor: pointer; border: 0; }
.dt-save-btn { background: var(--navy); color: #fff; }
.dt-save-btn:hover { filter: brightness(1.1); }
.dt-set-default-btn { background: #fef9c3; color: #713f12; border: 1px solid #fde047; }
.dt-set-default-btn:hover { background: #fef08a; }
.dt-refresh-btn { background: #eef1f6; color: #14224a; border: 1px solid #d6dbe6; }
.dt-refresh-btn:hover { background: #e3e8f1; }
.dt-section-title { margin: 14px 0 4px; color: var(--navy); font-size: 15px; font-weight: 800; border-bottom: 2px solid #eef1f6; padding-bottom: 6px; }
.dt-empty { color: #8a93a3; font-style: italic; font-size: 13.5px; padding: 10px 0; }
.dt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.dt-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 2px 8px rgba(20,34,74,.05); transition: box-shadow .15s, transform .15s; }
.dt-card:hover { box-shadow: 0 6px 18px rgba(20,34,74,.12); transform: translateY(-2px); }
.dt-card-official { border-color: #c9a250; }
.dt-preview { position: relative; height: 74px; display: flex; align-items: center; justify-content: center; background: #f6f8fc; }
.dt-swatches { display: flex; gap: 0; width: 100%; height: 100%; }
.dt-swatch { flex: 1; height: 100%; }
.dt-lock { position: absolute; top: 6px; inset-inline-end: 8px; font-size: 14px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }
.dt-info { padding: 10px 12px 6px; }
.dt-name { font-weight: 800; color: var(--navy); font-size: 14.5px; margin-bottom: 6px; }
.dt-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dt-badge { font-size: 11px; font-weight: 800; padding: 2px 9px; border-radius: 999px; }
.dt-badge-official { background: #fef3c7; color: #92600a; border: 1px solid #f0c060; }
.dt-badge-company  { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }
.dt-badge-personal { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.dt-date { font-size: 11px; color: #98a2b3; }
.dt-actions { display: flex; gap: 8px; padding: 8px 12px 12px; margin-top: auto; }
.dt-apply-btn, .dt-delete-btn { flex: 1; font-family: inherit; font-weight: 800; font-size: 13px; padding: 8px 10px; border-radius: 8px; cursor: pointer; border: 0; }
.dt-apply-btn { background: var(--navy); color: #fff; }
.dt-apply-btn:hover { filter: brightness(1.12); }
.dt-delete-btn { background: #fdecec; color: #c0271a; border: 1px solid #f5c2bd; flex: 0 0 auto; }
.dt-delete-btn:hover { background: #fbdada; }

/* Design-template apply modal */
.dt-modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; z-index: 9999; padding: 20px; }
.dt-modal { background: #fff; border-radius: 16px; max-width: 460px; width: 100%; padding: 22px 24px; box-shadow: 0 18px 50px rgba(0,0,0,.3); }
.dt-modal h3 { margin: 0 0 6px; color: var(--navy); font-size: 18px; }
.dt-modal .hint { font-size: 13px; color: #5b6577; margin: 0 0 14px; line-height: 1.7; }
.dt-mode-list { display: flex; flex-direction: column; gap: 8px; }
.dt-mode-option { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1.5px solid #e2e8f0; border-radius: 10px; cursor: pointer; transition: border-color .12s, background .12s; }
.dt-mode-option:hover { border-color: #c7d2e0; background: #f8fafc; }
.dt-mode-option input { margin-top: 3px; accent-color: var(--navy); }
.dt-mode-option strong { display: block; color: var(--navy); font-size: 14px; }
.dt-mode-option span { display: block; font-size: 12px; color: #6b7588; margin-top: 2px; }
.dt-modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.dt-modal-ok, .dt-modal-cancel { flex: 1; font-family: inherit; font-weight: 800; font-size: 14px; padding: 11px; border-radius: 10px; cursor: pointer; border: 0; }
.dt-modal-ok { background: var(--navy); color: #fff; }
.dt-modal-ok:hover { filter: brightness(1.12); }
.dt-modal-cancel { background: #eef1f6; color: #14224a; border: 1px solid #d6dbe6; }
.dt-modal-cancel:hover { background: #e3e8f1; }

/* Floating preview bar */
.design-preview-bar { position: fixed; bottom: 18px; inset-inline: 0; margin-inline: auto; width: max-content; max-width: 92vw; display: flex; align-items: center; gap: 12px; background: #14224a; color: #fff; padding: 12px 18px; border-radius: 999px; box-shadow: 0 10px 30px rgba(0,0,0,.35); z-index: 9998; }
.design-preview-bar .dpb-label { font-weight: 800; font-size: 13.5px; }
.design-preview-bar button { font-family: inherit; font-weight: 800; font-size: 13px; padding: 7px 16px; border-radius: 999px; cursor: pointer; border: 0; }
.design-preview-bar .dpb-ok { background: #16a34a; color: #fff; }
.design-preview-bar .dpb-cancel { background: #fff; color: #14224a; }

/* Transient toast */
.dt-toast { position: fixed; bottom: 70px; inset-inline: 0; margin-inline: auto; width: max-content; max-width: 90vw; background: #1f2a52; color: #fff; font-weight: 800; font-size: 13.5px; padding: 11px 22px; border-radius: 999px; box-shadow: 0 8px 24px rgba(0,0,0,.3); opacity: 0; transform: translateY(10px); transition: opacity .25s, transform .25s; pointer-events: none; z-index: 10000; }
.dt-toast.show { opacity: 1; transform: translateY(0); }

/* === Approval status dashboard (feature 7) === */
.approval-dashboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.ad-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px; text-align: center; }
.ad-card.ad-ok { border-color: #16a34a; background: #f0fdf4; }
.ad-card.ad-wait { border-color: #f59e0b; background: #fffbeb; }
.ad-num { font-size: 26px; font-weight: 900; color: var(--navy); line-height: 1; }
.ad-card.ad-ok .ad-num { color: #16a34a; }
.ad-card.ad-wait .ad-num { color: #b45309; }
.ad-label { font-size: 12px; color: #64748b; margin-top: 6px; }
.approval-refresh-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.booklet-status { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.status-chip { font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.status-chip-ok { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.status-chip-ok.status-chip-owner { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.status-chip-ok.status-chip-auditor { background: #ede9fe; color: #6d28d9; border-color: #c4b5fd; }
.status-chip-pending { background: #fef3c7; color: #b45309; border: 1px solid #fcd34d; }

/* === Autosave indicator (feature 2) === */
.autosave-indicator { font-size: 12px; color: #16a34a; font-weight: 700; margin-inline-start: auto; white-space: nowrap; }

/* === Version history modal (feature 2) === */
.version-list { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; background: #f8fafc; }
.version-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 16px; }
.version-item .version-info strong { color: var(--navy); font-size: 14px; }
.version-item button.primary { padding: 8px 18px; border-radius: 8px; border: 0; background: var(--navy); color: #fff; font-weight: 800; font-family: inherit; cursor: pointer; }

/* === معاينة استيراد Excel === */
.exc-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.exc-chip { background: #f2f4f8; color: #14224a; border-radius: 14px; padding: 4px 12px; font-size: 13px; font-weight: 600; }
.exc-chip.ok { background: #e6f6ec; color: #1b7f3b; }
.exc-chip.warn { background: #fff4e0; color: #9a6700; }
.exc-chip.err { background: #fdecec; color: #c0271a; }
.exc-h { margin: 16px 0 6px; color: #14224a; border-bottom: 1px solid #e3e7ee; padding-bottom: 4px; }
.exc-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.exc-table td { border: 1px solid #e3e7ee; padding: 6px 10px; text-align: right; }
.exc-table .exc-k { background: #f7f9fc; font-weight: 600; color: #14224a; width: 38%; }
.exc-table .exc-v { color: #222; }
.exc-empty { color: #888; font-style: italic; padding: 6px 0; }
.exc-list { margin: 6px 0; padding-inline-start: 20px; }
.exc-list li { margin: 4px 0; }
.exc-warn { background: #fff4e0; color: #9a6700; border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-size: 13px; }
.exc-note { background: #f2f4f8; color: #333; border-radius: 8px; padding: 10px 12px; margin-top: 14px; font-size: 13px; line-height: 1.7; }

/* === Send Booklet modal === */
#sendBookletModal { display: none; position: fixed; inset: 0; z-index: 9000; }
#sendBookletModal[open] { display: block; }
.sb-modal-bd { position: absolute; inset: 0; background: rgba(15,23,42,.55); }
.sb-modal-panel { position: relative; background: #fff; margin: auto; top: 50%; transform: translateY(-50%); width: 94%; max-width: 520px; border-radius: 16px; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.sb-modal-head { display: flex; align-items: center; padding: 14px 18px; background: var(--navy); color: #fff; gap: 10px; }
.sb-modal-head h2 { flex: 1; margin: 0; font-size: 16px; font-weight: 900; }
.sb-close { background: rgba(255,255,255,.15); border: 0; color: #fff; width: 32px; height: 32px; border-radius: 8px; font-size: 15px; cursor: pointer; display: grid; place-items: center; }
.sb-close:hover { background: rgba(255,255,255,.3); }
.sb-modal-body { padding: 18px; display: grid; gap: 12px; }
.sb-type-row { display: flex; flex-direction: column; gap: 6px; }
.sb-type-opt { display: flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; font-size: 13px; padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 9px; }
.sb-type-opt:hover { background: #f8fafc; border-color: var(--navy); }
.sb-actions { display: flex; gap: 8px; }
.sb-actions button { flex: 1; }
.sb-msg { padding: 9px 12px; border-radius: 9px; font-weight: 700; font-size: 13px; line-height: 1.5; }
.sb-msg.ok { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.sb-msg.err { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* === Sent booklets tab === */
.sb-empty { text-align: center; padding: 40px 16px; color: #64748b; font-weight: 700; line-height: 1.8; }
.sb-list { display: grid; gap: 10px; }
.sb-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; transition: border-color .12s; }
.sb-card:hover { border-color: var(--gold); }
.sb-card.failed { border-color: #fecaca; background: #fff5f5; }
.sb-card-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.sb-card-title { font-weight: 900; color: var(--navy); font-size: 14px; }
.sb-card-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: #64748b; font-weight: 700; }
.sb-card-meta b { color: #334155; }
.sb-error-msg { font-size: 12px; color: #991b1b; font-weight: 700; margin-top: 3px; }
.sb-badge { font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.sb-badge.sent { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.sb-badge.failed { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.sb-error { color: #991b1b; padding: 16px; font-weight: 700; }

/* === Pages Drag-to-Reorder === */
.page-drag-handle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; margin-left: 6px; margin-right: -2px;
  color: #94a3b8; font-size: 18px; cursor: grab; flex-shrink: 0;
  user-select: none; line-height: 1; border-radius: 5px;
  transition: color .12s, background .12s;
}
.page-drag-handle:hover { color: var(--navy); background: #e2e8f0; }
.page-drag-handle:active { cursor: grabbing; }
[data-page-index] > summary { display: flex; align-items: center; gap: 4px; }
[data-page-index].page-dragging { opacity: .38; }
[data-page-index].page-drag-above { border-top: 3px solid var(--gold) !important; margin-top: -1px; }
[data-page-index].page-drag-below { border-bottom: 3px solid var(--gold) !important; margin-bottom: -1px; }

/* === Conditions Library === */
.cond-lib-panel summary { display: flex; align-items: center; gap: 8px; }
.cond-lib-count { margin-right: auto; font-size: 11px; font-weight: 800; background: var(--gold); color: #fff; padding: 2px 9px; border-radius: 20px; }
.cond-lib-list { display: grid; gap: 8px; margin-top: 10px; }
.cond-lib-item { display: flex; align-items: center; gap: 10px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 9px 12px; transition: border-color .12s; }
.cond-lib-item:hover { border-color: var(--gold); }
.cond-lib-item-title { flex: 1; font-weight: 700; font-size: 13px; color: var(--navy); }
.cond-lib-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.cond-lib-insert { background: var(--navy); color: #fff; border: none; border-radius: 8px; padding: 5px 12px; font-size: 12px; font-weight: 800; cursor: pointer; font-family: inherit; white-space: nowrap; }
.cond-lib-insert:hover { background: #0f1f40; }
.cond-lib-rename { background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 8px; padding: 5px 9px; font-size: 13px; cursor: pointer; }
.cond-lib-rename:hover { background: #e2e8f0; }
.cond-lib-del { padding: 5px 9px !important; font-size: 12px !important; }
.cond-lib-empty { color: #64748b; font-size: 13px; font-weight: 600; text-align: center; padding: 16px 0 6px; }
.cond-lib-save-btn { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; border-radius: 8px; padding: 4px 10px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; white-space: nowrap; }
.cond-lib-save-btn:hover { background: #fde68a; }
