:root {
  --bg: #faf9f6;
  --panel: #ffffff;
  --ink: #1b1c18;
  --muted: #5f5e58;
  --faint: #6d6b62; /* ≥4.5:1 on --bg for small text (WCAG AA) */
  --line: #e2e2de;
  --line-soft: #eeedea;
  --control-line: #7a786f;
  --accent: #F2CA50;
  --accent-deep: #6f5600;
  --accent-ink: #3c2f00;
  --accent-soft: #fbf3dd;
  --live-bg: #DCFCE7;
  --live-border: #BBF7D0;
  --live-text: #166534;
  --danger: #b3261e;
  --danger-soft: #fdf1f0;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(27, 28, 24, .05), 0 8px 24px rgba(27, 28, 24, .04);
  --display: Oswald, "Arial Narrow", sans-serif;
  --body: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14.5px;
  line-height: 1.55;
}

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  box-shadow: 0 0 0 2px var(--accent);
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: none;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: .85em;
  background: var(--accent-soft);
  color: var(--accent-ink);
  padding: 2px 6px;
  border-radius: 5px;
}

.material-symbols-outlined {
  display: none;
  flex: 0 0 1em;
  width: 1em;
  overflow: hidden;
  white-space: nowrap;
  font-family: "Material Symbols Outlined", sans-serif;
  font-style: normal;
  font-weight: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  vertical-align: middle;
  font-variation-settings: "wght" 400;
  font-feature-settings: "liga";
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
}

.material-icons-ready .material-symbols-outlined {
  display: inline-block;
}

/* The icon font is an optional CDN enhancement. If it is unavailable, keep
   decorative ligature words out of the UI and give icon-only controls a
   compact, font-independent symbol instead of leaving an unlabeled blank. */
html:not(.material-icons-ready) .icon-button::before,
html:not(.material-icons-ready) .logout-form .button::before {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

html:not(.material-icons-ready) .icon-button[title^="Preview"]::before {
  content: "↗";
}

html:not(.material-icons-ready) .icon-button[title^="Download"]::before {
  content: "↓";
}

html:not(.material-icons-ready) .icon-button[title^="Delete"]::before {
  content: "×";
}

html:not(.material-icons-ready) .icon-button[title^="Copy"]::before {
  content: "⧉";
}

html:not(.material-icons-ready) .logout-form .button::before {
  content: "↪";
}

/* ------------------------------- top bar -------------------------------- */

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 34px;
  height: 100%;
}

.brand {
  text-decoration: none;
  font-family: var(--display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: .01em;
}

.brand span {
  color: var(--accent-deep);
}

.tabs {
  display: flex;
  gap: 26px;
  height: 100%;
}

.tabs a {
  display: inline-flex;
  align-items: center;
  height: 100%;
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  font-size: 14.5px;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}

.tabs a:hover {
  color: var(--ink);
}

.tabs a.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-chip {
  color: var(--faint);
  font-size: 13px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-form {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* -------------------------------- layout -------------------------------- */

.app-shell {
  flex: 1;
  min-width: 0;
  width: min(1240px, calc(100% - 48px));
  margin: 34px auto 60px;
}

.app-foot {
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: 20px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.app-foot p {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: .02em;
}

h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(26px, 3.4vw, 38px);
  line-height: 1.1;
  letter-spacing: .01em;
  margin: 0 0 6px;
}

h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 21px;
  letter-spacing: .01em;
  margin: 0 0 12px;
}

h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: .02em;
  margin: 26px 0 14px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 24px;
}

.page-head p {
  color: var(--muted);
  margin: 0;
  font-size: 15px;
}

.quota-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 5px 9px;
  border: 1px solid #ebdfba;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 600;
}

.quota-badge .material-symbols-outlined {
  font-size: 15px;
}

.kicker {
  font-family: var(--display);
  color: var(--accent-deep);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 12px;
  margin: 0 0 6px;
}

.help {
  color: var(--muted);
  font-size: 13.5px;
  margin: 4px 0 18px;
  max-width: 80ch;
}

