/* ═══════════════════════════════════════════════════════════════════════════
   Masar Beneficiary Portal — Main Stylesheet
   ═══════════════════════════════════════════════════════════════════════════
   Structure:
     1.  CSS Variables (colors, spacing, fonts)
     2.  Global Reset & Base
     3.  Typography (Arabic RTL + English LTR)
     4.  Auth Pages (Login, Forgot Password, Register)
     5.  Form Elements
     6.  Buttons
     7.  Alerts & Flash Messages
     8.  Language Switcher
     9.  WhatsApp Support Button
    10.  Utility Classes
    11.  Responsive (mobile)
   ═══════════════════════════════════════════════════════════════════════════ */


/* ─────────────────────────────────────────────────────────────────────────────
   1. CSS VARIABLES
   ───────────────────────────────────────────────────────────────────────── */
:root {
    /* Brand Colors */
    --primary:        #1a5276;   /* deep navy blue — main brand color */
    --primary-hover:  #154360;   /* darker shade for hover states */
    --primary-light:  #d6eaf8;   /* very light blue — backgrounds */
    --accent:         #1a8a7a;   /* teal — secondary accent */
    --accent-hover:   #148070;

    /* Status Colors */
    --success:        #1e8449;
    --success-light:  #d5f5e3;
    --error:          #c0392b;
    --error-light:    #fdecea;
    --warning:        #d68910;
    --warning-light:  #fef9e7;
    --info:           #1a6fa8;
    --info-light:     #d6eaf8;

    /* Neutral Colors */
    --bg:             #f0f4f8;   /* page background */
    --card-bg:        #ffffff;   /* card background */
    --border:         #d5dce8;   /* input borders, dividers */
    --border-focus:   #1a5276;   /* focused input border */
    --text:           #1c2833;   /* primary text */
    --text-muted:     #6c7a89;   /* secondary text */
    --text-light:     #aab4c0;   /* placeholder text */

    /* Spacing */
    --radius:         10px;      /* border radius for cards */
    --radius-sm:      6px;       /* border radius for inputs, buttons */
    --shadow:         0 4px 24px rgba(26, 82, 118, 0.10);
    --shadow-hover:   0 8px 32px rgba(26, 82, 118, 0.18);

    /* Typography */
    --font-ar: 'Noto Sans Arabic', 'Segoe UI', Arial, sans-serif;
    --font-en: 'Inter', 'Segoe UI', Arial, sans-serif;
}


/* ─────────────────────────────────────────────────────────────────────────────
   2. GLOBAL RESET & BASE
   ───────────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

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

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

img {
    max-width: 100%;
    height: auto;
}


/* ─────────────────────────────────────────────────────────────────────────────
   3. TYPOGRAPHY — Arabic (RTL) + English (LTR)
   ───────────────────────────────────────────────────────────────────────── */

/* Arabic — applied when <html lang="ar"> */
:lang(ar), .lang-ar {
    font-family: var(--font-ar);
    font-size: 1rem;
    letter-spacing: 0;
    word-spacing: 0.05em;
}

/* English — applied when <html lang="en"> */
:lang(en), .lang-en {
    font-family: var(--font-en);
    letter-spacing: -0.01em;
}

/* Headings */
h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.15rem; }


/* ─────────────────────────────────────────────────────────────────────────────
   4. AUTH PAGES (login, forgot password, register)
   ───────────────────────────────────────────────────────────────────────── */

/* Full-page centered layout */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(ellipse at 70% 20%, rgba(26,82,118,0.07) 0%, transparent 60%),
        radial-gradient(ellipse at 20% 80%, rgba(26,138,122,0.05) 0%, transparent 60%),
        var(--bg);
    position: relative;
}

/* White card container */
.auth-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem 2.25rem;
    width: 100%;
    max-width: 420px;
    border-top: 4px solid var(--primary);
    position: relative;
}

/* Logo container */
.auth-logo {
    text-align: center;
    margin-bottom: 1.25rem;
}

