/* Cadu: cinza frio + azul Cadu, textura de grade de planilha */
:root {
  --bg: #ECEFF4;
  --surface: #FFFFFF;
  --sunken: #F4F6FA;
  --ink: #0E1430;
  --muted: #586180;
  --grid: #D3D9E5;
  --grid-faint: rgba(14, 20, 48, .055);
  --accent: #2B3FF0;
  --accent-ink: #FFFFFF;
  --accent-soft: #E4E7FF;
  --live: #8F9BFF;
  --danger: #B3370B;
  --warn: #8F5400;
  --ok: #0B7A54;
  --shadow: 0 1px 0 rgba(14, 20, 48, .04), 0 14px 34px -14px rgba(14, 20, 48, .22);
  --r-s: 10px;
  --r-m: 16px;
  --r-l: 24px;
  --dock-h: 132px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090D1D;
    --surface: #121834;
    --sunken: #0D1229;
    --ink: #ECEFFF;
    --muted: #9AA3C9;
    --grid: #262E55;
    --grid-faint: rgba(236, 239, 255, .05);
    --accent: #8F9BFF;
    --accent-ink: #090D1D;
    --accent-soft: #1C2252;
    --live: #2B3FF0;
    --danger: #FF8E62;
    --warn: #F2B64B;
    --ok: #46D6A0;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 18px 40px -16px rgba(0, 0, 0, .7);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 500 16px/1.5 "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 14px;
  background: var(--ink); color: var(--bg); border-radius: var(--r-s); font-weight: 700; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- topo ---------- */
.top {
  max-width: 1040px; margin: 0 auto;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px 16px;
  padding: max(14px, env(safe-area-inset-top)) 16px 10px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 24px; font-weight: 800; letter-spacing: -.03em; color: var(--ink); text-decoration: none;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
}
.tabs {
  justify-self: center; display: inline-flex; gap: 2px; padding: 4px;
  background: var(--sunken); border: 1px solid var(--grid); border-radius: 14px;
}
.tabs a {
  padding: 8px 16px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 700; font-size: 15px;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(14, 20, 48, .12); }
.chip {
  font-size: 14px; font-weight: 700; padding: 8px 14px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--grid); color: var(--ink); white-space: nowrap;
}
.chip.on { color: var(--ok); border-color: currentColor; }
@media (max-width: 720px) {
  .top { grid-template-columns: 1fr auto; }
  .tabs { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; display: grid; grid-template-columns: repeat(3, 1fr); }
  .tabs a { text-align: center; padding: 9px 6px; }
}

/* ---------- conteúdo ---------- */
main {
  max-width: 1040px; margin: 0 auto; padding: 8px 16px calc(var(--dock-h) + 40px);
}
#view:focus, #view:focus-visible { outline: none; }
.stack { display: grid; gap: 28px; }
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin: 10px 0 18px;
}
.page-head h1 { margin: 0; font-size: clamp(28px, 6vw, 38px); font-weight: 800; letter-spacing: -.035em; line-height: 1.05; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.back {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px;
  color: var(--muted); font-weight: 700; text-decoration: none; font-size: 15px;
}
.back:hover { color: var(--ink); }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* hero com grade de planilha */
.hero {
  position: relative; overflow: hidden;
  padding: 30px 22px 22px; border: 1px solid var(--grid); border-radius: var(--r-l);
  background-color: var(--surface);
  background-image:
    linear-gradient(var(--grid-faint) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-faint) 1px, transparent 1px);
  background-size: 100% 34px, 104px 100%;
  background-position: 0 -1px, -1px 0;
}
.hero h1 { margin: 0; max-width: 16ch; font-size: clamp(32px, 7.4vw, 50px); font-weight: 800; letter-spacing: -.04em; line-height: 1.02; }
.hero .lead { margin: 12px 0 18px; max-width: 46ch; color: var(--muted); font-size: 17px; }
.examples { display: grid; gap: 8px; max-width: 640px; }
.example {
  text-align: left; cursor: pointer; padding: 11px 14px; border-radius: 12px;
  background: var(--sunken); border: 1px solid var(--grid); color: var(--ink); font-weight: 600; font-size: 15px;
  transition: border-color .15s ease, background-color .15s ease;
}
.example:hover { border-color: var(--accent); background: var(--accent-soft); }
.templates-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.tpl {
  text-align: left; cursor: pointer; padding: 16px; border-radius: var(--r-m);
  background: var(--sunken); border: 1px solid var(--grid); display: grid; gap: 8px;
}
.tpl:hover { border-color: var(--accent); }
.tpl strong { font-size: 18px; letter-spacing: -.01em; }
.tpl-cols { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--grid); border-radius: 8px; overflow: hidden; width: fit-content; max-width: 100%; }
.tpl-cols span {
  padding: 4px 8px; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface);
  border-right: 1px solid var(--grid); white-space: nowrap;
}
.tpl-cols span:last-child { border-right: 0; }

