:root {
  color-scheme: dark;
  --bg: #070a0f;
  --surface: #0e141c;
  --surface-soft: #111a25;
  --surface-line: #172232;
  --border: rgba(181, 199, 222, .15);
  --text: #f5f8fc;
  --muted: #91a0b4;
  --accent: #3f83ff;
  --accent-strong: #69a0ff;
  --success: #23c982;
  --error: #f35f70;
  --warning: #f4bd3f;
  --logo-byline: #8EA0B5;
  --on-accent: #ffffff;
  --shadow: rgba(0, 0, 0, .34);
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --accent-ring: color-mix(in srgb, var(--accent) 22%, transparent);
  --surface-alpha: color-mix(in srgb, var(--surface) 88%, transparent);
  --workspace-max-width: 1180px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f6f8fb;
  --surface-line: #e8edf4;
  --border: rgba(15, 23, 42, .13);
  --text: #101827;
  --muted: #617084;
  --accent: #2769d6;
  --accent-strong: #1f5fca;
  --success: #0d8b61;
  --error: #c84657;
  --warning: #a37116;
  --logo-byline: var(--muted);
  --shadow: rgba(15, 23, 42, .12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-top: 78px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 5%, transparent), transparent 300px),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.site-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 30;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
}

.brand-lockup {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-link {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  display: block;
  text-decoration: none;
}

.brand-logo,
.hero-logo {
  display: block;
  object-fit: contain;
}

.brand-logo {
  width: 54px;
  height: 54px;
}

.brand-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.brand-title,
.brand-byline {
  width: max-content;
  max-width: 100%;
  display: block;
  text-decoration: none;
}

.brand-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 820;
  line-height: 1.1;
}

.brand-byline {
  color: var(--logo-byline);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.15;
}

.header-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.auth-screen {
  position: fixed;
  inset: 76px 0 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(260px, 420px) minmax(360px, 430px);
  place-content: center;
  gap: 24px;
  padding: 28px 18px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 5%, transparent), transparent 360px),
    var(--bg);
  overflow-x: hidden;
}

.auth-visual {
  min-height: 420px;
  display: grid;
  align-content: center;
  gap: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--border) 34%, transparent) 1px, transparent 1px),
    linear-gradient(180deg, color-mix(in srgb, var(--border) 28%, transparent) 1px, transparent 1px),
    color-mix(in srgb, var(--surface) 82%, transparent);
  background-size: 34px 34px;
  box-shadow: 0 28px 80px var(--shadow);
  padding: 26px;
}

.auth-orbit {
  min-height: 214px;
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 46%, transparent);
  overflow: hidden;
}

.auth-orbit::before,
.auth-orbit::after {
  content: "";
  position: absolute;
  inset: 32px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
  border-radius: 8px;
}

.auth-orbit::after {
  inset: 70px;
  border-color: color-mix(in srgb, var(--success) 28%, transparent);
}

.auth-signal {
  position: absolute;
  height: 2px;
  background: color-mix(in srgb, var(--accent) 70%, transparent);
}

.signal-one {
  width: 118px;
  top: 55px;
  left: 38px;
}

.signal-two {
  width: 96px;
  right: 44px;
  bottom: 62px;
}

.signal-three {
  width: 74px;
  right: 76px;
  top: 92px;
}

.auth-flow-preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.auth-flow-preview span {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.auth-copy {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 12px;
}

.auth-copy h1 {
  max-width: 100%;
  margin: 0;
  color: var(--text);
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.02;
  overflow-wrap: anywhere;
}

.auth-copy p {
  max-width: 440px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.55;
}

.auth-card-stack {
  display: grid;
  align-items: center;
}

.auth-panel {
  min-width: 0;
  width: min(420px, calc(100vw - 32px));
  display: grid;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 20px 60px var(--shadow);
  padding: 22px;
}

.auth-panel label,
.auth-panel input,
.auth-panel button {
  min-width: 0;
}

.auth-logo {
  width: 62px;
  height: 62px;
  object-fit: contain;
}

.password-policy {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

body:not(.is-authenticated) main {
  visibility: hidden;
}

.app-switcher {
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alpha);
  padding: 7px;
}

.switcher-tabs {
  display: flex;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.switcher-button,
.admin-tab {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  padding: 0 14px;
}

.switcher-button.active,
.admin-tab.active {
  border-color: var(--border);
  background: var(--surface-soft);
  color: var(--text);
}

.ai-assistant-nav-button {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 10%, transparent);
}

.ai-assistant-nav-button.active,
.ai-assistant-nav-button:hover {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--border));
  background: color-mix(in srgb, var(--accent) 20%, var(--surface));
  color: var(--text);
}

.ai-assistant-drawer {
  display: grid;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--border));
  border-radius: 8px;
  background: var(--surface-alpha);
  box-shadow: 0 22px 70px var(--shadow);
  padding: 12px;
}

.ai-chat-head,
.ai-chat-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-chat-head strong {
  display: block;
  margin-top: 2px;
}

.ai-chat-messages {
  min-height: 260px;
  max-height: 420px;
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 32%, var(--surface));
  padding: 12px;
}

.ai-chat-message {
  width: min(78%, 680px);
  display: grid;
  gap: 4px;
}

.ai-chat-message span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.ai-chat-message p {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.55;
  padding: 10px 12px;
  white-space: pre-wrap;
}

.ai-chat-message.from-user {
  justify-self: end;
}

.ai-chat-message.from-user span {
  text-align: right;
}

.ai-chat-message.from-user p {
  border-color: color-mix(in srgb, var(--accent) 36%, var(--border));
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
}

.ai-chat-message.pending p {
  color: var(--muted);
}

.ai-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.ai-chat-form input {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  padding: 0 12px;
}

.shell {
  width: min(var(--workspace-max-width), calc(100% - 32px));
  display: grid;
  gap: 22px;
  margin: 0 auto;
  padding: 28px 0 34px;
}

.hero {
  min-height: 250px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 12px;
  text-align: center;
}

.hero-logo {
  width: 76px;
  height: 76px;
  filter: drop-shadow(0 18px 35px color-mix(in srgb, var(--accent) 24%, transparent));
}

.hero h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(48px, 8vw, 94px);
  font-weight: 900;
  letter-spacing: 0;
  line-height: .92;
}

.hero-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid currentColor;
  color: color-mix(in srgb, var(--text) 72%, var(--accent));
  font-size: 20px;
  font-weight: 850;
  line-height: 1.35;
  text-decoration: none;
}

.hero-link:hover {
  color: var(--accent-strong);
}

.hero-link svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

.hero-link path,
.datetime-trigger path,
.calendar-icon-button path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.pipeline-shell {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alpha);
  box-shadow: 0 28px 90px var(--shadow);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.pipeline-track {
  list-style: none;
  margin: 0;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  background: var(--surface-line);
}

.pipeline-node {
  min-height: 70px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.pipeline-node.active {
  color: var(--text);
  background: linear-gradient(135deg, var(--accent-soft), var(--surface));
}

.pipeline-node.complete {
  color: var(--success);
}

.node-mark {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--surface-soft);
  color: inherit;
  font-size: 11px;
  font-weight: 950;
}

.pipeline-node.complete .node-mark {
  border-color: color-mix(in srgb, var(--success) 42%, var(--border));
}

.pipeline-node.complete .node-mark::before {
  content: "✓";
}

.pipeline-node.complete .node-mark {
  font-size: 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(310px, .75fr);
  min-height: 520px;
}

.flow-panel,
.results-panel {
  min-width: 0;
  padding: 28px;
}

.flow-panel {
  display: grid;
  gap: 0;
  border-right: 1px solid var(--border);
}

.flow-section {
  display: grid;
  gap: 16px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}

.flow-section:first-of-type {
  padding-top: 0;
}

.flow-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.section-head {
  display: grid;
  gap: 4px;
}

.section-kicker {
  width: max-content;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.section-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 880;
  letter-spacing: 0;
  line-height: 1.2;
}

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

.source-mode-toggle {
  width: fit-content;
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 4px;
}

.source-mode-toggle label {
  min-height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  padding: 0 12px;
  white-space: nowrap;
}

.source-mode-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.source-mode-toggle label:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  color: var(--text);
}

.source-card {
  min-height: 114px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  padding: 14px 10px;
  font-weight: 850;
}

.source-card:hover,
.source-card.active {
  border-color: var(--accent);
}

.source-card.active {
  background: linear-gradient(135deg, var(--accent-soft), var(--surface-soft));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 36%, transparent);
}

.brand-icon {
  width: 46px;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--surface);
}

.brand-icon svg {
  width: 25px;
  height: 25px;
}

.bayt-logo span {
  color: #1f8a70;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: lowercase;
}

.telegram-logo svg,
.whatsapp-logo svg,
.linkedin-logo svg {
  fill: currentColor;
}

.telegram-logo {
  color: #2aabee;
}

.whatsapp-logo {
  color: #25d366;
}

.linkedin-logo {
  color: #0a66c2;
}

.google-logo svg {
  width: 27px;
  height: 27px;
}

.g-blue {
  fill: #4285f4;
}

.g-green {
  fill: #34a853;
}

.g-yellow {
  fill: #fbbc05;
}

.g-red {
  fill: #ea4335;
}

.panel,
label {
  display: grid;
  gap: 8px;
}

label span,
.field-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  outline: none;
}

input {
  min-height: 56px;
  padding: 0 16px;
}

textarea {
  min-height: 164px;
  padding: 14px;
  resize: vertical;
  line-height: 1.65;
}

input:focus,
textarea:focus,
.datetime-trigger:focus,
.theme-toggle:focus-visible,
.source-card:focus-visible,
.range-button:focus-visible,
.primary-button:focus-visible,
.tool-button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
  outline: none;
}

