/* ============================================================
   FALX · Design System — Fase 0
   Fonte única de tokens + primitivos (botões, nav items, ícones).
   Zero override de layout — só normaliza aparência.
   ============================================================ */

:root {
  /* Espaçamento (escala baseada em 4) */
  --ds-space-1: 4px;
  --ds-space-2: 8px;
  --ds-space-3: 12px;
  --ds-space-4: 16px;
  --ds-space-5: 24px;
  --ds-space-6: 32px;
  --ds-space-7: 48px;

  /* Radius — exatamente 4 valores */
  --ds-r-sm:   8px;
  --ds-r-md:   12px;
  --ds-r-lg:   20px;
  --ds-r-pill: 999px;

  /* Paleta derivada da estética escura já existente */
  --ds-ink:        oklch(0.985 0 0);
  --ds-ink-off:    oklch(0.955 0.005 90);   /* off-white premium (item #13) */
  --ds-ink-dim:    oklch(0.72 0.005 270);
  --ds-ink-mute:   oklch(0.55 0.005 270);
  --ds-bg:         oklch(0.13 0.005 270);
  --ds-surface:    oklch(0.165 0.006 270);
  --ds-hairline:   oklch(1 0 0 / 10%);
  --ds-hairline-2: oklch(1 0 0 / 18%);
  --ds-danger:     oklch(0.72 0.16 20);

  /* Sombras — no máximo 2 níveis */
  --ds-shadow-sm: 0 1px 2px oklch(0 0 0 / 20%);
  --ds-shadow-md: 0 8px 24px oklch(0 0 0 / 24%);

  /* Motion */
  --ds-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ============================================================
   BOTÕES — LINGUAGEM ÚNICA EDITORIAL
   2 variantes canônicas: primary (destaque) e secondary (ghost).
   Primary: cor quente âmbar/creme, label em Instrument Serif itálico
   quando `.ds-btn--lg` (contexto de CTA).
   Secondary: hairline transparente, sans, mesma altura/raio.
   Paleta alinhada com o popover de anexar (mogno/creme).
   ============================================================ */
.ds-btn {
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.005em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 40px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--ds-r-pill);
  background: transparent;
  color: var(--ds-ink);
  white-space: nowrap;
  transition:
    background 0.18s var(--ds-ease),
    border-color 0.18s var(--ds-ease),
    color 0.18s var(--ds-ease),
    box-shadow 0.18s var(--ds-ease),
    transform 0.12s var(--ds-ease);
  text-rendering: geometricPrecision;
}
.ds-btn > svg { flex: 0 0 auto; display: block; }
.ds-btn > .ds-btn__label { transform: translateY(-0.5px); }
.ds-btn:focus-visible {
  outline: 1px solid oklch(0.82 0.032 55 / 55%);
  outline-offset: 3px;
}
.ds-btn:disabled,
.ds-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

/* Primary — CTA quente, single per contexto */
.ds-btn--primary {
  background: linear-gradient(180deg, oklch(0.96 0.028 78) 0%, oklch(0.92 0.032 72) 100%);
  color: oklch(0.20 0.028 44);
  border-color: oklch(0.86 0.030 68 / 70%);
  box-shadow:
    inset 0 1px 0 oklch(1 0 0 / 55%),
    0 12px 28px -14px oklch(0.10 0.020 44 / 55%);
}
.ds-btn--primary:hover {
  background: linear-gradient(180deg, oklch(0.98 0.026 80) 0%, oklch(0.94 0.030 74) 100%);
  border-color: oklch(0.88 0.032 68 / 90%);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 oklch(1 0 0 / 65%),
    0 18px 36px -14px oklch(0.10 0.020 44 / 62%);
}
.ds-btn--primary:active { transform: translateY(0); }

/* Secondary — hairline ghost, mesma altura/raio */
.ds-btn--secondary {
  background: transparent;
  color: oklch(0.94 0.010 70);
  border-color: oklch(0.82 0.032 55 / 32%);
}
.ds-btn--secondary:hover {
  background: oklch(0.82 0.032 55 / 8%);
  border-color: oklch(0.82 0.032 55 / 52%);
  color: oklch(0.98 0.010 70);
}

/* Label editorial — em CTAs grandes (destaque), o texto vira serifada itálica.
   Aplicado só a primary+lg pra não poluir botões utilitários. */
.ds-btn--primary.ds-btn--lg > .ds-btn__label,
.ds-btn--primary.ds-btn--editorial > .ds-btn__label {
  font-family: "Instrument Serif", "Playfair Display", ui-serif, Georgia, serif;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
  font-size: 1.08em;
  transform: translateY(-1px);
}

/* Danger — texto vermelho sobre fundo transparente */
.ds-btn--danger {
  background: transparent;
  color: var(--ds-danger);
  border-color: transparent;
}
.ds-btn--danger:hover {
  background: color-mix(in oklab, var(--ds-danger) 8%, transparent);
}

