/* ==========================================================================
   K&D — DESIGN SYSTEM
   --------------------------------------------------------------------------
   Base única compartilhada pelo site, pelo álbum e pelo painel.
   Tudo o que é cor, tipo, espaço, raio, sombra e estado mora aqui.
   As páginas só montam layout em cima destes componentes.

   Identidade: verde-floresta profundo + latão + linho.
   Tipos: Fraunces (títulos, com eixo SOFT para um serifado mais macio),
          Manrope (interface), Great Vibes (apenas o monograma).
   ========================================================================== */

:root {
  /* ── Paleta base ─────────────────────────────────────── */
  --forest-950: #0e1813;
  --forest-900: #14201a;
  --forest-800: #1b2b23;
  --forest-700: #243a2f;
  --forest-600: #335244;
  --sage-400:   #8fa395;
  --sage-200:   #cdd6cc;
  --brass-600:  #8f7038;
  --brass-500:  #b08d4c;
  --brass-400:  #c9ab70;
  --brass-200:  #e8dbbb;
  --linen-50:   #faf8f3;
  --linen-100:  #f4f0e6;
  --linen-200:  #e9e3d4;
  --linen-300:  #d9d1bd;
  --ink-900:    #18211c;
  --ink-700:    #3a463f;
  --ink-500:    #66706a;

  /* ── Semânticas ──────────────────────────────────────── */
  --success-600: #2f6b4a;  --success-100: #e2efe6;
  --warning-600: #9a6a17;  --warning-100: #f6ecd6;
  --danger-600:  #a13a3a;  --danger-100:  #f6e1df;
  --info-600:    #36597a;  --info-100:    #e1e9f1;

  /* ── Papéis (tema claro, padrão) ─────────────────────── */
  --bg:            var(--linen-100);
  --surface:       #ffffff;
  --surface-2:     var(--linen-50);
  --surface-3:     var(--linen-200);
  --text:          var(--ink-900);
  --text-2:        var(--ink-700);
  --text-3:        var(--ink-500);
  --line:          rgba(24, 33, 28, .12);
  --line-strong:   rgba(24, 33, 28, .22);
  --accent:        var(--brass-500);
  --accent-strong: var(--brass-600);
  --accent-soft:   var(--brass-200);
  --brand:         var(--forest-900);
  --brand-hover:   var(--forest-700);
  --on-brand:      var(--linen-50);
  --focus:         var(--brass-500);

  /* ── Tipografia ──────────────────────────────────────── */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-ui:      "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-script:  "Great Vibes", "Segoe Script", cursive;

  /* escala modular 1.25 (terça maior) a partir de 16px */
  --fs-xs:  .75rem;
  --fs-sm:  .875rem;
  --fs-md:  1rem;
  --fs-lg:  1.125rem;
  --fs-xl:  1.25rem;
  --fs-2xl: 1.5625rem;
  --fs-3xl: 1.953rem;
  --fs-4xl: 2.441rem;
  --fs-5xl: clamp(2.6rem, 6vw, 3.815rem);
  --fs-hero: clamp(3.4rem, 12vw, 8.5rem);

  /* ── Espaço (base 4) ─────────────────────────────────── */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px; --sp-20: 80px; --sp-24: 96px;
  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1120px;

  /* ── Raio: hierarquia, não um valor único ────────────── */
  --r-xs: 6px;    /* chips, badges */
  --r-sm: 10px;   /* inputs, botões */
  --r-md: 16px;   /* cards */
  --r-lg: 24px;   /* sheets, modais */
  --r-full: 999px;

  /* ── Sombras (tingidas de verde, nunca cinza neutro) ── */
  --sh-1: 0 1px 2px rgba(14, 24, 19, .06), 0 1px 1px rgba(14, 24, 19, .04);
  --sh-2: 0 2px 4px rgba(14, 24, 19, .05), 0 10px 24px -6px rgba(14, 24, 19, .12);
  --sh-3: 0 24px 64px -12px rgba(14, 24, 19, .35);

  /* ── Movimento ───────────────────────────────────────── */
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --t-fast: 140ms;
  --t-base: 220ms;
  --t-slow: 420ms;

  --tap: 44px; /* alvo de toque mínimo */
}

