/* Mahin Inventory | Settings Layout
   Live source grouped by responsibility. Keep shared values in components.css. */

/* Origin: css/pages/appearance_settings.css; structure and behavior preserved */
/* ==========================================
   Mahin Inventory V2
   Appearance & Language Settings
   Production UI Component
========================================== */

.mi-appearance-page {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 4px 0 40px;
    color: var(--text, #172b49);
}

.mi-appearance-page.hidden {
    display: none !important;
}

/* Page heading */

.mi-appearance-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 28px;
}

.mi-appearance-heading h1 {
    margin: 5px 0 10px;
    font-size: clamp(23px, 2.6vw, 30px);
    font-weight: 700;
    letter-spacing: -.6px;
}

.mi-appearance-heading p {
    margin: 0;
    color: var(--muted, #728096);
    font-size: 13px;
    line-height: 1.65;
}

.mi-appearance-eyebrow {
    color: var(--primary, #2463c8) !important;
    font-size: 10px !important;
    font-weight: 750;
    letter-spacing: 1.3px;
}

/* Settings sections */

.mi-appearance-sections {
    display: grid;
    gap: 20px;
}

.mi-preference-card {
    min-width: 0;
    padding: 25px;
    border: 1px solid var(--border, #dbe4f0);
    border-radius: var(--mi-ui-radius-card, 15px);
    background: var(--mi-ui-surface, var(--surface, #fff));
    box-shadow: var(--mi-ui-shadow-card);
}

.mi-preference-heading {
    margin-bottom: 22px;
}

.mi-preference-heading h2 {
    margin: 0 0 7px;
    font-size: 17px;
    font-weight: 700;
}

.mi-preference-heading p {
    margin: 0;
    color: var(--muted, #728096);
    font-size: 12px;
    line-height: 1.6;
}

/* Interactive selection cards */

.mi-choice-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.mi-choice-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 10px;
    min-width: 0;
    min-height: 120px;
    padding: 15px;
    border: 1.5px solid var(--border, #dbe4f0);
    border-radius: 12px;
    background: var(--surface, #fff);
    color: var(--text, #172b49);
    text-align: left;
    cursor: pointer;
    transition:
        border-color 160ms ease,
        background-color 160ms ease,
        box-shadow 160ms ease,
        transform 160ms ease;
}

.mi-choice-card:hover {
    border-color: var(--primary, #2463c8);
    transform: translateY(-2px);
}

.mi-choice-card[aria-pressed="true"] {
    border-color: var(--primary, #2463c8);
    background: color-mix(in srgb,
            var(--primary, #2463c8) 7%,
            var(--surface, #fff));
    box-shadow: inset 0 0 0 1px var(--primary, #2463c8);
}

.mi-choice-card:focus-visible,
.mi-motion-setting input:focus-visible {
    outline: 3px solid var(--primary, #2463c8);
    outline-offset: 3px;
}

.mi-choice-card strong {
    font-size: 13px;
    font-weight: 700;
}

.mi-choice-card>span:not(.mi-theme-preview) {
    font-size: 11px;
    line-height: 1.5;
    color: var(--muted, #728096);
}

/* Theme mini-previews */

.mi-theme-preview {
    display: flex;
    width: 100%;
    height: 66px;
    overflow: hidden;
    border: 1px solid rgba(110, 135, 170, .22);
    border-radius: 7px;
}

.mi-theme-preview>span:first-child {
    width: 27%;
    height: 100%;
}

.mi-theme-preview>span:last-child {
    flex: 1;
    margin: 9px;
    border-radius: 4px;
}

.mi-theme-light {
    background: #f2f6fc;
}

.mi-theme-light>span:first-child {
    background: #17345d;
}

.mi-theme-light>span:last-child {
    background: #fff;
}

.mi-theme-dark {
    background: #111b2b;
}

.mi-theme-dark>span:first-child {
    background: #080f1c;
}

.mi-theme-dark>span:last-child {
    background: #26364e;
}

.mi-theme-system {
    background: linear-gradient(90deg,
            #f2f6fc 50%,
            #111b2b 50%);
}

.mi-theme-system>span:first-child {
    background: linear-gradient(90deg,
            #17345d 50%,
            #080f1c 50%);
}

.mi-theme-system>span:last-child {
    background: linear-gradient(90deg,
            #fff 50%,
            #26364e 50%);
}

/* Language cards */

.mi-language-choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mi-language-choices .mi-choice-card {
    min-height: 85px;
    justify-content: center;
}

/* Motion preference */

.mi-motion-setting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    cursor: pointer;
}

.mi-motion-setting>span {
    display: grid;
    gap: 7px;
}

.mi-motion-setting strong {
    font-size: 13px;
}

.mi-motion-setting small {
    color: var(--muted, #728096);
    font-size: 12px;
    line-height: 1.5;
}

.mi-motion-setting input {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    accent-color: var(--primary, #2463c8);
    cursor: pointer;
}

.mi-appearance-status {
    min-height: 20px;
    margin: 0;
    color: var(--muted, #728096);
    font-size: 12px;
}

/* Dark theme */

[data-theme="dark"] .mi-appearance-page {
    color: var(--text, #e5edf9);
}

[data-theme="dark"] .mi-preference-card,
[data-theme="dark"] .mi-choice-card {
    background: var(--surface, #18263b);
    border-color: var(--border, #31435d);
}

[data-theme="dark"] .mi-choice-card {
    color: var(--text, #e5edf9);
}

[data-theme="dark"] .mi-choice-card[aria-pressed="true"] {
    border-color: var(--primary, #8ab8ff);
    background: color-mix(in srgb,
            var(--primary, #8ab8ff) 12%,
            var(--surface, #18263b));
}

[data-theme="dark"] .mi-choice-card:hover {
    border-color: var(--primary, #8ab8ff);
}

/* Responsive */

@media (max-width: 750px) {
    .mi-appearance-page {
        padding-bottom: 25px;
    }

    .mi-appearance-heading {
        gap: 15px;
    }

    .mi-appearance-heading h1 {
        font-size: 23px;
    }

    .mi-preference-card {
        padding: 17px;
        border-radius: 13px;
    }

    .mi-choice-grid {
        gap: 9px;
    }

    .mi-choice-card {
        min-height: 100px;
        padding: 11px;
    }

    .mi-theme-preview {
        height: 49px;
    }
}

@media (max-width: 420px) {
    .mi-choice-grid {
        grid-template-columns: 1fr;
    }

    .mi-language-choices {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mi-motion-setting {
        align-items: flex-start;
    }
}

/* Accessibility */

@media (prefers-reduced-motion: reduce) {
    .mi-choice-card {
        transition: none !important;
    }

    .mi-choice-card:hover {
        transform: none;
    }
}

[data-mi-reduced-motion="true"] .mi-choice-card {
    transition: none !important;
}

[data-mi-reduced-motion="true"] .mi-choice-card:hover {
    transform: none;
}


/* MAHIN_ACTUAL_CHOICE_BUTTONS_UNIFIED_V1
   REAL controls are button.mi-choice-card[aria-pressed], not radio labels.
   These are the live Color Theme and Language controls from appearance_settings.html.
   The dashboard illustrations INSIDE the buttons are deliberately unchanged. */
html[data-mi-palette] #miV2SettingsPage_appearance {
    --mi-choice-surface: linear-gradient(145deg,
        color-mix(in srgb, white 94%, var(--mi-palette-accent)),
        color-mix(in srgb, white 87%, var(--mi-palette-accent)));
    --mi-choice-active: linear-gradient(145deg,
        color-mix(in srgb, white 80%, var(--mi-palette-accent)),
        color-mix(in srgb, white 87%, var(--mi-palette-accent)));
    --mi-choice-outline: rgba(var(--mi-palette-rgb), .38);
    --mi-choice-ink: #20324b;
}
html[data-mi-palette][data-mi-surface="glass"] #miV2SettingsPage_appearance {
    --mi-choice-surface: linear-gradient(145deg,
        rgba(255,255,255,.24), rgba(var(--mi-palette-rgb),.12));
    --mi-choice-active: linear-gradient(145deg,
        rgba(var(--mi-palette-rgb),.22), rgba(255,255,255,.18));
}
html[data-mi-palette][data-theme="dark"] #miV2SettingsPage_appearance,
html[data-mi-palette] body[data-theme="dark"] #miV2SettingsPage_appearance {
    --mi-choice-surface: linear-gradient(145deg,
        rgba(38,55,79,.95), rgba(var(--mi-palette-rgb),.16));
    --mi-choice-active: linear-gradient(145deg,
        rgba(43,62,90,.92), rgba(var(--mi-palette-rgb),.30));
    --mi-choice-outline: rgba(var(--mi-palette-rgb), .52);
    --mi-choice-ink: #f0f5ff;
}
html[data-mi-palette][data-mi-surface="glass"][data-theme="dark"] #miV2SettingsPage_appearance,
html[data-mi-palette][data-mi-surface="glass"] body[data-theme="dark"] #miV2SettingsPage_appearance {
    --mi-choice-surface: linear-gradient(145deg,
        rgba(35,52,77,.46), rgba(var(--mi-palette-rgb),.17));
    --mi-choice-active: linear-gradient(145deg,
        rgba(var(--mi-palette-rgb),.29), rgba(36,54,82,.41));
}

/* Explicit DOM selectors, not guessed label/radio combinations. */
html[data-mi-palette] #miV2SettingsPage_appearance
:is(#appearanceThemeOptions,#appearanceLanguageOptions) > button.mi-choice-card {
    background: var(--mi-choice-surface) !important;
    border-color: var(--mi-choice-outline) !important;
    color: var(--mi-choice-ink) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.35),
                0 3px 12px rgba(var(--mi-palette-rgb),.055) !important;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}
html[data-mi-palette][data-mi-surface="glass"] #miV2SettingsPage_appearance
:is(#appearanceThemeOptions,#appearanceLanguageOptions) > button.mi-choice-card {
    -webkit-backdrop-filter: blur(12px) saturate(140%) !important;
    backdrop-filter: blur(12px) saturate(140%) !important;
}
html[data-mi-palette] #miV2SettingsPage_appearance
:is(#appearanceThemeOptions,#appearanceLanguageOptions) > button.mi-choice-card[aria-pressed="true"] {
    background: var(--mi-choice-active) !important;
    border-color: var(--mi-palette-accent) !important;
    box-shadow: inset 0 0 0 1px var(--mi-palette-accent),
                0 4px 13px rgba(var(--mi-palette-rgb),.13) !important;
}
@media (hover:hover) and (pointer:fine) {
    html[data-mi-palette] #miV2SettingsPage_appearance
    :is(#appearanceThemeOptions,#appearanceLanguageOptions) > button.mi-choice-card:hover {
        border-color: var(--mi-palette-accent) !important;
        box-shadow: 0 7px 20px rgba(var(--mi-palette-rgb),.15) !important;
    }
}
html[data-mi-palette] #miV2SettingsPage_appearance
:is(#appearanceThemeOptions,#appearanceLanguageOptions) > button.mi-choice-card:focus-visible {
    outline: 2px solid var(--mi-palette-accent) !important;
    outline-offset: 2px;
}


/* Origin: css/pages/application_preferences.css; structure and behavior preserved */
/* ==================================================
   MAHIN INVENTORY V2
   Application Preferences — Production UI
   ================================================== */

#appScreen .mi-preferences-page {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 4px 0 40px;
    color: var(--text, #172b49);
}

#appScreen .mi-preferences-page.hidden {
    display: none !important;
}

/* Page heading */

#appScreen .mi-preferences-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 28px;
}

#appScreen .mi-preferences-heading h1 {
    margin: 5px 0 9px;
    font-size: clamp(23px, 2.5vw, 30px);
    font-weight: 750;
    letter-spacing: -.5px;
    line-height: 1.25;
}

#appScreen .mi-preferences-heading p {
    margin: 0;
    color: var(--muted, #718096);
    font-size: 13px;
    line-height: 1.7;
}

#appScreen .mi-preferences-eyebrow {
    color: var(--primary, #2463c8) !important;
    font-size: 10px !important;
    font-weight: 750;
    letter-spacing: 1.2px;
}

#appScreen .mi-preferences-heading>.button {
    flex-shrink: 0;
}

/* Main settings sections */

#appScreen .mi-preferences-sections {
    display: grid;
    gap: 18px;
}

#appScreen .mi-preference-section {
    min-width: 0;
    padding: 24px;
    border: 1px solid var(--border, #dce5f0);
    border-radius: var(--mi-ui-radius-card, 15px);
    background: var(--mi-ui-surface, var(--surface, #fff));
    box-shadow: var(--mi-ui-shadow-card);
}

#appScreen .mi-preference-section-heading {
    margin-bottom: 22px;
}

#appScreen .mi-preference-section-heading h2 {
    margin: 0 0 7px;
    color: var(--text, #172b49);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.4;
}

#appScreen .mi-preference-section-heading p {
    max-width: 680px;
    margin: 0;
    color: var(--muted, #718096);
    font-size: 12px;
    line-height: 1.65;
}

/* Radio options */

#appScreen .mi-preference-options {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    min-width: 0;
    border: 0;
}

#appScreen .mi-preference-options legend {
    margin-bottom: 12px;
    padding: 0;
    color: var(--muted, #718096);
    font-size: 11px;
    font-weight: 650;
}

#appScreen .mi-preference-option {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    padding: 15px 16px;
    border: 1.5px solid var(--border, #dce5f0);
    border-radius: 12px;
    background: var(--surface, #ffffff);
    cursor: pointer;
    transition:
        border-color 160ms ease,
        background-color 160ms ease,
        box-shadow 160ms ease;
}

#appScreen .mi-preference-option:hover {
    border-color: var(--primary, #2463c8);
}

#appScreen .mi-preference-option:has(input:checked) {
    border-color: var(--primary, #2463c8);
    background: color-mix(in srgb,
            var(--primary, #2463c8) 6%,
            var(--surface, #ffffff));
}

#appScreen .mi-preference-option input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    flex-shrink: 0;
    accent-color: var(--primary, #2463c8);
    cursor: pointer;
}

#appScreen .mi-preference-option>span {
    display: grid;
    gap: 5px;
    min-width: 0;
}

#appScreen .mi-preference-option strong {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
}

#appScreen .mi-preference-option small {
    color: var(--muted, #718096);
    font-size: 12px;
    line-height: 1.65;
}

/* Dropdown preferences */

#appScreen .mi-preference-control-list {
    display: grid;
    gap: 0;
}

#appScreen .mi-preference-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 17px 0;
}

#appScreen .mi-preference-control+.mi-preference-control {
    border-top: 1px solid var(--border, #dce5f0);
}

#appScreen .mi-preference-control>span {
    display: grid;
    gap: 6px;
    min-width: 0;
}

#appScreen .mi-preference-control strong {
    font-size: 13px;
    font-weight: 700;
}

#appScreen .mi-preference-control small {
    color: var(--muted, #718096);
    font-size: 12px;
    line-height: 1.6;
}

#appScreen .mi-preference-control select {
    width: 190px;
    max-width: 100%;
    min-height: 40px;
    flex-shrink: 0;
    padding: 9px 12px;
    border: 1px solid var(--border, #dce5f0);
    border-radius: 10px;
    background: var(--surface, #ffffff);
    color: var(--text, #172b49);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

/* Status and reset */

#appScreen .mi-preferences-note {
    margin: 12px 0 0;
    color: var(--muted, #718096);
    font-size: 11px;
    line-height: 1.7;
}

#appScreen .mi-preferences-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 8px 2px 0;
}

#appScreen #applicationPreferencesStatus {
    flex: 1;
    min-width: 0;
    margin: 0;
    color: var(--muted, #718096);
    font-size: 12px;
    line-height: 1.6;
}

/* Focus and disabled controls */

#appScreen .mi-preference-option:focus-within,
#appScreen .mi-preference-control select:focus-visible {
    outline: 2px solid var(--primary, #2463c8);
    outline-offset: 3px;
}

#appScreen .mi-preference-control select:disabled,
#appScreen .mi-preference-option:has(input:disabled) {
    opacity: .55;
    cursor: not-allowed;
}

/* Dark mode */

[data-theme="dark"] #appScreen .mi-preference-section,
[data-theme="dark"] #appScreen .mi-preference-option,
[data-theme="dark"] #appScreen .mi-preference-control select {
    background: var(--surface, #18263b);
    color: var(--text, #e5edf9);
    border-color: var(--border, #34445c);
}

[data-theme="dark"] #appScreen .mi-preference-option:has(input:checked) {
    border-color: var(--primary, #8ab8ff);
    background: color-mix(in srgb,
            var(--primary, #8ab8ff) 12%,
            var(--surface, #18263b));
}

/* Tablet and mobile */

@media (max-width: 750px) {
    #appScreen .mi-preferences-page {
        padding: 4px 0 25px;
    }

    #appScreen .mi-preferences-heading {
        gap: 15px;
        margin-bottom: 22px;
    }

    #appScreen .mi-preferences-heading h1 {
        font-size: 23px;
    }

    #appScreen .mi-preference-section {
        padding: 18px;
        border-radius: 13px;
    }

    #appScreen .mi-preference-option {
        padding: 13px;
    }
}

@media (max-width: 480px) {
    #appScreen .mi-preference-control {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    #appScreen .mi-preference-control select {
        width: 100%;
    }

    #appScreen .mi-preferences-actions {
        align-items: stretch;
        flex-direction: column;
    }

    #appScreen .mi-preferences-actions .button {
        width: 100%;
    }
}

/* Accessibility */

@media (prefers-reduced-motion: reduce) {
    #appScreen .mi-preference-option {
        transition: none !important;
    }
}

[data-mi-reduced-motion="true"] #appScreen .mi-preference-option {
    transition: none !important;
}


/* Origin: css/components/application_preferences_ui.css; structure and behavior preserved */
/* Mahin Inventory V2 - Shared application preference UI */

#appScreen .mi-quick-access {
    position: relative;
    flex: 0 0 auto;
}

#appScreen .mi-quick-access[hidden],
#appScreen .mi-quick-access-menu[hidden],
#appScreen #themeToggle[hidden],
#appScreen #languageToggle[hidden] {
    display: none !important;
}

#appScreen .mi-quick-access-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    min-height: 38px;
    padding: 5px 10px;
    font-size: 23px;
    font-weight: 700;
    line-height: 1;
}

#appScreen .mi-quick-access-menu {
    position: absolute;
    top: calc(100% + 9px);
    right: 0;
    z-index: 70;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
    width: max-content;
    min-width: 170px;
    max-width: min(270px, calc(100vw - 24px));
    padding: 9px;
    border: 1px solid var(--border, #dbe4ef);
    border-radius: 12px;
    background: var(--surface, #ffffff);
    color: var(--text, #172b49);
    box-shadow: 0 14px 36px rgba(10, 25, 48, .2);
}

#appScreen .mi-quick-access-menu>.button {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
    white-space: nowrap;
}

#appScreen .mi-quick-access-toggle:focus-visible,
#appScreen .mi-quick-access-menu button:focus-visible {
    outline: 2px solid var(--primary, #2463c8);
    outline-offset: 2px;
}

/* A selected header mode must override compact-on-scroll. */
[data-mi-header-behavior="fixed"] #appScreen .topbar.compact {
    transform: none;
    opacity: 1;
}

/* Sidebar preferences apply only outside mobile drawer mode. */
@media (min-width: 751px) {
    [data-mi-sidebar-preference="compact"] #appScreen:not(.mi-nav-expanded)>.sidebar {
        width: var(--mi-sidebar-rail, 72px);
        min-width: var(--mi-sidebar-rail, 72px);
        flex-basis: var(--mi-sidebar-rail, 72px);
        padding-left: 7px;
        padding-right: 7px;
        overflow: visible;
    }

    [data-mi-sidebar-preference="compact"] #appScreen:not(.mi-nav-expanded) .sidebar-brand {
        justify-content: center;
    }

    [data-mi-sidebar-preference="compact"] #appScreen:not(.mi-nav-expanded) .sidebar-brand>span,
    [data-mi-sidebar-preference="compact"] #appScreen:not(.mi-nav-expanded) .sidebar .nav-label,
    [data-mi-sidebar-preference="compact"] #appScreen:not(.mi-nav-expanded) .sidebar .mi-nav-text,
    [data-mi-sidebar-preference="compact"] #appScreen:not(.mi-nav-expanded) .sidebar .mi-parent-label,
    [data-mi-sidebar-preference="compact"] #appScreen:not(.mi-nav-expanded) .sidebar .mi-parent-chevron,
    [data-mi-sidebar-preference="compact"] #appScreen:not(.mi-nav-expanded) .sidebar .mi-footer-label {
        display: none !important;
    }

    [data-mi-sidebar-preference="compact"] #appScreen:not(.mi-nav-expanded) .mi-brand-toggle {
        display: flex;
        position: absolute;
        right: -3px;
        bottom: 9px;
        width: 20px;
        height: 20px;
        flex-basis: 20px;
        border-radius: 50%;
    }

    [data-mi-sidebar-preference="compact"] #appScreen:not(.mi-nav-expanded) .sidebar .nav-item,
    [data-mi-sidebar-preference="compact"] #appScreen:not(.mi-nav-expanded) .mi-nav-parent,
    [data-mi-sidebar-preference="compact"] #appScreen:not(.mi-nav-expanded) .mi-footer-about {
        justify-content: center;
    }

    [data-mi-sidebar-preference="compact"] #appScreen:not(.mi-nav-expanded) .mi-submenu {
        display: none !important;
    }

    [data-mi-sidebar-preference="compact"] #appScreen.mi-nav-expanded>.sidebar {
        width: var(--mi-sidebar-wide, 250px);
        min-width: var(--mi-sidebar-wide, 250px);
        flex-basis: var(--mi-sidebar-rail, 72px);
        padding-left: 11px;
        padding-right: 11px;
        box-shadow: 12px 0 32px rgba(0, 0, 0, .18);
    }

    [data-mi-sidebar-preference="compact"] #appScreen.mi-nav-expanded .mi-brand-toggle {
        display: flex;
    }
}

@media (min-width: 751px) and (max-width: 1100px) {
    [data-mi-sidebar-preference="expanded"] #appScreen>.sidebar {
        width: var(--mi-sidebar-wide, 250px);
        min-width: var(--mi-sidebar-wide, 250px);
        flex-basis: var(--mi-sidebar-wide, 250px);
        overflow-x: hidden;
        overflow-y: auto;
    }

    [data-mi-sidebar-preference="expanded"] #appScreen .sidebar-brand {
        justify-content: flex-start;
    }

    [data-mi-sidebar-preference="expanded"] #appScreen .sidebar-brand>span,
    [data-mi-sidebar-preference="expanded"] #appScreen .sidebar .nav-label,
    [data-mi-sidebar-preference="expanded"] #appScreen .sidebar .mi-nav-text,
    [data-mi-sidebar-preference="expanded"] #appScreen .sidebar .mi-parent-label,
    [data-mi-sidebar-preference="expanded"] #appScreen .sidebar .mi-parent-chevron {
        display: block !important;
    }

    [data-mi-sidebar-preference="expanded"] #appScreen .mi-brand-toggle {
        display: none !important;
    }

    [data-mi-sidebar-preference="expanded"] #appScreen .sidebar .nav-item,
    [data-mi-sidebar-preference="expanded"] #appScreen .mi-nav-parent {
        justify-content: flex-start;
    }
}

