*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --teal-500: #003e41;
  --teal-600: #00353a;
  --teal-700: #002b2e;
  --gray-50: #f8f8f8;
  --gray-100: #f0f0f1;
  --gray-200: #d5d6d9;
  --gray-300: #b5b7bc;
  --gray-400: #a3a7ae;
  --gray-500: #6d717a;
  --gray-600: #4a4e57;
  --gray-700: #2e3138;
  --gray-900: #131517;
  --accent: #db5452;
  --success: #07b767;
  --white: #ffffff;
  --amber: #d97706;
}

body {
  font-family:
    "DM Sans",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  background: var(--gray-50);
  color: var(--gray-700);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* --- Login View --- */
#login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

#login-view .card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 420px;
  padding: 40px 32px 32px;
  text-align: center;
}

.logo-icon {
  margin-bottom: 20px;
}

h1 {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 600;
  color: var(--gray-900);
}

#login-view h1 {
  font-size: 22px;
  margin-bottom: 6px;
}

.subtitle {
  font-size: 14px;
  color: var(--gray-500);
  margin-bottom: 28px;
}

.form-group {
  text-align: left;
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 4px;
}

.form-input,
.filter-select {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--gray-700);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  transition:
    border-color 150ms,
    box-shadow 150ms;
}

.form-input:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(0, 62, 65, 0.15);
}

.form-input:hover,
.filter-select:hover {
  border-color: var(--gray-300);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition:
    background 150ms,
    transform 150ms;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--teal-500);
  color: var(--white);
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  background: var(--teal-600);
}

.error-msg {
  margin-top: 12px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--accent);
  background: rgba(219, 84, 82, 0.08);
  border: 1px solid rgba(219, 84, 82, 0.2);
  border-radius: 6px;
  display: none;
}

.error-msg.show {
  display: block;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
}

.spinner-dark {
  border: 2px solid var(--gray-200);
  border-top-color: var(--teal-500);
}

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

.footer-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
  font-size: 11px;
  color: var(--gray-400);
}

/* --- Dashboard View --- */
#dashboard-view {
  display: none;
}

#dashboard-view.show {
  display: block;
}

#login-view.hide {
  display: none;
}

.dash-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
}

.dash-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.dash-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dash-header-left svg {
  flex-shrink: 0;
}

.dash-header-title {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
}

.dash-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-name {
  font-size: 13px;
  color: var(--gray-600);
  font-weight: 500;
}

.btn-signout {
  font-size: 13px;
  color: var(--gray-400);
  cursor: pointer;
  border: none;
  background: none;
  text-decoration: underline;
  font-family: inherit;
}

.btn-signout:hover {
  color: var(--gray-600);
}

/* Tab Bar */
.tab-bar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-bar::-webkit-scrollbar {
  display: none;
}

.tab-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 0;
}

.tab-btn {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--gray-500);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 150ms, border-color 150ms;
}

.tab-btn:hover {
  color: var(--gray-700);
}

.tab-btn.active {
  color: var(--teal-500);
  border-bottom-color: var(--teal-500);
}

/* Content Area */
.dash-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Stat Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 20px;
}

.stat-card.clickable {
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}

.stat-card.clickable:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 62, 65, 0.10);
}

.stat-card.clickable:active {
  transform: scale(0.98);
}

.stat-card.clickable.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary), 0 2px 8px rgba(0, 62, 65, 0.12);
}

.stat-card-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-card-value {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-900);
}

.stat-card-value.green {
  color: var(--success);
}

.stat-card-value.gray {
  color: var(--gray-400);
}

.stat-card-value.red {
  color: var(--accent);
}

/* Activity Log filter bar */
.log-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.log-filter-bar .filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.log-filter-pill {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s;
}

.log-filter-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.log-filter-pill.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.log-sort-select {
  margin-left: auto;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--gray-200);
  font-size: 13px;
  color: var(--gray-700);
  background: var(--white);
  cursor: pointer;
}

/* Data Tables */
.table-wrapper {
  overflow-x: auto;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: top;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: rgba(0, 62, 65, 0.02);
}

.td-right {
  text-align: right;
}

.td-secondary {
  color: var(--gray-500);
  font-size: 12px;
}

.td-mono {
  font-family: "SF Mono", "Consolas", "Monaco", monospace;
  font-size: 12px;
  color: var(--gray-500);
}

