:root {
  --bg: #0b111e;
  --surface: #121b2e;
  --surface-2: #18253d;
  --border: #263859;
  --border-strong: #37507d;
  --text: #eef2ff;
  --muted: #98a7c7;
  --accent: #38bdf8;
  --accent-strong: #0284c7;
  --gold-1: #f59e0b;
  --gold-2: #fbbf24;
  --good: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: radial-gradient(circle at top right, rgba(56, 189, 248, 0.08), transparent 42%), var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: rgba(56, 189, 248, 0.12);
  color: #bae6fd;
  padding: 1px 5px;
  border-radius: 5px;
}

.hidden {
  display: none !important;
}

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.back-link {
  display: inline-block;
  font-size: 0.76rem;
  color: var(--muted);
  margin-bottom: 4px;
}

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

.brand h1 {
  margin: 0;
  font-size: 1.3rem;
  letter-spacing: -0.015em;
}

.brand p {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.proposal-switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 6px;
  max-width: 100%;
}

select,
input[type="text"],
textarea {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.86rem;
  font-family: inherit;
  width: 100%;
  max-width: 100%;
}

.proposal-switcher select {
  border: 0;
  padding: 5px 6px;
  font-weight: 600;
  width: auto;
  max-width: 220px;
  min-width: 0;
  cursor: pointer;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(56, 189, 248, 0.45);
  outline-offset: 1px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: border-color 0.15s ease, filter 0.15s ease, background 0.15s ease;
}

.btn:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #031524;
  border-color: var(--accent);
}

.btn-primary:hover {
  filter: brightness(1.06);
  color: #031524;
}

.btn-pro {
  background: linear-gradient(135deg, var(--gold-1), var(--gold-2));
  color: #1c1002;
  border: 1px solid rgba(251, 191, 36, 0.65);
  font-weight: 700;
}

.btn-pro:hover {
  filter: brightness(1.06);
  border-color: var(--gold-2);
  color: #1c1002;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.1);
  border-color: transparent;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.btn-danger:hover {
  border-color: var(--bad);
  background: rgba(239, 68, 68, 0.24);
}

.btn-sm {
  padding: 5px 9px;
  font-size: 0.78rem;
}

.quota-tag {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
}

.quota-tag.pro-active {
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
}

.action-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
}

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

.mode-tabs {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  gap: 3px;
}

.mode-tab,
.theme-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 6px;
  cursor: pointer;
}

.mode-tab.active,
.theme-tab.active {
  background: rgba(56, 189, 248, 0.18);
  color: #e0f2fe;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);
  gap: 16px;
  align-items: start;
}

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

/* HEATMAP */
.heatmap-panel {
  margin-bottom: 14px;
}

.heatmap-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.muted-inline {
  font-size: 0.78rem;
  color: var(--muted);
  margin-left: 8px;
}

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

.dwell-summary-line {
  font-size: 0.8rem;
  color: #bae6fd;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  margin-bottom: 10px;
  word-break: break-word;
}

.dwell-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.dwell-chip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 9px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.dwell-chip.active {
  border-color: var(--accent);
}

.dwell-chip-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  margin-bottom: 5px;
  gap: 6px;
}

.dwell-chip-title {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dwell-chip-sec {
  font-weight: 700;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.dwell-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  overflow: hidden;
}

.dwell-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #f59e0b);
  transition: width 0.25s ease;
}

/* READER FRAME */
.reader-frame-wrap {
  display: flex;
  justify-content: center;
}

.reader-frame-wrap.viewport-mobile .reader-shell {
  width: 375px;
  max-width: 100%;
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.reader-frame-wrap.viewport-desktop .reader-shell {
  width: 100%;
}

.reader-shell {
  --deck-accent: #38bdf8;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 560px;
  position: relative;
  outline: none;
}

.reader-shell.theme-dark {
  background: #0e1627;
  color: #f1f5f9;
}

.reader-shell.theme-light {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}

.reader-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 0.82rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.reader-brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--deck-accent);
}

.reader-page-counter {
  font-size: 0.78rem;
  opacity: 0.75;
  font-weight: 600;
}

.reader-progress-track {
  height: 4px;
  background: rgba(148, 163, 184, 0.18);
}

.reader-progress-fill {
  height: 100%;
  background: var(--deck-accent);
  transition: width 0.2s ease;
}

.reader-watermark {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
  padding: 4px 10px;
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  font-weight: 700;
}

