/* ===================================================================
   ديوان — منظومة متكاملة | Design System
   Self-contained. No external dependencies.
   =================================================================== */

:root {
  /* Brand */
  --navy-900: #0a1f33;
  --navy-800: #0f2a44;
  --navy-700: #173a5a;
  --navy-600: #1f4a70;
  --navy-500: #2c5d86;
  --gold: #c8a24a;
  --gold-soft: #e3c47e;
  --gold-deep: #a07e2e;

  /* Surfaces */
  --paper: #f6f3ec;
  --paper-2: #efeadf;
  --paper-3: #e7e0d2;
  --white: #ffffff;
  --ink: #16212e;
  --ink-soft: #33414f;
  --muted: #5f6e7e;
  --muted-2: #8997a6;
  --line: #dcd3c2;
  --line-strong: #c8bda6;

  /* System colors (7 core) */
  --sys1: #173a5a; /* الضابط / Controller */
  --sys2: #7a4fa3; /* التصميم / Design */
  --sys3: #c2641d; /* المقاولات / Contracting */
  --sys4: #2f8f6b; /* التشطيب / Finishing */
  --sys5: #cf3f5b; /* الإشراف / Supervision */
  --sys6: #c8a24a; /* التوريد / Marketplace */
  --sys7: #8e3b4e; /* المالي / Financial */

  /* Supporting layers (6) */
  --lay-client: #4a7c59;
  --lay-pro: #b5793f;
  --lay-admin: #566b8c;
  --lay-ai: #8455c4;
  --lay-bim: #1f9aa6;
  --lay-exp: #9a6b3f;

  /* Complexity scale */
  --cx-s: #3aa676;
  --cx-m: #4d8fc9;
  --cx-l: #e0892e;
  --cx-xl: #cf4444;

  /* Effects */
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 3px rgba(16,42,68,.06), 0 1px 2px rgba(16,42,68,.04);
  --shadow: 0 6px 22px rgba(16,42,68,.10), 0 2px 6px rgba(16,42,68,.06);
  --shadow-lg: 0 20px 50px rgba(10,31,51,.18), 0 6px 16px rgba(10,31,51,.10);
  --maxw: 1240px;

  --font: "SF Arabic", "Geeza Pro", "Tajawal", "Noto Sans Arabic", "Cairo",
          "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
  font-size: 16.5px;
  letter-spacing: .1px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 88% -10%, rgba(200,162,74,.10), transparent 42%),
    radial-gradient(circle at 5% 0%, rgba(23,58,90,.06), transparent 38%);
  background-attachment: fixed;
}

::selection { background: var(--gold-soft); color: var(--navy-900); }

a { color: inherit; text-decoration: none; }

.en { font-family: "SF Pro Text", "Segoe UI", system-ui, sans-serif; direction: ltr; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; }

/* ============================ LAYOUT ============================ */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 26px; }

.section { padding-block: 78px; position: relative; }
.section--tight { padding-block: 50px; }
.section--alt { background: linear-gradient(180deg, rgba(231,224,210,.5), rgba(246,243,236,0)); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 13px; font-weight: 700; letter-spacing: .5px;
  color: var(--gold-deep); text-transform: uppercase;
  margin-bottom: 16px;
}
.eyebrow::before { content: ""; width: 26px; height: 2px; background: var(--gold); border-radius: 2px; }

h1, h2, h3, h4 { line-height: 1.25; color: var(--navy-900); font-weight: 800; }
h1 { font-size: clamp(34px, 5vw, 58px); letter-spacing: -.5px; }
h2 { font-size: clamp(27px, 3.4vw, 40px); letter-spacing: -.3px; }
h3 { font-size: clamp(20px, 2vw, 25px); }
.lead { font-size: clamp(17px, 1.6vw, 20px); color: var(--ink-soft); max-width: 70ch; }

.section-head { max-width: 80ch; margin-bottom: 44px; }
.section-head p { color: var(--muted); margin-top: 12px; font-size: 17px; }

