:root {
  --primary: #f97316;
  --primary-dark: #ea580c;
  --primary-light: #fff1e6;
  --ink: #1a1d29;
  --ink-dim: #6b7280;
  --border: #e7e8ec;
  --bg: #f6f7f9;
  --card: #ffffff;
  --green: #16a34a;
  --green-light: #e9f9ef;
  --red: #dc2626;
  --red-light: #fdecec;
  --yellow: #b45309;
  --yellow-light: #fef3e2;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 24px rgba(20, 20, 30, .06);
  --shadow-lg: 0 16px 40px rgba(20, 20, 30, .12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: inherit; }
button { font-family: inherit; }
.icon { display: block; }

/* Header */
.app-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.app-header-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.05rem; }
.brand-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--primary-light); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
}
.header-whatsapp {
  width: 40px; height: 40px; border-radius: 50%;
  background: #e9f9ef; color: #128c4a;
  display: flex; align-items: center; justify-content: center;
}

/* Progress bar */
.progress-bar {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 12px 4px;
  overflow-x: auto;
}
.progress-bar ol {
  list-style: none;
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0 6px;
  min-width: 560px;
}
.progress-bar li {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  font-size: .68rem;
  color: var(--ink-dim);
  font-weight: 700;
}
.progress-bar li::before {
  content: "";
  position: absolute;
  top: 14px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.progress-bar li:first-child::before { display: none; }
.progress-dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--card); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 800; color: var(--ink-dim);
  position: relative; z-index: 1;
}
.progress-bar li.done .progress-dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.progress-bar li.done::before { background: var(--primary); }
.progress-bar li.active .progress-dot { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-light); }
.progress-bar li.active .progress-label { color: var(--ink); }
.progress-label { white-space: nowrap; }

/* Main */
.app-main { max-width: 720px; margin: 0 auto; padding: 20px 16px 40px; min-height: 60vh; }
.app-footer { text-align: center; padding: 24px 16px 40px; color: var(--ink-dim); font-size: .78rem; display: flex; align-items: center; justify-content: center; gap: 6px; }
.app-footer .icon { width: 16px; height: 16px; }

/* Loading */
.loading-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 80px 0; gap: 16px; color: var(--ink-dim); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.inline-spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite; display: inline-block; vertical-align: -2px; margin-right: 6px; }

/* Step screen */
.step-screen { animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.step-title { font-size: 1.5rem; font-weight: 800; margin: 4px 0 8px; }
.step-text { color: var(--ink-dim); font-size: .95rem; line-height: 1.5; margin-bottom: 22px; }

/* Cacamba cards */
.cacamba-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 24px; }
.cacamba-card {
  background: var(--card); border: 2px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 20px; display: flex; align-items: center; gap: 16px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  text-align: left; width: 100%;
}
.cacamba-card:hover { border-color: var(--primary-light); }
.cacamba-card.selected { border-color: var(--primary); box-shadow: var(--shadow); background: var(--primary-light); }
.cacamba-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--primary-light); color: var(--primary-dark); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.05rem; flex-shrink: 0; }
.cacamba-card.selected .cacamba-icon { background: var(--primary); color: #fff; }
.cacamba-info { flex: 1; display: flex; flex-direction: column; }
.cacamba-size { display: block; font-weight: 800; font-size: 1.05rem; }
.cacamba-desc { display: block; color: var(--ink-dim); font-size: .82rem; margin-top: 2px; }
.cacamba-price { text-align: right; }
.cacamba-price strong { display: block; font-size: 1.1rem; font-weight: 800; color: var(--primary-dark); }
.cacamba-price span { font-size: .72rem; color: var(--ink-dim); }
.cacamba-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; }
.cacamba-card.selected .cacamba-check { background: var(--primary); border-color: var(--primary); }

