/* ==========================================================================
   FAMILY PORTAL DESIGN SYSTEM & VISUAL SPECIFICATION
   Visual Reference: Approved Family Portal Concept Image
   Color Tokens: Royal Gulf Heritage Deep Green (#003C2F), Desert Gold (#C89A3D)
   Typography: Heritage Serif Headings, Clean System UI Body
   ========================================================================== */

:root {
  /* Core Palette */
  --portal-primary: #003C2F;
  --portal-primary-dark: #00251D;
  --portal-primary-deep: #001B15;
  --portal-primary-light: #0A4E3E;
  --portal-gold: #C89A3D;
  --portal-gold-light: #E0B55E;
  --portal-gold-dark: #A67B27;
  --portal-gold-glow: rgba(200, 154, 61, 0.25);
  
  /* Surfaces & Backgrounds */
  --portal-bg: #F8F7F4;
  --portal-bg-alt: #F1EFEA;
  --portal-surface: #FFFFFF;
  --portal-surface-alt: #F9F8F5;
  --portal-surface-elevated: #FFFFFF;
  --surface: #FFFFFF;
  --surface-elevated: #FAF8F5;
  
  /* Text */
  --portal-text-main: #14231E;
  --portal-text-muted: #536B61;
  --portal-text-light: #82988F;
  --text-primary: #14231E;
  --text-secondary: #536B61;
  --text-muted: #82988F;
  --text-heading: #003C2F;
  
  /* Controls, Inputs & States */
  --border-color: rgba(0, 60, 47, 0.12);
  --input-bg: #FFFFFF;
  --input-placeholder: #82988F;
  --hover-bg: rgba(0, 60, 47, 0.05);
  --active-bg: rgba(0, 60, 47, 0.1);
  
  /* Borders & Dividers */
  --portal-border: rgba(0, 60, 47, 0.1);
  --portal-border-subtle: rgba(0, 60, 47, 0.06);
  --portal-border-gold: rgba(200, 154, 61, 0.35);
  
  /* Shadows */
  --portal-shadow-xs: 0 1px 3px rgba(0, 37, 29, 0.05);
  --portal-shadow-sm: 0 2px 8px rgba(0, 37, 29, 0.06);
  --portal-shadow-md: 0 6px 20px rgba(0, 37, 29, 0.08);
  --portal-shadow-lg: 0 12px 36px rgba(0, 37, 29, 0.12);
  --portal-shadow-gold: 0 4px 20px rgba(200, 154, 61, 0.2);
  
  /* Radii */
  --portal-radius-xs: 4px;
  --portal-radius-sm: 8px;
  --portal-radius-md: 12px;
  --portal-radius-lg: 18px;
  --portal-radius-xl: 26px;
  --portal-radius-full: 9999px;

  /* Layout & Widths */
  --portal-container-max: 1320px;
  --portal-section-spacing: 5.5rem;
}

/* Dark Theme Tokens */
[data-theme="dark"] {
  --portal-bg: #07100D;
  --portal-bg-alt: #0C1A16;
  --portal-surface: #0E1F1A;
  --portal-surface-alt: #132721;
  --portal-surface-elevated: #162E27;
  --surface: #0E1F1A;
  --surface-elevated: #162E27;
  
  --portal-text-main: #E5EFEA;
  --portal-text-muted: #8EA89E;
  --portal-text-light: #678076;
  --text-primary: #E5EFEA;
  --text-secondary: #8EA89E;
  --text-muted: #678076;
  --text-heading: #DFC17B;
  
  --border-color: rgba(200, 154, 61, 0.22);
  --input-bg: #132721;
  --input-placeholder: #678076;
  --hover-bg: rgba(200, 154, 61, 0.12);
  --active-bg: rgba(200, 154, 61, 0.2);
  
  --portal-border: rgba(200, 154, 61, 0.16);
  --portal-border-subtle: rgba(255, 255, 255, 0.05);
  --portal-border-gold: rgba(200, 154, 61, 0.35);
  
  --portal-shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.3);
  --portal-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --portal-shadow-md: 0 6px 20px rgba(0, 0, 0, 0.5);
  --portal-shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.6);
  --portal-shadow-gold: 0 4px 20px rgba(200, 154, 61, 0.15);
}