/* ============================ HEADER / NAV ============================ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(13, 32, 52, .92);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid rgba(200,162,74,.22);
  color: #eef2f6;
}
.nav-wrap { display: flex; align-items: center; gap: 18px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand .glyph {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(145deg, var(--gold), var(--gold-deep));
  display: grid; place-items: center; color: var(--navy-900);
  font-weight: 900; font-size: 19px; box-shadow: 0 4px 12px rgba(200,162,74,.35);
}
.brand .bt { display: flex; flex-direction: column; line-height: 1.1; }
.brand .bt b { font-size: 18px; color: #fff; font-weight: 800; }
.brand .bt span { font-size: 10px; color: var(--gold-soft); letter-spacing: .3px; }

.nav { display: flex; align-items: center; gap: 1px; margin-inline-start: auto; flex-wrap: nowrap; justify-content: flex-end; }
.nav a {
  font-size: 12.5px; font-weight: 600; color: #c4d0dd;
  padding: 7px 9px; border-radius: 8px; white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: var(--gold); color: var(--navy-900); font-weight: 700; }
.nav a.nav-logout { color: #ffd6d6; background: rgba(207,68,68,.16); border: 1px solid rgba(207,68,68,.45);
  margin-inline-start: 6px; font-weight: 700; }
.nav a.nav-logout:hover { background: rgba(207,68,68,.32); color: #fff; }

.nav-toggle { display: none; background: rgba(255,255,255,.1); border: 0; color: #fff;
  width: 42px; height: 38px; border-radius: 9px; font-size: 20px; cursor: pointer; margin-inline-start: auto; }

@media (max-width: 1200px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; top: 64px; inset-inline: 0;
    background: var(--navy-800); flex-direction: column; align-items: stretch;
    padding: 10px; gap: 3px; border-bottom: 1px solid rgba(200,162,74,.3); }
  .nav.open { display: flex; }
  .nav a { padding: 11px 14px; font-size: 15px; }
}

.progress-bar { position: fixed; top: 0; inset-inline-start: 0; height: 3px; background: var(--gold);
  width: 0; z-index: 200; transition: width .1s linear; }

/* ============================ HERO ============================ */
.hero {
  position: relative; color: #eaf0f6; overflow: hidden;
  background:
    radial-gradient(900px 500px at 85% 0%, rgba(200,162,74,.16), transparent 60%),
    radial-gradient(700px 600px at 0% 100%, rgba(44,93,134,.4), transparent 55%),
    linear-gradient(160deg, var(--navy-900), var(--navy-700) 70%, var(--navy-800));
  padding-block: clamp(70px, 11vw, 130px);
  border-bottom: 1px solid rgba(200,162,74,.25);
}
.hero::after {
  content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(circle at 70% 30%, #000, transparent 75%);
          mask-image: radial-gradient(circle at 70% 30%, #000, transparent 75%);
}
.hero .container { position: relative; z-index: 2; }
.hero h1 { color: #fff; }
.hero h1 .accent { color: var(--gold-soft); }
.hero .lead { color: #c2cfdd; margin-top: 22px; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700;
  color: var(--gold-soft); border: 1px solid rgba(200,162,74,.4);
  padding: 7px 15px; border-radius: 999px; background: rgba(200,162,74,.08); margin-bottom: 26px;
}
.hero-tag .dot { width: 8px; height: 8px; background: var(--gold); border-radius: 50%; box-shadow: 0 0 0 4px rgba(200,162,74,.2); }

.hero-stats { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 42px; }
.hero-stats .hs {
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius); padding: 16px 22px; min-width: 120px;
  backdrop-filter: blur(4px);
}
.hero-stats .hs b { display: block; font-size: 30px; color: #fff; font-weight: 800; line-height: 1; }
.hero-stats .hs span { font-size: 13px; color: var(--gold-soft); }

/* ============================ BUTTONS ============================ */
.btn { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px;
  padding: 13px 24px; border-radius: 11px; cursor: pointer; border: 1px solid transparent;
  transition: transform .12s, box-shadow .2s, background .2s; }
.btn:hover { transform: translateY(-2px); }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-deep)); color: var(--navy-900); box-shadow: 0 8px 22px rgba(200,162,74,.35); }
.btn-ghost { background: rgba(255,255,255,.07); color: #fff; border-color: rgba(255,255,255,.25); }
.btn-ghost:hover { background: rgba(255,255,255,.14); }
.btn-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 34px; }

/* ============================ CARDS / GRID ============================ */
.grid { display: grid; gap: 22px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 980px) { .g3, .g4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .2s, border-color .2s;
  position: relative; overflow: hidden;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.card .ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  font-size: 22px; margin-bottom: 16px; background: var(--paper-2); }
.card h3 { margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 15px; }
.card.accent-top::before { content: ""; position: absolute; top: 0; inset-inline: 0; height: 4px; background: var(--gold); }

