/* ==========================================================================
   Vi no Japão · base compartilhada (tokens, componentes, arte dos produtos)
   ========================================================================== */

:root {
  --font-sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Shippori Mincho B1', 'Hiragino Mincho ProN', 'Yu Mincho', Georgia, serif;

  --bg: #FAF6EF;
  --surface: #FFFFFF;
  --surface-2: #F4EEE4;
  --surface-3: #EDE5D8;
  --line: #E7DED1;
  --line-strong: #D4C8B6;
  --text: #1B1714;
  --text-2: #4F4740;
  --muted: #7E746A;

  --accent: #BC002D;
  --accent-hover: #9E0026;
  --accent-soft: #FBE8EB;
  --accent-ink: #FFFFFF;
  --ink: #1B1714;
  --ink-text: #F7F2EA;

  --good: #1E7A46;   --good-soft: #E2F2E8;
  --warn: #965A00;   --warn-soft: #FCEFD9;
  --info: #2A5196;   --info-soft: #E4EBF7;
  --teal: #0F6E6A;   --teal-soft: #DDF1EF;
  --violet: #5B45B0; --violet-soft: #ECE8FA;
  --danger: #B42318; --danger-soft: #FDE7E4;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(27, 23, 20, .06);
  --shadow: 0 1px 2px rgba(27, 23, 20, .04), 0 10px 30px -12px rgba(27, 23, 20, .16);
  --shadow-lg: 0 30px 80px -20px rgba(27, 23, 20, .35);
  --ring: 0 0 0 3px rgba(188, 0, 45, .22);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; text-wrap: balance; }
p { margin: 0; }
.ic { flex: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- botões ---------- */
.btn {
  --h: 42px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 18px;
  border-radius: 999px;
  font-weight: 600; font-size: 14px; white-space: nowrap;
  border: 1px solid transparent;
  transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), transform .18s var(--ease), box-shadow .18s var(--ease);
  text-decoration: none;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-dark { background: var(--ink); color: var(--ink-text); }
.btn-dark:hover:not(:disabled) { background: #000; }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--text-2); }
.btn-soft { background: var(--surface-2); color: var(--text); }
.btn-soft:hover:not(:disabled) { background: var(--surface-3); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(.92); }
.btn-sm { --h: 34px; padding: 0 13px; font-size: 13px; }
.btn-lg { --h: 52px; padding: 0 26px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: var(--h); padding: 0; }
.btn-whats { background: #1FAF5A; color: #fff; }
.btn-whats:hover:not(:disabled) { background: #178F49; }

/* ---------- formulários ---------- */
.field { display: grid; gap: 6px; align-content: start; }
.field > span, .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field small, .hint { font-size: 12.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237E746A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .8; }
.input-group { display: flex; align-items: stretch; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text-2); font-weight: 600; font-size: 14px; }
.input-group .addon:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); border-right: 0; }
.input-group .addon:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: 0; }
.input-group .input:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group .input:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input.invalido { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(180, 35, 24, .14); }

/* segmentado */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; }
.seg button, .seg label { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg button[aria-pressed="true"], .seg label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }

/* interruptor */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .trilho { width: 38px; height: 22px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .2s var(--ease); flex: none; }
.switch .trilho::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s var(--ease); }
.switch input:checked + .trilho { background: var(--good); }
.switch input:checked + .trilho::after { transform: translateX(16px); }
.switch input:focus-visible + .trilho { box-shadow: var(--ring); }

/* ---------- etiquetas ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px;
  border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.sem-ponto::before { display: none; }
.tom-warn { background: var(--warn-soft); color: var(--warn); }
.tom-info { background: var(--info-soft); color: var(--info); }
.tom-teal { background: var(--teal-soft); color: var(--teal); }
.tom-violet { background: var(--violet-soft); color: var(--violet); }
.tom-good { background: var(--good-soft); color: var(--good); }
.tom-muted { background: var(--surface-2); color: var(--muted); }
.tom-accent { background: var(--accent-soft); color: var(--accent); }
.tom-danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- arte dos produtos (substitui fotos nos dados de exemplo) ---------- */
.arte, .arte-img {
  width: 100%; height: 100%;
  display: block;
}
.arte-img { object-fit: cover; background: var(--surface-2); }
.arte {
  position: relative;
  display: grid; place-items: center;
  overflow: hidden;
  isolation: isolate;
  container-type: inline-size;
  background-color: var(--arte, #E9E3D9);
  background-image:
    radial-gradient(120% 90% at 20% 0%, rgba(255, 255, 255, .55), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='24' viewBox='0 0 48 24'%3E%3Cg fill='none' stroke='%23000' stroke-opacity='.07' stroke-width='1.2'%3E%3Cpath d='M0 24a24 24 0 0 1 48 0M8 24a16 16 0 0 1 32 0M16 24a8 8 0 0 1 16 0'/%3E%3Cpath d='M-24 12a24 24 0 0 1 48 0M-16 12a16 16 0 0 1 32 0M-8 12a8 8 0 0 1 16 0'/%3E%3Cpath d='M24 12a24 24 0 0 1 48 0M32 12a16 16 0 0 1 32 0M40 12a8 8 0 0 1 16 0'/%3E%3C/g%3E%3C/svg%3E");
  background-size: auto, 48px 24px;
}
.arte-sol {
  position: absolute;
  width: 62%; aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .85), rgba(255, 255, 255, .35) 70%);
  box-shadow: inset 0 -10px 30px rgba(0, 0, 0, .04);
  z-index: -1;
}
.arte-emoji {
  font-size: 34cqi;
  line-height: 1;
  filter: drop-shadow(0 10px 14px rgba(40, 20, 10, .18));
  transform: translateY(2%);
  font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
}
.arte-jp {
  position: absolute; top: 9%; right: 8%;
  writing-mode: vertical-rl;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: max(9px, 7cqw);
  letter-spacing: .18em;
  color: rgba(27, 23, 20, .32);
}
.arte.mini .arte-jp { display: none; }
.arte.mini .arte-emoji { font-size: 46cqi; filter: none; }
.arte.mini .arte-sol { width: 74%; }

