/* ============================================================================
   Painel da Juliana — atendimento e triagem
   Tokens → base → layout → componentes → páginas. Tema claro por padrão; escuro por [data-theme="dark"]
   ou pelo sistema (quando a pessoa não escolheu).
   ========================================================================== */
:root {
  --bg: #f6f2f5;
  --surface: #ffffff;
  --surface-2: #fbf8fa;
  --surface-3: #f3edf1;
  --line: #e9e1e6;
  --line-strong: #d9ced5;
  --text: #2b1f28;
  --text-2: #6a5b66;
  --text-3: #9a8c96;
  --primary: #8e2a63;
  --primary-hover: #772152;
  --primary-soft: #f7e8f0;
  --primary-ink: #ffffff;
  --green: #23805f;
  --green-soft: #e3f3ec;
  --amber: #b8780a;
  --amber-soft: #fcf0d9;
  --red: #c0392b;
  --red-soft: #fbe6e3;
  --blue: #3a65a8;
  --blue-soft: #e4ecf8;
  --bubble-in: #ffffff;
  --bubble-bot: #f4e3ed;
  --bubble-human: #dff1e8;
  --shadow: 0 1px 2px rgba(43, 31, 40, .06), 0 8px 24px -12px rgba(43, 31, 40, .14);
  --shadow-lg: 0 24px 60px -20px rgba(43, 31, 40, .35);
  --radius: 14px;
  --radius-sm: 9px;
  --side-w: 248px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-brand: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #161115;
  --surface: #211a1f;
  --surface-2: #281f26;
  --surface-3: #2f252d;
  --line: #3a2e37;
  --line-strong: #4a3b46;
  --text: #f4ecf1;
  --text-2: #b9a9b4;
  --text-3: #85757f;
  --primary: #d96aa6;
  --primary-hover: #e582b6;
  --primary-soft: rgba(217, 106, 166, .16);
  --primary-ink: #1d1018;
  --green: #55c79b;
  --green-soft: rgba(85, 199, 155, .14);
  --amber: #e8b04a;
  --amber-soft: rgba(232, 176, 74, .15);
  --red: #f0766a;
  --red-soft: rgba(240, 118, 106, .15);
  --blue: #7ea6e8;
  --blue-soft: rgba(126, 166, 232, .15);
  --bubble-in: #2d232b;
  --bubble-bot: #43283a;
  --bubble-human: #1f3d33;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .5);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161115; --surface: #211a1f; --surface-2: #281f26; --surface-3: #2f252d; --line: #3a2e37; --line-strong: #4a3b46;
    --text: #f4ecf1; --text-2: #b9a9b4; --text-3: #85757f; --primary: #d96aa6; --primary-hover: #e582b6;
    --primary-soft: rgba(217, 106, 166, .16); --primary-ink: #1d1018; --green: #55c79b; --green-soft: rgba(85, 199, 155, .14);
    --amber: #e8b04a; --amber-soft: rgba(232, 176, 74, .15); --red: #f0766a; --red-soft: rgba(240, 118, 106, .15);
    --blue: #7ea6e8; --blue-soft: rgba(126, 166, 232, .15); --bubble-in: #2d232b; --bubble-bot: #43283a; --bubble-human: #1f3d33;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .5); --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 24px; font-weight: 650; letter-spacing: -.015em; line-height: 1.2; }
h2 { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: 14px; font-weight: 650; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.brand-word { font-family: var(--font-brand); font-size: 21px; font-weight: 600; letter-spacing: .01em; line-height: 1.1; }
.logo-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--primary); color: var(--primary-ink); font: 600 21px/1 var(--font-brand); flex: none; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); display: inline-block; flex: none; }
.dot.ok { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.dot.warn { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.dot.bad { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

/* ---------- campos e botões ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field small { color: var(--text-3); font-size: 12px; }
input[type=text], input[type=password], input[type=search], input[type=tel], select, textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 10px 12px; line-height: 1.4; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  border-radius: var(--radius-sm); padding: 9px 14px; font-weight: 600; font-size: 14px; line-height: 1.2; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--line-strong)); }
.btn-danger:hover { background: var(--red-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn svg { width: 17px; height: 17px; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.form-error { color: var(--red); font-size: 13px; background: var(--red-soft); padding: 8px 10px; border-radius: var(--radius-sm); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.4; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-plum { background: var(--primary-soft); color: var(--primary); }
.chip-green { background: var(--green-soft); color: var(--green); }
.chip-amber { background: var(--amber-soft); color: var(--amber); }
.chip-red { background: var(--red-soft); color: var(--red); }
.chip-blue { background: var(--blue-soft); color: var(--blue); }

.badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--primary); color: var(--primary-ink); font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; font-style: normal; }
.badge-amber { background: var(--amber); color: #fff; }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: linear-gradient(155deg, #5c1840 0%, #8e2a63 55%, #b4506f 100%); color: #fff; display: grid; place-items: center; padding: 48px; }
.login-art-inner { max-width: 420px; }
.login-art .brand-word { font-size: 44px; display: block; margin-bottom: 18px; }
.login-art p { font-size: 18px; line-height: 1.5; opacity: .92; }
.login-art ul { margin: 28px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.login-art li { padding-left: 26px; position: relative; opacity: .9; }
.login-art li::before { content: ""; position: absolute; left: 0; top: .5em; width: 14px; height: 2px; background: #fff; opacity: .7; }
.login-card { align-self: center; justify-self: center; width: min(400px, calc(100% - 32px)); display: grid; gap: 16px; padding: 24px 0; }
.login-card .logo-mark { margin-bottom: 4px; }

/* ---------- layout do app ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); height: 100dvh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px; gap: 18px; min-height: 0; }
.side-brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px; }
.side-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.nav { display: grid; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); font-weight: 600; font-size: 14.5px; position: relative; }
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav .dot { margin-left: auto; }
.side-foot { margin-top: auto; display: grid; gap: 10px; }
.pause-toggle { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.pause-toggle:hover { border-color: var(--line-strong); }
.switch { width: 36px; height: 21px; border-radius: 999px; background: var(--green); position: relative; flex: none; transition: background .2s; }
.switch i { position: absolute; top: 2px; left: 17px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: left .2s; }
.pause-toggle[aria-pressed="true"] .switch { background: var(--line-strong); }
.pause-toggle[aria-pressed="true"] .switch i { left: 2px; }
.pause-text { display: grid; line-height: 1.25; }
.pause-text small { color: var(--text-3); font-size: 12px; }
.side-actions { display: flex; justify-content: space-between; padding: 0 2px; }

.main { min-width: 0; min-height: 0; overflow-y: auto; outline: none; }
.page { padding: 28px 32px 40px; max-width: 1240px; margin: 0 auto; display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); }
.page > * { min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.page-wide { max-width: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px 0; }
.empty { padding: 36px 20px; text-align: center; color: var(--text-3); display: grid; gap: 6px; justify-items: center; }
.empty strong { color: var(--text-2); font-weight: 650; }

/* ---------- visão geral ---------- */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding: 22px 24px; border-radius: 18px;
  background: linear-gradient(120deg, var(--primary-soft), var(--surface) 70%); border: 1px solid var(--line); }
.hero h1 { font-size: 26px; }
.hero-status { display: flex; gap: 10px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { padding: 16px 18px; display: grid; gap: 6px; align-content: start; }
.kpi .kpi-label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.kpi .kpi-num { font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi .kpi-note { font-size: 12.5px; color: var(--text-3); }
.kpi-hot { border-color: color-mix(in srgb, var(--amber) 50%, var(--line)); background: linear-gradient(180deg, var(--amber-soft), var(--surface) 80%); }
.kpi-hot .kpi-num { color: var(--amber); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; }
.grid-2 > * { min-width: 0; }
.chart { padding: 8px 20px 18px; }
.chart svg { width: 100%; height: 190px; overflow: visible; stroke: none; stroke-width: 0; }
.chart .legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-2); padding-top: 6px; }
.chart .legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--c); }
.bars { padding: 10px 20px 18px; display: grid; gap: 12px; }
.bar-row { display: grid; gap: 5px; }
.bar-row .bar-top { display: flex; justify-content: space-between; font-size: 13.5px; }
.bar-track { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--primary); }
.wait-list { display: grid; }
.wait-item { display: flex; gap: 14px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); cursor: pointer; }
.wait-item:first-child { border-top: none; }
.wait-item:hover { background: var(--surface-2); }
.wait-item .who { font-weight: 650; }
.wait-item .what { color: var(--text-2); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-size: 15px; background: var(--primary-soft); color: var(--primary); }
.avatar.sm { width: 34px; height: 34px; font-size: 13px; }