/* ============================ BADGES ============================ */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; border: 1px solid transparent; line-height: 1.6; }
.badge .en { font-weight: 700; }
.cx { color: #fff; }
.cx-s { background: var(--cx-s); } .cx-m { background: var(--cx-m); }
.cx-l { background: var(--cx-l); } .cx-xl { background: var(--cx-xl); }
.cx-pill { width: 26px; height: 22px; border-radius: 6px; display: inline-flex; align-items: center;
  justify-content: center; color: #fff; font-weight: 800; font-size: 12px; line-height: 1; flex-shrink: 0; }

.chip { background: var(--paper-2); border: 1px solid var(--line); color: var(--ink-soft);
  font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 999px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ============================ TABLES ============================ */
.tbl { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); border: 1px solid var(--line); font-size: 15px; }
.tbl th { background: var(--navy-800); color: #eef2f6; font-weight: 700; text-align: start;
  padding: 14px 16px; font-size: 14px; }
.tbl td { padding: 13px 16px; border-top: 1px solid var(--line); color: var(--ink-soft); vertical-align: top; }
.tbl tr:nth-child(even) td { background: rgba(239,234,223,.4); }
.tbl tr:hover td { background: rgba(200,162,74,.07); }

/* ============================ CALLOUT ============================ */
.callout { border-radius: var(--radius); padding: 20px 24px; border: 1px solid var(--line);
  background: var(--white); display: flex; gap: 16px; box-shadow: var(--shadow-sm); }
.callout .mk { font-size: 24px; flex-shrink: 0; }
.callout h4 { margin-bottom: 5px; }
.callout p { color: var(--muted); font-size: 15px; }
.callout--gold { background: linear-gradient(135deg, rgba(200,162,74,.12), rgba(200,162,74,.04));
  border-color: rgba(200,162,74,.4); }
.callout--navy { background: linear-gradient(135deg, rgba(23,58,90,.06), transparent); border-color: rgba(23,58,90,.2); }

/* ============================ LEGEND ============================ */
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 22px; align-items: center; }
.legend .li { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-soft); font-weight: 600; }
.legend .sw { width: 16px; height: 16px; border-radius: 5px; flex-shrink: 0; }

/* ============================ FOOTER ============================ */
.site-footer { background: var(--navy-900); color: #b9c6d4; padding-block: 50px 30px; margin-top: 40px;
  border-top: 1px solid rgba(200,162,74,.25); }