/* ------------------------------- buttons -------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 20px;
  border: 1px solid var(--control-line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .1s ease, box-shadow .15s ease;
}

.button .material-symbols-outlined {
  font-size: 19px;
}

.button:hover {
  border-color: var(--ink);
  background: #fcfbf8;
}

.button:active {
  transform: translateY(1px);
}

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

.button:disabled {
  cursor: not-allowed;
  opacity: .58;
  box-shadow: none;
  transform: none;
}

.button:focus-visible {
  outline-color: var(--ink);
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 16px rgba(242, 202, 80, .35);
}

.button.primary:hover {
  background: #e9bf3e;
  border-color: #e9bf3e;
}

.button.ghost {
  background: transparent;
}

.button.small {
  min-height: 44px;
  padding: 5px 13px;
  font-size: 13px;
}

.button.wide {
  width: 100%;
}

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

.button.danger:hover {
  border-color: #e3b7b4;
  background: var(--danger-soft);
}

/* "Go live" actions (Publish/Republish): green so they read differently from
   the gold save/primary buttons around them. */
.button.go {
  background: #087a3c;
  border-color: #087a3c;
  color: #fff;
  box-shadow: 0 6px 16px rgba(8, 122, 60, .28);
}

.button.go:hover {
  background: #066530;
  border-color: #066530;
}

/* Gives a newly available publish action a quiet, static emphasis. Continuous
   motion is deliberately avoided so the editor stays calm and accessible. */
.button.go.attention {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--accent), 0 6px 16px rgba(8, 122, 60, .28);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
  }
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
}

.icon-button:hover {
  background: var(--line-soft);
  color: var(--ink);
}

.icon-button.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* --------------------------------- cards --------------------------------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 28px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}

.card > p {
  color: var(--muted);
  margin: 0 0 10px;
}

/* -------------------------------- tables --------------------------------- */

.table-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 22px;
}

.search-row {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(420px, 100%);
  border: 1px solid var(--control-line);
  border-radius: 8px;
  padding: 9px 14px;
  background: var(--bg);
  color: var(--faint);
  min-height: 44px;
}

.search-box input {
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--ink);
  width: 100%;
  outline: none;
}

.search-box:focus-within {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--accent);
}

.leads-filter label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.leads-filter label > span {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--faint);
}

.leads-filter select {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--control-line);
  border-radius: 8px;
  padding: 9px 12px;
  min-width: 220px;
  max-width: 100%;
  min-height: 44px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  font-family: var(--display);
  font-weight: 500;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  text-align: left;
  padding: 14px 22px;
  background: #f7f6f2;
  border-bottom: 1px solid var(--line);
}

