/* POD copy (shell subset) of WbaManagementPortal portal-shell.css (AIDENPOD-75). */
/* Shell chrome only: app bar, user/language menus, drawer, footer, viewport scroll, stacking, dark drawer. */
/* Component/page rules (grids, buttons, tabs, status, dialogs) are added per story in AIDENPOD-76..82. */
/* Semantic tokens live in aiden-tokens.css (--aiden-* / --int-* aliases). */
html { scrollbar-gutter: stable; }
html, body {
    margin: 0;
    background: var(--int-canvas);
    color: var(--int-ink);
    -webkit-font-smoothing: antialiased;
    overflow-x: clip;
}
body {
    font-family: var(--aiden-font-body);
}

.page-shell {
    max-width: none;
    width: 100%;
    margin: 0;
    min-width: 0;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

.mud-appbar.portal-appbar {
    height: var(--portal-topbar-height) !important;
    min-height: var(--portal-topbar-height) !important;
    background: var(--int-appbar-bg) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--int-line);
    color: var(--mud-palette-appbar-text) !important;
    box-shadow: none !important;
    z-index: calc(var(--mud-zindex-appbar, 1300) + 1) !important;
    overflow: visible !important;
}
.mud-appbar.portal-appbar .mud-toolbar,
.mud-appbar.portal-appbar .mud-toolbar-appbar,
.mud-appbar.portal-appbar .mud-toolbar-gutters {
    overflow: visible !important;
}

/* Full-height sidebar from the top of the viewport (covers AppBar on the left). */
.mud-drawer.portal-drawer {
    top: 0 !important;
    height: 100% !important;
    max-height: 100vh !important;
    z-index: calc(var(--mud-zindex-drawer, 1100) + 1) !important;
}

