:root {
  --bg: #efe6d8;
  --bg-2: #e7dccb;
  --paper: #fffdf8;
  --ink: #241c16;
  --muted: #5e534a;
  --line: #e4d7c6;
  --line-strong: #c9b59a;
  --green: #1c6b42;
  --green-dark: #145233;
  --green-soft: #e6f4ec;
  --blue: #1d4f7a;
  --blue-soft: #e7f1f8;
  --amber: #8a5a09;
  --amber-soft: #fbf3dc;
  --red: #8e2f2f;
  --red-soft: #fdeaea;
  --shadow: 0 16px 40px rgba(70, 42, 16, 0.08);
  --radius: 22px;
  --font: "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 400px at 10% -10%, #f7f1e6 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.45;
}
img { max-width: 100%; }
a { color: var(--green-dark); }
button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-family: var(--serif); font-size: clamp(2rem, 7vw, 3.4rem); line-height: 1.05; letter-spacing: -0.03em; }
h2 { font-size: 1.35rem; line-height: 1.2; }

.wrap { width: min(1080px, calc(100% - 28px)); margin: 0 auto; }
.top { padding: 18px 0 8px; }
.top-inner, .top-nav, .brand-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--green);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.top-nav { gap: 8px; }
.top-nav a {
  text-decoration: none;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.7);
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 0.95rem;
}
.top-nav a[aria-current="page"] { border-color: var(--green); background: white; }