/* seções e listas tipo razão */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 10px; }
.section-head h2 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.more { font-weight: 700; font-size: 15px; text-decoration: none; }
.more:hover { text-decoration: underline; }
.ledger { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--grid); border-radius: var(--r-m); overflow: hidden; }
.ledger > li + li { border-top: 1px solid var(--grid); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 66px; }
.row-link { color: inherit; text-decoration: none; }
.row-link:hover { background: var(--sunken); }
.row-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.row-text .kicker { font-size: 13px; color: var(--muted); font-weight: 600; }
.row-text strong { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-text .sub { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* lembretes: texto completo, quebrando linha */
.row-text.wrap strong, .row-text.wrap .sub { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
.row-aside { display: grid; justify-items: end; gap: 2px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.row-aside .count { font-size: 14px; font-weight: 700; color: var(--ink); }
.badge {
  flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--sunken); border: 1px solid var(--grid); font-weight: 800; font-size: 16px; color: var(--ink);
}
.tag { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--grid); color: var(--muted); }
.sync { font-weight: 700; }
.sync.synced { color: var(--ok); }
.sync.pending { color: var(--muted); }
.sync.error { color: var(--danger); }
.empty-line { margin: 0; padding: 18px; border: 1px dashed var(--grid); border-radius: var(--r-m); color: var(--muted); }

.icon-btn {
  flex: none; width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer;
  background: none; border: 0; border-radius: 12px; color: var(--muted);
}
.icon-btn:hover { color: var(--ink); background: var(--sunken); }
.check span {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--muted); display: grid; place-items: center;
}
.is-done .check span { background: var(--ok); border-color: var(--ok); color: #fff; }
.is-done .row-text strong { text-decoration: line-through; color: var(--muted); }
.late { color: var(--danger); font-weight: 700; }
.sent { color: var(--ok); font-weight: 700; }
.done-wrap { margin-top: 18px; }
.done-wrap summary { cursor: pointer; font-weight: 700; color: var(--muted); padding: 6px 0 10px; }

/* banner */
.banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px;
  padding: 12px 14px; margin-bottom: 14px; border-radius: var(--r-m);
  border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--grid));
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
}
.banner p { margin: 0; font-weight: 600; }

