   Toolbars / search
   ------------------------------------------------------------------------ */

.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3); margin-bottom: 18px; }
.toolbar-card { margin: 0 32px 16px; padding: 12px; display: flex; align-items: center; gap: 10px; border-radius: var(--radius-lg); }
.search-wrap { min-width: 220px; flex: 1; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); }
.search-wrap:focus-within { border-color: var(--primary-2); box-shadow: var(--focus-ring); }
.search-wrap span { flex: 0 0 auto; color: var(--muted); font-size: 20px; }
.search-wrap input { min-height: 40px; border: 0 !important; outline: 0 !important; box-shadow: none !important; background: transparent !important; }

/* ------------------------------------------------------------------------
   Tables
   ------------------------------------------------------------------------ */

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.table-card { margin: 0 32px 32px; border-radius: var(--radius-lg); overflow: hidden; }
.table-meta { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: 14px 18px; border-bottom: 1px solid var(--line); }
.table-meta strong { display: block; color: var(--text-strong); }
.table-meta span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.table-tools { display: flex; align-items: center; gap: var(--space-2); }
.table-tools select { width: auto; min-height: 36px; padding: 7px 10px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table, .table-wrap table { width: 100%; border-collapse: collapse; min-width: 720px; }
.data-table th, .table-wrap th { padding: 12px 16px; background: var(--surface-2); color: var(--muted); border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 800; letter-spacing: .04em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td, .table-wrap td { padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--text); text-align: left; vertical-align: middle; }
.data-table tbody tr:hover, .table-wrap tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 65%, transparent); }
.data-table tbody tr:last-child td, .table-wrap tbody tr:last-child td { border-bottom: 0; }
.data-table small, .table-wrap small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.actions-col, .actions-cell { text-align: right !important; }
.actions-cell { white-space: nowrap; }
.person-cell { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.person-cell strong { display: block; color: var(--text-strong); }
.avatar { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border-radius: 50%; background: var(--info-bg); color: var(--primary-2); font-size: 13px; font-weight: 800; }

.table-empty, .empty-state, .loading-row { min-height: 120px; display: grid; place-items: center; align-content: center; gap: 5px; padding: 24px; color: var(--muted); text-align: center; }
.table-empty strong, .empty-state strong { color: var(--text-strong); }
.loading { display: grid; place-items: center; min-height: 100px; color: var(--muted); }

.pagination, .pagination-bar { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; padding: 14px 18px; border-top: 1px solid var(--line); }
.page-btn { min-width: 34px; height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.page-btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--line-strong); }
.page-btn:disabled { cursor: not-allowed; opacity: .45; }

/* ------------------------------------------------------------------------
   Status / badges / messages
   ------------------------------------------------------------------------ */

.badge, .status-badge, .permission-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
}
.badge, .status-badge { padding: 4px 9px; background: var(--surface-3); color: var(--muted); }
.success { color: var(--success) !important; }
.warning { color: var(--warning) !important; }
.danger { color: var(--danger) !important; }
.info { color: var(--info) !important; }
.status-badge.success { background: var(--success-bg); }
.status-badge.warning { background: var(--warning-bg); }
.status-badge.danger { background: var(--danger-bg); }
.status-badge.muted { background: var(--surface-3); color: var(--muted); }
.alert { padding: 12px 15px; border: 1px solid transparent; border-radius: var(--radius-md); font-size: 14px; }
.alert-info { background: var(--info-bg); border-color: #cfe0ff; color: var(--info); }
.alert-success { background: var(--success-bg); border-color: #b8ead0; color: var(--success); }
.alert-warning { background: var(--warning-bg); border-color: #f2dfa0; color: var(--warning); }
.alert-danger { background: var(--danger-bg); border-color: #f4c5c0; color: var(--danger); }

/* ------------------------------------------------------------------------
   Roles / permissions / workflows
   ------------------------------------------------------------------------ */

.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-4); }
.role-card { border-radius: var(--radius-lg); padding: var(--space-5); }
.role-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); }
.role-card h2 { margin: 5px 0; font-size: 17px; }
.permission-cloud { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.permission-chip { padding: 5px 9px; background: var(--surface-3); color: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.check-field { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; }
.check-field input { width: 18px; min-height: 18px; margin-top: 2px; }
.selection-list { display: grid; gap: 8px; max-height: 360px; overflow: auto; padding-right: 4px; }
.selection-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); }
.selection-item input { width: 18px; min-height: 18px; }
.workflow-steps { display: grid; gap: 10px; }
.workflow-step { padding: 13px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); }
.workflow-step-head, .task-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.workflow-step-title { color: var(--text-strong); font-weight: 700; }
.approval-step-list { display: grid; gap: 10px; }
.approval-step-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); }
.approval-step-number { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; border-radius: 50%; background: var(--info-bg); color: var(--primary-2); font-weight: 800; }
.approval-task { min-width: 0; }
.task-meta { color: var(--muted); font-size: 12px; }
.task-actions { display: flex; gap: 6px; }
.split-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.split-tabs a, .split-tabs button { padding: 11px 14px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); text-decoration: none; cursor: pointer; white-space: nowrap; }
.split-tabs a:hover, .split-tabs button:hover, .split-tabs .active { color: var(--text-strong); border-bottom-color: var(--primary-2); }

/* ------------------------------------------------------------------------
   Notifications / small lists
   ------------------------------------------------------------------------ */

.notification-item { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: 14px 16px; border-bottom: 1px solid var(--line); }
.notification-item:last-child { border-bottom: 0; }
.notification-item.unread { background: color-mix(in srgb, var(--info-bg) 55%, transparent); }
.notification-item p { margin: 4px 0 0; color: var(--muted); }
.notification-actions { display: flex; align-items: center; gap: 8px; white-space: nowrap; }

/* ------------------------------------------------------------------------
   Modals
   ------------------------------------------------------------------------ */

body.modal-open { overflow: hidden; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.58); backdrop-filter: blur(2px); }
.modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.modal-sm { width: min(440px, 100%); }
.modal-lg { width: min(860px, 100%); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-size: 19px; }
.modal-header button { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 25px; line-height: 1; cursor: pointer; }
.modal-header button:hover { background: var(--surface-3); color: var(--text-strong); }
.modal-body { overflow: auto; padding: 22px; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); }
.modal-close { cursor: pointer; }

/* ------------------------------------------------------------------------
   Toasts
   ------------------------------------------------------------------------ */

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2000;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 11px;
  background: #172033;
  color: #fff;
  box-shadow: 0 12px 35px rgba(0,0,0,.18);
  font-size: 14px;
  font-weight: 600;
}
.toast.success { background: #0b5132; color: #fff !important; }
.toast.error { background: #8b1e16; color: #fff !important; }
.toast.warning { background: #6d4d00; color: #fff !important; }

/* ------------------------------------------------------------------------
