/* Shell contract:
   Topbar colors must come from theme tokens or sidebar tokens.
   Do not introduce Fiori/Compact-specific color literals here. */
body.app-shell:not(.app-shell--default) {
  --shell-topbar-min-height: 36px;
  --shell-topbar-gap: 12px;
  --shell-topbar-margin-bottom: 0;
  --shell-topbar-padding-y: 0;
  --shell-topbar-padding-x: 12px;
  --shell-topbar-border-radius: 0;
  --shell-topbar-bg: var(--shell-sidebar-bg, #0f2740);
  --shell-topbar-border: var(--shell-sidebar-border, rgba(255, 255, 255, 0.08));
  --shell-topbar-control-height: 36px;
  --shell-topbar-control-font-size: 0.8rem;
  --shell-topbar-icon-color: var(--shell-sidebar-text, #d8e5f3);
  --shell-topbar-icon-hover-bg: rgba(255, 255, 255, 0.12);
  --shell-topbar-icon-hover-color: #ffffff;
  --shell-workspace-module-color: var(--shell-sidebar-text-soft, #9eb2c9);
  --shell-workspace-path-color: var(--shell-sidebar-text, #d8e5f3);
  --shell-workspace-chevron-color: var(--shell-sidebar-text-soft, #9eb2c9);
  --shell-user-chip-color: var(--shell-sidebar-text, #d8e5f3);
  --shell-user-chip-chevron-color: var(--shell-sidebar-text-soft, #9eb2c9);
  --shell-user-avatar-bg: var(--shell-brand-badge-bg, #2f7be4);
  --shell-user-avatar-color: #ffffff;
  --shell-topbar-divider-bg: var(--shell-sidebar-border, rgba(255, 255, 255, 0.14));
  --shell-shortcut-menu-bg: #ffffff;
  --shell-shortcut-menu-border: #c6d9ef;
  --shell-shortcut-menu-shadow: 0 10px 24px rgba(15, 23, 42, 0.2);
  --shell-shortcut-menu-radius: 10px;
  --shell-shortcut-menu-list-padding: 4px;
  --shell-shortcut-menu-item-padding-y: 8px;
  --shell-shortcut-menu-item-padding-x: 10px;
  --shell-shortcut-menu-item-radius: 8px;
  --shell-shortcut-menu-header-border: #e5edf6;
  --shell-shortcut-menu-header-color: #223a53;
  --shell-shortcut-menu-header-font-size: 0.78rem;
  --shell-shortcut-menu-header-font-weight: 700;
  --shell-shortcut-menu-header-letter-spacing: 0.03em;
  --shell-shortcut-menu-item-color: #1f3852;
  --shell-shortcut-menu-item-font-size: 0.84rem;
  --shell-shortcut-menu-item-font-weight: 600;
  --shell-shortcut-menu-item-hover-bg: #ecf4ff;
  --shell-shortcut-menu-item-hover-color: #184a85;
  --shell-shortcut-menu-item-active-bg: #2f7be4;
  --shell-shortcut-menu-item-active-color: #ffffff;
  --shell-user-menu-bg: var(--shell-shortcut-menu-bg);
  --shell-user-menu-border: var(--shell-shortcut-menu-border);
  --shell-user-menu-shadow: var(--shell-shortcut-menu-shadow);
  --shell-user-menu-radius: var(--shell-shortcut-menu-radius);
  --shell-user-menu-header-border: var(--shell-shortcut-menu-header-border);
  --shell-user-menu-title-color: var(--shell-shortcut-menu-header-color);
  --shell-user-menu-label-color: var(--shell-workspace-module-color);
  --shell-user-menu-text-color: var(--shell-shortcut-menu-item-color);
  --shell-user-menu-action-border: var(--shell-shortcut-menu-header-border);
  --shell-user-menu-button-bg: var(--shell-shortcut-menu-bg);
  --shell-user-menu-button-border: var(--shell-shortcut-menu-border);
  --shell-user-menu-button-text: var(--shell-shortcut-menu-item-color);
  --shell-user-menu-button-hover-bg: var(--shell-shortcut-menu-item-hover-bg);
  --shell-user-menu-button-hover-border: var(--shell-shortcut-menu-border);
  --shell-user-menu-button-active-bg: var(--shell-shortcut-menu-item-active-bg);
  --shell-user-menu-button-active-border: var(--shell-shortcut-menu-item-active-bg);
  --shell-user-menu-button-active-text: var(--shell-shortcut-menu-item-active-color);
  --shell-danger-button-bg: #fff5f4;
  --shell-danger-button-border: #f3c7c3;
  --shell-danger-button-text: #a1261c;
  --shell-danger-button-hover-bg: #fde8e6;
  --shell-danger-button-hover-border: #e9ada7;
  --shell-danger-button-hover-text: #8d1f17;
  --shell-topbar-badge-bg: var(--shell-shortcut-menu-item-active-bg);
  --shell-topbar-badge-text: var(--shell-shortcut-menu-item-active-color);
}

body.app-shell:not(.app-shell--default) .erp-topbar {
  display: flex;
  position: static;
  z-index: auto;
  box-sizing: border-box;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--shell-topbar-gap);
  height: var(--shell-topbar-min-height);
  min-height: var(--shell-topbar-min-height);
  max-height: var(--shell-topbar-min-height);
  margin: 0 -12px var(--shell-topbar-margin-bottom);
  padding: var(--shell-topbar-padding-y) max(var(--shell-topbar-padding-x), env(safe-area-inset-left))
    0 max(var(--shell-topbar-padding-x), env(safe-area-inset-right));
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: var(--shell-topbar-border-radius);
  background: var(--shell-topbar-bg);
  box-shadow: none;
}

body.app-shell:not(.app-shell--default) .erp-topbar {
  border-bottom: 0;
}

body.app-shell:not(.app-shell--default) .erp-shell-header {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Hard-merge: topbar must be flush with zero gap */
.erp-shell-header > .erp-topbar {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
  border-bottom: 0 !important;
}

body.app-shell:not(.app-shell--default) .erp-topbar-left,
body.app-shell:not(.app-shell--default) .erp-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

body.app-shell:not(.app-shell--default) .erp-topbar-right {
  margin-left: auto;
  position: relative;
  flex: 0 0 auto;
  gap: 6px;
}

body.app-shell:not(.app-shell--default) .erp-topbar-left {
  gap: 14px;
  position: relative;
  flex: 1 1 auto;
}

body.app-shell:not(.app-shell--default) .erp-workspace-context {
  appearance: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  max-width: 560px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

body.app-shell:not(.app-shell--default) .erp-workspace-context__module {
  color: var(--shell-workspace-module-color);
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

body.app-shell:not(.app-shell--default) .erp-workspace-context__path {
  overflow: hidden;
  color: var(--shell-workspace-path-color);
  font-size: 0.83rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

body.app-shell:not(.app-shell--default) .erp-workspace-context__chevron {
  color: var(--shell-workspace-chevron-color);
  font-size: 0.83rem;
  line-height: 1;
}

body.app-shell:not(.app-shell--default) .erp-context-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(280px, calc(100vw - 28px));
  border: 1px solid var(--shell-shortcut-menu-border);
  border-radius: var(--shell-shortcut-menu-radius);
  background: var(--shell-shortcut-menu-bg);
  box-shadow: var(--shell-shortcut-menu-shadow);
  z-index: 120;
  overflow: hidden;
}

body.app-shell:not(.app-shell--default) .erp-context-menu__header {
  padding: 8px 10px;
  border-bottom: 1px solid var(--shell-shortcut-menu-header-border);
  color: var(--shell-shortcut-menu-header-color);
  font-size: var(--shell-shortcut-menu-header-font-size);
  font-weight: var(--shell-shortcut-menu-header-font-weight);
  text-transform: uppercase;
  letter-spacing: var(--shell-shortcut-menu-header-letter-spacing);
}

body.app-shell:not(.app-shell--default) .erp-context-menu__list {
  display: grid;
  padding: var(--shell-shortcut-menu-list-padding);
}

body.app-shell:not(.app-shell--default) .erp-context-menu__item {
  display: block;
  padding: var(--shell-shortcut-menu-item-padding-y) var(--shell-shortcut-menu-item-padding-x);
  border-radius: var(--shell-shortcut-menu-item-radius);
  color: var(--shell-shortcut-menu-item-color);
  font-size: var(--shell-shortcut-menu-item-font-size);
  font-weight: var(--shell-shortcut-menu-item-font-weight);
  text-decoration: none;
}

body.app-shell:not(.app-shell--default) .erp-context-menu__item:hover {
  background: var(--shell-shortcut-menu-item-hover-bg);
  color: var(--shell-shortcut-menu-item-hover-color);
}

body.app-shell:not(.app-shell--default) .erp-context-menu__item.is-active {
  background: var(--shell-shortcut-menu-item-active-bg);
  color: var(--shell-shortcut-menu-item-active-color);
}

body.app-shell:not(.app-shell--default) .erp-icon-button {
  width: var(--shell-topbar-control-height);
  height: var(--shell-topbar-control-height);
  min-width: var(--shell-topbar-control-height);
  min-height: var(--shell-topbar-control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--shell-topbar-icon-color);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0;
  line-height: 1;
  position: relative;
}

body.app-shell:not(.app-shell--default) .erp-icon-svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

body.app-shell:not(.app-shell--default) .erp-icon-svg svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.app-shell:not(.app-shell--default) .erp-icon-button--ghost {
  border: 0;
  background: transparent;
}

body.app-shell:not(.app-shell--default) .erp-icon-button:hover,
body.app-shell:not(.app-shell--default) .erp-icon-button:focus {
  background: var(--shell-topbar-icon-hover-bg);
  color: var(--shell-topbar-icon-hover-color);
}

body.app-shell:not(.app-shell--default) .erp-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--shell-topbar-control-height);
  padding: 0 8px 0 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--shell-user-chip-color);
}

body.app-shell:not(.app-shell--default) .erp-topbar-divider {
  width: 1px;
  height: 26px;
  margin: 0 6px 0 4px;
  background: var(--shell-topbar-divider-bg);
}

body.app-shell:not(.app-shell--default) .erp-user-chip__avatar {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--shell-user-avatar-bg);
  color: var(--shell-user-avatar-color);
  font-size: 0.8rem;
  font-weight: 700;
}

body.app-shell:not(.app-shell--default) .erp-user-chip__chevron {
  color: var(--shell-user-chip-chevron-color);
  font-size: 0.78rem;
}

body.app-shell:not(.app-shell--default) .erp-user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(320px, calc(100vw - 24px));
  padding: 10px;
  border: 1px solid var(--shell-user-menu-border);
  border-radius: var(--shell-user-menu-radius);
  background: var(--shell-user-menu-bg);
  box-shadow: var(--shell-user-menu-shadow);
  z-index: 120;
}

body.app-shell:not(.app-shell--default) .erp-notification-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 96px;
  width: min(360px, calc(100vw - 24px));
  padding: 10px;
  border: 1px solid var(--shell-user-menu-border);
  border-radius: var(--shell-user-menu-radius);
  background: var(--shell-user-menu-bg);
  box-shadow: var(--shell-user-menu-shadow);
  z-index: 120;
}

body.app-shell:not(.app-shell--default) .erp-notification-menu__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--shell-user-menu-header-border);
}

body.app-shell:not(.app-shell--default) .erp-notification-menu__title {
  color: var(--shell-user-menu-title-color);
  font-size: 0.9rem;
  font-weight: 700;
}

body.app-shell:not(.app-shell--default) .erp-notification-menu__count {
  color: var(--shell-user-menu-label-color);
  font-size: 0.76rem;
  font-weight: 700;
}

body.app-shell:not(.app-shell--default) .erp-notification-menu__list {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

body.app-shell:not(.app-shell--default) .erp-notification-menu__item {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--shell-user-menu-action-border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--shell-user-menu-bg) 88%, white 12%);
}

body.app-shell:not(.app-shell--default) .erp-notification-menu__item strong {
  color: var(--shell-user-menu-title-color);
  font-size: 0.78rem;
  font-weight: 700;
}

body.app-shell:not(.app-shell--default) .erp-notification-menu__item span,
body.app-shell:not(.app-shell--default) .erp-notification-menu__empty {
  color: var(--shell-user-menu-text-color);
  font-size: 0.8rem;
  line-height: 1.4;
}

body.app-shell:not(.app-shell--default) .erp-notification-menu__empty {
  padding-top: 8px;
}

body.app-shell:not(.app-shell--default) .erp-user-menu__header {
  display: grid;
  gap: 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--shell-user-menu-header-border);
}

