/* Workspace shell ownership */
body.app-shell:not(.app-shell--default) {
  --erp-page-max-width: 100%;
  --erp-surface-bg: linear-gradient(180deg, #f6f9fc 0%, #eef3f8 100%);
  --erp-content-bg:
    radial-gradient(circle at top left, rgba(116, 154, 194, 0.12), transparent 24%),
    linear-gradient(180deg, #f5f8fb 0%, #edf2f7 100%);
  --erp-panel-bg: rgba(255, 255, 255, 0.96);
  --erp-panel-border: rgba(32, 58, 84, 0.08);
  --erp-panel-shadow: 0 4px 14px rgba(18, 39, 58, 0.04);
  --erp-panel-radius: 12px;
  --erp-section-gap: 12px;
  --erp-toolbar-gap: 8px;
  --erp-dense-row-height: 40px;
  --erp-title-color: #14324d;
  --erp-muted-color: #5c7186;
  --erp-emphasis-bg: linear-gradient(135deg, #fbfdff 0%, #eef5fb 100%);
  --erp-emphasis-border: rgba(34, 74, 111, 0.12);
  --erp-pill-bg: rgba(24, 73, 117, 0.08);
  --erp-pill-color: #36536f;
  --erp-card-bg: rgba(255, 255, 255, 0.92);
  --erp-card-header-bg: linear-gradient(180deg, #fbfdff 0%, #f3f7fb 100%);
  --erp-card-header-border: rgba(24, 61, 95, 0.08);
}

body.app-shell:not(.app-shell--default) .area-shell {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr) !important;
  width: 100%;
  flex: 1 1 auto;
  height: calc(100vh - var(--shell-bottom-bar-height, 40px)) !important;
  min-height: calc(100vh - var(--shell-bottom-bar-height, 40px)) !important;
  overflow-x: hidden;
  overflow-y: hidden;
  background: var(--erp-bg) !important;
}

body.app-shell:not(.app-shell--default) .area-content {
  height: 100%;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 0 12px 0 !important;
  background: #edf2f8 !important;
  border: 0 !important;
  box-shadow: none !important;
  scrollbar-gutter: stable;
}

body.app-shell:not(.app-shell--default) .single-layer-content {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  overflow-y: visible !important;
  overflow-x: hidden !important;
}

body.app-shell:not(.app-shell--default) .single-layer-content > * {
  max-width: var(--erp-page-max-width);
  min-width: 0;
}

body.app-shell:not(.app-shell--default) .erp-content-area {
  padding: 14px 10px 20px;
  background: var(--erp-content-bg);
}

body.app-shell:not(.app-shell--default) .workspace-frame {
  display: none !important;
}

body.app-shell:not(.app-shell--default) .workspace-root {
  height: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px !important;
}

body.app-shell:not(.app-shell--default) .workspace-panels {
  flex: 1 1 auto;
  min-height: 0;
  overflow: visible;
}

body.app-shell:not(.app-shell--default) .workspace-panel {
  min-height: 0;
  height: auto;
  overflow: visible;
}

body.app-shell:not(.app-shell--default) .workspace-panel.is-active {
  display: block;
}

.erp-workspace-page,
.erp-page-layout,
.erp-objectpage {
  display: flex;
  flex-direction: column;
  gap: var(--erp-section-gap);
}

.erp-workspace-page__header,
.erp-page-hero,
.erp-objectpage-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--erp-emphasis-border);
  border-radius: 18px;
  background: var(--erp-emphasis-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.erp-workspace-page__eyebrow,
.erp-page-hero__eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--erp-pill-bg);
  color: var(--erp-pill-color);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.erp-workspace-page__title,
.erp-page-hero h1,
.erp-page-header h1 {
  margin: 6px 0 0;
  color: var(--erp-title-color);
  font-size: clamp(1.15rem, 1rem + 0.45vw, 1.55rem);
  line-height: 1.08;
  font-weight: 700;
}

.erp-workspace-page__subtitle,
.erp-page-hero p,
.erp-page-header p {
  margin: 4px 0 0;
  color: var(--erp-muted-color);
  font-size: 0.83rem;
  line-height: 1.35;
  max-width: 72ch;
}

.erp-workspace-page__actions,
.erp-page-hero__actions,
.erp-objectpage-header > .d-flex {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

body.app-shell:not(.app-shell--default)[data-route-area="System"] .erp-workspace-page__header {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body.app-shell:not(.app-shell--default)[data-route-area="System"] .erp-workspace-page__eyebrow {
  min-height: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--erp-muted-color);
}

body.app-shell:not(.app-shell--default)[data-route-area="System"] .erp-workspace-page__title {
  margin-top: 2px;
}

.erp-workspace-page__toolbar,
.erp-workspace-page__filters,
.erp-page-section,
.erp-detail-pane,
.erp-workspace-page__metrics {
  border: 1px solid var(--erp-panel-border);
  border-radius: var(--erp-panel-radius);
  background: var(--erp-panel-bg);
  box-shadow: var(--erp-panel-shadow);
}

.erp-workspace-page__toolbar,
.erp-workspace-page__filters,
.erp-workspace-page__metrics,
.erp-page-section {
  padding: 12px 14px;
}

.erp-page-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.erp-page-section__title {
  margin: 0;
  color: var(--erp-title-color);
  font-size: 1rem;
  font-weight: 700;
}

.erp-page-section__hint {
  color: var(--erp-muted-color);
  font-size: 0.85rem;
}

.erp-page-section .card,
.erp-workspace-page .card,
.erp-objectpage .card {
  border: 1px solid var(--erp-panel-border);
  border-radius: 12px;
  box-shadow: none;
  background: var(--erp-card-bg);
}

.erp-page-section .card-header,
.erp-workspace-page .card-header,
.erp-objectpage .card-header {
  padding: 12px 16px;
  background: var(--erp-card-header-bg) !important;
  border-bottom: 1px solid var(--erp-card-header-border);
}

.erp-page-section .card-body,
.erp-workspace-page .card-body,
.erp-objectpage .card-body {
  padding: 12px 14px;
}

@media (max-width: 991.98px) {
  body.app-shell:not(.app-shell--default) .area-shell,
  body.app-shell:not(.app-shell--default).erp-sidebar-collapsed .area-shell {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.app-shell:not(.app-shell--default) .area-sidebar,
  body.app-shell:not(.app-shell--default) .area-content {
    grid-column: 1;
  }

  .erp-workspace-page__header,
  .erp-page-hero,
  .erp-objectpage-header {
    flex-direction: column;
    align-items: stretch;
  }
}