.auth-logo img {
    max-height: 90px;
    max-width: 220px;
    object-fit: contain;
}

/* Fallback text if logo image is missing */
.logo-text-fallback {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.02em;
    padding: 0.5rem 0;
}

/* Page title under logo */
.auth-title {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.3rem;
}

/* Subtitle under title */
.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* Info icon for placeholder pages */
.info-icon {
    text-align: center;
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

/* Horizontal divider inside card */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
    color: var(--text-light);
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Footer text below the card */
.auth-footer {
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-align: center;
}


/* ─────────────────────────────────────────────────────────────────────────────
   5. FORM ELEMENTS
   ───────────────────────────────────────────────────────────────────────── */

.auth-form {
    margin-top: 0.5rem;
}

.form-group {
    margin-bottom: 1.1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.4rem;
}

/* Mark required labels */
.form-group label.required::after {
    content: ' *';
    color: var(--error);
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.7rem 0.9rem;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    background-color: #fff;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    line-height: 1.5;
}

.form-control::placeholder {
    color: var(--text-light);
    font-size: 0.875rem;
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(26, 82, 118, 0.12);
}

.form-control:hover:not(:focus) {
    border-color: #9bafc4;
}

/* Password field with show/hide toggle */
.input-with-toggle {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-toggle .form-control {
    padding-inline-end: 2.8rem;   /* space for the toggle button */
}

.toggle-password {
    position: absolute;
    inset-inline-end: 0.75rem;   /* works for both RTL and LTR */
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-muted);
    padding: 0;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.toggle-password:hover {
    opacity: 1;
}

/* Link below password field (Forgot password) */
.form-footer-link {
    text-align: end;
    margin-top: -0.5rem;
    margin-bottom: 1.25rem;
}

.link-subtle {
    font-size: 0.82rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

.link-subtle:hover {
    color: var(--primary);
    text-decoration: none;
}


/* ─────────────────────────────────────────────────────────────────────────────
   6. BUTTONS
   ───────────────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.72rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s,
                box-shadow 0.2s, transform 0.1s;
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    line-height: 1.5;
}

.btn:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.btn:active {
    transform: translateY(0);
}

/* Full-width block button */
.btn-block {
    display: flex;
    width: 100%;
}

/* Primary — filled dark blue */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(26, 82, 118, 0.25);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 4px 14px rgba(26, 82, 118, 0.35);
    color: #ffffff;
}

/* Outline — bordered, no fill */
.btn-outline {
    background-color: transparent;
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

/* Accent — teal */
.btn-accent {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.btn-accent:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #ffffff;
}

/* Small button */
.btn-sm {
    padding: 0.45rem 1rem;
    font-size: 0.85rem;
}


/* ─────────────────────────────────────────────────────────────────────────────
   7. ALERTS & FLASH MESSAGES
   ───────────────────────────────────────────────────────────────────────── */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
    border: 1px solid transparent;
    line-height: 1.5;
}

.alert-icon {
    flex-shrink: 0;
    font-size: 1rem;
    margin-top: 0.05rem;
}

.alert-error {
    background-color: var(--error-light);
    border-color: #f5c6c6;
    color: var(--error);
}

.alert-success {
    background-color: var(--success-light);
    border-color: #a9dfbf;
    color: var(--success);
}

.alert-warning {
    background-color: var(--warning-light);
    border-color: #f9e4a4;
    color: var(--warning);
}

.alert-info {
    background-color: var(--info-light);
    border-color: #aed6f1;
    color: var(--info);
}


/* ─────────────────────────────────────────────────────────────────────────────
   8. LANGUAGE SWITCHER
   ───────────────────────────────────────────────────────────────────────── */

/* Top-right (or top-left in RTL) corner switcher */
.lang-switcher-top {
    position: absolute;
    top: 1.25rem;
    inset-inline-end: 1.5rem;   /* right in LTR, left in RTL */
}

.lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    transition: all 0.2s;
    text-decoration: none;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.lang-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    text-decoration: none;
}


/* ─────────────────────────────────────────────────────────────────────────────
   9. WHATSAPP SUPPORT BUTTON
   ───────────────────────────────────────────────────────────────────────── */

.support-link {
    margin-top: 1.25rem;
    text-align: center;
}

.whatsapp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1a7340;
    background-color: #e8f8ef;
    border: 1.5px solid #a9dfbf;
    border-radius: 20px;
    transition: all 0.2s;
    text-decoration: none;
}

