/* UI-1: somente a moldura ADM. Regras internas dos módulos e do Viewer permanecem próprias. */
body:not(.viewer-mode) #appShell.biwa-enterprise-ui {
  grid-template-columns: 264px minmax(0, 1fr);
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui > .sidebar {
  background: var(--biwa-shell-sidebar-bg);
  color: var(--biwa-shell-sidebar-text);
  border-right: 1px solid var(--biwa-shell-sidebar-border);
  padding: 14px 12px 0;
  gap: var(--biwa-space-3);
  box-shadow: none;
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui .sidebar-top {
  gap: var(--biwa-space-3);
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui .brand.brand-pro.brand-logo-only {
  padding: var(--biwa-space-3) var(--biwa-space-2);
  gap: var(--biwa-space-2);
  background: var(--biwa-shell-sidebar-surface);
  border: 1px solid var(--biwa-shell-divider);
  border-radius: var(--biwa-shell-radius);
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui .brand-logo-only .brand-logo {
  width: 68px;
  height: 68px;
  border-radius: var(--biwa-radius-md);
  box-shadow: none;
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui .brand-status-only {
  gap: var(--biwa-space-2);
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui .sidebar-collapse-btn,
body:not(.viewer-mode) #appShell.biwa-enterprise-ui .sidebar-account-button {
  min-height: 40px;
  border-radius: var(--biwa-radius-md);
  border-color: var(--biwa-shell-sidebar-border);
  background: var(--biwa-shell-sidebar-surface);
  color: var(--biwa-shell-sidebar-text);
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui .sidebar-collapse-btn:hover,
body:not(.viewer-mode) #appShell.biwa-enterprise-ui .sidebar-account-button:hover {
  background: var(--biwa-shell-nav-hover);
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui .sidebar-scroll {
  gap: var(--biwa-space-2);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--biwa-shell-sidebar-border) transparent;
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui .nav {
  gap: var(--biwa-space-1);
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui .nav-btn {
  min-height: 42px;
  padding: 9px 12px;
  gap: var(--biwa-space-3);
  border-radius: var(--biwa-radius-md);
  background: transparent;
  color: var(--biwa-shell-sidebar-text);
  font-size: var(--biwa-font-size-md);
  font-weight: 650;
  box-shadow: none;
  transform: none;
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui .nav-btn .nav-icon {
  color: var(--biwa-shell-sidebar-muted);
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui .nav-btn:hover {
  background: var(--biwa-shell-nav-hover);
  color: var(--biwa-shell-header-text);
  transform: none;
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui .nav-btn:hover .nav-icon {
  color: var(--biwa-shell-header-text);
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui .nav-btn.active {
  background: var(--biwa-shell-nav-active);
  color: var(--biwa-shell-nav-active-text);
  box-shadow: none;
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui .nav-btn.active .nav-icon {
  color: var(--biwa-shell-nav-active-text);
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui .nav-btn:focus-visible,
body:not(.viewer-mode) #appShell.biwa-enterprise-ui .sidebar-collapse-btn:focus-visible,
body:not(.viewer-mode) #appShell.biwa-enterprise-ui .sidebar-account-button:focus-visible,
body:not(.viewer-mode) #appShell.biwa-enterprise-ui .sidebar-logout:focus-visible {
  outline: 2px solid var(--biwa-shell-focus);
  outline-offset: 2px;
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui .nav-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui .sidebar-footer {
  padding: var(--biwa-space-3) var(--biwa-space-2);
  border-top-color: var(--biwa-shell-divider);
  color: var(--biwa-shell-sidebar-muted);
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui > .main {
  min-width: 0;
  padding: var(--biwa-space-5);
  background: var(--biwa-shell-workspace);
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui > .main > .tab > .page-head {
  align-items: center;
  gap: var(--biwa-space-3);
  margin-bottom: var(--biwa-space-4);
  padding: 13px 18px;
  border-radius: var(--biwa-shell-radius);
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui > .main > .tab > .page-head.page-head-dark {
  background: var(--biwa-shell-header-bg) !important;
  color: var(--biwa-shell-header-text);
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui > .main > .tab > .page-head > div:first-child {
  min-width: 0;
  gap: var(--biwa-space-3);
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui > .main > .tab > .page-head .page-head-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--biwa-radius-md);
  background: var(--biwa-shell-header-icon);
  color: var(--biwa-shell-header-icon-text);
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui > .main > .tab > .page-head h2 {
  font-size: 19px;
  line-height: 1.15;
  letter-spacing: -.025em;
}

body:not(.viewer-mode) #appShell.biwa-enterprise-ui > .main > .tab > .page-head .sub {
  font-size: var(--biwa-font-size-sm);
  line-height: var(--biwa-line-height);
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui > .main {
  padding: 12px 14px;
}

body.sidebar-collapsed:not(.viewer-mode) #appShell.biwa-enterprise-ui {
  grid-template-columns: 84px minmax(0, 1fr);
}

body.sidebar-collapsed:not(.viewer-mode) #appShell.biwa-enterprise-ui .sidebar-scroll {
  overflow: hidden;
}

body.sidebar-collapsed:not(.viewer-mode) #appShell.biwa-enterprise-ui .brand-logo-only .brand-logo {
  width: 48px;
  height: 48px;
}

body.sidebar-collapsed:not(.viewer-mode) #appShell.biwa-enterprise-ui .nav-btn {
  width: 52px;
  min-width: 52px;
  height: 52px;
  min-height: 52px;
  padding: 0;
}

@media (max-width: 1400px) {
  body:not(.viewer-mode) #appShell.biwa-enterprise-ui {
    grid-template-columns: 248px minmax(0, 1fr);
  }

  body:not(.viewer-mode) #appShell.biwa-enterprise-ui > .main {
    padding: 16px 18px;
  }

  body:not(.viewer-mode) #appShell.biwa-enterprise-ui > .main > .tab > .page-head {
    flex-direction: row;
    flex-wrap: wrap;
  }

  body:not(.viewer-mode) #appShell.biwa-enterprise-ui > .main > .tab > .page-head .actions,
  body:not(.viewer-mode) #appShell.biwa-enterprise-ui > .main > .tab > .page-head .actions.wrap {
    width: auto;
  }

  body.sidebar-collapsed:not(.viewer-mode) #appShell.biwa-enterprise-ui {
    grid-template-columns: 84px minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  body:not(.viewer-mode) #appShell.biwa-enterprise-ui,
  body.sidebar-collapsed:not(.viewer-mode) #appShell.biwa-enterprise-ui {
    grid-template-columns: minmax(0, 1fr);
  }
}
