/* Baiee Manager — components for the Reports module
   Companion to baiee-chrome.css. All classes are bm-* namespaced
   to avoid colliding with global Bootstrap/Mud styles. */

/* ---------- Page head ---------- */
.bm-page-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 20px;
}
.bm-page-head h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--bm-text);
}
.bm-page-head .bm-sub {
  color: var(--bm-text-3);
  font-size: 13px;
  margin-top: 4px;
}
.bm-page-head .bm-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
[dir="rtl"] .bm-page-head .bm-actions { margin-left: 0; margin-right: auto; }

/* ---------- Buttons ---------- */
.bm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid var(--bm-border-strong);
  background: var(--bm-surface);
  color: var(--bm-text);
  cursor: pointer;
  transition: background 120ms, border-color 120ms, box-shadow 120ms, color 120ms;
  white-space: nowrap;
  text-decoration: none;
}
.bm-btn:hover { background: var(--bm-surface-2); }
.bm-btn:active { background: var(--bm-bg-alt); }
.bm-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.bm-btn.primary {
  background: var(--bm-text);
  color: #fff;
  border-color: var(--bm-text);
}
.bm-btn.primary:hover { background: #000; border-color: #000; }
.bm-btn.gold {
  background: var(--bm-brand);
  color: #fff;
  border-color: var(--bm-brand);
}
.bm-btn.gold:hover { background: var(--bm-brand-600); border-color: var(--bm-brand-600); }
.bm-btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--bm-text-2);
}
.bm-btn.ghost:hover { background: var(--bm-surface-2); color: var(--bm-text); }
.bm-btn.danger {
  color: var(--bm-danger, #c94a3d);
  border-color: var(--bm-border-strong);
}
.bm-btn.danger:hover {
  background: var(--bm-danger-tint, #fbe8e6);
  border-color: var(--bm-danger, #c94a3d);
}
.bm-btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.bm-btn.lg { height: 40px; padding: 0 18px; font-size: 14px; }
.bm-btn i { font-size: 14px; line-height: 1; }

/* ---------- Card ---------- */
.bm-card {
  background: var(--bm-surface);
  border: 1px solid var(--bm-border);
  border-radius: 8px;
  box-shadow: var(--bm-shadow-1);
}
.bm-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--bm-divider);
}
.bm-card-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--bm-text);
}
.bm-card-head .bm-card-sub {
  font-size: 12px;
  color: var(--bm-text-3);
}
.bm-card-body { padding: 16px; }
.bm-card-foot {
  padding: 10px 16px;
  font-size: 11.5px;
  color: var(--bm-text-3);
  border-top: 1px solid var(--bm-divider);
  background: var(--bm-bg-alt);
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

.bm-spacer { flex: 1; }

/* ---------- Local search input (in card head) ---------- */
.bm-search-local {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 240px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--bm-border);
  border-radius: 6px;
  background: var(--bm-bg-alt);
  color: var(--bm-text-3);
  font-size: 12px;
}
.bm-search-local i { font-size: 12px; }
.bm-search-local input {
  border: 0;
  background: transparent;
  outline: none;
  flex: 1;
  color: var(--bm-text);
  font-family: inherit;
  font-size: 12px;
  min-width: 0;
}
.bm-search-local:focus-within {
  background: var(--bm-surface);
  border-color: var(--bm-brand);
  box-shadow: 0 0 0 3px var(--bm-brand-tint);
}

/* ---------- Chips ---------- */
.bm-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bm-bg-alt);
  font-size: 12px;
  color: var(--bm-text-2);
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
  white-space: nowrap;
}
.bm-chip:hover { background: var(--bm-surface-2); }
.bm-chip.solid { background: var(--bm-text); color: #fff; }
.bm-chip.solid:hover { background: #000; }
.bm-chip.ghost {
  background: transparent;
  color: var(--bm-text-3);
  border-color: var(--bm-border);
}
.bm-chip.sm { padding: 1px 6px; font-size: 10.5px; }

/* ---------- Pill (category-style label) ---------- */
.bm-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bm-surface-2);
  color: var(--bm-text-2);
  border: 1px solid var(--bm-border);
  white-space: nowrap;
}
.bm-pill .bm-pill-bar {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 6px;
  opacity: 0.7;
}
[dir="rtl"] .bm-pill .bm-pill-bar { margin-right: 0; margin-left: 6px; }

