/* QA Reporting — Report Builder */
html, body { height: 100%; }
body { display: flex; flex-direction: column; margin: 0; overflow: hidden; font-size: 14px; user-select: none; }
input, textarea, select, .qb-props, .modal { user-select: text; }

.qb-top { display: flex; align-items: center; gap: 12px; padding: 4px 10px; background: var(--bs-body-bg); flex: 0 0 auto; }
.qb-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
.qb-menu { display: flex; gap: 2px; }
.qb-menu > .dropdown > button { border: 0; background: none; padding: 4px 10px; border-radius: 4px; }
.qb-menu > .dropdown > button:hover, .qb-menu > .dropdown > button[aria-expanded="true"] { background: var(--bs-secondary-bg); }
.qb-menu .dropdown-item { display: flex; justify-content: space-between; gap: 24px; font-size: 13px; }
.qb-menu .dropdown-item kbd { background: none; color: var(--bs-secondary-color); padding: 0; font-size: 11px; }
.qb-title { margin-left: auto; font-weight: 600; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qb-title.dirty::after { content: " •"; color: var(--bs-warning); }

.qb-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 3px 8px; background: var(--bs-tertiary-bg); flex: 0 0 auto; }
.qb-toolbar .btn { padding: 3px 6px; font-size: 13px; line-height: 1.5; min-width: 30px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.qb-toolbar .btn:disabled .qi { opacity: .35; }
.qb-btn { background: transparent; color: var(--bs-body-color); border: 1px solid transparent; }
.qb-btn:hover, .qb-btn:focus-visible { background: var(--bs-secondary-bg); border-color: var(--bs-border-color); color: var(--bs-body-color); }
.qb-user { display: flex; align-items: center; gap: 8px; }
.qb-theme { font-size: 15px; line-height: 1; padding: 3px 6px; }
.qb-toolbar .sep { width: 1px; align-self: stretch; background: var(--bs-border-color); margin: 2px 4px; }
.qb-toolbar select, .qb-toolbar input { height: 26px; padding: 0 4px; font-size: 13px; }
.qb-tool[draggable="true"] { cursor: grab; }

.qb-main { flex: 1 1 auto; display: flex; min-height: 0; }
.qb-right { flex: 0 0 300px; width: 300px; display: flex; flex-direction: column; background: var(--bs-body-bg); min-height: 0; transition: flex-basis .15s, width .15s; border-left: 1px solid var(--bs-border-color); }
.qb-right.collapsed { flex-basis: 30px; width: 30px; }
.qb-right.collapsed > :not(.qb-panel-head) { display: none; }
.qb-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 4px 6px 4px 8px; font-weight: 600; font-size: 13px; background: var(--bs-tertiary-bg); border-bottom: 1px solid var(--bs-border-color); }
.qb-collapse { padding: 2px 4px; font-size: 15px; line-height: 1; display: inline-flex; align-items: center; color: var(--bs-secondary-color); background: transparent; border: 1px solid transparent; }
.qb-collapse:hover { color: var(--bs-body-color); background: var(--bs-secondary-bg); border-color: var(--bs-border-color); }
/* collapsed: the arrow on top, the panel's name written vertically below it */
.qb-right.collapsed .qb-panel-head { flex-direction: column; justify-content: flex-start; height: 100%; padding: 4px 0; gap: 10px; border-bottom: 0; cursor: pointer; }
.qb-right.collapsed .qb-panel-title { writing-mode: vertical-rl; letter-spacing: .5px; }

/* Thin line icons: drawn with the text colour (white in dark mode, black in light mode) */
.qi { stroke-width: var(--qi-sw, 1.25); flex: 0 0 auto; vertical-align: middle; }