/* Sizes */
.ds-btn--sm { height: 32px; padding: 0 14px; font-size: 12.5px; gap: 6px; }
.ds-btn--lg { height: 50px; padding: 0 28px; font-size: 15px; gap: 12px; }

/* Ícone dentro do botão */
.ds-btn svg { width: 16px; height: 16px; stroke-width: 1.5; }
.ds-btn--sm svg { width: 14px; height: 14px; }
.ds-btn--lg svg { width: 18px; height: 18px; }

/* ============================================================
   ALIAS de compatibilidade — mapeia classes antigas pra nova linguagem,
   pra que o resto do app herde o novo visual sem edit em cada callsite.
   ============================================================ */
.falx-cta-white {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 30px;
  height: 52px;
  border-radius: var(--ds-r-pill);
  background: oklch(0.97 0 0);
  color: var(--ds-bg);
  border: 1px solid oklch(1 0 0 / 18%);
  font-family: inherit;
  font-style: normal;
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.01em;
  box-shadow:
    inset 0 1px 0 oklch(1 0 0 / 55%),
    0 10px 28px -12px oklch(0 0 0 / 45%);
  transition:
    background 0.2s var(--ds-ease),
    transform 0.15s var(--ds-ease),
    box-shadow 0.2s var(--ds-ease);
  cursor: pointer;
  text-decoration: none;
}
.falx-cta-white:hover {
  background: oklch(1 0 0);
  transform: translateY(-1.5px);
  box-shadow:
    inset 0 1px 0 oklch(1 0 0 / 65%),
    0 16px 36px -12px oklch(0 0 0 / 55%);
}
.falx-cta-white:active { transform: translateY(0); }
.falx-cta-white:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.falx-cta-white span { opacity: 0.75; transition: transform 0.2s var(--ds-ease), opacity 0.2s var(--ds-ease); }
.falx-cta-white:hover span { transform: translateX(2px); opacity: 1; }

.falx-cta-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 24px;
  height: 50px;
  border-radius: var(--ds-r-pill);
  background: transparent;
  color: oklch(0.94 0.010 70);
  border: 1px solid oklch(0.82 0.032 55 / 32%);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.005em;
  transition: all 0.2s var(--ds-ease);
  cursor: pointer;
  text-decoration: none;
}
.falx-cta-ghost:hover {
  background: oklch(0.82 0.032 55 / 8%);
  border-color: oklch(0.82 0.032 55 / 52%);
  color: oklch(0.98 0.010 70);
}


/* ============================================================
   NAV ITEM — primitivo único para itens da rail/menu lateral
   ============================================================ */
.ds-nav-item {
  appearance: none;
  cursor: pointer;
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--ds-r-sm);
  background: transparent;
  color: var(--ds-ink-dim);
  position: relative;
  transition: background 0.14s var(--ds-ease), color 0.14s var(--ds-ease);
}
.ds-nav-item:hover { background: oklch(1 0 0 / 5%); color: var(--ds-ink); }
.ds-nav-item:focus-visible {
  outline: 2px solid var(--ds-hairline-2);
  outline-offset: 2px;
}
.ds-nav-item.is-active {
  color: var(--ds-ink);
  background: oklch(1 0 0 / 6%);
}
/* Barra indicadora à esquerda para o estado ativo */
.ds-nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  border-radius: 2px;
  background: var(--ds-ink);
}
.ds-nav-item svg { width: 20px; height: 20px; stroke-width: 1.5; }

/* ============================================================
   ÍCONES — normaliza peso/tamanho independente da fonte
   Todo SVG inline dentro de botões e nav herda stroke-width 1.5
   ============================================================ */
.ds-icon,
.ds-btn svg,
.ds-nav-item svg,
.dash-rail-icn svg,
.dash-secret-icn svg,
.dash-menu-btn svg,
.dash-icon-btn svg,
.dash-mod-close svg,
.dash-secret-close svg {
  stroke-width: 1.5;
}
.dash-rail-icn svg,
.dash-secret-icn svg { width: 20px; height: 20px; }

/* ============================================================
   BRIDGES — traduz classes legadas nas 3 variantes do DS
   sem precisar reescrever cada string HTML do dashboard.js
   ============================================================ */

/* .dash-quick (CTA cheio) → primary */
.dash-quick {
  all: unset;
  cursor: pointer;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--ds-r-md);
  background: var(--ds-ink-off);
  color: var(--ds-bg);
  border: 1px solid var(--ds-ink-off);
  box-shadow: none;
  transition: background 0.14s var(--ds-ease), transform 0.1s var(--ds-ease);
}
.dash-quick:hover {
  background: var(--ds-ink);
  border-color: var(--ds-ink);
  transform: translateY(-1px);
  box-shadow: none;
}
.dash-quick:active { transform: translateY(0); }
.dash-quick:focus-visible {
  outline: 2px solid var(--ds-hairline-2);
  outline-offset: 2px;
}

