/* ── Button Variants (shared) ── */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  line-height: 1.4;
}

.btn-ghost:hover {
  background: var(--bg-card-deep);
  color: var(--text-page);
  border-color: var(--border-hover);
}

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

.btn-tertiary {
  background: var(--bg-card-deep);
  border: 1px solid var(--border);
  color: var(--text-on-card);
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  line-height: 1.4;
}

.btn-tertiary:hover {
  background: #E5E7EB;
  border-color: var(--border-hover);
}

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

/* ── Campaign Status Tabs (List View) ── */
.campaign-status-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.cst-tab {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}

.cst-tab:hover {
  color: var(--text-page);
}

.cst-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Campaign Grid ── */
.campaigns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 18px;
  justify-content: start;
  align-content: start;
  width: 100%;
}

/* ── Campaign Card ── */
.campaign-card {
  position: relative;
  cursor: pointer;
  transition: box-shadow .15s, transform .1s;
}

.campaign-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.campaign-card--completed {
  opacity: 0.7;
}

.campaign-card--completed:hover {
  opacity: 0.9;
}

/* ── Card Progress Bar ── */
.campaign-progress-bar {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: #E5E7EB;
  gap: 1px;
}

.cpb-seg {
  height: 100%;
  transition: width .4s ease;
}

.cpb-engaged { background: var(--green); }
.cpb-sent    { background: var(--blue); }
.cpb-new     { background: #D1D5DB; }

/* ── Three-dot Menu ── */
.campaign-card-menu-wrap {
  position: relative;
}

.campaign-card-menu-btn {
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  padding: 2px 8px;
  font-size: 16px;
  color: var(--text-muted);
  border-radius: var(--radius);
  line-height: 1;
  transition: background .15s, border-color .15s;
}

.campaign-card-menu-btn:hover {
  background: var(--bg-card-deep);
  border-color: var(--border);
  color: var(--text-page);
}

.campaign-card-menu-dropdown {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 150px;
  overflow: hidden;
}

.campaign-card-menu-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 14px;
  font-size: 13px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-page);
  transition: background .1s;
}

.campaign-card-menu-dropdown button:hover {
  background: var(--bg-card-hover);
}

.campaign-card-menu-dropdown button.danger {
  color: var(--red);
}

.campaign-card-menu-dropdown button.danger:hover {
  background: var(--red-dim);
}

/* ── Campaign Detail Tabs ── */
.campaign-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  padding-bottom: 0;
}