/* ---------- tabela estilo planilha ---------- */
.grid-wrap {
  overflow: auto; border: 1px solid var(--grid); border-radius: var(--r-m); background: var(--surface);
  max-height: calc(100dvh - 300px); min-height: 160px; -webkit-overflow-scrolling: touch;
}
.grid { border-collapse: separate; border-spacing: 0; min-width: 100%; font-variant-numeric: tabular-nums; font-size: 15px; }
.grid th, .grid td {
  border-right: 1px solid var(--grid); border-bottom: 1px solid var(--grid);
  padding: 10px 12px; text-align: left; white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis;
}
.grid thead th { position: sticky; top: 0; z-index: 2; background: var(--sunken); vertical-align: bottom; }
.grid .L { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
.grid .N { display: block; font-weight: 800; color: var(--ink); }
.grid .rn {
  position: sticky; left: 0; z-index: 1; width: 1%; text-align: right;
  background: var(--sunken); color: var(--muted); font-weight: 700; font-size: 13px;
}
.grid thead .rn { z-index: 3; }
.grid .t-money, .grid .t-number { text-align: right; }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover td { background: var(--accent-soft); }
.grid tbody tr:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.grid tbody tr:last-child td, .grid tbody tr:last-child th { border-bottom: 0; }
.grid td.meta-col { color: var(--muted); font-size: 13px; }
.grid .dotsync { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 8px; vertical-align: middle; }
.dotsync.synced { background: var(--ok); }
.dotsync.pending { background: var(--muted); }
.dotsync.error { background: var(--danger); }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 13px; cursor: pointer; font-weight: 700; text-decoration: none;
  background: var(--surface); color: var(--ink); border: 1px solid var(--grid);
}
.btn:hover { border-color: color-mix(in srgb, var(--ink) 30%, var(--grid)); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-ghost { background: none; border-color: transparent; color: var(--danger); }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 11px; }
.btn[disabled] { opacity: .55; cursor: progress; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.actions .spacer { flex: 1; }

/* ---------- dock ---------- */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; pointer-events: none;
  padding: 26px 12px max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 55%, color-mix(in srgb, var(--bg) 0%, transparent));
}
.dock-card {
  pointer-events: auto; max-width: 680px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "target mic" "say mic"; gap: 6px 12px; align-items: center;
  padding: 10px 10px 10px 12px; background: var(--surface); border: 1px solid var(--grid); border-radius: 26px; box-shadow: var(--shadow);
}
.target { grid-area: target; display: flex; align-items: center; gap: 6px; min-width: 0; padding-left: 4px; }
.target-label { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.target select {
  min-width: 0; max-width: 100%; appearance: none; -webkit-appearance: none; cursor: pointer;
  border: 0; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 13px;
  padding: 4px 26px 4px 10px; border-radius: 999px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 13px center, right 9px center; background-size: 4px 4px; background-repeat: no-repeat;
  text-overflow: ellipsis;
}
@media (prefers-color-scheme: dark) { .target select { color: var(--ink); } }
.say { grid-area: say; position: relative; }
.say input {
  width: 100%; height: 50px; padding: 0 52px 0 16px; border-radius: 16px;
  background: var(--sunken); border: 1px solid var(--grid); color: var(--ink);
}
.say input::placeholder { color: var(--muted); }
.send {
  position: absolute; right: 5px; top: 5px; width: 40px; height: 40px; border-radius: 12px; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--surface); color: var(--ink); border: 1px solid var(--grid);
}
.send[disabled] { opacity: .5; }
.mic {
  grid-area: mic; width: 76px; height: 76px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--accent) 70%, transparent);
  transition: transform .15s ease;
}
.mic:active { transform: scale(.94); }

