/* Shared navigation chrome only. Business controls and permission gates remain local. */
:root {
    --oa-nav-ink: #213b30;
    --oa-nav-muted: #63756c;
    --oa-nav-accent: #17634b;
    --oa-nav-selected: #eaf4ee;
    --oa-nav-line: #e1e9e5;
}

.oa-business-shell .oa-header {
    padding-block: 14px 12px;
    border-bottom-color: var(--oa-nav-line);
    background: #fff;
}
.oa-business-shell .oa-header .header-inner { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.oa-business-shell .oa-header .header-top { gap: 16px; flex-wrap: wrap; }
.oa-business-shell .oa-header .brand-logo { height: 34px; }
.oa-business-shell .oa-header .brand-link { flex: 0 0 auto; }
.oa-business-shell .oa-header .account-menu {
    gap: 4px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    flex-wrap: wrap;
}
.oa-business-shell .oa-header .account-name { min-width: 0; max-width: 100%; color: var(--oa-nav-muted); font-weight: 400; }
.oa-business-shell .oa-header .account-name strong { min-width: 0; white-space: normal; overflow-wrap: anywhere; color: var(--oa-nav-ink); font-weight: 600; }
.oa-business-shell .oa-header :is(.account-action-link, .account-logout-button) {
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 7px;
    margin: 0;
    background: transparent;
    color: var(--oa-nav-muted);
    font-weight: 500;
}

/* Calm group labels, one consistent link treatment and one current location. */
.oa-business-shell .oa-header :is(.role-module-nav, .module-nav),
.oa-admin-shell #container .admin-module-nav,
.oa-label-shell .nav-tabs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 12px;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding: 10px 0;
    border: 0;
    border-top: 1px solid var(--oa-nav-line);
    border-bottom: 1px solid var(--oa-nav-line);
    border-radius: 0;
    background: #fff;
    box-shadow: none;
}
.oa-business-shell .oa-header .nav-group,
.oa-admin-shell #container .admin-role-module-group {
    display: inline-flex;
    flex: 0 1 auto;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
    padding: 0 0 0 12px;
    border: 0;
    border-left: 1px solid var(--oa-nav-line);
    background: transparent;
}
.oa-admin-shell #container .admin-role-module-group { border-left: 0; padding: 0; }
.oa-business-shell .oa-header .nav-group-label,
.oa-admin-shell #container .admin-role-module-title {
    min-height: 28px;
    margin: 0;
    padding: 0 6px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--oa-nav-muted);
    font-size: 12px;
    font-weight: 500;
    white-space: normal;
}
.oa-business-shell .oa-header :is(.role-module-nav, .module-nav) a,
.oa-admin-shell #container .admin-module-nav a,
.oa-label-shell .nav-tabs :is(a, .nav-backend-trigger) {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    box-sizing: border-box;
    min-height: 36px;
    max-width: 100%;
    margin: 0;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--oa-nav-ink);
    box-shadow: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    text-align: start;
    overflow-wrap: anywhere;
    text-decoration: none;
    transition: transform 160ms ease-out;
}
.oa-business-shell .oa-header :is(.role-module-nav, .module-nav) a[aria-current],
.oa-admin-shell #container .admin-module-nav a[aria-current],
.oa-label-shell .nav-tabs a[aria-current] {
    background: var(--oa-nav-selected);
    color: var(--oa-nav-accent);
    font-weight: 650;
    box-shadow: inset 0 -2px 0 var(--oa-nav-accent);
}
.oa-business-shell .oa-header .notification-badge {
    min-width: 18px;
    height: 18px;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    box-shadow: none;
}

/* Existing page disclosures share the shell instead of reinstating old grids. */
.oa-business-shell .oa-header :is(.sales-entry-module-navigation, .order-workspace-module-navigation) {
    width: 100%;
    min-width: 0;
}
.oa-business-shell .oa-header :is(.sales-entry-module-navigation, .order-workspace-module-navigation) > summary {
    box-sizing: border-box;
    width: fit-content;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid var(--oa-nav-line);
    border-radius: 7px;
    background: #f7faf8;
    color: var(--oa-nav-muted);
    font-size: 13px;
    cursor: pointer;
}