.td-truncate {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Badges */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.badge-enrolled {
  background: rgba(7, 183, 103, 0.1);
  color: var(--success);
}

.badge-skipped {
  background: var(--gray-100);
  color: var(--gray-500);
}

.badge-failed {
  background: rgba(219, 84, 82, 0.1);
  color: var(--accent);
}

.badge-single {
  background: rgba(0, 62, 65, 0.08);
  color: var(--teal-500);
}

.badge-bulk {
  background: rgba(0, 62, 65, 0.08);
  color: var(--teal-500);
}

.badge-debug {
  background: var(--gray-100);
  color: var(--gray-500);
}

.badge-info {
  background: rgba(0, 62, 65, 0.08);
  color: var(--teal-500);
}

.badge-warn {
  background: rgba(217, 119, 6, 0.1);
  color: var(--amber);
}

.badge-error {
  background: rgba(219, 84, 82, 0.1);
  color: var(--accent);
}

/* Filters */
.filter-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-select {
  width: auto;
  min-width: 140px;
  padding: 8px 12px;
  font-size: 13px;
}

.btn-refresh {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--gray-600);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  cursor: pointer;
  transition: background 150ms;
}

.btn-refresh:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  font-size: 13px;
  color: var(--gray-500);
}

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

.btn-page {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--gray-600);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  cursor: pointer;
}

.btn-page:hover:not(:disabled) {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

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

/* Loading / Empty states */
.panel-loading,
.panel-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 48px 20px;
  color: var(--gray-400);
  font-size: 14px;
}

.panel-empty {
  color: var(--gray-400);
}

/* Bookmark panel */
.bookmark-center {
  max-width: 520px;
  margin: 0 auto;
}

.bookmark-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 28px 24px;
  margin-bottom: 20px;
  text-align: center;
}

.bookmark-card h3 {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 8px;
}

.bookmark-card p {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 20px;
  line-height: 1.5;
}

.bookmarklet-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--teal-500);
  color: var(--white);
  text-decoration: none;
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 8px;
  cursor: grab;
  user-select: none;
  transition: background 150ms, transform 150ms, box-shadow 150ms;
  box-shadow: 0 2px 8px rgba(0, 62, 65, 0.15);
}

.bookmarklet-link:hover {
  background: var(--teal-600);
  box-shadow: 0 4px 12px rgba(0, 62, 65, 0.25);
  transform: translateY(-1px);
}

.bookmarklet-link:active {
  cursor: grabbing;
  transform: scale(0.97);
}

.bookmark-hint {
  display: block;
  margin-top: 12px;
  font-size: 12px;
  color: var(--gray-400);
  font-style: italic;
}

.instructions {
  text-align: left;
  padding: 20px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  margin-bottom: 16px;
}

.instructions h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 10px;
}

.instructions ol {
  padding-left: 18px;
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.8;
}

.instructions code {
  background: var(--gray-100);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}

.instructions-note {
  text-align: left;
  padding: 16px 20px;
  background: rgba(0, 62, 65, 0.04);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
}

.instructions-note h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 8px;
}

.instructions-note p {
  font-size: 13px;
  color: var(--gray-500);
  line-height: 1.6;
  margin: 0 0 6px;
}

.instructions-note p:last-child {
  margin-bottom: 0;
}

.instructions-note strong {
  color: var(--gray-700);
}

.instructions-note kbd {
  display: inline-block;
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: 3px;
  padding: 0 5px;
  font-size: 11px;
  font-family: inherit;
  line-height: 1.6;
  box-shadow: 0 1px 0 var(--gray-300);
}

/* Footer */
.dash-footer {
  text-align: center;
  padding: 24px;
  font-size: 11px;
  color: var(--gray-400);
}

.dash-footer span {
  font-weight: 600;
  color: var(--teal-500);
}

/* Environment notification bar */
.env-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 5px 16px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3px;
  color: #fff;
  background: var(--teal-700, #003e41);
}

.env-bar a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  transition: color 0.15s, border-color 0.15s;
}

.env-bar a:hover {
  color: #fff;
  border-color: #fff;
}

.env-bar .env-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0BF477;
  display: inline-block;
  margin-right: 4px;
}

/* Responsive */
@media (max-width: 768px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .tab-btn {
    padding: 10px 12px;
    font-size: 12px;
  }

  .dash-content {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .user-name {
    display: none;
  }

  .dash-header-inner {
    padding: 0;
  }

  #login-view .card {
    margin: 16px;
    padding: 32px 20px 24px;
  }
}