/* Tema escuro para seções / páginas inteiras (álbum, hero) */
.theme-dark {
  --bg:          var(--forest-900);
  --surface:     var(--forest-800);
  --surface-2:   var(--forest-700);
  --surface-3:   var(--forest-600);
  --text:        var(--linen-50);
  --text-2:      rgba(250, 248, 243, .78);
  --text-3:      rgba(250, 248, 243, .56);
  --line:        rgba(250, 248, 243, .12);
  --line-strong: rgba(250, 248, 243, .24);
  --accent:        var(--brass-400);
  --accent-strong: var(--brass-200);
  --accent-soft:   rgba(201, 171, 112, .16);
  --brand:       var(--brass-400);
  --brand-hover: var(--brass-200);
  --on-brand:    var(--forest-950);
  --focus:       var(--brass-400);
  --success-100: rgba(76, 160, 110, .18);  --success-600: #8fd3a8;
  --warning-100: rgba(214, 160, 60, .18);  --warning-600: #e9c27a;
  --danger-100:  rgba(220, 90, 90, .18);   --danger-600:  #f0a3a3;
  color: var(--text);
}

/* ==========================================================================
   RESET
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 450;
  font-variation-settings: "SOFT" 60, "WONK" 0;
  line-height: 1.12;
  letter-spacing: -.01em;
  text-wrap: balance;
}
p { margin: 0; text-wrap: pretty; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

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

.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;
}
.skip-link {
  position: fixed; left: var(--sp-4); top: -60px; z-index: 1000;
  background: var(--brand); color: var(--on-brand);
  padding: var(--sp-2) var(--sp-4); border-radius: var(--r-sm);
  transition: top var(--t-base) var(--ease-out);
}
.skip-link:focus { top: var(--sp-4); }

/* ==========================================================================
   TIPOGRAFIA UTILITÁRIA
   ========================================================================== */
.t-display { font-family: var(--font-display); font-variation-settings: "SOFT" 100; }
.t-kicker {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--fs-lg);
  color: var(--accent-strong);
  font-variation-settings: "SOFT" 100;
}
.theme-dark .t-kicker { color: var(--accent); }
.t-muted { color: var(--text-3); }
.t-small { font-size: var(--fs-sm); }
.t-num { font-variant-numeric: tabular-nums lining-nums; }

.monogram {
  font-family: var(--font-script);
  line-height: 1;
  white-space: nowrap;
}
.mono-amp {
  font-family: var(--font-script);
  color: var(--accent);
  font-size: .62em;
  margin: 0 .06em;
  vertical-align: .12em;
}

/* ==========================================================================
   ÍCONES
   ========================================================================== */
.icon {
  width: 20px; height: 20px; flex: none;
  stroke: currentColor; fill: none; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 24px; height: 24px; }
.icon--xl { width: 32px; height: 32px; stroke-width: 1.5; }

/* ==========================================================================
   BOTÕES
   --------------------------------------------------------------------------
   .btn                → primário (cor da marca)
   .btn--accent        → ação de destaque (latão)
   .btn--secondary     → contorno
   .btn--ghost         → sem borda
   .btn--danger        → destrutivo
   .btn--sm / --lg / --block / --icon
   [aria-busy="true"]  → estado de carregamento (spinner + bloqueio)
   ========================================================================== */