input.is-invalid {
  border-color: color-mix(in srgb, var(--warning) 72%, var(--border));
  background: color-mix(in srgb, var(--surface-soft) 88%, var(--warning) 12%);
}

.field-warning {
  margin: 0;
  color: color-mix(in srgb, var(--warning) 82%, var(--text));
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.upload-box {
  min-height: 54px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--surface-soft) 70%, transparent);
  cursor: pointer;
}

.upload-box input {
  display: none;
}

.upload-box span,
.calendar-days button.today,
.calendar-actions button:last-child {
  color: var(--accent);
}

.range-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.range-button,
.calendar-actions button,
.time-panel input,
.time-panel button,
.tool-button,
.theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
}

.range-button {
  min-height: 46px;
  border-radius: 8px;
  font-weight: 900;
}

.range-button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.date-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.datetime-field {
  min-width: 0;
}

.datetime-trigger {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  padding: 0 14px;
  text-align: left;
}

.datetime-trigger span {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.datetime-trigger svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.primary-button,
.tool-button,
.theme-toggle {
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

.application-panel {
  display: grid;
  gap: 16px;
  margin: 22px 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.compact-head {
  margin: 0;
}

.gmail-row,
.application-fields {
  display: grid;
  gap: 14px;
}

.gmail-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
}

.gmail-row p,
.application-fields small {
  margin: 4px 0 0;
  color: var(--muted);
}

.application-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.application-fields label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.subject-controls {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.subject-controls legend {
  padding: 0;
}

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

.subject-mode label {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  text-align: center;
}

.subject-mode input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.subject-mode label:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  color: var(--text);
}

.application-fields input,
.application-fields textarea {
  width: 100%;
}

.wide-field {
  grid-column: 1 / -1;
}

.button-link {
  text-decoration: none;
}

.email-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
}

.email-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.email-main span {
  color: var(--muted);
}

.lead-row {
  cursor: pointer;
}

.lead-row .email-main {
  min-width: 0;
}

.lead-row a {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--brand-ice);
  font-weight: 900;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-row a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.status-badge {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.status-sent {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  color: var(--accent-strong);
}

.status-open {
  border-color: color-mix(in srgb, var(--success) 46%, var(--border));
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
}

.status-failed {
  color: var(--error);
}

.status-sending {
  color: var(--warning);
}

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

.application-error {
  grid-column: 2 / -1;
  color: var(--error);
}

@media (max-width: 700px) {
  .gmail-row,
  .application-fields {
    grid-template-columns: 1fr;
  }

  .wide-field {
    grid-column: auto;
  }
}

.results .email-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
}

.results-filter-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.results-filter-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.results-filter-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
}

.result-source-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.result-source-summary button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  padding: 0 14px;
}

.result-source-summary button.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--text);
}

.result-source-summary span {
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.result-source-summary strong {
  display: none;
}

.primary-button {
  min-height: 56px;
  border: 1px solid var(--accent);
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 78%, var(--text)));
  color: var(--on-accent);
}

.secondary-button {
  min-height: 56px;
  border: 1px solid color-mix(in srgb, var(--accent) 46%, var(--border));
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, transparent), transparent 68%),
    color-mix(in srgb, var(--surface-soft) 84%, var(--accent) 16%);
  color: color-mix(in srgb, var(--text) 90%, var(--accent-strong));
  cursor: pointer;
  font-weight: 900;
  padding: 0 24px;
}

.secondary-button:hover {
  border-color: color-mix(in srgb, var(--accent) 72%, var(--border));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 23%, transparent), transparent 68%),
    color-mix(in srgb, var(--surface-soft) 78%, var(--accent) 22%);
  color: var(--text);
}

.theme-toggle {
  width: 62px;
  min-height: 44px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.results-panel {
  position: sticky;
  top: 96px;
  align-self: start;
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-line);
}

.metrics-row > div {
  min-height: 98px;
  display: grid;
  align-content: center;
  gap: 8px;
  background: var(--surface-soft);
  padding: 16px;
}

.metrics-row span {
  display: block;
  color: var(--accent);
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 950;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.metrics-row.is-scanning span {
  font-size: clamp(13px, 1.6vw, 16px);
  line-height: 1.2;
}

.metrics-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.result-actions {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.result-status-stack {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.state {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.result-state {
  width: max-content;
  min-height: 22px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 950;
}

.result-state[data-status="scanning"] {
  color: var(--accent-strong);
  font-size: 16px;
}

.result-state[data-status="done"] {
  color: var(--success);
}

.result-state[data-status="empty"] {
  color: var(--warning);
}

.result-state[data-status="error"] {
  color: var(--error);
}

.result-range-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.tool-button {
  min-height: 40px;
  color: var(--text);
  padding: 0 14px;
}

.button-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.new-extraction-button {
  border-color: color-mix(in srgb, var(--accent) 46%, var(--border));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 13%, transparent), transparent 68%),
    color-mix(in srgb, var(--surface-soft) 88%, var(--accent) 12%);
  color: color-mix(in srgb, var(--text) 88%, var(--accent-strong));
}

.new-extraction-button:hover {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--border));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 20%, transparent), transparent 68%),
    color-mix(in srgb, var(--surface-soft) 80%, var(--accent) 20%);
  color: var(--text);
}

button:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.results {
  display: grid;
  gap: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}

.email-row {
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  background: var(--surface-soft);
  padding: 10px 12px;
}

.email-row span {
  direction: ltr;
  text-align: left;
  font-weight: 850;
  word-break: break-all;
}

.date-popover {
  position: absolute;
  z-index: 20;
  width: min(340px, calc(100vw - 28px));
}

.calendar-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 28px 70px var(--shadow);
  padding: 14px;
}

.calendar-head {
  min-height: 42px;
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  gap: 8px;
}

.calendar-head strong {
  color: var(--text);
  font-size: 14px;
  text-align: center;
}

.calendar-icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
}

.calendar-icon-button svg {
  width: 19px;
  height: 19px;
}

.calendar-weekdays,
.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-weekdays {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.calendar-days {
  margin-top: 8px;
}

.calendar-days button,
.calendar-days span {
  width: 100%;
  min-height: 34px;
}

.calendar-days button {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
}

.calendar-days button:hover {
  border-color: var(--border);
  background: var(--surface-soft);
}

.calendar-days button.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.time-panel {
  min-height: 54px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 1fr auto 1fr 64px;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  background: color-mix(in srgb, var(--surface-soft) 70%, transparent);
  padding: 8px;
}

.time-panel input,
.time-panel button {
  min-height: 38px;
  border-radius: 8px;
  color: var(--text);
  font-weight: 900;
  text-align: center;
}

.time-panel input {
  padding: 0 6px;
}

.time-panel input::-webkit-outer-spin-button,
.time-panel input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.time-panel span {
  color: var(--muted);
  font-weight: 900;
}

.calendar-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.calendar-actions button {
  min-height: 40px;
  border-radius: 8px;
  font-weight: 900;
}

.calendar-actions button:last-child {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.hidden {
  display: none !important;
}

@media (max-width: 860px) {
  .hero {
    min-height: 220px;
  }

  .pipeline-track {
    grid-template-columns: 1fr;
  }

  .pipeline-node {
    justify-content: flex-start;
    padding: 0 14px;
  }

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

  .flow-panel {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .results-panel {
    position: static;
  }
}

@media (max-width: 560px) {
  body {
    padding-top: 132px;
  }

  .site-header {
    align-items: stretch;
    flex-direction: column;
  }

  .header-tools,
  .action-buttons {
    width: 100%;
  }


  .shell {
    width: min(100% - 22px, 1180px);
    padding-top: 18px;
  }

  .hero h1 {
    font-size: 46px;
  }

  .hero-link {
    font-size: 17px;
  }

  .flow-panel,
  .results-panel {
    padding: 18px;
  }

  .source-grid,
  .range-options,
  .date-grid,
  .metrics-row {
    grid-template-columns: 1fr;
  }

  .result-actions {
    align-items: stretch;
    flex-direction: column;
    padding: 14px 0;
  }
}

/* Very advanced compact pass */
:root {
  --brand-blue: #4a86ff;
  --brand-blue-soft: #77a8ff;
  --brand-ice: #b8d2ff;
}

html,
body {
  overflow-x: hidden;
}

body {
  padding-top: 76px;
}

.shell {
  gap: 14px;
  padding: 16px 0 18px;
}

.compact-hero {
  min-height: 200px;
  gap: 7px;
}

.compact-hero .hero-logo {
  width: 104px;
  height: 104px;
}

.compact-hero h1 {
  font-size: clamp(40px, 4.8vw, 64px);
  line-height: .94;
}

.compact-hero .hero-link {
  gap: 10px;
  font-size: clamp(20px, 1.65vw, 25px);
  font-weight: 900;
}

.compact-hero .hero-link svg {
  width: 23px;
  height: 23px;
}

.wizard-shell {
  width: min(820px, 100%);
}

.wizard-track {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--brand-blue) 8%, transparent), transparent),
    var(--surface);
}

.wizard-track .pipeline-node {
  min-height: 54px;
  border: 1px solid var(--border);
  border-radius: 8px;
  justify-content: flex-start;
  gap: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 0 14px;
}

.wizard-track .pipeline-node::before,
.wizard-track .pipeline-node::after {
  display: none;
}

.wizard-track .pipeline-node.active {
  border-color: color-mix(in srgb, var(--brand-blue) 72%, var(--border));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--brand-blue) 24%, transparent), transparent 58%),
    var(--surface-soft);
  color: var(--text);
  box-shadow: inset 0 -3px 0 var(--brand-blue);
}