.whatsapp-btn:hover {
    background-color: #d5f5e3;
    color: #145a32;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(26, 115, 64, 0.15);
}

.whatsapp-icon {
    font-size: 1.1rem;
}


/* ─────────────────────────────────────────────────────────────────────────────
   10. UTILITY CLASSES
   ───────────────────────────────────────────────────────────────────────── */

.text-center  { text-align: center; }
.text-start   { text-align: start; }   /* start = left in LTR, right in RTL */
.text-end     { text-align: end; }
.text-muted   { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-error   { color: var(--error); }
.text-success { color: var(--success); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.fw-bold   { font-weight: 700; }
.fw-medium { font-weight: 500; }

.d-none  { display: none; }
.d-block { display: block; }
.d-flex  { display: flex; }


/* ─────────────────────────────────────────────────────────────────────────────
   11. REGISTRATION PAGE
   ───────────────────────────────────────────────────────────────────────── */

/* Full-page layout for the multi-section registration form */
.reg-page {
    min-height: 100vh;
    padding: 2rem 1rem;
    background:
        radial-gradient(ellipse at 70% 20%, rgba(26,82,118,0.07) 0%, transparent 60%),
        radial-gradient(ellipse at 20% 80%, rgba(26,138,122,0.05) 0%, transparent 60%),
        var(--bg);
    position: relative;
}

/* Wider container for the registration form */
.reg-container {
    max-width: 760px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-top: 4px solid var(--primary);
    overflow: hidden;
}

/* Header bar inside the reg card */
.reg-header {
    background: var(--primary);
    color: #fff;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.reg-header .auth-logo img {
    max-height: 60px;
    max-width: 140px;
    filter: brightness(0) invert(1);   /* make logo white */
}

.reg-header-text h1 {
    color: #fff;
    font-size: 1.3rem;
    margin-bottom: 0.15rem;
}

.reg-header-text p {
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
}

/* Main form body — also applied to .reg-form directly */
.reg-body,
.reg-form {
    padding: 1.75rem 2rem;
}

/* Each named section of the form */
.form-section {
    margin-bottom: 2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

/* Section heading bar */
.form-section-title {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 1rem;
    background: var(--primary-light);
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
}

/* Numbered circle before section title */
.section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* Section content padding */
.form-section-body {
    padding: 1.25rem 1rem;
}

/* Two-column row */
.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
}

/* Radio cards grid (e.g. gender, nationality) */
.radio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.5rem;
    margin-top: 0.3rem;
}

/* Individual radio card — the <label> IS the card */
.radio-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 0.5rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.18s, background 0.18s, color 0.18s;
    background: #fff;
    color: var(--text);
    line-height: 1.3;
    min-height: 2.6rem;
    user-select: none;
}

/* Hide the actual radio/checkbox input visually but keep it accessible */
.radio-card input[type="radio"],
.radio-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Checked state — uses :has() which is supported in all modern browsers */
.radio-card:has(input[type="radio"]:checked),
.radio-card:has(input[type="checkbox"]:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    box-shadow: 0 0 0 2px rgba(26, 82, 118, 0.15);
}

.radio-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

/* Inline radio row (horizontal) */
.radio-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.3rem;
}

.radio-row .radio-card {
    flex: 1 1 auto;
    min-width: 100px;
}

/* Hint text below inputs */
.field-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* Validation error list under submit */
.error-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.error-list li {
    padding: 0.2rem 0;
    font-size: 0.88rem;
}

.error-list li::before {
    content: '• ';
}