.site-foot {
  margin: 28px 0 18px;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.hero { padding: 12px 0 28px; }
.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--green-dark);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.78rem;
}
.lede { margin-top: 12px; font-size: 1.15rem; color: var(--muted); max-width: 38rem; }
.steps, .price-grid, .proposal-list, .stack { display: grid; gap: 12px; }
.steps { margin: 22px 0; }
.step, .card, .panel, .doc {
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.step, .panel, .card { padding: 16px; }
.step strong { display: block; margin-bottom: 4px; }
.step span, .muted { color: var(--muted); }
.price-grid { margin: 8px 0 22px; }
.price {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 2px solid var(--line);
}
.price.is-paid { background: #163526; color: #f4fff8; border-color: #163526; }
.price.is-paid .muted, .price.is-paid li { color: #d5ecdf; }
.price h2 { font-family: var(--serif); font-size: 2rem; }
.price ul { margin: 12px 0 0; padding-left: 18px; }
.price li + li { margin-top: 6px; }
.amount { font-family: var(--serif); font-size: 2.1rem; margin: 8px 0; }

.panel h2, .block-title { margin-bottom: 8px; }
label, .block-title { display: block; font-weight: 700; margin: 14px 0 6px; }
.hint { color: var(--muted); font-size: 0.92rem; margin-top: 6px; }
input, textarea {
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid var(--line-strong);
  background: white;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus { outline: 3px solid rgba(28, 107, 66, 0.35); border-color: var(--green); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 2px solid transparent;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
  background: white;
  color: var(--ink);
}
.btn-primary { background: var(--green); color: white; }
.btn-primary:hover { background: var(--green-dark); }
.btn-secondary { background: white; border-color: var(--line-strong); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--green-dark); }
.btn-gap { margin-top: 10px; }
.btn-danger { background: var(--red); color: white; }
.btn-whats { background: #128c4a; color: white; }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-row, .card-actions, .share-row, .chip-row { display: grid; gap: 8px; margin-top: 12px; }

.banner {
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--amber-soft);
  color: var(--amber);
  font-weight: 700;
}
.banner-ok { background: var(--green-soft); color: var(--green-dark); }
.banner-erro { background: var(--red-soft); color: var(--red); }
.loading { color: var(--muted); padding: 12px 0 20px; }

.dash-head { display: grid; gap: 14px; margin: 8px 0 16px; }
.usage {
  margin-top: 8px;
  height: 10px;
  background: #efe4d4;
  border-radius: 999px;
  overflow: hidden;
}
.usage span { display: block; height: 100%; width: 0; background: var(--green); }
.usage[data-used="1"] span { width: 33%; }
.usage[data-used="2"] span { width: 66%; }
.usage[data-used="3"] span { width: 100%; }
.sr-copy { position: fixed; left: -9999px; top: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  border: 2px solid var(--line-strong);
  background: white;
  border-radius: 999px;
  min-height: 44px;
  padding: 0 14px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.chip.is-on { background: var(--ink); color: white; border-color: var(--ink); }
.card-top, .doc-id, .total-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.money { font-family: var(--serif); font-size: 1.7rem; }
.card h2 { margin: 8px 0 4px; font-family: var(--serif); }
.badge, .stamp {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.82rem;
  font-weight: 800;
}
.st-enviado { background: var(--blue-soft); color: var(--blue); }
.st-aprovado { background: var(--green-soft); color: var(--green-dark); }
.st-recusado { background: var(--red-soft); color: var(--red); }
.empty { text-align: left; padding: 8px 0 20px; }
.empty h2 { font-family: var(--serif); font-size: 2rem; margin-bottom: 8px; }

.modelos { display: grid; gap: 8px; margin: 10px 0 16px; }
.item-editor {
  display: grid;
  gap: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fffaf3;
  border: 2px solid var(--line);
  border-radius: 16px;
}
.item-editor .line-total { font-weight: 800; }
.sticky-save {
  position: sticky;
  bottom: 0;
  padding: 12px 0 8px;
  background: linear-gradient(transparent, var(--bg) 20%);
}
.totals-box {
  margin-top: 8px;
  padding: 12px 0;
}
.totals-box div { display: flex; justify-content: space-between; margin: 4px 0; }
.totals-box .grand { font-family: var(--serif); font-size: 2rem; margin-top: 8px; }

.doc-page { padding-bottom: 24px; }
.doc { padding: 22px 18px 18px; }
.doc-kicker { color: var(--green-dark); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.75rem; }
.doc-business { font-family: var(--serif); font-size: clamp(1.8rem, 6vw, 2.6rem); line-height: 1.05; margin: 4px 0; }
.doc-brand { display: flex; gap: 14px; align-items: flex-start; }
.doc-logo { width: 72px; height: 72px; object-fit: contain; border-radius: 12px; background: white; border: 1px solid var(--line); }
.doc-meta, .doc-client p, .doc-note { color: var(--muted); }
.doc-meta a, .doc-client a { color: inherit; }
.doc-top { display: grid; gap: 16px; padding-bottom: 16px; border-bottom: 2px solid var(--ink); }
.doc-number { font-family: var(--serif); font-size: 1.8rem; text-align: left; }
.stamp { border-radius: 8px; border: 3px solid currentColor; text-transform: uppercase; letter-spacing: 0.05em; }
.doc-client { margin: 16px 0; }
.doc-client h2, .doc-block h2 { font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.client-name { font-size: 1.35rem; font-weight: 800; }
.lines { margin-top: 8px; }
.line {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.line-head { display: none; }
.desc { grid-column: 1 / -1; font-weight: 700; }
.qty, .unit, .lt { color: var(--muted); text-align: right; }
.qty::before, .unit::before, .lt::before {
  content: attr(data-label);
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.doc-block { margin-top: 16px; }
.doc-block p { white-space: pre-wrap; }
.doc-credit {
  margin-top: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}
.decision {
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  background: var(--bg-2);
}
.toolbar { display: grid; gap: 8px; margin: 8px 0 14px; }

.link-box {
  width: 100%;
  min-height: 56px;
  border-radius: 14px;
  border: 2px dashed var(--line-strong);
  background: white;
  padding: 12px;
  word-break: break-all;
  font-size: 0.95rem;
}
.logo-preview { width: 88px; height: 88px; object-fit: contain; border-radius: 12px; background: white; border: 1px solid var(--line); }
.file-input {
  position: absolute;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (min-width: 800px) {
  body { font-size: 17px; }
  .hero-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 28px; align-items: start; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .price-grid { grid-template-columns: 1fr 1fr; }
  .proposal-list { grid-template-columns: 1fr 1fr; }
  .dash-head { grid-template-columns: 1fr auto; align-items: end; }
  .dash-head .btn, .toolbar .btn, .share-row .btn, .btn-auto { width: auto; }
  .share-row, .card-actions, .btn-row { grid-template-columns: repeat(3, max-content); }
  .card-actions { grid-template-columns: 1.3fr 0.8fr 0.8fr; }
  .modelos { grid-template-columns: repeat(5, 1fr); }
  .item-editor { grid-template-columns: 1.6fr 0.5fr 0.7fr auto auto; align-items: end; }
  .item-editor label { margin-top: 0; }
  .doc { padding: 36px 40px; }
  .doc-top { grid-template-columns: 1fr auto; align-items: start; }
  .doc-number, .doc-id { text-align: right; }
  .doc-id { display: grid; justify-items: end; gap: 6px; }
  .line, .line-head {
    grid-template-columns: 1.7fr 0.45fr 0.7fr 0.7fr;
    align-items: baseline;
  }
  .line-head { display: grid; color: var(--muted); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
  .desc { grid-column: auto; }
  .qty, .unit, .lt { color: inherit; }
  .qty::before, .unit::before, .lt::before { content: none; }
}
@media (max-width: 480px) {
  .brand { font-size: 1rem; }
  .top-nav a { padding: 8px 10px; font-size: 0.88rem; }
}

@media print {
  body { background: white; font-size: 12pt; }
  .top, .site-foot, .no-print { display: none !important; }
  .wrap { width: auto; }
  .doc {
    box-shadow: none;
    border: 0;
    border-radius: 0;
    padding: 0;
  }
  .line, .line-head {
    display: grid;
    grid-template-columns: 1.7fr 0.45fr 0.7fr 0.7fr;
  }
  .line-head { display: grid; }
  .desc { grid-column: auto; color: black; }
  .qty::before, .unit::before, .lt::before { content: none; }
  a { color: black; text-decoration: none; }
  @page { size: A4; margin: 14mm; }
}
