/* CSS-only blue/navy surfaces: no photographic or raster background layers. */
html[data-theme="light"] .app-shell .page-heading,
html[data-theme="dark"] .app-shell .page-heading {
  position: relative;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(8px, 1fr) auto;
  align-items: stretch !important;
  justify-items: stretch;
  row-gap: 12px;
  box-sizing: border-box;
  width: calc(100% + 16px);
  max-width: calc(100% + 16px);
  min-height: 152px;
  margin: 0 0 22px -8px;
  padding: 18px 24px 17px;
  overflow: visible !important;
  background-color: var(--surface) !important;
  background-image:
    repeating-linear-gradient(90deg, rgb(52 116 191 / 3%) 0 1px, transparent 1px 28px),
    radial-gradient(ellipse at 86% 8%, rgb(48 130 235 / 15%), transparent 43%),
    radial-gradient(ellipse at 12% 100%, rgb(40 166 177 / 9%), transparent 42%),
    linear-gradient(115deg, #f8fbff 0%, #eef5ff 55%, #e7f1ff 100%) !important;
  background-position: center;
  background-size: auto;
  background-repeat: no-repeat;
}

html[data-theme="dark"] .app-shell .page-heading {
  background-image:
    repeating-linear-gradient(90deg, rgb(111 170 239 / 4%) 0 1px, transparent 1px 28px),
    radial-gradient(ellipse at 86% 8%, rgb(38 105 214 / 22%), transparent 43%),
    radial-gradient(ellipse at 12% 100%, rgb(28 158 166 / 11%), transparent 42%),
    linear-gradient(115deg, #0a1b32 0%, #0d2440 55%, #102b49 100%) !important;
}

/* Keep the original heading copy upper-left and its original action nodes in a separate lower row. */
.app-shell .page-heading .page-heading-symbol {
  display: none !important;
}

.app-shell .page-heading .page-heading-copy {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  align-self: start;
}

.app-shell .page-heading .heading-actions {
  display: flex !important;
  grid-column: 1;
  grid-row: 3;
  align-self: end;
  align-items: center;
  justify-content: flex-start !important;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  max-width: none;
  min-width: 0;
}

.app-shell .page-heading .heading-actions > * {
  min-width: 0;
  max-width: 100%;
}

.app-shell .page-heading .heading-actions > .button {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}

/* Shared subtle glow/gradient surfaces for KPI, report, production, and settings cards. */
html[data-theme="light"] .app-shell :is(
  .stat-card,
  .panel,
  .table-panel,
  .overview-section,
  .dashboard-welcome,
  .dashboard-flow-visual,
  .settings-card,
  .settings-scope-card,
  .login-card,
  .detail-popup-card,
  .mobile-detail-popup,
  .stock-movement-ledger,
  .production-day-detail-card,
  .chemical-summary-panel,
  .recipe-detail-summary > div,
  .recipe-percent-subcard,
  .order-color-card,
  .stock-management-choice,
  .mobile-compact-detail-card,
  .entry-type-card
),
html[data-theme="dark"] .app-shell :is(
  .stat-card,
  .panel,
  .table-panel,
  .overview-section,
  .dashboard-welcome,
  .dashboard-flow-visual,
  .settings-card,
  .settings-scope-card,
  .login-card,
  .detail-popup-card,
  .mobile-detail-popup,
  .stock-movement-ledger,
  .production-day-detail-card,
  .chemical-summary-panel,
  .recipe-detail-summary > div,
  .recipe-percent-subcard,
  .order-color-card,
  .stock-management-choice,
  .mobile-compact-detail-card,
  .entry-type-card
) {
  background-color: var(--surface) !important;
  background-image:
    radial-gradient(ellipse at 100% 0%, rgb(48 130 235 / 8%), transparent 44%),
    linear-gradient(145deg, var(--surface), var(--surface-2)) !important;
  background-position: center;
  background-size: auto;
  background-repeat: no-repeat;
}

/* KPI artwork used to be supplied through --stat-art on a pseudo-element. Replace it too. */
html[data-theme="light"] .app-shell .stat-card,
html[data-theme="dark"] .app-shell .stat-card {
  --stat-art: none !important;
  background-image:
    radial-gradient(ellipse at 100% 0%, rgb(48 130 235 / 12%), transparent 48%),
    radial-gradient(ellipse at 0% 100%, rgb(41 165 173 / 7%), transparent 48%),
    linear-gradient(145deg, var(--surface), var(--surface-2)) !important;
}

html[data-theme="light"] .app-shell .stat-card::before,
html[data-theme="dark"] .app-shell .stat-card::before {
  background-image:
    linear-gradient(100deg, rgb(255 255 255 / 45%), rgb(198 220 250 / 19%) 58%, rgb(117 165 224 / 4%)) !important;
  background-position: center;
  background-size: auto;
  opacity: 0.72;
}

/* Replace the remaining theme photography on the sidebar and branded login panel; keep logo images intact. */
html[data-theme="light"] .app-shell .sidebar,
html[data-theme="dark"] .app-shell .sidebar {
  background-image:
    radial-gradient(ellipse at 80% 0%, rgb(57 132 246 / 20%), transparent 37%),
    linear-gradient(180deg, #0b204b 0%, #081b40 62%, #06152f 100%) !important;
}

html[data-theme="light"] .login-brand-panel,
html[data-theme="dark"] .login-brand-panel {
  background-image:
    radial-gradient(ellipse at 86% 10%, rgb(72 151 255 / 23%), transparent 42%),
    radial-gradient(ellipse at 8% 100%, rgb(30 161 170 / 13%), transparent 43%),
    linear-gradient(135deg, #0b204b 0%, #0b2b5a 58%, #0a1c3c 100%) !important;
}

@media (max-width: 760px) {
  html[data-theme="light"] .app-shell .page-heading,
  html[data-theme="dark"] .app-shell .page-heading {
    width: 100%;
    max-width: 100%;
    min-height: 142px;
    margin: 0 0 16px;
    padding: 15px 16px 14px;
  }

  .app-shell .page-heading .heading-actions {
    gap: 8px;
  }

  .app-shell .page-heading .heading-actions > .button {
    flex: 1 1 9rem;
    min-height: 44px;
  }
}

/* Team remains reachable through Settings but is no longer a separate sidebar item. */
#sidebar .main-nav > .nav-group:has(> .nav-item[data-view="team"]) {
  display: none !important;
}
