/* BI WA Enterprise UI — UI-5
   Specialized report-builder skin. Every rule is opt-in to the ADM shell so
   the Online Viewer keeps its certified presentation and read-only surface. */

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #sqlTab {
  --ui5-pane-border: #d7e1ee;
  --ui5-pane-muted: #5f6f84;
  --ui5-pane-hover: #f0f6ff;
  --ui5-pane-active: #e8f2ff;
  --ui5-editor-blue: #1769c2;
  --ui5-editor-navy: #17365d;
  padding: 0;
  background: #edf2f8;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #reportDesignerShell {
  grid-template-columns: minmax(0, 1fr) 210px 232px;
  gap: 6px;
  height: calc(100dvh - 20px);
  min-height: 640px;
  padding: 6px;
  border: 1px solid #ced9e7;
  border-radius: 14px;
  background: #e7edf5;
  box-shadow: 0 14px 34px rgba(15, 35, 64, .09);
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #reportDesignerShell.visuals-collapsed {
  grid-template-columns: minmax(0, 1fr) 42px 232px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #reportDesignerShell.data-collapsed {
  grid-template-columns: minmax(0, 1fr) 210px 42px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #reportDesignerShell.visuals-collapsed.data-collapsed {
  grid-template-columns: minmax(0, 1fr) 42px 42px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #reportDesignerShell > .report-canvas-panel,