[data-mi-widget-spacing="compact"] #appScreen {
    --mi-dashboard-widget-gap: 8px;
}

[data-mi-widget-spacing="comfortable"] #appScreen {
    --mi-dashboard-widget-gap: 14px;
}

[data-mi-widget-spacing="spacious"] #appScreen {
    --mi-dashboard-widget-gap: 22px;
}

@media (max-width: 750px) {
    #appScreen .mi-quick-access-menu {
        position: fixed;
        top: 62px;
        right: 12px;
        z-index: 80;
    }
}

@media (prefers-reduced-motion: reduce) {
    #appScreen .mi-quick-access-menu {
        transition: none !important;
    }
}

/* STEP 4.71 - DESCRIPTIVE QUICK ACCESS */

#appScreen .mi-quick-access-menu {
    min-width: 255px;
    max-width: min(310px, calc(100vw - 24px));
    gap: 3px;
    padding: 7px;
}

#appScreen .mi-quick-menu-row {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 58px;
    padding: 9px;
    border-radius: 9px;
    cursor: pointer;
    transition: background-color 140ms ease;
}

#appScreen .mi-quick-menu-row:hover {
    background: color-mix(
        in srgb,
        var(--primary, #2463c8) 7%,
        var(--surface, #fff)
    );
}

#appScreen .mi-quick-menu-icon {
    display: grid;
    place-items: center;
    flex: 0 0 35px;
    width: 35px;
    height: 35px;
    border-radius: 9px;
    background: color-mix(
        in srgb,
        var(--primary, #2463c8) 10%,
        var(--surface, #fff)
    );
    color: var(--primary, #2463c8);
    font-size: 18px;
}

#appScreen .mi-quick-menu-description {
    display: grid;
    flex: 1;
    min-width: 0;
    gap: 4px;
}

#appScreen .mi-quick-menu-description strong {
    font-size: 12px;
    font-weight: 650;
}

#appScreen .mi-quick-menu-description small {
    color: var(--muted, #728096);
    font-size: 11px;
}

#appScreen .mi-quick-menu-row > .button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    flex: 0 0 auto;
    width: auto;
    min-width: 35px;
    max-width: 78px;
    padding: 7px;
    text-align: center;
    font-size: 14px;
}

#appScreen .mi-quick-menu-row:focus-within {
    outline: 2px solid var(--primary, #2463c8);
    outline-offset: -2px;
}

