:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --surface-3: #e8ebf0;
  --border: #e3e6eb;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-soft: #e8efff;
  --on-primary: #ffffff;
  --success: #16a34a;
  --success-soft: #e7f6ec;
  --warning: #b45309;
  --warning-soft: #fdf3e2;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --me: #e8efff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 1px rgba(15, 23, 42, .04);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .18);
  --top-h: 56px;
  --bottom-nav-h: 0px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #111827;
    --surface-2: #172033;
    --surface-3: #1f2a40;
    --border: #253045;
    --text: #e5e9f0;
    --muted: #8b98ad;
    --primary: #60a5fa;
    --primary-soft: #16264a;
    --on-primary: #0b1120;
    --success: #4ade80;
    --success-soft: #0f2a1a;
    --warning: #fbbf24;
    --warning-soft: #2d2410;
    --danger: #f87171;
    --danger-soft: #2f1414;
    --me: #16264a;
    --shadow: none;
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 20px; }
h2 { font-size: 15px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--danger); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ── Controles ─────────────────────────────────────────────────────── */
input, textarea, select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 11px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input:disabled, textarea:disabled, select:disabled { background: var(--surface-2); color: var(--muted); }
label.field { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }
label.field > span { font-weight: 500; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px;
  font: inherit; font-weight: 500;
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: transparent; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { min-height: 32px; padding: 5px 11px; font-size: 13px; }
.btn.icon { padding: 0; width: 38px; }
.btn.small.icon { width: 32px; }

/* ── Carregamento ──────────────────────────────────────────────────── */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 100;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  background-size: 50% 100%; background-repeat: no-repeat;
  opacity: 0; transition: opacity .2s;
  animation: progress 1s linear infinite;
}
.progress.on { opacity: 1; }
@keyframes progress { from { background-position: -50% 0; } to { background-position: 150% 0; } }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; opacity: .8; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.skel {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.skel-line { height: 12px; }
.skel-block { height: 64px; }
@media (prefers-reduced-motion: reduce) {
  .skel, .progress, .spinner { animation-duration: 2.5s; }
}

/* ── Login ─────────────────────────────────────────────────────────── */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 360px; display: grid; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px 24px; box-shadow: var(--shadow);
}
.brand-mark {
  width: 36px; height: 36px; border-radius: 9px; background-color: #2563eb;
  background-image: linear-gradient(white, white), linear-gradient(white, white), linear-gradient(white, white);
  background-size: 55% 3px, 55% 3px, 35% 3px;
  background-position: 30% 32%, 30% 50%, 30% 68%;
  background-repeat: no-repeat;
}
.brand-mark.small { width: 24px; height: 24px; border-radius: 7px; background-size: 55% 2px, 55% 2px, 35% 2px; }

/* ── Topo e navegação ──────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 20; height: var(--top-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 650; }
#nav { display: flex; gap: 2px; flex: 1; }
#nav a {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 11px; border-radius: 8px; color: var(--muted); font-weight: 500; white-space: nowrap;
  transition: background .15s, color .15s;
}
#nav a:hover { background: var(--surface-2); color: var(--text); }
#nav a.active { background: var(--primary-soft); color: var(--primary); }
.count {
  flex: none;
  min-width: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--warning); color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
}
.count.blue { background: var(--primary); color: var(--on-primary); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
.dot.ok { background: var(--success); }
.dot.warn { background: var(--warning); }
.dot.bad { background: var(--danger); }

@media (max-width: 720px) {
  :root { --top-h: 52px; --bottom-nav-h: calc(60px + env(safe-area-inset-bottom)); }
  .top { gap: 8px; }
  .brand-name { display: none; }
  .brand { flex: 1; }
  /* No celular a navegação vai para baixo, ao alcance do polegar. */
  #nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: var(--bottom-nav-h); padding: 4px 4px env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--border);
    justify-content: space-around; gap: 0;
  }
  #nav a { flex: 1; flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 11px; border-radius: 10px; }
  #nav a svg { width: 20px; height: 20px; }
  #nav a .count, #nav a .dot { position: absolute; top: 4px; left: calc(50% + 6px); }
  #nav a.active { background: transparent; }
  /* A barra inferior já cuida da área segura do iPhone. */
  /* `body` sobe a especificidade: a regra base de .actions vem depois no arquivo. */
  body .actions { padding-bottom: 10px; }
  body .actions .btn { flex: 1; }
  body .actions .info-text { flex-basis: 100%; text-align: center; margin: 0; }
}