/* Forms */
.wizard-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; font-size: .84rem; font-weight: 700; color: var(--ink); }
.field input, .field select, .field textarea {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 13px 14px;
  font-size: .95rem; font-family: inherit; color: var(--ink); background: var(--card);
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); }
.field small { font-weight: 500; color: var(--ink-dim); }
.field.invalid input { border-color: var(--red); }
.field-error { color: var(--red); font-size: .78rem; font-weight: 600; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row.thirds { grid-template-columns: 1fr 1fr 1fr; }

.cep-input-row { display: flex; gap: 10px; }
.cep-input-row input { flex: 1; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; border-radius: var(--radius-sm); font-weight: 800; font-size: .95rem; padding: 15px 22px; cursor: pointer; transition: transform .05s, opacity .15s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: var(--card); color: var(--ink); border: 1.5px solid var(--border); }
.btn-block { width: 100%; }
.btn-link { background: none; color: var(--primary-dark); font-weight: 700; padding: 8px; }
.btn-whatsapp { background: #16a34a; color: #fff; }
.btn-row { display: flex; gap: 12px; margin-top: 24px; }
.btn-row .btn { flex: 1; }

/* Banners */
.banner { border-radius: var(--radius-md); padding: 14px 16px; font-size: .88rem; line-height: 1.5; display: flex; gap: 10px; margin-bottom: 18px; }
.banner .icon { flex-shrink: 0; margin-top: 1px; }
.banner-success { background: var(--green-light); color: #0f6b32; }
.banner-error { background: var(--red-light); color: #a51c1c; }
.banner-warning { background: var(--yellow-light); color: var(--yellow); }
.banner-info { background: var(--primary-light); color: var(--primary-dark); }

/* Review screen */
.review-section { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 14px; }
.review-section h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-dim); margin: 0 0 10px; display: flex; justify-content: space-between; align-items: center; }
.review-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: .92rem; }
.review-row span:first-child { color: var(--ink-dim); }
.review-row span:last-child { font-weight: 700; text-align: right; }
.review-edit { color: var(--primary-dark); font-weight: 700; font-size: .76rem; background: none; border: none; cursor: pointer; }
.review-total { display: flex; justify-content: space-between; align-items: baseline; background: var(--primary-light); border-radius: var(--radius-md); padding: 16px 18px; margin-top: 6px; }
.review-total span:first-child { font-weight: 700; }
.review-total strong { font-size: 1.4rem; color: var(--primary-dark); }

/* Pix / payment */
.pix-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px 20px; text-align: center; box-shadow: var(--shadow); }
.pix-value { font-size: 1.9rem; font-weight: 800; margin-bottom: 18px; }
.pix-qr { width: 220px; height: 220px; margin: 0 auto 18px; border-radius: var(--radius-md); border: 1px solid var(--border); overflow: hidden; }
.pix-qr img { width: 100%; height: 100%; object-fit: contain; }
.pix-copy-box { display: flex; gap: 8px; margin-bottom: 18px; }
.pix-copy-box input { flex: 1; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 12px; font-size: .78rem; font-family: monospace; color: var(--ink-dim); background: var(--bg); }
.pix-status { display: inline-flex; align-items: center; gap: 8px; background: var(--yellow-light); color: var(--yellow); font-weight: 700; font-size: .84rem; padding: 10px 16px; border-radius: 999px; }
.pix-status.confirmed { background: var(--green-light); color: #0f6b32; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* Success screen */
.success-icon { width: 80px; height: 80px; border-radius: 50%; background: var(--green-light); color: var(--green); display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; }
.success-icon .icon { width: 40px; height: 40px; }
.order-number { text-align: center; font-size: 1.6rem; font-weight: 800; margin-bottom: 6px; }
.summary-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; margin: 20px 0; }
.summary-card h2 { font-size: 1.1rem; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.status-pill { background: var(--green-light); color: #0f6b32; font-size: .7rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; }
.summary-card p { font-size: .9rem; margin: 6px 0; color: var(--ink); }

.text-center { text-align: center; }

@media (min-width: 640px) {
  .cacamba-grid { grid-template-columns: 1fr; }
  .app-header-inner, .app-main, .progress-bar { padding-left: 24px; padding-right: 24px; }
}