/* ---------- Badges ---------- */
.bm-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.5;
  border: 1px solid var(--bm-border);
  background: var(--bm-surface-2);
  color: var(--bm-text-2);
  white-space: nowrap;
}
.bm-badge .bm-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.bm-badge.success { color: #2f9e5e; background: #e6f4ec; border-color: transparent; }
.bm-badge.info    { color: #3b6bd4; background: #e8eefb; border-color: transparent; }
.bm-badge.warn    { color: #c68321; background: #fbf0db; border-color: transparent; }
.bm-badge.danger  { color: #c94a3d; background: #fbe8e6; border-color: transparent; }
.bm-badge.gold    { color: var(--bm-brand-700); background: var(--bm-brand-tint); border-color: transparent; }
.bm-badge.draft   { color: var(--bm-text-3); background: var(--bm-surface-2); border: 1px dashed var(--bm-border-strong); }

/* ---------- Table ---------- */
.bm-tbl-wrap {
  width: 100%;
  overflow-x: auto;
}
.bm-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.bm-tbl th, .bm-tbl td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: middle;
}
[dir="rtl"] .bm-tbl th, [dir="rtl"] .bm-tbl td { text-align: right; }
.bm-tbl thead th {
  font-size: 11px;
  font-weight: 600;
  color: var(--bm-text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--bm-divider);
  background: var(--bm-surface-2);
  white-space: nowrap;
}
.bm-tbl tbody td {
  border-bottom: 1px solid var(--bm-divider);
  color: var(--bm-text);
}
.bm-tbl tbody tr:hover { background: var(--bm-bg-alt); }
.bm-tbl tbody tr:last-child td { border-bottom: 0; }
.bm-tbl tbody tr.bm-row-inactive td { opacity: 0.55; }
.bm-tbl .bm-mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: var(--bm-text-2);
}
.bm-tbl .bm-tnum {
  font-variant-numeric: tabular-nums;
  color: var(--bm-text-2);
}
.bm-tbl .bm-name {
  font-weight: 600;
  color: var(--bm-text);
}
.bm-tbl .bm-meta-line {
  font-size: 11.5px;
  color: var(--bm-text-3);
  margin-top: 2px;
}
.bm-tbl .bm-actions-cell {
  display: flex;
  gap: 2px;
  justify-content: flex-end;
}
.bm-tbl .bm-empty-cell {
  text-align: center;
  padding: 48px 16px;
  color: var(--bm-text-3);
}

/* ---------- Inline icon button (within tables/cards) ---------- */
.bm-mini-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  color: var(--bm-text-2);
  cursor: pointer;
  background: transparent;
  border: 0;
  padding: 0;
  font-family: inherit;
  transition: background 120ms, color 120ms;
}
.bm-mini-btn:hover { background: var(--bm-surface-2); color: var(--bm-text); }
.bm-mini-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.bm-mini-btn.run:hover    { color: var(--bm-brand-700); background: var(--bm-brand-tint); }
.bm-mini-btn.danger:hover { color: #c94a3d; background: #fbe8e6; }
.bm-mini-btn i { font-size: 14px; line-height: 1; }

/* ---------- Layout split (main + aside) ---------- */
.bm-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.bm-split.with-aside {
  grid-template-columns: 1fr 420px;
}
@media (max-width: 1280px) {
  .bm-split.with-aside { grid-template-columns: 1fr; }
}
.bm-aside-sticky { position: sticky; top: 72px; align-self: start; }

/* ---------- Form grid ---------- */
.bm-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.bm-form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.bm-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.bm-field.bm-col-2, .bm-col-2 { grid-column: 1 / -1 !important; }
.bm-row-3 { display: grid; grid-template-columns: 1fr 1fr 1.5fr; gap: 12px; }
.bm-field label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--bm-text-2);
  letter-spacing: 0.01em;
}
.bm-field .bm-req { color: #c94a3d; margin-left: 2px; }
.bm-field .bm-help {
  font-size: 11px;
  color: var(--bm-text-3);
  margin-top: 2px;
}
.bm-field .bm-help.error { color: #c94a3d; }
.bm-field .bm-help.ok    { color: #2f9e5e; }

.bm-input,
.bm-textarea,
.bm-select {
  width: 100%;
  border: 1px solid var(--bm-border-strong);
  border-radius: 4px;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 13px;
  background: var(--bm-surface);
  color: var(--bm-text);
  transition: border-color 120ms, box-shadow 120ms;
  min-height: 32px;
}
.bm-input:focus,
.bm-textarea:focus,
.bm-select:focus {
  outline: none;
  border-color: var(--bm-brand);
  box-shadow: 0 0 0 3px var(--bm-brand-tint);
}
.bm-input.mono,
.bm-textarea.mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12.5px;
}
.bm-textarea { resize: vertical; min-height: 60px; line-height: 1.45; }
.bm-input.tnum { font-variant-numeric: tabular-nums; }

/* Input group (input + trailing button) */
.bm-input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
}
.bm-input-group .bm-input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  flex: 1;
}
.bm-input-group .bm-btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  margin-left: -1px;
  height: 34px;
}
[dir="rtl"] .bm-input-group .bm-input {
  border-radius: 0 4px 4px 0;
}
[dir="rtl"] .bm-input-group .bm-btn {
  border-radius: 4px 0 0 4px;
  margin-left: 0;
  margin-right: -1px;
}

