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

html.chat-page, html.chat-page body {
    overflow: hidden;
    overscroll-behavior: none;
    position: fixed;
    width: 100%;
    height: 100%;
}

:root {
    --primary: #4B72A6;
    --primary-dark: #3A5A85;
    --primary-light: #DFE9F2;
    --primary-soft: #EDF2F8;

    --accent-gold: #A68A56;
    --accent-gold-light: #C4A97A;
    --accent-gold-dark: #8B7347;

    --secondary: #4F6273;
    --secondary-light: #6B7F91;
    --secondary-dark: #3D4E5C;

    --near-black: #0D0D0D;

    --success: #059669;
    --success-light: #ECFDF5;
    --warning: #D97706;
    --warning-light: #FFFBEB;
    --error: #DC2626;
    --error-light: #FEF2F2;
    --info: #4B72A6;
    --info-light: #DFE9F2;

    --font-base: 16px;
    --line-height-body: 1.65;
    --line-height-heading: 1.3;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --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;

    --transition-base: 0.2s ease;

    --font-body-en: "Raleway", "Inter", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-heading-en: "Questrial", "Playfair Display", serif;
    --font-heading-en-h2: "Questrial", "Raleway", sans-serif;
    --font-body-ar: "Tajawal", "Noto Sans Arabic", sans-serif;
    --font-heading-ar: "Cairo", sans-serif;
    --font-heading-ar-h2: "Tajawal", sans-serif;
    --font-input: "Noto Sans", "Cairo", "Segoe UI", Tahoma, sans-serif;

    --gold-primary: var(--accent-gold);
    --gold-secondary: var(--accent-gold-light);
    --gold-dark: var(--accent-gold-dark);
    --navy-primary: var(--near-black);
    --navy-dark: var(--near-black);
    --navy-light: var(--secondary);
    --royal-blue: var(--primary);
    --royal-blue-hover: var(--primary-dark);
    --teal-primary: var(--primary);
    --teal-light: var(--secondary-light);
    --charcoal: #2d3748;

    --brand-primary: var(--primary);
    --brand-hover: var(--primary-dark);
    --focus-ring: var(--primary);

    --btn-navy: var(--near-black);
    --btn-navy-hover: #1a1a1a;
    --btn-orange: var(--accent-gold);
    --btn-orange-hover: var(--accent-gold-dark);
    --btn-support: var(--secondary);
    --btn-support-hover: var(--secondary-dark);
}

[data-theme="light"],
:root {
    --bg-primary: #DFE9F2;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #EDF2F8;
    --bg-inverse: #0D0D0D;
    --text-primary: #0D0D0D;
    --text-secondary: #4F6273;
    --text-muted: #6B7F91;
    --text-tertiary: #6B7F91;
    --text-inverse: #FFFFFF;
    --border-color: rgba(79, 98, 115, 0.2);
    --border-light: rgba(79, 98, 115, 0.12);
    --border-medium: rgba(79, 98, 115, 0.15);
    --card-bg: rgba(255, 255, 255, 0.6);
    --input-bg: rgba(255, 255, 255, 0.7);
    --header-bg: rgba(223, 233, 242, 0.7);
    --ai-accent: var(--primary);
    --cta-primary: var(--primary);
    --cta-hover: var(--primary-dark);

    --page-gradient: linear-gradient(160deg, #DFE9F2 0%, #E8EDF3 30%, #F0F3F6 60%, #DFE9F2 100%);

    --shadow-color: rgba(0, 0, 0, 0.06);
    --shadow-sm: 0 1px 3px var(--shadow-color);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.1);
    --shadow-1: 0 1px 3px var(--shadow-color);
    --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.06);

    --glass-bg: rgba(255, 255, 255, 0.55);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-blur: 16px;

    --gradient-overlay: linear-gradient(135deg, rgba(255,255,255,0.6), rgba(255,255,255,0.4));
}

[data-theme="dark"] {
    --bg-primary: #0D0D0D;
    --bg-secondary: #1A1A1A;
    --bg-tertiary: #2A2A2A;
    --bg-inverse: #DFE9F2;
    --text-primary: #DFE9F2;
    --text-secondary: #A0B0C0;
    --text-muted: #6B7F91;
    --text-tertiary: #6B7F91;
    --text-inverse: #0D0D0D;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.05);
    --border-medium: rgba(255, 255, 255, 0.12);
    --card-bg: rgba(26, 26, 26, 0.75);
    --input-bg: rgba(13, 13, 13, 0.6);
    --header-bg: rgba(13, 13, 13, 0.8);
    --ai-accent: #7B9CC6;
    --cta-primary: var(--primary);
    --cta-hover: var(--primary-dark);

    --primary-light: #7B9CC6;

    --page-gradient: linear-gradient(160deg, #0D0D0D 0%, #141418 30%, #1a1f2e 60%, #0D0D0D 100%);

    --shadow-color: rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 1px 3px var(--shadow-color);
    --shadow-md: 0 4px 6px -1px var(--shadow-color);
    --shadow-lg: 0 10px 15px -3px var(--shadow-color);
    --shadow-xl: 0 20px 25px -5px var(--shadow-color);
    --shadow-1: none;
    --shadow-2: 0 4px 24px rgba(0,0,0,0.3);

    --glass-bg: rgba(26, 26, 26, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: 20px;

    --gradient-overlay: linear-gradient(135deg, rgba(13,13,13,0.8), rgba(26,26,26,0.7));
}

html {
    font-size: var(--font-base);
}

body {
    font-family: var(--font-body-en);
    font-size: 1rem;
    line-height: var(--line-height-body);
    font-weight: 400;
    background: var(--page-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.font-english {
    font-family: var(--font-body-en);
}

body.font-arabic {
    font-family: var(--font-body-ar);
}

[dir="rtl"] body {
    font-family: var(--font-body-ar);
}

[dir="rtl"] {
    letter-spacing: normal !important;
}

[dir="rtl"] p,
[dir="rtl"] .body-text,
[dir="rtl"] .step-content p,
[dir="rtl"] .disclaimer-text,
[dir="rtl"] .hero-desc {
    font-size: 1.0625rem;
}

[dir="rtl"] .text-secondary,
[dir="rtl"] .text-meta,
[dir="rtl"] .text-helper {
    font-size: 0.9375rem;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading-en);
    font-weight: 600;
    line-height: var(--line-height-heading);
    color: var(--text-primary);
}

h1 {
    font-family: var(--font-heading-en);
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.3;
}

h2 {
    font-family: var(--font-heading-en-h2);
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
}

[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4, [dir="rtl"] h5, [dir="rtl"] h6 {
    font-family: var(--font-heading-ar);
}

[dir="rtl"] h1 {
    font-family: var(--font-heading-ar);
    font-weight: 700;
}

[dir="rtl"] h2 {
    font-family: var(--font-heading-ar-h2);
    font-weight: 500;
}

h3 {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.4;
}

h4 {
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
}

[dir="rtl"] h3,
[dir="rtl"] h4 {
    font-weight: 700;
}

p {
    font-size: 1rem;
    line-height: 1.65;
    font-weight: 400;
    color: var(--text-primary);
}

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

.text-meta,
.text-helper {
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--text-muted);
}

button {
    font-family: inherit;
}

input,
textarea,
select,
.input-field {
    font-family: var(--font-input);
    font-size: 1rem;
    line-height: 1.4;
    font-weight: 400;
    color: var(--text-primary);
}

input[type="email"],
input[type="password"] {
    direction: ltr;
    text-align: left;
}

.otp-input {
    direction: ltr;
    text-align: center;
}

.otp-inputs {
    direction: ltr;
}

label,
.form-label {
    font-size: 0.875rem;
    line-height: 1.4;
    font-weight: 500;
    color: var(--text-primary);
}

.form-error,
.error-text {
    font-size: 0.8125rem;
    line-height: 1.4;
    font-weight: 400;
    color: var(--error);
}

a {
    text-decoration: none;
    color: inherit;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--cta-primary, var(--royal-blue));
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--cta-hover, var(--royal-blue-hover));
}

.btn-gold {
    background: var(--gold-primary);
    color: #1E1E20;
    font-weight: 600;
}

.btn-gold:hover {
    background: var(--gold-dark);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-large {
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

.btn-small {
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-xl {
    height: 3rem;
    border-radius: var(--radius-md);
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
}

.btn-navy {
    background: var(--btn-navy);
    color: #ffffff;
    box-shadow: var(--shadow-2);
}

.btn-navy:hover {
    background: var(--btn-navy-hover);
}

.btn-orange {
    background: var(--btn-orange);
    color: #ffffff;
    box-shadow: var(--shadow-2);
}

.btn-orange:hover {
    background: var(--btn-orange-hover);
}

.btn-support {
    background: var(--btn-support);
    color: #ffffff;
    box-shadow: var(--shadow-2);
}

.btn-support:hover {
    background: var(--btn-support-hover);
}

.btn-outline {
    background: transparent;
    color: #ffffff;
    border: 1px solid #ffffff;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.landing-page {
    min-height: 100vh;
}

.landing-nav, .home-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--header-bg, var(--navy-primary));
    border-bottom: 1px solid var(--border-color);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 1.75rem;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.language-selector select, .lang-select-small {
    padding: 0.5rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    cursor: pointer;
}

.theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
}

.nav-icon-btn {
    position: relative;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 1.25rem;
}

.notification-badge, .notification-badge-small {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--error);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--gold-primary);
}

.landing-page.ims-split {
    min-height: 100vh;
    display: flex;
    flex-direction: row;
    position: relative;
    overflow: hidden;
}


html[dir="rtl"] .landing-page.ims-split {
    flex-direction: row-reverse;
}

.landing-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    z-index: 10;
    direction: ltr;
}

.landing-controls-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.flat-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: color 0.2s, background 0.2s;
}

.flat-icon-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.flat-lang-selector {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.flat-lang-selector .lang-icon {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

.flat-lang-selector select {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 0.25rem;
    font-size: 0.875rem;
    cursor: pointer;
    outline: none;
}

.flat-lang-selector select:hover {
    color: var(--text-primary);
}

.landing-logo-right {
    display: flex;
    align-items: center;
    position: absolute;
    top: 1rem;
    right: calc((560px - 420px) / 2 + 2rem);
}

.signin-icon {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

[data-theme="dark"] .signin-icon {
    filter: invert(0.85) brightness(1.2);
}

.landing-logo-right img {
    height: 64px;
    width: auto;
    object-fit: contain;
}

.landing-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 10;
}

.landing-controls .language-selector select {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.landing-controls .theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ims-left-section {
    flex: 1;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    padding-top: 6rem;
    position: relative;
}

.ims-branding {
    text-align: center;
    animation: fadeIn 0.6s ease-out;
}

.ims-logo-large {
    width: 140px;
    height: 140px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ims-logo-large img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ims-brand-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--royal-blue);
    margin-bottom: 0.5rem;
    font-style: normal;
}

.ims-brand-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.ims-brand-dept {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
}

.ims-stages-section {
    margin-top: 1.5rem;
}

.ims-stages-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--royal-blue);
    text-align: center;
    margin-bottom: 1.5rem;
}

.ims-pipeline {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
}

.ims-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 180px;
    padding: 0 0.75rem;
}

