/* ==========================================================================
   SETTINGS VIEW — 7-tab admin settings page
   Extracted from mockups/acq-lead-pipeline-v2.html (lines 898-1575, 1825-1843)
   ========================================================================== */

/* ===== VIEW WRAPPER ===== */
.settings-view {
  max-width: 1280px; margin: 0 auto;
  padding: var(--s-6) var(--s-8);
  animation: settingsReveal 400ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes settingsReveal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.set-page-title {
  font-size: 24px; font-weight: 800; color: var(--gray-900);
  margin-bottom: var(--s-6); letter-spacing: -0.5px;
  display: flex; align-items: center; gap: var(--s-3);
}
.set-page-title::before {
  content: ''; width: 4px; height: 24px;
  background: linear-gradient(180deg, var(--brand), var(--brand-light));
  border-radius: 2px; flex-shrink: 0;
}

/* ===== CONTAINER — sidebar + content grid ===== */
.set-container {
  display: grid; grid-template-columns: 220px 1fr;
  background: var(--white); border-radius: var(--r-xl);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(0,0,0,0.02);
  overflow: hidden; min-height: 680px;
}

/* ===== SIDEBAR ===== */
.set-sidebar {
  background: linear-gradient(180deg, var(--gray-50) 0%, var(--gray-100) 100%);
  padding: var(--s-4) var(--s-3);
  border-right: 1px solid var(--gray-200);
}
.set-tab {
  font-size: 13px; font-weight: 500; color: var(--gray-500);
  padding: 10px var(--s-3); border-radius: var(--r-md);
  cursor: pointer; transition: all 180ms cubic-bezier(0.22, 1, 0.36, 1);
  display: flex; align-items: center; gap: var(--s-2); margin-bottom: 2px;
  position: relative; border-left: 3px solid transparent;
  border: none; background: none; width: 100%; text-align: left;
}
.set-tab:hover {
  background: rgba(255,255,255,0.8); color: var(--gray-700);
  border-left-color: var(--gray-300);
}
.set-tab.active {
  background: var(--white); color: var(--brand-dark, var(--brand)); font-weight: 600;
  box-shadow: var(--shadow-sm);
  border-left-color: var(--brand);
}
.set-tab i { width: 16px; height: 16px; flex-shrink: 0; }

/* ===== CONTENT AREA ===== */
.set-content { padding: var(--s-8); }

/* Panel animation */
.set-panel {
  animation: panelFadeIn 250ms ease;
}
@keyframes panelFadeIn {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Section headings */
.set-title {
  font-size: 20px; font-weight: 700; color: var(--gray-900);
  margin-bottom: var(--s-1-5); line-height: 1.3; letter-spacing: -0.3px;
}
.set-desc {
  font-size: 13px; color: var(--gray-500); margin-bottom: var(--s-6);
  line-height: 1.6; max-width: 640px;
}

/* ===== SHARED FORM CONTROLS ===== */
.set-label {
  font-size: 13px; font-weight: 600; color: var(--gray-700);
  margin-bottom: var(--s-1-5); display: block;
}
.set-hint {
  font-size: 12px; font-weight: 400; color: var(--gray-400); margin-left: var(--s-1);
}
.set-input, .set-select, .set-textarea {
  width: 100%; background: var(--white);
  border: 1px solid var(--gray-300); border-radius: var(--r-md);
  font-family: var(--font-sans); font-size: 14px; line-height: 1.4;
  padding: var(--s-2) var(--s-3); color: var(--gray-700);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none; box-sizing: border-box;
}
.set-input:focus, .set-select:focus, .set-textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow), 0 1px 2px rgba(0,0,0,0.04);
}
.set-select { cursor: pointer; }
.set-textarea {
  font-size: 13px; line-height: 1.6;
  resize: vertical; min-height: 80px;
}