/* Toggle switch */
.bm-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--bm-text);
}
.bm-switch input { position: absolute; opacity: 0; pointer-events: none; }
.bm-switch .bm-switch-track {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--bm-border-strong);
  border-radius: 999px;
  transition: background 120ms;
  flex-shrink: 0;
}
.bm-switch .bm-switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 120ms;
  box-shadow: 0 1px 2px rgba(15,23,42,0.15);
}
.bm-switch input:checked + .bm-switch-track { background: var(--bm-brand); }
.bm-switch input:checked + .bm-switch-track::after { transform: translateX(16px); }
[dir="rtl"] .bm-switch input:checked + .bm-switch-track::after { transform: translateX(-16px); }

/* ---------- Segmented control ---------- */
.bm-segmented {
  display: inline-flex;
  background: var(--bm-bg-alt);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
  border: 1px solid var(--bm-border);
}
.bm-segmented button {
  border: 0;
  background: transparent;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--bm-text-3);
  cursor: pointer;
  font-weight: 500;
  font-family: inherit;
}
.bm-segmented button.on {
  background: var(--bm-surface);
  color: var(--bm-text);
  box-shadow: var(--bm-shadow-1);
}
.bm-segmented.sm button { font-size: 11.5px; padding: 3px 9px; }

/* ---------- Param list (within forms) ---------- */
.bm-param-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bm-param-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) minmax(110px, 1fr) minmax(100px, 0.8fr) auto;
  gap: 6px;
  align-items: center;
  padding: 6px;
  border: 1px dashed var(--bm-border);
  border-radius: 4px;
  background: var(--bm-bg-alt);
}
.bm-param-row .bm-input,
.bm-param-row .bm-select {
  height: 28px;
  padding: 0 8px;
  font-size: 12.5px;
  min-height: 28px;
  border-color: var(--bm-border);
  background: var(--bm-surface);
}
.bm-param-row.expanded {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.bm-param-row-top {
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) minmax(110px, 1fr) 80px minmax(110px, 1fr) minmax(110px, 1fr) auto auto auto;
  gap: 6px;
  align-items: center;
  width: 100%;
}
.bm-param-row-bot {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 8px;
  width: 100%;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--bm-border);
}
.bm-param-row .bm-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--bm-text-2);
  cursor: pointer;
  white-space: nowrap;
}
.bm-param-row .bm-checkbox input { margin: 0; cursor: pointer; }

/* ---------- Form actions footer ---------- */
.bm-form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--bm-divider);
}

/* ---------- Inline alert / status ---------- */
.bm-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.bm-alert i { font-size: 14px; margin-top: 2px; flex-shrink: 0; }
.bm-alert.success { background: #e6f4ec; color: #1f6e3e; border-color: #c5e3d2; }
.bm-alert.danger  { background: #fbe8e6; color: #973128; border-color: #f0c4be; }
.bm-alert.info    { background: #e8eefb; color: #234a99; border-color: #c9d6f4; }

/* ---------- Empty / loading states ---------- */
.bm-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--bm-text-3);
}
.bm-empty .bm-empty-icon {
  font-size: 36px;
  color: var(--bm-text-muted);
  margin-bottom: 12px;
}
.bm-empty h4 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--bm-text);
}
.bm-empty p {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--bm-text-3);
}

