:root{--bg:#F5F1E8;--brand:#2C3E50;--brand-dark:#1a252f;--accent:#E89A4D;--text:#333333;--muted:#666666;--card:#ffffff;--border:#E0E0E0}
*{box-sizing:border-box}
html{height:100%}
body{min-height:100%}
body{margin:0;font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;color:var(--text);background:var(--bg)}
h1,h2,h3{color:var(--brand)}
.container{max-width:1100px;margin:0 auto;padding:0 24px}
.header{background:#fff;box-shadow:0 2px 8px rgba(0,0,0,0.1);position:sticky;top:0;z-index:1000}
.header-content{display:flex;align-items:center;justify-content:space-between;padding:1rem 0}
.logo{font-size:1.5rem;font-weight:700;color:var(--brand)}
.logo a{text-decoration:none;color:inherit}
.logo-highlight{color:var(--accent)}
.nav{display:flex;gap:2rem;align-items:center}
.nav-link{color:var(--text);text-decoration:none;font-weight:500}
.nav a{color:var(--text);text-decoration:none;font-weight:500}
.hero{background:linear-gradient(135deg, var(--bg) 0%, #e8dcc8 100%);padding:24px 0;border-bottom:1px solid var(--border)}
.hero-grid{display:grid;grid-template-columns:1fr 1fr;gap:28px;align-items:center}
.hero h1{margin:0 0 7px;font-size:38px;line-height:1.15}
.hero h1 .accent{color:var(--accent)}
.hero p{margin:0 0 18px;color:var(--muted);max-width:52ch}
.hero-actions{display:flex;gap:12px}
.generator-section{padding:32px 0}
.grid-2{display:grid;grid-template-columns:1.1fr 1fr;gap:24px}
.card{background:var(--card);border:1px solid var(--border);border-radius:12px;padding:24px;box-shadow:0 6px 18px rgba(0,0,0,0.08)}
.form-card h2,.preview-card h2{margin:0 0 14px}
.field{display:flex;flex-direction:column;gap:10px;margin-bottom:16px}
.field-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
label{font-size:13px;color:var(--muted)}
input,textarea{padding:10px 12px;border:1px solid var(--border);border-radius:8px;font-size:14px}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:10px 14px;border-radius:10px;border:1px solid var(--border);background:#fff;color:var(--text);cursor:pointer}
.btn.primary{background:var(--brand);border-color:var(--brand);color:#fff}
.btn.primary:hover{background:var(--brand-dark)}
.btn.dark{background:var(--brand);border-color:var(--brand);color:#fff}
.btn.dark:hover{background:var(--brand-dark)}
.btn.outline{background:#fff;border-color:#e5e7eb;color:var(--text)}
.btn.big{padding:14px 18px;font-weight:600}
.actions{display:flex;gap:12px;margin-top:16px}
.actions .flag{display:inline-flex;align-items:center;gap:8px;color:var(--muted);font-size:14px}
.actions .flag input{width:16px;height:16px}
.receipt{width:100%;border:1px dashed var(--border);border-radius:10px;padding:20px;background:#fff;display:flex;flex-direction:column;min-height:380px}
.receipt-head{display:flex;align-items:center;justify-content:space-between;border-bottom:2px solid var(--border);padding-bottom:12px;margin-bottom:12px}
.receipt-title{font-weight:700;font-size:26px}
.receipt-brand{color:var(--muted);font-size:12px}
.receipt-body{display:flex;flex-direction:column;gap:10px;flex:1}
.row{display:flex;align-items:center;justify-content:space-between;border-bottom:1px dashed var(--border);padding:10px 0}
.row span{color:var(--muted)}
.receipt-footer{display:flex;align-items:flex-end;justify-content:space-between;margin-top:16px}
.sig{width:70%;min-height:80px;display:flex;flex-direction:column;justify-content:flex-end}
.sig .line{height:1px;background:var(--border);margin-bottom:8px}
.sig .label{font-size:13px;color:var(--muted)}
.stamp{color:#1f9d55;border:1px solid #1f9d55;border-radius:6px;padding:6px 10px;font-weight:600}
.smart-section{padding:28px 0;border-top:1px solid var(--border)}
.hero-art{display:flex;align-items:center;justify-content:center}
.hero-svg{width:100%;height:auto;max-height:340px}
.advantages-section{padding:24px 0;border-bottom:1px solid var(--border)}
.advantages-section h2{margin:0;font-size:26px}
.table-wrap{overflow:auto}
table{width:100%;border-collapse:collapse}
th,td{padding:12px;border-bottom:1px solid var(--border);text-align:left}
.features-table .yes{color:#0f766e}
.features-table .no{color:#e11d48}
.blog-links{padding:28px 0}
.list{display:grid;gap:10px;margin:0;padding-left:18px}
.site-footer{background:var(--brand);color:#fff;padding:2rem 0}
.footer-inner{display:flex;align-items:center;justify-content:space-between;min-height:64px}
.site-footer a{color:#fff;text-decoration:none;opacity:0.8}
.site-footer a:hover{opacity:1}
@page{size:A4;margin:0}
@media (max-width:860px){.grid-2{grid-template-columns:1fr}.field-grid{grid-template-columns:1fr}.logo{font-size:16px}.hero h1{font-size:30px}.hero-grid{grid-template-columns:1fr}}
@media (max-width:520px){.field-grid{grid-template-columns:1fr}}
@media print{
  body{background:#fff;margin:0;padding:0}
  .site-header,.hero,.form-card,.smart-section,.blog-links,.site-footer,.actions,.seo-text{display:none}
  .generator-section{padding:0}
  .preview-card{border:none;box-shadow:none}
  .receipt{border:none;min-height:260mm;padding:36mm}
  /* Two-per-page printing */
  #print-two{display:none}
  body.two-per-page #receipt-output{display:none}
  body.two-per-page #print-two{display:block;width:210mm;height:297mm;margin:0 auto;padding:10mm;display:flex;flex-direction:column;gap:0;box-sizing:border-box;position:relative;background:#fff}
  body.two-per-page #print-two::before{content:"";position:absolute;left:10mm;right:10mm;top:50%;border-top:1px dashed var(--border)}
  body.two-per-page #print-two .receipt{flex:0 0 50%;min-height:0;padding:6mm;border:1px dashed var(--border);box-sizing:border-box;overflow:hidden;page-break-inside:avoid;break-inside:avoid;font-size:12px}
  body.two-per-page #print-two .receipt-title{font-size:20px}
  body.two-per-page #print-two .receipt-body{gap:4px}
  body.two-per-page #print-two .row{padding:4px 0}
  body.two-per-page #print-two .receipt-footer{margin-top:6px}
  body.two-per-page #print-two .sig{min-height:20mm}
  /* One-per-page (top half) printing */
  body:not(.two-per-page) #receipt-output{width:210mm;height:148.5mm;margin:10mm auto 0;padding:6mm;border:1px dashed var(--border);box-sizing:border-box;page-break-inside:avoid;break-inside:avoid;font-size:12px;min-height:0;overflow:hidden;display:flex;flex-direction:column}
  body:not(.two-per-page) #receipt-output .receipt-title{font-size:20px}
  body:not(.two-per-page) #receipt-output .receipt-body{gap:4px}
  body:not(.two-per-page) #receipt-output .row{padding:4px 0}
  body:not(.two-per-page) #receipt-output .receipt-footer{margin-top:6px}
  body:not(.two-per-page) #receipt-output .sig{min-height:20mm}

  /* One-per-half (top half) printing using print-two container */
  body.one-per-half #receipt-output { display: none; }
  body.one-per-half #print-two {
      display: block;
      width: 210mm;
      height: 297mm;
      margin: 0 auto;
      padding: 10mm;
      display: flex;
      flex-direction: column;
      gap: 0;
      box-sizing: border-box;
      position: relative;
      background: #fff;
  }
  body.one-per-half #print-two .receipt {
      flex: 0 0 50%;
      min-height: 0;
      padding: 6mm;
      border: 1px dashed var(--border);
      box-sizing: border-box;
      overflow: hidden;
      page-break-inside: avoid;
      break-inside: avoid;
      font-size: 12px;
  }
  body.one-per-half #print-two .receipt-title { font-size: 20px; }
  body.one-per-half #print-two .receipt-body { gap: 4px; }
  body.one-per-half #print-two .row { padding: 4px 0; }
  body.one-per-half #print-two .receipt-footer { margin-top: 6px; }
  body.one-per-half #print-two .sig { min-height: 20mm; }
}

/* Modo de exportação (JPG/PDF): aumenta espaçamento apenas durante geração */
body.exporting .receipt{padding:40px;min-height:600px}
body.exporting .receipt-body{gap:14px}
body.exporting .row{padding:14px 0}
body.exporting .receipt-footer{margin-top:24px}
body.exporting .sig{min-height:120px}
/* two-per-page print rules moved inside @media print for reliability */
/* Exportação: replicar layout de 2 por folha para captura */
body.exporting.two-per-page #receipt-output{display:none}
body.exporting.two-per-page .preview-card{border:none;box-shadow:none;padding:0}
body.exporting.two-per-page #print-two{display:block;position:fixed;left:0;top:0;width:210mm;height:297mm;margin:0 auto;background:#fff;padding:10mm;box-sizing:border-box;display:flex;flex-direction:column;gap:0}
body.exporting.two-per-page #print-two::before{content:"";position:absolute;left:10mm;right:10mm;top:50%;border-top:1px dashed var(--border)}
body.exporting.two-per-page #print-two .receipt{flex:0 0 50%;min-height:0;padding:6mm;border:1px dashed var(--border);box-sizing:border-box;font-size:12px;overflow:hidden}
/* Exportação: recibo único ocupando metade superior */
body.exporting.one-per-half #receipt-output{display:none}
body.exporting.one-per-half .preview-card{border:none;box-shadow:none;padding:0}
body.exporting.one-per-half #print-two{display:block;position:fixed;left:0;top:0;width:210mm;height:297mm;margin:0 auto;background:#fff;padding:10mm;box-sizing:border-box;display:flex;flex-direction:column;gap:0}
body.exporting.one-per-half #print-two::before{display:none}
body.exporting.one-per-half #print-two .receipt{flex:0 0 50%;min-height:0;padding:6mm;border:1px dashed var(--border);box-sizing:border-box;font-size:12px;overflow:hidden}