/* Toolbox: an always-visible rail of categories and a second sidebar (drawer) that opens on click */
.qb-left { flex: 0 0 auto; display: flex; min-height: 0; background: var(--bs-body-bg); border-right: 1px solid var(--bs-border-color); }
.qb-rail { flex: 0 0 46px; width: 46px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; background: var(--bs-tertiary-bg); border-right: 1px solid var(--bs-border-color); }
.qb-rail-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; padding: 0; background: transparent; color: var(--bs-body-color); border: 1px solid transparent; border-radius: 6px; --qi-sw: 1.15; opacity: .78; }
.qb-rail-btn:hover, .qb-rail-btn.hover, .qb-rail-btn:focus-visible { opacity: 1; background: var(--bs-secondary-bg); border-color: var(--bs-border-color); }
.qb-rail-btn.active { opacity: 1; background: var(--bs-body-bg); border-left: 0;border-right:0; border-radius: 0;width: 48px;}
.qb-drawer { flex: 0 0 268px; width: 268px; display: flex; flex-direction: column; min-height: 0; }
.qb-left.drawer-closed .qb-drawer { display: none; }
.qb-drawer-head { display: flex; white-space: nowrap; align-items: center; justify-content: space-between; padding: 8px 6px 6px 12px; font-weight: 600; font-size: 14px; }
.qb-drawer-body { flex: 1 1 auto; overflow: auto; min-height: 0; }
.qb-pane[hidden], .qb-panel-search[hidden] { display: none !important; }
.qb-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px 8px 10px; align-content: start; }
.qb-tile { height: 80px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 4px 2px; background: transparent; color: var(--bs-body-color); border: 1px solid transparent; border-radius: 6px; font-size: 11.5px; --qi-sw: .9; }
.qb-tile .lb { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .85; }
.qb-tile:hover, .qb-tile:focus-visible { background: var(--bs-secondary-bg); border-color: var(--bs-border-color); }
.qb-tile.active, .qb-fly-item.active { background: var(--bs-secondary-bg); border-color: var(--bs-body-color); }
.qb-tile[draggable="true"], .qb-fly-item[draggable="true"] { cursor: grab; }

/* Hover quick menu next to the rail */
.qb-flyout { position: fixed; z-index: 1900; min-width: 190px; max-height: calc(100vh - 16px); overflow: auto; padding: 6px 0; background: var(--bs-body-bg); color: var(--bs-body-color); border: 1px solid var(--bs-border-color); border-radius: 6px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); font-size: 13px; }
.qb-flyout::before { content: ""; position: absolute; left: -6px; top: 12px; border: 6px solid transparent; border-left: 0; border-right-color: var(--bs-border-color); }
.qb-flyout.title-only { min-width: 0; padding: 4px 0; white-space: nowrap; }
.qb-flyout-head { padding: 2px 12px; font-weight: 600; color: var(--bs-secondary-color); font-size: 12.5px; white-space: nowrap; }
.qb-flyout hr { margin: 5px 0; }
.qb-fly-item { width: 100%; display: flex; align-items: center; gap: 9px; padding: 4px 12px; background: transparent; color: var(--bs-body-color); border: 1px solid transparent; text-align: left; --qi-sw: 1.2; }
.qb-fly-item:hover, .qb-fly-item:focus-visible { background: var(--bs-secondary-bg); }
.qb-panel-search { padding: 6px; border-bottom: 1px solid var(--bs-border-color); }

.qb-tree { padding: 2px 0 8px; font-size: 13px; }
.qb-node { display: flex; align-items: center; gap: 4px; padding: 1px 6px; cursor: default; white-space: nowrap; border-radius: 3px; }
.qb-node:hover { background: var(--bs-secondary-bg); }
.qb-node:focus { outline: 2px solid var(--bs-primary); outline-offset: -2px; }
.qb-node .tw { width: 14px; display: inline-flex; align-items: center; justify-content: center; color: var(--bs-secondary-color); cursor: pointer; flex: 0 0 14px; --qi-sw: 1.6; }
.qb-node .ic { width: 18px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 18px; --qi-sw: 1.3; opacity: .85; }
.qb-node .pk { display: inline-flex; opacity: .7; --qi-sw: 1.4; }
.qb-node .lbl { overflow: hidden; text-overflow: ellipsis; }
.qb-node .meta { margin-left: auto; color: var(--bs-secondary-color); font-size: 11px; }
.qb-node[draggable="true"] { cursor: grab; }
.qb-node.cat { font-weight: 600; margin-top: 2px; }
.qb-children { padding-left: 14px; }
.qb-children.closed { display: none; }

