/**
 * accounts-manager.css
 * BAE-Quality Styles for Accounts Manager Page
 * 
 * Aligned with WowDash component patterns and Business Credit Journey Dashboard.
 * Phase 2C - UI Modernization
 * Phase 2D - BAE Polish & UX Alignment (Dec 13, 2025)
 * Phase 1 Token Integration - (Jan 2025)
 * Phase 1.1 Hotfix - Old Blue Cleanup (Dec 2025)
 * 
 * PHASE 2D IMPROVEMENTS:
 * - Added .accounts-kpi-row class with 24px bottom margin for consistent spacing
 * - Increased category tabs wrapper margin-bottom from 16px to 20px
 * - Changed inactive tab badges from primary blue to neutral soft badges (WowDash pattern)
 * - Added .row-selected class for visual feedback (bg tint + 3px left border)
 * - Set table td min-height: 68px to prevent row height variance from badge wrapping
 * - Added WowDash soft badge patterns: bg-success-subtle and bg-secondary-subtle
 * - Added .reports-badges class with flex layout for vertical alignment
 * - Improved table hover state contrast
 * 
 * PHASE 1 TOKEN INTEGRATION:
 * - Hero icon now uses var(--gbc-primary) with gradient fallback
 * - Active tabs use var(--gbc-primary) brand color
 * - Status colors mapped to token semantic variants
 * 
 * PHASE 1.1 CLEANUP:
 * - Removed legacy #487FFF references
 * - Links now use var(--gbc-link) token
 * - Focus states use var(--gbc-focus-ring) token
 * - KPI primary icon uses brand token
 */

/* =========================================================================
   HERO HEADER
   ========================================================================= */
.accounts-hero-wrapper {
  margin-bottom: 24px; /* Phase 2D: Consistent spacing */
}