.wizard-track .pipeline-node.complete {
  border-color: color-mix(in srgb, var(--brand-blue-soft) 38%, var(--border));
  color: var(--brand-ice);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--brand-blue) 10%, transparent), transparent),
    var(--surface-soft);
}

.wizard-track .node-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border-color: color-mix(in srgb, currentColor 32%, var(--border));
  background: color-mix(in srgb, var(--bg) 42%, transparent);
  color: inherit;
  font-size: 12px;
  box-shadow: none;
}

.wizard-track .pipeline-node.complete .node-mark::before {
  content: none;
}

.wizard-track .pipeline-node.complete .node-mark {
  font-size: 12px;
}

.wizard-track .pipeline-node.active .node-mark {
  border-color: var(--brand-blue);
  color: var(--text);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-blue) 13%, transparent);
}

.wizard-workspace {
  min-height: auto;
}

.wizard-panel .wizard-step,
.results-panel.wizard-step {
  min-height: 382px;
  padding: 22px 30px;
}

.flow-section {
  gap: 12px;
}

.wizard-panel .section-head h2,
.results-panel .section-head h2 {
  font-size: 19px;
}

.section-kicker {
  font-size: 10px;
}

.source-grid {
  gap: 8px;
}

.source-card {
  min-height: 92px;
  gap: 7px;
  padding: 10px 8px;
}

.brand-icon {
  width: 42px;
  height: 42px;
}

.brand-icon svg,
.brand-icon img {
  width: 25px;
  height: 25px;
  display: block;
  object-fit: contain;
}

.telegram-logo img,
.whatsapp-logo img,
.google-logo img,
.linkedin-logo img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.whatsapp-logo img {
  width: 30px;
  height: 30px;
}

.whatsapp-logo {
  color: inherit;
}

.target-panel {
  margin-top: 0;
}

.source-setup-head {
  display: flex;
  align-items: center;
  gap: 9px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

#telegram-panel .source-setup-head {
  border-top: 0;
  padding-top: 0;
}

.source-setup-head .brand-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
}

.source-setup-head .brand-icon img {
  width: 18px;
  height: 18px;
}

.source-setup-head strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.source-state {
  min-height: 20px;
  font-size: 12px;
}

input {
  min-height: 48px;
}

textarea {
  min-height: 112px;
}