.qb-center { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; background: #d9dde3; color: #212529; }
.qb-canvas-scroll { flex: 1 1 auto; overflow: auto; position: relative; outline: none; }
.qb-canvas { position: relative; padding: 0 40px 60px 0; min-width: max-content; }
.qb-ruler-top { position: sticky; top: 0; z-index: 30; height: 20px; background: #f8f9fa; border-bottom: 1px solid #bbb; margin-left: 150px; }
.qb-ruler-top canvas, .qb-ruler-left canvas { display: block; }
.qb-sec { display: flex; position: relative; }
.qb-sec-label { width: 150px; flex: 0 0 150px; position: sticky; left: 0; z-index: 20; background: #eef0f3; border-right: 1px solid #b8bec7; border-bottom: 1px solid #c6ccd4; font-size: 12px; padding: 2px 4px; display: flex; flex-direction: column; overflow: hidden; }
.qb-sec-label .name { font-weight: 600; display: flex; gap: 4px; align-items: center; cursor: pointer; }
.qb-sec-label .name .tg { width: 12px; display: inline-flex; --qi-sw: 1.6; }
.qb-sec-label .sub { color: #666; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qb-sec.selected .qb-sec-label { background: #d7e5fb; }
.qb-sec.suppressed .qb-sec-label .name { text-decoration: line-through; color: #888; }
.qb-sec-body { position: relative; background-color: #fff; color: #212529; border-bottom: 1px dashed #b8bec7; overflow: hidden; }
.qb-sec-body.grid { background-image: radial-gradient(circle, #c3c8d0 0.6px, transparent 0.7px); }
.qb-sec.suppressed .qb-sec-body { background-color: #f3f3f3; opacity: .85; }
.qb-sec.collapsed .qb-sec-body { height: 8px !important; background: repeating-linear-gradient(45deg, #eee, #eee 4px, #e2e2e2 4px, #e2e2e2 8px); }
.qb-sec.collapsed .qb-el { display: none; }
.qb-sec-resizer { position: absolute; left: 150px; right: 0; bottom: -3px; height: 6px; cursor: row-resize; z-index: 15; }
.qb-sec-resizer:hover { background: rgba(47, 111, 223, .35); }
.qb-sec.drop-target .qb-sec-body { box-shadow: inset 0 0 0 2px #2f6fdf; }

.qb-el { position: absolute; box-sizing: border-box; overflow: hidden; white-space: pre; cursor: move; line-height: 1.15; outline: 1px dotted rgba(0, 0, 0, .25); }
.qb-el.t-line { outline: none; }
.qb-el.t-field, .qb-el.t-formula, .qb-el.t-summary, .qb-el.t-parameter, .qb-el.t-special { color: #1d4ed8; }
.qb-el.t-field::before, .qb-el.t-formula::before, .qb-el.t-summary::before { content: ""; }
.qb-el.selected { outline: 1px solid #2f6fdf; z-index: 1000 !important; }
.qb-el.locked { cursor: not-allowed; }
.qb-el.unprintable { opacity: .45; }
.qb-el .chart-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; color: #555; background: repeating-linear-gradient(135deg, #f4f6fb, #f4f6fb 6px, #eceff6 6px, #eceff6 12px); font-size: 11px; white-space: normal; text-align: center; }
.qb-el .bc-ph { position: absolute; inset: 2px; background: repeating-linear-gradient(90deg, #222 0 2px, transparent 2px 3px, #222 3px 4px, transparent 4px 7px); }
.qb-el img { width: 100%; height: 100%; pointer-events: none; }
.qb-handle { position: absolute; width: 8px; height: 8px; background: #fff; border: 1px solid #2f6fdf; z-index: 1001; }
.qb-guide { position: absolute; background: #e8743b; z-index: 1002; pointer-events: none; }
.qb-band { position: absolute; border: 1px dashed #2f6fdf; background: rgba(47, 111, 223, .08); z-index: 1003; pointer-events: none; }

.qb-right .qb-props { overflow: auto; flex: 1 1 auto; font-size: 12.5px; }
.qb-props .grp { border-bottom: 1px solid var(--bs-border-color); }
.qb-props .grp > button { width: 100%; text-align: left; border: 0; background: var(--bs-tertiary-bg); font-weight: 600; padding: 3px 8px; font-size: 12px; }
.qb-props .grp > button { display: flex; align-items: center; gap: 4px; color: var(--bs-body-color); }
.qb-props .grp > button::before, .qb-chev::before { content: ""; width: 12px; height: 12px; flex: 0 0 12px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; }
.qb-props .grp.closed > button::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.5 6l6 6-6 6'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.5 6l6 6-6 6'/%3E%3C/svg%3E"); }
.qb-props .grp.closed > .rows { display: none; }
.qb-props .row-p { display: grid; grid-template-columns: 42% 58%; align-items: center; padding: 2px 8px; gap: 4px; }
.qb-props .row-p label { color: var(--bs-secondary-color); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; }
.qb-props .row-p input:not([type=checkbox]):not([type=color]), .qb-props .row-p select, .qb-props .row-p textarea { width: 100%; font-size: 12px; padding: 1px 4px; border: 1px solid var(--bs-border-color); border-radius: 3px; background: var(--bs-body-bg); }
.qb-props .row-p input[type=color] { width: 36px; height: 22px; padding: 0; border: 1px solid var(--bs-border-color); }
.qb-props .row-p .clr { display: flex; gap: 4px; align-items: center; }
.qb-props .row-p.wide { grid-template-columns: 1fr; }
.qb-props .row-p .invalid { border-color: var(--bs-danger) !important; }
.qb-props .head { padding: 6px 8px; font-weight: 600; background: var(--bs-secondary-bg); }
.qb-props .note { padding: 6px 8px; color: var(--bs-secondary-color); }

.qb-status { display: flex; gap: 16px; padding: 2px 10px; font-size: 12px; background: var(--bs-tertiary-bg); flex: 0 0 auto; color: var(--bs-secondary-color); }
.qb-status .msg { margin-left: auto; }
.qb-status .err { color: var(--bs-danger); }
.qb-status span { display: inline-flex; align-items: center; gap: 4px; }

.qb-context { position: fixed; display: none; z-index: 2000; font-size: 13px; }
.qb-context.show { display: block; }

.qb-list { border: 1px solid var(--bs-border-color); border-radius: 4px; max-height: 300px; overflow: auto; }
.qb-list .item { padding: 3px 8px; cursor: pointer; display: flex; gap: 6px; align-items: center; }
.qb-list .item.active { background: var(--bs-primary-bg-subtle); }
.qb-list .item:hover { background: var(--bs-secondary-bg); }
.qb-formula { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; min-height: 160px; }
.qb-filter-group { border-left: 3px solid var(--bs-primary-border-subtle); padding-left: 8px; margin: 4px 0; }
.qb-filter-cond { display: flex; gap: 4px; margin: 3px 0; align-items: center; flex-wrap: wrap; }
.qb-filter-cond select, .qb-filter-cond input { width: auto; }
.qb-preview-frame { width: 100%; height: 70vh; border: 1px solid var(--bs-border-color); background: #e9ecef; }
.qb-diag li.error { color: var(--bs-danger); } .qb-diag li.warning { color: #a06800; } .qb-diag li.info { color: var(--bs-secondary-color); }
.modal-body .table td, .modal-body .table th { vertical-align: middle; }
.qb-wizard-steps { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 10px; }
.qb-wizard-steps span { font-size: 11px; padding: 2px 6px; border-radius: 10px; background: var(--bs-secondary-bg); }
.qb-wizard-steps span.on { background: var(--bs-primary); color: #fff; }
.qb-wizard-steps span.done { background: var(--bs-success-bg-subtle); }
.qb-dual { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.qb-dual select { height: 260px; }
.qb-dual .mid { display: flex; flex-direction: column; gap: 4px; }
code.sql { white-space: pre-wrap; display: block; font-size: 12px; background: var(--bs-tertiary-bg); padding: 6px; border-radius: 4px; max-height: 200px; overflow: auto; }

.qb-canvas.dragging .qb-sec-body { overflow: visible; }
.qb-canvas.dragging .qb-el.selected { opacity: .85; }

/* Dark theme around the paper: the grey surround, rulers and band labels follow the theme;
   the report itself (.qb-sec-body, the area where elements are placed) is never changed. */
[data-bs-theme=dark] .qb-center { background: #1b1e22; color: var(--bs-body-color); }
[data-bs-theme=dark] .qb-ruler-top { background: #2b3035; border-bottom-color: #495057; }
[data-bs-theme=dark] .qb-sec-label { background: #2b3035; color: #dee2e6; border-right-color: #495057; border-bottom-color: #3a4046; }
[data-bs-theme=dark] .qb-sec-label .sub { color: #9aa3ab; }
[data-bs-theme=dark] .qb-sec.selected .qb-sec-label { background: #1d3557; }
[data-bs-theme=dark] .qb-sec.suppressed .qb-sec-label .name { color: #8a939c; }

/* Dark theme: readable outline buttons (the theme's "secondary" colour is very light) and a backing for the logo.
   The design surface (.qb-center) is always light. */
[data-bs-theme=dark] .btn-outline-secondary { color: #dee2e6; --bs-btn-color: #dee2e6; --bs-btn-border-color: var(--bs-border-color); --bs-btn-hover-bg: var(--bs-secondary-bg); --bs-btn-hover-color: var(--bs-body-color); --bs-btn-hover-border-color: var(--bs-border-color); --bs-btn-active-bg: var(--bs-secondary-bg); --bs-btn-active-color: var(--bs-body-color); }
[data-bs-theme=dark] .qb-brand img { background: transparent; border-radius: 3px; padding: 1px 2px; }

/* Icon buttons and icon + text */
.qi + span { margin-left: 5px; }
.qb-btn-ic { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.qb-btn-ic .qi + span, .qb-toolbar .btn .qi + span { margin-left: 0; }
.qb-icon-btn { display: inline-flex; align-items: center; justify-content: center; padding: 3px 4px; color: var(--bs-body-color); background: transparent; border: 1px solid transparent; --qi-sw: 1.4; }
.qb-icon-btn:hover, .qb-icon-btn:focus-visible { background: var(--bs-secondary-bg); border-color: var(--bs-border-color); color: var(--bs-body-color); }
.btn-outline-secondary .qi, .btn-outline-primary .qi { --qi-sw: 1.5; vertical-align: -3px; }
.qb-list .item .qi { --qi-sw: 1.3; opacity: .85; }
.qb-toolbar .btn:disabled, .qb-toolbar .btn.disabled { border-color: transparent; background: transparent; }
.qb-status .qi { --qi-sw: 1.5; }

/* Page setup ▸ background image preview: one page, scaled */
.qb-bg-preview { position: relative; flex: 0 0 auto; background: #fff; border: 1px solid var(--bs-border-color); box-shadow: 0 1px 4px rgba(0, 0, 0, .2); overflow: hidden; }