body.app-shell:not(.app-shell--default) .erp-user-menu__name {
  color: var(--shell-user-menu-title-color);
  font-size: 0.9rem;
  font-weight: 700;
}

body.app-shell:not(.app-shell--default) .erp-user-menu__account {
  color: var(--shell-user-menu-label-color);
  font-size: 0.78rem;
}

body.app-shell:not(.app-shell--default) .erp-user-menu__meta {
  margin: 8px 0 0;
  display: grid;
  gap: 6px;
}

body.app-shell:not(.app-shell--default) .erp-user-menu__meta div {
  display: grid;
  gap: 2px;
}

body.app-shell:not(.app-shell--default) .erp-user-menu__meta dt {
  margin: 0;
  color: var(--shell-user-menu-label-color);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

body.app-shell:not(.app-shell--default) .erp-user-menu__meta dd {
  margin: 0;
  color: var(--shell-user-menu-text-color);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
}

body.app-shell:not(.app-shell--default) .erp-user-menu__actions {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--shell-user-menu-action-border);
  display: grid;
  gap: 6px;
}

body.app-shell:not(.app-shell--default) .erp-user-menu__section-title {
  color: var(--shell-user-menu-label-color);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

body.app-shell:not(.app-shell--default) .erp-user-menu__theme-form {
  margin: 0;
}

body.app-shell:not(.app-shell--default) .erp-user-menu__theme-btn {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--shell-user-menu-button-border);
  border-radius: 8px;
  background: var(--shell-user-menu-button-bg);
  color: var(--shell-user-menu-button-text);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: left;
  padding: 6px 10px;
}

