:root {
    --ml-navy: #062b5b;
    --ml-navy-deep: #031d3d;
    --ml-blue: #0874d1;
    --ml-blue-soft: #eaf5ff;
    --ml-green: #22c55e;
    --ml-bg: #f3f7fb;
    --ml-surface: #ffffff;
    --ml-surface-alt: #eef4f9;
    --ml-text: #0a1f36;
    --ml-text-muted: #60748b;
    --ml-success: #15803d;
    --ml-warning: #b45309;
    --ml-error: #c62828;
    --ml-border: #dce6f0;
    --ml-border-strong: #cad8e6;
    --ml-radius-sm: 10px;
    --ml-radius-md: 16px;
    --ml-radius-lg: 24px;
    --ml-shadow-sm: 0 6px 22px rgba(6, 43, 91, .07);
    --ml-shadow-md: 0 16px 44px rgba(6, 43, 91, .12);
    --ml-space-1: .25rem;
    --ml-space-2: .5rem;
    --ml-space-3: .75rem;
    --ml-space-4: 1rem;
    --ml-space-5: 1.25rem;
    --ml-space-6: 1.5rem;
    --ml-heading: var(--ml-navy);
    --ml-muted: var(--ml-text-muted);
    --ml-accent: var(--ml-blue);
    --ml-soft: var(--ml-blue-soft);
    --ml-shadow: var(--ml-shadow-sm);
    --ml-focus: #7cc4ff;
    color-scheme: light;
}

* { box-sizing: border-box; }

html { background: var(--ml-navy); }

body {
    margin: 0;
    background: var(--ml-bg);
    color: var(--ml-text);
    font-family: Inter, Roboto, "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
button, a { touch-action: manipulation; }

[dir="rtl"] body,
[dir="rtl"] button,
[dir="rtl"] input,
[dir="rtl"] select,
[dir="rtl"] textarea {
    font-family: "Noto Sans Arabic", Tahoma, Arial, sans-serif;
    line-height: 1.6;
}

.ml-ltr { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .ml-directional { transform: scaleX(-1); }

.ml-language-switcher { position: relative; }
.ml-language-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .28rem;
    min-width: 44px;
    min-height: 44px;
    padding: .35rem .55rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font-size: .72rem;
    font-weight: 800;
    cursor: pointer;
}
.ml-language-trigger .ml-icon { width: 15px; height: 15px; }
.ml-language-menu {
    position: absolute;
    z-index: 100;
    inset-block-start: calc(100% + .45rem);
    inset-inline-end: 0;
    display: grid;
    min-width: 190px;
    padding: .4rem;
    border: 1px solid var(--ml-border);
    border-radius: 14px;
    background: var(--ml-surface);
    box-shadow: var(--ml-shadow-md);
    color: var(--ml-text);
}
.ml-language-menu > strong { padding: .45rem .7rem .25rem; color: var(--ml-text-muted); font-size: .7rem; }
.ml-language-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    min-height: 44px;
    padding: .6rem .7rem;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: inherit;
    text-align: start;
    cursor: pointer;
}
.ml-language-option:hover,
.ml-language-option.active { background: var(--ml-blue-soft); color: var(--ml-accent); }

.ml-icon { display: block; width: 1.35rem; height: 1.35rem; flex: 0 0 auto; }

.ml-brand { display: inline-flex; align-items: center; min-width: 0; }
.ml-brand-image { display: block; width: auto; height: 42px; max-width: 100%; object-fit: contain; }
.ml-brand-symbol { width: 48px; height: 34px; object-position: center; }

.ml-card {
    padding: 1.1rem;
    border: 1px solid var(--ml-border);
    border-radius: var(--ml-radius-md);
    background: var(--ml-surface);
    box-shadow: var(--ml-shadow-sm);
}

.ml-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 48px;
    padding: .72rem 1.1rem;
    border: 0;
    border-radius: 12px;
    background: var(--ml-blue);
    color: #fff;
    font-weight: 760;
    letter-spacing: -.01em;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.ml-button:active { transform: scale(.985); }