/* Desktop: AppBar only spans the content area next to the open sidebar. */
@media (min-width: 960px) {
    .portal-shell--drawer-open .mud-appbar.portal-appbar {
        left: 272px !important;
        width: calc(100% - 272px) !important;
        right: auto !important;
    }
}
.mud-appbar.portal-appbar .mud-icon-button {
    color: var(--mud-palette-appbar-text) !important;
}
.appbar-right-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    white-space: nowrap;
    overflow: visible;
    position: relative;
    z-index: calc(var(--mud-zindex-appbar, 1300) + 20);
}
.appbar-menu {
    position: relative;
    z-index: calc(var(--mud-zindex-appbar, 1300) + 15);
}
.appbar-menu-backdrop {
    position: fixed;
    inset: 0;
    /* Must stay below .portal-appbar stacking context (+1) so lang/user menu clicks reach the panel. */
    z-index: calc(var(--mud-zindex-appbar, 1300) - 1);
    background: transparent;
}
.appbar-menu-panel {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    z-index: calc(var(--mud-zindex-appbar, 1300) + 20);
    min-width: 13.5rem;
    padding: 0.35rem 0;
    border: 1px solid var(--int-line);
    border-radius: var(--aiden-radius-md, 0.5rem);
    background: var(--int-surface);
    box-shadow: var(--int-surface-shadow);
}
.appbar-menu-divider {
    height: 1px;
    margin: 0.25rem 0;
    background: var(--int-line);
}
.appbar-menu-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    min-height: 2.4rem;
    padding: 0.4rem 0.85rem;
    border: 0;
    background: transparent;
    color: var(--int-ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.appbar-menu-item:hover,
.appbar-menu-item:focus-visible {
    background: color-mix(in srgb, var(--aiden-royal) 8%, var(--int-surface));
    outline: none;
}
.theme-dark-mode .appbar-menu-panel {
    background: color-mix(in srgb, #121a2b 90%, var(--aiden-royal));
    border-color: var(--int-line);
}
.theme-dark-mode .appbar-menu-item {
    color: #e7f0ff;
}
.theme-dark-mode .appbar-menu-item:hover,
.theme-dark-mode .appbar-menu-item:focus-visible {
    background: color-mix(in srgb, var(--aiden-royal) 22%, #121a2b);
}
button.lang-badge {
    appearance: none;
    border: 0;
    background: transparent;
    font: inherit;
    color: inherit;
    padding: 0.15rem 0.25rem;
    border-radius: var(--aiden-radius-md, 0.5rem);
}
button.lang-badge:hover,
button.lang-badge:focus-visible {
    background: color-mix(in srgb, var(--aiden-royal) 8%, var(--aiden-off-white));
    outline: none;
}
.theme-dark-mode button.lang-badge:hover,
.theme-dark-mode button.lang-badge:focus-visible {
    background: color-mix(in srgb, var(--aiden-royal) 22%, #101625);
}
.lang-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 2.25rem;
    cursor: pointer;
}
button.user-widget {
    appearance: none;
    border: 0;
    background: transparent;
    font: inherit;
    color: inherit;
    text-align: left;
}
.lang-badge__flag {
    width: 1.5rem;
    height: 1.5rem;
    object-fit: cover;
    border-radius: var(--aiden-radius-full, 9999px);
    flex: 0 0 auto;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--aiden-royal) 22%, transparent);
}
.lang-badge__code {
    letter-spacing: 0.04em;
    color: var(--int-ink-strong);
    font-size: 0.8rem;
    font-weight: 700;
}
    .lang-menu-item__flag {
        width: 1.35rem;
        height: 1rem;
        object-fit: cover;
        border-radius: 2px;
        margin: 0;
        flex: 0 0 1.35rem;
        display: block;
        align-self: center;
        box-shadow: 0 0 0 1px color-mix(in srgb, var(--aiden-royal) 18%, transparent);
    }
    .lang-menu-item__label {
        flex: 1 1 auto;
        text-align: left;
        line-height: 1.25;
    }
.lang-dropdown {
    position: relative;
    outline: none;
}
.lang-menu {
    position: absolute;
    top: calc(100% + 0.3rem);
    right: 0;
    left: auto;
    z-index: calc(var(--mud-zindex-appbar, 1300) + 5);
    min-width: 14rem;
    padding: 0.35rem 0;
    border: 1px solid var(--int-line);
    border-radius: var(--aiden-radius-md, 0.5rem);
    background: var(--int-surface);
    box-shadow: var(--int-surface-shadow);
}
    .lang-menu-item {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 0.65rem;
        flex-direction: row;
        width: 100%;
        min-height: 2.5rem;
        padding: 0.4rem 0.85rem;
        border: 0;
        background: transparent;
        color: var(--int-ink);
        font: inherit;
        text-align: left;
        cursor: pointer;
    }
.lang-menu-item:hover {
    background: color-mix(in srgb, var(--aiden-royal) 8%, var(--int-surface));
}
.dark-mode-toggle-button { flex: 0 0 auto; }

.mud-drawer.portal-drawer,
.mud-drawer.portal-drawer .mud-drawer-content {
    background: var(--int-sidebar-gradient) !important;
    color: #d9e6f6 !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    font-family: var(--aiden-font-body) !important;
}
.mud-drawer.portal-drawer .mud-drawer-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0 !important;
}
.portal-drawer-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100%;
}
.portal-drawer-brand {
    height: var(--portal-topbar-height);
    min-height: var(--portal-topbar-height);
    max-height: var(--portal-topbar-height);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0 1rem;
    /* Match AppBar bottom border so the lines meet at the same Y. */
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    flex: 0 0 var(--portal-topbar-height);
}
.portal-brand-icon {
    flex: 0 0 auto;
    width: 2rem;
    height: 2.125rem;
    object-fit: contain;
    object-position: center;
}
.portal-brand-title {
    color: #fff !important;
    font-family: var(--aiden-font-body) !important;
    font-size: 1.0625rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.portal-drawer-nav {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0.75rem 0.2rem 1rem;
}
.portal-drawer-footer {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    min-height: 3rem;
    padding: 0.55rem 0.35rem 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.11);
}
.portal-drawer-version {
    color: rgba(217, 230, 246, 0.72) !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.02em;
    user-select: text;
    white-space: nowrap;
    padding: 0 0.75rem;
}
.mud-drawer.portal-drawer .mud-nav-link {
    margin: 0.15rem 0.55rem;
    border-radius: var(--aiden-radius-md, 0.5rem) !important;
    color: #d9e6f6 !important;
    font-family: var(--aiden-font-body) !important;
    font-size: 0.88rem !important;
    font-weight: 500 !important;
    letter-spacing: 0 !important;
    min-height: 2.85rem;
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.mud-drawer.portal-drawer .mud-nav-link .mud-nav-link-icon,
.mud-drawer.portal-drawer .mud-nav-link .mud-nav-link-text {
    display: inline-flex !important;
    align-items: center !important;
    line-height: 1.2 !important;
}
.mud-drawer.portal-drawer .mud-nav-link .mud-nav-link-icon {
    flex: 0 0 auto;
    width: 1.35rem;
    height: 1.35rem;
    margin: 0 !important;
    justify-content: center;
}
.mud-drawer.portal-drawer .mud-nav-link .mud-nav-link-icon .mud-icon-root {
    margin: 0 !important;
    font-size: 1.25rem !important;
    width: 1.25rem !important;
    height: 1.25rem !important;
}
.mud-drawer.portal-drawer .mud-nav-link .mud-nav-link-text,
.mud-drawer.portal-drawer .mud-nav-link .mud-nav-link-text *,
.mud-drawer.portal-drawer .mud-nav-link .mud-typography-body1,
.mud-drawer.portal-drawer .mud-nav-link .mud-typography-body2,
.mud-drawer.portal-drawer .mud-nav-link .mud-icon-root {
    color: inherit !important;
    font-family: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    letter-spacing: inherit !important;
}
.mud-drawer.portal-drawer .mud-nav-link:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.18) !important;
}
.mud-drawer.portal-drawer .mud-nav-link.active {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.18) !important;
    box-shadow: inset 0.25rem 0 0 var(--aiden-limelight, #BFD730);
}
.mud-drawer.portal-drawer .mud-navmenu {
    padding: 0;
}

