/* ═══════════════════════════════════════════════════════════════════
   SwiftSign — Design System
   Dark, premium, app-like PWA. Private document signing.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  /* Surfaces */
  --bg: #0a0b0f;
  --bg-elevated: #121319;
  --surface: #16181f;
  --surface-hover: #1c1f28;
  --surface-active: #22262f;

  /* Borders */
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(129, 140, 248, 0.5);

  /* Text */
  --text: #e8eaf0;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --text-dim: #4b5563;

  /* Accent */
  --accent: #818cf8;
  --accent-hover: #6366f1;
  --accent-soft: rgba(129, 140, 248, 0.12);
  --accent-glow: rgba(129, 140, 248, 0.2);

  /* Semantic */
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.12);
  --warning: #fbbf24;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);

  /* Typography */
  --font-sans: 'Geist', -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-mono: 'SF Mono', 'Geist Mono', 'JetBrains Mono', monospace;

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 24px var(--accent-glow);

  /* Layout */
  --topbar-h: 56px;
  --max-w: 1200px;

  /* Transitions */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --t-fast: 150ms;
  --t-med: 250ms;
  --t-slow: 400ms;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; height: 100%; touch-action: manipulation; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  touch-action: manipulation;
}
/* Builder and Signer views hide the topbar, so they should fill 100% of the
   viewport with no top padding — this also kills the black bar that was
   showing below the builder layout on PC and mobile. */
#view-builder.view, #view-signer.view {
  padding-top: 0 !important;
  height: 100dvh;
  min-height: 100dvh;
}
/* When running as installed PWA (standalone), use safe areas on topbar */
@media (display-mode: standalone), (display-mode: fullscreen) {
  #topbar {
    padding-top: env(safe-area-inset-top);
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
  }
  .view { padding-top: calc(var(--topbar-h) + env(safe-area-inset-top)); }
  /* Builder and signer still fill the full viewport; toolbar/command-bar
     get safe-area insets so content avoids the iPhone notch and home bar. */
  .command-bar, .signer-footer, .builder-toolbar {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .builder-toolbar {
    padding-top: calc(12px + env(safe-area-inset-top));
  }
}
img, svg { display: block; max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
input, textarea { outline: none; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Top Bar ── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: rgba(10, 11, 15, 0.8);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  transition: transform var(--t-med) var(--ease);
}
.topbar-inner {
  max-width: var(--max-w);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  flex-shrink: 0;
}
.logo-mark { color: var(--accent); }
.logo-text {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-link {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--r-sm);
  transition: color var(--t-fast), background var(--t-fast);
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.topbar-menu-btn { display: none; padding: 8px; color: var(--text); }

/* ── Buttons ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--r-sm);
  transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled {
  background: var(--surface-active);
  color: var(--text-dim);
  cursor: not-allowed;
  transform: none;
}
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--r-sm);
  transition: color var(--t-fast), background var(--t-fast);
}
.btn-ghost:hover { color: var(--text); background: var(--surface); }
.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.btn-outline:hover { border-color: var(--accent); background: var(--accent-soft); }

/* ── Views ── */
.view { display: none; min-height: 100vh; min-height: 100dvh; padding-top: var(--topbar-h); }
.view-active { display: block; }

/* ═══════════════════════════════════════════════════════════════════
   HOME / HERO
   ═══════════════════════════════════════════════════════════════════ */
.home-hero {
  min-height: calc(100vh - var(--topbar-h));
  min-height: calc(100dvh - var(--topbar-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  position: relative;
  overflow: hidden;
}
/* Ambient glow */
.home-hero::before {
  content: '';
  position: absolute;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  opacity: 0.5;
  pointer-events: none;
  filter: blur(40px);
}
.hero-content {
  max-width: 640px;
  text-align: center;
  position: relative;
  z-index: 1;
}
.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 28px;
}
.privacy-badge svg { color: var(--success); }
.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}
.hero-title em {
  font-style: italic;
  color: var(--accent);
}
.hero-sub {
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto 40px;
}

/* ── Dropzone ── */
.dropzone-container { max-width: 480px; margin: 0 auto; }
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-xl);
  padding: 48px 32px;
  cursor: pointer;
  transition: border-color var(--t-med), background var(--t-med), transform var(--t-med);
  background: rgba(255,255,255,0.01);
}
.dropzone:hover, .dropzone:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.01);
}
.dropzone-inner { text-align: center; }
.dropzone-icon {
  color: var(--text-muted);
  margin: 0 auto 16px;
  transition: color var(--t-med);
}
.dropzone:hover .dropzone-icon { color: var(--accent); }
.dropzone-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}
.dropzone-sub {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Feature chips ── */
.home-features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
}
.feature-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  border-radius: 999px;
}
.feature-chip svg { color: var(--success); }

/* ═══════════════════════════════════════════════════ ════════════════
   HOW IT WORKS SECTION
   ═══════════════════════════════════════════════════════════════════ */
.how-section {
  padding: 100px 24px;
  border-top: 1px solid var(--border);
}
.section-inner { max-width: var(--max-w); margin: 0 auto; }
.section-title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 48px;
  text-align: center;
}
.section-sub {
  font-size: 15px;
  color: var(--text-secondary);
  text-align: center;
  max-width: 440px;
  margin: -32px auto 48px;
}
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.step-card {
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: border-color var(--t-med), transform var(--t-med);
}
.step-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.step-number {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 16px;
}
.step-card h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
}
.step-card p {
  font-size: 14px;
  .share-step-done .share-step-num {
    background: var(--success);
  }

  /* ═══════════════════════════════════════════════════════════════════
     ═══════════════════════════════════════════════════════════════════ */
.pricing-section {
  padding: 100px 24px;
  border-top: 1px solid var(--border);
}
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
}
.price-card {
  padding: 36px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  text-align: center;
  transition: border-color var(--t-med), transform var(--t-med);
  position: relative;
}
.price-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.price-card-featured {
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--surface) 100%);
}
.price-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 12px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
}
.price-tag {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  font-weight: 400;
  margin-bottom: 4px;
}
.price-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.price-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.price-btn { width: 100%; justify-content: center; }

