/* Fiveroom · Pagamentos
   Tema: neutros quentes (combinam com o logo marrom e creme) e o rosa da marca
   só como destaque: ação principal, item ativo, foco e gráfico.
   Layout: celular com barra inferior; tablet com menu lateral só de ícones;
   desktop com menu lateral completo e conteúdo de largura controlada. */

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: light;
  --bg: #f6f5f3;
  --surface: #ffffff;
  --surface-2: #f3f1ee;
  --surface-3: #ebe8e4;
  --sidebar: #fbfaf9;
  --text: #1c1917;
  --text-2: #44403c;
  --muted: #6b645e;
  --line: #e7e4df;
  --line-strong: #d6d1ca;
  --overlay: #1c191780;

  --brand: #e60045;          /* rosa da marca: fundo de botão principal */
  --brand-hover: #c9003c;
  --brand-ink: #ffffff;
  --brand-text: #c0003c;     /* rosa para texto e ícone sobre fundo claro */
  --brand-soft: #fdecf1;     /* fundo do item ativo */
  --brand-line: #f8c4d3;
  --focus: #e60045;

  --ok: #067647;      --ok-bg: #ecfdf3;      --ok-dot: #17b26a;
  --bad: #b42318;     --bad-bg: #fef3f2;     --bad-dot: #f04438;
  --wait: #854d0e;    --wait-bg: #fefbe8;    --wait-dot: #eab308;   /* Pendente = amarelo */
  --review: #b54708;  --review-bg: #fff6ed;  --review-dot: #f79009; /* Revisar = laranja */
  --bad-solid: #d92d20; --bad-solid-ink: #ffffff;

  --font: ui-sans-serif, system-ui, "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --shadow-sm: 0 1px 2px #1c19170d;
  --shadow: 0 1px 2px #1c19170a, 0 2px 8px -2px #1c191714;
  --shadow-lg: 0 24px 48px -12px #1c191740, 0 2px 6px #1c19171a;
  --ease: cubic-bezier(.2, .7, .3, 1);

  --nav-h: 64px;
  --top-h: 56px;
  --side-w: 252px;
  --side-mini: 76px;
}

/* Escuro: segue o sistema, a não ser que a pessoa tenha escolhido "claro". */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121011; --surface: #1b191a; --surface-2: #232122; --surface-3: #2c292a; --sidebar: #161415;
    --text: #f3f1ef; --text-2: #d6d3d1; --muted: #a8a29e; --line: #2e2b2c; --line-strong: #3d393a; --overlay: #000000a6;
    --brand: #d81b57; --brand-hover: #e8326b; --brand-ink: #ffffff; --brand-text: #ff7fa5; --brand-soft: #d81b5726; --brand-line: #d81b5766; --focus: #ff7fa5;
    --ok: #75e0a7; --ok-bg: #17b26a1f; --ok-dot: #47cd89;
    --bad: #fda29b; --bad-bg: #f044381f; --bad-dot: #f97066;
    --wait: #fde272; --wait-bg: #eab3081c; --wait-dot: #facc15;
    --review: #fdb57a; --review-bg: #f790091f; --review-dot: #fb923c;
    --bad-solid: #d92d20; --bad-solid-ink: #ffffff;
    --shadow-sm: 0 1px 2px #00000040; --shadow: 0 1px 2px #00000040, 0 2px 8px -2px #00000059; --shadow-lg: 0 24px 48px -12px #000000b3, 0 0 0 1px #ffffff0f;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121011; --surface: #1b191a; --surface-2: #232122; --surface-3: #2c292a; --sidebar: #161415;
  --text: #f3f1ef; --text-2: #d6d3d1; --muted: #a8a29e; --line: #2e2b2c; --line-strong: #3d393a; --overlay: #000000a6;
  --brand: #d81b57; --brand-hover: #e8326b; --brand-ink: #ffffff; --brand-text: #ff7fa5; --brand-soft: #d81b5726; --brand-line: #d81b5766; --focus: #ff7fa5;
  --ok: #75e0a7; --ok-bg: #17b26a1f; --ok-dot: #47cd89;
  --bad: #fda29b; --bad-bg: #f044381f; --bad-dot: #f97066;
  --wait: #fde272; --wait-bg: #eab3081c; --wait-dot: #facc15;
  --review: #fdb57a; --review-bg: #f790091f; --review-dot: #fb923c;
  --bad-solid: #d92d20; --bad-solid-ink: #ffffff;
  --shadow-sm: 0 1px 2px #00000040; --shadow: 0 1px 2px #00000040, 0 2px 8px -2px #00000059; --shadow-lg: 0 24px 48px -12px #000000b3, 0 0 0 1px #ffffff0f;
}

