/* Admin Portal Styles */

/* Filters bar */
.admin-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.admin-filters select,
.admin-filters input {
  padding: 8px 12px;
  border: 1px solid var(--oa-gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--oa-gray-700);
  background: var(--oa-white);
  min-width: 160px;
}
.admin-filters input {
  flex: 1;
  min-width: 200px;
}

/* Tables */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.admin-table th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 700;
  color: #1a1a1a;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--oa-gray-200);
  white-space: nowrap;
}
.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--oa-gray-100);
  color: var(--oa-gray-700);
  vertical-align: middle;
}
.admin-table tr:hover td {
  background: var(--oa-gray-50);
}

/* Role badges */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.role-badge.owner { background: #FEF3C7; color: #92400E; }
.role-badge.admin { background: #DBEAFE; color: #1E40AF; }
.role-badge.ops_manager { background: #E0E7FF; color: #3730A3; }
.role-badge.account_manager { background: #FCE7F3; color: #9D174D; }
.role-badge.team_leader { background: #D1FAE5; color: #065F46; }
.role-badge.va { background: #F3E8FF; color: #6B21A8; }
.role-badge.client { background: #FFF7ED; color: #9A3412; }

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.status-badge.active { background: #D1FAE5; color: #065F46; }
.status-badge.active::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #10B981; }
.status-badge.inactive { background: #FEE2E2; color: #991B1B; }
.status-badge.inactive::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #EF4444; }

/* Action buttons */
.btn-sm {
  padding: 5px 12px;
  font-size: 13px;
  border-radius: 6px;
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--oa-gray-300);
  color: var(--oa-gray-600);
  cursor: pointer;
  padding: 5px 12px;
  font-size: 13px;
  border-radius: 6px;
  transition: all var(--transition);
}
.btn-ghost:hover {
  background: var(--oa-gray-100);
  border-color: var(--oa-gray-400);
}
.btn-danger {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FECACA;
}
.btn-danger:hover {
  background: #FECACA;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open {
  display: flex;
}
.modal {
  background: var(--oa-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--oa-gray-200);
}
.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--oa-gray-900);
}
.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--oa-gray-400);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.modal-close:hover { color: var(--oa-gray-700); }
.modal-body {
  padding: 24px;
}
.modal-body .form-group {
  margin-bottom: 16px;
}
.modal-body .form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--oa-gray-300);
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--oa-gray-800);
  background: var(--oa-white);
}
.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}
.modal-actions .btn { flex: 1; }

/* ============ ORG TREE ============ */
.org-tree {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.team-card {
  background: var(--oa-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.team-card-header {
  padding: 16px 20px;
  background: var(--gradient-accent);
  color: var(--oa-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.team-card-name {
  font-size: 16px;
  font-weight: 600;
}

/* Org row for role slots */
.org-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: stretch;
  border-bottom: 1px solid var(--oa-gray-100);
}
.org-row:last-child { border-bottom: none; }

.org-row-label {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--oa-gray-500);
  background: var(--oa-gray-50);
  display: flex;
  align-items: center;
  border-right: 1px solid var(--oa-gray-200);
}

.org-row-content {
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 52px;
}

/* Drop zone styling */
.drop-zone {
  border: 2px dashed var(--oa-gray-300);
  border-radius: var(--radius);
  padding: 8px 16px;
  min-height: 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  transition: all 0.2s ease;
  flex: 1;
}
.drop-zone.empty::after {
  content: 'Drag a user here to assign';
  color: var(--oa-gray-400);
  font-size: 13px;
  font-style: italic;
}
.drop-zone.drag-over {
  border-color: var(--oa-teal);
  background: rgba(72,167,219,0.06);
}
.drop-zone.drag-over-invalid {
  border-color: var(--oa-danger);
  background: rgba(239,68,68,0.04);
}

/* Person chip (draggable) */
.person-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--oa-white);
  border: 1px solid var(--oa-gray-300);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--oa-gray-700);
  cursor: grab;
  user-select: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.person-chip:active { cursor: grabbing; }
.person-chip.dragging {
  opacity: 0.5;
  transform: scale(0.95);
}
.person-chip:hover {
  border-color: var(--oa-blue);
  box-shadow: var(--shadow-sm);
}
.person-chip .chip-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--oa-white);
  flex-shrink: 0;
}
.person-chip .chip-remove {
  margin-left: 4px;
  cursor: pointer;
  color: var(--oa-gray-400);
  font-size: 16px;
  line-height: 1;
}
.person-chip .chip-remove:hover { color: var(--oa-danger); }

