:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(60, 60, 67, 0.14);
  --panel: rgba(255, 255, 255, 0.78);
  --panel-solid: #ffffff;
  --accent: #007aff;
  --accent-strong: #0057d9;
  --accent-soft: #e8f2ff;
  --warning: #ff9500;
  --danger: #ff3b30;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
  --soft-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 10%, rgba(0, 122, 255, 0.12), transparent 28%),
    radial-gradient(circle at 80% 0%, rgba(175, 82, 222, 0.1), transparent 26%),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a.primary-button,
a.ghost-button {
  cursor: pointer;
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 30% 20%, rgba(0, 122, 255, 0.16), transparent 28%),
    radial-gradient(circle at 80% 70%, rgba(52, 199, 89, 0.1), transparent 25%),
    var(--bg);
}

.auth-panel {
  display: grid;
  width: min(460px, 100%);
  gap: 22px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
}

.auth-brand {
  padding-bottom: 4px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border: 1px solid rgba(60, 60, 67, 0.08);
  border-radius: 14px;
  background: rgba(118, 118, 128, 0.12);
}

.auth-tab {
  min-height: 38px;
  border: 0;
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
}

.auth-tab.active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-steps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-step {
  display: grid;
  min-height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 700;
}

.auth-step.active {
  color: var(--accent-strong);
  border-color: rgba(0, 122, 255, 0.24);
  background: var(--accent-soft);
  box-shadow: none;
}

.complete-message {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(0, 122, 255, 0.18);
  border-radius: 16px;
  background: var(--accent-soft);
}

.complete-message span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.register-step-two {
  display: grid;
  gap: 14px;
}

.auth-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.auth-note a,
.legal-document a,
.sidebar-link {
  color: var(--accent-strong);
  text-decoration: none;
}

.auth-note a:hover,
.legal-document a:hover,
.sidebar-link:hover {
  text-decoration: underline;
}

.legal-note {
  margin-top: -4px;
}

.user-chip {
  min-height: 42px;
  max-width: 220px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100vh;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  backdrop-filter: blur(24px);
}