/* -------------------------------------------------------------------- base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -.015em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-text); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
svg { flex: none; }

/* ------------------------------------------------------------------ layout */
.layout { min-height: 100dvh; }
.sidebar { display: none; }
main, .main-col { min-width: 0; }
.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 16px 16px 32px; }

/* Topo do celular: logo, quem está logado, tema e Sair */
.mtop {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  min-height: var(--top-h); padding: env(safe-area-inset-top) 12px 0 16px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.mtop .brand { display: flex; align-items: center; flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.mtop .logo { height: 30px; width: auto; display: block; }
.mtop .who { color: var(--muted); font-size: .8rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Barra inferior (celular) */
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 0 4px env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--line);
}
nav.tabs a {
  min-height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600; position: relative;
  -webkit-tap-highlight-color: transparent;
}
nav.tabs a svg { width: 22px; height: 22px; padding: 3px 14px; box-sizing: content-box; border-radius: 999px; transition: background .2s var(--ease), color .2s; }
nav.tabs a[aria-current="page"] { color: var(--text); font-weight: 700; }
nav.tabs a[aria-current="page"] svg { background: var(--brand-soft); color: var(--brand-text); }
nav.tabs .count {
  position: absolute; top: 6px; left: calc(50% + 8px); background: var(--brand); color: var(--brand-ink);
  font-size: .65rem; line-height: 17px; min-width: 18px; padding: 0 5px; border-radius: 9px; text-align: center; font-weight: 800;
  box-shadow: 0 0 0 2px var(--surface);
}

/* Menu lateral (tablet e desktop) */
@media (min-width: 768px) {
  body { padding-bottom: 0; }
  .mtop, nav.tabs { display: none; }
  .layout { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); transition: grid-template-columns .25s var(--ease); }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100dvh;
    background: var(--sidebar); border-right: 1px solid var(--line); padding: 16px 12px;
    container-type: inline-size; overflow: hidden auto;
  }
  .container { padding: 24px 24px 48px; }
}
@media (min-width: 768px) and (max-width: 1023.98px) {
  :root:not([data-nav="expanded"]) { --side-w: var(--side-mini); }
}
@media (min-width: 1024px) {
  :root[data-nav="collapsed"] { --side-w: var(--side-mini); }
  .container { padding: 32px 40px 64px; }
}

.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 14px; }
.side-top .brand { display: block; min-width: 0; }
.side-top .logo { height: 38px; width: auto; display: block; }
.side-nav { display: grid; gap: 2px; }
.side-label { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: 10px;
  color: var(--text-2); text-decoration: none; font-weight: 600; font-size: .92rem; position: relative;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 20px; height: 20px; color: var(--muted); transition: color .15s; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item:hover svg { color: var(--text-2); }
.nav-item[aria-current="page"] { background: var(--brand-soft); color: var(--brand-text); }
.nav-item[aria-current="page"] svg { color: var(--brand-text); }
.nav-item .nav-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item .count {
  font-size: .72rem; font-weight: 750; min-width: 22px; height: 20px; line-height: 20px; padding: 0 7px; border-radius: 999px;
  text-align: center; background: var(--brand); color: var(--brand-ink); font-variant-numeric: tabular-nums;
}
.side-foot { margin-top: auto; display: grid; gap: 2px; padding-top: 12px; border-top: 1px solid var(--line); }
.user { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; min-width: 0; }
.avatar {
  width: 32px; height: 32px; border-radius: 999px; flex: none; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2); font-weight: 700; font-size: .85rem;
}
.user .who { min-width: 0; display: grid; line-height: 1.25; }
.user .who strong { font-size: .88rem; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user .who span { font-size: .76rem; color: var(--muted); }
button.nav-item { width: 100%; background: none; border: 0; text-align: left; }

/* Menu recolhido: só ícones (tablet por padrão; desktop se a pessoa recolher) */
@container (max-width: 120px) {
  .side-top { flex-direction: column; padding: 2px 0 12px; gap: 10px; }
  .side-top .logo { height: auto; width: 48px; }
  .side-label { display: none; }
  .nav-item { justify-content: center; padding: 0; min-height: 44px; }
  .nav-item .nav-label { display: none; }
  .nav-item .count {
    position: absolute; top: 4px; right: 6px; min-width: 18px; height: 18px; line-height: 18px; padding: 0 4px; font-size: .64rem;
    box-shadow: 0 0 0 2px var(--sidebar);
  }
  .user { justify-content: center; padding: 8px 0; }
  .user .who { display: none; }
}

/* Botão de ícone (recolher menu, tema, fechar diálogo) */
.iconbtn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; padding: 0;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted); transition: background .15s, color .15s;
}
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn svg { width: 18px; height: 18px; }
.linkbtn { background: none; border: 0; color: var(--text-2); padding: 0 12px; min-height: 36px; font-weight: 650; font-size: .88rem; border-radius: 10px; }
.linkbtn:hover { background: var(--surface-2); color: var(--text); }