/* Buttons */
.set-btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font: 500 14px/1 var(--font-sans); padding: 10px 20px; border-radius: var(--r-md);
  cursor: pointer; transition: all 150ms ease; border: 1px solid transparent;
}
.set-btn:active { transform: scale(0.97); }
.set-btn i { width: 16px; height: 16px; }
.set-btn.primary {
  background: var(--brand); color: var(--white); border-color: var(--brand);
  box-shadow: var(--shadow-brand, var(--shadow-sm));
}
.set-btn.primary:hover { filter: brightness(0.92); box-shadow: 0 6px 18px rgba(72,122,123,0.25); }
.set-btn.secondary {
  background: var(--white); color: var(--brand); border-color: var(--brand);
}
.set-btn.secondary:hover { background: var(--brand-wash); }
.set-btn.ghost {
  background: transparent; color: var(--gray-600); border-color: transparent;
}
.set-btn.ghost:hover { background: var(--gray-100); color: var(--gray-800); }
.set-btn.danger {
  background: var(--white); color: var(--error); border-color: var(--error);
}
.set-btn.danger:hover { background: rgba(239,68,68,0.06); }

/* Toggle switch — spring physics */
.set-toggle { position: relative; width: 44px; height: 24px; cursor: pointer; flex-shrink: 0; display: inline-block; }
.set-toggle input { display: none; }
.set-toggle .toggle-track {
  position: absolute; inset: 0; background: var(--gray-300); border-radius: var(--r-full);
  transition: background 250ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.set-toggle input:checked + .toggle-track { background: var(--success); }
.set-toggle .toggle-thumb {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  background: var(--white); border-radius: var(--r-full);
  box-shadow: 0 1px 3px rgba(0,0,0,0.18), 0 1px 1px rgba(0,0,0,0.06);
  transition: transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.set-toggle input:checked ~ .toggle-thumb { transform: translateX(20px); }
.set-toggle:hover .toggle-thumb { box-shadow: 0 2px 6px rgba(0,0,0,0.22); }
.toggle-label-text {
  font: 600 12px/1 var(--font-mono); color: var(--gray-500); min-width: 48px; text-align: right;
}
.toggle-label-text.auto { color: var(--success); }

/* Save indicator */
.set-save-ind {
  display: inline-flex; align-items: center; gap: var(--s-1);
  font-size: 12px; color: var(--success); font-weight: 500;
  opacity: 0; transition: opacity var(--t-base);
}
.set-save-ind.visible { opacity: 1; }
.set-save-ind i { width: 14px; height: 14px; }

/* ===== TAB 1: DEFAULT ASSIGNMENTS ===== */
.assign-tbl {
  width: 100%; border-collapse: separate; border-spacing: 0;
}
.assign-tbl th {
  font-size: 11px; font-weight: 600; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: var(--s-2) var(--s-3); text-align: left;
  border-bottom: 1px solid var(--gray-200); background: var(--gray-50);
}
.assign-tbl th:first-child { border-radius: var(--r-md) 0 0 0; }
.assign-tbl th:last-child { border-radius: 0 var(--r-md) 0 0; }
.assign-tbl td {
  padding: var(--s-3); font-size: 13px;
  border-bottom: 1px solid var(--gray-100); vertical-align: middle;
}
.assign-tbl tr:last-child td { border-bottom: none; }
.assign-tbl tr:hover td { background: var(--brand-wash); transition: background var(--t-fast); }
.stage-label {
  display: flex; align-items: center; gap: var(--s-2);
  font-weight: 500; color: var(--gray-800);
}
.stage-dot {
  width: 8px; height: 8px; border-radius: var(--r-full); flex-shrink: 0;
}
.subtask-indent { padding-left: 28px !important; }
.subtask-label { font-weight: 400; color: var(--gray-600); font-size: 13px; }
.assign-sel {
  max-width: 200px; font-size: 13px; padding: 6px 10px;
  border: 1px solid var(--gray-300); border-radius: var(--r-md);
  font-family: var(--font-sans); color: var(--gray-700);
  background: var(--white); cursor: pointer; outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.assign-sel:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }

/* ===== TAB 2: APPROVAL RULES ===== */
.warning-banner {
  background: rgba(245,158,11,0.06);
  border: 1px solid rgba(245,158,11,0.20);
  border-radius: var(--r-lg); padding: var(--s-4) var(--s-5);
  display: flex; align-items: flex-start; gap: var(--s-3); margin-bottom: var(--s-6);
  font-size: 13px; color: var(--gray-700); line-height: 1.5;
}
.warning-banner i { color: var(--warning); flex-shrink: 0; margin-top: 2px; }
.rule-card {
  background: var(--white);
  border: 1px solid var(--gray-200); border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-5); margin-bottom: var(--s-3);
  display: flex; align-items: center; justify-content: space-between;
  transition: all 200ms ease;
  border-left: 3px solid transparent;
}
.rule-card:hover {
  box-shadow: var(--shadow-sm);
  border-left-color: var(--brand-light);
}
.rule-info { flex: 1; padding-right: var(--s-4); }
.rule-name {
  font-size: 14px; font-weight: 600; color: var(--gray-800); margin-bottom: 3px;
}
.rule-desc { font-size: 12px; color: var(--gray-500); line-height: 1.5; }
.toggle-wrap { display: flex; align-items: center; gap: var(--s-3); flex-shrink: 0; }

/* ===== TAB 3: BUY BOX ===== */
.bb-info-banner {
  background: linear-gradient(135deg, rgba(59,130,246,0.04), rgba(72,122,123,0.04));
  border: 1px solid rgba(59,130,246,0.15); border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-5); font-size: 13px; color: var(--gray-600); line-height: 1.5;
  margin-bottom: var(--s-6); display: flex; align-items: flex-start; gap: var(--s-3);
}
.bb-info-banner i { flex-shrink: 0; margin-top: 2px; }
.bb-criteria-card {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--r-lg); margin-bottom: var(--s-6); overflow: hidden;
  transition: box-shadow var(--t-base);
}
.bb-criteria-card:hover { box-shadow: var(--shadow-sm); }
.bb-criteria-heading {
  font-size: 14px; font-weight: 700; color: var(--gray-800);
  padding: var(--s-3) var(--s-5);
  background: linear-gradient(135deg, var(--gray-50), rgba(72,122,123,0.03));
  border-bottom: 1px solid var(--gray-200);
  text-transform: uppercase; letter-spacing: 0.3px;
}
.bb-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--gray-100);
  transition: background var(--t-fast);
}
.bb-row:last-child { border-bottom: none; }
.bb-row:hover { background: var(--gray-50); }
.bb-row-info { flex: 1; }
.bb-row-name { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.bb-row-hint { font-size: 12px; color: var(--gray-500); margin-top: 2px; line-height: 1.4; }
.bb-inline-input {
  width: 120px; padding: var(--s-2) var(--s-3);
  border: 1px solid var(--gray-300); border-radius: var(--r-md);
  font: 600 14px/1.4 var(--font-mono); color: var(--gray-800);
  text-align: right; background: var(--white); outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  box-sizing: border-box;
}
.bb-inline-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.bb-hoa-threshold {
  padding: 0 var(--s-5) var(--s-4); display: none;
  animation: hoaSlideIn 250ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes hoaSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.bb-hoa-threshold.visible { display: flex; align-items: center; gap: var(--s-3); }
.bb-hoa-threshold .hoa-label {
  font-size: 13px; font-weight: 500; color: var(--gray-600); white-space: nowrap;
}
.bb-hoa-input-wrap { position: relative; width: 140px; }
.bb-hoa-input-wrap .cur-sym {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--gray-400); font: 500 14px/1 var(--font-mono); pointer-events: none;
}
.bb-hoa-input-wrap input {
  width: 100%; padding: var(--s-2) var(--s-3) var(--s-2) 24px;
  border: 1px solid var(--gray-300); border-radius: var(--r-md);
  font: 600 14px/1.4 var(--font-mono); color: var(--gray-800);
  background: var(--white); outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  box-sizing: border-box;
}
.bb-hoa-input-wrap input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }

/* Score sliders */
.bb-scores-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--s-5); margin-bottom: var(--s-6);
}
.bb-score-field label {
  font-size: 13px; font-weight: 600; color: var(--gray-700);
  margin-bottom: var(--s-1-5); display: block;
}
.bb-slider-row { display: flex; align-items: center; gap: var(--s-3); }
.bb-slider-row input[type="range"] {
  flex: 1; height: 6px; -webkit-appearance: none; appearance: none;
  background: linear-gradient(90deg, var(--gray-200) 0%, var(--gray-200) 100%);
  border-radius: var(--r-full); outline: none; border: none; padding: 0;
}
.bb-slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px;
  background: var(--brand); border-radius: var(--r-full); cursor: pointer;
  box-shadow: 0 2px 6px rgba(72,122,123,0.35);
  transition: box-shadow var(--t-fast), transform var(--t-fast);
}
.bb-slider-row input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 3px 10px rgba(72,122,123,0.45);
  transform: scale(1.1);
}
.bb-slider-row input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; background: var(--brand);
  border-radius: var(--r-full); cursor: pointer; border: none;
  box-shadow: 0 2px 6px rgba(72,122,123,0.35);
}
.bb-slider-val {
  font: 700 15px/1 var(--font-mono); color: var(--brand-dark, var(--brand));
  min-width: 40px; text-align: center;
  background: var(--brand-wash); padding: 4px 8px; border-radius: var(--r-sm);
}

