/* =====================================================================
   BASE · tokens, vidro, botões, campos, folhas e avisos
   Usado pela vitrine e pelo painel.
   ===================================================================== */
@font-face {
  font-family: "Geist";
  src: url("../fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --canvas: #eef0f4;
  --surface: #ffffff;
  --surface-2: #f5f6f8;
  --photo: #f1f2f5;
  --ink: #1d1d1f;
  --ink-2: #4a4c55;
  --ink-3: #7c7f8a;
  --line: rgba(29, 29, 31, .09);
  --line-strong: rgba(29, 29, 31, .16);

  --ok: #12a150;
  --ok-ink: #0b7a3b;
  --wa: #1fae5b;
  --wa-strong: #179a4f;
  --warn: #c77700;
  --warn-soft: #fff1d6;
  --danger: #e5383b;
  --danger-soft: #ffe5e5;

  --glass-bg: rgba(255, 255, 255, .58);
  --glass-bg-strong: rgba(255, 255, 255, .78);
  --glass-stroke: rgba(255, 255, 255, .7);
  --glass-rim-top: rgba(255, 255, 255, .95);
  --glass-rim-bottom: rgba(255, 255, 255, .35);
  --glass-shadow: 0 1px 1px rgba(20, 24, 40, .04), 0 10px 30px -8px rgba(20, 24, 40, .14);
  --blur: 22px;

  --shadow-card: 0 0 0 1px rgba(20, 24, 40, .05), 0 1px 2px rgba(20, 24, 40, .04), 0 8px 24px -12px rgba(20, 24, 40, .16);
  --shadow-pop: 0 0 0 1px rgba(20, 24, 40, .06), 0 24px 60px -16px rgba(20, 24, 40, .35);

  --r-xs: 10px;
  --r-sm: 14px;
  --r-md: 20px;
  --r-lg: 26px;
  --r-xl: 32px;

  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-in-out: cubic-bezier(.77, 0, .175, 1);
  --ease-drawer: cubic-bezier(.32, .72, 0, 1);

  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1360px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #0c0d10;
    --surface: #17181c;
    --surface-2: #1f2025;
    --photo: #e9eaee;
    --ink: #f5f5f7;
    --ink-2: #c4c6cf;
    --ink-3: #8d909b;
    --line: rgba(255, 255, 255, .09);
    --line-strong: rgba(255, 255, 255, .16);
    --glass-bg: rgba(30, 32, 38, .55);
    --glass-bg-strong: rgba(30, 32, 38, .78);
    --glass-stroke: rgba(255, 255, 255, .1);
    --glass-rim-top: rgba(255, 255, 255, .28);
    --glass-rim-bottom: rgba(255, 255, 255, .04);
    --glass-shadow: 0 1px 1px rgba(0, 0, 0, .3), 0 12px 32px -10px rgba(0, 0, 0, .6);
    --shadow-card: 0 0 0 1px rgba(255, 255, 255, .06), 0 10px 30px -14px rgba(0, 0, 0, .7);
    --shadow-pop: 0 0 0 1px rgba(255, 255, 255, .08), 0 30px 70px -20px rgba(0, 0, 0, .8);
    --warn: #ffb020;
    --warn-soft: rgba(255, 176, 32, .14);
    --danger-soft: rgba(229, 56, 59, .16);
    --ok-ink: #3fd07f;
  }
}
:root[data-theme="dark"] {
  --canvas: #0c0d10; --surface: #17181c; --surface-2: #1f2025; --photo: #e9eaee;
  --ink: #f5f5f7; --ink-2: #c4c6cf; --ink-3: #8d909b;
  --line: rgba(255, 255, 255, .09); --line-strong: rgba(255, 255, 255, .16);
  --glass-bg: rgba(30, 32, 38, .55); --glass-bg-strong: rgba(30, 32, 38, .78);
  --glass-stroke: rgba(255, 255, 255, .1); --glass-rim-top: rgba(255, 255, 255, .28); --glass-rim-bottom: rgba(255, 255, 255, .04);
  --glass-shadow: 0 1px 1px rgba(0, 0, 0, .3), 0 12px 32px -10px rgba(0, 0, 0, .6);
  --shadow-card: 0 0 0 1px rgba(255, 255, 255, .06), 0 10px 30px -14px rgba(0, 0, 0, .7);
  --shadow-pop: 0 0 0 1px rgba(255, 255, 255, .08), 0 30px 70px -20px rgba(0, 0, 0, .8);
  --warn: #ffb020; --warn-soft: rgba(255, 176, 32, .14); --danger-soft: rgba(229, 56, 59, .16); --ok-ink: #3fd07f;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  overflow-x: hidden;
}
img, video, 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; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { letter-spacing: -.022em; line-height: 1.12; font-weight: 640; text-wrap: balance; }
::selection { background: var(--brand); color: var(--brand-ink); }
:focus-visible { outline: 2.5px solid var(--brand); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- fundo com brilho (dá vida ao vidro) ---------- */
.ambient {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
  background: var(--canvas);
}
.ambient::before, .ambient::after, .ambient i {
  content: ""; position: absolute; border-radius: 50%; filter: blur(80px); opacity: .5;
}
.ambient::before { width: 60vmax; height: 60vmax; left: -18vmax; top: -22vmax; background: radial-gradient(closest-side, color-mix(in srgb, var(--brand) 55%, transparent), transparent); }
.ambient::after { width: 50vmax; height: 50vmax; right: -16vmax; top: 18vh; background: radial-gradient(closest-side, color-mix(in srgb, var(--brand-2) 45%, transparent), transparent); opacity: .38; }
.ambient i { width: 46vmax; height: 46vmax; left: 20vw; bottom: -26vmax; background: radial-gradient(closest-side, color-mix(in srgb, var(--brand-3) 50%, transparent), transparent); opacity: .35; }

/* ---------- vidro ---------- */
.glass {
  position: relative;
  isolation: isolate;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  box-shadow: var(--glass-shadow);
}
.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 1;
  background: linear-gradient(180deg, var(--glass-rim-top), var(--glass-rim-bottom) 38%, transparent 62%, var(--glass-rim-bottom));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}