/* Paths are text links; they must never inherit the system's button defaults. */
.oa-business-shell .oa-header .page-navigation { width: 100%; margin: 0; }
.oa-business-shell .oa-header .page-breadcrumb,
.oa-admin-shell #container div.breadcrumbs,
.oa-business-shell :is(.crm-module .breadcrumb, .crm-admin-breadcrumb) {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 8px;
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--oa-nav-muted);
    font-size: 13px;
    line-height: 1.65;
    overflow-wrap: anywhere;
}
.oa-business-shell .oa-header .page-breadcrumb a,
.oa-admin-shell #container div.breadcrumbs a,
.oa-business-shell :is(.crm-module .breadcrumb, .crm-admin-breadcrumb) a {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    max-width: 100%;
    margin: 0;
    padding: 2px 0;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: var(--oa-nav-muted);
    box-shadow: none;
    font-size: inherit;
    font-weight: 400;
    text-align: start;
    white-space: normal;
    overflow-wrap: anywhere;
}
.oa-business-shell .oa-header .page-breadcrumb [aria-current="page"],
.oa-admin-shell #container div.breadcrumbs [aria-current="page"] {
    min-width: 0;
    color: var(--oa-nav-ink);
    font-weight: 600;
}
.oa-business-shell .oa-header .page-breadcrumb-separator,
.oa-admin-shell #container .breadcrumbs .page-breadcrumb-separator { color: #8b9b92; }
.oa-business-shell .oa-header .page-back-row { margin: 0; }
.oa-business-shell .oa-header .page-back-button,
.oa-admin-shell #container .admin-global-back-row .page-back-button {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    margin: 0;
    padding: 3px 10px;
    border: 1px solid var(--oa-nav-line);
    border-radius: 7px;
    background: #fff;
    color: var(--oa-nav-muted);
    box-shadow: none;
    font-size: 12px;
    font-weight: 500;
    transition: transform 160ms ease-out;
}
.oa-business-shell .oa-header .page-back-button::before { content: "←"; margin-right: 6px; }