.ims-stage-number {
    width: 32px;
    height: 32px;
    background: var(--gold-primary);
    color: #1a1a1a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.ims-stage-icon {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.ims-stage-icon.flat-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
}

.ims-stage-icon.flat-icon svg {
    width: 100%;
    height: 100%;
}

.ims-stage-icon.flat-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: invert(0.6);
}

[data-theme="dark"] .ims-stage-icon.flat-icon img {
    filter: invert(0.85);
}

.ims-stage-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.ims-stage-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.ims-stage-connector {
    display: flex;
    align-items: center;
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.ims-stage-connector::before {
    content: '';
    width: 40px;
    height: 2px;
    background: var(--border-color);
}

.ims-stage-connector::after {
    content: '▶';
    font-size: 0.625rem;
    margin-inline-start: -2px;
}

[dir="rtl"] .ims-stage-connector::after {
    content: '◀';
}

.ims-right-section {
    width: 560px;
    min-width: 480px;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    padding-top: 6rem;
    position: relative;
}

.ims-login-panel {
    width: 100%;
    max-width: 420px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow-2);
    animation: slideIn 0.5s ease-out;
    position: relative;
}

.ims-court-logo {
    margin-bottom: 1rem;
}

.court-icon {
    font-size: 3rem;
}

.ims-lock-icon {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.25rem;
    opacity: 0.6;
}

.ims-access-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.ims-access-subtitle {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.ims-login-panel .btn-primary {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.ims-access-notice {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
}

@media (max-width: 900px) {
    .landing-page.ims-split {
        flex-direction: column;
    }
    
    html[dir="rtl"] .landing-page.ims-split {
        flex-direction: column;
    }
    
    .ims-left-section {
        padding: 3rem 1.5rem 2rem;
    }
    
    .ims-logo-large {
        width: 100px;
        height: 100px;
        margin-bottom: 1rem;
    }
    
    .ims-logo-large img {
        width: 70px;
        height: 70px;
    }
    
    .ims-brand-title {
        font-size: 1.375rem;
    }
    
    .ims-brand-dept {
        margin-bottom: 1.5rem;
    }
    
    .ims-pipeline {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    
    .ims-stage {
        max-width: 100%;
        flex-direction: row;
        text-align: start;
        gap: 1rem;
        padding: 0.5rem 0;
    }
    
    .ims-stage-number {
        margin-bottom: 0;
        flex-shrink: 0;
    }
    
    .ims-stage-icon {
        display: none;
    }
    
    .ims-stage-connector {
        display: none;
    }
    
    .ims-brand-title {
        font-size: 1.5rem;
    }
    
    .ims-right-section {
        width: 100%;
        min-width: unset;
        padding: 2rem 1rem 3rem;
    }
}

/* Mobile branding elements - hidden on desktop */
.mobile-branding-text,
.mobile-logo-header {
    display: none;
}

@media (max-width: 480px) {
    .landing-controls {
        top: 0.75rem;
        right: 0.75rem;
    }
    
    .ims-login-panel {
        padding: 1.5rem;
    }
    
    .ims-branding {
        display: none;
    }
    
    /* Hide original header logo on mobile, show mobile version */
    .landing-logo-right {
        display: none;
    }
    
    .mobile-logo-header {
        display: block;
        width: 56px;
        height: 56px;
        margin-inline-start: auto;
    }
    
    .mobile-logo-header img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }
    
    .landing-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.75rem 1rem;
    }
    
    .mobile-branding-text {
        display: block;
        text-align: center;
        padding: 0.75rem 1rem 0.5rem;
        margin-top: 3.5rem;
    }
    
    .mobile-brand-title {
        font-size: 1.375rem;
        font-weight: 700;
        color: var(--gold-primary);
        margin: 0 0 0.25rem 0;
        font-family: var(--font-heading-ar);
    }
    
    .mobile-brand-subtitle {
        font-size: 0.75rem;
        color: var(--text-primary);
        margin: 0 0 0.125rem 0;
        font-weight: 500;
    }
    
    .mobile-brand-slogan {
        font-size: 0.6875rem;
        color: var(--text-secondary);
        margin: 0;
    }
    
    .ims-left-section {
        display: none;
    }
}

.landing-hero {
    padding: 4rem 2rem;
    text-align: center;
}

.hero-content {
    max-width: 600px;
    margin: 0 auto 4rem;
}

.hero-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.hero-content h1 {
    font-size: 1.375rem;
    color: var(--navy-primary);
    margin-bottom: 0.5rem;
}

[data-theme="dark"] .hero-content h1 {
    color: #ffffff;
}

.hero-tagline {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.hero-desc {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.hero-transition {
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-align: center;
    margin: 3rem auto 2rem;
    padding: 1rem 2rem;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    max-width: 600px;
    font-style: italic;
}

.pipeline-section {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
}

.pipeline-section h2 {
    color: var(--gold-primary);
    margin-bottom: 2rem;
    text-align: center;
    font-size: 1.125rem;
}

.pipeline-container {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    position: relative;
}

.pipeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    max-width: 280px;
    padding: 1.5rem 1rem;
    position: relative;
    transition: transform 0.2s ease;
}

.pipeline-step:hover {
    transform: translateY(-3px);
}

.step-number {
    width: 36px;
    height: 36px;
    background: var(--royal-blue);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    position: relative;
    z-index: 2;
}

.step-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.step-content h3 {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.step-content p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
}

.pipeline-connector {
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, var(--border-color), var(--royal-blue), var(--border-color));
    margin-top: 52px;
    flex-shrink: 0;
    position: relative;
}

.pipeline-connector::after {
    content: '▶';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--royal-blue);
    font-size: 0.6rem;
}

[dir="rtl"] .pipeline-connector::after {
    content: '◀';
    right: auto;
    left: -8px;
}

[dir="rtl"] .pipeline-container {
    flex-direction: row-reverse;
}

.home-page {
    min-height: 100vh;
}

.home-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 70px);
    padding: 2rem;
    text-align: center;
}

.welcome-section h1 {
    font-size: 1.375rem;
    color: var(--gold-primary);
    margin-bottom: 1rem;
}