/* Bottom actions bar */
.reg-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 2rem;
    background: #f8fafc;
    border-top: 1px solid var(--border);
}

/* select element inherits form-control styles */
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236c7a89' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    padding-right: 2.2rem;
}

/* RTL: flip the dropdown arrow position */
[dir="rtl"] select.form-control {
    background-position: left 0.9rem center;
    padding-right: 0.9rem;
    padding-left: 2.2rem;
}


/* ─────────────────────────────────────────────────────────────────────────────
   12. OTP VERIFY PAGE
   ───────────────────────────────────────────────────────────────────────── */

/* Large shield icon above the card title */
.otp-shield-icon {
    text-align: center;
    font-size: 2.8rem;
    margin-bottom: 0.5rem;
}

/* Masked mobile number display */
.otp-mobile-mask {
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.05em;
    display: inline-block;
    margin-top: 0.2rem;
}

/* Large centered OTP input field */
.otp-input {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.4em;
    padding: 0.75rem;
    color: var(--primary);
}

/* Resend link row */
.otp-resend-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.link-resend {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--accent);
    transition: color 0.2s;
}

.link-resend:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}


/* ─────────────────────────────────────────────────────────────────────────────
   13. PORTAL LAYOUT (base_portal.html)
   ───────────────────────────────────────────────────────────────────────── */

.portal-page {
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    flex-direction: column;
}

/* ── Topbar ───────────────────────────────────────────────────────────── */
.portal-topbar {
    background: var(--primary);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.portal-topbar-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 58px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Brand / Logo */
.portal-brand { flex: 0 0 auto; }

.portal-brand-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.portal-brand-link img {
    max-height: 38px;
    filter: brightness(0) invert(1);
}

.portal-logo-text {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
}

/* Navigation Links */
.portal-nav {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.portal-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255,255,255,0.82);
    text-decoration: none;
    transition: background 0.18s, color 0.18s;
    position: relative;
    white-space: nowrap;
}

.portal-nav-link:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    text-decoration: none;
}

.portal-nav-link.active {
    background: rgba(255,255,255,0.18);
    color: #fff;
    font-weight: 700;
}

.nav-icon { font-size: 0.95rem; }

/* Notification badge on nav link */
.notif-badge-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.1rem;
    height: 1.1rem;
    background: #e74c3c;
    color: #fff;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0 0.25rem;
    margin-inline-start: 0.1rem;
}

/* Top-right actions */
.portal-topbar-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.portal-lang-btn {
    background: rgba(255,255,255,0.12) !important;
    border-color: rgba(255,255,255,0.25) !important;
    color: #fff !important;
    font-size: 0.78rem !important;
    padding: 0.3rem 0.7rem !important;
}

.portal-lang-btn:hover {
    background: rgba(255,255,255,0.22) !important;
    text-decoration: none;
}

.portal-logout-btn {
    border-color: rgba(255,255,255,0.45);
    color: #fff;
    font-size: 0.82rem;
}

.portal-logout-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    text-decoration: none;
}

/* ── Content + Footer ─────────────────────────────────────────────────── */
.portal-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.75rem 1.5rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    flex: 1;
}

.portal-footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.78rem;
    color: var(--text-light);
    border-top: 1px solid var(--border);
    margin-top: auto;
}


/* ─────────────────────────────────────────────────────────────────────────────
   14. PORTAL COMPONENTS (shared across portal pages)
   ───────────────────────────────────────────────────────────────────────── */

/* ── Page heading ─────────────────────────────────────────────────────── */
.page-heading {
    margin-bottom: 0.25rem;
}

.page-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.3rem;
}

.page-sub {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ── Portal Card ──────────────────────────────────────────────────────── */
.portal-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.portal-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
}

.portal-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