.glass.strong { background: var(--glass-bg-strong); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--glass-bg-strong); }
}

/* ---------- botões ---------- */
.btn {
  --h: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 18px; border-radius: 999px;
  font-weight: 560; font-size: 15px; letter-spacing: -.005em; white-space: nowrap;
  transition: transform 160ms var(--ease-out), background-color 200ms ease, color 200ms ease, box-shadow 200ms ease, opacity 200ms ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-sm { --h: 36px; padding: 0 14px; font-size: 14px; }
.btn-lg { --h: 52px; padding: 0 24px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--brand) 80%, transparent); }
.btn-wa { background: var(--wa); color: #fff; box-shadow: 0 8px 20px -8px rgba(31, 174, 91, .7); }
.btn-dark { background: var(--ink); color: var(--canvas); }
.btn-soft { background: var(--brand-soft); color: var(--brand-strong); }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn-plain { background: transparent; color: var(--ink-2); padding: 0 10px; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-glass { color: var(--ink); }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: var(--brand-hover, var(--brand-strong)); }
  .btn-wa:hover { background: var(--wa-strong); }
  .btn-ghost:hover, .btn-plain:hover { background: var(--line); }
  .btn-soft:hover { background: color-mix(in srgb, var(--brand-soft) 80%, var(--brand) 12%); }
}
.btn[disabled], .btn.is-loading { opacity: .55; pointer-events: none; }
.btn.is-loading::after {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 999px; display: inline-grid; place-items: center; flex: none;
  color: var(--ink); transition: transform 160ms var(--ease-out), background-color 200ms ease;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:active { transform: scale(.94); }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { background: var(--line); } }

/* ---------- campos ---------- */
.field { display: grid; gap: 6px; }
.field > span, .label { font-size: 13px; font-weight: 560; color: var(--ink-2); }
.field small, .hint { font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 0 14px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink);
  font-size: 16px; /* evita zoom no iPhone */
  transition: border-color 160ms ease, box-shadow 160ms ease;
  -webkit-appearance: none; appearance: none;
}
.textarea { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.45; }
.select { padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%237c7f8a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input-wrap { position: relative; }
.input-wrap > svg { position: absolute; left: 13px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.input-wrap > .input { padding-left: 40px; }
.input-prefix { position: relative; }
.input-prefix > b { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-weight: 500; color: var(--ink-3); font-size: 15px; pointer-events: none; }
.input-prefix > .input { padding-left: 42px; }

/* chave liga/desliga estilo iOS */
.switch { position: relative; display: inline-flex; flex: none; width: 51px; height: 31px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i {
  position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong);
  transition: background-color 220ms ease;
}
.switch i::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2), 0 0 0 .5px rgba(0, 0, 0, .04);
  transition: transform 260ms var(--ease-out);
}
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 2.5px solid var(--brand); outline-offset: 2px; }