/* ---------- marca ---------- */
.marca { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.marca-selo {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent);
  display: grid; place-items: center;
  color: #fff;
  font-family: var(--font-display); font-weight: 800; font-size: 17px; line-height: 1;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12);
  flex: none;
}
.marca-nome { font-family: var(--font-display); font-weight: 800; font-size: 20px; letter-spacing: -.01em; line-height: 1; }
.marca-nome small { display: block; font-family: var(--font-sans); font-weight: 600; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }

/* ---------- diálogos (modal e gaveta) ---------- */
dialog { padding: 0; border: 0; color: var(--text); background: transparent; max-width: none; max-height: none; }
dialog::backdrop { background: rgba(20, 16, 12, .45); backdrop-filter: blur(3px); }
.modal {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  margin: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: auto;
  overscroll-behavior: contain;
}
.modal[open] { animation: modal-in .28s var(--ease); }
.modal.largo { width: min(980px, calc(100vw - 32px)); }
.gaveta {
  position: fixed; inset: 0 0 0 auto;
  width: min(520px, 100vw); height: 100dvh;
  margin: 0;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  display: none; flex-direction: column;
  overflow: hidden;
}
.gaveta[open] { display: flex; animation: gaveta-in .32s var(--ease); }
.gaveta.larga { width: min(980px, 100vw); }
.gaveta-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); flex: none; }
.gaveta-corpo { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 22px; }
.gaveta-rodape { display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface); flex: none; }
.fechar-x { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); }
.fechar-x:hover { background: var(--surface-2); color: var(--text); }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes gaveta-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- avisos (toasts) ---------- */
.toasts { position: fixed; z-index: 9999; right: 18px; bottom: 18px; display: grid; gap: 10px; width: min(380px, calc(100vw - 36px)); pointer-events: none; }
.toast {
  pointer-events: auto;
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start;
  padding: 14px 14px 14px 16px;
  background: #1B1714; color: #F7F2EA;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  animation: toast-in .35s var(--ease);
}
.toast.saindo { animation: toast-out .25s var(--ease) forwards; }
.toast .t-ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .12); }
.toast.ok .t-ic { background: #1E7A46; }
.toast.erro .t-ic { background: var(--danger); }
.toast.whats .t-ic { background: #1FAF5A; }
.toast strong { display: block; font-weight: 600; margin-bottom: 2px; }
.toast p { color: rgba(247, 242, 234, .75); font-size: 13px; }
.toast .bolha { margin-top: 8px; padding: 9px 11px; border-radius: 4px 12px 12px 12px; background: #DCF8C6; color: #111; font-size: 13px; line-height: 1.4; }
.toast .t-fechar { color: rgba(247, 242, 234, .6); width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.toast .t-fechar:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.toast .t-acao { margin-top: 10px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- selo de demonstração ---------- */
.demo-pill {
  position: fixed; z-index: 900; left: 50%; bottom: 16px; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px;
  background: rgba(27, 23, 20, .92); color: #F7F2EA;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  font-size: 12.5px; font-weight: 600;
  backdrop-filter: blur(8px);
}
.demo-pill .tag { padding: 0 10px 0 12px; color: rgba(247, 242, 234, .7); font-weight: 500; white-space: nowrap; }
.demo-pill a { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 999px; text-decoration: none; white-space: nowrap; color: rgba(247, 242, 234, .85); }
.demo-pill a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.demo-pill a[aria-current="page"] { background: #F7F2EA; color: #1B1714; }
@media (max-width: 560px) {
  .demo-pill .tag { display: none; }
  .demo-pill { bottom: 10px; }
  .toasts { bottom: 64px; right: 12px; width: calc(100vw - 24px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
