/* =========================================================
   DMO report — screen-only UI around the A4 document:
   toolbar, PDF export overlay, password gate.
   Nothing here may affect the printed / exported pages.
   ========================================================= */

:root{
  --ui-green:#216E48;
  --ui-green-900:#103B28;
  --ui-gold:#A8841E;
  --ui-gold-soft:#E9D28A;
  --ui-navy:#10233B;
  --ui-navy-900:#0B1829;
  --ui-font:"Tajawal","Arial",sans-serif;
}

/* ---------- Toolbar ---------- */
.dmo-report-body{padding-top:68px}

.dmo-toolbar{
  position:fixed;
  inset:0 0 auto 0;
  z-index:9000;
  height:56px;
  display:flex;
  align-items:center;
  gap:14px;
  padding:0 18px;
  font-family:var(--ui-font);
  line-height:1.3;
  color:#fff;
  background:linear-gradient(90deg,var(--ui-navy-900),var(--ui-navy) 55%,var(--ui-green-900));
  border-bottom:1px solid rgba(233,210,138,.35);
  box-shadow:0 8px 28px rgba(11,24,41,.28);
}
.dmo-toolbar svg{width:18px;height:18px;flex:0 0 auto}
.dmo-toolbar__back{
  display:grid;place-items:center;
  width:38px;height:38px;border-radius:12px;
  color:#fff;background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.14);
  transition:background .2s;
}
.dmo-toolbar__back:hover{background:rgba(255,255,255,.18)}
.dmo-toolbar__meta{display:flex;flex-direction:column;min-width:0;margin-inline-end:auto}
.dmo-toolbar__meta b{font-size:14px;font-weight:800;letter-spacing:.04em;color:var(--ui-gold-soft);text-align:right}
.dmo-toolbar__meta span{font-size:12.5px;opacity:.82;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dmo-toolbar__actions{display:flex;gap:8px}

.dmo-btn{
  display:inline-flex;align-items:center;gap:8px;
  height:38px;padding:0 14px;
  font:700 13.5px/1 var(--ui-font);
  color:#fff;cursor:pointer;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.18);
  background:rgba(255,255,255,.08);
  transition:background .2s,transform .15s,box-shadow .2s;
}
.dmo-btn:hover{background:rgba(255,255,255,.18)}
.dmo-btn:active{transform:translateY(1px)}
.dmo-btn:focus-visible,.dmo-toolbar__back:focus-visible{outline:2px solid var(--ui-gold-soft);outline-offset:2px}
.dmo-btn[disabled]{opacity:.55;cursor:progress}
.dmo-btn--primary{
  color:var(--ui-navy-900);
  border-color:transparent;
  background:linear-gradient(135deg,#F3DE9A,var(--ui-gold));
  box-shadow:0 6px 18px rgba(168,132,30,.35);
}
.dmo-btn--primary:hover{background:linear-gradient(135deg,#F8E8B4,#B8922A)}

@media (max-width:640px){
  .dmo-toolbar{padding:0 10px;gap:8px}
  .dmo-btn span{display:none}
  .dmo-btn{padding:0 11px}
}

/* ---------- Export overlay ---------- */
.dmo-export{
  position:fixed;inset:0;z-index:9500;
  display:grid;place-items:center;
  font-family:var(--ui-font);
  background:rgba(11,24,41,.72);
  backdrop-filter:blur(6px);
}
.dmo-export[hidden]{display:none}
.dmo-export__box{
  width:min(360px,calc(100vw - 40px));
  padding:28px 26px 22px;
  text-align:center;
  border-radius:24px;
  background:#fff;color:var(--ui-navy);
  box-shadow:0 30px 80px rgba(0,0,0,.35);
  display:flex;flex-direction:column;align-items:center;gap:8px;
}
.dmo-export__box b{font-size:17px;font-weight:800}
.dmo-export__box span{font-size:14px;color:#667085}
.dmo-export__box .dmo-btn{margin-top:10px;color:var(--ui-navy);border-color:#E4E7EC;background:#F8FAFC}
.dmo-export__spinner{
  width:42px;height:42px;border-radius:50%;
  border:4px solid #EAF5EF;border-top-color:var(--ui-green);
  animation:dmo-spin .8s linear infinite;margin-bottom:6px;
}
.dmo-export__bar{width:100%;height:8px;border-radius:99px;background:#EEF2F6;overflow:hidden;margin-top:6px}
.dmo-export__bar i{display:block;height:100%;width:0;border-radius:inherit;background:linear-gradient(90deg,var(--ui-green),var(--ui-gold));transition:width .25s}
@keyframes dmo-spin{to{transform:rotate(360deg)}}

/* While html2canvas captures, pages must be at their true size and unshadowed. */
.dmo-capturing .report{zoom:1 !important}
.dmo-capturing .page{box-shadow:none !important}

@media (prefers-reduced-motion:reduce){
  .dmo-export__spinner{animation-duration:2.4s}
  .dmo-btn,.dmo-toolbar__back,.dmo-export__bar i{transition:none}
}

@media print{
  .dmo-report-body{padding-top:0 !important}
  .dmo-toolbar,.dmo-export{display:none !important}
  .report{zoom:1 !important}
}

/* ---------- Password gate ---------- */
.dmo-gate-body{
  margin:0;
  min-height:100vh;
  font-family:var(--ui-font);
  color:#fff;
  background:
    radial-gradient(circle at 12% 10%, rgba(168,132,30,.30), transparent 34%),
    radial-gradient(circle at 88% 90%, rgba(33,110,72,.42), transparent 40%),
    linear-gradient(135deg,var(--ui-navy-900) 0%,var(--ui-navy) 48%,var(--ui-green-900) 100%);
}
.dmo-gate-body *{box-sizing:border-box}
.dmo-gate{
  position:relative;
  min-height:100vh;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:22px;
  padding:32px 18px;
  overflow:hidden;
}
.dmo-gate__pattern{
  position:absolute;inset:0;pointer-events:none;
  background-image:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size:26px 26px;
  -webkit-mask-image:radial-gradient(circle at 50% 50%, #000 0%, transparent 72%);
          mask-image:radial-gradient(circle at 50% 50%, #000 0%, transparent 72%);
}
.dmo-gate__card{
  position:relative;
  width:min(460px,100%);
  padding:34px 32px 26px;
  text-align:center;
  border-radius:32px;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(233,210,138,.32);
  box-shadow:0 30px 90px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.14);
  backdrop-filter:blur(14px);
  animation:dmo-rise .5s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes dmo-rise{from{opacity:0;transform:translateY(14px)}}
.dmo-gate__logo{display:block;width:150px;height:auto;margin:0 auto 18px}
.dmo-gate__lock{
  width:58px;height:58px;margin:0 auto 14px;
  display:grid;place-items:center;border-radius:20px;
  color:var(--ui-navy-900);
  background:linear-gradient(135deg,#F3DE9A,var(--ui-gold));
  box-shadow:0 12px 30px rgba(168,132,30,.4);
}
.dmo-gate__lock svg{width:28px;height:28px}
.dmo-gate__overline{margin:0 0 6px;font-size:13px;font-weight:700;letter-spacing:.06em;color:var(--ui-gold-soft)}
.dmo-gate__title{margin:0;font-size:25px;font-weight:900;line-height:1.45}
.dmo-gate__id{
  display:inline-block;margin:10px 0 0;padding:5px 14px;
  font-size:13px;font-weight:700;letter-spacing:.08em;
  border-radius:99px;
  color:var(--ui-gold-soft);
  background:rgba(0,0,0,.22);
  border:1px solid rgba(233,210,138,.25);
}
.dmo-gate__text{margin:18px 0 20px;font-size:15px;line-height:1.9;color:rgba(255,255,255,.82)}
.dmo-gate__form{text-align:right}
.dmo-gate__form label{display:block;margin-bottom:8px;font-size:14px;font-weight:700}
.dmo-gate__field{position:relative}
.dmo-gate__field input{
  width:100%;height:54px;
  padding:0 18px 0 52px;
  font:700 17px/1 var(--ui-font);letter-spacing:.12em;
  color:#fff;
  border-radius:16px;
  border:1.5px solid rgba(255,255,255,.22);
  background:rgba(0,0,0,.24);
  outline:none;
  transition:border-color .2s,box-shadow .2s,background .2s;
}
.dmo-gate__field input:focus{border-color:var(--ui-gold-soft);box-shadow:0 0 0 4px rgba(233,210,138,.18);background:rgba(0,0,0,.32)}
.dmo-gate__field.has-error input{border-color:#FF9C9C;box-shadow:0 0 0 4px rgba(255,120,120,.16);animation:dmo-shake .4s}
@keyframes dmo-shake{20%,60%{transform:translateX(-6px)}40%,80%{transform:translateX(6px)}}
.dmo-gate__toggle{
  position:absolute;left:8px;top:8px;
  width:38px;height:38px;display:grid;place-items:center;
  border:0;border-radius:12px;cursor:pointer;
  color:rgba(255,255,255,.75);background:transparent;
}
.dmo-gate__toggle:hover,.dmo-gate__toggle[aria-pressed="true"]{color:var(--ui-gold-soft);background:rgba(255,255,255,.08)}
.dmo-gate__toggle svg{width:20px;height:20px}
.dmo-gate__hint,.dmo-gate__error{margin:8px 2px 0;font-size:13px}
.dmo-gate__hint{color:rgba(255,255,255,.6)}
.dmo-gate__error{color:#FFB4B4;font-weight:700}
.dmo-gate__submit{
  width:100%;height:54px;margin-top:18px;
  display:flex;align-items:center;justify-content:center;gap:10px;
  font:800 16px/1 var(--ui-font);
  color:var(--ui-navy-900);cursor:pointer;
  border:0;border-radius:16px;
  background:linear-gradient(135deg,#F3DE9A,var(--ui-gold));
  box-shadow:0 14px 34px rgba(168,132,30,.38);
  transition:transform .15s,box-shadow .2s,filter .2s;
}
.dmo-gate__submit:hover{filter:brightness(1.06);box-shadow:0 18px 40px rgba(168,132,30,.48)}
.dmo-gate__submit:active{transform:translateY(1px)}
.dmo-gate__submit:focus-visible,.dmo-gate__toggle:focus-visible{outline:2px solid #fff;outline-offset:3px}
.dmo-gate__submit[disabled]{opacity:.7;cursor:progress}
.dmo-gate__submit svg{width:18px;height:18px}
.dmo-gate__foot{margin:18px 0 0;font-size:13px;line-height:1.8;color:rgba(255,255,255,.6)}
.dmo-gate__brand{position:relative;margin:0;font-size:12px;letter-spacing:.14em;color:rgba(255,255,255,.5);text-align:center}

@media (max-width:480px){
  .dmo-gate__card{padding:28px 20px 22px;border-radius:26px}
  .dmo-gate__title{font-size:21px}
}
@media (prefers-reduced-motion:reduce){
  .dmo-gate__card,.dmo-gate__field.has-error input{animation:none}
}

/* ---------- Auto-fit: only applied by JS to a page whose content overflows A4 ----------
   The reference design never triggers this; it exists for generated or long
   manual text (e.g. an agency with many weak axes). */
.page.is-dense{--page-pad-y:12mm}
.page.is-dense .section-head{margin-bottom:12px}
.page.is-dense .section-head h1{font-size:26px;line-height:1.35}
.page.is-dense .card,
.page.is-dense .smart-insight,
.page.is-dense .note-box{padding:14px 16px}
.page.is-dense .insight-card{min-height:0}
.page.is-dense .insight-card .icon-badge{width:34px;height:34px;border-radius:12px;margin-bottom:6px}
.page.is-dense .insight-card .percent{font-size:24px;line-height:1.2}
.page.is-dense .card p,
.page.is-dense .smart-insight p,
.page.is-dense .note-box p{font-size:12.5px;line-height:1.7}
.page.is-dense .grid-2,
.page.is-dense .grid-3{gap:10px}
.page.is-dense .mt-20,
.page.is-dense .mt-24{margin-top:12px}
.page.is-dense table td,
.page.is-dense table th{padding-top:8px;padding-bottom:8px}
.page.is-dense .checklist{gap:6px}
