/* ==========================================================================
   BACKOFFICE — Executive Command Center
   Refined SaaS admin aesthetic: clean, spacious, data-forward
   ========================================================================== */

/* --- Extended palette (builds on style.css :root) --- */
:root {
  --bo-sidebar-w: 240px;
  --bo-header-h: 64px;
  --bo-radius: 12px;
  --bo-radius-sm: 8px;
  --bo-shadow-sm: 0 1px 3px rgba(26,77,77,.06), 0 1px 2px rgba(26,77,77,.04);
  --bo-shadow: 0 4px 16px rgba(26,77,77,.07), 0 1px 4px rgba(26,77,77,.04);
  --bo-shadow-lg: 0 12px 40px rgba(26,77,77,.10), 0 4px 12px rgba(26,77,77,.06);
  --bo-transition: .2s cubic-bezier(.4,0,.2,1);
  --bo-success: #10b981;
  --bo-warning: #f59e0b;
  --bo-danger: #ef4444;
  --bo-info: #3b82f6;
}

/* --- Reset for backoffice page --- */
html:has(body.page-backoffice) {
  background: var(--primary-dark);
}

body.page-backoffice {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  display: flex;
  background: var(--primary-dark);
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.bo-sidebar {
  width: var(--bo-sidebar-w);
  height: 100vh;
  height: 100dvh;
  background: var(--primary-dark);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 100;
  transition: transform var(--bo-transition);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bo-sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.bo-logo {
  border-radius: 8px;
  flex-shrink: 0;
}

.bo-sidebar-title {
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  font-size: .95rem;
  color: #fff;
  letter-spacing: .02em;
}

/* --- Nav items --- */
.bo-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bo-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--bo-radius-sm);
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--bo-transition);
  cursor: pointer;
}

/* Role-tagged nav items stay hidden until the role-specific bundle reveals the
   allowed ones (revealNav strips data-roles). Prevents a flash of admin menu
   items before the role is resolved. */
.bo-nav-item[data-roles] {
  display: none;
}

.bo-nav-item svg {
  flex-shrink: 0;
  opacity: .7;
  transition: opacity var(--bo-transition);
}

.bo-nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,.08);
}

.bo-nav-item:hover svg { opacity: 1; }

.bo-nav-item.active {
  color: #fff;
  background: rgba(91,168,168,.25);
}

.bo-nav-item.active svg { opacity: 1; }

.bo-sidebar-footer {
  padding: 10px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.bo-nav-back {
  color: rgba(255,255,255,.5) !important;
  font-size: .8125rem;
}

.bo-nav-back:hover {
  color: rgba(255,255,255,.85) !important;
}

/* --- Hamburger (mobile) --- */
.bo-hamburger {
  display: none;
  position: fixed;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: calc(12px + env(safe-area-inset-left, 0px));
  z-index: 200;
  width: 36px;
  height: 36px;
  background: var(--primary);
  border: none;
  border-radius: var(--bo-radius-sm);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: var(--bo-shadow);
}

.bo-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
  transition: all var(--bo-transition);
}

.bo-hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.bo-hamburger.open span:nth-child(2) { opacity: 0; }
.bo-hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.bo-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 90;
  backdrop-filter: blur(2px);
}

.bo-overlay.visible { display: block; }

/* ==========================================================================
   MAIN AREA
   ========================================================================== */
.bo-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
}

.bo-header {
  height: var(--bo-header-h);
  min-height: var(--bo-header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.bo-page-title {
  font-family: 'Sora', sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
}

.bo-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.bo-username {
  font-size: .8125rem;
  color: var(--text-muted);
  font-weight: 500;
}

.bo-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 40px;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.bo-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--bo-radius-sm);
  font-family: 'Source Sans 3', sans-serif;
  font-size: .8125rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--bo-transition);
  text-decoration: none;
  white-space: nowrap;
}

.bo-btn-primary {
  background: var(--primary);
  color: #fff;
}
.bo-btn-primary:hover { background: var(--primary-hover); }