.site-footer .foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 30px; margin-bottom: 30px; }
@media (max-width: 760px) { .site-footer .foot-grid { grid-template-columns: 1fr; } }
.site-footer h5 { color: #fff; font-size: 15px; margin-bottom: 12px; font-weight: 700; }
.site-footer a { display: block; color: #9fb0c0; font-size: 14px; padding: 3px 0; }
.site-footer a:hover { color: var(--gold-soft); }
.site-footer .copy { border-top: 1px solid rgba(255,255,255,.1); padding-top: 20px; font-size: 13px; color: #7e8fa0;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* ============================ REVEAL ANIMATION ============================ */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s cubic-bezier(.22,.61,.36,1), transform .6s cubic-bezier(.22,.61,.36,1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } html { scroll-behavior: auto; } }

/* ============================ PAGE NAV (prev/next) ============================ */
.pagenav { display: flex; justify-content: space-between; gap: 16px; margin-top: 30px; flex-wrap: wrap; }
.pagenav a { flex: 1; min-width: 220px; background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 22px; box-shadow: var(--shadow-sm); transition: transform .14s, box-shadow .2s; }
.pagenav a:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--gold); }
.pagenav .dir { font-size: 12px; color: var(--gold-deep); font-weight: 700; }
.pagenav .ttl { font-size: 17px; font-weight: 800; color: var(--navy-800); margin-top: 3px; }
.pagenav .nx { text-align: end; }

/* ============================ DIAGRAM PRIMITIVES ============================ */
.diagram { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 30px; box-shadow: var(--shadow); position: relative; }
.diagram-scroll { overflow-x: auto; padding-bottom: 8px; }

/* node */
.node { background: var(--white); border: 1.5px solid var(--line-strong); border-radius: 12px;
  padding: 12px 16px; box-shadow: var(--shadow-sm); font-weight: 700; font-size: 14px; }

/* ---- Ecosystem hub ---- */
.eco { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; align-items: stretch; }
@media (max-width: 900px) { .eco { grid-template-columns: 1fr; } }
.eco-hub { grid-column: 2; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 900px) { .eco-hub { grid-column: 1; order: -1; } }
.hub-core { background: linear-gradient(150deg, var(--navy-800), var(--navy-600)); color: #fff;
  border-radius: var(--radius); padding: 24px; text-align: center; box-shadow: var(--shadow-lg);
  border: 1px solid rgba(200,162,74,.4); }
.hub-core .k { font-size: 12px; color: var(--gold-soft); font-weight: 700; letter-spacing: .5px; }
.hub-core b { display: block; font-size: 22px; margin: 6px 0; }
.hub-core p { font-size: 13px; color: #c2cfdd; }

.sys-card { border-radius: var(--radius); padding: 16px 18px; color: #fff; box-shadow: var(--shadow);
  position: relative; overflow: hidden; transition: transform .15s, box-shadow .2s;
  display: flex; flex-direction: column; height: 100%; }
.sys-card:hover { box-shadow: var(--shadow-lg); }
.sys-card:hover { transform: translateY(-3px) scale(1.01); }
.sys-card .sn { font-size: 12px; opacity: .85; font-weight: 700; }
.sys-card h4 { color: #fff; font-size: 17px; margin: 3px 0 6px; }
.sys-card p { font-size: 13px; color: rgba(255,255,255,.88); line-height: 1.5; }
.sys-card .meta { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.sys-card .meta span { background: rgba(255,255,255,.18); border-radius: 7px; padding: 2px 9px; font-size: 11.5px; font-weight: 700; }

/* ---- Journey ---- */
.journey { display: flex; gap: 0; align-items: stretch; min-width: 1050px; }
.j-step { flex: 1; position: relative; padding: 0 6px; }
.j-card { background: var(--white); border: 1px solid var(--line); border-top: 4px solid var(--navy-600);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); height: 100%; }
.j-card .jn { width: 30px; height: 30px; border-radius: 50%; background: var(--navy-700); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 14px; margin-bottom: 10px; }
.j-card h4 { font-size: 15px; margin-bottom: 5px; }
.j-card p { font-size: 12.5px; color: var(--muted); }
.j-gate { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 70px; }
.gate-badge { background: linear-gradient(135deg, var(--gold), var(--gold-deep)); color: var(--navy-900);
  font-weight: 800; font-size: 11px; padding: 6px 8px; border-radius: 8px; text-align: center; box-shadow: var(--shadow-sm); }
.gate-icon { font-size: 22px; margin-bottom: 4px; }

/* ---- Flow (governance) ---- */
.flow { display: flex; flex-direction: column; gap: 0; }
.flow-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.flow-box { background: var(--white); border: 1.5px solid var(--line-strong); border-radius: 12px;
  padding: 14px 18px; font-weight: 700; box-shadow: var(--shadow-sm); min-width: 150px; text-align: center; }
.flow-box.state { background: var(--navy-700); color: #fff; border-color: var(--navy-800); }
.flow-box.gate { background: linear-gradient(135deg, rgba(200,162,74,.18), rgba(200,162,74,.06));
  border-color: var(--gold); color: var(--gold-deep); }
.flow-box.action { background: rgba(47,143,107,.1); border-color: var(--cx-s); color: #1f6e4f; }
.flow-arrow { color: var(--gold-deep); font-size: 22px; font-weight: 800; }
.flow-arrow.down { width: 100%; text-align: center; }

/* state pills */
.states { display: flex; gap: 10px; flex-wrap: wrap; }
.state-pill { padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; color: #fff; }

/* ---- Roles ---- */
.role-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .2s; }
.role-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.role-head { padding: 22px 24px; color: #fff; display: flex; align-items: center; gap: 14px; }
.role-head .ava { width: 50px; height: 50px; border-radius: 14px; background: rgba(255,255,255,.2);
  display: grid; place-items: center; font-size: 26px; flex-shrink: 0; }
.role-head h3 { color: #fff; font-size: 21px; }
.role-head .plat { font-size: 12px; color: rgba(255,255,255,.9); font-weight: 600; }
.role-body { padding: 20px 24px; }
.role-body h5 { font-size: 13px; color: var(--gold-deep); font-weight: 700; margin: 14px 0 8px; text-transform: uppercase; letter-spacing: .4px; }
.role-body ul { list-style: none; }
.role-body li { font-size: 14.5px; color: var(--ink-soft); padding: 5px 0 5px 0; display: flex; gap: 9px; align-items: flex-start; }
.role-body li::before { content: "◂"; color: var(--gold); font-size: 12px; margin-top: 4px; }

/* ---- Integrations ---- */
.intg-group { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm); }
.intg-group h4 { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.intg-group h4 .gi { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; color: #fff; }
.intg-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px dashed var(--line); }
.intg-item:first-of-type { border-top: 0; }
.intg-item .tag { font-weight: 800; color: var(--navy-800); font-size: 14.5px; }
.intg-item .ds { font-size: 13.5px; color: var(--muted); }

/* ---- Architecture layers ---- */
.arch { display: flex; flex-direction: column; gap: 12px; }
.arch-layer { border-radius: var(--radius); padding: 16px 22px; border: 1px solid var(--line);
  background: var(--white); box-shadow: var(--shadow-sm); display: flex; align-items: center; gap: 18px; }
.arch-layer .lbl { font-weight: 800; font-size: 13px; color: var(--gold-deep); writing-mode: horizontal-tb;
  min-width: 130px; }
.arch-layer .items { display: flex; flex-wrap: wrap; gap: 8px; }
.arch-layer.client { background: linear-gradient(90deg, rgba(74,124,89,.1), transparent); }
.arch-layer.api { background: linear-gradient(90deg, rgba(200,162,74,.14), transparent); border-color: var(--gold); }
.arch-layer.core { background: linear-gradient(90deg, rgba(23,58,90,.08), transparent); }
.arch-layer.data { background: linear-gradient(90deg, rgba(142,59,78,.08), transparent); }
.arch-layer.infra { background: linear-gradient(90deg, rgba(86,107,140,.1), transparent); }

/* ---- Heatmap ---- */
.heat-sys { margin-bottom: 26px; }
.heat-sys .hs-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.heat-sys .hs-bar { width: 5px; height: 30px; border-radius: 4px; }
.heat-sys h4 { font-size: 18px; }
.heat-sys .hs-meta { color: var(--muted); font-size: 13px; font-weight: 600; }
.heat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 9px; }
.heat-cell { border-radius: 10px; padding: 11px 12px; cursor: pointer; color: #fff;
  transition: transform .12s, box-shadow .2s; position: relative; min-height: 74px;
  display: flex; flex-direction: column; justify-content: space-between; }
.heat-cell:hover { transform: translateY(-3px) scale(1.03); box-shadow: var(--shadow); z-index: 3; }
.heat-cell .hc-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.heat-cell .id { font-weight: 800; font-size: 13px; opacity: .97; }
.heat-cell .nm { font-size: 11.5px; line-height: 1.35; font-weight: 600; }
.heat-cell .cxb { font-size: 10.5px; font-weight: 800; background: rgba(0,0,0,.3);
  padding: 1px 7px; border-radius: 5px; flex-shrink: 0; }

/* detail panel (modal) */
.detail-overlay { position: fixed; inset: 0; background: rgba(10,31,51,.55); backdrop-filter: blur(3px);
  z-index: 300; display: none; align-items: center; justify-content: center; padding: 20px; }
.detail-overlay.open { display: flex; }
.detail-panel { background: var(--white); border-radius: var(--radius-lg); max-width: 560px; width: 100%;
  box-shadow: var(--shadow-lg); overflow: hidden; max-height: 88vh; display: flex; flex-direction: column; }
.detail-head { padding: 22px 26px; color: #fff; }
.detail-head .did { font-size: 13px; opacity: .85; font-weight: 700; }
.detail-head h3 { color: #fff; margin: 4px 0; }
.detail-body { padding: 24px 26px; overflow-y: auto; }
.detail-body p { color: var(--ink-soft); margin-bottom: 14px; }
.detail-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.detail-close { position: absolute; top: 16px; inset-inline-start: 20px; background: rgba(255,255,255,.2);
  border: 0; color: #fff; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 18px; }

/* ---- Stat blocks ---- */
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--gold); }
.stat b { font-size: 38px; font-weight: 800; color: var(--navy-800); line-height: 1; display: block; }
.stat span { color: var(--muted); font-size: 14px; font-weight: 600; }
.stat small { color: var(--muted-2); font-size: 12px; }

/* ---- Bar chart ---- */
.bars { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 180px 1fr 52px; gap: 14px; align-items: center; }
@media (max-width: 600px) { .bar-row { grid-template-columns: 110px 1fr 42px; } }
.bar-row .bl { font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.bar-track { background: var(--paper-3); border-radius: 999px; height: 22px; overflow: hidden; position: relative; }
.bar-fill { height: 100%; border-radius: 999px; transition: width 1s cubic-bezier(.22,.61,.36,1); width: 0; }
.bar-row .bv { font-weight: 800; color: var(--navy-800); font-size: 15px; text-align: end; }

/* stacked complexity bar */
.stack-bar { display: flex; height: 30px; border-radius: 9px; overflow: hidden; box-shadow: var(--shadow-sm); }
.stack-seg { display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; min-width: 26px; }

/* ---- Roadmap ---- */
.roadmap { display: flex; flex-direction: column; gap: 22px; }
.phase { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); overflow: hidden; }
.phase-head { padding: 22px 26px; display: flex; align-items: center; gap: 18px; color: #fff; flex-wrap: wrap; }
.phase-head .pnum { width: 48px; height: 48px; border-radius: 14px; background: rgba(255,255,255,.22);
  display: grid; place-items: center; font-size: 24px; font-weight: 900; flex-shrink: 0; line-height: 1; }
.phase-head h3 { color: #fff; }
.phase-head .pmeta { margin-inline-start: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.phase-head .pmeta span { background: rgba(255,255,255,.2); border-radius: 8px; padding: 5px 12px; font-size: 13px; font-weight: 700; }
.phase-body { padding: 22px 26px; }
.gantt { display: grid; grid-template-columns: 150px 1fr; gap: 0 14px; align-items: center; margin-top: 8px; }
.gantt .gl { font-size: 14px; font-weight: 700; color: var(--ink-soft); padding: 7px 0; }
.gantt .gt { position: relative; height: 26px; background: var(--paper-2); border-radius: 7px; margin: 4px 0; }
.gantt .gb { position: absolute; inset-block: 0; border-radius: 7px; display: grid; place-items: center;
  color: #fff; font-size: 12px; font-weight: 700; }

/* timeline axis */
.time-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted-2);
  font-weight: 700; border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 6px; }

/* ---- Dependency map ---- */
.dep-wrap { position: relative; }
.dep-svg { width: 100%; height: auto; display: block; }
.dep-node { cursor: default; }
.dep-node rect, .dep-node circle { transition: filter .2s; }
.dep-node:hover rect, .dep-node:hover circle { filter: brightness(1.08); }
.dep-label { font-family: var(--font); font-weight: 800; fill: #fff; }
.dep-sub { font-family: var(--font); font-weight: 600; }

/* misc utility */
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; } .mt40 { margin-top: 40px; }
.mb0 { margin-bottom: 0; } .center { text-align: center; }
.muted { color: var(--muted); }
.divider { height: 1px; background: var(--line); margin-block: 36px; border: 0; }
.note { font-size: 13px; color: var(--muted-2); }
.kpi-line { display: flex; gap: 8px; align-items: baseline; }

/* split layout */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; align-items: center; }
.split.wide-l { grid-template-columns: 1.3fr 1fr; }
@media (max-width: 860px) { .split, .split.wide-l { grid-template-columns: 1fr; } }

/* feature list with check */
.flist { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.flist li { display: flex; gap: 12px; align-items: flex-start; font-size: 15.5px; color: var(--ink-soft); }
.flist li .ck { width: 24px; height: 24px; border-radius: 7px; background: rgba(200,162,74,.15);
  color: var(--gold-deep); display: grid; place-items: center; flex-shrink: 0; font-weight: 800; font-size: 13px; margin-top: 1px; }
.flist li b { color: var(--navy-800); }

/* pill tabs (for heatmap filter) */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.filter-btn { background: var(--white); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 16px; font-size: 13.5px; font-weight: 700; color: var(--ink-soft); cursor: pointer; transition: all .15s; }
.filter-btn:hover { border-color: var(--gold); }
.filter-btn.active { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }

/* ============================ MODAL: meta table + components table ============================ */
.detail-panel.wide { max-width: 920px; }

.meta-tbl { width: 100%; border-collapse: collapse; margin-top: 6px; }
.meta-tbl th { text-align: start; padding: 10px 14px; background: var(--paper-2); color: var(--ink-soft);
  font-weight: 700; font-size: 13.5px; width: 140px; border: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.meta-tbl td { padding: 10px 14px; border: 1px solid var(--line); font-size: 14.5px; color: var(--ink-soft); vertical-align: middle; }

.modal-meta-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 16px; }
.modal-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.modal-tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 540px; }
.modal-tbl thead th { background: var(--navy-800); color: #eef2f6; padding: 11px 13px; text-align: start;
  font-size: 13px; font-weight: 700; position: sticky; top: 0; z-index: 1; }
.modal-tbl td { padding: 11px 13px; border-top: 1px solid var(--line); color: var(--ink-soft); vertical-align: top; }
.modal-tbl tbody tr:nth-child(even) td { background: rgba(239,234,223,.45); }
.modal-tbl .rowdesc { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.55; max-width: 46ch; }
.modal-tbl td.cxcell, .modal-tbl td.numcell { text-align: center; white-space: nowrap; }

.gnum { display: inline-flex; align-items: center; justify-content: center; width: 25px; height: 25px;
  border-radius: 7px; color: #fff; font-weight: 800; font-size: 12px; line-height: 1; text-align: center; flex-shrink: 0; }
.gnum.g1 { background: var(--sys1); } .gnum.g2 { background: var(--sys5); } .gnum.g3 { background: var(--lay-ai); }
.gleg { font-size: 12.5px; color: var(--muted); margin-top: 12px; line-height: 1.9; }
.gleg b { color: var(--navy-800); }
.gleg .gnum { width: 20px; height: 20px; font-size: 11px; vertical-align: middle; }

/* تلميح صغير أسفل الجداول لشرح قيم التعقيد كمدّة تنفيذ */
.cxleg { font-size: 11px; color: var(--muted-2); margin-top: 10px; line-height: 2; }
.cxleg b { color: var(--ink-soft); font-weight: 700; }
.cxleg .cx-pill { width: 19px; height: 16px; font-size: 9.5px; border-radius: 4px; vertical-align: middle; margin-inline-start: 4px; }
.cxleg .sep { color: var(--line-strong); margin: 0 4px; }

/* تمثيل سير العمل / حالة الاستخدام داخل الـ Modal — العنوان خارج الصندوق + فاصل */
.uc-sep { border: 0; border-top: 1px solid var(--line); margin: 22px 0 0; }
.uc-title { font-size: 15.5px; margin: 16px 0 12px; color: var(--navy-800); }
.usecase { background: linear-gradient(160deg, rgba(23,58,90,.05), transparent);
  border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.ucsteps { list-style: none; display: flex; flex-direction: column; }
.ucsteps li { display: grid; grid-template-columns: 27px 1fr; gap: 12px; align-items: start;
  padding-bottom: 14px; position: relative; }
.ucsteps li:last-child { padding-bottom: 0; }
/* الموصِّل الرأسي تحت الأرقام على جهة البداية (اليمين في RTL) */
.ucsteps li::before { content: ""; position: absolute; inset-inline-start: 13px; top: 28px; bottom: -1px;
  width: 2px; background: var(--line-strong); }
.ucsteps li:last-child::before { display: none; }
.ucn { width: 27px; height: 27px; border-radius: 50%; background: var(--navy-700); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12.5px;
  line-height: 1; flex-shrink: 0; z-index: 1; box-shadow: 0 0 0 3px var(--white); }
.uct { font-size: 14.5px; color: var(--ink-soft); padding-top: 4px; line-height: 1.55; }

/* ============================ CHAINS (critical dependency chains) ============================ */
.chains { display: flex; flex-direction: column; gap: 16px; }
.chain { background: var(--white); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 20px; box-shadow: var(--shadow-sm); }
.chain-info h4 { font-size: 16px; margin-bottom: 4px; }
.chain-info p { font-size: 13.5px; color: var(--muted); margin-bottom: 16px; max-width: 90ch; }
.chain-flow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.chain-stack { display: flex; flex-direction: column; gap: 8px; }
.cnode { color: #fff; border-radius: 10px; padding: 9px 15px; font-weight: 700; font-size: 13.5px;
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; align-items: center; text-align: center;
  min-width: 130px; border: 1px solid rgba(255,255,255,.5); }
.cnode.clk { cursor: pointer; transition: transform .12s, filter .15s; }
.cnode.clk:hover { transform: translateY(-2px); filter: brightness(1.07); }
.cnode .ce { font-size: 11px; opacity: .88; margin-top: 2px; }
.chain-arrow { font-size: 27px; color: var(--gold-deep); font-weight: 800; line-height: 1; }

/* ============================ GROUP DETAIL MODAL (roadmap) ============================ */
.grp-cat { display: flex; align-items: center; gap: 9px; font-size: 16.5px; font-weight: 800;
  margin: 24px 0 6px; padding-bottom: 7px; border-bottom: 2px solid var(--line-strong); }
.grp-cat-desc { font-size: 14px; color: var(--muted); margin-bottom: 12px; line-height: 1.6; }
.phase-cta { margin-bottom: 18px; }

/* ============================ INFO POPOVER (complexity scale on hover) ============================ */
.infohint { position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 50%; background: rgba(255,255,255,.25); color: #fff;
  font-size: 11px; font-weight: 800; cursor: help; margin-inline-start: 6px; vertical-align: middle;
  font-family: var(--font); }
.tbl th .infohint { background: rgba(255,255,255,.3); }
.infopop { display: none; position: fixed; z-index: 400; width: 256px; background: var(--white); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 11px; box-shadow: var(--shadow-lg); padding: 12px 14px;
  text-align: start; font-weight: 400; cursor: default; line-height: 1.5; }
.infohint:hover .infopop, .infohint:focus .infopop, .infohint:focus-within .infopop { display: block; }
.infopop b { display: block; font-size: 12.5px; color: var(--navy-800); margin-bottom: 8px; }
.ip-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--ink-soft); padding: 4px 0; }
.ip-row .cx-pill { flex-shrink: 0; }

/* ============================ DEPENDENCY MAP (HTML nodes over SVG lines) ============================ */
.dep-canvas { position: relative; width: 100%; height: 0; }  /* الارتفاع يُضبط ديناميكياً بنسبة العرض */
.dep-canvas > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.dep-overlay { position: absolute; inset: 0; pointer-events: none; }
.dnode { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; color: #fff; border-radius: 11px;
  box-shadow: 0 3px 9px rgba(10,31,51,.28); border: 1px solid rgba(255,255,255,.55); padding: 4px 8px;
  pointer-events: auto; overflow: hidden; line-height: 1.25; }
.dnode.clk { cursor: pointer; transition: filter .15s, transform .15s; }
.dnode.clk:hover { filter: brightness(1.08); transform: translate(-50%, -50%) scale(1.04); z-index: 3; }
.dnode .dt { font-weight: 800; font-size: 13px; }
.dnode .ds { font-size: 11px; opacity: .9; margin-top: 1px; }
.dlabel { position: absolute; transform: translate(-50%, -50%); background: #fff; border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 8px; font-size: 11px; font-weight: 700; color: var(--ink-soft);
  white-space: nowrap; pointer-events: none; box-shadow: var(--shadow-sm); }
@media (max-width: 640px) { .dnode .dt { font-size: 11.5px; } .dnode .ds, .dlabel { font-size: 10px; } }

/* ============================ MATRIX DOTS (roles use-case) ============================ */
.mdot { display: inline-block; border-radius: 50%; vertical-align: middle; }
.mdot.full { width: 16px; height: 16px; background: var(--gold-deep); box-shadow: 0 0 0 3px rgba(200,162,74,.2); }
.mdot.ring { width: 15px; height: 15px; background: transparent; border: 2.5px solid var(--muted-2); }
.mdot.none { width: 5px; height: 5px; background: var(--line-strong); opacity: .6; }
.tbl td.mcell { text-align: center; }

/* ============================ FLOW BRANCH (governance API lock) ============================ */
.flow.centered { align-items: center; gap: 12px; }
.flow.centered .flow-arrow { font-size: 24px; line-height: 1; }
.flow-branch { display: flex; gap: 36px; justify-content: center; flex-wrap: wrap; width: 100%; }
.branch-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.branch-col .flow-arrow { font-size: 20px; font-weight: 800; }
.flow-box.reject { background: #fdecec; border-color: #e3a3a3; color: #a8333a; }

/* ============================ ECOSYSTEM v2 (hub on top + grid) ============================ */
.eco2 { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.eco2 .hub-core { max-width: 540px; width: 100%; cursor: pointer; transition: transform .15s, box-shadow .2s; }
.eco2 .hub-core:hover { transform: translateY(-3px); box-shadow: 0 24px 54px rgba(10,31,51,.28); }
.eco-connector { color: var(--gold-deep); font-weight: 800; font-size: 13.5px; text-align: center;
  padding: 14px 0 18px; position: relative; }
.eco-connector::before { content: ""; position: absolute; top: 0; inset-inline-start: 50%; width: 2px; height: 14px; background: var(--line-strong); }
.eco-sys { width: 100%; }
.sys-more { margin-top: auto; padding-top: 12px; font-size: 12.5px; color: rgba(255,255,255,.85); font-weight: 700; }

/* ============================ MINDMAP TREE v2 ============================ */
.tree { text-align: center; }
.tree-root { display: inline-flex; align-items: center; gap: 10px; padding: 13px 26px; border-radius: 13px;
  background: linear-gradient(135deg, var(--navy-800), var(--navy-600)); color: #fff; font-weight: 800;
  font-size: 18px; box-shadow: var(--shadow); margin-bottom: 6px; }
.tree-stem { width: 2px; height: 22px; background: var(--line-strong); margin: 0 auto; }
.tree-trunk { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; text-align: start; }
@media (max-width: 760px) { .tree-trunk { grid-template-columns: 1fr; } }
.tree-group-label { font-weight: 800; color: var(--gold-deep); text-align: center; margin-bottom: 14px;
  padding: 8px; background: var(--paper-2); border-radius: 9px; font-size: 14.5px; }
.tree-leaves { display: flex; flex-direction: column; gap: 10px; }
.tree-leaf { display: flex; align-items: center; gap: 12px; background: var(--white); border: 1px solid var(--line);
  border-inline-start: 4px solid var(--navy-600); border-radius: 11px; padding: 12px 16px; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: transform .14s, box-shadow .2s; }
.tree-leaf:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.tree-leaf .tl-ico { font-size: 20px; flex-shrink: 0; }
.tree-leaf .tl-name { font-weight: 800; color: var(--navy-800); font-size: 15px; }
.tree-leaf .tl-en { font-size: 11.5px; color: var(--muted-2); }
.tree-leaf .tl-count { margin-inline-start: auto; background: var(--paper-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 12px; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }

/* ============================ VERTICAL TIMELINE (journey) ============================ */
.vtl { position: relative; padding-block: 6px; }
.vtl::before { content: ""; position: absolute; inset-inline-start: 25px; top: 20px; bottom: 20px;
  width: 2px; background: var(--line-strong); border-radius: 2px; }
.vtl-item { position: relative; display: grid; grid-template-columns: 52px 1fr; gap: 16px; margin-bottom: 14px; }
.vtl-node { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  font-weight: 800; font-size: 15px; line-height: 1; justify-self: center; position: relative; z-index: 1;
  box-shadow: 0 0 0 4px var(--white); background: var(--navy-700); }
.vtl-card { background: var(--white); border: 1px solid var(--line); border-inline-start: 4px solid var(--navy-600);
  border-radius: 12px; padding: 14px 18px; box-shadow: var(--shadow-sm); transition: transform .14s, box-shadow .2s; }
.vtl-card.clickable { cursor: pointer; }
.vtl-card.clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-inline-start-color: var(--gold); }
.vtl-card h4 { font-size: 16.5px; margin-bottom: 3px; }
.vtl-card p { font-size: 13.5px; color: var(--muted); }
.vtl-card .more { display: inline-block; margin-top: 8px; font-size: 12.5px; color: var(--gold-deep); font-weight: 800; }
.vtl-gate .vtl-node { background: linear-gradient(135deg, var(--gold), var(--gold-deep)); color: var(--navy-900); font-size: 17px; }
.vtl-gate .vtl-card { border-inline-start-color: var(--gold);
  background: linear-gradient(135deg, rgba(200,162,74,.13), var(--white)); display: flex; align-items: center;
  gap: 12px; flex-wrap: wrap; }
.vtl-gate .vtl-card h4 { color: var(--gold-deep); font-size: 14.5px; margin: 0; }
.vtl-gate .gate-pill { font-size: 11px; font-weight: 800; color: var(--gold-deep); background: rgba(200,162,74,.18);
  padding: 3px 10px; border-radius: 999px; }

@media print {
  .site-header, .nav-toggle, .progress-bar, .pagenav, .btn-row, .detail-overlay { display: none !important; }
  body { background: #fff; }
  .card, .diagram, .tbl { box-shadow: none; border-color: #ccc; }
  .section { padding-block: 24px; }
}
