:root {
  color-scheme: light;
  --accent: #714b67;
  --accent-strong: #4f3348;
  --accent-soft: #f1eaf0;
  --accent-ring: rgb(113 75 103 / 40%);
  --ink: #17131a;
  --ink-2: #4a434e;
  --muted: #5f5763;
  --subtle: #6b6270;
  --line: #e6e1e7;
  --line-2: #eeeaef;
  --ground: #f7f6f8;
  --surface: #ffffff;
  --surface-2: #faf8fa;
  --ok: #1f6b4a;
  --ok-dot: #1f9d64;
  --ok-bg: #e8f5ee;
  --ok-line: #b9e0cb;
  --warn: #7a4800;
  --warn-icon: #9a5b00;
  --warn-bg: #fff6e6;
  --warn-line: #e9c98f;
  --danger: #9e1f33;
  --danger-bg: #fbecee;
  --danger-line: #f0c3ca;
  --radius: 14px;
  --font: "Segoe UI Variable Text", "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  font-family: var(--font);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--ground);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }

:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Ícones */
.ico, .promise-ico svg, .ico-mic {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.ico-fill { fill: currentColor; stroke: none; width: 16px; height: 16px; }

/* Marca */
.mark {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  overflow: hidden; border-radius: 12px; color: #fff; background: var(--accent-soft);
}
.mark img { width: 158%; height: 158%; object-fit: contain; transform: translateY(-9%); }
.mark-lg { width: 84px; height: 84px; border-radius: 24px; box-shadow: 0 14px 34px rgb(113 75 103 / 24%); }
.mark-lg img { width: 116%; height: 116%; transform: translateY(5%); }

.eyebrow { color: var(--accent); font-size: .72rem; font-weight: 700; letter-spacing: .14em; }

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 12px;
  font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-lg { min-height: 52px; border-radius: 14px; font-size: 1rem; }
.btn-primary { color: #fff; background: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); }
.btn-outline { background: var(--surface); border-color: var(--line); font-weight: 500; }
.btn-outline:hover:not(:disabled) { border-color: #cfc6d1; }
.btn-outline[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.btn-danger-soft { color: var(--danger); background: var(--danger-bg); }
.btn-danger-soft:hover:not(:disabled) { border-color: var(--danger-line); }

.btn-link {
  min-height: 44px; padding: 0; border: 0; background: transparent;
  color: var(--accent); font-weight: 600; cursor: pointer;
}
.btn-link:hover { color: var(--accent-strong); text-decoration: underline; }
.btn-link-muted { color: var(--muted); font-weight: 500; }

.icon-btn {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); cursor: pointer;
}
.icon-btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn-primary { border: 0; color: #fff; background: var(--accent); }

/* ---------- Barra superior compartilhada ---------- */
.appbar {
  position: relative; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap;
  padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.appbar-brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: var(--ink); text-decoration: none; }
.appbar-brand .mark { width: 36px; height: 36px; border-radius: 11px; }
.appbar-title { font-family: var(--font-display); font-weight: 650; font-size: 1rem; white-space: nowrap; }
.appnav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.appnav a {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border-radius: 10px; color: var(--ink-2); text-decoration: none; font-weight: 500; white-space: nowrap;
}
.appnav a:hover { color: var(--ink); background: var(--ground); }
.appnav a[aria-current="page"] { color: var(--accent-strong); background: var(--accent-soft); font-weight: 600; }
.nav-count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-grid; place-items: center;
  color: #fff; background: var(--warn-icon); font-size: .75rem; font-weight: 700;
}
.appbar-end { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.appbar[data-auth="in"] .appbar-end { margin-left: 0; }
.account { position: relative; }
.account-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 10px 0 4px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer;
}
.account-btn:hover { border-color: #cfc6d1; }
.account-avatar {
  position: relative; width: 34px; height: 34px; flex: none; overflow: hidden;
  display: grid; place-items: center; border-radius: 50%;
  color: #fff; background: var(--accent); font-weight: 700; font-size: .875rem;
}
.account-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.account-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
  width: 260px; padding: 8px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 18px 44px rgb(40 24 36 / 16%);
}
.account-id { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 6px; }
.account-id strong, .account-id small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-id small { color: var(--muted); font-size: .8125rem; }
.account-item {
  width: 100%; min-height: 44px; padding: 0 10px; border: 0; border-radius: 10px;
  background: transparent; text-align: left; cursor: pointer; color: var(--danger); font-weight: 600;
}
.account-item:hover { background: var(--danger-bg); }

/* ---------- Entrada ---------- */
.page-agent { display: flex; flex-direction: column; }
.agent-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.portal-host { display: block; flex: 1; }
.portal.portal-view { min-height: 0; }
body[data-section]:not([data-section="agent"]) #panelButton { display: none; }
.gate { flex: 1; display: flex; justify-content: center; align-items: flex-start; padding: 48px 16px 40px; }
.gate-inner { width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: 20px; }
.gate-hero { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.gate-hero .mark-lg { margin-bottom: 8px; }
.gate-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 5vw, 2rem); font-weight: 650; line-height: 1.15; letter-spacing: -.01em;
}
.lead { color: var(--muted); }
.gate-center { text-align: center; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 20px 50px rgb(40 24 36 / 8%);
}
.gate-card { display: flex; flex-direction: column; gap: 12px; padding: 24px; }
.btn-google {
  color: var(--ink); background: var(--surface); border-color: #d9d2db;
  box-shadow: 0 1px 2px rgb(40 24 36 / 6%); text-decoration: none;
}
.btn-google:hover { border-color: #bfb4c2; background: var(--surface-2); }
.btn-google[aria-disabled="true"] { opacity: .55; pointer-events: none; }
.google-icon { width: 21px; height: 21px; flex: none; }

.pending-card { border: 1.5px solid var(--warn-line); }
.pending-row { display: flex; gap: 12px; align-items: flex-start; }
.pending-row h2 { font-size: 1.125rem; font-weight: 650; }
.pending-row p { margin-top: 2px; color: var(--ink-2); overflow-wrap: anywhere; }
.pending-ico { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; color: var(--warn-icon); background: var(--warn-bg); }
.pending-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line-2); }
.pending-check { display: inline-flex; align-items: center; gap: 8px; font-size: .8125rem; color: var(--muted); }
.pending-check .dot { background: var(--warn-icon); }
.pending-card.is-blocked { border-color: var(--danger-line); }
.pending-card.is-blocked .pending-ico { color: var(--danger); background: var(--danger-bg); }

.ready-card { overflow: hidden; }
.ready-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  min-height: 76px; padding: 14px 20px; border-bottom: 1px solid var(--line-2);
}
.ready-voice-img { width: 56px; height: 56px; flex: none; border-radius: 16px; object-fit: cover; background: var(--accent-soft); }
.ready-ico { width: 56px; flex: none; display: grid; place-items: center; color: var(--accent); }
.ready-ico .ico { width: 22px; height: 22px; }
.ready-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ready-copy strong { font-size: 1rem; font-weight: 650; overflow-wrap: anywhere; }
.ready-copy small { font-size: .8125rem; color: var(--muted); }
.ready-label { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ready-row > .btn-outline { padding: 0 14px; text-decoration: none; color: var(--ink); }
.name-form { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.name-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.name-controls input {
  flex: 1 1 160px; min-width: 0; height: 44px; padding: 0 12px;
  border: 1px solid #d9d2db; border-radius: 10px; background: var(--surface); outline: none;
}
.name-controls input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgb(113 75 103 / 14%); }
.name-controls input[aria-invalid="true"] { border-color: var(--danger); }
.name-form small { font-size: .75rem; color: var(--muted); }
.ready-cta { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 20px; }
.ready-cta .btn-link { align-self: center; }
.btn-xl { min-height: 56px; border-radius: 14px; font-size: 1rem; box-shadow: 0 10px 26px rgb(113 75 103 / 28%); }
.btn-xl .ico { width: 20px; height: 20px; }

.gate-hint { text-align: center; }
.signed-as { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: .875rem; color: var(--muted); }
.signed-as > span { min-width: 0; overflow-wrap: anywhere; }

.promises {
  list-style: none; margin: 0; padding: 16px 0 0; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 12px; font-size: .875rem; color: var(--ink-2);
}
.promises li { display: flex; gap: 12px; align-items: flex-start; }
.promises .ico { color: var(--accent); margin-top: 2px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .875rem; font-weight: 600; }
.hint { font-size: .8125rem; color: var(--muted); }
.hint.is-error { color: var(--danger); font-weight: 600; }

/* ---------- Páginas da conta ---------- */
.portal { height: auto; min-height: 100vh; }
.portal-main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 24px 48px; display: flex; flex-direction: column; gap: 20px; }
.portal-main.is-narrow { max-width: 1040px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-display); font-size: clamp(1.5rem, 4vw, 1.75rem); font-weight: 650; letter-spacing: -.01em; }
.page-head p { margin-top: 2px; color: var(--muted); }
.portal-status { padding: 12px 16px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-strong); }
.portal-status.is-error, .is-error { color: var(--danger); }
.portal-status.is-error { background: var(--danger-bg); }
.portal-help { color: var(--muted); font-size: .875rem; }
.portal-section { display: flex; flex-direction: column; gap: 16px; }
.portal-empty { padding: 24px 16px; text-align: center; color: var(--ink-2); }
.panel { border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.portal input[type="search"], .portal input[type="email"], .portal input[type="text"] {
  min-height: 44px; padding: 0 12px; border: 1px solid #d9d2db; border-radius: 10px;
  background: var(--surface); min-width: 0; font-size: 1rem; outline: none;
}
.portal input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgb(113 75 103 / 14%); }

