/* ==========================================================================
   Matrix OSINT — Guided "Add a Person" Target Modal (Phase 1)
   Light theme default (#FFFFFF cards, #F6F7F9 base, #E2E8F0 borders),
   with WCAG AA contrast, dark theme compatibility, and mobile responsiveness.
   ========================================================================== */

/* --- Backdrop & Container --- */
.target-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.target-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.target-modal-container {
  background: #FFFFFF;
  color: #0F172A;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  border-radius: 14px;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(8px) scale(0.985);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.target-modal-backdrop.open .target-modal-container {
  transform: translateY(0) scale(1);
}

/* Dark mode theme support */
body:not(.light-theme) .target-modal-container {
  background: #121C29;
  color: #E8EDF5;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.12);
}

/* --- Header --- */
.target-modal-header {
  padding: 20px 24px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid #E2E8F0;
}

body:not(.light-theme) .target-modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.target-modal-title {
  font-size: 19px;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: #0F172A;
  letter-spacing: -0.02em;
}

body:not(.light-theme) .target-modal-title {
  color: #E8EDF5;
}

.target-modal-subtitle {
  font-size: 13px;
  color: #64748B;
  margin: 0;
}

body:not(.light-theme) .target-modal-subtitle {
  color: #91A0B5;
}

.target-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.target-modal-esc-hint {
  font-size: 11px;
  color: #94A3B8;
  font-weight: 500;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 2px 7px;
  background: #F8FAFC;
}

body:not(.light-theme) .target-modal-esc-hint {
  color: #6C7D96;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}

.target-modal-close-btn {
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: #64748B;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.target-modal-close-btn:hover {
  background: #F1F5F9;
  color: #0F172A;
}

body:not(.light-theme) .target-modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
}

/* --- Steps Indicator --- */
.target-steps-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: #F8FAFC;
  border-bottom: 1px solid #E2E8F0;
  font-size: 13px;
}

body:not(.light-theme) .target-steps-indicator {
  background: #0D1520;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.target-step-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #94A3B8;
  font-weight: 500;
}

.target-step-item.active {
  color: #1E40AF;
  font-weight: 600;
}

body:not(.light-theme) .target-step-item.active {
  color: #60A5FA;
}

.target-step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #E2E8F0;
  color: #64748B;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.target-step-item.active .target-step-num {
  background: #2563EB;
  color: #FFFFFF;
}

.target-step-chevron {
  color: #CBD5E1;
  font-size: 14px;
}

body:not(.light-theme) .target-step-chevron {
  color: rgba(255, 255, 255, 0.2);
}

/* --- Step Content Body --- */
.target-step-pane {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 280px;
  max-height: calc(90vh - 200px);
}

/* --- Search Input Box --- */
.target-search-box {
  display: flex;
  align-items: center;
  position: relative;
  border: 1px solid #CBD5E1;
  border-radius: 9px;
  background: #FFFFFF;
  padding: 4px 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
}

.target-search-box:focus-within {
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

body:not(.light-theme) .target-search-box {
  background: #080D14;
  border-color: rgba(255, 255, 255, 0.15);
}

body:not(.light-theme) .target-search-box:focus-within {
  border-color: #4F83F1;
  box-shadow: 0 0 0 3px rgba(79, 131, 241, 0.2);
}

.target-search-icon {
  color: #64748B;
  margin-right: 8px;
  flex-shrink: 0;
}

.target-search-input {
  border: none;
  background: transparent;
  width: 100%;
  font-size: 14px;
  color: #0F172A;
  padding: 8px 0;
  outline: none;
  font-family: inherit;
}

body:not(.light-theme) .target-search-input {
  color: #E8EDF5;
}

.target-search-input::placeholder {
  color: #94A3B8;
}

.target-match-counter {
  font-size: 12px;
  color: #64748B;
  background: #F1F5F9;
  border-radius: 6px;
  padding: 2px 8px;
  margin-right: 6px;
  white-space: nowrap;
}

body:not(.light-theme) .target-match-counter {
  background: rgba(255, 255, 255, 0.08);
  color: #91A0B5;
}

.target-search-clear {
  background: transparent;
  border: none;
  font-size: 16px;
  color: #94A3B8;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.target-search-clear:hover {
  color: #0F172A;
  background: #F1F5F9;
}

.target-search-helper-text {
  font-size: 12px;
  color: #64748B;
  margin-top: 8px;
  margin-bottom: 16px;
}

.target-search-helper-text code {
  background: #F1F5F9;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
  color: #1E293B;
}

body:not(.light-theme) .target-search-helper-text code {
  background: rgba(255, 255, 255, 0.08);
  color: #E2E8F0;
}

/* --- Results Groups --- */
.target-results-group {
  margin-bottom: 20px;
}

.target-group-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
  margin-bottom: 10px;
}