.welcome-section p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.features-row {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 3rem;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.feature-item .feature-icon {
    font-size: 1.5rem;
}

.app-container {
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

html.chat-page .app-container {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--vv-top, 0px);
    height: var(--vvh, 100dvh);
    will-change: height;
}

.sidebar {
    width: 280px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-inline-end: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.sidebar-header {
    text-align: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.sidebar-logo-img {
    height: 32px;
    width: auto;
    margin-bottom: 0.25rem;
}

.sidebar-meezan-logo {
    height: auto;
    width: 75%;
    max-width: 170px;
    border-radius: 0;
    display: block;
    margin: 0 auto;
}

.logo {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.tagline {
    font-size: 0.85rem;
    color: var(--text-muted);
}

[data-theme="dark"] .sidebar-logo-img {
    filter: brightness(0) invert(1);
}

.new-chat-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--brand-primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    transition: background 0.3s, transform 0.2s, box-shadow 0.2s;
}

.new-chat-btn:hover {
    background: var(--brand-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-2);
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 0.25rem;
    transition: background-color 0.2s, border-color 0.2s;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.conversation-item-content {
    flex: 1;
    min-width: 0;
}

.conversation-item:hover {
    background-color: rgba(75, 114, 166, 0.08);
    border-color: rgba(75, 114, 166, 0.1);
}

.conversation-item.active {
    background-color: rgba(75, 114, 166, 0.12);
    border-inline-start: 3px solid var(--primary);
}

.conv-delete-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s, background-color 0.2s;
    flex-shrink: 0;
}

.conversation-item:hover .conv-delete-btn {
    opacity: 1;
}

.conv-delete-btn:hover {
    color: #ef4444;
    background-color: rgba(239, 68, 68, 0.15);
}

.conversation-title {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.conversation-date {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.user-avatar-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.user-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.sidebar-actions {
    display: flex;
    gap: 0.5rem;
}

.sidebar-btn {
    background: rgba(75, 114, 166, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    font-size: 1rem;
    position: relative;
    color: var(--text-primary);
}

.sidebar-btn:hover {
    background: rgba(75, 114, 166, 0.15);
}

.lang-select-small {
    padding: 0.4rem;
    font-size: 0.75rem;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
    min-height: 0;
    overflow: hidden;
}

.chat-header {
    padding: 1rem 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: relative;
    z-index: 100;
}

.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--text-primary);
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }
}

.chat-header h2 {
    font-size: 1.125rem;
    color: var(--text-primary);
}

.header-spacer {
    flex: 1;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-user-name {
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm, 6px);
    background: transparent;
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    transition: color 0.2s ease, background 0.2s ease;
}

.header-btn svg {
    stroke: currentColor;
}

.header-btn:hover {
    color: var(--text-primary);
    background: rgba(75, 114, 166, 0.1);
}

.notification-badge-header {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--error-color, var(--error));
    color: #ffffff;
    font-size: 0.625rem;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.lang-dropdown {
    position: relative;
}

.lang-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
    z-index: 9999;
    min-width: 200px;
    overflow: hidden;
    padding: 6px;
}

[data-theme="dark"] .lang-dropdown-menu {
    background: #1A1A1A;
    box-shadow: 0 12px 32px rgba(0,0,0,0.5);
}

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

.lang-dropdown-menu.show {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.lang-dropdown-header {
    padding: 8px 12px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    font-size: 0.875rem;
    font-weight: 400;
    text-align: left;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.lang-option:hover {
    background: var(--bg-tertiary);
}

.lang-option.active {
    background: rgba(231,111,81,0.08);
    color: var(--brand-primary);
    font-weight: 500;
}

[data-theme="dark"] .lang-option.active {
    background: rgba(75, 114, 166, 0.12);
}

.lang-option-check {
    width: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    flex-shrink: 0;
}

.lang-option.active .lang-option-check {
    opacity: 1;
    color: var(--brand-primary);
}

.lang-option-code {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    min-width: 32px;
    text-align: center;
    flex-shrink: 0;
}

[data-theme="dark"] .lang-option-code {
    background: rgba(255,255,255,0.08);
}

.lang-option-name {
    flex: 1;
}

.lang-chevron {
    opacity: 0.6;
    margin-left: 2px;
    flex-shrink: 0;
}

[dir="rtl"] .lang-chevron {
    margin-left: 0;
    margin-right: 2px;
}

[dir="rtl"] .lang-option {
    text-align: right;
    flex-direction: row-reverse;
}

.auth-page-controls {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 100;
}

[dir="rtl"] .auth-page-controls {
    right: auto;
    left: 1rem;
}

.auth-page-controls .header-btn {
    background: var(--card-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-1);
}

.auth-page-controls .header-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.theme-icon-dark,
.theme-icon-light {
    display: none;
}

[data-theme="light"] .theme-icon-light,
:root:not([data-theme]) .theme-icon-light {
    display: block;
}

[data-theme="light"] .theme-icon-dark,
:root:not([data-theme]) .theme-icon-dark {
    display: none;
}

[data-theme="dark"] .theme-icon-dark {
    display: block;
}

[data-theme="dark"] .theme-icon-light {
    display: none;
}

.theme-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-btn .sun-icon {
    display: block;
}

.theme-btn .moon-icon {
    display: none;
}

[data-theme="dark"] .theme-btn .sun-icon {
    display: none;
}

[data-theme="dark"] .theme-btn .moon-icon {
    display: block;
}

[data-theme="dark"] .auth-topbar {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--glass-border);
}

[data-theme="dark"] .auth-topbar .header-btn {
    background: var(--bg-secondary);
    border-color: var(--border-light);
    color: var(--text-primary);
}

[data-theme="dark"] .auth-topbar .header-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    color: var(--primary);
}

[data-theme="dark"] .auth-topbar .lang-code {
    color: var(--text-primary);
}

[data-theme="dark"] .auth-topbar .lang-chevron {
    color: var(--text-primary);
    opacity: 0.8;
}

.theme-logo {
    filter: brightness(0) saturate(100%) invert(18%) sepia(30%) saturate(1800%) hue-rotate(190deg) brightness(90%) contrast(95%);
}

[data-theme="dark"] .theme-logo {
    filter: brightness(0) invert(1);
}

[data-theme="dark"] .auth-container {
    background: var(--bg-primary);
}

[data-theme="dark"] .auth-card {
    background: var(--bg-secondary);
    box-shadow: var(--shadow-lg);
}

[data-theme="dark"] .auth-header h1 {
    color: var(--text-primary);
}

[data-theme="dark"] .auth-header p {
    color: var(--text-tertiary);
}

[data-theme="dark"] .auth-form-container h2 {
    color: var(--text-primary);
}

[data-theme="dark"] .auth-subtitle {
    color: var(--text-secondary);
}

[data-theme="dark"] .auth-success {
    background: rgba(5, 150, 105, 0.15);
    border-color: var(--success);
    color: #4ade80;
}

[data-theme="dark"] .btn-social {
    background: var(--input-bg);
    border-color: var(--border-light);
    color: var(--text-primary);
}

[data-theme="dark"] .btn-social:hover {
    background: var(--bg-secondary);
    border-color: var(--border-medium);
}

[data-theme="dark"] .auth-divider {
    color: var(--text-muted);
}

[data-theme="dark"] .auth-divider::before,
[data-theme="dark"] .auth-divider::after {
    background: var(--border-light);
}

[data-theme="dark"] .form-group label {
    color: var(--text-tertiary);
}

[data-theme="dark"] .form-group input {
    background: var(--input-bg);
    border-color: var(--border-light);
    color: var(--text-primary);
}

[data-theme="dark"] .form-group input::placeholder {
    color: var(--text-muted);
}

[data-theme="dark"] .form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(75, 114, 166, 0.2);
}

[data-theme="dark"] .btn-signin {
    background: var(--primary);
    color: #ffffff;
}

[data-theme="dark"] .btn-signin:hover {
    background: var(--primary-dark);
}

[data-theme="dark"] .forgot-link {
    color: var(--primary);
}

[data-theme="dark"] .auth-switch {
    color: var(--text-tertiary);
}

[data-theme="dark"] .auth-switch a {
    color: var(--primary);
}

[data-theme="dark"] .auth-terms {
    color: var(--text-muted);
}

[data-theme="dark"] .auth-terms a {
    color: var(--primary);
}

[data-theme="dark"] .auth-error {
    background: rgba(240, 122, 122, 0.1);
    border-color: #F07A7A;
    color: #F07A7A;
}

[data-theme="dark"] .password-toggle {
    color: var(--text-muted);
}

[data-theme="dark"] .password-toggle:hover {
    color: var(--text-primary);
}

[data-theme="dark"] .auth-logo-img {
    filter: brightness(1.2);
}

[data-theme="dark"] .sidebar {
    background: var(--glass-bg);
    border-color: var(--glass-border);
}

[data-theme="dark"] .sidebar-header {
    border-bottom-color: var(--glass-border);
}

[data-theme="dark"] .chat-header {
    background: rgba(18, 18, 22, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .conversation-item:hover {
    background-color: rgba(75, 114, 166, 0.08);
    border-color: rgba(75, 114, 166, 0.15);
}

[data-theme="dark"] .conversation-item.active {
    background-color: rgba(75, 114, 166, 0.12);
    border-inline-start-color: var(--primary);
}

[data-theme="dark"] .global-footer {
    background: var(--bg-primary);
    border-top-color: var(--bg-secondary);
}

[data-theme="dark"] .footer-link {
    color: var(--text-muted);
}

[data-theme="dark"] .footer-link:hover {
    color: var(--text-primary);
}

[data-theme="dark"] .footer-separator {
    color: var(--border-medium);
}

[data-theme="dark"] .footer-copyright {
    color: var(--text-muted);
}

[data-theme="dark"] .footer-gdpr {
    color: var(--text-muted);
    border-top-color: var(--bg-secondary);
}

[data-theme="dark"] .welcome-scales-icon {
    filter: brightness(1.3);
}

[data-theme="dark"] .signin-icon {
    filter: brightness(1.3);
}

.messages-container {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1.5rem;
    min-height: 0;
}

.chat-welcome-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: auto;
    min-height: 0;
    flex: 1;
    text-align: center;
    padding: 2rem 1rem;
    opacity: 0.9;
}

.chat-welcome-logo {
    width: 200px;
    max-width: 40vw;
    height: auto;
    margin-bottom: 1rem;
}

.chat-welcome-tagline {
    font-family: 'Cairo', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-gold);
    direction: rtl;
    line-height: 1.7;
    max-width: 600px;
}

@media (max-width: 480px) {
    .chat-welcome-logo {
        width: 200px;
    }
    .chat-welcome-tagline {
        font-size: 1.3rem;
    }
}

.welcome-message {
    text-align: center;
    padding: 3rem 1rem;
}

.welcome-message.welcome-compact {
    padding: 1.5rem 1rem;
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.welcome-message h2 {
    font-size: 1.125rem;
    color: var(--gold-primary);
    margin-bottom: 0.5rem;
}

.welcome-message p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.features {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.welcome-scales-icon {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.welcome-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--royal-blue);
    margin-bottom: 0.5rem;
}

.welcome-stages-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gold-primary);
    margin: 1.5rem 0 1rem;
}

.welcome-pipeline {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    direction: rtl;
}

.welcome-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    max-width: 140px;
}

.welcome-stage-number {
    position: absolute;
    top: -8px;
    inset-inline-end: -5px;
    width: 24px;
    height: 24px;
    background: var(--gold-primary);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.welcome-stage-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.welcome-stage-icon img,
.welcome-stage-icon .stage-icon-svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    color: var(--text-secondary);
}

.stage-icon-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.welcome-stage-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.welcome-stage-connector {
    width: 30px;
    height: 2px;
    background: var(--border-color);
    margin-top: 24px;
    position: relative;
}

.welcome-stage-connector::after {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-inline-end-color: var(--border-color);
}

/* Mobile: Make stages smaller to fit in one line */
@media (max-width: 480px) {
    .welcome-pipeline {
        flex-wrap: nowrap;
        gap: 0.25rem;
        justify-content: space-between;
        padding: 0 0.5rem;
    }
    
    .welcome-stage {
        max-width: 70px;
        min-width: 60px;
    }
    
    .welcome-stage-icon {
        width: 32px;
        height: 32px;
        margin-bottom: 0.25rem;
    }
    
    .welcome-stage-number {
        width: 18px;
        height: 18px;
        font-size: 0.65rem;
        top: -5px;
        inset-inline-end: -3px;
    }
    
    .welcome-stage-title {
        font-size: 0.55rem;
        line-height: 1.2;
    }
    
    .welcome-stage-connector {
        width: 15px;
        margin-top: 16px;
    }
    
    .welcome-stage-connector::after {
        border-width: 3px;
    }
}

/* New chat floating button */
.support-chat-fab {
    position: fixed;
    bottom: 24px;
    inset-inline-end: 24px;
    height: 48px;
    padding: 0 16px 0 10px;
    border-radius: 24px;
    background: var(--header-bg);
    color: white;
    border: 2px solid var(--cta-primary);
    cursor: grab;
    box-shadow: var(--shadow-2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    transition: box-shadow 0.3s ease, background 0.3s ease, border-color 0.3s ease;
    z-index: 1000;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
.support-chat-fab.dragging { cursor: grabbing; transition: none; }
.support-chat-fab:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.support-chat-fab .support-fab-content {
    display: flex;
    align-items: center;
    gap: 7px;
    pointer-events: none;
}
.support-chat-fab .support-fab-label {
    font-family: 'Roboto', 'Tajawal', sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: white;
    pointer-events: none;
}
[dir="rtl"] .support-chat-fab .support-fab-label,
[lang="ar"] .support-chat-fab .support-fab-label {
    font-family: 'Tajawal', 'Roboto', sans-serif;
}
.support-chat-fab .support-fab-icon { border-radius: 50%; object-fit: cover; pointer-events: none; }
.support-chat-fab .support-fab-close { display: none; }
.support-chat-fab.open .support-fab-content { display: none; }
.support-chat-fab.open .support-fab-close { display: block; }
.support-chat-fab.open {
    display: none;
}

.support-chat-overlay {
    position: fixed;
    bottom: 88px;
    inset-inline-end: 24px;
    width: 380px;
    max-height: 520px;
    z-index: 999;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.support-chat-overlay.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.support-chat-panel {
    position: relative;
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    max-height: 520px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    font-family: 'Roboto', 'Tajawal', sans-serif;
}
[data-theme="dark"] .support-chat-panel {
    background: #1A1A1A;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
    border-color: rgba(255, 255, 255, 0.1);
}
[dir="rtl"] .support-chat-panel,
[lang="ar"] .support-chat-panel {
    font-family: 'Tajawal', 'Roboto', sans-serif;
}

.support-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #4B72A6;
    color: white;
    border-radius: 16px 16px 0 0;
}
[data-theme="dark"] .support-chat-header {
    background: #2A2A2A;
}
.support-chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.support-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.support-chat-avatar img {
    border-radius: 50%;
    object-fit: cover;
}
.support-chat-title {
    font-weight: 600;
    font-size: 14px;
}
.support-chat-status {
    font-size: 11px;
    opacity: 0.85;
}
.support-chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    opacity: 0.8;
    padding: 4px;
    border-radius: 50%;
    transition: opacity 0.2s;
}
.support-chat-close:hover { opacity: 1; background: rgba(255,255,255,0.15); }

.support-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    min-height: 280px;
    max-height: 340px;
    scroll-behavior: smooth;
    background: #F8FAFC;
}
[data-theme="dark"] .support-chat-body {
    background: #141414;
}

.support-choice-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px 16px;
    height: 100%;
}
.support-choice-icon {
    color: var(--cta-primary);
    margin-bottom: 12px;
}
.support-choice-screen h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: var(--text-primary);
}
.support-choice-screen p {
    margin: 0 0 20px 0;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.support-choice-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}
.support-choice-btn {
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.support-choice-btn:hover {
    background: var(--bg-tertiary);
}
.support-choice-btn.primary {
    background: var(--cta-primary);
    color: white;
    border-color: transparent;
}
.support-choice-btn.primary:hover {
    filter: brightness(1.1);
}

.support-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.support-msg {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    animation: supportMsgIn 0.3s ease;
}
@keyframes supportMsgIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.support-msg.user {
    flex-direction: row-reverse;
}
.support-msg-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.support-msg-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
.support-msg-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    max-width: 75%;
    word-wrap: break-word;
}
.support-msg.bot .support-msg-bubble {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-end-start-radius: 4px;
}
.support-msg.user .support-msg-bubble {
    background: var(--cta-primary);
    color: white;
    border-end-end-radius: 4px;
}