.reader-slide-stage {
  flex: 1;
  padding: 26px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.slide-kicker {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--deck-accent);
}

.slide-heading {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.slide-summary {
  margin: 0;
  font-size: 0.94rem;
  opacity: 0.82;
}

.slide-bullets {
  margin: 4px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  font-size: 0.92rem;
}

.slide-pricing-grid {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.pricing-row-card {
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-left: 4px solid var(--deck-accent);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pricing-row-name {
  font-weight: 700;
  font-size: 0.92rem;
}

.pricing-row-note {
  font-size: 0.78rem;
  opacity: 0.72;
}

.pricing-row-price {
  font-weight: 800;
  font-size: 0.96rem;
  color: var(--deck-accent);
  white-space: nowrap;
}

.slide-image-wrap {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.slide-image-wrap img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: contain;
  background: #050914;
}

.slide-pdf-wrap {
  width: 100%;
  height: 380px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.24);
}

.slide-pdf-wrap object {
  width: 100%;
  height: 100%;
  display: block;
}

.reader-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.reader-dots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.reader-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  border: 0;
  background: rgba(148, 163, 184, 0.35);
  cursor: pointer;
  padding: 0;
}

.reader-dot.active {
  background: var(--deck-accent);
  width: 22px;
}

.sticky-cta-bar {
  padding: 12px 16px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reader-shell.theme-light .sticky-cta-bar {
  background: #f8fafc;
  color: #0f172a;
}

.sticky-cta-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  font-size: 0.8rem;
}

.sticky-cta-meta span {
  opacity: 0.72;
}

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

.cta-primary {
  flex: 1;
  min-width: 150px;
  text-align: center;
  padding: 10px 14px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 0.88rem;
  background: var(--deck-accent);
  color: #031524;
  text-decoration: none;
}

.cta-primary:hover {
  filter: brightness(1.06);
  text-decoration: none;
}

.cta-secondary {
  padding: 10px 14px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 0.84rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: inherit;
  text-decoration: none;
  text-align: center;
}

.cta-secondary:hover {
  border-color: var(--deck-accent);
  text-decoration: none;
}

.powered-badge {
  font-size: 0.72rem;
  text-align: center;
  opacity: 0.6;
}

/* BUILDER */
.builder-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 4px;
  margin-bottom: 14px;
}

.builder-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 7px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.builder-tab.active {
  background: rgba(56, 189, 248, 0.18);
  color: #e0f2fe;
}

.field {
  margin-bottom: 11px;
}

.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}

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

.color-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.color-row input[type="color"] {
  width: 38px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  padding: 2px;
  cursor: pointer;
}

.pro-chip {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  margin-left: 4px;
}

.divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

.subhead {
  margin: 0 0 10px;
  font-size: 0.9rem;
}

.url-error {
  margin-top: 5px;
  font-size: 0.78rem;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 6px;
  padding: 6px 8px;
}

.slide-selector-row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  align-items: center;
}

.slide-selector-row select {
  flex: 1;
}

.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  background: rgba(11, 17, 30, 0.55);
  margin-bottom: 12px;
}

.dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.1);
}

.dropzone p {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 6px 0 10px;
}

.pdf-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.muted-note {
  display: block;
  margin-top: 8px;
  font-size: 0.76rem;
  color: #bae6fd;
}

/* UPSELL & FOOTER */
.upsell-bar {
  margin-top: 18px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(18, 27, 46, 0.96));
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.upsell-bar p {
  margin: 3px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.footer {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

/* MODAL */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.74);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  width: 100%;
  max-width: 500px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 92vh;
  overflow-y: auto;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-head h3 {
  margin: 0;
  font-size: 1.08rem;
}

.plan-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.plan-box.plan-featured {
  border-color: rgba(245, 158, 11, 0.55);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.1), var(--bg));
}

.plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.plan-head h4 {
  margin: 0;
  font-size: 0.94rem;
}

.badge-pro {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.2);
  color: #fde68a;
}

.plan-desc {
  margin: 6px 0 10px;
  font-size: 0.82rem;
  color: var(--muted);
}

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

.plan-actions .btn {
  width: 100%;
}

.pay-methods-note {
  margin: 7px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
}

.unlock-row {
  display: flex;
  gap: 8px;
}

.toast {
  position: fixed;
  bottom: 18px;
  right: 18px;
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 200;
}

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

@media (max-width: 920px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
}
