:root {
  --bg: #f7f8fc;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --secondary: #111827;
  --danger: #dc2626;
  --success: #16a34a;
  --border: #e5e7eb;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, #eef2ff 0%, rgba(238,242,255,0) 55%), var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 {
  font-family: "Sora", "Inter", sans-serif;
  letter-spacing: 0.2px;
}

.container { width: min(1120px, 92vw); margin: 0 auto; }
.page { padding: 1.5rem 0 3rem; }
main.page { flex: 1; }

.header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e7eaf1;
  position: sticky;
  top: 0;
  z-index: 9;
  box-shadow: 0 4px 16px rgb(17 24 39 / 6%);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: nowrap;
  min-height: 64px;
  padding: 0;
}
.brand {
  text-decoration: none;
  font-family: "Sora", "Inter", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: 0.2px;
  display: inline-flex;
  align-items: center;
  height: 40px;
}
.main-nav {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}
.main-nav a {
  margin-left: 0.75rem;
  color: #334155;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0 0.95rem;
  border-radius: 999px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  height: 40px;
}
.main-nav a:hover {
  background: #eef2ff;
  color: var(--primary-dark);
}
.main-nav a:first-child { margin-left: 0; }

.hero {
  background: linear-gradient(135deg, #eef2ff, #f8fafc);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2.2rem;
  margin-bottom: 1.25rem;
}
.hero h1 {
  margin-top: 0;
  margin-bottom: 0.6rem;
}
.hero p {
  margin-top: 0;
  margin-bottom: 1rem;
}
.hero-photo {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 0.85rem;
  border: 1px solid #dbe4ff;
  margin-top: 0.9rem;
}

.grid { display: grid; gap: 1rem; }
.products-grid {
  grid-template-columns: 1fr;
  max-width: 760px;
  margin: 0 auto;
}
.dashboard-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.qr-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  box-shadow: 0 1px 2px rgb(0 0 0 / 6%);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgb(17 24 39 / 8%);
  border-color: #dbe4ff;
}
.product-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-top-left-radius: 0.9rem;
  border-top-right-radius: 0.9rem;
}
.product-card { display: flex; flex-direction: column; background: #ffffff; }
.product-card .card-body { padding: 1.1rem 1.1rem 1.2rem; flex: 1 1 auto; }
.product-card .card-body p { margin: 0.5rem 0 0; line-height: 1.5; }
.products-grid { gap: 1.1rem; }

.variant-list { margin-top: 0.9rem; display: grid; gap: 0.65rem; }
.variant-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.65rem;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.variant-actions { display: flex; align-items: center; gap: 0.5rem; }
.price { font-weight: 700; color: var(--primary-dark); }

.btn {
  border: 0;
  border-radius: 0.65rem;
  padding: 0.62rem 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Sora", "Inter", sans-serif;
  letter-spacing: 0.1px;
}
.btn.primary { background: var(--primary); color: white; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.secondary { background: #e5e7eb; color: #1f2937; }
.btn.danger { background: var(--danger); color: white; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.form-block { padding: 1rem; margin-bottom: 1rem; }
label { font-weight: 600; display: block; margin: 0.65rem 0 0.3rem; }
input, textarea, select {
  width: 100%;
  padding: 0.62rem;
  border-radius: 0.6rem;
  border: 1px solid var(--border);
}

.cart-line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
}
.cart-qty {
  min-width: 190px;
  display: grid;
  grid-template-columns: 1fr;
}
.checkout-total { margin: 1rem 0; font-size: 1.1rem; }
.radio-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 0.4rem; }
.radio-row label { font-weight: 500; }

.flash-wrap { margin-bottom: 1rem; }
.flash {
  border-radius: 0.55rem;
  padding: 0.68rem;
  margin-bottom: 0.35rem;
  font-weight: 600;
}
.flash-success { background: #dcfce7; color: #166534; }
.flash-error { background: #fee2e2; color: #991b1b; }

.badge { border-radius: 999px; padding: 0.2rem 0.55rem; font-weight: 700; font-size: 0.85rem; }
.badge.pendente, .badge.pending { background: #fef3c7; color: #92400e; }
.badge.pago { background: #dcfce7; color: #166534; }
.badge.entregue { background: #dbeafe; color: #1d4ed8; }

.table-card { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 0.75rem;
  vertical-align: top;
}

.variant-row {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: 2fr 1fr 1fr auto;
  margin-bottom: 0.5rem;
}
.admin-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.stat-card { padding: 1rem; }
.stat-card p { font-size: 1.6rem; margin: 0.5rem 0 0; font-weight: 800; }

.qr-card {
  padding: 0.7rem;
  display: grid;
  gap: 0.3rem;
  justify-items: center;
  text-align: center;
}
.qr-card img { image-rendering: pixelated; max-width: 320px; width: 100%; height: auto; object-fit: contain; }

.page-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.empty-state {
  background: white;
  border: 1px dashed var(--border);
  border-radius: 0.8rem;
  padding: 1rem;
  color: var(--muted);
}

.site-footer {
  background: #111827;
  color: #e5e7eb;
  margin-top: auto;
}
.footer-content {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0;
  flex-wrap: wrap;
}
.footer-content p {
  margin: 0.25rem 0;
  color: #cbd5e1;
}

.btn,
input,
select,
textarea {
  font-size: 1rem;
}

.variant-actions .btn {
  white-space: nowrap;
}

.variant-line > div:first-child {
  min-width: 0;
}

.scanner-box {
  width: min(420px, 100%);
  margin: 1rem 0;
}
.scanner-manual { margin-top: 1rem; }
.scanner-manual-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
}
.scan-result {
  margin-top: 1rem;
  border-radius: 0.6rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  background: #f9fafb;
}
.scan-result.ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}
.scan-result.warning {
  border-color: #fcd34d;
  background: #fef9c3;
  color: #854d0e;
}
.scan-result.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.products-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

@media (max-width: 1024px) {
  .container { width: min(1120px, 94vw); }
  .hero { padding: 1.4rem; }
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .variant-line { align-items: flex-start; }
}

@media (max-width: 768px) {
  .nav { min-height: 60px; }
  .main-nav { width: 100%; justify-content: flex-end; }
  .main-nav a { margin-left: 0.5rem; font-size: 0.9rem; padding: 0.45rem 0.75rem; }
  .variant-row { grid-template-columns: 1fr; }
  .cart-line { flex-direction: column; align-items: flex-start; }
  .variant-line { flex-direction: column; gap: 0.6rem; }
  .variant-actions { width: 100%; justify-content: space-between; }
  .variant-actions .btn { width: 100%; }
  .page-header-row { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
  .scanner-manual-row { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.45rem; }
  .hero p { font-size: 0.98rem; }
}

@media (max-width: 420px) {
  .main-nav { gap: 0.4rem; }
  .main-nav a { margin-left: 0.35rem; padding: 0.42rem 0.62rem; font-size: 0.85rem; }
}
.card-body p {
   white-space: pre-wrap;
    word-wrap: break-word;
}