body.app-shell:not(.app-shell--default) .erp-user-menu__theme-btn:hover {
  background: var(--shell-user-menu-button-hover-bg);
  border-color: var(--shell-user-menu-button-hover-border);
}

body.app-shell:not(.app-shell--default) .erp-user-menu__theme-btn.is-active {
  background: var(--shell-user-menu-button-active-bg);
  border-color: var(--shell-user-menu-button-active-border);
  color: var(--shell-user-menu-button-active-text);
}

body.app-shell:not(.app-shell--default) .erp-user-menu__theme-btn--danger {
  background: var(--shell-danger-button-bg);
  border-color: var(--shell-danger-button-border);
  color: var(--shell-danger-button-text);
}

body.app-shell:not(.app-shell--default) .erp-user-menu__theme-btn--danger:hover {
  background: var(--shell-danger-button-hover-bg);
  border-color: var(--shell-danger-button-hover-border);
  color: var(--shell-danger-button-hover-text);
}

body.app-shell:not(.app-shell--default) .erp-user-chip[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.14);
}

body.app-shell:not(.app-shell--default) .erp-topbar-badge {
  position: absolute;
  top: 1px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--shell-topbar-badge-bg);
  color: var(--shell-topbar-badge-text);
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

@media (max-width: 1199.98px) {
  body.app-shell:not(.app-shell--default) .erp-workspace-context {
    min-width: 0;
    max-width: 320px;
  }
}

@media (max-width: 991.98px) {
  body.app-shell:not(.app-shell--default) .erp-topbar {
    margin-left: -12px;
    margin-right: -12px;
    flex-wrap: wrap;
    align-items: center;
    height: auto;
    min-height: var(--shell-topbar-min-height);
    max-height: none;
  }

  body.app-shell:not(.app-shell--default) .erp-topbar-left {
    flex: 1 1 220px;
    min-width: 0;
  }

  body.app-shell:not(.app-shell--default) .erp-topbar-right {
    flex: 0 0 auto;
    margin-left: auto;
  }

  body.app-shell:not(.app-shell--default) .erp-workspace-context {
    min-width: 0;
    max-width: min(62vw, 340px);
  }

  body.app-shell:not(.app-shell--default) .erp-workspace-context__module {
    display: none;
  }
}

@media (max-width: 640px) {
  body.app-shell:not(.app-shell--default) .erp-topbar-left,
  body.app-shell:not(.app-shell--default) .erp-topbar-right {
    width: 100%;
  }

  body.app-shell:not(.app-shell--default) .erp-topbar-right {
    justify-content: flex-end;
  }

  body.app-shell:not(.app-shell--default) .erp-workspace-context {
    max-width: 100%;
  }
}