/* ---------- chips e controle segmentado ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px;
  font-size: 14px; font-weight: 520; white-space: nowrap; color: var(--ink-2);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
  transition: background-color 200ms ease, color 200ms ease, box-shadow 200ms ease, transform 160ms var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.chip:active { transform: scale(.96); }
.chip[aria-pressed="true"], .chip.is-on { background: var(--ink); color: var(--canvas); box-shadow: none; }
.chip .count { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.chip[aria-pressed="true"] .count { color: color-mix(in srgb, var(--canvas) 70%, transparent); }
@media (hover: hover) and (pointer: fine) { .chip:not([aria-pressed="true"]):hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); } }

.segmented {
  display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; gap: 2px;
  border-radius: 12px; background: var(--line); position: relative;
}
.segmented button {
  height: 32px; padding: 0 14px; border-radius: 9px; font-size: 14px; font-weight: 540; color: var(--ink-2);
  transition: background-color 200ms ease, color 200ms ease, box-shadow 200ms ease;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }

/* selos */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: .005em; white-space: nowrap;
}
.badge-ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok-ink); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-muted { background: var(--line); color: var(--ink-2); }
.badge-brand { background: var(--brand-soft); color: var(--brand-strong); }
.badge-dark { background: rgba(29, 29, 31, .78); color: #fff; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- folha (sheet) e janela ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: 80; background: rgba(10, 12, 18, .38);
  opacity: 0; transition: opacity 260ms ease;
}
.backdrop.is-open { opacity: 1; }
.sheet {
  position: fixed; z-index: 90; left: 0; right: 0; bottom: 0;
  max-height: calc(100dvh - 18px); display: flex; flex-direction: column;
  border-radius: 28px 28px 0 0; background: var(--surface);
  box-shadow: var(--shadow-pop);
  transform: translateY(105%);
  transition: transform 460ms var(--ease-drawer);
  overscroll-behavior: contain;
}
.sheet.is-open { transform: translateY(0); }
.sheet:focus { outline: none; }
.sheet.is-dragging { transition: none; }
.sheet-grabber { flex: none; display: grid; place-items: center; height: 22px; cursor: grab; touch-action: none; }
.sheet-grabber::before { content: ""; width: 38px; height: 5px; border-radius: 3px; background: var(--line-strong); }
.sheet-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 4px 16px 12px 22px; touch-action: none; }
.sheet-head h2 { font-size: 20px; flex: 1; min-width: 0; }
.sheet-body { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; padding: 0 22px 24px; overscroll-behavior: contain; }
.sheet-foot { flex: none; display: flex; gap: 10px; padding: 12px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }

@media (min-width: 820px) {
  .sheet.as-modal {
    left: 50%; top: 50%; bottom: auto; right: auto; width: min(var(--modal-w, 640px), calc(100vw - 48px));
    max-height: min(880px, calc(100dvh - 48px)); border-radius: var(--r-xl);
    transform: translate(-50%, -48%) scale(.97); opacity: 0;
    transition: transform 280ms var(--ease-out), opacity 200ms ease;
  }
  .sheet.as-modal.is-open { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  .sheet.as-modal .sheet-grabber { display: none; }
  .sheet.as-modal .sheet-head { padding-top: 18px; }
  .sheet.as-drawer {
    left: auto; top: 12px; bottom: 12px; right: 12px; width: min(var(--drawer-w, 560px), calc(100vw - 24px));
    max-height: none; border-radius: var(--r-xl);
    transform: translateX(calc(100% + 24px));
    transition: transform 420ms var(--ease-drawer);
  }
  .sheet.as-drawer.is-open { transform: translateX(0); }
  .sheet.as-drawer .sheet-grabber { display: none; }
  .sheet.as-drawer .sheet-head { padding-top: 18px; }
  .sheet.as-drawer .sheet-foot { border-radius: 0 0 var(--r-xl) var(--r-xl); }
}

/* ---------- avisos (toast) ---------- */
.toasts { position: fixed; z-index: 200; left: 50%; top: calc(12px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 18px; font-size: 14.5px; font-weight: 520;
  pointer-events: auto; opacity: 1; transform: translateY(0) scale(1);
  transition: opacity 260ms ease, transform 360ms var(--ease-out);
}
@starting-style { .toast { opacity: 0; transform: translateY(-14px) scale(.97); } }
.toast.is-leaving { opacity: 0; transform: translateY(-10px) scale(.97); transition-duration: 180ms; }
.toast svg { width: 20px; height: 20px; flex: none; }
.toast.ok svg { color: var(--ok); }
.toast.err svg { color: var(--danger); }

/* ---------- carregando ---------- */
.skeleton { background: linear-gradient(100deg, var(--line) 30%, color-mix(in srgb, var(--line) 40%, transparent) 50%, var(--line) 70%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .sheet, .sheet.as-modal, .sheet.as-drawer { transition: opacity 200ms ease !important; }
  .sheet:not(.is-open) { opacity: 0; }
}
