.report-workspace { margin: 14px 0 18px; }
.report-workspace-tabs { display: flex; align-items: end; gap: 4px; border-bottom: 1px solid #cbd8e5; }
.report-workspace-tab { min-height: 38px; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; padding: 8px 18px; background: transparent; color: #607488; font: 800 13px inherit; cursor: pointer; }
.report-workspace-tab:hover { background: #edf4fa; color: #173f6c; }
.report-workspace-tab.is-active { position: relative; border-color: #cbd8e5; background: #fff; color: #173f6c; }
.report-workspace-tab.is-active::after { position: absolute; right: -1px; bottom: -1px; left: -1px; height: 2px; background: #fff; content: ""; }
.report-workspace-panel { min-width: 0; }
.report-workspace-panel[data-report-workspace-panel="stats"] { padding-top: 14px; }
/* The original dashboard cards rely on this 12-column grid. Stats now lives
   inside the workspace panel, so retain the same grid contract there. */
html body .report-dashboard-view > .report-workspace > .report-workspace-panel[data-report-workspace-panel="stats"] > .report-grid {
  display: grid !important;
  grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
  grid-auto-rows: 8px !important;
  grid-auto-flow: row dense !important;
  align-items: start !important;
  gap: 14px !important;
}
html body .report-dashboard-view > .report-workspace > .report-workspace-panel[data-report-workspace-panel="stats"] > .report-grid > .report-panel,
html body .report-dashboard-view > .report-workspace > .report-workspace-panel[data-report-workspace-panel="stats"] > .report-grid > .report-panel.wide-report {
  grid-column: span 3 !important;
}

.report-studio {
  margin: 14px 0 0;
  border: 1px solid #ced9e6;
  border-radius: 12px;
  background: linear-gradient(135deg, #f7faff 0%, #ffffff 72%);
  box-shadow: 0 10px 26px rgba(25, 55, 91, .08);
  overflow: hidden;
}

.report-studio-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 20px;
  color: #fff;
  background: linear-gradient(110deg, #173f6c, #396f9f);
}

.report-studio-head-copy { min-width: 0; }
.report-studio-kicker { display: block; margin-bottom: 2px; color: #c9dff2; font-size: 10px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.report-studio-head h3 { margin: 0; color: #fff; font-size: 20px; }
.report-studio-head p { margin: 4px 0 0; color: #e3eff8; font-size: 12px; }
.report-studio-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.report-studio button,
.report-studio-dialog button {
  font: inherit;
}

.report-studio-primary,
.report-studio-secondary,
.report-studio-icon,
.report-studio-action,
.report-studio-tab {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 8px 13px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.report-studio-primary { border-color: #e1b344; background: #f0bd43; color: #12283f; }
.report-studio-primary:hover { background: #ffd067; }
.report-studio-secondary { border-color: #c8d6e4; background: #fff; color: #173f6c; }
.report-studio-secondary:hover { background: #edf4fa; }
.report-studio-secondary.danger { border-color: #edc8cd; color: #9b2433; }
.report-studio-head .report-studio-secondary { border-color: rgba(255,255,255,.45); background: rgba(255,255,255,.12); color: #fff; }
.report-studio-head .report-studio-secondary:hover { background: rgba(255,255,255,.22); }

.report-studio-library { padding: 16px 20px 18px; }
.report-studio-library-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.report-studio-tabs { display: flex; align-items: center; gap: 4px; }
.report-studio-tab { min-height: 31px; padding: 6px 11px; border-color: #d7e1eb; background: #f6f9fc; color: #51657a; }
.report-studio-tab.is-active { border-color: #6e94b8; background: #e6f0f8; color: #173f6c; }
.report-studio-search { width: min(270px, 45%); height: 34px; border: 1px solid #cad6e3; border-radius: 7px; padding: 0 11px; background: #fff; color: #172b3e; }

.report-studio-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 10px; }
.report-studio-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 13px; border: 1px solid #dce4ed; border-radius: 9px; background: #fff; box-shadow: 0 3px 10px rgba(20, 50, 80, .04); }
.report-studio-card:hover { border-color: #95afc9; box-shadow: 0 6px 16px rgba(20, 50, 80, .09); }
.report-studio-card-copy { min-width: 0; cursor: pointer; }
.report-studio-card h4 { margin: 0 0 5px; overflow: hidden; color: #132d47; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.report-studio-card p { margin: 0; overflow: hidden; color: #66798d; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.report-studio-card-meta { display: flex; align-items: center; gap: 6px; grid-column: 1 / -1; color: #7a8998; font-size: 10px; }
.report-studio-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 7px; background: #e7f0f8; color: #285c89; font-size: 9px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
.report-studio-badge.template { background: #f5ead0; color: #805c0b; }
.report-studio-card-menu { position: relative; }
.report-studio-icon { display: grid; place-items: center; width: 32px; min-height: 32px; padding: 0; border-color: #d9e2ec; background: #fff; color: #52687e; }
.report-studio-menu-panel { position: absolute; z-index: 20; top: 36px; right: 0; display: none; min-width: 145px; padding: 5px; border: 1px solid #d5dee8; border-radius: 8px; background: #fff; box-shadow: 0 10px 24px rgba(12, 34, 58, .18); }
.report-studio-card-menu.is-open .report-studio-menu-panel { display: grid; }
.report-studio-action { min-height: 30px; border: 0; padding: 6px 9px; background: transparent; color: #233e58; text-align: left; }
.report-studio-action:hover { background: #edf3f8; }
.report-studio-action.danger { color: #a12736; }
.report-studio-empty { grid-column: 1 / -1; display: grid; place-items: center; min-height: 100px; border: 1px dashed #bdcbd9; border-radius: 9px; color: #6b7e90; font-size: 12px; text-align: center; }

.report-studio-dialog {
  width: min(1500px, calc(100vw - 32px));
  max-width: none;
  height: min(920px, calc(100vh - 32px));
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 13px;
  background: #f4f7fa;
  box-shadow: 0 28px 80px rgba(3, 22, 42, .34);
  overflow: hidden;
}

.report-studio-dialog::backdrop { background: rgba(9, 27, 45, .62); backdrop-filter: blur(2px); }
.report-studio-dialog-shell { display: grid; grid-template-rows: auto 1fr auto; height: 100%; min-height: 0; }
.report-studio-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 18px; border-bottom: 1px solid #d3dde7; background: #fff; }
.report-studio-dialog-title { min-width: 0; }
.report-studio-dialog-title input { width: min(520px, 50vw); border: 0; border-bottom: 1px solid transparent; padding: 3px 2px; color: #102b45; background: transparent; font: 800 20px/1.2 inherit; }
.report-studio-dialog-title input:focus { border-bottom-color: #6f97ba; outline: 0; }
.report-studio-dialog-title span { display: block; margin-top: 3px; color: #728396; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.report-studio-dialog-actions { display: flex; align-items: center; gap: 7px; }
.report-studio-dialog-body { display: grid; grid-template-columns: 330px minmax(0, 1fr); min-height: 0; }
.report-studio-config { min-height: 0; overflow-y: auto; border-right: 1px solid #d4dee8; background: #fff; }
.report-studio-config-section { padding: 14px 16px; border-bottom: 1px solid #e2e8ef; }
.report-studio-config-section h4 { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; color: #233d56; font-size: 12px; }
.report-studio-field-label { display: grid; gap: 5px; margin-bottom: 10px; color: #5d7084; font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.report-studio-field-label input,
.report-studio-field-label select,
.report-studio-filter-row input,
.report-studio-filter-row select {
  width: 100%;
  height: 35px;
  min-width: 0;
  border: 1px solid #cbd7e3;
  border-radius: 6px;
  padding: 0 9px;
  background: #fff;
  color: #203b54;
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
}

.report-studio-field-search { position: sticky; top: 0; z-index: 2; margin-bottom: 9px; background: #fff; }
.report-studio-field-list { display: grid; gap: 4px; max-height: 275px; overflow-y: auto; }
.report-studio-field-option { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: start; gap: 7px; padding: 7px 8px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; }
.report-studio-field-option:hover { border-color: #d6e0ea; background: #f5f8fb; }
.report-studio-field-option input { margin: 2px 0 0; }
.report-studio-field-option strong { display: block; overflow: hidden; color: #2b435a; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.report-studio-field-option small { display: block; overflow: hidden; margin-top: 2px; color: #8795a4; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.report-studio-selected-fields { display: grid; gap: 5px; margin-top: 9px; }
.report-studio-selected-row { display: grid; grid-template-columns: minmax(0, 1fr) 82px 25px 25px 25px; align-items: center; gap: 3px; padding: 5px 6px; border-radius: 6px; background: #edf3f8; color: #2e4b66; font-size: 10px; font-weight: 800; }
.report-studio-selected-row select { width: 82px; height: 25px; min-width: 0; border: 1px solid #cfdae5; border-radius: 4px; background: #fff; color: #3f5870; font-size: 9px; }
.report-studio-selected-row button { display: grid; place-items: center; width: 25px; height: 25px; border: 0; border-radius: 4px; background: #fff; color: #49627a; cursor: pointer; }
.report-studio-selected-row button:hover { color: #133e68; background: #dce8f2; }
.report-studio-filter-list { display: grid; gap: 7px; }
.report-studio-filter-row { display: grid; grid-template-columns: 1fr 1fr 1fr 26px; gap: 4px; }
.report-studio-filter-row button { width: 26px; height: 35px; border: 0; border-radius: 5px; background: #f4e9eb; color: #9a2635; cursor: pointer; }
.report-studio-filter-row .value-to { grid-column: 3; }

.report-studio-preview { display: grid; grid-template-rows: auto auto minmax(0, 1fr); min-width: 0; min-height: 0; overflow: hidden; }
.report-studio-preview-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-bottom: 1px solid #dbe3eb; background: #f8fafc; }
.report-studio-preview-title { min-width: 0; }
.report-studio-preview-title strong { display: block; color: #233e58; font-size: 12px; }
.report-studio-preview-title span { display: block; margin-top: 2px; color: #748597; font-size: 10px; }
.report-studio-preview-tools { display: flex; align-items: center; gap: 6px; }
.report-studio-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; padding: 10px 14px 0; }
.report-studio-summary-card { min-width: 0; padding: 10px 12px; border: 1px solid #d9e2eb; border-left: 4px solid #4580b2; border-radius: 7px; background: #fff; }
.report-studio-summary-card span { display: block; overflow: hidden; color: #728396; font-size: 9px; font-weight: 900; letter-spacing: .05em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.report-studio-summary-card strong { display: block; margin-top: 3px; overflow: hidden; color: #183854; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.report-studio-preview-content { min-height: 0; margin: 10px 14px 14px; overflow: auto; border: 1px solid #d5dee8; border-radius: 8px; background: #fff; }
.report-studio-table { width: 100%; min-width: 650px; border-collapse: separate; border-spacing: 0; font-size: 11px; }
.report-studio-table th { position: sticky; z-index: 2; top: 0; padding: 9px 10px; border-bottom: 1px solid #cdd8e3; background: #eaf0f6; color: #28445f; font-size: 9px; letter-spacing: .04em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.report-studio-table td { max-width: 320px; padding: 8px 10px; border-bottom: 1px solid #e7ecf1; color: #334b62; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-studio-table tbody tr:hover td { background: #f7fafc; }
.report-studio-table tfoot td { position: sticky; bottom: 0; border-top: 2px solid #b9c9d8; border-bottom: 0; background: #edf3f8; font-weight: 900; }
.report-studio-chart { display: flex; align-items: flex-end; gap: 9px; min-width: 650px; min-height: 340px; padding: 28px 24px 54px; }
.report-studio-chart-item { position: relative; display: grid; flex: 1 1 0; place-items: end center; min-width: 28px; height: 250px; }
.report-studio-chart-bar { width: min(46px, 80%); min-height: 2px; border-radius: 5px 5px 0 0; background: linear-gradient(180deg, #4c87b8, #285d8b); }
.report-studio-chart-value { position: absolute; top: -18px; color: #36516a; font-size: 9px; font-weight: 900; }
.report-studio-chart-label { position: absolute; top: calc(100% + 8px); width: 90px; color: #64778a; font-size: 9px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-studio-preview-empty { display: grid; place-items: center; min-height: 300px; padding: 30px; color: #6f8295; text-align: center; }
.report-studio-dialog-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid #d3dde7; background: #fff; }
.report-studio-status { min-width: 0; color: #667a8e; font-size: 11px; }
.report-studio-status.is-error { color: #a32636; }
.report-studio-foot-actions { display: flex; align-items: center; gap: 7px; }

.report-studio-share-dialog { width: min(560px, calc(100vw - 32px)); border: 0; border-radius: 11px; padding: 0; box-shadow: 0 24px 70px rgba(4, 24, 45, .32); }
.report-studio-share-dialog::backdrop { background: rgba(10, 29, 48, .55); }
.report-studio-share-shell { padding: 18px; }
.report-studio-share-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.report-studio-share-head h3 { margin: 0; color: #173650; }
.report-studio-share-copy { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; margin-top: 12px; }
.report-studio-share-copy input { min-width: 0; height: 36px; border: 1px solid #ccd8e4; border-radius: 6px; padding: 0 9px; color: #4b6074; background: #f7f9fb; }
.report-studio-people { display: grid; gap: 5px; max-height: 230px; margin-top: 9px; overflow-y: auto; }
.report-studio-person { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid #e1e7ed; border-radius: 6px; color: #314b63; font-size: 11px; }

@media (max-width: 900px) {
  .report-studio-dialog { width: 100vw; height: 100vh; border-radius: 0; }
  .report-studio-dialog-body { grid-template-columns: 1fr; overflow-y: auto; }
  .report-studio-config { max-height: none; overflow: visible; border-right: 0; }
  .report-studio-preview { min-height: 520px; }
  .report-studio-dialog-head { align-items: flex-start; }
  .report-studio-dialog-actions { flex-wrap: wrap; justify-content: flex-end; }
}

@media (max-width: 640px) {
  .report-workspace-tabs { gap: 2px; }
  .report-workspace-tab { flex: 1; padding-right: 10px; padding-left: 10px; }
  .report-studio-head { align-items: flex-start; flex-direction: column; }
  .report-studio-actions { width: 100%; }
  .report-studio-actions button { flex: 1; }
  .report-studio-library-toolbar { align-items: stretch; flex-direction: column; }
  .report-studio-search { width: 100%; }
  .report-studio-cards { grid-template-columns: 1fr; }
  .report-studio-dialog-head { flex-direction: column; }
  .report-studio-dialog-title input { width: 100%; }
  .report-studio-dialog-actions { width: 100%; justify-content: flex-start; }
  .report-studio-preview-bar { align-items: flex-start; flex-direction: column; }
  .report-studio-dialog-foot { align-items: stretch; flex-direction: column; }
  .report-studio-foot-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .report-studio-filter-row { grid-template-columns: 1fr 1fr 26px; }
  .report-studio-filter-row input { grid-column: 1 / 3; }
}

@media print {
  .report-studio, .report-studio-dialog { box-shadow: none; }
}

/* Accounting customer insights full-width correction. */
html body .report-dashboard-view > .report-workspace > .report-workspace-panel[data-report-workspace-panel="stats"] > .report-grid > .report-panel.accounting-customer-insights-panel {
  grid-column: 1 / -1 !important;
}
/* End accounting customer insights full-width correction. */
