/* Tokens e componentes compartilhados entre loja e painel */
:root {
  --black: #111111;
  --blue: #007bff;
  --blue-600: #0066d6;
  --blue-50: #eef5ff;
  --white: #ffffff;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --text: #111111;
  --muted: #5b6472;
  --subtle: #8a93a2;
  --border: #e5e8ed;
  --success: #15803d;
  --success-bg: #e9f8ef;
  --danger: #c62828;
  --danger-bg: #fdecec;
  --warning: #b45309;
  --warning-bg: #fff4e0;
  --whatsapp: #1fa855;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(17, 17, 17, .06);
  --shadow: 0 4px 18px rgba(17, 17, 17, .07);
  --shadow-lg: 0 16px 40px rgba(17, 17, 17, .14);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
p { margin: 0; }
svg.icon { width: 20px; height: 20px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
:focus-visible { outline: 3px solid rgba(0, 123, 255, .45); outline-offset: 2px; }

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px;
  border: 1px solid transparent; border-radius: 12px;
  font-weight: 600; font-size: 15px; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .05s, box-shadow .15s;
  white-space: nowrap;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: .55; }
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--blue-600); box-shadow: 0 6px 16px rgba(0, 123, 255, .28); }
.btn-dark { background: var(--black); color: var(--white); }
.btn-dark:hover:not(:disabled) { background: #2a2a2a; }
.btn-outline { background: var(--white); border-color: var(--border); color: var(--text); }
.btn-outline:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #fad6d6; }
.btn-whatsapp { background: var(--whatsapp); color: var(--white); }
.btn-whatsapp:hover:not(:disabled) { background: #178a45; box-shadow: 0 6px 16px rgba(31, 168, 85, .3); }
.btn-block { width: 100%; }
.btn-lg { min-height: 54px; font-size: 16px; border-radius: 14px; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; border-radius: 10px; }

/* Formulários */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .label { font-size: 14px; font-weight: 600; }
.field small { color: var(--muted); font-size: 13px; }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 14px;
  background: var(--white); border: 1px solid var(--border); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
  font-size: 16px; /* evita zoom automático no iOS */
}
.textarea { min-height: 90px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 123, 255, .14); }
.input.invalid, .select.invalid { border-color: var(--danger); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235b6472' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }
.form-grid { display: grid; gap: 14px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 15px; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }

/* Cartões e selos */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.badge-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.pill-success { background: var(--success-bg); color: var(--success); }
.pill-danger { background: var(--danger-bg); color: var(--danger); }
.pill-warning { background: var(--warning-bg); color: var(--warning); }
.pill-blue { background: var(--blue-50); color: var(--blue-600); }
.pill-gray { background: #eef0f3; color: #3f4753; }
.pill-dark { background: var(--black); color: var(--white); }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.alert-info { background: var(--blue-50); color: #0a4a91; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); }

/* Toast */
.toast-wrap { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 1000; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: var(--black); color: var(--white); border-radius: 12px; box-shadow: var(--shadow-lg);
  font-size: 14.5px; animation: toast-in .2s ease-out; pointer-events: auto;
}
.toast.error { background: var(--danger); }
.toast a { color: #7cb8ff; font-weight: 600; margin-left: auto; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Carregamento */
.skeleton { background: linear-gradient(90deg, #eceff3 25%, #f5f7fa 37%, #eceff3 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 12px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255, 255, 255, .4); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(17, 17, 17, .5); z-index: 900; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.modal {
  background: var(--white); width: 100%; max-width: 640px; max-height: 92vh; overflow: auto;
  border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg); animation: up .2s ease-out;
}
.modal-head { position: sticky; top: 0; background: var(--white); display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); z-index: 1; }
.modal-body { padding: 20px; }
.modal-foot { position: sticky; bottom: 0; background: var(--white); display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: .6; } }
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; padding: 24px; }
  .modal { border-radius: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