@media (prefers-reduced-motion: reduce) {
    #appScreen .mi-quick-menu-row {
        transition: none !important;
    }
}


/* Origin: css/components/dynamic_header.css; structure and behavior preserved */
/* Mahin Inventory V2 — Dynamic Header */

#appScreen .main>.topbar {
    position: sticky;
    top: 0;
    z-index: 35;

    will-change: transform;

    transition:
        transform 240ms cubic-bezier(.22, 1, .36, 1),
        box-shadow 200ms ease,
        background-color 200ms ease;
}

/* Hide while scrolling downward. */
[data-mi-header-behavior="dynamic"] #appScreen .main>.topbar.mi-header-hidden {
    transform: translate3d(0, calc(-100% - 2px), 0);
    pointer-events: none;
}

/* Reappears as a clean, compact floating header. */
[data-mi-header-behavior="dynamic"] #appScreen .main>.topbar.mi-header-slim {
    transform: translate3d(0, 0, 0);
    box-shadow: 0 4px 18px rgba(13, 36, 70, .10);
}

/* Fixed means truly always visible. */
[data-mi-header-behavior="fixed"] #appScreen .main>.topbar,
[data-mi-header-behavior="fixed"] #appScreen .main>.topbar.compact,
[data-mi-header-behavior="fixed"] #appScreen .main>.topbar.mi-header-hidden {
    transform: none !important;
    opacity: 1 !important;
    pointer-events: auto;
}

/* Open drawer must not hide the header unexpectedly. */
#appScreen.mi-drawer-open .main>.topbar {
    transform: none !important;
}

[data-theme="dark"] #appScreen .main>.topbar.mi-header-slim {
    box-shadow: 0 4px 20px rgba(0, 0, 0, .32);
}

/* Respect user's accessibility preference. */
@media (prefers-reduced-motion: reduce) {
    #appScreen .main>.topbar {
        transition: none !important;
        will-change: auto;
    }
}

[data-mi-reduced-motion="true"] #appScreen .main>.topbar {
    transition: none !important;
    will-change: auto;
}


/* Origin: css/components/settings_experience.css; structure and behavior preserved */
/* Mahin Inventory V2 — Settings Experience */

/* -------------------------------------------
   Compact settings sections
------------------------------------------- */

#appScreen .mi-preference-card,
#appScreen .mi-preference-section {
    padding: 0;
    overflow: hidden;
    border-radius: 14px;
}

#appScreen .mi-settings-accordion-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    min-height: 76px;
    padding: 18px 21px;
    border: 0;
    background: transparent;
    color: var(--text, #172b49);
    text-align: left;
    cursor: pointer;
}

#appScreen .mi-settings-accordion-trigger:hover {
    background: color-mix(in srgb,
            var(--primary, #2463c8) 4%,
            var(--surface, #fff));
}

#appScreen .mi-settings-accordion-trigger:focus-visible {
    outline: 2px solid var(--primary, #2463c8);
    outline-offset: -4px;
}

#appScreen .mi-settings-accordion-label {
    display: grid;
    gap: 5px;
    min-width: 0;
}

#appScreen .mi-settings-accordion-label strong {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
}

#appScreen .mi-settings-accordion-label small {
    font-size: 12px;
    line-height: 1.5;
    color: var(--muted, #728096);
}

#appScreen .mi-settings-chevron {
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    margin-right: 5px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 180ms ease;
}

#appScreen .mi-settings-open .mi-settings-chevron {
    transform: rotate(225deg);
}

#appScreen .mi-settings-accordion-panel {
    padding: 4px 20px 21px;
    border-top: 1px solid var(--border, #dae3ef);
}

#appScreen .mi-settings-accordion-panel[hidden],
#appScreen .mi-preference-section[hidden],
#appScreen .mi-preference-card[hidden] {
    display: none !important;
}

#appScreen .mi-settings-accordion-panel>.mi-choice-grid {
    margin-top: 14px;
}

/* -------------------------------------------
   Realistic miniature dashboard previews
------------------------------------------- */

#appScreen .mi-theme-preview {
    display: flex;
    width: 100%;
    height: auto;
    min-height: 92px;
    aspect-ratio: 1.65;
    overflow: hidden;
    border: 1px solid var(--border, #d0dbe8);
    border-radius: 8px;
    background: transparent;
}

#appScreen .mi-theme-preview>.mi-mini-window {
    display: flex;
    flex: 1 1 100%;
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
    overflow: hidden;
}

#appScreen .mi-theme-preview.mi-mini-system>.mi-mini-window {
    flex-basis: 50%;
    width: 50%;
}

#appScreen .mi-mini-light {
    --mi-mini-bg: #f1f5fa;
    --mi-mini-sidebar: #19365d;
    --mi-mini-panel: #ffffff;
    --mi-mini-line: #d3deec;
    background: var(--mi-mini-bg);
}

#appScreen .mi-mini-dark {
    --mi-mini-bg: #101b2b;
    --mi-mini-sidebar: #091423;
    --mi-mini-panel: #22334b;
    --mi-mini-line: #435772;
    background: var(--mi-mini-bg);
}

#appScreen .mi-mini-sidebar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 25%;
    min-width: 0;
    height: 100%;
    padding: 10px 5px;
    background: var(--mi-mini-sidebar);
}

#appScreen .mi-mini-brand {
    width: 70%;
    height: 9px;
    border-radius: 3px;
    background: #387de0;
}

#appScreen .mi-mini-nav {
    width: 85%;
    height: 5px;
    border-radius: 3px;
    background: #92afd4;
    opacity: .7;
}

#appScreen .mi-mini-area {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    padding: 9px 7px;
}

#appScreen .mi-mini-header {
    width: 100%;
    height: 13px;
    border-radius: 3px;
    background: var(--mi-mini-panel);
    border: 1px solid var(--mi-mini-line);
}

#appScreen .mi-mini-cards {
    display: flex;
    gap: 5px;
    width: 100%;
    min-height: 24px;
}

#appScreen .mi-mini-card {
    flex: 1;
    border-radius: 3px;
    background: var(--mi-mini-panel);
    border: 1px solid var(--mi-mini-line);
}

#appScreen .mi-mini-chart {
    flex: 1;
    min-height: 17px;
    border-radius: 3px;
    background: repeating-linear-gradient(to right,
            var(--mi-mini-panel) 0 12px,
            var(--mi-mini-line) 12px 14px);
}

/* -------------------------------------------
   Language dropdown-like compact selection
------------------------------------------- */

#appScreen .mi-settings-accordion-panel .mi-language-choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 440px;
    margin: 14px 0 0;
}

#appScreen .mi-language-choices .mi-choice-card {
    min-height: 70px;
}

/* -------------------------------------------
   Searchable Application Preferences
------------------------------------------- */

#appScreen .mi-settings-search {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 46px;
    margin: 0 0 16px;
    padding: 0 14px;
    border: 1px solid var(--border, #dce5f0);
    border-radius: 11px;
    background: var(--surface, #fff);
    color: var(--muted, #728096);
}

#appScreen .mi-settings-search:focus-within {
    border-color: var(--primary, #2463c8);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary, #2463c8) 13%, transparent);
}

#appScreen .mi-settings-search input {
    flex: 1;
    width: 100%;
    min-width: 0;
    padding: 12px 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text, #172b49);
    font: inherit;
    font-size: 13px;
}

#appScreen .mi-settings-no-results[hidden] {
    display: none;
}

#appScreen .mi-settings-no-results {
    padding: 12px;
    color: var(--muted, #728096);
    text-align: center;
}

/* -------------------------------------------
   Quick Access — readable labels
------------------------------------------- */

#appScreen .mi-quick-access-menu .mi-quick-menu-description {
    min-width: 0;
}

#appScreen .mi-quick-access-menu .mi-quick-menu-description strong {
    display: block;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.4;
    font-size: 12px;
}

#appScreen .mi-quick-access-menu .mi-quick-menu-description small {
    display: block;
    white-space: normal;
    line-height: 1.4;
    font-size: 11px;
}

#appScreen .mi-quick-access-menu {
    min-width: 246px;
    max-width: min(310px, calc(100vw - 20px));
}

/* -------------------------------------------
   Floating Back to Top
------------------------------------------- */

#appScreen>.mi-back-to-top {
    position: fixed;
    right: max(20px, env(safe-area-inset-right));
    bottom: calc(22px + env(safe-area-inset-bottom));
    z-index: 40;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 14px;
    background: var(--primary, #2463c8);
    color: #fff;
    box-shadow: 0 8px 25px rgba(15, 45, 90, .24);
    cursor: pointer;
    transition: transform 150ms ease, box-shadow 150ms ease;
}

#appScreen>.mi-back-to-top[hidden] {
    display: none !important;
}

#appScreen>.mi-back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 11px 28px rgba(15, 45, 90, .3);
}

#appScreen>.mi-back-to-top span {
    font-size: 23px;
    line-height: 1;
}

#appScreen>.mi-back-to-top:focus-visible {
    outline: 3px solid var(--primary, #2463c8);
    outline-offset: 3px;
}

@media (max-width: 750px) {
    #appScreen>.mi-back-to-top {
        right: calc(14px + env(safe-area-inset-right));
        bottom: calc(18px + env(safe-area-inset-bottom));
        width: 42px;
        height: 42px;
        border-radius: 13px;
    }

    #appScreen .mi-settings-accordion-trigger {
        padding: 15px;
    }

    #appScreen .mi-settings-accordion-panel {
        padding: 4px 14px 16px;
    }
}

@media (prefers-reduced-motion: reduce) {

    #appScreen .mi-settings-chevron,
    #appScreen>.mi-back-to-top {
        transition: none !important;
    }
}

[data-mi-reduced-motion="true"] #appScreen>.mi-back-to-top {
    transition: none !important;
}


/* Origin: css/pages/settings_hub.css; structure and behavior preserved */
/* Mahin Inventory V2 — Settings Hub */

#appScreen .mi-settings-hub {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 4px 0 40px;
    color: var(--text, #172b49);
}

#appScreen .mi-settings-hub.hidden {
    display: none !important;
}

#appScreen .mi-hub-heading {
    margin-bottom: 26px;
}

#appScreen .mi-hub-heading-main {
    display: flex;
    align-items: center;
    gap: 17px;
}

#appScreen .mi-hub-heading-icon {
    display: grid;
    place-items: center;
    width: 57px;
    height: 57px;
    flex: 0 0 57px;
    border-radius: 17px;
    background: color-mix(in srgb,
            var(--primary, #2463c8) 12%,
            var(--surface, #fff));
    color: var(--primary, #2463c8);
    font-size: 31px;
}

#appScreen .mi-hub-eyebrow {
    margin: 0 0 5px;
    color: var(--primary, #2463c8);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 1px;
}

#appScreen .mi-hub-heading h1 {
    margin: 0 0 6px;
    font-size: clamp(24px, 2.7vw, 32px);
    letter-spacing: -.6px;
    line-height: 1.25;
}

#appScreen .mi-hub-heading-main p:last-child {
    margin: 0;
    color: var(--muted, #728096);
    font-size: 12px;
    line-height: 1.65;
}

/* Search */

#appScreen .mi-hub-search-area {
    position: relative;
    margin-bottom: 29px;
}

#appScreen .mi-hub-search-label {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 54px;
    padding: 0 17px;
    border: 1px solid var(--border, #dae3ef);
    border-radius: 14px;
    background: var(--surface, #fff);
    color: var(--muted, #728096);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

#appScreen .mi-hub-search-label:focus-within {
    border-color: var(--primary, #2463c8);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary, #2463c8) 12%, transparent);
}

#appScreen .mi-hub-search-label>span {
    font-size: 26px;
    line-height: 1;
}

#appScreen #settingsHubSearch {
    flex: 1;
    min-width: 0;
    padding: 13px 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text, #172b49);
    font: inherit;
    font-size: 13px;
}

#appScreen .mi-hub-search-label kbd {
    display: grid;
    place-items: center;
    min-width: 25px;
    height: 25px;
    border: 1px solid var(--border, #dae3ef);
    border-radius: 6px;
    font-size: 12px;
}

#appScreen .mi-hub-search-results {
    position: relative;
    display: grid;
    gap: 5px;
    margin-top: 9px;
    padding: 7px;
    border: 1px solid var(--border, #dae3ef);
    border-radius: 12px;
    background: var(--surface, #fff);
    box-shadow: 0 8px 24px rgba(16, 40, 75, .07);
}

#appScreen .mi-hub-search-results[hidden] {
    display: none !important;
}

#appScreen .mi-hub-search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text, #172b49);
    text-align: left;
    cursor: pointer;
}

#appScreen .mi-hub-search-result:hover,
#appScreen .mi-hub-search-result:focus-visible {
    background: color-mix(in srgb,
            var(--primary, #2463c8) 8%,
            var(--surface, #fff));
}

#appScreen .mi-hub-result-copy {
    display: grid;
    flex: 1;
    min-width: 0;
    gap: 3px;
}

#appScreen .mi-hub-result-copy strong {
    font-size: 12px;
}

#appScreen .mi-hub-result-copy small {
    color: var(--muted, #728096);
    font-size: 11px;
}

#appScreen .mi-hub-no-results {
    margin: 0;
    padding: 13px;
    color: var(--muted, #728096);
    font-size: 12px;
    text-align: center;
}

/* Main categories */

#appScreen .mi-hub-section-heading {
    margin-bottom: 15px;
}