/* Approved Jurisdictions */
.bb-jurisdictions-card {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--r-lg); margin-bottom: var(--s-6); overflow: hidden;
  transition: box-shadow var(--t-base);
}
.bb-jurisdictions-card:hover { box-shadow: var(--shadow-sm); }
.bb-jurisdictions-heading {
  font-size: 14px; font-weight: 700; color: var(--gray-800);
  padding: var(--s-3) var(--s-5);
  background: linear-gradient(135deg, var(--gray-50), rgba(72,122,123,0.03));
  border-bottom: 1px solid var(--gray-200);
  text-transform: uppercase; letter-spacing: 0.3px;
}
.bb-jurisdictions-note {
  font-size: 12px; color: var(--gray-500); line-height: 1.5;
  padding: var(--s-3) var(--s-5) var(--s-2);
}
.bb-jurisdictions-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: var(--s-1-5); padding: var(--s-3) var(--s-5) var(--s-5);
}
.bb-jur-item {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--gray-200); border-radius: var(--r-md);
  font-size: 13px; font-weight: 500; color: var(--gray-700);
  cursor: pointer; transition: all 180ms cubic-bezier(0.22, 1, 0.36, 1);
  user-select: none;
}
.bb-jur-item:hover { border-color: var(--gray-300); background: var(--gray-50); }
.bb-jur-item input {
  width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer;
  flex-shrink: 0;
}
.bb-jur-item.checked {
  border-color: var(--brand); background: var(--brand-wash);
  color: var(--brand-dark, var(--brand)); font-weight: 600;
}
.bb-save-row { display: flex; gap: var(--s-3); align-items: center; }
.bb-save-row .last-saved { font-size: 12px; color: var(--gray-400); }

/* ===== TAB 4: SUBMITTER MILESTONES ===== */
.ms-list { margin-bottom: var(--s-6); }
.ms-row {
  display: grid; grid-template-columns: 24px 1fr 1.5fr;
  gap: var(--s-3); align-items: center;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--gray-200); border-radius: var(--r-md);
  margin-bottom: var(--s-2); background: var(--white);
  transition: all 200ms ease;
}
.ms-row:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.ms-grip {
  color: var(--gray-400); cursor: grab;
  display: flex; align-items: center;
  transition: color var(--t-fast);
}
.ms-grip:hover { color: var(--gray-600); }
.ms-grip:active { cursor: grabbing; color: var(--brand); }
.ms-field { flex: 1; }
.ms-field .field-lbl {
  font-size: 10px; font-weight: 600; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px;
}
.ms-field input {
  font-size: 13px; padding: 6px 10px;
  border: 1px solid var(--gray-300); border-radius: var(--r-md);
  width: 100%; font-family: var(--font-sans); color: var(--gray-700);
  background: var(--white); outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  box-sizing: border-box;
}
.ms-field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.ms-save-row {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s-6);
}
.ms-reset {
  font-size: 13px; color: var(--gray-500); cursor: pointer;
  text-decoration: underline; transition: color var(--t-fast);
  background: none; border: none; font-family: var(--font-sans);
}
.ms-reset:hover { color: var(--brand); }