/* ---------- conversas ---------- */
.conv { display: grid; grid-template-columns: 330px minmax(0, 1fr) 320px; height: 100dvh; }
.conv-list { border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.conv-list-head { padding: 18px 16px 10px; display: grid; gap: 12px; }
.conv-list-head input { text-overflow: ellipsis; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.filter.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.conv-items { overflow-y: auto; flex: 1; }
.conv-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: flex-start; width: 100%; background: transparent; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.conv-item:hover { background: var(--surface-2); }
.conv-item.active { background: var(--primary-soft); }
.conv-item .body { min-width: 0; flex: 1; display: grid; gap: 2px; }
.conv-item .row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.conv-item .name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item .time { font-size: 12px; color: var(--text-3); flex: none; }
.conv-item .last { font-size: 13.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item .tags { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; }
.chat-head .who { min-width: 0; flex: 1 1 200px; }
.chat-head .who strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.back-btn { display: none; }
.ficha-toggle, .ficha-close { display: none; }
.msgs { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.day-sep { align-self: center; font-size: 12px; color: var(--text-3); background: var(--surface-3); border-radius: 999px; padding: 2px 12px; margin: 8px 0 2px; }
.bubble { max-width: min(560px, 82%); padding: 8px 12px 6px; border-radius: 14px; box-shadow: 0 1px 1px rgba(43, 31, 40, .06); white-space: pre-wrap; word-break: break-word; line-height: 1.45; }
.bubble .meta { display: flex; gap: 8px; justify-content: space-between; align-items: baseline; font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.bubble .tag { font-weight: 700; letter-spacing: .02em; text-transform: uppercase; font-size: 10.5px; }
.bubble.in { align-self: flex-start; background: var(--bubble-in); border-bottom-left-radius: 4px; }
.bubble.bot { align-self: flex-end; background: var(--bubble-bot); border-bottom-right-radius: 4px; }
.bubble.bot .tag { color: var(--primary); }
.bubble.human { align-self: flex-end; background: var(--bubble-human); border-bottom-right-radius: 4px; }
.bubble.human .tag { color: var(--green); }
.composer { border-top: 1px solid var(--line); background: var(--surface); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); display: grid; gap: 8px; }
.composer-row { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea { min-height: 44px; max-height: 140px; resize: none; flex: 1; min-width: 0; }
.composer-row .btn { flex: none; }
.composer .hint { font-size: 12.5px; color: var(--text-3); display: flex; gap: 6px; align-items: center; }
.paused-banner { display: flex; gap: 10px; align-items: center; padding: 8px 14px; background: var(--amber-soft); color: var(--amber); font-size: 13.5px; font-weight: 600; border-bottom: 1px solid var(--line); }
.ficha { border-left: 1px solid var(--line); background: var(--surface); overflow-y: auto; padding: 18px; display: grid; gap: 14px; align-content: start; }
.ficha .summary-box { background: var(--primary-soft); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; }
.ficha .summary-box strong { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--primary); margin-bottom: 4px; }
.conv-empty { display: grid; place-items: center; color: var(--text-3); text-align: center; padding: 24px; grid-column: 2 / 4; }

/* ---------- quadro de triagem ---------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 14px; align-items: start; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--surface-3); border-radius: var(--radius); padding: 10px; display: grid; gap: 10px; align-content: start; min-height: 220px; border: 2px solid transparent; }
.col.drop { border-color: var(--primary); background: var(--primary-soft); }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px; }
.col-head h3 { display: flex; align-items: center; gap: 8px; }
.col-count { font-size: 12.5px; font-weight: 700; color: var(--text-2); background: var(--surface); border-radius: 999px; padding: 1px 9px; }
.lead-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; cursor: grab; box-shadow: var(--shadow); text-align: left; width: 100%; }
.lead-card:hover { border-color: var(--line-strong); }
.lead-card.dragging { opacity: .5; }
.lead-card .top { display: flex; gap: 10px; align-items: center; }
.lead-card .name { font-weight: 650; line-height: 1.25; }
.lead-card .interest { font-size: 13.5px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lead-card .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.urg-alta { box-shadow: inset 3px 0 0 var(--red), var(--shadow); }

/* ---------- configuração + simulador ---------- */
.bot-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 18px; align-items: start; }
.form-card { display: grid; gap: 18px; padding: 20px; }
.form-card h2 { display: flex; align-items: center; gap: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.span-2 { grid-column: 1 / -1; }
.tones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tone { border: 1.5px solid var(--line-strong); background: var(--surface); border-radius: 12px; padding: 12px; text-align: left; display: grid; gap: 3px; }
.tone strong { font-size: 14px; }
.tone small { color: var(--text-3); font-size: 12.5px; line-height: 1.35; }
.tone[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.hours { display: grid; gap: 8px; }
.hours-row { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: center; }
.hours-row label { font-weight: 600; color: var(--text-2); font-size: 14px; text-transform: capitalize; }
.savebar { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.sim { position: sticky; top: 20px; display: flex; flex-direction: column; height: min(680px, calc(100dvh - 40px)); overflow: hidden; }
.sim-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.sim-head .who { flex: 1; min-width: 0; }
.sim .msgs { background: var(--bg); padding: 14px; }
.sim .triage { align-self: flex-end; max-width: 92%; font-size: 12px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: 10px; padding: 8px 10px; color: var(--text-2); display: grid; gap: 3px; }
.sim .triage b { color: var(--text); }
.sim .composer { padding: 10px 12px; }
.typing { display: inline-flex; gap: 4px; padding: 10px 14px; align-self: flex-end; background: var(--bubble-bot); border-radius: 14px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); opacity: .35; animation: blink 1.1s infinite; }
.typing i:nth-child(2) { animation-delay: .18s; } .typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.sim-suggest { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 12px 10px; }
.sim-suggest button { font-size: 12.5px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 4px 11px; color: var(--text-2); }
.sim-suggest button:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- conexão ---------- */
.conn-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.conn-state { display: flex; gap: 16px; align-items: center; padding: 22px; }
.conn-state .big { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--green-soft); color: var(--green); }
.conn-state .big svg { width: 28px; height: 28px; }
.conn-state.off .big { background: var(--amber-soft); color: var(--amber); }
.qr-box { display: grid; gap: 14px; justify-items: center; padding: 22px; text-align: center; }
.qr-box svg.qr { width: min(270px, 100%); height: auto; border-radius: 12px; border: 1px solid var(--line); background: #fff; padding: 0; }
.qr-wait { width: 270px; max-width: 100%; aspect-ratio: 1; border-radius: 12px; border: 1px dashed var(--line-strong); display: grid; place-items: center; color: var(--text-3); }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--text-2); }
.pair-code { font: 700 32px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em; color: var(--primary); background: var(--primary-soft); padding: 14px 18px; border-radius: 12px; }

/* ---------- avisos ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 50; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; font-size: 14px; max-width: min(380px, calc(100vw - 36px)); animation: toast-in .2s ease-out; pointer-events: auto; }
.toast.err { background: var(--red); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.modal-back { position: fixed; inset: 0; background: rgba(20, 10, 17, .55); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal { background: var(--surface); border-radius: 16px; padding: 22px; width: min(420px, 100%); display: grid; gap: 14px; box-shadow: var(--shadow-lg); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: 8px; min-height: 18px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- responsivo ---------- */
@media (max-width: 1180px) {
  .conv { grid-template-columns: 300px minmax(0, 1fr); }
  .ficha { display: none; }
  .ficha-toggle, .ficha-close { display: inline-flex; }
  .ficha.open { display: grid; position: fixed; inset: 0 0 0 auto; width: min(360px, 100%); z-index: 40; box-shadow: var(--shadow-lg); }
  .bot-layout, .conn-grid { grid-template-columns: 1fr; }
  .sim { position: static; height: 560px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .conv-empty { grid-column: 2; }
}
@media (max-width: 820px) {
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .app { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .sidebar { grid-row: 2; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); gap: 0; justify-content: space-around; }
  .side-brand, .side-foot { display: none; }
  .nav { display: flex; width: 100%; justify-content: space-around; min-width: 0; }
  .nav a { flex-direction: column; gap: 3px; font-size: 10.5px; padding: 6px 2px; flex: 1 1 0; min-width: 0; align-items: center; text-align: center; }
  .nav a .badge, .nav a .dot { position: absolute; top: 2px; right: calc(50% - 22px); margin: 0; }
  .nav a span { white-space: nowrap; }
  .page { padding: 18px 16px 28px; }
  .grid-2, .form-grid, .tones { grid-template-columns: minmax(0, 1fr); }
  .kpi .kpi-num { font-size: 30px; }
  .hero h1 { font-size: 21px; }
  .conv { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 62px); }
  .conv .chat, .conv .conv-empty { display: none; }
  .conv.show-chat .conv-list { display: none; }
  .conv.show-chat .chat { display: flex; }
  .back-btn { display: grid; }
  .board { grid-template-columns: repeat(4, 82%); scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
