/* Shared application chrome. Designer and drawing surfaces keep their own styles. */
/* Help markers share one palette; notification severity and note states keep theirs. */
.app-help-icon {
    align-items: center;
    background-color: #f7e5ab;
    border: 1px solid #d8bd70;
    border-radius: 0.2rem;
    box-sizing: border-box;
    color: #755514;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: calc(var(--app-help-icon-size, 1.25rem) * 0.8);
    height: var(--app-help-icon-size, 1.25rem);
    justify-content: center;
    line-height: 1;
    padding: 0;
    vertical-align: middle;
    width: var(--app-help-icon-size, 1.25rem);
}

.app-help-icon::before {
    display: block;
    line-height: 1;
    vertical-align: 0;
}

/* OrderStatusExtensions owns the status-to-palette mapping for every renderer. */
/* Shared value-badge palette. Grid and table-popup allowlists leave utility classes and
   action/note icons alone; !important overrides legacy Bootstrap badge colors. */
.e-grid span.badge:is(.col-label-profile, .col-design, .col-machine-type, .col-angleandheights, .col-perforation-type, .col-address-type, .col-currency, .col-invoice-period, .col-history-type, .col-entity-note-type, .col-priority, .col-state-code, .col-tracking-number) {
    border-radius: .2rem;
}