/* Auth form toggling */
.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.auth-link {
  background: none;
  border: none;
  color: var(--teal-500);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.auth-link:hover {
  color: var(--teal-600);
}

.auth-toggle {
  margin-top: 20px;
  font-size: 13px;
  color: var(--gray-500);
}

.success-msg {
  margin-top: 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--success);
  background: rgba(7, 183, 103, 0.08);
  border: 1px solid rgba(7, 183, 103, 0.2);
  border-radius: 6px;
  display: none;
}

.success-msg.show {
  display: block;
}

.forgot-link {
  text-align: right;
  margin-bottom: 16px;
}

/* Favorite & Hide icons */
.pref-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background 150ms, opacity 150ms;
  opacity: 0.4;
  vertical-align: middle;
}

.pref-btn:hover {
  background: var(--gray-100);
  opacity: 0.8;
}

.pref-btn.active {
  opacity: 1;
}

.pref-btn.favorite.active svg {
  fill: #f59e0b;
  stroke: #f59e0b;
}

.pref-btn.hidden.active svg {
  stroke: var(--gray-400);
}

.pref-actions {
  display: flex;
  gap: 2px;
  align-items: center;
}

tr.is-hidden {
  opacity: 0.5;
}

tr.is-favorite {
  background: rgba(245, 158, 11, 0.04);
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-600);
  cursor: pointer;
  user-select: none;
}

.filter-checkbox input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Bulk Jobs Panel */
.job-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.job-back-btn {
  background: none;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: background 150ms;
}

.job-back-btn:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

.job-detail-title {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
}

.job-progress-container {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.job-progress-bar-track {
  width: 100%;
  height: 20px;
  background: var(--gray-100);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 8px;
}

.job-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal-500), var(--teal-700));
  border-radius: 10px;
  transition: width 0.4s ease;
  min-width: 0;
}

.job-progress-bar-fill.completed {
  background: linear-gradient(90deg, var(--success), #05a55b);
}

.job-progress-bar-fill.failed {
  background: linear-gradient(90deg, var(--accent), #c0413f);
}

.job-progress-text {
  text-align: center;
  font-size: 13px;
  color: var(--gray-500);
}

.job-info-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--gray-600);
}

.job-info-item {
  display: flex;
  gap: 4px;
}

.job-info-item strong {
  color: var(--gray-700);
}

.badge-pending {
  background: rgba(217, 119, 6, 0.1);
  color: var(--amber);
}

.badge-enrolling {
  background: rgba(0, 62, 65, 0.08);
  color: var(--teal-500);
}

.badge-completed {
  background: rgba(7, 183, 103, 0.1);
  color: var(--success);
}

.badge-cancelled {
  background: var(--gray-100);
  color: var(--gray-500);
}

.badge-fetching_contacts {
  background: rgba(0, 62, 65, 0.08);
  color: var(--teal-500);
}

.badge-in_unenroll_workflow {
  background: rgba(0, 62, 65, 0.08);
  color: var(--teal-500);
}

.badge-awaiting_unenroll {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.badge-pending {
  background: rgba(107, 114, 128, 0.1);
  color: #6b7280;
}

.badge-unenrolled {
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
}

.job-log-section {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 20px;
}

.job-log-section h3 {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 12px;
}

.job-log-scroll {
  max-height: 400px;
  overflow-y: auto;
}

.job-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.btn-cancel-job {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--accent);
  background: rgba(219, 84, 82, 0.08);
  border: 1px solid rgba(219, 84, 82, 0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: background 150ms;
}

.btn-cancel-job:hover {
  background: rgba(219, 84, 82, 0.15);
}

.btn-download-report {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--teal-500);
  background: rgba(0, 62, 65, 0.06);
  border: 1px solid rgba(0, 62, 65, 0.15);
  border-radius: 6px;
  cursor: pointer;
  transition: background 150ms;
}

.btn-download-report:hover {
  background: rgba(0, 62, 65, 0.12);
}

.job-row-clickable {
  cursor: pointer;
}

.job-row-clickable:hover td {
  background: rgba(0, 62, 65, 0.04) !important;
}

/* Animated progress bar */
.job-progress-bar-fill.active {
  background: linear-gradient(90deg,
      var(--teal-500),
      var(--teal-700),
      var(--teal-500));
  background-size: 200% 100%;
  animation: progressShimmer 2s linear infinite;
}