body:not(.light-theme) .target-group-title {
  color: #91A0B5;
}

.target-cards-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Target Account Card */
.target-account-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.target-account-card:hover {
  background: #F8FAFC;
  border-color: #CBD5E1;
}

.target-account-card.selected {
  border-color: #2563EB;
  background: #EFF6FF;
  box-shadow: 0 0 0 1px #2563EB;
}

body:not(.light-theme) .target-account-card {
  background: #0D1520;
  border-color: rgba(255, 255, 255, 0.08);
}

body:not(.light-theme) .target-account-card:hover {
  background: #172333;
}

body:not(.light-theme) .target-account-card.selected {
  border-color: #4F83F1;
  background: rgba(79, 131, 241, 0.12);
  box-shadow: 0 0 0 1px #4F83F1;
}

.target-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.target-checkbox {
  width: 17px;
  height: 17px;
  accent-color: #2563EB;
  cursor: pointer;
  flex-shrink: 0;
}

.target-avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #E2E8F0;
  color: #334155;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.target-avatar-circle.green {
  background: #DCFCE7;
  color: #166534;
}

body:not(.light-theme) .target-avatar-circle {
  background: #172333;
  color: #E8EDF5;
}

body:not(.light-theme) .target-avatar-circle.green {
  background: rgba(22, 199, 132, 0.18);
  color: #16C784;
}

.target-info-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.target-meta-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.target-card-handle {
  font-size: 14px;
  font-weight: 600;
  color: #0F172A;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body:not(.light-theme) .target-card-handle {
  color: #E8EDF5;
}

.target-plat-badge {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 4px;
  font-weight: 500;
  background: #F1F5F9;
  color: #475569;
  border: 1px solid #E2E8F0;
}

body:not(.light-theme) .target-plat-badge {
  background: rgba(255, 255, 255, 0.06);
  color: #91A0B5;
  border-color: rgba(255, 255, 255, 0.1);
}

.target-status-badge {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 4px;
  font-weight: 600;
}

.target-status-badge.monitoring {
  background: #DCFCE7;
  color: #15803D;
  border: 1px solid #BBF7D0;
}

.target-status-badge.verified {
  background: #EFF6FF;
  color: #2563EB;
  border: 1px solid #BFDBFE;
}

.target-status-badge.not-verified {
  background: #FEF3C7;
  color: #D97706;
  border: 1px solid #FDE68A;
}

.target-status-badge.guess {
  background: #F1F5F9;
  color: #64748B;
  border: 1px solid #E2E8F0;
}

body:not(.light-theme) .target-status-badge.monitoring {
  background: rgba(22, 199, 132, 0.15);
  color: #16C784;
  border-color: rgba(22, 199, 132, 0.3);
}

body:not(.light-theme) .target-status-badge.verified {
  background: rgba(79, 131, 241, 0.15);
  color: #4F83F1;
  border-color: rgba(79, 131, 241, 0.3);
}

body:not(.light-theme) .target-status-badge.not-verified {
  background: rgba(232, 180, 90, 0.15);
  color: #E8B45A;
  border-color: rgba(232, 180, 90, 0.3);
}

body:not(.light-theme) .target-status-badge.guess {
  background: rgba(255, 255, 255, 0.06);
  color: #91A0B5;
  border-color: rgba(255, 255, 255, 0.1);
}

