@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --bg: #ffffff;
  --text: #0b0d12;
  --muted: #6b7280;
  --border: #d7e6f5;
  --accent: #1d9bf0;
  --accent-soft: rgba(29, 155, 240, 0.12);
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --card: #ffffff;
}

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

body {
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image: radial-gradient(rgba(29, 155, 240, 0.05) 1px, transparent 0);
  background-size: 26px 26px;
}

p {
  line-height: 1.5;
}

h1, h2, h3 {
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  letter-spacing: -0.02em;
}

.muted {
  color: var(--muted);
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 40px;
  border-radius: 16px;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
}

.brand {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  color: var(--accent);
  font-size: 18px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.hidden-field {
  position: absolute;
  opacity: 0;
  height: 0;
  width: 0;
  pointer-events: none;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 500;
  font-size: 14px;
}

input, textarea {
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: #ffffff;
  outline: none;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease, background 0.2s ease;
}

.btn.lg {
  padding: 13px 26px;
  font-size: 16px;
}

.btn.primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 10px 20px rgba(29, 155, 240, 0.25);
}

.btn.primary:hover {
  transform: translateY(-1px);
}

.btn.outline {
  background: #ffffff;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.btn.outline:hover {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn.ghost {
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn.ghost:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn.ghost.danger {
  border-color: #f2b8b5;
  color: #b42318;
}

.btn.ghost.danger:hover {
  border-color: #f97066;
  box-shadow: 0 0 0 3px rgba(249, 112, 102, 0.2);
}

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  border-right: 1px solid var(--border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: #ffffff;
}

.sidebar-brand {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  color: var(--accent);
  font-size: 22px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nav-item {
  border: 1px solid transparent;
  background: #ffffff;
  padding: 10px 12px;
  border-radius: 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  display: block;
  transition: border 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.nav-item.active,
.nav-item:hover:enabled {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  color: var(--accent);
}

.nav-item:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.sidebar-footer {
  margin-top: auto;
}

.main {
  flex: 1;
  padding: 32px 40px 48px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 28px;
}

.main-header h1 {
  font-size: 28px;
}

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

.content-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
}

.content-grid.single {
  grid-template-columns: 1fr;
}

.panel-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-header h2 {
  font-size: 20px;
}

.pill {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
}

.accounts-list {
  display: grid;
  gap: 16px;
  max-height: calc(100vh - 320px);
  overflow-y: auto;
  padding-right: 6px;
}

.campaigns-list {
  display: grid;
  gap: 16px;
  max-height: calc(100vh - 320px);
  overflow-y: auto;
  padding-right: 6px;
}

.account-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.account-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.account-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border);
  object-fit: cover;
}

.account-meta h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.account-meta span {
  font-size: 12px;
  color: var(--muted);
}

.campaign-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.campaign-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.campaign-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.status-pill.draft {
  color: #7a4f01;
  background: #fff2d6;
  border-color: #f9dbaf;
}

.status-pill.published {
  color: #067647;
  background: #d1fadf;
  border-color: #abefc6;
}

.status-pill.ready {
  color: #155eef;
  background: #e8f0ff;
  border-color: #c7d7ff;
}

.status-pill.scraping {
  color: #7a4f01;
  background: #fff2d6;
  border-color: #f9dbaf;
}

.status-pill.error {
  color: #b42318;
  background: #ffe4e8;
  border-color: #f9b4c2;
}

.campaign-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.campaign-message {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text);
  background: #f8fbff;
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  max-width: 420px;
}

.campaign-accounts {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.campaign-sources {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  background: #ffffff;
}

.campaign-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.empty-state {
  border: 1px dashed var(--border);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
}

.instructions .instruction-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.instruction-step {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 16px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  align-items: start;
}

.instruction-step .step-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.instruction-step .btn {
  width: fit-content;
}

.instruction-step h3 {
  font-size: 16px;
  margin-bottom: 6px;
}

.instruction-step p {
  margin: 0;
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--accent);
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.modal.active {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.3);
}

.modal-card {
  position: relative;
  background: #ffffff;
  border-radius: 20px;
  padding: 24px;
  width: min(520px, 92vw);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 1;
}

#campaign-modal .modal-card {
  width: min(640px, 92vw);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.icon-btn {
  border: none;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.step-marker {
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
}

.step-marker.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

#lead-stepper {
  grid-template-columns: repeat(3, 1fr);
  justify-items: center;
}

#lead-stepper .step-marker {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.step-panel {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.step-panel.active {
  display: flex;
}

.accounts-select {
  display: grid;
  gap: 12px;
}

.account-option {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
}

.account-option input {
  margin: 0;
}

.account-option .option-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.account-option .option-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: cover;
}

.personalization-bar {
  display: flex;
  justify-content: flex-start;
}

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

.small {
  font-size: 12px;
}

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

#lead-campaign-modal .modal-form {
  text-align: center;
}

#lead-campaign-modal select {
  width: 100%;
  margin-top: 8px;
}

.centered {
  text-align: center;
}

.checkbox-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  align-self: flex-start;
  flex-direction: row;
  gap: 10px;
  font-size: 13px;
}

#campaign-modal .form-actions {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

#campaign-modal #campaign-back {
  justify-self: start;
}

#campaign-modal #campaign-next,
#campaign-modal #campaign-save {
  justify-self: center;
}

.leads-list {
  display: grid;
  gap: 16px;
  max-height: calc(100vh - 320px);
  overflow-y: auto;
  padding-right: 6px;
}

.lead-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  transition: border 0.2s ease, box-shadow 0.2s ease;
  background: #ffffff;
}

.lead-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.lead-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

.lead-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.source-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  background: #ffffff;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.source-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.coming-soon {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #eef1f6;
  color: #6b7280;
  border-radius: 999px;
  padding: 2px 8px;
}

.source-card small {
  color: var(--muted);
  font-size: 12px;
}

.source-card.active,
.source-card:not(.disabled):hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.source-card.disabled {
  cursor: not-allowed;
  background: #f7f7f9;
  border-color: var(--border);
  box-shadow: none;
  opacity: 0.8;
}

.source-card.disabled .coming-soon {
  background: #e2e6ef;
}

.modal-body {
  margin: 8px 0 16px;
}

.lead-config {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.lead-config.active {
  display: flex;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.campaign-select {
  display: grid;
  gap: 10px;
}

.campaign-option {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
}

.campaign-option input {
  margin: 0;
}

.form-error {
  color: #b42318;
  font-size: 13px;
}

.auth-error {
  color: #b42318;
  font-size: 13px;
}

.form-success {
  color: #067647;
  font-size: 13px;
}

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

@media (max-width: 900px) {
  .app {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .main {
    padding: 24px;
  }
}

@media (max-width: 640px) {
  .main-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .auth-card {
    padding: 28px;
  }
  .panel-card {
    padding: 20px;
  }
  .source-grid {
    grid-template-columns: 1fr;
  }
}