@keyframes progressShimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* Pulsing Processing indicator */
.job-status-pulse {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--teal-500);
  margin-left: 12px;
}

.job-status-pulse .pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal-500);
  animation: pulseDot 1.4s ease-in-out infinite;
}

@keyframes pulseDot {

  0%,
  100% {
    opacity: 0.3;
    transform: scale(0.8);
  }

  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* System Log Panel */
.job-sys-log {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  margin-top: 16px;
  overflow: hidden;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

.job-sys-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  cursor: pointer;
  user-select: none;
}

.job-sys-log-header:hover {
  background: #1c2129;
}

.job-sys-log-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #c9d1d9;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.job-sys-log-title .live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3fb950;
  animation: pulseDot 1.4s ease-in-out infinite;
}

.job-sys-log-title .live-dot.inactive {
  background: #484f58;
  animation: none;
}

.job-sys-log-toggle {
  font-size: 12px;
  color: #8b949e;
  transition: transform 200ms;
}

.job-sys-log-toggle.collapsed {
  transform: rotate(-90deg);
}

.job-sys-log-body {
  max-height: 300px;
  overflow-y: auto;
  padding: 8px 0;
  transition: max-height 200ms ease;
}

.job-sys-log-body.collapsed {
  max-height: 0;
  padding: 0;
  overflow: hidden;
}

.job-sys-log-body::-webkit-scrollbar {
  width: 6px;
}

.job-sys-log-body::-webkit-scrollbar-track {
  background: transparent;
}

.job-sys-log-body::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 3px;
}

.sys-log-entry {
  display: flex;
  gap: 8px;
  padding: 2px 16px;
  font-size: 11.5px;
  line-height: 20px;
  color: #8b949e;
}

.sys-log-entry:hover {
  background: rgba(177, 186, 196, 0.04);
}

.sys-log-ts {
  color: #484f58;
  flex-shrink: 0;
  min-width: 65px;
}

.sys-log-cat {
  color: #58a6ff;
  flex-shrink: 0;
  min-width: 90px;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.3px;
  padding-top: 1px;
}

.sys-log-msg {
  color: #c9d1d9;
  word-break: break-word;
}

.sys-log-entry.warn .sys-log-msg {
  color: #d29922;
}

.sys-log-entry.error .sys-log-msg {
  color: #f85149;
}

.sys-log-empty {
  padding: 20px 16px;
  text-align: center;
  color: #484f58;
  font-size: 12px;
  font-style: italic;
}

/* Enrollment Forms */
.enroll-form-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 20px;
  margin-top: 20px;
  overflow: hidden;
}

.enroll-form-card h3 {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-width: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-group input,
.form-group select {
  width: 100%;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  color: var(--gray-900);
  background: var(--white);
  transition: border-color 150ms;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--teal-500);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.btn-enroll {
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--white);
  background: var(--teal-500);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 150ms;
}

.btn-enroll:hover {
  background: var(--teal-700);
}

.btn-enroll:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.enroll-result {
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 6px;
  display: none;
}

.enroll-result.success {
  display: block;
  background: rgba(7, 183, 103, 0.1);
  color: var(--success);
}

.enroll-result.error {
  display: block;
  background: rgba(219, 84, 82, 0.08);
  color: var(--accent);
}

/* Contact Preview Card */
.contact-preview {
  display: none;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 12px;
  grid-column: 1 / -1;
}

.contact-preview.visible {
  display: block;
}

.contact-preview.loading {
  display: block;
  color: var(--gray-400);
  font-size: 13px;
}

.contact-preview.error-state {
  display: block;
  color: var(--accent);
  font-size: 13px;
}

.contact-preview-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.contact-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--teal-500);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.contact-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--gray-900);
}

.contact-title-company {
  font-size: 12px;
  color: var(--gray-500);
}

.contact-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.contact-detail-item {
  font-size: 12px;
}

.contact-detail-item .detail-label {
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-size: 10px;
  font-weight: 500;
}

.contact-detail-item .detail-value {
  color: var(--gray-700);
  margin-top: 1px;
}

.seq-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.seq-badge.in-sequence {
  background: rgba(217, 119, 6, 0.1);
  color: var(--amber);
}

.seq-badge.not-in-sequence {
  background: rgba(7, 183, 103, 0.1);
  color: var(--success);
}

/* Radio Group for Send As */
.radio-group {
  display: flex;
  gap: 16px;
  padding: 8px 0;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--gray-700);
}