/* ── Status Badges ────────────────────────────────────────────────────── */
.sbadge {
    display: inline-block;
    padding: 0.22rem 0.75rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.sbadge-draft            { background: #f0f0f0;           color: #666; }
.sbadge-submitted        { background: #e3f2fd;           color: #1565c0; }
.sbadge-under_review     { background: #e8f4fd;           color: #0277bd; }
.sbadge-supervisor_review{ background: #e1f5fe;           color: #0288d1; }
.sbadge-approved         { background: var(--success-light); color: var(--success); }
.sbadge-follow_up        { background: #fff8e1;           color: #f57f17; }
.sbadge-completed        { background: #e8f5e9;           color: #1b5e20; }
.sbadge-rejected         { background: var(--error-light);color: var(--error); }
.sbadge-cancelled        { background: #f5f5f5;           color: #757575; }
.sbadge-on_hold          { background: #fff3e0;           color: #e65100; }

/* Legacy badge classes (kept for compatibility) */
.status-badge  { display: inline-block; padding: 0.2rem 0.75rem; border-radius: 20px;
                 font-size: 0.8rem; font-weight: 600; }
.status-active { background: var(--success-light); color: var(--success); }

/* ── Stats Grid ───────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1rem;
    text-align: center;
    border-top: 3px solid var(--primary);
}

.stat-warning { border-top-color: var(--warning); }
.stat-success { border-top-color: var(--success); }
.stat-accent  { border-top-color: var(--accent);  }

.stat-icon   { font-size: 1.5rem; margin-bottom: 0.3rem; }
.stat-number { font-size: 2rem; font-weight: 700; color: var(--primary); line-height: 1.1; }
.stat-warning .stat-number { color: var(--warning); }
.stat-success .stat-number { color: var(--success); }
.stat-accent  .stat-number { color: var(--accent);  }
.stat-label  { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.3rem; }

/* ── Dashboard Welcome ────────────────────────────────────────────────── */
.dashboard-welcome {
    background: linear-gradient(135deg, var(--primary) 0%, #1a6fa8 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.welcome-icon  { font-size: 2.5rem; flex-shrink: 0; }
.welcome-title { color: #fff; font-size: 1.35rem; margin-bottom: 0.2rem; }
.welcome-sub   { color: rgba(255,255,255,0.8); font-size: 0.875rem; }

/* ── Table ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.portal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.portal-table th {
    padding: 0.75rem 1rem;
    text-align: start;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.portal-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #f0f4f8;
    color: var(--text);
    vertical-align: middle;
}

.portal-table tr:last-child td { border-bottom: none; }
.portal-table tbody tr:hover td { background: #f8fafc; }

.case-num {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--primary);
    font-size: 0.85rem;
}

/* ── Status Legend (filter bar) ──────────────────────────────────────── */
.status-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.9rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
}

/* ── Empty State ──────────────────────────────────────────────────────── */
.empty-state { padding: 3rem 2rem; text-align: center; }
.empty-icon  { font-size: 3rem; margin-bottom: 0.75rem; opacity: 0.45; }
.empty-title { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 0.4rem; }
.empty-sub   { font-size: 0.875rem; color: var(--text-muted); }

/* ── Profile Sections ─────────────────────────────────────────────────── */
.profile-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.profile-section-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.8rem 1.5rem;
    background: var(--primary-light);
    border-bottom: 1px solid var(--border);
}

.profile-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
}

.profile-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 0 1.5rem;
}

.profile-fields-1 { grid-template-columns: 1fr; }

.profile-field {
    padding: 0.7rem 0;
    border-bottom: 1px solid #f0f4f8;
}

.profile-field:last-child { border-bottom: none; }

.profile-field-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 0.2rem;
}

.profile-field-value {
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 500;
}

/* ── Notifications ────────────────────────────────────────────────────── */
.notif-list { display: flex; flex-direction: column; }

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f0f4f8;
    transition: background 0.15s;
}

.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: #f5f8fe; }
.notif-item:hover  { background: #f4f7fc; }

.notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    margin-top: 0.45rem;
}

.notif-dot.read { background: var(--border); }

.notif-body     { flex: 1; }
.notif-title    { font-size: 0.9rem; font-weight: 700; color: var(--text); margin-bottom: 0.2rem; }
.notif-message  { font-size: 0.875rem; color: var(--text-muted); line-height: 1.55; }
.notif-date     { font-size: 0.75rem; color: var(--text-light); margin-top: 0.3rem; }

/* ── Request Detail / Tracking ────────────────────────────────────────── */
.detail-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
}

.meta-item {
    padding: 0.7rem 0.9rem;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.meta-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.3rem;
}

.meta-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

/* Tracking Timeline */
.timeline-wrap { padding: 1.25rem 1.5rem; }

.timeline {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-inline-start: 1rem;
}

.timeline::before {
    content: '';
    position: absolute;
    inset-inline-start: 1.9rem;
    top: 1rem;
    bottom: 1rem;
    width: 2px;
    background: var(--border);
    border-radius: 2px;
}

.timeline-step {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 0;
    align-items: flex-start;
}

.timeline-dot {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid var(--bg);
    box-shadow: 0 0 0 2px var(--primary);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    z-index: 1;
}

.timeline-body {
    flex: 1;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
}

.timeline-action { font-size: 0.875rem; font-weight: 700; color: var(--text); margin-bottom: 0.2rem; }
.timeline-stage  { font-size: 0.8rem; color: var(--text-muted); }
.timeline-note   { font-size: 0.85rem; color: var(--text); margin-top: 0.4rem;
                   padding-top: 0.4rem; border-top: 1px solid var(--border); }
.timeline-date   { font-size: 0.75rem; color: var(--text-light); margin-top: 0.3rem; }


/* ─────────────────────────────────────────────────────────────────────────────
   15. REQUEST WIZARD (Phase F)
   ───────────────────────────────────────────────────────────────────────── */

/* ── Wizard Progress Bar ─────────────────────────────────────────────── */
.wizard-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0.5rem 0;
    margin-bottom: 0.25rem;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.wizard-step-circle {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    border: 2.5px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.2s;
}

.wizard-step.active .wizard-step-circle {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(26, 82, 118, 0.18);
}

.wizard-step.done .wizard-step-circle {
    border-color: var(--success);
    background: var(--success);
    color: #fff;
}

.wizard-step-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.wizard-step.active .wizard-step-label { color: var(--primary); }
.wizard-step.done   .wizard-step-label { color: var(--success);  }

.wizard-connector {
    width: 4rem;
    height: 2.5px;
    background: var(--border);
    margin: 0 0.4rem;
    margin-bottom: 1.1rem;   /* align with circles */
    transition: background 0.2s;
}

.wizard-connector.done { background: var(--success); }

/* ── Service Cards (Step 1) ──────────────────────────────────────────── */
.service-grid-wrap { padding: 1.5rem; }

.service-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.service-card-btn {
    width: 100%;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 1.25rem;
    text-align: start;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-family: inherit;
}

.service-card-btn:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.service-card-icon    { font-size: 2.25rem; margin-bottom: 0.25rem; }

.service-card-name    {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.3;
}

.service-card-project {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
}

.service-card-desc    {
    font-size: 0.83rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin-top: 0.2rem;
}

.service-card-action  {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: 0.5rem;
    opacity: 0.7;
}

.service-card-btn:hover .service-card-action { opacity: 1; }

/* ── Description Cards (Step 2) ──────────────────────────────────────── */
.desc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.65rem;
    margin-bottom: 1.5rem;
}

.desc-card {
    display: block;
    cursor: pointer;
}

.desc-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.desc-card-inner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    transition: border-color 0.18s, background 0.18s;
}

.desc-card:hover .desc-card-inner {
    border-color: var(--primary);
    background: var(--primary-light);
}

.desc-card:has(input:checked) .desc-card-inner {
    border-color: var(--primary);
    background: var(--primary-light);
}

.desc-card-check {
    font-size: 1rem;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-top: 0.05rem;
}

.desc-card-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
}

.desc-card:has(input:checked) .desc-card-name { color: var(--primary); }

/* ── Items Grid (Step 3) ─────────────────────────────────────────────── */
.items-select-all {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.selected-count-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    margin-inline-start: auto;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 0.55rem;
}

.item-card {
    position: relative;
}

.item-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.item-card label {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.7rem 0.9rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: #fff;
    transition: border-color 0.15s, background 0.15s;
    min-height: 2.8rem;
}

.item-card:has(input:checked) label {
    border-color: var(--primary);
    background: var(--primary-light);
}

.item-card label:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.item-check-icon {
    font-size: 1rem;
    flex-shrink: 0;
    color: var(--text-muted);
    margin-top: 0.05rem;
}

.item-card:has(input:checked) .item-check-icon { color: var(--primary); }

.item-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
}

.item-card:has(input:checked) .item-name {
    color: var(--primary);
    font-weight: 700;
}

/* ── Wizard Navigation Actions ───────────────────────────────────────── */
.wizard-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
}