#appScreen .mi-hub-section-heading h2 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 700;
}

#appScreen .mi-hub-section-heading p {
    margin: 0;
    color: var(--muted, #728096);
    font-size: 12px;
}

#appScreen .mi-hub-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

#appScreen .mi-hub-card {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 0;
    min-height: 102px;
    padding: 19px;
    border: 1px solid var(--border, #dae3ef);
    border-radius: 15px;
    background: var(--surface, #fff);
    color: var(--text, #172b49);
    text-align: left;
    cursor: pointer;
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease,
        transform 160ms ease;
}

#appScreen .mi-hub-card:hover {
    border-color: var(--primary, #2463c8);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(15, 43, 82, .07);
}

#appScreen .mi-hub-card:focus-visible {
    outline: 3px solid var(--primary, #2463c8);
    outline-offset: 3px;
}

#appScreen .mi-hub-card-icon {
    display: grid;
    place-items: center;
    flex: 0 0 45px;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: color-mix(in srgb,
            var(--primary, #2463c8) 10%,
            var(--surface, #fff));
    color: var(--primary, #2463c8);
    font-size: 24px;
    line-height: 1;
}

#appScreen .mi-hub-card-copy {
    display: grid;
    flex: 1;
    min-width: 0;
    gap: 6px;
}

#appScreen .mi-hub-card-copy strong {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.45;
}

#appScreen .mi-hub-card-copy small {
    color: var(--muted, #728096);
    font-size: 12px;
    line-height: 1.55;
}

#appScreen .mi-hub-card-arrow {
    flex: 0 0 auto;
    color: var(--muted, #728096);
    font-size: 25px;
}

/* Sidebar Settings split action */

#appScreen .mi-settings-parent-row {
    display: flex;
    align-items: stretch;
    position: relative;
    gap: 3px;
}

#appScreen .mi-settings-home-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    padding: 10px 10px 10px 13px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

#appScreen .mi-settings-home-trigger:hover,
#appScreen .mi-settings-home-trigger.active {
    background: rgba(255, 255, 255, .13);
}

#appScreen .mi-settings-home-trigger .mi-settings-home-label {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 13px;
    font-weight: 600;
}

#appScreen .mi-settings-parent-row>#settingsGroupToggle {
    width: 36px;
    min-width: 36px;
    padding: 0;
    justify-content: center;
}

#appScreen #settingsGroupToggle .mi-parent-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

#appScreen .mi-settings-home-trigger:focus-visible,
#appScreen #settingsGroupToggle:focus-visible {
    outline: 2px solid #a8d0ff;
    outline-offset: -2px;
}

/* In compact rail, retain clear access to both actions. */
@media (min-width: 751px) and (max-width: 1100px) {
    #appScreen:not(.mi-nav-expanded) .mi-settings-parent-row {
        flex-direction: column;
        gap: 2px;
    }

    #appScreen:not(.mi-nav-expanded) .mi-settings-home-trigger {
        flex: none;
        justify-content: center;
        padding: 10px 5px;
    }

    #appScreen:not(.mi-nav-expanded) .mi-settings-home-label {
        display: none;
    }

    #appScreen:not(.mi-nav-expanded) .mi-settings-parent-row>#settingsGroupToggle {
        width: 100%;
        min-height: 22px;
    }
}

@media (max-width: 750px) {
    #appScreen .mi-hub-grid {
        grid-template-columns: 1fr;
        gap: 11px;
    }

    #appScreen .mi-hub-card {
        min-height: 86px;
        padding: 15px;
    }

    #appScreen .mi-hub-heading-icon {
        width: 47px;
        height: 47px;
        flex-basis: 47px;
        font-size: 26px;
    }

    #appScreen .mi-hub-search-label kbd {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    #appScreen .mi-hub-card {
        transition: none !important;
    }

    #appScreen .mi-hub-card:hover {
        transform: none;
    }
}

[data-mi-reduced-motion="true"] #appScreen .mi-hub-card {
    transition: none !important;
}

/* STEP 4.75 - SETTINGS PAGE SWITCHER */

#appScreen .mi-hub-page-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 22px;
    padding: 11px 13px;
    border: 1px solid var(--border, #dae3ef);
    border-radius: 11px;
    background: var(--surface, #fff);
}

#appScreen .mi-hub-switch-home {
    flex: 0 0 auto;
    padding: 9px 12px;
    border: 0;
    border-radius: 8px;
    background: color-mix(
        in srgb,
        var(--primary, #2463c8) 9%,
        var(--surface, #fff)
    );
    color: var(--primary, #2463c8);
    font: inherit;
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
}

#appScreen .mi-hub-switch-select {
    flex: 1;
    min-width: 0;
    min-height: 37px;
    padding: 8px 11px;
    border: 1px solid var(--border, #dae3ef);
    border-radius: 8px;
    background: var(--surface, #fff);
    color: var(--text, #172b49);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

#appScreen .mi-hub-page-switcher button:focus-visible,
#appScreen .mi-hub-page-switcher select:focus-visible {
    outline: 2px solid var(--primary, #2463c8);
    outline-offset: 2px;
}

#appScreen .mi-settings-home-icon {
    font-size: 19px;
    line-height: 1;
}

@media (max-width: 750px) {
    #appScreen .mi-hub-page-switcher {
        padding: 8px;
        gap: 7px;
    }

    #appScreen .mi-hub-switch-home {
        padding: 9px;
    }
}

/* MAHIN_SETTINGS_HUB_PRODUCTION_V2 */
#settingsHubView .mi-settings-category-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
}

#settingsHubView .mi-settings-category {
    min-width: 0;
    border: 1px solid rgba(120,145,180,.28);
    border-radius: 14px;
    background: rgba(120,145,180,.055);
    overflow: hidden;
}

#settingsHubView .mi-settings-category[open] {
    border-color: rgba(61,116,212,.55);
}

#settingsHubView .mi-settings-category > summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 17px;
    cursor: pointer;
    list-style: none;
}

#settingsHubView .mi-settings-category > summary::-webkit-details-marker {
    display: none;
}

#settingsHubView .mi-category-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 11px;
    background: rgba(48,112,215,.13);
    color: #4781e8;
    font-size: 22px;
}

#settingsHubView .mi-category-title {
    display: grid;
    gap: 5px;
    min-width: 0;
    flex: 1;
}

#settingsHubView .mi-category-title strong {
    font-size: 14px;
}

#settingsHubView .mi-category-title small {
    font-size: 12px;
    opacity: .7;
    line-height: 1.4;
}

#settingsHubView .mi-settings-category > summary::after {
    content: "⌄";
    font-size: 20px;
    opacity: .65;
}

#settingsHubView .mi-settings-category[open] > summary::after {
    transform: rotate(180deg);
}

#settingsHubView .mi-category-options {
    padding: 0 15px 15px;
    display: grid;
    gap: 8px;
}

#settingsHubView .mi-setting-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    padding: 11px 13px;
    text-align: left;
    color: inherit;
    background: rgba(110,145,190,.09);
    border: 1px solid rgba(120,145,180,.22);
    border-radius: 10px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
}

#settingsHubView .mi-setting-entry:hover {
    background: rgba(75,130,215,.15);
}

#settingsHubView .mi-setting-entry:focus-visible,
#settingsHubView .mi-settings-category summary:focus-visible {
    outline: 2px solid #4781e8;
    outline-offset: 2px;
}

#settingsHubView .mi-settings-unavailable {
    font-size: 12px;
    line-height: 1.6;
    opacity: .75;
    margin: 4px 0;
}

#settingsHubView .mi-module-search {
    width: 100%;
    padding: 11px;
    border: 1px solid rgba(120,145,180,.35);
    border-radius: 9px;
    background: transparent;
    color: inherit;
}

#settingsHubView .mi-module-list {
    display: grid;
    gap: 6px;
}

#settingsHubView .mi-module-list > span {
    padding: 8px 10px;
    border: 1px solid rgba(120,145,180,.17);
    border-radius: 8px;
    font-size: 12px;
}

#settingsHubView .mi-module-list > span[hidden] {
    display: none;
}

@media (max-width: 800px) {
    #settingsHubView .mi-settings-category-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}


/* Origin: css/components/settings_navigation_polish.css; structure and behavior preserved */
/* Navigation and functional search results. Historical page-specific banner/card/search skins retired in v3. */
/* Mahin Inventory V2 — Unified Settings Navigation */

/* Consistent sidebar icons */

#appScreen .mi-polished-nav {
    display: flex;
    align-items: center;
    gap: 11px;
}

#appScreen .mi-polished-nav>.mi-polished-icon {
    flex: 0 0 19px;
    width: 19px;
    height: 19px;
}

#appScreen #settingsHomeNav>.mi-polished-icon {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
}

#appScreen .mi-settings-parent-row {
    align-items: stretch;
}

#appScreen .mi-settings-home-trigger {
    min-width: 0;
}

#appScreen .mi-settings-home-trigger.active {
    background: rgba(255, 255, 255, .12);
}

/* Header-level Settings tabs */

#appScreen .main>.topbar.mi-settings-tabs-visible {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
}

#appScreen .mi-settings-header-tabs {
    display: flex;
    align-items: center;
    gap: 7px;

    flex: 0 0 100%;
    width: 100%;
    min-width: 0;

    margin-top: 9px;
    padding: 9px 0 1px;

    border-top: 1px solid color-mix(in srgb, currentColor 10%, transparent);

    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

#appScreen .mi-settings-header-tabs[hidden] {
    display: none !important;
}

#appScreen .mi-settings-header-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    flex: 0 0 auto;
    min-height: 35px;
    padding: 8px 12px;

    border: 1px solid transparent;
    border-radius: 9px;

    background: transparent;
    color: var(--text, #172b49);

    font: inherit;
    font-size: 12px;
    font-weight: 550;
    white-space: nowrap;
    cursor: pointer;

    transition:
        background-color 160ms ease,
        border-color 160ms ease,
        color 160ms ease;
}

#appScreen .mi-settings-header-tab:hover {
    background: color-mix(in srgb,
            var(--primary, #2463c8) 8%,
            var(--surface, #fff));
}

#appScreen .mi-settings-header-tab.active {
    color: var(--primary, #2463c8);
    background: color-mix(in srgb,
            var(--primary, #2463c8) 10%,
            var(--surface, #fff));
    border-color: color-mix(in srgb,
            var(--primary, #2463c8) 24%,
            transparent);
    font-weight: 700;
}

#appScreen .mi-settings-header-tab:focus-visible {
    outline: 2px solid var(--primary, #2463c8);
    outline-offset: 2px;
}

#appScreen .mi-settings-header-tab .mi-polished-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

/* Hide redundant legacy dropdown navigation. */

#appScreen .mi-hub-page-switcher {
    display: none !important;
}

/* Dashboard is already available in main navigation. */

#appScreen #appearanceSettingsBack,
#appScreen #appearanceBackButton,
#appScreen #applicationPreferencesBack,
#appScreen #brandingSettingsBack,
#appScreen #brandingBackButton {
    display: none !important;
}

/* Keep header compact and usable on mobile. */

@media (max-width: 750px) {
    #appScreen .mi-settings-header-tabs {
        gap: 4px;
        margin-top: 6px;
        padding-top: 7px;
    }

    #appScreen .mi-settings-header-tab {
        min-height: 34px;
        padding: 8px 10px;
        font-size: 11px;
    }

    #appScreen .mi-settings-header-tab .mi-polished-icon {
        width: 15px;
        height: 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #appScreen .mi-settings-header-tab {
        transition: none !important;
    }
}

[data-mi-reduced-motion="true"] #appScreen .mi-settings-header-tab {
    transition: none !important;
}

/* STEP 4.77R.3 ? COMPACT HEADER TABS */

/* Reduce unnecessary white space surrounding Settings tabs. */
#appScreen .main>.topbar.mi-settings-tabs-visible {
    row-gap: 0 !important;
    padding-bottom: 4px !important;
}

/* Keep tabs directly under the primary header content. */
#appScreen .mi-settings-header-tabs {
    gap: 4px !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding: 2px 0 0 !important;
    border-top: 0 !important;
    border-bottom: 0 !important;
    background: transparent !important;
    min-height: 0 !important;
}

/* Compact, accessible tab buttons. */
#appScreen .mi-settings-header-tab {
    min-height: 30px !important;
    padding: 5px 9px !important;
    border-radius: 7px !important;
    font-size: 11.5px !important;
    line-height: 1.2 !important;
    gap: 5px !important;
}