.range-options {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.wizard-panel .range-panel {
  min-height: 250px;
}

.range-button {
  min-height: 52px;
}

.date-grid {
  margin-top: 2px;
}

.datetime-trigger {
  min-height: 48px;
}

.primary-button,
.secondary-button {
  min-height: 48px;
}

.wizard-actions .primary-button {
  min-width: 168px;
}

.metrics-row {
  margin-top: 12px;
}

.metrics-row > div {
  min-height: 72px;
  padding: 12px 14px;
}

.metrics-row span {
  font-size: 30px;
}

.result-actions {
  min-height: 52px;
  margin-bottom: 10px;
}

.results {
  max-height: clamp(360px, 48vh, 620px);
}

.email-row {
  min-height: 40px;
  padding: 8px 10px;
}

.results-footer {
  margin-top: 12px;
  padding-top: 12px;
}

@media (min-width: 1000px) and (max-height: 760px) {
  .compact-hero {
    min-height: 136px;
  }

  .compact-hero .hero-logo {
    width: 66px;
    height: 66px;
  }

  .compact-hero h1 {
    font-size: 48px;
  }

  .compact-hero .hero-link {
    font-size: 18px;
  }

  .wizard-panel .wizard-step,
  .results-panel.wizard-step {
    min-height: 340px;
    padding: 18px 28px;
  }

  .source-card {
    min-height: 82px;
  }

  .range-button {
    min-height: 66px;
  }
}

@media (max-width: 720px) {
  body {
    padding-top: calc(58px + env(safe-area-inset-top, 0px));
    overflow-x: hidden;
  }

  .site-header {
    min-height: calc(58px + env(safe-area-inset-top, 0px));
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: calc(7px + env(safe-area-inset-top, 0px)) 12px 7px;
  }

  .site-header > * {
    min-width: 0;
  }

  .brand-lockup {
    flex: 1 1 auto;
    gap: 8px;
  }

  .brand-logo-link,
  .brand-logo {
    width: 36px;
    height: 36px;
  }

  .brand-logo-link {
    flex-basis: 36px;
  }

  .brand-title {
    font-size: 13px;
    line-height: 1.12;
  }

  .brand-byline {
    max-width: 150px;
    font-size: 10px;
    line-height: 1.15;
  }

  .header-tools {
    width: auto;
    flex: 0 0 auto;
  }


  .shell {
    width: calc(100% - 20px);
    gap: 10px;
    padding: 10px 0 18px;
  }

  .compact-hero {
    min-height: 126px;
    gap: 6px;
    padding: 4px 0 2px;
  }

  .compact-hero .hero-logo {
    width: 58px;
    height: 58px;
  }

  .compact-hero h1 {
    font-size: clamp(34px, 9.8vw, 42px);
    line-height: 1.03;
  }

  .compact-hero .hero-link {
    gap: 7px;
    font-size: clamp(16px, 4.5vw, 18px);
    line-height: 1.2;
  }

  .compact-hero .hero-link svg {
    width: 18px;
    height: 18px;
  }

  .wizard-shell {
    width: 100%;
    max-width: 100%;
  }

  .wizard-track {
    position: static;
    z-index: auto;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
    padding: 7px;
  }

  .wizard-track .pipeline-node {
    min-width: 0;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    padding: 0 5px;
    font-size: 9px;
    line-height: 1.08;
    text-align: left;
  }

  .wizard-track .pipeline-node > span:last-child {
    min-width: 0;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .wizard-track .node-mark,
  .wizard-track .pipeline-node.complete .node-mark {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border-radius: 7px;
    font-size: 9px;
  }

  .wizard-panel .wizard-step,
  .results-panel.wizard-step {
    min-height: auto;
    gap: 15px;
    padding: 22px 16px 24px;
  }

  .section-head {
    gap: 6px;
  }

  .section-kicker {
    font-size: 10px;
    letter-spacing: .1em;
    line-height: 1;
  }

  .wizard-panel .section-head h2,
  .results-panel .section-head h2 {
    font-size: 18px;
    line-height: 1.24;
  }

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

  .source-card {
    min-width: 0;
    min-height: 86px;
    gap: 8px;
    padding: 12px 8px 11px;
    font-size: 14px;
    line-height: 1.15;
  }

  .brand-icon {
    width: 39px;
    height: 39px;
  }

  .telegram-logo img,
  .whatsapp-logo img,
  .google-logo img,
  .linkedin-logo img {
    width: 25px;
    height: 25px;
  }

  .source-card.unavailable {
    opacity: .5;
  }

  .source-card.unavailable em {
    top: 8px;
    right: 8px;
    max-width: 58px;
    overflow: hidden;
    font-size: 0;
    line-height: 1;
    text-overflow: clip;
    white-space: nowrap;
    padding: 4px 6px;
  }

  .source-card.unavailable em::after {
    content: "Soon";
    font-size: 9px;
  }

  .source-state {
    min-height: 0;
    margin: -2px 0 2px;
    font-size: 12px;
    font-weight: 760;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  label {
    gap: 9px;
  }

  label span,
  .field-title {
    font-size: 12px;
    line-height: 1.2;
  }

  input {
    min-width: 0;
    min-height: 46px;
    padding: 0 14px;
    font-size: 14px;
  }

  textarea {
    min-height: 126px;
    font-size: 14px;
    line-height: 1.5;
  }

  .wizard-actions,
  .wizard-actions.split {
    gap: 9px;
    margin-top: 0;
  }

  .primary-button,
  .secondary-button {
    min-height: 46px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1;
  }

  .range-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .range-button {
    min-height: 52px;
    font-size: 13px;
  }

  .range-button[data-range="custom"] {
    grid-column: 1 / -1;
  }
}

@media (max-width: 380px) {

  .source-card {
    min-height: 82px;
    font-size: 13px;
  }
}

@media (max-width: 720px) {

  .shell {
    width: calc(100vw - 20px);
    max-width: 380px;
  }

  .wizard-shell {
    overflow: hidden;
  }
}

@media (max-width: 380px) {

  .shell {
    width: calc(100vw - 16px);
  }
}

/* Mobile experience v3: final override after legacy compact passes */
@media (max-width: 720px) {
  body {
    padding-top: calc(58px + env(safe-area-inset-top, 0px));
    font-size: 14px;
    overflow-x: hidden;
  }

  .site-header {
    min-height: calc(58px + env(safe-area-inset-top, 0px));
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: calc(7px + env(safe-area-inset-top, 0px)) 12px 7px;
  }

  .site-header > * {
    min-width: 0;
  }

  .brand-lockup {
    flex: 1 1 auto;
    gap: 8px;
  }

  .brand-logo-link,
  .brand-logo {
    width: 36px;
    height: 36px;
  }

  .brand-logo-link {
    flex-basis: 36px;
  }

  .brand-title {
    font-size: 13px;
    line-height: 1.12;
  }

  .brand-byline {
    max-width: 150px;
    font-size: 10px;
    line-height: 1.15;
  }

  .header-tools {
    width: auto;
    flex: 0 0 auto;
  }


  .shell {
    width: calc(100% - 20px);
    gap: 10px;
    padding: 10px 0 18px;
  }

  .compact-hero {
    min-height: 126px;
    gap: 6px;
    padding: 4px 0 2px;
  }

  .compact-hero .hero-logo {
    width: 58px;
    height: 58px;
  }

  .compact-hero h1 {
    font-size: clamp(34px, 9.8vw, 42px);
    line-height: 1.03;
  }

  .compact-hero .hero-link {
    gap: 7px;
    font-size: clamp(16px, 4.5vw, 18px);
    line-height: 1.2;
  }

  .compact-hero .hero-link svg {
    width: 18px;
    height: 18px;
  }

  .wizard-shell {
    width: 100%;
    max-width: 100%;
    border-color: color-mix(in srgb, var(--border) 72%, transparent);
    box-shadow: 0 18px 44px color-mix(in srgb, var(--shadow) 58%, transparent);
  }

  .wizard-track {
    position: static;
    z-index: auto;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
    padding: 7px;
  }

  .wizard-track .pipeline-node {
    min-width: 0;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    padding: 0 5px;
    font-size: 9px;
    line-height: 1.08;
    text-align: left;
  }

  .wizard-track .pipeline-node > span:last-child {
    min-width: 0;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .wizard-track .node-mark,
  .wizard-track .pipeline-node.complete .node-mark {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border-radius: 7px;
    font-size: 9px;
  }

  .wizard-panel .wizard-step,
  .results-panel.wizard-step {
    min-height: auto;
    gap: 15px;
    padding: 22px 16px 24px;
  }

  .section-head {
    gap: 6px;
  }

  .section-kicker {
    font-size: 10px;
    letter-spacing: .1em;
    line-height: 1;
  }

  .wizard-panel .section-head h2,
  .results-panel .section-head h2 {
    font-size: 18px;
    line-height: 1.24;
  }

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

  .source-card {
    min-width: 0;
    min-height: 86px;
    gap: 8px;
    padding: 12px 8px 11px;
    font-size: 14px;
    line-height: 1.15;
  }

  .brand-icon {
    width: 39px;
    height: 39px;
  }

  .telegram-logo img,
  .whatsapp-logo img,
  .google-logo img,
  .linkedin-logo img {
    width: 25px;
    height: 25px;
  }

  .source-card.unavailable {
    opacity: .5;
  }

  .source-card.unavailable em {
    top: 8px;
    right: 8px;
    max-width: 58px;
    overflow: hidden;
    font-size: 0;
    line-height: 1;
    text-overflow: clip;
    white-space: nowrap;
    padding: 4px 6px;
  }

  .source-card.unavailable em::after {
    content: "Soon";
    font-size: 9px;
  }

  .source-state {
    min-height: 0;
    margin: -2px 0 2px;
    font-size: 12px;
    font-weight: 760;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  label {
    gap: 9px;
  }

  label span,
  .field-title {
    font-size: 12px;
    line-height: 1.2;
  }

  input {
    min-width: 0;
    min-height: 46px;
    padding: 0 14px;
    font-size: 14px;
  }

  textarea {
    min-height: 126px;
    font-size: 14px;
    line-height: 1.5;
  }

  .wizard-actions,
  .wizard-actions.split {
    gap: 9px;
    margin-top: 0;
  }

  .primary-button,
  .secondary-button {
    min-height: 46px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1;
  }

  .range-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .range-button {
    min-height: 52px;
    font-size: 13px;
  }

  .range-button[data-range="custom"] {
    grid-column: 1 / -1;
  }
}

@media (max-width: 380px) {

  .source-card {
    min-height: 82px;
    font-size: 13px;
  }
}

/* Production mobile layout */
@media (max-width: 720px) {
  body {
    padding-top: calc(64px + env(safe-area-inset-top, 0px));
    background:
      radial-gradient(circle at 50% -120px, color-mix(in srgb, var(--accent) 18%, transparent), transparent 330px),
      linear-gradient(180deg, color-mix(in srgb, var(--surface-soft) 72%, transparent), transparent 260px),
      var(--bg);
  }

  .site-header {
    min-height: calc(64px + env(safe-area-inset-top, 0px));
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 8px;
    background: color-mix(in srgb, var(--bg) 94%, transparent);
  }

  .brand-lockup {
    gap: 9px;
  }

  .brand-logo-link,
  .brand-logo {
    width: 42px;
    height: 42px;
  }

  .brand-logo-link {
    flex-basis: 42px;
  }

  .brand-title {
    font-size: 14px;
  }

  .brand-byline {
    max-width: 132px;
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-tools {
    width: auto;
    flex: 0 0 auto;
  }


  .shell {
    width: min(100% - 20px, 520px);
    gap: 12px;
    padding: 12px 0 20px;
  }

  .compact-hero {
    min-height: clamp(142px, 34vh, 190px);
    gap: 6px;
    padding-top: 4px;
  }

  .compact-hero .hero-logo {
    width: clamp(68px, 22vw, 92px);
    height: clamp(68px, 22vw, 92px);
  }

  .compact-hero h1 {
    font-size: clamp(34px, 11vw, 48px);
    line-height: 1;
  }

  .compact-hero .hero-link {
    max-width: 100%;
    justify-content: center;
    font-size: clamp(15px, 4.3vw, 18px);
  }

  .wizard-shell {
    border-radius: 8px;
  }

  .wizard-track {
    position: sticky;
    top: calc(64px + env(safe-area-inset-top, 0px));
    z-index: 10;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
    border-bottom: 1px solid var(--border);
  }

  .wizard-track .pipeline-node {
    min-height: 50px;
    display: grid;
    justify-items: center;
    gap: 4px;
    padding: 6px 4px;
    font-size: 10px;
    line-height: 1.1;
    text-align: center;
  }

  .wizard-track .node-mark,
  .wizard-track .pipeline-node.complete .node-mark {
    width: 28px;
    height: 28px;
    font-size: 10px;
  }

  .wizard-panel .wizard-step,
  .results-panel.wizard-step {
    min-height: auto;
    padding: 16px;
  }

  .wizard-panel .section-head h2,
  .results-panel .section-head h2 {
    font-size: 18px;
  }

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

  .source-card {
    min-height: 96px;
  }

  .source-card.unavailable em {
    top: 7px;
    right: 7px;
    max-width: calc(100% - 14px);
    font-size: 9px;
  }

  .range-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .range-button {
    min-height: 54px;
  }

  .range-button[data-range="custom"] {
    grid-column: 1 / -1;
  }

  .date-grid,
  .metrics-row {
    grid-template-columns: 1fr;
  }

  .wizard-actions,
  .wizard-actions.split,
  .result-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .wizard-actions .primary-button,
  .secondary-button {
    width: 100%;
  }

  .action-buttons {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .tool-button {
    padding: 0 10px;
  }

  .results {
    max-height: 260px;
    padding-right: 0;
  }
}

@media (max-width: 380px) {
  .brand-byline {
    display: none;
  }

  .brand-copy {
    gap: 0;
  }


  .source-grid,
  .range-options {
    grid-template-columns: 1fr;
  }

  .range-button[data-range="custom"] {
    grid-column: auto;
  }
}

/* Mobile experience v2: clearer hierarchy, calmer spacing */
@media (max-width: 720px) {
  :root {
    --mobile-page-x: 10px;
    --mobile-card-x: 16px;
    --mobile-soft-border: color-mix(in srgb, var(--border) 72%, transparent);
  }

  body {
    padding-top: calc(58px + env(safe-area-inset-top, 0px));
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--accent) 8%, transparent), transparent 220px),
      var(--bg);
    font-size: 14px;
  }

  .site-header {
    min-height: calc(58px + env(safe-area-inset-top, 0px));
    padding: calc(7px + env(safe-area-inset-top, 0px)) 12px 7px;
    border-bottom-color: color-mix(in srgb, var(--border) 66%, transparent);
  }

  .brand-lockup {
    gap: 8px;
  }

  .brand-logo-link,
  .brand-logo {
    width: 36px;
    height: 36px;
  }

  .brand-logo-link {
    flex-basis: 36px;
  }

  .brand-title {
    font-size: 13px;
    line-height: 1.12;
  }

  .brand-byline {
    max-width: 150px;
    color: color-mix(in srgb, var(--muted) 86%, var(--text));
    font-size: 10px;
    line-height: 1.15;
  }


  .shell {
    width: min(100% - calc(var(--mobile-page-x) * 2), 430px);
    gap: 10px;
    padding: 10px 0 18px;
  }

  .compact-hero {
    min-height: 154px;
    gap: 6px;
    padding: 4px 0 2px;
  }

  .compact-hero .hero-logo {
    width: 74px;
    height: 74px;
    filter: drop-shadow(0 12px 24px color-mix(in srgb, var(--accent) 26%, transparent));
  }

  .compact-hero h1 {
    max-width: 100%;
    font-size: clamp(34px, 9.8vw, 42px);
    line-height: 1.03;
  }

  .compact-hero .hero-link {
    gap: 7px;
    font-size: clamp(16px, 4.5vw, 18px);
    line-height: 1.2;
  }

  .compact-hero .hero-link svg {
    width: 18px;
    height: 18px;
  }

  .wizard-shell {
    border-color: var(--mobile-soft-border);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: 0 18px 44px color-mix(in srgb, var(--shadow) 58%, transparent);
  }

  .wizard-track {
    position: static;
    gap: 8px;
    padding: 10px;
    border-bottom: 1px solid var(--mobile-soft-border);
    background: color-mix(in srgb, var(--surface-soft) 42%, var(--surface));
  }

  .wizard-track .pipeline-node {
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    border-color: var(--mobile-soft-border);
    padding: 0 9px;
    color: color-mix(in srgb, var(--muted) 86%, var(--text));
    font-size: 11px;
    font-weight: 850;
    line-height: 1.15;
    text-align: left;
  }

  .wizard-track .node-mark,
  .wizard-track .pipeline-node.complete .node-mark {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 7px;
    font-size: 10px;
  }

  .wizard-track .pipeline-node.active {
    border-color: color-mix(in srgb, var(--accent) 84%, var(--border));
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--accent) 18%, transparent), transparent 72%),
      var(--surface-soft);
    box-shadow: inset 0 -2px 0 var(--accent);
  }

  .wizard-panel .wizard-step,
  .results-panel.wizard-step {
    gap: 15px;
    padding: 22px var(--mobile-card-x) 24px;
  }

  .section-head {
    gap: 6px;
  }

  .section-kicker {
    font-size: 10px;
    letter-spacing: .1em;
    line-height: 1;
  }

  .wizard-panel .section-head h2,
  .results-panel .section-head h2 {
    font-size: 18px;
    line-height: 1.24;
  }

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

  .source-card {
    min-height: 86px;
    gap: 8px;
    border-color: var(--mobile-soft-border);
    padding: 12px 8px 11px;
    font-size: 14px;
    line-height: 1.15;
  }

  .source-card.active {
    box-shadow:
      inset 0 0 0 1px color-mix(in srgb, var(--accent) 48%, transparent),
      0 8px 24px color-mix(in srgb, var(--accent) 10%, transparent);
  }

  .brand-icon {
    width: 39px;
    height: 39px;
  }

  .telegram-logo img,
  .whatsapp-logo img,
  .google-logo img,
  .linkedin-logo img {
    width: 25px;
    height: 25px;
  }

  .source-card.unavailable {
    opacity: .5;
  }

  .source-card.unavailable em {
    top: 8px;
    right: 8px;
    max-width: 78px;
    overflow: hidden;
    border-color: color-mix(in srgb, var(--border) 65%, transparent);
    font-size: 9px;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 4px 6px;
  }

  .source-state {
    min-height: 0;
    margin: -2px 0 2px;
    color: color-mix(in srgb, var(--muted) 88%, var(--text));
    font-size: 12px;
    font-weight: 760;
    line-height: 1.35;
  }

  label {
    gap: 9px;
  }

  label span,
  .field-title {
    font-size: 12px;
    line-height: 1.2;
  }

  input,
  textarea,
  .datetime-trigger {
    border-color: var(--mobile-soft-border);
    border-radius: 8px;
  }

  input {
    min-height: 46px;
    padding: 0 14px;
    font-size: 14px;
  }

  textarea {
    min-height: 126px;
    font-size: 14px;
    line-height: 1.5;
  }

  .wizard-actions {
    margin-top: 0;
    gap: 9px;
  }

  .primary-button,
  .secondary-button {
    min-height: 46px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1;
  }

  .range-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .range-button {
    min-height: 52px;
    font-size: 13px;
  }

  .range-button[data-range="custom"] {
    grid-column: 1 / -1;
  }

  .date-grid {
    gap: 12px;
  }

  .metrics-row {
    margin-top: 0;
  }

  .result-actions {
    min-height: 0;
    gap: 10px;
    padding: 0 0 12px;
  }

  .state {
    font-size: 12px;
    line-height: 1.35;
  }

  .results {
    max-height: 300px;
  }
}

@media (max-width: 380px) {
  .wizard-track {
    gap: 6px;
    padding: 8px;
  }

  .wizard-track .pipeline-node {
    min-height: 42px;
    gap: 5px;
    padding: 0 7px;
    font-size: 10px;
  }

  .wizard-track .node-mark,
  .wizard-track .pipeline-node.complete .node-mark {
    width: 25px;
    height: 25px;
    flex-basis: 25px;
  }

  .source-grid {
    gap: 8px;
  }

  .source-card {
    min-height: 82px;
    font-size: 13px;
  }
}

@media (max-width: 860px) {
  .wizard-track {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .wizard-track .pipeline-node {
    justify-content: center;
    padding: 0 8px;
  }
}

@media (max-width: 560px) {
  .compact-hero .hero-logo {
    width: 78px;
    height: 78px;
  }

  .compact-hero h1 {
    font-size: 40px;
  }

  .compact-hero .hero-link {
    font-size: 18px;
  }

  .wizard-track {
    gap: 6px;
  }

  .wizard-track .pipeline-node {
    min-height: 64px;
    display: grid;
    justify-items: center;
    gap: 5px;
    font-size: 11px;
  }

  .wizard-track .node-mark {
    width: 32px;
    height: 32px;
  }
}

/* Workspace top stack */
body {
  padding-top: 76px;
}

.shell {
  gap: 10px;
  padding: 10px 0 24px;
}

.compact-hero {
  min-height: 154px;
  gap: 6px;
  padding: 2px 0 0;
}

.compact-hero .hero-logo {
  width: 76px;
  height: 76px;
}

.compact-hero h1 {
  font-size: clamp(40px, 4.4vw, 58px);
  line-height: .96;
}

.compact-hero .hero-link {
  gap: 8px;
  font-size: clamp(17px, 1.45vw, 21px);
  font-weight: 900;
}

.compact-hero .hero-link svg {
  width: 19px;
  height: 19px;
}

.wizard-shell {
  width: 100%;
  margin: 0 auto;
}

.wizard-track {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--brand-blue) 8%, transparent), transparent),
    var(--surface);
}