.btn {
  --btn-bg: var(--brand);
  --btn-fg: var(--on-brand);
  --btn-bd: transparent;
  --btn-bg-hover: var(--brand-hover);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--tap);
  padding: 0 var(--sp-5);
  border: 1px solid var(--btn-bd);
  border-radius: var(--r-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 650;
  font-size: var(--fs-sm);
  letter-spacing: .01em;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast),
              color var(--t-fast), transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast);
}
.btn:hover { background: var(--btn-bg-hover); }
.btn:active { transform: scale(.97); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: .45; cursor: not-allowed; transform: none;
}
.btn--accent { --btn-bg: var(--brass-500); --btn-fg: var(--forest-950); --btn-bg-hover: var(--brass-400); }
.btn--secondary {
  --btn-bg: transparent; --btn-fg: var(--text); --btn-bd: var(--line-strong);
  --btn-bg-hover: color-mix(in srgb, var(--text) 6%, transparent);
}
.btn--ghost {
  --btn-bg: transparent; --btn-fg: var(--text-2);
  --btn-bg-hover: color-mix(in srgb, var(--text) 7%, transparent);
}
.btn--danger { --btn-bg: var(--danger-600); --btn-fg: #fff; --btn-bg-hover: #8a2f2f; }
.btn--danger-ghost { --btn-bg: transparent; --btn-fg: var(--danger-600); --btn-bg-hover: var(--danger-100); }
.btn--sm { min-height: 34px; padding: 0 var(--sp-3); font-size: var(--fs-xs); border-radius: 8px; }
.btn--lg { min-height: 54px; padding: 0 var(--sp-6); font-size: var(--fs-md); border-radius: 14px; }
.btn--block { width: 100%; }
.btn--icon { padding: 0; width: var(--tap); }
.btn--icon.btn--sm { width: 34px; }

.btn[aria-busy="true"] { color: transparent !important; pointer-events: none; }
.btn[aria-busy="true"] > * { visibility: hidden; }
.btn[aria-busy="true"]::after {
  content: ""; position: absolute; width: 18px; height: 18px;
  border: 2px solid var(--btn-fg); border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.link-btn {
  background: none; border: 0; padding: 0;
  color: var(--accent-strong); font-weight: 600; font-size: inherit;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.link-btn:hover { color: var(--text); }

/* ==========================================================================
   FORMULÁRIOS
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label {
  font-size: var(--fs-sm); font-weight: 600; color: var(--text);
  display: flex; align-items: baseline; gap: var(--sp-2);
}
.field__opt { font-weight: 500; color: var(--text-3); font-size: var(--fs-xs); }
.field__hint { font-size: var(--fs-xs); color: var(--text-3); line-height: 1.45; }
.field__error { font-size: var(--fs-xs); color: var(--danger-600); font-weight: 600; display: none; }
.field.is-invalid .field__error { display: block; }

.input, .select, .textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 16px; /* evita zoom no iOS */
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  -webkit-appearance: none; appearance: none;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); opacity: .8; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}
.input:disabled, .select:disabled, .textarea:disabled { opacity: .55; cursor: not-allowed; }
.field.is-invalid .input, .field.is-invalid .textarea, .field.is-invalid .select,
.input[aria-invalid="true"] {
  border-color: var(--danger-600);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger-600) 14%, transparent);
}
.select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2366706a' 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; background-size: 18px;
}
.input-group { position: relative; display: flex; align-items: center; }
.input-group__prefix {
  position: absolute; left: 14px; color: var(--text-3); font-weight: 600; pointer-events: none;
}
.input-group .input { padding-left: 44px; }

/* checkbox / radio nativos estilizados */
.check {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  cursor: pointer; font-size: var(--fs-sm); line-height: 1.45;
}
.check input {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 20px; height: 20px; margin: 1px 0 0;
  border: 1.5px solid var(--line-strong); border-radius: 6px;
  background: var(--surface); display: grid; place-content: center;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.check input[type="radio"] { border-radius: 50%; }
.check input::after {
  content: ""; width: 10px; height: 10px; transform: scale(0);
  transition: transform var(--t-fast) var(--ease-out);
  background: var(--on-brand);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
.check input[type="radio"]::after { clip-path: circle(50%); width: 8px; height: 8px; }
.check input:checked { background: var(--brand); border-color: var(--brand); }
.check input:checked::after { transform: scale(1); }

/* toggle (switch) */
.toggle { display: inline-flex; align-items: center; gap: var(--sp-3); cursor: pointer; font-size: var(--fs-sm); }
.toggle input {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 44px; height: 26px; border-radius: var(--r-full);
  background: var(--surface-3); position: relative; margin: 0;
  transition: background var(--t-base) var(--ease-out);
}
.toggle input::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: var(--sh-1);
  transition: transform var(--t-base) var(--ease-out);
}
.toggle input:checked { background: var(--success-600); }
.toggle input:checked::after { transform: translateX(18px); }

/* controle segmentado (radio em pílulas) */
.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 4px; gap: 4px;
  background: var(--surface-3);
  border-radius: 12px;
}
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 42px; padding: 0 var(--sp-3);
  border-radius: 9px; font-weight: 600; font-size: var(--fs-sm);
  color: var(--text-2); cursor: pointer; text-align: center;
  transition: background var(--t-base) var(--ease-out), color var(--t-fast), box-shadow var(--t-base);
}
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }

/* stepper de quantidade */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.stepper button { width: 40px; height: 40px; border: 0; background: transparent; display: grid; place-content: center; }
.stepper button:hover { background: var(--surface-2); }
.stepper output { min-width: 32px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ==========================================================================
   CARD / SUPERFÍCIES
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
}
.card--pad { padding: clamp(var(--sp-5), 3vw, var(--sp-8)); }
.card--interactive { transition: transform var(--t-base) var(--ease-out), box-shadow var(--t-base), border-color var(--t-base); }
.card--interactive:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--line-strong); }

/* ==========================================================================
   BADGES / CHIPS / PILLS
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-xs);
  font-size: var(--fs-xs); font-weight: 650; line-height: 1.3;
  background: var(--surface-3); color: var(--text-2);
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge--plain::before { display: none; }
.badge--success { background: var(--success-100); color: var(--success-600); }
.badge--warning { background: var(--warning-100); color: var(--warning-600); }
.badge--danger  { background: var(--danger-100);  color: var(--danger-600); }
.badge--info    { background: var(--info-100);    color: var(--info-600); }
.badge--accent  { background: var(--accent-soft); color: var(--accent-strong); }

.chip {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: 36px; padding: 0 var(--sp-4);
  border: 1px solid var(--line-strong); border-radius: var(--r-full);
  background: var(--surface); color: var(--text-2);
  font-size: var(--fs-sm); font-weight: 600; white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.chip:hover { border-color: var(--text-3); color: var(--text); }
/* chips de opção (role="radio") marcam com aria-checked — antes só o leitor de tela via (QA C1-R) */
.chip[aria-pressed="true"], .chip[aria-checked="true"], .chip.is-active {
  background: var(--brand); border-color: var(--brand); color: var(--on-brand);
}
.chip__count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-full);
  background: color-mix(in srgb, currentColor 14%, transparent);
  font-size: 11px; display: grid; place-content: center; font-variant-numeric: tabular-nums;
}
.chip-row { display: flex; gap: var(--sp-2); overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chip-row::-webkit-scrollbar { display: none; }

/* ==========================================================================
   ALERTAS / BANNERS
   ========================================================================== */
.alert {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: var(--fs-sm); line-height: 1.5;
}
.alert .icon { margin-top: 1px; }
.alert--success { background: var(--success-100); border-color: transparent; color: var(--success-600); }
.alert--warning { background: var(--warning-100); border-color: transparent; color: var(--warning-600); }
.alert--danger  { background: var(--danger-100);  border-color: transparent; color: var(--danger-600); }
.alert--info    { background: var(--info-100);    border-color: transparent; color: var(--info-600); }
.alert strong { color: inherit; }

/* ==========================================================================
   PROGRESSO / SPINNER / SKELETON
   ========================================================================== */
.progress {
  height: 6px; border-radius: var(--r-full);
  background: var(--surface-3); overflow: hidden;
}
.progress > span {
  display: block; height: 100%; width: 0;
  background: var(--accent);
  border-radius: inherit;
  transition: width var(--t-slow) var(--ease-out);
}
.progress--success > span { background: var(--success-600); }
.progress--warning > span { background: var(--warning-600); }
.progress--danger > span  { background: var(--danger-600); }

.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--line-strong); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.spinner--lg { width: 32px; height: 32px; border-width: 3px; }

.skeleton {
  position: relative; overflow: hidden;
  background: var(--surface-3); border-radius: var(--r-sm);
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s var(--ease-in-out) infinite;
}
.theme-dark .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent); }
@keyframes shimmer { to { transform: translateX(100%); } }

/* ==========================================================================
   ESTADO VAZIO
   ========================================================================== */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: var(--sp-3); padding: var(--sp-10) var(--sp-6);
  color: var(--text-2);
}
.empty__art {
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-content: center;
  background: var(--accent-soft); color: var(--accent-strong);
}
.empty__title { font-family: var(--font-display); font-size: var(--fs-xl); color: var(--text); }
.empty__text { max-width: 42ch; font-size: var(--fs-sm); }