.cd-tab {
  background: none;
  border: none;
  cursor: pointer;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cd-tab:hover { color: var(--text-page); }
.cd-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.cd-tab-count {
  font-size: 11px;
  background: var(--bg-card-deep);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 9px;
}

.cd-tab.active .cd-tab-count {
  background: var(--accent-dim);
  color: var(--accent);
}

/* ── Tab Content Panel ── */
.cd-tab-panel {
  animation: fadeIn .15s ease;
}

/* When the contacts tab (cd-fixed-panel) is active, make #cdTabContent fill
   remaining height so the table scrolls internally instead of page-scrolling */
#cdTabContent:has(.cd-fixed-panel) {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── KPI Stat Grid — 7 columns, 1 row ── */
.campaign-stat-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

/* Tighter card to fit 7 across without wrapping */
.campaign-stat-grid .stat-card {
  padding: 12px 14px;
  min-width: 0;
}
.campaign-stat-grid .stat-card .stat-label {
  font-size: 10.5px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.campaign-stat-grid .stat-card .stat-value {
  font-size: 22px;
  line-height: 1.1;
}

@media (max-width: 1200px) {
  .campaign-stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .campaign-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.stat-card--clickable {
  cursor: pointer;
  transition: box-shadow .15s, transform .1s;
}

.stat-card--clickable:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* ── Funnel Bar ── */
.campaign-funnel-bar {
  display: flex;
  height: 16px;
  border-radius: 8px;
  overflow: hidden;
  background: #E5E7EB;
  gap: 2px;
  margin-bottom: 10px;
}

.cfb-seg {
  height: 100%;
  transition: width .5s ease;
  cursor: pointer;
}

.cfb-seg:first-child { border-radius: 8px 0 0 8px; }
.cfb-seg:last-child  { border-radius: 0 8px 8px 0; }
.cfb-seg:only-child  { border-radius: 8px; }

.cfb-engaged { background: var(--green); }
.cfb-sent    { background: var(--blue); }
.cfb-new     { background: #D1D5DB; }

.campaign-funnel-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

.campaign-funnel-legend span {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color .15s;
}

.campaign-funnel-legend span:hover { color: var(--text-page); }

.cfb-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.cfb-dot-engaged { background: var(--green); }
.cfb-dot-sent    { background: var(--blue); }
.cfb-dot-new     { background: #D1D5DB; }
.cfb-dot-meeting { background: var(--teal); }

/* ── Contacts Tab Bulk Action Bar ── */
.cd-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--accent-light);
  border: 1px solid var(--accent-glow);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

/* Selected row highlight */
.data-table tr.tr-selected td {
  background: var(--accent-light);
}

/* ── Add Contacts Slide Panel ── */
.add-contacts-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  z-index: 500;
  transform: translateX(100%);
  transition: transform .25s ease;
}

.add-contacts-panel.open {
  transform: translateX(0);
}

.acp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.acp-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.acp-filters {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.acp-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.acp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background .1s;
}

.acp-row:hover {
  background: var(--bg-card-hover);
}

.acp-row input[type="checkbox"] {
  flex-shrink: 0;
}

.acp-row > div {
  flex: 1;
  min-width: 0;
}

.acp-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

.add-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.2);
  z-index: 499;
}

/* ── Batch Draft Queue Overlay ── */
.batch-queue-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}

.batch-queue-modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
  overflow: hidden;
}

.bqm-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--border);
}

.bqm-header h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}

/* Progress bar strip under header */
.bqm-progress-wrap {
  height: 3px;
  background: var(--bg-card-deep);
  flex-shrink: 0;
}

.bqm-progress-bar {
  height: 100%;
  background: var(--accent);
  transition: width .3s ease;
}

.bqm-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Contact card within queue */
.bqm-contact-card {
  background: var(--bg-card-deep);
  border-radius: var(--radius);
  padding: 12px 16px;
}

.bqm-contact-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-on-card);
  margin-bottom: 2px;
}

.bqm-contact-meta {
  font-size: 12px;
  color: var(--text-on-card-muted);
}

.bqm-loading {
  text-align: center;
  padding: 32px 0;
}

.bqm-error {
  background: var(--red-dim);
  border-radius: var(--radius);
  padding: 14px;
}

.bqm-compose {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.bqm-subject-input {
  font-weight: 500;
}

.bqm-body-input {
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  min-height: 200px;
}

.bqm-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

/* ── Batch Complete Summary ── */
.bqm-summary {
  justify-content: center;
  align-items: center;
}

.bqm-summary-grid {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.bqm-summary-card {
  text-align: center;
  padding: 20px 28px;
  border-radius: var(--radius-lg);
  min-width: 100px;
}

.bqm-sc-green { background: var(--green-dim); }
.bqm-sc-gray  { background: var(--bg-card-deep); }
.bqm-sc-red   { background: var(--red-dim); }

.bqm-sc-num {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 6px;
}

.bqm-sc-green .bqm-sc-num { color: var(--green); }
.bqm-sc-gray  .bqm-sc-num { color: var(--text-muted); }
.bqm-sc-red   .bqm-sc-num { color: var(--red); }

.bqm-sc-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── AI Insights bar chart ── */
.insights-bar-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Round Type Tiles (shared with wizard) ── */
.round-type-tiles {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.round-type-tile {
  flex: 1;
  min-width: 100px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  text-align: center;
}

.round-type-tile:hover {
  border-color: var(--accent-glow);
  background: var(--accent-light);
}

.round-type-tile.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

.tile-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-on-card);
}

.tile-sub {
  font-size: 11px;
  color: var(--text-on-card-muted);
  margin-top: 2px;
}
