:root {
  --bg: #f4f6f9;
  --paper: #ffffff;
  --ink: #1b2430;
  --muted: #6b7686;
  --line: #e2e7ee;
  --brand: #1f7a5c;
  --brand-dark: #165c45;
  --brand-soft: #e6f3ee;
  --danger: #c0392b;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--brand); }

/* ---------- Header / footer ---------- */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  font-weight: 800;
  font-size: 20px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -.3px;
}
.logo span { color: var(--brand); }
.nav a {
  margin-left: 22px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
}
.nav a:hover { color: var(--brand); }
.nav .btn-nav {
  background: var(--brand);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
}
.nav .btn-nav:hover { background: var(--brand-dark); color: #fff; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper);
  margin-top: 60px;
  padding: 28px 0;
  font-size: 14px;
  color: var(--muted);
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 18px; justify-content: space-between; }
.site-footer a { color: var(--muted); margin-right: 16px; text-decoration: none; }
.site-footer a:hover { color: var(--brand); }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 36px 0 18px; }
.hero h1 { font-size: 36px; margin: 0 0 6px; letter-spacing: -.5px; }
.hero p { margin: 0; color: var(--muted); font-size: 18px; }

/* ---------- Generator layout ---------- */
.generator {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  align-items: start;
  margin-top: 20px;
}

.paper {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
}

.row { display: flex; gap: 24px; }
.col { flex: 1; min-width: 0; }

label.small {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 4px;
}

input[type=text], input[type=number], input[type=date], input[type=email], textarea, select {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
textarea { resize: vertical; min-height: 70px; }

.inv-title {
  font-size: 34px !important;
  font-weight: 800 !important;
  text-align: right;
  border-color: transparent !important;
  letter-spacing: -.5px;
}
.inv-title:hover { border-color: var(--line) !important; }

/* Logo upload */
.logo-box {
  width: 190px;
  height: 100px;
  border: 2px dashed var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: #fafbfc;
}
.logo-box:hover { border-color: var(--brand); color: var(--brand); }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  cursor: pointer;
  font-size: 13px;
  line-height: 22px;
  display: none;
}
.logo-box.has-logo .logo-remove { display: block; }

.meta-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 12px;
  align-items: center;
}
.meta-grid label { font-size: 14px; color: var(--muted); text-align: right; }

.section-gap { margin-top: 28px; }

/* Items table */
.items { width: 100%; border-collapse: collapse; margin-top: 30px; }
.items thead th {
  background: var(--accent, var(--ink));
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  padding: 10px;
}
.items thead th:first-child { border-radius: 7px 0 0 7px; }
.items thead th:last-child { border-radius: 0 7px 7px 0; }
.items td { padding: 8px 4px; vertical-align: top; }
.items thead th.amt { padding-top: 10px; }
.items .num { width: 110px; }
.items .qty { width: 80px; }
.items .amt { width: 120px; text-align: right; padding-top: 16px; font-weight: 600; }
.items .del { width: 34px; }
.btn-del {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 8px 6px;
}
.btn-del:hover { color: var(--danger); }

.btn-add {
  margin-top: 8px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: none;
  font: inherit;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 7px;
  cursor: pointer;
}
.btn-add:hover { background: #d4ebe2; }

/* Totals */
.bottom { display: flex; gap: 32px; margin-top: 30px; }
.bottom .notes { flex: 1; }
.totals { width: 330px; }
.totals .line {
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 15px;
}
.totals .line > span:first-child { text-align: right; color: var(--muted); }
.totals .line .val { text-align: right; font-weight: 600; }
.totals .adj { display: flex; gap: 6px; }
.totals .adj select { width: 62px; padding: 8px 4px; }
.totals .grand {
  border-top: 2px solid var(--ink);
  padding-top: 10px;
  margin-top: 10px;
  font-size: 18px;
}
.totals .grand .val { font-size: 20px; }

/* Signature */
.sig-section { margin-top: 30px; }
.sig-pad {
  position: relative;
  width: 100%;
  max-width: 360px;
  height: 130px;
  border: 2px dashed var(--line);
  border-radius: 8px;
  background: #fafbfc;
  touch-action: none;
}
.sig-pad canvas { width: 100%; height: 100%; display: block; cursor: crosshair; }
.sig-pad img { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); object-fit: contain; }
.sig-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: var(--muted);
  pointer-events: none;
  font-size: 15px;
}
.sig-actions { margin-top: 6px; }
.btn-link {
  background: none;
  border: none;
  color: var(--brand);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  margin-right: 16px;
}
.btn-link:hover { text-decoration: underline; }

/* Photos */
.photos-section { margin-top: 30px; }
.photo-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }
.photo-item {
  position: relative;
  width: 120px;
  height: 90px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fafbfc;
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-item button {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  cursor: pointer;
  font-size: 13px;
  line-height: 22px;
}
.photo-hint { font-size: 13px; color: var(--muted); margin-left: 10px; }

/* Color swatches */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
  padding: 0;
}
.swatch.active { box-shadow: 0 0 0 2px var(--ink); }

