/* PORTELON — tema "Portal": violeta + coral. Modo claro e escuro pelos mesmos tokens. */
:root {
  --bg: #F7F6FB;
  --surface: #FFFFFF;
  --surface-2: #F3F0FF;
  --line: #E4E0F2;
  --text: #14112B;
  --muted: #6B6785;
  --brand: #6D4AFF;
  --brand-2: #9B6BFF;
  --brand-ink: #5536E0;
  --brand-soft: #EDE8FF;
  --accent: #FF7A59;
  --ok: #12A150;
  --ok-soft: #E3F6EA;
  --warn: #B87400;
  --warn-soft: #FFF3D6;
  --bad: #D93A3F;
  --bad-soft: #FDE7E8;
  --side: #14112B;
  --side-text: #CFCAF0;
  --side-hover: #221D44;
  --shadow: 0 1px 2px rgba(20, 17, 43, .06), 0 4px 16px rgba(20, 17, 43, .05);
  --radius: 14px;
  --grad: linear-gradient(135deg, #6D4AFF, #9B6BFF);
  --font: Sora, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0F0D22;
  --surface: #17142F;
  --surface-2: #1F1B3D;
  --line: #2C2752;
  --text: #ECEAFB;
  --muted: #A19CC4;
  --brand: #7C5CFF;
  --brand-2: #A37BFF;
  --brand-ink: #B9A2FF;
  --brand-soft: #2A2257;
  --ok: #3DD68C;
  --ok-soft: #12382A;
  --warn: #F5B544;
  --warn-soft: #3A2C10;
  --bad: #FF6B6F;
  --bad-soft: #3D1A20;
  --side: #0B0A1A;
  --side-text: #B8B2E0;
  --side-hover: #1B1736;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14.5px/1.55 var(--font); min-height: 100vh; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 16px 0 8px; color: var(--muted); }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }

/* ---------- Estrutura: menu lateral + conteúdo ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-text); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 4px; flex: none; }
.side-pin { all: unset; width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 8px; color: var(--side-text); cursor: pointer; }
.side-pin:hover { background: var(--side-hover); color: #fff; }
.side-pin:focus-visible { outline: 2px solid #fff; }
.side-pin svg { fill: currentColor; transition: transform .15s; }
.side-pin[aria-pressed="false"] svg { fill: none; transform: rotate(45deg); }
.side .brand { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 2px 8px 16px; color: #fff; font-weight: 800; letter-spacing: 1.4px; font-size: 17px; }
.side .brand:hover { text-decoration: none; }
.side .brand svg { width: 28px; height: 30px; flex: none; }
.side .who { font-size: 12px; padding: 0 8px 12px; color: var(--side-text); opacity: .85; }
.side .who b { display: block; color: #fff; font-size: 13px; }
.side .sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; padding: 14px 10px 4px; opacity: .55; }
.side a.it { display: flex; align-items: center; gap: 10px; color: var(--side-text); padding: 8px 10px; border-radius: 10px; font-size: 13.5px; }
.side a.it:hover { background: var(--side-hover); text-decoration: none; color: #fff; }
.side a.it.on { background: var(--brand); color: #fff; font-weight: 600; }
.side a.it .ic { width: 18px; text-align: center; opacity: .9; }
.side a.it .count { margin-left: auto; background: var(--accent); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; font-weight: 700; }
.side .bottom { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.side button.it { all: unset; display: flex; align-items: center; gap: 10px; color: var(--side-text); padding: 8px 10px; border-radius: 10px; font-size: 13.5px; cursor: pointer; }
.side button.it:hover { background: var(--side-hover); color: #fff; }

.main { min-width: 0; padding: 22px 28px 48px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.top .sub { color: var(--muted); margin-top: 2px; }
.top .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }

.btn.menu-toggle { display: none; }
.main:has(.inbox) { padding-bottom: 22px; }
.btn.only-mobile { display: none; }

/* ---------- Cartões, grades ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat .lbl { color: var(--muted); font-size: 12.5px; }
.stat .val { font-size: 24px; font-weight: 800; margin-top: 4px; }
.stat .val.bad { color: var(--bad); }
.stat .val.ok { color: var(--ok); }

/* ---------- Abas (quebram linha em vez de cortar) ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--brand-ink); border-color: var(--brand); }

/* ---------- Botões ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 10px; font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; line-height: 1.2; }
.btn:hover { border-color: var(--brand); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
:root[data-theme="dark"] .btn.primary:hover { background: #6A48F0; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.lg { padding: 11px 20px; font-size: 15px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.inline { display: inline; }

/* ---------- Formulários ---------- */
label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.field .hint, .hint { font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 3px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=time], input[type=url], input[type=search], input:not([type]), select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 14px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea { min-height: 80px; resize: vertical; }
.row { display: flex; gap: 8px; align-items: flex-end; }
.row > .grow { flex: 1; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; font-size: 13.5px; }
.check input { width: auto; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13.5px; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* ---------- Etiquetas e avisos ---------- */
.tag { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.brand { background: var(--brand-soft); color: var(--brand-ink); }
.flash { padding: 11px 14px; border-radius: 12px; margin-bottom: 16px; border: 1px solid; font-size: 13.5px; }
.flash.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.flash.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.flash.info { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); }
.flash.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.secret-box { font-family: ui-monospace, Consolas, monospace; background: var(--surface-2); padding: 8px 12px; border-radius: 10px; user-select: all; word-break: break-all; }

/* ---------- Passos (próximo passo claro) ---------- */
.steps { display: flex; flex-direction: column; gap: 10px; }
.step { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.step .n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 800; color: var(--muted); flex: none; }
.step.done .n { background: var(--ok-soft); color: var(--ok); }
.step .txt { flex: 1; }
.step .txt b { display: block; }

/* ---------- Cartões de canais ---------- */
.channel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.ch-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); }
a.ch-card:hover { border-color: var(--brand); text-decoration: none; }
.ch-card.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.ch-card .ch-ic, .ch-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; flex: none; box-shadow: 0 2px 6px rgba(20, 17, 43, .15); }
.ch-ic svg { width: 26px; height: 26px; }
.ch-ic.sm { width: 28px; height: 28px; border-radius: 8px; box-shadow: none; }
.ch-ic.sm svg { width: 17px; height: 17px; }
.ch-card .ch-name { font-weight: 700; }
.ch-card .ch-desc { color: var(--muted); font-size: 12.5px; flex: 1; }