.target-sub-line {
  font-size: 12px;
  color: #64748B;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body:not(.light-theme) .target-sub-line {
  color: #91A0B5;
}

.target-btn-open-monitored {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #1E293B;
  cursor: pointer;
  transition: all 0.15s ease;
}

.target-btn-open-monitored:hover {
  background: #F1F5F9;
  border-color: #94A3B8;
}

body:not(.light-theme) .target-btn-open-monitored {
  background: #172333;
  border-color: rgba(255, 255, 255, 0.15);
  color: #E8EDF5;
}

/* --- Form Fields for Step 3 --- */
.target-form-field {
  margin-bottom: 20px;
}

.target-field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #0F172A;
  margin-bottom: 4px;
}

body:not(.light-theme) .target-field-label {
  color: #E8EDF5;
}

.target-field-required {
  color: #EF4444;
}

.target-field-hint {
  font-size: 12px;
  color: #64748B;
  margin: 0 0 8px 0;
}

body:not(.light-theme) .target-field-hint {
  color: #91A0B5;
}

.target-textarea {
  width: 100%;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
  color: #0F172A;
  background: #FFFFFF;
  resize: vertical;
  min-height: 80px;
}

.target-textarea:focus {
  outline: none;
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

body:not(.light-theme) .target-textarea {
  background: #080D14;
  border-color: rgba(255, 255, 255, 0.15);
  color: #E8EDF5;
}

.target-field-error {
  font-size: 12px;
  color: #DC2626;
  margin-top: 6px;
  font-weight: 500;
}

/* System Policy Card in Step 3 */
.target-policy-notice-card {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 16px;
}

body:not(.light-theme) .target-policy-notice-card {
  background: #0D1520;
  border-color: rgba(255, 255, 255, 0.08);
}

.target-policy-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
  margin-bottom: 8px;
}

body:not(.light-theme) .target-policy-title {
  color: #91A0B5;
}

.target-policy-row {
  display: flex;
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 4px;
}

.target-policy-label {
  font-weight: 600;
  color: #334155;
  width: 120px;
  flex-shrink: 0;
}

body:not(.light-theme) .target-policy-label {
  color: #CBD5E1;
}

.target-policy-value {
  color: #64748B;
  flex: 1;
}

body:not(.light-theme) .target-policy-value {
  color: #91A0B5;
}

/* --- Footer Controls --- */
.target-modal-footer {
  padding: 14px 24px;
  border-top: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFFFFF;
}

body:not(.light-theme) .target-modal-footer {
  border-top-color: rgba(255, 255, 255, 0.08);
  background: #121C29;
}

.target-footer-info {
  font-size: 13px;
  color: #475569;
  font-weight: 500;
}

body:not(.light-theme) .target-footer-info {
  color: #91A0B5;
}