/* ═══════════════════════════════════════════════════════════════════
   FOOTER
   ═════════════════════════════════════════════ page-footer ───────── */
.footer {
  padding: 60px 24px 40px;
  border-top: 1px solid var(--border);
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 40px;
}
.footer-brand { max-width: 360px; }
.footer-brand .logo-text { font-size: 16px; font-weight: 600; margin-bottom: 12px; display: block; }
.footer-brand p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}
.footer-meta {
  font-size: 12px;
  color: var(--text-dim);
}

/* ═══════════════════════════════════════════════════════════════════
   BUILDER VIEW — EMPTY STATE
   Shown when no PDF is loaded. The "Select your document" CTA is the
   primary entry point. Once a PDF loads, this whole panel hides and
   the canvas + toolbar take over.
   ═══════════════════════════════════════════════════════════════════ */
.builder-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 40px 24px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(99, 102, 241, 0.08), transparent 60%),
    radial-gradient(ellipse at 100% 100%, rgba(14, 124, 102, 0.06), transparent 50%),
    var(--bg, #0a0c10);
  position: relative;
  overflow: hidden;
}
.builder-empty::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: -1px -1px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}
.builder-empty-inner {
  position: relative;
  z-index: 1;
  max-width: 560px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
}
.builder-empty-back {
  align-self: flex-start;
  margin-bottom: 8px;
}
.builder-empty-icon {
  color: var(--text-secondary, #cbd5e1);
  margin-bottom: 4px;
  display: inline-flex;
  animation: emptyIconFloat 6s ease-in-out infinite;
}
@keyframes emptyIconFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
@media (prefers-reduced-motion: reduce) {
  .builder-empty-icon { animation: none; }
}
.builder-empty-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text, #f8fafc);
  margin: 0;
  line-height: 1.1;
}
.builder-empty-sub {
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-secondary, #cbd5e1);
  max-width: 460px;
  margin: 0;
}
.builder-empty-drop {
  width: 100%;
  max-width: 460px;
  margin-top: 12px;
  padding: 32px 24px 28px;
  background: rgba(255, 255, 255, 0.02);
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 200ms ease-out;
  outline: none;
}
.builder-empty-drop:hover,
.builder-empty-drop:focus-visible {
  border-color: var(--accent, #6366f1);
  background: rgba(99, 102, 241, 0.06);
  transform: translateY(-1px);
}
.builder-empty-drop.is-dragover {
  border-color: var(--accent, #6366f1);
  background: rgba(99, 102, 241, 0.12);
  border-style: solid;
  transform: scale(1.01);
}
.builder-empty-drop-glyph {
  color: var(--text-secondary, #cbd5e1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(168, 85, 247, 0.12));
  border: 1px solid rgba(99, 102, 241, 0.25);
  transition: transform 200ms ease-out;
}
.builder-empty-drop:hover .builder-empty-drop-glyph {
  transform: translateY(-2px);
}
.builder-empty-pick {
  /* Inherits btn-primary btn-xl from the global styles */
  /* The button is inside the dropzone — clicking it picks the file, but the
     dropzone itself is also clickable for redundancy */
}
.builder-empty-drop-hint {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  margin: 0;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.builder-empty-bullets {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 460px;
  text-align: left;
}
.builder-empty-bullets li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary, #cbd5e1);
  line-height: 1.45;
}
.builder-empty-bullets .check {
  color: var(--success, #10b981);
  font-weight: 700;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  font-size: 11px;
  margin-top: 1px;
}
@media (max-width: 640px) {
  .builder-empty { padding: 24px 16px; }
  .builder-empty-title { font-size: 26px; }
  .share-step-done .share-step-num {
    background: var(--success);
  }

  /* ═══════════════════════════════════════════════════════════════════
     ═══════════════════════════════════════════════════════════════════ */
/* Fills the entire builder view (which is 100dvh). No padding/margin hack
   to overlay a topbar — the topbar is hidden in builder/signer views. */
.builder-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100%;
}
.builder-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 5;
}
.builder-tools {
  display: flex;
  gap: 8px;
}
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  transition: all var(--t-fast);
}
.tool-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
  border-color: var(--border-strong);
}
.tool-btn.tool-active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
}
.builder-canvas-area {
  flex: 1;
  overflow-y: auto;
  background: #08090c;
  padding: 16px 24px 0;
  position: relative;
  scroll-behavior: smooth;
  /* Avoid iOS rubber-band on pull-down causing visual jank */
  overscroll-behavior: contain;
}
/* Page index sits at the top of the canvas area and stays visible while scrolling.
   Compact layout: [‹] [horizontal-scrolling chips] [N / Total] [›] */