/* Admin and print shells use the same spacing without affecting their content. */
.oa-admin-shell #container #header { min-height: 72px; padding-block: 14px; gap: 12px 20px; }
.oa-admin-shell #container #user-tools :is(a, button) { border-color: transparent; background: transparent; color: var(--oa-nav-muted); }
.oa-admin-shell #container .admin-role-modules { padding-block: 0; }
.oa-admin-shell #container div.breadcrumbs { padding: 12px 32px 4px; }
.oa-admin-shell #container .admin-global-back-row { padding-top: 4px; }
.oa-label-shell .topbar { gap: 12px; padding-block: 12px; background: #fff; color: var(--oa-nav-ink); border-bottom: 1px solid var(--oa-nav-line); }
.oa-label-shell .topbar .environment { color: var(--oa-nav-muted); overflow-wrap: anywhere; }
.oa-label-shell .topbar .nav-account-action { min-height: 32px; border-color: var(--oa-nav-line); color: var(--oa-nav-muted); }
.oa-label-shell .topbar .version { color: var(--oa-nav-muted); }
.oa-label-shell .topbar .rule-management-back-link { color: var(--oa-nav-accent); }
.oa-label-shell .nav-tabs { padding-inline: 28px; }
.oa-label-shell .nav-backend-trigger { list-style: none; cursor: pointer; }
.oa-label-shell .nav-backend-trigger::-webkit-details-marker { display: none; }
.oa-label-shell .nav-backend-menu:not([open]) .nav-backend-dropdown { display: none; }
.oa-label-shell .nav-backend-menu[open] .nav-backend-dropdown {
    display: grid;
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
    border-color: var(--oa-nav-line);
    transform-origin: top left;
    max-width: calc(100vw - 40px);
    min-width: min(210px, calc(100vw - 40px));
}
.oa-label-shell .nav-backend-menu[open] .nav-backend-trigger { background: var(--oa-nav-selected); color: var(--oa-nav-accent); }
.oa-label-shell .nav-backend-menu[open] .nav-backend-trigger::after { transform: rotate(180deg); }
.oa-label-shell .nav-backend-menu:not([open]) .nav-backend-trigger::after { transform: none; }
.oa-label-shell .nav-tabs .nav-backend-dropdown a { white-space: normal; }

/* Keep the path and history action together, in reading order. */
.oa-business-shell .oa-header .oa-location-row,
.oa-admin-shell #container .oa-location-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 16px;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
}
.oa-business-shell .oa-header .oa-location-row:not(:has(> *)) { display: none; }
.oa-business-shell .oa-header .oa-location-row > .page-navigation { flex: 1 1 240px; width: auto; }
.oa-business-shell .oa-header .oa-location-row > .page-back-row { width: auto; flex: 0 0 auto; margin-left: auto; }
.oa-admin-shell #container .oa-location-row { padding: 12px 32px 4px; }
.oa-admin-shell #container .oa-location-row > nav { flex: 1 1 240px; min-width: 0; }
.oa-admin-shell #container .oa-location-row div.breadcrumbs { padding: 0; }
.oa-admin-shell #container .oa-location-row .admin-global-back-row { width: auto; flex: 0 0 auto; margin-left: auto; padding: 0; }

.oa-nav-toggle { display: none; }
:is(.oa-header, .oa-admin-shell #header, .admin-module-nav, .oa-label-shell .nav-tabs) :is(a, button, summary):focus-visible,
.oa-nav-toggle:focus-visible,
.oa-admin-shell #container div.breadcrumbs a:focus-visible {
    outline: 2px solid var(--oa-nav-accent);
    outline-offset: 3px;
}
@media (hover: hover) and (pointer: fine) {
    .oa-business-shell .oa-header :is(.role-module-nav, .module-nav) a:hover,
    .oa-admin-shell #container .admin-module-nav a:hover,
    .oa-label-shell .nav-tabs :is(a, .nav-backend-trigger):hover,
    .oa-business-shell .oa-header :is(.account-action-link, .account-logout-button, .page-back-button):hover,
    .oa-nav-toggle:hover {
        border-color: transparent;
        background: #f1f6f3;
        color: var(--oa-nav-accent);
    }
    .oa-business-shell .oa-header .page-breadcrumb a:hover,
    .oa-admin-shell #container div.breadcrumbs a:hover,
    .oa-business-shell :is(.crm-module .breadcrumb, .crm-admin-breadcrumb) a:hover {
        background: transparent;
        color: var(--oa-nav-accent);
    }
}
:is(.oa-header .role-module-nav, .oa-header .module-nav, .admin-module-nav, .oa-label-shell .nav-tabs) a:active,
.oa-business-shell .oa-header :is(.account-action-link, .account-logout-button, .page-back-button):active,
.oa-nav-toggle:active { transform: scale(.97); }