/* ---------- diálogos ---------- */
dialog {
  border: 0; padding: 0; color: var(--ink); background: var(--surface);
  width: 100%; max-width: 640px; max-height: 92dvh; margin: auto auto 0;
  border-radius: var(--r-l) var(--r-l) 0 0; box-shadow: var(--shadow);
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
}
dialog::backdrop { background: rgba(6, 9, 22, .55); backdrop-filter: blur(2px); }
dialog[open] { animation: rise .26s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { transform: translateY(28px); opacity: 0; } to { transform: none; opacity: 1; } }
.panel > div, .panel > form { padding: 22px 18px max(22px, env(safe-area-inset-bottom)); }
.panel.wide { max-width: 760px; }
.panel.small { max-width: 460px; }
@media (min-width: 760px) {
  dialog { margin: auto; border-radius: var(--r-l); max-height: min(88dvh, 860px); }
  .panel > div, .panel > form { padding: 26px 26px 24px; }
}
.dlg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
dialog h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; }
dialog h3 { margin: 22px 0 10px; font-size: 17px; font-weight: 800; }
.heard {
  margin: 0 0 14px; padding: 12px 14px; border-radius: 14px; background: var(--sunken);
  border-left: 3px solid var(--accent); font-size: 16px;
}
.heard small { display: block; font-size: 13px; color: var(--muted); font-weight: 700; margin-bottom: 2px; }
.note {
  margin: 0 0 14px; padding: 10px 14px; border-radius: 12px; font-weight: 600;
  background: color-mix(in srgb, var(--warn) 12%, var(--surface)); color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--grid));
}
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field > span { font-size: 14px; font-weight: 700; color: var(--muted); }
.field input, .field select, .field textarea {
  min-height: 48px; padding: 10px 14px; border-radius: 12px;
  background: var(--sunken); border: 1px solid var(--grid); color: var(--ink);
}
.field textarea.grow { resize: none; overflow: hidden; line-height: 1.4; font: inherit; }
.toggle { display: flex; align-items: center; gap: 10px; margin: 4px 0 16px; font-weight: 600; cursor: pointer; }
.toggle input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.field.inline { grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
.hint { margin: -4px 0 12px; font-size: 14px; color: var(--warn); }

/* células da conferência */
.cells { list-style: none; margin: 0 0 6px; padding: 0; border: 1px solid var(--grid); border-radius: var(--r-m); overflow: hidden; }
.cell {
  display: grid; grid-template-columns: 42px minmax(0, 1fr); grid-template-areas: "L name" "L ctrl" "L msg";
  background: var(--surface);
}
.cell + .cell { border-top: 1px solid var(--grid); }
.cell .L {
  grid-area: L; display: flex; justify-content: center; padding-top: 12px;
  background: var(--sunken); border-right: 1px solid var(--grid); color: var(--muted); font-weight: 800; font-size: 13px;
}
.cell-name { grid-area: name; padding: 10px 14px 0; font-size: 14px; font-weight: 700; color: var(--muted); }
.req { color: var(--danger); }
.cell-ctrl { grid-area: ctrl; display: flex; align-items: center; min-width: 0; padding: 2px 8px 8px; }
.cell-ctrl input:focus-visible, .cell-ctrl select:focus-visible { outline-offset: -1px; }
.cell-ctrl input, .cell-ctrl select {
  flex: 1; min-width: 0; min-height: 44px; padding: 6px 8px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--ink); font-size: 19px; font-weight: 700;
}
.cell-ctrl input:hover, .cell-ctrl select:hover { background: var(--sunken); }
.cell-ctrl input:focus, .cell-ctrl select:focus { background: var(--sunken); border-color: var(--grid); }
.cell-ctrl .prefix { padding-left: 8px; color: var(--muted); font-weight: 700; }
.cell-msg { grid-area: msg; margin: 0; padding: 0 14px 10px; font-size: 13px; font-weight: 600; }
.cell-msg:empty { display: none; }
.cell-msg.hint-msg { color: var(--warn); }
.cell.missing .L { background: color-mix(in srgb, var(--warn) 16%, var(--sunken)); color: var(--warn); }
.cell.invalid .L { background: color-mix(in srgb, var(--danger) 16%, var(--sunken)); color: var(--danger); }
.cell.invalid .cell-msg { color: var(--danger); }
.segs { display: inline-flex; gap: 6px; padding: 4px 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: inline-block; min-width: 74px; text-align: center; padding: 9px 14px; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--grid); background: var(--sunken); font-weight: 800;
}
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

.cells.fill .cell-ctrl { animation: cellIn .42s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 60ms + 80ms); }
.cells.fill .L { animation: lFlash .7s ease-out backwards; animation-delay: calc(var(--i) * 60ms); }
@keyframes cellIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@keyframes lFlash { 0% { background: var(--accent); color: var(--accent-ink); } 100% { background: var(--sunken); color: var(--muted); } }

.choose { display: grid; gap: 8px; margin-top: 4px; }
.choose .btn { justify-content: flex-start; min-height: 52px; }