.page-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 10px;
  margin: 0 -24px 16px;
  background: #08090c;
  position: sticky;
  top: 0;
  z-index: 20;
  scrollbar-width: thin;
  /* Subtle bottom border to visually separate from the page content */
  border-bottom: 1px solid var(--border);
}
.page-tab-rail {
  display: flex;
  gap: 4px;
  flex: 1;
  min-width: 0;            /* allows flex-shrink inside parent */
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px 4px;
  /* Fade edges so off-screen chips hint at more content */
  mask-image: linear-gradient(to right, transparent 0, black 16px, black calc(100% - 16px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0, black 16px, black calc(100% - 16px), transparent 100%);
}
.page-tab-rail::-webkit-scrollbar { display: none; }
.page-tab {
  /* Slim, square-ish chip — far less width than "Page N" text */
  flex: 0 0 auto;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums; /* align digits in a column for big docs */
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--t-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.page-tab:hover { color: var(--text); background: var(--surface-hover); }
.page-tab.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
  font-weight: 600;
}
.page-nav-btn {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--t-fast);
}
.page-nav-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
  border-color: var(--border-strong);
}
.page-nav-btn:active { transform: scale(0.95); }
.page-counter {
  flex: 0 0 auto;
  min-width: 52px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  padding: 0 4px;
}
.pdf-viewport {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  transform-origin: top center;
  transition: transform 0.15s ease-out;
  will-change: transform;
}
.pdf-viewport-zoom {
  width: 100%;
  min-height: 100%;
  overflow: visible;
}

/* ── Natural Language Command Bar ── */
.builder-cmd-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 24px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  /* Cancel the parent padding so it spans edge-to-edge */
  margin: 24px -24px 0;
  z-index: 30;
  flex-wrap: wrap;
  /* Solid background so scrolling content behind doesn't bleed through */
  box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.4);
}
.cmd-input {
  flex: 1;
  min-width: 200px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text);
}
.cmd-input:focus {
  outline: none;
  border-color: var(--border-focus);
}
.cmd-input::placeholder {
  color: var(--text-muted);
  font-size: 12px;
}
.cmd-execute {
  padding: 8px 16px;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--t-fast);
}
.cmd-execute:hover:not(:disabled) {
  background: var(--accent-hover);
}
.cmd-execute:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.cmd-error {
  width: 100%;
  font-size: 12px;
  color: var(--danger);
  padding: 4px 8px;
}

/* ── Smart-edit brand chip in the command bar ──
   Sits at the left of the cmd input to brand it as a "smart edit" / "magic
   bar" — a small spark icon + label so users understand it's a typed-command
   surface, not a passive search. */
.cmd-bar-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 8px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.10), rgba(168, 85, 247, 0.10));
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--r-sm);
  flex-shrink: 0;
}
.cmd-bar-spark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #a78bfa;
  width: 14px;
  height: 14px;
}
.cmd-bar-spark svg { display: block; }
.cmd-bar-name {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: #c4b5fd;
  white-space: nowrap;
}
.cmd-bar-divider {
  width: 1px;
  height: 12px;
  background: rgba(167, 139, 250, 0.25);
}
.cmd-bar-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}
@media (max-width: 720px) {
  .cmd-bar-hint { display: none; }
  .cmd-bar-divider { display: none; }
}

/* ── Dropdown base (used by Stamp popover) ──
   Generic popover styles. The popover is a child of a `.tool-btn-wrap` so it
   can position itself below the toggle button. Hidden via [hidden] attribute
   by default; toggled via JS by adding/removing the attribute. */
.tool-btn-wrap {
  position: relative;
  display: inline-flex;
}
.tool-chevron {
  margin-left: 2px;
  opacity: 0.7;
  transition: transform var(--t-fast);
}
.tool-btn.dropdown-toggle[aria-expanded="true"] .tool-chevron {
  transform: rotate(180deg);
}
.dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  min-width: 220px;
  padding: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.20);
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: dropdownIn 140ms ease-out;
}
@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dropdown[hidden] { display: none; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast);
}
.dropdown-item:hover {
  background: var(--surface-hover);
}
.stamp-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.stamp-glyph.stamp-glyph-text {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  font-family: var(--font-mono, monospace);
}
.stamp-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.stamp-label-main {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}
.stamp-label-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.2;
}

/* Lock icon on Pro dropdown items */
.lock-icon {
  flex-shrink: 0;
  color: var(--text-muted);
  opacity: 0.6;
  margin-left: auto;
}

/* Pro badge in dropdown labels */
.pro-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent);
  vertical-align: middle;
  margin-left: 3px;
  line-height: 1.4;
}

/* ── Date picker overlay ── */
.date-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  animation: fadeIn 150ms ease;
}
.date-picker-card {
  background: var(--bg-elevated, #fff);
  border-radius: 12px;
  padding: 20px;
  min-width: 280px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}
.date-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.date-picker-title {
  font-size: 15px;
  font-weight: 600;
}
.date-picker-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}
.date-picker-close:hover { background: var(--surface-hover); }
.date-picker-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  background: var(--surface);
  color: var(--text);
  margin-bottom: 16px;
}
.date-picker-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Search Results Panel ── */
.search-results-panel {
  position: sticky;
  bottom: 64px; /* sits just above the command bar */
  z-index: 25;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin: 16px 0 -8px;
  box-shadow: var(--shadow-md);
  max-height: 280px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: searchPanelIn 200ms var(--ease);
}
@keyframes searchPanelIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.search-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.search-results-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.search-results-title svg { color: var(--accent); flex-shrink: 0; }
.search-results-title strong { color: var(--text); font-weight: 600; }
.search-results-close {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--t-fast);
}
.search-results-close:hover { color: var(--text); background: var(--surface-hover); }
.search-results-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.search-result-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast);
  font-family: var(--font-sans);
}
.search-result-row:last-child { border-bottom: none; }
.search-result-row:hover { background: var(--surface-hover); }
.search-result-page {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.search-result-snippet {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-count {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.pdf-page-container {
  position: relative;
  box-shadow: var(--shadow-md);
  border-radius: 2px;
  overflow: visible;
}
.pdf-page-canvas {
  display: block;
  border-radius: 2px;
}
.pdf-page-label {
  position: absolute;
  top: -24px;
  left: 0;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* ── Per-Page Actions ── */
.page-actions {
  position: absolute;
  top: -28px;
  right: 0;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--t-fast);
}
.pdf-page-container:hover .page-actions {
  opacity: 1;
}
.page-actions:hover {
  opacity: 1;
}
.page-action-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t-fast);
  padding: 0;
}
.page-action-btn:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-strong);
}
.page-action-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.page-action-delete:hover:not(:disabled) {
  color: var(--danger);
  border-color: var(--danger);
  background: var(--danger-soft);
}