/* Smaller icons match the slim buttons. */
#appScreen .mi-settings-header-tab .mi-polished-icon {
    width: 14px !important;
    height: 14px !important;
    flex-basis: 14px !important;
}

/* Selected tab retains clear but restrained emphasis. */
#appScreen .mi-settings-header-tab.active {
    box-shadow: none !important;
}

/* Responsive: prevent oversized tab rows. */
@media (max-width: 750px) {
    #appScreen .main>.topbar.mi-settings-tabs-visible {
        padding-bottom: 3px !important;
    }

    #appScreen .mi-settings-header-tabs {
        gap: 3px !important;
        padding-top: 1px !important;
    }

    #appScreen .mi-settings-header-tab {
        min-height: 32px !important;
        padding: 6px 8px !important;
        font-size: 11px !important;
    }
}

/* Step 4.81 obsolete custom active paint removed: unified navigation owns visual states. */

/* STEP 4.82 — SINGLE GEAR / RESPONSIVE SETTINGS ROW */
/* Full desktop and mobile: the Gear + full label + one chevron. */
#appScreen .mi-settings-parent-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    width: 100%;
    min-width: 0;
    gap: 4px;
}

#appScreen .mi-settings-parent-row>#settingsHomeNav {
    display: flex !important;
    flex: 1 1 0% !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 42px;
    padding: 9px 10px !important;
    overflow: hidden;
}

#appScreen #settingsHomeNav>.mi-polished-icon {
    display: block !important;
    width: 19px !important;
    height: 19px !important;
    flex: 0 0 19px !important;
    overflow: visible;
    color: inherit;
}

#appScreen #settingsHomeNav>.mi-settings-home-label {
    display: block !important;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    line-height: 1.35;
}

#appScreen .mi-settings-parent-row>#settingsGroupToggle {
    position: relative !important;
    inset: auto !important;
    display: grid !important;
    place-items: center !important;
    flex: 0 0 34px !important;
    width: 34px !important;
    min-width: 34px !important;
    height: 40px !important;
    min-height: 40px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: transparent !important;
    box-shadow: none !important;
}

#appScreen #settingsGroupToggle .mi-parent-chevron,
#appScreen #settingsGroupToggle svg {
    display: none !important;
}

#appScreen #settingsGroupToggle .mi-parent-label {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    border: 0 !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    clip-path: inset(50%) !important;
}

#appScreen #settingsGroupToggle::after {
    content: "";
    display: block;
    width: 7px;
    height: 7px;
    border-right: 1.7px solid currentColor;
    border-bottom: 1.7px solid currentColor;
    transform: rotate(45deg);
}

#appScreen #settingsGroupToggle[aria-expanded="true"]::after {
    transform: rotate(225deg);
}

/* Compact desktop: one centered gear with a small corner chevron. */
@media (min-width: 751px) {
    #appScreen.mi-settings-compact-mode .mi-settings-parent-row {
        position: relative !important;
        display: block !important;
        width: 100% !important;
    }

    #appScreen.mi-settings-compact-mode #settingsHomeNav {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0 !important;
        width: 100% !important;
        min-height: 44px !important;
        padding: 0 !important;
    }

    #appScreen.mi-settings-compact-mode #settingsHomeNav>.mi-settings-home-label {
        display: none !important;
    }

    #appScreen.mi-settings-compact-mode #settingsGroupToggle {
        position: absolute !important;
        inset: auto 0 -3px auto !important;
        z-index: 4;
        width: 21px !important;
        min-width: 21px !important;
        height: 21px !important;
        min-height: 21px !important;
        border: 1px solid rgba(255, 255, 255, .27) !important;
        border-radius: 50% !important;
        background: #28518a !important;
        color: #fff !important;
    }

    #appScreen.mi-settings-compact-mode #settingsGroupToggle::after {
        width: 5px;
        height: 5px;
    }

    #appScreen.mi-settings-compact-mode #settingsSubmenu:not([hidden]) {
        display: flex !important;
        flex-direction: column !important;
        position: static !important;
        gap: 5px !important;
        width: 100% !important;
        margin: 10px 0 3px !important;
        padding: 10px 0 0 !important;
        border: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
        overflow: visible !important;
    }

    #appScreen.mi-settings-compact-mode #settingsSubmenu:not([hidden])>button {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 42px !important;
        min-width: 42px !important;
        min-height: 40px !important;
        margin: 0 auto !important;
        padding: 8px !important;
        gap: 0 !important;
        font-size: 0 !important;
        overflow: hidden !important;
        border-radius: 9px !important;
    }

    #appScreen.mi-settings-compact-mode #settingsSubmenu:not([hidden])>button>.mi-polished-icon {
        width: 19px !important;
        height: 19px !important;
        flex: 0 0 19px !important;
        display: block !important;
    }
}

#appScreen #settingsSubmenu[hidden] {
    display: none !important;
}

/* Mobile keeps readable labels and independent >=40px chevron. */
@media (max-width: 750px) {
    #appScreen .mi-settings-parent-row {
        display: flex !important;
        flex-direction: row !important;
    }

    #appScreen .mi-settings-parent-row>#settingsHomeNav {
        flex: 1 1 0% !important;
        width: auto !important;
        justify-content: flex-start !important;
    }

    #appScreen #settingsHomeNav>.mi-settings-home-label {
        display: block !important;
    }

    #appScreen .mi-settings-parent-row>#settingsGroupToggle {
        position: relative !important;
        inset: auto !important;
        flex: 0 0 40px !important;
        width: 40px !important;
        min-width: 40px !important;
        min-height: 44px !important;
    }
}


/* STEP 4.90 - SIDEBAR TOP SPACING
   Only adjusts the space between brand and navigation.
   Does not change sidebar width, footer or behavior.
*/

#appScreen #sidebar>.sidebar-brand {
    margin-bottom: 0 !important;
    padding-bottom: 8px !important;
}

#appScreen #sidebar>.nav-label {
    margin-top: 8px !important;
    margin-bottom: 9px !important;
    padding-top: 0 !important;
}

/* Maintain comfortable spacing inside the mobile drawer. */
@media (max-width: 750px) {
    #appScreen #sidebar>.sidebar-brand {
        margin-bottom: 0 !important;
        padding-bottom: 10px !important;
    }

    #appScreen #sidebar>.nav-label {
        margin-top: 10px !important;
        margin-bottom: 10px !important;
    }
}



/* STEP 5.11 - GLOBAL QUICK ACCESS SHORTCUT HINTS */

#appScreen .mi-global-shortcut-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 35px;
    min-width: 35px;
    height: 35px;
    padding: 5px;
    border-radius: 9px;
}

#appScreen .mi-global-shortcut-toggle[hidden] {
    display: none !important;
}

#appScreen .mi-global-shortcut-toggle svg {
    display: block;
    flex: 0 0 auto;
}

#appScreen .mi-global-shortcut-indicator {
    position: absolute;
    right: 4px;
    top: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .4;
}

#appScreen .mi-global-shortcut-toggle[data-mode="show"] {
    border-color: var(--primary, #2563c9);
    background: color-mix(in srgb,
            var(--primary, #2563c9) 11%,
            var(--surface, #fff));
}

#appScreen .mi-global-shortcut-toggle[data-mode="show"] .mi-global-shortcut-indicator {
    background: #2563c9;
    opacity: 1;
}

#appScreen .mi-global-shortcut-toggle:focus-visible {
    outline: 2px solid var(--primary, #2563c9);
    outline-offset: 2px;
}

/* The old dashboard-only control is replaced by
   the shared Quick Access button. */
#appScreen #miDashShortcutControl {
    display: none !important;
}

/* App-wide hints for future registered actions. */
html[data-mi-shortcut-hints="show"] #appScreen [data-mi-shortcut]::after {
    content: attr(data-mi-shortcut);
    display: inline-block;
    margin-left: 6px;
    padding: 2px 5px;
    border: 1px solid currentColor;
    border-radius: 4px;
    font-size: 9px;
    opacity: .7;
}

/* Hide removes persistent hints, not tooltips. */
html[data-mi-shortcut-hints="hide"] #appScreen [data-mi-shortcut]::after {
    display: none !important;
}

#appScreen .mi-shortcut-preferences {
    display: grid;
    gap: 13px;
    margin-top: 18px;
    padding: 17px;
    border: 1px solid var(--border, #d7e0eb);
    border-radius: 12px;
    background: var(--surface, #fff);
}

#appScreen .mi-shortcut-preferences h3 {
    margin: 0;
    font-size: 15px;
}

#appScreen .mi-shortcut-preferences>p {
    margin: 0;
    color: var(--muted, #718096);
    font-size: 12px;
    line-height: 1.6;
}

#appScreen .mi-shortcut-preference-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 14px;
}

#appScreen .mi-shortcut-preference-row label {
    font-size: 12px;
    font-weight: 550;
}

#appScreen .mi-shortcut-preference-row select {
    min-width: 155px;
    max-width: 100%;
    min-height: 36px;
    padding: 7px 10px;
    border: 1px solid var(--border, #d7e0eb);
    border-radius: 8px;
    background: var(--surface, #fff);
    color: var(--text, #172b49);
    font: inherit;
    font-size: 12px;
}

@media (hover: none) {
    html[data-mi-shortcut-hints="show"] #appScreen [data-mi-shortcut]::after {
        display: none;
    }
}

/* MAHIN_CONTEXTUAL_MENU_STATE_FINAL */

/* Inactive Settings: no submenu chevron at any width. */
html[data-mi-palette] #appScreen.mi-settings-compact-mode:not(.mi-nav-expanded) #sidebar .mi-navigation-group .mi-settings-parent-row > #settingsGroupToggle:not([data-mi-context-active="1"]) {
    display: none !important;
}

/* Active Settings: one functional submenu toggle. */
#appScreen .mi-navigation-group .mi-settings-parent-row>#settingsGroupToggle[data-mi-context-active="1"] {
    display: grid !important;
    place-items: center !important;
}

/* Never draw two chevrons. Keep only one CSS arrow. */
#appScreen #settingsGroupToggle>* {
    display: none !important;
}

#appScreen #settingsGroupToggle::before {
    content: none !important;
    display: none !important;
}

#appScreen #settingsGroupToggle::after {
    content: "" !important;
    display: block !important;
    width: 7px !important;
    height: 7px !important;
    border: 0 !important;
    border-right: 1.7px solid currentColor !important;
    border-bottom: 1.7px solid currentColor !important;
    transform: rotate(45deg) !important;
}

#appScreen #settingsGroupToggle[aria-expanded="true"]::after {
    transform: rotate(225deg) !important;
}

/* In a compact sidebar, place the arrow BESIDE the gear,
   not below it or on top of it. */
@media (min-width: 751px) {
    html[data-mi-palette] #appScreen.mi-settings-compact-mode:not(.mi-nav-expanded) #sidebar .mi-settings-parent-row > #settingsGroupToggle[data-mi-context-active="1"] {
        display: grid !important;
        position: absolute !important;
        top: 50% !important;
        right: 2px !important;
        bottom: auto !important;
        left: auto !important;
        transform: translateY(-50%) !important;
        flex: 0 0 18px !important;
        width: 18px !important;
        min-width: 18px !important;
        height: 28px !important;
        min-height: 28px !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 5px !important;
        background: transparent !important;
        background-image: none !important;
        box-shadow: none !important;
        z-index: 3 !important;
    }
}

/* MAHIN_SETTINGS_SEVEN_PAGE_ROUTER_V1
   One navigable Settings Home and seven dedicated category pages. */
#settingsHubView .mi-v2-settings-deck[hidden],
#settingsHubView .mi-v2-settings-pages[hidden],
#settingsHubView .mi-v2-category-page[hidden] {
    display: none !important;
}

#settingsHubView.mi-v2-settings-ready .mi-v2-settings-deck {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
}

#settingsHubView .mi-v2-settings-card {
    display: flex;
    gap: 14px;
    align-items: center;
    width: 100%;
    min-width: 0;
    min-height: 94px;
    padding: 17px;
    border-radius:var(--mi-ui-radius-card,15px);
    border: 1px solid rgba(120, 145, 180, .29);
    background: rgba(120, 145, 180, .055);
    color: inherit;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

#settingsHubView .mi-v2-settings-card:hover {
    border-color: rgba(75, 132, 225, .65);
    background: rgba(87, 142, 225, .11);
}

#settingsHubView .mi-v2-cat-symbol {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: rgba(47, 109, 213, .15);
    color: #6da4fa;
    font-size: 23px;
}

#settingsHubView .mi-v2-card-text {
    display: grid;
    gap: 5px;
    flex: 1;
    min-width: 0;
}

#settingsHubView .mi-v2-card-text strong {
    font-size: 14px;
    line-height: 1.35;
}

#settingsHubView .mi-v2-card-text small {
    opacity: .75;
    line-height: 1.5;
    font-size: 12px;
}

