/* Law Office — Admin theme (Arabic / RTL) */

:root {
    --ml-navy:        #0A2540;
    --ml-navy-2:      #0F2A45;
    --ml-navy-deep:   #061827;
    --ml-gold:        #C9A961;
    --ml-gold-dark:   #A8893F;
    --ml-cream:       #FAFAF7;
    --ml-text:        #0F172A;
    --ml-muted:       #475569;
    --ml-border:      #E5E7EB;
    --ml-surface:     #FFFFFF;
}

/* ml-compact: the whole admin panel one step smaller (Majed, 2026-11-18: "font everywhere is big").
   Nearly every size here and in MudBlazor is written in rem, so the root size scales them together;
   the theme in MainLayout.razor sets the matching MudBlazor typography. */
html { font-size: 15px; }
/* and the page content stops stretching on wide screens: centred, at most 1440px */
.mud-main-content > .mud-container { max-width: 1440px; }

html, body {
    background: var(--ml-cream);
    font-family: 'Tajawal', 'Segoe UI', system-ui, sans-serif;
    color: var(--ml-text);
    direction: rtl;
}

/* ========================================================================
   App background — applied to every page via MainLayout > MudMainContent.
   Six-layer "designer mesh" build:
     1) base cream-tinted gradient with three colour stops for direction
     2) SIX softly-drifting brand-tinted radial blobs (5 corners + 1 centre),
        animated at two different speeds via ml-bg-drift / ml-bg-drift-slow
        so the mesh feels organic rather than mechanical
     3) Subtle SVG noise grain for a paper-like texture (data URI, no fetch)
     4) faint dot grid that fades edges → centre
     5) top vignette anchoring content under the navy AppBar
     6) gold accent stripe at the very top (1px hairline) just under the AppBar
   Real content is forced to z-index:1 so the decorative layers never compete.
   ======================================================================== */
.ml-app-bg {
    position: relative;
    min-height: 100vh;
    background-color: var(--ml-cream);
    /* Three-stop diagonal cream→white→ivory so the page has direction. */
    background-image: linear-gradient(135deg, #F7F4EC 0%, #FFFFFF 45%, #F4F1E8 100%);
    background-attachment: fixed;
    background-size: cover;
    overflow-x: hidden;
}

/* Drifting brand-tinted blob mesh — the primary "depth" pass. Inset by
   -10% so the blobs spill past the viewport edges and never reveal hard
   boundaries when the layer translates. */
.ml-app-bg::before {
    content: "";
    position: fixed; inset: -10%;
    pointer-events: none;
    z-index: 0;
    background-image:
        radial-gradient(circle at 16% 20%, rgba(201, 169, 97, .18) 0%, transparent 36%),
        radial-gradient(circle at 84% 16%, rgba(10,  37, 64, .10) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .55) 0%, transparent 30%),
        radial-gradient(circle at 14% 82%, rgba(10,  37, 64, .08) 0%, transparent 42%),
        radial-gradient(circle at 86% 88%, rgba(201, 169, 97, .15) 0%, transparent 46%),
        radial-gradient(circle at 60% 38%, rgba(125,  92, 213, .04) 0%, transparent 30%);
    animation: ml-bg-drift 48s ease-in-out infinite alternate;
    will-change: transform;
}
@keyframes ml-bg-drift {
    0%   { transform: translate3d(0,     0,    0) scale(1);    }
    33%  { transform: translate3d(-14px, 10px, 0) scale(1.035); }
    66%  { transform: translate3d(12px, -8px,  0) scale(1.02);  }
    100% { transform: translate3d(-6px, -12px, 0) scale(1.045); }
}

/* Second pass: noise grain + dot grid + top vignette + gold hairline
   merged into one ::after so we don't burn extra paint layers. The
   noise is encoded inline as a tiny SVG turbulence — no network fetch. */
.ml-app-bg::after {
    content: "";
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.04  0 0 0 0 0.14  0 0 0 0 0.25  0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.55'/></svg>"),
        radial-gradient(rgba(10, 37, 64, .055) 1px, transparent 1px),
        linear-gradient(180deg, rgba(10, 37, 64, .06) 0%, transparent 140px),
        linear-gradient(180deg, rgba(201, 169, 97, .35) 0%, rgba(201, 169, 97, 0) 1px);
    background-size: 240px 240px, 24px 24px, 100% 100%, 100% 100%;
    background-position: 0 0, 0 0, 0 0, 0 0;
    background-repeat: repeat, repeat, no-repeat, no-repeat;
    opacity: .9;
    /* Fade dots/noise from the edges → centre so the body of the page
       stays clean and the texture only whispers around the periphery. */
    mask-image: radial-gradient(ellipse 95% 85% at 50% 50%, rgba(0,0,0,.55) 0%, rgba(0,0,0,.7) 35%, #000 100%);
    -webkit-mask-image: radial-gradient(ellipse 95% 85% at 50% 50%, rgba(0,0,0,.55) 0%, rgba(0,0,0,.7) 35%, #000 100%);
}

/* All real content sits above the decorative ::before/::after layers. */
.ml-app-bg > * { position: relative; z-index: 1; }

/* Honour OS-level reduce-motion: stop the drift animation entirely. */
@media (prefers-reduced-motion: reduce) {
    .ml-app-bg::before { animation: none; }
}

/* Give MudPaper/cards a touch more lift on the new background — keeps them
   visually distinct from the noise/grain even when content is dense. */
.ml-app-bg .mud-paper:not([class*="ml-hero"]):not(.mud-dialog) {
    box-shadow: 0 1px 2px rgba(10, 37, 64, .03),
                0 8px 24px rgba(10, 37, 64, .04);
}

/* ========================================================================
   Branded loader — used for splash (auth restore), page-level loading,
   and inline loaders. Three sizes: Splash (80px), Page (56px), Inline (28px).
   Two rotating arcs (gold outer, navy inner) around a centred Balance icon.
   ======================================================================== */
.ml-loader {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.ml-loader.size-splash { width: 96px; height: 96px; }
.ml-loader.size-page   { width: 64px; height: 64px; }
.ml-loader.size-inline { width: 32px; height: 32px; }

/* Outer gold arc — runs clockwise */
.ml-loader::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--ml-gold);
    border-inline-end-color: var(--ml-gold);
    animation: ml-spin 1.1s linear infinite;
}
/* Inner navy arc — runs counter-clockwise at a different speed */
.ml-loader::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--ml-navy);
    border-inline-start-color: var(--ml-navy);
    animation: ml-spin 1.7s linear infinite reverse;
}
.ml-loader.size-splash::after { inset: 14px; }
.ml-loader.size-page::after   { inset: 10px; }
.ml-loader.size-inline::after { inset: 6px; }