/* ---------- Departamentos (quadro com cartões) ---------- */
.dept-board { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.dept { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.dept.over { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.dept header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.dept header b { font-size: 15px; }
.dept-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.dept-drop { list-style: none; margin: 0; padding: 8px; min-height: 150px; background: var(--surface-2); border-radius: 10px; display: flex; flex-direction: column; gap: 2px; }
.dept-drop li, #peopleList li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; font-size: 13.5px; }
.dept-drop li[hidden], #peopleList li[hidden] { display: none; }
.dept-drop li:hover { background: var(--surface); }
.dept-drop .nm, #peopleList .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dept-drop .rm { all: unset; cursor: pointer; color: var(--muted); font-size: 12px; padding: 2px 6px; border-radius: 6px; opacity: 0; }
.dept-drop li:hover .rm, .dept-drop .rm:focus { opacity: 1; }
.dept-drop .rm:hover { color: var(--bad); background: var(--bad-soft); }
.dept-drop .hint-empty { color: var(--muted); font-size: 12.5px; justify-content: center; flex: 1; border: 1px dashed var(--line); }
.dept-add select { font-size: 12.5px; padding: 6px 9px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; flex: none; letter-spacing: .02em; }
.people { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 10px; }
.people-head { padding: 10px 14px; font-weight: 700; border-bottom: 1px solid var(--line); }
#peopleList { list-style: none; margin: 0; padding: 6px; max-height: 60vh; overflow-y: auto; }
#peopleList li[draggable="true"] { cursor: grab; }
#peopleList li[draggable="true"]:hover { background: var(--surface-2); }
#peopleList li.dragging { opacity: .5; }
#peopleList small { display: block; color: var(--muted); font-size: 11.5px; }
details.kebab { position: relative; }
details.kebab summary { list-style: none; cursor: pointer; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; font-size: 18px; color: var(--muted); }
details.kebab summary::-webkit-details-marker { display: none; }
details.kebab summary:hover { background: var(--surface-2); color: var(--text); }
.kebab-menu { position: absolute; right: 0; top: 34px; z-index: 40; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(20, 17, 43, .18); min-width: 240px; padding: 6px; }
.kebab-menu a, .kebab-menu button { all: unset; display: flex; align-items: center; gap: 10px; box-sizing: border-box; width: 100%; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 13.5px; color: var(--text); white-space: nowrap; }
.kebab-menu a:hover, .kebab-menu button:hover, .kebab-menu a:focus-visible, .kebab-menu button:focus-visible { background: var(--surface-2); text-decoration: none; }
.kebab-menu .mi { width: 20px; text-align: center; flex: none; }
.kebab-menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.kebab-menu button.danger { color: var(--bad); }
.kebab-menu button.danger:hover { background: var(--bad-soft); }
.card.flush.auto-list { overflow: visible; }
dialog.modal { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: var(--surface); color: var(--text); width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
dialog.modal::backdrop { background: rgba(20, 17, 43, .45); }

/* ---------- Automações ---------- */
.auto-list { overflow: visible; }
.auto-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.auto-row:last-child { border-bottom: 0; }
.auto-row[hidden] { display: none; }
.auto-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.auto-name { font-weight: 700; font-size: 15px; margin-right: 6px; }
.auto-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; }
.auto-ch { display: inline-flex; align-items: center; gap: 6px; }
.auto-ch .ch-ic.sm { width: 22px; height: 22px; border-radius: 6px; }
.auto-ch .ch-ic.sm svg { width: 14px; height: 14px; }
.auto-dates { text-align: right; white-space: nowrap; }
.slots { display: flex; flex-direction: column; gap: 10px; }
.slots[hidden] { display: none; }
.slot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.slot input[type=time] { width: auto; }
.days { display: flex; gap: 4px; flex-wrap: wrap; }
.day input { position: absolute; opacity: 0; pointer-events: none; }
.day span { display: inline-block; padding: 6px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; font-weight: 600; cursor: pointer; user-select: none; }
.day input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.day input:focus-visible + span { outline: 2px solid var(--brand); }
.channel-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 500; }
.pick:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.pick small { display: block; }
.pick input { width: auto; }

/* ---------- Editor de fluxograma ---------- */
.main:has(.flow-page) { padding: 14px 18px; }
.flow-page { display: flex; flex-direction: column; height: calc(100vh - 28px); gap: 10px; }
.flow-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.flow-bar .grow { flex: 1; }
.flow-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 10px; }
.flow-canvas { position: relative; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius);
  background: radial-gradient(circle, var(--line) 1px, transparent 1px) 0 0 / 22px 22px, var(--bg); }