.bm-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 16px;
  color: var(--bm-text-3);
  font-size: 13px;
}
.bm-spinner {
  display: inline-block;      /* so width/height apply even on inline <span> spinners */
  vertical-align: middle;
  flex: 0 0 auto;             /* keep its size inside flex loaders/buttons */
  width: 16px;
  height: 16px;
  border: 2px solid var(--bm-border);
  border-top-color: var(--bm-brand);
  border-radius: 50%;
  animation: bm-spin 700ms linear infinite;
}
.bm-spinner.lg { width: 28px; height: 28px; border-width: 3px; }
@keyframes bm-spin { to { transform: rotate(360deg); } }

/* ---------- Modal (drop-in for Bootstrap modal markup) ---------- */
.bm-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1050;
  animation: bm-fade-in 120ms ease-out;
}
.bm-modal {
  position: fixed;
  inset: 0;
  z-index: 1055;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 16px;
  overflow-y: auto;
  pointer-events: none;
}
.bm-modal-dialog {
  background: var(--bm-surface);
  border-radius: 10px;
  border: 1px solid var(--bm-border);
  box-shadow: 0 20px 48px rgba(15,23,42,0.18), 0 4px 12px rgba(15,23,42,0.06);
  width: 100%;
  max-width: 980px;
  pointer-events: auto;
  animation: bm-modal-in 160ms ease-out;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}
.bm-modal-dialog.sm  { max-width: 520px; }
.bm-modal-dialog.md  { max-width: 720px; }
.bm-modal-dialog.lg  { max-width: 1100px; }
.bm-modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--bm-divider);
  flex-shrink: 0;
}
.bm-modal-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--bm-text);
}
.bm-modal-head .bm-modal-sub {
  font-size: 12px;
  color: var(--bm-text-3);
  margin-top: 2px;
}
.bm-modal-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
}
.bm-modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--bm-divider);
  background: var(--bm-bg-alt);
  border-radius: 0 0 10px 10px;
  flex-shrink: 0;
}
@keyframes bm-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes bm-modal-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Stack utilities ---------- */
.bm-hstack { display: flex; align-items: center; gap: 8px; }
.bm-vstack { display: flex; flex-direction: column; gap: 8px; }
.bm-tnum   { font-variant-numeric: tabular-nums; }

/* ---------- Stat tile grid (dashboard) ---------- */
.bm-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 1024px) { .bm-stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px)  { .bm-stat-grid { grid-template-columns: 1fr; } }