.radio-option input[type="radio"] {
  accent-color: var(--teal-500);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Confirm Modal / Lightbox */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  padding: 28px 32px;
  max-width: 440px;
  width: 90%;
  transform: scale(0.92);
  transition: transform 0.2s ease;
}

.modal-overlay.visible .modal-box {
  transform: scale(1);
}

.modal-message {
  font-size: 15px;
  color: var(--gray-700);
  line-height: 1.6;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-btn {
  padding: 9px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}

.modal-btn-cancel {
  background: var(--gray-100);
  color: var(--gray-600);
}

.modal-btn-cancel:hover {
  background: var(--gray-200);
}

.modal-btn-confirm {
  background: var(--teal-500);
  color: #fff;
}

.modal-btn-confirm:hover {
  background: var(--teal-600, #0d9488);
}

.modal-btn-confirm.danger {
  background: var(--danger, #ef4444);
}

.modal-btn-confirm.danger:hover {
  background: #dc2626;
}

/* ── Enrollment Confirmation Flow (ECF) ────────────────────── */
.ecf-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.ecf-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.ecf-modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
  max-width: 520px;
  width: 92%;
  transform: scale(0.92) translateY(10px);
  transition: transform 0.25s ease;
  overflow: hidden;
  position: relative;
}

.ecf-overlay.visible .ecf-modal {
  transform: scale(1) translateY(0);
}

.ecf-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--gray-100);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  transition: all 0.15s ease;
  z-index: 2;
}

.ecf-close:hover {
  background: var(--gray-200);
  color: var(--gray-700);
}

.ecf-body {
  padding: 36px 36px 32px;
}

/* Step indicators */
.ecf-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 28px;
}

.ecf-step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--success);
  background: transparent;
  transition: background 0.2s ease;
}

.ecf-step-dot.active {
  background: var(--success);
}

.ecf-step-dot.completed {
  background: var(--success);
}

.ecf-step-line {
  width: 32px;
  height: 2px;
  background: var(--gray-200);
  transition: background 0.2s ease;
}

.ecf-step-line.active {
  background: var(--success);
}

/* Step content */
.ecf-icon {
  text-align: center;
  margin-bottom: 8px;
}

.ecf-title {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 20px;
  font-family: "Bricolage Grotesque", sans-serif;
}

.ecf-desc {
  font-size: 14px;
  color: var(--gray-600);
  line-height: 1.7;
  margin-bottom: 24px;
  text-align: center;
}

.ecf-desc strong {
  color: var(--gray-900);
}

.ecf-input-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  text-align: center;
}

.ecf-input {
  display: block;
  width: 120px;
  margin: 0 auto 24px;
  padding: 10px 16px;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  color: var(--gray-900);
  outline: none;
  transition: border-color 0.15s ease;
  font-family: "DM Sans", sans-serif;
}

.ecf-input:focus {
  border-color: var(--teal-500);
}

.ecf-input.correct {
  border-color: var(--success);
}

.ecf-actions {
  display: flex;
  justify-content: center;
}

.ecf-btn {
  padding: 12px 36px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: var(--teal-500);
  color: #fff;
  transition: all 0.15s ease;
  font-family: "DM Sans", sans-serif;
}

.ecf-btn:hover:not(:disabled) {
  background: var(--teal-600);
  transform: translateY(-1px);
}

.ecf-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Success state */
.ecf-success-icon {
  text-align: center;
  margin-bottom: 12px;
}

.ecf-success-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 8px;
  font-family: "Bricolage Grotesque", sans-serif;
}

.ecf-success-subtitle {
  text-align: center;
  font-size: 14px;
  color: var(--gray-500);
  margin-bottom: 24px;
}

.ecf-detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  font-size: 13px;
  margin-bottom: 28px;
  padding: 16px 20px;
  background: var(--gray-50);
  border-radius: 10px;
}

.ecf-detail-label {
  color: var(--gray-500);
  font-weight: 600;
}

.ecf-detail-value {
  color: var(--gray-900);
}

.ecf-btn-success {
  background: var(--success);
}

.ecf-btn-success:hover:not(:disabled) {
  background: #069a57;
}

/* Error state */
.ecf-error-msg {
  text-align: center;
  color: var(--accent);
  font-size: 14px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: rgba(219, 84, 82, 0.08);
  border-radius: 8px;
}

/* === Preview Modal (full-screen) === */
.preview-modal {
  max-width: 1100px;
  width: 96%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.preview-header {
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--gray-200);
}