/* Centre dot with the Balance icon (only on splash + page sizes) */
.ml-loader .ml-loader-center {
    position: relative;
    z-index: 2;
    background: linear-gradient(135deg, #C9A961 0%, #A8893F 100%);
    border-radius: 50%;
    color: #0A2540;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(201, 169, 97, .35);
    animation: ml-pulse 2.2s ease-in-out infinite;
}
.ml-loader.size-splash .ml-loader-center { width: 38px; height: 38px; }
.ml-loader.size-page   .ml-loader-center { width: 26px; height: 26px; }
.ml-loader.size-inline .ml-loader-center { display: none; }

@keyframes ml-spin {
    to { transform: rotate(360deg); }
}
@keyframes ml-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.08); }
}

/* Full-page splash loader (used during auth-restore on F5 / first load).
   Premium four-layer build matched to the login backdrop:
     1) navy radial base with two anchor points (top-centre + bottom-trailing)
     2) drifting gold halo behind the spinner (ml-splash-halo, 10s alternate)
     3) Islamic-style octagonal lattice tinted gold, anchored top-trailing
     4) fine grid + SVG noise grain merged into a single ::after layer
   Animations stop under prefers-reduced-motion. */
.ml-loader-splash {
    position: fixed; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background:
        radial-gradient(circle at 50% 28%, rgba(15, 42, 69, .65) 0%, transparent 50%),
        radial-gradient(circle at 86% 86%, rgba(201, 169, 97, .12) 0%, transparent 50%),
        radial-gradient(circle at 14% 84%, rgba(10, 37, 64, .55) 0%, transparent 48%),
        linear-gradient(135deg, #061827 0%, #0A2540 35%, #0F2A45 70%, #061827 100%);
    color: #fff;
    z-index: 99999;
    overflow: hidden;
}

/* Drifting gold halo behind the spinner — same idea as the login screen but
   faster (10s) since the splash is short-lived and should feel "alive now". */
.ml-loader-splash::before {
    content: "";
    position: absolute;
    width: 760px; height: 760px;
    left: 50%; top: 50%;
    margin-left: -380px; margin-top: -380px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(201, 169, 97, .26) 0%, rgba(201, 169, 97, .08) 35%, transparent 65%);
    filter: blur(28px);
    pointer-events: none;
    animation: ml-splash-halo 10s ease-in-out infinite alternate;
}
@keyframes ml-splash-halo {
    0%   { transform: translate3d(0,     0,    0) scale(1);    opacity: .85; }
    50%  { transform: translate3d(-30px, 20px, 0) scale(1.10); opacity: 1;   }
    100% { transform: translate3d(20px, -15px, 0) scale(1.04); opacity: .9;  }
}

/* Composite texture pass: noise grain + octagonal lattice + fine grid,
   all encoded inline as data URIs (no network fetch). */
.ml-loader-splash::after {
    content: "";
    position: absolute; inset: 0;
    background-image:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 0.84  0 0 0 0 0.5  0 0 0 0.45 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.5'/></svg>"),
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='90' height='90' viewBox='0 0 90 90'><g fill='none' stroke='%23C9A961' stroke-width='0.5' opacity='0.22'><polygon points='45,10 63,18 71,36 63,54 45,62 27,54 19,36 27,18'/><polygon points='45,22 56,28 61,40 56,52 45,58 34,52 29,40 34,28'/></g></svg>"),
        linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
    background-size: 200px 200px, 90px 90px, 36px 36px, 36px 36px;
    background-position: 0 0, top right, 0 0, 0 0;
    background-repeat: repeat, repeat, repeat, repeat;
    pointer-events: none;
    /* Fade overlay from edges → centre so the spinner sits on clean navy. */
    mask-image: radial-gradient(ellipse 95% 85% at 50% 50%, rgba(0,0,0,.2) 0%, rgba(0,0,0,.55) 35%, #000 100%);
    -webkit-mask-image: radial-gradient(ellipse 95% 85% at 50% 50%, rgba(0,0,0,.2) 0%, rgba(0,0,0,.55) 35%, #000 100%);
}

/* Content (spinner + brand + text) needs to sit above the decorative layers. */
.ml-loader-splash > * { position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) {
    .ml-loader-splash::before { animation: none; }
}
.ml-loader-brand {
    font-family: 'Cairo', sans-serif;
    font-size: 1.15rem; font-weight: 800;
    letter-spacing: .6px;
    margin-top: 24px;
    color: #fff;
}
.ml-loader-eyebrow {
    color: var(--ml-gold);
    font-size: .72rem; font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    margin-top: 6px;
}
.ml-loader-text {
    color: rgba(255,255,255,.62);
    font-size: .88rem;
    margin-top: 14px;
    font-weight: 500;
}

/* Inline page-level loader (centred in available container space) */
.ml-loader-page {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 48px 16px;
    color: #475569;
}
.ml-loader-page-text {
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    font-size: .95rem;
    color: #0F172A;
    margin-top: 16px;
}
.ml-loader-page-sub {
    font-size: .82rem;
    color: #94A3B8;
    margin-top: 4px;
}

/* Three pulsing dots (alternative inline style for table headers etc.) */
.ml-loader-dots {
    display: inline-flex; gap: 6px; align-items: center;
}
.ml-loader-dots span {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--ml-gold);
    animation: ml-dot 1.2s infinite ease-in-out both;
}
.ml-loader-dots span:nth-child(2) { animation-delay: .15s; background: var(--ml-navy); }
.ml-loader-dots span:nth-child(3) { animation-delay: .30s; background: var(--ml-gold); }
@keyframes ml-dot {
    0%, 80%, 100% { transform: scale(.4); opacity: .4; }
    40%           { transform: scale(1);  opacity: 1; }
}

/* ========================================================================
   Scrollbars — make it obvious which pane you're scrolling.
   Two distinct treatments:
   1) PAGE scroll (main content area & body): wider, branded gold/navy thumb,
      shown on the trailing edge with a subtle track.
   2) DRAWER scroll (the nav menu): noticeably thinner, low-contrast grey
      thumb, only fades in on hover so the menu itself stays clean.
   Both are mirrored properly in RTL (browsers put the vertical scrollbar
   on the inline-end edge automatically for RTL containers).
   ======================================================================== */

/* ---- Page-level scrollbar (window + main content) ---------------------- */
html, body, .ml-app-bg, .mud-main-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(10, 37, 64, .35) rgba(10, 37, 64, .04);
}
html::-webkit-scrollbar,
body::-webkit-scrollbar,
.ml-app-bg::-webkit-scrollbar,
.mud-main-content::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}
html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
.ml-app-bg::-webkit-scrollbar-track,
.mud-main-content::-webkit-scrollbar-track {
    background: rgba(10, 37, 64, .04);
    border-radius: 8px;
}
html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
.ml-app-bg::-webkit-scrollbar-thumb,
.mud-main-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--ml-navy) 0%, var(--ml-navy-2) 100%);
    border: 3px solid transparent;
    background-clip: padding-box;
    border-radius: 10px;
    min-height: 40px;
    transition: background .15s;
}
html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
.ml-app-bg::-webkit-scrollbar-thumb:hover,
.mud-main-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--ml-gold) 0%, var(--ml-gold-dark) 100%);
    background-clip: padding-box;
}
html::-webkit-scrollbar-corner,
body::-webkit-scrollbar-corner,
.ml-app-bg::-webkit-scrollbar-corner,
.mud-main-content::-webkit-scrollbar-corner {
    background: transparent;
}