.bm-stat {
  padding: 14px 16px;
  border: 1px solid var(--bm-border);
  border-radius: 8px;
  background: var(--bm-surface);
  box-shadow: var(--bm-shadow-1);
}
.bm-stat .bm-stat-lbl {
  font-size: 11px;
  color: var(--bm-text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 6px;
}
.bm-stat .bm-stat-val {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--bm-text);
}
.bm-stat .bm-stat-val.danger { color: #c94a3d; }
.bm-stat .bm-stat-delta {
  font-size: 11.5px;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--bm-text-3);
}
.bm-stat .bm-stat-delta.up   { color: #2f9e5e; }
.bm-stat .bm-stat-delta.down { color: #c94a3d; }

/* ---------- Status row dot ---------- */
.bm-row-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bm-text-muted);
  flex-shrink: 0;
}
.bm-row-dot.success { background: #2f9e5e; }
.bm-row-dot.warn    { background: #c68321; }
.bm-row-dot.danger  { background: #c94a3d; }
.bm-row-dot.info    { background: #3b6bd4; }
.bm-row-dot.running { background: var(--bm-brand); box-shadow: 0 0 0 3px var(--bm-brand-tint); }

/* ---------- Progress bar ---------- */
.bm-progress {
  height: 4px;
  background: var(--bm-bg-alt);
  border-radius: 3px;
  overflow: hidden;
}
.bm-progress.lg { height: 6px; }
.bm-progress-bar {
  height: 100%;
  background: var(--bm-brand);
  transition: width 300ms;
  border-radius: 3px;
}
.bm-progress-bar.success { background: #2f9e5e; }
.bm-progress-bar.danger  { background: #c94a3d; }
.bm-progress-bar.idle    { background: var(--bm-border-strong); }
.bm-progress-bar.striped {
  background-image: linear-gradient(45deg,
    rgba(255,255,255,0.2) 25%, transparent 25%,
    transparent 50%, rgba(255,255,255,0.2) 50%,
    rgba(255,255,255,0.2) 75%, transparent 75%, transparent);
  background-size: 12px 12px;
  animation: bm-stripes 1s linear infinite;
}
@keyframes bm-stripes { from { background-position: 0 0; } to { background-position: 12px 0; } }

/* ---------- Category cards (Reports → Categories) ---------- */
.bm-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.bm-cat-card {
  background: var(--bm-surface);
  border: 1px solid var(--bm-border);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 120ms, box-shadow 120ms, transform 120ms;
  box-shadow: var(--bm-shadow-1);
}
.bm-cat-card:hover {
  border-color: var(--bm-border-strong);
  box-shadow: 0 4px 12px rgba(15,23,42,0.06);
}
.bm-cat-card.inactive { opacity: 0.55; }
.bm-cat-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bm-cat-bar {
  width: 4px;
  height: 32px;
  border-radius: 2px;
  flex-shrink: 0;
  background: var(--bm-brand);
}
.bm-cat-title { flex: 1; min-width: 0; }
.bm-cat-title h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.005em;
  color: var(--bm-text);
}
.bm-cat-meta {
  font-size: 11.5px;
  color: var(--bm-text-3);
  margin-top: 2px;
}
.bm-cat-desc {
  font-size: 12.5px;
  color: var(--bm-text-2);
  line-height: 1.5;
  text-wrap: pretty;
  min-height: 36px;
}
.bm-cat-foot {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--bm-divider);
}
.bm-cat-card.add {
  border-style: dashed;
  background: transparent;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  color: var(--bm-text-3);
  box-shadow: none;
}
.bm-cat-card.add:hover {
  color: var(--bm-brand-700);
  border-color: var(--bm-brand);
  background: var(--bm-brand-tint);
}
.bm-cat-card .bm-add-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.bm-cat-card .bm-add-inner i { font-size: 22px; line-height: 1; }
.bm-cat-card .bm-add-title { font-size: 13.5px; font-weight: 600; color: var(--bm-text-2); }
.bm-cat-card .bm-add-sub   { font-size: 11.5px; color: var(--bm-text-3); }

/* ---------- Job cards (My running reports) ---------- */
.bm-job-card {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--bm-surface);
  border: 1px solid var(--bm-border);
  border-radius: 8px;
  border-left-width: 3px;
  box-shadow: var(--bm-shadow-1);
  transition: border-color 120ms, box-shadow 120ms;
}
.bm-job-card:hover { box-shadow: 0 4px 12px rgba(15,23,42,0.06); }
.bm-job-card.running   { border-left-color: var(--bm-brand); }
.bm-job-card.queued    { border-left-color: #c68321; }
.bm-job-card.success   { border-left-color: #2f9e5e; }
.bm-job-card.failed    { border-left-color: #c94a3d; }
.bm-job-card.cancelled { border-left-color: var(--bm-text-muted); }

.bm-job-status { display: flex; align-items: center; gap: 8px; }
.bm-job-main { min-width: 0; }
.bm-job-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
  letter-spacing: -0.005em;
  color: var(--bm-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bm-job-meta {
  font-size: 12px;
  color: var(--bm-text-3);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-variant-numeric: tabular-nums;
}
.bm-job-meta .bm-sep { color: var(--bm-border-strong); }
.bm-job-err {
  margin-top: 8px;
  padding: 6px 10px;
  background: #fbe8e6;
  color: #973128;
  font-size: 12px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}
.bm-job-err i { font-size: 13px; }
.bm-job-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

@media (max-width: 720px) {
  .bm-job-card { grid-template-columns: 1fr; gap: 10px; }
  .bm-job-actions { flex-wrap: wrap; }
}

/* ---------- Pagination ---------- */
.bm-pagination {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--bm-border);
  border-radius: 6px;
  padding: 2px;
  background: var(--bm-surface);
}
.bm-pagination button {
  height: 26px;
  min-width: 26px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--bm-text-2);
  font-family: inherit;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
}
.bm-pagination button:hover:not(:disabled) { background: var(--bm-bg-alt); color: var(--bm-text); }
.bm-pagination button.on { background: var(--bm-brand); color: #fff; font-weight: 600; }
.bm-pagination button:disabled { color: var(--bm-text-muted); cursor: not-allowed; }

/* ---------- Filter bar (multi-select rail) ---------- */
.bm-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--bm-surface);
  border: 1px solid var(--bm-border);
  border-radius: 8px;
  box-shadow: var(--bm-shadow-1);
}
.bm-filter-bar label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--bm-text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bm-filter-bar .bm-select {
  height: 30px;
  padding: 0 8px;
  font-size: 12.5px;
  width: auto;
  min-width: 220px;
  min-height: auto;
}

/* ---------- Role tag (assigned roles list) ---------- */
.bm-role-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 2px 10px;
  border-radius: 999px;
  background: var(--bm-brand-tint);
  color: var(--bm-brand-700);
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid transparent;
}
.bm-role-tag.public { background: #e6f4ec; color: #1f6e3e; }
.bm-role-tag .bm-tag-x {
  width: 18px;
  height: 18px;
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
  padding: 0;
  opacity: 0.65;
}
.bm-role-tag .bm-tag-x:hover { opacity: 1; background: rgba(0,0,0,0.06); }

/* ---------- Color picker (small) ---------- */
.bm-color-input {
  width: 40px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--bm-border-strong);
  border-radius: 4px;
  background: var(--bm-surface);
  cursor: pointer;
}

/* ---------- Full-page definition form (stepped) ---------- */
.bm-def-step {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bm-brand);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.bm-form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.bm-form-grid-3 .bm-col-2 { grid-column: span 2 !important; width: auto !important; flex: unset !important; }
.bm-form-grid-3 .bm-col-3 { grid-column: span 3 !important; width: auto !important; flex: unset !important; }
@media (max-width: 900px) {
  .bm-form-grid-3 { grid-template-columns: 1fr; }
  .bm-form-grid-3 .bm-col-2,
  .bm-form-grid-3 .bm-col-3 { grid-column: span 1; }
}
.bm-field-hint {
  font-size: 11px;
  color: var(--bm-text-muted);
  margin-top: 2px;
}

/* KV pairs (in summary sidebar) */
.bm-kv {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-top: 1px dashed var(--bm-divider);
  font-size: 12.5px;
  color: var(--bm-text-2);
}
.bm-kv:first-of-type { margin-top: 6px; }
.bm-kv span:first-child { color: var(--bm-text-3); }

/* Stepped form + sidebar layout */
.bm-def-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1100px) { .bm-def-layout { grid-template-columns: 1fr; } }
.bm-def-sidebar { position: sticky; top: 72px; }

/* Danger zone */
.bm-danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: #c94a3d;
  border: 1px solid rgba(201,74,61,0.2);
  background: #fbe8e6;
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
  margin-bottom: 8px;
}
.bm-danger-btn:hover { background: #f5ccc8; border-color: rgba(201,74,61,0.35); }

/* ---------- Confirm popup (above modals at z-index 1055) ---------- */
.bm-confirm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1060;
}
.bm-confirm-popup {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 1065; background: #fff; border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2); width: 440px; max-width: 90vw;
  overflow: hidden;
}
.bm-confirm-icon {
  background: #fef3cd; text-align: center; padding: 20px 0 12px;
  font-size: 32px; color: #d4a017;
}
.bm-confirm-body { padding: 16px 24px 12px; }
.bm-confirm-body h4 { margin: 0 0 8px; font-size: 16px; font-weight: 600; color: var(--bm-text); }
.bm-confirm-body p { margin: 0; font-size: 13px; color: var(--bm-text-2); line-height: 1.6; }
.bm-confirm-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 24px; border-top: 1px solid var(--bm-divider, #eee);
}
.bm-btn.danger { background: #dc3545; color: #fff; border-color: #dc3545; }
.bm-btn.danger:hover { background: #c82333; }

/* ---------- Collapse on small screens ---------- */
@media (max-width: 1024px) {
  .bm-page-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .bm-page-head .bm-actions { margin-left: 0; }
  [dir="rtl"] .bm-page-head .bm-actions { margin-right: 0; }
  .bm-form-grid, .bm-form-grid.cols-3 { grid-template-columns: 1fr; }
  .bm-param-row,
  .bm-param-row-top { grid-template-columns: 1fr 1fr; }
  .bm-param-row-bot { grid-template-columns: 1fr; }
}
