/* MUNTIJI_GLOBAL_THEME_R9C1 */

.muntiji-global-theme-toggle{
    position:fixed;
    inset-inline-start:18px;
    bottom:18px;
    z-index:2147483000;

    width:48px;
    height:48px;
    padding:0;

    display:grid;
    place-items:center;

    border:1px solid var(--mui2-border, #d8e0ec);
    border-radius:15px;
    background:var(--mui2-bg-surface, #ffffff);
    color:var(--mui2-text-primary, #111827);

    box-shadow:0 12px 30px rgba(15,23,42,.16);
    cursor:pointer;
}

html[data-muntiji-color-mode="dark"]
.muntiji-global-theme-toggle{
    background:#172033;
    border-color:#334155;
    color:#f8fafc;
}

[data-muntiji-theme-switch],
[data-mui-theme-toggle]{
    display:none !important;
}

@media (max-width:720px){
    .muntiji-global-theme-toggle{
        inset-inline-start:12px;
        bottom:12px;
        width:44px;
        height:44px;
    }
}

/* MUNTIJI_GLOBAL_THEME_R9C2_HEADER */
.m3-topbar .muntiji-global-theme-toggle{
    position:static;
    inset:auto;
    bottom:auto;

    flex:0 0 auto;
    width:42px;
    height:42px;

    border-radius:12px;
    box-shadow:none;
}

.m3-topbar .muntiji-global-theme-toggle:hover{
    transform:none;
    box-shadow:0 4px 14px rgba(15,23,42,.10);
}

@media (max-width:720px){
    .m3-topbar .muntiji-global-theme-toggle{
        position:static;
        width:40px;
        height:40px;
    }
}

/* MUNTIJI_GLOBAL_THEME_R9C3_HEADER_PLACEMENT */
.m3-account .muntiji-global-theme-toggle,
.public-actions .muntiji-global-theme-toggle,
.login-language-box + .muntiji-global-theme-toggle,
.row > .muntiji-global-theme-toggle{
    position:static;
    inset:auto;
    bottom:auto;
    flex:0 0 auto;
    width:42px;
    height:42px;
    border-radius:12px;
    box-shadow:none;
}

/* MUNTIJI_GLOBAL_THEME_R9C4_REGISTER */
.register-header-actions .muntiji-global-theme-toggle{
    position:static;
    inset:auto;
    bottom:auto;
    flex:0 0 auto;
    width:42px;
    height:42px;
    border-radius:12px;
    box-shadow:none;
}

/* =========================================================
   MUNTIJI GLOBAL THEME R9C6
   CENTRAL LIGHT / DARK TOKEN BRIDGE

   Canonical runtime selector:
   html[data-muntiji-color-mode="light|dark"]

   Compatibility selector:
   html[data-mui-theme="light|dark"]
   ========================================================= */

/* ---------- LIGHT ---------- */

html[data-muntiji-color-mode="light"],
html[data-mui-theme="light"]{
    color-scheme:light;

    --mui-bg-page:#f4f7fb;
    --mui-bg-subtle:#eef3f9;

    --mui-surface:#ffffff;
    --mui-surface-raised:#ffffff;
    --mui-surface-soft:#f8fafc;

    --mui-text-primary:#111827;
    --mui-text-secondary:#64748b;
    --mui-text-muted:#94a3b8;
    --mui-text-inverse:#ffffff;

    --mui-border-default:#dbe3ee;
    --mui-border-strong:#cbd5e1;

    --mui-brand-50:#eef4ff;
    --mui-brand-100:#dbe7ff;
    --mui-brand-200:#b9ceff;
    --mui-brand-600:#3158df;
    --mui-brand-700:#244bcf;

    --mui-info:#3b82f6;
    --mui-info-100:#dbeafe;
    --mui-info-700:#1d4ed8;
    --mui-info-soft:#eff6ff;

    --mui-success:#22c55e;
    --mui-success-50:#f0fdf4;
    --mui-success-100:#dcfce7;
    --mui-success-600:#16a34a;
    --mui-success-700:#15803d;
    --mui-success-soft:#f0fdf4;

    --mui-warning:#f59e0b;
    --mui-warning-100:#fef3c7;
    --mui-warning-700:#b45309;
    --mui-warning-soft:#fffbeb;

    --mui-danger:#dc2626;
    --mui-danger-50:#fef2f2;
    --mui-danger-100:#fee2e2;
    --mui-danger-700:#b91c1c;

    --mui-neutral-100:#f1f5f9;
    --mui-neutral-300:#cbd5e1;
    --mui-neutral-700:#334155;
    --mui-neutral-900:#0f172a;

    --mui-focus-ring:rgba(49,88,223,.18);
}


/* ---------- DARK ---------- */

html[data-muntiji-color-mode="dark"],
html[data-mui-theme="dark"]{
    color-scheme:dark;

    --mui-bg-page:#08111f;
    --mui-bg-subtle:#0d1728;

    --mui-surface:#111c2f;
    --mui-surface-raised:#162238;
    --mui-surface-soft:#18253a;

    --mui-text-primary:#f1f5f9;
    --mui-text-secondary:#b6c2d2;
    --mui-text-muted:#8fa0b7;
    --mui-text-inverse:#ffffff;

    --mui-border-default:#2b3a51;
    --mui-border-strong:#40516a;

    --mui-brand-50:#152448;
    --mui-brand-100:#1b3060;
    --mui-brand-200:#3155a6;
    --mui-brand-600:#5b82f5;
    --mui-brand-700:#82a2ff;

    --mui-info:#60a5fa;
    --mui-info-100:#17355b;
    --mui-info-700:#93c5fd;
    --mui-info-soft:#102947;

    --mui-success:#4ade80;
    --mui-success-50:#102a20;
    --mui-success-100:#153c2a;
    --mui-success-600:#22c55e;
    --mui-success-700:#86efac;
    --mui-success-soft:#102a20;

    --mui-warning:#fbbf24;
    --mui-warning-100:#493515;
    --mui-warning-700:#fde68a;
    --mui-warning-soft:#30230f;

    --mui-danger:#f87171;
    --mui-danger-50:#351719;
    --mui-danger-100:#542024;
    --mui-danger-700:#fca5a5;

    --mui-neutral-100:#172236;
    --mui-neutral-300:#8291a7;
    --mui-neutral-700:#cbd5e1;
    --mui-neutral-900:#f1f5f9;

    --mui-focus-ring:rgba(91,130,245,.30);
}


/* ---------- GLOBAL DOCUMENT ---------- */

html[data-muntiji-color-mode="dark"] body{
    background-color:var(--mui-bg-page);
    color:var(--mui-text-primary);
}


/*
 * Legacy dashboard compatibility.
 *
 * Some older pages define their own --text/--muted/--bg variables.
 * Redirect those variables to the central contract in dark mode.
 */
html[data-muntiji-color-mode="dark"]{
    --text:var(--mui-text-primary);
    --muted:var(--mui-text-secondary);
    --bg:var(--mui-bg-page);
    --card:var(--mui-surface);
    --border:var(--mui-border-default);
    --navy:var(--mui-text-primary);
    --soft:var(--mui-bg-subtle);
}


/* ---------- CLIENT PORTAL ---------- */

html[data-muntiji-color-mode="dark"] .client-sidebar,
html[data-muntiji-color-mode="dark"] .client-topbar{
    background:var(--mui-surface);
    color:var(--mui-text-primary);
    border-color:var(--mui-border-default);
}


/* ---------- CLIENT DASHBOARD ---------- */

html[data-muntiji-color-mode="dark"] .topbar{
    background:rgba(17,28,47,.94);
    color:var(--mui-text-primary);
}

html[data-muntiji-color-mode="dark"] .card,
html[data-muntiji-color-mode="dark"] .summary-card,
html[data-muntiji-color-mode="dark"] .stat-card{
    color:var(--mui-text-primary);
}


/* ---------- REGISTER ---------- */

/*
 * Preserve the blue showcase identity.
 * Only convert the white form surface and its controls.
 */
html[data-muntiji-color-mode="dark"] .muntiji-register-page{
    background:var(--mui-bg-page);
    color:var(--mui-text-primary);
}

html[data-muntiji-color-mode="dark"] .muntiji-register-page .register-shell,
html[data-muntiji-color-mode="dark"] .muntiji-register-page .register-card{
    background:var(--mui-surface);
    color:var(--mui-text-primary);
}

html[data-muntiji-color-mode="dark"] .muntiji-register-page
:is(
    .register-card-head h1,
    .register-section-title,
    .register-field label,
    .register-security,
    .register-card-foot
){
    color:var(--mui-text-primary);
}

html[data-muntiji-color-mode="dark"] .muntiji-register-page
:is(
    .register-card-head p,
    .register-field-note,
    .register-divider,
    .register-divider span
){
    color:var(--mui-text-secondary);
}

html[data-muntiji-color-mode="dark"] .muntiji-register-page
:is(
    input,
    select
){
    background:var(--mui-surface-raised);
    color:var(--mui-text-primary);
    border-color:var(--mui-border-default);
}

html[data-muntiji-color-mode="dark"] .muntiji-register-page
:is(
    input,
    select
)::placeholder{
    color:var(--mui-text-muted);
}


/* ---------- FORM NATIVE CONTROLS ---------- */

html[data-muntiji-color-mode="dark"]
:is(input,textarea,select){
    color-scheme:dark;
}


/* ---------- TRANSITIONS ---------- */

@media (prefers-reduced-motion:no-preference){
    body,
    .client-sidebar,
    .client-topbar,
    .topbar,
    .register-shell,
    .register-card{
        transition:
            background-color .18s ease,
            border-color .18s ease,
            color .18s ease;
    }
}


/* =========================================================
   MUNTIJI GLOBAL THEME R9C7-B
   DARK CONTRAST COMPATIBILITY BRIDGE

   Purpose:
   - central dark-mode contrast correction
   - preserve official blue showcase surfaces
   - bridge legacy page-local color contracts
   ========================================================= */


/* ---------------------------------------------------------
   1. PUBLIC HOME
   --------------------------------------------------------- */

html[data-muntiji-color-mode="dark"] .public-home{
    background:var(--mui-bg-page);
    color:var(--mui-text-primary);
}

html[data-muntiji-color-mode="dark"] .public-header{
    background:var(--mui-surface);
    border-color:var(--mui-border-default);
}

html[data-muntiji-color-mode="dark"]
.public-header :is(
    .public-brand,
    .public-brand__text,
    .public-brand__text strong,
    .public-nav a
){
    color:var(--mui-text-primary);
}

html[data-muntiji-color-mode="dark"]
.public-brand__text span{
    color:var(--mui-text-secondary);
}

html[data-muntiji-color-mode="dark"] .hero__panel{
    background:var(--mui-surface);
    border-color:var(--mui-border-default);
}

html[data-muntiji-color-mode="dark"]
.hero__content{
    color:var(--mui-text-primary);
}

html[data-muntiji-color-mode="dark"]
.hero__content :is(h1,h2,h3,strong){
    color:var(--mui-text-primary);
}

html[data-muntiji-color-mode="dark"]
.hero__content p{
    color:var(--mui-text-secondary);
}

html[data-muntiji-color-mode="dark"]
.hero__content .hero__eyebrow{
    background:var(--mui-brand-50);
    border-color:var(--mui-brand-200);
    color:var(--mui-brand-700);
}

html[data-muntiji-color-mode="dark"]
.hero__content :is(
    .hero__feature,
    .hero__stat,
    .hero__benefit
){
    background:var(--mui-surface-soft);
    border-color:var(--mui-border-default);
    color:var(--mui-text-primary);
}


/* ---------------------------------------------------------
   2. LOGIN
   Bridge legacy --mt-* contract into central tokens.
   Blue showcase intentionally remains unchanged.
   --------------------------------------------------------- */

html[data-muntiji-color-mode="dark"]{
    --mt-canvas:var(--mui-bg-page);

    --mt-surface:var(--mui-surface);

    --mt-ink-950:var(--mui-text-primary);
    --mt-ink-900:var(--mui-text-primary);
    --mt-ink-800:var(--mui-text-primary);
    --mt-ink-700:var(--mui-text-primary);
    --mt-ink-600:var(--mui-text-secondary);
    --mt-ink-500:var(--mui-text-muted);

    --mt-line:var(--mui-border-default);

    --mt-brand-50:var(--mui-brand-50);
    --mt-brand-200:var(--mui-brand-200);
    --mt-brand-500:var(--mui-brand-600);
    --mt-brand-600:var(--mui-brand-600);
    --mt-brand-700:var(--mui-brand-700);
    --mt-brand-800:var(--mui-brand-700);
}

html[data-muntiji-color-mode="dark"]
:is(.login-page,.muntiji-login-page){
    background:var(--mui-bg-page);
    color:var(--mui-text-primary);
}

html[data-muntiji-color-mode="dark"]
:is(.login-card,.auth-card,.login-form-side){
    background:var(--mui-surface);
    color:var(--mui-text-primary);
    border-color:var(--mui-border-default);
}

html[data-muntiji-color-mode="dark"]
:is(.login-card,.auth-card,.login-form-side)
:is(h1,h2,h3,label,strong){
    color:var(--mui-text-primary);
}

html[data-muntiji-color-mode="dark"]
:is(.login-card,.auth-card,.login-form-side)
:is(p,.muted,.help-text,.field-help){
    color:var(--mui-text-secondary);
}

html[data-muntiji-color-mode="dark"]
:is(.login-card,.auth-card,.login-form-side)
:is(input,select,textarea){
    background:var(--mui-surface-raised);
    color:var(--mui-text-primary);
    border-color:var(--mui-border-default);
}

html[data-muntiji-color-mode="dark"]
:is(.login-card,.auth-card,.login-form-side)
:is(input,textarea)::placeholder{
    color:var(--mui-text-muted);
}


/* ---------------------------------------------------------
   3. REGISTER
   Correct actual heading contract and form surface.
   --------------------------------------------------------- */

html[data-muntiji-color-mode="dark"]
.muntiji-register-page
.register-card-head :is(h1,h2,h3){
    color:var(--mui-text-primary);
}

html[data-muntiji-color-mode="dark"]
.muntiji-register-page
.register-card-head p{
    color:var(--mui-text-secondary);
}

html[data-muntiji-color-mode="dark"]
.muntiji-register-page
:is(
    .register-section-title,
    .register-field label
){
    color:var(--mui-text-primary);
}

html[data-muntiji-color-mode="dark"]
.muntiji-register-page
:is(
    .register-field small,
    .register-field-note,
    .register-divider,
    .register-divider span
){
    color:var(--mui-text-secondary);
}

html[data-muntiji-color-mode="dark"]
.muntiji-register-page
:is(
    .register-field input,
    .register-field select
){
    background:var(--mui-surface-raised);
    border-color:var(--mui-border-default);
    color:var(--mui-text-primary);
}


/* ---------------------------------------------------------
   4. CLIENT DASHBOARD
   Bridge legacy local theme variables.
   --------------------------------------------------------- */

html[data-muntiji-color-mode="dark"]{
    --text:var(--mui-text-primary);
    --muted:var(--mui-text-secondary);
    --bg:var(--mui-bg-page);
    --card:var(--mui-surface);
    --navy:var(--mui-text-primary);
}

html[data-muntiji-color-mode="dark"]
:is(
    .hero,
    .account-panel,
    .stat,
    .summary-card,
    .portal-empty-state
){
    background-color:var(--mui-surface);
    color:var(--mui-text-primary);
    border-color:var(--mui-border-default);
}

html[data-muntiji-color-mode="dark"]
:is(
    .hero,
    .account-panel,
    .stat,
    .summary-card,
    .portal-empty-state
)
:is(h1,h2,h3,strong,.value){
    color:var(--mui-text-primary);
}

html[data-muntiji-color-mode="dark"]
:is(
    .hero,
    .account-panel,
    .stat,
    .summary-card,
    .portal-empty-state
)
:is(p,.label,.hint,.status-line){
    color:var(--mui-text-secondary);
}


/* ---------------------------------------------------------
   5. IDENTITY / CHANGE PASSWORD
   Existing identity CSS already consumes --mui-*.
   Force only major neutral surfaces to central contract.
   Preserve the official blue showcase.
   --------------------------------------------------------- */

html[data-muntiji-color-mode="dark"]
:is(
    .identity-page,
    .identity-content,
    .identity-card,
    .password-form,
    .password-form-panel
){
    color:var(--mui-text-primary);
}

html[data-muntiji-color-mode="dark"]
:is(
    .identity-card,
    .password-form,
    .password-form-panel
){
    background:var(--mui-surface);
    border-color:var(--mui-border-default);
}

html[data-muntiji-color-mode="dark"]
:is(
    .identity-card,
    .password-form,
    .password-form-panel
)
:is(h1,h2,h3,label,strong){
    color:var(--mui-text-primary);
}

html[data-muntiji-color-mode="dark"]
:is(
    .identity-card,
    .password-form,
    .password-form-panel
)
:is(p,small,.muted,.help-text){
    color:var(--mui-text-secondary);
}


/* ---------------------------------------------------------
   6. CENTRAL DARK FORM CONTRACT
   Do not affect primary/action button colors.
   --------------------------------------------------------- */

html[data-muntiji-color-mode="dark"]
:is(
    .hero__content,
    .login-card,
    .auth-card,
    .login-form-side,
    .muntiji-register-page,
    .account-panel,
    .identity-card,
    .password-form,
    .password-form-panel
)
:is(input:not([type="submit"]):not([type="button"]),
    textarea,
    select){
    background-color:var(--mui-surface-raised);
    color:var(--mui-text-primary);
    border-color:var(--mui-border-default);
}

html[data-muntiji-color-mode="dark"]
:is(
    .hero__content,
    .login-card,
    .auth-card,
    .login-form-side,
    .muntiji-register-page,
    .account-panel,
    .identity-card,
    .password-form,
    .password-form-panel
)
:is(input,textarea)::placeholder{
    color:var(--mui-text-muted);
    opacity:1;
}


/* ---------------------------------------------------------
   7. DARK HEADER NEUTRAL SURFACES
   --------------------------------------------------------- */

html[data-muntiji-color-mode="dark"]
:is(
    .public-language-box,
    .login-language-box,
    .register-language-box
)
select{
    background:var(--mui-surface-raised);
    color:var(--mui-text-primary);
    border-color:var(--mui-border-default);
}


/* ---------------------------------------------------------
   8. LIGHT MODE GUARANTEE
   R9C7-B intentionally adds no light overrides.
   Existing page identity remains authoritative in light mode.
   --------------------------------------------------------- */


/* ============================================================
   MUNTIJI GLOBAL THEME R9C8-B
   Targeted dark surface + contrast compatibility repair

   Scope:
   - authenticated enterprise/client shells
   - dashboard
   - billing
   - owner/profile institutional pages

   Important:
   - no blanket DIV/SPAN recoloring
   - no public login/register brand-panel mutation
   - semantic status colors remain untouched
   ============================================================ */

html[data-muntiji-color-mode="dark"]{
    --muntiji-r9-page:var(--mui-bg-page, #07111f);
    --muntiji-r9-surface:var(--mui-surface, #101d31);
    --muntiji-r9-surface-2:var(--mui-surface-raised, #16243a);
    --muntiji-r9-border:var(--mui-border-default, #34445d);
    --muntiji-r9-text:var(--mui-text-primary, #f8fafc);
    --muntiji-r9-text-2:var(--mui-text-secondary, #cbd5e1);
    --muntiji-r9-muted:var(--mui-text-muted, #94a3b8);
}

/*
 * Authenticated shell canvas.
 * Fixes the pale/grey content canvas visible behind dashboard/profile.
 */
html[data-muntiji-color-mode="dark"] :is(
    .client-main,
    .client-content,
    .client-page,
    .dashboard-page,
    .dashboard-content,
    .m3-main,
    .m3-content,
    .m3-page,
    .enterprise-page,
    .enterprise-content,
    .page-shell,
    .page-content
){
    background-color:var(--muntiji-r9-page) !important;
    color:var(--muntiji-r9-text);
}

/*
 * Dashboard legacy token bridge.
 * client_dashboard.css still contains light-era values.
 */
html[data-muntiji-color-mode="dark"] :is(
    .dashboard-page,
    .dashboard-content
){
    --bg:var(--muntiji-r9-page);
    --surface:var(--muntiji-r9-surface);
    --card:var(--muntiji-r9-surface);
    --text:var(--muntiji-r9-text);
    --muted:var(--muntiji-r9-muted);
    --border:var(--muntiji-r9-border);
}

/*
 * Dashboard application/cards.
 * Keep selectors semantic instead of overriding every generic element.
 */
html[data-muntiji-color-mode="dark"] :is(
    .dashboard-page,
    .dashboard-content
) :is(
    .app-card,
    .application-card,
    .subscription-card,
    .billing-card,
    .account-card,
    .summary-card,
    .stat-card,
    .panel
){
    background-color:var(--muntiji-r9-surface) !important;
    border-color:var(--muntiji-r9-border) !important;
    color:var(--muntiji-r9-text) !important;
}

html[data-muntiji-color-mode="dark"] :is(
    .dashboard-page,
    .dashboard-content
) :is(
    h1,h2,h3,h4,h5,h6,
    .title,
    .card-title,
    .app-title
){
    color:var(--muntiji-r9-text) !important;
}

html[data-muntiji-color-mode="dark"] :is(
    .dashboard-page,
    .dashboard-content
) :is(
    p,
    .subtitle,
    .description,
    .meta,
    .muted
){
    color:var(--muntiji-r9-text-2) !important;
}

/*
 * Billing dashboard.
 *
 * The forensic scan confirmed static/billing/css/kernel237/dashboard.css
 * contains several hard-coded white backgrounds.
 */
html[data-muntiji-color-mode="dark"] :is(
    .billing-page,
    .billing-dashboard,
    .subscriptions-page,
    .subscription-page
){
    background-color:var(--muntiji-r9-page) !important;
    color:var(--muntiji-r9-text) !important;
}

html[data-muntiji-color-mode="dark"] :is(
    .billing-page,
    .billing-dashboard,
    .subscriptions-page,
    .subscription-page
) :is(
    .card,
    .panel,
    .summary-card,
    .stat-card,
    .subscription-card,
    .billing-card,
    .table-card,
    .hero,
    .page-hero,
    .dashboard-hero
){
    background-color:var(--muntiji-r9-surface) !important;
    border-color:var(--muntiji-r9-border) !important;
    color:var(--muntiji-r9-text) !important;
}

html[data-muntiji-color-mode="dark"] :is(
    .billing-page,
    .billing-dashboard,
    .subscriptions-page,
    .subscription-page
) :is(
    h1,h2,h3,h4,h5,h6,
    th,
    td
){
    color:var(--muntiji-r9-text) !important;
}

html[data-muntiji-color-mode="dark"] :is(
    .billing-page,
    .billing-dashboard,
    .subscriptions-page,
    .subscription-page
) :is(
    p,
    small,
    .subtitle,
    .description,
    .muted,
    .meta
){
    color:var(--muntiji-r9-text-2) !important;
}

html[data-muntiji-color-mode="dark"] :is(
    .billing-page,
    .billing-dashboard,
    .subscriptions-page,
    .subscription-page
) table{
    background-color:var(--muntiji-r9-surface) !important;
    color:var(--muntiji-r9-text) !important;
}

html[data-muntiji-color-mode="dark"] :is(
    .billing-page,
    .billing-dashboard,
    .subscriptions-page,
    .subscription-page
) :is(
    thead,
    th
){
    background-color:var(--muntiji-r9-surface-2) !important;
}

html[data-muntiji-color-mode="dark"] :is(
    .billing-page,
    .billing-dashboard,
    .subscriptions-page,
    .subscription-page
) :is(
    th,
    td
){
    border-color:var(--muntiji-r9-border) !important;
}

/*
 * Owner/profile pages.
 * Repair only shell/page surfaces. Permission content cards that are
 * already correctly dark are preserved.
 */
html[data-muntiji-color-mode="dark"] :is(
    .profile-page,
    .owner-profile,
    .account-profile,
    .identity-page
){
    background-color:var(--muntiji-r9-page) !important;
    color:var(--muntiji-r9-text);
}

html[data-muntiji-color-mode="dark"] :is(
    .profile-page,
    .owner-profile,
    .account-profile,
    .identity-page
) :is(
    .profile-card,
    .account-card,
    .identity-card,
    .permissions-card,
    .section-card,
    .panel
){
    background-color:var(--muntiji-r9-surface) !important;
    border-color:var(--muntiji-r9-border) !important;
    color:var(--muntiji-r9-text) !important;
}

/*
 * Shared readable typography inside authenticated surfaces.
 * Explicitly exclude the public registration/login branded experience.
 */
html[data-muntiji-color-mode="dark"]
body:not(.muntiji-register-page):not(.muntiji-login-page)
:is(
    .client-main,
    .client-content,
    .m3-main,
    .m3-content,
    .enterprise-content
)
:is(h1,h2,h3,h4,h5,h6){
    color:var(--muntiji-r9-text);
}

html[data-muntiji-color-mode="dark"]
body:not(.muntiji-register-page):not(.muntiji-login-page)
:is(
    .client-main,
    .client-content,
    .m3-main,
    .m3-content,
    .enterprise-content
)
:is(.text-muted,.muted,.subtitle,.description){
    color:var(--muntiji-r9-muted) !important;
}

/* R9C8-B END */

/* ============================================================
   MUNTIJI GLOBAL THEME R9C8-C2
   Change Password — authenticated dark-mode compatibility

   Scope:
   - /accounts/change_password/
   - security-enterprise only

   Preserves:
   - blue security presentation panel
   - semantic alert colors
   - primary action branding
   - login/register public identity
   ============================================================ */

html[data-muntiji-color-mode="dark"]
.security-enterprise{
    --muntiji-security-page:
        var(--muntiji-r9-page, var(--mui-bg-page, #07111f));

    --muntiji-security-surface:
        var(--muntiji-r9-surface, var(--mui-surface, #101d31));

    --muntiji-security-surface-2:
        var(--muntiji-r9-surface-2, var(--mui-surface-raised, #16243a));

    --muntiji-security-border:
        var(--muntiji-r9-border, var(--mui-border-default, #34445d));

    --muntiji-security-text:
        var(--muntiji-r9-text, var(--mui-text-primary, #f8fafc));

    --muntiji-security-text-2:
        var(--muntiji-r9-text-2, var(--mui-text-secondary, #cbd5e1));

    --muntiji-security-muted:
        var(--muntiji-r9-muted, var(--mui-text-muted, #94a3b8));

    background-color:var(--muntiji-security-page) !important;
    color:var(--muntiji-security-text);
}

/*
 * Outer desktop layout.
 * change_password.css line ~584 forces background:#fff.
 */
html[data-muntiji-color-mode="dark"]
.security-enterprise .layout{
    background-color:var(--muntiji-security-surface) !important;
    border-color:var(--muntiji-security-border) !important;
}

/*
 * Password form side.
 *
 * Do NOT override .panel:
 * it is the intentional branded blue security presentation.
 */
html[data-muntiji-color-mode="dark"]
.security-enterprise .card{
    background-color:var(--muntiji-security-surface) !important;
    border-color:var(--muntiji-security-border) !important;
    color:var(--muntiji-security-text) !important;
}

html[data-muntiji-color-mode="dark"]
.security-enterprise .card-head{
    background-color:var(--muntiji-security-surface) !important;
    border-color:var(--muntiji-security-border) !important;
}

html[data-muntiji-color-mode="dark"]
.security-enterprise .card-head h2{
    color:var(--muntiji-security-text) !important;
}

html[data-muntiji-color-mode="dark"]
.security-enterprise .card-head p{
    color:var(--muntiji-security-text-2) !important;
}

html[data-muntiji-color-mode="dark"]
.security-enterprise .card-body{
    background-color:var(--muntiji-security-surface) !important;
    color:var(--muntiji-security-text) !important;
}

/*
 * Password inputs.
 * change_password.css line ~655 forces background:#fff.
 */
html[data-muntiji-color-mode="dark"]
.security-enterprise .field input{
    background-color:var(--muntiji-security-surface-2) !important;
    border-color:var(--muntiji-security-border) !important;
    color:var(--muntiji-security-text) !important;
    caret-color:var(--muntiji-security-text);
}

html[data-muntiji-color-mode="dark"]
.security-enterprise .field input::placeholder{
    color:var(--muntiji-security-muted) !important;
    opacity:1;
}

html[data-muntiji-color-mode="dark"]
.security-enterprise .field label{
    color:var(--muntiji-security-text) !important;
}

html[data-muntiji-color-mode="dark"]
.security-enterprise .field .hint{
    color:var(--muntiji-security-text-2) !important;
}

/*
 * Password reveal button.
 */
html[data-muntiji-color-mode="dark"]
.security-enterprise .toggle{
    background-color:var(--muntiji-security-surface-2) !important;
    border-color:var(--muntiji-security-border) !important;
    color:var(--muntiji-security-text) !important;
}

/*
 * Password guidance.
 */
html[data-muntiji-color-mode="dark"]
.security-enterprise .password-rules{
    background-color:var(--muntiji-security-surface-2) !important;
    border-color:var(--muntiji-security-border) !important;
    color:var(--muntiji-security-text-2) !important;
}

html[data-muntiji-color-mode="dark"]
.security-enterprise .password-rules h3{
    color:var(--muntiji-security-text) !important;
}

html[data-muntiji-color-mode="dark"]
.security-enterprise .password-rules li{
    color:var(--muntiji-security-text-2) !important;
}

/*
 * Secondary action only.
 * Primary blue action remains owned by page identity.
 */
html[data-muntiji-color-mode="dark"]
.security-enterprise .btn-secondary{
    background-color:var(--muntiji-security-surface-2) !important;
    border-color:var(--muntiji-security-border) !important;
    color:var(--muntiji-security-text) !important;
}

/*
 * Footer.
 * change_password.css line ~700 forces #fafbfe.
 */
html[data-muntiji-color-mode="dark"]
.security-enterprise .card-foot{
    background-color:var(--muntiji-security-surface-2) !important;
    border-color:var(--muntiji-security-border) !important;
}

html[data-muntiji-color-mode="dark"]
.security-enterprise .card-foot a{
    color:var(--muntiji-security-text-2) !important;
}

html[data-muntiji-color-mode="dark"]
.security-enterprise .tiny{
    color:var(--muntiji-security-muted) !important;
}

/*
 * Native/browser autofill protection.
 * Prevents Chrome from restoring a bright field surface.
 */
html[data-muntiji-color-mode="dark"]
.security-enterprise input:-webkit-autofill,
html[data-muntiji-color-mode="dark"]
.security-enterprise input:-webkit-autofill:hover,
html[data-muntiji-color-mode="dark"]
.security-enterprise input:-webkit-autofill:focus{
    -webkit-text-fill-color:var(--muntiji-security-text) !important;
    caret-color:var(--muntiji-security-text) !important;
    box-shadow:
        0 0 0 1000px var(--muntiji-security-surface-2) inset !important;
    transition:background-color 9999s ease-out 0s;
}

/* R9C8-C2 END */

/* ============================================================
   MUNTIJI GLOBAL THEME R9C8-C3B
   Billing exact dark contract repair

   Exact live scope:
   .billing-enterprise-surface

   Repairs hard-coded light surfaces from:
   static/billing/css/kernel237/dashboard.css
   ============================================================ */

html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface{
    background:var(--muntiji-r9-page) !important;
    color:var(--muntiji-r9-text) !important;
}

/* Billing page canvas */
html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface .page{
    color:var(--muntiji-r9-text) !important;
}

/* Header / hero */
html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface .header-card{
    background:var(--muntiji-r9-surface) !important;
    border:1px solid var(--muntiji-r9-border) !important;
    color:var(--muntiji-r9-text) !important;
    box-shadow:0 15px 35px rgba(0,0,0,.18) !important;
}

html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface .header-card h1{
    color:var(--muntiji-r9-text) !important;
}

html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface .header-card .muted{
    color:var(--muntiji-r9-text-2) !important;
}

/* Secondary header action */
html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface .btn-secondary{
    background:var(--muntiji-r9-surface-2) !important;
    color:var(--muntiji-r9-text) !important;
    border-color:var(--muntiji-r9-border) !important;
}

/* Main billing cards */
html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface .card{
    background:var(--muntiji-r9-surface) !important;
    border:1px solid var(--muntiji-r9-border) !important;
    color:var(--muntiji-r9-text) !important;
    box-shadow:0 15px 35px rgba(0,0,0,.16) !important;
}

/*
 * Preserve existing R3.6.5.1 transparent metrics container.
 * Only stat boxes themselves receive surfaces.
 */
html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface
.page > .grid > .card:first-child{
    background:transparent !important;
    border:0 !important;
    box-shadow:none !important;
}

html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface .stat-box{
    background:var(--muntiji-r9-surface-2) !important;
    border-color:var(--muntiji-r9-border) !important;
}

html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface .stat-title{
    color:var(--muntiji-r9-muted) !important;
}

html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface .stat-value{
    color:var(--muntiji-r9-text) !important;
}

/* Subscription table */
html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface .table-wrap{
    background:var(--muntiji-r9-surface) !important;
    border:1px solid var(--muntiji-r9-border);
}

html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface table{
    background:var(--muntiji-r9-surface) !important;
    color:var(--muntiji-r9-text) !important;
}

html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface thead,
html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface th{
    background:var(--muntiji-r9-surface-2) !important;
    color:var(--muntiji-r9-text-2) !important;
}

html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface tbody{
    background:var(--muntiji-r9-surface) !important;
}

html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface tbody tr{
    background:var(--muntiji-r9-surface) !important;
}

html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface tbody td{
    background:transparent !important;
    color:var(--muntiji-r9-text) !important;
    border-color:var(--muntiji-r9-border) !important;
}

html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface tbody tr:hover{
    background:var(--muntiji-r9-surface-2) !important;
}

/* Links inside table */
html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface tbody a{
    color:var(--mui-brand-700) !important;
}

/* Available applications */
html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface .app-card{
    background:var(--muntiji-r9-surface-2) !important;
    border-color:var(--muntiji-r9-border) !important;
    color:var(--muntiji-r9-text) !important;
}

html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface .app-name{
    color:var(--muntiji-r9-text) !important;
}

html[data-muntiji-color-mode="dark"]
.billing-enterprise-surface .footer{
    color:var(--muntiji-r9-muted) !important;
}

/* Preserve semantic badge colors. */

/* R9C8-C3B END */

/* ============================================================
   MUNTIJI GLOBAL THEME R9C8-C3D
   Enterprise V3 contextbar dark contract

   Exact source:
   enterprise_contextbar_v3.html

   Repairs:
   - .m31-context hard-coded light background
   - .m31-context-button hard-coded white background
   - hover light leakage

   Scope:
   enterprise contextbar only
   ============================================================ */

html[data-muntiji-color-mode="dark"] .m31-context{
    background:var(--m3-card-surface, #111827) !important;
    border-color:var(--m3-border, #2b3648) !important;
    color:var(--m3-text, #f3f6fb) !important;
    box-shadow:
        0 10px 28px rgba(0,0,0,.18) !important;
}

html[data-muntiji-color-mode="dark"]
.m31-context__identity strong{
    color:var(--m3-text, #f3f6fb) !important;
}

html[data-muntiji-color-mode="dark"]
.m31-context__eyebrow{
    color:var(--m3-primary, #7c9cff) !important;
}

html[data-muntiji-color-mode="dark"]
.m31-context-button{
    background:var(--m3-control-surface, #111827) !important;
    border-color:var(--m3-border, #2b3648) !important;
    color:var(--m3-text, #f3f6fb) !important;
}

html[data-muntiji-color-mode="dark"]
.m31-context-button:hover{
    background:var(--m3-soft, #172033) !important;
    border-color:var(--m3-primary, #7c9cff) !important;
    color:var(--m3-primary, #7c9cff) !important;
}

html[data-muntiji-color-mode="dark"]
.m31-context-button:focus-visible{
    outline:2px solid var(--m3-primary, #7c9cff);
    outline-offset:2px;
}

/* R9C8-C3D END */

/* ==========================================================
   MUNTIJI GLOBAL THEME R9C8-C4B
   OWNER PROFILE INFO BOX DARK CONTRACT

   Scope:
   - authenticated owner/basic profile
   - dark mode only
   - legacy .info-box / .msg compatibility
   ========================================================== */

html[data-muntiji-color-mode="dark"]
body:not(.muntiji-login-page):not(.muntiji-register-page)
.profile-body > .info-box{
    background:var(--m3-primary-soft, #18264d) !important;
    background-color:var(--m3-primary-soft, #18264d) !important;
    border-color:var(--m3-border, #2b3648) !important;
    color:var(--m3-text, #f3f6fb) !important;
    box-shadow:none !important;
}

html[data-muntiji-color-mode="dark"]
body:not(.muntiji-login-page):not(.muntiji-register-page)
.profile-body > .info-box :is(
    p,
    span,
    strong,
    small,
    a
){
    color:inherit !important;
}

html[data-muntiji-color-mode="dark"]
body:not(.muntiji-login-page):not(.muntiji-register-page)
.profile-body > .msg{
    background-color:var(--m3-soft, #172033) !important;
    border-color:var(--m3-border, #2b3648) !important;
    color:var(--m3-text, #f3f6fb) !important;
}

/* Preserve semantic message distinction without light surfaces. */
html[data-muntiji-color-mode="dark"]
.profile-body > .msg.success{
    background-color:rgba(34,197,94,.12) !important;
    border-color:rgba(34,197,94,.32) !important;
    color:#bbf7d0 !important;
}

html[data-muntiji-color-mode="dark"]
.profile-body > .msg.error{
    background-color:rgba(239,68,68,.12) !important;
    border-color:rgba(239,68,68,.32) !important;
    color:#fecaca !important;
}

/* R9C8-C4B END */

/* ==========================================================
   MUNTIJI GLOBAL THEME R9C8-C5
   OWNER DECLARATIONS + CLIENT DASHBOARD HELP STRIP
   DARK SURFACE CONTRACT

   Scope:
   - dark mode only
   - authenticated owner declarations only
   - client dashboard .portal-help-strip only
   - no public login/register surfaces
   ========================================================== */


/* ----------------------------------------------------------
   1. Owner profile — declarations
   Exact template contract:
   [data-profile-section="declarations"]
   .check-grid
   .check-card
   ---------------------------------------------------------- */

html[data-muntiji-color-mode="dark"]
body:not(.muntiji-login-page):not(.muntiji-register-page)
[data-profile-section="declarations"]
.check-card{
    background:var(--m3-surface, #111827) !important;
    background-color:var(--m3-surface, #111827) !important;
    border-color:var(--m3-border, #2b3648) !important;
    color:var(--m3-text, #f3f6fb) !important;
    box-shadow:none !important;
}

html[data-muntiji-color-mode="dark"]
body:not(.muntiji-login-page):not(.muntiji-register-page)
[data-profile-section="declarations"]
.check-card__content{
    color:var(--m3-text, #f3f6fb) !important;
}

html[data-muntiji-color-mode="dark"]
body:not(.muntiji-login-page):not(.muntiji-register-page)
[data-profile-section="declarations"]
.check-card__title{
    color:var(--m3-text, #f3f6fb) !important;
}

html[data-muntiji-color-mode="dark"]
body:not(.muntiji-login-page):not(.muntiji-register-page)
[data-profile-section="declarations"]
.check-card__text{
    color:var(--m3-muted, #a9b4c4) !important;
}

html[data-muntiji-color-mode="dark"]
body:not(.muntiji-login-page):not(.muntiji-register-page)
[data-profile-section="declarations"]
.check-card:hover{
    background:var(--m3-soft, #172033) !important;
    background-color:var(--m3-soft, #172033) !important;
    border-color:var(--m3-primary, #7c9cff) !important;
}


/* ----------------------------------------------------------
   2. Client dashboard — bottom help strip
   Exact template contract:
   .portal-help-strip
   ---------------------------------------------------------- */

html[data-muntiji-color-mode="dark"]
body:not(.muntiji-login-page):not(.muntiji-register-page)
.portal-help-strip{
    background:var(--m3-surface, #111827) !important;
    background-color:var(--m3-surface, #111827) !important;
    border-color:var(--m3-border, #2b3648) !important;
    color:var(--m3-text, #f3f6fb) !important;
    box-shadow:none !important;
}

html[data-muntiji-color-mode="dark"]
body:not(.muntiji-login-page):not(.muntiji-register-page)
.portal-help-strip h3{
    color:var(--m3-text, #f3f6fb) !important;
}

html[data-muntiji-color-mode="dark"]
body:not(.muntiji-login-page):not(.muntiji-register-page)
.portal-help-strip p{
    color:var(--m3-muted, #a9b4c4) !important;
}


/* R9C8-C5 END */

/* ============================================================
   MUNTIJI GLOBAL THEME R9C8-C6C
   DASHBOARD SERVICE ACTIONS + OWNER LEGAL BOX
   DARK SURFACE CONTRACT

   Scope:
   - client dashboard .portal-service-card__icon
   - client dashboard .portal-service-card__action
   - owner declarations .legal-box only

   Light mode: untouched.
   ============================================================ */


/* ------------------------------------------------------------
   CLIENT DASHBOARD
   Remove hard-coded light controls while dark mode is active.
   ------------------------------------------------------------ */

html[data-muntiji-color-mode="dark"]
.portal-service-card__icon{
    background:var(--muntiji-surface-raised, #17243a) !important;
    color:var(--muntiji-accent, #78a7ff) !important;
    border-color:var(--muntiji-border, #33445f) !important;
}


html[data-muntiji-color-mode="dark"]
.portal-service-card__action{
    background:var(--muntiji-surface-raised, #17243a) !important;
    color:var(--muntiji-text-primary, #f8fafc) !important;
    border-color:var(--muntiji-border, #33445f) !important;
}


html[data-muntiji-color-mode="dark"]
.portal-service-card__action:hover,
html[data-muntiji-color-mode="dark"]
.portal-service-card__action:focus-visible{
    background:var(--muntiji-surface-hover, #1d2d47) !important;
    color:var(--muntiji-text-primary, #ffffff) !important;
    border-color:var(--muntiji-accent, #5b8def) !important;
}


/* ------------------------------------------------------------
   OWNER DECLARATIONS
   Legal/compliance notice only.
   Explicit section scope prevents affecting public legal pages.
   ------------------------------------------------------------ */

html[data-muntiji-color-mode="dark"]
[data-profile-section="declarations"]
.legal-box{
    background:var(--muntiji-surface-raised, #17243a) !important;
    border-color:var(--muntiji-border, #33445f) !important;
    color:var(--muntiji-text-secondary, #cbd5e1) !important;
}


/* R9C8-C6C END */