.bo-btn-accent {
  background: var(--accent);
  color: #fff;
}
.bo-btn-accent:hover { background: var(--accent-hover); }

.bo-btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 12px;
}
.bo-btn-ghost:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.bo-btn-sm {
  padding: 5px 10px;
  font-size: .75rem;
}

.bo-btn-icon {
  padding: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 6px;
  transition: all var(--bo-transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bo-btn-icon:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.bo-btn-danger {
  background: transparent;
  color: var(--bo-danger);
  border: 1px solid var(--bo-danger);
}
.bo-btn-danger:hover {
  background: var(--bo-danger);
  color: #fff;
}

/* ==========================================================================
   FILTER BAR
   ========================================================================== */
.bo-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--bo-radius);
  box-shadow: var(--bo-shadow-sm);
}

.bo-filter-bar label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.bo-filter-bar input[type="date"],
.bo-filter-bar select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: .8125rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color var(--bo-transition);
}

.bo-filter-bar input[type="date"]:focus,
.bo-filter-bar select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,77,77,.1);
}

.bo-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   KPI CARDS
   ========================================================================== */
.bo-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.bo-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--bo-radius);
  padding: 20px;
  box-shadow: var(--bo-shadow-sm);
  transition: all var(--bo-transition);
  position: relative;
  overflow: hidden;
}

.bo-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  opacity: 0;
  transition: opacity var(--bo-transition);
}

.bo-kpi-card:hover {
  box-shadow: var(--bo-shadow);
  transform: translateY(-1px);
}

.bo-kpi-card:hover::before { opacity: 1; }

.bo-kpi-card:nth-child(2)::before { background: var(--accent); }
.bo-kpi-card:nth-child(3)::before { background: var(--teal-light); }
.bo-kpi-card:nth-child(4)::before { background: var(--bo-info); }
.bo-kpi-card:nth-child(5)::before { background: var(--bo-success); }

.bo-kpi-label {
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-light);
  margin-bottom: 8px;
}

.bo-kpi-value {
  font-family: 'Sora', sans-serif;
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.bo-kpi-unit {
  font-size: .75rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 2px;
}

/* ==========================================================================
   CHARTS
   ========================================================================== */
.bo-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.bo-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--bo-radius);
  padding: 20px;
  box-shadow: var(--bo-shadow-sm);
}

.bo-chart-card.wide {
  grid-column: span 2;
}

.bo-chart-title {
  font-family: 'Sora', sans-serif;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}

.bo-chart-wrap {
  position: relative;
  width: 100%;
}

/* Constrain the small charts to a reasonable height */
.bo-chart-wrap canvas {
  max-height: 280px;
}

/* ==========================================================================
   TABLES
   ========================================================================== */
.bo-table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--bo-radius);
  box-shadow: var(--bo-shadow-sm);
  overflow: hidden;
}

.bo-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.bo-table-title {
  font-family: 'Sora', sans-serif;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
}

.bo-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* KPI row alias (used by TTS cache page) */
.bo-kpi-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
}

.bo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8125rem;
}

.bo-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-light);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.bo-table td {
  padding: 11px 16px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.bo-table tbody tr {
  transition: background var(--bo-transition);
}

.bo-table tbody tr:hover {
  background: rgba(26,77,77,.02);
}

.bo-table tbody tr:last-child td {
  border-bottom: none;
}

.bo-table .actions {
  display: flex;
  gap: 4px;
}

/* --- Sortable columns --- */
.bo-table th[data-sort] {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 22px;
}

.bo-table th[data-sort]:hover {
  color: var(--primary);
}

.bo-table th[data-sort]::after {
  content: '\2195';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: .6rem;
  opacity: .35;
  transition: opacity var(--bo-transition);
}

.bo-table th[data-sort]:hover::after {
  opacity: .6;
}

.bo-table th[data-sort].sort-asc::after {
  content: '\2191';
  opacity: .85;
}

.bo-table th[data-sort].sort-desc::after {
  content: '\2193';
  opacity: .85;
}

/* --- Empty state --- */
.bo-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-light);
}