.hero .trust { font-size: 15px; color: var(--brand-dark); font-weight: 600; margin-top: 8px; }

/* Sidebar */
.sidebar { position: sticky; top: 20px; }
.card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.btn-primary {
  display: block;
  width: 100%;
  background: var(--brand);
  color: #fff;
  border: none;
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  padding: 14px;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary {
  display: block;
  width: 100%;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  font: inherit;
  font-weight: 600;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 10px;
}
.btn-secondary:hover { border-color: var(--muted); }
.free-left { font-size: 13px; color: var(--muted); text-align: center; margin-top: 10px; }
.pro-pitch h3 { margin: 0 0 6px; font-size: 16px; }
.pro-pitch ul { margin: 0 0 14px; padding-left: 18px; font-size: 14px; color: var(--muted); }

/* SEO content */
.content { max-width: 820px; margin: 60px auto 0; }
.content h2 { font-size: 26px; margin: 40px 0 12px; letter-spacing: -.3px; }
.content h3 { font-size: 18px; margin: 22px 0 6px; }
.content p, .content li { color: #3a4553; font-size: 16px; }
.steps { counter-reset: s; list-style: none; padding: 0; }
.steps li { counter-increment: s; position: relative; padding-left: 44px; margin-bottom: 14px; }
.steps li::before {
  content: counter(s);
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ind-links { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.ind-links a {
  display: block;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  text-decoration: none;
  font-weight: 600;
  color: var(--ink);
}
.ind-links a:hover { border-color: var(--brand); color: var(--brand); }
@media (max-width: 680px) { .ind-links { grid-template-columns: 1fr; } }

/* Modal */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 35, .55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal-bg.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 14px;
  max-width: 440px;
  width: 100%;
  padding: 30px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal h2 { margin: 0 0 8px; }
.modal p { color: var(--muted); margin: 0 0 20px; }
.modal .close-link {
  display: inline-block;
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  background: none;
  border: none;
}

/* ---------- Pricing ---------- */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 30px;
}
.plan {
  background: var(--paper);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 28px;
  display: flex;
  flex-direction: column;
  border: 2px solid transparent;
}
.plan.featured { border-color: var(--brand); position: relative; }
.plan .badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 20px;
}
.plan h3 { margin: 0; font-size: 18px; }
.plan .price { font-size: 40px; font-weight: 800; margin: 10px 0 0; letter-spacing: -1px; }
.plan .price small { font-size: 16px; color: var(--muted); font-weight: 500; }
.plan .sub { color: var(--muted); font-size: 14px; margin-bottom: 18px; min-height: 21px; }
.plan ul { list-style: none; padding: 0; margin: 0 0 24px; flex: 1; }
.plan li { padding: 6px 0 6px 26px; position: relative; font-size: 15px; }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--brand); font-weight: 800; }

/* ---------- Legal ---------- */
.legal { max-width: 800px; margin: 40px auto; background: var(--paper); padding: 40px; border-radius: var(--radius); box-shadow: var(--shadow); }
.legal h1 { margin-top: 0; }
.legal h2 { font-size: 20px; margin-top: 30px; }
.legal p, .legal li { color: #3a4553; }
.legal .updated { color: var(--muted); font-size: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .generator { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .pricing-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .paper { padding: 20px; }
  .row, .bottom { flex-direction: column; gap: 16px; }
  .totals { width: 100%; }
  .hero h1 { font-size: 28px; }
  .nav a:not(.btn-nav) { display: none; }
  .items .num { width: 80px; }
  .items .qty { width: 56px; }
  .items .amt { width: 80px; font-size: 14px; }
  .meta-grid { grid-template-columns: 100px 1fr; }
}

/* Two Pro plans only */
.pricing-grid.two { grid-template-columns: repeat(2, minmax(0, 340px)); justify-content: center; }
@media (max-width: 760px) { .pricing-grid.two { grid-template-columns: 1fr; } }
.plan .badge { white-space: nowrap; }

/* Help center & FAQ pages */
.faq-page .crumbs { font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.faq-page .crumbs a { color: var(--muted); }
.faq-page .answer { font-size: 18px; line-height: 1.6; }
.faq-cta { margin: 28px 0; padding: 22px; border-radius: var(--radius); background: #eef7f2; text-align: center; }
.faq-cta p { margin: 0 0 14px; color: #3a4553; }
.faq-toc { columns: 2; padding-left: 20px; }
.faq-item { padding: 14px 0; border-bottom: 1px solid #e6e9ee; }
.faq-item h3 { font-size: 17px; margin: 0 0 6px; }
.faq-item p { margin: 0 0 6px; }
.faq-link { font-size: 14px; font-weight: 600; }
.faq-note { font-size: 14px; color: var(--muted); font-style: italic; }
@media (max-width: 600px) { .faq-toc { columns: 1; } .legal { padding: 24px; } }
.faq-item h2 { font-size: 19px; margin: 0 0 6px; }
.faq-sub { font-size: 16px; margin: 22px 0 4px; text-transform: none; }
