/* ============================================================
   LOJA 3D — Gestão da oficina
   Tokens: primer-gray + grafite + verde-petróleo + âmbar
   Type: Archivo (display) / IBM Plex Sans (corpo) / Plex Mono (dados)
   ============================================================ */

:root {
  --bg: #EDF0EE;
  --surface: #FFFFFF;
  --surface-2: #F6F8F7;
  --ink: #1A2327;
  --ink-2: #59686D;
  --ink-3: #8A979B;
  --line: #D9E0DD;

  --teal: #0E6B5A;
  --teal-press: #0A5446;
  --teal-soft: #DFEEE9;
  --amber: #C97508;
  --amber-soft: #FAEFDC;
  --red: #BC3F28;
  --red-soft: #F8E6E0;

  --display: "Archivo", system-ui, sans-serif;
  --body: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --radius: 14px;
  --radius-s: 9px;
  --shadow: 0 1px 2px rgba(26, 35, 39, .05), 0 4px 16px rgba(26, 35, 39, .06);
  --tabbar-h: 62px;
}

/* ---------- Modo escuro: só redefine os tokens ---------- */
:root[data-tema="escuro"] {
  --bg: #111618;
  --surface: #1B2124;
  --surface-2: #232C30;
  --ink: #F0F3F2;
  --ink-2: #BCC9CD;
  --ink-3: #8EA0A6;
  --line: #3A474C;

  --teal: #16A882;
  --teal-press: #12946F;
  --teal-soft: #1D3830;
  --amber: #E89C35;
  --amber-soft: #3A2C18;
  --red: #E87060;
  --red-soft: #40201A;

  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .45);
}
:root[data-tema="escuro"] #topbar {
  background: repeating-linear-gradient(to bottom, transparent 0 5px, rgba(255, 255, 255, .03) 5px 6px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
}

/* ---------- Layout: tabbar no celular, sidebar no desktop ---------- */
#app { min-height: 100vh; }

#main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px calc(var(--tabbar-h) + 84px);
}

#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 2px 10px;
  /* linhas de camada: a textura de uma peça impressa */
  background:
    repeating-linear-gradient(to bottom, transparent 0 5px, rgba(26,35,39,.025) 5px 6px);
}

.wordmark {
  font-family: var(--display);
  font-stretch: 125%;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: .04em;
  display: flex;
  align-items: center;
  gap: 9px;
  user-select: none;
}
.wordmark .cube { width: 22px; height: 22px; flex: none; }
.wordmark small {
  font-family: var(--mono);
  font-weight: 400;
  font-stretch: 100%;
  font-size: 10px;
  letter-spacing: .12em;
  color: var(--ink-2);
  display: block;
  margin-top: -2px;
}
.topbar-data {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
  text-align: right;
}

#sidebar { display: none; }

#tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  /* a altura inclui a "área segura" do iPhone, senão os ícones ficam
     espremidos quando o app é instalado na tela inicial */
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 40;
  padding-bottom: env(safe-area-inset-bottom);
}
#tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .02em;
}
#tabbar a svg { width: 22px; height: 22px; }
#tabbar a.ativo { color: var(--teal); }

#fab {
  position: fixed;
  right: 16px;
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  z-index: 39;
  border: 0;
  background: var(--teal);
  color: #fff;
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  padding: 14px 20px;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(14, 107, 90, .35);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
#fab:active { background: var(--teal-press); transform: scale(.97); }

@media (min-width: 960px) {
  #app { display: grid; grid-template-columns: 230px 1fr; }
  #tabbar { display: none; }
  #main { padding-bottom: 100px; width: 100%; }
  #fab { bottom: 28px; right: 28px; }

  #sidebar {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 20px 14px;
    border-right: 1px solid var(--line);
    background: var(--surface);
    min-height: 100vh;
    position: sticky;
    top: 0;
  }
  #sidebar .wordmark { padding: 4px 10px 18px; }
  #sidebar a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: var(--radius-s);
    text-decoration: none;
    color: var(--ink-2);
    font-weight: 500;
    font-size: 14px;
  }
  #sidebar a svg { width: 19px; height: 19px; }
  #sidebar a:hover { background: var(--surface-2); color: var(--ink); }
  #sidebar a.ativo { background: var(--teal-soft); color: var(--teal); font-weight: 600; }
  #sidebar .sep {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: .14em;
    color: var(--ink-3);
    padding: 16px 12px 4px;
  }
}

/* ---------- Cabeçalho de cada tela ---------- */
.view-head { margin: 18px 0 14px; }
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--teal);
  margin-bottom: 2px;
}
.view-head h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 24px;
  margin: 0;
  letter-spacing: -.01em;
}
.view-head .sub { color: var(--ink-2); font-size: 13.5px; margin-top: 2px; }
.view-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ---------- Central do Dia (cockpit) ---------- */
.home-hero { margin: 18px 2px 14px; animation: surgir .35s ease both; }
.home-hero h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -.02em;
  margin: 0;
  line-height: 1.12;
}
.home-hero .sub { color: var(--ink-2); font-size: 14px; margin-top: 4px; }

@keyframes surgir { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card-hoje { animation: surgir .4s ease both; }
.card-hoje h2 { margin-bottom: 4px; }
.hoje-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink-3);
  border-radius: var(--radius-s);
  background: var(--surface-2);
}
.hoje-card[data-nivel="alto"] { border-left-color: var(--red); background: var(--red-soft); }
.hoje-card[data-nivel="medio"] { border-left-color: var(--amber); background: var(--amber-soft); }
.hoje-card[data-nivel="info"] { border-left-color: var(--teal); background: var(--teal-soft); }
.hoje-ic { font-size: 20px; flex: none; width: 26px; text-align: center; }
.hoje-info { flex: 1; min-width: 0; }
.hoje-titulo { font-weight: 700; font-size: 14px; color: var(--ink); line-height: 1.25; }
.hoje-det { font-size: 12.5px; color: var(--ink-2); margin-top: 1px; }
.hoje-btn { flex: none; white-space: nowrap; }
.hoje-vazio {
  text-align: center; padding: 18px 8px; color: var(--ink-2);
  font-size: 14px;
}

.card-briefing { animation: surgir .45s ease both; }
.briefing-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.briefing-txt {
  margin: 10px 0 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
}
.briefing-vazio { margin: 8px 0 0; font-size: 13px; color: var(--ink-3); line-height: 1.5; }

/* ---------- Consultor IA (chat) ---------- */
.chat-card { display: flex; flex-direction: column; }
.chat-msgs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 58vh;
  min-height: 240px;
  overflow-y: auto;
  padding: 4px 2px 8px;
}
.bolha {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  animation: surgir .25s ease both;
}
.bolha-voce {
  align-self: flex-end;
  background: var(--teal);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.bolha-ia {
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  border-bottom-left-radius: 5px;
}
.bolha-corpo { white-space: pre-wrap; }
.bolha-copiar {
  margin-top: 6px;
  background: none; border: 0; padding: 0;
  font-family: var(--body); font-size: 11.5px;
  color: var(--ink-3); cursor: pointer;
}
.bolha-copiar:hover { color: var(--teal); text-decoration: underline; }
.pensando span { animation: piscar 1.2s infinite; }
.pensando span:nth-child(2) { animation-delay: .2s; }
.pensando span:nth-child(3) { animation-delay: .4s; }
@keyframes piscar { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

.chat-input {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.chat-input textarea {
  flex: 1;
  resize: none;
  max-height: 120px;
  font-family: var(--body);
  font-size: 15px;
}
.chat-input .btn { flex: none; }
.chat-aviso { font-size: 11px; color: var(--ink-3); margin-top: 8px; line-height: 1.4; }

.chat-bem { color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.chat-bem p { margin: 4px 0 12px; }
.chat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-sug {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 13px;
  font-family: var(--body);
  font-size: 13px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.chip-sug:hover { background: var(--teal-soft); border-color: var(--teal); }

/* ---------- Componentes ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 12px; }
.card h2 {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 10px;
}

.btn {
  font-family: var(--body);
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  padding: 9px 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  transition: background .12s;
}
.btn-primario { background: var(--teal); color: #fff; }
.btn-primario:hover { background: var(--teal-press); }
.btn-claro { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-claro:hover { background: var(--surface-2); }
.btn-perigo { background: var(--red-soft); color: var(--red); }
.btn-mini { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 4px;
}
.field input, .field select, .field textarea {
  width: 100%;
  font-family: var(--body);
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 9px 11px;
}
.field input:focus, .field select:focus, .field textarea:focus,
.btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}
.field .dica { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.tempo-duo { display: flex; align-items: center; gap: 5px; }
.tempo-duo input { min-width: 0; flex: 1; }
.tempo-duo span { font-size: 11.5px; color: var(--ink-3); flex: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }

.mono { font-family: var(--mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }

.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
}
.badge-pago { background: var(--teal-soft); color: var(--teal); }
.badge-pendente { background: var(--amber-soft); color: var(--amber); }
.badge-cancelado { background: var(--red-soft); color: var(--red); }
.badge-neutro { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }

.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table.tabela { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tabela th {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: left;
  padding: 7px 10px 7px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tabela td {
  padding: 9px 10px 9px 0;
  border-bottom: 1px solid var(--surface-2);
  vertical-align: middle;
}
.tabela tr:last-child td { border-bottom: 0; }
.tabela .dir, .tabela th.dir { text-align: right; }

/* KPIs do dashboard */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 720px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  box-shadow: var(--shadow);
}
.kpi .rotulo {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.kpi .valor {
  font-family: var(--display);
  font-weight: 700;
  font-size: 21px;
  margin-top: 3px;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.kpi .extra { font-size: 11.5px; color: var(--ink-2); margin-top: 1px; }
.kpi.alerta { border-color: var(--amber); }
.kpi.alerta .valor { color: var(--amber); }

.charts { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 12px; }
@media (min-width: 880px) { .charts { grid-template-columns: 1fr 1fr; } }
.chart-box { position: relative; height: 230px; }

/* Anel de carretel — assinatura visual */
.spool { transform: rotate(-90deg); }
.spool .trilha { fill: none; stroke: var(--line); stroke-width: 3.6; }
.spool .nivel {
  fill: none;
  stroke-width: 3.6;
  stroke-linecap: round;
  transition: stroke-dasharray .5s ease;
}
.spool .eixo { fill: none; stroke: var(--line); stroke-width: 1.4; }

/* Linha de filamento na lista */
.rolo {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 0;
  border-bottom: 1px solid var(--surface-2);
  cursor: pointer;
}
.rolo:last-child { border-bottom: 0; }
.rolo .info { flex: 1; min-width: 0; }
.rolo .nome { font-weight: 600; font-size: 14.5px; }
.rolo .meta { font-size: 12px; color: var(--ink-2); }
.rolo .dados { text-align: right; }
.rolo .gramas { font-family: var(--mono); font-size: 13.5px; font-weight: 500; }
.rolo .custo-g { font-size: 11.5px; color: var(--ink-3); }

/* Lista de produtos */
.produto-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--surface-2);
  cursor: pointer;
}
.produto-item:last-child { border-bottom: 0; }
.produto-thumb {
  width: 52px; height: 52px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  object-fit: cover;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  overflow: hidden;
}
.produto-thumb img { width: 100%; height: 100%; object-fit: cover; }
.produto-item .info { flex: 1; min-width: 0; }
.produto-item .nome { font-weight: 600; font-size: 14.5px; }
.produto-item .meta { font-size: 12px; color: var(--ink-2); }
.produto-item .preco { font-family: var(--mono); font-weight: 600; white-space: nowrap; }
.produto-item.indisponivel { opacity: .5; }

/* Segmented control */
.seg {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  max-width: 100%;
  overflow-x: auto;
}
.seg button {
  border: 0;
  background: transparent;
  font-family: var(--body);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.seg button.ativo { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* Modal */
#modal-root { position: fixed; inset: 0; z-index: 50; display: none; }
#modal-root.aberto { display: block; }
.modal-veu { position: absolute; inset: 0; background: rgba(26, 35, 39, .45); }
.modal-caixa {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  display: flex;
  flex-direction: column;
  animation: sobe .22s ease;
}
@media (min-width: 720px) {
  .modal-caixa { bottom: auto; top: 6vh; border-radius: 18px; max-height: 86vh; }
}
@keyframes sobe { from { transform: translate(-50%, 24px); opacity: 0; } }
.modal-topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--surface-2);
}
.modal-topo h2 { font-family: var(--display); font-size: 17px; font-weight: 700; margin: 0; }
.modal-fechar {
  border: 0; background: var(--surface-2); color: var(--ink-2);
  width: 30px; height: 30px; border-radius: 999px; cursor: pointer;
  font-size: 15px; line-height: 1;
}
.modal-corpo { padding: 16px 18px; overflow-y: auto; }
.modal-pe {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--surface-2);
}

/* Toast */
#toast-root {
  position: fixed;
  bottom: calc(var(--tabbar-h) + 14px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
@media (min-width: 960px) { #toast-root { bottom: 24px; } }
.toast {
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(26,35,39,.3);
  animation: sobe-toast .25s ease;
}
@keyframes sobe-toast { from { transform: translateY(12px); opacity: 0; } }

/* Estado vazio */
.vazio {
  text-align: center;
  padding: 36px 18px;
  color: var(--ink-2);
}
.vazio .icone { font-size: 34px; margin-bottom: 8px; }
.vazio p { margin: 0 0 14px; font-size: 14px; }

/* Linha de resultado da precificação */
.linha-calc {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13.5px;
}
.linha-calc:last-child { border-bottom: 0; }
.linha-calc .v { font-family: var(--mono); font-weight: 500; }
.linha-calc.total { font-weight: 700; border-bottom: 2px solid var(--ink); }
.linha-calc.destaque .v { color: var(--teal); font-weight: 700; font-size: 15px; }

.preco-grande {
  background: var(--teal-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 12px;
}
.preco-grande .rotulo { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; color: var(--teal); }
.preco-grande .valor { font-family: var(--display); font-weight: 800; font-size: 27px; color: var(--teal); }

/* Itens da venda (PDV) */
.item-venda {
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 11px;
  margin-bottom: 10px;
  background: var(--surface-2);
}
.item-venda .grid-2, .item-venda .grid-3 { gap: 0 8px; }
.item-venda .field { margin-bottom: 7px; }
.cor-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.cor-row input, .cor-row select {
  font-family: var(--body);
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 8px 9px;
  min-width: 0;
}
.cor-row input:focus, .cor-row select:focus { outline: 2px solid var(--teal); outline-offset: 1px; }

/* Chip de cor sugerida (painel de eventos) */
.chip-cor {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 4px 10px 4px 6px;
}
.chip-cor i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, .15);
  flex: none;
}
.chip-cor b { font-weight: 600; font-size: 11px; }

/* Cartões de ideia (busca com IA + catálogo) */
.ideia-card { display: flex; gap: 10px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--line); }
.ideia-card:last-child { border-bottom: 0; }
.ideia-card .ideia-info { flex: 1; min-width: 0; }
.ideia-card .nome { font-weight: 600; color: var(--ink); }
.ideia-card .meta { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; line-height: 1.45; }
.ideia-acoes { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ideia-acoes .btn { text-decoration: none; }
.ideia-foto { width: 88px; height: 88px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); flex: none; }
.ideia-foto.sem { display: flex; align-items: center; justify-content: center; font-size: 34px; background: var(--bg); color: var(--ink-3); }
.ia-titulo { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; margin: 12px 0 2px; }
.ia-erro { font-size: 13px; color: var(--amber); padding: 10px 0; line-height: 1.5; }
.ia-fontes { font-size: 11.5px; color: var(--ink-3); margin-top: 10px; }
.ia-fontes a { color: var(--ink-3); }

/* Grid "Em Alta" — cards com foto gerados pela IA */
.tendencias-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 4px;
}
.tendencia-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tendencia-foto {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: var(--bg);
}
.tendencia-foto-vazia {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  background: var(--bg);
  color: var(--ink-3);
}
/* Botão discreto "adicionar link do modelo" no item do pedido */
.btn-link-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 0;
  padding: 2px 0 6px;
  margin: 0;
  font-family: var(--body);
  font-size: 12.5px;
  color: var(--teal);
  cursor: pointer;
}
.btn-link-add:hover { text-decoration: underline; }

.tendencia-info {
  padding: 10px 12px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.tendencia-info .nome { font-weight: 700; font-size: 14px; color: var(--ink); line-height: 1.3; }
.tendencia-info .meta { font-size: 12px; color: var(--ink-2); margin-top: 4px; line-height: 1.4; }

/* Barra de progresso (meta do mês) */
.barra { height: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.barra-fill { height: 100%; background: var(--amber); border-radius: 99px; transition: width .4s ease; }

/* Botão de alternar tema (topo) */
.topbar-acoes { display: flex; align-items: center; gap: 10px; }
.tema-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex: none; padding: 0;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--ink-2); cursor: pointer;
  transition: background .12s, color .12s;
}
.tema-toggle:hover { background: var(--surface-2); color: var(--ink); }
.tema-toggle svg { width: 18px; height: 18px; }

/* Banner de nova versão (PWA) */
.update-banner {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 14px); z-index: 200;
  background: var(--teal); color: #fff;
  padding: 9px 10px 9px 16px; border-radius: 99px; box-shadow: var(--shadow);
  display: flex; gap: 12px; align-items: center; font-size: 13.5px;
}
.update-banner .btn { background: #fff; color: var(--teal); border: 0; }
@media (min-width: 860px) { .update-banner { bottom: 20px; } }

/* Barra de filtros */
.filtros { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filtros input[type="month"], .filtros input[type="date"], .filtros input[type="search"], .filtros select {
  font-family: var(--body);
  font-size: 13.5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 7px 10px;
  background: var(--surface);
  color: var(--ink);
}

.lucro-pos { color: var(--teal); }
.lucro-neg { color: var(--red); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
