:root {
  --text: #111827;
  --muted: #6b7280;
  --soft: #9ca3af;
  --line: #f3f4f6;
  --input-line: #e5e7eb;
  --bg: #fafafa;
  --white: #ffffff;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  min-height: 100vh;
}

.builder-layout {
  display: grid;
  grid-template-columns: minmax(360px, 40%) minmax(0, 60%);
  min-height: 100vh;
}

.builder-pane {
  padding: 38px 42px 48px;
  background: var(--white);
  border-right: 1px solid var(--line);
}

.preview-pane {
  padding: 42px 56px;
}

.preview-sticky {
  position: sticky;
  top: 42px;
}

.product-head {
  margin-bottom: 34px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.topbar .eyebrow {
  margin-bottom: 0;
}

.language-select {
  width: auto;
  min-width: 132px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--soft);
  font-size: 12px;
  font-weight: 600;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 360px;
  color: var(--text);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: 0;
}

.invoice-form {
  display: grid;
  gap: 0;
}

.form-section {
  padding: 28px 0;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 16px;
}

.section-head {
  margin-bottom: 2px;
}

.section-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

h2 {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 540;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--input-line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  background: var(--white);
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #c7cdd8;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.05);
}

.split-fields,
.item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.items-list {
  display: grid;
  gap: 14px;
}

.text-button {
  min-height: auto;
  border: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
}

.submit-area {
  padding-top: 28px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 14px;
}

#generateButton {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--text);
  color: var(--white);
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
}

#generateButton:disabled {
  cursor: wait;
  opacity: 0.72;
}

.status-line {
  min-height: 20px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.status-line a {
  color: var(--text);
  font-weight: 650;
}

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

.paywall-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 24, 39, 0.42);
  backdrop-filter: blur(8px);
}

.paywall-backdrop[hidden] {
  display: none;
}

.paywall-dialog {
  width: min(430px, 100%);
  padding: 28px;
  border-radius: 12px;
  background: var(--white);
  box-shadow: 0 24px 80px rgba(17, 24, 39, 0.22);
}

.paywall-dialog h2 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 22px;
  font-weight: 720;
  line-height: 1.18;
}

.paywall-dialog p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.paywall-dialog ul {
  margin: 22px 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 11px;
}

.paywall-dialog li {
  color: var(--text);
  font-size: 14px;
  font-weight: 540;
}

.paywall-dialog li::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--text);
  vertical-align: 2px;
}

.plan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 22px 0 12px;
}

.plan-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--input-line);
  border-radius: 8px;
  cursor: pointer;
}

.plan-option span {
  display: grid;
  gap: 3px;
}

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

.plan-option small,
.annual-option {
  color: var(--muted);
  font-size: 12px;
}

.annual-option {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 4px;
}

.paywall-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 20px 0 22px;
  border-top: 1px solid var(--line);
}

.paywall-price strong {
  color: var(--text);
  font-size: 36px;
  font-weight: 780;
  line-height: 1;
}

.paywall-price span {
  color: var(--muted);
  font-size: 14px;
}

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

.paywall-actions button {
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
}

#upgradeNowButton {
  border: 0;
  background: var(--text);
  color: var(--white);
}

#maybeLaterButton {
  border: 1px solid var(--input-line);
  background: var(--white);
  color: var(--text);
}

.paywall-actions button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.paywall-status {
  min-height: 18px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.invoice-preview {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 54px 58px 44px;
  background: var(--white);
  color: var(--text);
}

.preview-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 68px;
  padding-bottom: 52px;
}