.seg { display: inline-flex; gap: 2px; padding: 4px; border-radius: 12px; background: #efebf0; }
.seg button { min-height: 36px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); font-weight: 500; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgb(40 24 36 / 12%); }

/* Histórico */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kpi { padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.kpi span, .kpi small { display: block; color: var(--muted); }
.kpi span { font-size: .8125rem; }
.kpi strong { display: block; font-size: 1.375rem; font-weight: 650; line-height: 1.3; font-variant-numeric: tabular-nums; }
.kpi small { font-size: .75rem; }
.history-layout { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.history-pane { flex: 1 1 320px; max-width: 100%; display: flex; flex-direction: column; gap: 8px; padding: 12px; }
@media (min-width: 900px) { .history-pane { flex: 0 1 400px; position: sticky; top: 16px; } }
.search-box { position: relative; }
.search-box .ico { position: absolute; left: 12px; top: 13px; color: var(--subtle); pointer-events: none; }
.search-box input { width: 100%; padding-left: 38px !important; }
.history-group { padding: 10px 6px 2px; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); list-style: none; }
.history-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; max-height: 70vh; overflow-y: auto; }
.history-item {
  width: 100%; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px;
  border: 1px solid transparent; border-radius: 12px; background: transparent; text-align: left; cursor: pointer;
}
.history-item:hover { background: var(--surface-2); }
.history-item[aria-pressed="true"] { background: var(--accent-soft); border-color: #dcc9d7; }
.history-item-top, .history-item-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.history-item-top strong { min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-pane, .history-list, .history-list li, .history-item { min-width: 0; }
.history-item-top span { font-size: .8125rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.history-item-bottom { font-size: .8125rem; color: var(--muted); }
.conversation-detail { flex: 999 1 520px; min-width: 0; overflow: hidden; }
.conversation-detail > .portal-empty { padding: 48px 20px; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; padding: 18px 20px; border-bottom: 1px solid var(--line-2); }
.detail-head h2 { font-size: 1.25rem; font-weight: 650; overflow-wrap: anywhere; }
.detail-head p { font-size: .8125rem; color: var(--muted); }
.cost-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); background: var(--surface-2); border-bottom: 1px solid var(--line-2); }
.cost-strip div { padding: 12px 16px; min-width: 0; }
.cost-strip div + div { border-left: 1px solid var(--line-2); }
.cost-strip span { display: block; font-size: .75rem; color: var(--muted); }
.cost-strip strong { font-variant-numeric: tabular-nums; }
.cost-note { padding: 10px 20px 0; font-size: .8125rem; color: var(--muted); }
.detail-messages { padding: 8px 20px 20px; }
.history-message { padding: 16px 0; border-bottom: 1px solid var(--line-2); overflow-wrap: anywhere; }
.history-message:last-child { border-bottom: 0; }
.history-message-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.history-message-header h3 { color: var(--muted); font-size: .8125rem; font-weight: 600; margin: 0; }
.history-message-header .avatar { width: 28px; height: 28px; }
.history-message.role-user .rich-content { color: var(--accent-strong); }
.history-message > small { display: inline-block; margin-top: 8px; color: var(--warn); }

/* Preferências */
/* wrap-reverse: no celular "Sua escolha" fica acima da grade; flex-end = topo neste modo. */
.prefs-layout { display: flex; flex-wrap: wrap-reverse; gap: 20px; align-items: flex-end; }
.prefs-voices { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.prefs-voices-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.prefs-voices-head h2 { font-size: 1.125rem; font-weight: 650; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 500; cursor: pointer; }
.filter-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.voice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.voice-option { position: relative; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.voice-option.is-selected { border: 2px solid var(--accent); box-shadow: 0 10px 24px rgb(113 75 103 / 16%); }
.voice-pick {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 18px 12px 14px; border: 0; border-radius: 16px; background: transparent; text-align: center; cursor: pointer;
}
.voice-pick:disabled { cursor: wait; opacity: .7; }
.voice-pick img { width: 72px; height: 72px; margin-bottom: 8px; border-radius: 20px; object-fit: cover; background: var(--accent-soft); }
.voice-pick strong { font-size: 1rem; }
.voice-pick span { font-size: .8125rem; color: var(--muted); }
.voice-pick .voice-gender { font-size: .75rem; color: var(--subtle); }
.voice-play {
  position: absolute; top: 8px; right: 8px; width: 44px; height: 44px;
  display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--accent-strong); cursor: pointer;
}
.voice-play:hover { background: var(--accent-soft); }
.voice-play svg { width: 14px; height: 14px; fill: currentColor; }
.voice-play .spinner { width: 14px; height: 14px; }
.voice-tick { position: absolute; top: 10px; left: 10px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--accent); }
.voice-tick .ico { width: 14px; height: 14px; stroke-width: 3; }
.prefs-side { flex: 1 1 320px; max-width: 100%; display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 900px) { .prefs-side { position: sticky; top: 16px; } }
.prefs-side .panel { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.pref-voice { display: flex; align-items: center; gap: 14px; }
.pref-voice img { width: 72px; height: 72px; border-radius: 20px; object-fit: cover; background: var(--accent-soft); }
.pref-voice strong { display: block; font-size: 1.25rem; font-weight: 650; }
.pref-voice span { font-size: .875rem; color: var(--muted); }
.voice-player { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.voice-player-row { display: flex; align-items: center; gap: 12px; }
.play-btn { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; color: #fff; background: var(--accent); cursor: pointer; }
.play-btn svg { width: 16px; height: 16px; fill: currentColor; }
.voice-player audio { width: 100%; height: 36px; }
.name-panel form { display: flex; flex-direction: column; gap: 6px; }
.name-panel label { font-size: .875rem; font-weight: 600; }

/* Acessos */
.grant-form { flex: 0 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.grant-form label { font-size: .875rem; font-weight: 600; }
.grant-form > div { display: flex; gap: 8px; }
.grant-form input { flex: 1; }
.banner-warn {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px;
  color: var(--warn); background: var(--warn-bg); border: 1px solid var(--warn-line); font-weight: 600;
}
.tabs { display: flex; gap: 4px; padding: 0 10px; border-bottom: 1px solid var(--line); overflow: auto hidden; scrollbar-width: none; }
.tabs button {
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px;
  border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: transparent; color: var(--ink-2); font-weight: 500; cursor: pointer; white-space: nowrap;
}
.tabs button[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--ink); font-weight: 600; }
.tab-count { min-width: 22px; height: 22px; padding: 0 7px; display: inline-grid; place-items: center; border-radius: 999px; background: #efebf0; font-size: .75rem; font-weight: 700; }
.access-list { list-style: none; padding: 0; margin: 0; }
.access-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 18px; border-top: 1px solid var(--line-2); }
.access-row:first-child { border-top: 0; }
.access-initial { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%; color: var(--accent-strong); background: #efebf0; font-weight: 700; }
.access-copy { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.access-copy strong { font-weight: 600; }
.access-copy span { font-size: .875rem; color: var(--ink-2); }
.access-when { font-size: .8125rem; color: var(--muted); }
.access-actions { display: flex; gap: 8px; }
.access-audit { padding: 0 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-size: .875rem; color: var(--ink-2); }
.access-audit summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; font-weight: 600; color: var(--ink); }
.access-audit ul { list-style: none; margin: 0; padding: 0 0 14px; display: flex; flex-direction: column; gap: 8px; }
.access-audit li { overflow-wrap: anywhere; }

.appnav .ico { width: 18px; height: 18px; }
.detail-back { display: none; }

/* Histórico em tela estreita: lista e conversa alternam (lista → toque → conversa → Voltar). */
@media (max-width: 899px) {
  .history-list { max-height: none; overflow: visible; }
  .conversation-detail { display: none; }
  .is-reading .conversation-detail { display: block; }
  .is-reading .history-pane, .is-reading > .kpis, .is-reading > .portal-help { display: none; }
  .portal-main:has(.is-reading) .page-head { display: none; }
  .detail-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 6px 0 0 8px; padding: 0 10px; }
}

@media (max-width: 720px) {
  /* Menu: quatro abas iguais, ícone sobre o rótulo, sem rolagem lateral. */
  .appbar { padding: 8px 16px 0; gap: 8px 12px; }
  .appbar:has(.appnav[hidden]) { padding-bottom: 8px; }
  .appnav {
    order: 3; width: calc(100% + 32px); margin: 0 -16px; padding: 0 4px;
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0;
    border-top: 1px solid var(--line-2); overflow: visible;
  }
  .appnav a {
    position: relative; min-width: 0; min-height: 58px; padding: 7px 2px 6px;
    flex-direction: column; justify-content: center; gap: 3px;
    border-radius: 0; font-size: .75rem; line-height: 1.15; text-align: center;
  }
  .appnav a:hover, .appnav a[aria-current="page"] { background: transparent; }
  .appnav a .ico { width: 22px; height: 22px; }
  .appnav a[aria-current="page"]::after {
    content: ''; position: absolute; left: 20%; right: 20%; bottom: 0;
    height: 3px; border-radius: 3px 3px 0 0; background: var(--accent);
  }
  .nav-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .nav-extra { display: none; }
  .nav-count {
    position: absolute; top: 4px; left: calc(50% + 5px);
    min-width: 18px; height: 18px; padding: 0 5px; font-size: .6875rem; box-shadow: 0 0 0 2px var(--surface);
  }
  .account-name { display: none; }
  .account-btn { padding: 0 8px 0 3px; }

  .portal-main { padding: 20px 16px 40px; gap: 16px; }
  .gate { padding-top: 28px; }
  .page-head { gap: 12px; }
  .page-head .seg { width: 100%; }
  .page-head .seg button { flex: 1; }

  /* Histórico */
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 12px 14px; }
  .kpi strong { font-size: 1.125rem; overflow-wrap: anywhere; }
  .kpi small { font-size: .6875rem; }
  .history-pane { padding: 8px; }
  .history-item { padding: 12px 10px; }
  .detail-head { padding: 12px 16px 16px; }
  .detail-head .btn { width: 100%; }
  .cost-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cost-strip div + div { border-left: 0; }
  .cost-strip div:nth-child(even) { border-left: 1px solid var(--line-2); }
  .cost-strip div:nth-child(n+3) { border-top: 1px solid var(--line-2); }
  .cost-note { padding: 10px 16px 0; }
  .detail-messages { padding: 4px 16px 16px; }

  /* Preferências: escolha atual → grade de vozes → nome. */
  .prefs-layout { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 16px; }
  .prefs-side { display: contents; }
  .prefs-side > .panel:first-child { order: 1; }
  .prefs-voices { order: 2; flex: none; }
  .name-panel { order: 3; }
  .filter-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px; scrollbar-width: none; }
  .filter-chip { flex: none; }
  .voice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .voice-pick { padding: 16px 8px 12px; }
  .voice-pick img { width: 60px; height: 60px; }
  .prefs-side .panel { padding: 16px; }

  /* Acessos */
  .grant-form { flex-basis: 100%; }
  .tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 0; }
  .tabs button { min-width: 0; justify-content: center; gap: 5px; padding: 0 4px; font-size: .8125rem; }
  .tab-count { min-width: 20px; height: 20px; padding: 0 6px; }
  .access-row { gap: 4px 12px; padding: 14px 16px; }
  .access-copy { flex: 1 1 0; }
  .access-when, .access-actions { width: 100%; padding-left: 48px; }
  .access-actions .btn { flex: 1; }
}

@media (max-width: 380px) {
  .appbar-title { font-size: .9375rem; }
  .tabs button { flex-direction: column; gap: 2px; min-height: 58px; padding: 6px 2px; }
}

/* Durante a conversa, o celular prioriza o status ao vivo no topo. */
@media (max-width: 480px) {
  .appbar:has(#connectionBadge:not([hidden])) .appbar-title { display: none; }
}

/* ---------- Sessão ---------- */
.app { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  font-size: .8125rem; font-weight: 600; white-space: nowrap;
  color: var(--ink-2); background: #f2f0f3;
}
.pill-timer { font-family: var(--font-mono); font-weight: 500; opacity: .85; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #a39aa6; flex: none; }
[data-tone="ok"] { color: var(--ok); }
.pill[data-tone="ok"] { background: var(--ok-bg); }
[data-tone="ok"] .dot { background: var(--ok-dot); }
[data-tone="warn"] { color: var(--warn); }
.pill[data-tone="warn"] { background: var(--warn-bg); }
[data-tone="warn"] .dot { background: var(--warn-icon); }
[data-tone="error"] { color: var(--danger); }
.pill[data-tone="error"] { background: var(--danger-bg); }
[data-tone="error"] .dot { background: var(--danger); }

.panel-toggle { display: none; }

.layout { flex: 1; min-height: 0; display: flex; }

.stage { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.messages {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
  padding: 28px max(24px, calc((100% - 860px) / 2)) 16px;
  scroll-behavior: smooth;
}
.messages > * { flex-shrink: 0; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--subtle); font-size: .75rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.empty { margin: auto 0; padding: 24px 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty h2 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 650; letter-spacing: -.01em; }
.empty p { color: var(--muted); }

.suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
.suggestions-col { justify-content: flex-start; margin-top: 0; }
.suggestion {
  min-height: 44px; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  font-size: .875rem; text-align: left; cursor: pointer;
}
.suggestion:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.suggestion:disabled { opacity: .5; cursor: not-allowed; }

/* Mensagens */
.msg { display: flex; flex-direction: column; gap: 4px; max-width: 100%; }
.msg.user { align-items: flex-end; }
.msg-row { display: flex; gap: 12px; align-items: flex-start; }
.user-msg-row { width: 100%; justify-content: flex-end; min-width: 0; }
.user-msg-row .bubble { min-width: 0; }
.avatar {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center; overflow: hidden; border-radius: 10px;
  color: var(--accent); background: var(--accent-soft);
}
.avatar-wello { width: 165%; height: 165%; object-fit: contain; transform: translateY(-9%); }
.avatar-user { position: relative; border-radius: 50%; color: #fff; background: var(--accent); font-weight: 650; }
.avatar-user img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.msg.user .meta { padding-right: 44px; }
.history-message-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.history-message-header h3 { color: var(--muted); font-size: .8125rem; margin: 0; }
.empty-mascot {
  width: 88px; height: 88px; margin-bottom: 2px; object-fit: contain;
  filter: drop-shadow(0 12px 18px rgb(79 51 72 / 16%));
}
.bubble { max-width: min(78%, 640px); padding: 12px 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user .bubble { border-radius: 18px 18px 4px 18px; color: #fff; background: var(--accent); }
.msg.agent .bubble { max-width: 100%; border-radius: 4px 18px 18px 18px; background: var(--surface); border: 1px solid var(--line); }
.msg.user.is-live .bubble { color: var(--ink-2); background: var(--surface); border: 1.5px dashed #c9b6c4; }
.msg.is-live .bubble::after {
  content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -2px;
  background: var(--accent); animation: caret 1s steps(1) infinite;
}
.meta { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; color: var(--subtle); }
.msg.agent .meta { padding-left: 44px; }

/* Etiqueta de ferramenta */
.chip {
  align-self: flex-start; margin-left: 44px;
  display: inline-flex; align-items: center; gap: 8px; max-width: calc(100% - 44px);
  padding: 6px 10px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--line);
  font-family: var(--font-mono); font-size: .75rem; color: var(--ink-2);
}
.chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .ico { width: 14px; height: 14px; }
.chip.is-done .ico { color: var(--ok-dot); stroke-width: 2.5; }
.chip.is-error { color: var(--danger); border-color: var(--danger-line); }
.spinner {
  width: 12px; height: 12px; flex: none; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}

/* Resposta do agente e confirmação */
.result, .confirm { margin-left: 44px; border-radius: 18px; background: var(--surface); overflow: hidden; }
.result { border: 1px solid var(--line); }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; font-size: .8125rem; font-weight: 600;
  color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line-2);
}
.card-head .ico { width: 16px; height: 16px; }
.card-body { padding: 18px; overflow-wrap: anywhere; }
.rich-content { display: grid; gap: 14px; color: var(--ink-2); line-height: 1.58; }
.rich-content p { margin: 0; max-width: 76ch; }
.rich-lead { color: var(--ink); font-size: 1rem; }
.rich-heading {
  display: flex; align-items: center; gap: 9px; margin: 4px 0 -2px;
  color: var(--ink); font-family: var(--font-display); font-size: .9375rem; font-weight: 700;
}
.rich-heading .ico { width: 17px; height: 17px; color: var(--accent); }
.rich-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.rich-list li { position: relative; padding: 8px 10px 8px 32px; border-radius: 10px; background: var(--surface-2); }
.rich-list li::before {
  content: ""; position: absolute; left: 13px; top: 1.15em;
  width: 7px; height: 7px; border-radius: 50%; background: #9d929f;
}
.rich-list li.is-risk { color: #6f3900; background: var(--warn-bg); }
.rich-list li.is-risk::before { background: var(--warn-icon); }
.rich-list li.is-ok { color: var(--ok); background: var(--ok-bg); }
.rich-list li.is-ok::before { background: var(--ok-dot); }
.record-ref {
  display: inline-flex; padding: 1px 6px; border-radius: 6px;
  color: var(--accent-strong); background: var(--accent-soft);
  font-family: var(--font-mono); font-size: .88em; font-weight: 700;
}
.inline-code { padding: 1px 5px; border-radius: 5px; background: #eee9ef; font-family: var(--font-mono); font-size: .88em; }
.rich-link { color: var(--accent-strong); font-weight: 650; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.rich-action { padding: 12px 14px; border-radius: 12px; color: var(--accent-strong); background: var(--accent-soft); font-weight: 650; }
.rich-content p.is-risk { padding: 10px 12px; border-radius: 10px; color: var(--warn); background: var(--warn-bg); }
.rich-content p.is-ok { color: var(--ok); }
.rich-callout { display: flex; gap: 10px; padding: 11px 12px; border-radius: 12px; background: var(--surface-2); }
.rich-callout .ico { margin-top: 3px; color: var(--accent); }
.rich-callout.is-risk { color: var(--warn); background: var(--warn-bg); }
.rich-callout.is-risk .ico { color: var(--warn-icon); }
.rich-callout.is-ok { color: var(--ok); background: var(--ok-bg); }
.rich-callout.is-ok .ico { color: var(--ok-dot); }
.rich-table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.rich-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.rich-table th, .rich-table td { padding: 9px 11px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-2); }
.rich-table th { color: var(--muted); background: var(--surface-2); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.rich-table tbody tr:last-child td { border-bottom: 0; }

.confirm { border: 1.5px solid var(--warn-line); box-shadow: 0 12px 32px rgb(154 91 0 / 10%); }
.confirm .card-head { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.confirm-foot {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 0 16px 16px;
}
.confirm-note { font-size: .8125rem; color: var(--muted); }
.confirm-actions { display: flex; gap: 8px; }
.confirm[data-state="sending"] .card-head { color: var(--ink-2); background: var(--surface-2); }
.confirm[data-state="done"] { border-color: var(--ok-line); box-shadow: none; }
.confirm[data-state="done"] .card-head { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.confirm[data-state="cancelled"], .confirm[data-state="replaced"] { border-color: var(--line); box-shadow: none; }
.confirm[data-state="cancelled"] .card-head, .confirm[data-state="replaced"] .card-head { color: var(--ink-2); background: #f2f0f3; border-color: var(--line); }
.confirm[data-state="cancelled"] .card-body, .confirm[data-state="replaced"] .card-body { color: var(--muted); }
.confirm-summary { margin-top: 16px; font-weight: 600; }
.confirm-details { margin-top: 12px; }
.confirm-details summary { cursor: pointer; color: var(--muted); }
.confirm-details pre { max-height: 240px; overflow: auto; padding: 12px; background: var(--surface-2); border-radius: 10px; font: .8125rem var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; }

.notice {
  align-self: stretch; padding: 10px 14px; border-radius: 12px;
  font-size: .875rem; color: var(--ink-2); background: #f2f0f3; border: 1px dashed var(--line);
}
.notice.is-error { color: var(--danger); background: var(--danger-bg); border: 1px solid var(--danger-line); }

/* Dock de voz */
.dock-wrap {
  padding: 8px max(24px, calc((100% - 860px) / 2)) 24px;
  display: flex; flex-direction: column; gap: 10px;
}
.compose {
  display: flex; gap: 8px; padding: 6px;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
}
.compose input { flex: 1; min-width: 0; height: 44px; padding: 0 12px; border: 0; outline: none; background: transparent; }
.compose:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgb(113 75 103 / 12%); }

.dock {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: 24px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 18px 44px rgb(40 24 36 / 10%);
}
.mic-wrap { position: relative; display: inline-flex; flex: none; }
.mic {
  width: 64px; height: 64px; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  color: #fff; background: var(--accent);
  box-shadow: 0 10px 28px rgb(113 75 103 / 35%);
  transition: background-color .2s ease, transform .15s ease, box-shadow .2s ease;
  touch-action: manipulation;
}
.mic:hover:not(:disabled) { transform: scale(1.04); }
.mic:disabled { cursor: not-allowed; opacity: .55; }
.mic .ico-mic { width: 26px; height: 26px; }
.mic .ico-mic.off { display: none; }
.mic-ring { position: absolute; inset: -7px; border-radius: 50%; border: 2px solid transparent; pointer-events: none; }

.app[data-mode="listening"] .mic-ring { border-color: var(--accent-ring); animation: ring 1.6s ease-out infinite; }
.app[data-mic="off"] .mic { color: var(--ink-2); background: #ece8ed; box-shadow: none; }
.app[data-mic="off"] .mic .ico-mic.on { display: none; }
.app[data-mic="off"] .mic .ico-mic.off { display: block; }
.app[data-mode="working"] .mic-ring { border-color: rgb(154 91 0 / 35%); border-top-color: var(--warn-icon); animation: spin 1s linear infinite; }
.app[data-mic="off"] .mic-ring { border-color: transparent; animation: none; }

.dock-status { flex: 1 1 260px; min-width: 0; display: flex; align-items: center; gap: 16px; }
.wave { display: flex; align-items: center; gap: 3px; height: 44px; flex: none; }
.wave i {
  display: block; width: 4px; height: 40px; border-radius: 4px;
  background: var(--accent); transform: scaleY(.12); transform-origin: center;
  transition: transform .08s linear;
}
.app[data-mode="muted"] .wave i,
.app[data-mode="nomic"] .wave i,
.app[data-mode="offline"] .wave i,
.app[data-mode="connecting"] .wave i { background: #cfc8d1; }
.app[data-mode="working"] .wave i { background: var(--warn-icon); animation: pulse 1.2s ease-in-out infinite; }
.app[data-mode="working"] .wave i:nth-child(3n+1) { animation-delay: .15s; }
.app[data-mode="working"] .wave i:nth-child(3n+2) { animation-delay: .3s; }
.dock-status .wave { flex: 0 1 auto; min-width: 48px; overflow: hidden; }
.dock-text { flex: 1 1 150px; min-width: 130px; }
.status-label { font-family: var(--font-display); font-weight: 650; font-size: 1rem; }
.status-hint { font-size: .8125rem; color: var(--muted); }
.dock-actions { display: flex; align-items: center; gap: 8px; }

/* Painel lateral */
.side {
  width: 320px; flex: none; overflow-y: auto;
  display: flex; flex-direction: column; gap: 24px;
  padding: 24px; background: var(--surface); border-left: 1px solid var(--line);
}
.side-head { display: none; align-items: center; justify-content: space-between; }
.side-title { font-family: var(--font-display); font-size: 1.125rem; font-weight: 650; }
.section-title {
  margin-bottom: 12px; font-size: .75rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.conns { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: .875rem; }
.conns li { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; color: var(--muted); white-space: nowrap; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stat-main { grid-column: 1 / -1; background: var(--accent-soft); }
.stat-main strong { font-size: 1.25rem; color: var(--accent-strong); }
.stat { min-width: 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.stat span { display: block; font-size: .75rem; color: var(--muted); }
.stat strong { display: block; font-weight: 650; font-size: .9375rem; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.disclosure { display: inline-flex; align-items: center; gap: 6px; font-size: .875rem; }
.disclosure .ico { width: 16px; height: 16px; transition: transform .15s ease; }
.disclosure[aria-expanded="true"] .ico { transform: rotate(180deg); }
.usage-details { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line-2); border-radius: 12px; }
.usage-source { display: flex; justify-content: space-between; gap: 12px; font-size: .8125rem; }
.usage-source > span { display: flex; min-width: 0; flex-direction: column; }
.usage-source > span:last-child { align-items: flex-end; text-align: right; font-variant-numeric: tabular-nums; }
.usage-source small { color: var(--subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usage-line { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--line-2); font-size: .8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.usage-note { color: var(--subtle); font-size: .75rem; line-height: 1.4; }
.conn-summary {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); cursor: pointer;
}
.conn-summary .conn { font-size: .875rem; font-weight: 600; }
.conn-more { font-size: .8125rem; color: var(--muted); }
.conns { margin-top: 10px !important; padding: 0 12px !important; }

.activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; font-size: .875rem; }
.activity li { display: flex; gap: 10px; }
.activity-empty { color: var(--subtle); }
.act-time { font-family: var(--font-mono); font-size: .75rem; color: var(--subtle); padding-top: 2px; }
.act-body { flex: 1; min-width: 0; }
.act-detail { font-size: .75rem; color: var(--subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  align-self: flex-start; padding: 2px 8px; border-radius: 999px;
  font-size: .75rem; font-weight: 600; white-space: nowrap;
  color: var(--ink-2); background: #f2f0f3;
}
.badge[data-tone="ok"] { background: var(--ok-bg); }
.badge[data-tone="warn"] { background: var(--warn-bg); }
.badge[data-tone="error"] { background: var(--danger-bg); }

.side-foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: 16px; font-size: .875rem; }

/* Animações */
@keyframes caret { 50% { opacity: 0; } }
@keyframes ring { from { transform: scale(1); opacity: 1; } to { transform: scale(1.28); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scaleY(.15); } 50% { transform: scaleY(.45); } }

/* Responsivo */
@media (max-width: 960px) {
  .panel-toggle { display: grid; }
  .side {
    position: fixed; inset: 0 0 0 auto; z-index: 20;
    width: min(360px, 92vw);
    box-shadow: -24px 0 60px rgb(40 24 36 / 18%);
    transform: translateX(100%); visibility: hidden;
    transition: transform .25s ease, visibility .25s;
  }
  .side.open { transform: none; visibility: visible; }
  .side-head { display: flex; }
}

@media (max-width: 640px) {
  .pill-timer { display: none; }
  .wave i:nth-child(n+17) { display: none; }
  .dock-status { gap: 12px; }
  .messages { padding: 20px 16px 12px; }
  .dock-wrap { padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); }
  .dock { justify-content: space-between; gap: 12px; padding: 12px; }
  .dock-status { order: -1; flex-basis: 100%; }
  .wave { gap: 2px; }
  .wave i { width: 3px; }
  .dock-actions .btn span { display: none; }
  .dock-actions .btn { width: 44px; padding: 0; }
  .bubble { max-width: 88%; }
  .user-msg-row .bubble { max-width: calc(100% - 44px); }
  .chip, .result, .confirm { margin-left: 0; }
  .msg.agent .meta { padding-left: 0; }
  .confirm-actions { width: 100%; }
  .confirm-actions .btn { flex: 1; }
}

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