.target-footer-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.target-btn-secondary {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.target-btn-secondary:hover {
  background: #F1F5F9;
  border-color: #94A3B8;
  color: #0F172A;
}

body:not(.light-theme) .target-btn-secondary {
  background: #172333;
  border-color: rgba(255, 255, 255, 0.15);
  color: #E8EDF5;
}

.target-btn-primary {
  background: #2563EB;
  border: 1px solid #1D4ED8;
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 18px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.target-btn-primary:hover:not(:disabled) {
  background: #1D4ED8;
}

.target-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* Spinner & States */
.target-loading-state,
.target-empty-state {
  text-align: center;
  padding: 32px 16px;
  color: #64748B;
  font-size: 13px;
}

.target-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid #CBD5E1;
  border-top-color: #2563EB;
  border-radius: 50%;
  animation: targetSpin 0.7s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

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

/* --- Responsive Layout (Mobile <= 540px) --- */
@media (max-width: 540px) {
  .target-modal-container {
    max-height: 95vh;
  }
  .target-modal-header,
  .target-step-pane,
  .target-modal-footer {
    padding-left: 16px;
    padding-right: 16px;
  }
  .target-steps-indicator {
    padding-left: 16px;
    padding-right: 16px;
    font-size: 12px;
  }
  .target-modal-esc-hint {
    display: none;
  }
}


/* ==========================================================================
   Matrix OSINT — Admin Target Overview Workspace ("Who is monitoring whom")
   Clean, light-theme white/grey design (#FFFFFF, #F8FAFC, #E2E8F0),
   WCAG AA contrast, dark theme compatibility, responsive table to cards.
   ========================================================================== */

.tg-overview-workspace {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
  box-sizing: border-box;
}

/* --- Header Row --- */
.tg-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.tg-header-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tg-page-title {
  font-size: 24px;
  font-weight: 700;
  color: #0F172A;
  margin: 0;
  letter-spacing: -0.02em;
}

.tg-page-subtitle {
  font-size: 13px;
  color: #64748B;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tg-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tg-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #0F172A;
  color: #FFFFFF;
  border: 1px solid #0F172A;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tg-btn-primary:hover {
  background: #1E293B;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.12);
}

.tg-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #FFFFFF;
  color: #0F172A;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tg-btn-secondary:hover {
  background: #F8FAFC;
  border-color: #CBD5E1;
}

/* --- Quotas & Surveillance Limits Panel --- */
.tg-quotas-panel {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.tg-quotas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.tg-quotas-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tg-quotas-title {
  font-size: 15px;
  font-weight: 700;
  color: #0F172A;
  letter-spacing: -0.01em;
}

.tg-quotas-badge {
  font-size: 12px;
  color: #475569;
  background: #F1F5F9;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid #E2E8F0;
}

.tg-quotas-badge strong {
  color: #0F172A;
}

.tg-quotas-actions {
  display: flex;
  gap: 8px;
}

.tg-btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.tg-quotas-cards-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}

.tg-quota-meter-card {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease;
}

.tg-quota-meter-card:hover {
  border-color: #CBD5E1;
}

.tg-quota-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.tg-quota-plat-title {
  font-size: 12px;
  font-weight: 700;
  color: #1E293B;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tg-quota-stat-pill {
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  font-variant-numeric: tabular-nums;
}

.tg-quota-bar-track {
  height: 6px;
  background: #E2E8F0;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.tg-quota-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: #2563EB;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.tg-quota-bar-fill.safe {
  background: #16A34A;
}

.tg-quota-bar-fill.warn {
  background: #D97706;
}

.tg-quota-bar-fill.danger {
  background: #DC2626;
}

.tg-quota-card-footer {
  font-size: 11px;
  color: #64748B;
  display: flex;
  justify-content: space-between;
}

.tg-quota-sum-valid {
  background: #ECFDF5 !important;
  color: #065F46 !important;
  border-color: #A7F3D0 !important;
}

.tg-quota-sum-invalid {
  background: #FEF2F2 !important;
  color: #991B1B !important;
  border-color: #FECACA !important;
}

.tg-quota-current-hint {
  font-size: 11px;
  color: #64748B;
  margin-top: 4px;
  display: block;
}

/* --- Summary 6-KPI Grid --- */
.tg-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.tg-kpi-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tg-kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.06);
}

.tg-kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748B;
  margin-bottom: 6px;
}

.tg-kpi-val {
  font-size: 26px;
  font-weight: 700;
  color: #0F172A;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.tg-kpi-sub {
  font-size: 11px;
  color: #94A3B8;
  margin-top: 4px;
}

.tg-kpi-danger .tg-kpi-val {
  color: #DC2626;
}

/* --- Filter & Search Toolbar --- */
.tg-filter-toolbar {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.tg-toolbar-top-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.tg-search-wrap {
  flex: 1;
  min-width: 240px;
  position: relative;
}

.tg-search-input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  font-size: 13px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  background: #F8FAFC;
  color: #0F172A;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
  box-sizing: border-box;
}

.tg-search-input:focus {
  border-color: #2563EB;
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.tg-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: #94A3B8;
  pointer-events: none;
}