.wizard-track .pipeline-node {
  min-height: 54px;
  border: 1px solid var(--border);
  border-radius: 8px;
  justify-content: flex-start;
  gap: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 0 14px;
  min-width: 0;
}

.wizard-track .pipeline-node > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.wizard-track .pipeline-node::before,
.wizard-track .pipeline-node::after {
  display: none;
  content: none;
}

.wizard-track .pipeline-node.active {
  border-color: color-mix(in srgb, var(--brand-blue) 72%, var(--border));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--brand-blue) 24%, transparent), transparent 58%),
    var(--surface-soft);
  color: var(--text);
  box-shadow: inset 0 -3px 0 var(--brand-blue);
}

.wizard-track .pipeline-node.complete {
  border-color: color-mix(in srgb, var(--brand-blue-soft) 38%, var(--border));
  color: var(--brand-ice);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--brand-blue) 10%, transparent), transparent),
    var(--surface-soft);
}

.wizard-track .node-mark,
.wizard-track .pipeline-node.complete .node-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border-color: color-mix(in srgb, currentColor 32%, var(--border));
  background: color-mix(in srgb, var(--bg) 42%, transparent);
  color: inherit;
  font-size: 12px;
  box-shadow: none;
}

.wizard-track .pipeline-node.complete .node-mark::before {
  content: none;
}

.wizard-track .pipeline-node.active .node-mark {
  border-color: var(--brand-blue);
  color: var(--text);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-blue) 13%, transparent);
}

.wizard-step,
.wizard-panel .wizard-step,
.results-panel.wizard-step,
.apply-panel.wizard-step,
.cv-panel.wizard-step {
  display: none;
}

.wizard-step.active,
.wizard-panel .wizard-step.active,
.results-panel.wizard-step.active,
.apply-panel.wizard-step.active,
.cv-panel.wizard-step.active {
  display: grid;
}

.wizard-workspace {
  display: block;
  min-height: auto;
}

.wizard-panel {
  border-right: 0;
}

.wizard-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.wizard-actions.split {
  justify-content: flex-end;
}

.wizard-actions .action-buttons {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  width: auto;
}

.wizard-actions .primary-button,
.wizard-actions .secondary-button {
  width: auto;
}

.results-footer {
  align-items: center;
  border-top: 1px solid var(--border);
  border-bottom: 0;
  margin-top: 16px;
  margin-bottom: 0;
  padding-top: 14px;
}

.results-footer .action-buttons {
  width: auto;
  flex-wrap: wrap;
}

.wizard-panel .wizard-step,
.results-panel.wizard-step {
  min-height: 382px;
  padding: 22px 30px;
}

.wizard-panel .section-head h2,
.results-panel .section-head h2 {
  font-size: 19px;
}

.source-card {
  min-height: 92px;
  gap: 7px;
  padding: 10px 8px;
}

.brand-icon {
  width: 42px;
  height: 42px;
}

.brand-icon svg,
.brand-icon img {
  width: 25px;
  height: 25px;
  display: block;
}

.source-state {
  min-height: 20px;
  font-size: 12px;
}

input {
  min-height: 48px;
}

textarea {
  min-height: 112px;
}

.range-button {
  min-height: 52px;
}

.datetime-trigger {
  min-height: 48px;
}

.primary-button,
.secondary-button {
  min-height: 48px;
}

.metrics-row > div {
  min-height: 72px;
  padding: 12px 14px;
}

.metrics-row span {
  font-size: 30px;
}

.results {
  max-height: clamp(360px, 48vh, 620px);
}

.email-row {
  min-height: 40px;
  padding: 8px 10px;
}

@media (min-width: 1000px) and (max-height: 760px) {
  .compact-hero {
    min-height: 170px;
  }

  .compact-hero .hero-logo {
    width: 88px;
    height: 88px;
  }

  .compact-hero h1 {
    font-size: 52px;
  }

  .compact-hero .hero-link {
    font-size: 21px;
  }

  .wizard-panel .wizard-step,
  .results-panel.wizard-step {
    min-height: 340px;
    padding: 18px 28px;
  }

  .source-card {
    min-height: 82px;
  }

  .range-button {
    min-height: 48px;
  }
}

.wizard-track .pipeline-node.unavailable {
  opacity: .55;
}

@media (max-width: 380px) {
  .theme-toggle {
    width: 52px;
    flex-basis: 52px;
  }

  .source-card {
    min-height: 82px;
    font-size: 10px;
  }
}

.results .email-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
}

