/* =========================================================
   Shared look (v2) for report screens (report studio pages:
   templates/partials/report_studio/{toolbar,filter_bar,preview_panel,empty_state}.html).
   Scoped to .o_action.inv-report-studio; colours only from theme tokens.
   The html body prefix outranks the older .inv-report-studio rules in odoo.css.
   ========================================================= */

html body .o_action.inv-report-studio {
  --rs-text: var(--qc-text, var(--o-text));
  --rs-muted: var(--qc-muted, var(--o-muted));
  --rs-card: var(--qc-panel, var(--o-panel));
  --rs-line: var(--qc-border, var(--o-border));
  --rs-line-strong: var(--qc-border-strong, var(--o-input-border));
  --rs-field: var(--qc-input-bg, #ffffff);
  --rs-ro: var(--qc-readonly-bg, #eef0f2);
  --rs-hover: var(--qc-hover, var(--o-hover));
  --rs-on-accent: var(--et-on-accent, #ffffff);
  --rs-h: 1.8rem;
}
html[data-theme="dark"] body .o_action.inv-report-studio {
  --rs-field: var(--qc-input-bg, #121a22);
  --rs-ro: var(--qc-readonly-bg, #1d2731);
}

/* ---------- Toolbar: View = primary, others outlined, Exit plain after a divider ---------- */
html body .o_action.inv-report-studio .report-studio-toolbar {
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--rs-line);
}
html body .o_action.inv-report-studio .report-studio-toolbar .o_cp_title { font-size: 1.1rem; font-weight: 600; color: var(--rs-text); }
html body .o_action.inv-report-studio .report-studio-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
html body .o_action.inv-report-studio .report-studio-actions .btn-odoo {
  height: var(--rs-h);
  padding: 0 0.7rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  box-shadow: none;
}
html body .o_action.inv-report-studio .report-studio-actions .btn-odoo-secondary {
  border: 1px solid var(--rs-line-strong);
  background: var(--rs-card);
  color: var(--rs-text);
}
html body .o_action.inv-report-studio .report-studio-actions .btn-odoo-secondary:hover:not(:disabled) { background: var(--rs-hover); }
html body .o_action.inv-report-studio .report-studio-actions .btn-odoo-secondary:disabled { opacity: 0.5; cursor: not-allowed; }
html body .o_action.inv-report-studio .report-studio-actions .btn-odoo-primary { font-weight: 600; }
html body .o_action.inv-report-studio .report-studio-actions .rs-exit {
  border-color: transparent;
  background: transparent;
  color: var(--rs-muted);
}
html body .o_action.inv-report-studio .report-studio-actions .rs-exit:hover { background: var(--rs-hover); color: var(--rs-text); }
html body .o_action.inv-report-studio .rs-sep { width: 1px; height: 1.4rem; background: var(--rs-line-strong); margin: 0 0.2rem; }

/* ---------- Parameters card ---------- */
html body .o_action.inv-report-studio .report-studio-filters {
  margin: 0.55rem 0.75rem 0;
  padding: 0.55rem 0.75rem 0.65rem;
  background: var(--rs-card);
  border: 1px solid var(--rs-line);
  border-radius: 10px;
  box-shadow: none;
}
html body .o_action.inv-report-studio .rs-params-title {
  margin-bottom: 0.4rem;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--rs-muted);
}
html body .o_action.inv-report-studio .report-studio-filters label {
  font-size: 0.71rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--rs-muted);
}
/* Editable: white + border */
html body .o_action.inv-report-studio .report-studio-filters input:where(:not([type="checkbox"], [type="radio"], [type="hidden"])),
html body .o_action.inv-report-studio .report-studio-filters select:not(.klaro-select-native),
html body .o_action.inv-report-studio .report-studio-filters .klaro-select-trigger {
  height: var(--rs-h);
  min-height: var(--rs-h);
  padding-top: 0;
  padding-bottom: 0;
  border: 1px solid var(--rs-line-strong);
  border-radius: 6px;
  background: var(--rs-field);
  color: var(--rs-text);
  font-size: 0.82rem;
  box-shadow: none;
}
html body .o_action.inv-report-studio .report-studio-filters input:focus,
html body .o_action.inv-report-studio .report-studio-filters select:focus,
html body .o_action.inv-report-studio .report-studio-filters .klaro-select-trigger:focus-visible {
  outline: none;
  border-color: var(--o-accent);
  box-shadow: 0 0 0 3px rgba(var(--o-accent-rgb), 0.2);
}
/* System-filled: grey, no border */
html body .o_action.inv-report-studio .report-studio-filters input[readonly],
html body .o_action.inv-report-studio .report-studio-filters input:disabled,
html body .o_action.inv-report-studio .report-studio-filters select:disabled {
  background: var(--rs-ro);
  border-color: transparent;
  -webkit-text-fill-color: var(--rs-text);
  opacity: 1;
}
html body .o_action.inv-report-studio .report-studio-filters .lov-btn {
  height: var(--rs-h);
  min-width: var(--rs-h);
  border: 1px solid var(--rs-line-strong);
  border-radius: 6px;
  background: var(--rs-card);
  color: var(--rs-muted);
}
html body .o_action.inv-report-studio .report-studio-filters .lov-btn:hover { color: var(--o-accent); border-color: var(--o-accent); }

/* ---------- Preview area ---------- */
html body .o_action.inv-report-studio .inv-preview-panel {
  margin: 0.55rem 0.75rem 0.75rem;
  background: var(--rs-card);
  border: 1px solid var(--rs-line);
  border-radius: 10px;
  overflow: hidden;
}
/* While nothing has been run, shrink to the empty state instead of a tall blank box. */
html body .o_action.inv-report-studio .inv-preview-panel:has(> .inv-preview-empty:not([hidden])) {
  min-height: 0;
  height: auto;
}
html body .o_action.inv-report-studio .inv-preview-empty {
  display: block;
  padding: 0;
  color: var(--rs-muted);
  font-size: 0.82rem;
  text-align: center;
  background: transparent;
}
html body .o_action.inv-report-studio .inv-preview-empty[hidden] { display: none !important; }
html body .o_action.inv-report-studio .rs-empty {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  padding: 2.4rem 1rem 2.6rem;
}
html body .o_action.inv-report-studio .rs-empty-icon { color: var(--rs-line-strong); margin-bottom: 0.25rem; }
html body .o_action.inv-report-studio .rs-empty-title { font-size: 0.95rem; font-weight: 600; color: var(--rs-text); }
html body .o_action.inv-report-studio .rs-empty-text { max-width: 56ch; font-size: 0.82rem; color: var(--rs-muted); }

/* "Account 0101… · dates" status line shown after View */
html body .o_action.inv-report-studio .report-studio-status {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid var(--rs-line);
  font-size: 0.76rem;
  color: var(--rs-muted);
}
html body .o_action.inv-report-studio .report-studio-status[hidden] { display: none; }
html body .o_action.inv-report-studio .report-studio-status::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--o-accent);
}

