:root {
  --accent: #FF5C3E;
  --accent-hover: #E8482B;
  --accent-secondary: #FF8A3D;
  --accent-soft: #FFEDE8;
  --accent-glow: rgba(255, 92, 62, 0.22);
  --gradient: linear-gradient(135deg, #FF4D27 0%, #FFA33B 100%);
  --gradient-soft: linear-gradient(135deg, rgba(255, 77, 39, 0.08) 0%, rgba(255, 163, 59, 0.08) 100%);

  --bg-canvas: #FFFFFF;
  --bg-surface: #FFFFFF;
  --bg-surface-soft: #F7F7F9;
  --bg-surface-hover: #F1F1F4;

  --border-subtle: #F1F1F4;
  --border-strong: #E8E8ED;
  --border-interactive: #D0D5DD;

  --text-primary: #111827;
  --text-secondary: #667085;
  --text-muted: #98A2B3;
  --text-on-accent: #FFFFFF;

  --success: #12B76A;
  --success-soft: #E7F8F0;
  --warning: #F79009;
  --warning-soft: #FFF6E5;
  --danger: #F04438;
  --danger-soft: #FEECEB;
  --info: #2E90FA;
  --info-soft: #EAF2FF;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 9999px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 16px -2px rgba(16, 24, 40, 0.06), 0 2px 6px -2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 12px 32px -4px rgba(16, 24, 40, 0.08), 0 4px 12px -2px rgba(16, 24, 40, 0.03);

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Arabic", Inter, Helvetica, Arial, sans-serif;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --bg-canvas: #0B0B0F;
  --bg-surface: #141419;
  --bg-surface-soft: #1B1B22;
  --bg-surface-hover: #24242D;

  --border-subtle: #25252E;
  --border-strong: #34343F;
  --border-interactive: #45454F;

  --text-primary: #F5F5F7;
  --text-secondary: #A8A8B3;
  --text-muted: #6E6E7A;

  --accent-soft: rgba(255, 92, 62, 0.16);
  --success-soft: rgba(18, 183, 106, 0.16);
  --warning-soft: rgba(247, 144, 9, 0.16);
  --danger-soft: rgba(240, 68, 56, 0.16);
  --info-soft: rgba(46, 144, 250, 0.16);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-canvas: #0B0B0F;
    --bg-surface: #141419;
    --bg-surface-soft: #1B1B22;
    --bg-surface-hover: #24242D;

    --border-subtle: #25252E;
    --border-strong: #34343F;
    --border-interactive: #45454F;

    --text-primary: #F5F5F7;
    --text-secondary: #A8A8B3;
    --text-muted: #6E6E7A;

    --accent-soft: rgba(255, 92, 62, 0.16);
    --success-soft: rgba(18, 183, 106, 0.16);
    --warning-soft: rgba(247, 144, 9, 0.16);
    --danger-soft: rgba(240, 68, 56, 0.16);
    --info-soft: rgba(46, 144, 250, 0.16);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.6);
  }
}

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

html {
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-primary);
  background-color: var(--bg-canvas);
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-canvas);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ── Top Navigation Bar ────────────────────────────────── */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-canvas);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: var(--transition);
}

.nav-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
  flex-shrink: 0;
}

.brand-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.brand-meta {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition);
  text-decoration: none;
}

.nav-link:hover, .nav-link.active {
  color: var(--accent);
  background-color: var(--accent-soft);
  text-decoration: none;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--bg-surface-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.lang-switch-btn {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.lang-switch-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background-color: var(--accent-soft);
}

/* ── Hero Banner ───────────────────────────────────────── */
.hero-banner {
  background: var(--gradient);
  color: #FFFFFF;
  padding: 48px 20px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-banner::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.22) 0%, transparent 50%),
              radial-gradient(circle at 20% 80%, rgba(0, 0, 0, 0.12) 0%, transparent 60%);
  pointer-events: none;
}

.hero-content {
  max-width: 820px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 16px;
}

.hero-title {
  font-size: 38px;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}