/* ─────────────────────────────────────────────────────────────────────────────
   16. RESPONSIVE — Tablet & Mobile
   ───────────────────────────────────────────────────────────────────────── */

/* Tablet: collapse nav labels on smaller screens */
@media (max-width: 768px) {
    .portal-topbar-inner {
        padding: 0 0.75rem;
        height: 52px;
    }

    .portal-nav { gap: 0; }

    .portal-nav-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    .nav-label { display: none; }
    .nav-icon  { font-size: 1.1rem; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    .profile-fields { grid-template-columns: 1fr; }

    .detail-meta-grid { grid-template-columns: 1fr 1fr; }

    /* Wizard tablet */
    .service-grid { grid-template-columns: 1fr 1fr; }
    .wizard-connector { width: 2.5rem; }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 2rem 1.25rem;
        border-radius: var(--radius-sm);
        border-top-width: 3px;
    }

    .auth-title {
        font-size: 1.2rem;
    }

    .btn {
        font-size: 0.9rem;
        padding: 0.65rem 1.2rem;
    }

    .lang-switcher-top {
        top: 0.75rem;
        inset-inline-end: 0.75rem;
    }

    /* Registration page — stack columns on mobile */
    .form-row-2 {
        grid-template-columns: 1fr;
    }

    .reg-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 1.25rem 1.25rem;
    }

    .reg-body {
        padding: 1.25rem 1rem;
    }

    .reg-actions {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
    }

    .radio-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* OTP input smaller on mobile */
    .otp-input {
        font-size: 1.4rem;
        letter-spacing: 0.3em;
    }

    /* Portal mobile */
    .service-grid     { grid-template-columns: 1fr; }
    .items-grid       { grid-template-columns: 1fr; }
    .desc-grid        { grid-template-columns: 1fr; }
    .wizard-actions   { flex-direction: column-reverse; align-items: stretch; }
    .wizard-connector { width: 1.5rem; }
    .stats-grid       { grid-template-columns: repeat(2, 1fr); }
    .portal-content   { padding: 1rem; }
    .portal-card-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .profile-fields   { grid-template-columns: 1fr; }
    .detail-meta-grid { grid-template-columns: 1fr; }
    .dashboard-welcome { flex-direction: column; gap: 0.75rem; padding: 1.25rem; }
    .welcome-title    { font-size: 1.1rem; }
    .notif-item       { padding: 0.9rem 1rem; }
    .timeline-wrap    { padding: 1rem; }
    .chronic-grid     { grid-template-columns: repeat(2, 1fr); }
    .upload-group     { margin-bottom: 1.25rem; }
}

