      :root {
        --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
        --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
        --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
        --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
        --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
        --space-1: 0.25rem;
        --space-2: 0.5rem;
        --space-3: 0.75rem;
        --space-4: 1rem;
        --space-5: 1.25rem;
        --space-6: 1.5rem;
        --space-8: 2rem;
        --space-10: 2.5rem;
        --space-12: 3rem;
        --space-16: 4rem;
        --bg: #071526;
        --sidebar: #06111f;
        --surface: #0d2138;
        --surface-raised: #12304f;
        --surface-soft: rgba(255, 255, 255, 0.055);
        --surface-dynamic: #18395d;
        --border: rgba(255, 255, 255, 0.10);
        --border-strong: rgba(255, 255, 255, 0.18);
        --text: #f7fbff;
        --muted: #bfd0e2;
        --faint: #82a0bd;
        --gold: #ffffff;
        --gold-dark: #d9e8f7;
        --teal: #56b6d6;
        --teal-dark: #2d7da4;
        --error: #e07a7a;
        --success: #6fcf97;
        --radius-card: 18px;
        --radius-composer: 28px;
        --radius-pill: 999px;
        --shadow-raised: 0 18px 48px rgba(0, 0, 0, 0.22);
        --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.18);
        --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);
        --font-body: "Noto Sans Arabic", Tahoma, Arial, sans-serif;
        --sidebar-width: 318px;
        --topbar-height: 72px;
        --composer-height: 122px;
      }

      html[data-theme="light"] {
        --bg: #f7fbff;
        --surface: #ffffff;
        --sidebar: #edf5fc;
        --text: #0b1f35;
        --muted: #54708c;
        --faint: #5e7791;
        --gold: #1a6fa8;
        --gold-dark: #c4ddf0;
        --border: rgba(7, 21, 38, 0.11);
        --border-strong: rgba(7, 21, 38, 0.20);
        --surface-raised: #e3eef8;
        --surface-soft: rgba(7, 21, 38, 0.035);
        --surface-dynamic: #d7e7f5;
        --shadow-raised: 0 18px 48px rgba(0, 0, 0, 0.10);
        --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.07);
      }

      html[data-amoled]:not([data-theme="light"]) {
        --bg: #000000;
        --sidebar: #000000;
        --surface: #0a0a0a;
        --surface-raised: #161616;
        --surface-soft: rgba(255, 255, 255, 0.04);
        --surface-dynamic: #1f1f1f;
        --border: rgba(255, 255, 255, 0.09);
        --border-strong: rgba(255, 255, 255, 0.16);
        --shadow-raised: 0 18px 48px rgba(0, 0, 0, 0.6);
        --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.5);
      }

      html[data-amoled]:not([data-theme="light"]) body {
        background: var(--bg);
      }

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

      html {
        -moz-text-size-adjust: none;
        -webkit-text-size-adjust: none;
        text-size-adjust: none;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
      }

      body {
        width: 100%;
        max-width: 100%;
        min-height: 100dvh;
        overflow: hidden;
        overflow-x: hidden;
        overscroll-behavior-x: none;
        background:
          radial-gradient(circle at 76% -8%, rgba(86, 182, 214, 0.20), transparent 34rem),
          radial-gradient(circle at 7% 89%, rgba(255, 255, 255, 0.08), transparent 32rem),
          var(--bg);
        color: var(--text);
        font-family: var(--font-body);
        font-size: var(--text-base);
        line-height: 1.65;
      }

      html[data-theme="light"] body {
        background:
          radial-gradient(circle at 76% -8%, rgba(86, 182, 214, 0.18), transparent 34rem),
          radial-gradient(circle at 7% 89%, rgba(7, 21, 38, 0.08), transparent 32rem),
          var(--bg);
      }

      img,
      svg {
        display: block;
        max-width: 100%;
      }

      button,
      input,
      textarea,
      select {
        max-width: 100%;
        min-width: 0;
        font: inherit;
        color: inherit;
      }

      button,
      input,
      textarea,
      [role="button"] {
        transition:
          background var(--transition),
          border-color var(--transition),
          color var(--transition),
          box-shadow var(--transition),
          opacity var(--transition),
          transform var(--transition);
      }

      button {
        min-height: 44px;
        border: 0;
        cursor: pointer;
      }

      button:disabled {
        cursor: not-allowed;
        opacity: 0.55;
      }

      :focus-visible {
        outline: 2px solid var(--gold);
        outline-offset: 3px;
        border-radius: 12px;
      }

      .sr-only {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
      }

      .app-shell {
        position: relative;
        min-height: 100vh;
        min-height: 100dvh;
      }

      .screen {
        min-height: 100vh;
        min-height: 100dvh;
      }

      .hidden {
        display: none !important;
      }

      .skip-link {
        position: fixed;
        top: var(--space-4);
        right: var(--space-4);
        z-index: 1000;
        transform: translateY(-160%);
        border-radius: var(--radius-pill);
        background: var(--gold);
        color: #171717;
        padding: var(--space-2) var(--space-4);
        font-weight: 800;
        text-decoration: none;
      }

      .skip-link:focus {
        transform: translateY(0);
      }

      /* ── Display preferences: font size ────────────────────────────────── */
      body.font-sm {
        --text-xs:   0.7rem;
        --text-sm:   0.8rem;
        --text-base: 0.9rem;
        --text-lg:   1.1rem;
        --text-xl:   1.4rem;
      }
      body.font-lg {
        --text-xs:   0.85rem;
        --text-sm:   1rem;
        --text-base: 1.2rem;
        --text-lg:   1.5rem;
        --text-xl:   2rem;
      }

      /* ── Display preferences: density ──────────────────────────────────── */
      body.density-compact {
        --space-3: 0.4rem;
        --space-4: 0.6rem;
        --space-6: 0.9rem;
        --space-8: 1.2rem;
      }