.data-table td {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table .right,
.data-table td.right {
  text-align: right;
}

.row-title {
  font-weight: 600;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.row-sub {
  font-family: var(--display);
  color: var(--faint);
  font-size: 12.5px;
  letter-spacing: .04em;
  margin-top: 3px;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.live-link {
  color: var(--accent-deep);
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

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

.live-link .material-symbols-outlined {
  font-size: 16px;
}

.lead-count-link {
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
}

.lead-count-link strong {
  color: var(--accent-deep);
  font-size: 18px;
}

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

.not-deployed {
  color: var(--faint);
  font-style: italic;
}

.domain-cell {
  display: grid;
  gap: 3px;
  min-width: 150px;
}

.domain-cell .row-sub {
  width: fit-content;
}

.table-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-family: var(--display);
  letter-spacing: .03em;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.table-scroll {
  overflow-x: auto;
}

.table-scroll:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.table-search-empty {
  margin: 0;
  padding: 30px 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--display);
  text-align: center;
}

.leads-table {
  min-width: 1120px;
}

@media (min-width: 1101px) {
  .leads-table {
    min-width: 1740px;
    table-layout: fixed;
  }

  .leads-table th:first-child {
    width: 280px;
  }

  .leads-table th:nth-child(2) {
    width: 170px;
  }

  .leads-table th:nth-child(3) {
    width: 190px;
  }

  .leads-table td:first-child {
    vertical-align: top;
  }

  .leads-table td:nth-child(2) {
    white-space: nowrap;
  }

  .leads-table .lead-funnel,
  .leads-table .utm-chip {
    max-width: 100%;
  }
}

.members-table {
  min-width: 940px;
}

.leads-table td {
  padding-top: 14px;
  padding-bottom: 14px;
}

.lead-funnel,
.utm-chip {
  display: inline-block;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-funnel {
  font-weight: 600;
}

.utm-chip {
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12px;
}

.lead-date,
.faint {
  color: var(--faint);
  font-size: 12.5px;
}

.empty-icon {
  color: var(--accent-deep);
  font-size: 36px;
}

/* -------------------------------- badges --------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
}

.pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.pill.live {
  background: var(--live-bg);
  border: 1px solid var(--live-border);
  color: var(--live-text);
}

.pill.published {
  background: var(--accent-soft);
  border: 1px solid #dbc780;
  color: var(--accent-ink);
}

.pill.draft {
  background: #f4f3f0;
  border: 1px solid var(--line);
  color: var(--muted);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f4f3f0;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 6px;
  padding: 4px 10px;
}

.chip.admin {
  background: var(--accent-soft);
  border-color: #ecd9a0;
  color: var(--accent-ink);
}

.chip .material-symbols-outlined {
  font-size: 15px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-cell > div {
  min-width: 0;
}

.data-table .email {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.user-cell .email {
  color: var(--faint);
  font-size: 13px;
  margin-top: 2px;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #16a34a;
}

/* --------------------------------- editor -------------------------------- */

.editor-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 24px;
  margin-bottom: 22px;
  position: sticky;
  top: 78px;
  z-index: 30;
}

.editor-bar .editor-label {
  font-family: var(--display);
  color: var(--accent-deep);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 11.5px;
  display: block;
}

.editor-bar h1 {
  font-size: 21px;
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.editor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.autosave-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--live-text);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.autosave-status .material-symbols-outlined {
  font-size: 17px;
}

.autosave-status.pending,
.autosave-status.saving {
  color: var(--muted);
}

.autosave-status.saving .material-symbols-outlined {
  animation: status-spin .8s linear infinite;
}

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

@keyframes status-spin {
  to { transform: rotate(360deg); }
}

.editor-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.editor-side {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 14px;
  position: sticky;
  top: 156px;
}

.side-kicker {
  font-family: var(--display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 11px;
  color: var(--faint);
  margin: 0 0 12px;
  padding: 0 10px;
}

.side-nav {
  display: grid;
  gap: 2px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  padding: 11px 12px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 44px;
}

.side-nav a .material-symbols-outlined {
  font-size: 20px;
  color: var(--faint);
}

.side-nav a:hover {
  background: var(--bg);
  color: var(--ink);
}

.side-nav a.active {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.side-nav a.active .material-symbols-outlined {
  color: var(--accent-ink);
}

.side-launch {
  margin-top: 18px;
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
}

.editor-main {
  min-width: 0;
}

.step {
  display: none;
  scroll-margin-top: 170px;
}

.step.active {
  display: block;
}

.editor-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 30px 30px;
}

.funnel-flow {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0 5px;
  padding: 16px 18px;
  border: 1px solid #ebdfba;
  border-radius: 10px;
  background: linear-gradient(110deg, #fffaf0, #fffdf8);
}

.funnel-flow-icon {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
}

.material-icons-ready .funnel-flow-icon {
  display: grid;
}

.funnel-flow-copy {
  min-width: 0;
}

.funnel-flow-copy strong {
  display: block;
  font-size: 14px;
}

.funnel-flow-copy p,
.funnel-flow-summary {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.funnel-flow-summary {
  margin: 0 0 22px 54px;
}

.option-toggle {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 0 0 22px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfaf7;
}

.option-toggle > div {
  min-width: 0;
}

.option-toggle strong {
  display: block;
  font-size: 13.5px;
}

.option-toggle p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.option-toggle .flow-switch {
  margin-left: auto;
}

.flow-switch {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  margin-left: auto;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  min-height: 44px;
}

.flow-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.flow-switch-track {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #77746b;
  box-shadow: inset 0 0 0 1px rgba(27, 28, 24, .12);
  transition: background .18s ease;
}

.flow-switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(27, 28, 24, .25);
  content: "";
  transition: transform .18s ease;
}

.flow-switch input:checked + .flow-switch-track {
  background: var(--accent-deep);
}

.flow-switch input:checked + .flow-switch-track::after {
  transform: translateX(16px);
}

.flow-switch input:focus-visible + .flow-switch-track {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  box-shadow: 0 0 0 2px var(--accent);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 4px;
}

.panel-head h2 {
  margin: 0;
  overflow-wrap: anywhere;
}

.panel-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Live URL of a published page, shown next to its editor section. */
.live-page {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.live-page-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 5px 10px;
  border: 1px solid var(--live-border);
  border-radius: 999px;
  background: var(--live-bg);
  color: var(--live-text);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}

.live-page-link:hover {
  border-color: #86efac;
  filter: brightness(.98);
}

.live-page-link .material-symbols-outlined {
  font-size: 15px;
}

.live-copy .material-symbols-outlined {
  font-size: 18px;
}

/* -------------------------------- fields --------------------------------- */

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 18px;
}

.field > span,
.field > label,
.field > legend {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.field small {
  color: var(--faint);
  font-size: 12.5px;
}

.field input,
.field textarea,
.field select {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--control-line);
  border-radius: 8px;
  padding: 11px 13px;
  width: 100%;
}

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

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--accent);
}

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

.color-pair {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.color-pair input[type="text"] {
  flex: 1 1 140px;
  width: auto;
  min-width: 0;
}

.color-field {
  min-width: 0;
  padding: 0;
  border: 0;
}

.color-field legend {
  margin-bottom: 7px;
  padding: 0;
}

.color-pair input[type="color"] {
  flex: 0 0 46px;
  width: 46px;
  height: 44px;
  padding: 4px;
  cursor: pointer;
}

.checkline {
  display: flex;
  gap: 9px;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: 14px;
  margin: 4px 0 18px;
  cursor: pointer;
}

.checkline input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-deep);
}

.quota-form {
  display: grid;
  gap: 4px;
  min-width: 132px;
}

.quota-form select {
  width: 100%;
  border: 1px solid var(--control-line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  padding: 7px 9px;
  font: inherit;
  font-size: 13px;
  min-height: 44px;
}

.quota-form small {
  color: var(--faint);
  font-size: 11.5px;
}

.suffix-input {
  display: flex;
  align-items: stretch;
}

.suffix-input input {
  border-radius: 8px 0 0 8px;
  border-right: 0;
}

.suffix-input .suffix {
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 0 8px 8px 0;
  background: #f7f6f2;
  color: var(--muted);
  font-size: 13.5px;
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

.image-field .image-drop {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px dashed #cfcec8;
  border-radius: 8px;
  padding: 12px;
  background: var(--bg);
}

.image-preview {
  height: 52px;
  max-width: 120px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--line);
}

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

.image-file-input {
  max-width: 100%;
  min-height: 44px;
  color: var(--muted);
  font: inherit;
}

.image-file-input::file-selector-button {
  min-height: 40px;
  margin-right: 10px;
  padding: 7px 13px;
  border: 1px solid var(--control-line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* -------------------------------- publish -------------------------------- */

.publish-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: 20px;
  align-items: start;
  min-width: 0;
}

.pub-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
  min-width: 0;
}

.pub-card h3 {
  margin: 0 0 6px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.pub-col {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.publish-readiness {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin: 0 0 20px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.publish-readiness.ready {
  border-color: var(--live-border);
  background: var(--live-bg);
}

.publish-readiness.blocked {
  border-color: #e5cf98;
  background: #fffaf0;
}

.publish-readiness strong {
  display: block;
}

.publish-readiness > div:first-child {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  min-width: 0;
}

.publish-readiness p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.publish-readiness ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  align-items: start;
  gap: 8px 16px;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.publish-readiness li {
  display: inline-flex;
  align-items: flex-start;
  gap: 5px;
  min-width: 0;
  line-height: 18px;
  font-size: 12.5px;
  font-weight: 600;
}

.publish-readiness li.ready {
  color: var(--live-text);
}

.publish-readiness li.blocked {
  color: #7a4c00;
}

.publish-readiness li .material-symbols-outlined {
  flex: 0 0 auto;
  font-size: 18px;
}

.publish-guide {
  border: 1px solid #ebdfba;
  border-radius: var(--radius);
  padding: 20px;
  background: linear-gradient(135deg, #fffaf0, #fffdf8);
}

.publish-guide-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.material-icons-ready .publish-guide-head > .material-symbols-outlined {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
}

.publish-guide .kicker {
  margin: 0 0 1px;
  font-size: 10px;
}

.publish-guide h3 {
  margin: 0;
  font-size: 17px;
}

.publish-guide ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: publish-step;
}

.publish-guide li {
  position: relative;
  padding-left: 29px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  counter-increment: publish-step;
}

.publish-guide li::before {
  position: absolute;
  top: 1px;
  left: 0;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  content: counter(publish-step);
  font-size: 11px;
  font-weight: 700;
}

.publish-guide strong {
  color: var(--ink);
}

.publish-guide a {
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration-color: var(--accent-deep);
  text-underline-offset: 2px;
}

.info-box {
  display: flex;
  gap: 14px;
  background: #f4f3ef;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.info-box .material-symbols-outlined {
  color: var(--muted);
  margin-top: 2px;
}

.info-box strong {
  display: block;
  margin-bottom: 4px;
}

.info-box p {
  color: var(--muted);
  margin: 0;
  font-size: 13.5px;
}

.info-box.warning {
  border-color: #f0cf83;
  background: #fff7e3;
}

.info-box.warning .material-symbols-outlined,
.info-box.warning strong {
  color: #8a5a00;
}

.live-url-box {
  border: 1.5px dashed #cfcec8;
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  color: var(--faint);
  font-size: 13.5px;
}

.live-url-box.on {
  border-style: solid;
  border-color: var(--live-border);
  background: var(--live-bg);
  color: var(--live-text);
}

.material-icons-ready .live-url-box .material-symbols-outlined {
  display: block;
  margin: 0 auto 8px;
  font-size: 26px;
}

.live-url-box a {
  color: inherit;
  font-weight: 600;
}

.page-links p {
  margin: 0 0 8px;
}

.page-links strong {
  display: inline-block;
  min-width: 96px;
  font-family: var(--display);
  font-weight: 500;
}

.page-links a {
  color: var(--accent-ink);
  font-weight: 500;
}

.dns-box {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 8px 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  margin: 14px 0;
  font-size: 14px;
}

.dns-box span {
  color: var(--faint);
}

.dns-box b {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* ------------------------------ hero / empty ----------------------------- */

.hero-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 32px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}

.hero-bar p {
  color: var(--muted);
  margin: 0;
  max-width: 62ch;
}

.hero-bar.success {
  border-color: var(--live-border);
  background: linear-gradient(0deg, var(--live-bg), var(--panel) 70%);
}

.empty {
  text-align: center;
  padding: 54px 20px;
  color: var(--muted);
}

.empty h1,
.empty h2 {
  color: var(--ink);
}

.empty .button {
  margin-top: 12px;
}

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

/* ----------------------------- flash messages ---------------------------- */

.form-error {
  background: var(--danger-soft);
  border: 1px solid #eccfcd;
  color: var(--danger);
  border-radius: 8px;
  padding: 11px 15px;
  font-size: 14px;
  margin: 0 0 16px;
}

.form-success {
  background: var(--live-bg);
  border: 1px solid var(--live-border);
  color: var(--live-text);
  border-radius: 8px;
  padding: 11px 15px;
  font-size: 14px;
  margin: 0 0 16px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 11px 22px;
  border-radius: 999px;
  box-shadow: 0 14px 40px rgba(27, 28, 24, .3);
  z-index: 60;
  transition: opacity .4s ease, transform .4s ease;
}

.toast.hide {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
  pointer-events: none;
}

.app-loader[hidden] {
  display: none;
}

.app-loader {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(27, 28, 24, .22);
  backdrop-filter: blur(3px);
}

.app-loader-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 17px 21px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(27, 28, 24, .22);
  color: var(--ink);
}

.app-loader-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent-deep);
  border-radius: 50%;
  animation: loader-spin .75s linear infinite;
}

@keyframes loader-spin {
  to { transform: rotate(360deg); }
}

/* --------------------------------- auth ---------------------------------- */

.auth-body {
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.auth-shell {
  width: min(430px, 100%);
  display: grid;
  gap: 24px;
  justify-items: center;
}

.auth-brand {
  font-size: 26px;
}

.auth-card {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 34px;
  box-shadow: var(--shadow);
}

.mobile-editor-action {
  display: none;
}

.auth-card h1 {
  font-size: 26px;
  margin-bottom: 4px;
}

.auth-card .help {
  margin-bottom: 22px;
}

.auth-link {
  margin: 17px 0 0;
  text-align: center;
  font-size: 13.5px;
}

.auth-link a {
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration-color: var(--accent-deep);
  text-underline-offset: 3px;
}

/* ------------------------------- responsive ------------------------------ */

@media (max-width: 1100px) {
  /*
   * Wide data tables become labelled record cards before their columns start
   * squeezing. The underlying table markup and headers remain available to
   * assistive technology while every value stays visible without side-scrolling.
   */
  .table-scroll {
    overflow: visible;
  }

  .data-table,
  .leads-table,
  .members-table {
    display: block;
    min-width: 0;
  }

  .data-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .data-table tbody {
    display: grid;
    gap: 12px;
    padding: 14px;
  }

  .data-table tbody tr {
    display: block;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
  }

  .data-table td,
  .data-table td.right {
    position: relative;
    display: block;
    min-width: 0;
    min-height: 46px;
    padding: 13px 14px 13px 132px;
    border: 0;
    border-top: 1px solid var(--line-soft);
    text-align: left;
    overflow-wrap: anywhere;
  }

  .data-table td:first-child {
    position: relative;
    left: auto;
    z-index: auto;
    border-top: 0;
    background: transparent;
    box-shadow: none;
  }

  .data-table td::before {
    content: attr(data-label);
    position: absolute;
    top: 14px;
    left: 14px;
    width: 104px;
    color: var(--muted);
    font-family: var(--display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    line-height: 1.35;
    text-transform: uppercase;
  }

  .data-table .row-actions {
    justify-content: flex-start;
  }

  .lead-funnel,
  .utm-chip {
    max-width: 100%;
  }
}

@media (max-width: 960px) {
  html:has(.mobile-editor-action) {
    height: 100%;
    overflow: hidden;
  }

  body:has(.mobile-editor-action) {
    position: fixed;
    inset: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }

  body:has(.mobile-editor-action) .topbar {
    flex: 0 0 auto;
  }

  body:has(.mobile-editor-action) .app-shell {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    padding-bottom: 28px;
    scroll-padding-bottom: 28px;
  }

  body:has(.mobile-editor-action) .app-foot {
    display: none;
  }

  .editor-layout {
    grid-template-columns: 1fr;
  }

  .editor-side {
    position: static;
  }

  .side-nav {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

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

  .editor-bar {
    position: static;
    flex-direction: column;
    align-items: flex-start;
  }

  .editor-actions {
    flex-wrap: wrap;
  }

  .editor-actions > button[form="funnel-form"] {
    display: none;
  }

  .step {
    scroll-margin-top: 80px;
  }

  .mobile-editor-action {
    position: fixed;
    z-index: 35;
    right: 14px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 14px;
    display: block;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    box-shadow: 0 10px 30px rgba(27, 28, 24, .18);
  }
}

@media (max-width: 760px) {
  /* Prevent iOS Safari from zooming and panning the page when a form control
     receives focus. */
  .field input,
  .field textarea,
  .field select,
  .search-box input,
  .quota-form select {
    font-size: 16px;
  }

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

  .page-head,
  .hero-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-row {
    padding: 14px;
  }

  .leads-filter,
  .leads-filter label {
    display: grid;
    width: 100%;
  }

  .leads-filter label {
    align-items: stretch;
    gap: 7px;
  }

  .leads-filter select {
    width: 100%;
    min-width: 0;
    font-size: 16px;
  }

  .topbar {
    position: sticky;
    height: auto;
    min-height: 0;
    padding: 8px 14px 0;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .topbar-left {
    width: 100%;
    min-width: 0;
    height: auto;
    gap: 0;
    flex-wrap: wrap;
  }

  .brand {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    padding-right: 52px;
  }

  .tabs {
    order: 2;
    width: 100%;
    height: 44px;
    gap: 0;
    justify-content: space-around;
    border-top: 1px solid var(--line-soft);
  }

  .tabs a {
    min-width: 0;
    min-height: 44px;
    height: 44px;
    flex: 1;
    justify-content: center;
    padding: 0 8px;
    font-size: 13.5px;
    margin-bottom: 0;
  }

  .topbar-right {
    position: absolute;
    top: 8px;
    right: 12px;
  }

  .logout-form .button {
    width: 44px;
    padding: 0;
    gap: 0;
    font-size: 0;
  }

  .logout-form .button .material-symbols-outlined {
    font-size: 20px;
  }

  .user-chip {
    display: none;
  }

  .app-shell {
    width: calc(100% - 28px);
    margin-top: 22px;
  }

  .funnel-flow {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .flow-switch {
    margin-left: 0;
  }

  .funnel-flow-summary {
    margin-left: 0;
  }

  .option-toggle {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .option-toggle .flow-switch {
    margin-left: 0;
  }

  .editor-side {
    position: sticky;
    top: 0;
    z-index: 24;
    padding: 10px;
    overflow: hidden;
  }

  .side-kicker {
    display: none;
  }

  .side-nav {
    display: flex;
    grid-template-columns: none;
    gap: 6px;
    padding: 7px 7px 10px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-padding-inline: 7px;
    scroll-snap-type: inline proximity;
    scrollbar-width: thin;
  }

  .side-nav a {
    flex: 0 0 auto;
    white-space: nowrap;
    scroll-snap-align: start;
    padding: 9px 11px;
    min-height: 44px;
  }

  .side-launch {
    display: none;
  }

  .editor-panel {
    padding: 20px 16px 22px;
    scroll-margin-top: 105px;
  }

  .step {
    scroll-margin-top: 105px;
  }

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

  .panel-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .live-page {
    min-width: 0;
    max-width: 100%;
  }

  .live-page-link {
    max-width: calc(100vw - 130px);
  }

  .pub-card {
    padding: 20px 16px;
  }

  .publish-readiness {
    align-items: start;
  }

  .publish-readiness ul {
    grid-template-columns: minmax(0, 1fr);
  }

  .dns-box {
    grid-template-columns: 64px minmax(0, 1fr);
    padding: 14px;
  }

  .dns-box b {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .image-field .image-drop {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .image-actions {
    width: 100%;
  }

  .image-file-input {
    width: 100%;
  }

  .color-pair {
    flex-wrap: wrap;
  }

  .table-scroll {
    position: relative;
  }

  .data-table td,
  .data-table td.right {
    padding-left: 116px;
  }

  .data-table td::before {
    width: 88px;
  }

  .app-foot {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    padding-inline: 16px;
  }

  .auth-card {
    padding: 26px 22px;
  }

}