.preview-header strong {
  display: block;
  margin-bottom: 14px;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.preview-header p {
  max-width: 270px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

.preview-meta {
  margin: 0;
  display: grid;
  gap: 12px;
}

.preview-meta div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 24px;
}

.preview-meta dt {
  color: var(--soft);
  font-size: 11px;
  font-weight: 520;
}

.preview-meta dd {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 560;
  text-align: right;
}

.preview-title {
  padding-bottom: 38px;
  border-bottom: 1px solid var(--line);
}

.preview-title h2 {
  margin-bottom: 22px;
  color: var(--text);
  font-size: 48px;
  font-weight: 720;
  line-height: 1;
}

.preview-title p {
  margin-bottom: 8px;
  color: var(--soft);
  font-size: 11px;
  font-weight: 520;
}

.preview-title strong {
  display: block;
  color: var(--text);
  font-size: 38px;
  font-weight: 780;
  line-height: 1.05;
}

.preview-bill {
  padding: 38px 0 42px;
  border-bottom: 1px solid var(--line);
}

.preview-label {
  margin-bottom: 12px;
  color: var(--soft);
  font-size: 11px;
  font-weight: 520;
}

.preview-bill strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.preview-bill span {
  color: var(--muted);
  font-size: 13px;
}

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

.preview-table th {
  padding: 17px 0 13px;
  border-bottom: 1px solid var(--line);
  color: var(--soft);
  font-size: 11px;
  font-weight: 520;
  text-align: left;
}

.preview-table th:nth-child(2),
.preview-table td:nth-child(2) {
  width: 80px;
  color: var(--muted);
}

.preview-table th:last-child,
.preview-table td:last-child {
  width: 170px;
  text-align: right;
}

.preview-table td {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
  vertical-align: top;
}

.preview-footer {
  margin-top: 34px;
}

.preview-totals {
  width: 328px;
  margin-left: auto;
  display: grid;
  gap: 14px;
}

.preview-totals div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 28px;
  color: var(--muted);
  font-size: 13px;
}

.preview-totals strong {
  color: var(--text);
  font-weight: 560;
}

.preview-totals .preview-total {
  margin-top: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--text);
  font-size: 16px;
  font-weight: 660;
}

.preview-total strong {
  font-size: 30px;
  font-weight: 780;
  line-height: 1;
}

.preview-footer p {
  margin-top: 72px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

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

.success-panel {
  width: min(520px, 100%);
  padding: 28px;
  background: var(--white);
  display: grid;
  gap: 18px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--text);
  color: var(--white);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
}

.result-box {
  min-height: 76px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  display: grid;
  align-content: center;
  gap: 6px;
}

.result-box.success {
  color: var(--text);
}

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

.result-box strong {
  color: var(--text);
}

.text-link {
  color: var(--text);
  font-weight: 650;
}

.seo-page {
  min-height: 100vh;
  background: var(--white);
}

.seo-hero {
  width: min(980px, calc(100% - 48px));
  margin: 0 auto;
  padding: 86px 0 58px;
}

.seo-eyebrow {
  margin-bottom: 14px;
  color: var(--soft);
  font-size: 12px;
  font-weight: 650;
}

.seo-hero h1 {
  max-width: 760px;
  margin-bottom: 18px;
  color: var(--text);
  font-size: 52px;
  font-weight: 760;
  line-height: 1.02;
}

.seo-hero p {
  max-width: 720px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.seo-cta {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  margin-top: 28px;
  padding: 0 18px;
  border-radius: 8px;
  background: var(--text);
  color: var(--white);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.seo-content,
.seo-faq {
  width: min(980px, calc(100% - 48px));
  margin: 0 auto 60px;
  padding-top: 34px;
  border-top: 1px solid var(--line);
}

.seo-content h2,
.seo-faq h2 {
  margin: 0 0 18px;
  color: var(--text);
  font-size: 18px;
  font-weight: 720;
}

.seo-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
}

.seo-features article h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 680;
}

.seo-features article p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.seo-links {
  margin-top: 36px;
}

.seo-links nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.seo-links a {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.seo-tool {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto 80px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.seo-tool-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.seo-tool-head span {
  color: var(--soft);
  font-size: 12px;
}

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

.seo-tool iframe {
  width: 100%;
  height: 980px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
}

.seo-faq {
  display: grid;
  gap: 10px;
  margin-bottom: 88px;
}

.seo-faq details {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.seo-faq summary {
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
}

.seo-faq details p {
  margin-top: 10px;
  max-width: 720px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
}

.public-invoice-page {
  min-height: 100vh;
  padding: 36px 24px 70px;
  background: var(--bg);
}

.public-invoice-shell {
  width: min(860px, 100%);
  margin: 0 auto;
}

.public-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.public-brand,
.public-download {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.public-download {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--text);
  color: var(--white);
  display: inline-grid;
  place-items: center;
}

.public-invoice {
  width: 100%;
}

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

  .builder-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .preview-sticky {
    position: static;
  }
}

@media (max-width: 640px) {
  .builder-pane,
  .preview-pane {
    padding: 24px;
  }

  .split-fields,
  .item-row,
  .preview-header {
    grid-template-columns: 1fr;
  }

  .preview-meta dd {
    text-align: left;
  }

  .invoice-preview {
    padding: 34px 24px;
  }

  .seo-hero h1 {
    font-size: 38px;
  }

  .seo-features {
    grid-template-columns: 1fr;
  }
}