/* ----------------------------------------------------------- cabeçalho de página */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head > div { min-width: 0; }
.page-head h2 { font-size: 1.35rem; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }
.page-head .count-pill {
  display: inline-block; vertical-align: 3px; margin-left: 8px; font-size: .8rem; font-weight: 700; padding: 1px 9px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2); font-variant-numeric: tabular-nums;
}
@media (min-width: 1024px) {
  .page-head { margin-bottom: 20px; }
  .page-head h2 { font-size: 1.6rem; letter-spacing: -.02em; }
}
.section { margin-top: 24px; }
.section-title { font-size: .78rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }

/* ------------------------------------------------------------------- cartões */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow-sm); }
.card.flush { padding: 0; overflow: hidden; }
.card-title { font-size: .95rem; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }

/* Resumo */
.dash { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.dash-row { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.kpis { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (min-width: 1024px) {
  .dash { gap: 24px; }
  .dash-row.halves { grid-template-columns: 1fr 1fr; gap: 24px; }
  .dash-row.thirds { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 24px; }
}
.kpi { display: flex; flex-direction: column; gap: 2px; min-width: 0; position: relative; }
.kpi .kpi-ico {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 10px;
  background: var(--surface-2); color: var(--text-2);
}
.kpi .kpi-ico svg { width: 18px; height: 18px; }
.kpi.accent .kpi-ico { background: var(--brand-soft); color: var(--brand-text); }
.kpi .label { color: var(--muted); font-size: .82rem; font-weight: 600; }
.kpi .value { font-size: 1.6rem; font-weight: 750; letter-spacing: -.025em; font-variant-numeric: tabular-nums; line-height: 1.2; overflow-wrap: anywhere; }
.kpi .sub { color: var(--muted); font-size: .82rem; }
.kpi .sub.bad { color: var(--bad); font-weight: 650; }
@media (min-width: 1024px) { .kpi { padding: 20px; } .kpi .value { font-size: 1.9rem; } }
.kpi.link { text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .2s var(--ease), transform .2s var(--ease); }
.kpi.link:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi.link .go { position: absolute; top: 18px; right: 16px; color: var(--muted); width: 18px; height: 18px; transition: transform .2s var(--ease), color .15s; }
.kpi.link:hover .go { transform: translateX(2px); color: var(--text); }
.kpi.alert .kpi-ico { background: var(--bad-bg); color: var(--bad); }

.statbars { display: grid; gap: 12px; }
.statbar { display: grid; grid-template-columns: 104px minmax(0, 1fr) 44px; align-items: center; gap: 12px; font-size: .9rem; }
.statbar .track { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.statbar .track i { display: block; height: 100%; border-radius: 999px; background: var(--st, var(--muted)); min-width: 2px; transition: width .4s var(--ease); }
.statbar .n { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.totline { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.totline strong { color: var(--text); font-variant-numeric: tabular-nums; }

.daychart { display: flex; align-items: flex-end; gap: 6px; height: 180px; overflow-x: auto; padding-top: 4px; }
.daychart .col { flex: 1 0 28px; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.daychart .stick { flex: 1; width: 100%; max-width: 44px; display: flex; align-items: flex-end; background: var(--surface-2); border-radius: 8px; }
.daychart .stick i { display: block; width: 100%; min-height: 3px; background: var(--brand); border-radius: 8px; opacity: .9; transition: opacity .15s; }
.daychart .col:hover .stick i { opacity: 1; }
.daychart .n { font-size: .78rem; font-weight: 700; min-height: 1em; font-variant-numeric: tabular-nums; }
.daychart .d { font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }

details.card { padding: 0; }
details.card > summary { padding: 0 16px; }
details.card > :not(summary) { margin: 0 16px 16px; }
summary { cursor: pointer; font-weight: 650; min-height: 52px; display: flex; align-items: center; gap: 10px; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary .chev { width: 18px; height: 18px; color: var(--muted); transition: transform .2s var(--ease); margin-left: auto; }
details[open] summary .chev { transform: rotate(90deg); }
summary .ico { width: 18px; height: 18px; color: var(--muted); }
details pre {
  white-space: pre-wrap; font: inherit; font-size: .9rem; line-height: 1.55; background: var(--surface-2); padding: 14px 16px;
  border-radius: var(--r); overflow-wrap: anywhere; border: 1px solid var(--line);
}

/* --------------------------------------------------------- selos de status */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 999px;
  font-size: .76rem; font-weight: 650; white-space: nowrap; line-height: 1.5; border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: var(--st); }
.s-OK, .st-OK { --st: var(--ok-dot); }
.s-Reprovado, .st-Reprovado { --st: var(--bad-dot); }
.s-Pendente, .st-Pendente { --st: var(--wait-dot); }
.s-Revisar, .st-Revisar { --st: var(--review-dot); }
.badge.s-OK { background: var(--ok-bg); color: var(--ok); }
.badge.s-Reprovado { background: var(--bad-bg); color: var(--bad); }
.badge.s-Pendente { background: var(--wait-bg); color: var(--wait); }
.badge.s-Revisar { background: var(--review-bg); color: var(--review); }

/* ---------------------------------------------------------- filtros (chips) */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 767.98px) {
  /* Celular: uma linha só, rolando para o lado */
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
}
.chip {
  min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: .88rem; color: var(--text-2); display: inline-flex; align-items: center; gap: 8px;
  transition: border-color .15s, background .15s, color .15s;
}
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip .n {
  min-width: 22px; text-align: center; padding: 0 6px; border-radius: 999px; font-size: .74rem; line-height: 20px;
  background: var(--surface-2); color: var(--muted); font-variant-numeric: tabular-nums;
}
.chip[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-text); border-color: var(--brand-line); }
.chip[aria-pressed="true"] .n { background: var(--surface); color: inherit; }
.chip.alert { border-color: var(--bad-dot); color: var(--bad); }
.chip.alert .n { background: var(--bad-bg); color: var(--bad); }
.chip.alert[aria-pressed="true"] { background: var(--bad-solid); color: var(--bad-solid-ink); border-color: var(--bad-solid); }
.chip.alert[aria-pressed="true"] .n { background: #ffffff33; color: inherit; }

/* ---------------------------------------------------------------- pendências */
.groups { display: grid; gap: 24px; margin-top: 20px; grid-template-columns: minmax(0, 1fr); }
.group-title { font-size: .95rem; font-weight: 700; display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; }
.group-title .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--st); align-self: center; flex: none; }
.group-title small { color: var(--muted); font-weight: 500; font-size: .84rem; line-height: 1.35; flex-basis: 100%; padding-left: 18px; }
@media (min-width: 768px) { .group-title small { flex-basis: auto; padding-left: 0; } }
.list { display: grid; gap: 10px; margin-top: 12px; }
.group .list { margin-top: 10px; }
@media (min-width: 1024px) {
  .group .list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 16px; }
}

/* Cartão de pendência (mesma ordem do FIV-26 no celular: nome e status, problema, dados, ações) */
.pending-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px 14px 18px;
  display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-sm), inset 3px 0 0 var(--st, var(--line-strong));
  min-width: 0; transition: box-shadow .2s var(--ease), border-color .15s;
}
.pending-card:hover { border-color: var(--line-strong); }
.row1 { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.row1 .badge { flex: none; }
.row1 .name { font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; min-width: 0; font-size: 1rem; }
.why { font-size: .9rem; margin: 0; overflow-wrap: anywhere; color: var(--text-2); }

/* Explicação dos motivos */
.problems { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: .9rem; }
.problems li { position: relative; padding-left: 16px; }
.problems li::before { content: ""; position: absolute; left: 2px; top: .58em; width: 6px; height: 6px; border-radius: 999px; background: var(--st, var(--muted)); }
.problems li strong { display: block; font-weight: 600; overflow-wrap: anywhere; color: var(--text); }
.problems li span { display: block; color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; margin-top: 1px; }

/* Dados da venda e o que foi lido do comprovante */
.pc-data { display: grid; gap: 6px; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); }
.meta { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; line-height: 1.5; }
.meta > span + span::before { content: "·"; margin: 0 6px; }
.meta .amt, .meta .when, .meta .by { white-space: nowrap; }
.meta .amt { color: var(--text); font-weight: 700; font-size: .98rem; font-variant-numeric: tabular-nums; }
.readdata { display: flex; flex-wrap: wrap; gap: 2px 16px; font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.readdata > span { min-width: 0; }
.readdata em { font-style: normal; font-weight: 600; margin-right: 6px; color: var(--text-2); }

/* Ações: no celular dividem a linha (como antes); no desktop ficam do tamanho natural */
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pending-card .actions { margin-top: auto; padding-top: 2px; }
.pending-card .actions { gap: 6px; }
.pending-card .actions .btn { flex: 1 1 110px; padding: 0 10px; }
.pending-card .actions .btn.danger { flex: 0 0 auto; }
@media (min-width: 768px) {
  .pending-card .actions { padding-top: 12px; border-top: 1px solid var(--line); }
  .pending-card .actions .btn { flex: 0 0 auto; }
  .pending-card .actions .btn.primary { order: 4; margin-left: auto; }
  .pending-card .actions .btn.danger { order: 3; margin-left: auto; }
  .pending-card .actions:has(.danger) .btn.primary { margin-left: 0; }
}
/* Excluir discreto: só o ícone (o nome continua para leitor de tela e no title) */
.pending-card .actions .btn.danger { width: 44px; padding: 0; }
.pending-card .actions .btn.danger .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (min-width: 768px) { .pending-card .actions .btn.danger { width: 38px; } }

/* Etiquetas de categoria do problema */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; font-size: .76rem; font-weight: 650; line-height: 1.5; padding: 2px 9px; border-radius: 6px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line);
}