/* ── Section 17: Health Data Form (Step 4) ────────────────────────────── */

.health-form-body {
    padding: 1.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Required asterisk label helper */
.required-label::after {
    content: ' *';
    color: var(--error);
}

.form-label-hint {
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-inline-start: 0.3rem;
}

/* Chronic diseases checkbox grid */
.chronic-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.chronic-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}

.chronic-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.chronic-card:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
    font-weight: 600;
    color: var(--primary);
}

.chronic-card input[type="checkbox"] {
    accent-color: var(--primary);
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

/* Consent radio options */
.consent-radios {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.consent-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}

.consent-option:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.consent-option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
    font-weight: 600;
    color: var(--primary);
}

.consent-option input[type="radio"] {
    accent-color: var(--primary);
    width: 1rem;
    height: 1rem;
}

/* ── File Upload ─────────────────────────────────────────────────────── */

.upload-group {
    margin-bottom: 0.25rem;
}

.upload-box {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 1.25rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s;
    background: var(--surface);
}

.upload-box:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-box-drag {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-box-selected {
    border-color: var(--success);
    background: #f0fff4;
}

.upload-icon {
    font-size: 1.75rem;
    margin-bottom: 0.4rem;
    line-height: 1;
}

.upload-instructions {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.2rem;
}

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

/* The actual <input type="file"> — hidden visually but clickable */
.upload-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.upload-chosen {
    margin-top: 0.65rem;
    font-size: 0.85rem;
    color: var(--success);
    font-weight: 600;
    word-break: break-all;
}

.upload-error-msg {
    margin-top: 0.35rem;
    font-size: 0.83rem;
    color: var(--error);
}

/* ── Declarations ────────────────────────────────────────────────────── */

.decl-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.decl-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}