/* ── Drag-and-drop visual states ── */
.pdf-page-container.dragging {
  opacity: 0.4;
  transform: scale(0.98);
  transition: all var(--t-fast);
}
.pdf-page-container.drag-over-left::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 12px var(--accent-glow);
  z-index: 20;
}
.pdf-page-container.drag-over-right::after {
  content: '';
  position: absolute;
  right: -8px;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 12px var(--accent-glow);
  z-index: 20;
}
.pdf-page-label {
  cursor: grab;
  user-select: none;
}
.pdf-page-label:active {
  cursor: grabbing;
}

/* ── Zoom Controls ── */
.builder-zoom {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 2px;
}
.zoom-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
  padding: 0;
}
.zoom-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.zoom-level {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  min-width: 36px;
  text-align: center;
  user-select: none;
}
.zoom-slider {
  width: 80px;
  height: 4px;
  background: var(--surface-active);
  border-radius: 2px;
  outline: none;
  margin: 0 4px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--t-fast);
}
.zoom-slider::-webkit-slider-thumb:hover {
  background: var(--accent-hover);
  transform: scale(1.2);
}
.zoom-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

/* ── PDF Loading Overlay ── */
.pdf-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 9, 12, 0.92);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  flex-direction: column;
}
.pdf-loading-content {
  text-align: center;
  max-width: 320px;
}
.pdf-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--surface-active);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.pdf-loading-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 12px;
}
.pdf-loading-bar-wrap {
  width: 240px;
  height: 4px;
  background: var(--surface-active);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 auto 8px;
}
.pdf-loading-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}
.pdf-loading-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Builder Fields ── */
.field-overlay {
  position: absolute;
  border: 2px solid var(--accent);
  border-radius: 4px;
  background: rgba(129, 140, 248, 0.06);
  cursor: move;
  touch-action: none;
  user-select: none;
  z-index: 10;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field-overlay:hover {
  border-color: var(--accent-hover);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-overlay.field-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  z-index: 12;
}
.field-overlay.field-signature {
  border-color: #a78bfa;
  background: rgba(167, 139, 250, 0.06);
}
.field-overlay.field-text {
  border-color: #60a5fa;
  background: rgba(96, 165, 250, 0.06);
}
.field-overlay.field-date {
  border-color: #34d399;
  background: rgba(52, 211, 153, 0.06);
}
.field-label {
  position: absolute;
  top: -20px;
  left: 0;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 4px;
}
.field-label .field-label-type {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--surface);
}
.field-label .field-delete {
  pointer-events: auto;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity var(--t-fast);
}
.field-label .field-delete:hover { opacity: 1; color: var(--danger); }
.field-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  pointer-events: none;
}
/* Editable placeholders (text/date fields) - click to set default text */
.field-placeholder.field-placeholder-editable {
  pointer-events: auto;
  cursor: text;
  transition: color var(--t-fast), background var(--t-fast);
  border-radius: var(--r-sm);
}
.field-placeholder.field-placeholder-editable:hover {
  color: var(--text);
  background: rgba(129, 140, 248, 0.08);
}
.field-value-preview {
  position: absolute;
  inset: 22px 4px 4px 4px;
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
  pointer-events: none;
  padding: 0 6px;
  background: rgba(129, 140, 248, 0.04);
  border-radius: var(--r-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.field-edit-input {
  position: absolute;
  inset: 22px 4px 4px 4px;
  width: calc(100% - 8px);
  font-size: 12px;
  padding: 4px 6px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  color: var(--text);
  outline: none;
  z-index: 5;
  font-family: var(--font-sans);
}
.field-resize-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border: 2px solid var(--bg);
  border-radius: 50%;
  bottom: -6px;
  right: -6px;
  cursor: nwse-resize;
  z-index: 13;
}

/* ── Signature Library ── */
.signature-save-toggle {
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.sig-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}
.sig-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
.sig-library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  padding: 8px;
  max-height: 280px;
  overflow-y: auto;
}
.sig-library-item {
  position: relative;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px;
  cursor: pointer;
  transition: all var(--t-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
}
.sig-library-item:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.sig-library-item img,
.sig-library-item svg {
  max-width: 100%;
  max-height: 60px;
  object-fit: contain;
}
.sig-library-item .sig-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--t-fast);
}
.sig-library-item:hover .sig-delete {
  opacity: 1;
}
.sig-library-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-secondary);
}
.sig-library-empty p {
  margin: 4px 0;
  font-size: 14px;
}
.sig-library-empty .dim {
  .share-step-done .share-step-num {
    background: var(--success);
  }

  /* ═══════════════════════════════════════════════════════════════════
     ═══════════════════════════════════════════════════════════════════ */
.signer-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100%;
}
.signer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.signer-progress {
  flex: 1;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#signerProgressText {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}
.progress-bar {
  height: 4px;
  background: var(--surface);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width var(--t-med) var(--ease);
}
.signer-canvas-area {
  flex: 1;
  overflow: auto;
  background: #08090c;
  padding: 24px;
  position: relative;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

/* ── Signer Zoom Controls (same visual as builder) ── */
.signer-zoom {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 2px;
  flex-shrink: 0;
}
.signer-zoom .zoom-slider { width: 70px; }
@media (max-width: 640px) {
  .signer-zoom .zoom-slider { display: none; }
  .signer-zoom .zoom-level { display: none; }
}

/* ── Signer Fields (interactive) ── */
.signer-field {
  position: absolute;
  border: 2px solid var(--accent);
  border-radius: 6px;
  background: var(--accent-soft);
  cursor: pointer;
  z-index: 10;
  transition: border-color var(--t-fast), background var(--t-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}
.signer-field:hover {
  border-color: var(--accent-hover);
  background: rgba(129, 140, 248, 0.2);
}
.signer-field.signer-field-completed {
  border-color: var(--success);
  background: var(--success-soft);
}
.signer-field.signer-field-completed:hover {
  border-color: #2dd49e;
}
.signer-field-text {
  color: var(--text);
  padding: 4px 8px;
  font-size: 13px;
}
.signer-field-placeholder {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.signer-field.signer-field-completed .signer-field-placeholder { display: none; }

/* When the inline text input is open over a text field, we hide the
   underlying field's content so the user doesn't see two copies of the
   text (the original value + their typing echo). The field still takes
   up its space so the layout doesn't shift when the input is dismissed. */
.signer-field.signer-field-occluded {
  visibility: hidden;
  pointer-events: none;
}

/* ── Signer: PDF load prompt ── */
.signer-load-pdf {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  max-width: 480px;
  margin: 80px auto;
  gap: 16px;
}
.signer-load-icon {
  color: var(--l-emerald);
  margin-bottom: 8px;
}
.signer-load-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.signer-load-sub {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}
.signer-load-sub strong {
  color: var(--text);
  font-weight: 600;
}
.signer-load-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}
.signer-load-pdf .btn-xl {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ── Beacon ── */
.beacon {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: transform var(--t-med) var(--ease);
}
.beacon:hover { transform: translateX(-50%) translateY(-2px); }
.beacon-pulse {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  .share-step-done .share-step-num {
    background: var(--success);
  }

  /* ═══════════════════════════════════════════════════════════════════
     ═══════════════════════════════════════════════════════════════════ */
.success-container {
  min-height: calc(100vh - var(--topbar-h));
  min-height: calc(100dvh - var(--topbar-h));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
}
.success-icon {
  color: var(--success);
  margin-bottom: 24px;
  animation: scaleIn var(--t-slow) var(--ease);
}
@keyframes scaleIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.success-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.success-sub {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 400px;
  margin-bottom: 32px;
}
.success-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.link-box {
  display: flex;
  gap: 8px;
  max-width: 520px;
  width: 100%;
  margin-bottom: 32px;
}
.link-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text);
}
.link-input:focus { border-color: var(--border-focus); }

/* ── Share Steps ── */
.share-step {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  max-width: 540px;
  width: 100%;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 16px;
  text-align: left;
}
.share-step-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  font-family: var(--font-sans);
}
.share-step-body {
  flex: 1;
  min-width: 0;
}
.share-step-title {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px 0;
}
.share-step-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 12px 0;
}
.share-step .link-box {
  margin-bottom: 0;
}
.btn-share-pdf {
  width: 100%;
  justify-content: center;
}
.btn-copy-msg {
  width: 100%;
  justify-content: center;
}
.share-message-box {
  margin-bottom: 12px;
}
.share-message-text {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-family: var(--font-sans);
  color: var(--text);
  line-height: 1.6;
  resize: none;
  cursor: text;
}
.share-message-text:focus {
  outline: none;
  border-color: var(--border-focus);
}
.share-step-done {
  opacity: 0.5;
  pointer-events: none;
}
.share-step-done .share-step-num {
  background: var(--success);
}

/* ═══════════════════════════════════════════════════════════════════
   ═══════════════════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════════════════
   PWA INSTALL BANNER
   ═══════════════════════════════════════════════════════════════════ */
.pwa-install-banner {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  width: calc(100% - 32px);
  max-width: 440px;
  animation: pwaSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes pwaSlideUp {
  from { transform: translateX(-50%) translateY(100px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}
.pwa-install-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(42, 75, 124, 0.15);
  position: relative;
}
.pwa-install-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 10px;
  flex-shrink: 0;
}
.pwa-install-text {
  flex: 1;
  min-width: 0;
}
.pwa-install-text strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.pwa-install-text span {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.3;
}
.pwa-install-btn {
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 150ms;
}
.pwa-install-btn:hover {
  background: var(--accent-hover);
}
.pwa-install-dismiss {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: 6px;
  transition: color 150ms, background 150ms;
  cursor: pointer;
}
.pwa-install-dismiss:hover {
  color: var(--text);
  background: var(--surface);
}


.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
  animation: fadeIn var(--t-fast) var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn var(--t-med) var(--ease);
}
.modal-sm { max-width: 440px; }
@keyframes modalIn {
  from { transform: translateY(16px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.modal-close {
  padding: 6px;
  color: var(--text-muted);
  border-radius: var(--r-sm);
  transition: color var(--t-fast), background var(--t-fast);
}
.modal-close:hover { color: var(--text); background: var(--surface); }

/* ── Signature Modal ── */
.signature-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 24px 0;
}
.sig-tab {
  flex: 1;
  padding: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.sig-tab:hover { color: var(--text); }
.sig-tab-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.signature-content { padding: 24px; }
.sig-panel { display: none; }
.sig-panel-active { display: block; animation: fadeIn var(--t-med) var(--ease); }

/* Draw panel */
.sig-landscape-hint {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  margin-bottom: 10px;
  background: var(--accent-soft);
  border-radius: var(--r-sm);
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
}
/* Show landscape hint only on portrait phones */
@media (max-width: 600px) and (orientation: portrait) {
  .sig-landscape-hint { display: flex; }
}
/* In landscape, give more drawing space */
@media (max-width: 900px) and (orientation: landscape) {
  #sigSvg, .sig-svg { height: 160px; }
  .modal { max-height: 100dvh; }
}
.sig-canvas-wrap {
  position: relative;
  background: #fff;
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: 16px;
}
#sigSvg, .sig-svg {
  display: block;
  width: 100%;
  height: 200px;
  cursor: crosshair;
  touch-action: none;
  background: #fff;
  border-radius: var(--r-md);
}
.sig-canvas-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #999;
  font-size: 13px;
  pointer-events: none;
  transition: opacity var(--t-fast);
}

/* Draw actions: clear + save buttons */
.sig-draw-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}

/* Save to library toggle */
.sig-save-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 12px;
  cursor: pointer;
}
.sig-save-toggle input[type="checkbox"] {
  accent-color: var(--accent);
}