.support-msg-bubble.typing {
    display: flex;
    gap: 4px;
    padding: 12px 18px;
}
.support-msg-bubble.typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: supportTyping 1.4s infinite;
}
.support-msg-bubble.typing span:nth-child(2) { animation-delay: 0.2s; }
.support-msg-bubble.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes supportTyping {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1); }
}

.support-feedback-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    border-radius: 16px;
    overflow: hidden;
}
.support-feedback-modal {
    background: #FFFFFF;
    border-radius: 16px 16px 0 0;
    padding: 24px 20px 20px;
    width: 100%;
    max-height: 85%;
    overflow-y: auto;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
    animation: feedbackSlideUp 0.3s ease;
}
[data-theme="dark"] .support-feedback-modal {
    background: #1A1A1A;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
}
@keyframes feedbackSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.support-feedback-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.support-feedback-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}
.support-feedback-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
}
.support-feedback-close:hover {
    background: var(--bg-tertiary);
}
.support-feedback-subtitle {
    margin: 0 0 16px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.support-feedback-ratings {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    justify-content: center;
}
.support-feedback-rating-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 8px;
    border-radius: 12px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    min-width: 0;
}
.support-feedback-rating-btn span {
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.support-feedback-rating-btn:hover {
    border-color: #e67e22;
    background: rgba(230, 126, 34, 0.06);
    color: #e67e22;
}
.support-feedback-rating-btn.selected {
    border-color: #e67e22;
    background: rgba(230, 126, 34, 0.1);
    color: #e67e22;
    box-shadow: 0 0 0 1px #e67e22;
}
.support-feedback-textarea {
    width: 100%;
    padding: 12px;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    resize: none;
    margin-bottom: 16px;
    font-family: inherit;
    box-sizing: border-box;
}
.support-feedback-textarea::placeholder {
    color: var(--text-secondary);
}
.support-feedback-textarea:focus {
    outline: none;
    border-color: #e67e22;
}
.support-feedback-actions {
    display: flex;
    gap: 12px;
}
.support-feedback-skip-btn {
    flex: 0.6;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1.5px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.support-feedback-skip-btn:hover {
    background: var(--bg-tertiary);
}
.support-feedback-submit-btn {
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    border: none;
    background: #e67e22;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.support-feedback-submit-btn:hover {
    background: #d35400;
}
.support-feedback-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.support-chat-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: #FFFFFF;
}
[data-theme="dark"] .support-chat-footer {
    background: #1A1A1A;
}
.support-input-area {
    display: flex;
    gap: 8px;
    align-items: center;
}
.support-input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 20px;
    border: 1px solid #E2E8F0;
    background: #F1F5F9;
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
    min-width: 0;
}
[data-theme="dark"] .support-input {
    background: #222222;
    border-color: rgba(255, 255, 255, 0.12);
}
.support-input:focus {
    border-color: var(--cta-primary);
}
.support-input::placeholder {
    color: var(--text-muted);
}
.support-attach-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: none;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
}
.support-attach-btn:hover {
    color: var(--cta-primary);
}
.support-uploaded-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0;
}
.support-uploaded-preview:empty {
    display: none;
}
.support-uploaded-file {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--text-secondary);
}
.support-uploaded-file .remove-file {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
    line-height: 1;
}
.support-file-thumb {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: cover;
}
.support-chat-image {
    display: block;
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    margin-top: 6px;
    cursor: pointer;
    object-fit: contain;
}
.support-chat-image:hover {
    opacity: 0.85;
}
.support-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cta-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.support-send-btn:hover {
    filter: brightness(1.1);
    transform: scale(1.05);
}
.support-end-btn {
    width: auto;
    margin: 10px auto 0;
    padding: 8px 24px;
    border-radius: 20px;
    border: 1.5px solid #e67e22;
    background: transparent;
    color: #e67e22;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.support-end-btn:hover {
    background: #e67e22;
    color: white;
    border-color: #e67e22;
}

@media (max-width: 480px) {
    .support-chat-overlay {
        inset-inline-end: 0;
        bottom: 0;
        width: 100%;
        max-height: 100dvh;
        border-radius: 0;
    }
    .support-chat-panel {
        border-radius: 0;
        max-height: 100dvh;
        height: 100dvh;
    }
    .support-chat-header {
        border-radius: 0;
    }
    .support-chat-body {
        max-height: calc(100dvh - 130px);
        min-height: 0;
        flex: 1;
    }
    .support-chat-fab {
        display: none !important;
    }
    .support-chat-fab.open {
        display: none !important;
    }
}

.message {
    margin-bottom: 1.5rem;
    max-width: 85%;
}

.message.user {
    margin-inline-start: auto;
    margin-inline-end: 0;
}

.message.assistant {
    margin-inline-end: auto;
    margin-inline-start: 0;
    max-width: 100%;
}

.message-content {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    line-height: 1.7;
}

.message.user .message-content {
    background-color: var(--cta-primary, var(--royal-blue));
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

[dir="rtl"] .message.user .message-content {
    border-bottom-right-radius: 12px;
    border-bottom-left-radius: 4px;
}

.message.assistant .message-content {
    background-color: var(--card-bg);
    border: 1px solid var(--ai-accent, var(--teal-primary));
    border-left: 3px solid var(--ai-accent, var(--teal-primary));
    border-bottom-left-radius: 4px;
}

[dir="rtl"] .message.assistant .message-content {
    border-left: 1px solid var(--ai-accent, var(--teal-primary));
    border-right: 3px solid var(--ai-accent, var(--teal-primary));
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 4px;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.view-stages-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1.5px solid var(--error);
    color: var(--error);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.view-stages-btn:hover {
    background-color: var(--error);
    color: #ffffff;
}

.send-email-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1.5px solid var(--teal-primary);
    color: var(--teal-primary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.send-email-btn:hover {
    background-color: var(--teal-primary);
    color: #ffffff;
}

.send-email-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.send-email-btn.email-sent {
    background-color: var(--success);
    border-color: var(--success);
    color: #ffffff;
}

.send-email-btn svg {
    flex-shrink: 0;
}

.send-email-btn .loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(13, 148, 136, 0.3);
    border-top-color: var(--teal-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.analysis-card {
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
}

.analysis-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--surface-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 2;
}

.analysis-card-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.analysis-card-title-row svg {
    color: var(--royal-blue);
    flex-shrink: 0;
}

.analysis-card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-heading);
}

.analysis-card-badge {
    font-size: 0.72rem;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--royal-blue);
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.analysis-toc {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-bg);
}

.analysis-toc-title {
    display: none;
}

.analysis-toc-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: transparent;
    cursor: pointer;
    font-size: 0.72rem;
    color: var(--text-secondary);
    transition: all 0.2s;
    font-family: var(--font-body);
}

.analysis-toc-item:hover {
    background: var(--royal-blue);
    color: #fff;
    border-color: var(--royal-blue);
}

.analysis-toc-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.analysis-toc-label {
    white-space: nowrap;
}

.analysis-sections-container {
    padding: 6px 0;
}

.analysis-section {
    border-bottom: 1px solid var(--border-color);
}

.analysis-section:last-child {
    border-bottom: none;
}

.analysis-section-final {
    border: 3px solid #DC2626;
    border-radius: 12px;
    margin: 12px 10px 6px 10px;
    background: linear-gradient(135deg, rgba(153, 27, 27, 0.04) 0%, rgba(153, 27, 27, 0.08) 100%);
    position: relative;
    box-shadow: 0 2px 12px rgba(153, 27, 27, 0.12);
}

.analysis-section-final::before {
    content: '⚖️';
    position: absolute;
    top: -12px;
    inset-inline-start: 16px;
    background: #991B1B;
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 10px;
    border-radius: 10px;
    z-index: 1;
    line-height: 1.4;
}

.analysis-section-final .analysis-section-header {
    background: rgba(153, 27, 27, 0.06);
    border-radius: 10px 10px 0 0;
    padding-top: 16px;
}

.analysis-section-final .analysis-section-title {
    color: #111111;
    font-weight: 700;
    font-size: 0.95rem;
}

.analysis-section-final .analysis-section-number {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
    box-shadow: 0 0 0 3px rgba(153, 27, 27, 0.25);
    background: #991B1B !important;
}

.analysis-section-final .analysis-section-body {
    border-top: 1px dashed rgba(153, 27, 27, 0.2);
}

.analysis-section-final .analysis-section-content {
    font-weight: 500;
}

[data-theme="dark"] .analysis-section-final {
    border-color: #DC2626;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.06) 0%, rgba(220, 38, 38, 0.12) 100%);
    box-shadow: 0 2px 12px rgba(220, 38, 38, 0.15);
}

[data-theme="dark"] .analysis-section-final::before {
    background: #DC2626;
}

[data-theme="dark"] .analysis-section-final .analysis-section-header {
    background: rgba(220, 38, 38, 0.08);
}

[data-theme="dark"] .analysis-section-final .analysis-section-title {
    color: #F5F5F5;
}

[data-theme="dark"] .analysis-section-final .analysis-section-number {
    background: #DC2626 !important;
}

.analysis-toc-item-final {
    background: rgba(153, 27, 27, 0.08) !important;
    border-color: #991B1B !important;
}

.analysis-toc-item-final .analysis-toc-label {
    font-weight: 700;
    color: #991B1B;
}

.analysis-toc-item-final:hover {
    background: #991B1B !important;
    color: #fff !important;
    border-color: #991B1B !important;
}

.analysis-conclusion {
    border: 2px solid #991B1B;
    border-radius: 12px;
    margin: 12px 10px;
    background: linear-gradient(135deg, rgba(153, 27, 27, 0.04) 0%, rgba(153, 27, 27, 0.10) 100%);
    position: relative;
    box-shadow: 0 2px 16px rgba(153, 27, 27, 0.12);
    overflow: hidden;
}

.analysis-conclusion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    background: rgba(153, 27, 27, 0.06);
    border-bottom: 1px solid rgba(153, 27, 27, 0.15);
}

.analysis-conclusion-badge {
    background: #991B1B !important;
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
    box-shadow: 0 0 0 3px rgba(153, 27, 27, 0.25);
}

.analysis-conclusion-body {
    padding: 14px 16px;
}

.analysis-conclusion-body .analysis-section-content {
    font-weight: 500;
    line-height: 1.75;
}

[data-theme="dark"] .analysis-conclusion {
    border-color: #DC2626;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.06) 0%, rgba(220, 38, 38, 0.14) 100%);
    box-shadow: 0 2px 16px rgba(220, 38, 38, 0.15);
}

[data-theme="dark"] .analysis-conclusion-header {
    background: rgba(220, 38, 38, 0.08);
    border-bottom-color: rgba(220, 38, 38, 0.2);
}

[data-theme="dark"] .analysis-conclusion-badge {
    background: #DC2626 !important;
}

details.analysis-details {
    margin: 8px 10px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

details.analysis-details > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: #555;
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid transparent;
    list-style: none;
    user-select: none;
    transition: background 0.2s, color 0.2s;
}