/* DHL Preview — elevated card */
.dhl-preview-box {
  background: var(--white);
  border: 1px solid var(--gray-200); border-radius: 20px;
  padding: var(--s-6) var(--s-8);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.8);
}
.dhl-preview-label {
  font-size: 13px; font-weight: 600; color: var(--gray-800); margin-bottom: var(--s-5);
}
.dhl-track {
  display: flex; align-items: flex-start; justify-content: space-between;
  position: relative; padding: 0 var(--s-4);
}
.dhl-track::before {
  content: ''; position: absolute; top: 14px; left: 32px; right: 32px;
  height: 3px; background: var(--gray-200); border-radius: var(--r-full);
}
.dhl-track::after {
  content: ''; position: absolute; top: 14px; left: 32px;
  width: 40%; height: 3px; background: var(--brand); border-radius: var(--r-full);
  transition: width 600ms ease;
}
.dhl-ms {
  display: flex; flex-direction: column; align-items: center;
  position: relative; z-index: 1; min-width: 80px;
}
.dhl-dot-set {
  width: 28px; height: 28px; border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--s-2); font-size: 12px;
  transition: all var(--t-base);
}
.dhl-dot-set i { width: 14px; height: 14px; }
.dhl-dot-set.done { background: var(--brand); color: white; }
.dhl-dot-set.now {
  border: 2px solid var(--brand); background: var(--brand-wash); color: var(--brand);
  animation: dhlPulse 2s ease-in-out infinite;
}
@keyframes dhlPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--brand-glow); }
  50% { box-shadow: 0 0 0 6px rgba(72,122,123,0); }
}
.dhl-dot-set.later {
  border: 2px solid var(--gray-300); background: var(--gray-50); color: var(--gray-300);
}
.dhl-lbl {
  font-size: 11px; font-weight: 500; color: var(--gray-400);
  text-align: center; max-width: 90px;
}
.dhl-lbl.done { color: var(--brand); }
.dhl-lbl.now { color: var(--gray-800); font-weight: 600; }
.dhl-ts {
  font-size: 10px; color: var(--gray-400);
  font-family: var(--font-mono); margin-top: 2px;
}

