:root {
  --red: #e31837;
  --red-dark: #bd102a;
  --red-soft: #fff1f3;
  --ink: #202124;
  --muted: #686b73;
  --line: #e6e7eb;
  --surface: #ffffff;
  --bg: #f6f7f9;
  --green: #1fa855;
  --green-dark: #178744;
  --shadow: 0 10px 32px rgba(22, 26, 33, .07);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}
button, input { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}
.brand-row {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  background: var(--red);
  color: white;
  border-radius: 13px;
  font-weight: 900;
  letter-spacing: -1px;
}
.brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.brand-copy strong { font-size: 18px; }
.brand-copy span { color: var(--muted); font-size: 12px; margin-top: 5px; }
.top-pill {
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid #ffd7de;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .4px;
}

.page { padding: 42px 0 54px; }
.hero {
  display: grid;
  grid-template-columns: 1.4fr .6fr;
  gap: 36px;
  align-items: center;
  margin-bottom: 28px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 1.2px;
}
h1 { margin: 0; font-size: clamp(30px, 5vw, 48px); letter-spacing: -1.7px; line-height: 1.05; }
.hero-text { color: var(--muted); max-width: 720px; margin: 16px 0 0; font-size: 17px; }
.hero-card {
  background: var(--red);
  color: white;
  border-radius: 18px;
  padding: 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  box-shadow: var(--shadow);
}
.hero-card-icon {
  flex: 0 0 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: grid;
  place-items: center;
  font-weight: 900;
}
.hero-card strong, .hero-card span { display: block; }
.hero-card span { opacity: .88; font-size: 13px; margin-top: 5px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.mode-card {
  padding: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 18px;
}
.mode-card h2, .step h2 { margin: 0; font-size: 21px; }
.mode-card p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.mode-switch {
  flex: 0 0 auto;
  display: flex;
  gap: 7px;
  padding: 5px;
  background: #f1f2f5;
  border-radius: 13px;
}
.mode-btn {
  border: 0;
  background: transparent;
  color: #555960;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.mode-btn.active {
  background: white;
  color: var(--red);
  box-shadow: 0 2px 10px rgba(0,0,0,.07);
}

.step { padding: 28px; margin-top: 18px; }
.step-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 24px; }
.step-number {
  width: 34px; height: 34px; flex: 0 0 34px;
  display: grid; place-items: center;
  color: white; background: var(--red);
  border-radius: 50%; font-weight: 900;
}
.step-hint { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field span { font-size: 13px; font-weight: 750; }
.field input {
  width: 100%;
  min-height: 46px;
  border: 1px solid #d8dae0;
  background: white;
  border-radius: 11px;
  padding: 11px 12px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(227, 24, 55, .10);
}
.field input.invalid { border-color: #c8222a; background: #fff7f7; }
.field-status { min-height: 16px; font-size: 11px; color: var(--muted); }
.field-status.ok { color: #178744; }
.field-status.error { color: #bd102a; }

.subhead {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 22px; margin: 22px 0 16px;
}
.subhead strong { font-size: 15px; }
.subhead span { color: var(--muted); font-size: 12px; }

.items-head {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin-bottom: 14px;
}
.items-head strong, .items-head span { display: block; }
.items-head span { color: var(--muted); font-size: 12px; margin-top: 4px; }
.secondary-btn {
  border: 1px solid #d6d8de; background: white; color: #363941;
  border-radius: 11px; padding: 10px 13px; font-weight: 800;
}
.secondary-btn:hover { background: #f7f7f8; }
.items-list { display: grid; gap: 10px; }
.item-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: #fcfcfd;
}
.item-top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.item-title { font-size: 14px; }
.remove-item {
  border: 0; background: transparent; color: #a61b2e; font-size: 12px; font-weight: 800;
}
.item-grid { display: grid; grid-template-columns: 110px 1fr 190px; gap: 12px; }
.parcel-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px;
  border-top: 1px solid var(--line); padding-top: 20px; margin-top: 20px;
}
.declared-total {
  margin-top: 18px;
  background: var(--red-soft);
  border: 1px solid #ffd7de;
  border-radius: 13px;
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.declared-total span { font-size: 13px; font-weight: 800; color: #8d1d2c; }
.declared-total strong { color: var(--red); font-size: 22px; }

.privacy-card { margin-top: 18px; padding: 20px 22px; }
.consent { display: flex; gap: 11px; align-items: flex-start; font-size: 13px; font-weight: 650; }
.consent input { margin-top: 3px; accent-color: var(--red); }
.privacy-card p { color: var(--muted); font-size: 11px; margin: 10px 0 0 26px; }

.actions {
  margin-top: 18px; padding: 20px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.action-copy strong, .action-copy span { display: block; }
.action-copy span { color: var(--muted); font-size: 12px; margin-top: 4px; }
.action-buttons { display: flex; gap: 10px; }
.whatsapp-btn {
  border: 0; background: var(--green); color: white;
  border-radius: 11px; padding: 11px 16px; font-weight: 900;
}
.whatsapp-btn:hover { background: var(--green-dark); }
.wa-dot { margin-right: 5px; }

.form-alert {
  display: none;
  margin-top: 14px; padding: 13px 16px; border-radius: 12px; font-size: 13px; font-weight: 700;
}
.form-alert.show { display: block; }
.form-alert.error { background: #fff0f1; color: #a31125; border: 1px solid #ffd1d8; }
.form-alert.success { background: #effbf3; color: #166c39; border: 1px solid #c9efd6; }

.footer { background: #24252a; color: #cfd0d5; padding: 22px 0; font-size: 12px; }
.footer-row { display: flex; justify-content: space-between; gap: 20px; }

.quick-only { display: none; }
body[data-mode="quick"] .full-only { display: none !important; }
body[data-mode="quick"] .quick-only { display: block; }
body[data-mode="quick"] .step { padding-bottom: 24px; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 20px; }
  .hero-card { max-width: 520px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .parcel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mode-card, .actions { align-items: stretch; flex-direction: column; }
  .mode-switch, .action-buttons { width: 100%; }
  .mode-btn, .action-buttons button { flex: 1; }
}
@media (max-width: 580px) {
  .shell { width: min(100% - 20px, 1120px); }
  .topbar { position: static; }
  .brand-row { min-height: 66px; }
  .top-pill { display: none; }
  .page { padding-top: 28px; }
  h1 { font-size: 34px; }
  .mode-card, .step { padding: 18px; }
  .mode-switch { flex-direction: column; }
  .grid, .parcel-grid, .item-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .subhead, .items-head { align-items: stretch; flex-direction: column; }
  .items-head .secondary-btn { width: 100%; }
  .action-buttons { flex-direction: column; }
  .action-buttons button { width: 100%; }
  .footer-row { flex-direction: column; }
}


/* Limites e documento fiscal */
.limit-hint { min-height: 16px; font-size: 11px; color: var(--muted); }
.parcel-grid-first { border-top: 0; padding-top: 0; margin-top: 0; }
.fiscal-block { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 22px; }
.fiscal-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.fiscal-head > div:first-child strong, .fiscal-head > div:first-child span { display: block; }
.fiscal-head > div:first-child span { color: var(--muted); font-size: 12px; margin-top: 4px; }
.fiscal-switch { display: flex; gap: 7px; padding: 5px; background: #f1f2f5; border-radius: 13px; }
.fiscal-btn { border: 0; background: transparent; color: #555960; padding: 10px 13px; border-radius: 10px; font-weight: 800; white-space: nowrap; }
.fiscal-btn.active { background: white; color: var(--red); box-shadow: 0 2px 10px rgba(0,0,0,.07); }
.fiscal-panel.hidden { display: none; }
.notice-box { display: flex; flex-direction: column; gap: 3px; background: #fff8e7; border: 1px solid #f2dda2; color: #70530a; border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: 12px; }
.notice-box strong { font-size: 13px; }
.invoice-notice { background: #eef7ff; border-color: #c9e2f7; color: #22577a; }
.declared-total small { display: block; font-weight: 700; font-size: 10px; margin-top: 2px; }
.declared-limit-status { display: block; min-height: 18px; margin-top: 7px; font-size: 12px; font-weight: 800; }
.declared-limit-status.error { color: #bd102a; }
.declared-limit-status.ok { color: #178744; }
.invoice-grid { margin-top: 4px; }

@media (max-width: 860px) {
  .fiscal-head { align-items: stretch; flex-direction: column; }
  .fiscal-switch { width: 100%; }
  .fiscal-btn { flex: 1; }
}
@media (max-width: 580px) {
  .fiscal-switch { flex-direction: column; }
}