.tg-filter-group {
  display: flex;
  align-items: center;
  background: #F1F5F9;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.tg-filter-btn {
  background: transparent;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #64748B;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tg-filter-btn:hover:not(.active) {
  color: #0F172A;
  background: rgba(255, 255, 255, 0.6);
}

.tg-filter-btn.active {
  background: #FFFFFF;
  color: #0F172A;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.tg-chk-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #64748B;
  cursor: pointer;
  user-select: none;
}

/* --- Operator Chips Row --- */
.tg-user-chips-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tg-chips-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748B;
  white-space: nowrap;
}

.tg-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.tg-filter-chip:hover:not(.active) {
  background: #F1F5F9;
  border-color: #CBD5E1;
}

.tg-filter-chip.active {
  background: #0F172A;
  border-color: #0F172A;
  color: #FFFFFF;
}

.tg-chip-badge {
  display: inline-block;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
}

.tg-filter-chip.active .tg-chip-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

/* --- Table Styles (Desktop) --- */
.tg-table-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.tg-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.tg-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.tg-table th {
  background: #F8FAFC;
  color: #64748B;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 14px;
  border-bottom: 1px solid #E2E8F0;
  white-space: nowrap;
}

.tg-table td {
  padding: 14px;
  border-bottom: 1px solid #F1F5F9;
  color: #334155;
  vertical-align: middle;
}

.tg-table-row:hover {
  background: #F8FAFC;
}

.tg-table-row.row-removed {
  opacity: 0.6;
  background: #FAFAFA;
}

/* Person Cell */
.tg-person-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tg-avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #E2E8F0;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tg-person-meta {
  display: flex;
  flex-direction: column;
}

.tg-display-name {
  font-weight: 600;
  color: #0F172A;
}

.tg-case-label {
  font-size: 11px;
  color: #94A3B8;
}

.tg-platform-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #475569;
  text-transform: capitalize;
}

.tg-handle-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: #0F172A;
}

.tg-added-by-btn {
  background: transparent;
  border: none;
  color: #2563EB;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.tg-added-by-btn:hover {
  color: #1D4ED8;
}

.tg-reason-truncate {
  display: block;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  color: #64748B;
}

/* Status Pills */
.tg-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.tg-status-pill.pill-active {
  background: #ECFDF5;
  color: #065F46;
}

.tg-status-pill.pill-queued {
  background: #FFFBEB;
  color: #92400E;
}

.tg-status-pill.pill-failed {
  background: #FEF2F2;
  color: #991B1B;
}

.tg-status-pill.pill-removed {
  background: #F1F5F9;
  color: #64748B;
}

/* Tier Pills */
.tg-tier-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.tg-tier-pill.tier1 {
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}

.tg-tier-pill.tier2 {
  background: #F8FAFC;
  color: #475569;
  border: 1px solid #E2E8F0;
}

.tg-tier-pill.tier3 {
  background: #F1F5F9;
  color: #64748B;
}

.tg-tier-pill.tier-none {
  color: #94A3B8;
}

.tg-override-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  background: #FEF3C7;
  color: #B45309;
  padding: 1px 4px;
  border-radius: 4px;
  text-transform: uppercase;
}

.tg-posts-count {
  font-weight: 600;
  color: #0F172A;
  font-variant-numeric: tabular-nums;
}

/* Row Action Buttons */
.tg-actions-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tg-btn-action {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tg-btn-action:hover {
  background: #F8FAFC;
  border-color: #94A3B8;
}

.tg-btn-action.btn-retry {
  background: #FEF2F2;
  color: #B91C1C;
  border-color: #FECACA;
}

.tg-btn-action.btn-retry:hover {
  background: #FEE2E2;
}

.tg-btn-action.btn-remove {
  color: #64748B;
}

.tg-btn-action.btn-remove:hover {
  color: #DC2626;
  border-color: #FCA5A5;
}

/* --- Mobile Cards Layout (Hidden on Desktop) --- */
.tg-mobile-cards-container {
  display: none;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}

.tg-mobile-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.tg-mobile-card.card-removed {
  opacity: 0.6;
}

.tg-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #F1F5F9;
}