/* Type panel */
.sig-type-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 15px;
  margin-bottom: 16px;
}
.sig-type-input:focus { border-color: var(--border-focus); }
.font-picker {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.font-option {
  flex: 1;
  padding: 12px;
  font-size: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.font-option:hover { background: var(--surface-hover); }
.font-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.sig-preview {
  background: #fff;
  border-radius: var(--r-md);
  padding: 20px;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.sig-preview-text {
  color: #1a1a2e;
  font-size: 36px;
  line-height: 1;
}

/* Upload panel */
.sig-upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-md);
  padding: 36px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t-med), background var(--t-med);
}
.sig-upload-zone:hover, .sig-upload-zone:focus-visible {
  border-color: var(--accent);
  background: var(--accent-smooth);
}
.sig-upload-zone svg { color: var(--text-muted); margin: 0 auto 12px; }
.sig-upload-zone p { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.sig-upload-zone span { font-size: 12px; color: var(--text-muted); }
.sig-upload-preview {
  text-align: center;
  margin-bottom: 16px;
}
.sig-upload-preview img {
  max-height: 120px;
  margin: 0 auto 12px;
  border-radius: var(--r-sm);
  background: #fff;
  padding: 12px;
}
.sig-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Consent Modal ── */
.consent-body { padding: 24px; }
.consent-body p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}
.consent-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}
.consent-toggle input { display: none; }
.toggle-track {
  flex-shrink: 0;
  width: 40px;
  height: 22px;
  background: var(--surface-active);
  border-radius: 999px;
  position: relative;
  transition: background var(--t-fast);
  margin-top: 1px;
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast);
}
.consent-toggle input:checked + .toggle-track {
  background: var(--accent);
}
.consent-toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(18px);
  background: #fff;
}
.consent-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.consent-actions {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  .share-step-done .share-step-num {
    background: var(--success);
  }

  /* ═══════════════════════════════════════════════════════════════════
     MODALS
     ═══════════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  pointer-events: auto;
  animation: toastIn var(--t-med) var(--ease);
  max-width: 360px;
}
@keyframes toastIn {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.toast.toast-out { animation: toastOut var(--t-med) var(--ease) forwards; }
@keyframes toastOut {
  to { transform: translateY(16px); opacity: 0; }
}
.toast-success { border-color: var(--success); }
.toast-success svg { color: var(--success); }
.toast-error { border-color: var(--danger); }
.toast-error svg { color: var(--danger); }

/* ═════════════════════════════════ auto══════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 860px) {
  .topbar-nav .nav-link { display: none; }
  .topbar-nav .nav-cta { display: none; }
  .topbar-menu-btn { display: block; }
  .steps-grid { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; max-width: 360px; }
  .footer-inner { flex-direction: column; }
}

@media (max-width: 640px) {
  .topbar-inner { padding: 0 16px; }
  .home-hero { padding: 24px 16px; }
  .dropzone { padding: 32px 20px; }
  .how-section, .pricing-section { padding: 60px 16px; }
  .builder-toolbar { padding: 8px 10px; flex-wrap: wrap; gap: 8px; }
  .builder-back { font-size: 12px; padding: 6px 8px; }
  .builder-back svg { width: 14px; height: 14px; }
  .builder-tools { flex: 1 1 100%; justify-content: center; order: 2; }
  .tool-btn { padding: 7px 12px; font-size: 12px; }
  .tool-btn span { font-size: 11px; }
  .builder-zoom { order: 3; }
  .btn-generate { order: 4; font-size: 13px; padding: 8px 14px; }
  .signer-header { padding: 10px 12px; }
  .signer-progress { max-width: 200px; }
  .builder-canvas-area, .signer-canvas-area { padding: 12px; }
  .modal { border-radius: var(--r-md); }
  .modal-header { padding: 16px; }
  .signature-content { padding: 16px; }
  .font-picker { flex-direction: column; }
  .beacon { bottom: 16px; font-size: 12px; padding: 8px 16px; }
  .link-box { flex-direction: column; }
  .page-actions { opacity: 1; } /* Always visible on touch */
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .beacon-pulse { animation: none; }
  .home-hero::before { display: none; }
}

