:root {
  --red: #B71C2B;
  --red-dark: #8C1220;
  --red-soft: #FCEEEF;
  --cream: #FFF8EE;
  --paper: #FFFFFF;
  --ink: #1E1916;
  --muted: #6F655D;
  --line: #EEE2D3;
  --cheese: #F6B93B;
  --basil: #1F7A4D;
  --basil-soft: #E6F3EC;
  --blue: #1565C0;
  --blue-soft: #E3EEFB;
  --amber-soft: #FFF3D6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(43, 29, 22, .06), 0 6px 20px rgba(43, 29, 22, .08);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--cream);
  line-height: 1.45;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { line-height: 1.15; margin: 0; }
[hidden] { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border: 0; border-radius: 999px; padding: .75rem 1.25rem;
  font-weight: 600; background: var(--red); color: #fff;
  transition: background .15s, transform .05s, opacity .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--red-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: #fff; border-color: #d9c9b6; }
.btn.green { background: var(--basil); }
.btn.green:hover { background: #1f5f23; }
.btn.small { padding: .45rem .85rem; font-size: .875rem; }
.btn.block { width: 100%; }

.field { display: grid; gap: .35rem; margin-bottom: .85rem; }
.field label, .label { font-size: .85rem; font-weight: 600; color: var(--ink); }
.input, .field input, .field select, .field textarea {
  width: 100%; border: 1px solid #DCCDBB; border-radius: 10px;
  padding: .7rem .8rem; background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 70px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--red); box-shadow: 0 0 0 3px rgba(198, 40, 40, .15);
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.row.r-2-1 { grid-template-columns: 2fr 1fr; }

#toasts {
  position: fixed; left: 50%; top: 1rem; transform: translateX(-50%);
  display: grid; gap: .5rem; z-index: 1000; width: min(92vw, 420px);
  right: auto; bottom: auto; margin: 0; padding: 0; border: 0;
  background: transparent; color: inherit; overflow: visible; height: auto;
}
#toasts:popover-open { display: grid; }

/* Campo com erro (ex.: nome em branco no pedido) */
.field.has-error input, .field.has-error textarea, .field.has-error select {
  border-color: var(--red); box-shadow: 0 0 0 3px rgba(183, 28, 43, .15); background: #FFFAFA;
}
.field-error { color: var(--red); font-size: .82rem; font-weight: 600; margin-top: -.1rem; }
.field-error::before { content: '⚠ '; }
.toast {
  background: var(--ink); color: #fff; padding: .8rem 1rem; border-radius: 12px;
  box-shadow: var(--shadow); font-size: .95rem; animation: toastIn .2s ease-out;
  transition: opacity .3s, transform .3s;
}
.toast.error { background: var(--red-dark); }
.toast.success { background: var(--basil); }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }

dialog {
  border: 0; padding: 0; border-radius: 20px; background: var(--paper); color: var(--ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3); max-height: 92vh;
}
dialog::backdrop { background: rgba(30, 18, 12, .55); backdrop-filter: blur(2px); }

.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 600;
}
.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.empty .big { font-size: 2.5rem; display: block; margin-bottom: .5rem; }

:focus-visible { outline: 3px solid rgba(198, 40, 40, .45); outline-offset: 2px; }