.bo-empty-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  opacity: .5;
}

/* ==========================================================================
   BADGES
   ========================================================================== */
.bo-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}

.bo-badge-active {
  background: rgba(16,185,129,.1);
  color: #059669;
}

.bo-badge-inactive {
  background: rgba(239,68,68,.08);
  color: #dc2626;
}

.bo-badge-admin {
  background: rgba(26,77,77,.1);
  color: var(--primary);
}

.bo-badge-contributor {
  background: rgba(224,123,79,.1);
  color: var(--accent);
}

.bo-badge-user {
  background: rgba(77,92,92,.08);
  color: var(--text-muted);
}

/* ==========================================================================
   MODAL
   ========================================================================== */
.bo-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 500;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
  padding: 20px;
}

.bo-modal-backdrop.visible {
  display: flex;
}

.bo-modal {
  background: var(--surface);
  border-radius: var(--bo-radius);
  box-shadow: var(--bo-shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  animation: boModalIn .2s ease;
}

@keyframes boModalIn {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.bo-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.bo-modal-title {
  font-family: 'Sora', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.bo-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color var(--bo-transition);
}
.bo-modal-close:hover { color: var(--text); }

.bo-modal-body {
  padding: 20px 24px;
}

.bo-modal-footer {
  padding: 0 24px 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* --- Form inside modal --- */
.bo-form-group {
  margin-bottom: 14px;
}

.bo-form-group label {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.bo-form-group input,
.bo-form-group select,
.bo-form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: .875rem;
  color: var(--text);
  background: var(--bg);
  transition: all var(--bo-transition);
}

.bo-form-group input:focus,
.bo-form-group select:focus,
.bo-form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,77,77,.1);
  background: var(--surface);
}

/* ==========================================================================
   TOAST
   ========================================================================== */
.bo-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
}

.bo-toast {
  padding: 12px 20px;
  border-radius: var(--bo-radius-sm);
  font-size: .8125rem;
  font-weight: 500;
  color: #fff;
  box-shadow: var(--bo-shadow);
  animation: boToastIn .3s ease, boToastOut .3s ease 2.7s forwards;
  max-width: 360px;
}

.bo-toast-success { background: var(--bo-success); }
.bo-toast-error { background: var(--bo-danger); }
.bo-toast-info { background: var(--bo-info); }

@keyframes boToastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes boToastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-8px); }
}

/* ==========================================================================
   FORM HINTS
   ========================================================================== */
.bo-form-hint {
  display: block;
  font-size: .6875rem;
  color: var(--text-light);
  margin-bottom: 4px;
  font-weight: 400;
  font-style: italic;
}

/* ==========================================================================
   COLLAPSIBLE CELLS
   ========================================================================== */
.bo-collapsible {
  max-width: 320px;
  word-break: break-word;
}

.bo-coll-short {
  color: var(--text-muted);
}

/* ==========================================================================
   FLOATING CONTACT BUTTON ("vraag / opmerking")
   ========================================================================== */
/* Persistent help/feedback FAB, bottom-right. Sits below the modal backdrop
   (z 500) so the contact form covers it, and below toasts (z 1000). */
.bo-contact-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 400;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 18px 0 16px;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--bo-shadow-lg);
  transition: transform var(--bo-transition), background var(--bo-transition);
}
.bo-contact-fab:hover {
  background: var(--primary-hover, var(--accent, var(--primary)));
  transform: translateY(-2px);
}
.bo-contact-fab svg { flex: 0 0 auto; }
.bo-contact-fab-label { white-space: nowrap; }

@media (max-width: 640px) {
  /* Shrink to an icon-only circle on small screens to stay out of the way. */
  .bo-contact-fab { padding: 0; width: 48px; justify-content: center; }
  .bo-contact-fab-label { display: none; }
}

.bo-coll-full {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: .75rem;
  line-height: 1.5;
  padding: 8px 0;
  max-height: 300px;
  overflow-y: auto;
}