/* ---- Drawer scrollbar — fully hidden, scroll still works -------------- */
/* The drawer can still scroll via wheel / touch / arrow keys but no
   scrollbar is rendered. Keeps the menu chrome clean and minimal. */
.mud-drawer,
.mud-drawer .mud-drawer-content,
.mud-navmenu,
.ml-nav-shell {
    scrollbar-width: none;        /* Firefox */
    -ms-overflow-style: none;     /* IE / old Edge */
}
.mud-drawer::-webkit-scrollbar,
.mud-drawer *::-webkit-scrollbar,
.mud-drawer .mud-drawer-content::-webkit-scrollbar,
.mud-navmenu::-webkit-scrollbar,
.ml-nav-shell::-webkit-scrollbar,
.ml-nav-shell *::-webkit-scrollbar {
    display: none;                /* Chrome / Safari / Edge */
    width: 0;
    height: 0;
}

/* ========================================================================
   File upload zone — compact horizontal pill used both inside
   CaseDocumentsPanel (edit mode) and inline in NewCasePage step 5
   (new mode, queue files). Hoisted to global so it's available even when
   the dedicated panel component isn't currently rendered.
   ======================================================================== */
.ml-upload-zone {
    position: relative;
    display: flex; align-items: center; gap: 14px;
    padding: 10px 14px;
    border: 2px dashed #C9A961;
    border-radius: 14px;
    background: linear-gradient(135deg, #FFFBEB 0%, #FFFFFF 100%);
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .12s, box-shadow .15s;
}
.ml-upload-zone:hover {
    background: linear-gradient(135deg, #FEF3C7 0%, #FFFBEB 100%);
    border-color: #A8893F;
    box-shadow: 0 8px 20px rgba(201, 169, 97, .15);
}
.ml-upload-ico-wrap {
    position: relative; flex-shrink: 0;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
}
.ml-upload-ico-ring {
    position: absolute; inset: 0;
    border-radius: 50%;
    background: rgba(201, 169, 97, .18);
    animation: ml-upload-pulse 2s ease-in-out infinite;
}
@keyframes ml-upload-pulse {
    0%, 100% { transform: scale(1);    opacity: .55; }
    50%      { transform: scale(1.20); opacity: .12; }
}
.ml-upload-ico {
    position: relative; z-index: 1;
    width: 40px; height: 40px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid rgba(201, 169, 97, .25);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 10px rgba(10, 37, 64, .06);
}
.ml-upload-body { flex: 1; min-width: 0; }
.ml-upload-title {
    font-family: 'Cairo', sans-serif;
    font-weight: 800;
    font-size: .95rem;
    color: #0F172A;
    line-height: 1.2;
}
.ml-upload-sub {
    font-size: .74rem;
    color: #78350F;
    margin-top: 2px;
    line-height: 1.4;
}
.ml-upload-cta {
    /* Navy on cream — maximum contrast against the gold upload zone so the
       button can't be missed. Order -1 lands it on the right in RTL. */
    order: -1;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 22px;
    background: linear-gradient(135deg, #0A2540 0%, #0F2A45 60%, #061827 100%);
    color: #FFFFFF;
    font-family: 'Cairo', sans-serif;
    font-weight: 800;
    font-size: .95rem;
    letter-spacing: .2px;
    border: 2px solid #C9A961;
    border-radius: 999px;
    box-shadow:
        0 8px 20px rgba(10, 37, 64, .30),
        0 0 0 4px rgba(201, 169, 97, .15);
    flex-shrink: 0;
    transition: transform .12s ease, box-shadow .15s ease, filter .12s ease;
    white-space: nowrap;
}
/* Icon inside the CTA gets the gold tint */
.ml-upload-cta .mud-icon-root { color: #C9A961 !important; }

.ml-upload-zone:hover .ml-upload-cta {
    transform: translateY(-2px);
    box-shadow:
        0 14px 28px rgba(10, 37, 64, .38),
        0 0 0 6px rgba(201, 169, 97, .22);
    filter: brightness(1.06);
}
.ml-upload-zone:active .ml-upload-cta {
    transform: translateY(0);
    box-shadow:
        0 6px 14px rgba(10, 37, 64, .28),
        0 0 0 3px rgba(201, 169, 97, .15);
}

/* ========================================================================
   Cursor hygiene — ensure text inputs always show the text I-beam and a
   visible typing caret. Bulldoze any inherited cursor: pointer from parent
   labels/wrappers (MudFileUpload, picker buttons, etc).
   ======================================================================== */
/* Catch every text-style input, regardless of MudBlazor wrapper class. */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input:not([type]),
textarea {
    cursor: text !important;
    caret-color: #0A2540 !important;
}
/* Read-only and disabled overrides keep their semantic cursor. */
input[readonly]:not([type="checkbox"]):not([type="radio"]),
textarea[readonly] {
    cursor: default !important;
}
input[disabled]:not([type="checkbox"]):not([type="radio"]),
textarea[disabled] {
    cursor: not-allowed !important;
}
/* Pickers (date / select / autocomplete) — input is read-only but the
   whole control is clickable to open a popover, so a pointer is right. */
.mud-picker .mud-input-slot input,
.mud-picker-inline .mud-input-root,
.mud-select .mud-input-slot input,
.mud-autocomplete .mud-input-slot input {
    cursor: pointer !important;
}

/* Final safety net: anywhere a MudInput exists, force its inner editable
   field to show the I-beam unless it's read-only/disabled/picker. */
.mud-input-control input:not([readonly]):not([disabled]):not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.mud-input-slot input:not([readonly]):not([disabled]):not([type="checkbox"]):not([type="radio"]):not([type="file"]) {
    cursor: text !important;
    caret-color: #0A2540 !important;
}

/* ---- Dialog & generic scrollable panes (e.g. global search dialog body) - */
.ml-gs-dlg-body,
.mud-dialog .mud-dialog-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(10, 37, 64, .25) transparent;
}
.ml-gs-dlg-body::-webkit-scrollbar,
.mud-dialog .mud-dialog-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.ml-gs-dlg-body::-webkit-scrollbar-track,
.mud-dialog .mud-dialog-content::-webkit-scrollbar-track {
    background: transparent;
}
.ml-gs-dlg-body::-webkit-scrollbar-thumb,
.mud-dialog .mud-dialog-content::-webkit-scrollbar-thumb {
    background: rgba(10, 37, 64, .25);
    border-radius: 999px;
}
.ml-gs-dlg-body::-webkit-scrollbar-thumb:hover,
.mud-dialog .mud-dialog-content::-webkit-scrollbar-thumb:hover {
    background: var(--ml-gold);
}

.serif, h1, h2, h3, h4, h5, h6,
.mud-typography-h1, .mud-typography-h2, .mud-typography-h3,
.mud-typography-h4, .mud-typography-h5, .mud-typography-h6 {
    font-family: 'Cairo', 'Tajawal', sans-serif;
    letter-spacing: 0;
    font-weight: 700;
}

/* === Hero =============================================================== */
.ml-hero {
    position: relative; overflow: hidden;
    border-radius: 20px; padding: 36px 40px; color: #fff;
    background:
        radial-gradient(circle at 15% 20%, rgba(201,169,97,0.18) 0%, transparent 45%),
        radial-gradient(circle at 90% 90%, rgba(255,255,255,0.06) 0%, transparent 50%),
        linear-gradient(135deg, var(--ml-navy) 0%, var(--ml-navy-2) 55%, var(--ml-navy-deep) 100%);
    box-shadow: 0 18px 60px rgba(10,37,64,0.30);
}
.ml-hero::before {
    content: ""; position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: radial-gradient(ellipse at 40% 50%, #000 0%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at 40% 50%, #000 0%, transparent 75%);
    pointer-events: none;
}
.ml-hero-eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: .78rem; letter-spacing: 0; color: var(--ml-gold);
    font-weight: 700;
}
.ml-hero-eyebrow::after {
    content: ""; width: 28px; height: 1px; background: var(--ml-gold); display: inline-block;
}
.ml-hero-title { font-family: 'Cairo', sans-serif; font-size: 1.7rem; font-weight: 800; margin: 10px 0 8px; }
.ml-hero-sub   { font-size: .88rem; opacity: .82; max-width: 640px; line-height: 1.7; font-weight: 300; }
.ml-hero-chip {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,0.10);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 999px; padding: 6px 16px;
    font-size: .85rem; margin-top: 18px;
}

/* === Section ============================================================ */
.ml-section { display: flex; align-items: center; gap: 12px; margin: 24px 4px 12px; }
.ml-section-rule { width: 32px; height: 2px; background: var(--ml-gold); border-radius: 1px; }
.ml-section-title {
    font-family: 'Cairo', sans-serif;
    font-size: 1.05rem; font-weight: 700; color: var(--ml-text);
}

/* === KPI / stat cards =================================================== */
.ml-kpi {
    background: var(--ml-surface);
    border: 1px solid var(--ml-border);
    border-radius: 14px;
    padding: 14px 16px 12px;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
    height: 100%;
}
.ml-kpi:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 40px rgba(10,37,64,0.10);
    border-color: rgba(10,37,64,0.18);
}
.ml-kpi-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ml-kpi-ico {
    width: 34px; height: 34px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
}
.ml-kpi-label { font-size: .76rem; color: var(--ml-muted); font-weight: 700; }
.ml-kpi-value {
    font-family: 'Cairo', sans-serif;
    font-size: 1.5rem; font-weight: 800; line-height: 1.1;
}
.ml-kpi-suffix { font-size: .8rem; color: var(--ml-muted); font-weight: 500; margin-right: 6px; }
.ml-kpi-hint  { font-size: .8rem; color: var(--ml-muted); margin-top: 4px; }

/* === Quick actions ====================================================== */
.ml-qa {
    background: var(--ml-surface);
    border: 1px solid var(--ml-border);
    border-radius: 14px;
    padding: 22px 18px;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
    height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; text-align: center; text-decoration: none;
}
.ml-qa:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 40px rgba(10,37,64,0.10);
    border-color: var(--ml-gold);
}
.ml-qa-ico {
    width: 52px; height: 52px; border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--ml-navy) 0%, var(--ml-navy-2) 100%);
    color: #fff;
}
.ml-qa-label { font-size: .95rem; font-weight: 700; color: var(--ml-text); font-family: 'Cairo', sans-serif; }
.ml-qa-desc  { font-size: .8rem; color: var(--ml-muted); }