/* Seleção para marcar em massa */
.pick { display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; margin: -2px 0 0 -4px; cursor: pointer; position: relative; }
.pick::before { content: ""; position: absolute; inset: -10px; } /* alvo de toque de 44px */
.pick input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.row1 .name { flex: 1; }
.pending-card.selected { border-color: var(--brand-line); background: color-mix(in srgb, var(--brand-soft) 45%, var(--surface)); }

/* "Ver detalhe": a explicação longa, recolhida */
details.more { margin-top: -2px; }
details.more > summary {
  min-height: 0; display: inline-flex; gap: 4px; font-size: .82rem; font-weight: 600; color: var(--muted); padding: 2px 0; border-radius: 6px;
}
details.more > summary:hover { color: var(--text); }
details.more > summary .chev { width: 14px; height: 14px; margin: 0; }
details.more[open] > summary { margin-bottom: 8px; }

/* Filtros da tela de pendências */
.facets { display: grid; gap: 10px; }
.facet { display: grid; gap: 6px; min-width: 0; }
.facet-label { font-size: .72rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
@media (min-width: 768px) {
  .facet { grid-template-columns: 96px minmax(0, 1fr); align-items: start; gap: 12px; }
  .facet-label { padding-top: 11px; }
  .pend-tools .facet-label { padding-top: 0; }
}
@media (max-width: 767.98px) {
  /* Celular: menos texto em volta da lista */
  .pend-tools .facet-label, .group-title small { display: none; }
  .pend-tools { flex-wrap: nowrap; }
}
.pend-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.pend-tools .facet { grid-template-columns: auto auto; align-items: center; gap: 10px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; padding: 0 12px; min-height: 30px; border-radius: 7px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.linkbtn.sm { min-height: 30px; font-size: .82rem; padding: 0 10px; }
.linkbtn:disabled { opacity: .5; cursor: default; }
.group-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.group-head .linkbtn { flex: none; margin-top: -4px; color: var(--brand-text); }
.group.by-cat { --st: var(--muted); }

/* Barra de ação em massa: gruda no rodapé enquanto há seleção */
.bulkbar {
  position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px); z-index: 4; margin-top: 16px;
  display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 16px; border-radius: 14px;
  background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg); animation: rise .2s var(--ease);
}
.bulkbar[hidden] { display: none; }
.bulkbar .bulk-n { flex: 1; font-weight: 650; font-size: .92rem; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 767.98px) {
  .bulkbar { gap: 4px; padding-left: 14px; }
  .bulkbar .bulk-n { font-size: .85rem; }
  .bulkbar .linkbtn { padding: 0 8px; }
  .bulkbar .btn { padding: 0 14px; }
}
.bulkbar .linkbtn { color: var(--surface); opacity: .85; }
.bulkbar .linkbtn:hover { background: color-mix(in srgb, var(--surface) 14%, transparent); color: var(--surface); opacity: 1; }
@media (min-width: 768px) { .bulkbar { bottom: 20px; max-width: 560px; margin-left: auto; margin-right: auto; } }