.hero-subtitle {
  font-size: 17px;
  font-weight: 400;
  opacity: 0.95;
  line-height: 1.5;
  max-width: 640px;
  margin: 0 auto 20px;
}

.hero-badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.18);
  font-size: 12px;
  font-weight: 600;
}

/* ── Content Layout ────────────────────────────────────── */
.main-content {
  max-width: 900px;
  margin: -24px auto 48px;
  padding: 0 20px;
  width: 100%;
  flex: 1;
  position: relative;
  z-index: 2;
}

.article-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
}

@media (max-width: 640px) {
  .article-card {
    padding: 24px 18px;
    border-radius: var(--radius-lg);
  }
  .hero-title {
    font-size: 28px;
  }
  .hero-banner {
    padding: 36px 16px 36px;
  }
  .nav-links {
    display: none; /* Mobile menu toggled */
  }
}

/* ── Typography & Legal Sections ───────────────────────── */
.doc-section {
  margin-bottom: 36px;
}

.doc-section:last-child {
  margin-bottom: 0;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.section-num {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section-title {
  font-size: 21px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.doc-p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 16px;
}

.doc-p strong {
  color: var(--text-primary);
}

.doc-list {
  margin: 12px 0 18px 24px;
  color: var(--text-secondary);
  font-size: 15px;
}

.doc-list li {
  margin-bottom: 8px;
  line-height: 1.6;
}

.doc-list li strong {
  color: var(--text-primary);
}

/* ── Callout Alerts ────────────────────────────────────── */
.callout {
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 20px 0;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  border-inline-start: 4px solid transparent;
}

.callout-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  margin-top: 2px;
}

.callout-body {
  font-size: 14px;
  line-height: 1.6;
}

.callout-body strong {
  display: block;
  font-size: 15px;
  margin-bottom: 4px;
}

.callout.brand {
  background: var(--accent-soft);
  color: var(--text-primary);
  border-inline-start-color: var(--accent);
}
.callout.brand .callout-icon { fill: var(--accent); }

.callout.success {
  background: var(--success-soft);
  color: var(--text-primary);
  border-inline-start-color: var(--success);
}
.callout.success .callout-icon { fill: var(--success); }

.callout.warning {
  background: var(--warning-soft);
  color: var(--text-primary);
  border-inline-start-color: var(--warning);
}
.callout.warning .callout-icon { fill: var(--warning); }

.callout.info {
  background: var(--info-soft);
  color: var(--text-primary);
  border-inline-start-color: var(--info);
}
.callout.info .callout-icon { fill: var(--info); }

/* ── Grid Cards for Portal / Index ─────────────────────── */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.hub-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
}

.hub-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.hub-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.hub-card-icon svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

.hub-card-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.hub-card-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
}

.hub-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

/* ── Code / License Box ────────────────────────────────── */
.license-box {
  background: var(--bg-surface-soft);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre-wrap;
  margin: 12px 0 20px;
}

/* ── Footer ────────────────────────────────────────────── */
.page-footer {
  background: var(--bg-surface-soft);
  border-top: 1px solid var(--border-subtle);
  padding: 40px 20px 32px;
  margin-top: auto;
}

.footer-container {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  list-style: none;
}

.footer-link {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
}

.footer-link:hover {
  color: var(--accent);
}

.footer-copy {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── RTL Handling ──────────────────────────────────────── */
[dir="rtl"] {
  text-align: right;
  direction: rtl;
}

[dir="rtl"] .doc-list {
  margin: 12px 24px 18px 0;
}

[dir="rtl"] .section-header {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

[dir="rtl"] .hub-card-cta svg {
  transform: rotate(180deg);
}

/* ── Print Styles ──────────────────────────────────────── */
@media print {
  .top-nav, .nav-actions, .lang-switch-btn, .page-footer, .btn-icon {
    display: none !important;
  }
  .main-content {
    margin: 0;
    max-width: 100%;
    padding: 0;
  }
  .article-card {
    border: none;
    box-shadow: none;
    padding: 0;
  }
}