.order-status-gray-500,
.carrier-filter-btn.bs-gray-500,
:is(.e-grid .e-rowcell, .entity-history-tooltip-grid, .entity-notes-tooltip-grid, .station-tooltip-table) span.badge:is(.col-label-profile, .col-design, .col-machine-type, .col-angleandheights, .col-perforation-type, .col-address-type, .col-currency, .col-invoice-period, .col-history-type, .col-entity-note-type, .col-priority, .col-state-code, .col-tracking-number):is(.bs-gray-500, .bs-gray-500-bg, .text-bg-secondary) { background-color: #cbd0d9 !important; color: #4b4d59 !important; }
.order-status-gray-200,
:is(.e-grid .e-rowcell, .entity-history-tooltip-grid, .entity-notes-tooltip-grid, .station-tooltip-table) span.badge:is(.col-label-profile, .col-design, .col-machine-type, .col-angleandheights, .col-perforation-type, .col-address-type, .col-currency, .col-invoice-period, .col-history-type, .col-entity-note-type, .col-priority, .col-state-code, .col-tracking-number):is(.bs-gray-200, .bs-gray-200-bg) { background-color: #eef1f4 !important; color: #596676 !important; }
.order-status-pink-500,
.carrier-filter-btn.carrier-color-withtracking,
:is(.e-grid .e-rowcell, .entity-history-tooltip-grid, .entity-notes-tooltip-grid, .station-tooltip-table) span.badge:is(.col-label-profile, .col-design, .col-machine-type, .col-angleandheights, .col-perforation-type, .col-address-type, .col-currency, .col-invoice-period, .col-history-type, .col-entity-note-type, .col-priority, .col-state-code, .col-tracking-number):is(.bs-pink-500, .bs-pink-500-bg) { background-color: #f0c9e0 !important; color: #812d63 !important; }
.order-status-teal-500,
.carrier-filter-btn.carrier-color-fedex,
:is(.e-grid .e-rowcell, .entity-history-tooltip-grid, .entity-notes-tooltip-grid, .station-tooltip-table) span.badge:is(.col-label-profile, .col-design, .col-machine-type, .col-angleandheights, .col-perforation-type, .col-address-type, .col-currency, .col-invoice-period, .col-history-type, .col-entity-note-type, .col-priority, .col-state-code, .col-tracking-number):is(.bs-teal-500, .bs-teal-500-bg) { background-color: #dee6bc !important; color: #4c5d22 !important; }
.order-status-cyan-200,
:is(.e-grid .e-rowcell, .entity-history-tooltip-grid, .entity-notes-tooltip-grid, .station-tooltip-table) span.badge:is(.col-label-profile, .col-design, .col-machine-type, .col-angleandheights, .col-perforation-type, .col-address-type, .col-currency, .col-invoice-period, .col-history-type, .col-entity-note-type, .col-priority, .col-state-code, .col-tracking-number):is(.bs-cyan-200, .bs-cyan-200-bg) { background-color: #e0e9f7 !important; color: #305574 !important; }
.order-status-indigo-500,
:is(.e-grid .e-rowcell, .entity-history-tooltip-grid, .entity-notes-tooltip-grid, .station-tooltip-table) span.badge:is(.col-label-profile, .col-design, .col-machine-type, .col-angleandheights, .col-perforation-type, .col-address-type, .col-currency, .col-invoice-period, .col-history-type, .col-entity-note-type, .col-priority, .col-state-code, .col-tracking-number):is(.bs-indigo-500, .bs-indigo-500-bg) { background-color: #c9d7f9 !important; color: #324f89 !important; }
.order-status-cyan-500,
.carrier-filter-btn.carrier-color-custom,
:is(.e-grid .e-rowcell, .entity-history-tooltip-grid, .entity-notes-tooltip-grid, .station-tooltip-table) span.badge:is(.col-label-profile, .col-design, .col-machine-type, .col-angleandheights, .col-perforation-type, .col-address-type, .col-currency, .col-invoice-period, .col-history-type, .col-entity-note-type, .col-priority, .col-state-code, .col-tracking-number):is(.bs-cyan-500, .bs-cyan-500-bg) { background-color: #bfe9eb !important; color: #1a6061 !important; }
.order-status-yellow-500,
.carrier-filter-btn.carrier-color-dhl,
:is(.e-grid .e-rowcell, .entity-history-tooltip-grid, .entity-notes-tooltip-grid, .station-tooltip-table) span.badge:is(.col-label-profile, .col-design, .col-machine-type, .col-angleandheights, .col-perforation-type, .col-address-type, .col-currency, .col-invoice-period, .col-history-type, .col-entity-note-type, .col-priority, .col-state-code, .col-tracking-number):is(.bs-yellow-500, .bs-yellow-500-bg, .text-bg-warning) { background-color: #f7e5ab !important; color: #755514 !important; }
.order-status-green-500,
.carrier-filter-btn.carrier-color-default,
:is(.e-grid .e-rowcell, .entity-history-tooltip-grid, .entity-notes-tooltip-grid, .station-tooltip-table) span.badge:is(.col-label-profile, .col-design, .col-machine-type, .col-angleandheights, .col-perforation-type, .col-address-type, .col-currency, .col-invoice-period, .col-history-type, .col-entity-note-type, .col-priority, .col-state-code, .col-tracking-number):is(.bs-green-500, .bs-green-500-bg, .text-bg-success) { background-color: #cbe7d8 !important; color: #24593b !important; }
.order-status-purple-500,
.carrier-filter-btn.carrier-color-dpd,
:is(.e-grid .e-rowcell, .entity-history-tooltip-grid, .entity-notes-tooltip-grid, .station-tooltip-table) span.badge:is(.col-label-profile, .col-design, .col-machine-type, .col-angleandheights, .col-perforation-type, .col-address-type, .col-currency, .col-invoice-period, .col-history-type, .col-entity-note-type, .col-priority, .col-state-code, .col-tracking-number):is(.bs-purple-500, .bs-purple-500-bg) { background-color: #e4d2f1 !important; color: #603b7f !important; }
.order-status-blue-500,
.carrier-filter-btn.carrier-color-gls,
:is(.e-grid .e-rowcell, .entity-history-tooltip-grid, .entity-notes-tooltip-grid, .station-tooltip-table) span.badge:is(.col-label-profile, .col-design, .col-machine-type, .col-angleandheights, .col-perforation-type, .col-address-type, .col-currency, .col-invoice-period, .col-history-type, .col-entity-note-type, .col-priority, .col-state-code, .col-tracking-number):is(.bs-blue-500, .bs-blue-500-bg, .text-bg-primary) { background-color: #c4ddf7 !important; color: #235380 !important; }
.order-status-orange-500,
.e-grid .e-rowcell span.badge.col-state-code.text-bg-secondary,
:is(.e-grid .e-rowcell, .entity-history-tooltip-grid, .entity-notes-tooltip-grid, .station-tooltip-table) span.badge:is(.col-label-profile, .col-design, .col-machine-type, .col-angleandheights, .col-perforation-type, .col-address-type, .col-currency, .col-invoice-period, .col-history-type, .col-entity-note-type, .col-priority, .col-state-code, .col-tracking-number):is(.bs-orange-500, .bs-orange-500-bg) { background-color: #f5d0ad !important; color: #824c20 !important; }
.order-status-red-500,
.carrier-filter-btn.bs-red-500,
:is(.e-grid .e-rowcell, .entity-history-tooltip-grid, .entity-notes-tooltip-grid, .station-tooltip-table) span.badge:is(.col-label-profile, .col-design, .col-machine-type, .col-angleandheights, .col-perforation-type, .col-address-type, .col-currency, .col-invoice-period, .col-history-type, .col-entity-note-type, .col-priority, .col-state-code, .col-tracking-number):is(.bs-red-500, .bs-red-500-bg, .text-bg-danger) { background-color: #f4ccc3 !important; color: #843b2b !important; }
.carrier-filter-btn.carrier-color-ups,
span.badge.col-tracking-number.carrier-color-ups { background-color: #eadacb !important; border-color: #d9bfa9 !important; color: #67422e !important; }

/* Priority bands are shared by grid badges and the Designer's preview indicators. */
.app-priority-low { --app-priority-background: #cbe7d8; --app-priority-text: #24593b; --app-priority-border: #8aba9e; }
.app-priority-medium { --app-priority-background: #f7e5ab; --app-priority-text: #755514; --app-priority-border: #c8aa59; }
.app-priority-high { --app-priority-background: #f4ccc3; --app-priority-text: #843b2b; --app-priority-border: #d49788; }
span.badge.col-priority:is(.app-priority-low, .app-priority-medium, .app-priority-high) {
    display: inline-flex; align-items: center; justify-content: center;
    padding: .35em .65em; border-radius: .2rem;
    background: var(--app-priority-background); color: var(--app-priority-text); font-size: .7rem; font-weight: 500; line-height: 1;
}

.carrier-filter-btn.carrier-color-all { background-color: var(--app-surface, #fff); color: var(--app-text, #17365c); }

span.badge.col-order-status {
    display: inline-grid;
    grid-template-columns: 1em minmax(0, 1fr);
    align-items: center;
    justify-content: center;
    gap: .3em;
    max-width: 100%;
    min-width: 0;
    border-radius: .2rem;
    font-size: .7rem;
    vertical-align: middle;
}
.e-grid .e-rowcell > span.badge.col-order-status,
.e-grid .e-rowcell > div > span.badge.col-order-status,
.e-grid .e-rowcell.col-files-cell .order-files-trigger {
    width: 100%;
    padding: .55em;
    font-size: .75rem;
    line-height: 1.25;
}
.col-order-status .col-order-status-icon { grid-column: 1; justify-self: start; font-size: .9em; }
.col-order-status .col-order-status-text {
    grid-column: 2;
    text-align: center;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: var(--grid-column-font-weight, inherit);
}

/* App owns the stable theme marker; dynamic descendants must not invalidate body and every grid. Portal dialogs inherit the same colors. */
.app-shell,
body.app-theme {
    --app-chrome-surface: #dce7f7;
    --app-background: #f3f5f8;
    --app-surface: #fff;
    --app-border: #e1e6ed;
    --app-text: #263548;
    --app-muted: #778395;
    --app-primary: #347ed7;
    --app-selected: #edf4fe;
    --app-control-surface: #e7ecf3;
    --app-control-border: #c8d3e2;
    --app-control-hover: #e5edf9;
    --app-control-selected: #d6e4f8;
    --app-control-selected-hover: #c8daf3;
    --app-control-accent: #245fb5;
    --app-control-accent-hover: #1f579f;
    --bs-body-color: var(--app-text);
    --bs-border-color: var(--app-border);
}

.app-shell {
    --app-nav-surface: #e6eef9;
    --app-stations-surface: #e8eff9;
    --app-chrome-shadow: 0 .0625rem .125rem rgb(42 70 107 / 9%);
    --app-sidebar-expanded-width: 15.625rem;
    --app-sidebar-collapsed-width: 4.125rem;
    --app-sidebar-width: var(--app-sidebar-expanded-width);
    --app-brand-padding-inline: 1.125rem;
    --app-brand-gap: .75rem;
    --app-brand-font-size: 1.1875rem;
    --app-topbar-height: 3.5rem;
    --app-topbar-padding-x: 20px;
    display: grid;
    grid-template-columns: var(--app-sidebar-width) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    height: 100dvh;
    min-height: 0;
    color: var(--app-text);
    background: var(--app-background);
    font: 14px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
}

body.app-theme {
    --app-nav-hover: #b9d1f1;
    --app-nav-selected: #347bd7;
    --app-nav-selected-hover: #2b6ec4;
    --app-nav-selected-text: #fff;
    --app-nav-indicator: #082654;
    --app-popover-border: #9eacc0;
    --app-popover-shadow: 0 0.2rem 0.65rem rgb(31 46 66 / 20%), 0 1rem 2.5rem rgb(31 46 66 / 26%);
    margin: 0;
    overflow: hidden;
    background: #f3f5f8;
}

.app-shell.collapsed { --app-sidebar-width: var(--app-sidebar-collapsed-width); }
.app-shell:has(.app-sidebar .nav-scrollable.expanded) { --app-sidebar-width: var(--app-sidebar-expanded-width); }
.app-shell:has(.app-sidebar .nav-scrollable.collapsed) { --app-sidebar-width: var(--app-sidebar-collapsed-width); }
.app-shell.app-shell-public { grid-template-columns: minmax(0, 1fr); font-size: .875rem; }
.app-shell.app-shell-standalone { grid-template-rows: minmax(0, 1fr); }
.app-shell.app-shell-designer { --app-topbar-padding-x: var(--app-brand-padding-inline); grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.app-shell.app-shell-designer > .app-header { display: contents; }
.app-shell.app-shell-designer > .app-header > .app-sidebar { visibility: hidden; }
.app-shell.app-shell-designer > .app-main { grid-area: 1 / 1; min-height: 0; overflow: hidden; }
.app-shell.app-shell-designer > .app-main > #main-content { height: 100%; min-height: 0; padding: 0 !important; overflow: hidden; }
.app-shell-designer .app-topbar { position: relative; z-index: 30; flex-shrink: 0; flex-wrap: wrap; }

.app-shell .app-header {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    position: relative;
    z-index: 30;
    background: var(--app-surface);
}

.app-shell .app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: var(--app-topbar-height);
    padding: 8px var(--app-topbar-padding-x);
    border-bottom: 1px solid var(--app-border);
    background: var(--app-chrome-surface);
}
.app-shell:not(.app-shell-designer) .app-topbar { position: relative; z-index: 1; box-shadow: var(--app-chrome-shadow); }

.app-shell-public .app-topbar { flex-wrap: wrap; min-height: 3.5rem; gap: .75rem 1rem; padding: .5rem clamp(1rem, 2vw, 2rem); }
.app-shell-public .app-topbar-location { flex-wrap: wrap; gap: .5rem 1.25rem; }
.app-shell-public .app-breadcrumb { flex-wrap: wrap; gap: .25rem .5rem; }
.app-shell-public .app-topbar-actions { flex: 0 1 auto; margin-inline-start: auto; }
.app-shell-public .app-topbar-account-actions { flex-wrap: wrap; justify-content: flex-end; gap: .625rem; }
.app-shell-public .app-guest-toolbar { flex: 0 1 auto; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }

.app-topbar-location, .app-topbar-actions, .app-topbar-account-actions, .app-breadcrumb {
    display: flex;
    align-items: center;
    min-width: 0;
}

.app-topbar-location { gap: 12px; }
.app-topbar-actions, .app-topbar-account-actions { flex-shrink: 0; gap: 10px; }
.app-topbar-page-actions { display: flex; align-items: center; padding-right: 16px; margin-right: 6px; border-right: 1px solid var(--app-border); }
.app-shell-designer .app-topbar-location { flex: 1 1 auto; align-self: stretch; }
.app-shell.app-shell-designer .app-public-brand { flex: 0 0 calc(var(--pd-plates-width, var(--app-sidebar-expanded-width)) - var(--app-topbar-padding-x)); align-self: stretch; margin-block: -8px; padding-inline-end: var(--app-brand-padding-inline); border-right: 1px solid var(--app-border); color: var(--app-primary); }
.app-shell-designer .app-topbar-actions { align-self: stretch; gap: 16px; }
.app-shell-designer .app-topbar-page-actions { padding: 0; margin: 0; border: 0; }
.app-shell-designer .app-topbar-account-actions { width: calc(var(--pd-pieces-width, 288px) - var(--app-topbar-padding-x)); align-self: stretch; justify-content: space-between; margin-block: -8px; padding-left: 16px; border-left: 1px solid var(--app-border); }
.app-shell-designer .app-topbar-account-actions .login-toolbar { flex: 0 1 auto; min-width: 0; }
.app-shell-designer .app-user-trigger { max-width: 100%; }
.app-shell-designer .app-user-icon, .app-shell-designer .app-user-chevron { flex-shrink: 0; }
.app-breadcrumb { gap: 12px; font-size: 13px; color: var(--app-muted); }
.app-breadcrumb-current { color: var(--app-text); }
.app-breadcrumb-divider { color: #bcc6d4; }
.app-breadcrumb span:not(.app-breadcrumb-divider) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-shell .app-stations-bar {
    isolation: isolate;
    min-width: 0;
    min-height: 64px;
    padding: 0 16px;
    border-bottom: 1px solid var(--app-border);
    background: var(--app-stations-surface);
    box-shadow: var(--app-chrome-shadow);
}
.app-shell .app-stations-toggle { display: none; }
.app-shell .s-info.btn-toolbar { min-height: 64px; padding: 8px 0; gap: 10px; background: transparent; }
.app-shell .s-info.btn-toolbar :is(a.s-info, button.s-info) {
    --bs-btn-bg: transparent;
    --bs-btn-color: var(--app-text);
    --bs-btn-hover-bg: var(--app-nav-hover);
    --bs-btn-hover-color: var(--app-text);
    --bs-btn-active-bg: var(--app-nav-selected);
    --bs-btn-active-color: var(--app-nav-selected-text);
    --bs-btn-active-border-color: transparent;
}
.app-shell .s-info.btn-toolbar :is(a.s-info, button.s-info):is(:hover, :focus-visible) {
    --bs-btn-active-bg: var(--app-nav-selected-hover);
    --bs-btn-active-color: var(--app-nav-selected-text);
}
.app-shell .app-topbar :is(#app-culture-trigger .localization-combo.e-input-group, #app-culture-trigger select, .app-user-trigger, .app-notification-button) {
    background: transparent;
    color: var(--app-text);
    border-color: transparent;
}
.app-shell .app-topbar :is(#app-culture-trigger .localization-combo.e-input-group, #app-culture-trigger select, .app-user-trigger, .app-notification-button):is(:hover, :focus-visible) {
    background-color: var(--app-nav-hover);
    color: var(--app-text);
}
.app-shell .app-topbar :is(.app-user-trigger, .app-notification-button)[aria-expanded="true"],
.app-shell .app-topbar #app-culture-trigger.app-culture-open .localization-combo.e-input-group {
    background-color: var(--app-nav-selected);
    color: var(--app-nav-selected-text);
}
.app-shell .app-topbar :is(.app-user-trigger, .app-notification-button)[aria-expanded="true"]:is(:hover, :focus-visible),
.app-shell .app-topbar #app-culture-trigger.app-culture-open .localization-combo.e-input-group:is(:hover, :focus-visible) {
    background-color: var(--app-nav-selected-hover);
    color: var(--app-nav-selected-text);
}
.app-shell .app-topbar :is(.app-user-trigger, #app-culture-trigger) :is(.app-user-icon, .app-user-chevron, .e-input-group-icon, .app-culture-value) { color: inherit; }
body.app-theme :is(#app-culture-select_popup .e-list-item, #app-user-menu-panel .app-user-menu-item):is(:hover, :focus-visible, .e-hover) { background-color: var(--app-nav-hover); color: var(--app-text, #263548); }
body.app-theme :is(#app-culture-select_popup .e-list-item, #app-user-menu-panel .app-user-menu-item):is(.e-active, .active, [aria-selected="true"]) { background-color: var(--app-nav-selected); color: var(--app-nav-selected-text); }
body.app-theme :is(#app-culture-select_popup .e-list-item, #app-user-menu-panel .app-user-menu-item):is(.e-active, .active, [aria-selected="true"]):is(:hover, :focus-visible, .e-hover) { background-color: var(--app-nav-selected-hover); }
body.app-theme :is(#app-culture-select_popup .e-list-item .app-culture-item, #app-user-menu-panel .app-user-menu-item > span) { color: inherit; }
.app-shell .s-info-stations-group { column-gap: 8px; }
.app-shell .s-info.btn-toolbar a.s-info-overview-button { width: 40px; min-width: 40px; }
.app-shell .s-info-refresh-group { border-radius: 0; }

.app-shell .app-public-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--app-brand-gap);
    color: var(--app-primary);
    font-size: var(--app-brand-font-size);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.app-shell .app-brand-mark { display: block; flex: 0 0 auto; inline-size: 1.75rem; block-size: 1.75rem; }
.app-shell-public .app-public-brand { gap: .75rem; font-size: 1.1875rem; white-space: normal; }
.app-shell-public #app-culture-trigger .localization-combo.e-input-group { width: 5.25rem !important; height: auto; min-height: 2.25rem; font-size: .75rem; }
.app-shell-public .app-culture-value { height: auto; min-height: 2.125rem; gap: .4375rem; padding-left: .5rem; font-size: .6875rem; }

.app-shell .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    width: var(--app-sidebar-width);
    min-width: 0;
    height: 100dvh;
    background: var(--app-nav-surface);
    background-image: none;
    border-right: 1px solid var(--app-border);
    box-shadow: none;
    z-index: 40;
}

.app-shell .app-sidebar .app-nav-brand {
    position: relative;
    z-index: 1;
    flex: 0 0 var(--app-topbar-height);
    width: 100%;
    min-width: 0;
    height: var(--app-topbar-height);
    padding: 0 var(--app-brand-padding-inline);
    background: var(--app-chrome-surface) !important;
    border-bottom: 1px solid var(--app-border);
    box-shadow: var(--app-chrome-shadow);
}
.app-shell .app-nav-brand .container-fluid { padding: 0; }
.app-shell .home-brand-link { gap: var(--app-brand-gap); margin: 0; padding: 0; color: var(--app-primary); font-size: var(--app-brand-font-size); font-weight: 600; }
.app-shell .app-sidebar:has(.nav-scrollable.collapsed) .app-nav-brand-name { display: none; }

.app-shell.app-shell-authenticated .app-sidebar { width: var(--app-sidebar-width); min-width: 0; }
.app-shell.app-shell-authenticated .app-sidebar .nav-scrollable { background: var(--app-nav-surface); }

.app-shell .app-sidebar .nav-scrollable {
    --app-nav-group: #bcd2f1;
    --app-nav-submenu: #d4e3f7;
    --app-nav-branch: #9cb8dd;
    --app-nav-label-width: calc(var(--app-sidebar-expanded-width) - 5.5rem);
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    overflow: auto;
    padding: .5rem;
    background: var(--app-nav-surface);
    scrollbar-width: thin;
    scrollbar-gutter: stable both-edges;
    scrollbar-color: #ccd5e1 transparent;
}
.app-shell .app-sidebar .nav-scrollable::-webkit-scrollbar { display: block; width: 5px; }
.app-shell .app-sidebar .nav-scrollable::-webkit-scrollbar-thumb { border-radius: 4px; background: #ccd5e1; }
.app-shell .app-sidebar .nav-scrollable.collapsed { padding-inline: .25rem; }
.app-shell .app-sidebar .app-nav-items { gap: .1875rem; }
.app-shell .app-nav-section { position: relative; margin-top: .375rem; padding: .75rem .75rem .375rem; border-top: 1px solid #dce3ed; color: var(--app-muted); font-size: .625rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.app-shell .app-nav-section-label { display: block; inline-size: var(--app-nav-label-width); }
.app-shell .app-nav-items > .app-nav-section:first-child { margin-top: 0; padding-top: .375rem; border-color: transparent; }
.app-shell .app-sidebar:has(.nav-scrollable.collapsed) .app-nav-section {
    padding-inline: .375rem;
    overflow: clip;
    border-color: transparent;
}
.app-shell .app-sidebar:has(.nav-scrollable.collapsed) .app-nav-section::after { content: ""; position: absolute; inset-inline: .375rem; inset-block-start: 0; border-top: 1px solid #ccd7e5; }
.app-shell .app-sidebar:has(.nav-scrollable.collapsed) .app-nav-items > .app-nav-section:first-child::after { content: none; }
.app-shell .app-sidebar:has(.nav-scrollable.collapsed) .app-nav-section-label { visibility: hidden; }
.app-shell .app-sidebar .nav-item { padding: 0 !important; font-size: .8125rem; }
.app-shell .app-sidebar .nav-item:not(:has(a.nav-link)) { display: none; }
.app-shell .app-nav-section:has(+ .nav-item:not(:has(a.nav-link))) { display: none; }

.app-shell .app-sidebar .nav-link {
    position: relative;
    min-height: 2.375rem;
    height: auto;
    padding: .5rem .625rem;
    color: var(--app-text);
    border: 1px solid transparent;
    border-radius: .375rem;
    background: transparent;
    font-weight: 600;
    line-height: 1.45;
    text-decoration: none;
}
/* The same text column determines row height in both modes, including wrapped labels. */
.app-shell .app-sidebar .nav-link-text { flex: 0 0 var(--app-nav-label-width); inline-size: var(--app-nav-label-width); min-inline-size: 0; overflow-wrap: anywhere; }
.app-shell .app-sidebar .nav-link.collapsable:has(+ nav:not(.collapse)) { color: var(--app-text); background: var(--app-nav-group); }
.app-shell .app-sidebar .nav-item > nav {
    --app-nav-label-width: calc(var(--app-sidebar-expanded-width) - 7rem);
    margin: .125rem 0 .375rem .625rem;
    padding: .25rem 0 .25rem 1.125rem;
    border: 0;
    border-radius: .375rem;
    background: var(--app-nav-submenu);
}
.app-shell .app-sidebar :where(.nav-item > nav) .nav-link { min-height: 2.0625rem; padding: .375rem .5rem; color: var(--app-text); font-size: .75rem; font-weight: 400; }
.app-shell .app-sidebar .nav-link.active:not(.collapsable),
.app-shell .app-sidebar .nav-link.collapsable:has(+ nav .nav-link.active) { color: var(--app-nav-selected-text); background: var(--app-nav-selected); font-weight: 600; }
.app-shell .app-sidebar .nav-link.active:not(.collapsable)::before,
.app-shell .app-sidebar .nav-link.collapsable:has(+ nav .nav-link.active)::before { content: ""; position: absolute; inset-inline-start: 0; inset-block: .4375rem; width: .1875rem; border-radius: .125rem; background: var(--app-nav-indicator); }
/* An open parent remains a context hint while its selected child is visible. */
.app-shell .app-sidebar .nav-link.collapsable:has(+ nav:not(.collapse) .nav-link.active) { color: var(--app-text); background: var(--app-nav-group); }
.app-shell .app-sidebar .nav-link.collapsable:has(+ nav:not(.collapse) .nav-link.active)::before { content: none; }
.app-shell .app-sidebar .nav-link:is(:hover, :focus-visible),
.app-shell .app-sidebar .nav-link.collapsable:has(+ nav:not(.collapse)):is(:hover, :focus-visible),
.app-shell .app-sidebar .nav-link.collapsable:has(+ nav:not(.collapse) .nav-link.active):is(:hover, :focus-visible) { color: var(--app-text); background: var(--app-nav-hover); }
.app-shell .app-sidebar .nav-link.active:not(.collapsable):is(:hover, :focus-visible),
.app-shell .app-sidebar .nav-link.collapsable:has(+ nav .nav-link.active):is(:hover, :focus-visible) { color: var(--app-nav-selected-text); background: var(--app-nav-selected-hover); }
.app-shell .app-sidebar .nav-link:focus-visible,
.app-shell .app-nav-fold:focus-visible,
.app-shell .app-nav-toggle:focus-visible { outline: 2px solid var(--app-primary); outline-offset: -2px; }
.app-shell .app-sidebar .nav-link > :is(.e-icons, .icons, .icon, .bi, .oi, .fa-solid, .fa-regular, .fa-light, .scalar-logo-icon) { flex: 0 0 1.1875rem; width: 1.1875rem !important; height: 1.1875rem; font-size: 1.125rem; line-height: 1; margin: 0 .75rem 0 0 !important; text-align: center; }
.app-shell .app-sidebar .nav-item > nav .nav-link > :is(.e-icons, .icons, .icon, .bi, .oi, .fa-solid, .fa-regular, .fa-light, .scalar-logo-icon) { height: .9375rem; font-size: .9375rem; }
.app-shell .app-sidebar .nav-link.collapsable::after { content: ""; flex: 0 0 .3125rem; height: .3125rem; width: .3125rem; margin-left: auto; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(-45deg); }
.app-shell .app-sidebar .nav-link.collapsable:has(+ nav:not(.collapse))::after { transform: rotate(45deg); }
/* Row-relative branches follow wrapping text; permission-hidden rows do not extend the tree. */
.app-shell .app-sidebar .app-nav-items > .nav-item > nav > .nav-item:has(> a.nav-link) { position: relative; }
.app-shell .app-sidebar .app-nav-items > .nav-item > nav > .nav-item:has(> a.nav-link)::before { content: ""; position: absolute; inset-inline-start: -.5rem; inset-block: 0; border-inline-start: 1px solid var(--app-nav-branch); pointer-events: none; }
.app-shell .app-sidebar .app-nav-items > .nav-item > nav > .nav-item:has(> a.nav-link)::after { content: ""; position: absolute; inset-inline-start: -.5rem; inset-block-start: 50%; width: .75rem; border-block-start: 1px solid var(--app-nav-branch); pointer-events: none; }
.app-shell .app-sidebar .app-nav-items > .nav-item > nav > .nav-item:has(> a.nav-link):not(:has(~ .nav-item > a.nav-link))::before { inset-block-end: 50%; }
.app-shell .app-sidebar .app-nav-items > .nav-item > nav > .nav-item:has(> a.nav-link:is(:hover, :focus-visible))::after { border-color: #8096b7; }
.app-shell .app-sidebar .app-nav-items > .nav-item > nav > .nav-item:has(> a.nav-link.active)::after { border-color: var(--app-primary); }
.app-shell .app-sidebar:has(.nav-scrollable.collapsed) .nav-link { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; align-items: center; padding-inline: .125rem; overflow: clip; }
.app-shell .app-sidebar:has(.nav-scrollable.collapsed) .nav-link-text { grid-area: 1 / 1; visibility: hidden; pointer-events: none; }
.app-shell .app-sidebar:has(.nav-scrollable.collapsed) .nav-link > :is(.e-icons, .icons, .icon, .bi, .oi, .fa-solid, .fa-regular, .fa-light, .scalar-logo-icon) { grid-area: 1 / 1; margin: 0 !important; }
.app-shell .app-sidebar:has(.nav-scrollable.collapsed) .nav-link.collapsable::after { display: none; content: none; }
.app-shell .app-sidebar:has(.nav-scrollable.collapsed) .nav-item > nav {
    margin-inline: 0;
    padding-inline: .75rem 0;
}

.app-shell .app-nav-fold {
    display: flex;
    flex: 0 0 52px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 0 20px;
    color: var(--app-muted);
    background: var(--app-surface);
    border: 0;
    border-top: 1px solid var(--app-border);
    font: inherit;
    font-size: 12px;
}
.app-shell .app-nav-fold:hover { background: var(--app-selected); color: var(--app-primary); }
.app-shell .app-sidebar:has(.nav-scrollable.collapsed) .app-nav-fold { justify-content: center; padding: 0; }
.app-shell .app-sidebar:has(.nav-scrollable.collapsed) .app-nav-fold-label { display: none; }
.app-shell .app-nav-toggle, .app-shell .app-nav-backdrop { display: none; }

.app-shell .app-main {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    min-height: 0;
    height: 100%;
    margin: 0;
    overflow: auto;
    overscroll-behavior: contain;
}
.app-shell-public .app-header, .app-shell-public .app-main { grid-column: 1; }
.app-shell-standalone .app-main { grid-row: 1; }
.app-shell #main-content { padding: 16px !important; }
.app-shell.app-shell-public #main-content { inline-size: 100%; max-inline-size: 76rem; margin-inline: auto; padding: clamp(1rem, 2vw, 2rem) !important; }
.app-shell #main-content > .row.header { margin: 0 0 12px; }
.app-shell #main-content > .row.header > div { padding-left: 0; padding-bottom: 0 !important; }
.app-shell #main-content > .row.header h4,
.app-shell #main-content .plate-pieces-heading h4 { display: inline-block; margin: 0 14px 0 0; color: var(--app-text); font-size: 22px; line-height: 1.3; font-weight: 600; letter-spacing: -.02em; }
.app-shell #main-content > .row.header h6,
.app-shell #main-content .plate-pieces-heading h6 { display: inline; margin: 0; color: var(--app-muted); font-size: 13px; line-height: 1.6; font-weight: 400; }
.app-shell #main-content:has(> .row.grid) { height: 100%; min-height: 0; }
.app-shell #main-content:has(> .row.grid) > .row.header { min-height: 0; flex: 0 0 auto; }
.app-shell #main-content:has(> .row.grid) > .row.grid { margin-inline: 0; }
.app-shell #main-content:has(> .row.grid) > .row.grid > div { padding-inline: 0; }
.app-shell #main-content:has(> .app-content-fill) { display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; }
.app-shell #main-content > .app-content-fill { flex: 1 1 auto; min-height: 0; }
.app-shell .fixed-toasts-right { pointer-events: none; }
.app-shell .app-notification-panel .message.e-message { color: var(--app-text); }
/* Toasts are body portals; their transparent message content shares the history's severity background. */
body.app-theme .app-notification-toast.e-toast { background: #e2e3e5; }
.app-shell .app-notification-panel .message.e-success,
body.app-theme .app-notification-toast.e-toast:has(.message.e-success) { background: #f2f9f5; }
.app-shell .app-notification-panel .message.e-warning,
body.app-theme .app-notification-toast.e-toast:has(.message.e-warning) { background: #fff9ed; }
.app-shell .app-notification-panel .message.e-error,
body.app-theme .app-notification-toast.e-toast:has(.message.e-error) { background: #fdf1f2; }
.app-shell .app-notification-panel .message.e-info,
body.app-theme .app-notification-toast.e-toast:has(.message.e-info) { background: #f0f6ff; }
.app-shell .app-notification-panel .message-header { color: var(--app-muted); }
.app-shell .app-notification-panel .message.e-control.e-message:not(:last-child) { border-bottom: 1px solid #d5dee8; }

/* Shared action colors: existing variants select the same palette in forms and dialogs. */
body.app-theme :where(.mybutton, .generic-form-field-button, .notification-email-dropdown, .e-dialog .e-footer-content .e-btn, .entity-file-uploader .e-file-select-wrap .e-btn, .e-toolbar-item.bs-orange-500 .e-tbar-btn) {
    --app-action-bg: #e2e9f2;
    --app-action-fg: #405b78;
    --app-action-border: #adbed2;
}
body.app-theme :where(.e-btn, .generic-form-field-button):is(.e-primary, .generic-form-field-button-primary) {
    --app-action-bg: #c4ddf7;
    --app-action-fg: #235380;
    --app-action-border: #8bafd4;
}
body.app-theme :where(.e-btn, .generic-form-field-button):is(.e-success, .generic-form-field-button-success, .bs-green-500) {
    --app-action-bg: #cbe7d8;
    --app-action-fg: #24593b;
    --app-action-border: #90baa2;
}
body.app-theme :where(.e-btn, .generic-form-field-button):is(.e-info, .generic-form-field-button-info),
body.app-theme .entity-file-uploader .e-file-select-wrap .e-btn {
    --app-action-bg: #bfe9eb;
    --app-action-fg: #1a6061;
    --app-action-border: #81b9bc;
}
body.app-theme :where(.e-btn, .generic-form-field-button):is(.e-warning, .generic-form-field-button-warning) {
    --app-action-bg: #f7e5ab;
    --app-action-fg: #755514;
    --app-action-border: #cbb16b;
}
body.app-theme :where(.e-btn, .generic-form-field-button):is(.e-danger, .generic-form-field-button-danger, .bs-red-500) {
    --app-action-bg: #f4ccc3;
    --app-action-fg: #843b2b;
    --app-action-border: #cf9b8e;
}
body.app-theme :where(.e-btn, .generic-form-field-button):is(.e-light, .generic-form-field-button-light) {
    --app-action-bg: #edf2f8;
    --app-action-fg: #425c77;
    --app-action-border: #b6c5d6;
}
body.app-theme :where(.e-btn, .generic-form-field-button):is(.e-dark, .generic-form-field-button-dark) {
    --app-action-bg: #d3dce7;
    --app-action-fg: #35475d;
    --app-action-border: #9baabd;
}
body.app-theme :where(.e-btn, .generic-form-field-button):is(.bs-purple-500) {
    --app-action-bg: #e4d2f1;
    --app-action-fg: #603b7f;
    --app-action-border: #bda0d1;
}
body.app-theme :where(.e-btn, .generic-form-field-button):is(.bs-indigo-500) {
    --app-action-bg: #c9d7f9;
    --app-action-fg: #324f89;
    --app-action-border: #99afd8;
}
body.app-theme :where(.e-btn, .generic-form-field-button):is(.bs-teal-500) {
    --app-action-bg: #c5e5df;
    --app-action-fg: #225e52;
    --app-action-border: #87b6a9;
}
body.app-theme :where(.mybutton.bs-orange-500, .e-toolbar-item.bs-orange-500 .e-tbar-btn) {
    --app-action-bg: #f5d0ad;
    --app-action-fg: #75451d;
    --app-action-border: #caa27d;
}
body.app-theme :is(.mybutton, .generic-form-field-button, .notification-email-dropdown, .e-dialog .e-footer-content .e-btn, .entity-file-uploader .e-file-select-wrap .e-btn, .e-toolbar-item.bs-orange-500 .e-tbar-btn):not(:disabled):not(.e-disabled) {
    background: var(--app-action-bg) !important;
    border: 1px solid var(--app-action-border) !important;
    color: var(--app-action-fg) !important;
    box-shadow: none;
}
body.app-theme :is(.mybutton, .generic-form-field-button, .notification-email-dropdown, .e-dialog .e-footer-content .e-btn, .entity-file-uploader .e-file-select-wrap .e-btn, .e-toolbar-item.bs-orange-500 .e-tbar-btn):not(:disabled):not(.e-disabled):is(:hover, :focus-visible, :active, .e-active, [aria-expanded="true"]) {
    background: color-mix(in srgb, var(--app-action-bg) 88%, var(--app-action-fg)) !important;
    border-color: var(--app-action-fg) !important;
}
body.app-theme :is(.mybutton, .generic-form-field-button, .notification-email-dropdown, .e-dialog .e-footer-content .e-btn, .entity-file-uploader .e-file-select-wrap .e-btn, .e-toolbar-item.bs-orange-500 .e-tbar-btn):focus-visible {
    outline: 2px solid var(--app-action-fg);
    outline-offset: 2px;
}
body.app-theme :is(.mybutton, .generic-form-field-button, .notification-email-dropdown, .e-dialog .e-footer-content .e-btn, .entity-file-uploader .e-file-select-wrap .e-btn, .e-toolbar-item.bs-orange-500 .e-tbar-btn) :is(.e-btn-icon, .e-caret) {
    color: inherit !important;
}
body.app-theme .generic-form-field-button:disabled {
    background: #e5e7eb;
    border-color: #cbd5e1;
    color: #64748b;
    cursor: not-allowed;
    opacity: 1;
}
body.app-theme :is(.generic-form-field-detail-link, .entity-edit-dialog-detail-link).entity-link-anchor {
    background: #e7eef7;
    border-color: #adbed2 !important;
    color: #405b78;
}
body.app-theme :is(.generic-form-field-detail-link, .entity-edit-dialog-detail-link).entity-link-anchor:is(:hover, :focus-visible) {
    background: #d4e1f1;
    border-color: #7896ba !important;
    color: #294868;
}

/* Keep Syncfusion's layout, row height, controls, selection, filtering and paging. */
/* Every application grid owns the same presentation, independently of persistence
   or whether a BaseTable component has already been rendered. */
body.app-theme .e-grid .e-rowcell:not([data-grid-font-weight]) { --grid-column-font-weight: initial; font-weight: 400; }
body.app-theme .e-grid .e-rowcell[data-grid-font-weight="400"] { --grid-column-font-weight: 400; font-weight: 400; }
body.app-theme .e-grid .e-rowcell[data-grid-font-weight="600"] { --grid-column-font-weight: 600; font-weight: 600; }
body.app-theme .e-grid .e-rowcell[data-grid-font-weight="700"] { --grid-column-font-weight: 700; font-weight: 700; }

body.app-theme .e-grid td.e-rowcell:has(> .grid-entity-label),
body.app-theme .e-grid td.e-rowcell:has(> div > .grid-entity-label) { padding-inline: 0; }
body.app-theme .e-grid { padding-bottom: 2px; }
body.app-theme .e-grid .e-unboundcelldiv > button { margin: 0 0; }

/* A21: font-size pro header row */
body.app-theme .e-grid .e-headercelldiv { font-size: 0.8rem; }
/* A21: font-size pro data row */
body.app-theme .e-grid .e-rowcell { font-size: 0.8rem; }
body.app-theme .e-grid .e-headercell .e-headertext { font-weight: 600; }
body.app-theme .e-grid .e-rowcell.col-files-cell,
body.app-theme .e-grid .e-rowcell:has(> span.badge.col-order-status),
body.app-theme .e-grid .e-rowcell:has(> div > span.badge.col-order-status) { padding: .15rem; }

body.app-theme .e-grid,
body.app-theme .e-toolbar,
body.app-theme .e-pager { font-family: "Segoe UI", system-ui, sans-serif; border-color: var(--app-border); }
body.app-theme .e-grid { color: var(--app-text); border-radius: 6px; }
body.app-theme .e-grid .e-gridheader,
body.app-theme .e-grid .e-headercontent,
body.app-theme .e-grid .e-headercell,
body.app-theme .e-grid .e-filterbarcell,
body.app-theme .e-grid .e-rowcell { border-color: var(--app-border); }
body.app-theme .e-grid .e-headercell,
body.app-theme .e-grid .e-filterbarcell { background: #f8fafc; color: var(--app-text); }
body.app-theme .e-grid .e-rowcell { color: var(--app-text); }
body.app-theme .e-grid td.e-active { background: var(--app-selected); }
body.app-theme .e-grid .e-row:hover .e-rowcell:not(.e-active) { background: #f8fbff; }
body.app-theme .e-toolbar .e-toolbar-items,
body.app-theme .e-grid .e-gridpager { background: var(--app-surface); }
body.app-theme .e-pager .e-currentitem { background: var(--app-primary); color: #fff; border-color: var(--app-primary); }
body.app-theme .e-toolbar .e-tbar-btn { border-radius: 5px; }
body.app-theme .e-toolbar .e-toolbar-item.bs-orange-500 { background-color: transparent !important; }
body.app-theme .e-toolbar .e-toolbar-item:not(.a21-reset-grid-state-active):not(.bs-orange-500) :is(.e-tbar-btn, .e-dropdown-btn, .e-split-btn, .table-tools-button):not(.e-primary):not(.e-danger) {
    border-color: var(--app-control-border) !important;
    background: var(--app-control-surface) !important;
    color: var(--app-text) !important;
    box-shadow: none;
}
body.app-theme .e-toolbar .e-toolbar-item:not(.a21-reset-grid-state-active):not(.bs-orange-500) :is(.e-tbar-btn, .e-dropdown-btn, .e-split-btn, .table-tools-button):not(.e-primary):not(.e-danger):not(:disabled):not(.e-disabled):is(:hover, :focus-visible, :active, .e-active, [aria-expanded="true"]) {
    border-color: #aabfdd !important;
    background: var(--app-control-selected) !important;
    color: var(--app-text) !important;
}
body.app-theme .e-toolbar .e-toolbar-item.a21-reset-grid-state-active .e-tbar-btn { color: var(--app-text) !important; }
body.app-theme .e-toolbar .e-toolbar-item :is(.e-tbar-btn, .e-dropdown-btn, .e-split-btn, .table-tools-button) :is(.e-tbar-btn-text, .e-btn-content, .e-btn-icon) { color: inherit !important; }
body.app-theme .e-toolbar .e-toolbar-item :is(.e-tbar-btn, .e-dropdown-btn, .e-split-btn, .table-tools-button) .e-btn-icon::before { color: inherit !important; }
body.app-theme .e-toolbar .e-toolbar-item:not(.bs-orange-500) :is(.e-tbar-btn, .e-dropdown-btn, .e-split-btn, .table-tools-button):not(.e-primary):not(.e-danger):not(:disabled):not(.e-disabled):is(:hover, :focus-visible, :active, .e-active, [aria-expanded="true"]) .e-btn-icon { color: var(--app-control-accent) !important; }
body.app-theme .e-toolbar .e-toolbar-item:not(.a21-reset-grid-state-active):not(.bs-orange-500) :is(.e-tbar-btn, .e-dropdown-btn, .e-split-btn, .table-tools-button):not(.e-primary):not(.e-danger):not(:disabled):not(.e-disabled):is(:active, .e-active, [aria-expanded="true"]) { background: var(--app-control-selected-hover) !important; }
body.app-theme .e-toolbar .e-toolbar-item :is(.e-tbar-btn, .e-dropdown-btn, .e-split-btn, .table-tools-button):focus-visible { outline: 2px solid var(--app-primary); outline-offset: 1px; }
body.app-theme :is(.e-toolbar, .e-grid .e-filterbarcell) .e-input-group.e-ddl:not(.e-disabled) { border-color: var(--app-control-border); background: var(--app-control-surface); color: var(--app-text); }
body.app-theme :is(.e-toolbar, .e-grid .e-filterbarcell) .e-input-group.e-ddl:not(.e-disabled):is(:hover, :focus-within, .e-input-focus, [aria-expanded="true"]) { border-color: #aabfdd; background: var(--app-control-selected); }
body.app-theme :is(.e-toolbar, .e-grid .e-filterbarcell) .e-input-group.e-ddl:not(.e-disabled)[aria-expanded="true"] { background: var(--app-control-selected-hover); }
body.app-theme :is(.e-toolbar, .e-grid .e-filterbarcell) .e-input-group.e-ddl:not(.e-disabled) :is(.e-input, .e-input-group-icon) { background: transparent; color: inherit; }
body.app-theme :is(.e-toolbar, .e-grid .e-filterbarcell) .e-input-group.e-ddl:not(.e-disabled):is(:hover, :focus-within, .e-input-focus, [aria-expanded="true"]) .e-input-group-icon { color: var(--app-control-accent); }
.app-shell .btn-primary,
.app-shell .e-btn.e-primary:not(.e-flat) { background-color: var(--app-primary); border-color: var(--app-primary); }
.app-shell .btn-primary:hover,
.app-shell .e-btn.e-primary:not(.e-flat):hover { background-color: #286abe; border-color: #286abe; }
.app-shell .form-control,
.app-shell .form-select { border-color: var(--app-border); border-radius: 5px; }
.app-shell .form-control:focus,
.app-shell .form-select:focus { border-color: var(--app-primary); box-shadow: 0 0 0 2px rgb(52 126 215 / 12%); }

/* Syncfusion portals are attached to body, outside the layout element. */
.app-shell .s-info-custom-tooltip {
    --s-info-tooltip-border: var(--app-popover-border);
    box-shadow: var(--app-popover-shadow);
}
#app-culture-trigger { anchor-name: --app-culture; }
#app-user-trigger { anchor-name: --app-user; }
#notificationButton { anchor-name: --app-notifications; }
#app-culture-select_popup { --app-popover-anchor: --app-culture; --app-popover-width: 180px; }
#app-user-menu-panel { --app-popover-anchor: --app-user; --app-popover-width: 246px; }
#notificationPanel { --app-popover-anchor: --app-notifications; }

body.app-theme :is(#app-culture-select_popup, #app-user-menu-panel, #notificationPanel) {
    --app-popover-used-width: min(var(--app-popover-width), calc(100vw - 24px));
    position: fixed !important;
    inset: 66px 12px auto auto !important;
    width: var(--app-popover-used-width) !important;
    margin: 0 !important;
    max-height: calc(100dvh - 78px) !important;
    min-height: 0;
    box-sizing: border-box;
    border: 1px solid var(--app-popover-border);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--app-popover-shadow);
}
body.app-theme :is(#app-culture-select_popup, #app-user-menu-panel, #notificationPanel)::before {
    content: "";
    position: absolute;
    top: -6px;
    right: 12px;
    width: 10px;
    height: 10px;
    border-top: 1px solid var(--app-popover-border);
    border-left: 1px solid var(--app-popover-border);
    background: #fff;
    transform: translateX(-50%) rotate(45deg);
    pointer-events: none;
}
@supports (position-area: bottom span-all) {
    body.app-theme :is(#app-culture-select_popup, #app-user-menu-panel, #notificationPanel) {
        position-anchor: var(--app-popover-anchor);
        position-area: bottom span-all;
        align-self: start;
        justify-self: start;
        inset: 10px auto auto clamp(12px, calc(anchor(right) - var(--app-popover-used-width)), calc(100% - var(--app-popover-used-width) - 12px)) !important;
        max-height: calc(100% - 22px) !important;
    }
    body.app-theme :is(#app-culture-select_popup, #app-user-menu-panel, #notificationPanel)::before {
        position: fixed;
        position-anchor: var(--app-popover-anchor);
        inset: calc(anchor(bottom) + 5px) auto auto anchor(center);
    }
}
body.app-theme > .e-dlg-container .e-dialog,
body.app-theme > .e-dialog { border-radius: 8px; border-color: #e1e6ed; }
body.app-theme .e-dialog,
body.app-theme .e-dialog > :is(.e-dlg-content, .e-footer-content) { background-color: var(--app-background); }
body.app-theme .e-dialog > .e-dlg-header-content { background: var(--app-chrome-surface); border-bottom: 1px solid #e1e6ed; }

/* Only the outer visible surfaces follow the dialog corners; popup overflow stays unchanged. */
body.app-theme .e-dialog > :is(.e-dlg-header-content, .e-dlg-content, .e-footer-content) { border-radius: 0; }
body.app-theme .e-dialog > :nth-child(1 of :is(.e-dlg-header-content, .e-dlg-content, .e-footer-content):not(.e-hide)) {
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}
body.app-theme .e-dialog > :nth-last-child(1 of :is(.e-dlg-header-content, .e-dlg-content, .e-footer-content):not(.e-hide)) {
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}

/* Syncfusion portals these headers outside the page's isolated CSS scope. */
.curve-preview-modal.e-dialog .e-dlg-header-content { display: flex; flex-direction: row-reverse; align-items: center; gap: .375rem; }
.curve-preview-modal.e-dialog .e-dlg-header { flex: 1; min-inline-size: 0; width: auto; }
.curve-preview-modal.e-dialog .e-dlg-closeicon-btn { flex: 0 0 auto; float: none; }

.limits-groups-grid .e-table {
    min-inline-size: 40rem;
}
.limits-groups-grid :is(.e-headercelldiv, .e-headertext) {
    height: auto;
    line-height: 1.3;
    white-space: normal;
}

/* Syncfusion moves these limit forms under body, outside the page's scoped CSS. */
.entity-edit-dialog:has(#limit-group-name, #limit-range-from) .entity-edit-dialog-header {
    flex-wrap: wrap;
}
.entity-edit-dialog:has(#limit-group-name, #limit-range-from) .entity-edit-dialog-title {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
}
.entity-edit-dialog:has(#limit-group-name, #limit-range-from) .entity-edit-dialog-header-actions {
    flex: 1 1 auto;
    min-width: 0;
}
.entity-edit-dialog:has(#limit-group-name, #limit-range-from) .entity-edit-dialog-header-actions .col {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
}
.entity-edit-dialog:has(#limit-group-name, #limit-range-from) .entity-edit-dialog-header-actions :is(.buttons-right, .buttons-left, .buttons-center) {
    flex-wrap: wrap !important;
}

@media (max-width: 1250px) {
    .app-shell-designer .app-user-name { display: none; }
}

@media (max-width: 1100px) {
    .app-shell { --app-topbar-padding-x: 14px; }
    .app-shell .app-stations-bar { padding-inline: 12px; }
    .app-shell #main-content { padding: 14px !important; }
}

@media (max-width: 900px) {
    .app-shell-designer .app-topbar-account-actions { gap: 8px; padding-left: 12px; }
}

@media (max-width: 760px) {
    .app-shell { --app-topbar-padding-x: 10px; grid-template-columns: minmax(0, 1fr); }
    .app-shell .app-header, .app-shell .app-main { grid-column: 1; }
    .app-shell .app-topbar { gap: 8px; padding-block: 7px; }
    .app-shell .app-topbar-actions, .app-shell .app-topbar-account-actions { gap: 5px; }
    .app-shell .app-breadcrumb { font-size: 12px; gap: 7px; }
    .app-shell .app-breadcrumb > span:not(:last-child) { display: none; }
    .app-shell .app-nav-toggle { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 36px; height: 36px; padding: 0; border: 1px solid var(--app-border); border-radius: 5px; background: #fff; color: var(--app-text); }
    .app-shell .app-sidebar { top: var(--app-topbar-height); bottom: 0; height: calc(100dvh - var(--app-topbar-height)); width: var(--app-sidebar-width); transform: translateX(-100%); box-shadow: 8px 0 24px rgb(38 53 72 / 10%); }
    .app-shell .app-sidebar .app-nav-brand { display: none; }
    .app-shell:has(.nav-scrollable[data-app-navigation-open="true"]) .app-sidebar { transform: translateX(0); }
    .app-shell:has(.nav-scrollable[data-app-navigation-open="true"]) .app-nav-backdrop { display: block; position: fixed; inset: var(--app-topbar-height) 0 0; padding: 0; border: 0; background: rgb(38 53 72 / 20%); z-index: 35; }
    .app-shell .app-stations-bar { min-height: 0; padding-inline: 8px; }
    .app-shell .app-stations-toggle { display: flex; align-items: center; justify-content: space-between; gap: .75rem; width: 100%; min-block-size: 2.5rem; padding: .5rem; border: 0; border-radius: .3rem; background: transparent; color: var(--app-text); font-size: .875rem; font-weight: 600; text-align: start; }
    .app-shell .app-stations-toggle:hover { background: var(--app-control-hover); color: var(--app-control-accent); }
    .app-shell .app-stations-toggle:focus-visible { outline: 2px solid var(--app-primary); outline-offset: 2px; }
    .app-shell .s-info.btn-toolbar[data-mobile-stations-expanded="false"] { display: none; }
    .app-shell #main-content { padding: 12px !important; }
    .app-shell #main-content > .row.header h4,
.app-shell #main-content .plate-pieces-heading h4 { display: block; margin: 0 0 3px; font-size: 20px; }
    .app-shell #main-content > .row.header h6,
.app-shell #main-content .plate-pieces-heading h6 { display: block; }
    .app-shell .app-public-brand { gap: .5rem; font-size: 1rem; }
    .app-shell .app-brand-mark { inline-size: 1.5rem; block-size: 1.5rem; }
    .app-shell-designer .app-topbar-location { flex-basis: 100%; }
    .app-shell.app-shell-designer .app-public-brand { margin-block: -7px; }
    .app-shell-designer .app-topbar-account-actions { margin-block: -7px; }
    .app-shell-designer .app-topbar-actions { flex: 1 1 100%; flex-wrap: wrap; justify-content: flex-end; }
    .app-shell-designer .app-topbar-page-actions { flex: 1 1 auto; justify-content: flex-end; padding-right: 10px; margin-right: 0; }
    .app-shell-designer .app-user-name { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .app-shell *, .app-shell *::before, .app-shell *::after { scroll-behavior: auto !important; }
}

/* Shared table popovers: history, notes and station details. */
:is(.entity-history-panel, .entity-notes-panel) {
    border: 1px solid var(--app-popover-border, #9eacc0);
    border-radius: .5rem;
    background: var(--app-surface, #fff);
    color: var(--app-text, #263548);
    box-shadow: var(--app-popover-shadow, 0 .25rem .75rem #1f2e4233, 0 1rem 2.5rem #1f2e4242);
}

:is(.entity-history-tooltip-grid, .entity-notes-tooltip-grid, .station-tooltip-table) {
    --tooltip-table-header-bg: var(--app-background, #f3f5f8);
    --tooltip-table-divider: var(--app-border, #e1e6ed);
    --tooltip-table-emphasis: 500;
    --grid-column-font-weight: var(--tooltip-table-emphasis);
    --bs-badge-font-weight: var(--tooltip-table-emphasis);
    font-weight: 400;
}

.entity-history-tooltip-row > div,
.entity-notes-tooltip-grid > div,
.station-tooltip-table td {
    border-bottom: 1px solid var(--tooltip-table-divider);
}

.entity-history-tooltip-header-row,
.entity-history-tooltip-header,
.entity-notes-tooltip-header,
.station-tooltip-table th {
    background: var(--tooltip-table-header-bg);
    color: var(--app-text, #263548);
    font-weight: var(--tooltip-table-emphasis);
}

.entity-history-tooltip-header-row,
.station-tooltip-table th {
    box-shadow: inset 0 -1px var(--tooltip-table-divider);
}

.entity-history-tooltip-message,
.entity-history-tooltip-entity,
.entity-history-tooltip-result,
.entity-notes-tooltip-message,
.entity-notes-tooltip-entity,
.entity-notes-source,
:is(.entity-history-tooltip-grid, .entity-notes-tooltip-grid, .station-tooltip-table) :is(b, strong, .badge) {
    font-weight: var(--tooltip-table-emphasis);
}

/* Value badges share metrics as well as the palette in every table popup. */
:is(.entity-history-tooltip-grid, .entity-notes-tooltip-grid, .station-tooltip-table) span.badge:is(.col-history-type, .col-entity-note-type, .col-order-status) {
    padding: .35em .65em;
    border-radius: .2rem;
    font-size: .7rem;
    line-height: 1.25;
}

/* Column popups retain their existing positioner and scrolling. Each arrow anchors
   to its own panel, escapes overflow clipping, and inherits that panel's palette. */
@supports (anchor-scope: --column-popover-panel) and (top: anchor(top)) {
    .app-column-popover {
        anchor-name: --column-popover-panel;
        anchor-scope: --column-popover-panel;
    }

    .app-column-popover[data-popover-placement]::before {
        content: "";
        position: fixed;
        position-anchor: --column-popover-panel;
        width: .625rem;
        height: .625rem;
        transform: translate(-50%, -50%) rotate(45deg);
        background-color: inherit;
        border-color: inherit;
        border-style: solid;
        border-width: 0;
        pointer-events: none;
        z-index: 1;
    }

    .app-column-popover:is([data-popover-placement="left"], [data-popover-placement="right"])::before {
        top: clamp(calc(anchor(top) + .75rem), var(--popover-anchor-y), calc(anchor(bottom) - .75rem));
    }

    .app-column-popover[data-popover-placement="right"]::before {
        left: anchor(left);
        border-bottom-width: 1px;
        border-left-width: 1px;
    }

    .app-column-popover[data-popover-placement="left"]::before {
        left: anchor(right);
        border-top-width: 1px;
        border-right-width: 1px;
    }

    .app-column-popover:is([data-popover-placement="top"], [data-popover-placement="bottom"])::before {
        left: clamp(calc(anchor(left) + .75rem), var(--popover-anchor-x), calc(anchor(right) - .75rem));
    }

    .app-column-popover[data-popover-placement="bottom"]::before {
        top: anchor(top);
        border-top-width: 1px;
        border-left-width: 1px;
    }

    .app-column-popover[data-popover-placement="top"]::before {
        top: anchor(bottom);
        border-bottom-width: 1px;
        border-right-width: 1px;
    }
}
