/* ==========================================================================
   Cuba — design system
   Tokens e componentes compartilhados por todas as páginas.
   Tema claro por padrão; `body.dark` troca os tokens, não os componentes.
   ========================================================================== */

:root {
  --bg: #fbfaf9;
  --surface: #ffffff;
  --sunken: #f5f2f4;
  --text: #191418;
  --muted: #6b6169;
  --faint: #a0959d;
  --border: #eae4e8;
  --border-strong: #d8ccd4;

  --accent: #a8174e;
  --accent-strong: #8c1241;
  --accent-soft: #fdeef3;
  --accent-border: #f7c2d4;
  --on-accent: #ffffff;

  --danger: #b91c1c;
  --danger-soft: #fef0ef;
  --danger-border: #f9caca;

  /* Verde só pro "✓ está" dos filtros: o acento é framboesa e brigaria com o vermelho do "✕". */
  --positive: #0f7a4f;
  --positive-soft: #e9f7f0;
  --positive-border: #b3e0c9;

  --amber: #b45309;
  --amber-soft: #fff5e6;
  --amber-border: #fadcab;

  --blue: #1d4ed8;
  --blue-soft: #eef3ff;
  --blue-border: #c3d4fb;

  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-full: 999px;

  --shadow-pop: 0 8px 24px rgba(28, 25, 23, 0.1), 0 2px 6px rgba(28, 25, 23, 0.06);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);

  --tap: 40px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body.dark {
  --bg: #1a1618;
  --surface: #241f22;
  --sunken: #201c1e;
  --text: #f5f2f3;
  --muted: #a9a0a4;
  --faint: #7b7276;
  --border: #362f33;
  --border-strong: #4a4045;

  --accent: #f2789f;
  --accent-strong: #f79ab7;
  --accent-soft: #2e1622;
  --accent-border: #4d2335;
  --on-accent: #1a0a11;

  --danger: #f08a85;
  --danger-soft: #2e1a1a;
  --danger-border: #4a2a28;

  --positive: #6fc79a;
  --positive-soft: #16271f;
  --positive-border: #2a4436;

  --amber: #e0a85c;
  --amber-soft: #2c2416;
  --amber-border: #4a3c24;

  --blue: #8fb4e8;
  --blue-soft: #1b2432;
  --blue-border: #2f3e55;

  --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ── Base ───────────────────────────────────────────────────────────────── */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  /* 76px = 56px da nav-top fixa + os mesmos 20px de respiro que já existiam. */
  padding: 76px 16px 48px;
  font-size: 0.95rem;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

/* ── Ícones ─────────────────────────────────────────────────────────────── */

/* Dimensionado em em pra acompanhar o texto do botão que o contém. */
.ico {
  width: 1.05em;
  height: 1.05em;
  flex-shrink: 0;
  vertical-align: -0.15em;
}

.ico-lg {
  width: 1.25em;
  height: 1.25em;
}

/* ── Header ─────────────────────────────────────────────────────────────── */

header {
  max-width: 1240px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-title,
.header-text {
  flex: 1;
  min-width: 0;
}

.header-title h1,
.header-text h1 {
  font-size: 1.45rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.header-title p,
.header-text p {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 3px;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

/* ── Botões ─────────────────────────────────────────────────────────────── */

.btn-theme,
.link-sabores,
.back-link,
.btn-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 0.85rem;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s;
}

.btn-theme {
  width: var(--tap);
  padding: 0;
  font-size: 1rem;
}

.btn-theme:hover,
.link-sabores:hover,
.back-link:hover,
.btn-copy:hover {
  background: var(--sunken);
  border-color: var(--border-strong);
}

.link-sabores {
  position: relative;
}

.btn-copy {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.78rem;
  margin-left: auto;
}

/* Ação primária */
.btn-inline,
.btn-create,
.btn-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 16px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--r-md);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.12s;
}

.btn-inline:hover,
.btn-create:hover,
.btn-save:hover {
  background: var(--accent-strong);
}

/* Ação secundária */
.btn-cancel,
.btn-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 0.78rem;
  font-weight: 550;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.btn-cancel:hover,
.btn-edit:hover {
  background: var(--sunken);
  color: var(--text);
  border-color: var(--border-strong);
}

/* Ação destrutiva */
.btn-del,
.btn-remove {
  color: var(--danger);
  border-color: var(--danger-border);
  background: var(--surface);
}

.btn-del:hover,
.btn-remove:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-del {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--danger-border);
  border-radius: var(--r-sm);
  font-size: 0.78rem;
  font-weight: 550;
}

/* ── Painéis ────────────────────────────────────────────────────────────── */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Páginas de coluna única (compras, catálogo, receitas…) — o index usa .grid e
   não precisa disso. Header e painéis têm que alinhar na mesma largura. */
body.estreito header,
body.estreito .panel {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

body.largo header,
body.largo .panel {
  max-width: 1240px;
  margin-left: auto;
  margin-right: auto;
}

body.estreito .panel,
body.largo .panel {
  margin-bottom: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.panel-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.badge,
.mini-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-full);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1;
}

.badge-ok {
  background: var(--positive-soft);
  color: var(--positive);
  border-color: var(--positive-border);
}

.mini-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--surface);
  border-width: 2px;
  font-size: 0.68rem;
  display: none;
}

/* ── Campos ─────────────────────────────────────────────────────────────── */

.sel-input,
.edit-input,
.add-form input,
.receita-sel {
  width: 100%;
  min-height: var(--tap);
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: 0.9rem;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.sel-input::placeholder,
.add-form input::placeholder {
  color: var(--faint);
}

.sel-input:focus,
.edit-input:focus,
.add-form input:focus,
.receita-sel:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.receita-sel {
  min-height: 34px;
  font-size: 0.8rem;
  cursor: pointer;
}

/* ── Autocomplete ───────────────────────────────────────────────────────── */

.inline-add {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.sel-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.sel-arrow {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  font-size: 0.6rem;
  pointer-events: none;
}

/* Mais largo que o campo: nome de sabor não cabe na coluna estreita do painel. */
.sel-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 240px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  z-index: 50;
  display: none;
  padding: 4px;
}

.sel-dropdown.open {
  display: block;
}

.sel-option,
.sel-create,
.sel-empty {
  padding: 10px 10px;
  border-radius: var(--r-sm);
  font-size: 0.87rem;
  cursor: pointer;
}

.sel-option:hover,
.sel-option.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.sel-create {
  color: var(--accent-strong);
  font-weight: 600;
  border-top: 1px solid var(--border);
  border-radius: 0;
  margin-top: 4px;
}

.sel-empty {
  color: var(--faint);
  cursor: default;
}

.qty-mini {
  display: flex;
  align-items: center;
  gap: 2px;
  height: var(--tap);
  padding: 0 4px;
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  flex-shrink: 0;
}

.qty-mini button {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  color: var(--accent-strong);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
}

.qty-mini button:hover {
  background: var(--accent-soft);
}

.qty-mini span {
  min-width: 20px;
  text-align: center;
  font-size: 0.87rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* ── Menu ───────────────────────────────────────────────────────────────── */

.menu-wrap {
  position: relative;
}

.menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  z-index: 60;
  display: none;
}

.menu-dropdown.open {
  display: block;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 11px;
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 0.87rem;
  font-weight: 500;
  text-decoration: none;
}

.menu-link:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

/* ── Navegação ──────────────────────────────────────────────────────────── */
/* Barra fixa no topo em qualquer largura, com todos os links (desktop). No
   mobile os links somem daqui: viram abas fixas embaixo (só as 3 mais usadas)
   e o resto fica atrás do botão "Mais". Tudo position:fixed de propósito —
   renderNav() só dá insertAdjacentHTML no body, não importa a ordem no DOM. */

.nav-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 300;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-brand .ico {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-links::-webkit-scrollbar {
  display: none;
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--r-md);
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}

.nav-link:hover {
  background: var(--sunken);
  color: var(--text);
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.nav-user {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

@media (max-width: 640px) {
  .nav-user {
    display: none;
  }
}

.nav-badge {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--r-full);
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
}

.nav-bottom,
.nav-more-backdrop,
.nav-more-sheet {
  display: none;
}

@media (max-width: 760px) {
  .nav-links {
    display: none;
  }

  .nav-bottom {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: stretch;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom, 0);
    z-index: 300;
  }

  .nav-tab {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: 58px;
    color: var(--faint);
    font-size: 0.68rem;
    font-weight: 600;
    text-decoration: none;
  }

  .nav-tab .ico {
    width: 1.2em;
    height: 1.2em;
  }

  .nav-tab.active {
    color: var(--accent);
  }

  .nav-tab .nav-badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 22px);
  }

  .nav-more-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(20, 15, 17, 0.4);
    z-index: 340;
  }

  .nav-more-sheet.open {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 350;
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding: 8px 8px calc(env(safe-area-inset-bottom, 0) + 8px);
    max-height: 70vh;
    overflow-y: auto;
  }

  .nav-more-title {
    padding: 10px 11px 6px;
    color: var(--faint);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .nav-sheet-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 11px;
    border-radius: var(--r-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 550;
    text-decoration: none;
  }

  .nav-sheet-link:hover {
    background: var(--sunken);
  }

  .nav-sheet-link .nav-badge {
    margin-left: auto;
  }

  body.admin-mode .nav-sheet-link.admin-only {
    display: flex !important;
  }
}

body.admin-mode .nav-link.admin-only {
  display: inline-flex !important;
}

/* ── Listas e itens ─────────────────────────────────────────────────────── */

.grid {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.flavor-list,
.sabor-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flavor-item,
.sabor-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: border-color 0.12s;
}

.flavor-item:hover,
.sabor-item:hover {
  border-color: var(--border-strong);
}

/* O sabor é uma linha: nome, tags e ações no mesmo eixo. */
.sabor-item {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.sabor-item .sabor-nome {
  flex: 1;
}

.sabor-tags {
  margin-right: auto;
}

.btn-prod,
.btn-edit,
.btn-del,
.btn-save,
.btn-cancel {
  flex-shrink: 0;
}

.flavor-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.flavor-name,
.sabor-nome {
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.proximo-hint {
  font-size: 0.76rem;
  color: var(--muted);
}

.item-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.qty-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qty-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.qty-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent-strong);
}

.qty-value {
  min-width: 20px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent-strong);
}

.qty-label {
  font-size: 0.74rem;
  color: var(--faint);
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 0.76rem;
  font-weight: 550;
  color: var(--muted);
  white-space: nowrap;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.action-btn:hover {
  background: var(--sunken);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-move,
.btn-prod {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent-strong);
}

.btn-move:hover,
.btn-prod:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.btn-prod {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  font-size: 0.78rem;
  font-weight: 600;
  border-width: 1px;
  border-style: solid;
}

.btn-back,
.btn-move-back {
  color: var(--muted);
}

/* Aparece solto no sabores.html, sem .action-btn — precisa da caixa própria. */
.btn-receita {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--blue-border);
  border-radius: var(--r-sm);
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-receita:hover {
  background: var(--blue-soft);
  border-color: var(--blue);
  color: var(--blue);
}

.empty {
  padding: 22px 12px;
  text-align: center;
  color: var(--faint);
  font-size: 0.85rem;
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
}

/* ── Etapas de produção ─────────────────────────────────────────────────── */

.etapas-producao {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.etapa-col {
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.etapa-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.etapa-title {
  font-size: 0.76rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  line-height: 1.3;
}

/* A cor marca a etapa: âmbar entra, verde sai. */
.etapa-pesagem {
  border-left: 3px solid var(--amber);
}
.etapa-batida {
  border-left: 3px solid var(--blue);
}
.etapa-ornamentacao {
  border-left: 3px solid var(--accent);
}

/* ── Tags ───────────────────────────────────────────────────────────────── */

.sabor-tags {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-full);
  border: 1px solid transparent;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.tag-producao {
  background: var(--amber-soft);
  border-color: var(--amber-border);
  color: var(--amber);
}
.tag-estoque {
  background: var(--blue-soft);
  border-color: var(--blue-border);
  color: var(--blue);
}
.tag-vitrine {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent-strong);
}

/* ── Filtros ────────────────────────────────────────────────────────────── */

.filtros {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.filtro-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: 0.8rem;
  font-weight: 550;
  color: var(--muted);
  white-space: nowrap;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.filtro-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.filtro-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
  font-weight: 650;
}

/* ✓ está / ✕ não está — os dois lados do filtro precisam se distinguir de relance. */
.filtro-btn.sim {
  background: var(--positive-soft);
  border-color: var(--positive);
  color: var(--positive);
  font-weight: 650;
}

.filtro-btn.nao {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
  font-weight: 650;
}

.filtro-hint {
  font-size: 0.76rem;
  color: var(--faint);
}

.count {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 550;
}

/* ── Formulários das páginas ────────────────────────────────────────────── */

.add-form {
  display: flex;
  gap: 8px;
}

.add-form input {
  flex: 1;
  min-width: 0;
}

.receita-linha {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1 0 100%;
  padding-top: 9px;
  border-top: 1px solid var(--border);
}

.receita-label {
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 550;
  flex-shrink: 0;
}

.receita-sel {
  flex: 1;
  min-width: 0;
}

.edit-input {
  flex: 1;
  min-width: 0;
  min-height: 34px;
  font-size: 0.9rem;
}

.add-input,
.add-select,
.textarea {
  min-width: 0;
  background: var(--sunken);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.add-input,
.add-select {
  flex: 1;
  min-height: var(--tap);
  padding: 0 12px;
}

.add-select {
  flex: 0 0 auto;
}

.textarea {
  width: 100%;
  padding: 10px 12px;
  line-height: 1.55;
  resize: vertical;
}

.add-input::placeholder,
.textarea::placeholder {
  color: var(--faint);
}

.add-input:focus,
.add-select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.campo {
  margin-bottom: 14px;
}

.label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.btn-add,
.btn-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: var(--tap);
  padding: 0 18px;
  background: var(--accent);
  color: var(--on-accent);
  border: 1px solid var(--accent);
  border-radius: var(--r-md);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.12s;
}

.btn-add:hover,
.btn-send:hover {
  background: var(--accent-strong);
}

.btn-add:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-outline,
.btn-clear,
.btn-whatsapp,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: var(--tap);
  padding: 0 14px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 0.85rem;
  font-weight: 550;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.btn-outline:hover,
.btn-clear:hover {
  background: var(--sunken);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-whatsapp {
  color: var(--positive);
  border-color: var(--positive-border);
}

.btn-whatsapp:hover {
  background: var(--positive-soft);
  border-color: var(--positive);
}

.btn-danger {
  color: var(--danger);
  border-color: var(--danger-border);
}

.btn-danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

/* ── Linha de item genérica ─────────────────────────────────────────────── */

.item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  margin-bottom: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: border-color 0.12s, background 0.12s, opacity 0.2s, transform 0.2s;
}

.item:hover {
  border-color: var(--border-strong);
}

.item.removing {
  opacity: 0;
  transform: translateX(16px);
}

.item.sel {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.item.na-lista {
  opacity: 0.5;
}

.item.na-lista:hover {
  border-color: var(--border);
}

.item-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-sm);
  color: transparent;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.item-check.round {
  border-radius: var(--r-full);
}

.item-check:hover,
.item.sel .item-check {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.item-info {
  flex: 1;
  min-width: 0;
}

.item-nome {
  flex: 1;
  min-width: 0;
  font-size: 0.92rem;
  color: var(--text);
}

.item-data {
  margin-top: 2px;
  font-size: 0.74rem;
  color: var(--faint);
}

.contador {
  font-size: 0.8rem;
  font-weight: 550;
  color: var(--muted);
}

.cat-title {
  margin: 18px 0 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
  font-size: 0.74rem;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cat-title:first-child {
  margin-top: 0;
}

/* ── Chips ──────────────────────────────────────────────────────────────── */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.chip {
  min-height: 32px;
  padding: 0 13px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: 0.8rem;
  font-weight: 550;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

/* ── Barra de envio fixa ────────────────────────────────────────────────── */

.send-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  transform: translateY(110%);
  transition: transform 0.2s ease;
}

.send-bar.on {
  transform: translateY(0);
}

/* ── Tabela ─────────────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th {
  padding: 10px 12px;
  background: var(--sunken);
  color: var(--muted);
  text-align: left;
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 10px 12px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--sunken);
}

/* ── Cartões de número ──────────────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.stat-card {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.stat-val {
  font-size: 1.5rem;
  font-weight: 650;
  color: var(--text);
  line-height: 1.1;
}

.stat-label {
  margin-top: 4px;
  font-size: 0.74rem;
  color: var(--muted);
}

/* ── Tela de cadeado ────────────────────────────────────────────────────── */

#lock-screen {
  position: fixed;
  inset: 0;
  /* Abaixo da nav (300): o cadeado pra liberar o acesso precisa continuar
     clicável mesmo com a tela de bloqueio em cima do conteúdo da página. */
  z-index: 260;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
}

.lock-box {
  width: 100%;
  max-width: 320px;
  padding: 28px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
}

.lock-box .lock-icon {
  color: var(--accent);
}

.lock-box h2 {
  margin: 12px 0 4px;
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--text);
}

.lock-box p {
  font-size: 0.84rem;
  color: var(--muted);
}

.lock-box input {
  width: 100%;
  margin: 18px 0 12px;
  min-height: var(--tap);
  padding: 0 12px;
  text-align: center;
  background: var(--sunken);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
}

.lock-box input:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.lock-box input.error {
  border-color: var(--danger);
  animation: shake 0.3s;
}

@keyframes shake {
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.lock-box button {
  width: 100%;
  min-height: var(--tap);
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: var(--r-md);
  font-size: 0.92rem;
  font-weight: 600;
  transition: background 0.12s;
}

.lock-box button:hover {
  background: var(--accent-strong);
}

/* ── Skeleton ───────────────────────────────────────────────────────────── */

/* Placeholder de carregamento. `skeleton(n, variante)` em cuba.js gera o markup;
   a variante só muda a altura, o brilho é o mesmo em todas. */
.sk {
  position: relative;
  overflow: hidden;
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.sk::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--text) 7%, transparent),
    transparent
  );
  animation: sk-shimmer 1.4s ease-in-out infinite;
}

.sk + .sk {
  margin-top: 8px;
}

.sk-row { height: 46px; }
.sk-item { height: 62px; }
.sk-card { height: 96px; }
.sk-tall { height: 150px; }

.sk-line {
  height: 13px;
  border-radius: var(--r-full);
}

.sk-chip {
  display: inline-block;
  width: 92px;
  height: 32px;
  border-radius: var(--r-full);
}

.sk-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.sk-chips .sk + .sk {
  margin-top: 0;
}

.sk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.sk-grid .sk + .sk {
  margin-top: 0;
}

/* .flavor-list e .sabor-list já têm gap próprio; a margem do .sk duplicaria o
   espaçamento e o esqueleto ficaria mais solto que a lista real. */
.flavor-list .sk + .sk,
.sabor-list .sk + .sk {
  margin-top: 0;
}

@keyframes sk-shimmer {
  100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .sk::after {
    animation: none;
  }
}

/* ── Status da loja ─────────────────────────────────────────────────────── */

.status-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.status-inline {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
}

.status-emoji {
  font-size: 0.95rem;
}

.status-question {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.status-state {
  font-size: 0.78rem;
  font-weight: 700;
}

.status-state.nao {
  color: var(--muted);
}

.status-state.sim {
  color: var(--amber);
}

.status-updated {
  font-size: 0.68rem;
  color: var(--faint);
  padding-right: 6px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: var(--r-full);
  transition: background 0.18s;
  cursor: pointer;
}

.switch-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.18s;
}

.switch input:checked + .switch-slider {
  background: var(--amber);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(16px);
}

.switch input:disabled + .switch-slider {
  opacity: 0.5;
  cursor: default;
}

.switch input:focus-visible + .switch-slider {
  box-shadow: var(--ring);
}

/* ── Toast ──────────────────────────────────────────────────────────────── */

#toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translate(-50%, 16px);
  padding: 11px 18px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  font-size: 0.86rem;
  font-weight: 550;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  /* Acima de tudo, inclusive da nav e do #lock-screen: o toast precisa aparecer por cima. */
  z-index: 500;
  max-width: calc(100vw - 32px);
  text-align: center;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

#toast.error {
  background: var(--danger);
  color: #fff;
}

/* ── Modo admin ─────────────────────────────────────────────────────────── */

.admin-only {
  display: none !important;
}

body.admin-mode .admin-only {
  display: revert !important;
}

body.admin-mode .menu-link.admin-only {
  display: flex !important;
}

body.admin-mode .action-btn.admin-only,
body.admin-mode .link-sabores.admin-only,
body.admin-mode .btn-receita.admin-only {
  display: inline-flex !important;
}

body.admin-mode .admin-only.flex {
  display: flex !important;
}

/* ── Responsivo ─────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  :root {
    --tap: 44px;
  }

  body {
    /* 70px = 56px da nav-top + os 14px de respiro; 98px = 58px da aba fixa
       embaixo + os 40px que já existiam. */
    padding: 70px 12px 98px;
  }

  /* Sobe a barra de envio (catalogo.html) pra não empilhar embaixo da aba fixa
     de baixo da navegação. Precisa vir depois da regra base de .send-bar
     (mais abaixo no arquivo) pra vencer no empate de especificidade. */
  .send-bar {
    bottom: calc(58px + env(safe-area-inset-bottom, 0));
  }

  header {
    flex-wrap: wrap;
    gap: 10px;
  }

  .header-right {
    align-items: stretch;
    width: 100%;
  }

  .header-actions {
    justify-content: flex-end;
  }

  .status-inline {
    justify-content: space-between;
  }

  .inline-add {
    flex-wrap: wrap;
  }

  .sel-wrap {
    flex-basis: 100%;
  }

  .btn-inline {
    flex: 1;
  }

  .link-sabores .link-text {
    display: none;
  }

  .item-controls {
    align-items: flex-start;
  }

  .sabor-item .sabor-nome {
    flex: 1 0 100%;
  }
}