.bo-coll-toggle {
  padding: 1px 6px !important;
  font-size: .6875rem !important;
  margin-top: 2px;
}

/* ==========================================================================
   PAGINATION
   ========================================================================== */
.bo-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 0;
}

.bo-pagination-dots {
  padding: 0 4px;
  color: var(--text-light);
  font-size: .8125rem;
}

.bo-pagination button[disabled] {
  opacity: .35;
  cursor: not-allowed;
}

/* ==========================================================================
   COMPACT TABLE VARIANT
   ========================================================================== */
.bo-table-compact th,
.bo-table-compact td {
  padding: 5px 8px;
  font-size: .6875rem;
}

.bo-session-id {
  font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
  font-size: .625rem;
  background: rgba(26,77,77,.06);
  padding: 2px 5px;
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--bo-transition);
}

.bo-session-id:hover {
  background: rgba(26,77,77,.14);
}

.bo-table td.nowrap,
.bo-table th.nowrap,
td.nowrap {
  white-space: nowrap;
}

.text-muted {
  color: var(--text-muted);
}

/* ==========================================================================
   SECTION TITLES
   ========================================================================== */
.bo-section-title {
  font-family: 'Sora', sans-serif;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}

/* ==========================================================================
   LOADING
   ========================================================================== */
.bo-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-light);
  font-size: .875rem;
  gap: 10px;
}

.bo-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: boSpin .6s linear infinite;
}

@keyframes boSpin { to { transform: rotate(360deg); } }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1024px) {
  .bo-chart-grid {
    grid-template-columns: 1fr;
  }
  .bo-chart-card.wide {
    grid-column: span 1;
  }
}