main { max-width: 1120px; margin: 0 auto; padding: 20px 16px calc(96px + var(--bottom-nav-h)); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; margin-bottom: 6px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 16px; }
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid-3 { display: grid; gap: 10px; grid-template-columns: 2fr 1fr 1fr; }
@media (max-width: 640px) { .grid-3 { grid-template-columns: 1fr 1fr; } .grid-3 > :first-child { grid-column: 1 / -1; } }
.divider { border-top: 1px solid var(--border); padding-top: 12px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; line-height: 18px;
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; }
.badge.warn { background: var(--warning-soft); color: var(--warning); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.info { background: var(--primary-soft); color: var(--primary); }
a.badge:hover { filter: brightness(.96); }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); display: grid; gap: 6px; justify-items: center; }
.empty strong { color: var(--text); font-size: 15px; }
.empty svg { width: 28px; height: 28px; opacity: .6; }

/* Segmentado e abas */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; flex: none; background: var(--surface); }
.seg button { font: inherit; font-size: 13px; font-weight: 500; min-height: 36px; padding: 6px 13px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--primary-soft); color: var(--primary); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs a { padding: 9px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-color: var(--primary); }
.tabs a .n { color: var(--muted); font-weight: 400; margin-left: 5px; font-size: 12px; }

/* ── Lista de demandas ─────────────────────────────────────────────── */
.demand-list { display: grid; gap: 8px; }
.demand-item {
  position: relative; display: grid; gap: 5px;
  padding: 13px 14px 13px 17px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}
.demand-item::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--border); }
.demand-item.p-urgent::before { background: var(--danger); }
.demand-item.p-high::before { background: var(--warning); }
.demand-item:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); box-shadow: var(--shadow); }
.demand-item .title { font-weight: 600; }
.demand-item .meta { display: flex; gap: 6px 8px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); }

/* ── Detalhe da demanda ────────────────────────────────────────────── */
.detail { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); align-items: start; }
@media (max-width: 960px) { .detail { grid-template-columns: 1fr; } }
.doubts { border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); background: var(--warning-soft); }
.doubts h2 { color: var(--warning); display: flex; gap: 6px; align-items: center; }
.doubt { display: grid; gap: 6px; padding-top: 10px; border-top: 1px solid color-mix(in srgb, var(--warning) 25%, transparent); }
.doubt:first-of-type { border-top: 0; padding-top: 0; }
.doubt .q { font-weight: 500; }
.doubt.dismissed .q { text-decoration: line-through; color: var(--muted); }
.notice { padding: 10px 12px; border-radius: 9px; background: var(--danger-soft); color: var(--danger); font-size: 13px; }
.notice.info { background: var(--primary-soft); color: var(--primary); }
.notice.warn { background: var(--warning-soft); color: var(--warning); }
details > summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 500; list-style: none; display: flex; align-items: center; gap: 6px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "›"; display: inline-block; transition: transform .15s; font-size: 16px; line-height: 1; }
details[open] > summary::before { transform: rotate(90deg); }
details[open] > summary { margin-bottom: 10px; }