/* .dash-quick-outline / .dash-quick-ghost → secondary */
.dash-quick-outline,
.dash-quick-ghost {
  background: transparent;
  color: var(--ds-ink);
  border-color: var(--ds-hairline-2);
}
.dash-quick-outline:hover,
.dash-quick-ghost:hover {
  background: oklch(1 0 0 / 4%);
  border-color: var(--ds-ink-off);
}

/* .dash-forge-suggest-accept → secondary small */
.dash-forge-suggest-accept {
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--ds-r-md);
  border: 1px solid var(--ds-hairline-2);
  background: transparent;
  color: var(--ds-ink);
  flex: 0 0 auto;
  transition: background 0.14s var(--ds-ease), border-color 0.14s var(--ds-ease);
}
.dash-forge-suggest-accept:hover {
  background: oklch(1 0 0 / 4%);
  border-color: var(--ds-ink-off);
  opacity: 1;
}

/* .dash-forge-finish-pill → hierarquia progressiva
   .is-ghost      → accuracy < 40% (adormecido, não compete com o formulário)
   .is-secondary  → 40% ≤ accuracy < 75% (outline hairline)
   .is-primary    → accuracy ≥ 75% (CTA sólido, pulse 1x quando destrava) */
.dash-forge-finish-pill {
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  max-height: 40px;
  padding: 0 16px;
  border-radius: var(--ds-r-md);
  background: transparent;
  color: var(--ds-ink);
  border: 1px solid var(--ds-hairline-2);
  white-space: nowrap;
  flex: 0 0 auto;
  width: auto;
  max-width: min(100%, 280px);
  overflow: hidden;
  text-overflow: ellipsis;
  transition:
    background 0.18s var(--ds-ease),
    border-color 0.18s var(--ds-ease),
    color 0.18s var(--ds-ease),
    opacity 0.18s var(--ds-ease),
    transform 0.1s var(--ds-ease);
}
.dash-forge-finish-pill:hover {
  transform: translateY(-1px);
}
.dash-forge-finish-pill:active { transform: translateY(0); }

/* Tier ghost — adormecido enquanto o usuário preenche */
.dash-forge-finish-pill.is-ghost {
  height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
  color: var(--ds-ink-mute);
  border-color: transparent;
  background: transparent;
  opacity: 0.7;
}
.dash-forge-finish-pill.is-ghost:hover {
  opacity: 1;
  color: var(--ds-ink-dim);
  border-color: var(--ds-hairline);
  background: oklch(1 0 0 / 3%);
}

/* Tier secondary — visível, mas ainda secundário ao conteúdo */
.dash-forge-finish-pill.is-secondary {
  background: transparent;
  color: var(--ds-ink);
  border-color: var(--ds-hairline-2);
}
.dash-forge-finish-pill.is-secondary:hover {
  background: oklch(1 0 0 / 4%);
  border-color: var(--ds-ink-off);
}

/* Tier primary — destrava e vira CTA único */
.dash-forge-finish-pill.is-primary {
  background: var(--ds-ink-off);
  color: var(--ds-bg);
  border-color: var(--ds-ink-off);
}
.dash-forge-finish-pill.is-primary:hover {
  background: var(--ds-ink);
  border-color: var(--ds-ink);
}
.dash-forge-finish-pill.just-unlocked {
  animation: dsPulseUnlock 0.9s var(--ds-ease) 1;
}
@keyframes dsPulseUnlock {
  0%   { box-shadow: 0 0 0 0 oklch(from var(--ds-ink-off) l c h / 55%); }
  70%  { box-shadow: 0 0 0 10px oklch(from var(--ds-ink-off) l c h / 0%); }
  100% { box-shadow: 0 0 0 0 oklch(from var(--ds-ink-off) l c h / 0%); }
}

/* Microcopy ao lado do botão quando ele está no tier ghost */
.dash-forge-finish-hint {
  font-size: 11.5px;
  color: var(--ds-ink-mute);
  letter-spacing: 0.01em;
  margin-right: 4px;
  white-space: nowrap;
}
.dash-forge-finish-hint[hidden] { display: none; }

/* Sair — texto vermelho sobre fundo transparente (item #6) */
.dash-secret-item.dash-secret-danger {
  background: transparent;
  border-color: transparent;
}
.dash-secret-item.dash-secret-danger:hover {
  background: color-mix(in oklab, var(--ds-danger) 6%, transparent);
  border-color: transparent;
}
.dash-secret-danger .dash-secret-icn {
  background: transparent !important;
  border-color: transparent !important;
  color: var(--ds-danger);
}

/* Botão "Voltar" do checkout — agora com label + ícone */
.dash-checkout-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 36px;
  border-radius: var(--ds-r-md);
  font-size: 13px;
  color: var(--ds-ink-dim);
  border: 1px solid transparent;
  background: transparent;
}
.dash-checkout-back svg { width: 16px; height: 16px; stroke-width: 1.5; }
.dash-checkout-back:hover {
  color: var(--ds-ink);
  background: oklch(1 0 0 / 4%);
  border-color: var(--ds-hairline-2);
}