/* Five-step apply flow */
.wizard-track {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.results-panel.wizard-step,
.apply-panel.wizard-step {
  min-height: 382px;
  padding: 22px 30px;
}

.apply-panel.wizard-step.active {
  display: grid;
  gap: 18px;
}

.email-only-row {
  grid-template-columns: minmax(0, 1fr) !important;
}

.email-only-row .email-main strong {
  color: var(--brand-ice);
  font-size: 15px;
}

.apply-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, .95fr);
  gap: 16px;
  align-items: start;
}

.google-connect {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--text) 18%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 76%, white 4%);
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  padding: 0 14px;
  white-space: nowrap;
}

.google-connect img {
  width: 18px;
  height: 18px;
}

.file-field input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.file-control {
  min-height: 48px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 7px;
}

.file-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border-radius: 7px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 900;
  padding: 0 12px;
}

.file-control small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automation-apply-summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 8px 12px;
}

.automation-apply-summary strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.automation-apply-summary small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.save-source-toggle {
  width: fit-content;
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.save-source-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  width: 42px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  position: relative;
}

.toggle-track::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  position: absolute;
  top: 2px;
  left: 3px;
  transition: transform .16s ease, background .16s ease;
}

.save-source-toggle input:checked + .toggle-track {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 22%, var(--surface));
}

.save-source-toggle input:checked + .toggle-track::after {
  background: var(--accent);
  transform: translateX(17px);
}

.saved-sources {
  display: grid;
  gap: 8px;
}

.saved-sources > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.saved-source-list {
  min-width: 0;
}

.compact-table {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.compact-table-head,
.saved-source-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 150px;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
}

.compact-table-head {
  min-height: 34px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.compact-table-head span:last-child {
  text-align: right;
}

.saved-source-row {
  min-height: 54px;
  border-bottom: 1px solid var(--border);
}

.saved-source-row:last-child {
  border-bottom: 0;
}

.source-index {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
}

.source-details {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.source-details strong,
.source-details small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-details strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.source-details small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.source-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.source-actions button {
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  font-size: 11px;
  font-weight: 850;
  padding: 0 10px;
}

.source-actions .source-use-button {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent);
}

.source-actions .source-delete-button {
  color: var(--error);
}

.empty-sources {
  color: var(--muted);
  font-size: 12px;
}

.email-preview {
  display: grid;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.preview-head {
  display: grid;
  gap: 4px;
}

.preview-head strong {
  font-size: 17px;
}

.preview-meta {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-line);
  margin: 0;
}

.preview-meta div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  background: var(--surface-soft);
  padding: 10px 12px;
}

.preview-meta dt,
.preview-meta dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.preview-meta dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.preview-meta dd {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.preview-body {
  min-height: 170px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 50%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.55;
  margin: 0;
  padding: 14px;
  white-space: pre-wrap;
}

.recipients-head {
  display: grid;
  grid-template-columns: minmax(230px, .28fr) minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
}

.recipients-title {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.recipients-title > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.recipients-head h3 {
  margin: 2px 0 0;
  font-size: 18px;
  line-height: 1.1;
}

.selected-count-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.recipients-actions {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto auto auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.recipient-search {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
  padding: 0 10px;
}

.recipient-view-toggle {
  display: flex;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 3px;
}

.recipient-view-toggle button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
  padding: 0 10px;
  white-space: nowrap;
}

.recipient-view-toggle button.active {
  background: var(--surface-soft);
  color: var(--text);
}

.recipients-actions .tool-button {
  min-width: 88px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding-inline: 12px;
  white-space: nowrap;
}

.import-recipients-button {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
  background: color-mix(in srgb, var(--surface-soft) 86%, var(--accent) 14%);
}

.add-recipient-button {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--border));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, transparent), transparent 68%),
    color-mix(in srgb, var(--surface-soft) 78%, var(--accent) 22%);
}

.clear-recipients-button {
  border-color: color-mix(in srgb, var(--error) 46%, var(--border));
  background: color-mix(in srgb, var(--surface-soft) 90%, var(--error) 10%);
  color: color-mix(in srgb, var(--text) 82%, var(--error));
}

.recipients-table-wrap {
  --sheet-line: color-mix(in srgb, var(--border) 72%, transparent);
  --sheet-cell: color-mix(in srgb, var(--surface-soft) 82%, var(--surface));
  --sheet-head: color-mix(in srgb, var(--surface) 88%, var(--text) 7%);
  --sheet-active: color-mix(in srgb, var(--accent) 15%, var(--surface-soft));
  --sheet-text: var(--text);
  max-height: 344px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--sheet-line);
}

.recipients-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.recipients-table th,
.recipients-table td {
  height: 42px;
  border-bottom: 1px solid var(--sheet-line);
  border-right: 1px solid var(--sheet-line);
  background: var(--sheet-cell);
  color: var(--sheet-text);
  padding: 5px 7px;
  vertical-align: middle;
}

.recipients-table th {
  background: var(--sheet-head);
  color: var(--muted);
  height: 26px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
  text-align: center;
}

.recipients-table th:nth-child(1),
.recipients-table td:nth-child(1) {
  width: 28px;
  text-align: center;
}

.recipients-table th:nth-child(2),
.recipients-table td:nth-child(2) {
  width: 27%;
}

.recipients-table th:nth-child(3),
.recipients-table td:nth-child(3) {
  width: 22%;
}

.recipients-table th:nth-child(4),
.recipients-table td:nth-child(4) {
  width: 29%;
}

.recipients-table th:nth-child(5),
.recipients-table td:nth-child(5) {
  width: 92px;
  text-align: center;
}

.recipients-table th:nth-child(6),
.recipients-table td:nth-child(6) {
  width: 66px;
  text-align: center;
}

.recipients-table th:nth-child(7),
.recipients-table td:nth-child(7) {
  width: 82px;
  text-align: center;
}

.recipients-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.recipient-check {
  width: 13px;
  height: 13px;
  accent-color: var(--accent);
  margin: 0;
}

.recipient-check:focus,
.recipient-check:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 24%, transparent);
}

.sheet-cell {
  padding: 5px 7px;
}

.email-duplicate-cell {
  padding: 5px 7px;
}

.recipient-email-control {
  min-width: 0;
  min-height: 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  padding: 0 6px;
}

.match-count {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.manual-recipient-badge {
  color: var(--accent);
  font-size: 10px;
  font-weight: 950;
  white-space: nowrap;
}

.sheet-input {
  width: 100%;
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--sheet-text);
  font: inherit;
  font-size: 13px;
  font-weight: 760;
  overflow: hidden;
  padding: 0 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
  outline: none;
}

.sheet-input:focus {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 48%, var(--border));
}

.position-input[readonly] {
  color: var(--text);
  background: color-mix(in srgb, var(--surface-soft) 72%, transparent);
  cursor: default;
}

.final-subject-cell {
  min-width: 0;
}

.final-subject-text {
  display: block;
  max-width: 100%;
  color: var(--sheet-text);
  font-size: 13px;
  font-weight: 820;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.final-subject-text.is-missing,
#preview-subject.is-warning {
  color: color-mix(in srgb, var(--warning) 84%, var(--text));
}

.status-text {
  display: inline-block;
  max-width: 100%;
  border: 0;
  background: transparent;
  font-size: 11px;
  font-weight: 900;
  text-transform: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.status-sending {
  color: var(--accent);
}

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

.status-sent {
  color: color-mix(in srgb, var(--brand-ice) 85%, white);
}

.status-open {
  color: #34d399;
}

.status-failed {
  color: #fbbf24;
}

.status-skipped {
  color: #fbbf24;
}

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

.status-saved {
  color: var(--accent);
}

.status-applied {
  color: #34d399;
}

.status-reply {
  color: #c084fc;
}

.source-view-button {
  width: auto;
  min-height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  padding: 0;
}

.source-view-button:hover {
  color: var(--accent-strong);
}

.send-limit-meter {
  min-height: 42px;
  justify-content: center;
  display: grid;
  align-content: center;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 5px 12px;
  text-align: center;
}

.send-limit-meter span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.send-limit-meter strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 950;
}

.send-limit-meter small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.recipients-table tr.active td {
  background: var(--sheet-active);
}

.review-cell {
  text-align: center;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.15;
  padding: 0 4px;
  white-space: normal;
  vertical-align: middle;
}

.review-cell[data-review="ai-high"] {
  color: var(--success);
}

.review-cell[data-review="manual-review-needed"],
.review-cell[data-review="ai-failed"],
.review-cell[data-review="ai-deferred"] {
  color: var(--warning);
}

.review-cell[data-review="ai-pending"],
.review-cell[data-review="ai-reviewing"] {
  color: var(--accent);
}

.recipient-ai-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.recipient-status-filters {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.recipient-status-chip {
  min-width: 0;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
  padding: 7px 9px;
}

.recipient-status-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipient-status-chip strong {
  color: var(--text);
  font-size: 12px;
}

.recipient-status-chip.active,
.recipient-status-chip:hover {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-soft));
  color: var(--text);
}

.recipient-status-chip[data-status="ready"] strong {
  color: var(--success);
}

.recipient-status-chip[data-status="manual-review"] strong,
.recipient-status-chip[data-status="missing-subject"] strong,
.recipient-status-chip[data-status="ai-pending"] strong {
  color: var(--warning);
}

.recipient-status-chip[data-status="ai-failed"] strong {
  color: var(--error);
}

.source-message-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.source-message-panel strong {
  display: block;
  margin-top: 2px;
}

.source-message-date {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-top: 5px;
}