.preview-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 4px;
  font-family: "Bricolage Grotesque", sans-serif;
}

.preview-header p {
  font-size: 13px;
  color: var(--gray-500);
  margin: 0;
}

.preview-summary {
  display: flex;
  gap: 12px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--gray-100);
  flex-wrap: wrap;
}

.preview-summary-card {
  flex: 1;
  min-width: 100px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--gray-50);
  text-align: center;
}

.preview-summary-card .psc-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  margin-bottom: 2px;
}

.preview-summary-card .psc-value {
  font-size: 22px;
  font-weight: 700;
}

.preview-table-wrap {
  flex: 1;
  overflow: auto;
  padding: 0 28px 16px;
}

.preview-table-wrap table {
  width: 100%;
  font-size: 13px;
}

.preview-table-wrap th {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.preview-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.preview-footer .btn-cancel-preview {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--gray-300);
  background: #fff;
  color: var(--gray-700);
  cursor: pointer;
}

.preview-footer .btn-confirm-enroll {
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  background: var(--teal-500);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
}

.preview-footer .btn-confirm-enroll:hover {
  background: var(--teal-600);
}

/* Action badges */
.badge-will_enroll {
  background: rgba(7, 170, 96, 0.1);
  color: var(--success);
}

.badge-will_skip_same,
.badge-will_skip_other {
  background: var(--gray-100);
  color: var(--gray-500);
}

.badge-will_unenroll {
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
}

.badge-no_owner,
.badge-no_owner_match {
  background: rgba(219, 84, 82, 0.08);
  color: var(--accent);
}

/* Fade transition for step content */
.ecf-content {
  transition: opacity 0.2s ease;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

.badge-enrolling,
.badge-fetching_contacts {
  animation: pulse 2s ease-in-out infinite;
}

/* Schedule config */
.schedule-config { margin-top: 12px; }
#schedule-options { background: var(--gray-50); border-radius: 8px; padding: 12px 16px; border: 1px solid var(--gray-200); }

/* Settings tab */
.settings-section { max-width: 700px; margin: 0 auto; }
.settings-section h3 { margin-bottom: 4px; }
.settings-section p { color: var(--gray-500); font-size: 13px; margin-bottom: 16px; }
.holiday-form { display: flex; gap: 8px; margin-bottom: 16px; align-items: flex-end; }
.holiday-form input { padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: 13px; }
.holiday-form input[type="date"] { width: 160px; }
.holiday-form input[type="text"] { flex: 1; }
.holiday-form button { white-space: nowrap; }
.holiday-past { opacity: 0.5; }

/* Schedule badges */
.badge-scheduled { background: #eef2ff; color: #4338ca; }
.badge-waiting { background: #fffbeb; color: #b45309; }
.badge-paused { background: var(--gray-100); color: var(--gray-500); }
.badge-instant { background: var(--gray-100); color: var(--gray-500); font-size: 11px; }

/* Waiting/paused banners */
.schedule-banner { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; font-weight: 500; }
.schedule-banner.waiting { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.schedule-banner.paused { background: var(--gray-100); color: var(--gray-500); border: 1px solid var(--gray-200); }
.schedule-banner svg { flex-shrink: 0; }

/* Schedule info section in job detail */
.schedule-info { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.schedule-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 12px; }
.schedule-info-item label { display: block; font-size: 11px; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.3px; }
.schedule-info-item span { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.schedule-edit-btn { font-size: 12px; color: var(--teal-600); cursor: pointer; background: none; border: 1px solid var(--teal-300); border-radius: 6px; padding: 4px 12px; font-weight: 600; }
.schedule-edit-btn:hover { background: var(--teal-50); }

/* Daily log table */
.daily-log-section { margin-top: 16px; }
.daily-log-section h4 { font-size: 13px; font-weight: 600; color: var(--gray-600); margin-bottom: 8px; }

/* Schedule estimate in preview */
.schedule-estimate { background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 8px; padding: 16px; margin: 12px 0; }
.schedule-estimate h4 { font-size: 13px; font-weight: 700; color: #4338ca; margin: 0 0 12px 0; }
.schedule-estimate-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.schedule-estimate-card { text-align: center; }
.schedule-estimate-card .label { font-size: 11px; color: #6366f1; text-transform: uppercase; font-weight: 600; }
.schedule-estimate-card .value { font-size: 20px; font-weight: 700; color: #312e81; }