/* ---------- Dark mode: app-workbench-orange.css forces form inputs with !important ---------- */
html[data-theme="dark"] body .o_action.inv-report-studio .report-studio-filters input:where(:not([type="checkbox"], [type="radio"], [type="hidden"])),
html[data-theme="dark"] body .o_action.inv-report-studio .report-studio-filters select:not(.klaro-select-native),
html[data-theme="dark"] body .o_action.inv-report-studio .report-studio-filters .klaro-select-trigger {
  background: var(--rs-field) !important;
  border-color: var(--rs-line-strong) !important;
  color: var(--rs-text) !important;
  -webkit-text-fill-color: var(--rs-text) !important;
}
html[data-theme="dark"] body .o_action.inv-report-studio .report-studio-filters input[readonly],
html[data-theme="dark"] body .o_action.inv-report-studio .report-studio-filters input:disabled,
html[data-theme="dark"] body .o_action.inv-report-studio .report-studio-filters select:disabled {
  background: var(--rs-ro) !important;
  border-color: transparent !important;
}
html[data-theme="dark"] body .o_action.inv-report-studio .report-studio-toolbar {
  background: var(--qc-page, #121820) !important;
  border-color: var(--rs-line) !important;
}
html[data-theme="dark"] body .o_action.inv-report-studio .report-studio-actions .rs-exit {
  background: transparent !important;
  border-color: transparent !important;
  color: var(--rs-muted) !important;
}
