/* Login, modals, embed — preserved from index.html */
/* CSS Variables for Clean White Theme */
    :root {
      --primary-color: #2563eb;
      --primary-light: #3b82f6;
      --primary-dark: #1d4ed8;
      --secondary-color: #64748b;
      --success-color: #10b981;
      --warning-color: #f59e0b;
      --danger-color: #ef4444;
      --text-primary: #1e293b;
      --text-secondary: #64748b;
      --text-muted: #94a3b8;
      --border-color: #e2e8f0;
      --border-light: #f1f5f9;
      --bg-white: #ffffff;
      --bg-light: #f8fafc;
      --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
      --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
      --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
      --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
      --border-radius: 12px;
    }

    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    body {
      background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 50%, #cbd5e1 100%);
      font-family: 'Cairo', 'Segoe UI', system-ui, -apple-system, sans-serif;
      min-height: 100vh;
      color: var(--text-primary);
      line-height: 1.6;
      padding: 0;
      margin: 0;
    }

    /* Subtle Background Pattern */
    body::before {
      content: '';
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-image: 
        radial-gradient(circle at 25% 25%, rgba(37, 99, 235, 0.02) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(16, 185, 129, 0.02) 0%, transparent 50%);
      pointer-events: none;
      z-index: -1;
    }

    /* Page Background GIF */
    body::after {
      content: '';
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: linear-gradient(135deg, #f4f7fa 0%, #e8f0e4 55%, #dfeaf5 100%);
      pointer-events: none;
      z-index: -2;
    }

    /* Hero Section Background Photo */
    #schoolSelectionStep .hero-background {
      background: url('photos/indexinterface.jpg') center / cover no-repeat;
      animation: backgroundMove 30s ease-in-out infinite;
      background-size: 110% 110%;
    }

    @keyframes backgroundMove {
      0% {
        background-position: 0% 50%;
      }
      25% {
        background-position: 100% 50%;
      }
      50% {
        background-position: 100% 50%;
      }
      75% {
        background-position: 0% 50%;
      }
      100% {
        background-position: 0% 50%;
      }
    }

    /* Animated Text Carousel */
    .text-carousel {
      position: relative;
      height: 80px;
      overflow: hidden;
      margin: 30px 0;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    .carousel-text {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translateX(-50%) translateY(-50%);
      width: 90%;
      max-width: 800px;
      text-align: center;
      font-size: 18px;
      font-weight: 700;
      color: #000000;
      font-family: 'Cairo', 'Segoe UI', system-ui, sans-serif;
      text-shadow: 
        2px 2px 4px rgba(255,255,255,0.9),
        0 0 10px rgba(255,255,255,0.7);
      background: rgba(255, 255, 255, 0.1);
      backdrop-filter: blur(8px);
      padding: 16px 24px;
      border-radius: 30px;
      box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
      border: 1px solid rgba(255, 255, 255, 0.15);
      opacity: 0;
      transform: translateX(-50%) translateY(-50%) translateY(40px);
      transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .carousel-text.active {
      opacity: 1;
      transform: translateX(-50%) translateY(-50%);
    }

    .carousel-text.fade-out {
      opacity: 0;
      transform: translateX(-50%) translateY(-50%) translateY(-40px);
    }

    /* Pulsing animation for active text */
    .carousel-text.active::before {
      content: '';
      position: absolute;
      top: -2px;
      left: -2px;
      right: -2px;
      bottom: -2px;
      background: linear-gradient(45deg, #3b82f6, #8b5cf6, #06b6d4, #10b981);
      border-radius: 27px;
      z-index: -1;
      animation: gradientPulse 3s ease-in-out infinite;
    }

    @keyframes gradientPulse {
      0%, 100% {
        opacity: 0.3;
        transform: scale(1);
      }
      50% {
        opacity: 0.6;
        transform: scale(1.02);
      }
    }

    /* Main Container */
    .login-container {
      max-width: 1200px;
      width: 95%;
      margin: 20px auto;
      background: var(--bg-white);
      border-radius: 20px;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
      overflow: hidden;
      animation: slideInUp 0.6s ease-out;
      transition: all 0.3s ease;
      min-height: calc(100vh - 40px);
      display: flex;
      flex-direction: column;
    }

    .login-container:hover {
      box-shadow: 0 25px 60px -12px rgb(0 0 0 / 0.15);
      transform: translateY(-2px);
    }

    /* Ensure proper centering on all screen sizes */
    @media (min-width: 769px) {
      .login-container {
        margin: 20px auto;
      }
    }

    /* Inner wrappers: no layout change unless .embed-login-only overrides */
    .login-step-layout,
    .login-step-modal-body {
      display: contents;
    }

    /* Specific styling for login step - smaller, more typical login form */
    #loginStep.login-container {
      max-width: 550px;
      width: 95%;
      min-height: auto;
      margin: 50px auto;
      padding: 40px 30px;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    }

    #loginStep.login-container:hover {
      box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
      transform: translateY(-3px);
    }

    /* Responsive adjustments for login step */
    @media (max-width: 768px) {
      #loginStep.login-container {
        max-width: 500px;
        width: 95%;
        margin: 30px auto;
        padding: 30px 20px;
      }
    }

    @media (max-width: 480px) {
      #loginStep.login-container {
        width: 98%;
        margin: 20px auto;
        padding: 25px 15px;
      }
    }

    /* Platform Brand */
    .platform-brand {
      text-align: center;
      margin-bottom: 20px;
      animation: fadeInDown 1s ease-out, brandBreath 5s ease-in-out infinite 2s;
      position: relative;
    }

    .platform-brand::before {
      content: '';
      position: absolute;
      top: -20px;
      left: -20px;
      right: -20px;
      bottom: -20px;
      background: radial-gradient(ellipse, rgba(255,255,255,0.05) 0%, transparent 70%);
      border-radius: 50%;
      animation: brandAura 8s ease-in-out infinite;
      z-index: -1;
    }

    .platform-brand::after {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      width: 200px;
      height: 200px;
      background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 50%);
      border-radius: 50%;
      transform: translate(-50%, -50%);
      animation: particleField 10s linear infinite;
      z-index: -2;
    }

    .platform-name {
      font-size: 3.5rem;
      font-weight: 800;
      margin: 0;
      color: #000000;
      text-shadow: 0 2px 4px rgba(255, 255, 255, 0.8);
      animation: platformGlow 3s ease-in-out infinite, platformFloat 4s ease-in-out infinite;
      position: relative;
      transform-origin: center;
    }

    .platform-name::before {
      content: attr(data-text);
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: linear-gradient(45deg, rgba(255,255,255,0.8), rgba(255,255,255,0.4), rgba(255,255,255,0.8));
      background-size: 200% 200%;
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      animation: platformShimmer 2s linear infinite, platformPulse 3s ease-in-out infinite;
      z-index: -1;
    }

    .platform-name::after {
      content: '';
      position: absolute;
      top: -10px;
      left: -10px;
      right: -10px;
      bottom: -10px;
      background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
      border-radius: 50%;
      animation: platformRipple 6s ease-in-out infinite;
      z-index: -2;
    }

    .platform-subtitle {
      font-size: 1.1rem;
      color: #000000;
      margin: 8px 0 0 0;
      font-weight: 500;
      letter-spacing: 0.5px;
      animation: fadeInUp 1s ease-out 0.3s both, subtitleGlow 4s ease-in-out infinite 1s;
      position: relative;
      text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    }

    .platform-subtitle::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
      animation: subtitleShimmer 3s ease-in-out infinite;
      z-index: -1;
    }

    @keyframes platformGlow {
      0%, 100% {
        text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
      }
      50% {
        text-shadow: 0 6px 12px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 255, 255, 0.3);
      }
    }

    @keyframes platformFloat {
      0%, 100% {
        transform: translateY(0px) scale(1);
      }
      50% {
        transform: translateY(-8px) scale(1.02);
      }
    }

    @keyframes platformPulse {
      0%, 100% {
        opacity: 0.8;
        transform: scale(1);
      }
      50% {
        opacity: 1;
        transform: scale(1.05);
      }
    }

    @keyframes platformRipple {
      0% {
        transform: scale(0.8);
        opacity: 0.3;
      }
      50% {
        transform: scale(1.2);
        opacity: 0.1;
      }
      100% {
        transform: scale(1.6);
        opacity: 0;
      }
    }

    @keyframes platformShimmer {
      0% { background-position: -200% 0; }
      100% { background-position: 200% 0; }
    }

    @keyframes subtitleGlow {
      0%, 100% {
        text-shadow: 0 2px 4px rgba(255, 255, 255, 0.2);
      }
      50% {
        text-shadow: 0 4px 8px rgba(255, 255, 255, 0.4);
      }
    }

    @keyframes subtitleShimmer {
      0% {
        transform: translateX(-100%);
        opacity: 0;
      }
      50% {
        opacity: 0.5;
      }
      100% {
        transform: translateX(100%);
        opacity: 0;
      }
    }

    @keyframes brandBreath {
      0%, 100% {
        transform: scale(1);
      }
      50% {
        transform: scale(1.01);
      }
    }

    @keyframes brandAura {
      0% {
        transform: scale(0.8) rotate(0deg);
        opacity: 0.3;
      }
      50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 0.1;
      }
      100% {
        transform: scale(0.8) rotate(360deg);
        opacity: 0.3;
      }
    }

    /* Interactive hover effects */
    .platform-brand:hover .platform-name {
      animation-play-state: paused;
      transform: scale(1.05);
      transition: transform 0.3s ease;
    }

    .platform-brand:hover .platform-subtitle {
      animation-play-state: paused;
      transform: scale(1.02);
      transition: transform 0.3s ease;
    }

    .platform-brand:hover::before {
      animation-play-state: paused;
      transform: scale(1.5);
      transition: transform 0.3s ease;
    }

    @keyframes particleField {
      0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(0.8);
        opacity: 0.3;
      }
      25% {
        transform: translate(-50%, -50%) rotate(90deg) scale(1.2);
        opacity: 0.6;
      }
      50% {
        transform: translate(-50%, -50%) rotate(180deg) scale(1);
        opacity: 0.4;
      }
      75% {
        transform: translate(-50%, -50%) rotate(270deg) scale(1.1);
        opacity: 0.7;
      }
      100% {
        transform: translate(-50%, -50%) rotate(360deg) scale(0.8);
        opacity: 0.3;
      }
    }

    /* Hero Section */
    .hero-section {
      position: relative;
      min-height: 280px;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
    }

    .hero-background {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 50%, #1e40af 100%);
    }

    .hero-pattern {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-image: 
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
      animation: float 20s ease-in-out infinite;
    }

    @keyframes float {
      0%, 100% { transform: translateY(0px) rotate(0deg); }
      33% { transform: translateY(-20px) rotate(1deg); }
      66% { transform: translateY(10px) rotate(-1deg); }
    }

    .hero-overlay {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.1);
    }

    .hero-content {
      position: relative;
      z-index: 2;
      text-align: center;
      color: #000000;
      max-width: 700px;
      padding: 40px 30px;
      margin: 0 auto;
      background: rgba(255, 255, 255, 0.08);
      backdrop-filter: blur(10px);
      border-radius: 25px;
      border: 1px solid rgba(255, 255, 255, 0.1);
      box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }

    .hero-logo {
      margin-bottom: 30px;
    }

    .logo-container {
      width: 80px;
      height: 80px;
      margin: 0 auto;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      background: rgba(255, 255, 255, 0.1);
      backdrop-filter: blur(10px);
      border: 2px solid rgba(255, 255, 255, 0.2);
      box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    }

    .logo-container img {
      width: 50px;
      height: 50px;
      object-fit: contain;
      border-radius: 50%;
    }

    .hero-text h1 {
      font-size: 2rem;
      font-weight: 800;
      margin-bottom: 10px;
      color: #000000;
      text-shadow: 0 2px 4px rgba(255, 255, 255, 0.8);
    }

    .hero-subtitle {
      font-size: 1rem;
      font-weight: 400;
      margin-bottom: 25px;
      color: #000000;
      line-height: 1.6;
      text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    }

    .hero-stats {
      display: flex;
      justify-content: center;
      gap: 40px;
      margin-top: 25px;
    }

    .stat-item {
      text-align: center;
    }

    .stat-number {
      font-size: 1.8rem;
      font-weight: 800;
      color: #fbbf24;
      text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
      margin-bottom: 5px;
    }

    .stat-label {
      font-size: 0.8rem;
      font-weight: 500;
      color: #fbbf24;
      text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
      opacity: 0.9;
    }

    /* Main Content */
    .main-content {
      flex: 1;
      padding: 40px 30px;
      background: var(--bg-white);
      max-width: 1000px;
      margin: 0 auto;
      width: 100%;
    }

    @keyframes slideInUp {
      from { opacity: 0; transform: translateY(30px); }
      to { opacity: 1; transform: translateY(0); }
    }

    /* Header Section */
    .login-header {
      text-align: center;
      padding: 30px 40px 20px;
      background: var(--bg-light);
      border-bottom: 1px solid var(--border-light);
      flex-shrink: 0;
    }

    .login-header .logo {
      width: 80px;
      height: 80px;
      margin: 0 auto 20px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--bg-white);
      border: 2px solid var(--primary-color);
      box-shadow: var(--shadow-md);
      overflow: hidden;
    }

    .login-header .logo img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      border-radius: 50%;
    }

    .login-header .logo i {
      font-size: 36px;
      color: var(--primary-color);
    }

    .login-header h2 {
      color: var(--text-primary);
      font-weight: 700;
      font-size: 24px;
      margin-bottom: 8px;
      letter-spacing: -0.025em;
    }

    .login-header p {
      color: var(--text-secondary);
      font-size: 14px;
      font-weight: 500;
    }

    .welcome-text {
      color: var(--primary-color);
      font-size: 16px;
      font-weight: 600;
      margin: 12px 0;
      padding: 8px 16px;
      background: rgba(37, 99, 235, 0.05);
      border-radius: 8px;
      border-left: 4px solid var(--primary-color);
      overflow: hidden;
      white-space: nowrap;
      position: relative;
    }

    .welcome-text.sliding {
      animation: slideText 15s linear infinite;
    }

    @keyframes slideText {
      0% {
        transform: translateX(100%);
      }
      10% {
        transform: translateX(0);
      }
      90% {
        transform: translateX(0);
      }
      100% {
        transform: translateX(-100%);
      }
    }

    /* Navigation Tabs */
    .nav-tabs {
      border: none;
      background: var(--bg-white);
      padding: 0 20px;
    }

    .nav-tabs .nav-link {
      font-weight: 600;
      font-size: 14px;
      padding: 16px 20px;
      border: none;
      border-radius: 0;
      color: var(--text-secondary);
      background: transparent;
      transition: all 0.3s ease;
      position: relative;
      margin: 0 4px;
    }

    .nav-tabs .nav-link::after {
      content: '';
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      height: 2px;
      background: var(--primary-color);
      transform: scaleX(0);
      transition: transform 0.3s ease;
    }

    .nav-tabs .nav-link.active {
      color: var(--primary-color);
      background: transparent;
      border: none;
    }

    .nav-tabs .nav-link.active::after {
      transform: scaleX(1);
    }

    .nav-tabs .nav-link:hover:not(.active) {
      color: var(--primary-light);
      background: var(--bg-light);
    }

    /* Responsive nav-tabs for mobile - horizontal layout */
    @media (max-width: 768px) {
      .nav-tabs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: thin;
        scrollbar-color: var(--primary-color) transparent;
        gap: 4px;
        padding: 0 10px;
      }
      
      .nav-tabs::-webkit-scrollbar {
        height: 4px;
      }
      
      .nav-tabs::-webkit-scrollbar-track {
        background: transparent;
      }
      
      .nav-tabs::-webkit-scrollbar-thumb {
        background: var(--primary-color);
        border-radius: 2px;
      }
      
      .nav-tabs .nav-item {
        flex: 0 0 auto;
      }
      
      .nav-tabs .nav-link {
        flex: 0 0 auto;
        padding: 8px 12px;
        font-size: 12px;
        white-space: nowrap;
        min-width: fit-content;
      }
    }

    @media (max-width: 480px) {
      .nav-tabs {
        padding: 0 5px;
        gap: 2px;
      }
      
      .nav-tabs .nav-link {
        padding: 6px 8px;
        font-size: 11px;
      }
    }

    /* Tab Content */
    .tab-content {
      background: var(--bg-white);
      padding: 20px 40px 30px;
      flex: 1;
      display: flex;
      flex-direction: column;
      overflow-y: auto;
    }

    /* Form Elements */
    .form-group {
      margin-bottom: 24px;
    }

    .form-label {
      font-weight: 600;
      color: var(--text-primary);
      margin-bottom: 8px;
      font-size: 14px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .form-control {
      width: 100%;
      padding: 12px 16px 12px 44px;
      border: 2px solid var(--border-color);
      border-radius: 8px;
      font-size: 16px;
      font-weight: 500;
      background: var(--bg-white);
      color: var(--text-primary);
      transition: all 0.3s ease;
    }

    .form-control:focus {
      outline: none;
      border-color: var(--primary-color);
      box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
    }

    .form-control::placeholder {
      color: var(--text-muted);
      font-weight: 400;
    }

    .input-icon {
      position: absolute;
      left: 16px;
      top: 50%;
      transform: translateY(-50%);
      color: var(--text-muted);
      font-size: 16px;
      transition: all 0.3s ease;
    }

    .position-relative:focus-within .input-icon {
      color: var(--primary-color);
    }

    /* Buttons */
    .btn {
      font-weight: 600;
      font-size: 16px;
      padding: 12px 24px;
      border-radius: 8px;
      border: none;
      transition: all 0.3s ease;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      text-decoration: none;
    }

    .btn:hover {
      transform: translateY(-1px);
      box-shadow: var(--shadow-md);
    }

    .btn:active {
      transform: translateY(0);
    }

    .btn-primary {
      background: var(--primary-color);
      color: white;
    }

    .btn-primary:hover {
      background: var(--primary-dark);
    }

    .btn-success {
      background: var(--success-color);
      color: white;
    }

    .btn-success:hover {
      background: #059669;
    }

    .btn-info {
      background: var(--primary-light);
      color: white;
    }

    .btn-info:hover {
      background: var(--primary-color);
    }

    .btn-warning {
      background: var(--warning-color);
      color: white;
    }

    .btn-warning:hover {
      background: #d97706;
    }

    /* Language Toggle (login step only — landing uses .mahd-lang-toggle in landing.css) */
    #loginStep #langToggle,
    #langToggle:not(.mahd-lang-toggle) {
      position: absolute;
      top: 20px;
      right: 20px;
      background: rgba(255, 255, 255, 0.2);
      border: 2px solid rgba(255, 255, 255, 0.3);
      border-radius: 8px;
      padding: 8px 16px;
      font-size: 14px;
      font-weight: 600;
      color: white;
      cursor: pointer;
      transition: all 0.3s ease;
      z-index: 100;
      backdrop-filter: blur(10px);
    }

    #loginStep #langToggle:hover,
    #langToggle:not(.mahd-lang-toggle):hover {
      background: rgba(255, 255, 255, 0.3);
      border-color: rgba(255, 255, 255, 0.5);
      transform: translateY(-2px);
    }

    /* User Type Badges */
    .user-type-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 4px 8px;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 600;
      margin-right: 8px;
    }

    .badge-parent {
      background: #dbeafe;
      color: var(--primary-color);
    }

    .badge-admin {
      background: #dcfce7;
      color: var(--success-color);
    }

    .badge-teacher {
      background: #fef3c7;
      color: var(--warning-color);
    }

    .badge-employee {
      background: #fee2e2;
      color: var(--danger-color);
    }

    /* Divider */
    .divider {
      text-align: center;
      margin: 24px 0;
      position: relative;
    }

    .divider::before {
      content: '';
      position: absolute;
      top: 50%;
      left: 0;
      right: 0;
      height: 1px;
      background: var(--border-color);
    }

    .divider span {
      background: var(--bg-white);
      padding: 0 16px;
      color: var(--text-secondary);
      font-size: 14px;
      font-weight: 500;
    }

    /* Selected School Info */
    .selected-school-info {
      margin-top: 15px;
      padding: 12px;
      background: var(--bg-light);
      border-radius: 8px;
      border: 1px solid var(--border-light);
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .selected-school-info small {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    /* Staff Login Buttons */
    .staff-buttons {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
      margin-top: 20px;
    }

    .staff-btn {
      padding: 16px;
      border-radius: 8px;
      border: 2px solid var(--border-color);
      background: var(--bg-white);
      font-weight: 600;
      font-size: 14px;
      color: var(--text-primary);
      transition: all 0.3s ease;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
      cursor: pointer;
    }

    .staff-btn:hover {
      border-color: var(--primary-color);
      background: var(--bg-light);
      transform: translateY(-1px);
      box-shadow: var(--shadow-md);
    }

    .staff-btn i {
      font-size: 20px;
      color: var(--primary-color);
    }

    /* Loading Overlay — full-screen glass + centered card (login in progress) */
    #loadingOverlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(15, 23, 42, 0.68);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      display: none;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      z-index: 2000;
      padding: 24px;
    }

    #loadingOverlay .portal-loading-overlay-card {
      background: linear-gradient(165deg, #ffffff 0%, #f1f5f9 100%);
      border-radius: 20px;
      padding: 36px 40px 32px;
      max-width: 360px;
      width: 100%;
      text-align: center;
      box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.28),
        0 0 0 1px rgba(255, 255, 255, 0.65) inset;
      animation: portal-overlay-card-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    }

    @keyframes portal-overlay-card-in {
      from {
        opacity: 0;
        transform: scale(0.94) translateY(16px);
      }
      to {
        opacity: 1;
        transform: scale(1) translateY(0);
      }
    }

    #loadingOverlay .portal-loading-overlay-card .loading-text {
      color: #1e293b;
      font-size: 1.1rem;
      font-weight: 700;
      margin-top: 12px;
      font-family: 'Cairo', 'Segoe UI', system-ui, sans-serif;
    }

    #adminLoginWaitingModal .modal-content {
      border-radius: 20px;
      overflow: hidden;
      border: none;
      background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
    }

    #adminLoginWaitingModal .modal-content::before {
      content: '';
      display: block;
      height: 4px;
      background: linear-gradient(90deg, #2563eb, #60a5fa, #2563eb);
      background-size: 200% 100%;
      animation: portal-admin-top-shine 2.5s ease infinite;
    }

    @keyframes portal-admin-top-shine {
      0% { background-position: 0% 50%; }
      100% { background-position: 200% 50%; }
    }

    #adminLoginWaitingModal .portal-loading-shield--sm {
      width: 52px;
      height: 52px;
      margin: 0 auto 6px;
      border-radius: 14px;
    }

    #adminLoginWaitingModal .portal-loading-shield--sm i {
      font-size: 1.4rem;
    }

    /* Responsive Design */
    @media (max-width: 768px) {
      .login-container {
        margin: 0;
        width: 100%;
        min-height: 100vh;
        border-radius: 0;
      }

      .hero-section {
        min-height: 250px;
      }

      .hero-content {
        padding: 0 20px;
        max-width: 100%;
      }

      .platform-name {
        font-size: 2.2rem;
      }
      
      .platform-subtitle {
        font-size: 0.9rem;
      }
      
      .hero-text h1 {
        font-size: 1.8rem;
      }

      .hero-subtitle {
        font-size: 0.9rem;
      }

      .hero-stats {
        gap: 25px;
      }

      .stat-number {
        font-size: 1.6rem;
      }

      .stat-label {
        font-size: 0.7rem;
      }

      .main-content {
        padding: 30px 20px;
        max-width: 100%;
      }

      .welcome-section {
        padding: 25px 20px;
        margin: 0 20px 30px;
        max-width: calc(100% - 40px);
      }

      .section-title {
        font-size: 1.8rem;
      }

      .features-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        max-width: 100%;
      }

      .feature-card {
        padding: 20px;
      }

      .selection-container {
        padding: 25px 20px;
        margin: 0 20px;
        max-width: calc(100% - 40px);
      }

      .selection-header h2 {
        font-size: 1.8rem;
      }

      .trust-section {
        margin: 40px 20px 0;
        padding: 30px 20px;
        max-width: calc(100% - 40px);
      }

      .trust-header h3 {
        font-size: 1.8rem;
      }

      .trust-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 20px;
      }

      .nav-tabs .nav-link {
        padding: 12px 16px;
        font-size: 13px;
      }

      .staff-buttons {
        grid-template-columns: 1fr;
        gap: 8px;
      }

      #loginStep #langToggle,
      #langToggle:not(.mahd-lang-toggle) {
        top: 15px;
        right: 15px;
        padding: 6px 12px;
        font-size: 12px;
      }
    }

    @media (max-width: 480px) {
      .login-header {
        padding: 25px 20px 15px;
      }

      .tab-content {
        padding: 15px 20px 25px;
      }

      .form-control {
        padding: 10px 14px 10px 40px;
        font-size: 14px;
      }

      .btn {
        padding: 10px 20px;
        font-size: 14px;
      }
    }

    /* OTP Modal Styles */
    .otp-icon {
      width: 80px;
      height: 80px;
      background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto;
      box-shadow: var(--shadow-md);
    }

    .otp-icon i {
      color: white;
      font-size: 32px;
    }

    .otp-input-container {
      position: relative;
      display: flex;
      align-items: center;
      gap: 15px;
    }

    .otp-input {
      font-size: 24px;
      font-weight: 700;
      text-align: center;
      letter-spacing: 8px;
      padding: 15px;
      border: 2px solid var(--border-color);
      border-radius: 12px;
      background: var(--bg-white);
      transition: all 0.3s ease;
    }

    .otp-input:focus {
      border-color: var(--primary-color);
      box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
      outline: none;
    }

    .otp-timer {
      background: var(--bg-light);
      border: 1px solid var(--border-color);
      border-radius: 8px;
      padding: 8px 12px;
      font-weight: 600;
      color: var(--text-secondary);
      min-width: 60px;
      text-align: center;
    }

    .otp-timer.expired {
      color: var(--danger-color);
      background: rgba(239, 68, 68, 0.1);
    }

    #resendOtpBtn {
      color: var(--primary-color);
      text-decoration: none;
      font-weight: 600;
      transition: all 0.3s ease;
    }

    #resendOtpBtn:hover:not(:disabled) {
      color: var(--primary-dark);
      transform: translateY(-1px);
    }

    #resendOtpBtn:disabled {
      color: var(--text-muted);
      cursor: not-allowed;
    }

    /* Advanced Welcome Section Styles */
    .welcome-section {
      margin: 0 auto 40px;
      text-align: center;
      padding: 30px;
      background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
      border-radius: 20px;
      border: 1px solid var(--border-light);
      max-width: 800px;
    }

    .welcome-badge {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 8px 16px;
      background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
      color: white;
      border-radius: 20px;
      font-size: 14px;
      font-weight: 600;
      margin-bottom: 12px;
      box-shadow: var(--shadow-sm);
    }

    .welcome-badge i {
      color: #ffd700;
      animation: pulse 2s infinite;
    }

    @keyframes pulse {
      0%, 100% { transform: scale(1); }
      50% { transform: scale(1.1); }
    }

    .welcome-message p {
      color: var(--text-secondary);
      font-size: 15px;
      line-height: 1.6;
      margin: 0;
      padding: 0 20px;
    }

    /* Features Showcase Styles */
    .features-showcase {
      margin-bottom: 60px;
    }

    .section-header {
      text-align: center;
      margin-bottom: 35px;
    }

    .section-title {
      font-size: 2rem;
      font-weight: 800;
      color: var(--text-primary);
      margin-bottom: 12px;
      background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }

    .section-subtitle {
      font-size: 1rem;
      color: var(--text-secondary);
      max-width: 500px;
      margin: 0 auto;
      line-height: 1.6;
    }

    .features-title {
      text-align: center;
      color: var(--text-primary);
      font-weight: 700;
      font-size: 18px;
      margin-bottom: 20px;
      position: relative;
    }

    .features-title::after {
      content: '';
      position: absolute;
      bottom: -8px;
      left: 50%;
      transform: translateX(-50%);
      width: 60px;
      height: 3px;
      background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
      border-radius: 2px;
    }

    .features-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
      gap: 20px;
      margin-bottom: 15px;
      max-width: 900px;
      margin-left: auto;
      margin-right: auto;
    }

    .feature-card {
      background: var(--bg-white);
      border: 1px solid var(--border-color);
      border-radius: 20px;
      padding: 20px;
      transition: all 0.4s ease;
      position: relative;
      overflow: hidden;
      box-shadow: var(--shadow-sm);
    }

    .feature-card::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 4px;
      background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
      transform: scaleX(0);
      transition: transform 0.3s ease;
    }

    .feature-card:hover::before {
      transform: scaleX(1);
    }

    .feature-card:hover {
      transform: translateY(-8px);
      box-shadow: var(--shadow-xl);
      border-color: var(--primary-color);
    }

    .feature-card.premium {
      background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
      border-color: #f59e0b;
    }

    .feature-card.premium::before {
      background: linear-gradient(90deg, #f59e0b, #fbbf24);
    }

    .feature-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 20px;
    }

    .feature-icon {
      width: 45px;
      height: 45px;
      background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: var(--shadow-md);
    }

    .feature-icon i {
      color: white;
      font-size: 18px;
    }

    .feature-badge {
      background: linear-gradient(135deg, #f59e0b, #fbbf24);
      color: white;
      padding: 6px 12px;
      border-radius: 20px;
      font-size: 12px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .feature-content h3 {
      color: var(--text-primary);
      font-weight: 700;
      font-size: 16px;
      margin-bottom: 10px;
    }

    .feature-content p {
      color: var(--text-secondary);
      font-size: 13px;
      line-height: 1.6;
      margin-bottom: 15px;
    }

    .feature-highlights {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    .highlight {
      background: rgba(37, 99, 235, 0.1);
      color: var(--primary-color);
      padding: 6px 12px;
      border-radius: 20px;
      font-size: 12px;
      font-weight: 500;
    }

    /* School Selection Section Styles */
    .school-selection-section {
      margin: 60px 0;
      flex-shrink: 0;
    }

    .selection-container {
      max-width: 500px;
      margin: 0 auto;
      text-align: center;
      padding: 35px;
      background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
      border-radius: 25px;
      border: 1px solid var(--border-light);
      box-shadow: var(--shadow-lg);
      position: relative;
    }

    .selection-header h2 {
      font-size: 2rem;
      font-weight: 800;
      color: var(--text-primary);
      margin-bottom: 12px;
      background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }

    .selection-header p {
      font-size: 1rem;
      color: var(--text-secondary);
      margin-bottom: 30px;
    }

    .section-divider {
      text-align: center;
      margin: 24px 0;
      position: relative;
    }

    .section-divider::before {
      content: '';
      position: absolute;
      top: 50%;
      left: 0;
      right: 0;
      height: 1px;
      background: var(--border-color);
    }

    .section-divider span {
      background: var(--bg-white);
      padding: 0 20px;
      color: var(--text-primary);
      font-size: 16px;
      font-weight: 600;
    }

    .proceed-btn {
      background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
      border: none;
      padding: 14px 24px;
      font-size: 16px;
      font-weight: 600;
      box-shadow: var(--shadow-md);
      transition: all 0.3s ease;
    }

    .proceed-btn:hover {
      background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
      transform: translateY(-2px);
      box-shadow: var(--shadow-lg);
    }

    .proceed-btn:disabled {
      background: var(--text-muted);
      cursor: not-allowed;
      transform: none;
      box-shadow: none;
    }

    /* School Selection Cards Styles */
    .school-selection-cards {
      margin-bottom: 30px;
    }

    .selection-card {
      background: var(--bg-white);
      border: 2px solid var(--border-color);
      border-radius: 16px;
      padding: 25px;
      cursor: pointer;
      transition: all 0.3s ease;
      display: flex;
      align-items: center;
      gap: 20px;
      position: relative;
      overflow: hidden;
    }

    .selection-card::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 4px;
      background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
      transform: scaleX(0);
      transition: transform 0.3s ease;
    }

    .selection-card:hover {
      border-color: var(--primary-color);
      transform: translateY(-2px);
      box-shadow: var(--shadow-lg);
    }

    .selection-card:hover::before {
      transform: scaleX(1);
    }

    .selection-card-icon {
      width: 60px;
      height: 60px;
      background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: white;
      font-size: 1.5rem;
      flex-shrink: 0;
    }

    .selection-card-content {
      flex: 1;
      text-align: right;
    }

    .selection-card-content h3 {
      font-size: 1.3rem;
      font-weight: 700;
      color: var(--text-primary);
      margin-bottom: 5px;
    }

    .selection-card-content p {
      color: var(--text-secondary);
      font-size: 0.95rem;
      margin: 0;
    }

    .selection-card-arrow {
      color: var(--primary-color);
      font-size: 1.2rem;
      transition: transform 0.3s ease;
    }

    .selection-card:hover .selection-card-arrow {
      transform: translateX(-5px);
    }

    /* Selected School Card Styles */
    .selected-school-card {
      background: var(--bg-white);
      border: 2px solid var(--success-color);
      border-radius: 16px;
      padding: 20px;
      animation: slideIn 0.3s ease-out;
    }

    .selected-school-info {
      display: flex;
      align-items: center;
      gap: 15px;
    }

    .selected-school-logo {
      width: 50px;
      height: 50px;
      border-radius: 50%;
      overflow: hidden;
      background: var(--bg-light);
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .selected-school-logo img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .selected-school-logo i {
      font-size: 1.2rem;
      color: var(--primary-color);
    }

    .selected-school-details {
      flex: 1;
      text-align: right;
    }

    .selected-school-details h4 {
      font-size: 1.1rem;
      font-weight: 700;
      color: var(--text-primary);
      margin-bottom: 3px;
    }

    .selected-school-details p {
      color: var(--text-secondary);
      font-size: 0.9rem;
      margin: 0;
    }

    .change-school-btn {
      background: var(--primary-color);
      color: white;
      border: none;
      border-radius: 8px;
      padding: 8px 12px;
      cursor: pointer;
      transition: all 0.3s ease;
      flex-shrink: 0;
    }

    .change-school-btn:hover {
      background: var(--primary-dark);
      transform: scale(1.05);
    }

    @keyframes slideIn {
      from {
        opacity: 0;
        transform: translateY(10px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    /* Trust Section Styles */
    .trust-section {
      margin: 60px auto 0;
      padding: 40px 30px;
      background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
      border-radius: 25px;
      text-align: center;
      max-width: 900px;
    }

    .trust-header h3 {
      font-size: 2rem;
      font-weight: 800;
      color: var(--text-primary);
      margin-bottom: 15px;
      background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }

    .trust-header p {
      font-size: 1.1rem;
      color: var(--text-secondary);
      margin-bottom: 50px;
      max-width: 600px;
      margin-left: auto;
      margin-right: auto;
    }

      .trust-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
        max-width: 1000px;
        margin: 0 auto;
        padding: 0 20px;
      }

      .trust-item {
        background: var(--bg-white);
        padding: 20px 15px;
        border-radius: 12px;
        box-shadow: var(--shadow-md);
        transition: all 0.3s ease;
        text-align: center;
        min-height: 140px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        opacity: 1;
        transform: translateY(0);
      }

    .trust-item:hover {
      transform: translateY(-8px) scale(1.02);
      box-shadow: var(--shadow-xl);
      cursor: pointer;
    }

    .trust-item:active {
      transform: translateY(-4px) scale(0.98);
      transition: all 0.1s ease;
    }

    .trust-icon {
      width: 60px;
      height: 60px;
      background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto 15px;
      box-shadow: var(--shadow-md);
      transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
      position: relative;
      overflow: hidden;
    }

    .trust-icon::before {
      content: '';
      position: absolute;
      top: -2px;
      left: -2px;
      right: -2px;
      bottom: -2px;
      background: linear-gradient(135deg, #3b82f6, #8b5cf6, #06b6d4, #10b981);
      border-radius: 50%;
      z-index: -1;
      opacity: 0;
      transition: opacity 0.3s ease;
    }

    .trust-item:hover .trust-icon {
      transform: scale(1.1) rotate(5deg);
      box-shadow: 
        0 12px 30px rgba(59, 130, 246, 0.4),
        0 6px 15px rgba(59, 130, 246, 0.3);
    }

    .trust-item:hover .trust-icon::before {
      opacity: 1;
    }

    .trust-icon i {
      color: white;
      font-size: 24px;
      transition: all 0.3s ease;
      z-index: 1;
    }

    .trust-item:hover .trust-icon i {
      transform: scale(1.1);
      animation: iconPulse 0.6s ease-in-out;
    }

    @keyframes iconPulse {
      0%, 100% {
        transform: scale(1.1);
      }
      50% {
        transform: scale(1.2);
      }
    }

    /* Loading Modal Styles */
    .loading-modal {
      position: fixed;
      top: 0;
      left: 0;
      width: 100vw;
      height: 100vh;
      background: rgba(0, 0, 0, 0.9);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 999999;
      opacity: 0;
      visibility: hidden;
      transition: all 0.3s ease;
      backdrop-filter: blur(15px);
    }

    .loading-modal.active {
      opacity: 1;
      visibility: visible;
    }

    .loading-content {
      background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
      border-radius: 20px;
      padding: 40px;
      text-align: center;
      box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 8px 25px rgba(0, 0, 0, 0.2);
      border: 1px solid rgba(255, 255, 255, 0.2);
      max-width: 400px;
      width: 90%;
    }

    /* Professional login / verification loading (no circular spinner) */
    .portal-loading-visual {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 4px;
      margin-bottom: 8px;
    }

    .portal-loading-shield {
      width: 72px;
      height: 72px;
      margin: 0 auto 18px;
      border-radius: 18px;
      background: linear-gradient(145deg, #1d4ed8 0%, #3b82f6 50%, #2563eb 100%);
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow:
        0 12px 40px rgba(37, 99, 235, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.15) inset;
      animation: portal-shield-pulse 2.2s ease-in-out infinite;
    }

    .portal-loading-shield i {
      font-size: 2rem;
      color: #fff;
      filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
    }

    @keyframes portal-shield-pulse {
      0%, 100% { transform: scale(1); box-shadow: 0 12px 40px rgba(37, 99, 235, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.15) inset; }
      50% { transform: scale(1.05); box-shadow: 0 16px 48px rgba(37, 99, 235, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.2) inset; }
    }

    .portal-loading-bars {
      display: flex;
      align-items: flex-end;
      justify-content: center;
      gap: 6px;
      height: 44px;
    }

    .portal-loading-bars span {
      width: 6px;
      height: 16px;
      border-radius: 4px;
      background: linear-gradient(180deg, #3b82f6 0%, #93c5fd 100%);
      animation: portal-bar-bounce 0.9s ease-in-out infinite;
      transform-origin: center bottom;
    }

    .portal-loading-bars span:nth-child(1) { animation-delay: 0s; }
    .portal-loading-bars span:nth-child(2) { animation-delay: 0.1s; }
    .portal-loading-bars span:nth-child(3) { animation-delay: 0.2s; }
    .portal-loading-bars span:nth-child(4) { animation-delay: 0.3s; }
    .portal-loading-bars span:nth-child(5) { animation-delay: 0.4s; }

    @keyframes portal-bar-bounce {
      0%, 100% { height: 14px; opacity: 0.65; }
      50% { height: 36px; opacity: 1; }
    }

    .portal-loading-bars--compact {
      height: 36px;
      gap: 5px;
      margin: 0;
    }

    .portal-loading-bars--compact span {
      width: 5px;
      animation-duration: 0.75s;
    }

    .portal-btn-dots {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      vertical-align: middle;
      margin-inline-end: 0.5rem;
    }

    .portal-btn-dots span {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: currentColor;
      animation: portal-dot-pulse 0.85s ease-in-out infinite;
    }

    .portal-btn-dots span:nth-child(2) { animation-delay: 0.12s; }
    .portal-btn-dots span:nth-child(3) { animation-delay: 0.24s; }

    @keyframes portal-dot-pulse {
      0%, 100% { transform: scale(0.7); opacity: 0.45; }
      50% { transform: scale(1.05); opacity: 1; }
    }

    .loading-text {
      font-size: 1.3rem;
      font-weight: 700;
      color: #1e40af;
      margin-bottom: 10px;
      font-family: 'Cairo', 'Segoe UI', system-ui, sans-serif;
    }

    .loading-subtext {
      color: #64748b;
      font-size: 0.9rem;
      line-height: 1.5;
      font-family: 'Cairo', 'Segoe UI', system-ui, sans-serif;
    }

    .school-info {
      margin-top: 20px;
      padding: 15px;
      background: rgba(59, 130, 246, 0.1);
      border-radius: 12px;
      border: 1px solid rgba(59, 130, 246, 0.2);
    }

    .school-logo {
      width: 50px;
      height: 50px;
      border-radius: 50%;
      margin: 0 auto 10px;
      object-fit: cover;
      border: 2px solid #3b82f6;
    }

    .school-name {
      font-size: 1.1rem;
      font-weight: 600;
      color: #1e40af;
      margin-bottom: 5px;
    }

    .school-type {
      font-size: 0.8rem;
      color: #64748b;
    }

    /* Modal Styles */
    .card-modal {
      position: fixed;
      top: 0;
      left: 0;
      width: 100vw;
      height: 100vh;
      background: rgba(0, 0, 0, 0.8);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 999999;
      opacity: 0;
      visibility: hidden;
      transition: all 0.3s ease;
      backdrop-filter: blur(10px);
    }

    .card-modal.active {
      opacity: 1;
      visibility: visible;
    }

    .modal-content {
      background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
      border-radius: 20px;
      padding: 40px;
      max-width: 500px;
      width: 90%;
      text-align: center;
      box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 8px 25px rgba(0, 0, 0, 0.2);
      transform: scale(0.8) translateY(50px);
      transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
      border: 1px solid rgba(255, 255, 255, 0.2);
    }

    .card-modal.active .modal-content {
      transform: scale(1) translateY(0);
    }

    .modal-icon {
      width: 100px;
      height: 100px;
      background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto 25px;
      box-shadow: 
        0 15px 35px rgba(59, 130, 246, 0.4),
        0 5px 15px rgba(59, 130, 246, 0.3);
    }

    .modal-icon i {
      color: white;
      font-size: 40px;
    }

    .modal-title {
      font-size: 1.8rem;
      font-weight: 700;
      color: var(--text-primary);
      margin-bottom: 15px;
      font-family: 'Cairo', 'Segoe UI', system-ui, sans-serif;
    }

    .modal-description {
      font-size: 1.1rem;
      color: var(--text-secondary);
      line-height: 1.6;
      margin-bottom: 30px;
    }

    .modal-close {
      position: absolute;
      top: 15px;
      right: 20px;
      background: none;
      border: none;
      font-size: 24px;
      color: var(--text-secondary);
      cursor: pointer;
      transition: all 0.3s ease;
      width: 40px;
      height: 40px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .modal-close:hover {
      background: rgba(0, 0, 0, 0.1);
      color: var(--text-primary);
      transform: rotate(90deg);
    }

    /* Responsive Modal Styles */
    @media (max-width: 768px) {
      .loading-modal,
      .card-modal {
        padding: 20px;
      }
      
      .loading-content,
      .modal-content {
        max-width: 90vw;
        width: 90vw;
        padding: 30px 20px;
        margin: 0;
      }
      
      .modal-icon {
        width: 80px;
        height: 80px;
        margin-bottom: 20px;
      }
      
      .modal-icon i {
        font-size: 32px;
      }
      
      .modal-title {
        font-size: 1.5rem;
        margin-bottom: 12px;
      }
      
      .modal-description {
        font-size: 1rem;
        margin-bottom: 25px;
      }
      
      .portal-loading-shield {
        width: 62px;
        height: 62px;
      }

      .portal-loading-shield i {
        font-size: 1.65rem;
      }
      
      .loading-text {
        font-size: 1.1rem;
        margin-bottom: 8px;
      }
      
      .loading-subtext {
        font-size: 0.85rem;
      }
    }

    @media (max-width: 480px) {
      .loading-modal,
      .card-modal {
        padding: 15px;
      }
      
      .loading-content,
      .modal-content {
        max-width: 95vw;
        width: 95vw;
        padding: 25px 15px;
        border-radius: 15px;
      }
      
      .modal-icon {
        width: 70px;
        height: 70px;
        margin-bottom: 15px;
      }
      
      .modal-icon i {
        font-size: 28px;
      }
      
      .modal-title {
        font-size: 1.3rem;
        margin-bottom: 10px;
      }
      
      .modal-description {
        font-size: 0.9rem;
        margin-bottom: 20px;
        line-height: 1.5;
      }
      
      .modal-close {
        top: 10px;
        right: 15px;
        width: 35px;
        height: 35px;
        font-size: 20px;
      }
      
      .portal-loading-shield {
        width: 56px;
        height: 56px;
      }

      .portal-loading-shield i {
        font-size: 1.5rem;
      }
      
      .loading-text {
        font-size: 1rem;
        margin-bottom: 6px;
      }
      
      .loading-subtext {
        font-size: 0.8rem;
      }
    }

    .trust-item h4 {
      font-size: 1.1rem;
      font-weight: 700;
      color: var(--text-primary);
      margin-bottom: 6px;
    }

    .trust-item p {
      color: var(--text-secondary);
      font-size: 12px;
      line-height: 1.4;
    }

    .security-badges {
      display: flex;
      justify-content: center;
      gap: 20px;
      flex-wrap: wrap;
    }

    .security-badge {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 6px 12px;
      background: var(--bg-light);
      border: 1px solid var(--border-color);
      border-radius: 20px;
      font-size: 12px;
      font-weight: 500;
      color: var(--text-secondary);
      transition: all 0.3s ease;
    }

    .security-badge:hover {
      background: var(--primary-color);
      color: white;
      border-color: var(--primary-color);
      transform: translateY(-1px);
    }

    .security-badge i {
      font-size: 14px;
    }

    /* Responsive adjustments for new components */
    @media (max-width: 768px) {
      .features-grid {
        grid-template-columns: 1fr;
        gap: 10px;
      }

      .feature-card {
        padding: 12px;
      }

      .security-badges {
        gap: 12px;
      }

      .welcome-message p {
        padding: 0 10px;
        font-size: 14px;
      }
    }

    @media (max-width: 480px) {
      .feature-card {
        flex-direction: column;
        text-align: center;
        gap: 12px;
      }

      .feature-icon {
        align-self: center;
      }

      .security-badges {
        flex-direction: column;
        align-items: center;
        gap: 8px;
      }
    }

    /* Initial state override to avoid flicker when landing on #loginStep */
    .login-step-initial #schoolSelectionStep { display: none !important; }
    .login-step-initial #loginStep { display: block !important; }

    /* Hide school/login chrome while auto-resuming remembered school (same flow as "proceed") */
    .portal-school-auto-load #schoolSelectionStep { display: none !important; }
    .portal-school-auto-load #loginStep { display: none !important; }

    /* Footer / modals / overlays sit outside #schoolSelectionStep — hide during remembered-school handoff */
    /* Footer / modals / overlays sit outside #schoolSelectionStep — hide during remembered-school handoff */
    .portal-school-auto-load #copyrightFooter,
    .portal-school-auto-load #loadingModal,
    .portal-school-auto-load #loadingModal.active,
    .portal-school-auto-load #loadingOverlay,
    .portal-school-auto-load #cardModal {
      display: none !important;
      visibility: hidden !important;
      opacity: 0 !important;
      pointer-events: none !important;
    }

    /* Plain backdrop only — no GIF / hero chrome flashing before school page opens */
    /* Plain backdrop only — no GIF / hero chrome flashing before school page opens */
    .portal-school-auto-load body {
      background: #e8ecf2 !important;
    }
    .portal-school-auto-load body::before,
    .portal-school-auto-load body::after {
      display: none !important;
      background-image: none !important;
      content: none !important;
    }
    /*
     * Embed login (iframe): modal / bottom-sheet inspired layout — structure via
     * .login-step-layout + .login-step-modal-body (display:contents outside embed).
     */
    .embed-login-only {
      --em-viewport: #070c14;
      --em-viewport-mid: #101b2e;
      --em-card: #ffffff;
      --em-sheet: #eef2f7;
      --em-line: rgba(15, 23, 42, 0.09);
      --em-text: #0f172a;
      --em-muted: #64748b;
      --em-fill: #f8fafc;
      --em-accent: #2563eb;
      --em-accent-hover: #1d4ed8;
      --em-accent-ring: rgba(37, 99, 235, 0.28);
      --em-success: #0d9488;
      --em-success-hover: #0f766e;
      --em-link: #2563eb;
      --em-radius: 11px;
      --em-radius-sheet: 16px;
      min-height: 100%;
      background: radial-gradient(ellipse 100% 120% at 50% -15%, #1a365d 0%, var(--em-viewport-mid) 42%, var(--em-viewport) 100%);
      color-scheme: light;
    }
    .embed-login-only body {
      background: transparent !important;
      min-height: 100vh;
      min-height: 100dvh;
      margin: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
      box-sizing: border-box;
    }
    .embed-login-only body::before,
    .embed-login-only body::after,
    .embed-login-only .hero-section,
    .embed-login-only .main-content,
    .embed-login-only .trust-section,
    .embed-login-only #schoolSelectionStep,
    .embed-login-only #loadingModal,
    .embed-login-only #cardModal { display: none !important; }

    .embed-login-only #loginStep.login-container {
      display: flex !important;
      flex-direction: column;
      position: relative;
      isolation: isolate;
      width: min(392px, calc(100vw - 28px));
      max-width: 392px;
      margin: 0 auto !important;
      padding: 0;
      min-height: unset;
      overflow: hidden;
      border-radius: var(--em-radius-sheet);
      border: 1px solid rgba(255, 255, 255, 0.14);
      background: var(--em-card);
      box-shadow:
        0 0 0 1px rgba(15, 23, 42, 0.04),
        0 28px 56px -18px rgba(0, 0, 0, 0.55),
        0 12px 24px -12px rgba(0, 0, 0, 0.35);
      animation: embedModalIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    }
    .embed-login-only #loginStep.login-container::before {
      content: '';
      position: absolute;
      top: 8px;
      left: 50%;
      transform: translateX(-50%);
      width: 32px;
      height: 3px;
      border-radius: 100px;
      background: rgba(15, 23, 42, 0.12);
      z-index: 2;
      pointer-events: none;
    }
    @keyframes embedModalIn {
      from { opacity: 0; transform: translateY(18px) scale(0.97); }
      to { opacity: 1; transform: translateY(0) scale(1); }
    }
    @media (prefers-reduced-motion: reduce) {
      .embed-login-only #loginStep.login-container { animation: none; }
    }
    .embed-login-only #loginStep.login-container:hover {
      transform: none;
      box-shadow:
        0 0 0 1px rgba(15, 23, 42, 0.05),
        0 32px 64px -16px rgba(0, 0, 0, 0.58);
    }

    .embed-login-only .login-step-layout {
      display: flex;
      flex-direction: column;
      flex: 1 1 auto;
      min-height: 0;
    }
    .embed-login-only .login-step-modal-body {
      display: flex;
      flex-direction: column;
      flex: 1 1 auto;
      min-height: 0;
      background: var(--em-sheet);
      padding-bottom: 4px;
    }

    /* Header: logo + title alignment (grid), not stacked center */
    .embed-login-only .login-header {
      flex-shrink: 0;
      display: grid;
      grid-template-columns: auto minmax(0, 1fr);
      grid-template-areas:
        "logo title"
        "logo sub"
        "welcome welcome";
      column-gap: 13px;
      row-gap: 3px;
      align-items: center;
      padding: 26px 18px 14px;
      margin: 0;
      border: 0;
      background: var(--em-card);
      text-align: start;
    }
    .embed-login-only .login-header .logo {
      grid-area: logo;
      width: 46px;
      height: 46px;
      margin: 0;
      align-self: center;
      border-radius: 12px;
      border: 1px solid var(--em-line);
      background: linear-gradient(145deg, #f8fafc, #eef2f7);
      box-shadow: 0 8px 20px -10px rgba(37, 99, 235, 0.35);
    }
    .embed-login-only .login-header .logo i {
      font-size: 19px;
      color: var(--em-accent);
    }
    .embed-login-only .login-header h2 {
      grid-area: title;
      margin: 0;
      font-size: 1.03125rem;
      font-weight: 800;
      letter-spacing: -0.04em;
      line-height: 1.2;
      color: var(--em-text);
    }
    .embed-login-only .login-header #loginSubtitle {
      grid-area: sub;
      margin: 0;
      font-size: 0.71875rem;
      font-weight: 500;
      line-height: 1.4;
      color: var(--em-muted);
    }
    .embed-login-only .login-header .welcome-text {
      grid-area: welcome;
      margin: 9px 0 0;
      padding: 8px 11px;
      font-size: 0.71875rem;
      font-weight: 500;
      line-height: 1.45;
      white-space: normal;
      text-align: start;
      border-radius: 10px;
      border: 1px solid var(--em-line);
      border-inline-start-width: 2px;
      border-inline-start-color: var(--em-accent);
      background: var(--em-fill);
      color: var(--em-muted);
    }

    .embed-login-only #langToggle { display: none !important; }
    .embed-login-only .selected-school-info { display: none !important; }

    /* Segmented control — sits on sheet */
    .embed-login-only .login-step-modal-body > .nav-tabs {
      flex-shrink: 0;
      display: flex;
      flex-wrap: nowrap;
      overflow-x: auto;
      scrollbar-width: thin;
      gap: 4px;
      margin: 11px 11px 0;
      padding: 4px;
      border-radius: 11px;
      background: rgba(15, 23, 42, 0.055);
      border: none;
      -webkit-overflow-scrolling: touch;
    }
    .embed-login-only .nav-tabs .nav-item {
      flex: 1 1 0;
      min-width: 0;
    }
    .embed-login-only .nav-tabs .nav-link {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 5px;
      width: 100%;
      min-width: 0;
      padding: 8px 5px;
      margin: 0 !important;
      border: none !important;
      border-radius: 9px !important;
      font-size: 0.65625rem;
      font-weight: 700;
      letter-spacing: -0.02em;
      white-space: nowrap;
      color: var(--em-muted);
      background: transparent !important;
      transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
      position: relative;
    }
    .embed-login-only .nav-tabs .nav-link::after { display: none !important; }
    .embed-login-only .nav-tabs .nav-link:hover:not(.active) {
      color: var(--em-text);
      background: rgba(255, 255, 255, 0.45) !important;
    }
    .embed-login-only .nav-tabs .nav-link.active {
      color: var(--em-text) !important;
      background: #ffffff !important;
      box-shadow:
        0 2px 8px rgba(15, 23, 42, 0.07),
        0 0 0 1px rgba(15, 23, 42, 0.06) !important;
    }
    .embed-login-only .nav-tabs .nav-link .user-type-badge {
      font-size: 0.78125rem;
      line-height: 1;
      opacity: 0.95;
    }

    /* Inner form card — inset panel */
    .embed-login-only .tab-content {
      flex: 1 1 auto;
      margin: 10px 11px 12px;
      padding: 17px 15px 19px;
      background: var(--em-card);
      border-radius: var(--em-radius-sheet);
      border: 1px solid var(--em-line);
      box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
      overflow-y: auto;
      max-height: min(50vh, 430px);
    }

    .embed-login-only .staff-buttons {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      margin-top: 13px;
    }
    .embed-login-only .staff-btn {
      flex-direction: row;
      justify-content: center;
      gap: 7px;
      padding: 10px 9px;
      font-size: 0.75rem;
      font-weight: 700;
      border-radius: var(--em-radius);
      border: 1px solid var(--em-line);
      background: var(--em-fill);
      color: var(--em-text);
      box-shadow: none;
    }
    .embed-login-only .staff-btn:hover {
      border-color: rgba(37, 99, 235, 0.35);
      background: #ffffff;
      transform: none;
      box-shadow: 0 6px 16px rgba(37, 99, 235, 0.1);
    }
    .embed-login-only .staff-btn i {
      font-size: 0.96875rem;
      color: var(--em-accent);
    }

    .embed-login-only .form-group { margin-bottom: 14px; }
    .embed-login-only .form-label {
      margin-bottom: 6px;
      font-size: 0.75rem;
      font-weight: 700;
      letter-spacing: 0;
      text-transform: none;
      color: var(--em-text);
      gap: 6px;
    }
    .embed-login-only .form-control {
      padding-block: 10px;
      padding-inline-start: 37px;
      padding-inline-end: 11px;
      font-size: 0.84375rem;
      font-weight: 500;
      border-radius: var(--em-radius);
      border: 1px solid var(--em-line);
      background: var(--em-fill);
      color: var(--em-text);
      transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    }
    .embed-login-only .input-icon {
      left: auto;
      right: auto;
      inset-inline-start: 12px;
      font-size: 14px;
    }
    .embed-login-only .form-control:hover {
      border-color: rgba(15, 23, 42, 0.14);
      background: var(--em-card);
    }
    .embed-login-only .form-control:focus {
      outline: none;
      border-color: var(--em-accent);
      background: var(--em-card);
      box-shadow: 0 0 0 3px var(--em-accent-ring);
    }
    .embed-login-only .position-relative:focus-within .input-icon {
      color: var(--em-accent);
    }

    .embed-login-only .tab-content .text-end {
      text-align: start !important;
    }
    .embed-login-only .tab-content a.text-decoration-none {
      font-size: 0.75rem;
      font-weight: 600;
      color: var(--em-link) !important;
    }

    .embed-login-only .divider { margin: 16px 0; }
    .embed-login-only .divider::before { background: var(--em-line); }
    .embed-login-only .divider span {
      background: var(--em-card);
      font-size: 0.625rem;
      font-weight: 700;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      color: var(--em-muted);
    }

    .embed-login-only #loginStep .btn {
      border-radius: var(--em-radius);
      font-weight: 700;
      font-size: 0.8125rem;
      padding: 11px 14px;
      letter-spacing: -0.02em;
    }
    .embed-login-only #loginStep .btn-primary {
      margin-top: 4px;
      border: none;
      background: var(--em-accent);
      color: #ffffff;
      box-shadow: 0 14px 28px -10px rgba(37, 99, 235, 0.55);
    }
    .embed-login-only #loginStep .btn-primary:hover {
      background: var(--em-accent-hover);
      transform: translateY(-1px);
      box-shadow: 0 18px 34px -12px rgba(37, 99, 235, 0.55);
    }
    .embed-login-only #loginStep .btn-success {
      margin-top: 4px;
      border: none;
      background: var(--em-success);
      color: #ffffff;
      box-shadow: 0 14px 28px -10px rgba(13, 148, 136, 0.45);
    }
    .embed-login-only #loginStep .btn-success:hover {
      background: var(--em-success-hover);
      transform: translateY(-1px);
      box-shadow: 0 18px 34px -12px rgba(13, 148, 136, 0.45);
    }
    .embed-login-only #loginStep .btn-info {
      border: 1px solid var(--em-line);
      background: var(--em-fill);
      color: var(--em-text);
    }
    .embed-login-only #loginStep .btn-info:hover {
      background: #ffffff;
      border-color: rgba(37, 99, 235, 0.25);
    }
    .embed-login-only #loginStep .btn-warning {
      border: 1px solid var(--em-line);
      background: var(--em-fill);
      color: var(--em-text);
    }
    .embed-login-only #loginStep .btn-warning:hover {
      background: #ffffff;
      border-color: rgba(37, 99, 235, 0.25);
    }

    /* Modern modal styling for login flows */
    .modal .modal-content {
      border-radius: 16px;
      box-shadow: 0 20px 60px rgba(0,0,0,0.2);
      border: 1px solid rgba(0,0,0,0.05);
      overflow: hidden;
    }
    .modal .modal-header {
      align-items: center;
      gap: 8px;
      border-bottom: 0;
    }
    .modal .modal-footer {
      border-top: 0;
    }
    .modal-header .modal-title i {
      font-size: 18px;
    }
    .modal-header.bg-gradient-success {
      background: linear-gradient(135deg, #10b981, #34d399);
      color: #fff;
    }
    .modal-header.bg-gradient-danger {
      background: linear-gradient(135deg, #ef4444, #f87171);
      color: #fff;
    }
    .modal-header.bg-gradient-warning {
      background: linear-gradient(135deg, #f59e0b, #fbbf24);
      color: #1f2937;
    }
    .modal-header.bg-gradient-primary {
      background: linear-gradient(135deg, #2563eb, #3b82f6);
      color: #fff;
    }
    /* Inline alert polish */
    .alert {
      border-radius: 12px;
      border: 1px solid rgba(0,0,0,0.05);
    }
    .alert i { margin-inline-end: 6px; }
    /* OTP timer chip */
    .otp-timer { font-variant-numeric: tabular-nums; }

    /* Responsive — embedded modal login */
    @media (max-width: 768px) {
      .embed-login-only #loginStep.login-container {
        width: min(372px, calc(100vw - 22px));
      }
      .embed-login-only .login-header {
        padding: 24px 15px 12px;
        column-gap: 11px;
      }
      .embed-login-only .tab-content {
        margin-inline: 10px;
        padding: 15px 13px 17px;
      }
      .embed-login-only .login-step-modal-body > .nav-tabs {
        margin-inline: 10px;
      }
    }

    @media (max-width: 480px) {
      .embed-login-only #loginStep.login-container {
        width: calc(100vw - 18px);
        max-width: none;
        border-radius: 14px;
      }
      .embed-login-only .login-header .logo {
        width: 42px;
        height: 42px;
      }
      .embed-login-only .login-header .logo i {
        font-size: 17px;
      }
      .embed-login-only .login-header h2 {
        font-size: 0.96875rem;
      }
      .embed-login-only .tab-content {
        max-height: min(54vh, 400px);
        margin-inline: 9px;
        margin-bottom: 10px;
        border-radius: 13px;
      }
      .embed-login-only .login-step-modal-body > .nav-tabs {
        margin-inline: 9px;
      }
      .embed-login-only .nav-tabs .nav-link {
        padding: 7px 5px;
        font-size: 0.625rem;
      }
    }

    @media (max-width: 360px) {
      .embed-login-only .nav-tabs .nav-link .user-type-badge { display: none; }
      .embed-login-only .login-header {
        grid-template-columns: 1fr;
        grid-template-areas:
          "logo"
          "title"
          "sub"
          "welcome";
        justify-items: center;
        text-align: center;
      }
      .embed-login-only .login-header .logo {
        justify-self: center;
      }
      .embed-login-only .login-header .welcome-text {
        text-align: center;
      }
    }

    /* Bootstrap Modal Z-Index Override */
    .modal {
      z-index: 999999 !important;
    }
    
    .modal-backdrop {
      z-index: 999998 !important;
    }

/* Initial state override to avoid flicker when landing on #loginStep */
    .login-step-initial #schoolSelectionStep { display: none !important; }
    .login-step-initial #loginStep { display: block !important; }

    /* Hide school/login chrome while auto-resuming remembered school (same flow as "proceed") */
    .portal-school-auto-load #schoolSelectionStep { display: none !important; }
    .portal-school-auto-load #loginStep { display: none !important; }

    /* Footer / modals / overlays sit outside #schoolSelectionStep — hide during remembered-school handoff */
    /* Footer / modals / overlays sit outside #schoolSelectionStep — hide during remembered-school handoff */
    .portal-school-auto-load #copyrightFooter,
    .portal-school-auto-load #loadingModal,
    .portal-school-auto-load #loadingModal.active,
    .portal-school-auto-load #loadingOverlay,
    .portal-school-auto-load #cardModal {
      display: none !important;
      visibility: hidden !important;
      opacity: 0 !important;
      pointer-events: none !important;
    }

    /* Plain backdrop only — no GIF / hero chrome flashing before school page opens */
    /* Plain backdrop only — no GIF / hero chrome flashing before school page opens */
    .portal-school-auto-load body {
      background: #e8ecf2 !important;
    }
    .portal-school-auto-load body::before,
    .portal-school-auto-load body::after {
      display: none !important;
      background-image: none !important;
      content: none !important;
    }
    /*
     * Embed login (iframe): modal / bottom-sheet inspired layout — structure via
     * .login-step-layout + .login-step-modal-body (display:contents outside embed).
     */
    .embed-login-only {
      --em-viewport: #070c14;
      --em-viewport-mid: #101b2e;
      --em-card: #ffffff;
      --em-sheet: #eef2f7;
      --em-line: rgba(15, 23, 42, 0.09);
      --em-text: #0f172a;
      --em-muted: #64748b;
      --em-fill: #f8fafc;
      --em-accent: #2563eb;
      --em-accent-hover: #1d4ed8;
      --em-accent-ring: rgba(37, 99, 235, 0.28);
      --em-success: #0d9488;
      --em-success-hover: #0f766e;
      --em-link: #2563eb;
      --em-radius: 11px;
      --em-radius-sheet: 16px;
      min-height: 100%;
      background: radial-gradient(ellipse 100% 120% at 50% -15%, #1a365d 0%, var(--em-viewport-mid) 42%, var(--em-viewport) 100%);
      color-scheme: light;
    }
    .embed-login-only body {
      background: transparent !important;
      min-height: 100vh;
      min-height: 100dvh;
      margin: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
      box-sizing: border-box;
    }
    .embed-login-only body::before,
    .embed-login-only body::after,
    .embed-login-only .hero-section,
    .embed-login-only .main-content,
    .embed-login-only .trust-section,
    .embed-login-only #schoolSelectionStep,
    .embed-login-only #loadingModal,
    .embed-login-only #cardModal { display: none !important; }

    .embed-login-only #loginStep.login-container {
      display: flex !important;
      flex-direction: column;
      position: relative;
      isolation: isolate;
      width: min(392px, calc(100vw - 28px));
      max-width: 392px;
      margin: 0 auto !important;
      padding: 0;
      min-height: unset;
      overflow: hidden;
      border-radius: var(--em-radius-sheet);
      border: 1px solid rgba(255, 255, 255, 0.14);
      background: var(--em-card);
      box-shadow:
        0 0 0 1px rgba(15, 23, 42, 0.04),
        0 28px 56px -18px rgba(0, 0, 0, 0.55),
        0 12px 24px -12px rgba(0, 0, 0, 0.35);
      animation: embedModalIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    }
    .embed-login-only #loginStep.login-container::before {
      content: '';
      position: absolute;
      top: 8px;
      left: 50%;
      transform: translateX(-50%);
      width: 32px;
      height: 3px;
      border-radius: 100px;
      background: rgba(15, 23, 42, 0.12);
      z-index: 2;
      pointer-events: none;
    }
    @keyframes embedModalIn {
      from { opacity: 0; transform: translateY(18px) scale(0.97); }
      to { opacity: 1; transform: translateY(0) scale(1); }
    }
    @media (prefers-reduced-motion: reduce) {
      .embed-login-only #loginStep.login-container { animation: none; }
    }
    .embed-login-only #loginStep.login-container:hover {
      transform: none;
      box-shadow:
        0 0 0 1px rgba(15, 23, 42, 0.05),
        0 32px 64px -16px rgba(0, 0, 0, 0.58);
    }

    .embed-login-only .login-step-layout {
      display: flex;
      flex-direction: column;
      flex: 1 1 auto;
      min-height: 0;
    }
    .embed-login-only .login-step-modal-body {
      display: flex;
      flex-direction: column;
      flex: 1 1 auto;
      min-height: 0;
      background: var(--em-sheet);
      padding-bottom: 4px;
    }

    /* Header: logo + title alignment (grid), not stacked center */
    .embed-login-only .login-header {
      flex-shrink: 0;
      display: grid;
      grid-template-columns: auto minmax(0, 1fr);
      grid-template-areas:
        "logo title"
        "logo sub"
        "welcome welcome";
      column-gap: 13px;
      row-gap: 3px;
      align-items: center;
      padding: 26px 18px 14px;
      margin: 0;
      border: 0;
      background: var(--em-card);
      text-align: start;
    }
    .embed-login-only .login-header .logo {
      grid-area: logo;
      width: 46px;
      height: 46px;
      margin: 0;
      align-self: center;
      border-radius: 12px;
      border: 1px solid var(--em-line);
      background: linear-gradient(145deg, #f8fafc, #eef2f7);
      box-shadow: 0 8px 20px -10px rgba(37, 99, 235, 0.35);
    }
    .embed-login-only .login-header .logo i {
      font-size: 19px;
      color: var(--em-accent);
    }
    .embed-login-only .login-header h2 {
      grid-area: title;
      margin: 0;
      font-size: 1.03125rem;
      font-weight: 800;
      letter-spacing: -0.04em;
      line-height: 1.2;
      color: var(--em-text);
    }
    .embed-login-only .login-header #loginSubtitle {
      grid-area: sub;
      margin: 0;
      font-size: 0.71875rem;
      font-weight: 500;
      line-height: 1.4;
      color: var(--em-muted);
    }
    .embed-login-only .login-header .welcome-text {
      grid-area: welcome;
      margin: 9px 0 0;
      padding: 8px 11px;
      font-size: 0.71875rem;
      font-weight: 500;
      line-height: 1.45;
      white-space: normal;
      text-align: start;
      border-radius: 10px;
      border: 1px solid var(--em-line);
      border-inline-start-width: 2px;
      border-inline-start-color: var(--em-accent);
      background: var(--em-fill);
      color: var(--em-muted);
    }

    .embed-login-only #langToggle { display: none !important; }
    .embed-login-only .selected-school-info { display: none !important; }

    /* Segmented control — sits on sheet */
    .embed-login-only .login-step-modal-body > .nav-tabs {
      flex-shrink: 0;
      display: flex;
      flex-wrap: nowrap;
      overflow-x: auto;
      scrollbar-width: thin;
      gap: 4px;
      margin: 11px 11px 0;
      padding: 4px;
      border-radius: 11px;
      background: rgba(15, 23, 42, 0.055);
      border: none;
      -webkit-overflow-scrolling: touch;
    }
    .embed-login-only .nav-tabs .nav-item {
      flex: 1 1 0;
      min-width: 0;
    }
    .embed-login-only .nav-tabs .nav-link {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 5px;
      width: 100%;
      min-width: 0;
      padding: 8px 5px;
      margin: 0 !important;
      border: none !important;
      border-radius: 9px !important;
      font-size: 0.65625rem;
      font-weight: 700;
      letter-spacing: -0.02em;
      white-space: nowrap;
      color: var(--em-muted);
      background: transparent !important;
      transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
      position: relative;
    }
    .embed-login-only .nav-tabs .nav-link::after { display: none !important; }
    .embed-login-only .nav-tabs .nav-link:hover:not(.active) {
      color: var(--em-text);
      background: rgba(255, 255, 255, 0.45) !important;
    }
    .embed-login-only .nav-tabs .nav-link.active {
      color: var(--em-text) !important;
      background: #ffffff !important;
      box-shadow:
        0 2px 8px rgba(15, 23, 42, 0.07),
        0 0 0 1px rgba(15, 23, 42, 0.06) !important;
    }
    .embed-login-only .nav-tabs .nav-link .user-type-badge {
      font-size: 0.78125rem;
      line-height: 1;
      opacity: 0.95;
    }

    /* Inner form card — inset panel */
    .embed-login-only .tab-content {
      flex: 1 1 auto;
      margin: 10px 11px 12px;
      padding: 17px 15px 19px;
      background: var(--em-card);
      border-radius: var(--em-radius-sheet);
      border: 1px solid var(--em-line);
      box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
      overflow-y: auto;
      max-height: min(50vh, 430px);
    }

    .embed-login-only .staff-buttons {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      margin-top: 13px;
    }
    .embed-login-only .staff-btn {
      flex-direction: row;
      justify-content: center;
      gap: 7px;
      padding: 10px 9px;
      font-size: 0.75rem;
      font-weight: 700;
      border-radius: var(--em-radius);
      border: 1px solid var(--em-line);
      background: var(--em-fill);
      color: var(--em-text);
      box-shadow: none;
    }
    .embed-login-only .staff-btn:hover {
      border-color: rgba(37, 99, 235, 0.35);
      background: #ffffff;
      transform: none;
      box-shadow: 0 6px 16px rgba(37, 99, 235, 0.1);
    }
    .embed-login-only .staff-btn i {
      font-size: 0.96875rem;
      color: var(--em-accent);
    }

    .embed-login-only .form-group { margin-bottom: 14px; }
    .embed-login-only .form-label {
      margin-bottom: 6px;
      font-size: 0.75rem;
      font-weight: 700;
      letter-spacing: 0;
      text-transform: none;
      color: var(--em-text);
      gap: 6px;
    }
    .embed-login-only .form-control {
      padding-block: 10px;
      padding-inline-start: 37px;
      padding-inline-end: 11px;
      font-size: 0.84375rem;
      font-weight: 500;
      border-radius: var(--em-radius);
      border: 1px solid var(--em-line);
      background: var(--em-fill);
      color: var(--em-text);
      transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    }
    .embed-login-only .input-icon {
      left: auto;
      right: auto;
      inset-inline-start: 12px;
      font-size: 14px;
    }
    .embed-login-only .form-control:hover {
      border-color: rgba(15, 23, 42, 0.14);
      background: var(--em-card);
    }
    .embed-login-only .form-control:focus {
      outline: none;
      border-color: var(--em-accent);
      background: var(--em-card);
      box-shadow: 0 0 0 3px var(--em-accent-ring);
    }
    .embed-login-only .position-relative:focus-within .input-icon {
      color: var(--em-accent);
    }

    .embed-login-only .tab-content .text-end {
      text-align: start !important;
    }
    .embed-login-only .tab-content a.text-decoration-none {
      font-size: 0.75rem;
      font-weight: 600;
      color: var(--em-link) !important;
    }

    .embed-login-only .divider { margin: 16px 0; }
    .embed-login-only .divider::before { background: var(--em-line); }
    .embed-login-only .divider span {
      background: var(--em-card);
      font-size: 0.625rem;
      font-weight: 700;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      color: var(--em-muted);
    }

    .embed-login-only #loginStep .btn {
      border-radius: var(--em-radius);
      font-weight: 700;
      font-size: 0.8125rem;
      padding: 11px 14px;
      letter-spacing: -0.02em;
    }
    .embed-login-only #loginStep .btn-primary {
      margin-top: 4px;
      border: none;
      background: var(--em-accent);
      color: #ffffff;
      box-shadow: 0 14px 28px -10px rgba(37, 99, 235, 0.55);
    }
    .embed-login-only #loginStep .btn-primary:hover {
      background: var(--em-accent-hover);
      transform: translateY(-1px);
      box-shadow: 0 18px 34px -12px rgba(37, 99, 235, 0.55);
    }
    .embed-login-only #loginStep .btn-success {
      margin-top: 4px;
      border: none;
      background: var(--em-success);
      color: #ffffff;
      box-shadow: 0 14px 28px -10px rgba(13, 148, 136, 0.45);
    }
    .embed-login-only #loginStep .btn-success:hover {
      background: var(--em-success-hover);
      transform: translateY(-1px);
      box-shadow: 0 18px 34px -12px rgba(13, 148, 136, 0.45);
    }
    .embed-login-only #loginStep .btn-info {
      border: 1px solid var(--em-line);
      background: var(--em-fill);
      color: var(--em-text);
    }
    .embed-login-only #loginStep .btn-info:hover {
      background: #ffffff;
      border-color: rgba(37, 99, 235, 0.25);
    }
    .embed-login-only #loginStep .btn-warning {
      border: 1px solid var(--em-line);
      background: var(--em-fill);
      color: var(--em-text);
    }
    .embed-login-only #loginStep .btn-warning:hover {
      background: #ffffff;
      border-color: rgba(37, 99, 235, 0.25);
    }

    /* Modern modal styling for login flows */
    .modal .modal-content {
      border-radius: 16px;
      box-shadow: 0 20px 60px rgba(0,0,0,0.2);
      border: 1px solid rgba(0,0,0,0.05);
      overflow: hidden;
    }
    .modal .modal-header {
      align-items: center;
      gap: 8px;
      border-bottom: 0;
    }
    .modal .modal-footer {
      border-top: 0;
    }
    .modal-header .modal-title i {
      font-size: 18px;
    }
    .modal-header.bg-gradient-success {
      background: linear-gradient(135deg, #10b981, #34d399);
      color: #fff;
    }
    .modal-header.bg-gradient-danger {
      background: linear-gradient(135deg, #ef4444, #f87171);
      color: #fff;
    }
    .modal-header.bg-gradient-warning {
      background: linear-gradient(135deg, #f59e0b, #fbbf24);
      color: #1f2937;
    }
    .modal-header.bg-gradient-primary {
      background: linear-gradient(135deg, #2563eb, #3b82f6);
      color: #fff;
    }
    /* Inline alert polish */
    .alert {
      border-radius: 12px;
      border: 1px solid rgba(0,0,0,0.05);
    }
    .alert i { margin-inline-end: 6px; }
    /* OTP timer chip */
    .otp-timer { font-variant-numeric: tabular-nums; }

    /* Responsive — embedded modal login */
    @media (max-width: 768px) {
      .embed-login-only #loginStep.login-container {
        width: min(372px, calc(100vw - 22px));
      }
      .embed-login-only .login-header {
        padding: 24px 15px 12px;
        column-gap: 11px;
      }
      .embed-login-only .tab-content {
        margin-inline: 10px;
        padding: 15px 13px 17px;
      }
      .embed-login-only .login-step-modal-body > .nav-tabs {
        margin-inline: 10px;
      }
    }

    @media (max-width: 480px) {
      .embed-login-only #loginStep.login-container {
        width: calc(100vw - 18px);
        max-width: none;
        border-radius: 14px;
      }
      .embed-login-only .login-header .logo {
        width: 42px;
        height: 42px;
      }
      .embed-login-only .login-header .logo i {
        font-size: 17px;
      }
      .embed-login-only .login-header h2 {
        font-size: 0.96875rem;
      }
      .embed-login-only .tab-content {
        max-height: min(54vh, 400px);
        margin-inline: 9px;
        margin-bottom: 10px;
        border-radius: 13px;
      }
      .embed-login-only .login-step-modal-body > .nav-tabs {
        margin-inline: 9px;
      }
      .embed-login-only .nav-tabs .nav-link {
        padding: 7px 5px;
        font-size: 0.625rem;
      }
    }

    @media (max-width: 360px) {
      .embed-login-only .nav-tabs .nav-link .user-type-badge { display: none; }
      .embed-login-only .login-header {
        grid-template-columns: 1fr;
        grid-template-areas:
          "logo"
          "title"
          "sub"
          "welcome";
        justify-items: center;
        text-align: center;
      }
      .embed-login-only .login-header .logo {
        justify-self: center;
      }
      .embed-login-only .login-header .welcome-text {
        text-align: center;
      }
    }

    /* Bootstrap Modal Z-Index Override */
    .modal {
      z-index: 999999 !important;
    }
    
    .modal-backdrop {
      z-index: 999998 !important;
    }