/* ── Loading spinner ── */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Builder loading state ── */
.builder-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px;
  color: var(--text-muted);
}

/* ── Text field input overlay (signer) ── */
.text-input-overlay {
  position: absolute;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 6px;
  z-index: 20;
  padding: 4px;
}
.text-input-overlay input {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  padding: 4px 8px;
  font-size: 13px;
  color: var(--text);
  border-radius: 4px;
}


/* ═══════════════════════════════════════════════════════════════════
   TEXT FIELD STYLING (size, bold, color)
   Applied via the floating field-props-panel when a text/date field is
   selected. The overlay itself uses --field-color as a CSS var; pdf-utils
   reads the same color/bold/fontSize when burning the field into the PDF.
   ═══════════════════════════════════════════════════════════════════ */

/* Live preview in the overlay: text/date fields show their color + bold. */
.field-overlay.field-text,
.field-overlay.field-date {
  --field-color: #0f172a;
  color: var(--field-color);
  border-color: color-mix(in srgb, var(--field-color) 60%, transparent);
  background: color-mix(in srgb, var(--field-color) 7%, transparent);
}
.field-overlay.field-text .field-value-preview,
.field-overlay.field-date .field-value-preview,
.field-overlay.field-text .field-placeholder,
.field-overlay.field-date .field-placeholder {
  color: var(--field-color);
}
.field-overlay.field-bold .field-value-preview,
.field-overlay.field-bold .field-placeholder {
  font-weight: 700;
}
.field-overlay.field-text .field-label .field-label-type,
.field-overlay.field-date .field-label .field-label-type {
  color: var(--field-color);
  background: color-mix(in srgb, var(--field-color) 8%, var(--surface));
}

