/* Persistent ERP navigation and subsidiary switching. */
.workspace-shell {
    --workspace-header-offset: 0px;
}
.workspace-shell:has(.app-staging-warning) { --workspace-header-offset: 40px; }
.workspace-header {
    position: relative;
    top: auto;
    z-index: 1030;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 8px 24px;
    background: var(--theme-surface-strong);
    color: var(--theme-text);
    border-bottom: 1px solid var(--theme-border);
}
.workspace-top-shell button { font: inherit; }
.workspace-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 200px;
    color: var(--theme-text);
    font-size: 1rem;
    font-weight: var(--user-heading-weight, 700);
    text-decoration: none;
    white-space: nowrap;
}
.workspace-brand img { object-fit: contain; }
.workspace-icon { flex: 0 0 20px; }
.workspace-icon-button, .workspace-control {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    min-width: 44px;
    padding: 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--theme-text-soft);
    cursor: pointer;
}
.workspace-control:hover, .workspace-icon-button:hover { background: var(--theme-surface-muted); }
.workspace-header .workspace-dropdown {
    padding: 8px;
    border: 1px solid var(--theme-border);
    border-radius: 10px;
    background: var(--theme-surface-strong);
    color: var(--theme-text);
    box-shadow: none;
    max-height: calc(100dvh - 100px);
    overflow-y: auto;
}
.workspace-subsidiary { min-width: 0; max-width: 320px; }
.workspace-subsidiary .workspace-control { max-width: 100%; }
.workspace-subsidiary .workspace-control span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-subsidiary-menu { width: min(360px, calc(100vw - 32px)); }
.workspace-subsidiary-form { display: grid; gap: 4px; margin: 0; }
.workspace-subsidiary-empty { padding: 12px; color: var(--theme-text-muted); }
.workspace-header .app-subsidiary-option { min-height: 44px; white-space: normal; }
.workspace-header .app-global-search-form { flex: 1 1 280px; width: auto; min-width: 120px; max-width: 560px; margin-left: auto; }
.workspace-header .app-global-search-input { min-height: 44px; border: 1px solid var(--theme-border); border-radius: 8px; background: var(--theme-surface-muted); color: var(--theme-text); box-shadow: none; }
.workspace-header .app-global-search-input::placeholder { color: var(--theme-text-muted); opacity: 1; }
.workspace-header .app-global-search-form .app-global-search-icon { color: var(--theme-text-muted); stroke: var(--theme-text-muted); }
.workspace-header .app-global-search-dropdown { width: min(560px, calc(100vw - 32px)); }
.workspace-notification-dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--theme-accent); }
.workspace-notification-menu { width: min(420px, calc(100vw - 32px)); }
.workspace-header .app-notification-list { max-height: 360px; }
.workspace-header .app-notification-item { border-radius: 8px; background: var(--theme-surface-muted); box-shadow: none; }
.workspace-header .app-user-avatar { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; background: var(--theme-accent-soft); color: var(--theme-accent); box-shadow: none; font-size: .75rem; }
.workspace-profile-name { max-width: 140px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.workspace-header .app-user-menu { min-width: 260px; }
.workspace-header .dropdown-item { min-height: 44px; display: flex; align-items: center; white-space: normal; color: var(--theme-text); }

.workspace-shell { background: var(--theme-bg); }
.workspace-top-shell {
    position: sticky;
    top: var(--workspace-header-offset, 0px);
    z-index: 1030;
    flex: 0 0 auto;
    background: var(--theme-surface-strong);
}
.workspace-primary-navigation {
    padding: 0 24px;
    background: var(--theme-surface-strong);
    border-bottom: 1px solid var(--theme-border);
}
.workspace-module-tabs { display: flex; align-items: stretch; overflow-x: auto; scrollbar-width: thin; }
.workspace-nav-group { flex: 0 0 auto; }
.workspace-module-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 12px;
    border-bottom: 3px solid transparent;
    color: var(--theme-text-soft);
    font-size: .8125rem;
    font-weight: var(--app-font-weight-medium, 500);
    white-space: nowrap;
    list-style: none;
    text-decoration: none;
    cursor: pointer;
}
.workspace-module-trigger::-webkit-details-marker { display: none; }
.workspace-module-trigger:hover, .workspace-nav-group[open] > summary { color: var(--theme-text); background: var(--theme-surface-muted); }
.workspace-nav-group.is-active > summary, .workspace-home.is-current { border-bottom-color: var(--theme-accent); color: var(--theme-accent-strong); }
.workspace-chevron { width: 5px; height: 5px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg); margin-top: -3px; }
.workspace-nav-group[open] .workspace-chevron { transform: rotate(225deg); margin-top: 3px; }
.workspace-menu-panel {
    position: fixed;
    z-index: 1040;
    top: 108px;
    left: 24px;
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100dvh - 140px);
    overflow-y: auto;
    padding: 16px;
    background: var(--theme-surface-strong);
    border: 1px solid var(--theme-border-strong);
    border-radius: 0 0 4px 4px;
}
.workspace-menu-heading { margin-bottom: 10px; padding: 0 8px 10px; border-bottom: 1px solid var(--theme-border); font-size: .75rem; font-weight: var(--app-font-weight-semibold, 600); color: var(--theme-text-muted); }
.workspace-destinations { margin: 0; padding: 0; list-style: none; }
.workspace-destinations-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.workspace-destination { display: flex; align-items: center; min-height: 44px; padding: 10px 12px; border-left: 2px solid transparent; color: var(--theme-text-soft); font-size: .8125rem; line-height: 1.4; text-decoration: none; }
.workspace-destination:hover { color: var(--theme-text); background: var(--theme-surface-muted); }
.workspace-destination.is-current { border-left-color: var(--theme-accent); color: var(--theme-accent-strong); background: var(--theme-accent-soft); font-weight: var(--app-font-weight-semibold, 600); }
.workspace-favorites { padding: 0 24px; background: var(--theme-surface-muted); border-bottom: 1px solid var(--theme-border); }
.workspace-favorites-heading { flex: 0 0 auto; padding-right: 12px; border-right: 1px solid var(--theme-border); color: var(--theme-text-muted); font-size: .75rem; font-weight: var(--app-font-weight-semibold, 600); }
.workspace-favorites .app-bookmark-shell { display: flex; align-items: center; gap: 8px; width: 100%; padding: 0; margin: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
.workspace-favorites .app-bookmark-list { display: flex; flex: 1; gap: 4px; min-width: 0; width: 0; margin: 0; padding: 0; overflow-x: auto; list-style: none; scrollbar-width: thin; }
.workspace-favorites .app-bookmark-list-item { display: flex; flex: 0 0 auto; max-width: 200px; }
.workspace-shell .workspace-favorites .app-bookmark-chip { display: flex; align-items: center; width: 100%; max-width: none; min-height: 44px; padding: 8px 10px; border: 0; border-radius: 0; background: transparent !important; box-shadow: none; color: var(--theme-text-soft) !important; font-size: .75rem; font-weight: var(--app-font-weight-regular, 400); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workspace-shell .workspace-favorites .app-bookmark-chip:hover { background: var(--theme-accent-soft) !important; transform: none; }
.workspace-text-button { flex: 0 0 auto; min-height: 44px; padding: 8px; color: var(--theme-accent-strong); background: transparent; border: 0; font-size: .75rem !important; cursor: pointer; }
.workspace-favorites .app-bookmark-empty { flex: 1; margin: 0; padding: 8px; font-size: .75rem; color: var(--theme-text-muted); }
.workspace-favorites [data-has-bookmarks="false"] .app-bookmark-list { display: none; }
.workspace-favorite-status { margin: 0; color: var(--theme-danger); font-size: .75rem; }
.workspace-favorites-manage { list-style: none; margin: 0 0 16px; padding: 0; }
.workspace-favorites-manage li { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--theme-border); }
.workspace-favorites-manage li span { flex: 1; min-width: 0; }
.workspace-favorites-manage button { flex: 0 0 44px; width: 44px; min-height: 44px; border: 0; border-radius: 4px; background: transparent; color: var(--theme-text); }
.workspace-favorites-manage button:hover { background: var(--theme-accent-soft); }
.workspace-caption { font-size: .75rem; font-weight: var(--app-font-weight-semibold, 600); color: var(--theme-text-muted); }
.workspace-top-shell :focus-visible, .workspace-favorites-manage button:focus-visible { outline: 2px solid var(--theme-accent); outline-offset: -2px; }
.workspace-shell [hidden] { display: none !important; }
.workspace-shell .app-main-content { width: calc(100% - 48px); max-width: none; margin-left: 24px; margin-right: 24px; padding: 0; }
html[data-user-colors] .workspace-header, html[data-user-colors] .workspace-primary-navigation { background: var(--user-navbar); border-color: var(--user-navbar-border); }
html[data-user-colors] .workspace-header :is(.workspace-brand, .workspace-control, .workspace-icon-button), html[data-user-colors] .workspace-module-trigger { color: var(--user-navbar-on); }
html[data-user-colors] .workspace-header .app-global-search-input { background: var(--user-navbar); border-color: var(--user-navbar-border); }
html[data-user-colors] .workspace-header .app-global-search-form .app-global-search-icon { color: var(--user-navbar-on); stroke: var(--user-navbar-on); }
html[data-user-colors] .workspace-nav-group.is-active > summary, html[data-user-colors] .workspace-home.is-current { border-bottom-color: var(--user-accent-on); }
html[data-user-colors] .workspace-module-trigger:hover, html[data-user-colors] .workspace-nav-group[open] > summary { background: var(--user-accent); color: var(--user-accent-on); }
@media (max-width: 1199.98px) {
    .workspace-header { padding: 8px 16px; gap: 8px; }
    .workspace-brand { flex: 0 1 auto; }
    .workspace-brand span { display: none; }
    .workspace-profile-name { display: none; }
    .workspace-primary-navigation, .workspace-favorites { padding: 0 16px; }
    .workspace-shell .app-main-content { width: calc(100% - 32px); margin-left: 16px; margin-right: 16px; }
}
@media (max-width: 767.98px) {
    .workspace-header { flex-wrap: wrap; }
    .workspace-subsidiary { flex: 1; max-width: none; }
    .workspace-subsidiary .workspace-icon { display: none; }
    .workspace-header .app-global-search-form { flex: 1 0 100%; order: 5; max-width: none; margin: 0; }
    .workspace-header .app-global-search-dropdown { width: 100%; }
    .workspace-header .workspace-dropdown { position: fixed !important; left: 16px !important; right: 16px !important; top: calc(64px + var(--workspace-header-offset, 0px)) !important; transform: none !important; width: auto; max-height: calc(100dvh - 100px); }
    .workspace-favorites-long-label { display: none; }
    .workspace-favorites .app-bookmark-list-item { max-width: 140px; }
    .workspace-favorites-heading { display: none; }
    .workspace-destinations-columns { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .workspace-top-shell * { transition: none !important; scroll-behavior: auto !important; } }