/* ===== TAB 5: TEAM MANAGEMENT ===== */
.team-header-row {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s-5);
}
.team-count { font-size: 13px; color: var(--gray-500); }
.team-tbl {
  width: 100%; border-collapse: separate; border-spacing: 0; margin-bottom: var(--s-5);
}
.team-tbl th {
  font-size: 11px; font-weight: 600; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: var(--s-2) var(--s-3); text-align: left;
  border-bottom: 1px solid var(--gray-200); background: var(--gray-50);
}
.team-tbl th:first-child { border-radius: var(--r-md) 0 0 0; }
.team-tbl th:last-child { border-radius: 0 var(--r-md) 0 0; }
.team-tbl td {
  padding: var(--s-3); font-size: 13px;
  border-bottom: 1px solid var(--gray-100); vertical-align: middle;
}
.team-tbl tr:last-child td { border-bottom: none; }
.team-tbl tr:hover td { background: var(--brand-wash); transition: background var(--t-fast); }
.member-name-cell {
  display: flex; align-items: center; gap: var(--s-2);
  font-weight: 500; color: var(--gray-800);
}
.member-av {
  width: 30px; height: 30px; border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white; flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.member-email { color: var(--gray-500); font-size: 12px; }
.member-role-sel {
  font-size: 12px; padding: 4px 8px; max-width: 140px;
  border: 1px solid var(--gray-300); border-radius: var(--r-md);
  font-family: var(--font-sans); background: var(--white); cursor: pointer;
  outline: none; transition: border-color var(--t-fast);
}
.member-role-sel:focus { border-color: var(--brand); }
.member-status-row { display: flex; align-items: center; gap: var(--s-2); }
.status-txt { font-size: 12px; font-weight: 600; }
.status-txt.on { color: var(--success); }
.status-txt.off { color: var(--gray-400); }
.deleg-badges { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.deleg-badge {
  font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: var(--r-sm);
  background: rgba(59,130,246,0.08); color: #3B82F6;
  cursor: default; transition: all var(--t-fast);
}
.deleg-badge:hover { background: rgba(59,130,246,0.15); transform: translateY(-1px); }
.deleg-badge.empty {
  background: var(--gray-100); color: var(--gray-400); font-style: italic;
}

/* ===== TAB 6: EMAIL TEMPLATES ===== */
.tmpl-card {
  border: 1px solid var(--gray-200); border-radius: var(--r-lg);
  margin-bottom: var(--s-3); overflow: hidden;
  transition: all 200ms ease;
}
.tmpl-card:hover { box-shadow: var(--shadow-sm); }
.tmpl-header {
  padding: var(--s-4) var(--s-5);
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; transition: background var(--t-fast);
}
.tmpl-header:hover { background: var(--gray-50); }
.tmpl-header-left { display: flex; align-items: center; gap: var(--s-3); }
.tmpl-icon {
  width: 36px; height: 36px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.tmpl-icon i { width: 18px; height: 18px; }
.tmpl-name { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.tmpl-stage { font-size: 12px; color: var(--gray-500); }
.tmpl-chevron {
  color: var(--gray-400); transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
}
.tmpl-card.expanded .tmpl-chevron { transform: rotate(180deg); }
.tmpl-body {
  display: none; padding: 0 var(--s-5) var(--s-5);
  border-top: 1px solid var(--gray-200);
  animation: tmplOpen 250ms ease;
}
@keyframes tmplOpen {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.tmpl-card.expanded .tmpl-body { display: block; }
.tmpl-body .fg { margin-bottom: var(--s-4); }
.tmpl-body .fg:last-child { margin-bottom: 0; }
.tmpl-body .fg label {
  font-size: 12px; font-weight: 600; color: var(--gray-600);
  margin-bottom: var(--s-1); display: block; margin-top: var(--s-4);
}
.tmpl-body textarea { font-size: 13px; line-height: 1.6; }
.tmpl-actions { display: flex; gap: var(--s-3); margin-top: var(--s-4); align-items: center; }
.placeholder-hl {
  background: rgba(139,92,246,0.10); color: #7C3AED;
  padding: 1px 4px; border-radius: 3px; font: 500 12px/1 var(--font-mono);
}
.ch-selector { display: flex; gap: var(--s-2); margin-top: var(--s-3); }
.ch-option {
  display: flex; align-items: center; gap: var(--s-1-5);
  padding: var(--s-1-5) var(--s-3);
  border: 1px solid var(--gray-300); border-radius: var(--r-md);
  font-size: 12px; font-weight: 500; color: var(--gray-600);
  cursor: pointer; transition: all var(--t-fast);
  background: none;
}
.ch-option:hover { border-color: var(--gray-400); }
.ch-option.selected {
  border-color: var(--brand); background: var(--brand-wash); color: var(--brand);
}
.ch-option i { width: 14px; height: 14px; }

/* ===== TAB 7: INTEGRATIONS ===== */
.integ-card {
  border: 1px solid var(--gray-200); border-radius: var(--r-lg);
  padding: var(--s-5) var(--s-6); margin-bottom: var(--s-4);
  transition: all 200ms ease;
}
.integ-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.integ-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-4);
}
.integ-title-row { display: flex; align-items: center; gap: var(--s-3); }
.integ-logo {
  width: 42px; height: 42px; border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.integ-name { font-size: 15px; font-weight: 700; color: var(--gray-800); }
.integ-desc { font-size: 12px; color: var(--gray-500); }
.integ-status {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: 13px; font-weight: 600;
}
.integ-status.ok { color: var(--success); }
.integ-status.err { color: var(--error); }
.integ-status.disconnected { color: var(--gray-400); }
.integ-dot {
  width: 10px; height: 10px; border-radius: var(--r-full); display: inline-block;
}
.integ-dot.ok { background: var(--success); box-shadow: 0 0 6px rgba(16,185,129,0.4); }
.integ-dot.err { background: var(--error); box-shadow: 0 0 6px rgba(239,68,68,0.4); animation: dotPulse 2s ease-in-out infinite; }
.integ-dot.disconnected { background: var(--gray-300); }
@keyframes dotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.integ-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4);
  padding: var(--s-4); background: var(--gray-50);
  border-radius: var(--r-md); margin-bottom: var(--s-4);
}
.integ-stat-label {
  font-size: 11px; font-weight: 500; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 2px;
}
.integ-stat-val { font: 600 14px/1 var(--font-mono); color: var(--gray-800); }
.integ-stat-val.err-count { color: var(--error); font-weight: 700; }
.integ-actions { display: flex; gap: var(--s-3); }

/* Integration status — connected state */
.integ-status.connected { color: var(--green-600, #16a34a); }
.integ-dot.connected { background: var(--green-500, #22c55e); box-shadow: 0 0 6px rgba(34,197,94,0.4); }

/* Integration config panel */
.integ-config { padding: var(--s-3) 0; }
.integ-config .fg { margin-bottom: var(--s-2); }
.integ-config .set-input { font-size: 13px; }
.integ-config details { border-top: 1px solid var(--gray-100); padding-top: var(--s-2); }
.integ-config details summary:hover { color: var(--brand); }

/* ===== INVITE MODAL ===== */
.set-modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.set-modal {
  background: var(--white); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); max-width: 480px; width: 90%;
  animation: modalEntry 300ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes modalEntry {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.set-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-5) var(--s-6) var(--s-4);
}
.set-modal-title { font-size: 18px; font-weight: 700; color: var(--gray-900); }
.set-modal-close {
  width: 32px; height: 32px; border: none;
  background: var(--gray-100); border-radius: var(--r-md);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--gray-500); transition: all var(--t-fast);
}
.set-modal-close:hover { background: var(--gray-200); color: var(--gray-700); }
.set-modal-body { padding: 0 var(--s-6) var(--s-5); }
.set-modal-body .fg { margin-bottom: var(--s-4); }
.set-modal-foot {
  padding: var(--s-4) var(--s-6);
  display: flex; justify-content: flex-end; gap: var(--s-3);
  border-top: 1px solid var(--gray-200);
}
.set-modal-deleg {
  display: flex; flex-wrap: wrap; gap: var(--s-2);
}
.set-modal-deleg label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--gray-600); cursor: pointer;
}
.set-modal-deleg input {
  width: auto; padding: 0; accent-color: var(--brand);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .settings-view { padding: var(--s-4); }
  .set-container { grid-template-columns: 1fr; min-height: auto; }
  .set-sidebar {
    border-right: none; border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
    display: flex; gap: var(--s-1); overflow-x: auto; padding: var(--s-2);
    -webkit-overflow-scrolling: touch;
  }
  .set-tab {
    white-space: nowrap; margin-bottom: 0;
    border-left: none !important; border-bottom: 2px solid transparent;
    border-radius: var(--r-sm);
  }
  .set-tab.active { border-bottom-color: var(--brand); border-left-color: transparent !important; }
  .set-content { padding: var(--s-5); }
  .bb-scores-grid { grid-template-columns: 1fr; }
  .bb-jurisdictions-grid { grid-template-columns: repeat(2, 1fr); }
  .bb-row { flex-direction: column; align-items: flex-start; gap: var(--s-3); }
  .ms-row { grid-template-columns: 1fr; gap: var(--s-2); }
  .ms-grip { display: none; }
  .ms-field { width: 100%; }
  .dhl-track { flex-direction: column; align-items: center; gap: var(--s-3); }
  .dhl-track::before, .dhl-track::after { display: none; }
  .integ-stats { grid-template-columns: 1fr; }
  .team-tbl { font-size: 12px; }
  .team-tbl th:nth-child(5), .team-tbl td:nth-child(5) { display: none; }
}