.ml-button:focus-visible { outline: 3px solid rgba(8, 116, 209, .25); outline-offset: 2px; }
.ml-button:disabled { opacity: .5; cursor: default; transform: none; }
.ml-button-secondary { background: var(--ml-surface-alt); color: var(--ml-heading); }
.ml-button-success { background: var(--ml-success); color: #fff; }

.ml-input {
    width: 100%;
    min-height: 50px;
    padding: .72rem .85rem;
    border: 1px solid var(--ml-border-strong);
    border-radius: 12px;
    background: var(--ml-surface);
    color: var(--ml-text);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.ml-input:focus { outline: 0; border-color: var(--ml-blue); box-shadow: 0 0 0 3px rgba(8, 116, 209, .12); }
.ml-label { display: grid; gap: .42rem; color: var(--ml-text-muted); font-size: .78rem; font-weight: 760; }

.ml-badge {
    display: inline-flex;
    align-items: center;
    gap: .38rem;
    width: fit-content;
    padding: .28rem .58rem;
    border-radius: 999px;
    background: var(--ml-surface-alt);
    color: var(--ml-text-muted);
    font-size: .7rem;
    font-weight: 800;
    line-height: 1.2;
}

.ml-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ml-badge-success { color: var(--ml-success); background: #e9f8ee; }
.ml-badge-warning { color: var(--ml-warning); background: #fff6e5; }
.ml-badge-error { color: var(--ml-error); background: #fff0f0; }
.ml-badge-info { color: #0563ad; background: var(--ml-blue-soft); }

.ml-loading {
    min-height: 160px;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: .8rem;
    color: var(--ml-text-muted);
}

.ml-spinner { width: 34px; height: 34px; border: 3px solid var(--ml-border); border-top-color: var(--ml-blue); border-radius: 50%; animation: ml-spin .8s linear infinite; }
@keyframes ml-spin { to { transform: rotate(360deg); } }

.ml-empty { padding: 1.65rem 1rem; text-align: center; color: var(--ml-text-muted); }
.ml-empty h3 { margin: .7rem 0 .25rem; color: var(--ml-text); font-size: 1rem; }
.ml-empty p { max-width: 320px; margin: 0 auto; font-size: .85rem; }
.ml-empty-icon { width: 48px; height: 48px; display: grid; place-content: center; margin: auto; border-radius: 15px; background: var(--ml-blue-soft); color: var(--ml-blue); }
.ml-empty-icon .ml-icon { width: 24px; height: 24px; }

.ml-map { position: relative; min-height: 210px; overflow: hidden; border: 1px solid rgba(8, 116, 209, .12); border-radius: var(--ml-radius-lg); background: #dfeef3; }
.ml-map-grid { position: absolute; inset: 0; opacity: .82; background-image: linear-gradient(35deg, transparent 44%, #fff 45%, #fff 50%, transparent 51%), linear-gradient(110deg, transparent 46%, #bad5df 47%, #bad5df 51%, transparent 52%); background-size: 90px 70px, 120px 90px; }
.ml-map-route { position: absolute; width: 65%; height: 55%; left: 18%; top: 20%; border: 5px solid var(--ml-blue); border-left-color: transparent; border-bottom-color: transparent; border-radius: 50%; transform: rotate(8deg); }
.ml-pin { position: absolute; width: 20px; height: 20px; border: 4px solid #fff; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); box-shadow: var(--ml-shadow-sm); }
.ml-pin-origin { left: 18%; bottom: 24%; background: var(--ml-green); }
.ml-pin-destination { right: 18%; top: 20%; background: var(--ml-navy); }
.ml-map-label { position: absolute; left: .75rem; right: .75rem; bottom: .75rem; display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; padding: .72rem .85rem; border-radius: 13px; background: rgba(255, 255, 255, .94); box-shadow: var(--ml-shadow-sm); color: var(--ml-text); font-size: .82rem; backdrop-filter: blur(8px); }
.ml-map-label small { width: 100%; color: var(--ml-warning); font-size: .68rem; }

.ml-alert { display: flex; align-items: center; justify-content: space-between; gap: .7rem; padding: .8rem .9rem; border: 1px solid #cfe7fb; border-radius: 12px; background: var(--ml-blue-soft); color: var(--ml-heading); font-size: .84rem; }
.ml-alert-error { border-color: #f4cccc; background: #fff2f2; color: var(--ml-error); }
.ml-skeleton { min-height: 1rem; border-radius: 8px; background: linear-gradient(90deg, #e9eef4, #f8fafc, #e9eef4); background-size: 200% 100%; animation: ml-shimmer 1.3s infinite; }
@keyframes ml-shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Application palettes are scoped to mobile shells; the professional portals retain their own palette. */
.mobile-shell[data-theme] {
    --ml-muted: var(--ml-text-muted);
    --ml-soft: var(--ml-blue-soft);
    --ml-shadow: var(--ml-shadow-sm);
    --ml-header-bg: #fff;
    --ml-header-text: #0b2442;
    --ml-nav-bg: rgba(255, 255, 255, .98);
    --ml-nav-active: #e8f4ff;
    --ml-nav-muted: #687f99;
    --ml-hero-start: #f4faff;
    --ml-hero-end: #e1f1ff;
    --ml-hero-kicker: #078147;
    --ml-hero-label-bg: #d9f5e7;
    --ml-scene-ink: #8fc7ef;
    --ml-scene-green: #5caa88;
    --ml-scene-car: #f7fbff;
    --ml-scene-wheel: #355c79;
    --ml-driver-banner-border: #163d59;
    color: var(--ml-text);
    color-scheme: light;
}
.mobile-shell[data-theme="dark"] {
    --ml-bg: #041b2e;
    --ml-surface: #0b2a45;
    --ml-surface-alt: #123650;
    --ml-text: #edf5ff;
    --ml-heading: #f4f8ff;
    --ml-text-muted: #abc0d6;
    --ml-accent: #53b8ff;
    --ml-blue-soft: #103957;
    --ml-border: #24455f;
    --ml-border-strong: #3a5c76;
    --ml-success: #77e1a3;
    --ml-warning: #ffd08c;
    --ml-error: #ffb1ac;
    --ml-shadow-sm: 0 6px 22px rgba(0, 0, 0, .12);
    --ml-shadow-md: 0 16px 40px rgba(0, 0, 0, .2);
    --ml-header-bg: #03182c;
    --ml-header-text: #f0f7ff;
    --ml-nav-bg: rgba(5, 29, 49, .98);
    --ml-nav-active: #0c3b65;
    --ml-nav-muted: #a0b7cf;
    --ml-hero-start: #042743;
    --ml-hero-end: #06233d;
    --ml-hero-kicker: #38dc8e;
    --ml-hero-label-bg: #0b443c;
    --ml-scene-ink: #2075ad;
    --ml-scene-green: #1f715f;
    --ml-scene-car: #c8deec;
    --ml-scene-wheel: #163c59;
    --ml-driver-banner-border: #245370;
    color-scheme: dark;
}
.mobile-shell[data-theme="dark"] .ml-badge-success { color: var(--ml-success); background: #103d31; }
.mobile-shell[data-theme="dark"] .ml-badge-warning { color: var(--ml-warning); background: #44341e; }
.mobile-shell[data-theme="dark"] .ml-badge-error { color: var(--ml-error); background: #462832; }
.mobile-shell[data-theme="dark"] .ml-badge-info { color: #9cd4ff; }
.mobile-shell[data-theme="dark"] .ml-alert-error { background: #3c252e; border-color: #75434c; color: var(--ml-error); }
.mobile-shell[data-theme="dark"] .ml-alert-warning { background: #3b311e; border-color: #6a5736; color: var(--ml-warning); }
.mobile-shell[data-theme="dark"] .ml-map-label { background: rgba(11, 42, 69, .96); }
/* Only the decorative home scene changes direction; official brand images are never mirrored. */
.mobile-shell[dir="rtl"] .home-mobility-scene { transform: scaleX(-1); }