.send-history-panel {
  display: grid;
  grid-template-rows: minmax(260px, 1fr) minmax(260px, 1fr);
  gap: 12px;
  height: min(74vh, 780px);
  min-height: 560px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.send-history-panel h3 {
  margin: 2px 0 0;
  font-size: 16px;
}

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

.history-section {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
  overflow: hidden;
}

.history-section-head {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(280px, 1.1fr);
  gap: 12px;
  align-items: end;
}

.history-section-head h3 {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
}

.history-section-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.history-section-tools select,
.history-section-tools input {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
  padding: 0 10px;
}

.history-table-shell {
  min-width: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
}

.history-batches {
  min-width: 760px;
  overflow: hidden;
}

.history-batch-head,
.history-batch-row {
  display: grid;
  grid-template-columns: 38px minmax(140px, 1fr) repeat(5, minmax(65px, .5fr));
  align-items: center;
  gap: 10px;
}

.history-batch-head {
  padding: 9px 12px;
}

.history-batch-head span:not(:nth-child(2)) {
  text-align: center;
}

.history-batch-row {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 8px 12px;
  text-align: left;
}

.history-batch-row:last-child {
  border-bottom: 0;
}

.history-batch-row.active,
.history-batch-row:hover {
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
}

.history-index {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 900;
}

.history-batch-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-align: center;
  white-space: nowrap;
}

.history-table-wrap {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
}

.history-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  table-layout: fixed;
}

.history-table th,
.history-table td {
  height: 38px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 780;
  padding: 6px 9px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  background: var(--surface-soft);
}

.history-recipient-list {
  display: grid;
  border-top: 1px solid var(--border);
}

.history-recipient-list div {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
  gap: 8px;
  padding: 7px 10px;
}

.history-recipient-list span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-message-panel pre {
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  padding: 12px;
  white-space: pre-wrap;
}

.admin-panel {
  display: none;
  gap: 16px;
}

.admin-panel.active {
  display: grid;
}

.admin-console {
  display: grid;
  gap: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-alpha);
  padding: 24px 28px;
}

.admin-console-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.admin-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 4px;
}

.admin-panel-head {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.admin-panel-head > div {
  display: grid;
  gap: 4px;
}

.admin-panel-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
}

.admin-panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.admin-panel-head p strong {
  color: var(--text);
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.admin-summary > div {
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 10px 12px;
}

.admin-summary span {
  color: var(--brand-ice);
  font-size: 26px;
  font-weight: 900;
}

.admin-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.opportunity-profile-form .setting-row > input,
.opportunity-profile-form .setting-row > select,
.linkedin-search-form .setting-row > input,
.linkedin-search-form .setting-row > select {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 0 10px;
}

.opportunity-profile-form .setting-row > select,
.linkedin-search-form .setting-row > select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 16px, calc(100% - 11px) 16px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}

.linkedin-score {
  border-color: color-mix(in srgb, #0a66c2 52%, var(--border));
  background: color-mix(in srgb, #0a66c2 16%, transparent);
}

.linkedin-search-box {
  display: grid;
  gap: 8px;
}

.linkedin-suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.linkedin-chip {
  min-height: 28px;
  padding: 0 9px;
  font-size: 11px;
}

.opportunity-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.opportunity-summary > div {
  min-height: 70px;
  display: grid;
  align-content: center;
  gap: 3px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px 12px;
}

.opportunity-summary strong {
  color: var(--brand-ice);
  font-size: 24px;
  font-weight: 950;
}

.opportunity-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.opportunities-list {
  display: grid;
  gap: 10px;
}

.opportunity-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.opportunity-score {
  min-height: 74px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.opportunity-score strong {
  color: var(--brand-ice);
  font-size: 24px;
  font-weight: 950;
}

.opportunity-score span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.opportunity-main {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.opportunity-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.opportunity-title-row > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.opportunity-title-row strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 950;
}

.opportunity-title-row span,
.opportunity-main p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.opportunity-main p {
  margin: 0;
  line-height: 1.45;
}

.opportunity-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.opportunity-tags span {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--brand-ice);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  padding: 6px 8px;
  text-transform: capitalize;
}

.opportunity-cv-brief {
  max-height: 160px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.45;
  margin: 0;
  padding: 10px;
  white-space: pre-wrap;
}

.opportunity-source {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 10px;
  font-style: normal;
  font-weight: 950;
  text-transform: uppercase;
}

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

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

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

.admin-form-card {
  align-content: start;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 14px;
}

.admin-form-head {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.admin-form-head strong {
  color: var(--text);
  font-size: 14px;
}

.admin-form-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.admin-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.admin-form input,
.admin-form select {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 10px;
}

.admin-form .password-policy {
  margin: 0;
}

.admin-form-actions,
.settings-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.settings-form {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.setting-row {
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, .38fr);
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
}

.setting-row > span:first-child {
  display: grid;
  gap: 4px;
}

.setting-row strong {
  color: var(--text);
  font-size: 13px;
}

.setting-row small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.setting-row > select,
.setting-control input {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 0 10px;
}

.setting-control {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) 62px;
  align-items: center;
  gap: 8px;
}

.setting-control em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
}

.settings-footer {
  min-height: 58px;
  justify-content: space-between;
  padding: 10px 16px;
}

.automation-guard-row {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
}

.automation-guard-row strong {
  color: var(--text);
  font-size: 13px;
}

.automation-guard-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.switch-control {
  position: relative;
  justify-self: end;
}

.switch-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  width: 46px;
  height: 24px;
  display: block;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  cursor: pointer;
}

.switch-track::after {
  content: "";
  width: 18px;
  height: 18px;
  position: absolute;
  top: 3px;
  left: 4px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .16s ease, background .16s ease;
}

.switch-control input:checked + .switch-track {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 22%, var(--surface));
}

.switch-control input:checked + .switch-track::after {
  background: var(--accent);
  transform: translateX(19px);
}

.system-status {
  min-height: 28px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 900;
}

.system-status[data-status="enabled"] {
  color: var(--success);
}

.system-status[data-status="disabled"] {
  color: var(--muted);
}

.admin-list {
  display: grid;
  gap: 6px;
  max-height: 440px;
  overflow: auto;
}

.account-row,
.request-row {
  min-height: 46px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 9px 10px;
}

.account-row {
  grid-template-columns: 34px minmax(0, 1fr) 160px 64px auto;
}

.account-index {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
}

.account-actions {
  display: flex;
  gap: 6px;
}

.account-actions .secondary-button {
  min-height: 28px;
  font-size: 11px;
  padding-inline: 8px;
}

.danger-button {
  color: var(--error);
}

.request-row {
  align-items: center;
}

.request-row strong,
.account-row strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-row span,
.account-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-align: right;
}

.request-row p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.request-status {
  min-height: 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 900;
  text-transform: capitalize;
}

.request-status.status-pending {
  color: var(--warning);
}

.request-status.status-approved {
  color: var(--success);
}

.request-status.status-rejected {
  color: var(--error);
}

.request-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.request-actions .primary-button,
.request-actions .secondary-button {
  min-height: 30px;
  font-size: 11px;
  padding-inline: 10px;
}

.locked-feature {
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 18px;
}

.locked-feature strong {
  color: var(--brand-ice);
  font-size: 18px;
}

.locked-feature p {
  margin: 0;
  color: var(--muted);
}

.results-footer .action-buttons {
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 860px) {
  .auth-screen {
    grid-template-columns: minmax(150px, .8fr) minmax(180px, 1fr) minmax(320px, 1fr);
    align-content: center;
    gap: 14px;
  }

  .auth-copy {
    justify-items: start;
    text-align: left;
  }

  .auth-copy h1 {
    max-width: 520px;
    font-size: 26px;
  }

  .auth-copy p {
    font-size: 13px;
  }

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

  .apply-layout {
    grid-template-columns: minmax(0, 1fr) minmax(220px, .95fr);
  }

}