/* Noto Sans Arabic — self-hosted (variable font, arabic + latin subsets) */
@font-face {
  font-family: 'Noto Sans Arabic';
  font-style: normal;
  font-weight: 400 800;
  font-stretch: 100%;
  font-display: swap;
  src: url('/css/fonts/noto-sans-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1,
    U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF,
    U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4,
    U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24,
    U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42,
    U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54,
    U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64,
    U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E,
    U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9,
    U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: 'Noto Sans Arabic';
  font-style: normal;
  font-weight: 400 800;
  font-stretch: 100%;
  font-display: swap;
  src: url('/css/fonts/noto-sans-arabic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

      .login-screen {
        display: grid;
        place-items: center;
        align-content: start;
        padding: calc(var(--space-6) + env(safe-area-inset-top, 0px)) var(--space-6) var(--space-6);
        height: 100dvh;
        min-height: unset;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
      }

      .login-card {
        width: min(100%, 430px);
        border: 1px solid var(--border);
        border-radius: 24px;
        background: rgba(42, 42, 42, 0.82);
        box-shadow: var(--shadow-raised);
        padding: clamp(var(--space-6), 5vw, var(--space-10));
        -webkit-backdrop-filter: blur(18px);
        backdrop-filter: blur(18px);
      }

      html[data-theme="light"] .login-card {
        background: rgba(255, 255, 255, 0.84);
      }

      @media (min-width: 1024px) {
        .login-screen {
          display: grid;
          grid-template-columns: 1fr 1fr;
          align-items: start;
          justify-items: center;
          gap: var(--space-8);
          padding: var(--space-8) var(--space-6);
          min-height: 100dvh;
          background: linear-gradient(90deg,
            var(--surface) 0%,
            var(--surface-dynamic) 50%,
            var(--bg) 100%);
        }

        .login-card {
          width: min(100%, 480px);
          margin: 0;
          grid-column: 2;
          grid-row: 1;
          position: relative;
          z-index: 2;
        }

        #aboutPanel {
          display: flex !important;
          flex-direction: column;
          grid-column: 1;
          grid-row: 1;
          width: min(100%, 480px);
          max-height: calc(100dvh - 4rem);
          overflow-y: auto;
          margin: 0;
        }

        #aboutPanel .login-tabs {
          display: none;
        }

        #aboutPanel .about-content {
          max-height: none;
          overflow-y: visible;
        }

        #showAboutTabFromLogin,
        #showAboutTabFromRegister {
          display: none;
        }
      }

      @media (min-width: 1024px) and (max-width: 1280px) {
        .login-card,
        #aboutPanel {
          width: min(100%, 420px);
        }
      }

      @media (min-width: 1280px) {
        .login-card,
        #aboutPanel {
          width: min(100%, 520px);
        }
      }

      .login-mark {
        width: 76px;
        height: 76px;
        margin: 0 auto var(--space-5);
        border: 1px solid var(--border-strong);
        border-radius: 24px;
        overflow: hidden;
        background: var(--surface-raised);
        box-shadow: var(--shadow-soft);
      }

      @media (min-width: 1024px) {
        .login-card .login-mark {
          width: 88px;
          height: 88px;
          border-radius: 28px;
          box-shadow: var(--shadow-raised);
        }
      }

      .login-mark img,
      .brand-mark img,
      .welcome-logo img,
      .avatar-logo img {
        width: 100%;
        height: 100%;
        object-fit: cover;
      }

      .image-failed {
        display: grid;
        place-items: center;
      }

      .fallback-mark {
        display: inline-grid;
        width: 100%;
        height: 100%;
        place-items: center;
        background: rgba(214, 177, 93, 0.1);
        color: #f1d693;
        font-size: var(--text-sm);
        font-weight: 800;
      }

      .login-card h1,
      .login-card .login-card-title {
        color: var(--text);
        font-size: var(--text-xl);
        font-weight: 800;
        letter-spacing: -0.02em;
        line-height: 1.25;
        text-align: center;
      }

      .login-subtitle {
        margin-top: var(--space-2);
        color: var(--muted);
        font-size: var(--text-sm);
        text-align: center;
      }

      .login-form {
        display: grid;
        gap: var(--space-4);
        margin-top: var(--space-8);
      }

      .login-tabs {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--space-2);
        margin-top: var(--space-6);
      }

      .login-tab {
        flex: 1 1 auto;
        min-width: 4.5rem;
        min-height: 38px;
        border: 1px solid var(--border);
        border-radius: var(--radius-pill);
        background: var(--surface-soft);
        color: var(--muted);
        font-weight: 800;
        font-size: var(--text-xs);
        padding-inline: var(--space-2);
      }

      .login-tab.active {
        background: var(--surface-raised);
        color: var(--text);
        border-color: var(--border-strong);
      }

      .about-content {
        display: grid;
        gap: var(--space-3);
        margin-top: var(--space-5);
        max-height: calc(100dvh - 340px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: max(var(--space-4), env(safe-area-inset-bottom, 20px));
      }

      .about-section {
        border: 1px solid var(--border);
        border-radius: 16px;
        padding: var(--space-4);
        background: var(--surface-soft);
      }

      .about-heading {
        font-size: var(--text-sm);
        font-weight: 800;
        color: var(--text);
        margin-bottom: var(--space-3);
      }

      .about-body {
        color: var(--muted);
        font-size: var(--text-sm);
        line-height: 1.75;
      }

      .about-steps {
        list-style: none;
        padding: 0;
        display: grid;
        gap: var(--space-2);
        margin-top: var(--space-3);
      }

      .about-steps li {
        display: flex;
        align-items: flex-start;
        gap: var(--space-2);
        color: var(--muted);
        font-size: var(--text-sm);
      }

      .step-num {
        min-width: 22px;
        height: 22px;
        border-radius: 50%;
        background: rgba(214,177,93,.15);
        color: #d6b15d;
        font-size: 11px;
        font-weight: 800;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        margin-top: 1px;
      }

      .about-examples {
        list-style: none;
        padding: 0;
        display: grid;
        gap: var(--space-2);
        margin-top: var(--space-2);
      }

      .about-examples li {
        font-size: var(--text-sm);
        color: var(--muted);
        background: var(--surface-raised);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: var(--space-2) var(--space-3);
        line-height: 1.6;
      }

      .about-tags {
        list-style: none;
        padding: 0;
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-2);
        margin-top: var(--space-2);
      }

      .about-tags li {
        font-size: 12px;
        color: var(--muted);
        border: 1px solid var(--border);
        border-radius: var(--radius-pill);
        padding: 2px var(--space-3);
        background: var(--surface-raised);
      }

      .about-models {
        list-style: none;
        padding: 0;
        display: grid;
        gap: var(--space-3);
        margin-top: var(--space-2);
      }

      .about-models li {
        padding-bottom: var(--space-3);
        border-bottom: 1px solid var(--border);
      }

      .about-models li:last-child {
        border-bottom: none;
        padding-bottom: 0;
      }

      .model-label {
        font-size: var(--text-sm);
        font-weight: 800;
        color: var(--text);
      }

      .model-desc {
        font-size: var(--text-sm);
        color: var(--muted);
        margin-top: 2px;
        line-height: 1.6;
      }

      .about-premium {
        border-color: rgba(214,177,93,.35);
        background: rgba(214,177,93,.05);
      }

      .about-premium .about-heading {
        color: #d6b15d;
      }

      .about-premium ul {
        list-style: none;
        padding: 0;
        display: grid;
        gap: var(--space-2);
        margin-top: var(--space-2);
      }

      .about-premium ul li {
        font-size: var(--text-sm);
        color: var(--muted);
        display: flex;
        gap: var(--space-2);
        align-items: flex-start;
      }

      .about-premium ul li::before {
        content: "✦";
        color: #d6b15d;
        flex-shrink: 0;
        font-size: 10px;
        margin-top: 3px;
      }

      .about-cta {
        text-align: center;
        border-color: rgba(214,177,93,.25);
        background: rgba(214,177,93,.07);
      }

      .about-cta .about-heading { color: var(--text); }

      .about-cta p {
        font-size: var(--text-sm);
        color: var(--muted);
        margin-bottom: var(--space-4);
        line-height: 1.7;
      }

      html[data-theme="light"] .about-section {
        background: rgba(0,0,0,.03);
      }

      html[data-theme="light"] .about-examples li,
      html[data-theme="light"] .about-tags li {
        background: #fff;
      }

      html[data-theme="light"] .about-premium {
        background: rgba(214,177,93,.08);
      }

      html[data-theme="light"] .about-cta {
        background: rgba(214,177,93,.1);
      }

      .register-form {
        display: grid;
        gap: var(--space-4);
        margin-top: var(--space-6);
        max-height: calc(100dvh - 380px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: max(var(--space-4), env(safe-area-inset-bottom, 20px));
      }

      .model-select-wrap {
        display: grid;
        gap: var(--space-1);
        align-self: center;
        min-width: 150px;
      }

      .model-select-wrap label {
        color: var(--faint);
        font-size: var(--text-xs);
        font-weight: 800;
      }

      .model-select {
        min-height: 42px;
        border: 1px solid var(--border);
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.035);
        color: var(--text);
        padding: 0 var(--space-3);
        font: inherit;
        font-size: var(--text-sm);
        font-weight: 800;
      }

      html[data-theme="light"] .model-select {
        background: rgba(255, 255, 255, 0.82);
      }

      .field {
        display: grid;
        gap: var(--space-2);
      }

      .field label {
        color: var(--text);
        font-size: var(--text-sm);
        font-weight: 700;
      }

      .field-hint {
        font-size: var(--text-xs);
        color: var(--faint);
        margin: 0;
        line-height: 1.5;
      }
      .field-warn {
        color: var(--error);
        font-size: var(--text-xs);
        margin: 0;
        line-height: 1.5;
      }

      .text-input,
      .composer-textarea {
        width: 100%;
        border: 1px solid var(--border);
        background: rgba(255, 255, 255, 0.035);
        color: var(--text);
      }

      html[data-theme="light"] .text-input,
      html[data-theme="light"] .composer-textarea {
        background: rgba(0, 0, 0, 0.025);
      }

      .text-input {
        min-height: 52px;
        border-radius: 16px;
        padding: 0 var(--space-4);
      }

      .text-input::placeholder,
      .composer-textarea::placeholder {
        color: var(--faint);
      }

      .text-input:hover,
      .composer-textarea:hover {
        border-color: var(--border-strong);
      }

      .text-input:focus,
      .composer-textarea:focus {
        border-color: rgba(214, 177, 93, 0.9);
        box-shadow: 0 0 0 4px rgba(214, 177, 93, 0.35);
        outline: 0;
      }

      .primary-button {
        border-radius: var(--radius-pill);
        background: var(--gold);
        color: #171717;
        font-weight: 800;
        padding: 0 var(--space-6);
      }

      .primary-button:hover:not(:disabled) {
        background: #e1bd6a;
        box-shadow: 0 8px 24px rgba(214, 177, 93, 0.18);
      }

      .primary-button:active:not(:disabled) {
        transform: translateY(1px);
        background: var(--gold-dark);
      }

      .secondary-button {
        border: 1px solid var(--border);
        border-radius: var(--radius-pill);
        background: rgba(255, 255, 255, 0.04);
        color: var(--text);
        font-weight: 700;
        padding: 0 var(--space-5);
        min-height: 44px;
        cursor: pointer;
        transition: background 0.15s, border-color 0.15s, opacity 0.15s;
      }

      .secondary-button:hover:not(:disabled) {
        border-color: var(--border-strong);
        background: rgba(255, 255, 255, 0.07);
      }

      .secondary-button:disabled {
        opacity: 0.45;
        cursor: not-allowed;
      }

      html[data-theme="light"] .secondary-button {
        background: rgba(0, 0, 0, 0.035);
      }

      html[data-theme="light"] .secondary-button:hover {
        background: rgba(0, 0, 0, 0.06);
      }

      /* Inline OTP-sent confirmation under the code field. */
      .otp-status {
        margin-top: var(--space-2);
        font-size: var(--text-sm);
        color: var(--text-secondary);
      }
      .otp-status.ok {
        color: var(--success, #16a085);
        font-weight: 600;
      }

      /* 10-second deprecation splash shown after a password-only login. */
      .deprecation-splash .splash-modal {
        border-color: #d97706;        /* amber-600 */
        box-shadow: 0 12px 40px rgba(217, 119, 6, 0.25);
      }
      .deprecation-splash .splash-title {
        color: #d97706;
      }
      .deprecation-splash .splash-body p {
        margin: 0 0 var(--space-2);
        line-height: 1.7;
      }
      .deprecation-splash #deprecationCountdown {
        display: inline-block;
        min-width: 2ch;
        text-align: center;
        font-variant-numeric: tabular-nums;
        color: #d97706;
      }

      .ghost-button {
        border-radius: var(--radius-pill);
        background: transparent;
        color: var(--muted);
        font-weight: 700;
        padding: 0 var(--space-4);
      }

      .ghost-button:hover {
        background: rgba(255, 255, 255, 0.06);
        color: var(--text);
      }

      html[data-theme="light"] .ghost-button:hover {
        background: rgba(0, 0, 0, 0.055);
      }

      .error-area {
        min-height: 1.55em;
        color: var(--error);
        font-size: var(--text-sm);
        font-weight: 700;
        text-align: center;
      }