/* High-Contrast Inputs, Dropdowns & Controls across Themes */
input::placeholder, textarea::placeholder, select::placeholder {
  color: var(--input-placeholder, #82988F);
  opacity: 1;
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: #8EA89E;
  opacity: 1;
}
[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background-color: var(--input-bg, #132721);
  color: var(--text-primary, #E5EFEA);
  border-color: var(--border-color, rgba(200, 154, 61, 0.25));
}
[data-theme="dark"] .portal-profile-menu {
  background: #0E1F1A !important;
  border-color: rgba(200, 154, 61, 0.35) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6) !important;
}
[data-theme="dark"] .portal-profile-item {
  color: var(--text-primary, #E5EFEA) !important;
}
[data-theme="dark"] .portal-profile-item:hover {
  background: rgba(200, 154, 61, 0.15) !important;
  color: #DFC17B !important;
}
[data-theme="dark"] .portal-profile-header-center {
  border-bottom-color: rgba(200, 154, 61, 0.2) !important;
}
[data-theme="dark"] .portal-profile-name {
  color: #FFFFFF !important;
}

/* ==========================================================================
   GLOBAL BASE & LAYOUT WIDTH SYSTEM
   ========================================================================== */
.family-portal-body {
  background-color: var(--portal-bg);
  color: var(--portal-text-main);
  font-family: var(--font-body, system-ui, -apple-system, sans-serif);
  line-height: 1.65;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.portal-drawer-open {
  overflow: hidden !important;
  touch-action: none;
}

.family-portal-main {
  flex: 1 0 auto;
}

.family-portal-container,
.portal-container {
  width: 100%;
  max-width: var(--portal-container-max);
  margin-inline: auto;
  padding-inline: 1.5rem;
  box-sizing: border-box;
}

/* Consistent Section Vertical Rhythm */
.portal-section {
  padding-block: var(--portal-section-spacing);
  position: relative;
}

.portal-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2.75rem;
  flex-wrap: wrap;
}

.portal-section-title {
  font-family: var(--font-heading, "Amiri", "Traditional Arabic", serif);
  font-size: 2rem;
  font-weight: 800;
  color: var(--portal-primary);
  margin: 0 0 0.5rem;
  line-height: 1.25;
  position: relative;
}

[data-theme="dark"] .portal-section-title {
  color: #FFFFFF;
}

.portal-section-title::after {
  content: "";
  display: block;
  width: 48px;
  height: 3px;
  background: var(--portal-gold);
  border-radius: var(--portal-radius-full);
  margin-top: 0.5rem;
}

.portal-section-subtitle {
  font-size: 1rem;
  color: var(--portal-text-muted);
  max-width: 650px;
  margin: 0;
  line-height: 1.6;
}

.portal-section-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--portal-gold-dark);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.2s ease;
  padding: 0.4rem 0.8rem;
  border-radius: var(--portal-radius-sm);
  background: rgba(200, 154, 61, 0.08);
}

.portal-section-cta:hover {
  color: var(--portal-gold);
  background: rgba(200, 154, 61, 0.16);
  transform: translateX(is_rtl() ? -4px : 4px);
}

[dir="rtl"] .portal-section-cta:hover {
  transform: translateX(-4px);
}

[dir="ltr"] .portal-section-cta:hover {
  transform: translateX(4px);
}

/* ==========================================================================
   DEDICATED FAMILY NAVBAR (DESKTOP & MOBILE ISOLATION)
   ========================================================================== */
.family-portal-navbar {
  position: sticky;
  top: 0;
  z-index: 1100;
  overflow: visible;
  background: rgba(0, 37, 29, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(200, 154, 61, 0.25);
  color: #FFFFFF;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.family-portal-navbar.is-scrolled {
  background: rgba(0, 27, 21, 0.98);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.portal-nav-container {
  max-width: var(--portal-container-max, 1320px);
  margin-inline: auto;
  padding: 0.75rem 1.25rem;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

/* Brand / Crest */
.portal-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: #FFFFFF;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

.portal-brand:hover {
  opacity: 0.92;
}

.portal-brand-crest {
  width: 2.85rem;
  height: 2.85rem;
  border-radius: var(--portal-radius-md, 10px);
  border: 1.5px solid var(--portal-gold, #C89A3D);
  background: radial-gradient(circle, rgba(200, 154, 61, 0.25) 0%, rgba(0, 60, 47, 0.6) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--portal-gold, #C89A3D);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.portal-brand-crest img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 2px;
}

.portal-brand-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.portal-brand-title {
  font-family: var(--font-heading, "Tajawal", "Segoe UI", sans-serif);
  font-size: 1.15rem;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.portal-brand-subtitle {
  font-size: 0.72rem;
  color: rgba(200, 154, 61, 0.95);
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

/* Desktop Navigation (>= 992px) */
@media (min-width: 992px) {
  .portal-nav-desktop {
    display: flex !important;
    align-items: center;
    flex: 1 1 auto;
    justify-content: center;
  }
  
  .portal-nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;
  }
  
  .portal-nav-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.65rem;
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: var(--portal-radius-md, 8px);
    border: 1px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
  }
  
  .portal-nav-links a:hover {
    color: var(--portal-gold-light, #DFC17B);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(200, 154, 61, 0.2);
  }
  
  .portal-nav-links a.active {
    color: #FFFFFF;
    background: linear-gradient(135deg, rgba(200, 154, 61, 0.25) 0%, rgba(0, 60, 47, 0.45) 100%);
    border: 1px solid rgba(200, 154, 61, 0.45);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  }
  
  /* Strictly Hide Mobile Drawer & Toggle on Desktop */
  .portal-mobile-toggle,
  .portal-mobile-drawer,
  .portal-drawer-backdrop {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
  }
}

@media (min-width: 992px) and (max-width: 1200px) {
  .portal-nav-links {
    gap: 0.15rem;
  }
  .portal-nav-links a {
    padding: 0.4rem 0.45rem;
    font-size: 0.82rem;
  }
  .portal-brand-title {
    font-size: 1.05rem;
  }
  .portal-brand-subtitle {
    font-size: 0.68rem;
  }
}

/* Actions in Navbar */
.portal-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

/* Admin Shortcut Link */
.portal-admin-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--portal-radius-md, 8px);
  background: rgba(200, 154, 61, 0.15);
  border: 1px solid rgba(200, 154, 61, 0.35);
  color: var(--portal-gold-light, #DFC17B);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.portal-admin-link:hover {
  background: rgba(200, 154, 61, 0.28);
  border-color: var(--portal-gold, #C89A3D);
  color: #FFFFFF;
}

/* Member Profile Dropdown Control (Avatar-Only Trigger) */
.portal-profile-dropdown {
  position: relative;
  display: inline-block;
  z-index: 1110;
  overflow: visible;
}

.portal-profile-trigger.avatar-only-trigger {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid var(--portal-gold, #C89A3D);
  background: radial-gradient(circle, rgba(200, 154, 61, 0.25) 0%, rgba(0, 60, 47, 0.75) 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  outline: none;
}

.portal-profile-trigger.avatar-only-trigger:hover,
.portal-profile-dropdown.is-active .portal-profile-trigger.avatar-only-trigger {
  transform: scale(1.06);
  border-color: var(--portal-gold-light, #DFC17B);
  box-shadow: 0 0 12px rgba(200, 154, 61, 0.45);
}

.portal-profile-trigger.avatar-only-trigger:focus-visible {
  outline: 2px solid var(--portal-gold, #C89A3D);
  outline-offset: 2px;
}

.portal-user-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.portal-user-initials {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 800;
  color: #FFFFFF;
}

/* Premium Floating Dropdown Menu */
.portal-profile-menu {
  position: absolute;
  top: calc(100% + 10px);
  width: 250px;
  max-width: min(260px, calc(100vw - 20px));
  background: #00221A;
  background: linear-gradient(180deg, #00281F 0%, #001913 100%);
  border: 1px solid rgba(200, 154, 61, 0.35);
  border-radius: var(--portal-radius-md, 12px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65);
  padding: 0.5rem;
  z-index: 1120;
  display: none;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

[dir="rtl"] .portal-profile-menu {
  left: 0;
  right: auto;
}

[dir="ltr"] .portal-profile-menu {
  right: 0;
  left: auto;
}

.portal-profile-dropdown.is-active .portal-profile-menu,
.portal-profile-dropdown.is-open .portal-profile-menu,
#portal-profile-menu.is-active,
#portal-profile-menu.is-open {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Top Center User Summary Card */
.portal-profile-header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.15rem 1rem 0.85rem;
  border-bottom: 1px solid rgba(200, 154, 61, 0.2);
  margin-bottom: 0.4rem;
}

.portal-profile-avatar-large-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--portal-gold, #C89A3D);
  margin-bottom: 0.6rem;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  background: radial-gradient(circle, rgba(200, 154, 61, 0.2) 0%, rgba(0, 60, 47, 0.85) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.portal-user-avatar-large {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.portal-user-initials-large {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  font-weight: 800;
  background: linear-gradient(135deg, #C89A3D 0%, #003C2F 100%);
  color: #FFFFFF;
}

.portal-profile-name {
  color: #FFFFFF;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.3;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-profile-role {
  color: var(--portal-gold-light, #DFC17B);
  font-size: 0.76rem;
  font-weight: 600;
  margin-top: 3px;
  line-height: 1.2;
}

.portal-profile-items {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.25rem 0.25rem 0.35rem;
}

.portal-profile-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s ease;
  width: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  box-sizing: border-box;
  text-align: start;
}

.portal-profile-item:hover {
  background: rgba(200, 154, 61, 0.14);
  color: #FFFFFF;
}

.portal-profile-item.logout-item {
  color: #fca5a5;
  margin-top: 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.65rem;
}

.portal-profile-item.logout-item:hover {
  background: rgba(239, 68, 68, 0.16);
  color: #fee2e2;
}

/* Guest Login Button (Create Account button completely removed) */
.portal-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 1rem;
  border-radius: var(--portal-radius-md, 8px);
  background: linear-gradient(135deg, rgba(200, 154, 61, 0.18) 0%, rgba(0, 60, 47, 0.5) 100%);
  border: 1px solid rgba(200, 154, 61, 0.45);
  color: #FFFFFF;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
}

.portal-login-btn:hover {
  background: linear-gradient(135deg, rgba(200, 154, 61, 0.3) 0%, rgba(0, 60, 47, 0.7) 100%);
  border-color: rgba(200, 154, 61, 0.7);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(200, 154, 61, 0.25);
}

.portal-lang-btn,
.portal-theme-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
  padding: 0.4rem 0.65rem;
  border-radius: var(--portal-radius-sm, 6px);
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.portal-lang-btn:hover,
.portal-theme-btn:hover {
  border-color: var(--portal-gold, #C89A3D);
  color: var(--portal-gold-light, #DFC17B);
  background: rgba(255, 255, 255, 0.08);
}

/* Mobile Toggle (< 992px) */
.portal-mobile-toggle {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
  padding: 0.45rem 0.65rem;
  border-radius: var(--portal-radius-sm, 6px);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.portal-mobile-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--portal-gold, #C89A3D);
}

/* ==========================================================================
   MOBILE OFF-CANVAS DRAWER & BACKDROP (< 992px)
   ========================================================================== */
@media (max-width: 991.98px) {
  .portal-nav-desktop {
    display: none !important;
  }
  
  /* Mobile Header Redesign: visible header on mobile contains ONLY family logo/brand, hamburger toggle, and authenticated avatar */
  .portal-nav-actions .portal-login-btn,
  .portal-nav-actions .portal-theme-btn,
  .portal-nav-actions .portal-lang-btn {
    display: none !important;
  }

  .portal-nav-actions .portal-profile-dropdown {
    display: inline-flex !important;
  }

  .portal-nav-actions .portal-profile-btn {
    padding: 0.25rem !important;
    gap: 0 !important;
    border-radius: 50% !important;
  }

  .portal-nav-actions .portal-profile-btn .portal-profile-name,
  .portal-nav-actions .portal-profile-btn .portal-profile-role,
  .portal-nav-actions .portal-profile-btn .portal-profile-chevron {
    display: none !important;
  }

  .portal-nav-actions .portal-profile-btn .portal-profile-avatar-wrap {
    margin: 0 !important;
  }
  
  .portal-mobile-toggle {
    display: inline-flex !important;
  }
  
  /* Mobile Drawer Backdrop (Single Fullscreen Overlay Behind Drawer) */
  .portal-drawer-backdrop {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(0, 15, 12, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99990;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }
  
  .portal-drawer-backdrop.is-active {
    display: block !important;
    opacity: 1;
    pointer-events: auto;
  }
  
  /* Mobile Off-Canvas Drawer */
  .portal-mobile-drawer {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    width: min(88vw, 380px);
    max-width: 380px;
    height: 100vh;
    height: 100dvh;
    background: #00221A;
    background: linear-gradient(180deg, #002B21 0%, #001611 100%);
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.7);
    z-index: 99999;
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    box-sizing: border-box;
  }
  
  /* RTL: anchored to right */
  [dir="rtl"] .portal-mobile-drawer {
    right: 0;
    left: auto;
    border-left: 1px solid rgba(200, 154, 61, 0.25);
    border-right: none;
    transform: translateX(100%);
  }
  
  /* LTR: anchored to left */
  [dir="ltr"] .portal-mobile-drawer {
    left: 0;
    right: auto;
    border-right: 1px solid rgba(200, 154, 61, 0.25);
    border-left: none;
    transform: translateX(-100%);
  }
  
  /* Opened Drawer State */
  .portal-mobile-drawer.is-open,
  .portal-mobile-drawer.open {
    transform: translateX(0) !important;
  }
  
  /* 1. Fixed Header Area */
  .portal-mobile-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid rgba(200, 154, 61, 0.2);
    background: rgba(0, 20, 15, 0.45);
    box-sizing: border-box;
    gap: 0.75rem;
  }

  .portal-mobile-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    min-width: 0;
    flex: 1;
  }

  .portal-mobile-brand .portal-brand-crest {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(200, 154, 61, 0.4);
    background: rgba(200, 154, 61, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--portal-gold-light, #DFC17B);
    flex-shrink: 0;
    overflow: hidden;
  }

  .portal-mobile-brand .portal-brand-crest img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
  }

  .portal-mobile-brand .portal-brand-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #FFFFFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
  }
  
  .portal-mobile-close {
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.85);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: var(--portal-radius-sm, 6px);
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
  }
  
  .portal-mobile-close:hover {
    background: rgba(200, 154, 61, 0.2);
    border-color: var(--portal-gold, #C89A3D);
    color: var(--portal-gold-light, #DFC17B);
  }

  /* 2. Scrollable Menu Area (Single Clean Scrollbar) */
  .portal-mobile-nav {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }
  
  .portal-mobile-links,
  .portal-mobile-menu {
    list-style: none;
    margin: 0;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
  }

  .portal-mobile-links::-webkit-scrollbar {
    width: 5px;
  }
  .portal-mobile-links::-webkit-scrollbar-track {
    background: transparent;
  }
  .portal-mobile-links::-webkit-scrollbar-thumb {
    background: rgba(200, 154, 61, 0.3);
    border-radius: 4px;
  }
  .portal-mobile-links::-webkit-scrollbar-thumb:hover {
    background: rgba(200, 154, 61, 0.55);
  }

  .portal-mobile-links li {
    margin: 0;
    padding: 0;
    list-style: none;
  }
  
  .portal-mobile-links a,
  .portal-mobile-menu a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-height: 48px;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.98rem;
    font-weight: 600;
    border-radius: var(--portal-radius-md, 8px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.2s ease;
    box-sizing: border-box;
  }

  .portal-mobile-links a .portal-mobile-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    color: var(--portal-gold, #C89A3D);
    flex-shrink: 0;
    transition: color 0.2s ease;
  }

  .portal-mobile-links a .portal-mobile-nav-label {
    flex: 1;
  }
  
  .portal-mobile-links a:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(200, 154, 61, 0.3);
    color: #FFFFFF;
  }

  .portal-mobile-links a:hover .portal-mobile-nav-icon {
    color: var(--portal-gold-light, #DFC17B);
  }
  
  .portal-mobile-links a.active {
    background: linear-gradient(135deg, rgba(200, 154, 61, 0.22) 0%, rgba(0, 60, 47, 0.45) 100%);
    border-color: var(--portal-gold, #C89A3D);
    color: var(--portal-gold-light, #DFC17B);
    font-weight: 700;
  }

  .portal-mobile-links a.active .portal-mobile-nav-icon {
    color: var(--portal-gold-light, #DFC17B);
  }
  
  /* 3. Account / Utilities Area (Fixed Bottom) */
  .portal-mobile-footer {
    flex: 0 0 auto;
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(200, 154, 61, 0.2);
    background: rgba(0, 16, 12, 0.88);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    box-sizing: border-box;
  }
  
  .portal-mobile-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 46px;
    padding: 0.75rem 1rem;
    border-radius: var(--portal-radius-md, 8px);
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    border: none;
  }
  
  .portal-mobile-login-btn {
    background: linear-gradient(135deg, rgba(200, 154, 61, 0.25) 0%, rgba(0, 60, 47, 0.6) 100%);
    border: 1px solid rgba(200, 154, 61, 0.45);
    color: #FFFFFF;
  }
  
  .portal-mobile-login-btn:hover {
    background: linear-gradient(135deg, rgba(200, 154, 61, 0.35) 0%, rgba(0, 60, 47, 0.8) 100%);
    color: #FFFFFF;
  }
  
  .portal-mobile-admin-btn {
    background: rgba(200, 154, 61, 0.18);
    border: 1px solid rgba(200, 154, 61, 0.4);
    color: var(--portal-gold-light, #DFC17B);
  }
  
  .portal-mobile-admin-btn:hover {
    background: rgba(200, 154, 61, 0.28);
    color: #FFFFFF;
  }

  .portal-mobile-subtle-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(200, 154, 61, 0.25);
    color: #FFFFFF;
  }

  .portal-mobile-subtle-btn:hover {
    background: rgba(200, 154, 61, 0.18);
    border-color: var(--portal-gold, #C89A3D);
    color: var(--portal-gold-light, #DFC17B);
  }
  
  .portal-mobile-logout-btn {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
  }
  
  .portal-mobile-logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ffffff;
  }
  
  .portal-mobile-user-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.25rem;
    color: #FFFFFF;
  }
  
  .portal-mobile-user-name {
    font-weight: 700;
    font-size: 0.95rem;
  }
  
  .portal-mobile-utils {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  
  .portal-mobile-utils .mobile-theme-btn,
  .portal-mobile-utils .mobile-lang-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0.55rem 0.75rem;
    border-radius: var(--portal-radius-md, 8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: #FFFFFF;
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .portal-mobile-utils .mobile-theme-btn:hover,
  .portal-mobile-utils .mobile-lang-btn:hover {
    background: rgba(200, 154, 61, 0.15);
    border-color: var(--portal-gold, #C89A3D);
    color: var(--portal-gold-light, #DFC17B);
  }
}

body.portal-drawer-open {
  overflow: hidden !important;
  touch-action: none;
}

/* ==========================================================================
   HOMEPAGE HERO — PREMIUM HERITAGE DESIGN (MATCHING CONCEPT IMAGE)
   ========================================================================== */
.portal-hero,
.family-portal-hero {
  position: relative;
  min-height: 440px;
  background-color: var(--portal-primary-dark);
  background-image: 
    radial-gradient(circle at 50% 20%, rgba(200, 154, 61, 0.18) 0%, transparent 60%),
    linear-gradient(180deg, #00231B 0%, #003C2F 65%, #00231B 100%);
  background-size: cover;
  background-position: center;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4.25rem 1.5rem 4.5rem;
  overflow: hidden;
  box-shadow: inset 0 -20px 40px rgba(0, 0, 0, 0.3);
}

/* Subtle Geometric Pattern Overlay */
.portal-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(200, 154, 61, 0.12) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.6;
  pointer-events: none;
  z-index: 1;
}

.portal-hero-container {
  position: relative;
  z-index: 2;
  max-width: 900px;
  margin-inline: auto;
}

.portal-hero-crest {
  width: 96px;
  height: 96px;
  margin: 0 auto 1.5rem;
  border-radius: var(--portal-radius-xl);
  border: 2px solid var(--portal-gold);
  background: radial-gradient(circle, rgba(200, 154, 61, 0.3) 0%, rgba(0, 43, 33, 0.8) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--portal-gold-light);
  box-shadow: var(--portal-shadow-gold), inset 0 0 15px rgba(200, 154, 61, 0.25);
  animation: heroPulse 4s ease-in-out infinite alternate;
}

@keyframes heroPulse {
  0% { transform: scale(1); box-shadow: 0 4px 20px rgba(200, 154, 61, 0.2); }
  100% { transform: scale(1.03); box-shadow: 0 8px 30px rgba(200, 154, 61, 0.35); }
}

.portal-hero-crest img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.portal-hero-title {
  font-family: var(--font-heading, "Amiri", "Traditional Arabic", serif);
  font-size: 3.25rem;
  font-weight: 800;
  margin: 0 0 1rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  color: #FFFFFF;
}

.portal-hero-subtitle {
  font-size: 1.25rem;
  font-weight: 400;
  max-width: 680px;
  margin: 0 auto 2.25rem;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.6;
}

.portal-hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.portal-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.85rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--portal-radius-md);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.portal-btn-primary {
  background: linear-gradient(135deg, #C89A3D 0%, #A67B27 100%);
  color: #071712;
  border: 1px solid #E0B55E;
  box-shadow: 0 4px 16px rgba(200, 154, 61, 0.35);
}

.portal-btn-primary:hover {
  background: linear-gradient(135deg, #E0B55E 0%, #C89A3D 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(200, 154, 61, 0.45);
  color: #000000;
}

.portal-btn-outline {
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(8px);
}

.portal-btn-outline:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: #FFFFFF;
  transform: translateY(-2px);
  color: #FFFFFF;
}

/* ==========================================================================
   COMPACT PAGE HEADER (NEWS, TREE, LIBRARY, MAP, CONTACT)
   ========================================================================== */
.portal-page-header {
  margin-bottom: 2.25rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--portal-border);
}

.portal-page-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.portal-breadcrumb {
  font-size: 0.84rem;
  color: var(--portal-text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.portal-breadcrumb a {
  color: var(--portal-text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.portal-breadcrumb a:hover {
  color: var(--portal-gold);
}

.portal-breadcrumb-sep {
  color: var(--portal-text-muted);
  opacity: 0.55;
  font-size: 0.9rem;
}

.portal-breadcrumb-current {
  color: var(--portal-primary);
  font-weight: 700;
}

[data-theme="dark"] .portal-breadcrumb-current {
  color: var(--portal-text-main);
}

.portal-page-title-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.portal-page-title {
  font-size: 1.95rem;
  font-weight: 800;
  color: var(--portal-primary);
  margin: 0;
  font-family: var(--font-heading, "Amiri", serif);
  line-height: 1.25;
}

[data-theme="dark"] .portal-page-title {
  color: var(--portal-text-main);
}

.portal-page-subtitle {
  font-size: 0.96rem;
  color: var(--portal-text-muted);
  margin: 0.45rem 0 0;
  max-width: 720px;
  line-height: 1.6;
}

.portal-page-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: var(--portal-radius-full);
  background: rgba(200, 154, 61, 0.15);
  color: var(--portal-gold-dark);
  border: 1px solid rgba(200, 154, 61, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

[data-theme="dark"] .portal-page-badge {
  color: var(--portal-gold);
  background: rgba(200, 154, 61, 0.2);
  border-color: rgba(200, 154, 61, 0.4);
}

/* ==========================================================================
   ABOUT PREVIEW SECTION (EDITORIAL 2-COLUMN)
   ========================================================================== */
.portal-about-preview {
  padding-block: var(--portal-section-spacing);
  background-color: var(--portal-surface);
}

[data-theme="dark"] .portal-about-preview {
  background-color: var(--portal-surface);
}

.portal-about-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 3.5rem;
  align-items: center;
}

.portal-about-collage {
  position: relative;
}

.portal-stamp-card {
  position: relative;
  background: #FFFFFF;
  padding: 1rem;
  border-radius: var(--portal-radius-lg);
  border: 1px solid var(--portal-border-gold);
  box-shadow: var(--portal-shadow-md);
  transform: rotate(-1.5deg);
  transition: transform 0.3s ease;
}

.portal-stamp-card:hover {
  transform: rotate(0deg) scale(1.02);
}

.portal-stamp-img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  border-radius: var(--portal-radius-md);
  display: block;
}

.portal-stamp-badge {
  position: absolute;
  top: -12px;
  inset-inline-end: -12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--portal-gold);
  color: #002B21;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(200, 154, 61, 0.4);
}

.portal-about-text {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.portal-about-tag {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--portal-gold-dark);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.portal-about-desc {
  font-size: 1.15rem;
  line-height: 1.85;
  color: var(--portal-text-main);
  margin: 0;
}

.portal-about-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--portal-primary);
  text-decoration: none;
  transition: all 0.2s ease;
  margin-top: 0.5rem;
}

[data-theme="dark"] .portal-about-link {
  color: var(--portal-gold);
}

.portal-about-link:hover {
  color: var(--portal-gold-dark);
  gap: 0.85rem;
}

/* ==========================================================================
   REAL STATISTICS KPI STRIP (4-CARD BALANCED)
   ========================================================================== */
.portal-stats-section {
  padding: 0;
  margin-top: -3.5rem;
  position: relative;
  z-index: 10;
}

.portal-stats-grid,
.family-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.portal-stat-card,
.family-stat-card {
  background: var(--portal-surface);
  border: 1px solid var(--portal-border);
  border-radius: var(--portal-radius-lg);
  padding: 1.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--portal-shadow-md);
  transition: all 0.3s ease;
}

.portal-stat-card:hover,
.family-stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--portal-shadow-lg);
  border-color: var(--portal-border-gold);
}

.portal-stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 60, 47, 0.08);
  color: var(--portal-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

[data-theme="dark"] .portal-stat-icon {
  background: rgba(200, 154, 61, 0.15);
  color: var(--portal-gold);
}

.portal-stat-body {
  display: flex;
  flex-direction: column;
}

.portal-stat-number {
  font-family: var(--font-heading, serif);
  font-size: 2rem;
  font-weight: 800;
  color: var(--portal-primary);
  line-height: 1.1;
}

[data-theme="dark"] .portal-stat-number {
  color: #FFFFFF;
}

.portal-stat-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--portal-text-muted);
  margin-top: 0.25rem;
}

/* ==========================================================================
   HOMEPAGE TREE PREVIEW
   ========================================================================== */
.portal-tree-preview-box,
.family-tree-preview-box {
  background: var(--portal-surface);
  border: 1px solid var(--portal-border);
  border-radius: var(--portal-radius-lg);
  padding: 2.5rem;
  box-shadow: var(--portal-shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.portal-root-ancestor,
.family-root-ancestor {
  display: inline-flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 2rem;
  background: linear-gradient(135deg, rgba(0, 60, 47, 0.06) 0%, rgba(200, 154, 61, 0.08) 100%);
  border: 1.5px solid var(--portal-border-gold);
  border-radius: var(--portal-radius-xl);
  margin-inline: auto;
}

.portal-root-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid var(--portal-gold);
  background: var(--portal-surface);
  color: var(--portal-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 1.5rem;
}

.portal-root-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portal-root-info {
  display: flex;
  flex-direction: column;
}

.portal-root-role {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--portal-gold-dark);
  text-transform: uppercase;
}

.portal-root-name {
  font-family: var(--font-heading, serif);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--portal-primary);
}

[data-theme="dark"] .portal-root-name {
  color: #FFFFFF;
}

.portal-branches-row,
.family-branches-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.portal-branch-pill,
.family-branch-pill {
  background: var(--portal-surface-alt);
  border: 1px solid var(--portal-border);
  border-radius: var(--portal-radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.2s ease;
}

.portal-branch-pill:hover {
  border-color: var(--portal-gold);
  transform: translateY(-2px);
  box-shadow: var(--portal-shadow-sm);
}

.portal-branch-icon {
  font-size: 1.5rem;
}

.portal-branch-name {
  font-weight: 700;
  color: var(--portal-primary);
}

[data-theme="dark"] .portal-branch-name {
  color: #FFFFFF;
}

.portal-branch-count {
  font-size: 0.82rem;
  color: var(--portal-text-muted);
}

/* ==========================================================================
   NEWS PREVIEW GRID & CARDS
   ========================================================================== */
.portal-news-grid,
.family-news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.portal-news-card,
.family-news-card {
  background: var(--portal-surface);
  border: 1px solid var(--portal-border);
  border-radius: var(--portal-radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--portal-shadow-sm);
  transition: all 0.3s ease;
}

.portal-news-card:hover,
.family-news-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--portal-shadow-md);
  border-color: var(--portal-border-gold);
}

.portal-news-thumb {
  position: relative;
  height: 200px;
  background: var(--portal-surface-alt);
  overflow: hidden;
}

.portal-news-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.portal-news-card:hover .portal-news-thumb img {
  transform: scale(1.05);
}

.portal-news-thumb-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--portal-gold);
  background: linear-gradient(135deg, rgba(0, 60, 47, 0.08) 0%, rgba(200, 154, 61, 0.12) 100%);
}

.portal-news-badge {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  background: rgba(0, 37, 29, 0.85);
  backdrop-filter: blur(8px);
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--portal-radius-sm);
  border: 1px solid rgba(200, 154, 61, 0.4);
}

.portal-news-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.portal-news-date {
  font-size: 0.8rem;
  color: var(--portal-gold-dark);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.portal-news-heading {
  font-family: var(--font-heading, serif);
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  line-height: 1.4;
}

.portal-news-heading a {
  color: var(--portal-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

[data-theme="dark"] .portal-news-heading a {
  color: #FFFFFF;
}

.portal-news-heading a:hover {
  color: var(--portal-gold);
}

.portal-news-excerpt {
  font-size: 0.92rem;
  color: var(--portal-text-muted);
  line-height: 1.6;
  margin: 0;
  flex-grow: 1;
}

/* ==========================================================================
   LIBRARY PREVIEW CARDS (HERITAGE MODULES)
   ========================================================================== */
.portal-library-grid,
.family-library-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.portal-lib-card,
.family-library-card {
  background: linear-gradient(145deg, #002B21 0%, #001B15 100%);
  border: 1px solid rgba(200, 154, 61, 0.35);
  border-radius: var(--portal-radius-lg);
  padding: 2.25rem 1.75rem;
  color: #FFFFFF;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  box-shadow: var(--portal-shadow-md);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.portal-lib-card::before {
  content: "";
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  width: 4px;
  bottom: 0;
  background: var(--portal-gold);
}

.portal-lib-card:hover,
.family-library-card:hover {
  transform: translateY(-4px);
  border-color: var(--portal-gold-light);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), var(--portal-shadow-gold);
}

.portal-lib-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--portal-radius-md);
  background: rgba(200, 154, 61, 0.15);
  border: 1.5px solid var(--portal-gold);
  color: var(--portal-gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.85rem;
  flex-shrink: 0;
}

.portal-lib-info {
  display: flex;
  flex-direction: column;
}

.portal-lib-title {
  font-family: var(--font-heading, serif);
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0 0 0.35rem;
  color: #FFFFFF;
}

.portal-lib-desc {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.75);
  margin: 0;
  line-height: 1.5;
}

/* ==========================================================================
   MAP PREVIEW SECTION
   ========================================================================== */
.portal-map-box,
.family-map-box {
  background: var(--portal-surface);
  border: 1px solid var(--portal-border);
  border-radius: var(--portal-radius-lg);
  overflow: hidden;
  box-shadow: var(--portal-shadow-sm);
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 380px;
}

.portal-map-regions-badge,
.portal-map-sidebar,
.family-map-sidebar {
  background: var(--portal-surface-alt);
  border-inline-end: 1px solid var(--portal-border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.portal-map-regions-title {
  font-family: var(--font-heading, serif);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--portal-primary);
  margin-bottom: 1rem;
}

[data-theme="dark"] .portal-map-regions-title {
  color: #FFFFFF;
}

.portal-map-regions-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.portal-map-regions-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  background: var(--portal-surface);
  border: 1px solid var(--portal-border-subtle);
  border-radius: var(--portal-radius-sm);
  font-size: 0.88rem;
}

.portal-reg-dot {
  font-size: 1rem;
  margin-inline-end: 0.5rem;
}

.portal-reg-name {
  flex-grow: 1;
  font-weight: 600;
  color: var(--portal-text-main);
}

.portal-reg-count {
  background: rgba(200, 154, 61, 0.15);
  color: var(--portal-gold-dark);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--portal-radius-full);
}

/* ==========================================================================
   HOMEPAGE CONTACT CTA BANNER
   ========================================================================== */
.portal-contact-cta,
.family-contact-cta {
  background: linear-gradient(135deg, #002B21 0%, #003C2F 60%, #001B15 100%);
  border: 1px solid var(--portal-border-gold);
  border-radius: var(--portal-radius-lg);
  padding: 3.5rem 2rem;
  text-align: center;
  color: #FFFFFF;
  box-shadow: var(--portal-shadow-md);
  margin-top: var(--portal-section-spacing);
  position: relative;
  overflow: hidden;
}

.portal-contact-cta::before {
  content: "";
  position: absolute;
  top: 0;
  inset-inline: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--portal-gold), transparent);
}

.portal-contact-cta h3 {
  font-family: var(--font-heading, serif);
  font-size: 2.25rem;
  font-weight: 800;
  margin: 0 0 0.75rem;
  color: #FFFFFF;
}

.portal-contact-cta p {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.85);
  max-width: 620px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

/* ==========================================================================
   ABOUT PAGE REFINEMENTS
   ========================================================================== */
.portal-about-section-card {
  background: var(--portal-surface);
  border: 1px solid var(--portal-border);
  border-radius: var(--portal-radius-lg);
  padding: 2.5rem;
  box-shadow: var(--portal-shadow-sm);
  margin-bottom: 2.5rem;
}

.portal-about-section-card:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   TREE WORKSPACE PAGE (DOMINANT CANVAS)
   ========================================================================== */
.portal-tree-workspace,
.family-tree-canvas {
  min-height: 72vh;
  min-height: 700px;
  background: var(--portal-surface);
  border: 1px solid var(--portal-border);
  border-radius: var(--portal-radius-lg);
  box-shadow: var(--portal-shadow-md);
  position: relative;
  overflow: hidden;
}

.portal-tree-toolbar,
.family-tree-toolbar {
  padding: 0.85rem 1.25rem;
  background: var(--portal-surface-alt);
  border-bottom: 1px solid var(--portal-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  z-index: 10;
}

/* ==========================================================================
   CONTACT PAGE 2-COLUMN BALANCED LAYOUT
   ========================================================================== */
.portal-contact-grid,
.family-contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.65fr;
  gap: 3rem;
  align-items: start;
}

.portal-contact-info {
  background: var(--portal-surface);
  border: 1px solid var(--portal-border);
  border-radius: var(--portal-radius-lg);
  padding: 2.25rem;
  box-shadow: var(--portal-shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.portal-contact-form-card {
  background: var(--portal-surface);
  border: 1px solid var(--portal-border);
  border-radius: var(--portal-radius-lg);
  padding: 2.5rem 2.25rem;
  box-shadow: var(--portal-shadow-sm);
  max-width: 760px;
}

/* ==========================================================================
   REUSABLE POLISHED EMPTY STATES
   ========================================================================== */
.family-empty-state,
.portal-empty-state {
  text-align: center;
  padding: 3.5rem 2rem;
  background: var(--portal-surface-alt);
  border: 1.5px dashed var(--portal-border);
  border-radius: var(--portal-radius-lg);
  margin-block: 1.5rem;
}

.portal-empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  background: rgba(200, 154, 61, 0.12);
  color: var(--portal-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.85rem;
}

.portal-empty-title {
  font-family: var(--font-heading, serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--portal-primary);
  margin: 0 0 0.5rem;
}

[data-theme="dark"] .portal-empty-title {
  color: #FFFFFF;
}

.portal-empty-desc {
  font-size: 0.95rem;
  color: var(--portal-text-muted);
  max-width: 480px;
  margin: 0 auto;
}

/* ==========================================================================
   FAMILY PORTAL FOOTER (3-COLUMN RESPONSIVE)
   ========================================================================== */
.family-portal-footer,
[data-theme="light"] .family-portal-footer,
[data-theme="dark"] .family-portal-footer {
  background: linear-gradient(180deg, #003328 0%, #00221A 100%) !important;
  color: #F7F5F0 !important;
  padding: 4.5rem 0 2rem;
  border-top: 1px solid rgba(200, 154, 61, 0.25) !important;
  margin-top: auto;
}

/* Branch Portal Dedicated Footer - Permanent Deep Emerald in BOTH Themes */
.branch-portal-footer,
[data-theme="light"] .branch-portal-footer,
[data-theme="dark"] .branch-portal-footer {
  background: linear-gradient(180deg, #003328 0%, #00221A 100%) !important;
  color: #F7F5F0 !important;
  border-top: 1px solid rgba(200, 154, 61, 0.3) !important;
}

.portal-footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 3.5rem;
  padding-bottom: 2.5rem;
}

.portal-footer-identity {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.portal-footer-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.portal-footer-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--portal-radius-md);
  border: 1.5px solid var(--portal-gold);
  background: radial-gradient(circle, rgba(200, 154, 61, 0.2) 0%, rgba(0, 60, 47, 0.5) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--portal-gold);
  overflow: hidden;
}

.portal-footer-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portal-footer-name {
  font-family: var(--font-heading, serif);
  font-size: 1.35rem;
  font-weight: 800;
  color: #FFFFFF;
}

.portal-footer-tagline {
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.6;
  margin: 0;
  max-width: 380px;
}

.portal-footer-col-title {
  font-family: var(--font-heading, serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--portal-gold-light);
  margin: 0 0 1.25rem;
  position: relative;
  padding-bottom: 0.5rem;
}

.portal-footer-col-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  inset-inline-start: 0;
  width: 24px;
  height: 2px;
  background: var(--portal-gold);
}

.portal-footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.portal-footer-links a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 0.92rem;
  transition: all 0.2s ease;
  display: inline-block;
}

.portal-footer-links a:hover {
  color: var(--portal-gold-light);
  transform: translateX(is_rtl() ? -3px : 3px);
}

[dir="rtl"] .portal-footer-links a:hover {
  transform: translateX(-3px);
}

[dir="ltr"] .portal-footer-links a:hover {
  transform: translateX(3px);
}

.portal-footer-bottom {
  width: 100% !important;
  border-top: 1px solid rgba(200, 154, 61, 0.2) !important;
  padding: 1.75rem 0 0.5rem !important;
  margin-top: 1.5rem !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  text-align: center !important;
}

.portal-footer-copy {
  text-align: center !important;
  width: 100% !important;
  margin: 0 auto !important;
  font-size: 0.92rem !important;
  color: rgba(255, 255, 255, 0.8) !important;
  direction: rtl !important;
  display: block !important;
}

[data-theme="light"] .portal-footer-copy,
[data-theme="dark"] .portal-footer-copy {
  color: rgba(255, 255, 255, 0.8) !important;
  text-align: center !important;
}

.portal-footer-platform-link {
  color: var(--portal-gold);
  text-decoration: none;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--portal-radius-sm);
  background: rgba(200, 154, 61, 0.1);
  transition: all 0.2s ease;
}

.portal-footer-platform-link:hover {
  background: rgba(200, 154, 61, 0.2);
  color: #FFFFFF;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (COHERENT 3-TIER SYSTEM)
   ========================================================================== */
@media (max-width: 1199.98px) {
  .portal-about-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  .portal-stamp-card {
    max-width: 480px;
    margin-inline: auto;
  }
  .portal-contact-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

@media (max-width: 991.98px) {
  :root {
    --portal-section-spacing: 4rem;
  }
  .portal-stats-grid,
  .family-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .portal-news-grid,
  .family-news-grid,
  .portal-library-grid,
  .family-library-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .portal-map-box {
    grid-template-columns: 1fr;
  }
  .portal-map-regions-badge {
    border-inline-end: none;
    border-bottom: 1px solid var(--portal-border);
    max-height: 240px;
  }
  .portal-footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
  .portal-footer-identity {
    grid-column: 1 / -1;
  }
}

@media (max-width: 767.98px) {
  :root {
    --portal-section-spacing: 2.75rem;
  }
  .portal-hero,
  .family-portal-hero {
    min-height: 440px;
    padding: 3.5rem 1rem 3rem;
  }
  .portal-hero-crest {
    width: 76px;
    height: 76px;
  }
  .portal-hero-title {
    font-size: 2.15rem;
  }
  .portal-hero-subtitle {
    font-size: 1rem;
    margin-bottom: 1.75rem;
  }
  .portal-hero-actions {
    flex-direction: column;
    width: 100%;
  }
  .portal-btn {
    width: 100%;
    justify-content: center;
  }
  .portal-stats-grid,
  .family-stats-grid {
    grid-template-columns: 1fr;
    margin-top: -1.75rem;
  }
  .portal-news-grid,
  .family-news-grid,
  .portal-library-grid,
  .family-library-grid {
    grid-template-columns: 1fr;
  }
  .portal-branches-row {
    grid-template-columns: 1fr;
  }
  .portal-footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .portal-page-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
  }
  .portal-page-title {
    font-size: 1.55rem;
  }
  .portal-page-subtitle {
    font-size: 0.88rem;
  }
  .portal-footer-bottom {
    flex-direction: column;
    text-align: center;
    justify-content: center;
    align-items: center;
  }
}

/* ==========================================================================
   Member Profile Module - Heritage Emerald & Gold Identity
   ========================================================================== */
.member-profile-wrapper {
  min-height: 80vh;
  padding-bottom: 4rem;
}

/* Compact Premium Banner */
.member-profile-hero {
  background: linear-gradient(135deg, #092e23 0%, #003c2f 60%, #164639 100%);
  border-bottom: 2px solid rgba(200, 154, 61, 0.35);
  padding: 2.5rem 0 2.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 42, 34, 0.15);
}

.member-profile-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 10% 20%, rgba(200, 154, 61, 0.08) 0%, transparent 40%),
                    radial-gradient(circle at 90% 80%, rgba(200, 154, 61, 0.08) 0%, transparent 40%);
  pointer-events: none;
}

.member-hero-content {
  position: relative;
  z-index: 2;
  text-align: right;
}

[dir="ltr"] .member-hero-content {
  text-align: left;
}

.member-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.85rem;
  background: rgba(200, 154, 61, 0.15);
  border: 1px solid rgba(200, 154, 61, 0.4);
  border-radius: var(--radius-full);
  color: var(--brand-warm-gold);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.member-hero-title {
  color: #ffffff;
  font-size: 2rem;
  font-weight: 800;
  margin: 0 0 0.5rem 0;
  font-family: var(--font-family-arabic);
  letter-spacing: -0.02em;
}

.member-hero-subtitle {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1rem;
  margin: 0;
  max-width: 600px;
  line-height: 1.6;
}

/* Container */
.member-profile-container {
  margin-top: 2rem;
}

/* Missing Member Link Alert */
.member-alert-warning {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: rgba(221, 107, 32, 0.1);
  border: 1px solid rgba(221, 107, 32, 0.35);
  border-right: 4px solid #dd6b20;
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  color: #dd6b20;
}

[dir="ltr"] .member-alert-warning {
  border-right: 1px solid rgba(221, 107, 32, 0.35);
  border-left: 4px solid #dd6b20;
}

.member-alert-icon {
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.member-alert-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.25rem;
  color: #c05621;
}

[data-theme="dark"] .member-alert-title {
  color: #f6ad55;
}

.member-alert-text {
  font-size: 0.92rem;
  margin: 0;
  line-height: 1.5;
  color: var(--text-primary);
}

/* General Member Card */
.member-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.member-card:hover {
  box-shadow: var(--shadow-md);
}

/* Identity Card */
.member-identity-card {
  background: linear-gradient(145deg, var(--bg-card) 0%, var(--bg-surface-elevated) 100%);
  border: 1px solid rgba(200, 154, 61, 0.35);
  padding: 2rem;
}

.member-identity-grid {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.member-avatar-col {
  flex-shrink: 0;
}

.member-avatar-lg {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  border: 3px solid var(--brand-gold);
  box-shadow: 0 4px 15px rgba(200, 154, 61, 0.25);
  overflow: hidden;
  background: var(--brand-deep-green);
  display: flex;
  align-items: center;
  justify-content: center;
}

.member-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.member-avatar-fallback {
  color: var(--brand-warm-gold);
  font-size: 2.2rem;
  font-weight: 700;
  font-family: var(--font-family-arabic);
}

.member-identity-info {
  flex: 1;
}

.member-identity-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.member-name {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  font-family: var(--font-family-arabic);
}

.member-badges-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.member-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
}

.badge-emerald {
  background: rgba(0, 60, 47, 0.1);
  border: 1px solid rgba(0, 60, 47, 0.3);
  color: #003c2f;
}

[data-theme="dark"] .badge-emerald {
  background: rgba(0, 60, 47, 0.35);
  border-color: rgba(200, 154, 61, 0.3);
  color: #74d8b6;
}

.badge-gold {
  background: rgba(200, 154, 61, 0.12);
  border: 1px solid rgba(200, 154, 61, 0.35);
  color: #9b7322;
}

[data-theme="dark"] .badge-gold {
  background: rgba(200, 154, 61, 0.2);
  color: #e6bb69;
}

.badge-neutral {
  background: rgba(108, 125, 120, 0.12);
  border: 1px solid rgba(108, 125, 120, 0.3);
  color: var(--text-muted);
}

.status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38a169;
  display: inline-block;
}

.member-identity-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  background: rgba(200, 154, 61, 0.05);
  border: 1px solid rgba(200, 154, 61, 0.15);
  border-radius: var(--radius-md);
  padding: 0.65rem 1.15rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.meta-label {
  color: var(--text-muted);
  font-weight: 500;
}

.meta-value {
  color: var(--text-primary);
  font-weight: 700;
}

.meta-divider {
  width: 1px;
  height: 16px;
  background: var(--border-color);
}

/* Sections Grid */
.member-sections-grid {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: 1.75rem;
  align-items: start;
}

.member-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.card-header-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(0, 60, 47, 0.08);
  border: 1px solid rgba(200, 154, 61, 0.25);
  color: var(--brand-deep-green);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

[data-theme="dark"] .card-header-icon {
  background: rgba(200, 154, 61, 0.15);
  color: var(--brand-warm-gold);
}

.member-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.2rem 0;
  font-family: var(--font-family-arabic);
}

.member-card-sub {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

/* Family Data Table */
.member-data-table {
  display: flex;
  flex-direction: column;
}

.member-data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.95rem 0.5rem;
  border-bottom: 1px solid var(--border-light);
  gap: 1rem;
}

.member-data-row:last-child {
  border-bottom: none;
}

.data-row-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
  flex: 0 0 35%;
}

.data-row-value {
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 500;
  text-align: left;
  flex: 1;
}

[dir="rtl"] .data-row-value {
  text-align: left;
}

.data-row-value.primary-text {
  font-weight: 700;
  color: var(--text-primary);
}

.member-data-row.bio-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.bio-row .data-row-label {
  flex: none;
}

.bio-row .bio-text {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
  text-align: right;
}

[dir="ltr"] .bio-row .bio-text {
  text-align: left;
}

/* Correction Request Card */
.correction-card {
  background: linear-gradient(135deg, rgba(200, 154, 61, 0.06) 0%, rgba(0, 60, 47, 0.04) 100%);
  border: 1px dashed rgba(200, 154, 61, 0.4);
}

.correction-content {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.correction-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(200, 154, 61, 0.15);
  color: var(--brand-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.correction-text {
  flex: 1;
}

.correction-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.35rem 0;
  font-family: var(--font-family-arabic);
}

.correction-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

.correction-action {
  flex-shrink: 0;
}

/* Photo Card Body */
.photo-card-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.photo-preview-box {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.photo-preview-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--brand-gold);
  overflow: hidden;
  background: var(--brand-deep-green);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-initials {
  color: var(--brand-warm-gold);
  font-size: 1.5rem;
  font-weight: 700;
}

.photo-preview-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.photo-allowed-formats {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-primary);
}

.photo-max-size {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.remove-photo-form {
  margin-top: 0.25rem;
}

/* Forms & Inputs */
.member-form {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.required-star {
  color: #e53e3e;
}

.portal-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.92rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.portal-input:focus {
  border-color: var(--brand-gold);
  box-shadow: 0 0 0 3px rgba(200, 154, 61, 0.2);
}

.portal-input.input-readonly {
  background: var(--bg-surface-elevated);
  border-color: var(--border-light);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.85;
}

.portal-file-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-size: 0.88rem;
  cursor: pointer;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

[dir="rtl"] .form-actions {
  justify-content: flex-start;
}

/* Buttons */
.portal-btn-emerald {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  background: var(--brand-deep-green);
  color: #ffffff;
  border: 1px solid rgba(200, 154, 61, 0.3);
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 6px rgba(0, 60, 47, 0.2);
}

.portal-btn-emerald:hover {
  background: #002a22;
  border-color: var(--brand-gold);
  transform: translateY(-1px);
}

[data-theme="dark"] .portal-btn-emerald {
  background: #003c2f;
  color: #ffffff;
}

.portal-btn-gold {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  background: var(--brand-gold);
  color: #002a22;
  border: 1px solid var(--brand-gold);
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  box-shadow: 0 2px 6px rgba(200, 154, 61, 0.25);
}

.portal-btn-gold:hover {
  background: var(--brand-warm-gold);
  color: #002a22;
  transform: translateY(-1px);
}

.portal-btn-danger-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  justify-content: center;
  padding: 0.65rem 1rem;
  background: transparent;
  color: #e53e3e;
  border: 1px solid rgba(229, 62, 62, 0.35);
  border-radius: var(--radius-md);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.portal-btn-danger-outline:hover {
  background: rgba(229, 62, 62, 0.08);
  border-color: #e53e3e;
}

/* Responsive adjustments */
@media (max-width: 991px) {
  .member-sections-grid {
    grid-template-columns: 1fr;
  }
  .correction-content {
    flex-direction: column;
    text-align: center;
  }
  .correction-action {
    width: 100%;
  }
  .correction-action .portal-btn-gold {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .member-identity-grid {
    flex-direction: column;
    text-align: center;
  }
  .member-identity-header {
    justify-content: center;
  }
  .member-identity-meta {
    justify-content: center;
  }
  .meta-divider {
    display: none;
  }
  .member-data-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
  .data-row-value {
    text-align: right;
  }
  [dir="ltr"] .data-row-value {
    text-align: left;
  }
}