#tree { position: relative; display: inline-block; padding: 56px 60px 40px 40px; }
#treeInner { position: relative; }
#wires { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.zoom { position: sticky; top: 8px; left: 8px; z-index: 3; display: flex; width: max-content; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 4px 6px; margin: 8px 0 0 8px; box-shadow: var(--shadow); }
.zoom span { min-width: 40px; text-align: center; }
#wires path { fill: none; stroke: var(--brand-2); stroke-width: 2; opacity: .75; }
.fwrap { display: flex; align-items: center; }
.fkids { display: flex; flex-direction: column; gap: 12px; margin-left: 52px; padding: 4px 0; }
.fnode { position: relative; width: 205px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 12px; padding: 9px 12px; cursor: pointer; box-shadow: var(--shadow); }
.fnode:hover { border-color: var(--brand-2); }
.fnode.sel { outline: 3px solid var(--brand-soft); border-color: var(--brand); }
.fnode.t-menu { border-left-color: #0B84D9; } .fnode.t-pergunta { border-left-color: #9333EA; } .fnode.t-horario { border-left-color: #B87400; }
.fnode.t-transferir { border-left-color: #12A150; } .fnode.t-encerrar { border-left-color: #D93A3F; } .fnode.t-webhook { border-left-color: #0F766E; }
.fnode.t-voltar, .fnode.t-automacao { border-left-color: var(--accent); }
.ftitle { display: flex; gap: 6px; align-items: center; font-weight: 700; font-size: 13.5px; }
.ficon { flex: none; } .ficon.big { font-size: 22px; }
.fprev { color: var(--muted); font-size: 12px; margin-top: 3px; white-space: pre-line; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.fbadge { display: inline-block; font-size: 11px; font-weight: 700; background: var(--brand-soft); color: var(--brand-ink); padding: 1px 8px; border-radius: 99px; margin-bottom: 4px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fbadge.yes { background: var(--ok-soft); color: var(--ok); }
.fbadge.no { background: var(--bad-soft); color: var(--bad); }
.fnode.t-erp_identificar, .fnode.t-erp_faturas, .fnode.t-erp_desbloqueio { border-left-color: #0B84D9; background: linear-gradient(90deg, rgba(11, 132, 217, .06), transparent 40%), var(--surface); }
.opt-row .grow { flex: 1; font-size: 13px; }
.fstart { position: absolute; top: -10px; left: 10px; background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 700; padding: 1px 8px; border-radius: 99px; }
.fplus { position: absolute; right: -13px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--brand); background: var(--surface); color: var(--brand); font-weight: 800; cursor: pointer; line-height: 1; opacity: 0; transition: opacity .12s; }
.fnode:hover .fplus, .fnode.sel .fplus, .fplus:focus { opacity: 1; }
.flow-panel { overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; }
.opt-list { display: flex; flex-direction: column; gap: 6px; }
.opt-row { display: flex; gap: 6px; align-items: center; }
.opt-row input { flex: 1; }
.sim { position: fixed; right: 20px; bottom: 20px; width: 360px; max-width: calc(100vw - 32px); height: 520px; max-height: calc(100vh - 40px); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); display: flex; flex-direction: column; z-index: 60; }
.sim[hidden] { display: none; }
.sim-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.sim-head .grow { flex: 1; }
.sim-msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.sim-msgs .opts { display: flex; flex-wrap: wrap; gap: 6px; }
.sim-send { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
@media (max-width: 1100px) { .flow-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(320px, 1fr) auto; } .flow-page { height: auto; } .flow-canvas { min-height: 420px; } }

/* ---------- Caixa de entrada ---------- */
.inbox > * { min-width: 0; }
.inbox { display: grid; grid-template-columns: 320px minmax(0, 1fr) 260px; height: calc(100vh - 44px); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.inbox .list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.inbox .list .filters { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; border-bottom: 1px solid var(--line); }
.inbox .list .filters a { padding: 5px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--surface-2); }
.inbox .list .filters a.on { background: var(--brand); color: #fff; }
.inbox .list .filters a:hover { text-decoration: none; }
.inbox .list .next { padding: 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
/* Abas da lista numa linha só, com contador em bolinha (como um app de mensagens) */
.seg-tabs { display: flex; gap: 2px; margin: 10px 10px 0; padding: 4px; background: var(--surface-2); border-radius: 99px; }
.seg-tabs a { flex: 1; position: relative; text-align: center; padding: 7px 4px; border-radius: 99px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.seg-tabs a:hover { text-decoration: none; color: var(--text); }
.seg-tabs a.on { background: var(--brand); color: #fff; box-shadow: 0 2px 6px rgba(109, 74, 255, .3); }
.bdg { position: absolute; top: -8px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--brand-2); color: #fff; font-size: 10.5px; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.bdg.hot { background: #E5484D; }
.bdg[hidden] { display: none; }
.inbox .search .srow { display: flex; gap: 6px; align-items: center; }
.sbox { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 0 12px; height: 38px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--muted); }
.sbox:focus-within { border-color: var(--brand); outline: 2px solid var(--brand-soft); }
.inbox .search .sbox input[type=search] { border: 0; outline: 0; padding: 0; background: none; height: 100%; font-size: 13px; border-radius: 0; }
.sq-btn { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.sq-btn:hover { color: var(--brand); border-color: var(--brand-2); text-decoration: none; }
.sq-btn.on, .sq-btn.open { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
.inbox .search .fl[hidden] { display: none; }
.conv.idle { border-left: 4px solid transparent; }
.bulk-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.conv { position: relative; }
.bulk-ck { position: absolute; right: 10px; bottom: 10px; width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--brand-2); background: var(--surface); }
.bulk-ck.on { background: var(--brand); border-color: var(--brand); }
.bulk-ck.on::after { content: '✓'; color: #fff; font-size: 13px; font-weight: 800; display: grid; place-items: center; height: 100%; line-height: 1; }
.close-ticket { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.close-ticket[hidden] { display: none; }
.recur { display: inline-flex; align-items: center; gap: 4px; }
/* Janela "Abrir atendimento" */
.st-find { position: relative; }
.st-hits { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(20, 16, 50, .15); overflow: hidden; }
.st-hits[hidden] { display: none; }
.st-hits button { display: flex; justify-content: space-between; gap: 8px; width: 100%; border: 0; background: none; padding: 9px 12px; font: inherit; text-align: left; cursor: pointer; color: var(--text); }
.st-hits button:hover { background: var(--brand-soft); }
.tpl-preview { background: #D9FDD3; color: #111B21; border-radius: 10px 10px 10px 2px; padding: 10px 12px; white-space: pre-wrap; font-size: 13.5px; box-shadow: 0 1px 1px rgba(0, 0, 0, .1); }
.tpl-preview::before { content: 'Prévia'; display: block; font-size: 11px; font-weight: 700; color: #667781; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .06em; }
[data-only][hidden], #stTpl[hidden], #stTxt[hidden] { display: none; }
.inbox .list .next .btn { width: 100%; justify-content: center; }
.inbox .convs { overflow-y: auto; flex: 1; }
.conv { display: block; padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--text); }
.conv:hover { background: var(--surface-2); text-decoration: none; }
.conv.on { background: var(--brand-soft); }
.conv:has(> .conv-ic) { padding-left: 50px; }
.conv .conv-ic { position: absolute; left: 13px; top: 12px; }
.conv .l1 { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; font-size: 13.5px; }
.conv .l2 { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .l3 { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
/* Conversa esperando resposta: pisca até alguém responder */
.conv.awaiting { position: relative; animation: awaiting 1.6s ease-in-out infinite; }
.conv.awaiting::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.conv.awaiting .l1 span:first-child { font-weight: 800; }
.conv.awaiting.on { animation: none; }
@keyframes awaiting { 0%, 100% { background: transparent; } 50% { background: rgba(255, 122, 89, .16); } }
@media (prefers-reduced-motion: reduce) { .conv.awaiting { animation: none; background: rgba(255, 122, 89, .12); } }
.tag.reply { background: var(--accent); color: #fff; }
.conv .unread { background: var(--accent); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; }
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat .head { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.chat .head .actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chat .msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.bubble { max-width: 72%; padding: 8px 12px; border-radius: 14px; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.bubble.in { background: var(--surface); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.out { background: var(--brand); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble.out.bot { background: var(--surface-2); color: var(--text); border: 1px dashed var(--brand-2); }
.bubble .meta { font-size: 11px; opacity: .7; margin-top: 3px; }
.sysmsg { align-self: center; font-size: 12px; color: var(--muted); background: var(--surface-2); padding: 3px 10px; border-radius: 99px; }
.chat .composer { border-top: 1px solid var(--line); padding: 10px; display: flex; gap: 8px; align-items: flex-end; position: relative; container-type: inline-size; }
.chat .composer textarea { max-height: 160px; }
.chat .placeholder { flex: 1; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 30px; }
.qr-pop { position: absolute; bottom: 62px; left: 10px; right: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); max-height: 220px; overflow-y: auto; display: none; }
.qr-pop.open { display: block; }
.qr-pop div { padding: 8px 12px; cursor: pointer; font-size: 13px; }
.qr-pop div:hover, .qr-pop div.sel { background: var(--brand-soft); }
.inbox .info { border-left: 1px solid var(--line); padding: 14px; overflow-y: auto; font-size: 13px; }
.inbox .info dt { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; margin-top: 10px; }
.inbox .info dd { margin: 2px 0 0; }

/* ---------- Conversa: mídia, envio estilo WhatsApp, fundos por canal ---------- */
.chat { position: relative; }
.bubble.has-media { padding: 4px; }
.bubble .b-text { padding: 2px 6px; }
.bubble.has-media .meta { padding: 0 6px 2px; }
.m-img img { display: block; max-width: 280px; max-height: 320px; min-width: 90px; min-height: 60px; border-radius: 10px; object-fit: cover; background: rgba(0, 0, 0, .05); }
.m-audio { display: block; width: 270px; max-width: 100%; height: 40px; }
.m-video { display: block; max-width: 300px; max-height: 300px; border-radius: 10px; }
.m-doc { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: rgba(0, 0, 0, .06); color: inherit; min-width: 210px; }
.m-doc:hover { text-decoration: none; background: rgba(0, 0, 0, .1); }
.m-doc small { display: block; opacity: .75; }
.m-doc-ic { width: 38px; height: 44px; border-radius: 6px; background: #E5484D; color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; flex: none; }
.bubble a { color: inherit; text-decoration: underline; }
.b-opts { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 6px 2px; }
.b-opts span { font-size: 11.5px; border: 1px solid currentColor; border-radius: 99px; padding: 1px 8px; opacity: .8; }
.tick { opacity: .8; }
.err { color: #FFD1D1; }
.bubble.in .err, .bubble.bot .err { color: var(--bad); }
.daysep { align-self: center; margin: 6px 0; }
.daysep span { background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 11.5px; padding: 3px 12px; border-radius: 99px; text-transform: capitalize; box-shadow: var(--shadow); }

/* Barra de envio */
.composer { align-items: center; background: var(--surface); flex-wrap: wrap; }
.composer.closed { justify-content: center; padding: 14px; }
.compose-row { flex: 1; display: flex; align-items: flex-end; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 22px; padding: 4px 6px 4px 4px; min-width: 0; }
.compose-row:focus-within { border-color: var(--brand); }
.compose-row textarea { border: 0; background: transparent; min-height: 36px; max-height: 160px; padding: 8px 6px; outline: none; resize: none; font-size: 14px; line-height: 20px; }
/* A dica fica em uma linha só, alinhada com os ícones; se não couber, termina em reticências. */
.compose-row textarea::placeholder { color: var(--muted); opacity: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compose-row textarea:focus { outline: none; }
.icon-btn { border: 0; background: transparent; color: var(--muted); width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none; font-size: 15px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { color: var(--bad); background: var(--bad-soft); }
.compose-row .icon-btn:hover { background: var(--surface); }
.round-btn { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; box-shadow: 0 2px 8px rgba(109, 74, 255, .35); transition: transform .1s; }
.round-btn:hover { background: var(--brand-ink); transform: scale(1.04); }
.round-btn[hidden] { display: none; }
.round-btn:disabled { opacity: .6; }
.round-btn.alt { background: var(--surface); color: var(--brand); border: 1px solid var(--line); box-shadow: none; }
.round-btn.alt:hover { background: var(--brand-soft); }
.send-btn { height: 46px; padding: 0 18px; border-radius: 99px; border: 0; background: var(--brand); color: #fff; font: inherit; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; flex: none; box-shadow: 0 2px 8px rgba(109, 74, 255, .35); }
.send-btn:hover { background: var(--brand-ink); }
.send-btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
.attach-preview { flex-basis: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px dashed var(--brand-2); border-radius: 12px; background: var(--brand-soft); }
.attach-preview[hidden] { display: none; }
.ap-icon { font-size: 22px; }
.ap-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ap-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.rec-bar { flex: 1; display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 22px; padding: 4px 14px 4px 4px; min-height: 46px; }
.rec-bar[hidden], .compose-row[hidden] { display: none; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); animation: pulse 1s infinite; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 700; }
.rec-wave { flex: 1; height: 18px; background: repeating-linear-gradient(90deg, var(--brand-2) 0 3px, transparent 3px 7px); opacity: .45; border-radius: 4px; animation: wave 1.2s linear infinite; }
@keyframes pulse { 50% { opacity: .3; } }
@keyframes wave { to { background-position: 28px 0; } }
.drop-hint { position: absolute; inset: 60px 10px 10px; border: 3px dashed var(--brand); border-radius: 16px; background: rgba(237, 232, 255, .85); display: grid; place-items: center; font-weight: 800; color: var(--brand-ink); z-index: 5; pointer-events: none; }
.drop-hint[hidden] { display: none; }

/* Guia de uso */
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.guide-card { display: flex; flex-direction: column; gap: 4px; margin: 0; color: var(--text); }
.guide-card:hover { text-decoration: none; border-color: var(--brand); }
.guide-card[hidden] { display: none; }
.guide-ic { font-size: 26px; }
.guide-article { max-width: 860px; }
.guide-article li { margin-bottom: 4px; }
.guide-img { display: block; width: 100%; height: auto; margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; }

/* Fundo da conversa conforme o canal (desenho leve, como no WhatsApp) */
.msgs.bg-whatsapp_cloud, .msgs.bg-whatsapp_coex, .msgs.bg-whatsapp_web, .msgs.bg-dialog360, .msgs.bg-otima {
  background-color: #EFEAE2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23D9D0C3' stroke-width='1.4' stroke-linecap='round'%3E%3Cpath d='M14 18a8 8 0 1 1 3 6l-5 2 2-5z'/%3E%3Cpath d='M78 14l8 8M86 14l-8 8'/%3E%3Ccircle cx='100' cy='70' r='6'/%3E%3Cpath d='M20 80h14M27 73v14'/%3E%3Cpath d='M58 52c4-6 12-6 16 0'/%3E%3Cpath d='M60 100l6-8 6 8z'/%3E%3C/g%3E%3C/svg%3E");
}
.msgs.bg-whatsapp_cloud .bubble.out:not(.bot), .msgs.bg-whatsapp_coex .bubble.out:not(.bot), .msgs.bg-whatsapp_web .bubble.out:not(.bot), .msgs.bg-dialog360 .bubble.out:not(.bot), .msgs.bg-otima .bubble.out:not(.bot) { background: #D9FDD3; color: #111B21; }
.msgs.bg-whatsapp_cloud .bubble.in, .msgs.bg-whatsapp_coex .bubble.in, .msgs.bg-whatsapp_web .bubble.in, .msgs.bg-dialog360 .bubble.in, .msgs.bg-otima .bubble.in { background: #fff; color: #111B21; border-color: transparent; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); }
.msgs.bg-webchat { background-color: #F3F0FF; background-image: radial-gradient(circle at 1px 1px, #DCD3FF 1.2px, transparent 0); background-size: 20px 20px; }
.msgs.bg-telegram { background: linear-gradient(160deg, #D8EBC1 0%, #A9D3A6 35%, #8CC3C9 70%, #90B5E0 100%); }
.msgs.bg-telegram .bubble.out:not(.bot) { background: #EFFDDE; color: #111; }
.msgs.bg-telegram .bubble.in { background: #fff; color: #111; border-color: transparent; }
.msgs.bg-messenger { background: linear-gradient(180deg, #F1F5FF 0%, #F6EFFF 100%); }
.msgs.bg-messenger .bubble.out:not(.bot) { background: linear-gradient(135deg, #0099FF, #A033FF); color: #fff; }
.msgs.bg-instagram { background: linear-gradient(180deg, #FFF5F9 0%, #F8F1FF 100%); }
.msgs.bg-instagram .bubble.out:not(.bot) { background: linear-gradient(135deg, #8134AF, #DD2A7B); color: #fff; }
:root[data-theme="dark"] .msgs.bg-whatsapp_cloud, :root[data-theme="dark"] .msgs.bg-whatsapp_coex, :root[data-theme="dark"] .msgs.bg-whatsapp_web, :root[data-theme="dark"] .msgs.bg-dialog360, :root[data-theme="dark"] .msgs.bg-otima { background-color: #0B141A; filter: none; background-blend-mode: overlay; }
:root[data-theme="dark"] .msgs.bg-whatsapp_cloud .bubble.out:not(.bot), :root[data-theme="dark"] .msgs.bg-whatsapp_coex .bubble.out:not(.bot), :root[data-theme="dark"] .msgs.bg-whatsapp_web .bubble.out:not(.bot) { background: #005C4B; color: #E9EDEF; }
:root[data-theme="dark"] .msgs.bg-whatsapp_cloud .bubble.in, :root[data-theme="dark"] .msgs.bg-whatsapp_coex .bubble.in, :root[data-theme="dark"] .msgs.bg-whatsapp_web .bubble.in { background: #202C33; color: #E9EDEF; }
:root[data-theme="dark"] .msgs.bg-webchat { background-color: #13112A; background-image: radial-gradient(circle at 1px 1px, #2A2452 1.2px, transparent 0); }
:root[data-theme="dark"] .msgs.bg-telegram, :root[data-theme="dark"] .msgs.bg-messenger, :root[data-theme="dark"] .msgs.bg-instagram { background: var(--bg); }

/* Painel do cliente */
.inbox .info { background: var(--bg); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.pcard-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.pcard-h .icon-btn { width: 28px; height: 28px; display: inline-grid; }
.pcard.who { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; width: 100%; box-sizing: border-box; }
.avatar.big { width: 46px; height: 46px; font-size: 16px; position: relative; overflow: hidden; }
.avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.who-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.who-main b { font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
/* O canal fica em linha própria: ao lado da foto não cabe nome longo. */
.who-ch { flex: 1 0 100%; min-width: 0; display: flex; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.3; color: var(--muted); }
.who-ch-name { min-width: 0; overflow-wrap: anywhere; }
.who-ch .ch-ic.sm { width: 20px; height: 20px; border-radius: 6px; box-shadow: none; }
.who-ch .ch-ic.sm svg { width: 13px; height: 13px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; margin: 0; font-size: 13px; }
.kv dt, .inbox .info .kv dt { color: var(--muted); font-size: 12px; text-transform: none; letter-spacing: 0; margin: 0; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv.sm { font-size: 12.5px; margin: 6px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.b-code { overflow-wrap: anywhere; font-size: 12.5px; line-height: 1.45; }
.b-copy { display: block; width: 100%; margin-top: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--brand-ink); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.b-copy:hover { background: var(--brand-soft); }
.copy { cursor: copy; border-bottom: 1px dashed var(--line); }
.copy.copied::after { content: ' ✓ copiado'; color: var(--ok); font-size: 11px; }
.sec-t { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 12px 0 6px; }
.conn { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; }
.conn-h { display: flex; align-items: center; gap: 6px; }
.conn .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.conn.on .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.conn.on .conn-h b { color: var(--ok); } .conn.off .conn-h b { color: var(--bad); }
.fin-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 6px; }
.fin-sum > div { border-radius: 10px; padding: 8px 10px; background: var(--surface-2); display: flex; flex-direction: column; }
.fin-sum > div.ok { background: var(--ok-soft); color: var(--ok); grid-column: span 1; }
.fin-sum > div.bad { background: var(--bad-soft); color: var(--bad); }
.fin-sum > div:only-child { grid-column: 1 / -1; }
.inv-list { display: flex; flex-direction: column; gap: 4px; }
.inv { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); font-size: 13px; flex-wrap: wrap; }
.inv.late { border-color: var(--bad); background: var(--bad-soft); }
.erp-hit { display: flex; gap: 8px; justify-content: space-between; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
#erpResults { margin-top: 6px; }
.hist { margin-top: 10px; }
.hist > div { padding: 4px 0; border-top: 1px solid var(--line); }
/* Abas verticais do painel do cliente */
.inbox { grid-template-columns: 300px minmax(0, 1fr) 380px; }
.inbox .info { flex-direction: row; padding: 0; gap: 0; overflow: hidden; }
.prail { flex: none; width: 64px; display: flex; flex-direction: column; gap: 2px; padding: 8px 4px; background: var(--surface); border-right: 1px solid var(--line); }
.prail button { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 10.5px; font-weight: 600; padding: 8px 2px; border-radius: 10px; cursor: pointer; }
.prail button span { font-size: 18px; line-height: 1; }
.prail button:hover { background: var(--surface-2); color: var(--text); }
.prail button.on { background: var(--brand-soft); color: var(--brand-ink); }
.pbody { flex: 1; min-width: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; transition: opacity .2s; }
.pcard.ident { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 14px; }
.ident-ic { width: 48px; height: 48px; border-radius: 50%; background: var(--brand-soft); display: grid; place-items: center; font-size: 22px; }
.pcard.ident form { width: 100%; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack .field { margin: 0; }
label.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; margin: 0; }
label.chk input { width: 16px; height: 16px; margin: 0; flex: none; accent-color: var(--brand); }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.quick button { border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); padding: 8px; text-align: left; cursor: pointer; font: inherit; display: flex; flex-direction: column; color: var(--text); }
.quick button span { font-size: 11.5px; color: var(--muted); }
.quick button.ok b { color: var(--ok); } .quick button.bad b { color: var(--bad); }
.invc { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-top: 8px; }
.invc.late { border-color: var(--bad); }
.inv-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.inv-acts .btn { justify-content: center; }
.inv-acts .btn:last-child:nth-child(odd) { grid-column: 1 / -1; }
.seg { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; margin-bottom: 10px; }
.seg button { flex: 1; border: 0; background: none; font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tk { border-top: 1px solid var(--line); padding: 8px 0; }
.tk-d { margin-top: 4px; white-space: pre-wrap; max-height: 80px; overflow: hidden; }
.tk-close { margin-top: 6px; }
.tk-close summary { list-style: none; display: inline-flex; }
.tk-close summary::-webkit-details-marker { display: none; }
.tk-close form { margin-top: 6px; }
.deal { border-top: 1px solid var(--line); padding: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.deal:first-of-type { border-top: 0; }
@media (max-width: 1400px) { .inbox { grid-template-columns: 270px minmax(0, 1fr) 340px; } }

/* ---------- Regras do atendimento e etiquetas ---------- */
.rules { max-width: 920px; }
.rules-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; position: sticky; top: 0; z-index: 4; background: var(--bg); padding: 6px 0; }
.rules-nav a { padding: 6px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--text); }
.rules-nav a:hover { border-color: var(--brand); text-decoration: none; }
.rules .card { scroll-margin-top: 60px; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); font-weight: 400; cursor: pointer; }
.switch-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.switch { appearance: none; width: 42px !important; height: 24px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; flex: none; transition: background .15s; border: 0; padding: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch:checked { background: var(--brand); }
.switch:checked::after { left: 21px; }
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.choice-card { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 400; }
.choice-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice-card input { width: auto; margin-top: 3px; }
.choice-card small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.save-bar { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; box-shadow: 0 -4px 16px rgba(20, 17, 43, .08); }
.tagchip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); }
.tagchip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.colors { display: flex; gap: 6px; flex-wrap: wrap; }
.colors input { position: absolute; opacity: 0; }
.colors span { display: block; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; }
.colors input:checked + span { border-color: var(--text); }

/* Busca/filtros da caixa de entrada, etiquetas na conversa, janela de encerramento, alerta de fila */
.inbox .search { padding: 8px 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.inbox .search input[type=search] { border-radius: 99px; padding: 7px 14px; font-size: 13px; }
.inbox .search .fl { display: flex; gap: 4px; flex-wrap: wrap; }
.inbox .search select { width: auto; flex: 1; min-width: 90px; font-size: 12px; padding: 4px 6px; border-radius: 8px; }
.conv .l3 .tagchip { font-size: 10.5px; padding: 0 7px; }
.head-tags { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.head-tags select { width: auto; font-size: 12px; padding: 2px 6px; border-radius: 99px; }
.tag-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-pick label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; font-weight: 400; padding: 4px; border-radius: 99px; }
.tag-pick input { width: auto; }
.queue-alert { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 90; background: var(--bad); color: #fff; padding: 10px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); display: flex; gap: 12px; align-items: center; font-weight: 600; }
.queue-alert a { color: #fff; text-decoration: underline; }
.queue-alert button { background: transparent; border: 0; color: #fff; font-size: 18px; cursor: pointer; }

/* ---------- Ocorrências (drawer lateral) ---------- */
.occ-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.occ { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.occ-h { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.occ-h b { display: block; }
dialog.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(460px, 100vw); border: 0; border-left: 1px solid var(--line); padding: 0; background: var(--surface); color: var(--text); }
dialog.drawer::backdrop { background: rgba(20, 17, 43, .45); }
dialog.drawer form { display: flex; flex-direction: column; height: 100%; }
.drawer-h { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer-h h2 { margin: 0; }
.drawer-b { flex: 1; overflow-y: auto; padding: 16px 18px; }
.drawer-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
fieldset.opt { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 0 0 10px; background: var(--surface-2); }
fieldset.opt .field { margin: 8px 0 0; }
fieldset.opt .switch-row { border-top: 0; padding-bottom: 0; }

/* ---------- Gráficos, painel e relatórios ---------- */
.chart { position: relative; min-height: 120px; }
.ch-wrap { position: relative; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-ax { fill: var(--muted); font-size: 11px; }
.ch-total { fill: var(--text); font-size: 24px; font-weight: 700; }
.ch-hit { fill: transparent; cursor: crosshair; }
.ch-hit:hover { fill: var(--brand-soft); opacity: .35; }
.ch-tip { position: absolute; top: 4px; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12px; box-shadow: 0 8px 24px rgba(20, 16, 50, .15); pointer-events: none; white-space: nowrap; z-index: 2; }
.ch-tip[hidden] { display: none; }
.ch-tip div, .ch-legend span, .ch-list div { display: flex; align-items: center; gap: 6px; }
.ch-tip i, .ch-legend i, .ch-list i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.ch-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: 12px; color: var(--muted); margin-top: 6px; }
.ch-donut { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }
.ch-list { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.ch-list span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-list small { color: var(--muted); width: 38px; text-align: right; }
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.dash > .card { margin: 0; min-width: 0; }
.dash .s12 { grid-column: span 12; } .dash .s8 { grid-column: span 8; } .dash .s7 { grid-column: span 7; } .dash .s6 { grid-column: span 6; } .dash .s5 { grid-column: span 5; } .dash .s4 { grid-column: span 4; }
@media (max-width: 1100px) { .dash .s8, .dash .s7, .dash .s6, .dash .s5, .dash .s4 { grid-column: span 12; } }
.card-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.card-h h2 { margin: 0; font-size: 15px; }
.card-h .sub { color: var(--muted); font-size: 12px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .val { font-size: 26px; font-weight: 800; margin-top: 2px; line-height: 1.15; }
.kpi .val small { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi .ft { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.bad .val { color: var(--bad); } .kpi.ok .val { color: var(--ok); } .kpi.warn .val { color: var(--warn); }
.export-card { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 24px; align-items: center; }
@media (max-width: 760px) { .export-card { grid-template-columns: 1fr; } }
.export-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 26px 16px; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--brand); }
.export-drop:hover { border-color: var(--brand); background: var(--brand-soft); text-decoration: none; }
.export-drop b { color: var(--text); }
.steps-ol { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.input-suffix { display: flex; }
.input-suffix input { border-top-right-radius: 0; border-bottom-right-radius: 0; min-width: 0; }
.input-suffix span { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line); border-left: 0; border-radius: 0 10px 10px 0; background: var(--surface-2); color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.color-in { width: 64px; height: 38px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.sep { height: 1px; background: var(--line); margin: 16px 0; }
[data-pane][hidden] { display: none; }
.week { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: 8px; overflow-x: auto; }
.wday { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px; min-height: 160px; }
.wday.today { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.wday header { padding: 2px 4px 6px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.wper { margin-bottom: 8px; }
.visit { border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 8px; padding: 6px 8px; margin-top: 4px; font-size: 12.5px; background: var(--surface-2); }
.visit.concluida { border-left-color: var(--ok); opacity: .75; } .visit.cancelada { border-left-color: var(--bad); opacity: .55; }
.brand-logo { width: 30px; height: 30px; object-fit: contain; border-radius: 8px; background: #fff; }
.brand-login { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 24px; }
.brand-login img { max-height: 48px; max-width: 160px; object-fit: contain; }
.storage-bar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.storage-bar i { display: block; height: 100%; background: var(--brand); }
.qr-box { width: 230px; height: 230px; display: grid; place-items: center; border: 1px dashed var(--line); border-radius: 12px; background: #fff; color: #333; }
pre.code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; overflow-x: auto; white-space: pre; font-family: ui-monospace, Consolas, monospace; }
.outage-on { border-left: 4px solid var(--bad); }
.transcript { margin-top: 4px; font-size: 12px; color: var(--muted); font-style: italic; white-space: normal; }
/* Monitor ao vivo e notas internas */
.team-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tchip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; }
.tchip i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.tchip.on i { background: var(--ok); }
.tchip b { background: var(--surface-2); border-radius: 99px; padding: 0 6px; }
.mon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.mon { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.mon.warm { border-left-color: var(--warn); } .mon.hot { border-left-color: var(--bad); }
.mon header { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.mon-msgs { background: var(--surface-2); border-radius: 8px; padding: 8px; font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; }
.mm span { font-weight: 700; color: var(--muted); }
.mm.in span { color: var(--brand-ink); }
.mm.nota { background: #FFF6D6; border-radius: 6px; padding: 2px 6px; }
.mon footer { display: flex; gap: 6px; flex-wrap: wrap; }
.bubble.nota { align-self: center; max-width: 80%; background: #FFF6D6; color: #5C4600; border: 1px dashed #E0A100; }
.bubble.nota .meta { color: #8A6D00; }
.composer.note-mode .compose-row { background: #FFF6D6; border-color: #E0A100; }
:root[data-theme="dark"] .bubble.nota, :root[data-theme="dark"] .mm.nota { background: #3A2C10; color: #F5D98A; }
.addon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.addon { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
.addon.on { border-color: var(--brand-2); background: var(--brand-soft); }
.team { display: flex; flex-direction: column; }
.team-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.team-row:first-child { border-top: 0; }
.team-row small { display: block; color: var(--muted); font-size: 11.5px; }
.team-row .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex: none; }
.team-row .dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.sla-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; min-width: 80px; }
.sla-bar > i { display: block; height: 100%; border-radius: 99px; }
.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs-line a { padding: 9px 12px; font-size: 13.5px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs-line a.on { color: var(--brand-ink); border-color: var(--brand); }
.tabs-line a:hover { text-decoration: none; color: var(--text); }
.period { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.period .field { margin: 0; }
.period input[type=date] { width: auto; }
.period .quick a { padding: 7px 10px; border-radius: 99px; background: var(--surface-2); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.period .quick a.on { background: var(--brand); color: #fff; }
.period .quick { display: flex; gap: 4px; }

/* ---------- CRM (kanban) ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.kcol { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 300px; }
.kcol.over { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.kcol header { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; border-top: 4px solid var(--c); border-radius: var(--radius) var(--radius) 0 0; }
.kcards { padding: 8px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; cursor: grab; box-shadow: var(--shadow); font-size: 13px; }
.kcard:hover { border-color: var(--brand-2); }
.kcard.dragging { opacity: .5; }
.kmeta { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(900px 500px at 85% -10%, var(--brand-soft), transparent 60%), var(--bg); }
.auth .box { width: 100%; max-width: 400px; }
.auth .logo { display: flex; justify-content: center; margin-bottom: 22px; }
.auth .logo img { height: 46px; }

/* ---------- Tema ---------- */
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: inline; }

/* ---------- Celular ---------- */
.btn.only-narrow, .info-close { display: none; }
@media (max-width: 1100px) {
  .inbox { grid-template-columns: 280px 1fr; }
  .inbox .info { display: none; }
  /* Sem espaço para a coluna de dados do cliente: ela abre por cima da conversa, pelo botão. */
  .btn.only-narrow { display: inline-flex; }
  .inbox.show-info .info { display: flex; position: fixed; inset: 0; z-index: 60; background: var(--bg); padding-top: 58px; overflow-y: auto; }
  .inbox.show-info .info-close { display: inline-flex; position: fixed; top: 10px; right: 12px; z-index: 61; }
}
/* Barra lateral solta: só os ícones; abre por cima da tela ao passar o mouse ou navegar pelo teclado. No celular ela já é um menu. */
@media (min-width: 861px) {
  .shell { transition: grid-template-columns .15s ease; }
  .shell.side-loose { grid-template-columns: 64px 1fr; }
  .shell.side-loose .side { width: 64px; z-index: 40; overflow-x: hidden; scrollbar-width: none; transition: width .15s ease .12s; }
  .shell.side-loose .side:hover, .shell.side-loose .side:has(:focus-visible) { width: 236px; scrollbar-width: thin; box-shadow: 8px 0 24px rgba(10, 8, 30, .25); }
  .shell.side-loose .side-head, .shell.side-loose .side .who { width: 212px; flex: none; }
  .shell.side-loose .side .brand, .shell.side-loose .side .who, .shell.side-loose .side .sec, .shell.side-loose .side a.it, .shell.side-loose .side button.it { white-space: nowrap; }
  .shell.side-loose .side .who b, .shell.side-loose .side .who { overflow: hidden; text-overflow: ellipsis; }
  .shell.side-loose .side a.it { position: relative; }
  /* Janela baixa: a barra rola, sem espremer os itens. */
  .shell.side-loose .side > *, .shell.side-loose .side .bottom > * { flex: none; }
  .shell.side-loose .side:not(:hover):not(:has(:focus-visible)) .who,
  .shell.side-loose .side:not(:hover):not(:has(:focus-visible)) .sec,
  .shell.side-loose .side:not(:hover):not(:has(:focus-visible)) .side-pin { opacity: 0; pointer-events: none; }
  /* Só o ícone: o espaço maior empurra o texto para fora da área visível. */
  .shell.side-loose .side:not(:hover):not(:has(:focus-visible)) a.it,
  .shell.side-loose .side:not(:hover):not(:has(:focus-visible)) button.it { width: 40px; box-sizing: border-box; overflow: hidden; gap: 40px; }
  .shell.side-loose .side:not(:hover):not(:has(:focus-visible)) .brand { gap: 40px; }
  .shell.side-loose .side:not(:hover):not(:has(:focus-visible)) a.it .count { position: absolute; left: 24px; top: 1px; margin: 0; font-size: 10px; padding: 0 5px; }
}
.side-pin { display: grid; }
/* Conversa estreita (depende da tela, da barra e dos ícones ativos): o texto vem primeiro, os ícones vão ao lado ou abaixo, e Enviar vira só ícone. */
@container (max-width: 600px) {
  .compose-row { flex-wrap: wrap; border-radius: 18px; }
  .compose-row textarea { order: -1; flex: 1 1 170px; width: auto; min-width: 0; }
  .send-btn { width: 46px; padding: 0; justify-content: center; font-size: 0; gap: 0; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side-pin { display: none; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; height: 100dvh; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(10, 8, 30, .45); }
  .btn.menu-toggle { display: inline-flex; margin-bottom: 12px; }
  /* Letra menor que 16px faz o iPhone dar zoom ao tocar no campo. */
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=time], input[type=url], input[type=search], input:not([type]), select, textarea { font-size: 16px !important; }
  input[type=checkbox]:not(.switch), input[type=radio] { width: 20px; height: 20px; }
  /* Alvos de toque. */
  .btn { min-height: 42px; }
  .btn.sm { min-height: 38px; padding: 7px 12px; font-size: 13.5px; }
  .icon-btn { width: 40px; height: 40px; }
  .week { grid-template-columns: minmax(0, 1fr); overflow-x: visible; }
  .wday { min-height: 0; }
  .btn.only-mobile { display: inline-flex; }
  .main { padding: 16px; }
  .main:has(.inbox) { padding-bottom: 16px; }
  .g2, .g3, .g4, .grid[style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
  .dept-board { grid-template-columns: minmax(0, 1fr); }
  .people { position: static; order: -1; }
  #peopleList { max-height: 30vh; }
  .dept-drop .rm { opacity: 1; }
  /* No celular: ou a lista, ou a conversa aberta. */
  /* dvh: a altura real, sem contar as barras do navegador do celular, para o campo de resposta não ficar escondido. */
  .inbox { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 90px); height: calc(100dvh - 90px); }
  .inbox .list { border-right: 0; }
  .inbox.has-conv .list, .inbox:not(.has-conv) .chat { display: none; }
  .bubble { max-width: 88%; }
  /* Conversa aberta: o espaço vai para as mensagens. O menu volta na lista, pelo botão Voltar. */
  .main:has(.inbox.has-conv) { padding: 0; }
  .main:has(.inbox.has-conv) .menu-toggle { display: none; }
  .inbox.has-conv { height: 100vh; height: 100dvh; border: 0; border-radius: 0; }
  .chat .head { flex-direction: column; align-items: stretch; flex-wrap: nowrap; padding: 8px 12px; gap: 6px; }
  .chat .head .btn.only-mobile { margin: 0 8px 0 0 !important; }
  .chat .head .actions select, .head-tags select { width: auto; max-width: 190px; }
  .chat .msgs { padding: 10px; }
  /* Campo de resposta: o texto ocupa a linha inteira e os botões ficam embaixo dele. */
  .chat .composer { padding: 8px; gap: 6px; flex-wrap: nowrap; align-items: flex-end; }
  .chat .composer:has(.attach-preview:not([hidden])) { flex-wrap: wrap; }
  .compose-row { flex-wrap: wrap; border-radius: 18px; align-items: center; }
  .compose-row textarea { order: -1; flex: 1 1 100%; width: 100%; min-height: 40px; padding: 8px 10px 2px; line-height: 22px; }
  .chat .composer .round-btn { width: 44px; height: 44px; }
  .send-btn { width: 44px; height: 44px; padding: 0; justify-content: center; font-size: 0; gap: 0; }
}