.brand,
.nav-item,
.status-line,
.topbar,
.top-actions,
.panel-heading,
.checkbox-row,
.lead-main,
.queue-item,
.conversation-item,
.integration-card {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  border: 0;
  color: #fff;
  background: linear-gradient(145deg, #007aff, #5e5ce6);
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(0, 122, 255, 0.22);
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.status-card small,
.metric small,
.panel-heading p,
.lead-comment,
.conversation-item p,
.integration-card p {
  color: var(--muted);
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  font-weight: 700;
}

.nav-item.active,
.nav-item:hover {
  color: var(--ink);
  border-color: rgba(60, 60, 67, 0.08);
  background: rgba(118, 118, 128, 0.12);
}

.icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 8px;
  border: 0;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.status-card {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
}

.sidebar-link {
  display: inline-flex;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 700;
}

.status-line {
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 700;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--muted);
}

.dot.ok {
  background: #34c759;
}

.workspace {
  min-width: 0;
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 32px;
}

.topbar {
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.topbar > div:first-child {
  min-width: min(100%, 360px);
  flex: 1 1 420px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

h1 {
  max-width: 820px;
  margin-bottom: 0;
  font-size: clamp(34px, 4.6vw, 64px);
  line-height: 1.02;
  font-weight: 750;
}

h2 {
  margin-bottom: 6px;
  font-size: 20px;
  font-weight: 720;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.top-actions {
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
  justify-content: flex-end;
}

.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  text-decoration: none;
}

.primary-button {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 8px 20px rgba(0, 122, 255, 0.22);
}

.primary-button:hover {
  background: var(--accent-strong);
}

.ghost-button {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  border-color: var(--line);
}

.ghost-button:hover {
  background: rgba(118, 118, 128, 0.14);
  color: var(--ink);
}

.ghost-button.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.primary-button.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
  white-space: nowrap;
}

.primary-button.full {
  width: 100%;
}

.meta-result-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.meta-result {
  display: grid;
  width: min(560px, 100%);
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.meta-result h1 {
  font-size: 36px;
}

.meta-result p {
  color: var(--muted);
  line-height: 1.5;
}

.legal-page {
  min-height: 100vh;
  padding: 32px;
}

.legal-document {
  width: min(920px, 100%);
  margin: 0 auto;
}

.legal-back {
  margin-bottom: 18px;
}

.legal-hero,
.legal-section {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.legal-hero {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
  padding: 28px;
}

.legal-hero h1 {
  font-size: clamp(34px, 5vw, 56px);
}

.legal-hero p,
.legal-section p,
.legal-section li {
  color: var(--muted);
  line-height: 1.6;
}

.legal-section {
  padding: 24px 28px;
  margin-bottom: 12px;
}

.legal-section ul {
  margin: 0;
  padding-left: 20px;
}

.legal-section li + li {
  margin-top: 8px;
}

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

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
  background: rgba(255, 255, 255, 0.76);
}

.metric span,
.metric small {
  display: block;
}

.metric strong {
  display: block;
  margin: 10px 0 4px;
  font-size: 38px;
  line-height: 1;
  font-weight: 760;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.92fr) minmax(420px, 1.08fr);
  gap: 18px;
}

.panel {
  padding: 22px;
}

.panel-heading {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-heading p {
  margin-bottom: 0;
}

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 700;
}

.badge,
.pill.ready {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.pill.blocked {
  color: #9a5b00;
  background: #fff3d6;
}

.composer {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(60, 60, 67, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  outline: none;
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 132px;
  resize: vertical;
  padding: 12px;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(0, 122, 255, 0.52);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.12);
}

.two-cols {
  display: grid;
  grid-template-columns: 1fr 136px;
  gap: 12px;
}

.checkbox-row {
  grid-template-columns: 18px 1fr;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.7);
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

.form-actions {
  display: grid;
  gap: 10px;
}

.lead-list,
.queue-list,
.conversation-list,
.campaign-recipient-list,
.settings-grid {
  display: grid;
  gap: 10px;
}

.lead-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.campaign-card.selected {
  border-color: rgba(0, 122, 255, 0.42);
  background: rgba(232, 242, 255, 0.76);
}

.campaign-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.campaign-stats span {
  min-height: 26px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(118, 118, 128, 0.12);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.lead-main {
  justify-content: space-between;
  gap: 12px;
}

.lead-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-comment {
  margin: 0;
  line-height: 1.45;
}

.muted-label {
  color: var(--muted);
  font-weight: 700;
}

.error-text {
  color: var(--danger);
  font-weight: 700;
}

.lead-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(118, 118, 128, 0.12);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.mini-button:hover {
  background: rgba(0, 122, 255, 0.12);
}

.mini-button.danger {
  color: var(--danger);
  background: rgba(255, 59, 48, 0.1);
}

.queue-item,
.conversation-item,
.integration-card {
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.integration-card-wide {
  align-items: flex-start;
}

.callback-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.callback-list li {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.callback-list strong {
  color: var(--ink);
}

code {
  overflow-wrap: anywhere;
  border-radius: 8px;
  padding: 2px 6px;
  background: rgba(118, 118, 128, 0.12);
  color: var(--ink);
  font-size: 12px;
}

.queue-item.sent {
  border-color: rgba(52, 199, 89, 0.28);
  background: #eefbf2;
}

.queue-item.skipped {
  opacity: 0.64;
}

.queue-item p,
.conversation-item p,
.integration-card p {
  margin-bottom: 0;
  line-height: 1.45;
}

.hidden {
  display: none;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100vw - 48px));
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(60, 60, 67, 0.14);
  color: #fff;
  background: rgba(29, 29, 31, 0.88);
  backdrop-filter: blur(18px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(12px);
  transition: 180ms ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-item {
    justify-content: center;
  }

  .nav-item span:last-child {
    display: none;
  }

  .status-card {
    margin-top: 0;
  }

  .topbar,
  .content-grid,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .top-actions,
  .two-cols {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .top-actions {
    display: grid;
  }

  .user-chip {
    max-width: none;
    width: 100%;
  }

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

  .queue-item,
  .conversation-item,
  .integration-card,
  .lead-main {
    align-items: flex-start;
    flex-direction: column;
  }
}
