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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
  padding: 2rem 1rem;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

header {
  text-align: center;
  padding: 1rem 0;
}
header h1 { font-size: 2rem; font-weight: 700; color: #1a1a2e; }
header p  { color: #666; margin-top: .4rem; font-size: 1rem; }

.card {
  background: #fff;
  border-radius: 14px;
  padding: 1.8rem;
  box-shadow: 0 2px 12px rgba(0,0,0,.07);
}

/* ── Form ─────────────────────────── */
.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}
.field { display: flex; flex-direction: column; flex: 1; min-width: 180px; }
.field-small { flex: 0 0 100px; }
label { font-size: .8rem; font-weight: 600; color: #555; margin-bottom: .4rem; text-transform: uppercase; letter-spacing: .04em; }
input[type="text"],
input[type="number"] {
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  padding: .6rem .9rem;
  font-size: .95rem;
  outline: none;
  transition: border-color .2s;
}
input:focus { border-color: #6366f1; }

button[type="submit"] {
  width: 100%;
  background: #6366f1;
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: .85rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, opacity .2s;
}
button[type="submit"]:hover  { background: #4f46e5; }
button[type="submit"]:disabled { opacity: .6; cursor: not-allowed; }

/* ── Progress ─────────────────────── */
.progress-bar-wrap {
  background: #eee;
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #a855f7);
  width: 0%;
  border-radius: 99px;
  transition: width .4s ease;
  animation: pulse-bar 1.5s infinite;
}
@keyframes pulse-bar {
  0%,100% { opacity: 1; }
  50%      { opacity: .7; }
}
#log-box {
  background: #1e1e2e;
  color: #a6e3a1;
  border-radius: 8px;
  padding: 1rem;
  font-family: "Fira Code", monospace;
  font-size: .8rem;
  line-height: 1.6;
  max-height: 220px;
  overflow-y: auto;
}

/* ── Results ─────────────────────── */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
  gap: .6rem;
}
.results-header h2 { font-size: 1.2rem; display: flex; align-items: center; gap: .5rem; }
.badge {
  background: #6366f1;
  color: #fff;
  border-radius: 99px;
  padding: .15rem .6rem;
  font-size: .8rem;
  font-weight: 700;
}
.actions { display: flex; gap: .6rem; }
.btn-secondary {
  background: #f4f4f8;
  color: #333;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  padding: .5rem 1rem;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-secondary:hover { background: #e8e8f0; }

.airtable-status {
  padding: .7rem 1rem;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 500;
  margin-bottom: 1rem;
}
.airtable-status.success { background: #d1fae5; color: #065f46; }
.airtable-status.error   { background: #fee2e2; color: #991b1b; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
thead th {
  text-align: left;
  padding: .6rem .8rem;
  background: #f8f8fc;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #888;
  border-bottom: 1.5px solid #eee;
}
tbody tr { border-bottom: 1px solid #f2f2f2; transition: background .1s; }
tbody tr:hover { background: #fafafe; }
td { padding: .6rem .8rem; vertical-align: middle; }

.score-hot  { background: #dcfce7; color: #166534; border-radius: 6px; padding: .15rem .5rem; font-weight: 700; font-size: .78rem; }
.score-warm { background: #fef9c3; color: #854d0e; border-radius: 6px; padding: .15rem .5rem; font-weight: 700; font-size: .78rem; }
.score-cold { background: #fce7f3; color: #9d174d; border-radius: 6px; padding: .15rem .5rem; font-weight: 700; font-size: .78rem; }
.score-weak { background: #fee2e2; color: #991b1b; border-radius: 6px; padding: .15rem .5rem; font-weight: 700; font-size: .78rem; }

.email-personal { color: #4f46e5; font-weight: 600; }
.email-generic  { color: #888; }

td a { color: #6366f1; text-decoration: none; font-size: .82rem; }
td a:hover { text-decoration: underline; }

.hidden { display: none !important; }

/* ── Tabs ─────────────────────────── */
.tabs {
  display: flex;
  gap: .5rem;
  background: #fff;
  border-radius: 14px;
  padding: .5rem;
  box-shadow: 0 2px 12px rgba(0,0,0,.07);
}
.tab {
  flex: 1;
  padding: .6rem 1rem;
  border: none;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: #666;
  transition: background .15s, color .15s;
}
.tab.active {
  background: #6366f1;
  color: #fff;
}
.tab:hover:not(.active) { background: #f0f0f8; }

/* ── Campaign form ────────────────── */
textarea {
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  padding: .6rem .9rem;
  font-size: .9rem;
  outline: none;
  resize: vertical;
  transition: border-color .2s;
  font-family: inherit;
}
textarea:focus { border-color: #6366f1; }

.gsheets-toggle {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}
.hint { font-size: .8rem; color: #f59e0b; }

.campaign-actions {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.campaign-actions button {
  padding: .6rem 1.2rem;
  border-radius: 9px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s;
}
#c-start-btn { background: #6366f1; color: #fff; }
#c-start-btn:hover { background: #4f46e5; }

.btn-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1.5px solid #fca5a5 !important;
}
.btn-danger:hover { background: #fecaca !important; }

/* ── Campaign status bar ──────────── */
.campaign-status-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: .8rem;
  flex-wrap: wrap;
}
.status-badge {
  padding: .25rem .7rem;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.status-badge.idle    { background: #f3f4f6; color: #6b7280; }
.status-badge.running { background: #dcfce7; color: #166534; }
.status-badge.paused  { background: #fef9c3; color: #854d0e; }
.status-badge.done    { background: #dbeafe; color: #1e40af; }

#c-combo-label { font-size: .9rem; color: #444; flex: 1; }
#c-contacts-count { font-size: .85rem; font-weight: 700; color: #6366f1; }

.progress-label {
  text-align: right;
  font-size: .78rem;
  color: #999;
  margin-top: -.6rem;
  margin-bottom: .8rem;
}

#c-log-box {
  background: #1e1e2e;
  color: #a6e3a1;
  border-radius: 8px;
  padding: 1rem;
  font-family: "Fira Code", monospace;
  font-size: .8rem;
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
  margin-top: .8rem;
}