@media (max-width: 720px) {
    .oa-business-shell .oa-header { padding-block: 12px; }
    .oa-business-shell .oa-header .header-inner { gap: 10px; }
    .oa-business-shell .oa-header .header-top { flex-direction: row; align-items: center; gap: 10px; }
    .oa-business-shell .oa-header .brand-link { width: auto; }
    .oa-business-shell .oa-header .brand-logo { height: 30px; max-width: 100px; }
    .oa-business-shell .oa-header .account-menu { width: 100%; gap: 2px; }
    .oa-business-shell .oa-header :is(.account-action-link, .account-logout-button) { min-height: 40px; padding-inline: 8px; }
    .oa-business-shell .oa-header .account-name { padding-left: 0; }
    .oa-business-shell .oa-header .nav-group,
    .oa-admin-shell #container .admin-role-module-group {
        flex: 1 1 100%;
        align-items: center;
        padding: 8px 0 0;
        border: 0;
        border-top: 1px solid var(--oa-nav-line);
    }
    .oa-business-shell .oa-header .nav-group-label,
    .oa-admin-shell #container .admin-role-module-title { flex-basis: 100%; padding-inline: 8px; }
    .oa-business-shell .oa-header :is(.role-module-nav, .module-nav) a,
    .oa-admin-shell #container .admin-module-nav a,
    .oa-label-shell .nav-tabs :is(a, .nav-backend-trigger) { min-height: 44px; }
    .oa-business-shell .oa-header :is(.sales-entry-module-navigation, .order-workspace-module-navigation) > summary { min-height: 44px; }
    .oa-nav-toggle {
        display: flex;
        align-items: center;
        gap: 10px;
        box-sizing: border-box;
        width: 100%;
        min-height: 44px;
        padding: 8px 12px;
        border: 1px solid var(--oa-nav-line);
        border-radius: 8px;
        background: #f7faf8;
        color: var(--oa-nav-ink);
        font: inherit;
        font-size: 13px;
        text-align: start;
        cursor: pointer;
        transition: transform 160ms ease-out;
    }
    .oa-nav-toggle-location { flex: 1; color: var(--oa-nav-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .oa-nav-toggle::after { content: "⌄"; margin-left: auto; }
    .oa-nav-toggle[aria-expanded="true"]::after { transform: rotate(180deg); }
    :is(.oa-header .role-module-nav, .admin-module-nav, .oa-label-shell .nav-tabs)[data-nav-collapsed="true"] { display: none !important; }
    .oa-business-shell .oa-header .page-breadcrumb,
    .oa-admin-shell #container div.breadcrumbs { gap: 2px 6px; font-size: 12px; }
    .oa-business-shell .oa-header .page-breadcrumb a,
    .oa-admin-shell #container div.breadcrumbs a { min-height: 36px; }
    .oa-admin-shell #container div.breadcrumbs { padding: 10px 16px 4px; }
    .oa-admin-shell #container .admin-role-modules { padding-top: 10px; }
    .oa-admin-shell #container .admin-role-module-group { padding-top: 0; border: 0; }
    .oa-label-shell .nav-tabs { padding-inline: 16px; }
    .oa-label-shell > .oa-nav-toggle { width: calc(100% - 32px); margin: 10px 16px; }
    .oa-label-shell .nav-backend-dropdown { left: 0; right: auto; }
    .oa-admin-shell #container .oa-location-row { padding: 10px 16px 4px; }
    .oa-business-shell .oa-header .oa-location-row > .page-navigation,
    .oa-admin-shell #container .oa-location-row > nav { flex-basis: 180px; }
    .oa-label-shell .nav-backend-menu[open] { flex: 1 1 100%; flex-direction: column; align-items: stretch; }
    .oa-label-shell .nav-backend-menu[open] .nav-backend-dropdown {
        position: static;
        box-sizing: border-box;
        min-width: 0;
        max-width: 100%;
        width: 100%;
        box-shadow: none;
    }
}
@media (prefers-reduced-motion: reduce) {
    :is(.oa-header, .admin-module-nav, .oa-label-shell .nav-tabs) :is(a, button, summary), .oa-nav-toggle { transition: none; }
    :is(.oa-header .role-module-nav, .oa-header .module-nav, .admin-module-nav, .oa-label-shell .nav-tabs) a:active,
    .oa-business-shell .oa-header :is(.account-action-link, .account-logout-button, .page-back-button):active,
    .oa-nav-toggle:active { transform: none; }
    .oa-label-shell .nav-backend-trigger::after { transition: none; }
}
@media print {
    .oa-nav-toggle { display: none; }
}