#settingsHubView .mi-v2-card-arrow {
    font-size: 22px;
    opacity: .6;
}

#settingsHubView.mi-v2-category-open .mi-hub-heading,
#settingsHubView.mi-v2-category-open .mi-hub-search-area,
#settingsHubView.mi-v2-category-open .mi-hub-section-heading {
    display: none !important;
}

#settingsHubView .mi-v2-category-page {
    min-width:0;
    max-width:none;
    padding:0 0 28px;
}

#settingsHubView .mi-v2-category-page h2 {
    font-size: clamp(20px, 3vw, 27px);
    margin: 12px 0 9px;
}

#settingsHubView .mi-v2-category-page>small {
    display: block;
    opacity: .7;
    margin-bottom: 18px;
}

#settingsHubView .mi-v2-category-page .mi-category-options {
    display: grid;
    gap: 11px;
    padding: 0;
}

#settingsHubView .mi-v2-category-page .mi-setting-entry,
#settingsHubView .mi-v2-category-page .mi-module-search {
    min-height: 44px;
}

#settingsHubView .mi-v2-settings-back,
#appScreen .mi-v2-detail-back {
    display: inline-flex;
    align-items: center;
    width: auto;
    min-height: 36px;
    padding: 8px 12px;
    margin: 0 0 10px;
    border: 1px solid rgba(120, 145, 180, .32);
    border-radius: 9px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

#appScreen .mi-v2-detail-back {
    margin-bottom: 16px;
}

#settingsHubView .mi-v2-settings-card:focus-visible,
#settingsHubView .mi-v2-settings-back:focus-visible,
#appScreen .mi-v2-header-link:focus-visible,
#appScreen .mi-v2-sidebar-link:focus-visible,
#appScreen .mi-v2-detail-back:focus-visible {
    outline: 2px solid #6da4fa;
    outline-offset: 2px;
}

/* Keep the original hidden destination buttons for working page controllers. */
#appScreen.mi-v2-settings-ready #settingsSubmenu>#brandingSettingsNav,
#appScreen.mi-v2-settings-ready #settingsSubmenu>#appearanceSettingsNav,
#appScreen.mi-v2-settings-ready #settingsSubmenu>#applicationPreferencesNav,
#appScreen.mi-v2-settings-ready #settingsSubmenu>#settingsAboutNav {
    display: none !important;
}

#appScreen.mi-v2-settings-ready .mi-v2-settings-sidebar {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    min-width: 0;
}

#appScreen.mi-v2-settings-ready .mi-v2-sidebar-link {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
}

#appScreen.mi-v2-settings-ready .mi-v2-sidebar-link:hover,
#appScreen.mi-v2-settings-ready .mi-v2-sidebar-link.mi-v2-current {
    background: rgba(84, 140, 221, .19);
}

#appScreen .mi-v2-nav-icon {
    flex: 0 0 19px;
    text-align: center;
    font-size: 16px;
    line-height: 1;
}

#appScreen.mi-v2-settings-ready .mi-v2-nav-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* The old five Header links are replaced (not supplemented) by the same categories. */
#appScreen #miSettingsHeaderTabs:has(.mi-v2-header-link) {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    gap: 5px;
    scrollbar-width: none;
}

#appScreen #miSettingsHeaderTabs:has(.mi-v2-header-link)[hidden] {
    display: none !important;
}

#appScreen #miSettingsHeaderTabs:has(.mi-v2-header-link)::-webkit-scrollbar {
    display: none;
}





/* Collapsed sidebar retains a compact icon rail, not duplicated labels. */
@media (min-width:751px) {
    #appScreen.mi-settings-compact-mode .mi-v2-settings-sidebar {
        align-items: center;
    }

    #appScreen.mi-settings-compact-mode .mi-v2-sidebar-link {
        width: 40px;
        min-width: 40px;
        height: 38px;
        padding: 8px;
        justify-content: center;
    }

    #appScreen.mi-settings-compact-mode .mi-v2-sidebar-link .mi-v2-nav-label {
        display: none;
    }
}

@media (max-width:800px) {
    #settingsHubView.mi-v2-settings-ready .mi-v2-settings-deck {
        grid-template-columns: minmax(0, 1fr);
    }

    
}

/* MAHIN_SETTINGS_PAGE_VISIBILITY_V2 */

/* Hide Settings Home cards when a category is open. */
#settingsHubView.mi-v2-settings-ready #miV2SettingsDeck[hidden],
#settingsHubView.mi-v2-category-open #miV2SettingsDeck {
    display: none !important;
}

/* Hide inactive category pages. */
#settingsHubView.mi-v2-settings-ready #miV2SettingsPages[hidden],
#settingsHubView.mi-v2-settings-ready .mi-v2-category-page[hidden] {
    display: none !important;
}

/* MAHIN_APPEARANCE_UNIFIED_LIVE_V2: one actual Appearance category. */
#miV2SettingsPage_appearance .mi-setting-entry[data-settings-destination="appearanceSettingsNav"],
#miV2SettingsPage_appearance .mi-setting-entry[data-settings-destination="applicationPreferencesNav"] {
    display: none !important;
}

#miV2SettingsPage_appearance .mi-appearance-live-container {
    width:100%;min-width:0;margin:0 0 26px;
}

#miV2SettingsPage_appearance .mi-appearance-live-overview {
    display: grid;
    gap: 18px;
    min-width: 0;
}

#miV2SettingsPage_appearance .mi-appearance-live-overview[hidden],
#miV2SettingsPage_appearance .mi-appearance-live-detail[hidden] {
    display: none !important;
}

/* Existing view objects retain their JS listeners and IDs, but inherit their
   display state from this category while temporarily embedded here. */
#miV2SettingsPage_appearance .mi-appearance-live-reused-view,
#miV2SettingsPage_appearance .mi-appearance-live-reused-view.hidden,
#miV2SettingsPage_appearance .mi-appearance-live-reused-view[hidden] {
    display: block !important;
    position: static !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

#miV2SettingsPage_appearance .mi-appearance-live-reused-view .mi-hub-page-switcher,
#miV2SettingsPage_appearance .mi-appearance-live-reused-view .mi-v2-detail-back {
    display: none !important;
}

#miV2SettingsPage_appearance .mi-appearance-live-detail {
    display: grid;
    gap: 12px;
    max-width: 920px;
}

#miV2SettingsPage_appearance .mi-appearance-live-customize,
#miV2SettingsPage_appearance .mi-appearance-live-back,
#miV2SettingsPage_appearance .mi-appearance-live-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    max-width: 100%;
    width: fit-content;
    border: 1px solid rgba(105, 149, 204, .35);
    border-radius: 10px;
    min-height: 42px;
    padding: 10px 14px;
    background: rgba(80, 140, 220, .10);
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
}

#miV2SettingsPage_appearance .mi-appearance-live-demo-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    padding: 12px;
    margin: 8px 0 4px;
    border: 1px solid rgba(105, 149, 204, .28);
    border-radius: 10px;
    background: rgba(80, 140, 220, .06);
}

#miV2SettingsPage_appearance .mi-appearance-live-demo {
    flex: 0 0 150px;
    height: 74px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 10px;
    border: 1px solid rgba(105, 149, 204, .25);
    border-radius: 8px;
    background: rgba(110, 143, 185, .12);
    overflow: hidden;
}

#miV2SettingsPage_appearance .mi-live-demo-bar {
    display: block;
    height: 17px;
    width: 100%;
    border-radius: 4px;
    background: #3172ce;
}

#miV2SettingsPage_appearance .mi-live-demo-line {
    display: block;
    height: 5px;
    width: 80%;
    border-radius: 3px;
    background: rgba(92, 133, 185, .45);
}

#miV2SettingsPage_appearance .mi-live-demo-line:last-child {
    width: 56%;
}

#miV2SettingsPage_appearance .mi-appearance-live-demo[data-mode="dynamic"] .mi-live-demo-bar {
    animation: mi-v2-live-header 3.8s ease-in-out infinite;
}

@keyframes mi-v2-live-header {

    0%,
    25%,
    100% {
        transform: translateY(0);
        opacity: 1;
    }

    44%,
    68% {
        transform: translateY(-25px);
        opacity: .25;
    }

    82% {
        transform: translateY(0);
        opacity: 1;
    }
}

#miV2SettingsPage_appearance .mi-appearance-live-demo-caption {
    font-size: 12px;
    opacity: .78;
}

@media (max-width:800px) {
    #miV2SettingsPage_appearance .mi-appearance-live-overview {
        gap: 12px;
    }

    #miV2SettingsPage_appearance .mi-appearance-live-reused-view {
        max-width: 100%;
    }

    #miV2SettingsPage_appearance .mi-appearance-live-customize,
    #miV2SettingsPage_appearance .mi-appearance-live-back {
        width: 100%;
    }

    #miV2SettingsPage_appearance .mi-appearance-live-demo {
        flex-basis: 115px;
    }
}

@media (prefers-reduced-motion:reduce) {
    #miV2SettingsPage_appearance .mi-live-demo-bar {
        animation: none !important;
    }
}

/* MAHIN_OVERVIEW_SEARCH_PARITY_V2_START
   Overview search visual parity with Appearance.
   Keeps existing result buttons and navigation handlers.
*/

/* Search area remains in normal document flow. */
/* MAHIN_OVERVIEW_RESULTS_STACK_FIX_V3 */
html[data-mi-palette] #appScreen #settingsHubView:not(.mi-v2-category-open) .mi-hub-search-area {
    display: block !important;
    position: relative !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* One search bar, with no nested white box. */
#appScreen #settingsHubView .mi-hub-search-area>.mi-hub-search-label {
    display: flex !important;
    align-items: center !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-height: 50px !important;
    height: 50px !important;
    padding: 5px 14px !important;
    margin: 0 !important;
    gap: 11px !important;

    border: 1px solid var(--mi-ov-border) !important;
    border-radius: 13px !important;
    background: var(--mi-ov-card) !important;
    box-shadow: var(--mi-ov-shadow) !important;
}

#appScreen #settingsHubView .mi-hub-search-area>.mi-hub-search-label:focus-within {
    border-color: var(--mi-palette-accent) !important;
    box-shadow:
        0 0 0 3px rgba(var(--mi-palette-rgb), .11) !important;
}

/* Remove any square focus outline from the actual input. */
#appScreen #settingsHubView .mi-hub-search-label #settingsHubSearch,
#appScreen #settingsHubView .mi-hub-search-label #settingsHubSearch:focus-visible {
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 35px !important;
    padding: 0 !important;
    margin: 0 !important;

    border: 0 !important;
    border-radius: 0 !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* Empty input: no search-result panel. */
#appScreen #settingsHubView #settingsHubSearchResults[hidden] {
    display: none !important;
}

/* Search results live BELOW the bar, not over the page. */
#appScreen #settingsHubView #settingsHubSearchResults:not([hidden]) {
    position: static !important;
    inset: auto !important;
    transform: none !important;
    z-index: auto !important;

    display: grid !important;
    grid-template-columns:
        repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
    align-items: stretch !important;

    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    max-height: none !important;

    margin: 12px 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
}

/* Hide normal category cards WHILE the user is searching.
   Clearing the input restores the original category grid. */
#appScreen #settingsHubView:has(#settingsHubSearch:not(:placeholder-shown)) .mi-v2-settings-deck {
    display: none !important;
}

/* Compact individual result cards, like Appearance. */
html[data-mi-palette] #appScreen #settingsHubView #settingsHubSearchResults:is(.mi-hub-search-result, button, a) {
    position: relative !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: flex-start !important;

    min-width: 0 !important;
    width: 100% !important;
    min-height: 78px !important;
    height: auto !important;
    padding: 14px 16px !important;
    margin: 0 !important;
    gap: 5px !important;

    border: 1px solid var(--mi-ov-border) !important;
    border-radius: 13px !important;
    background: var(--mi-ov-card) !important;
    box-shadow: var(--mi-ov-shadow) !important;

    color: var(--mi-ov-ink) !important;
    text-align: left !important;
    text-decoration: none !important;
    white-space: normal !important;
    cursor: pointer;
}

/* Result title and description. */
#appScreen #settingsHubView #settingsHubSearchResults:is(strong, b) {
    font-size: 13px !important;
    font-weight: 750 !important;
    line-height: 1.4 !important;
    color: var(--mi-ov-ink) !important;
}

#appScreen #settingsHubView #settingsHubSearchResults:is(small, .mi-hub-result-description) {
    font-size: 11px !important;
    line-height: 1.45 !important;
    color: var(--mi-ov-muted) !important;
    white-space: normal !important;
}

/* Palette hover. */
@media (hover:hover) and (pointer:fine) {
    html[data-mi-palette] #appScreen #settingsHubView #settingsHubSearchResults :is(.mi-hub-search-result, button, a):hover {
        background: var(--mi-ov-hover) !important;
        border-color: var(--mi-ov-strong) !important;
        box-shadow:
            0 6px 18px rgba(var(--mi-palette-rgb), .12) !important;
    }
}