@media (max-width: 520px) {
  .preview-meta div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 620px) {
  body {
    overflow-x: hidden;
  }

  .auth-screen {
    inset: 58px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 12px 8px;
  }

  .auth-visual,
  .auth-copy {
    display: none;
  }

  .auth-panel {
    width: min(340px, calc(100vw - 28px));
    gap: 9px;
    padding: 13px;
  }

  .auth-card-stack {
    position: fixed;
    top: 58px;
    bottom: 0;
    left: 0;
    display: grid;
    align-items: center;
    justify-items: center;
    width: 100vw;
    padding: 0 14px;
  }

  .auth-panel .primary-button,
  .auth-panel .secondary-button {
    padding-inline: 4px;
    white-space: normal;
  }

  .password-policy {
    font-size: 9px;
  }

  .shell {
    width: calc(100% - 12px);
    gap: 8px;
    overflow-x: hidden;
    padding: 10px 0 22px;
  }

  .hero {
    min-height: 118px;
    gap: 5px;
    margin: 0;
  }

  .hero-logo {
    width: 48px;
    height: 48px;
  }

  .hero h1 {
    font-size: clamp(28px, 10vw, 42px);
    line-height: .94;
  }

  .hero-link {
    gap: 5px;
    font-size: 13px;
  }

  .hero-link svg {
    width: 13px;
    height: 13px;
  }

  .pipeline-shell {
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
  }

  .wizard-track {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
    padding: 6px;
  }

  .wizard-track .pipeline-node {
    min-width: 0;
    min-height: 42px;
    gap: 3px;
    padding: 0 4px;
  }

  .wizard-track .node-mark,
  .wizard-track .pipeline-node.complete .node-mark {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    font-size: 9px;
  }

  .wizard-track .pipeline-node > span:last-child {
    min-width: 0;
    overflow: visible;
    font-size: 9px;
    line-height: 1.05;
    text-overflow: clip;
    white-space: normal;
  }

  .wizard-panel .wizard-step,
  .results-panel.wizard-step,
  .apply-panel.wizard-step {
    min-height: 250px;
    padding: 14px 16px;
  }

  .section-kicker {
    font-size: 8px;
  }

  .section-head h2,
  .wizard-panel .section-head h2,
  .results-panel .section-head h2 {
    font-size: 14px;
  }

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

  .source-mode-toggle {
    width: 100%;
  }

  .source-mode-toggle label {
    min-height: 30px;
    font-size: 9px;
    padding: 0 6px;
  }

  .source-card {
    min-height: 58px;
    gap: 4px;
    padding: 6px 4px;
    font-size: 9px;
  }

  .brand-icon {
    width: 26px;
    height: 26px;
  }

  .brand-icon svg,
  .brand-icon img {
    width: 16px;
    height: 16px;
  }

  .source-state,
  .state {
    font-size: 9px;
  }

  .result-state {
    min-height: 18px;
    font-size: 12px;
  }

  .result-state[data-status="scanning"] {
    font-size: 13px;
  }

  .result-range-label {
    font-size: 9px;
  }

  .wide-field,
  .saved-sources {
    gap: 5px;
  }

  .wide-field > span,
  .saved-sources > span,
  .save-source-toggle {
    font-size: 9px;
  }

  input:not([type="checkbox"]):not([type="hidden"]):not([type="file"]),
  textarea {
    min-height: 32px;
    font-size: 10px;
    padding: 0 8px;
  }

  textarea {
    padding-block: 8px;
  }

  .range-options {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
  }

  .range-button {
    min-height: 34px;
    font-size: 10px;
  }

  .metrics-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .metrics-row > div {
    padding: 8px 7px;
  }

  .metrics-row span {
    font-size: 20px;
  }

  .metrics-row p {
    font-size: 9px;
  }

  .result-source-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .result-source-summary button {
    min-height: 42px;
    padding: 6px;
  }

  .result-source-summary span {
    font-size: 8px;
  }

  .result-source-summary strong {
    font-size: 16px;
  }

  .email-only-row .email-main strong {
    font-size: 10px;
  }

  .tool-button,
  .primary-button,
  .secondary-button {
    min-height: 34px;
    font-size: 10px;
    padding-inline: 10px;
  }

  .apply-layout {
    grid-template-columns: minmax(0, 1fr) minmax(135px, .95fr);
    gap: 8px;
  }

  .application-fields,
  .email-preview,
  .source-message-panel,
  .locked-feature {
    padding: 9px;
  }

  .apply-panel.wizard-step.active {
    gap: 10px;
  }

  .google-connect {
    min-height: 30px;
    gap: 5px;
    font-size: 9px;
    padding-inline: 8px;
  }

  .google-connect img {
    width: 13px;
    height: 13px;
  }

  .file-control {
    min-height: 34px;
    gap: 6px;
    padding: 4px;
  }

  .file-button {
    min-height: 24px;
    font-size: 9px;
    padding-inline: 8px;
  }

  .file-control small,
  .preview-meta dt,
  .preview-meta dd {
    font-size: 9px;
  }

  .preview-meta div {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 5px;
    padding: 6px 7px;
  }

  .preview-head strong {
    font-size: 11px;
  }

  .preview-body,
  .source-message-panel pre {
    min-height: 100px;
    max-height: 150px;
    font-size: 9px;
    padding: 8px;
  }

  .recipients-head {
    grid-template-columns: minmax(118px, .34fr) minmax(0, 1fr);
    align-items: stretch;
    gap: 7px;
  }

  .recipients-actions {
    grid-template-columns: auto minmax(120px, 1fr) auto auto auto;
    justify-content: stretch;
    gap: 6px;
  }

  .recipient-search {
    grid-column: auto;
  }

  .recipients-actions .tool-button {
    width: auto;
    min-height: 34px;
    display: inline-flex;
    padding-inline: 8px;
  }

  .recipient-view-toggle {
    grid-column: auto;
    width: auto;
  }

  .recipient-view-toggle button {
    flex: 0 1 auto;
    padding-inline: 7px;
  }

  .admin-console {
    padding: 14px 16px;
  }

  .admin-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .admin-summary span {
    font-size: 20px;
  }

  .opportunity-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .opportunity-summary > div {
    min-height: 56px;
    padding: 8px;
  }

  .opportunity-summary strong,
  .opportunity-score strong {
    font-size: 18px;
  }

  .opportunity-summary span,
  .opportunity-score span,
  .opportunity-tags span,
  .opportunity-title-row span,
  .opportunity-main p {
    font-size: 9px;
  }

  .opportunity-card {
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 8px;
    padding: 9px;
  }

  .opportunity-score {
    min-height: 58px;
  }

  .opportunity-title-row strong {
    font-size: 11px;
  }

  .opportunity-actions {
    gap: 5px;
  }

  .opportunity-tags {
    gap: 4px;
  }

  .opportunity-tags span {
    padding: 5px 6px;
  }

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

  .setting-row {
    grid-template-columns: minmax(0, 1fr) minmax(120px, .38fr);
    gap: 10px;
    min-height: 58px;
    padding: 9px 10px;
  }

  .account-row {
    grid-template-columns: 24px minmax(0, 1fr) 82px 42px auto;
  }

  .send-limit-meter {
    min-height: 30px;
    padding: 3px 7px;
  }

  .send-history-panel {
    padding: 9px;
  }

  .history-recipient-list div {
    gap: 5px;
    padding: 6px 7px;
  }

  .admin-form label,
  .request-row span,
  .account-row span,
  .request-row p {
    font-size: 9px;
  }

  .request-row,
  .account-row {
    padding: 7px;
  }

  .recipients-head h3 {
    font-size: 13px;
  }

  .recipients-head strong {
    font-size: 10px;
    min-height: 24px;
    padding-inline: 7px;
  }

  .recipients-table-wrap {
    max-height: 260px;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .recipients-table {
    min-width: 1040px;
  }

  .recipients-table th:nth-child(1),
  .recipients-table td:nth-child(1) {
    width: 42px;
  }

  .recipients-table th:nth-child(2),
  .recipients-table td:nth-child(2) {
    width: 300px;
  }

  .recipients-table th:nth-child(3),
  .recipients-table td:nth-child(3) {
    width: 220px;
  }

  .recipients-table th:nth-child(4),
  .recipients-table td:nth-child(4) {
    width: 300px;
  }

  .recipients-table th:nth-child(5),
  .recipients-table td:nth-child(5) {
    width: 82px;
  }

  .recipients-table th:nth-child(6),
  .recipients-table td:nth-child(6) {
    width: 70px;
  }

  .recipients-table th:nth-child(7),
  .recipients-table td:nth-child(7) {
    width: 86px;
  }

  .recipients-table th,
  .recipients-table td {
    height: 34px;
  }

  .recipient-check {
    width: 18px;
    height: 18px;
  }

  .sheet-input,
  .status-text,
  .review-cell {
    min-height: 33px;
    font-size: 11px;
    padding-inline: 7px;
  }

  .recipient-status-filters {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
  }

  .recipient-status-chip {
    min-height: 32px;
    font-size: 8px;
    padding: 5px 6px;
  }

  .recipient-status-chip strong {
    font-size: 9px;
  }

  .source-view-button {
    min-height: auto;
    font-size: 11px;
    padding: 0;
  }

  .saved-source-row {
    grid-template-columns: 26px minmax(0, 1fr) 112px;
    gap: 4px;
    min-height: 42px;
    padding: 5px 7px;
  }

  .saved-source-table .compact-table-head {
    grid-template-columns: 26px minmax(0, 1fr) 112px;
    gap: 4px;
    padding: 6px 7px;
  }

  .source-index {
    width: 18px;
    height: 18px;
    font-size: 9px;
  }

  .source-details strong,
  .source-actions button,
  .empty-sources {
    font-size: 9px;
  }

  .source-details small {
    font-size: 8px;
  }

  .send-history-panel {
    height: min(74vh, 640px);
    min-height: 480px;
    gap: 8px;
    padding: 8px;
  }

  .history-section {
    padding: 8px;
    gap: 7px;
  }

  .history-section-head {
    grid-template-columns: minmax(120px, 1fr) minmax(180px, 1.1fr);
    gap: 5px;
  }

  .history-section-head h3 {
    font-size: 12px;
  }

  .history-section-tools {
    gap: 5px;
  }

  .history-section-tools select,
  .history-section-tools input {
    min-width: 0;
    font-size: 9px;
    padding-inline: 5px;
  }

  .history-batch-row {
    grid-template-columns: 28px minmax(120px, 1fr) repeat(5, 58px);
  }

  .history-batch-head {
    grid-template-columns: 28px minmax(120px, 1fr) repeat(5, 58px);
  }

  .source-actions button {
    min-height: 22px;
    padding-inline: 5px;
  }
}

.source-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.source-card {
  min-height: 124px;
}

@media (max-width: 640px) {
  .source-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .source-card {
    min-height: 96px;
    padding: 10px 6px;
    font-size: 11px;
  }

  .source-card .brand-icon {
    width: 34px;
    height: 34px;
  }
}

.result-source-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.result-source-summary button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
}

.result-source-summary strong {
  font-size: 13px;
}

.results-filter-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.results-filter-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.result-source-summary button {
  min-height: 38px;
  padding: 0 14px;
}

.result-source-summary strong {
  display: none;
}

@media (max-width: 640px) {
  .results-filter-row {
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 7px;
  }

  .result-source-summary {
    gap: 5px;
  }

  .result-source-summary button {
    min-height: 34px;
    padding: 0 9px;
  }

  .result-source-summary span,
  .results-filter-label {
    font-size: 10px;
  }
}