body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #reportDesignerShell > .powerbi-side-panel {
  min-height: 0;
  border: 1px solid var(--ui5-pane-border);
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .powerbi-editor-head {
  min-height: 48px;
  padding: 8px 11px;
  border-radius: 9px 9px 0 0;
  background: var(--ui5-editor-navy);
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .powerbi-editor-head h2 {
  font-size: 14px;
  letter-spacing: -.01em;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .powerbi-editor-head .btn {
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 10px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .powerbi-main-ribbon {
  border-right: 0;
  border-left: 0;
  border-color: #d8e2ef;
  background: #fbfcfe;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .ribbon-tab-strip {
  min-height: 31px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .ribbon-tab {
  min-height: 30px;
  padding: 5px 12px;
  font-size: 10px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .report-canvas {
  margin: 6px;
  border: 1px solid #cbd8e8;
  border-radius: 8px;
  background:
    radial-gradient(circle at 1px 1px, rgba(64, 93, 127, .16) 1px, transparent 1.2px) 0 0 / 16px 16px,
    #e9eef5;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .report-page-navigation-bar {
  min-height: 38px;
  margin: 0 6px 6px;
  border-top: 1px solid #d8e2ed;
  background: #fff;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .page-tab,
body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .page-add {
  min-height: 30px;
  padding: 5px 11px;
  font-size: 10px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #visualizationsPane:not(.collapsed),
body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #dataPane:not(.collapsed) {
  max-height: none;
  height: 100%;
  padding: 0;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #visualizationsPane:not(.collapsed) {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  scrollbar-gutter: stable;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .powerbi-side-panel > .pane-title {
  position: sticky;
  top: 0;
  z-index: 6;
  min-height: 43px;
  margin: 0;
  padding: 9px 10px;
  border-bottom: 1px solid var(--ui5-pane-border);
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(8px);
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .powerbi-side-panel > .pane-title h3 {
  color: #18283e;
  font-size: 12px;
  font-weight: 800;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .pane-collapse-btn {
  width: 26px;
  height: 26px;
  min-height: 26px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f1f5fa;
  color: #30445f;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .pane-collapse-btn:hover,
body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .pane-collapse-btn:focus-visible {
  border-color: #9bbbe0;
  background: #e8f2ff;
  color: var(--ui5-editor-blue);
  outline: none;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .visual-pane-tabs {
  position: sticky;
  top: 43px;
  z-index: 5;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 4px 7px 0;
  border: 0;
  border-bottom: 1px solid var(--ui5-pane-border);
  border-radius: 0;
  background: rgba(255, 255, 255, .98);
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .visual-pane-tab {
  min-height: 42px;
  gap: 2px;
  padding: 4px 2px 5px;
  border-radius: 6px 6px 0 0;
  color: #53647a;
  font-size: 9px;
  font-weight: 700;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .visual-pane-tab svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .visual-pane-tab.active {
  background: #eef5ff;
  color: var(--ui5-editor-blue);
  box-shadow: inset 0 -2px 0 var(--ui5-editor-blue);
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .visual-tools-head,
body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .visual-icon-grid,
body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #visualizationsPane > .field-bucket {
  margin-right: 8px;
  margin-left: 8px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .visual-tools-head {
  min-height: 31px;
  margin-top: 5px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .visual-icon-grid.powerbi-icons {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 7px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .visual-icon {
  min-height: 42px;
  padding: 4px 1px;
  border-radius: 6px;
  border-color: transparent;
  background: #fff;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .visual-icon:hover {
  border-color: #b8cee8;
  background: var(--ui5-pane-hover);
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .visual-icon.active {
  border-color: #5c9ee5;
  background: var(--ui5-pane-active);
  box-shadow: inset 0 -2px 0 var(--ui5-editor-blue);
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .visual-icon span {
  font-size: 14px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .visual-icon small {
  max-width: 100%;
  font-size: 8px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #visualizationsPane > .field-bucket {
  padding: 8px 0 4px;
  border-color: #e0e7f0;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .visual-field-drop {
  min-height: 45px;
  padding: 6px;
  border-radius: 7px;
  border-color: #cbd9e9;
  background: #fbfcfe;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .visual-field-drop:hover,
body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .visual-field-drop.drag-over {
  border-color: #5c9ee5;
  background: #edf6ff;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #dataPane:not(.collapsed) {
  overflow: hidden !important;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #dataSearchInput {
  flex: 0 0 auto;
  min-height: 32px;
  margin: 8px 9px 6px;
  padding: 6px 9px 6px 30px;
  border: 1px solid #cbd8e7;
  border-radius: 7px;
  background:
    linear-gradient(45deg, transparent 46%, #7b899a 47% 53%, transparent 54%) 16px 18px / 7px 7px no-repeat,
    radial-gradient(circle, transparent 45%, #7b899a 48% 58%, transparent 61%) 8px 7px / 12px 12px no-repeat,
    #fff;
  font-size: 11px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #dataSearchInput:focus {
  border-color: #4f92dc;
  outline: 2px solid rgba(23, 105, 194, .15);
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #builderFieldList {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  margin: 0;
  padding: 0 8px 10px;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  scrollbar-gutter: stable;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .powerbi-data-tree .field-table-title {
  min-height: 32px;
  margin: 3px 0;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .powerbi-data-tree .field-table-title:hover,
body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .powerbi-data-tree .field-table-title:focus-visible {
  border-color: #c4d6ea;
  background: var(--ui5-pane-hover);
  outline: none;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .measure-table-title {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 26px;
  gap: 4px;
  margin-top: 0;
  border-color: #d9e3ef;
  background: #f8fafc;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .measure-table-title .field-table-toggle {
  display: grid;
  grid-template-columns: 15px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #1c2d43;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .field-table-count {
  align-self: center;
  min-width: 20px;
  padding: 2px 5px;
  border-radius: 999px;
  background: #e7edf5;
  color: #5e7087;
  font-size: 9px;
  text-align: center;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .measure-table-title [data-create-measure-inline] {
  position: static;
  align-self: center;
  width: 24px;
  height: 24px;
  min-height: 24px;
  margin: 0;
  padding: 0;
  border-radius: 6px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .builder-table-fields[hidden],
body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .builder-table-fields.collapsed {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .measure-table-fields {
  margin: 2px 0 7px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .builder-measure-row {
  position: relative;
  min-height: 30px;
  border-radius: 6px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .builder-measure-row:hover {
  background: var(--ui5-pane-hover);
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .data-pane .field-row.clean-field-row {
  min-height: 30px;
  padding: 5px 6px;
  border-radius: 6px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .field-type-icon {
  min-width: 20px;
  height: 17px;
  margin-right: 4px;
  border-radius: 4px;
  font-size: 8px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .powerbi-other-tables {
  margin-top: 6px;
  padding-top: 6px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .powerbi-other-tables > h4 {
  position: sticky;
  top: 36px;
  z-index: 3;
  margin: 0 -2px 4px;
  padding: 5px 2px;
  background: rgba(255, 255, 255, .96);
  color: #68798e;
  font-size: 9px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .builder-data-table-section.selected > .field-table-title {
  border-color: #a7c7eb;
  background: #edf5ff;
  color: #145fae;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .builder-table-empty {
  margin: 2px 0 5px 20px;
  padding: 5px 7px;
  font-size: 9px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .measure-actions-menu {
  z-index: 20;
  border-radius: 7px;
  box-shadow: 0 10px 24px rgba(20, 42, 70, .16);
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .report-canvas-panel > .measure-formula-bar:not([hidden]) {
  right: 6px;
  left: 6px;
  display: grid;
  grid-template-columns: 34px 34px minmax(0, 1fr);
  align-items: stretch;
  max-height: 330px;
  border: 1px solid #8daed2;
  border-radius: 7px;
  background: #fff;
  filter: drop-shadow(0 10px 20px rgba(18, 43, 73, .18));
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .measure-formula-action {
  width: 34px;
  min-width: 34px;
  max-width: 34px;
  height: 39px;
  min-height: 39px;
  border: 0;
  border-right: 1px solid #d2dfed;
  background: #f8fafc;
  font-size: 20px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .measure-formula-action:first-child {
  border-left: 0;
  border-radius: 6px 0 0 6px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .measure-formula-action:focus-visible {
  position: relative;
  z-index: 2;
  outline: 2px solid #438bd7;
  outline-offset: -3px;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .measure-formula-bar-wrapper {
  min-height: 39px;
  border: 0;
  border-radius: 0 6px 6px 0;
  background: #fff;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .measure-formula-bar-wrapper:focus-within {
  box-shadow: inset 0 0 0 2px rgba(23, 105, 194, .55);
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .measure-formula-input,
body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .measure-formula-bar-wrapper .measure-formula-highlight {
  min-height: 39px;
  max-height: 310px;
  padding: 9px 10px 22px;
  font-family: "Cascadia Mono", "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  tab-size: 4;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .measure-formula-input {
  caret-color: #092c53;
  overscroll-behavior: contain;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .measure-formula-input::selection {
  background: rgba(49, 124, 205, .27);
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .measure-formula-hint {
  position: absolute;
  right: 7px;
  bottom: 3px;
  z-index: 3;
  display: flex;
  gap: 7px;
  pointer-events: none;
  color: #78879a;
  font: 700 8px/1.2 "Segoe UI", sans-serif;
  text-transform: uppercase;
  letter-spacing: .025em;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .measure-formula-hint span:first-child {
  color: #1769c2;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .measure-formula-suggestions {
  right: 6px;
  left: auto !important;
  width: min(300px, calc(100% - 12px));
  border: 1px solid #b8cbe1;
  border-radius: 7px;
  box-shadow: 0 12px 26px rgba(18, 43, 73, .2);
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .measure-formula-validation {
  right: 8px;
  left: 8px;
  max-height: 92px;
  margin-top: 0;
  border-radius: 7px;
  box-shadow: 0 8px 18px rgba(18, 43, 73, .14);
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .powerbi-side-panel.collapsed {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  background: #f7f9fc;
}

body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .powerbi-side-panel.collapsed .pane-title {
  min-height: 100%;
  padding: 8px;
  background: #f7f9fc;
}

@media (max-width: 1500px) {
  body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #reportDesignerShell {
    grid-template-columns: minmax(0, 1fr) 200px 220px;
  }
  body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #reportDesignerShell.visuals-collapsed {
    grid-template-columns: minmax(0, 1fr) 42px 220px;
  }
  body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #reportDesignerShell.data-collapsed {
    grid-template-columns: minmax(0, 1fr) 200px 42px;
  }
  body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #reportDesignerShell.visuals-collapsed.data-collapsed {
    grid-template-columns: minmax(0, 1fr) 42px 42px;
  }
}

@media (max-width: 1366px) {
  body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #reportDesignerShell {
    grid-template-columns: minmax(0, 1fr) 190px 214px;
    min-height: 620px;
    padding: 5px;
    gap: 5px;
  }
  body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #reportDesignerShell.visuals-collapsed {
    grid-template-columns: minmax(0, 1fr) 40px 214px;
  }
  body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #reportDesignerShell.data-collapsed {
    grid-template-columns: minmax(0, 1fr) 190px 40px;
  }
  body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #reportDesignerShell.visuals-collapsed.data-collapsed {
    grid-template-columns: minmax(0, 1fr) 40px 40px;
  }
  body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .visual-icon-grid.powerbi-icons {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .measure-formula-input,
  body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui .measure-formula-bar-wrapper .measure-formula-highlight {
    max-height: 255px;
  }
}

@media (max-width: 1180px) {
  body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #reportDesignerShell,
  body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #reportDesignerShell.visuals-collapsed,
  body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #reportDesignerShell.data-collapsed,
  body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #reportDesignerShell.visuals-collapsed.data-collapsed {
    grid-template-columns: minmax(0, 1fr) 40px 40px;
  }
  body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #visualizationsPane:not(.collapsed) {
    right: 268px;
    width: min(260px, 42vw);
  }
  body.report-editor-active:not(.viewer-mode) #appShell.biwa-enterprise-ui #dataPane:not(.collapsed) {
    right: 6px;
    width: min(260px, 42vw);
  }
}