/* Visible keyboard focus. */
#appScreen #settingsHubView #settingsHubSearchResults:is(button, a):focus-visible {
    outline: 2px solid var(--mi-palette-accent) !important;
    outline-offset: 2px !important;
}

/* Preserve no-results message. */
#appScreen #settingsHubView #settingsHubSearchResults .mi-hub-no-results {
    grid-column: 1 / -1 !important;
    min-height: 50px !important;
    padding: 14px !important;
    border: 1px solid var(--mi-ov-border) !important;
    border-radius: 12px !important;
    background: var(--mi-ov-card) !important;
}

/* Glass effect follows the global Surface Style. */
html[data-mi-palette][data-mi-surface="glass"] #appScreen #settingsHubView #settingsHubSearchResults:is(.mi-hub-search-result, button, a) {
    -webkit-backdrop-filter:
        blur(12px) saturate(135%);
    backdrop-filter:
        blur(12px) saturate(135%);
}

/* Mobile: one result per row. */
@media (max-width:700px) {
    #appScreen #settingsHubView #settingsHubSearchResults:not([hidden]) {
        grid-template-columns:
            minmax(0, 1fr) !important;
    }
}

/* MAHIN_OVERVIEW_SEARCH_PARITY_V2_END */
/* MAHIN_HUB_SEARCH_SCOPE_HEIGHT_FIX_V1 */

/* Search belongs to the Settings Overview, not category pages. */
#appScreen #settingsHubView.mi-v2-category-open
.mi-hub-search-area,
#appScreen #settingsHubView.mi-v2-category-open
.mi-hub-searchbar,
#appScreen #settingsHubView.mi-v2-category-open
#settingsHubSearchResults {
    display: none !important;
}

/* Keep the clear button and keyboard hint compact. */
#appScreen #settingsHubView:not(.mi-v2-category-open)
.mi-hub-search-clear {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    padding: 0;
}

/* Result panel: no extra enclosing border. */
#appScreen #settingsHubView:not(.mi-v2-category-open)
#settingsHubSearchResults:not([hidden]) {
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* End of focused fix. */
/* MAHIN_HUB_SEARCH_REAL_DOM_V4: result visibility and placement only; visual search surface moved to global. */

#appScreen #settingsHubView
.mi-hub-search-clear[hidden],
#appScreen #settingsHubView
#settingsHubSearchResults[hidden] {
    display: none !important;
}

/* No extra frame around the result cards. */
html[data-mi-palette] #appScreen
#settingsHubView.mi-v2-settings-ready:not(.mi-v2-category-open)
#settingsHubSearchResults:not([hidden]) {
    position: static !important;
    inset: auto !important;
    transform: none !important;
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 12px 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
}

#appScreen #settingsHubView
.mi-hub-search-grid {
    display: grid !important;
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
    gap: 12px !important;
    background: transparent !important;
    border: 0 !important;
    padding: 0 !important;
}

/* Hide categories only while search results are open. */
#appScreen #settingsHubView.mi-v2-settings-ready.mi-searching
.mi-v2-settings-deck {
    display: none !important;
}

/* Restore categories after outside click or clear. */
#appScreen
#settingsHubView.mi-v2-settings-ready:not(.mi-searching):not(.mi-v2-category-open)
.mi-v2-settings-deck {
    display: grid !important;
}

@media (max-width: 700px) {
    #appScreen #settingsHubView .mi-hub-search-grid {
        grid-template-columns: minmax(0,1fr) !important;
    }
}


/* MAHIN_SEARCH_RESULT_CARD_DESIGN_V1_START
   Search result cards only.
   No changes to navigation, search or Appearance.
*/

/* Clean result grid without an enclosing card. */
html[data-mi-palette] #appScreen
#settingsHubView #settingsHubSearchResults
.mi-hub-search-grid {
    display: grid !important;
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
    align-items: stretch !important;
    gap: 12px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* Real existing result buttons. */
html[data-mi-palette] #appScreen
#settingsHubView #settingsHubSearchResults
.mi-hub-search-grid > :is(button,a) {
    box-sizing: border-box !important;
    position: relative !important;

    display: grid !important;
    grid-template-columns:
        38px minmax(0,1fr) 18px !important;
    grid-template-rows: auto auto !important;

    align-content: center !important;
    align-items: center !important;
    justify-content: stretch !important;
    justify-items: stretch !important;
    column-gap: 12px !important;
    row-gap: 4px !important;

    min-width: 0 !important;
    width: 100% !important;
    min-height: 78px !important;
    height: auto !important;
    padding: 13px 15px !important;
    margin: 0 !important;

    border-radius: 14px !important;
    border: 1px solid
        rgba(var(--mi-palette-rgb),.30) !important;

    background: linear-gradient(
        145deg,
        rgba(255,255,255,.72),
        rgba(var(--mi-palette-rgb),.10)
    ) !important;

    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.37),
        0 3px 10px rgba(var(--mi-palette-rgb),.045)
        !important;

    text-align: left !important;
    color: var(--mi-ov-ink) !important;
    text-decoration: none !important;
    white-space: normal !important;
    cursor: pointer !important;

    transition:
        background .18s ease,
        border-color .18s ease,
        box-shadow .18s ease,
        transform .18s ease !important;
}

/* Left icon box — same visual family as Settings category icons. */
html[data-mi-palette] #appScreen
#settingsHubView #settingsHubSearchResults
.mi-hub-search-grid > :is(button,a)::before {
    content: "⚙" !important;
    grid-column: 1 !important;
    grid-row: 1 / 3 !important;

    display: grid !important;
    place-items: center !important;
    width: 38px !important;
    height: 38px !important;

    font-size: 20px !important;
    font-weight: 400 !important;
    line-height: 1 !important;

    color: var(--mi-palette-accent) !important;
    background: rgba(var(--mi-palette-rgb),.12) !important;
    border: 1px solid
        rgba(var(--mi-palette-rgb),.22) !important;
    border-radius: 10px !important;
    box-sizing: border-box !important;
}

/* Right navigation chevron. */
html[data-mi-palette] #appScreen
#settingsHubView #settingsHubSearchResults
.mi-hub-search-grid > :is(button,a)::after {
    content: "›" !important;
    grid-column: 3 !important;
    grid-row: 1 / 3 !important;
    justify-self: center !important;

    font-size: 24px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    color: var(--mi-palette-accent) !important;
    transition: transform .18s ease !important;
}

/* Title — left aligned, never centered. */
html[data-mi-palette] #appScreen
#settingsHubView #settingsHubSearchResults
.mi-hub-search-grid > :is(button,a)
.mi-hub-search-result-title {
    grid-column: 2 !important;
    grid-row: 1 !important;
    display: block !important;

    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;

    text-align: left !important;
    font-size: 13px !important;
    font-weight: 750 !important;
    line-height: 1.35 !important;
    color: var(--mi-ov-ink) !important;
    overflow-wrap: anywhere !important;
}

/* Description — directly below the title. */
html[data-mi-palette] #appScreen
#settingsHubView #settingsHubSearchResults
.mi-hub-search-grid > :is(button,a)
.mi-hub-search-result-subtitle {
    grid-column: 2 !important;
    grid-row: 2 !important;
    display: block !important;

    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;

    text-align: left !important;
    font-size: 11px !important;
    font-weight: 400 !important;
    line-height: 1.45 !important;
    color: var(--mi-ov-muted) !important;
    overflow-wrap: anywhere !important;
}

/* Solid mode: clearer opaque surface. */
html[data-mi-palette][data-mi-surface="solid"]
#appScreen #settingsHubView
#settingsHubSearchResults .mi-hub-search-grid
> :is(button,a) {
    background: linear-gradient(
        145deg,
        color-mix(in srgb,
            white 93%,var(--mi-palette-accent)),
        color-mix(in srgb,
            white 85%,var(--mi-palette-accent))
    ) !important;
}

/* Glass mode: translucent surface. */
html[data-mi-palette][data-mi-surface="glass"]
#appScreen #settingsHubView
#settingsHubSearchResults .mi-hub-search-grid
> :is(button,a) {
    background: linear-gradient(
        145deg,
        rgba(255,255,255,.36),
        rgba(var(--mi-palette-rgb),.13)
    ) !important;

    -webkit-backdrop-filter:
        blur(12px) saturate(140%) !important;
    backdrop-filter:
        blur(12px) saturate(140%) !important;
}

/* Hover and active feedback. */
@media (hover:hover) and (pointer:fine) {
    html[data-mi-palette] #appScreen
    #settingsHubView #settingsHubSearchResults
    .mi-hub-search-grid > :is(button,a):hover {
        border-color:
            rgba(var(--mi-palette-rgb),.62) !important;
        background: linear-gradient(
            145deg,
            rgba(255,255,255,.46),
            rgba(var(--mi-palette-rgb),.21)
        ) !important;

        box-shadow:
            0 7px 19px rgba(var(--mi-palette-rgb),.13)
            !important;
        transform: translateY(-2px) !important;
    }

    html[data-mi-palette] #appScreen
    #settingsHubView #settingsHubSearchResults
    .mi-hub-search-grid > :is(button,a):hover::after {
        transform: translateX(3px) !important;
    }
}

#appScreen #settingsHubView
#settingsHubSearchResults
.mi-hub-search-grid > :is(button,a):active {
    transform: scale(.99) !important;
}

/* Dark mode. */
html[data-mi-palette][data-theme="dark"]
#appScreen #settingsHubView
#settingsHubSearchResults .mi-hub-search-grid
> :is(button,a),
html[data-mi-palette] body[data-theme="dark"]
#appScreen #settingsHubView
#settingsHubSearchResults .mi-hub-search-grid
> :is(button,a) {
    background: linear-gradient(
        145deg,
        rgba(38,55,79,.88),
        rgba(var(--mi-palette-rgb),.17)
    ) !important;
    border-color:
        rgba(var(--mi-palette-rgb),.43) !important;
}

/* Mobile layout. */
@media (max-width: 700px) {
    #appScreen #settingsHubView
    #settingsHubSearchResults .mi-hub-search-grid {
        grid-template-columns: minmax(0,1fr) !important;
        gap: 10px !important;
    }

    #appScreen #settingsHubView
    #settingsHubSearchResults
    .mi-hub-search-grid > :is(button,a) {
        min-height: 72px !important;
        padding: 12px !important;
        column-gap: 10px !important;
    }
}

/* MAHIN_SEARCH_RESULT_CARD_DESIGN_V1_END */










/* Behavioral visibility from the retired six-category presentation block. */
#settingsHubView :is(.mi-six-category-clear,.mi-six-category-empty)[hidden],
#settingsHubView .mi-six-category-options > [hidden] { display: none !important; }

/* MAHIN_SETTINGS_CHEVRON_POLISH_V1_START */
@media (min-width: 751px) {
    html[data-mi-palette] #appScreen.mi-settings-compact-mode:not(.mi-nav-expanded) #sidebar .mi-settings-parent-row {
        position: relative !important;
    }

    html[data-mi-palette] #appScreen.mi-settings-compact-mode:not(.mi-nav-expanded) #sidebar #settingsHomeNav {
        padding-right: 12px !important;
    }

    html[data-mi-palette] #appScreen.mi-settings-compact-mode:not(.mi-nav-expanded) #sidebar .mi-settings-parent-row > #settingsGroupToggle[data-mi-context-active="1"] {
        display: grid !important;
        place-items: center !important;
        position: absolute !important;
        top: 50% !important;
        right: 4px !important;
        left: auto !important;
        bottom: auto !important;
        transform: translateY(-50%) !important;
        width: 18px !important;
        min-width: 18px !important;
        height: 18px !important;
        min-height: 18px !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 1px solid rgba(98, 88, 226, 0.22) !important;
        border-radius: 999px !important;
        background: rgba(255, 255, 255, 0.94) !important;
        background-image: none !important;
        color: var(--primary, #5c57e6) !important;
        box-shadow: 0 2px 8px rgba(29, 43, 78, 0.12) !important;
        z-index: 4 !important;
        overflow: hidden !important;
    }

    html[data-mi-palette] #appScreen.mi-settings-compact-mode:not(.mi-nav-expanded) #sidebar .mi-settings-parent-row > #settingsGroupToggle[data-mi-context-active="1"]:hover {
        border-color: rgba(98, 88, 226, 0.34) !important;
        background: rgba(255, 255, 255, 0.98) !important;
        box-shadow: 0 3px 10px rgba(29, 43, 78, 0.16) !important;
    }

    html[data-mi-palette] #appScreen.mi-settings-compact-mode:not(.mi-nav-expanded) #sidebar .mi-settings-parent-row > #settingsGroupToggle[data-mi-context-active="1"]::after {
        content: "" !important;
        display: block !important;
        width: 5px !important;
        height: 5px !important;
        margin-top: -1px !important;
        border: 0 !important;
        border-right: 1.6px solid currentColor !important;
        border-bottom: 1.6px solid currentColor !important;
        transform: rotate(45deg) !important;
    }

    html[data-mi-palette] #appScreen.mi-settings-compact-mode:not(.mi-nav-expanded) #sidebar .mi-settings-parent-row > #settingsGroupToggle[data-mi-context-active="1"][aria-expanded="true"]::after {
        margin-top: 1px !important;
        transform: rotate(225deg) !important;
    }
}
/* MAHIN_SETTINGS_CHEVRON_POLISH_V1_END */