details.analysis-details > summary::-webkit-details-marker {
    display: none;
}

details.analysis-details > summary svg {
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

details.analysis-details[open] > summary svg {
    transform: rotate(180deg);
}

details.analysis-details > summary:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

details.analysis-details[open] > summary {
    border-bottom-color: rgba(0, 0, 0, 0.1);
    color: #333;
}

details.analysis-details .analysis-sections-container {
    padding: 0;
}

[data-theme="dark"] details.analysis-details {
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] details.analysis-details > summary {
    color: #aaa;
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] details.analysis-details > summary:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ddd;
}

[data-theme="dark"] details.analysis-details[open] > summary {
    border-bottom-color: rgba(255, 255, 255, 0.1);
    color: #ddd;
}

.analysis-toc-item-final:hover .analysis-toc-label {
    color: #fff !important;
}

[data-theme="dark"] .analysis-toc-item-final {
    background: rgba(220, 38, 38, 0.12) !important;
    border-color: #DC2626 !important;
}

[data-theme="dark"] .analysis-toc-item-final .analysis-toc-label {
    color: #FCA5A5;
}

[data-theme="dark"] .analysis-toc-item-final:hover {
    background: #DC2626 !important;
}

.analysis-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}

.analysis-section-header:hover {
    background: rgba(59, 130, 246, 0.04);
}

.analysis-section-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.analysis-section-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.analysis-section-number {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.68rem;
    font-weight: 700;
    background: var(--royal-blue);
    color: #fff;
    flex-shrink: 0;
}

.analysis-section-title {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-heading);
}

.analysis-section-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.analysis-copy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.analysis-copy-btn:hover {
    background: var(--royal-blue);
    color: #fff;
}

.analysis-copy-btn.copied {
    color: #10B981;
}

.analysis-section-chevron {
    display: flex;
    align-items: center;
    transition: transform 0.25s;
    color: var(--text-secondary);
}

.analysis-section-chevron.collapsed {
    transform: rotate(-90deg);
}

[dir="rtl"] .analysis-section-chevron.collapsed {
    transform: rotate(90deg);
}

.analysis-section-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 18px;
}

.analysis-section-body.expanded {
    max-height: 5000px;
    padding: 0 18px 16px;
}

.analysis-section-content {
    font-size: 0.88rem;
    line-height: 1.75;
    color: var(--text-primary);
    font-family: var(--font-body);
}

.analysis-section-content p {
    margin: 0 0 0.6em;
}

.analysis-section-content p:last-child {
    margin-bottom: 0;
}

.analysis-list {
    margin: 0.5em 0;
    padding: 0;
    list-style: none;
}

.analysis-list li {
    position: relative;
    padding: 0.3em 0 0.3em 1.3em;
    font-size: 0.86rem;
    line-height: 1.65;
}

[dir="rtl"] .analysis-list li {
    padding: 0.3em 1.3em 0.3em 0;
}

.analysis-list li::before {
    content: '';
    position: absolute;
    left: 0.2em;
    top: 0.8em;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--royal-blue);
}

[dir="rtl"] .analysis-list li::before {
    left: auto;
    right: 0.2em;
}

.analysis-legal-notice {
    margin: 8px 14px 6px;
    padding: 16px 18px;
    border: 2px solid #F59E0B;
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.06);
}

.analysis-legal-notice-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.analysis-legal-notice-header svg {
    flex-shrink: 0;
    color: #E97B00;
}

.analysis-legal-notice-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #E97B00;
}

.analysis-legal-notice-text {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.7;
    color: var(--text-primary);
}

[data-theme="dark"] .analysis-legal-notice {
    border-color: #D97706;
    background: rgba(217, 119, 6, 0.08);
}

[data-theme="dark"] .analysis-legal-notice-title {
    color: #FBBF24;
}

[data-theme="dark"] .analysis-legal-notice-header svg {
    color: #FBBF24;
}

[data-theme="dark"] .analysis-card {
    background: rgba(22, 24, 30, 0.95);
    border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .analysis-card-header {
    background: rgba(26, 28, 36, 0.95);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .analysis-card-title {
    color: #F0F4F8;
}

[data-theme="dark"] .analysis-toc {
    background: rgba(26, 28, 36, 0.9);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .analysis-toc-item {
    border-color: rgba(255, 255, 255, 0.12);
    color: #B0C0D0;
}

[data-theme="dark"] .analysis-section {
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .analysis-section-header:hover {
    background: rgba(255, 255, 255, 0.04);
}

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

[data-theme="dark"] .analysis-section-content {
    color: #D0DAE4;
}

[data-theme="dark"] .analysis-section-content p {
    color: #D0DAE4;
}

[data-theme="dark"] .analysis-section-chevron {
    color: #8899AA;
}

[data-theme="dark"] .analysis-copy-btn {
    color: #8899AA;
}

[data-theme="dark"] .analysis-copy-btn:hover {
    background: var(--royal-blue);
    color: #fff;
}

[data-theme="dark"] .analysis-list li {
    color: #D0DAE4;
}

[data-theme="dark"] .analysis-actions-bar {
    border-top-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .analysis-action-btn {
    border-color: rgba(255, 255, 255, 0.12);
    color: #B0C0D0;
}

[data-theme="dark"] .analysis-action-btn:hover {
    background: var(--royal-blue);
    color: #fff;
    border-color: var(--royal-blue);
}

[data-theme="dark"] .analysis-disclaimer {
    background: rgba(217, 119, 6, 0.06);
    border-top-color: rgba(255, 255, 255, 0.08);
    color: #A0B0C0;
}

[data-theme="dark"] .analysis-legal-notice-text {
    color: #D0DAE4;
}

[data-theme="dark"] .analysis-section-final .analysis-section-content,
[data-theme="dark"] .analysis-section-final .analysis-section-content p {
    color: #F0E0E0;
}

[data-theme="dark"] .analysis-conclusion-body .analysis-section-content,
[data-theme="dark"] .analysis-conclusion-body .analysis-section-content p {
    color: #F0E0E0;
}

[data-theme="dark"] .message.assistant .message-content {
    background-color: rgba(22, 24, 30, 0.9);
    border-color: rgba(123, 156, 198, 0.3);
}

.analysis-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 18px;
    margin: 0;
    font-size: 0.74rem;
    line-height: 1.5;
    color: var(--text-secondary);
    background: rgba(245, 158, 11, 0.06);
    border-top: 1px solid var(--border-color);
}

.analysis-disclaimer svg {
    flex-shrink: 0;
    margin-top: 1px;
    color: #F59E0B;
}

.analysis-actions-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px 14px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.analysis-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-body);
    white-space: nowrap;
}

.analysis-action-btn:hover {
    background: var(--royal-blue);
    color: #fff;
    border-color: var(--royal-blue);
}

.analysis-action-btn svg {
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .analysis-card-header {
        padding: 10px 14px;
    }
    .analysis-toc {
        padding: 8px 14px;
    }
    .analysis-section-header {
        padding: 10px 14px;
    }
    .analysis-section-body {
        padding: 0 14px;
    }
    .analysis-section-body.expanded {
        padding: 0 14px 12px;
    }
    .analysis-actions-bar {
        padding: 8px 14px;
    }
    .analysis-disclaimer {
        padding: 8px 14px;
    }
    .analysis-card-title {
        font-size: 0.95rem;
    }
    .analysis-section-title {
        font-size: 0.82rem;
    }
    .analysis-section-content {
        font-size: 0.82rem;
    }
    .analysis-action-btn {
        font-size: 0.72rem;
        padding: 5px 10px;
    }
    .analysis-toc-item {
        font-size: 0.68rem;
        padding: 3px 8px;
    }
}

.message-meta {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.intake-selectors {
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.intake-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.intake-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.intake-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.intake-required {
    color: var(--error, #D32F2F);
    font-weight: 700;
}

.intake-select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #E8E8E8;
    color: var(--text-primary);
    font-family: var(--font-input);
    font-size: 0.9375rem;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2350535A' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
    min-height: 44px;
    line-height: 1.4;
}

[dir="rtl"] .intake-select {
    background-position: left 0.5rem center;
    padding-right: 0.6rem;
    padding-left: 1.75rem;
}

[data-theme="dark"] .intake-select {
    background-color: #1A1A1A;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23B8BBC2' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.intake-select:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px rgba(231, 111, 81, 0.15);
}


#jurisdictionSelect {
    max-width: 100%;
}

#jurisdictionSelect optgroup {
    font-weight: 700;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    padding: 4px 0;
    font-style: normal;
}

#jurisdictionSelect option {
    font-weight: 400;
    padding: 6px 12px;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.jurisdiction-general-option {
    font-weight: 500 !important;
    color: var(--brand-primary) !important;
}

.jurisdiction-divider {
    font-size: 0.5rem !important;
    color: var(--text-muted) !important;
    pointer-events: none;
    height: 1px;
}

.intake-auto-detect {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--success, #198754);
    animation: fadeIn 0.3s ease;
}

.search-panel {
    background: var(--bg-secondary);
    border-radius: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    padding: 0.625rem;
    border: 1px solid var(--border-color);
}
[data-theme="dark"] .search-panel {
    background: rgba(30, 32, 40, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
}

.smart-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0;
    background: none !important;
    border: none !important;
    margin-bottom: 0.5rem;
}

.smart-chip-wrapper {
    position: relative;
}

.smart-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 50px;
    border: 1px solid transparent;
    background: #E0F2FE;
    color: #0369A1;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1.3;
}
.smart-chip:hover {
    background: #BAE6FD;
    border-color: #7DD3FC;
}
.smart-chip.active {
    background: #BAE6FD;
    border-color: #0EA5E9;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.15);
}
[data-theme="dark"] .smart-chip {
    background: rgba(14, 165, 233, 0.18);
    color: #93E0FF;
    border-color: rgba(14, 165, 233, 0.3);
}
[data-theme="dark"] .smart-chip:hover {
    background: rgba(14, 165, 233, 0.28);
    border-color: rgba(14, 165, 233, 0.45);
}
[data-theme="dark"] .smart-chip.active {
    background: rgba(14, 165, 233, 0.3);
    border-color: #38BDF8;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.18);
}

.smart-chip svg:first-child {
    opacity: 0.7;
    flex-shrink: 0;
}
.smart-chip-arrow {
    opacity: 0.5;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.smart-chip.active .smart-chip-arrow {
    transform: rotate(180deg);
}

.smart-chip-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 220px;
    background: var(--bg-secondary, #fff);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 6px;
    z-index: 200;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.06);
    animation: chipDropdownIn 0.15s ease-out;
}
[dir="rtl"] .smart-chip-dropdown {
    left: auto;
    right: 0;
}
[data-theme="dark"] .smart-chip-dropdown {
    background: #1E293B;
    border-color: #334155;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.smart-chip-dropdown.open {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

@keyframes chipDropdownIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes chipSheetUp {
    from { opacity: 0; transform: translateY(100%); }
    to { opacity: 1; transform: translateY(0); }
}

.smart-chip-option {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 400;
    cursor: pointer;
    border-radius: 8px;
    text-align: left;
    transition: background 0.15s ease;
}
[dir="rtl"] .smart-chip-option {
    text-align: right;
}
.smart-chip-option:hover {
    background: var(--bg-tertiary, #F0F1F3);
    color: var(--text-primary);
}
.smart-chip-option.selected {
    background: rgba(14, 165, 233, 0.08);
    color: #0369A1;
    font-weight: 600;
}
[data-theme="dark"] .smart-chip-option:hover {
    background: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .smart-chip-option.selected {
    background: rgba(14, 165, 233, 0.18);
    color: #93E0FF;
}

.smart-chip-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2px 8px;
}

html.chat-page .intake-field.is-locked .smart-chip { display: none; }
html.chat-page .intake-field.is-locked .smart-chip-dropdown { display: none !important; }

.smart-chip-backdrop {
    display: none;
}

.custom-select-sheet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.custom-select-sheet-overlay.show {
    display: block;
    opacity: 1;
}

.custom-select-sheet {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #F0F0F0;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.2);
    max-height: 70vh;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    overflow: hidden;
}

[data-theme="dark"] .custom-select-sheet {
    background: #1A1A1A;
}

.custom-select-sheet.show {
    display: flex;
    flex-direction: column;
    transform: translateY(0);
}

.custom-select-sheet-handle {
    display: flex;
    justify-content: center;
    padding: 10px 0 6px;
    flex-shrink: 0;
}

.custom-select-sheet-handle::after {
    content: '';
    width: 36px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
}

.custom-select-sheet-title {
    padding: 4px 20px 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    text-align: center;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-color);
}

.custom-select-sheet-options {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px 8px 20px;
    overscroll-behavior: contain;
}

.custom-select-sheet-group {
    padding: 14px 14px 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.custom-select-sheet-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 400;
    text-align: start;
    border-radius: 12px;
    transition: background 0.15s ease;
    line-height: 1.4;
}

.custom-select-sheet-option:active {
    background: var(--bg-tertiary);
}

.custom-select-sheet-option.selected {
    background: rgba(231,111,81,0.08);
    color: var(--brand-primary);
    font-weight: 500;
}

[data-theme="dark"] .custom-select-sheet-option.selected {
    background: rgba(75, 114, 166, 0.12);
}

.custom-select-sheet-option .sheet-check {
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    flex-shrink: 0;
    color: var(--brand-primary);
}

.custom-select-sheet-option.selected .sheet-check {
    opacity: 1;
}

.custom-select-sheet-option.highlight {
    font-weight: 500;
    color: var(--brand-primary);
}

.custom-select-sheet-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 16px;
}

[data-theme="dark"] .custom-select-sheet {
    box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
}

@keyframes sheetSlideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.intake-note {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.analysis-context-header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--surface-tertiary, var(--surface-bg));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    align-items: center;
}