.accounts-hero {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border: 1px solid #e3e6ef;
  border-radius: 16px;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.accounts-hero-left {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 1;
}

.accounts-hero-icon {
  width: 56px;
  height: 56px;
  /* Phase 1: Token-based primary with gradient fallback */
  background: linear-gradient(135deg, var(--gbc-primary, #303E8B) 0%, var(--gbc-primary-dark, #202C5D) 100%);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 28px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(48, 62, 139, 0.3);
}

.accounts-hero-text {
  flex: 1;
}

.accounts-hero-title {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 4px 0;
  line-height: 1.3;
}

.accounts-hero-subtitle {
  font-size: 14px;
  color: #64748b;
  margin: 0;
  line-height: 1.5;
}

.accounts-hero-right {
  display: flex;
  align-items: center;
}

/* Responsive hero */
@media (max-width: 991.98px) {
  .accounts-hero {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .accounts-hero-right {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 575.98px) {
  .accounts-hero {
    padding: 20px;
  }
  
  .accounts-hero-left {
    gap: 12px;
  }
  
  .accounts-hero-icon {
    width: 48px;
    height: 48px;
    font-size: 24px;
  }
  
  .accounts-hero-title {
    font-size: 20px;
  }
}

/* =========================================================================
   BREADCRUMB
   ========================================================================= */
.accounts-breadcrumb {
  margin-bottom: 12px;
}

.accounts-breadcrumb .breadcrumb {
  margin-bottom: 0;
  background: transparent;
  padding: 0;
  font-size: 0.875rem;
}

.accounts-breadcrumb .breadcrumb-item a {
  /* Phase 1.1: Use link token */
  color: var(--gbc-link, var(--gbc-secondary, #156888));
  text-decoration: none;
}

.accounts-breadcrumb .breadcrumb-item a:hover {
  text-decoration: underline;
}

.accounts-breadcrumb .breadcrumb-item.active {
  color: #64748b;
}

/* =========================================================================
   KPI CARDS (Phase 2D: Standardized 24px spacing)
   ========================================================================= */
.accounts-kpi-row {
  margin-bottom: 24px; /* Consistent gap before category tabs */
}

.accounts-kpi-card {
  background: #ffffff;
  border: 1px solid #e3e6ef;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  height: 100%;
}

.accounts-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.accounts-kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.accounts-kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.accounts-kpi-icon.primary {
  /* Phase 1.1: Use brand primary token */
  background: linear-gradient(135deg, rgba(48, 62, 139, 0.15) 0%, rgba(48, 62, 139, 0.05) 100%);
  color: var(--gbc-primary, #303E8B);
}

.accounts-kpi-icon.success {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.05) 100%);
  color: #22c55e;
}

.accounts-kpi-icon.warning {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(251, 191, 36, 0.05) 100%);
  color: #fbbf24;
}

.accounts-kpi-icon.info {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(6, 182, 212, 0.05) 100%);
  color: #06b6d4;
}

.accounts-kpi-label {
  font-size: 0.875rem;
  color: #64748b;
  margin-bottom: 4px;
  font-weight: 500;
}

.accounts-kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
  line-height: 1.2;
}

.accounts-kpi-secondary {
  font-size: 0.8125rem;
  color: #94a3b8;
  margin: 0;
}

.accounts-kpi-secondary strong {
  color: #64748b;
  font-weight: 600;
}

/* =========================================================================
   KPI ROW SPACING (Phase 2D: Consistent 24px gaps)
   ========================================================================= */
.accounts-kpi-row {
  margin-bottom: 24px;
}

/* =========================================================================
   CATEGORY TABS (Phase 2C-Refactor: Nav Pills Style)
   ========================================================================= */
.accounts-category-tabs-wrapper {
  background: #ffffff;
  border: 1px solid #e3e6ef;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 20px; /* Phase 2D: Increased from 16px for better spacing */
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.accounts-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.accounts-category-tabs .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid rgba(48, 62, 139, 0.3);
  border-radius: 999px;
  /* WAVE 1: White text on semi-transparent primary for all tabs */
  background: rgba(48, 62, 139, 0.65);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.accounts-category-tabs .nav-link:hover {
  background: rgba(48, 62, 139, 0.8);
  border-color: rgba(48, 62, 139, 0.5);
  color: #ffffff;
  text-decoration: none;
}

.accounts-category-tabs .nav-link.active {
  /* Phase 1: Token-based primary brand color */
  background: linear-gradient(135deg, var(--gbc-primary, #303E8B) 0%, var(--gbc-primary-dark, #202C5D) 100%);
  border-color: var(--gbc-primary, #303E8B);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(48, 62, 139, 0.25);
}

.accounts-category-tabs .nav-link .badge {
  /* WAVE 1: White text badges on all tabs */
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  min-width: 22px;
  text-align: center;
}

.accounts-category-tabs .nav-link.active .badge {
  /* Phase 2D: White overlay on active tab (correct WowDash pattern) */
  background-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.accounts-tab-context {
  padding-left: 4px;
  min-height: 20px;
}

.accounts-tab-context small {
  font-size: 0.8125rem;
  font-weight: 500;
}

@media (max-width: 575.98px) {
  .accounts-category-tabs .nav-link {
    font-size: 0.8125rem;
    padding: 8px 14px;
  }
}

/* =========================================================================
   CONTROLS BAR (WAVE 1: Simple 3-Line Layout)
   Line 1: Search | Line 2: Filters | Line 3: Clear + Toggle + Actions
   ========================================================================= */
.accounts-controls-bar {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.accounts-controls-bar #archivedBanner {
  border-left: 4px solid #ffc107;
  background: #fff9e6;
  border-radius: 8px;
}

/* Each row in the controls bar */
.controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* -------------------------------------------------------------------------
   LINE 1: Search (full width)
   ------------------------------------------------------------------------- */
.controls-search {
  width: 100%;
}

.search-wrapper {
  position: relative;
  width: 100%;
}

.search-wrapper .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
  width: 18px;
  height: 18px;
}

.search-wrapper .form-control {
  width: 100%;
  padding-left: 42px;
  padding-right: 40px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  font-size: 0.9375rem;
  background: #f8fafc;
  transition: all 0.2s ease;
}

.search-wrapper .form-control:focus {
  background: #ffffff;
  border-color: var(--gbc-primary, #303E8B);
  box-shadow: 0 0 0 3px rgba(48, 62, 139, 0.1);
}

.search-wrapper .form-control::placeholder {
  color: #94a3b8;
}

.search-wrapper .search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 6px;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.search-wrapper .search-clear:hover {
  color: #64748b;
  background: #f1f5f9;
}

/* -------------------------------------------------------------------------
   LINE 2: Filters (3 dropdowns)
   ------------------------------------------------------------------------- */
.controls-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.controls-filters .form-select {
  flex: 1;
  min-width: 140px;
  max-width: 200px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  font-size: 0.875rem;
  color: #475569;
  background-color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.controls-filters .form-select:focus {
  border-color: var(--gbc-primary, #303E8B);
  box-shadow: 0 0 0 3px rgba(48, 62, 139, 0.1);
}

.controls-filters .form-select:hover:not(:focus) {
  border-color: #cbd5e1;
}

/* -------------------------------------------------------------------------
   LINE 3: Actions (Clear left, Toggle + Bulk right)
   ------------------------------------------------------------------------- */
.controls-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.actions-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.actions-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Clear Button (subtle secondary) */
.btn-clear-filters {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #64748b;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-clear-filters:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}

.btn-clear-filters:active {
  background: #f1f5f9;
}

.btn-clear-filters iconify-icon {
  font-size: 16px;
}

/* Archived Toggle */
.toggle-archived {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.toggle-archived input {
  display: none;
}

.toggle-archived .toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  background: #e2e8f0;
  border-radius: 999px;
  transition: all 0.2s ease;
}

.toggle-archived .toggle-switch::after {
  content: '';
  position: absolute;
  left: 2px;
  top: 2px;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

.toggle-archived input:checked + .toggle-switch {
  background: var(--gbc-primary, #303E8B);
}

.toggle-archived input:checked + .toggle-switch::after {
  left: 18px;
}

.toggle-archived .toggle-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
}

.toggle-archived input:checked ~ .toggle-label {
  color: var(--gbc-primary, #303E8B);
}

/* Actions Divider */
.actions-divider {
  width: 1px;
  height: 24px;
  background: #e2e8f0;
}

/* Bulk Actions Container */
.bulk-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Bulk Action Buttons */
.btn-bulk {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-bulk iconify-icon {
  font-size: 16px;
}

.btn-bulk:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Secondary (Close, Reopen) */
.btn-bulk-secondary {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #64748b;
}

.btn-bulk-secondary:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}

/* Warning (Archive) */
.btn-bulk-warning {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

.btn-bulk-warning:hover:not(:disabled) {
  background: #fde68a;
  border-color: #fbbf24;
}

/* Success (Restore) */
.btn-bulk-success {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #065f46;
}

.btn-bulk-success:hover:not(:disabled) {
  background: #a7f3d0;
  border-color: #34d399;
}

/* Danger (Delete) */
.btn-bulk-danger {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.btn-bulk-danger:hover:not(:disabled) {
  background: #fecaca;
  border-color: #f87171;
}

/* =========================================================================
   CONTROLS BAR: Mobile Responsive (3-Line Layout)
   ========================================================================= */
@media (max-width: 767.98px) {
  /* Filters: wrap to 2 per row on tablet */
  .controls-filters .form-select {
    flex: 1 1 calc(50% - 5px);
    max-width: none;
  }
  
  /* Actions row: stack if needed */
  .controls-actions {
    flex-wrap: wrap;
  }
  
  .actions-right {
    flex-wrap: wrap;
    gap: 10px;
  }
  
  .actions-divider {
    display: none;
  }
}

@media (max-width: 575.98px) {
  .accounts-controls-bar {
    padding: 12px;
    gap: 10px;
  }
  
  /* Search: slightly smaller on mobile */
  .search-wrapper .form-control {
    height: 42px;
    font-size: 0.875rem;
  }
  
  /* Filters: full width each */
  .controls-filters {
    flex-direction: column;
  }
  
  .controls-filters .form-select {
    flex: none;
    width: 100%;
    max-width: none;
  }
  
  /* Actions: stack vertically */
  .controls-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  
  .actions-left {
    width: 100%;
  }
  
  .actions-left .btn-clear-filters {
    width: 100%;
    justify-content: center;
  }
  
  .actions-right {
    width: 100%;
    flex-direction: column;
    gap: 10px;
  }
  
  .toggle-archived {
    justify-content: space-between;
    padding: 10px 0;
    border-top: 1px solid #f1f5f9;
  }
  
  .bulk-actions {
    width: 100%;
  }
  
  .btn-bulk {
    flex: 1;
    justify-content: center;
  }
}

/* =========================================================================
   TABLE STYLING
   ========================================================================= */
.accounts-table-card {
  background: #ffffff;
  border: 1px solid #e3e6ef;
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
  overflow: hidden;
}

.accounts-table {
  margin-bottom: 0;
}

.accounts-table thead {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
}

.accounts-table thead th {
  padding: 14px 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  border-bottom: none;
}

.accounts-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background-color 0.15s ease;
}

.accounts-table tbody tr:hover {
  /* Phase 1.1: Use brand primary subtle */
  background-color: rgba(48, 62, 139, 0.03);
}

/* Phase 2D: Selected row visual feedback */
.accounts-table tbody tr.row-selected {
  /* Phase 1.1: Use brand primary */
  background-color: rgba(48, 62, 139, 0.06);
  border-left: 3px solid var(--gbc-primary, #303E8B);
}

.accounts-table tbody tr.row-selected td:first-child {
  padding-left: 9px; /* Compensate for 3px border */
}

.accounts-table tbody tr:last-child {
  border-bottom: none;
}

.accounts-table tbody td {
  padding: 16px 12px;
  vertical-align: middle;
  font-size: 0.875rem;
  color: #334155;
  min-height: 68px; /* Phase 2D: Prevent row height variance from badge wrapping */
}

/* Column alignments */
.accounts-table td:nth-child(1),
.accounts-table th:nth-child(1) {
  text-align: center;
  width: 48px;
  min-width: 48px;
  max-width: 48px;
}

/* WAVE 1 FIX: Checkbox cell explicit styling for reliable rendering */
.accounts-table .checkbox-cell {
  text-align: center;
  vertical-align: middle;
  padding: 12px 8px;
  width: 48px;
  min-width: 48px;
}

.accounts-table .checkbox-cell .form-check-input {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  border-radius: 4px;
  border: 1.5px solid #cbd5e1;
  background-color: #fff;
}

.accounts-table .checkbox-cell .form-check-input:checked {
  background-color: var(--gbc-primary, #303E8B);
  border-color: var(--gbc-primary, #303E8B);
}

.accounts-table .checkbox-cell .form-check-input:focus {
  box-shadow: 0 0 0 0.2rem rgba(48, 62, 139, 0.25);
  border-color: var(--gbc-primary, #303E8B);
}

.accounts-table .checkbox-cell .form-check-input:indeterminate {
  background-color: var(--gbc-primary, #303E8B);
  border-color: var(--gbc-primary, #303E8B);
}

.accounts-table td:nth-child(4),
.accounts-table td:nth-child(5),
.accounts-table td:nth-child(6) {
  text-align: right;
}

.accounts-table td:nth-child(8) {
  text-align: center;
}

.accounts-table td:last-child {
  text-align: center;
  width: 110px;
}

/* Status badges in table */
.accounts-table .badge {
  font-size: 0.75rem;
  padding: 4px 10px;
  font-weight: 500;
  border-radius: 999px;
}

/* Phase 2D: WowDash soft badge pattern for bureau reports */
.accounts-table .badge.bg-success-subtle {
  background-color: rgba(34, 197, 94, 0.1) !important;
  color: #16a34a;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.accounts-table .badge.bg-secondary-subtle {
  background-color: rgba(100, 116, 139, 0.1) !important;
  color: #64748b;
  border: 1px solid rgba(100, 116, 139, 0.2);
}

/* Reports column: flex container for vertical alignment */
.accounts-table td.reports-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  justify-content: center;
}

/* Action buttons */
.accounts-table .action-btn {
  opacity: 0.7;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.accounts-table tr:hover .action-btn {
  opacity: 1;
}

.accounts-table .action-btn:hover {
  transform: scale(1.1);
}

/* =========================================================================
   EMPTY STATES
   ========================================================================= */
.accounts-empty-state {
  text-align: center;
  padding: 60px 20px;
  background: #ffffff;
}

.accounts-empty-icon {
  font-size: 80px;
  color: #cbd5e1;
  opacity: 0.5;
  margin-bottom: 16px;
}

.accounts-empty-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 8px;
}

.accounts-empty-text {
  font-size: 0.9375rem;
  color: #64748b;
  max-width: 400px;
  margin: 0 auto 20px;
  line-height: 1.6;
}

.accounts-empty-cta {
  margin-top: 16px;
}

/* Filtered empty state (lighter styling) */
.accounts-empty-filtered {
  padding: 40px 20px;
}

.accounts-empty-filtered .accounts-empty-icon {
  font-size: 60px;
  opacity: 0.3;
}

.accounts-empty-filtered .accounts-empty-title {
  font-size: 1.125rem;
}

/* =========================================================================
   MODAL ENHANCEMENTS (Phase 2C-Refactor: Improved Scroll Behavior)
   ========================================================================= */

/* Ensure modal content fits within viewport and scrolls properly */
#accountModalDialog,
#acctModal .modal-dialog {
  max-height: calc(100vh - 2rem);
  margin: 1rem auto;
}

#accountModalDialog .modal-content,
#acctModal .modal-content {
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
}

#accountModalDialog .modal-body,
#acctModal .modal-body {
  overflow-y: auto;
  flex: 1 1 auto;
  max-height: calc(100vh - 200px); /* Account for header + footer */
}

/* Delete confirmation modal */
#confirmDelete .modal-dialog {
  margin-top: 10vh;
}

#confirmDelete .modal-header.bg-danger {
  color: #ffffff;
}

#confirmDelete .btn-close-white {
  filter: brightness(0) invert(1);
}

.modal-content {
  border-radius: 16px;
  border: 1px solid #e3e6ef;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.15);
}

.modal-header {
  border-bottom: 1px solid #f1f5f9;
  padding: 20px 24px;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #0f172a;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  border-top: 1px solid #f1f5f9;
  padding: 16px 24px;
}

/* Form sections in modal */
.form-section {
  margin-bottom: 24px;
}

.form-section:last-child {
  margin-bottom: 0;
}

.form-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

.form-section .form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #334155;
  margin-bottom: 6px;
}

.form-section .form-control,
.form-section .form-select {
  border-radius: 8px;
  border-color: #e2e8f0;
  font-size: 0.875rem;
}

.form-section .form-control:focus,
.form-section .form-select:focus {
  /* Phase 1.1: Use focus ring token */
  border-color: var(--gbc-focus-ring, var(--gbc-primary, #303E8B));
  box-shadow: 0 0 0 3px var(--gbc-focus-ring-shadow, rgba(48, 62, 139, 0.15));
}

.form-helper-text {
  font-size: 0.75rem;
  color: #94a3b8;
  font-style: italic;
  margin-top: 4px;
  margin-bottom: 0;
}

/* Pill-style checkboxes for bureau reporting */
.form-check-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.form-check-pill {
  position: relative;
  margin: 0;
}

.form-check-pill input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.form-check-pill label {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border: 1.5px solid #e2e8f0;
  border-radius: 999px;
  background: #ffffff;
  color: #64748b;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 0;
}

.form-check-pill input[type="checkbox"]:checked + label {
  /* Phase 1.1: Use brand primary gradient */
  background: linear-gradient(135deg, var(--gbc-primary, #303E8B) 0%, var(--gbc-primary-dark, #202C5D) 100%);
  border-color: var(--gbc-primary, #303E8B);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(48, 62, 139, 0.25);
}

.form-check-pill label:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.form-check-pill input[type="checkbox"]:checked + label:hover {
  background: linear-gradient(135deg, #3d70e8 0%, #2d5de0 100%);
}

/* Primary account toggle */
.form-check-primary {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-top: 8px;
}

.form-check-primary .form-check-input {
  width: 20px;
  height: 20px;
  margin-right: 10px;
  cursor: pointer;
}

.form-check-primary .form-check-label {
  font-size: 0.875rem;
  color: #475569;
  margin: 0;
  cursor: pointer;
  flex: 1;
}

.form-check-primary .form-helper-text {
  margin-top: 4px;
  margin-left: 30px;
}

/* =========================================================================
   UTILITY CLASSES
   ========================================================================= */
.mb-20 {
  margin-bottom: 20px !important;
}

.mb-28 {
  margin-bottom: 28px !important;
}

.radius-16 {
  border-radius: 16px !important;
}

/* Loading states */
.placeholder-shimmer {
  animation: shimmer 1.5s infinite;
  background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
  background-size: 200% 100%;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* =========================================================================
   VENDOR LOGOS (Wave 1 P0 - Prompt 9E + Sanity Patch)
   Hard thumbnail constraints to prevent table layout blowups
   ========================================================================= */

/* Vendor logo wrapper - fixed size container (table rows) */
.vendor-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  max-width: 18px;
  max-height: 18px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 4px;
}

/* Vendor logo - small (table rows) - scoped to accounts table */
.accounts-table .vendor-logo,
#accountsTable .vendor-logo,
.vendor-logo-wrap .vendor-logo {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  min-width: 18px;
  min-height: 18px;
  border-radius: 4px;
  object-fit: contain;
  border: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
  display: block;
}

/* Vendor logo - large (modal preview) */
.vendor-logo-lg,
.vendor-preview .vendor-logo-lg {
  width: 28px !important;
  height: 28px !important;
  max-width: 28px !important;
  max-height: 28px !important;
  min-width: 28px;
  min-height: 28px;
  border-radius: 6px;
  object-fit: contain;
  border: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

/* Vendor fallback badge (when no image) */
.vendor-fallback {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  border-radius: 4px;
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  color: #475569;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Vendor fallback - large (modal preview) */
.vendor-fallback-lg {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: 6px;
  font-size: 14px;
}

/* Provider cell wrapper for vendor accounts */
.vendor-provider-wrap {
  font-weight: 500;
}

/* Vendor subtitle row - flex layout for logo + text alignment */
.vendor-subtitle-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  line-height: 1.2;
}

/* Vendor preview in modal */
.vendor-preview {
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  max-width: 100%;
  overflow: hidden;
}

.vendor-preview-inner {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Ensure table cells have proper vertical alignment */
.accounts-table td {
  vertical-align: middle;
}

/* =========================================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================================= */
@media (max-width: 991.98px) {
  .accounts-kpi-value {
    font-size: 1.5rem;
  }
}

@media (max-width: 767.98px) {
  .accounts-table thead th,
  .accounts-table tbody td {
    padding: 10px 8px;
    font-size: 0.8125rem;
  }
  
  .accounts-kpi-card {
    padding: 16px;
  }
  
  .accounts-kpi-value {
    font-size: 1.375rem;
  }
}

@media (max-width: 575.98px) {
  .modal-body,
  .modal-header,
  .modal-footer {
    padding: 16px;
  }
  
  .form-section {
    margin-bottom: 20px;
  }
}

/* =========================================================================
   MOBILE 375px BASELINE - Critical overflow fixes
   ========================================================================= */
@media (max-width: 400px) {
  /* Hero section */
  .accounts-hero {
    padding: 16px;
    gap: 16px;
  }
  
  .accounts-hero-icon {
    width: 44px;
    height: 44px;
    font-size: 22px;
    border-radius: 12px;
  }
  
  .accounts-hero-title {
    font-size: 18px;
  }
  
  .accounts-hero-subtitle {
    font-size: 13px;
  }
  
  .accounts-hero-right .btn {
    width: 100%;
    padding: 12px 16px;
  }
  
  /* Category tabs - ensure no overflow */
  .accounts-category-tabs-wrapper {
    padding: 12px;
  }
  
  .accounts-category-tabs {
    gap: 6px;
  }
  
  .accounts-category-tabs .nav-link {
    font-size: 0.75rem;
    padding: 8px 10px;
  }
  
  /* Table wrapper - horizontal scroll inside container */
  .accounts-table-card {
    border-radius: 12px;
  }
  
  .accounts-table-card .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
  }
  
  .accounts-table {
    min-width: 700px;
  }
  
  /* KPI cards */
  .accounts-kpi-card {
    padding: 14px;
  }
  
  .accounts-kpi-value {
    font-size: 1.25rem;
  }
  
  .accounts-kpi-label {
    font-size: 0.8125rem;
  }
  
  /* Modal improvements */
  #accountModalDialog,
  #acctModal .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }
  
  #accountModalDialog .modal-body,
  #acctModal .modal-body {
    max-height: calc(100vh - 160px);
    padding: 12px;
  }
  
  .form-section-title {
    font-size: 0.8125rem;
  }
  
  /* Bulk actions - touch friendly */
  .btn-bulk {
    min-height: 44px;
    padding: 0 10px;
  }
  
  /* Toggle switch */
  .toggle-archived {
    min-height: 44px;
  }
}