/* editor de colunas */
.cols { list-style: none; margin: 0; padding: 0; border: 1px solid var(--grid); border-radius: var(--r-m); overflow: hidden; }
.colrow { display: grid; grid-template-columns: 38px minmax(0, 1fr); background: var(--surface); }
.colrow + .colrow { border-top: 1px solid var(--grid); }
.colrow .L {
  display: flex; justify-content: center; padding-top: 14px; background: var(--sunken);
  border-right: 1px solid var(--grid); color: var(--muted); font-weight: 800; font-size: 13px;
}
.colrow-fields { display: flex; flex-wrap: wrap; gap: 8px 10px; padding: 10px 10px 12px; align-items: flex-end; }
.colrow-fields .field { margin: 0; flex: 1 1 170px; }
.colrow-fields .field.type { flex: 0 1 160px; }
.colrow-fields .field.opts { flex: 1 1 100%; }
.colrow-fields .field input, .colrow-fields .field select { min-height: 42px; padding: 8px 12px; }
.colrow-fields .field > span { font-size: 13px; }
.check-line { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; font-weight: 600; font-size: 14px; cursor: pointer; }
.check-line input { width: 18px; height: 18px; accent-color: var(--accent); }
.colrow .L { grid-row: 1 / span 2; }
.colrow-actions { grid-column: 2; display: flex; justify-content: flex-end; gap: 2px; padding: 0 8px 8px; margin-top: -6px; }
@media (min-width: 760px) {
  .colrow { grid-template-columns: 38px minmax(0, 1fr) auto; align-items: end; }
  .colrow .L { grid-row: auto; align-self: stretch; }
  .colrow-actions { grid-column: 3; padding: 10px 6px 14px 0; margin-top: 0; }
}
.colrow-actions .icon-btn { width: 36px; height: 36px; }
.add-col { margin-top: 10px; }
.gbox {
  margin-top: 20px; border: 1px solid var(--grid); border-radius: var(--r-m); background: var(--sunken);
}
.gbox summary { cursor: pointer; padding: 14px 16px; font-weight: 800; }
.gbox-body { padding: 0 16px 16px; }
.gbox-body p { margin: 0 0 12px; }
.copyline { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.copyline code {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--grid); font-size: 14px;
}
.test-result { margin: 8px 0 0; font-size: 14px; font-weight: 700; }
.test-result.ok { color: var(--ok); }
.test-result.bad { color: var(--danger); }

/* ---------- captura de voz (painel invertido) ---------- */
.capture {
  background: var(--ink); color: var(--bg); max-width: 720px; min-height: min(560px, 82dvh);
  display: none; flex-direction: column; padding: 22px 20px max(20px, env(safe-area-inset-bottom));
}
.capture[open] { display: flex; }
.cap-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.cap-status { margin: 0; display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; }
.cap-status .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--live); animation: blink 1.2s ease-in-out infinite; }
.cap-target { margin: 0; font-size: 14px; font-weight: 600; opacity: .7; }
@keyframes blink { 50% { opacity: .25; } }
.live {
  flex: 1; margin: 28px 0 18px; font-size: clamp(26px, 6.4vw, 40px); font-weight: 700; letter-spacing: -.025em; line-height: 1.18;
  overflow-wrap: anywhere;
}
.live.placeholder { opacity: .45; }
.bars { display: flex; align-items: center; gap: 4px; height: 72px; margin-bottom: 22px; }
.bars span {
  flex: 1; height: 100%; border-radius: 4px; background: var(--live); transform: scaleY(.08); transform-origin: center;
  will-change: transform;
}
.bars.thinking span { animation: wave 1.1s ease-in-out infinite; animation-delay: calc(var(--i) * 40ms); }
@keyframes wave { 0%, 100% { transform: scaleY(.08); } 50% { transform: scaleY(.5); } }
.cap-actions { display: flex; gap: 10px; }
.btn.on-dark { border-color: color-mix(in srgb, var(--bg) 25%, transparent); background: transparent; color: var(--bg); min-height: 52px; }
.btn.on-dark.primary { background: var(--bg); color: var(--ink); border-color: var(--bg); flex: 1; max-width: 240px; }
.btn.on-dark.ghost { border-color: transparent; opacity: .8; }