.tg-card-header-meta {
  flex: 1;
}

.tg-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  margin-bottom: 12px;
}

.tg-card-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.tg-card-label {
  color: #64748B;
  font-weight: 500;
}

.tg-card-val {
  color: #0F172A;
  font-weight: 600;
  text-align: right;
}

.tg-card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid #F1F5F9;
}

/* --- Pagination Controls --- */
.tg-pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid #E2E8F0;
  background: #F8FAFC;
}

.tg-page-info {
  font-size: 12px;
  color: #64748B;
}

.tg-pagination-btns {
  display: flex;
  gap: 8px;
}

.tg-btn-page {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
}

.tg-btn-page:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Change Tier Modal --- */
.tg-tier-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.tg-tier-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.tg-tier-modal-card {
  background: #FFFFFF;
  border-radius: 12px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.tg-tier-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #E2E8F0;
}

.tg-tier-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #0F172A;
  margin: 0;
}

.tg-tier-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tg-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tg-form-label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.tg-form-select,
.tg-form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  font-size: 13px;
  box-sizing: border-box;
}

.tg-tier-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  background: #F8FAFC;
  border-top: 1px solid #E2E8F0;
}

/* --- My Targets Modal (Scoped user view) --- */
.tg-my-targets-modal-card {
  background: #FFFFFF;
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.tg-my-targets-body {
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tg-my-target-item {
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 12px;
  background: #F8FAFC;
}

.tg-my-target-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.tg-my-target-name {
  font-weight: 700;
  color: #0F172A;
}

.tg-my-target-reason {
  font-size: 12px;
  color: #475569;
  margin-bottom: 6px;
}

.tg-my-target-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: #64748B;
}

/* --- Responsive Media Queries --- */
@media (max-width: 1024px) {
  .tg-summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .tg-table-wrap {
    display: none;
  }
  .tg-mobile-cards-container {
    display: flex;
  }
  .tg-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 390px) {
  .tg-overview-workspace {
    padding: 12px;
  }
  .tg-summary-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .tg-toolbar-top-row {
    flex-direction: column;
    align-items: stretch;
  }
  .tg-filter-group {
    overflow-x: auto;
  }
}

/* Add person, step 2: account existence check */
.target-verify-summary { margin: 0 0 10px; padding: 9px 12px; border-radius: 10px; font-size: 13px; background: var(--bg-elevated, rgba(0,0,0,0.04)); color: var(--text-secondary, #4b5563); }
.target-verify-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.target-verify-badge-checking { background: rgba(107,114,128,0.15); color: var(--text-secondary, #4b5563); }
.target-verify-badge-ok { background: rgba(22,163,74,0.15); color: #15803d; }
.target-verify-badge-bad { background: rgba(220,38,38,0.14); color: #b91c1c; }
.target-verify-badge-warn { background: rgba(217,119,6,0.16); color: #92400e; }
.target-account-card.target-verify-not_found { border-color: #FCA5A5; background: rgba(220,38,38,0.05); }
.target-account-card.target-verify-unknown { border-color: #FCD34D; }
.target-account-card.target-verify-checking .target-sub-line::after { content: ""; display: inline-block; width: 10px; height: 10px; margin-left: 6px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: target-verify-spin 0.8s linear infinite; vertical-align: -1px; }
@keyframes target-verify-spin { to { transform: rotate(360deg); } }
.target-verify-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
@media (max-width: 600px) {
  .target-account-card { flex-wrap: wrap; row-gap: 8px; }
  .target-account-card .target-card-left { flex: 1 1 100%; }
  .target-account-card .target-info-wrap { min-width: 0; }
  .target-account-card .target-sub-line { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
  .target-account-card .target-meta-line { flex-wrap: wrap; row-gap: 4px; }
  .target-verify-actions { width: 100%; justify-content: flex-start; }
  .target-verify-actions .target-btn-open-monitored { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) { .target-account-card.target-verify-checking .target-sub-line::after { animation: none; } }