.mud-layout {
    background: var(--int-canvas);
    height: 100vh !important;
    max-height: 100vh !important;
    min-height: 0 !important;
    overflow: hidden !important;
}
.mud-main-content.portal-main,
.portal-main {
    display: flex !important;
    flex-direction: column !important;
    background: var(--int-canvas);
    /* Full viewport; pt-16 clears the fixed app bar inside the box */
    height: 100vh !important;
    max-height: 100vh !important;
    min-height: 0 !important;
    box-sizing: border-box !important;
    padding-bottom: 0 !important;
    overflow: hidden !important;
}
.portal-main > .page-shell {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding-bottom: 0.5rem;
}
.portal-app-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex: 0 0 auto;
    margin-top: 0;
    min-height: var(--portal-footer-height, 3rem);
    padding: 0.55rem 1rem 0.75rem;
    border-top: 1px solid var(--int-line);
    color: var(--aiden-royal, var(--int-primary));
    font-size: 0.78rem;
    background: var(--int-canvas);
    position: relative;
    z-index: 5;
}
.portal-app-footer-logo {
    height: 1.5rem;
    width: auto;
}


.theme-dark-mode .portal-app-footer {
    color: color-mix(in srgb, var(--aiden-royal, var(--int-primary)) 72%, var(--aiden-cool-grey, #d7d9dd));
}

/* App bar: environment pill, user widget, user menu */
.env-pill {
    display: flex;
    align-items: center;
    gap: var(--aiden-space-2, 0.5rem);
    min-height: 2.5rem;
    border: 1px solid var(--aiden-cool-grey);
    border-radius: var(--aiden-radius-full, 9999px);
    padding: var(--aiden-space-2, 0.5rem) var(--aiden-space-3, 0.75rem);
    background: var(--aiden-off-white);
    color: var(--aiden-royal);
    font-size: 0.82rem;
    white-space: nowrap;
}
.env-pill .status-dot {
    background: var(--aiden-success);
}
.env-pill strong {
    color: var(--aiden-warm-black);
}
.env-pill span:not(.status-dot) {
    color: var(--aiden-royal);
}
.user-widget {
    display: flex;
    align-items: center;
    gap: var(--aiden-space-2, 0.5rem);
    min-height: 2.5rem;
    padding: var(--aiden-space-1, 0.25rem) var(--aiden-space-2, 0.5rem) var(--aiden-space-1, 0.25rem) var(--aiden-space-1, 0.25rem);
    border-radius: var(--aiden-radius-md, 0.5rem);
}
.user-widget--clickable {
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}
.user-widget--clickable:hover,
.user-widget--clickable:focus-visible {
    background: color-mix(in srgb, var(--aiden-royal) 8%, var(--aiden-off-white));
    outline: none;
}
.user-widget--clickable:focus-visible {
    box-shadow: 0 0 0 3px var(--int-focus-ring);
}
.user-menu-header {
    padding: 0.65rem 0.9rem 0.35rem;
    min-width: 12rem;
}
.user-menu-header__name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--int-ink-strong);
    line-height: 1.25;
}
.user-menu-header__meta {
    margin-top: 0.15rem;
    font-size: 0.75rem;
    color: var(--int-muted);
    line-height: 1.3;
}
.theme-dark-mode .user-widget--clickable:hover,
.theme-dark-mode .user-widget--clickable:focus-visible {
    background: color-mix(in srgb, var(--aiden-royal) 22%, #101625);
}
.theme-dark-mode .user-menu-header__name {
    color: #fff;
}
.theme-dark-mode .user-menu-header__meta {
    color: color-mix(in srgb, #fff 70%, var(--aiden-cool-grey));
}
.user-widget .user-copy {
    display: grid;
    min-width: 0;
    line-height: 1.2;
    color: var(--aiden-warm-black);
}
.user-widget .user-copy strong {
    color: var(--aiden-warm-black);
    font-size: 0.82rem;
    white-space: nowrap;
}
.user-widget .user-copy small {
    margin-top: 0.1rem;
    color: var(--aiden-royal);
    font-size: 0.72rem;
    white-space: nowrap;
}
.avatar {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--aiden-radius-full, 9999px);
    background: color-mix(in srgb, var(--aiden-royal) 16%, var(--aiden-off-white));
    color: var(--aiden-royal);
    font-size: 0.72rem;
    font-weight: 700;
}
.theme-dark-mode .env-pill {
    border-color: color-mix(in srgb, var(--int-line) 65%, var(--aiden-cool-grey));
    background: color-mix(in srgb, #101625 82%, var(--aiden-royal));
}
.theme-dark-mode .env-pill strong {
    color: #fff;
}
.theme-dark-mode .env-pill span:not(.status-dot) {
    color: color-mix(in srgb, #fff 78%, var(--aiden-cool-grey));
}
.theme-dark-mode .user-widget .user-copy strong {
    color: #fff;
}
.theme-dark-mode .user-widget .user-copy small {
    color: color-mix(in srgb, var(--aiden-cool-grey) 76%, #fff);
}
.theme-dark-mode .avatar {
    background: color-mix(in srgb, var(--aiden-royal) 36%, #101625);
    color: #e7f0ff;
}
@media (max-width: 640px) {
    .env-pill span:not(.status-dot),
    .user-widget .user-copy {
        display: none;
    }
    .user-widget {
        padding: 0;
    }
}

/* Nested MudNavGroup labels/icons on royal drawer */
.mud-drawer.portal-drawer .mud-nav-group,
.mud-drawer.portal-drawer .mud-nav-group .mud-nav-link {
    color: #d9e6f6 !important;
}
.mud-drawer.portal-drawer .mud-nav-group > .mud-nav-link {
    margin: 0.15rem 0.55rem;
    border-radius: var(--aiden-radius-md, 0.5rem) !important;
    min-height: 2.85rem;
}
.mud-drawer.portal-drawer .mud-nav-group .mud-nav-group {
    margin-left: 0.35rem;
}
.mud-drawer.portal-drawer .mud-expand-panel {
    background: transparent !important;
    color: inherit !important;
    box-shadow: none !important;
    border: 0 !important;
}
.mud-drawer.portal-drawer .mud-paper {
    background: transparent !important;
    color: inherit !important;
    box-shadow: none !important;
    border: 0 !important;
}
.portal-nav-menu {
    height: 100%;
}
@media (max-width: 959.95px) {
    .user-widget .user-copy {
        display: none;
    }
}


/* Viewport shell: footer always visible; home scrolls; grids scroll internally */
:root {
    --portal-footer-height: 3.25rem;
    /* Fallback when flex chain cannot resolve a concrete height */
    --portal-grid-height: calc(100vh - var(--portal-topbar-height, 64px) - var(--portal-footer-height) - 5.5rem);
}

html, body, #app {
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}
body {
    overflow: hidden;
}

.portal-main > .page-shell > .mud-container {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Side menu: no horizontal scrollbar; clip long labels */
.mud-drawer.portal-drawer,
.mud-drawer.portal-drawer .mud-drawer-content,
.portal-drawer-shell {
    overflow-x: hidden !important;
    max-width: 100%;
}
.mud-drawer.portal-drawer .mud-navmenu,
.mud-drawer.portal-drawer .mud-nav-link,
.mud-drawer.portal-drawer .mud-nav-group {
    max-width: 100%;
    min-width: 0;
}
.mud-drawer.portal-drawer .mud-nav-link .mud-nav-link-text {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    min-width: 0;
}
.mud-drawer.portal-drawer .mud-nav-group-button,
.mud-drawer.portal-drawer .mud-nav-group > .mud-nav-link {
    max-width: calc(100% - 0.2rem);
}


/* Shell stacking aligned with MudTheme.ZIndex / --mud-zindex-* variables.
   Do NOT force .mud-popover z-index with !important — that breaks Mud's cascading
   values used by MudSelect/MudAutocomplete inside MudDialog
   (.mud-dialog .mud-popover-cascading-value => dialog + 3). */

.mud-main-content.portal-main,
.portal-main {
    position: relative;
    z-index: 1;
    overflow-x: clip;
}

/* Custom app-bar widgets (not Mud popovers) stay above the app bar surface */
.appbar-right-controls,
.appbar-menu-panel {
    z-index: calc(var(--mud-zindex-appbar, 1300) + 20);
}
.appbar-menu-backdrop {
    /* Below app bar (+1); still above .portal-main (z-index: 1) for outside-click dismiss. */
    z-index: calc(var(--mud-zindex-appbar, 1300) - 1);
}

/* Ensure dialog host uses theme dialog layer (select lists cascade above it) */
.mud-dialog-container {
    z-index: var(--mud-zindex-dialog, 1400) !important;
}

/* Dark mode side menu: darker surface (table-like), keep nav readable */
.theme-dark-mode .mud-drawer.portal-drawer,
.theme-dark-mode .mud-drawer.portal-drawer .mud-drawer-content {
    background: var(--int-sidebar-gradient, #2a3344) !important;
    color: #e8eef5 !important;
    border-right-color: rgba(255, 255, 255, 0.06);
}
.theme-dark-mode .portal-drawer-brand {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
.theme-dark-mode .mud-drawer.portal-drawer .mud-nav-link {
    color: #d7dee8 !important;
}
.theme-dark-mode .mud-drawer.portal-drawer .mud-nav-link:hover,
.theme-dark-mode .mud-drawer.portal-drawer .mud-nav-link.active {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.10) !important;
}
.theme-dark-mode .portal-brand-title {
    color: #f3f6fa !important;
}

/* ---- Grids, status pill, empty/loading states (AIDENPOD-76) ---- */
/* Table + compact table from WbaManagementPortal portal-shell.css; status/empty from WbAClient wba-shell.css. */
.mud-table {
    border: 1px solid var(--int-line);
    border-radius: var(--int-surface-radius);
    overflow: hidden;
    background: var(--int-surface);
    box-shadow: var(--int-surface-shadow);
}
.mud-table .mud-table-head .mud-table-cell {
    font-weight: 700 !important;
    color: var(--int-ink-strong) !important;
    background: color-mix(in srgb, var(--int-canvas) 65%, var(--int-surface));
}

.mud-table.table--compact,
.table--compact {
    margin-top: 0;
    font-size: 0.82rem;
}
.mud-table.table--compact .mud-table-head .mud-table-cell,
.table--compact th {
    color: var(--int-muted) !important;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}
.mud-table.table--compact .mud-table-cell,
.table--compact th,
.table--compact td {
    padding: var(--aiden-space-2, 0.5rem) var(--aiden-space-3, 0.75rem);
    white-space: nowrap;
}
.mud-table.table--compact .mud-table-container .mud-table-root .mud-table-body tr:hover,
.table--compact tbody tr:hover {
    background: color-mix(in srgb, var(--aiden-royal) 4%, var(--aiden-off-white));
}

.theme-dark-mode .mud-table.table--compact {
    border-color: var(--int-line);
    background: color-mix(in srgb, #121a2b 86%, var(--aiden-royal));
}
.theme-dark-mode .mud-table.table--compact .mud-table-head .mud-table-cell {
    color: color-mix(in srgb, #fff 70%, var(--aiden-cool-grey)) !important;
    background: color-mix(in srgb, #121a2b 88%, var(--aiden-royal));
}
.theme-dark-mode .mud-table.table--compact .mud-table-container .mud-table-root .mud-table-body tr:hover {
    background: color-mix(in srgb, var(--aiden-royal) 14%, #121a2b);
}

/* Grid toolbar wraps on narrow grids instead of clipping actions (table has overflow: hidden) */
.mud-table.table--compact .mud-table-toolbar {
    flex-wrap: wrap;
    height: auto !important;
    min-height: 64px;
    row-gap: var(--aiden-space-2, 0.5rem);
    padding-top: var(--aiden-space-2, 0.5rem);
    padding-bottom: var(--aiden-space-2, 0.5rem);
}
/* Grid toolbar title (ToolBarContent Typo.h5) */
.mud-table-toolbar .mud-typography-h5 {
    font-family: var(--aiden-font-display) !important;
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    color: var(--int-ink-strong) !important;
}

/*
  Full-page grids only (direct child of the page container, or opt-in class).
  Nested grids inside settings/forms keep a compact height and the page scrolls.
*/
.page-shell:has(> .mud-container > .mud-data-grid),
.page-shell:has(> .mud-container > .portal-full-page-grid) {
    overflow: hidden;
}

.page-shell:has(> .mud-container > .mud-data-grid) > .mud-container,
.page-shell:has(> .mud-container > .portal-full-page-grid) > .mud-container {
    overflow: hidden;
    height: 100%;
    min-height: 0;
}

.page-shell > .mud-container > .mud-data-grid,
.page-shell > .mud-container > .portal-full-page-grid {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    /* Prefer flex fill of the content area; vh-calc remains available as fallback var */
    height: 100% !important;
    display: flex !important;
    flex-direction: column;
}

.page-shell > .mud-container > .mud-data-grid .mud-table-container,
.page-shell > .mud-container > .portal-full-page-grid .mud-table-container {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto !important;
}

/* If a page still sets an inline Height, neutralize it on full-page grids */
.page-shell > .mud-container > .mud-data-grid.mud-table,
.page-shell > .mud-container > .portal-full-page-grid.mud-table {
    height: 100% !important;
    max-height: none !important;
}
/* Explicit full-page opt-in (also wins when still wrapped by MudGrid/etc.) */
.page-shell .mud-data-grid.portal-full-page-grid {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column;
}

.page-shell .mud-data-grid.portal-full-page-grid .mud-table-container {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto !important;
}

.page-shell:has(.mud-data-grid.portal-full-page-grid) {
    overflow: hidden;
}

.page-shell:has(.mud-data-grid.portal-full-page-grid) > .mud-container {
    overflow: hidden;
    height: 100%;
    min-height: 0;
}

/* Table/grid footer (pager): never show a tiny vertical scrollbar */
.page-shell .mud-data-grid,
.page-shell .mud-table {
    overflow: hidden !important;
}
.page-shell .mud-data-grid > .mud-table-container,
.page-shell .mud-table > .mud-table-container {
    /* only the body area scrolls */
    overflow-x: auto !important;
    overflow-y: auto !important;
}
.page-shell .mud-data-grid-toolbar,
.page-shell .mud-table-toolbar,
.page-shell .mud-data-grid-pager,
.page-shell .mud-table-pagination,
.page-shell .mud-table-pagination-toolbar,
.page-shell .mud-data-grid > .mud-paper,
.page-shell .mud-table-pagination .mud-toolbar {
    overflow: hidden !important;
    flex: 0 0 auto !important;
    min-height: fit-content;
}
.page-shell .mud-table-pagination,
.page-shell .mud-data-grid-pager {
    /* avoid 1px clip that triggers a useless vertical scrollbar */
    max-height: none !important;
    height: auto !important;
}
/* Status pill — colour always paired with label text */
.wba-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    min-height: 1.5rem;
    padding: 0.15rem 0.55rem;
    border-radius: var(--aiden-status-pill-radius, var(--aiden-radius-full, 9999px));
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.wba-status-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.wba-status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: var(--aiden-radius-full, 9999px);
    background: currentColor;
    flex: 0 0 auto;
}

.wba-status--healthy,
.wba-status--success {
    background: color-mix(in srgb, var(--aiden-color-status-success, #25D366) 22%, white);
    color: var(--int-success-fg, #087944);
}

.wba-status--attention {
    background: color-mix(in srgb, var(--aiden-color-status-warning, #B54708) 18%, white);
    color: var(--aiden-color-status-warning, #B54708);
}

.wba-status--error {
    background: var(--int-error-bg, #fde8e7);
    color: var(--aiden-color-status-danger, #B42318);
}

.wba-status--neutral {
    background: color-mix(in srgb, var(--aiden-color-status-info, #3C5279) 12%, white);
    color: var(--aiden-color-status-info, #3C5279);
}

/* Empty state */
.wba-empty-state {
    display: grid;
    place-items: center;
    gap: var(--aiden-space-3, 12px);
    width: 100%;
    padding: var(--aiden-space-6, 32px) var(--aiden-space-4, 16px);
    text-align: center;
    border: 1px solid var(--aiden-empty-state-border, var(--aiden-color-border-default, #D3DAE1));
    border-radius: var(--aiden-empty-state-radius, var(--aiden-radius-lg, 12px));
    background: var(--aiden-empty-state-background, var(--aiden-color-surface-default, #fff));
    color: var(--aiden-empty-state-text, var(--aiden-color-text-secondary, #3C5279));
    box-shadow: var(--aiden-elevation-resting, 0 1px 2px rgba(60, 82, 121, 0.06));
}

.wba-empty-state__icon {
    display: grid;
    place-items: center;
    width: 3.25rem;
    height: 3.25rem;
    border: 1px solid var(--aiden-color-border-default, #D3DAE1);
    border-radius: var(--aiden-radius-lg, 12px);
    background: color-mix(in srgb, var(--aiden-royal, #3C5279) 8%, white);
    color: var(--aiden-royal, #3C5279);
}

.wba-empty-state__title {
    margin: 0;
    font-family: var(--aiden-font-display, Ubuntu, Arial, sans-serif);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--aiden-color-text-primary, #32363D);
}

.wba-empty-state__description {
    margin: 0;
    max-width: 28rem;
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--aiden-color-text-secondary, #3C5279);
}

.wba-empty-state__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.theme-dark-mode .wba-status--healthy,
.theme-dark-mode .wba-status--success {
    background: var(--int-success-bg, rgba(37, 211, 102, 0.14));
    color: var(--int-success-fg, #3dcb6c);
}

.theme-dark-mode .wba-status--attention {
    background: var(--int-warning-bg, rgba(181, 71, 8, 0.2));
    color: var(--int-warning-fg, #ffb545);
}

.theme-dark-mode .wba-status--error {
    background: var(--int-error-bg, rgba(180, 35, 24, 0.18));
    color: var(--int-error-fg, #ff6b84);
}

.theme-dark-mode .wba-status--neutral {
    background: var(--int-info-bg, rgba(60, 82, 121, 0.28));
    color: var(--int-info-fg, #9eb6d4);
}

.theme-dark-mode .wba-empty-state {
    background: var(--int-surface, #1c2533);
    border-color: var(--int-line);
    color: var(--int-muted, #a8b6c7);
}

.theme-dark-mode .wba-empty-state__icon {
    background: color-mix(in srgb, var(--aiden-royal, #3C5279) 28%, #121a2b);
    border-color: var(--int-line);
    color: var(--aiden-color-text-secondary, #a8b6c7);
}

.theme-dark-mode .wba-empty-state__title {
    color: var(--int-ink-strong, #e4ebf3);
}

.theme-dark-mode .wba-empty-state__description {
    color: var(--int-muted, #a8b6c7);
}


/* Loading state (grid LoadingContent) */
.pod-loading-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--aiden-space-2, 0.5rem);
    width: 100%;
    padding: var(--aiden-space-4, 1rem);
    color: var(--int-muted);
    font-size: 0.875rem;
}

/* ---- Detail dialogs (AIDENPOD-77) ---- */
/* Read-only detail list (DS detail-list): label in royal, value bold, divider below. */
.detail-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: var(--aiden-space-3, 0.75rem) var(--aiden-space-4, 1rem);
    margin: 0 0 var(--aiden-space-3, 0.75rem);
}
.detail-list > div {
    min-width: 0;
    padding-bottom: var(--aiden-space-2, 0.5rem);
    border-bottom: 1px solid var(--int-line);
}
.detail-list dt {
    margin: 0;
    color: var(--aiden-royal);
    font-size: 0.8rem;
}
.detail-list dd {
    margin: 0;
    min-height: 1.25rem;
    color: var(--int-ink-strong);
    font-weight: 700;
    overflow-wrap: anywhere;
    white-space: pre-line;
}
.detail-list__wide {
    grid-column: 1 / -1;
}
.theme-dark-mode .detail-list dt {
    color: color-mix(in srgb, var(--aiden-cool-grey) 76%, #fff);
}

/* Header actions next to the detail list (refresh, custom fields, cancel, webhook, expand) */
.pod-detail-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--aiden-space-1, 0.25rem);
}
.pod-detail-section-title {
    margin: 0 0 var(--aiden-space-2, 0.5rem);
    color: var(--int-ink-strong);
    font-size: 0.95rem;
    font-weight: 700;
}
.pod-detail-divider {
    border-color: var(--int-line) !important;
    margin: var(--aiden-space-3, 0.75rem) 0 !important;
}

/* MudTabs: selected tab uses limelight surface (DS filled tab), not underline-only. */
.mud-tabs.portal-tabs .mud-tab {
    color: var(--aiden-tabs-text, var(--aiden-royal)) !important;
    font-weight: 700;
    text-transform: none;
    min-height: 2.5rem;
}
.mud-tabs.portal-tabs .mud-tab.mud-tab-active,
.mud-tabs.portal-tabs .mud-tab[aria-selected="true"] {
    background: var(--aiden-tabs-background-active, var(--aiden-limelight)) !important;
    color: var(--aiden-tabs-text-active, var(--aiden-warm-black)) !important;
    border-radius: var(--aiden-radius-sm, 0.25rem);
}
.mud-tabs.portal-tabs .mud-tabs-toolbar,
.mud-tabs.portal-tabs .mud-tabs-tabbar {
    border: 1px solid var(--aiden-tabs-border, var(--aiden-cool-grey));
    border-radius: var(--aiden-tabs-radius, var(--aiden-radius-md, 0.5rem));
    background: var(--aiden-tabs-background, var(--aiden-off-white));
    min-height: auto;
    padding: var(--aiden-space-2, 0.5rem);
}
.mud-tabs.portal-tabs .mud-tab-slider,
.mud-tabs.portal-tabs .mud-tabs-tabbar-wrapper .mud-tab-slider {
    display: none;
}
.theme-dark-mode .mud-tabs.portal-tabs .mud-tab {
    color: #d9e6f6 !important;
}
.theme-dark-mode .mud-tabs.portal-tabs .mud-tab.mud-tab-active,
.theme-dark-mode .mud-tabs.portal-tabs .mud-tab[aria-selected="true"] {
    background: var(--aiden-limelight) !important;
    color: var(--aiden-warm-black) !important;
}
.theme-dark-mode .mud-tabs.portal-tabs .mud-tabs-toolbar,
.theme-dark-mode .mud-tabs.portal-tabs .mud-tabs-tabbar {
    border-color: var(--int-line);
    background: color-mix(in srgb, #121a2b 86%, var(--aiden-royal));
}
.mud-tabs.portal-tabs .mud-tab.mud-disabled {
    opacity: 0.45;
}

/* Signature and attachment previews: token border/background instead of #ccc */
.pod-detail-image {
    display: block;
    border: 1px solid var(--int-line);
    border-radius: var(--aiden-radius-md, 0.5rem);
    background: var(--int-surface);
}
.pod-detail-image--signature {
    max-width: 300px;
    max-height: 200px;
}
.pod-detail-image--attachment {
    width: 400px;
    max-width: 100%;
    height: 400px;
    object-fit: contain;
}
.pod-detail-attachment-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--aiden-space-2, 0.5rem);
    max-width: 400px;
}

/* Numeric grid cells (quantities, numeric answers) */
.pod-cell--num,
.pod-cell--num .mud-typography {
    text-align: right;
}
.pod-cell--num .mud-typography {
    display: block;
    width: 100%;
}
/* ---- Forms and dialogs (AIDENPOD-78) ---- */
/* Action bar on settings pages: primary first, then secondary */
.pod-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--aiden-space-2, 0.5rem);
}

/* Validation summary next to settings forms */
.pod-form-errors {
    padding: var(--aiden-space-4, 1rem);
    border: 1px solid color-mix(in srgb, var(--aiden-color-status-danger, #B42318) 35%, var(--int-line));
    border-radius: var(--aiden-radius-md, 0.5rem);
    background: var(--int-error-bg, #fde8e7);
    color: var(--aiden-color-status-danger, #B42318);
}
.pod-form-errors__title {
    margin: 0 0 var(--aiden-space-2, 0.5rem);
    font-size: 0.875rem;
    font-weight: 700;
}
.pod-form-errors ul {
    margin: 0;
    padding-left: 1.1rem;
}
.theme-dark-mode .pod-form-errors {
    background: var(--int-error-bg, rgba(180, 35, 24, 0.18));
    color: var(--int-error-fg, #ff6b84);
}

/* Narrow form fields (dialogs with short codes / numbers) */
.pod-field--narrow {
    max-width: 350px;
}

/* Small info dialogs (address, business partner, custom fields): keep clear of the app bar */
.pod-dialog--top-offset {
    margin-top: calc(var(--portal-topbar-height, 64px) + var(--aiden-space-6, 2rem)) !important;
}

/* Full-width attachment preview */
.pod-detail-image--full {
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* Grid column widths that used inline HeaderStyle */
.pod-col--narrow {
    width: 150px !important;
}
.pod-col--actions {
    width: 3rem !important;
    max-width: 5% !important;
}
/* ---- Integration and reporting (AIDENPOD-82) ---- */
/* Tab panels spacing (replaces page-level .mud-tabs-panels rules) */
.mud-tabs.portal-tabs .mud-tabs-panels {
    margin-top: var(--aiden-space-2, 0.5rem);
}

/* Fixed column widths in token grids (replaces inline <col style>) */
.pod-w-44 { width: 44%; }
.pod-w-30 { width: 30%; }
.pod-w-12 { width: 12%; }
.pod-w-5 { width: 5%; }
.pod-col--w100 { width: 100px !important; }

/* Field widths */
.pod-field--operator { width: 80px !important; flex: 0 0 auto; }
.pod-field--operator-wide { width: 100px !important; flex: 0 0 auto; }
.pod-field--value { width: 400px !important; min-width: 400px !important; max-width: 400px !important; }
.pod-field--wide { width: 100%; max-width: 500px; }

/* Fixed-width secondary actions (print conditions, generate/restore/sample data) */
.pod-btn--fixed {
    width: 200px;
    max-width: 200px;
}

/* Webhook log dialog */
.pod-log-pane {
    margin: 2px;
}
.pod-log-content {
    max-height: calc(100vh - 510px);
    min-height: 0;
    overflow-y: auto;
}

/* Large report dialogs: small offset from the top */
.pod-dialog--top-offset-sm {
    margin-top: 30px !important;
}

/* Telerik report viewer / designer frames: the Kendo widgets keep their own theme */
.pod-report-dialog .mud-dialog-content {
    overflow: hidden !important;
}
.pod-report-dialog #WMSReportViewer {
    position: relative !important;
    width: 99%;
    height: calc(100vh - 180px) !important;
    background: var(--int-canvas) !important;
    border: 1px solid var(--int-line) !important;
    padding-bottom: 8px !important;
}
.pod-report-dialog #WMSWebReportDesigner {
    position: relative !important;
    width: 99%;
    height: calc(100vh - 180px);
    padding-bottom: 8px !important;
}
/* ---- JSON editor (AIDENPOD-108, Monaco via BlazorMonaco) ---- */
.pod-json-editor {
    display: flex;
    flex-direction: column;
    gap: var(--aiden-space-1, 0.25rem);
    width: 100%;
}
.pod-json-editor__toolbar {
    display: flex;
    align-items: center;
    gap: var(--aiden-space-1, 0.25rem);
    min-height: 2rem;
}
.pod-json-editor__label {
    color: var(--aiden-royal);
    font-size: 0.8rem;
    font-weight: 700;
}
.theme-dark-mode .pod-json-editor__label {
    color: color-mix(in srgb, var(--aiden-cool-grey) 76%, #fff);
}
.pod-json-editor__frame {
    height: 60vh;
    min-height: 12rem;
    border: 1px solid var(--int-line);
    border-radius: var(--aiden-radius-md, 0.5rem);
    overflow: hidden;
    background: var(--int-surface);
}
.pod-json-editor--compact .pod-json-editor__frame {
    height: 40vh;
}
.pod-json-editor__monaco,
.pod-json-editor__frame .monaco-editor-container {
    width: 100%;
    height: 100%;
}
.pod-json-editor__error {
    padding: var(--aiden-space-1, 0.25rem) var(--aiden-space-2, 0.5rem);
    border-radius: var(--aiden-radius-sm, 0.25rem);
    background: var(--int-error-bg, #fde8e7);
    color: var(--aiden-color-status-danger, #B42318);
    font-size: 0.8rem;
}
.theme-dark-mode .pod-json-editor__error {
    background: var(--int-error-bg, rgba(180, 35, 24, 0.18));
    color: var(--int-error-fg, #ff6b84);
}

/* Smaller desktops and tablets: footer becomes a watermark (like the handheld client wba-footer-brand).
   Fixed bottom-right, no layout space, does not catch clicks; grids get the freed height. */
@media (max-width: 1279.98px), (max-height: 799.98px) {
    :root {
        --portal-footer-height: 0px;
    }
    .portal-app-footer {
        position: fixed;
        right: 0.75rem;
        bottom: 0.5rem;
        z-index: 2;
        min-height: 0;
        padding: 0;
        border-top: 0;
        background: transparent;
        pointer-events: none;
        user-select: none;
        line-height: 0;
    }
    .portal-app-footer > span {
        display: none;
    }
    .portal-app-footer-logo {
        height: 1rem;
        max-width: min(28vw, 7.5rem);
        opacity: 0.18;
        filter: grayscale(0.15);
    }
    .theme-dark-mode .portal-app-footer-logo {
        filter: brightness(0) invert(1);
    }
}