/* ---------- aviso ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--dock-h) + 20px); z-index: 60; transform: translate(-50%, 10px);
  width: max-content; max-width: min(92vw, 440px); padding: 12px 16px; border-radius: 14px;
  background: var(--ink); color: var(--bg); font-size: 15px; font-weight: 700; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.skeleton { height: 66px; border-radius: var(--r-m); background: var(--sunken); border: 1px solid var(--grid); }

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

/* ---------- conta e login ---------- */
.top-actions { display: flex; align-items: center; gap: 8px; justify-self: end; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 16px;
  background: var(--ink); color: var(--bg); border: 0;
}
@media (max-width: 720px) {
  .top-actions { grid-column: 2; grid-row: 1; }
}
body.signed-out .tabs, body.signed-out .top-actions, body.signed-out .dock { display: none; }
body.signed-out main { padding-bottom: 40px; }
body.booting main { visibility: hidden; }

.auth-wrap { display: grid; place-items: start center; padding-top: 4vh; }
.auth { width: 100%; max-width: 520px; padding: 32px 24px 26px; }
.auth h1 { font-size: clamp(30px, 7vw, 42px); max-width: 15ch; }
.auth .lead { margin-bottom: 22px; }
.btn.block { width: 100%; min-height: 52px; font-size: 17px; }
.auth-or {
  display: flex; align-items: center; gap: 12px; margin: 20px 0 16px; color: var(--muted); font-size: 14px; font-weight: 600;
}
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--grid); }
.auth-form .field input { background: var(--surface); }
.auth-msg { margin: 2px 0 12px; min-height: 1.2em; font-size: 15px; font-weight: 600; color: var(--danger); }
.auth-msg:empty { margin: 0; min-height: 0; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 14px; }
.linklike {
  background: none; border: 0; padding: 6px 0; cursor: pointer; color: var(--accent); font-weight: 700; font-size: 15px;
}
.linklike:hover { text-decoration: underline; }
.auth .actions { margin: 0 0 14px; }
.acct-name { margin: 0; font-size: 18px; font-weight: 800; }
#account-body p { margin: 4px 0; }

/* ---------- mascote (Bem-te-vi Cadu) ---------- */
.mascot { display: block; height: auto; user-select: none; pointer-events: none; }
img.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: none; }
.auth-m { width: 116px; margin: -10px 0 4px -8px; }

.hero.with-m { overflow: visible; }
.hero-m { float: right; width: 116px; margin: -14px -8px 4px 10px; }
@media (min-width: 760px) { .hero-m { width: 168px; margin: -18px 4px 0 16px; } }
.only-rem {
  clear: both; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--grid);
}
.only-rem p { margin: 0; color: var(--muted); font-weight: 600; }

.empty-state {
  display: flex; align-items: center; gap: 14px; padding: 12px 18px 12px 10px;
  border: 1px dashed var(--grid); border-radius: var(--r-m); color: var(--muted);
}
.empty-state p { margin: 0; max-width: 52ch; }
.empty-state.plain { padding: 18px; }
.empty-m { width: 84px; flex: none; }

.dlg-title-m { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dlg-m { width: 64px; flex: none; margin: -10px 0 -10px -8px; }

.toast.with-m { display: flex; align-items: center; gap: 10px; padding: 7px 16px 7px 7px; }
.toast-m {
  position: relative; flex: none; width: 46px; height: 46px; border-radius: 50%;
  background: #F4F6FA; overflow: hidden;
}
.toast-m img { position: absolute; width: 60px; height: auto; left: 50%; top: 0; transform: translateX(-50%); }

.cap-body { flex: 1; display: flex; flex-direction: column; }
.cap-body .live { flex: 1; margin: 16px 0 18px; }
.cap-m {
  position: relative; width: 112px; height: 112px; margin-top: 20px; border-radius: 50%;
  background: #F4F6FA; overflow: hidden;
}
.cap-m img { position: absolute; width: 94px; height: auto; left: 50%; top: 12px; transform: translateX(-50%); }
.capture[open] .cap-m img { animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -4px); } }

.banner.info {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--grid));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