/* ==========================================================================
   AVATAR
   ========================================================================== */
.avatar {
  --size: 40px;
  width: var(--size); height: var(--size); flex: none;
  border-radius: 50%; overflow: hidden;
  display: grid; place-content: center;
  background: var(--accent-soft); color: var(--accent-strong);
  font-family: var(--font-display); font-weight: 500;
  font-size: calc(var(--size) * .42);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ==========================================================================
   MODAL + SHEET
   --------------------------------------------------------------------------
   .overlay > .modal       → centralizado no desktop
   .overlay > .modal.sheet → no celular vira "bottom sheet"
   Abrir: remover [hidden] do .overlay. Fechar: adicionar.
   ========================================================================== */
.overlay {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-4);
  background: rgba(10, 18, 14, .58);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: fade-in var(--t-base) var(--ease-out);
}
.modal {
  position: relative;
  width: min(100%, 520px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  animation: pop-in var(--t-slow) var(--ease-out);
}
.modal--wide { width: min(100%, 760px); }
.modal__head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-6) var(--sp-4);
  background: var(--surface);
}
.modal__title { font-size: var(--fs-2xl); flex: 1; }
.modal__body { padding: 0 var(--sp-6) var(--sp-6); }
.modal__foot {
  position: sticky; bottom: 0;
  display: flex; gap: var(--sp-3); justify-content: flex-end;
  padding: var(--sp-4) var(--sp-6);
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.modal__close {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-content: center; flex: none;
  background: var(--surface-2); border: 0; color: var(--text-2);
  transition: background var(--t-fast);
}
.modal__close:hover { background: var(--surface-3); color: var(--text); }
.sheet__grip { display: none; }

@media (max-width: 640px) {
  .overlay--sheet { align-items: flex-end; padding: 0; }
  .overlay--sheet .modal {
    width: 100%;
    max-height: 92dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation: sheet-up var(--t-slow) var(--ease-out);
  }
  .overlay--sheet .sheet__grip {
    display: block; width: 40px; height: 4px; border-radius: 4px;
    background: var(--line-strong); margin: 10px auto 0;
  }
  .modal__head { padding: var(--sp-4) var(--sp-5) var(--sp-3); }
  .modal__body { padding: 0 var(--sp-5) var(--sp-5); }
  .modal__foot { padding: var(--sp-3) var(--sp-5) calc(var(--sp-3) + env(safe-area-inset-bottom)); }
}

@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes sheet-up { from { transform: translateY(100%); } }

/* ==========================================================================
   TOASTS (feedback após ações)
   ========================================================================== */
.toast-stack {
  position: fixed; z-index: 900;
  left: 50%; bottom: calc(var(--sp-6) + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  width: min(calc(100% - 32px), 440px);
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%;
  padding: 12px 14px 12px 16px;
  border-radius: 14px;
  background: var(--forest-950); color: var(--linen-50);
  box-shadow: var(--sh-3);
  font-size: var(--fs-sm); font-weight: 550;
  pointer-events: auto;
  animation: toast-in var(--t-slow) var(--ease-out);
}
.toast.is-leaving { animation: toast-out var(--t-base) var(--ease-in-out) forwards; }
.toast__icon { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-content: center; }
.toast--success .toast__icon { background: #4f9a6f; }
.toast--error .toast__icon { background: #c75a5a; }
.toast--info .toast__icon { background: var(--brass-500); }
.toast__msg { flex: 1; }
.toast__action {
  background: none; border: 0; color: var(--brass-400); font-weight: 700;
  padding: 6px 8px; border-radius: 8px;
}
.toast__action:hover { background: rgba(255,255,255,.08); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
/* no celular os avisos ficam no topo — embaixo moram os botões principais */
@media (max-width: 640px) {
  .toast-stack { bottom: auto; top: calc(var(--sp-3) + env(safe-area-inset-top)); flex-direction: column-reverse; }
  .toast { animation-name: toast-in-top; }
  @keyframes toast-in-top { from { opacity: 0; transform: translateY(-16px) scale(.96); } }
}
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }

/* ==========================================================================
   TOOLTIP (CSS puro: [data-tip])
   ========================================================================== */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; left: 50%; bottom: calc(100% + 8px);
  transform: translate(-50%, 4px);
  padding: 6px 10px; border-radius: 8px;
  background: var(--forest-950); color: var(--linen-50);
  font-size: 12px; font-weight: 550; line-height: 1.3; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-fast), transform var(--t-fast) var(--ease-out);
  z-index: 20;
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
@media (hover: none) { [data-tip]::after { display: none; } }

/* ==========================================================================
   DROPDOWN / MENU
   ========================================================================== */
.menu {
  position: absolute; z-index: 50; min-width: 200px;
  padding: 6px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--sh-2);
  animation: pop-in var(--t-base) var(--ease-out);
}
.menu__item {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; min-height: 40px; padding: 0 var(--sp-3);
  border: 0; border-radius: 9px; background: none; text-align: left;
  font-size: var(--fs-sm); font-weight: 550; color: var(--text); text-decoration: none;
}
.menu__item:hover { background: var(--surface-2); }
.menu__item--danger { color: var(--danger-600); }

/* ==========================================================================
   TABELA
   ========================================================================== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.table th {
  position: sticky; top: 0;
  text-align: left; font-weight: 600; color: var(--text-3); font-size: var(--fs-xs);
  padding: 10px 16px; background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table th button { background: none; border: 0; padding: 0; color: inherit; font-weight: inherit; display: inline-flex; align-items: center; gap: 4px; }
.table th button:hover { color: var(--text); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ==========================================================================
   LIGHTBOX (visualizador de fotos em tela cheia)
   ========================================================================== */
.lightbox {
  position: fixed; inset: 0; z-index: 800;
  display: grid; grid-template-rows: auto 1fr auto;
  background: #080d0a;
  color: var(--linen-50);
  animation: fade-in var(--t-base) var(--ease-out);
  touch-action: pan-y;
}
.lightbox__bar {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: calc(var(--sp-3) + env(safe-area-inset-top)) var(--sp-4) var(--sp-3);
}
.lightbox__count { flex: 1; font-size: var(--fs-sm); color: rgba(250,248,243,.7); font-variant-numeric: tabular-nums; }
.lightbox__btn {
  width: var(--tap); height: var(--tap); border-radius: 50%;
  display: grid; place-content: center;
  background: rgba(255,255,255,.08); border: 0; color: inherit;
  text-decoration: none;
  transition: background var(--t-fast);
}
.lightbox__btn:hover { background: rgba(255,255,255,.16); }
.lightbox__stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 0 var(--sp-4); }
.lightbox__img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  border-radius: 6px;
  animation: lb-img var(--t-slow) var(--ease-out);
}
@keyframes lb-img { from { opacity: 0; transform: scale(.985); } }
.lightbox__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-content: center;
  background: rgba(255,255,255,.08); border: 0; color: inherit;
}
.lightbox__nav:hover { background: rgba(255,255,255,.16); }
.lightbox__nav--prev { left: var(--sp-4); }
.lightbox__nav--next { right: var(--sp-4); }
.lightbox__caption {
  padding: var(--sp-3) var(--sp-6) calc(var(--sp-5) + env(safe-area-inset-bottom));
  text-align: center; font-size: var(--fs-sm); color: rgba(250,248,243,.8); min-height: 52px;
}
@media (max-width: 640px) { .lightbox__nav { display: none; } }

/* ==========================================================================
   OFFLINE BANNER
   ========================================================================== */
.net-banner {
  position: fixed; left: 50%; top: calc(var(--sp-3) + env(safe-area-inset-top)); z-index: 950;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 8px 14px; border-radius: var(--r-full);
  background: #8a5d12; color: #fff;
  font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; max-width: calc(100% - 24px);
  box-shadow: var(--sh-2);
  animation: toast-in var(--t-slow) var(--ease-out);
}

/* ==========================================================================
   UTILITÁRIOS DE LAYOUT
   ========================================================================== */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.stack { display: flex; flex-direction: column; gap: var(--stack, var(--sp-4)); }
.row { display: flex; align-items: center; gap: var(--row, var(--sp-3)); }
.row--wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }
