/* Minha Vida Organizada — shell global: sidebar, topbar, conteúdo.
   Depende de tokens.css já estar carregado antes.
   Sem linhas dividindo a tela: as áreas se separam por fundo e sombra, não por borda. */

:root { --sb-w: 240px; --topbar-h: 56px; }
html.sb-collapsed { --sb-w: 72px; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sb-w) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 180ms;
}

.body-split { display: grid; grid-template-columns: 1fr 300px; gap: var(--space-4); align-items: start; }
@media (max-width: 1100px) { .body-split { grid-template-columns: 1fr; } }

/* ---------- Sidebar (clara; recolhe pra só ícones; no celular vira gaveta) ---------- */
.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  padding: var(--space-5) var(--space-3);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 30;
}
.sb-brand { display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-2) var(--space-5); margin-bottom: var(--space-2); border-bottom: 1px solid var(--sidebar-line); }
.sb-brand .mark { width: 28px; height: 28px; background: var(--brand); border-radius: var(--radius-sm); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--on-brand); }
.sb-brand .mark svg { width: 16px; height: 16px; }
.sb-brand .name { font-size: 14px; font-weight: 700; line-height: 1.2; white-space: nowrap; }

.sb-sec { font-size: 12px; font-weight: 500; color: var(--text-faint); padding: var(--space-4) var(--space-2) var(--space-2); white-space: nowrap; }
.sb-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--sidebar-ink-soft);
  text-decoration: none;
  margin-bottom: var(--space-1);
  white-space: nowrap;
  transition: background-color 150ms, color 150ms;
}
.sb-item svg { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 2; }
.sb-item:hover { background: var(--surface-2); color: var(--text-primary); }
.sb-item.on { background: var(--sidebar-active); color: var(--brand-ink); }
.sb-item.on:not([data-mod]) svg { color: var(--brand); }
.sb-item.soon { opacity: 0.45; cursor: default; }
.sb-item.soon:hover { background: transparent; color: var(--sidebar-ink-soft); }
.sb-spacer { flex: 1; }
/* Rodapé do menu: recolher e abrir com texto (só no computador; no celular o menu é gaveta). */
button.sb-item { width: 100%; border: 0; background: none; font-family: inherit; text-align: left; cursor: pointer; }
button.sb-item:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.sb-recolher { color: var(--sidebar-ink-soft); }
@media (max-width: 780px) { .sb-recolher { display: none; } }
/* Troca de contexto (Minha casa <-> Gestão do MVO): só existe pra quem acumula os dois papéis. */
.sb-switch { border-top: 1px solid var(--sidebar-line); padding-top: var(--space-2); margin-top: var(--space-2); }
.sb-switch a { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; color: var(--sidebar-ink-soft); text-decoration: none; white-space: nowrap; }
.sb-switch a:hover { background: var(--surface-2); color: var(--text-primary); }
.sb-switch a svg { width: 14px; height: 14px; flex-shrink: 0; stroke-width: 2; }
/* Rodapé discreto: de qual commit e quando foi a última publicação (ver renderSidebarVersion em ui.js). */
.sb-version { padding: var(--space-3) var(--space-3) var(--space-2); font-family: var(--font-mono); font-size: 11px; color: var(--sidebar-ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-2); border-top: 1px solid var(--sidebar-line); margin-top: var(--space-2); cursor: pointer; }
.sb-user .avatar { width: 28px; height: 28px; font-size: 11px; }
.sb-user .un { font-size: 12.5px; font-weight: 600; }
.sb-user .ue { font-size: 11.5px; color: var(--sidebar-ink-soft); }
.sb-user .chev { margin-left: auto; color: var(--sidebar-ink-soft); width: 14px; height: 14px; }

html.sb-collapsed .sidebar .lbl { display: none; }
html.sb-collapsed .sb-item, html.sb-collapsed .sb-brand { justify-content: center; padding-left: 0; padding-right: 0; }
html.sb-collapsed .sb-sec { padding: var(--space-2) 0; margin-top: var(--space-2); border-top: 1px solid var(--sidebar-line); }
html.sb-collapsed .sb-brand + .sb-sec { border-top: none; margin-top: 0; }

.sb-backdrop { display: none; }
@media (max-width: 780px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 240px; transform: translateX(-100%); transition: transform 180ms; box-shadow: var(--shadow-floating); }
  html.sb-collapsed .sidebar .lbl { display: revert; }
  html.sb-collapsed .sb-item, html.sb-collapsed .sb-brand { justify-content: flex-start; padding-left: var(--space-3); padding-right: var(--space-3); }
  html.sb-collapsed .sb-sec { padding: var(--space-4) var(--space-2) var(--space-2); border-top: none; margin-top: 0; }
  body.sb-open .sidebar { transform: none; }
  body.sb-open .sb-backdrop { display: block; position: fixed; inset: 0; background: var(--overlay); z-index: 25; }
}

/* ---------- Topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-3); height: var(--topbar-h); padding: 0 var(--space-8); background: var(--bg); }
@media (max-width: 780px) { .topbar { padding: 0 var(--space-4); } .top-user-name { display: none; } .kbd { display: none; } }
.icon-btn { width: 32px; height: 32px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; background: transparent; border: none; color: var(--text-secondary); cursor: pointer; flex-shrink: 0; transition: background-color 150ms, color 150ms, box-shadow 150ms; }
@media (hover: hover) { .icon-btn:hover { background: var(--surface-2); color: var(--text-primary); } }   /* no toque o hover grudava no último botão tocado (fundo cinza) */
.icon-btn svg { width: 16px; height: 16px; stroke-width: 2; }
.top-espaco { flex: 1; min-width: 0; }
/* Card "Seus primeiros passos": o passo é um link, e ao lado ficam "Opcional" e "Pular". */
.ob-link { display: flex; align-items: center; gap: var(--space-3); text-decoration: none; color: inherit; }
.ob-link .row-title, .ob-link .row-sub { display: block; }
a.icon-btn { text-decoration: none; }
.icon-btn:focus-visible, .top-icon:focus-visible, .top-user:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
/* Tamanho do texto (Aparência): aumenta o conteúdo das telas e das janelas, sem mexer na casca. */
html[data-texto="grande"] .content, html[data-texto="grande"] .mvo-modal-body, html[data-texto="grande"] .vivi-modal { zoom: 1.12; }
html[data-texto="maior"] .content, html[data-texto="maior"] .mvo-modal-body, html[data-texto="maior"] .vivi-modal { zoom: 1.25; }
.search { position: relative; display: flex; align-items: center; gap: var(--space-2); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); color: var(--text-faint); font-size: 14px; max-width: 320px; flex: 1; min-width: 0; }
.search svg { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 2; }
.search input { border: none; background: none; outline: none; font-family: var(--font-sans); font-size: 14px; color: var(--text-primary); flex: 1; min-width: 0; box-shadow: none; }
.search input::placeholder { color: var(--text-faint); }
.kbd { margin-left: auto; font-size: 11px; color: var(--text-faint); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 var(--space-1); }
.top-icon-wrap { position: relative; }
.top-icon { width: 38px; height: 38px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; color: var(--text-secondary); cursor: pointer; }
.top-icon svg { width: 16px; height: 16px; stroke-width: 2; }
.top-dot { position: absolute; top: var(--space-2); right: var(--space-2); width: 6px; height: 6px; border-radius: 50%; background: var(--danger); }
/* Com contagem de verdade (notificações "pra você" não vistas, 0066): vira pílula com número
   em vez do pontinho vazio. Sem contagem (só alerta de data, sem item discreto pra contar),
   continua o pontinho simples, nunca mostra "0" nem número inventado. */
.top-dot.count { top: var(--space-1); right: var(--space-1); width: auto; min-width: 16px; height: 16px; padding: 0 var(--space-1); border-radius: var(--radius-pill); background: var(--danger-btn); color: var(--on-brand); font-size: 11px; font-weight: 700; line-height: 16px; text-align: center; }
.notif-empty { font-size: 12.5px; color: var(--text-faint); padding: var(--space-3); text-align: center; white-space: nowrap; }
.top-user-wrap { position: relative; }
.top-user { display: flex; align-items: center; gap: var(--space-2); font-size: 14px; font-weight: 600; cursor: pointer; }
.top-user .avatar { width: 30px; height: 30px; font-size: 12px; }
.top-user svg { width: 14px; height: 14px; color: var(--text-faint); stroke-width: 2; }
.account-menu { display: none; position: absolute; top: calc(100% + 8px); right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-2); min-width: 160px; box-shadow: var(--shadow-floating); z-index: 50; }
.account-menu.open { display: block; }
.account-menu a { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; color: var(--text-primary); text-decoration: none; cursor: pointer; }
.account-menu a:hover { background: var(--surface-2); }
.account-menu a svg { width: 16px; height: 16px; color: var(--text-faint); stroke-width: 2; }

/* ---------- Main content ---------- */
.main-col { min-width: 0; }
.content { padding: var(--space-8) var(--space-8) calc(var(--space-10) * 2); max-width: 1440px; margin: 0 auto; }
@media (max-width: 780px) { .content { padding: var(--space-5) var(--space-4) calc(var(--space-10) * 2); } .page-title { font-size: 26px; } }

.page-hd { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); margin-bottom: var(--space-6); flex-wrap: wrap; }
.page-title { font-size: 32px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.15; }
.page-sub { font-size: 16px; font-weight: 400; color: var(--text-secondary); margin-top: var(--space-2); }
.date-chip { display: flex; align-items: center; gap: var(--space-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); font-size: 12.5px; color: var(--text-secondary); white-space: nowrap; }
.date-chip svg { width: 14px; height: 14px; stroke-width: 2; }

.sec-lbl { font-size: 18px; font-weight: 600; letter-spacing: -.01em; color: var(--text-primary); margin-bottom: var(--space-4); }
.sec-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-3); }

/* ---------- Context cards (Em destaque) ---------- */
.hl-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); margin-bottom: var(--space-6); }
@media (max-width: 900px) { .hl-row { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .hl-row { grid-template-columns: 1fr; } }
.hl-card { position: relative; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-lg); padding: var(--space-4); box-shadow: var(--shadow-card); transition: box-shadow 150ms, transform 150ms, border-color 150ms; text-decoration: none; color: inherit; }
a.hl-card:hover { box-shadow: var(--shadow-floating); transform: translateY(-1px); }
.hl-top { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.hl-icon { width: 38px; height: 38px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hl-icon svg { width: 18px; height: 18px; stroke-width: 2; }
.hl-label { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.hl-sub { font-size: 12.5px; color: var(--text-secondary); }
.hl-val { font-size: 17px; font-weight: 600; letter-spacing: -0.2px; line-height: 1.3; margin-top: var(--space-2); color: var(--text-primary); padding-right: var(--space-8); }   /* espaço pra seta, que fica no canto */
.hl-val .num { font-family: var(--font-mono); font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.hl-arrow { position: absolute; bottom: var(--space-3); right: var(--space-3); width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; }
.hl-arrow svg { width: 14px; height: 14px; stroke-width: 2; }
.hl-empty { color: var(--text-faint); font-size: 11.5px; margin-top: var(--space-2); }

/* ---------- Module grid ---------- */
.mod-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
@media (max-width: 900px) { .mod-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .mod-grid { grid-template-columns: 1fr; } }
.mod-tile { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-lg); padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); text-decoration: none; color: inherit; box-shadow: var(--shadow-card); transition: box-shadow 150ms, transform 150ms, border-color 150ms; }
a.mod-tile:hover { box-shadow: var(--shadow-floating); transform: translateY(-1px); }
.mod-icon-lg { width: 38px; height: 38px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.mod-icon-lg svg { width: 18px; height: 18px; stroke-width: 2; }
.mod-label { font-size: 15px; font-weight: 600; }
.mod-desc { font-size: 12.5px; color: var(--text-secondary); line-height: 1.4; min-height: 32px; }
.mod-foot { display: flex; justify-content: space-between; align-items: center; margin-top: var(--space-1); }
.mod-foot svg { width: 14px; height: 14px; color: var(--text-faint); stroke-width: 2; }

/* ---------- Right side column ---------- */
.home-side { display: flex; flex-direction: column; gap: var(--space-4); }
.side-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4); box-shadow: var(--shadow-card); }
.side-hd { display: flex; justify-content: space-between; align-items: center; font-size: 15px; font-weight: 600; margin-bottom: var(--space-3); }
.side-hd a { font-size: 12.5px; font-weight: 600; color: var(--brand); text-decoration: none; cursor: pointer; }
.side-caption { font-size: 11.5px; color: var(--text-faint); margin-top: var(--space-2); }
.side-list { display: flex; flex-direction: column; gap: var(--space-3); }
.side-row { display: flex; align-items: center; gap: var(--space-3); }
.side-row svg { width: 14px; height: 14px; stroke-width: 2; color: var(--text-secondary); margin-left: auto; flex-shrink: 0; }
.sr-nm { font-size: 14px; font-weight: 600; }
.sr-sub { font-size: 11.5px; color: var(--text-faint); margin-top: var(--space-1); font-family: var(--font-mono); }
.mini-flag { width: 38px; height: 38px; border-radius: var(--radius-sm); color: var(--on-brand); font-size: 12px; font-weight: 800; letter-spacing: -0.2px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.side-go { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text-secondary); margin-left: auto; flex-shrink: 0; }
.side-go svg { width: 12px; height: 12px; margin-left: 0; stroke-width: 2; }

/* ---------- Sugestões de melhoria (janela aberta por "Sugerir melhoria", no menu da conta) ---------- */
/* Acima de .mvo-modal-bg (300): precisa abrir por cima de um compromisso (ou qualquer outra
   tela) já aberto em modal, senão fica escondido atrás e parece que não abriu nada. */
.fb-modal-bg { display: none; position: fixed; inset: 0; background: var(--overlay); z-index: 310; align-items: center; justify-content: center; padding: var(--space-4); }
.fb-modal-bg.open { display: flex; }
.fb-modal { background: var(--surface); border-radius: var(--radius-lg); width: 460px; max-width: 92vw; max-height: min(88vh, calc(100dvh - var(--space-8))); display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-floating); }
.fb-modal-body { padding: var(--space-6); overflow-y: auto; min-height: 0; }
.fb-modal h3 { font-size: 16px; font-weight: 700; margin-bottom: var(--space-1); }
.fb-modal .sub { font-size: 12.5px; color: var(--text-secondary); margin-bottom: var(--space-4); }
.fb-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: var(--space-4); }
.fb-tab { font-size: 12.5px; font-weight: 600; color: var(--text-faint); padding: var(--space-2) var(--space-1); margin-right: var(--space-5); border: none; background: none; border-bottom: 2px solid transparent; cursor: pointer; font-family: var(--font-sans); }
.fb-tab.on { color: var(--brand-ink); border-color: var(--brand); }
.fb-textarea { width: 100%; background: var(--surface); color: var(--text-primary); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: var(--space-3); font-family: var(--font-sans); font-size: 13px; resize: vertical; min-height: 70px; }
.fb-item { padding: var(--space-3) 0; border-bottom: 1px solid var(--border-soft); }
.fb-item:last-child { border-bottom: none; }
.fb-item-title { font-size: 13px; font-weight: 600; }
.fb-item-desc { font-size: 12px; color: var(--text-secondary); margin-top: var(--space-1); }
.fb-item-status { margin-top: var(--space-1); }


/* ---------- Menu da busca global ---------- */
.search-menu { display: none; position: absolute; top: calc(100% + 8px); right: 0; width: 380px; max-width: 92vw; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-2); box-shadow: 0 12px 32px rgba(20,25,22,0.14); z-index: 60; }
.search-menu.open { display: block; }
.sm-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); border-radius:  var(--radius-sm); text-decoration: none; color: var(--text-primary); }
.sm-item:hover { background: var(--surface-2); }
.sm-ic { width: 28px; height: 28px; border-radius:  var(--radius-sm); background: var(--surface-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sm-ic svg { width: 16px; height: 16px; }
.sm-tx { display: flex; flex-direction: column; min-width: 0; }
.sm-t { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-s { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Busca agrupada por módulo (ux33): rótulo .card-label em cada grupo, "Ver mais N" como .card-link. */
.search-menu { max-height: min(70vh, 560px); overflow-y: auto; overscroll-behavior: contain; }
.sm-grupo + .sm-grupo { border-top: 1px solid var(--border); margin-top: var(--space-1); padding-top: var(--space-1); }
.search-menu .card-label { margin: var(--space-2) var(--space-3) var(--space-1); }
.sm-item:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.sm-mais { margin: var(--space-1) var(--space-3) var(--space-2); }

/* ---------- Sino de notificações ---------- */
.notif-menu { width: 340px; max-width: 92vw; padding: var(--space-2); }
.nf-sec { font-size:12px; font-weight: 600; color: var(--text-faint); padding: var(--space-2) var(--space-3) var(--space-1); }
.nf-sec-acao { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.nf-limpar { font: inherit; font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--brand-ink); background: none; border: 0; padding: var(--space-1) var(--space-2); border-radius: var(--radius-sm); cursor: pointer; }
.nf-limpar:hover { background: var(--surface-2); }
.nf-limpar:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.nf-item { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-2) var(--space-3); border-radius:  var(--radius-sm); text-decoration: none; color: var(--text-primary); }
a.nf-item:hover { background: var(--surface-2); }
.nf-foot { display: block; margin-top: var(--space-2); padding: var(--space-2) var(--space-3); border-top: 1px solid var(--border-soft); font-size: 12px; font-weight: 600; color: var(--brand-ink); text-decoration: none; }
.nf-foot:hover { text-decoration: underline; }
.nf-ic { width: 28px; height: 28px; border-radius:  var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nf-ic svg { width: 14px; height: 14px; }
.nf-tx { display: flex; flex-direction: column; min-width: 0; }
.nf-t { font-size: 12.5px; line-height: 1.35; font-weight: 500; }
.nf-t b { font-weight: 700; }
.nf-s { font-size: 11.5px; color: var(--text-faint); margin-top: var(--space-1); }

.fb-prints { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-2); }
.fb-prints:empty { display: none; }
.fb-print { position: relative; width: 96px; height: 72px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.fb-print img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fb-print .icon-btn { position: absolute; top: var(--space-1); right: var(--space-1); width: 24px; height: 24px; background: var(--surface); box-shadow: var(--shadow-card); }
.fb-detalhes { margin-bottom: var(--space-4); font-size: 12.5px; color: var(--text-secondary); }
.fb-detalhes summary { cursor: pointer; font-weight: 600; color: var(--brand-ink); }
.fb-detalhes .hint { margin-top: var(--space-2); line-height: 1.55; }
.fb-apontado { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); }
.fb-apontado:empty { display: none; }
body.fb-apontando, body.fb-apontando * { cursor: crosshair !important; }
.fb-apontar-alvo { outline: 2px solid var(--brand) !important; outline-offset: 2px; }
.fb-apontar-banner { position: fixed; top: var(--space-4); left: 50%; transform: translateX(-50%); z-index: 250; background: var(--text-primary); color: var(--bg); font-size: 13px; font-weight: 600; padding: var(--space-3) var(--space-4); border-radius: var(--radius-pill); display: flex; align-items: center; gap: var(--space-3); box-shadow: var(--shadow-floating); }
.fb-apontar-banner .btn { cursor: pointer; }

/* ---------- Pular para o conteúdo (só aparece quando recebe o foco do teclado) ---------- */
.skip-link { position: absolute; left: var(--space-4); top: calc(var(--space-10) * -2); z-index: 500; background: var(--surface); color: var(--brand-ink); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); font-weight: 600; text-decoration: none; box-shadow: var(--shadow-floating); }
.skip-link:focus { top: var(--space-3); }

/* ---------- Toque e celular ---------- */
@media (max-width: 780px) {
  .input, select.input, textarea.input, .search input, textarea, select, input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]) { font-size: 16px !important; }   /* o iPhone não dá zoom ao tocar em nenhum campo (inclui Sugerir melhoria e Vivi) */
  .input, select.input { min-height: 40px; }
  .top-user { min-height: 40px; }
  .view-tab { min-width: 40px; }
  .mod-pill { min-height: 40px; }
  .ag-item a { display: inline-flex; align-items: center; min-height: 40px; }
  .topbar { gap: var(--space-2); }
  .icon-btn, .top-icon { width: 40px; height: 40px; }
    .btn-sm { height: 40px; }
  .sb-item { min-height: 44px; }
  .tab, .view-tab, .fb-tab, .chip, .p-chip, .seg button { min-height: 40px; }
  .side-hd a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--space-2); }
  .row-item.clickable, .ag-item { min-height: 48px; }
  /* A busca do topo vira só a lupa; ao tocar, abre por cima da barra do topo, na largura toda.
     A busca dentro da página (Compromissos, Meus Acessos) continua aberta: ela é o filtro da lista. */
  .topbar .search { flex: 0 0 auto; width: 40px; height: 40px; padding: 0; justify-content: center; cursor: pointer; }
  .topbar .search input { width: 0; flex: 0; opacity: 0; padding: 0; }
  .topbar .search:focus-within { position: absolute; left: var(--space-4); right: var(--space-4); top: 50%; transform: translateY(-50%); width: auto; height: 44px; padding: 0 var(--space-3); justify-content: flex-start; cursor: text; z-index: 30; box-shadow: var(--shadow-floating); }
  .topbar .search:focus-within input { width: auto; flex: 1; opacity: 1; }
  .topbar .search:focus-within .search-menu { left: 0; right: 0; width: auto; max-width: none; }   /* o menu da busca na largura da busca aberta, sem sair da tela */
  .content .search { min-height: 40px; }
}

/* ---------- FALE COM A VIVI: widget de conversa, disponível em qualquer tela ---------- */
/* Bolha flutuante fixa no canto, igual ao chat de atendimento de loja: aperta e abre o popup. */
.vivi-fab { position: fixed; right: var(--space-5); bottom: var(--space-5); width: 56px; height: 56px; border-radius: var(--radius-pill); background: var(--brand); color: var(--on-brand); border: none; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-floating); cursor: pointer; z-index: 309; }
.vivi-fab svg { width: 24px; height: 24px; }
.vivi-fab:hover { filter: brightness(1.06); }
.vivi-modal-bg { display: none; position: fixed; inset: 0; background: var(--overlay); z-index: 310; align-items: center; justify-content: center; padding: var(--space-4); }
.vivi-modal-bg.open { display: flex; }
.vivi-modal { background: var(--surface); border-radius: var(--radius-lg); width: 480px; max-width: 94vw; height: min(680px, calc(100dvh - var(--space-8))); display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-floating); }
.vivi-modal-hd { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border-soft); flex-shrink: 0; }
.vivi-modal-hd h3 { font-size: 15px; font-weight: 700; flex: 1; }
.vivi-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5); min-height: 0; }
.vivi-row { display: flex; gap: var(--space-2); align-items: flex-end; max-width: 100%; }
.vivi-row.user { flex-direction: row-reverse; align-self: flex-end; }
.vivi-avatar-vivi { width: 28px; height: 28px; border-radius: var(--radius-pill); background: var(--brand-light); color: var(--brand-ink); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.vivi-avatar-vivi svg { width: 16px; height: 16px; }
.vivi-bubble-wrap { display: flex; flex-direction: column; max-width: 76%; }
.vivi-row.user .vivi-bubble-wrap { align-items: flex-end; }
.vivi-msg { padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.vivi-msg.user { background: var(--brand); color: var(--on-brand); border-bottom-right-radius: var(--radius-sm); }
.vivi-msg.vivi { background: var(--surface-2); color: var(--text-primary); border-bottom-left-radius: var(--radius-sm); }
.vivi-msg.erro { background: var(--danger-soft); color: var(--danger-ink); border-bottom-left-radius: var(--radius-sm); }
.vivi-time { font-size: 11px; color: var(--text-faint); margin-top: var(--space-1); padding: 0 var(--space-1); }
.vivi-card { align-self: flex-start; max-width: 76%; width: min(320px, 100%); }
.vivi-card-row { display: flex; justify-content: space-between; gap: var(--space-3); padding: var(--space-1) 0; font-size: 13px; border-bottom: 1px solid var(--border-soft); }
.vivi-card-row:last-of-type { border-bottom: none; }
.vivi-antes { color: var(--text-faint); }
.vivi-card-row span:first-child { color: var(--text-faint); }
.vivi-card-actions { display: flex; gap: var(--space-2); margin-top: var(--space-4); }
/* Respostas rápidas: o .chip de sempre, alinhado com a fala da Vivi (espaço do avatar) e com alvo de toque de 40px. */
.vivi-avatar-espaco { width: 28px; flex-shrink: 0; }
.vivi-opcoes { max-width: 86%; }
.vivi-opcoes .chip { min-height: 40px; text-align: left; }
.vivi-input-row { display: flex; gap: var(--space-2); padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border-soft); flex-shrink: 0; }
.vivi-input-row textarea { flex: 1; min-width: 0; resize: none; min-height: 44px; max-height: 140px; }
.vivi-input-row { align-items: flex-end; }
/* Ditando: o botão fica marcado (cor de seleção) e o ícone vira "parar"; o campo avisa "Ouvindo". */
.vivi-mic.on { background: var(--brand-light); color: var(--brand-ink); }
.vivi-anexos { display: flex; gap: var(--space-2); padding: var(--space-3) var(--space-5) 0; flex-shrink: 0; }
.vivi-thumb { position: relative; width: 56px; height: 56px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); flex-shrink: 0; }
.vivi-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vivi-thumb button { position: absolute; top: 0; right: 0; width: 20px; height: 20px; border: none; border-radius: var(--radius-pill); background: var(--text-primary); color: var(--bg); display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.vivi-thumb button svg { width: 12px; height: 12px; }
.vivi-fotos { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-2); }
.vivi-fotos:last-child { margin-bottom: 0; }
.vivi-fotos img { width: 96px; height: 96px; object-fit: cover; border-radius: var(--radius-sm); display: block; }
.vivi-pdf { width: 100%; height: 100%; min-width: 56px; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-1); background: var(--surface-2); color: var(--text-secondary); font-size: 11px; font-weight: 600; border-radius: var(--radius-sm); }
.vivi-pdf svg { width: 18px; height: 18px; }
.vivi-fotos .vivi-pdf { width: 96px; height: 96px; }
.vivi-intro { text-align: center; padding: var(--space-8) 0; color: var(--text-faint); margin: auto 0; }
.vivi-intro .mark { width: 48px; height: 48px; border-radius: var(--radius-pill); background: var(--brand-light); color: var(--brand-ink); display: flex; align-items: center; justify-content: center; margin: 0 auto var(--space-4); }
@media (max-width: 640px) {
  .vivi-modal-bg { padding: 0; }
  .vivi-modal { width: 100%; max-width: 100%; height: 100dvh; border-radius: 0; }
  .vivi-row { max-width: 94%; }
  .vivi-bubble-wrap { max-width: 100%; }
}

/* Zoom no toque (pedido da Viviane, 2026-10-11: "cuidado com o zoom que dá no telefone o tempo todo"):
   - campo com letra menor que 16px faz o iPhone/iPad dar zoom ao tocar. A regra acima só valia até 780px;
     celular deitado e iPad passam disso. Agora vale em toda tela de toque.
   - dois toques rápidos num botão também davam zoom: touch-action manipulation tira só isso (a pinça continua). */
html { touch-action: manipulation; }
@media (pointer: coarse) {
  .input, select.input, textarea.input, .search input, textarea, select, input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]) { font-size: 16px !important; }
}