.context-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--input-bg);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.context-tag svg {
    color: var(--brand-primary);
    flex-shrink: 0;
}

.context-warning {
    width: 100%;
    font-size: 0.75rem;
    color: var(--warning, #D97706);
    margin-top: 0.25rem;
}

.input-area {
    padding: 0.75rem 1rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    border-top: none;
    overflow: visible;
    box-sizing: border-box;
    flex: 0 0 auto;
    z-index: 10;
    background: transparent;
}

.input-container {
    display: flex;
    gap: 0.5rem;
    background-color: transparent;
    border: none;
    border-radius: 0;
    padding: 0.25rem 0.25rem 0;
    align-items: flex-end;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

#questionInput {
    flex: 1 1 0%;
    min-width: 0;
    width: 0;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.4;
    font-weight: 400;
    padding: 0.5rem;
    resize: none;
    max-height: 150px;
    box-sizing: border-box;
}

#questionInput:focus {
    outline: none;
}

#questionInput::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 44px;
    min-width: 44px;
    height: 44px;
    flex-shrink: 0;
    background: #0D9488;
    border: none;
    border-radius: 12px;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, transform 0.2s;
}

.send-btn:hover:not(:disabled) {
    background: #0F766E;
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.attach-btn {
    width: 44px;
    height: 44px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

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

.uploaded-files-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.uploaded-files-preview:empty {
    display: none;
}

.file-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.file-tag .file-icon {
    font-size: 1rem;
}

.file-tag .file-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-tag .file-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
    margin-inline-start: 0.25rem;
    transition: color 0.2s;
}

.file-tag .file-remove:hover {
    color: var(--error);
}

.upload-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.25rem;
    display: none;
}

.attached-files-indicator {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    opacity: 0.85;
}

.disclaimer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Stages Modal Overlay */
.stages-panel {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.stages-panel.open {
    opacity: 1;
    visibility: visible;
}

.stages-panel-content {
    background-color: var(--bg-secondary);
    border-radius: 16px;
    width: 90%;
    max-width: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.stages-panel.open .stages-panel-content {
    transform: scale(1) translateY(0);
}

.stages-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
}

.stages-header h3 {
    color: var(--gold-primary);
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stages-header h3::before {
    content: "📊";
    font-size: 1.2rem;
}

.close-stages {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-stages:hover {
    background-color: var(--error);
    border-color: var(--error);
    color: #ffffff;
}

.stages-content {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.stage-item {
    background-color: var(--bg-tertiary);
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.stage-item:hover {
    border-color: var(--gold-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stage-item:last-child {
    margin-bottom: 0;
}

.stage-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border-bottom: 1px solid transparent;
    background: transparent;
    transition: background 0.2s;
}

.stage-item.expanded .stage-header {
    border-bottom-color: var(--border-color);
    background: rgba(230, 166, 74, 0.05);
}

.stage-name-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stage-name {
    font-weight: 600;
    font-size: 0.95rem;
}

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

.stage-number {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-primary) 0%, #d4943a 100%);
    color: #0f0f0f;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stage-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stage-status {
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
}

.stage-status.completed {
    background-color: rgba(76, 175, 80, 0.15);
    color: var(--success);
}

.stage-status.error {
    background-color: rgba(244, 67, 54, 0.15);
    color: var(--error);
}

.stage-expand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.stage-item.expanded .stage-expand-icon {
    transform: rotate(180deg);
}

.stage-body {
    padding: 1.25rem;
    font-size: 0.875rem;
    line-height: 1.8;
    display: none;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

.stage-item.expanded .stage-body {
    display: block;
}

.stage-body-content {
    font-family: inherit;
    color: var(--text-primary);
    text-align: start;
}

.stage-body-content p {
    margin: 0;
    line-height: 1.7;
}

.stage-bullet-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.stage-bullet-list li {
    position: relative;
    padding-inline-start: 1.5rem;
    margin-bottom: 0.75rem;
    line-height: 1.7;
}

.stage-bullet-list li:last-child {
    margin-bottom: 0;
}

.stage-bullet-list li::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0.6em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--gold-primary);
}

.stage-body[dir="rtl"] .stage-body-content {
    font-family: var(--font-body-ar);
    text-align: right;
}

.stage-body[dir="ltr"] .stage-body-content {
    font-family: var(--font-body-en);
    text-align: left;
}

.loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--gold-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Horizontal Progress Indicator */
.progress-indicator-horizontal {
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-tertiary) 100%);
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.progress-icon {
    font-size: 1.25rem;
}

.progress-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gold-primary);
}

.progress-timeline {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    overflow-x: auto;
    padding: 0.5rem 0;
}

.progress-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    min-width: 70px;
    flex: 1;
    max-width: 100px;
}

.progress-stage-node {
    position: relative;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.progress-stage-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
}

.progress-stage-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.progress-stage-icon .stage-icon-img,
.progress-stage-icon .stage-icon-svg {
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: grayscale(100%);
    transition: filter 0.3s ease;
    color: var(--text-muted);
}

.progress-stage-check {
    display: none;
    color: white;
}

.progress-stage-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gold-primary);
    opacity: 0;
    z-index: 1;
}

.progress-stage-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.5rem;
    transition: all 0.3s ease;
    line-height: 1.2;
    max-width: 80px;
}

/* Connector between stages */
.progress-connector {
    position: absolute;
    top: 24px;
    inset-inline-start: calc(50% + 24px);
    width: calc(100% - 48px);
    height: 3px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    z-index: 1;
}

.progress-connector-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* RTL support for progress timeline */
[dir="rtl"] .progress-timeline {
    direction: rtl;
}

[dir="rtl"] .progress-connector-fill {
    background: linear-gradient(270deg, var(--primary), var(--success));
}

/* Active State */
.progress-stage.active .progress-stage-circle {
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 4px rgba(230, 166, 74, 0.2);
    transform: scale(1.05);
}

.progress-stage.active .progress-stage-icon {
    opacity: 1;
}

.progress-stage.active .progress-stage-icon .stage-icon-img,
.progress-stage.active .progress-stage-icon .stage-icon-svg {
    filter: none;
    color: var(--gold-primary);
}

.progress-stage.active .progress-stage-label {
    color: var(--gold-primary);
    font-weight: 600;
}

.progress-stage.active .progress-stage-pulse {
    animation: pulse-ring 2s ease-out infinite;
}