/* Selected field: stronger ring + raise the resize handle above the toolbar. */
.field-overlay.field-selected {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--field-color, var(--accent)) 25%, transparent);
  z-index: 30;
}
.field-overlay.field-selected .field-resize-handle {
  background: var(--field-color, var(--accent));
  transform: scale(1.2);
}

/* ═══════════════════════════════════════════════════════════════════
   FLOATING FIELD PROPERTIES PANEL
   Appears above the selected text/date field with size / bold / color.
   Positioned by JS (fixed coords); we just style the contents.
   ═══════════════════════════════════════════════════════════════════ */
.field-props-panel {
  position: fixed;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 6px;
  background: #1a1d24;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.2);
  font-size: 12px;
  color: var(--text);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  /* Animate in on first show */
  animation: props-panel-in 140ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes props-panel-in {
  from { opacity: 0; transform: translateY(4px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.field-props-panel .props-section {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
}
.field-props-panel .props-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.10);
}
.field-props-panel .props-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 2px;
}

/* Size stepper (with - button, select, + button) */
.field-props-panel .size-stepper {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 1px;
}
.field-props-panel .stepper-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast);
}
.field-props-panel .stepper-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.field-props-panel .size-select {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-sans);
  padding: 0 4px;
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  text-align: center;
  min-width: 50px;
}
.field-props-panel .size-select:focus { color: var(--text); }
.field-props-panel .size-select option {
  background: #1a1d24;
  color: var(--text);
}

/* Bold toggle (B button) */
.field-props-panel .props-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: all var(--t-fast);
  font-family: var(--font-serif);
}
.field-props-panel .props-toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.field-props-panel .props-toggle.is-active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

/* Color swatches */
.field-props-panel .color-swatches {
  display: flex;
  align-items: center;
  gap: 4px;
}
.field-props-panel .swatch {
  position: relative;
  width: 22px;
  height: 22px;
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--t-fast), border-color var(--t-fast);
}
.field-props-panel .swatch:hover { transform: scale(1.12); }
.field-props-panel .swatch .swatch-dot {
  width: 14px;
  height: 14px;
  background: var(--swatch);
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.20), inset 0 1px 1px rgba(255, 255, 255, 0.15);
}
.field-props-panel .swatch.is-active {
  border-color: var(--swatch);
  transform: scale(1.1);
}
.field-props-panel .swatch.is-active::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 1.5px solid var(--swatch);
  border-radius: 50%;
  opacity: 0.4;
}

/* Custom font size input that appears when the user picks "Other…" from
   the size dropdown. Replaces the dropdown with a free numeric input so
   there's no upper cap on the size — they can go 96, 128, 200, whatever. */
.field-props-panel .size-custom {
  display: inline-flex;
  align-items: center;
  width: 56px;
  padding: 0 4px;
  background: transparent;
  border: 1px solid rgba(129, 140, 248, 0.4);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}
.field-props-panel .size-custom::-webkit-outer-spin-button,
.field-props-panel .size-custom::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.field-props-panel .size-custom:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

/* Tiny attention-grabber: when the panel first appears for a freshly-created
   field, give it a 2-beat pulse so the user notices it's there. Otherwise
   panels feel like "they sometimes don't show up." */
@keyframes props-panel-pulse {
  0%   { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.2); }
  20%  { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 0   rgba(99, 102, 241, 0.0), 0 0 0 4px rgba(99, 102, 241, 0.35); }
  60%  { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 0   rgba(99, 102, 241, 0.0), 0 0 0 4px rgba(99, 102, 241, 0.35); }
  100% { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.2); }
}
.field-props-panel.is-fresh {
  animation: props-panel-in 140ms cubic-bezier(0.16, 1, 0.3, 1),
             props-panel-pulse 1200ms ease-out 200ms 1;
}
@media (prefers-reduced-motion: reduce) {
  .field-props-panel.is-fresh { animation: props-panel-in 140ms ease-out; }
}

/* Responsive: shrink on small screens */
@media (max-width: 640px) {
  .field-props-panel {
    flex-wrap: wrap;
    max-width: calc(100vw - 24px);
    padding: 4px;
  }
  .field-props-panel .props-section { padding: 2px 6px; }
}


/* ═══════════════════════════════════════════════════════════════════
   EXPORT PDF BUTTON (builder toolbar, free action)
   Secondary button next to Generate Link.
   ═══════════════════════════════════════════════════════════════════ */