/* MAHIN_SHARED_SHORTCUT_CENTER_V3 - global, signature-style-neutral */
#appScreen .mi-shortcut-center-button {
  position:relative; display:inline-flex; justify-content:center; align-items:center;
  width:35px; min-width:35px; height:35px; padding:5px;
  border-radius:var(--mi-global-control-radius,9px);
  color:inherit; cursor:pointer;
}
#appScreen .mi-shortcut-center-button[hidden] {display:none!important}
#appScreen .mi-shortcut-center-button svg {display:block; pointer-events:none;}
#appScreen .mi-global-shortcut-toggle .mi-hint-eye-slash {opacity:0;}
#appScreen .mi-global-shortcut-toggle[data-mode="hide"] .mi-hint-eye-slash {opacity:1;}
#appScreen .mi-global-shortcut-help {flex:0 0 auto;}
#appScreen .mi-global-shortcut-help:focus-visible,
#appScreen .mi-global-shortcut-toggle:focus-visible {outline:2px solid var(--mi-global-accent,#2972d0);outline-offset:2px;}
#appScreen .mi-shortcut-center-settings {
  margin:12px 0 0; padding:14px; border-radius:var(--mi-global-control-radius,12px);
  border:1px solid var(--mi-global-line,#ccd7e7);
  background:var(--mi-global-card,#fff);color:var(--mi-global-foreground,inherit);
}
#appScreen .mi-shortcut-center-settings h3 {font-size:14px;margin:0;}
#appScreen .mi-shortcut-center-settings p {margin:4px 0 10px;font-size:12px;opacity:.85;line-height:1.55;}
#appScreen .mi-shortcut-center-settings .mi-shortcut-preference-row {margin-top:9px;}
#appScreen .mi-shortcut-center-settings select {color:inherit;background:var(--mi-global-card,#fff);border:1px solid var(--mi-global-line,#cad6e8);}
#appScreen #miGlobalShortcutHelp[data-mi-shortcut]::after {
  position:absolute;top:100%;right:0;margin:3px 0 0;z-index:3;white-space:nowrap;
}
html[data-mi-shortcut-hints="hide"] #appScreen .mi-unified-search-hint {display:none!important;}
html[data-mi-shortcut-hints="show"] #appScreen [data-mi-shortcut-center="1"]::after {
  content:attr(data-mi-shortcut);display:inline-block;margin-left:6px;padding:2px 5px;
  border:1px solid currentColor;border-radius:5px;font-size:10px;line-height:1.4;
  opacity:.86;vertical-align:middle;pointer-events:none;
}
html[data-mi-shortcut-hints="hide"] #appScreen [data-mi-shortcut-center="1"]::after {display:none!important;}
.mi-shortcut-center-dialog {max-width:min(560px,calc(100vw - 28px));width:100%;
  border:1px solid var(--mi-global-line,#cad6e8);border-radius:16px;
  background:var(--mi-global-card,#fff);color:var(--mi-global-foreground,#14223d);
  padding:22px;box-shadow:0 20px 75px rgba(0,0,0,.3);}
.mi-shortcut-center-dialog::backdrop {background:rgba(6,15,30,.54);}
.mi-shortcut-center-dialog h2 {margin:0 0 5px;}
.mi-shortcut-center-dialog>p {margin:0 0 14px;font-size:13px;opacity:.8;}
.mi-shortcut-center-dialog .mi-shortcut-help-list>div {display:flex;justify-content:space-between;align-items:center;gap:12px;padding:10px 0;border-bottom:1px solid var(--mi-global-line,#cbd5e1);}
.mi-shortcut-center-dialog .mi-shortcut-help-list kbd {font-size:12px;white-space:nowrap;padding:5px 8px;border:1px solid var(--mi-global-line,#cbd5e1);border-radius:6px;background:var(--mi-global-tile,#edf3fa);}
.mi-shortcut-center-dialog>button {margin-top:18px;min-width:95px;padding:8px 14px;border:1px solid var(--mi-global-line,#cbd5e1);border-radius:8px;background:var(--mi-global-tile,#edf3fa);color:inherit;cursor:pointer;}
@media (hover:none) {html[data-mi-shortcut-hints="show"] #appScreen [data-mi-shortcut-center="1"]::after {display:none!important;}}
@media(max-width:650px) {#appScreen .mi-shortcut-center-button{width:32px;min-width:32px;height:32px;}}


/* =======================================================================
 * MAHIN_GLOBAL_SHORTCUT_BUTTON_AND_POPUP_CONTRACT_V3
 * One reusable visual contract for every existing/future popup or action:
 * data-mi-ui-popup and data-mi-ui-button are opt-in shared component hooks.
 * Signature styles supply only tokens, never duplicate component code.
 * ======================================================================= */
:root {
  --mi-popup-bg:var(--mi-global-card,var(--surface,#fff));
  --mi-popup-ink:var(--mi-global-foreground,var(--text,#132542));
  --mi-popup-muted:var(--mi-global-subtle,var(--muted,#62758e));
  --mi-popup-line:var(--mi-global-line,var(--border,#ced8e9));
  --mi-popup-accent:var(--mi-global-accent,var(--primary,#2869dc));
  --mi-popup-control-bg:var(--mi-global-tile,#edf4ff);
  --mi-popup-radius:var(--mi-global-control-radius,12px);
  --mi-popup-shadow:0 24px 70px rgba(5,18,38,.28);
  --mi-popup-head-art:none;
}
/* Five signature variants own ONLY values. The reusable markup is unchanged. */
html[data-mi-visual-style="aether-glass"] {
  --mi-popup-bg:#e7f7ff;--mi-popup-ink:#143655;
  --mi-popup-muted:#42647e;--mi-popup-line:rgba(95,163,222,.56);
  --mi-popup-accent:#276ccf;--mi-popup-control-bg:rgba(244,251,255,.9);
  --mi-popup-head-art:linear-gradient(115deg,#c2f4ff,#bcd5ff 63%,#e6d9ff);
}
html[data-mi-visual-style="orbit-luxe"] {
  --mi-popup-bg:#081b34;--mi-popup-ink:#eff8ff;
  --mi-popup-muted:#aac3dd;--mi-popup-line:rgba(85,170,239,.54);
  --mi-popup-accent:#67d5ff;--mi-popup-control-bg:rgba(22,51,90,.96);
  --mi-popup-head-art:linear-gradient(110deg,#103c65,#111c40 76%,#122d51);
}
html[data-mi-visual-style="sakura-pearl"] {
  --mi-popup-bg:#fff0fa;--mi-popup-ink:#542542;
  --mi-popup-muted:#81536f;--mi-popup-line:rgba(223,132,190,.62);
  --mi-popup-accent:#d92d8d;--mi-popup-control-bg:rgba(255,249,253,.96);
  --mi-popup-head-art:linear-gradient(110deg,#ffe0ef,#ffeaf9 60%,#f8d7ef);
}
html[data-mi-visual-style="obsidian-ember"] {
  --mi-popup-bg:#181619;--mi-popup-ink:#fff2e5;
  --mi-popup-muted:#d6ac92;--mi-popup-line:rgba(245,129,46,.58);
  --mi-popup-accent:#ff952d;--mi-popup-control-bg:rgba(44,34,28,.96);
  --mi-popup-head-art:linear-gradient(114deg,#2d201b,#161519 70%,#3b251a);
}
html[data-mi-visual-style="emerald-mihrab"] {
  --mi-popup-bg:#fff8e8;--mi-popup-ink:#164936;
  --mi-popup-muted:#6b7457;--mi-popup-line:rgba(190,147,69,.70);
  --mi-popup-accent:#a87521;--mi-popup-control-bg:#fffdf5;
  --mi-popup-head-art:linear-gradient(110deg,#e6f3e3,#fff6e3 59%,#f2e7cd);
}

/* Global popup surfaces: the same selector family covers Header More,
 * Quick Access More, Help dialog and any new popup using data-mi-ui-popup. */
html #appScreen :is(.mi-shortcut-center-dialog,.mi-quick-access-menu,[data-mi-ui-popup]),
html :is(.mi-v6-tool-menu,.mi-v6-keyboard-guide)[role],
html .mi-v6-tool-menu {
  box-sizing:border-box;
  background:var(--mi-popup-bg)!important;
  color:var(--mi-popup-ink)!important;
  border:1px solid var(--mi-popup-line)!important;
  border-radius:var(--mi-popup-radius)!important;
  box-shadow:var(--mi-popup-shadow)!important;
}
html #appScreen .mi-shortcut-center-dialog {padding:0!important;overflow:visible;max-height:min(84dvh,720px);}
html #appScreen .mi-shortcut-center-dialog > h2 {
  padding:16px 20px;margin:0!important;
  color:var(--mi-popup-ink)!important;
  border-radius:calc(var(--mi-popup-radius) - 1px) calc(var(--mi-popup-radius) - 1px) 0 0;
  border-bottom:1px solid var(--mi-popup-line);
  background-image:var(--mi-popup-head-art)!important;
  font-size:17px;line-height:1.5;
}
html #appScreen .mi-shortcut-center-dialog > p,
html #appScreen .mi-shortcut-center-dialog > .mi-shortcut-help-list {
  margin:0!important;padding:13px 20px;
  color:var(--mi-popup-ink)!important;
}
html #appScreen .mi-shortcut-center-dialog > p {color:var(--mi-popup-muted)!important;padding-bottom:3px;}
html #appScreen .mi-shortcut-center-dialog .mi-shortcut-help-list {max-height:45dvh;overflow:auto;}
html #appScreen .mi-shortcut-center-dialog .mi-shortcut-help-list > div {
  border-bottom:1px solid var(--mi-popup-line)!important;
}
html #appScreen .mi-shortcut-center-dialog .mi-shortcut-help-list > div:last-child {border-bottom:0!important;}
html #appScreen .mi-shortcut-center-dialog kbd {
  color:var(--mi-popup-ink)!important;
  background:var(--mi-popup-control-bg)!important;
  border:1px solid var(--mi-popup-line)!important;
}
html #appScreen .mi-shortcut-center-dialog > button {
  display:inline-flex;align-items:center;justify-content:center;
  margin:7px 20px 19px!important;min-height:36px;max-width:calc(100% - 40px);
}

/* Unified shared buttons: new actions opt into data-mi-ui-button; existing
 * shortcut buttons, modal actions and menu actions use the same surface. */
html #appScreen :is(.mi-shortcut-center-button,.mi-shortcut-center-dialog > button,[data-mi-ui-button]),
html :is(.mi-v6-tool-menu,.mi-v6-keyboard-guide) button {
  box-sizing:border-box;
  background:var(--mi-popup-control-bg)!important;
  color:var(--mi-popup-ink)!important;
  border:1px solid var(--mi-popup-line)!important;
  border-radius:var(--mi-popup-radius)!important;
  box-shadow:none;
  cursor:pointer;
  transition:border-color .15s ease,box-shadow .15s ease,background .15s ease;
}
html #appScreen :is(.mi-shortcut-center-button,.mi-shortcut-center-dialog > button,[data-mi-ui-button]):is(:hover,:focus-visible),
html :is(.mi-v6-tool-menu,.mi-v6-keyboard-guide) button:is(:hover,:focus-visible) {
  border-color:var(--mi-popup-accent)!important;
  box-shadow:0 0 0 2px color-mix(in srgb,var(--mi-popup-accent) 18%,transparent)!important;
}
html #appScreen :is(.mi-shortcut-center-button,.mi-shortcut-center-dialog > button,[data-mi-ui-button]):focus-visible,
html :is(.mi-v6-tool-menu,.mi-v6-keyboard-guide) button:focus-visible {
  outline:2px solid var(--mi-popup-accent)!important;outline-offset:2px;
}
html #appScreen .mi-shortcut-center-button svg {width:20px;height:20px;}
html #appScreen #miGlobalShortcutHelp::after {display:none!important;content:none!important;}
/* Responsive popup scroll without cutting off buttons. */
@media(max-width:620px) {
  html #appScreen .mi-shortcut-center-dialog > h2 {padding:12px 14px;}
  html #appScreen .mi-shortcut-center-dialog > p,
  html #appScreen .mi-shortcut-center-dialog > .mi-shortcut-help-list {padding:9px 14px;}
  html #appScreen .mi-shortcut-center-dialog > button {margin:7px 14px 14px!important;}
}
@media(prefers-reduced-motion:reduce) {
  html #appScreen .mi-shortcut-center-button {transition:none!important;}
}