/* Role-specific avatar colors */
.chip-avatar.owner { background: #D97706; }
.chip-avatar.admin { background: #2563EB; }
.chip-avatar.ops_manager { background: #4F46E5; }
.chip-avatar.account_manager { background: #DB2777; }
.chip-avatar.team_leader { background: #059669; }
.chip-avatar.va { background: #48A7DB; }
.chip-avatar.client { background: #EA580C; }

/* Clients grid inside org tree */
.org-clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  padding: 16px;
}
.org-client-card {
  border: 1px solid var(--oa-gray-200);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--oa-gray-50);
  transition: box-shadow 0.15s ease;
}
.org-client-card:hover { box-shadow: var(--shadow); }
.org-client-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--oa-gray-800);
  margin-bottom: 4px;
}
.org-client-industry {
  font-size: 12px;
  color: var(--oa-gray-500);
  margin-bottom: 8px;
}
.org-client-va {
  font-size: 12px;
  color: var(--oa-gray-600);
}

/* Unassigned pool */
.unassigned-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 40px;
}
.unassigned-pool:empty::after {
  content: 'All users are assigned.';
  color: var(--oa-gray-400);
  font-size: 13px;
  font-style: italic;
}

/* Preview container */
#previewContent .preview-role-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  z-index: 300;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}
.toast.success {
  background: #065F46;
  color: #D1FAE5;
}
.toast.error {
  background: #991B1B;
  color: #FEE2E2;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--oa-gray-400);
}

/* ============ STATIC ORG TREE ============ */
.ot-ceo-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--oa-white);
  border: 2px solid var(--oa-orange);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  box-shadow: var(--shadow-md);
  max-width: 320px;
  margin-bottom: 0;
}
.ot-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.ot-avatar-ceo { background: linear-gradient(135deg, #D97706, #F59E0B); }
.ot-avatar-om { background: linear-gradient(135deg, #362456, #0c4da2); }
.ot-avatar-tl { background: #3b7dd8; }
.ot-avatar-am { background: #DB2777; width: 28px; height: 28px; font-size: 10px; }
.ot-name { font-weight: 600; color: var(--oa-gray-900); font-size: 15px; }
.ot-role { font-size: 12px; color: var(--oa-gray-500); margin-top: 1px; }
.ot-connector-vertical {
  width: 2px;
  background: var(--oa-gray-300);
}
.ot-count-badge {
  background: var(--oa-gray-100);
  color: var(--oa-gray-700);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.ot-count-sm { font-size: 12px; padding: 3px 10px; }

/* OM Section */
.ot-om-section {
  background: var(--oa-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
  border-left: 4px solid #362456;
}
.ot-om-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: linear-gradient(135deg, rgba(54,36,86,0.04) 0%, rgba(12,77,162,0.04) 100%);
  transition: background 0.15s ease;
}
.ot-om-header:hover { background: linear-gradient(135deg, rgba(54,36,86,0.08) 0%, rgba(12,77,162,0.08) 100%); }
.ot-om-body { padding: 0 20px 20px; }
.ot-chevron { transition: transform 0.2s ease; flex-shrink: 0; }
.ot-om-header.collapsed .ot-chevron,
.ot-tl-header.collapsed .ot-chevron { transform: rotate(-90deg); }

/* TL Section */
.ot-tl-section {
  background: var(--oa-gray-50);
  border-radius: var(--radius);
  margin-top: 12px;
  border-left: 3px solid #3b7dd8;
  overflow: hidden;
}
.ot-tl-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.15s ease;
}
.ot-tl-header:hover { background: rgba(59,125,216,0.06); }

/* VA Table */
.ot-va-list { padding: 0 16px 16px; }
.ot-va-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ot-va-table th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 700;
  color: #1a1a1a;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--oa-gray-200);
  white-space: nowrap;
}
.ot-va-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--oa-gray-100);
  color: var(--oa-gray-700);
}
.ot-va-table tr:hover td { background: rgba(59,125,216,0.03); }
.ot-va-table tr:last-child td { border-bottom: none; }

/* AM chip */
.ot-am-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--oa-white);
  border: 1px solid var(--oa-gray-200);
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  color: var(--oa-gray-700);
}

/* ============ DASHBOARD MAP ============ */
.dm-org-chart {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Legend */
.dm-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--oa-gray-600);
}
.dm-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.dm-legend-live { background: #3b7dd8; }
.dm-legend-soon { background: #ccc; }

/* Tier */
.dm-tier {
  width: 100%;
  margin-bottom: 4px;
}
.dm-tier-indent {
  padding-left: 24px;
  border-left: 2px solid var(--oa-gray-200);
  margin-left: 18px;
}

/* Node row */
.dm-node-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
}
.dm-node {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--oa-white);
  border: 1px solid var(--oa-gray-200);
  border-radius: 12px;
  padding: 12px 20px;
  box-shadow: var(--shadow-sm);
}
.dm-node-sm {
  padding: 8px 16px;
}
.dm-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.dm-avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.dm-node-name { font-weight: 600; font-size: 15px; color: var(--oa-gray-900); }
.dm-node-sm .dm-node-name { font-size: 14px; }
.dm-node-title { font-size: 12px; color: var(--oa-gray-500); margin-top: 1px; }