.builder-tools-export {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(129, 140, 248, 0.10);
  color: var(--text);
  border: 1px solid rgba(129, 140, 248, 0.30);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.builder-tools-export:hover {
  background: rgba(129, 140, 248, 0.18);
  border-color: var(--accent);
}
.builder-tools-export:active { transform: scale(0.97); }
.builder-tools-export:disabled {
  background: var(--surface-active);
  color: var(--text-dim);
  border-color: var(--border);
  cursor: not-allowed;
  transform: none;
}


/* ═══════════════════════════════════════════════════════════════════
   TOPBAR AUTH STATE
   Shown in the topbar. Signed-out: "Sign in" link. Signed-in: Pro badge +
   email + sign-out button.
   ═══════════════════════════════════════════════════════════════════ */
.topbar-auth-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-signin {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.topbar-signin:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface);
}
.topbar-pro-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: linear-gradient(135deg, #818cf8, #6366f1);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 4px;
}
.topbar-user {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-signout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast);
}
.topbar-signout:hover {
  color: var(--text);
  background: var(--surface);
}


/* ═══════════════════════════════════════════════════════════════════
   PAYWALL MODAL
   Shown when logged-out users try to Generate Link, or click Sign in.
   Light-themed to match the landing page palette; uses the same design
   tokens as the rest of the app for buttons.
   ═══════════════════════════════════════════════════════════════════ */
.paywall-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms cubic-bezier(0.16, 1, 0.3, 1);
}
.paywall-modal.paywall-open {
  opacity: 1;
  pointer-events: auto;
}
.paywall-card {
  position: relative;
  background: #ffffff;
  color: #0f172a;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.4), 0 0 0 1px rgba(15, 23, 42, 0.06);
  transform: translateY(16px) scale(0.98);
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.paywall-modal.paywall-open .paywall-card {
  transform: translateY(0) scale(1);
}
.paywall-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: #64748b;
  border-radius: 8px;
  cursor: pointer;
  z-index: 1;
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.paywall-close:hover {
  color: #0f172a;
  background: #f1f5f9;
  border-color: #e2e8f0;
}
.paywall-body {
  padding: 32px 32px 28px;
  font-family: var(--font-sans);
}
.paywall-head { margin-bottom: 24px; }
.paywall-title {
  font-family: var(--font-serif);
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 400;
  color: #0f172a;
  margin: 0 0 8px;
}
.paywall-sub {
  font-size: 14px;
  line-height: 1.55;
  color: #475569;
  margin: 0;
}
.paywall-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}
.paywall-col {
  padding: 16px 18px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}
.paywall-col.paywall-pro {
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 70%);
  border-color: #86efac;
}
.paywall-col-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0f172a;
  margin-bottom: 10px;
}
.paywall-col.paywall-pro .paywall-col-label { color: #166534; }
.paywall-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.paywall-col li {
  font-size: 13px;
  line-height: 1.45;
  color: #334155;
  padding-left: 16px;
  position: relative;
}
.paywall-col li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 0;
  font-size: 12px;
  color: #16a34a;
  font-weight: 700;
}
.paywall-col.paywall-free li::before { color: #64748b; }

.paywall-cta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.paywall-cta .btn-primary {
  justify-content: center;
  background: var(--accent);
  color: #fff;
}
.paywall-cta .btn-ghost {
  justify-content: center;
  color: #475569;
}
.paywall-cta .btn-ghost:hover {
  color: #0f172a;
  background: #f1f5f9;
}
.paywall-foot {
  font-size: 11px;
  line-height: 1.5;
  color: #94a3b8;
  text-align: center;
  margin: 0 0 16px;
}
.paywall-fallback {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: #475569;
}
.paywall-fallback svg { color: #64748b; flex-shrink: 0; }
.paywall-link-inline {
  color: #0e7c66;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.paywall-link-inline:hover { color: #0a5a4b; }

/* Body lock when modal is open */
body.paywall-locked { overflow: hidden; }

@media (max-width: 540px) {
  .paywall-card { max-width: 100%; }
  .paywall-body { padding: 24px 20px 20px; }
  .paywall-title { font-size: 24px; }
  .paywall-compare { grid-template-columns: 1fr; }
  .paywall-col ul { gap: 4px; }
  .paywall-col li { font-size: 12px; }
}


/* ═══════════════════════════════════════════════════════════════════
   HOW TAG (Free / Pro pill next to section titles)
   ═══════════════════════════════════════════════════════════════════ */
.how-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #166534;
  background: #dcfce7;
  border-radius: 9999px;
  vertical-align: middle;
}
.how-tag-pro {
  color: #6b46c1;
  background: #ede9fe;
}


/* ═══════════════════════════════════════════════════════════════════
   PRICING GRID (two-card layout: free + pro)
   ═══════════════════════════════════════════════════════════════════ */
.pricing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 880px;
  margin: 0 auto 60px;
}
.price-card {
  position: relative;
  padding: 32px 28px;
  background: #ffffff;
  border: 1px solid #e3decd;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
}
.price-card .price-header { margin-bottom: 24px; }
.price-card .price-eyebrow-free {
  color: #166534;
  background: #dcfce7;
  padding: 4px 10px;
  border-radius: 9999px;
  display: inline-block;
  margin-bottom: 16px;
}
.price-card .price-features { margin-bottom: 24px; flex: 1; }
.price-card .btn-ghost { width: 100%; justify-content: center; }
.price-card-big { /* existing styles, now in grid context */ }
.price-eyebrow-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.price-pro-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: linear-gradient(135deg, #818cf8, #6b46c1);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 9999px;
}

@media (max-width: 720px) {
  .pricing-grid { grid-template-columns: 1fr; max-width: 420px; }
}