/* Lista de nomes nos diálogos de massa */
.namelist { list-style: none; margin: 10px 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r); max-height: 40dvh; overflow-y: auto; }
.namelist li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.namelist li:last-child { border-bottom: 0; }
.namelist li span:first-child { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.namelist li small { color: var(--muted); text-align: right; }
.namelist .more-n { color: var(--muted); justify-content: center; }

/* ------------------------------------------------------------------- vendas */
.toolbar { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.toolbar .wide, .toolbar select { grid-column: 1 / -1; }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 38px !important; }
@media (min-width: 768px) {
  .toolbar { grid-template-columns: minmax(0, 2.2fr) repeat(3, minmax(0, 1fr)); }
  .toolbar .wide, .toolbar select { grid-column: auto; }
}
.resultline { margin: 14px 2px 0; color: var(--muted); font-size: .85rem; }

.sale {
  display: grid; gap: 4px 10px; text-align: left; width: 100%;
  grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name badge" "why why" "meta meta";
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px;
  box-shadow: var(--shadow-sm); transition: border-color .15s, background .15s;
}
.sale:hover { border-color: var(--line-strong); }
.sale .name { grid-area: name; font-weight: 650; overflow-wrap: anywhere; min-width: 0; }
.sale .badge { grid-area: badge; justify-self: end; align-self: start; }
.sale .why { grid-area: why; font-size: .85rem; color: var(--muted); }
.sale .meta { grid-area: meta; }
.sale-head { display: none; }

@media (min-width: 1024px) {
  .list.sales { gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
  .sale-head, .sale {
    grid-template-columns: minmax(0, 1fr) 120px 170px 110px 112px;
    grid-template-areas: "name amt by when badge" "why amt by when badge";
    column-gap: 20px; align-items: center;
  }
  .sale-head {
    display: grid; padding: 10px 20px; font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); grid-template-areas: none;
  }
  .sale-head span:nth-child(2) { text-align: right; }
  .sale { border: 0; border-radius: 0; box-shadow: none; padding: 12px 20px; border-bottom: 1px solid var(--line); row-gap: 0; }
  .sale:last-child { border-bottom: 0; }
  .sale:hover { background: var(--surface-2); }
  .sale:focus-visible { outline-offset: -2px; border-radius: 0; }
  .sale .meta { display: contents; }
  .sale .meta > span::before { content: none; }
  .sale .meta .amt { grid-area: amt; text-align: right; font-size: .92rem; font-weight: 650; }
  .sale .meta .by { grid-area: by; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sale .meta .by .pre { display: none; }
  .sale .meta .when { grid-area: when; font-size: .86rem; font-variant-numeric: tabular-nums; }
  .sale .badge { justify-self: start; align-self: center; }
  .sale .why { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* ------------------------------------------------------------------- config */
.settings { padding: 0; overflow: hidden; }
.setting { display: grid; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting .field { margin: 0; }
.setting .actions { justify-content: flex-end; }
@media (min-width: 1024px) {
  .setting { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) auto; align-items: center; gap: 24px; padding: 16px 20px; }
  .setting .field { display: contents; }
  .setting .field label { font-size: .92rem; color: var(--text); font-weight: 550; }
  .setting:not(:has(.actions)) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
}

/* ----------------------------------------------------------------- controles */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: .92rem; white-space: nowrap;
  box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, color .15s, transform .1s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
a.btn { text-decoration: none; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; box-shadow: 0 1px 2px #1c19171f, inset 0 1px 0 #ffffff26; }
.btn.primary:hover { background: var(--brand-hover); }
.btn.danger { color: var(--muted); border-color: transparent; background: transparent; box-shadow: none; }
.btn.danger:hover { color: var(--bad); background: var(--bad-bg); }
.btn.danger.solid { background: var(--bad-solid); color: var(--bad-solid-ink); border-color: transparent; }
.btn.danger.solid:hover { filter: brightness(.94); background: var(--bad-solid); color: var(--bad-solid-ink); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.primary:disabled { opacity: 1; background: var(--surface-3); color: var(--muted); box-shadow: none; }
@media (min-width: 768px) {
  .btn { min-height: 38px; padding: 0 14px; font-size: .88rem; }
}

.field { display: grid; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field label { font-size: .84rem; color: var(--text-2); font-weight: 600; }
.field input, .field select, .field textarea, .toolbar input, .toolbar select {
  min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: color-mix(in srgb, var(--line-strong) 60%, var(--muted)); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.field textarea { min-height: 88px; resize: vertical; }
.field input[readonly] { background: var(--surface-2); color: var(--muted); }
@media (min-width: 768px) {
  .field input, .field select, .toolbar input, .toolbar select { min-height: 40px; font-size: .92rem; }
  .field textarea { font-size: .92rem; }
}

/* ------------------------------------------------------- vazio e carregando */
.empty { text-align: center; color: var(--muted); padding: 48px 16px; display: grid; justify-items: center; gap: 4px; }
.empty .empty-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); margin-bottom: 8px; }
.empty .empty-icon svg { width: 24px; height: 24px; }
.empty.good .empty-icon { background: var(--ok-bg); color: var(--ok); }
.empty p { margin: 0; }
.empty .empty-title { color: var(--text); font-weight: 650; }
.card .empty { padding: 32px 8px; }

.skel { display: grid; gap: 16px; }
.skel .bar, .skel .box {
  border-radius: var(--r); background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%; animation: shimmer 1.3s ease-in-out infinite;
}
.skel .bar { height: 14px; }
.skel .bar.title { height: 26px; width: 220px; }
.skel .bar.short { width: 40%; }
.skel .box { height: 120px; border-radius: var(--r-lg); }
.skel .boxes { display: grid; gap: 16px; }
@media (min-width: 1024px) { .skel .boxes { grid-template-columns: 1fr 1fr; } .skel .box { height: 160px; } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.view-in { animation: rise .25s var(--ease) both; }

/* ------------------------------------------------------------------ diálogos */
dialog {
  border: 1px solid var(--line); border-radius: 20px; padding: 0; width: min(560px, calc(100vw - 32px)); max-height: min(92dvh, 900px);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.wide { width: min(1040px, calc(100vw - 48px)); }
dialog.mid { width: min(720px, calc(100vw - 32px)); }
dialog[open] { animation: pop .2s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
dialog::backdrop { background: var(--overlay); backdrop-filter: blur(3px); }
dialog form { display: flex; flex-direction: column; max-height: min(92dvh, 900px); }
dialog .head { padding: 16px 16px 12px 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
dialog .head h3 { font-size: 1.05rem; font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
dialog .body { padding: 16px 20px; overflow-y: auto; }
dialog .foot { padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); background: var(--surface); }
dialog .intro { margin: 0 0 14px; color: var(--muted); font-size: .9rem; }
@media (max-width: 600px) {
  dialog, dialog.wide, dialog.mid { margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; width: 100vw; max-width: 100vw; border-bottom: 0; }
  dialog[open] { animation: sheet .25s var(--ease); }
  dialog .foot .btn { flex: 1; }
}
@keyframes sheet { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

/* Formulários em duas colunas quando há espaço */
.form-grid { display: grid; column-gap: 14px; }
@media (min-width: 600px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .span2 { grid-column: 1 / -1; }
}
/* Corrigir: comprovante ao lado do formulário em telas largas */
.edit-grid { display: grid; gap: 16px; }
.edit-side { display: grid; gap: 12px; align-content: start; min-width: 0; }
.edit-side .problems { padding: 12px 14px; background: var(--surface-2); border-radius: var(--r); }
@media (min-width: 900px) {
  .edit-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 24px; }
  .edit-side { position: sticky; top: 0; }
  .edit-side .receipt-photo { max-height: 62dvh; }
}
.receipt-photo { display: block; width: 100%; max-height: 72dvh; object-fit: contain; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); margin: 0; }
.receipt-link { display: block; border-radius: var(--r); }
.hint { margin: 8px 0 0; color: var(--muted); font-size: .84rem; }
.reg { margin: 0; color: var(--muted); font-size: .85rem; }
.dlg-summary { display: grid; gap: 8px; padding: 12px 14px; margin: 14px 0 4px; box-shadow: none; background: var(--surface-2); border-color: var(--line); }
.warn { background: var(--wait-bg); color: var(--wait); padding: 10px 12px; border-radius: var(--r); margin-bottom: 14px; font-size: .9rem; border: 1px solid color-mix(in srgb, var(--wait-dot) 35%, transparent); }

/* -------------------------------------------------------------------- login */
.login {
  min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px calc(32px + env(safe-area-inset-bottom));
  background:
    radial-gradient(900px 480px at 50% -10%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 70%),
    var(--bg);
}
.login .inner { width: 100%; max-width: 400px; }
.login .logo { width: min(60vw, 220px); height: auto; display: block; margin: 0 auto 20px; filter: drop-shadow(0 12px 24px #1c191733); }
.login h1 { font-size: 1.4rem; text-align: center; letter-spacing: -.02em; }
.login p { text-align: center; color: var(--muted); margin: 6px 0 0; font-size: .95rem; }
.login .card { margin-top: 24px; padding: 24px; box-shadow: var(--shadow-lg); border-radius: 20px; }
.login .card .btn.primary { width: 100%; margin-top: 4px; min-height: 44px; }
.login .foot { text-align: center; font-size: .76rem; color: var(--muted); margin-top: 24px; letter-spacing: .04em; }
.error { color: var(--bad); font-size: .9rem; min-height: 1.3em; margin-bottom: 8px; }
.card.error { color: var(--bad); }

/* -------------------------------------------------------------------- toast */
#toast {
  position: fixed; left: 50%; transform: translate(-50%, 8px); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom));
  background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 12px; font-size: .9rem; font-weight: 550;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s var(--ease); z-index: 20; max-width: calc(100vw - 32px);
  box-shadow: var(--shadow-lg);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 768px) {
  #toast { left: auto; right: 24px; bottom: 24px; transform: translateY(8px); }
  #toast.show { transform: none; }
}

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

/* "Olhinho" do Resumo: esconde valores e contagens, como nos apps de banco */
.secret { white-space: nowrap; }
.secret .dots { display: none; letter-spacing: .08em; }
.masked .secret .real { display: none; }
.masked .secret .dots { display: inline; }
.masked .blur-when-masked { filter: blur(7px); pointer-events: none; user-select: none; }
.blur-when-masked { transition: filter .2s ease; }
.eye-toggle { gap: 8px; }
@media (max-width: 600px) { .eye-toggle .lbl { display: none; } }

/* ---------------------------------------------------------------- app (PWA) */
/* Áreas seguras do iPhone (notch e barra de gestos), inclusive deitado. */
.mtop { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
nav.tabs { padding-left: max(4px, env(safe-area-inset-left)); padding-right: max(4px, env(safe-area-inset-right)); }
.container { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
@media (min-width: 768px) {
  .sidebar { padding-left: max(12px, env(safe-area-inset-left)); padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .container { padding-left: 24px; padding-right: max(24px, env(safe-area-inset-right)); }
}
@media (min-width: 1024px) {
  .container { padding-left: 40px; padding-right: max(40px, env(safe-area-inset-right)); }
}
.login { padding-top: max(32px, env(safe-area-inset-top)); }

/* Toast com ação (ex.: "Nova versão disponível · Atualizar"): fica até tocar. */
#toast.has-action { display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 16px; pointer-events: auto; }
#toast .toast-action {
  border: 0; border-radius: 9px; min-height: 34px; padding: 0 14px; font-weight: 700; font-size: .88rem;
  background: var(--brand); color: var(--brand-ink); white-space: nowrap;
}
#toast .toast-action:hover { background: var(--brand-hover); }

/* Card "Instalar app" na Config */
.install-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 16px; }
.install-card img { width: 44px; height: 44px; border-radius: 10px; flex: none; }
.install-card .txt { flex: 1; min-width: 0; }
.install-card .txt strong { display: block; font-size: .95rem; }
.install-card .txt span { display: block; color: var(--muted); font-size: .86rem; }
.install-card[hidden] { display: none; }

/* Config: um botão "Salvar alterações" para tudo (barra igual à de ação em massa) */
.setting.dirty { box-shadow: inset 3px 0 0 var(--brand); }
.setting .field-error { margin: 0; color: var(--bad); font-size: .85rem; grid-column: 1 / -1; }
.setting .field-error[hidden] { display: none; }
.setting input[aria-invalid="true"] { border-color: var(--bad); }
.savebar .btn.primary { flex: none; }
@media (max-width: 767.98px) { .savebar .long { display: none; } }
/* Toast não cobre a barra de salvar / ação em massa enquanto ela está na tela */
body:has(.bulkbar:not([hidden])) #toast { bottom: calc(var(--nav-h) + 88px + env(safe-area-inset-bottom)); }
@media (min-width: 768px) { body:has(.bulkbar:not([hidden])) #toast { bottom: 96px; } }
/* Resumo: olhinho no canto superior direito, na linha do título (também no celular) */
.page-head.head-eye { flex-wrap: nowrap; align-items: flex-start; }
.page-head.head-eye .eye-toggle { flex: none; margin-top: -2px; }
@media (max-width: 600px) { .page-head.head-eye .eye-toggle { margin-right: -8px; } }
/* Toast centralizado com left:50% encolhia até metade da tela ("Nova / versão / disponível") */
#toast { width: max-content; }