/* === Buttons =========================================================== */
.mud-button.mud-button-filled.mud-button-filled-primary {
    background: linear-gradient(135deg, var(--ml-navy) 0%, var(--ml-navy-2) 100%) !important;
    box-shadow: 0 4px 14px rgba(10,37,64,0.22) !important;
    font-family: 'Cairo', sans-serif;
}
.mud-button.mud-button-filled.mud-button-filled-primary:hover {
    box-shadow: 0 8px 22px rgba(10,37,64,0.30) !important;
}

/* === Login backdrop ==================================================== */
/* Premium login backdrop — five layered passes:
     1) Navy gradient base with two radial anchors (top-centre, bottom-left)
     2) ::before — a 900×900 drifting gold halo behind the card (animated)
     3) ::after  — fine grid overlay + paper noise grain + Islamic-style
                   geometric octagonal accent in the trailing top corner */
.ml-login-bg {
    min-height: 100vh; position: relative;
    background:
        radial-gradient(circle at 50% 25%, rgba(15, 42, 69, .60) 0%, transparent 50%),
        radial-gradient(circle at 14% 86%, rgba(10, 37, 64, .55) 0%, transparent 48%),
        radial-gradient(circle at 86% 92%, rgba(201, 169, 97, .14) 0%, transparent 55%),
        linear-gradient(135deg, var(--ml-navy-deep) 0%, var(--ml-navy) 35%, var(--ml-navy-2) 70%, #08203A 100%);
    overflow: hidden;
}

/* Drifting gold halo behind the card. */
.ml-login-bg::before {
    content: ""; position: absolute;
    width: 900px; height: 900px;
    top: -260px; right: -260px;
    border-radius: 50%;
    background:
        radial-gradient(circle, rgba(201, 169, 97, .28) 0%, rgba(201, 169, 97, .10) 30%, transparent 65%);
    pointer-events: none;
    filter: blur(28px);
    animation: ml-login-halo 22s ease-in-out infinite alternate;
}
@keyframes ml-login-halo {
    0%   { transform: translate3d(0,     0,    0) scale(1);    opacity: .85; }
    33%  { transform: translate3d(-50px, 40px, 0) scale(1.10); opacity: 1;   }
    66%  { transform: translate3d(30px, -30px, 0) scale(1.04); opacity: .92; }
    100% { transform: translate3d(-15px, 20px, 0) scale(1.08); opacity: .95; }
}

/* Composite texture layer — fine grid + SVG noise grain + a faint
   Islamic-style octagonal pattern anchored to the trailing top corner.
   All three are encoded as data URIs so nothing has to download. */
.ml-login-bg::after {
    content: ""; position: absolute; inset: 0;
    background-image:
        /* 1. SVG noise grain for paper feel */
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 0.84  0 0 0 0 0.5  0 0 0 0.4 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.5'/></svg>"),
        /* 2. Octagonal lattice anchored top-trailing (gold thin lines) */
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'><g fill='none' stroke='%23C9A961' stroke-width='0.5' opacity='0.22'><polygon points='40,8 56,16 64,32 56,48 40,56 24,48 16,32 24,16'/><polygon points='40,20 50,25 55,35 50,45 40,50 30,45 25,35 30,25'/></g></svg>"),
        /* 3. Fine grid */
        linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
    background-size: 200px 200px, 80px 80px, 32px 32px, 32px 32px;
    background-position: 0 0, top right, 0 0, 0 0;
    background-repeat: repeat, repeat, repeat, repeat;
    pointer-events: none;
    /* Fade everything from the edges → centre so the card sits on clean navy. */
    mask-image: radial-gradient(ellipse 100% 100% at 50% 50%, rgba(0,0,0,.15) 0%, rgba(0,0,0,.5) 35%, #000 100%);
    -webkit-mask-image: radial-gradient(ellipse 100% 100% at 50% 50%, rgba(0,0,0,.15) 0%, rgba(0,0,0,.5) 35%, #000 100%);
}

/* Login content (card + footer) needs to sit above the decorative layers. */
.ml-login-bg > * { position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) {
    .ml-login-bg::before { animation: none; }
}
.ml-login-card {
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(14px);
    box-shadow: 0 30px 80px rgba(0,0,0,0.35) !important;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 20px !important;
}
.ml-login-brand {
    width: 84px; height: 84px; margin: 0 auto;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ml-navy) 0%, var(--ml-navy-2) 100%);
    display: flex; align-items: center; justify-content: center;
    color: var(--ml-gold);
    box-shadow: 0 12px 30px rgba(10,37,64,0.35);
    position: relative;
}
.ml-login-brand::before {
    content: ""; position: absolute; inset: -4px;
    border-radius: 50%;
    border: 1px solid rgba(201,169,97,0.4);
}
.ml-login-firm {
    font-family: 'Cairo', sans-serif;
    font-size: 1.85rem; font-weight: 800;
    color: var(--ml-text); text-align: center;
}
.ml-login-tag {
    font-size: .8rem; color: var(--ml-gold-dark);
    text-align: center; font-weight: 700;
}
.ml-login-foot { text-align: center; color: rgba(255,255,255,0.6); font-size: .8rem; padding: 16px; position: relative; }

/* === Table polish ====================================================== */
.mud-table-root .mud-table-head .mud-table-cell {
    background: #F8FAFC !important;
    color: var(--ml-muted) !important;
    font-weight: 700; font-size: .82rem;
    font-family: 'Cairo', sans-serif;
}
.mud-table-root .mud-table-row .mud-table-cell { font-family: 'Tajawal', sans-serif; }

/* === Empty state ======================================================= */
.ml-empty { text-align: center; padding: 48px 16px; color: var(--ml-muted); }
.ml-empty-ico {
    width: 64px; height: 64px; margin: 0 auto 12px;
    border-radius: 50%; background: #F1F5F9;
    display: flex; align-items: center; justify-content: center;
    color: var(--ml-muted);
}
.ml-empty-title { font-family: 'Cairo', sans-serif; font-size: 1.15rem; color: var(--ml-text); margin-bottom: 4px; font-weight: 700; }
.ml-empty-sub { font-size: .9rem; }

/* === RTL drawer / nav adjustments ====================================== */
.mud-drawer.mud-drawer-pos-left { right: 0; left: auto; }
.mud-nav-link { font-family: 'Tajawal', sans-serif; }

/* === Save-in-progress overlay ========================================= */
/* Fullscreen scrim shown while a multi-step action (case create + email +
   uploads) is in flight. Branded with the navy/gold palette and a slow
   rotating ring so the user gets clear "still working" feedback. */
.ml-save-overlay {
    position: fixed; inset: 0;
    background: rgba(10, 37, 64, .55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1500;
    animation: ml-overlay-fade .18s ease-out;
}
@keyframes ml-overlay-fade {
    from { opacity: 0; } to { opacity: 1; }
}
.ml-save-card {
    background: #FFFFFF;
    border-radius: 18px;
    padding: 28px 32px;
    min-width: 320px; max-width: 90vw;
    text-align: center;
    box-shadow: 0 28px 64px rgba(10, 37, 64, .35),
                0 0 0 1px rgba(201, 169, 97, .35);
    font-family: 'Tajawal', sans-serif;
}
.ml-save-ring {
    width: 56px; height: 56px;
    margin: 0 auto 14px;
    border-radius: 50%;
    border: 4px solid #E5E7EB;
    border-top-color: #C9A961;
    border-right-color: #0A2540;
    animation: ml-save-spin 1.1s linear infinite;
}
@keyframes ml-save-spin { to { transform: rotate(360deg); } }
.ml-save-phase {
    font-family: 'Cairo', sans-serif;
    font-weight: 800;
    color: #0A2540;
    font-size: 1.05rem;
    line-height: 1.45;
}
.ml-save-detail {
    margin-top: 6px;
    color: #475569;
    font-size: .9rem;
    line-height: 1.6;
}
.ml-save-hint {
    margin-top: 14px;
    color: #94A3B8;
    font-size: .78rem;
    padding-top: 10px;
    border-top: 1px dashed #E5E7EB;
}

/* === Scroll-reveal animation =========================================== */
/* Elements start hidden (opacity 0, slid down 18px) and transition into
   view when an IntersectionObserver (see app.js → mlInterop.reveal) adds
   the .in-view class — so each section fades in only when it scrolls into
   the viewport, not all at once on first render. */
/* Slowed-down version (per user request: more pronounced reveal).
   Duration bumped from 0.55s → 0.85s. Stagger gap between children
   doubled (~120ms apart instead of ~60ms) so the cascade reads as a
   deliberate wave rather than a quick flash. */
.ml-anim {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .85s cubic-bezier(.22, .61, .36, 1),
                transform .85s cubic-bezier(.22, .61, .36, 1);
    will-change: opacity, transform;
}
.ml-anim.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger wrapper: every direct child stays hidden until the wrapper
   itself enters view, then they cascade in via transition-delay. */
.ml-stagger > * {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .85s cubic-bezier(.22, .61, .36, 1),
                transform .85s cubic-bezier(.22, .61, .36, 1);
    will-change: opacity, transform;
}
.ml-stagger.in-view > * {
    opacity: 1;
    transform: translateY(0);
}
.ml-stagger.in-view > *:nth-child(1)  { transition-delay: .08s; }
.ml-stagger.in-view > *:nth-child(2)  { transition-delay: .20s; }
.ml-stagger.in-view > *:nth-child(3)  { transition-delay: .32s; }
.ml-stagger.in-view > *:nth-child(4)  { transition-delay: .44s; }
.ml-stagger.in-view > *:nth-child(5)  { transition-delay: .56s; }
.ml-stagger.in-view > *:nth-child(6)  { transition-delay: .68s; }
.ml-stagger.in-view > *:nth-child(7)  { transition-delay: .80s; }
.ml-stagger.in-view > *:nth-child(8)  { transition-delay: .92s; }
.ml-stagger.in-view > *:nth-child(9)  { transition-delay: 1.04s; }
.ml-stagger.in-view > *:nth-child(10) { transition-delay: 1.16s; }
.ml-stagger.in-view > *:nth-child(11) { transition-delay: 1.28s; }
.ml-stagger.in-view > *:nth-child(12) { transition-delay: 1.40s; }

/* Per-section delays applied AFTER .in-view fires, so the title row inside
   a section briefly trails the panel intro for a layered effect. Spaced
   out (~150-200ms apart) so a long dashboard reads as a proper wave. */
.ml-anim.ml-anim-delay-1.in-view { transition-delay: .12s; }
.ml-anim.ml-anim-delay-2.in-view { transition-delay: .26s; }
.ml-anim.ml-anim-delay-3.in-view { transition-delay: .40s; }
.ml-anim.ml-anim-delay-4.in-view { transition-delay: .54s; }
.ml-anim.ml-anim-delay-5.in-view { transition-delay: .68s; }
.ml-anim.ml-anim-delay-6.in-view { transition-delay: .82s; }

/* Respect users who've asked the OS to reduce motion — skip the animation. */
@media (prefers-reduced-motion: reduce) {
    .ml-anim, .ml-stagger > * {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

/* === API status badge ================================================== */
/* Pill rendered next to the brand on the login screen and in the app bar
   header. Three colour treatments matching the State enum in
   ApiStatusBadge.razor. */
.ml-api-status {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(10, 37, 64, .12);
    box-shadow: 0 2px 8px rgba(10, 37, 64, .08);
    font-family: 'Cairo', sans-serif;
    font-size: .78rem;
    font-weight: 700;
    color: #0F172A;
    line-height: 1;
    transition: background .2s, border-color .2s, color .2s;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.ml-api-status.compact { padding: 6px; }
.ml-api-status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 0 currentColor;
}
.ml-api-status-label { white-space: nowrap; }
.ml-api-status-latency {
    color: #94A3B8;
    font-weight: 600;
    font-size: .7rem;
    padding-inline-start: 4px;
    border-inline-start: 1px solid #E5E7EB;
}

/* — Online (green) — */
.ml-api-status.online { color: #065F46; border-color: rgba(13, 138, 85, .35); }
.ml-api-status.online .ml-api-status-dot {
    background: #0d8a55;
    animation: ml-api-pulse-green 2.4s ease-out infinite;
}
@keyframes ml-api-pulse-green {
    0%   { box-shadow: 0 0 0 0   rgba(13, 138, 85, .55); }
    70%  { box-shadow: 0 0 0 7px rgba(13, 138, 85, 0); }
    100% { box-shadow: 0 0 0 0   rgba(13, 138, 85, 0); }
}

/* — Offline (red) — */
.ml-api-status.offline { color: #9F1239; border-color: rgba(159, 18, 57, .45); background: rgba(255, 241, 242, .96); }
.ml-api-status.offline .ml-api-status-dot {
    background: #9F1239;
    animation: ml-api-blink-red 1.2s ease-in-out infinite;
}
@keyframes ml-api-blink-red {
    0%, 100% { opacity: 1; }
    50%      { opacity: .35; }
}

/* — Checking (gold) — */
.ml-api-status.checking { color: #78350F; border-color: rgba(201, 169, 97, .45); background: rgba(254, 243, 199, .96); }
.ml-api-status.checking .ml-api-status-dot {
    background: #C9A961;
    animation: ml-api-pulse-gold 1.2s ease-in-out infinite;
}
@keyframes ml-api-pulse-gold {
    0%, 100% { transform: scale(1);   opacity: 1; }
    50%      { transform: scale(1.4); opacity: .55; }
}

/* On the navy app bar, swap the background to a darker tinted glass so the
   pill stays legible against the deep blue. */
.mud-appbar .ml-api-status {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .22);
    color: #FFFFFF;
}
.mud-appbar .ml-api-status.online   { color: #BBF7D0; border-color: rgba(187, 247, 208, .35); }
.mud-appbar .ml-api-status.offline  { color: #FECDD3; border-color: rgba(254, 205, 211, .45); background: rgba(159, 18, 57, .25); }
.mud-appbar .ml-api-status.checking { color: #FEF3C7; border-color: rgba(254, 243, 199, .45); background: rgba(201, 169, 97, .22); }
.mud-appbar .ml-api-status-latency  { color: rgba(255, 255, 255, .55); border-inline-start-color: rgba(255, 255, 255, .2); }

/* === Notification bell ================================================= */
/* Pill-style icon button that lives in the navy AppBar. Badge sits on the
   trailing edge (RTL → visually top-left) and uses three colour variants
   matching the severity buckets in the API feed. */
.ml-notif-trigger {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .18);
    color: #FFFFFF;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .15s;
}
.ml-notif-trigger:hover { background: rgba(255, 255, 255, .18); transform: translateY(-1px); }
.ml-notif-trigger:active { transform: scale(.96); }

.ml-notif-badge {
    position: absolute;
    top: -3px; inset-inline-end: -3px;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    color: #FFFFFF;
    font-family: 'Cairo', sans-serif;
    font-weight: 800;
    font-size: .68rem;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px #0A2540;   /* ring matches the AppBar so the badge looks "cut out" */
}
.ml-notif-badge.info    { background: #1D4ED8; }
.ml-notif-badge.warning { background: #C2410C; }
.ml-notif-badge.error   { background: #9F1239; animation: ml-notif-pulse 1.6s ease-in-out infinite; }
@keyframes ml-notif-pulse {
    0%, 100% { transform: scale(1);    box-shadow: 0 0 0 2px #0A2540, 0 0 0 0   rgba(159,18,57,.6); }
    50%      { transform: scale(1.08); box-shadow: 0 0 0 2px #0A2540, 0 0 0 5px rgba(159,18,57,0); }
}

/* Popover content (MudMenu fills it via PopoverClass="ml-notif-popover"). */
.ml-notif-popover { min-width: 360px !important; max-width: 420px !important; border-radius: 14px !important; overflow: hidden !important; }

.ml-notif-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #0A2540 0%, #0F2A45 100%);
    border-bottom: 1px solid rgba(201,169,97,.25);
}
.ml-notif-header-ico {
    width: 32px; height: 32px;
    border-radius: 10px;
    background: rgba(201,169,97,.18);
    color: #C9A961;
    display: flex; align-items: center; justify-content: center;
}
.ml-notif-refresh {
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.20);
    color: #FFFFFF;
    border-radius: 8px;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background .15s;
}
.ml-notif-refresh:hover { background: rgba(255,255,255,.20); }
.ml-notif-refresh[disabled] { opacity: .55; cursor: default; }
@keyframes ml-spin { to { transform: rotate(360deg); } }

.ml-notif-empty {
    padding: 38px 22px;
    text-align: center;
    background: #FFFFFF;
}

.ml-notif-list {
    max-height: 460px;
    overflow-y: auto;
    background: #FFFFFF;
    padding: 6px 6px 10px;
}

.ml-notif-section {
    font-family: 'Cairo', sans-serif;
    font-size: .72rem;
    font-weight: 800;
    color: #64748B;
    letter-spacing: .3px;
    text-transform: uppercase;
    padding: 12px 12px 6px;
    display: flex; align-items: center; gap: 8px;
}
.ml-notif-section-count {
    background: #F1F5F9;
    color: #475569;
    border-radius: 999px;
    padding: 1px 8px;
    font-size: .65rem;
}

.ml-notif-item {
    display: flex; align-items: flex-start; gap: 12px;
    width: 100%;
    background: transparent;
    border: 1.5px solid transparent;
    border-radius: 10px;
    padding: 10px 10px;
    margin: 2px 0;
    cursor: pointer;
    text-align: start;
    color: #0F172A;
    font-family: 'Tajawal', sans-serif;
    transition: background .12s, border-color .12s;
}
.ml-notif-item:hover { background: #F8FAFC; border-color: #E5E7EB; }

.ml-notif-item-ico {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: #E3ECF5;
    color: #0A2540;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}
.ml-notif-item.info    .ml-notif-item-ico { background: #DBEAFE; color: #1D4ED8; }
.ml-notif-item.warning .ml-notif-item-ico { background: #FFF7ED; color: #C2410C; }
.ml-notif-item.error   .ml-notif-item-ico { background: #FFE4E6; color: #9F1239; }

.ml-notif-item-body { flex: 1; min-width: 0; }
.ml-notif-item-title {
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    color: #0F172A;
    font-size: .92rem;
    line-height: 1.3;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ml-notif-item-sub {
    font-size: .78rem;
    color: #475569;
    margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ml-notif-item-time {
    font-size: .7rem;
    color: #94A3B8;
    margin-top: 4px;
}

/* ========================================================================
   Top bar — nothing wraps.
   The brand, the firm chip and the user chip used to break onto several
   lines and spill out of the bar when it got narrow (a long firm name, the
   side menu open, a small window). Now every label stays on one line, a
   long firm name shortens with an ellipsis (the full name is its tooltip),
   and the labels that matter least step aside as the bar itself narrows.
   The rules follow the width of the bar, not of the window, because the
   open side menu takes its share of the window.
   ======================================================================== */
.mud-appbar { container-type: inline-size; container-name: mlbar; }
.mud-appbar .mud-toolbar { flex-wrap: nowrap; min-width: 0; }
.mud-appbar .ml-gs-trigger { min-width: 0; }
.mud-appbar .ml-gs-trigger-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mud-appbar .ml-gs-trigger-kbd { white-space: nowrap; flex-shrink: 0; }

.ml-bar-brand { flex-shrink: 0; }
.ml-bar-brand-text { white-space: nowrap; }

.ml-bar-firm { flex: 0 1 auto; min-width: 0; max-width: 260px; white-space: nowrap; }
.ml-bar-firm .mud-icon-root { flex-shrink: 0; }
.ml-bar-firm-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ml-bar-user { flex-shrink: 0; }
.ml-bar-user-text { white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }

@container mlbar (max-width: 1180px) {
    .ml-bar-firm { max-width: 190px; }
    .mud-appbar .ml-gs-trigger-kbd { display: none; }
}
@container mlbar (max-width: 980px) {
    /* the firm chip keeps its icon; its name is still in the tooltip and in the user menu */
    .ml-bar-firm { padding: 6px !important; }
    .ml-bar-firm-name { display: none; }
    .ml-bar-user-text { display: none; }
    .ml-bar-user { padding: 4px !important; }
}
@container mlbar (max-width: 760px) {
    .ml-bar-brand-text { display: none; }
    .mud-appbar .ml-gs-trigger-text { display: none; }
    .mud-appbar .ml-gs-trigger { flex: 0 0 auto; margin: 0 6px; }
}

/* ========================================================================
   ml-small-inputs: every field in the small size, as in the municipal
   maintenance system. The dense height (40px) comes from
   MudGlobal.InputDefaults.Margin in Program.cs; this makes the text, the
   label, the helper line and the adornment icons small to match.
   ======================================================================== */
.mud-input-control .mud-input,
.mud-input-control .mud-input-label,
.mud-input-control > .mud-input-control-input-container > .mud-input-label-inputcontrol,
.mud-input-control .mud-select-input,
.mud-input-control .mud-input-slot { font-size: .9rem; }
.mud-input-control .mud-input-helper-text { font-size: .72rem; }
.mud-input-control .mud-input-adornment .mud-icon-root,
.mud-input-control .mud-select .mud-icon-root { font-size: 1.15rem; }
.mud-input-control .mud-input-outlined input,
.mud-input-control .mud-input-outlined .mud-select-input { padding-top: 9.5px; padding-bottom: 9.5px; }
.mud-input-control textarea.mud-input-slot { padding-top: 8px; padding-bottom: 8px; }
/* the lists a select or autocomplete opens */
.mud-popover .mud-list-item { min-height: 36px; }
.mud-popover .mud-list-item-text .mud-typography { font-size: .875rem; }

/* ========================================================================
   ml-phone: what the phone-width check (375px) turned up.
   ======================================================================== */
@media (max-width: 600px) {
    /* a table shown as cards: a cell with several chips or buttons wraps instead of widening the card */
    .mud-xs-table .mud-table-body .mud-table-cell,
    .mud-sm-table .mud-table-body .mud-table-cell { white-space: normal; flex-wrap: wrap; row-gap: 4px; }
    .mud-xs-table .mud-table-body .mud-table-cell .mud-chip,
    .mud-sm-table .mud-table-body .mud-table-cell .mud-chip { margin: 2px; }
    .mud-table-container { overflow-x: auto; }
    /* the new-case stepper: the five titles fit when their second lines are left out */
    .mud-stepper-nav .mud-step-label-content .mud-typography-body2,
    .mud-stepper-nav .mud-step-label-content .mud-typography-caption { display: none; }
    .mud-stepper-nav .mud-step { padding-inline: 6px; }
    /* dialogs use the whole width of the phone */
    .mud-dialog-container .mud-dialog { margin: 8px; width: calc(100vw - 16px); max-width: calc(100vw - 16px) !important; }
    .mud-dialog-container .mud-dialog .mud-dialog-content { padding: 12px 14px; }
    .mud-dialog-container .mud-dialog .mud-dialog-actions { flex-wrap: wrap; gap: 6px; }
}

/* ========================================================================
   ml-motion: entrance animations on every page (Majed, 2026-11-18: "add some
   animation"), CSS only, like the municipal maintenance system. Each kind of
   element rises or pops in once when it appears, the rows one after another.
   Off for people who asked their system for less motion.
   ======================================================================== */
@media (prefers-reduced-motion: no-preference) {
    @keyframes mlRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
    @keyframes mlPop  { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
    @keyframes mlSlide { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
    @keyframes mlGrowX { from { transform: scaleX(0); } to { transform: scaleX(1); } }

    /* the blocks of a page, top to bottom */
    .mud-main-content > .mud-container > * { animation: mlRise .55s cubic-bezier(.2,.8,.2,1) both; }
    .mud-main-content > .mud-container > *:nth-child(2) { animation-delay: .06s; }
    .mud-main-content > .mud-container > *:nth-child(3) { animation-delay: .12s; }
    .mud-main-content > .mud-container > *:nth-child(4) { animation-delay: .18s; }
    .mud-main-content > .mud-container > *:nth-child(5) { animation-delay: .24s; }
    .mud-main-content > .mud-container > *:nth-child(n+6) { animation-delay: .3s; }

    /* cards and tiles */
    .mud-main-content .ml-kpi,
    .mud-main-content .ml-qa,
    .mud-main-content .mud-grid > .mud-grid-item > .mud-paper,
    .mud-main-content .mud-grid > .mud-grid-item > .mud-card { animation: mlPop .5s cubic-bezier(.2,.8,.2,1) both; }
    .mud-main-content .mud-grid > .mud-grid-item:nth-child(2) > *, .mud-main-content .ml-stagger > :nth-child(2) > * { animation-delay: .07s; }
    .mud-main-content .mud-grid > .mud-grid-item:nth-child(3) > *, .mud-main-content .ml-stagger > :nth-child(3) > * { animation-delay: .14s; }
    .mud-main-content .mud-grid > .mud-grid-item:nth-child(4) > *, .mud-main-content .ml-stagger > :nth-child(4) > * { animation-delay: .21s; }
    .mud-main-content .mud-grid > .mud-grid-item:nth-child(n+5) > *, .mud-main-content .ml-stagger > :nth-child(n+5) > * { animation-delay: .28s; }

    /* table rows and list rows, one after another (the first dozen; the rest appear at once) */
    .mud-main-content .mud-table-body .mud-table-row,
    .mud-main-content .mud-list > .mud-list-item { animation: mlSlide .4s ease-out both; }
    .mud-main-content .mud-table-body .mud-table-row:nth-child(2),  .mud-main-content .mud-list > .mud-list-item:nth-child(2)  { animation-delay: .04s; }
    .mud-main-content .mud-table-body .mud-table-row:nth-child(3),  .mud-main-content .mud-list > .mud-list-item:nth-child(3)  { animation-delay: .08s; }
    .mud-main-content .mud-table-body .mud-table-row:nth-child(4),  .mud-main-content .mud-list > .mud-list-item:nth-child(4)  { animation-delay: .12s; }
    .mud-main-content .mud-table-body .mud-table-row:nth-child(5),  .mud-main-content .mud-list > .mud-list-item:nth-child(5)  { animation-delay: .16s; }
    .mud-main-content .mud-table-body .mud-table-row:nth-child(6),  .mud-main-content .mud-list > .mud-list-item:nth-child(6)  { animation-delay: .20s; }
    .mud-main-content .mud-table-body .mud-table-row:nth-child(7),  .mud-main-content .mud-list > .mud-list-item:nth-child(7)  { animation-delay: .24s; }
    .mud-main-content .mud-table-body .mud-table-row:nth-child(8),  .mud-main-content .mud-list > .mud-list-item:nth-child(8)  { animation-delay: .28s; }
    .mud-main-content .mud-table-body .mud-table-row:nth-child(9),  .mud-main-content .mud-list > .mud-list-item:nth-child(9)  { animation-delay: .32s; }
    .mud-main-content .mud-table-body .mud-table-row:nth-child(10), .mud-main-content .mud-list > .mud-list-item:nth-child(10) { animation-delay: .36s; }
    .mud-main-content .mud-table-body .mud-table-row:nth-child(11), .mud-main-content .mud-list > .mud-list-item:nth-child(11) { animation-delay: .40s; }
    .mud-main-content .mud-table-body .mud-table-row:nth-child(12), .mud-main-content .mud-list > .mud-list-item:nth-child(12) { animation-delay: .44s; }

    /* dashboard bars grow from their start, the side menu slides in once */
    .mud-main-content .mud-progress-linear .mud-progress-linear-bar { transform-origin: 100% 50%; animation: mlGrowX .9s cubic-bezier(.2,.8,.2,1) both .2s; }
    html[dir="ltr"] .mud-main-content .mud-progress-linear .mud-progress-linear-bar { transform-origin: 0 50%; }
    .mud-drawer .mud-nav-link { animation: mlSlide .35s ease-out both; }
    .mud-drawer .mud-nav-link:nth-child(2) { animation-delay: .03s; } .mud-drawer .mud-nav-link:nth-child(3) { animation-delay: .06s; }
    .mud-drawer .mud-nav-link:nth-child(4) { animation-delay: .09s; } .mud-drawer .mud-nav-link:nth-child(5) { animation-delay: .12s; }
    .mud-drawer .mud-nav-link:nth-child(n+6) { animation-delay: .15s; }

    /* windows open with a small lift; buttons and tiles answer the pointer */
    .mud-dialog-container .mud-dialog { animation: mlPop .28s cubic-bezier(.2,.8,.2,1) both; }
    .mud-button-root.mud-button-filled, .mud-button-root.mud-button-outlined { transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease; }
    .mud-button-root.mud-button-filled:hover, .mud-button-root.mud-button-outlined:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(10,37,64,.14); }
    .mud-button-root.mud-button-filled:active, .mud-button-root.mud-button-outlined:active { transform: translateY(0) scale(.98); }
    .mud-main-content .mud-paper.mud-card, .mud-main-content .ml-qa { transition: transform .2s ease, box-shadow .2s ease; }
    .mud-main-content .mud-paper.mud-card:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(10,37,64,.10); }
    .mud-table-hover .mud-table-body .mud-table-row { transition: background-color .15s ease; }
    .mud-nav-link .mud-icon-root { transition: transform .2s ease; }
    .mud-nav-link:hover .mud-icon-root { transform: scale(1.12); }
}