@keyframes pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.4;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* Completed State */
.progress-stage.completed .progress-stage-circle {
    background: var(--success, #22c55e);
    border-color: var(--success, #22c55e);
    transform: scale(1);
}

.progress-stage.completed .progress-stage-icon {
    display: none;
}

.progress-stage.completed .progress-stage-check {
    display: flex;
}

.progress-stage.completed .progress-stage-label {
    color: var(--success, #22c55e);
    font-weight: 500;
}

.progress-stage.completed .progress-connector-fill {
    width: 100%;
}

/* Stage icon styling for view stages modal */
.stage-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stage-icon svg {
    width: 20px;
    height: 20px;
}

.stage-icon .stage-icon-img,
.stage-icon .stage-icon-svg {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .progress-timeline {
        gap: 0;
    }
    
    .progress-stage {
        min-width: 60px;
    }
    
    .progress-stage-node {
        width: 40px;
        height: 40px;
    }
    
    .progress-stage-circle {
        width: 36px;
        height: 36px;
    }
    
    .progress-stage-icon .stage-icon-img,
    .progress-stage-icon .stage-icon-svg {
        width: 18px;
        height: 18px;
    }
    
    .progress-connector {
        top: 20px;
        left: calc(50% + 18px);
        width: calc(100% - 36px);
    }
    
    .progress-stage-label {
        font-size: 0.65rem;
        max-width: 60px;
    }
}

.notifications-page {
    min-height: 100vh;
}

.notifications-logo-link {
    display: flex;
    align-items: center;
}

.notifications-logo-img {
    height: 28px;
    width: auto;
}

.notifications-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.notifications-header h1 {
    color: var(--gold-primary);
}

.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: background 0.2s;
}

.notification-item.unread {
    background: var(--bg-tertiary);
    border-color: var(--gold-primary);
}

.notification-icon {
    font-size: 1.5rem;
}

.notification-content {
    flex: 1;
}

.notification-content h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.notification-content p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.mark-read-btn {
    background: var(--gold-primary);
    color: #0f0f0f;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 0.9rem;
}

.no-notifications {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.no-notifications-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
}

.error-content h1 {
    font-size: 6rem;
    color: var(--gold-primary);
}

.error-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.pwa-install-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1rem;
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.pwa-install-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.pwa-icon {
    font-size: 2rem;
}

.pwa-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.pwa-text strong {
    color: var(--gold-primary);
}

.pwa-text span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.pwa-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

@media (min-width: 1200px) {
    .landing-hero {
        padding: 4rem;
    }
    
    .hero-content h1 {
        font-size: 1.375rem;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
}

@media (max-width: 768px) {
    .intake-row {
        grid-template-columns: 1fr 1fr;
    }
    
    .intake-row .intake-field:last-child {
        grid-column: 1 / -1;
    }
    
    .sidebar {
        position: fixed;
        inset-inline-start: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    [dir="rtl"] .sidebar {
        transform: translateX(100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
        display: none;
    }
    
    .sidebar-overlay.open {
        display: block;
    }
    
    .landing-nav, .home-nav {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .nav-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .logo-text {
        font-size: 1.25rem;
    }
    
    .landing-hero {
        padding: 2rem 1rem;
    }
    
    .hero-content {
        margin-bottom: 2rem;
    }
    
    .hero-content h1 {
        font-size: 1.375rem;
    }
    
    .hero-tagline {
        font-size: 1rem;
    }
    
    .hero-icon {
        font-size: 3.5rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .feature-card {
        padding: 1.25rem;
    }
    
    .welcome-section h1 {
        font-size: 1.375rem;
    }
    
    .features-row {
        flex-direction: column;
        gap: 1rem;
        margin-top: 2rem;
    }
    
    .chat-header {
        padding: 0.75rem 1rem;
    }
    
    .messages-container {
        padding: 1rem;
    }
    
    .input-area {
        padding: 0.5rem 0.75rem;
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 1.5rem));
    }
    
    .legal-notice-bar {
        display: none;
    }
    
    .upload-hint {
        display: none;
    }
    
    .intake-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .intake-selectors {
        padding: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .intake-row {
        grid-template-columns: 1fr;
    }
    
    .intake-select {
        font-size: 1rem;
        padding: 0.75rem 0.875rem;
        padding-right: 2.25rem;
        min-height: 48px;
        border-radius: 10px;
    }
    
    [dir="rtl"] .intake-select {
        padding-right: 0.875rem;
        padding-left: 2.25rem;
    }
    
    .intake-label {
        font-size: 0.875rem;
        margin-bottom: 2px;
    }

    .smart-chip-dropdown {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        min-width: 100% !important;
        border-radius: 16px 16px 0 0 !important;
        padding: 0.75rem !important;
        max-height: 50vh;
        overflow-y: auto;
        animation: chipSheetUp 0.2s ease-out !important;
        z-index: 10001 !important;
    }
    [dir="rtl"] .smart-chip-dropdown {
        left: 0 !important;
        right: 0 !important;
    }
    .smart-chip-dropdown.open {
        gap: 4px;
    }
    .smart-chip-option {
        padding: 14px 18px;
        font-size: 1rem;
        border-radius: 10px;
    }

    .smart-chip-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 10000;
    }
    .smart-chip-backdrop.show {
        display: block;
    }
    
    .intake-select:focus {
        box-shadow: 0 0 0 3px rgba(231, 111, 81, 0.18);
    }
    
    .message {
        max-width: 95%;
    }
    
    .notifications-content {
        padding: 1rem;
    }
    
    .notifications-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .notification-item {
        flex-wrap: wrap;
    }
    
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: var(--bg-tertiary);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        cursor: pointer;
        font-size: 1.25rem;
    }
    
    .btn-small {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
    
    .btn-large {
        padding: 0.65rem 1.5rem;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .landing-nav, .home-nav {
        padding: 0.5rem 0.75rem;
    }
    
    .nav-brand {
        gap: 0.25rem;
    }
    
    .logo-icon {
        font-size: 1.25rem;
    }
    
    .logo-text {
        font-size: 1rem;
    }
    
    .hero-content h1 {
        font-size: 1.375rem;
    }
    
    .hero-tagline {
        font-size: 0.9375rem;
    }
    
    .hero-icon {
        font-size: 3rem;
    }
    
    .welcome-message h2 {
        font-size: 1.125rem;
    }
    
    .features {
        flex-direction: column;
        gap: 1rem;
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
    }
    
    .language-selector select {
        padding: 0.35rem;
        font-size: 0.8rem;
    }
    
    .theme-toggle {
        padding: 0.35rem;
        font-size: 1rem;
    }
    
    .pwa-install-content {
        flex-wrap: wrap;
        text-align: center;
        justify-content: center;
    }
    
    .pwa-text {
        width: 100%;
        align-items: center;
    }
    
    .error-content h1 {
        font-size: 4rem;
    }
}

.intake-selectors.intake-hidden {
    display: none;
}

.input-area.input-collapsed .intake-selectors,
.input-area.input-collapsed .input-container,
.input-area.input-collapsed .uploaded-files-preview,
.input-area.input-collapsed .upload-hint,
.input-area.input-collapsed .legal-notice-bar,
.input-area.input-collapsed .search-panel {
    display: none;
}

.input-area.input-collapsed {
    padding: 0;
    border-top: none;
}

.new-question-fab {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 20px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #22c55e;
    color: #ffffff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.4);
    z-index: 90;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
    transition: transform 0.2s, box-shadow 0.2s;
}

[dir="rtl"] .new-question-fab {
    right: auto;
    left: 20px;
}

.new-question-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
}

.new-question-fab.visible {
    display: flex;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

html.chat-page .intake-field-locked {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    color: var(--text-primary);
    min-height: 40px;
}

html.chat-page .intake-field-locked .locked-value {
    flex: 1;
    font-weight: 500;
}

html.chat-page .intake-field-locked .locked-change-btn {
    background: none;
    border: none;
    color: var(--brand-primary, #E76F51);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: auto !important;
    position: relative;
    z-index: 20;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

html.chat-page .intake-field-locked .locked-change-btn:hover {
    text-decoration: underline;
}

html.chat-page .intake-select.is-locked {
    display: none !important;
}

html.chat-page .intake-field .intake-field-locked {
    display: none;
}

html.chat-page .intake-field.is-locked .intake-field-locked {
    display: flex;
}

html.chat-page .intake-field.is-locked .intake-select {
    display: none !important;
}

html.chat-page .jurisdiction-gate-hint {
    font-size: 0.8125rem;
    color: var(--brand-primary, #E76F51);
    text-align: center;
    padding: 0.25rem 0;
    font-weight: 500;
}

html.chat-page[data-theme="dark"] .intake-field-locked {
    background: rgba(30, 32, 40, 0.6);
    border-color: rgba(255, 255, 255, 0.12);
    color: #E0E8F0;
}

html.chat-page[data-theme="dark"] .intake-field-locked .locked-value {
    color: #E0E8F0;
}

html.chat-page[data-theme="dark"] .intake-field-locked .locked-change-btn {
    color: #7DD3FC;
}

html.chat-page[data-theme="dark"] .jurisdiction-gate-hint {
    color: #93E0FF;
}

html.chat-page[data-theme="dark"] .header-btn {
    color: #A0B0C0;
}

html.chat-page[data-theme="dark"] .header-btn:hover {
    color: #E0E8F0;
    background: rgba(255, 255, 255, 0.08);
}

html.chat-page[data-theme="dark"] .header-user-name {
    color: #E0E8F0;
}

html.chat-page[data-theme="dark"] .attach-btn {
    background: rgba(40, 44, 52, 0.8);
    border-color: rgba(255, 255, 255, 0.12);
    color: #A0B0C0;
}

html.chat-page[data-theme="dark"] #questionInput {
    color: #E0E8F0;
}

html.chat-page[data-theme="dark"] #questionInput::placeholder {
    color: #6B7F91;
}

html.chat-page[data-theme="dark"] .chat-area {
    background: transparent;
}

html.chat-page[data-theme="dark"] .sidebar {
    background: rgba(16, 18, 22, 0.92);
    border-color: rgba(255, 255, 255, 0.08);
}

html.chat-page[data-theme="dark"] .sidebar-header {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

html.chat-page[data-theme="dark"] .new-chat-btn {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    color: #D0DAE4;
}

html.chat-page[data-theme="dark"] .new-chat-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

html.chat-page[data-theme="dark"] .conversation-item {
    color: #B0C0D0;
    border-color: transparent;
}

html.chat-page[data-theme="dark"] .conversation-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #E0E8F0;
}

html.chat-page[data-theme="dark"] .conversation-item.active {
    background: rgba(75, 114, 166, 0.15);
    color: #E0E8F0;
}

html.chat-page[data-theme="dark"] .mobile-menu-btn {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    color: #D0DAE4;
}

html.chat-page[data-theme="dark"] .chat-welcome-tagline {
    color: var(--accent-gold, #A68A56);
}

html.chat-page[data-theme="dark"] .chat-welcome-logo {
    filter: none;
    opacity: 1;
}

html.chat-page[data-theme="dark"] .chat-welcome-hero {
    opacity: 1;
}

html.chat-page[data-theme="dark"] .input-area {
    background: rgba(22, 24, 30, 0.85);
    border-color: rgba(255, 255, 255, 0.1);
}

html.chat-page[data-theme="dark"] .input-area:focus-within {
    border-color: rgba(123, 156, 198, 0.4);
}

html.chat-page[data-theme="dark"] .send-btn {
    background: var(--cta-primary);
    color: #fff;
}

html.chat-page[data-theme="dark"] .upload-hint {
    color: #6B7F91;
}

html.chat-page[data-theme="dark"] .legal-notice-bar {
    color: #8899AA;
    border-color: rgba(255, 255, 255, 0.06);
}

html.chat-page[data-theme="dark"] .sidebar-btn {
    color: #A0B0C0;
}

html.chat-page[data-theme="dark"] .sidebar-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #E0E8F0;
}

html.chat-page .input-container.is-gated {
    opacity: 0.5;
    pointer-events: none;
}

html.chat-page .message.assistant[dir="ltr"] {
    direction: ltr;
    text-align: left;
}

html.chat-page .message.assistant[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

html.chat-page .message.assistant[dir="ltr"] .analysis-card,
html.chat-page .message.assistant[dir="ltr"] .analysis-section-content,
html.chat-page .message.assistant[dir="ltr"] .analysis-toc {
    direction: ltr;
    text-align: left;
}

html.chat-page .message.assistant[dir="rtl"] .analysis-card,
html.chat-page .message.assistant[dir="rtl"] .analysis-section-content,
html.chat-page .message.assistant[dir="rtl"] .analysis-toc {
    direction: rtl;
    text-align: right;
}

html.chat-page .message.assistant[dir="ltr"] pre,
html.chat-page .message.assistant[dir="ltr"] code {
    direction: ltr;
    text-align: left;
}

html.chat-page .message.assistant[dir="rtl"] pre,
html.chat-page .message.assistant[dir="rtl"] code {
    direction: ltr;
    text-align: left;
}

html.chat-page.keyboard-open .intake-selectors {
    display: none !important;
}

html.chat-page.keyboard-open .chat-welcome-hero {
    display: none !important;
}

html.chat-page.keyboard-open .search-panel {
    padding: 0.375rem;
    border-radius: 14px;
}

html.chat-page.keyboard-open .search-panel .smart-chips-row {
    display: none !important;
}

@media (min-width: 769px) {
    html.chat-page.keyboard-open .intake-selectors {
        display: flex !important;
    }
    .intake-selectors.intake-hidden {
        display: flex !important;
    }
    html.chat-page.keyboard-open .chat-welcome-hero {
        display: flex !important;
    }
    html.chat-page.keyboard-open .search-panel .smart-chips-row {
        display: flex !important;
    }
}

html.chat-page.keyboard-open .upload-hint,
html.chat-page.keyboard-open .legal-notice-bar,
html.chat-page.keyboard-open .jurisdiction-gate-hint {
    display: none !important;
}

html.chat-page.keyboard-open .input-area {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

@media (max-width: 768px) {
    html.chat-page .input-area:focus-within ~ .messages-container .chat-welcome-hero,
    html.chat-page .chat-area:has(.input-area:focus-within) .chat-welcome-hero {
        display: none !important;
    }
    html.chat-page .chat-area:has(.input-area:focus-within) .smart-chips-row {
        display: none !important;
    }
    html.chat-page .chat-area:has(.input-area:focus-within) .search-panel {
        padding: 0.375rem;
        border-radius: 14px;
    }
    html.chat-page .chat-area:has(.input-area:focus-within) .upload-hint,
    html.chat-page .chat-area:has(.input-area:focus-within) .legal-notice-bar,
    html.chat-page .chat-area:has(.input-area:focus-within) .jurisdiction-gate-hint {
        display: none !important;
    }
    html.chat-page .chat-area:has(.input-area:focus-within) .input-area {
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
    }
}

@media (max-height: 500px) and (max-width: 768px) {
    html.chat-page .chat-welcome-hero {
        display: none !important;
    }
    html.chat-page .smart-chips-row {
        display: none !important;
    }
    html.chat-page .input-area {
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
    }
}

@supports (padding: max(0px)) {
    .landing-nav, .home-nav {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    .input-area {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
    
    .pwa-install-prompt {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

.global-footer {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    color: #b8bcc4;
    padding: 1rem 2rem;
    text-align: center;
    border-top: 1px solid var(--glass-border);
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-link {
    color: #e5e7eb;
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: #ffffff;
    text-decoration: underline;
}

.footer-separator {
    color: #d1d5db;
}

.footer-gdpr {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #e5e7eb;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    margin-top: 0.5rem;
}

.gdpr-badge {
    font-size: 1rem;
}

.footer-copyright {
    font-size: 0.85rem;
    color: #b8bcc4;
}


.disclaimer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 1rem;
}

.disclaimer-modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    max-width: 700px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.disclaimer-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.disclaimer-modal-header h2 {
    color: var(--text-primary);
    font-size: 1.125rem;
}

.disclaimer-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
}

.disclaimer-close:hover {
    color: var(--text-primary);
}

.disclaimer-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.disclaimer-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
}

.disclaimer-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.legal-notice-bar {
    background: var(--bg-tertiary);
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.first-use-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10001;
    padding: 1rem;
}

.first-use-content {
    background: var(--card-bg);
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    padding: 2rem;
    text-align: center;
}

.first-use-content h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.first-use-content p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.first-use-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.first-use-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--royal-blue);
}

.first-use-checkbox label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
}

.first-use-checkbox a {
    color: var(--royal-blue);
    text-decoration: underline;
}

.tooltip-container {
    position: relative;
    display: inline-block;
}

.tooltip-icon {
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: help;
    margin-left: 0.25rem;
}

.tooltip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--charcoal);
    color: #fff;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 100;
    transition: opacity 0.2s ease;
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

@media (max-width: 768px) {
    .pipeline-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding-left: 1rem;
    }
    
    [dir="rtl"] .pipeline-container {
        flex-direction: column;
        padding-left: 0;
        padding-right: 1rem;
    }
    
    .pipeline-step {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        max-width: none;
        padding: 1rem 0;
        gap: 1rem;
        position: relative;
    }
    
    [dir="rtl"] .pipeline-step {
        text-align: right;
        flex-direction: row-reverse;
    }
    
    .pipeline-step::before {
        content: '';
        position: absolute;
        left: 17px;
        top: 46px;
        width: 2px;
        height: calc(100% - 10px);
        background: var(--border-color);
    }
    
    [dir="rtl"] .pipeline-step::before {
        left: auto;
        right: 17px;
    }
    
    .pipeline-step:last-of-type::before {
        display: none;
    }
    
    .step-number {
        flex-shrink: 0;
        margin-bottom: 0;
    }
    
    .step-icon {
        display: none;
    }
    
    .step-content {
        flex: 1;
    }
    
    .step-content h3 {
        font-size: 1rem;
    }
    
    .step-content p {
        font-size: 0.8125rem;
    }
    
    .pipeline-connector {
        display: none;
    }
}

@media (max-width: 480px) {
    .footer-content {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .disclaimer-modal-content {
        max-height: 90vh;
    }
    
    .tooltip-text {
        white-space: normal;
        width: 200px;
        left: 0;
        transform: none;
    }
}

/* ================================
   Dubai Courts Theme - Animations
================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes pulse-slow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes bounce-slow {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.animate-slide-in {
    animation: slideIn 0.4s ease-out;
}

.animate-bounce-in {
    animation: bounceIn 0.5s ease-out;
}

.animate-shimmer {
    animation: shimmer 2s infinite linear;
}

.animate-pulse-slow {
    animation: pulse-slow 2s infinite ease-in-out;
}

.animate-float {
    animation: float 3s infinite ease-in-out;
}

.animate-bounce-slow {
    animation: bounce-slow 3s infinite ease-in-out;
}

.hover-lift {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.smooth-focus {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.smooth-focus:focus {
    transform: scale(1.02);
    box-shadow: 0 0 0 3px rgba(90, 160, 240, 0.15);
}

/* Animation delays */
.delay-75 { animation-delay: 75ms; }
.delay-150 { animation-delay: 150ms; }
.delay-300 { animation-delay: 300ms; }
.delay-500 { animation-delay: 500ms; }

/* ================================
   Dubai Courts Theme - Scrollbar
================================ */

.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--gold-primary);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--gold-dark);
}

.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: var(--gold-primary) var(--bg-tertiary);
}

/* ================================
   Dubai Courts Theme - Buttons
================================ */

.btn-dc-primary {
    background-color: var(--brand-primary);
    border: none;
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 300ms ease-in;
}

.btn-dc-primary:hover {
    background-color: var(--brand-hover);
    color: #fff;
}

.btn-dc-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-dc-outline {
    background-color: transparent;
    border: 1px solid var(--text-primary);
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 200ms ease;
}

.btn-dc-outline:hover {
    background-color: var(--text-primary);
    color: var(--bg-primary);
}

/* ================================
   Dubai Courts Theme - Cards
================================ */

.card-elevated {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-elevated:hover {
    transform: translateY(-2px);
}

/* ================================
   Dubai Courts Theme - RTL Spacing
================================ */

.ps-0 { padding-left: 0; }
[dir="rtl"] .ps-0 { padding-right: 0; padding-left: unset; }

.pe-0 { padding-right: 0; }
[dir="rtl"] .pe-0 { padding-right: unset; padding-left: 0; }

.ms-0 { margin-left: 0; }
[dir="rtl"] .ms-0 { margin-right: 0; margin-left: unset; }

.me-0 { margin-right: 0; }
[dir="rtl"] .me-0 { margin-right: unset; margin-left: 0; }

.ps-1 { padding-left: 0.25rem; }
[dir="rtl"] .ps-1 { padding-right: 0.25rem; padding-left: unset; }

.ps-2 { padding-left: 0.5rem; }
[dir="rtl"] .ps-2 { padding-right: 0.5rem; padding-left: unset; }

.ps-3 { padding-left: 0.75rem; }
[dir="rtl"] .ps-3 { padding-right: 0.75rem; padding-left: unset; }

.ps-4 { padding-left: 1rem; }
[dir="rtl"] .ps-4 { padding-right: 1rem; padding-left: unset; }


/* ================================
   Email Dialog Styles
================================ */
.email-dialog-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.email-dialog-overlay.active {
    display: flex;
}

.email-dialog {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 420px;
    animation: scaleIn 0.25s ease-out;
}

.email-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.email-dialog-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.email-dialog-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    transition: color 0.2s;
}

.email-dialog-close:hover {
    color: var(--text-primary);
}

.email-dialog-body {
    padding: 1.5rem;
}

.email-dialog-body label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.email-dialog-body input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
    direction: ltr !important;
    text-align: left !important;
    font-family: var(--font-input) !important;
}

.email-dialog-body input:focus {
    outline: none;
    border-color: var(--teal-primary);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

.email-dialog-body input.error {
    border-color: var(--error-color);
}

.email-error {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: var(--error-color);
}

.email-dialog-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem 1.5rem;
    justify-content: flex-end;
}

.email-send-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--teal-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.email-send-btn:hover {
    background: var(--teal-dark);
}

.email-send-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}


/* ================================
   Toast Notification Styles
================================ */
.toast-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 10000;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    white-space: nowrap;
    font-size: 0.875rem;
}