.decl-item:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
}

.decl-item input[type="checkbox"] {
    accent-color: var(--primary);
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.decl-text {
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text);
}

.decl-required {
    color: var(--error);
    font-weight: 700;
    margin-inline-end: 0.2rem;
}

/* Final submit button */
.btn-submit-final {
    min-width: 10rem;
    font-size: 1rem;
    padding: 0.65rem 1.75rem;
}

@media (max-width: 480px) {
    .health-form-body  { padding: 1.25rem 1rem; }
    .chronic-grid      { grid-template-columns: repeat(2, 1fr); }
    .consent-radios    { flex-direction: column; }
}


/* ─────────────────────────────────────────────────────────────────────────────
   18. RTL-SPECIFIC OVERRIDES
   Applied when <html dir="rtl"> (Arabic language mode).
   Most layout already uses logical CSS properties (padding-inline-*, etc.)
   These rules handle the few remaining physical/directional edge cases.
   ───────────────────────────────────────────────────────────────────────── */

/* Flip wizard progress connector visual flow for RTL reading direction.
   The connector itself is symmetric (a line), but the overall wizard
   direction reverses automatically via flex row-reverse in RTL. */
[dir="rtl"] .wizard-connector {
    /* Connectors are directionally neutral — no change needed */
}

/* Status legend wraps from right in RTL */
[dir="rtl"] .status-legend {
    justify-content: flex-start;
}

/* Chronic-disease grid and items flow RTL natively via flex/grid,
   but the checkbox sits before the label text in LTR; in RTL the
   flex row reverses automatically. Keep checkbox at the start. */
[dir="rtl"] .chronic-card,
[dir="rtl"] .check-item,
[dir="rtl"] .decl-item {
    flex-direction: row; /* maintain source order; bidi handles text */
}

/* Timeline vertical rule stays at inline-start (right in RTL)
   thanks to inset-inline-start in the base style. No override needed. */

/* Upload box text is centered — neutral in both directions */

/* Alert icon comes before text; in RTL ensure it remains at inline-start */
[dir="rtl"] .alert {
    flex-direction: row;
}

/* Force numeric/phone/date values to remain LTR regardless of page dir.
   Applied directly in templates via dir="ltr" on those cells.
   This rule is a safety net for any missed instances. */
[dir="rtl"] td[dir="ltr"],
[dir="rtl"] div[dir="ltr"],
[dir="rtl"] span[dir="ltr"],
[dir="rtl"] input[type="date"],
[dir="rtl"] input[type="tel"],
[dir="rtl"] input[type="number"] {
    direction: ltr;
    text-align: start;
}

/* Breadcrumb separators (›) — flip visually in RTL */
[dir="rtl"] .admin-breadcrumb-sep {
    display: inline-block;
    transform: scaleX(-1);
}