/* Barra de ações fixa */
.actions {
  position: fixed; left: 0; right: 0; bottom: var(--bottom-nav-h); z-index: 25;
  display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  animation: rise .18s ease-out;
}
.actions .info-text { font-size: 13px; color: var(--muted); margin-right: auto; }
@media (min-width: 721px) { .actions .info-text { margin-right: 8px; } }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Mensagens ─────────────────────────────────────────────────────── */
.thread { display: grid; gap: 10px; }
.msg {
  max-width: min(88%, 560px); justify-self: start;
  padding: 9px 12px 10px; border-radius: 14px; border-top-left-radius: 4px;
  background: var(--surface); border: 1px solid var(--border);
  display: grid; gap: 7px;
  transition: outline-color .1s, background .15s;
  outline: 2px solid transparent;
}
.msg.me { justify-self: end; background: var(--me); border-color: transparent; border-top-left-radius: 14px; border-top-right-radius: 4px; }
.msg.selectable { cursor: pointer; }
.msg.selectable:hover { outline-color: color-mix(in srgb, var(--primary) 35%, transparent); }
.msg.selected { outline-color: var(--primary); }
.msg.done { opacity: .72; }
.msg-head { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.msg-head .who { font-weight: 600; color: var(--text); }
.msg-head .time { margin-left: auto; font-variant-numeric: tabular-nums; }
.kind { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px 1px 5px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 500; }
.msg.me .kind { background: color-mix(in srgb, var(--surface) 60%, transparent); }
.kind svg { width: 12px; height: 12px; }
.kind.audio { color: #7c3aed; } .kind.image { color: #0891b2; } .kind.video { color: #db2777; } .kind.document { color: #b45309; }
@media (prefers-color-scheme: dark) { .kind.audio { color: #c4b5fd; } .kind.image { color: #67e8f9; } .kind.video { color: #f9a8d4; } .kind.document { color: #fcd34d; } }
.msg .text { white-space: pre-wrap; word-break: break-word; }
.msg .quote { border-left: 3px solid var(--border); padding-left: 8px; color: var(--muted); font-size: 13px; white-space: pre-wrap; }
.msg img, .msg video { max-width: 100%; max-height: 340px; border-radius: 10px; display: block; background: var(--surface-2); }
.msg audio { width: 100%; min-width: 220px; height: 38px; }
.doc-link { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; background: var(--surface-2); color: var(--text); }
.doc-link svg { width: 20px; height: 20px; color: var(--muted); }
.ai { font-size: 13px; padding: 7px 10px; border-radius: 9px; background: var(--surface-2); white-space: pre-wrap; word-break: break-word; }
.msg.me .ai { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.ai-label { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 3px; text-transform: uppercase; letter-spacing: .03em; }
.ai-label svg { width: 12px; height: 12px; }
.ai.clamp { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.more { font: inherit; font-size: 12px; color: var(--primary); background: none; border: 0; padding: 0; cursor: pointer; justify-self: start; }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.state.bad { color: var(--danger); }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.day { justify-self: center; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface-2); padding: 3px 12px; border-radius: 999px; position: sticky; top: calc(var(--top-h) + 8px); z-index: 2; }

/* ── Conversas ─────────────────────────────────────────────────────── */
.split { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .split.has-detail > .side { display: none; }
  .split:not(.has-detail) > .pane { display: none; }
}
.side { position: sticky; top: calc(var(--top-h) + 14px); max-height: calc(100vh - var(--top-h) - 28px); display: flex; flex-direction: column; overflow: hidden; }
.side-search { padding: 10px; border-bottom: 1px solid var(--border); }
.side-list { overflow: auto; }
@media (max-width: 860px) { .side { position: static; max-height: none; } }
.contact { display: flex; gap: 10px; align-items: center; padding: 10px 12px; color: var(--text); border-bottom: 1px solid var(--border); }
.contact:last-child { border-bottom: 0; }
.contact:hover { background: var(--surface-2); }
.contact.active { background: var(--primary-soft); }
.contact > .info, .chat-row > .info { min-width: 0; flex: 1; }
.contact > .info > .name, .chat-row > .info > .name { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact > .info > .small, .chat-row > .info > .small { display: flex; gap: 6px; align-items: center; }
.avatar {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface-3); color: var(--muted);
  display: grid; place-items: center; font-weight: 600; font-size: 13px; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.triage { background: var(--primary-soft); color: var(--primary); }
.avatar.triage svg { width: 18px; height: 18px; }
.pane-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }

/* ── Clientes ──────────────────────────────────────────────────────── */
.search { position: relative; flex: 1; min-width: 200px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 34px; }
.search .spinner { position: absolute; right: 11px; top: 50%; margin-top: -7px; color: var(--muted); }
.list-card { overflow: hidden; }
.section-title {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.section-title .n { font-weight: 500; }
.chat-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); min-height: 60px; }
.chat-row:last-child { border-bottom: 0; }
.list-foot { padding: 12px 14px; font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border); transition: background .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + span { background: var(--success); border-color: var(--success); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch input:disabled + span { opacity: .5; cursor: wait; }
.callout { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--radius); background: var(--primary-soft); color: var(--text); }
.callout svg { width: 22px; height: 22px; color: var(--primary); }
.callout .grow p { font-size: 13px; color: var(--muted); }

/* ── Conexão ───────────────────────────────────────────────────────── */
.qr { display: grid; place-items: center; padding: 16px; background: #fff; border-radius: 14px; width: fit-content; margin: 0 auto; }
.qr img { width: 260px; height: 260px; image-rendering: pixelated; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.status-title { display: flex; align-items: center; gap: 8px; }

/* ── Painel (sheet) ────────────────────────────────────────────────── */
.sheet { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); animation: fade .15s ease-out; }
.sheet-panel {
  position: relative; width: 100%; max-width: 520px; max-height: calc(100dvh - 32px); overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg);
  padding: 18px; display: grid; gap: 14px; animation: pop .18s ease-out;
}
.sheet-panel header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sheet-panel footer { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
@media (max-width: 720px) {
  /* No celular o painel sobe de baixo. */
  .sheet { place-items: end stretch; padding: 0; }
  .sheet-panel { max-width: none; border-radius: 18px 18px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); animation: slideup .22s ease-out; }
  .sheet-panel footer .btn { flex: 1; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
@keyframes slideup { from { transform: translateY(40px); opacity: 0; } }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--bottom-nav-h)); transform: translateX(-50%); z-index: 80;
  display: flex; align-items: center; gap: 10px;
  background: var(--text); color: var(--bg);
  padding: 10px 14px; border-radius: 12px; font-size: 13px; max-width: calc(100vw - 32px);
  box-shadow: var(--shadow-lg); animation: rise .18s ease-out;
}
.toast a { color: inherit; font-weight: 600; text-decoration: underline; }
.toast.bad { background: var(--danger); color: #fff; }