.toast-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-notification.toast-success {
    border-left: 4px solid var(--success-color);
}

.toast-notification.toast-error {
    border-left: 4px solid var(--error-color);
}

.toast-notification.toast-info {
    border-left: 4px solid var(--info-color);
}

.toast-notification button {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.toast-notification button:hover {
    color: var(--text-primary);
}

.auth-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--glass-border);
}
.auth-topbar-logo img {
    height: 30px;
    width: auto;
}
.auth-topbar-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}
.auth-topbar .header-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    padding: 0;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.auth-topbar .header-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    color: var(--primary);
}
.auth-topbar .header-btn svg {
    width: 18px;
    height: 18px;
}
.auth-topbar .lang-dropdown {
    position: relative;
}
.auth-topbar .lang-toggle-btn {
    width: auto;
    padding: 0 12px;
    gap: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.auth-topbar .lang-code {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}
.auth-topbar .lang-chevron {
    opacity: 0.6;
    transition: transform 0.2s;
}
[dir="rtl"] .auth-topbar .lang-chevron {
    margin-left: 0;
    margin-right: 0;
}
.auth-topbar .lang-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.375rem;
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 9999;
    min-width: 180px;
    padding: 0.375rem;
    overflow: hidden;
}
[data-theme="dark"] .auth-topbar .lang-dropdown-menu {
    background: #1A1A1A;
}
[dir="rtl"] .auth-topbar .lang-dropdown-menu {
    right: auto;
    left: 0;
}
.auth-topbar .lang-dropdown-menu.show {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.auth-topbar .lang-dropdown-header {
    padding: 0.5rem 0.75rem 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.auth-topbar .lang-option {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    background: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.875rem;
    text-align: left;
    border-radius: 8px;
    transition: background 0.15s;
}
[dir="rtl"] .auth-topbar .lang-option {
    text-align: right;
    flex-direction: row-reverse;
}
.auth-topbar .lang-option:hover {
    background: var(--bg-secondary);
}
.auth-topbar .lang-option.active {
    background: rgba(37, 99, 235, 0.08);
}
.auth-topbar .lang-option-check {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
}
.auth-topbar .lang-option.active .lang-option-check {
    color: var(--royal-blue);
}
.auth-topbar .lang-option-code {
    font-weight: 600;
    font-size: 0.8125rem;
    min-width: 24px;
    color: var(--text-secondary);
}
.auth-topbar .lang-option.active .lang-option-code {
    color: var(--royal-blue);
}
.auth-topbar .lang-option-name {
    color: var(--text-primary);
}