@media (max-width: 768px) {
  .bo-sidebar {
    position: fixed;
    transform: translateX(-100%);
    padding-top: env(safe-area-inset-top, 0px);
  }
  .bo-sidebar.open {
    transform: translateX(0);
  }
  /* When sidebar is open, move hamburger inside it */
  .bo-hamburger.open {
    left: calc(var(--bo-sidebar-w) - 48px);
  }
  .bo-sidebar .bo-sidebar-header {
    padding-left: 20px;
  }
  .bo-hamburger {
    display: flex;
  }
  .bo-header {
    padding: 0 calc(12px + env(safe-area-inset-right, 0px)) 0 calc(60px + env(safe-area-inset-left, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(56px + env(safe-area-inset-top, 0px));
    min-height: calc(56px + env(safe-area-inset-top, 0px));
  }
  .bo-page-title {
    font-size: 1rem;
  }
  .bo-content {
    padding: 16px calc(12px + env(safe-area-inset-right, 0px)) calc(32px + env(safe-area-inset-bottom, 0px)) calc(12px + env(safe-area-inset-left, 0px));
  }
  .bo-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
  }
  .bo-kpi-card {
    padding: 14px;
  }
  .bo-kpi-value {
    font-size: 1.3rem;
  }
  .bo-filter-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 10px;
  }
  .bo-filter-group {
    flex-wrap: wrap;
    width: 100%;
  }
  .bo-filter-group label {
    min-width: 40px;
  }
  .bo-filter-bar input[type="date"],
  .bo-filter-bar select,
  .bo-filter-bar input[type="text"] {
    flex: 1;
    min-width: 0;
  }
  .bo-filter-bar .bo-btn {
    width: 100%;
    justify-content: center;
    padding: 10px 16px;
  }

  /* Tables: ensure horizontal scroll with visual hint */
  .bo-table-wrap {
    -webkit-overflow-scrolling: touch;
    position: relative;
  }
  .bo-table {
    font-size: .75rem;
  }
  .bo-table th,
  .bo-table td {
    padding: 8px 10px;
  }
  .bo-table-compact th,
  .bo-table-compact td {
    padding: 5px 6px;
    font-size: .625rem;
  }
  .bo-table-header {
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .bo-table-title {
    font-size: .8125rem;
  }

  /* Charts */
  .bo-chart-grid {
    gap: 14px;
    margin-bottom: 20px;
  }
  .bo-chart-card {
    padding: 14px;
  }
  .bo-chart-title {
    font-size: .75rem;
    margin-bottom: 12px;
  }

  /* Buttons: larger touch targets */
  .bo-btn {
    padding: 10px 16px;
    font-size: .8125rem;
  }
  .bo-btn-sm {
    padding: 8px 12px;
    font-size: .75rem;
  }
  .bo-btn-icon {
    padding: 10px;
  }

  /* Modal: nearly full-screen on mobile */
  .bo-modal-backdrop {
    padding: 10px;
    align-items: flex-end;
  }
  .bo-modal {
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--bo-radius) var(--bo-radius) 0 0;
  }
  .bo-modal-body {
    padding: 16px;
  }
  .bo-modal-header {
    padding: 16px 16px 0;
  }
  .bo-modal-footer {
    padding: 0 16px 16px;
  }
  .bo-form-group input,
  .bo-form-group select,
  .bo-form-group textarea {
    font-size: 1rem; /* prevent iOS zoom on focus */
  }

  /* Section titles */
  .bo-section-title {
    font-size: .8125rem;
    margin-bottom: 12px;
  }

  /* Toast */
  .bo-toast-container {
    bottom: 12px;
    right: 12px;
    left: 12px;
  }
  .bo-toast {
    max-width: 100%;
  }

  /* Pagination: bigger touch targets */
  .bo-pagination button {
    min-width: 36px;
    min-height: 36px;
  }

  /* Collapsible */
  .bo-collapsible {
    max-width: 200px;
  }

  /* Hide non-essential table columns on mobile */
  .bo-mh {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .bo-kpi-grid {
    grid-template-columns: 1fr;
  }
  .bo-header-right {
    gap: 8px;
  }
  .bo-username {
    display: none;
  }
}

/* ==========================================================================
   COMPLIANCE PROFILE PICKER (company → compliance settings modal)
   ========================================================================== */
.bo-modal.bo-modal-wide {
  max-width: 760px;
}

.bo-compliance-intro {
  font-size: .85rem;
  color: var(--text-muted);
  margin: 0 0 18px;
  line-height: 1.5;
}

.bo-compliance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 640px) {
  .bo-compliance-grid {
    grid-template-columns: 1fr;
  }
}

.bo-compliance-card {
  position: relative;
  border: 2px solid var(--border, #e5e7eb);
  border-radius: var(--bo-radius);
  padding: 18px 18px 16px;
  background: var(--surface, #fff);
  cursor: pointer;
  transition: border-color var(--bo-transition), box-shadow var(--bo-transition), transform var(--bo-transition);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bo-compliance-card:hover {
  border-color: var(--primary, #1A4D4D);
  box-shadow: var(--bo-shadow-lg, 0 8px 24px rgba(0,0,0,.08));
  transform: translateY(-1px);
}

.bo-compliance-card.selected {
  border-color: var(--primary, #1A4D4D);
  background: rgba(26, 77, 77, 0.04);
}

.bo-compliance-card.selected::after {
  content: "";
  position: absolute;
  top: 12px;
  right: 12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary, #1A4D4D);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
  background-size: 14px 14px;
  background-repeat: no-repeat;
  background-position: center;
}

.bo-compliance-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bo-compliance-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 77, 77, 0.08);
  color: var(--primary, #1A4D4D);
  flex-shrink: 0;
}

.bo-compliance-title {
  font-family: 'Sora', sans-serif;
  font-size: .98rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.bo-compliance-tagline {
  font-size: .78rem;
  color: var(--text-muted);
  margin: 0;
}

.bo-compliance-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  font-size: .8rem;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bo-compliance-list li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  line-height: 1.4;
}

.bo-compliance-list li::before {
  content: "";
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--primary, #1A4D4D);
  opacity: .6;
}

.bo-compliance-current {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  background: var(--primary, #1A4D4D);
  color: white;
}
