:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-alt: #eef3f9;
  --border: #d7e0ea;
  --text: #18212b;
  --muted: #5f6b7a;
  --accent: #0e7490;
  --accent-dark: #155e75;
  --danger: #b91c1c;
  --danger-dark: #991b1b;
  --success: #15803d;
  --email: #2563eb;
  --email-dark: #1d4ed8;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI Variable", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.5;
  background:
    radial-gradient(circle at top left, rgba(14, 116, 144, 0.12), transparent 28%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
  color: var(--text);
  overflow-x: hidden;
}

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.page {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.login-page {
  width: min(480px, 100%);
}

.login-card {
  padding: 32px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(215, 224, 234, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.login-form {
  display: grid;
  gap: 16px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.topbar-user {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
  gap: 20px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-copy,
.hero-status {
  padding: 28px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(215, 224, 234, 0.9);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-status {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(circle at top right, rgba(14, 116, 144, 0.16), transparent 42%),
    rgba(255, 255, 255, 0.82);
}

.hero-status-label {
  margin-bottom: 12px;
  color: var(--accent-dark);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-status-value {
  margin-bottom: 0;
  font-size: 1.35rem;
  line-height: 1.35;
  font-weight: 700;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.view-nav {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(215, 224, 234, 0.9);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.view-nav-button {
  flex: 1 1 220px;
  color: var(--text);
  background: var(--surface-alt);
}

.view-nav-button.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
}

.view-section {
  display: none;
}

.view-section.is-active {
  display: block;
}

.section-intro {
  margin-bottom: 20px;
}

.section-intro h3 {
  margin-bottom: 8px;
}

.nested-panel {
  margin-top: 24px;
  margin-bottom: 0;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.96) 0%, rgba(255, 255, 255, 0.98) 100%);
}

.stat-card {
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(215, 224, 234, 0.9);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.stat-label {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.stat-value {
  margin-bottom: 0;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 4vw, 3rem);
}

.subtitle,
.panel-header p,
.form-message {
  color: var(--muted);
}

.panel-note {
  font-size: 0.92rem;
}

.panel {
  margin-bottom: 24px;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.panel-header {
  margin-bottom: 20px;
}

.panel > *:last-child {
  margin-bottom: 0;
}

.export-actions,
.prepared-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.action-toolbar {
  align-items: center;
  padding: 14px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.9) 0%, rgba(238, 243, 249, 0.8) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.action-toolbar select {
  min-width: 220px;
  min-height: 46px;
  padding: 10px 12px;
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.follow-up-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.follow-up-card {
  padding: 16px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 16px;
  min-height: 196px;
}

.follow-up-card h3 {
  margin-bottom: 12px;
}

.follow-up-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.follow-up-item {
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.follow-up-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.06);
}

.follow-up-item p {
  margin-bottom: 6px;
}

.follow-up-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.activity-panel {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.activity-note-row {
  display: flex;
  gap: 12px;
  margin: 12px 0;
}

.activity-note-row input {
  flex: 1;
  min-height: 44px;
  padding: 10px 12px;
  font: inherit;
  color: inherit;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.activity-item {
  padding: 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.activity-item p {
  margin-bottom: 6px;
}

.activity-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.lead-form,
.filter-form,
.communication-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  align-items: start;
}

.communication-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.communication-grid .field:first-child,
.communication-grid .field:last-child {
  grid-column: span 2;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 0.95rem;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font: inherit;
  color: inherit;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.field textarea {
  min-height: 90px;
  resize: vertical;
}

.multi-select {
  position: relative;
}

.multi-select-toggle {
  width: 100%;
  justify-content: space-between;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-weight: 400;
}

.multi-select-toggle::after {
  content: "▾";
  font-size: 0.9rem;
}

.multi-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 240px;
  overflow-y: auto;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.multi-select-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 8px;
}

.multi-select-option:hover {
  background: var(--surface-alt);
}

.multi-select-option input {
  width: 18px;
  height: 18px;
  min-height: 18px;
}

.multi-select-option span {
  flex: 1;
  word-break: break-word;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #94a3b8;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid rgba(14, 116, 144, 0.18);
  border-color: var(--accent);
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}

button,
.action-link {
  min-height: 46px;
  padding: 0 18px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover,
.action-link:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

.danger-button {
  background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
}

.secondary-button {
  background: linear-gradient(135deg, #475569 0%, #334155 100%);
}

.warning-button {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.whatsapp-button {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

.email-button {
  background: linear-gradient(135deg, var(--email) 0%, var(--email-dark) 100%);
}

.email-replied-button {
  background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
}

.disabled-button {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}

.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.pagination-buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pagination-button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
}

.pagination-button.is-active {
  background: linear-gradient(135deg, var(--accent-dark) 0%, #0f3f52 100%);
}

.pagination-ellipsis {
  color: var(--muted);
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1600px;
}

th,
td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  font-size: 0.9rem;
  color: var(--muted);
  background: rgba(248, 250, 252, 0.96);
}

tbody tr {
  transition: background-color 120ms ease;
}

tbody tr:nth-child(even) {
  background: rgba(248, 250, 252, 0.55);
}

tbody tr:hover {
  background: rgba(224, 242, 254, 0.35);
}

.checkbox-cell {
  width: 48px;
  text-align: center;
}

.row-checkbox,
#select-all-leads {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.actions-cell {
  min-width: 320px;
}

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

.small-button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.9rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-new {
  color: #0f4c81;
  background: #dbeafe;
}

.status-contacted {
  color: #075985;
  background: #cffafe;
}

.status-quoted {
  color: #92400e;
  background: #fef3c7;
}

.status-follow_up {
  color: #166534;
  background: #dcfce7;
}

.status-won {
  color: #166534;
  background: #bbf7d0;
}

.status-lost {
  color: #991b1b;
  background: #fee2e2;
}

.form-message {
  min-height: 24px;
  margin-bottom: 0;
  font-size: 0.95rem;
}

.form-message.is-success {
  color: var(--success);
}

.form-message.is-error {
  color: var(--danger);
}

.muted-value {
  color: #94a3b8;
}

.empty-state {
  text-align: center;
  color: var(--muted);
}

.hidden {
  display: none;
}

.prepared-panel {
  margin-top: 16px;
  padding: 16px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.deliverability-panel {
  margin-top: 16px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.95) 0%, rgba(238, 243, 249, 0.92) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.checklist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.checklist-card {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.checklist-title {
  margin-bottom: 6px;
  font-weight: 700;
  color: var(--accent-dark);
}

.tracking-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 150px;
}

.tracking-prepared {
  color: #1d4ed8;
  background: #dbeafe;
}

.tracking-opened {
  color: #075985;
  background: #cffafe;
}

.tracking-replied {
  color: #0f766e;
  background: #ccfbf1;
}

.tracking-bounced {
  color: #92400e;
  background: #fde68a;
}

.tracking-unsubscribed {
  color: #991b1b;
  background: #fee2e2;
}

.prepared-card {
  min-width: 260px;
  max-width: 360px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.prepared-card p {
  margin-bottom: 8px;
}

.prepared-preview {
  color: var(--muted);
  font-size: 0.92rem;
  white-space: pre-wrap;
}

.selected-outreach-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.selected-outreach-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.selected-outreach-card input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 4px;
  cursor: pointer;
}

.selected-outreach-card p {
  margin-bottom: 6px;
}

.outreach-pagination {
  margin-top: 16px;
}

.lead-name {
  font-weight: 700;
  line-height: 1.4;
}

.lead-contact,
.lead-date {
  line-height: 1.55;
}

.lead-link {
  color: var(--accent-dark);
  text-decoration: none;
  word-break: break-word;
}

.lead-link:hover {
  text-decoration: underline;
}

@media (max-width: 720px) {
  .page {
    width: calc(100% - 20px);
    padding-top: 20px;
    padding-bottom: 32px;
  }

  .hero,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 18px;
    border-radius: 16px;
  }

  .form-actions,
  .export-actions,
  .prepared-list,
  .pagination-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .activity-note-row {
    flex-direction: column;
  }

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

  .communication-grid .field:first-child,
  .communication-grid .field:last-child {
    grid-column: auto;
  }

  .action-toolbar select,
  button,
  .action-link {
    width: 100%;
  }

  .pagination-buttons {
    justify-content: flex-start;
  }

  table {
    min-width: 1200px;
  }
}