/* Dashboards row */
.dm-dashboards-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

/* Thumbnail card */
.dm-thumb {
  width: 140px;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  flex-shrink: 0;
  text-decoration: none;
  display: block;
}
.dm-thumb-sm { width: 130px; }
.dm-thumb-live {
  border: 2px solid #3b7dd8;
  cursor: pointer;
  background: var(--oa-white);
}
.dm-thumb-live:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59,125,216,0.25);
}
.dm-thumb-soon {
  border: 2px dashed #ccc;
  cursor: default;
  background: #fafafa;
  opacity: 0.75;
}

/* Thumbnail bar */
.dm-thumb-bar {
  height: 6px;
  width: 100%;
}
.dm-bar-live { background: linear-gradient(90deg, #3b7dd8, #5a9be6); }
.dm-bar-soon { background: #ddd; }

/* Thumbnail body */
.dm-thumb-body {
  padding: 8px 10px 10px;
}

/* Mini chart inside thumbnail */
.dm-thumb-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 30px;
  margin-bottom: 6px;
}
.dm-mini-bar {
  flex: 1;
  background: linear-gradient(180deg, #3b7dd8, #5a9be6);
  border-radius: 2px 2px 0 0;
  min-width: 8px;
}
.dm-chart-muted .dm-mini-bar {
  background: linear-gradient(180deg, #ccc, #ddd);
}

/* Thumbnail name */
.dm-thumb-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--oa-gray-700);
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dm-thumb-soon .dm-thumb-name { color: var(--oa-gray-400); }

/* Badge */
.dm-badge {
  display: inline-block;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}
.dm-badge-live { background: #3b7dd8; color: #fff; }
.dm-badge-soon { background: #eee; color: #999; }

/* Vertical connector */
.dm-connector-v {
  width: 2px;
  height: 24px;
  background: var(--oa-gray-300);
  margin-left: 38px;
}
.dm-connector-short { height: 16px; margin-left: 42px; }

/* Branch connector */
.dm-connector-branch {
  width: 60px;
  height: 2px;
  background: var(--oa-gray-300);
  margin-left: 38px;
  margin-bottom: 4px;
  position: relative;
}
.dm-connector-branch::after {
  content: '';
  position: absolute;
  right: 0;
  top: -4px;
  width: 2px;
  height: 10px;
  background: var(--oa-gray-300);
}

/* Department section */
.dm-department {
  width: 100%;
  background: var(--oa-white);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}
.dm-dept-header {
  padding: 14px 20px;
  background: #4a4a5a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  transition: background 0.15s ease;
  border-radius: 6px;
}
.dm-dept-header:hover { background: #5a5a6a; }
.dm-dept-body { padding: 16px 20px 20px; }
.dm-dept-header.collapsed + .dm-dept-body { display: none; }

.dm-chevron { transition: transform 0.2s ease; flex-shrink: 0; }
.dm-dept-header.collapsed .dm-chevron { transform: rotate(-90deg); }

/* Department group label */
.dm-dept-group-label {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a1a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 24px 0 12px;
  padding: 8px 0;
  border-bottom: 2px solid var(--oa-gray-200);
}

/* ============ FULL COMPANY ORG CHART ============ */
.fc-ceo-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--oa-white);
  border: 2px solid #D97706;
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  box-shadow: var(--shadow-md);
  max-width: 320px;
}
.fc-president-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--oa-white);
  border: 2px solid #0c4da2;
  border-radius: var(--radius-lg);
  padding: 14px 22px;
  box-shadow: var(--shadow);
  max-width: 300px;
}
.fc-connector {
  width: 2px;
  height: 24px;
  background: var(--oa-gray-300);
  margin-left: 48px;
}
.fc-section {
  background: var(--oa-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
}
.fc-section-header {
  padding: 14px 20px;
  background: #4a4a5a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  border-radius: 6px;
  transition: background 0.15s ease;
}
.fc-section-header:hover { background: #5a5a6a; }
.fc-section-body { padding: 16px 20px 20px; }
.fc-chevron { transition: transform 0.2s ease; flex-shrink: 0; }
.fc-section-header.collapsed .fc-chevron,
.fc-dept-header.collapsed .fc-chevron { transform: rotate(-90deg); }
.fc-leader-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.fc-leader-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--oa-gray-50);
  border: 1px solid var(--oa-gray-200);
  border-radius: 10px;
}
.fc-leader-name { font-weight: 600; font-size: 13px; color: var(--oa-gray-900); }
.fc-leader-dept { font-size: 11px; color: var(--oa-gray-500); margin-top: 1px; }
.fc-dept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.fc-dept-card {
  background: var(--oa-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.fc-dept-card.fc-dept-service { border-left: 4px solid #48A7DB; }
.fc-dept-card.fc-dept-people { border-left: 4px solid #10B981; }
.fc-dept-card.fc-dept-finance { border-left: 4px solid #F59E0B; }
.fc-dept-card.fc-dept-support { border-left: 4px solid #48A7DB; }
.fc-dept-card.fc-dept-learning { border-left: 4px solid #EC4899; }
.fc-dept-card.fc-dept-matching { border-left: 4px solid #06B6D4; }
.fc-dept-header {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: var(--oa-gray-800);
  background: var(--oa-gray-50);
  transition: background 0.15s ease;
}
.fc-dept-header:hover { background: var(--oa-gray-100); }
.fc-dept-body { padding: 16px 20px 20px; }
.fc-dept-header.collapsed + .fc-dept-body { display: none; }
.fc-dept-badge {
  background: var(--oa-gray-100);
  color: var(--oa-gray-700);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.fc-subsection { margin-bottom: 16px; }
.fc-subsection-header {
  font-size: 12px;
  font-weight: 700;
  color: #1a1a1a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--oa-gray-200);
}
.fc-om-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.fc-om-card {
  padding: 14px;
  background: var(--oa-gray-50);
  border: 1px solid var(--oa-gray-200);
  border-radius: var(--radius);
}

/* Responsive */
@media (max-width: 768px) {
  .admin-filters { flex-direction: column; }
  .admin-filters select,
  .admin-filters input { min-width: 100%; }
  .org-row { grid-template-columns: 1fr; }
  .org-row-label { border-right: none; border-bottom: 1px solid var(--oa-gray-200); }
  .org-clients-grid { grid-template-columns: 1fr; }
  .modal { max-width: 100%; margin: 20px; }
  .main-header { flex-direction: column; gap: 12px; align-items: flex-start; }

  /* Dashboard Map mobile */
  .dm-tier-indent { padding-left: 12px; margin-left: 8px; }
  .dm-dashboards-row { gap: 8px; }
  .dm-thumb, .dm-thumb-sm { width: 120px; }
  .dm-node { padding: 8px 12px; }
  .dm-node-name { font-size: 13px; }

  /* Full Company mobile */
  .fc-dept-grid { grid-template-columns: 1fr; }
  .fc-leader-grid { grid-template-columns: 1fr; }
  .fc-om-cards { grid-template-columns: 1fr; }
  .fc-ceo-card, .fc-president-card { max-width: 100%; }
  .fc-dept-badge { font-size: 10px; padding: 2px 6px; }

  /* Database Design tab mobile */
  .dashboard-section .section-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .dashboard-section .section-body > p { word-wrap: break-word; overflow-wrap: break-word; }
  .db-flow-diagram { flex-direction: column !important; align-items: center !important; gap: 8px !important; }
  .db-flow-diagram .db-flow-arrow { transform: rotate(90deg); }
  .db-flow-diagram .db-flow-box { min-width: 180px !important; width: 80% !important; }

  /* Dashboard Builder mobile */
  .db-builder-layout { flex-direction: column !important; }
  .db-builder-palette { width: 100% !important; max-height: 300px !important; }
  .db-builder-properties { width: 100% !important; }
  .db-builder-canvas-wrapper { min-height: 400px !important; }
  .db-subtabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .db-subtab { white-space: nowrap; font-size: 12px !important; padding: 10px 12px !important; }
  .db-example-mod { grid-column: span 2 !important; }
}

/* ============ DASHBOARD BUILDER ============ */

/* Sub-tabs */
.db-subtab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #5a5f6d;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
}
.db-subtab:hover {
  color: #3b7dd8;
  background: rgba(59,125,216,0.04);
}
.db-subtab.active {
  color: #3b7dd8;
  border-bottom-color: #3b7dd8;
}

/* Module Library Cards */
.db-module-group {
  background: var(--oa-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}
.db-module-group-header {
  padding: 14px 20px;
  background: #4a4a5a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  border-radius: 6px;
  transition: background 0.15s ease;
}
.db-module-group-header:hover { background: #5a5a6a; }
.db-module-group-header.collapsed + .db-module-group-body { display: none; }
.db-module-group-body { padding: 0; }

.db-module-subgroup-header {
  font-size: 12px;
  font-weight: 700;
  color: #1a1a1a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 14px 20px 8px;
  border-bottom: 1px solid var(--oa-gray-100);
}

.db-module-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--oa-gray-100);
  transition: background 0.1s ease;
}
.db-module-card:last-child { border-bottom: none; }
.db-module-card:hover { background: var(--oa-gray-50); }

.db-module-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 4px;
  background: #E0E7FF;
  color: #3730A3;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 68px;
  text-align: center;
}
.db-module-tag.fin { background: #FEF3C7; color: #92400E; }
.db-module-tag.ops { background: #DBEAFE; color: #1E40AF; }
.db-module-tag.com { background: #D1FAE5; color: #065F46; }
.db-module-tag.perf { background: #FCE7F3; color: #9D174D; }
.db-module-tag.hr { background: #F3E8FF; color: #6B21A8; }
.db-module-tag.adm { background: #FFF7ED; color: #9A3412; }

.db-module-info { flex: 1; min-width: 0; }
.db-module-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--oa-gray-900);
  margin-bottom: 2px;
}
.db-module-desc {
  font-size: 13px;
  color: #5a5f6d;
  line-height: 1.4;
}
.db-module-meta {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  font-size: 12px;
  color: #5a5f6d;
}
.db-module-size-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--oa-gray-100);
  color: var(--oa-gray-700);
}
.db-module-status-live {
  color: #059669;
  font-weight: 600;
}
.db-module-status-soon {
  color: #5a5f6d;
  font-weight: 500;
}

/* Pre-built Example */
.db-example-mod {
  background: var(--oa-white);
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  transition: border-color 0.15s ease;
}
.db-example-mod:hover { border-color: #3b7dd8; }
.db-example-mod-tag {
  font-size: 11px;
  font-weight: 700;
  color: #3730A3;
  background: #E0E7FF;
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
}
.db-example-mod-name {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
}
.db-example-mod-size {
  font-size: 11px;
  color: #5a5f6d;
  margin-top: 2px;
}

/* ============ BUILDER LAYOUT ============ */
.db-builder-layout {
  display: flex;
  gap: 0;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  min-height: 600px;
  background: var(--oa-white);
}

.db-builder-palette {
  width: 260px;
  flex-shrink: 0;
  border-right: 1px solid #e5e7eb;
  background: #fafbfc;
  overflow-y: auto;
}

.db-builder-canvas-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.db-builder-tabbar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e5e7eb;
  background: #fafbfc;
  padding: 0 12px;
  overflow-x: auto;
}
.db-builder-tab {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #5a5f6d;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}
.db-builder-tab:hover { color: #3b7dd8; background: rgba(59,125,216,0.04); }
.db-builder-tab.active { color: #3b7dd8; border-bottom-color: #3b7dd8; }
.db-builder-tab .tab-close {
  font-size: 14px;
  color: #9ca3af;
  cursor: pointer;
  margin-left: 4px;
  line-height: 1;
}
.db-builder-tab .tab-close:hover { color: #EF4444; }

.db-builder-canvas {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8f9fa;
}

.db-canvas-dropzone {
  min-height: 400px;
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  align-content: start;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.db-canvas-dropzone.drag-over {
  border-color: #3b7dd8;
  background: rgba(59,125,216,0.04);
}
.db-canvas-dropzone.has-modules {
  border-style: solid;
  border-color: #e5e7eb;
}

.db-canvas-empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
}

/* Placed module on canvas */
.db-placed-module {
  background: var(--oa-white);
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
}
.db-placed-module:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border-color: #3b7dd8;
}
.db-placed-module.selected {
  border-color: #3b7dd8;
  box-shadow: 0 0 0 2px rgba(59,125,216,0.2);
}
.db-placed-module.size-s { grid-column: span 1; }
.db-placed-module.size-m { grid-column: span 2; }
.db-placed-module.size-l { grid-column: span 4; }

.db-placed-module-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FEE2E2;
  color: #991B1B;
  border: none;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.db-placed-module:hover .db-placed-module-remove { opacity: 1; }

.db-builder-properties {
  width: 280px;
  flex-shrink: 0;
  border-left: 1px solid #e5e7eb;
  background: #fafbfc;
  overflow-y: auto;
}

/* Palette items (draggable) */
.db-palette-group {
  border-bottom: 1px solid #e5e7eb;
}
.db-palette-group-header {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #1a1a1a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--oa-gray-50);
}
.db-palette-group-header:hover { background: var(--oa-gray-100); }
.db-palette-item {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--oa-gray-700);
  border-bottom: 1px solid var(--oa-gray-50);
  cursor: grab;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.1s ease;
}
.db-palette-item:hover { background: rgba(59,125,216,0.06); }
.db-palette-item:active { cursor: grabbing; }
.db-palette-item.dragging { opacity: 0.4; }

/* Preview area */
.db-preview-area {
  background: var(--oa-white);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  min-height: 500px;
}
.db-preview-tabbar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e5e7eb;
  background: #fafbfc;
  padding: 0 12px;
}
.db-preview-tab {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #5a5f6d;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.db-preview-tab.active { color: #3b7dd8; border-bottom-color: #3b7dd8; }
.db-preview-canvas {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  align-content: start;
}
.db-preview-module {
  background: var(--oa-white);
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  min-height: 80px;
}
.db-preview-module.size-s { grid-column: span 1; }
.db-preview-module.size-m { grid-column: span 2; }
.db-preview-module.size-l { grid-column: span 4; }
.db-preview-module-header {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.db-preview-module-placeholder {
  height: 60px;
  background: #f3f4f6;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 12px;
}

/* ========== TL DASHBOARD HORIZONTAL TABS ========== */
.tl-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0;
}
.tl-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: #5a5f6d;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all 0.15s ease;
  font-family: 'Inter', sans-serif;
}
.tl-tab:hover {
  color: #3b7dd8;
  background: rgba(59,125,216,0.06);
  border-radius: 8px 8px 0 0;
}
.tl-tab.active {
  color: #3b7dd8;
  border-bottom-color: #3b7dd8;
  font-weight: 600;
}
.tl-tab svg {
  flex-shrink: 0;
}
.tl-panel {
  animation: tlFadeIn 0.2s ease;
}
@keyframes tlFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* TL Dashboard Cards */
.tl-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.tl-stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  border: 1px solid rgba(0,0,0,0.06);
}
.tl-stat-card .tl-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #5a5f6d;
  margin-bottom: 6px;
}
.tl-stat-card .tl-value {
  font-size: 26px;
  font-weight: 700;
  color: #362456;
}
.tl-stat-card .tl-sub {
  font-size: 12px;
  color: #5a5f6d;
  margin-top: 4px;
}
.tl-stat-card.blue .tl-value { color: #3b7dd8; }
.tl-stat-card.green .tl-value { color: #16a34a; }
.tl-stat-card.red .tl-value { color: #dc2626; }
.tl-stat-card.gold .tl-value { color: #b8860b; }
.tl-stat-card.orange .tl-value { color: #f97316; }

.tl-section {
  background: #fff;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.06);
  margin-bottom: 20px;
  overflow: hidden;
}
.tl-section-header {
  padding: 14px 20px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tl-section-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: #362456;
  margin: 0;
}
.tl-section-header svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.tl-section-body {
  padding: 16px 20px;
}

/* Client Cards */
.tl-client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.tl-client-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  border: 1px solid rgba(0,0,0,0.06);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.tl-client-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.tl-client-card .tl-cc-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 12px 12px 0 0;
}
.tl-cc-bar.green { background: #16a34a; }
.tl-cc-bar.yellow { background: #eab308; }
.tl-cc-bar.red { background: #dc2626; }
.tl-cc-bar.orange { background: #f97316; }
.tl-cc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.tl-cc-name {
  font-size: 15px;
  font-weight: 700;
  color: #362456;
}
.tl-cc-industry {
  font-size: 11px;
  color: #5a5f6d;
  margin-top: 2px;
}
.tl-cc-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.tl-cc-badge.active { background: #dcfce7; color: #166534; }
.tl-cc-badge.attention { background: #fef3c7; color: #92400e; }
.tl-cc-badge.critical { background: #fee2e2; color: #991b1b; }
.tl-cc-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  font-size: 12px;
}
.tl-cc-row:last-child { border-bottom: none; }
.tl-cc-row .tl-cc-label { color: #5a5f6d; font-weight: 500; }
.tl-cc-row .tl-cc-val { font-weight: 600; color: #1a1a1a; }

/* VA Performance Table */
.tl-va-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tl-va-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #1a1a1a;
  border-bottom: 2px solid #e5e7eb;
  white-space: nowrap;
}
.tl-va-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
  color: #1a1a1a;
}
.tl-va-table tr:hover td {
  background: rgba(59,125,216,0.04);
}

/* Alert Cards */
.tl-alert {
  padding: 14px 16px;
  border-radius: 10px;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.tl-alert.critical { background: #fef2f2; border-left: 3px solid #dc2626; }
.tl-alert.high { background: #fff7ed; border-left: 3px solid #f97316; }
.tl-alert.medium { background: #fefce8; border-left: 3px solid #eab308; }
.tl-alert.low { background: #f0fdf4; border-left: 3px solid #16a34a; }
.tl-alert-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}
.tl-alert-content {
  flex: 1;
}
.tl-alert-title {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 2px;
}
.tl-alert-desc {
  font-size: 12px;
  color: #5a5f6d;
  line-height: 1.4;
}

/* Advisory Tracker */
.tl-adv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tl-adv-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #1a1a1a;
  border-bottom: 2px solid #e5e7eb;
}
.tl-adv-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
  color: #1a1a1a;
}
.tl-adv-status {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  display: inline-block;
}
.tl-adv-status.delivered { background: #dcfce7; color: #166534; }
.tl-adv-status.pending { background: #fef3c7; color: #92400e; }
.tl-adv-status.overdue { background: #fee2e2; color: #991b1b; }

/* Idle rate bar */
.tl-idle-bar {
  width: 100%;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}
.tl-idle-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Filter buttons */
.tl-filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid #e5e7eb;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  color: #5a5f6d;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Inter', sans-serif;
}
.tl-filter-btn:hover {
  border-color: #3b7dd8;
  color: #3b7dd8;
}
.tl-filter-btn.active {
  background: #3b7dd8;
  color: #fff;
  border-color: #3b7dd8;
}

@media (max-width: 768px) {
  .tl-tabs {
    gap: 2px;
  }
  .tl-tab {
    padding: 8px 12px;
    font-size: 12px;
  }
  .tl-stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .tl-client-grid {
    grid-template-columns: 1fr;
  }
  .tl-va-table, .tl-adv-table {
    display: block;
    overflow-x: auto;
  }
}
