/* WhatsApp IpChronus — estilos
   As cores da marca ficam todas nas variáveis abaixo (--brand e --accent). */
:root {
  --brand: #12355B;        /* azul da barra lateral e do login */
  --brand-2: #0D2846;      /* azul mais escuro (fundo da marca) */
  --brand-ink: #D3E0EF;    /* texto sobre o azul */
  --accent: #1F5FA6;       /* botões e destaques */
  --accent-ink: #FFFFFF;

  --bg: #E8EDF3; --panel: #FFFFFF; --ink: #15212E; --muted: #627286; --line: #D6DEE7; --soft: #EFF3F8;
  --chat: #EDF1F6; --in: #FFFFFF; --out: #D7E6F8; --read: #2C8BE8;
  --ok: #1E9E6A; --warn: #C98A16; --danger: #C33A3A;
  color-scheme: light;
}
/* Tema escuro: automático (segue o sistema) ou escolhido no botão Tema */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #0D2440; --brand-2: #091A2F; --brand-ink: #9FB4CC;
    --accent: #5C9DE8; --accent-ink: #0B1520;
    --bg: #0E151C; --panel: #151F29; --ink: #E3EAF1; --muted: #8C9DB0; --line: #243240; --soft: #1B2734;
    --chat: #0F1820; --in: #1B2733; --out: #1D3A5B; --read: #6DB3FF;
    --ok: #3CC48C; --warn: #E3AC4C; --danger: #F07A7A;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --brand: #0D2440; --brand-2: #091A2F; --brand-ink: #9FB4CC;
    --accent: #5C9DE8; --accent-ink: #0B1520;
    --bg: #0E151C; --panel: #151F29; --ink: #E3EAF1; --muted: #8C9DB0; --line: #243240; --soft: #1B2734;
    --chat: #0F1820; --in: #1B2733; --out: #1D3A5B; --read: #6DB3FF;
    --ok: #3CC48C; --warn: #E3AC4C; --danger: #F07A7A;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 "Segoe UI", Ubuntu, Roboto, system-ui, sans-serif; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }
code, pre { font-family: Consolas, "Ubuntu Mono", monospace; }
.muted { color: var(--muted); }

/* ================= Login ================= */
.login-page { min-height: 100%; display: grid; grid-template-columns: minmax(320px, 1fr) minmax(360px, 520px); }
.login-brand { background: var(--brand-2); display: grid; place-items: center; padding: 48px; }
.login-brand img { width: min(340px, 70%); height: auto; }
.login-side { display: grid; place-items: center; padding: 32px 24px; background: var(--panel); }
.login-form { width: min(360px, 100%); }
.login-form h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -.01em; }
.login-form > p { color: var(--muted); margin: 0 0 24px; }
.login-form label { display: block; font-size: 14px; color: var(--muted); margin: 14px 0 6px; }
.login-form input { width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--soft); }
.login-form button { width: 100%; margin-top: 24px; padding: 12px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.login-form .err { color: var(--danger); font-size: 14px; margin: 14px 0 0; }
@media (max-width: 760px) {
  .login-page { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-brand { padding: 32px; }
  .login-brand img { width: 180px; }
}

/* ================= Estrutura ================= */
.app { height: 100vh; height: 100dvh; display: grid; grid-template-columns: 92px 1fr; background: var(--brand);
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.rail { display: flex; flex-direction: column; gap: 2px; padding: 14px 8px; overflow-y: auto; }
.rail-logo { display: block; width: 70px; margin: 0 auto 14px; }
.rail-btn { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px;
  border: 0; border-radius: 12px; background: transparent; color: var(--brand-ink); font-size: 11.5px; text-decoration: none; text-align: center; }
.rail-btn svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rail-btn:hover { color: #fff; background: rgba(255,255,255,.07); }
.rail-btn.active { color: #fff; background: rgba(255,255,255,.14); }
.rail-btn .dot-count { position: absolute; top: 3px; right: 10px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--ok); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.rail-spacer { flex: 1; min-height: 12px; }
@media (max-height: 880px) {
  .rail-btn { padding: 6px 2px; }
  .rail-logo { width: 58px; margin-bottom: 8px; }
  .rail-user { display: none; }
}
.rail-user { color: var(--brand-ink); font-size: 11px; text-align: center; padding: 6px 2px; opacity: .85;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.stage { min-width: 0; min-height: 0; background: var(--bg); display: flex; }
.view { flex: 1; min-width: 0; min-height: 0; }

/* ================= Páginas de gestão ================= */
.page { overflow-y: auto; }
.page-inner { max-width: 1120px; margin: 0 auto; padding: 30px clamp(16px, 4vw, 40px) 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 26px; margin: 0; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 70ch; }
.page-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page-tools select { padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 6px 11px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: default; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.grid th { text-align: left; font-weight: 600; color: var(--muted); font-size: 13px; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid td.actions { text-align: right; white-space: nowrap; }
table.grid td.actions .btn + .btn { margin-left: 6px; }
.empty { padding: 36px 20px; color: var(--muted); text-align: center; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.tag.on { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.tag.off { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.tag.brand { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* Painel */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 16px 18px; }
.kpi span { display: block; color: var(--muted); font-size: 13.5px; }
.kpi strong { display: block; font-size: 28px; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: 13px; }
.dash-cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; margin-bottom: 16px; }
.dash-cols .card { padding: 18px; }
.card h2 { font-size: 16px; margin: 0 0 14px; }
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end; height: 190px; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-stack { width: 100%; max-width: 46px; display: flex; flex-direction: column-reverse; border-radius: 6px 6px 0 0; overflow: hidden; min-height: 2px; background: var(--soft); }
.bar-stack i { display: block; }
.bar-stack .r { background: var(--accent); }
.bar-stack .e { background: color-mix(in srgb, var(--accent) 45%, var(--panel)); }
.bar-col small { font-size: 12px; color: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.rank li:last-child { border-bottom: 0; }
@media (max-width: 900px) { .dash-cols { grid-template-columns: 1fr; } }

/* Números */
.numero { margin-bottom: 12px; overflow: hidden; }
.numero-row { display: grid; grid-template-columns: 46px 1fr auto auto; gap: 14px; align-items: center; padding: 14px 16px; }
.numero-main { min-width: 0; }
.numero-main strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.numero-main span { color: var(--muted); font-size: 14px; }
.numero-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.conectado { color: var(--ok); } .pill.conectado::before { background: var(--ok); }
.pill.aguardando_qr, .pill.reconectando, .pill.conectando { color: var(--warn); }
.pill.aguardando_qr::before, .pill.reconectando::before, .pill.conectando::before { background: var(--warn); }
.pill.qr_expirado, .pill.falha_conexao, .pill.ausente { color: var(--danger); }
.pill.qr_expirado::before, .pill.falha_conexao::before, .pill.ausente::before { background: var(--danger); }
.toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform .15s; }
.numero.open .toggle svg { transform: rotate(180deg); }
.numero-detail { border-top: 1px solid var(--line); padding: 18px 16px 20px 76px; display: none; }
.numero.open .numero-detail { display: block; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0 0 18px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; }
.copyline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.copyline code { background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; font-size: 13px; overflow-wrap: anywhere; min-width: 0; }
.numero-detail h4 { margin: 18px 0 8px; font-size: 14px; }
.numero-detail pre { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0; overflow-x: auto; font-size: 13px; line-height: 1.55; }
.pre-wrap { position: relative; }
.pre-wrap .btn { position: absolute; top: 8px; right: 8px; }
.danger-zone { margin-top: 22px; padding-top: 16px; border-top: 1px dashed var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.danger-zone p { margin: 0; color: var(--muted); font-size: 14px; }
.limit-note { margin: -6px 0 16px; color: var(--muted); font-size: 14px; }

/* ================= Conversas ================= */
.chat-view { display: grid; grid-template-columns: 370px 1fr; }
.side { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-top { padding: 14px 14px 10px; border-bottom: 1px solid var(--line); }
.conn-row { display: flex; gap: 8px; align-items: center; }
.conn { flex: 1; min-width: 0; position: relative; }
.conn select { width: 100%; appearance: none; padding: 10px 34px 10px 30px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--soft); font-weight: 600; text-overflow: ellipsis; }
.conn::before { content: ""; position: absolute; left: 12px; top: 50%; width: 9px; height: 9px; margin-top: -4.5px; border-radius: 50%; background: var(--dot, var(--muted)); pointer-events: none; }
.conn::after { content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; margin-top: -6px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); pointer-events: none; }
.icon-btn { width: 40px; height: 40px; flex: none; border-radius: 10px; border: 1px solid var(--line); background: var(--panel);
  display: grid; place-items: center; color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: var(--soft); }
.search-row { display: flex; gap: 8px; margin-top: 10px; }
.search-row input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--soft); }

.chat-list { flex: 1; overflow-y: auto; }
.chat-item { display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; align-items: center; width: 100%;
  padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.chat-item:hover { background: var(--soft); }
.chat-item.active { background: var(--soft); box-shadow: inset 3px 0 0 var(--accent); }
.avatar { position: relative; overflow: hidden; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 16px; color: #fff; background: var(--av, #6B7C93); flex: none; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.conv-head .avatar img { cursor: zoom-in; }
.ci-main { min-width: 0; }
.ci-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-last { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 12px; color: var(--muted); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--ok); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.chat-item.unread .ci-side time { color: var(--ok); font-weight: 600; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--chat); }
.main-empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 24px; }
.main-empty h2 { color: var(--ink); font-size: 22px; margin: 0 0 6px; }
.conv { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.conv-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.conv-head .avatar { width: 40px; height: 40px; font-size: 15px; }
.conv-title { min-width: 0; }
.conv-title strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-title span { color: var(--muted); font-size: 13px; }
.back { display: none; }
.icon-btn.small-icon { width: 32px; height: 32px; border-color: transparent; color: var(--muted); }
.icon-btn.small-icon svg { width: 17px; height: 17px; }
.icon-btn.small-icon:hover { color: var(--ink); }
.ct-nome { display: flex; align-items: center; gap: 10px; }
.ct-nome .avatar { width: 34px; height: 34px; font-size: 13px; }
.import-result { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 14px; margin-top: 10px; }
.conv-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.lockbar { padding: 14px 16px; text-align: center; color: var(--muted); font-size: 14px; background: var(--soft); border-bottom: 1px solid var(--line); }
.at-tabs { display: flex; gap: 4px; margin-top: 10px; padding: 3px; border-radius: 10px; background: var(--soft); border: 1px solid var(--line); }
.at-tabs button { flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 7px 6px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.at-tabs button:hover { color: var(--ink); }
.at-tabs button.active { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.at-tabs .at-admin { flex: 0 0 auto; padding: 7px 8px; }
.at-tabs svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.at-tabs .count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--line); color: var(--ink); font-size: 11px; display: grid; place-items: center; }
.at-tabs .count.alert { background: var(--warn); color: #fff; }
.list-section { display: flex; align-items: center; gap: 8px; padding: 10px 14px 7px; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); background: var(--soft); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1; }
.list-section .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--line); color: var(--ink); display: grid; place-items: center; font-size: 11.5px; letter-spacing: 0; }
.list-section.fila .count { background: var(--warn); color: #fff; }
.list-empty { padding: 12px 14px 16px; color: var(--muted); font-size: 14px; border-bottom: 1px solid var(--line); }
.chat-item .wait { color: var(--warn); font-weight: 600; }
.chat-item .who-tag { color: var(--accent); }
dialog { overflow: auto; }
.offline { background: color-mix(in srgb, var(--warn) 18%, var(--panel)); padding: 8px 16px; font-size: 14px; border-bottom: 1px solid var(--line); }

.msgs { flex: 1; overflow-y: auto; padding: 18px clamp(12px, 4vw, 56px); display: flex; flex-direction: column; gap: 3px; }
.older { align-self: center; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.day { align-self: center; margin: 12px 0 8px; padding: 4px 12px; border-radius: 8px; background: var(--panel); color: var(--muted); font-size: 12.5px; border: 1px solid var(--line); }
.msg { max-width: min(68%, 560px); padding: 7px 10px 6px; border-radius: 10px; word-wrap: break-word; overflow-wrap: anywhere; box-shadow: 0 1px 0 rgba(0,0,0,.06); }
.msg.in { align-self: flex-start; background: var(--in); border-top-left-radius: 3px; }
.msg.out { align-self: flex-end; background: var(--out); border-top-right-radius: 3px; }
.msg .who { font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 2px; }
.msg .by { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.msg .txt { white-space: pre-wrap; }
.msg .txt a { color: var(--accent); }
.msg .meta { float: right; margin: 6px 0 -3px 12px; font-size: 11.5px; color: var(--muted); display: inline-flex; gap: 3px; align-items: center; }
.tick { font-size: 12px; letter-spacing: -3px; padding-right: 3px; }
.tick.read { color: var(--read); }
.tick.err { color: var(--danger); letter-spacing: 0; }
.m-img { display: block; max-width: 100%; max-height: 340px; border-radius: 8px; margin-bottom: 4px; cursor: zoom-in; background: var(--soft); min-height: 80px; min-width: 120px; object-fit: cover; }
.m-sticker { width: 140px; height: 140px; object-fit: contain; background: transparent; min-height: 0; }
.msg video { display: block; max-width: 100%; max-height: 340px; border-radius: 8px; margin-bottom: 4px; }
.msg audio { display: block; width: 270px; max-width: 100%; margin: 2px 0 4px; }
.doc { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); text-decoration: none; margin-bottom: 4px; }
.doc svg { width: 26px; height: 26px; flex: none; fill: none; stroke: var(--accent); stroke-width: 1.6; }

.composer-wrap { position: relative; background: var(--panel); border-top: 1px solid var(--line); }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 14px; }
.composer textarea { flex: 1; min-width: 0; resize: none; max-height: 140px; padding: 10px 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--soft); line-height: 1.4; }
.composer .icon-btn { border-radius: 50%; width: 44px; height: 44px; }
.send { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.send svg { width: 20px; height: 20px; fill: currentColor; }
.send.mic svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.send:disabled { opacity: .5; cursor: default; }
.file-chip { display: flex; align-items: center; gap: 8px; margin: 10px 14px 0; padding: 8px 12px; border-radius: 10px; background: var(--soft); border: 1px solid var(--line); font-size: 14px; }
.file-chip span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip button { border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; }
.recbar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.recbar .rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); }
@media (prefers-reduced-motion: no-preference) { .recbar .rec-dot { animation: blink 1s infinite; } @keyframes blink { 50% { opacity: .25; } } }
.recbar time { font-variant-numeric: tabular-nums; flex: 1; }
.recbar audio { flex: 1; min-width: 0; height: 40px; }
.recbar #recStop { color: var(--danger); border-radius: 50%; width: 44px; height: 44px; }
.recbar .rec-hint { color: var(--muted); font-size: 13px; white-space: nowrap; }
.quick { position: absolute; left: 14px; right: 14px; bottom: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  max-height: 260px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 5; }
.quick button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.quick button:last-child { border-bottom: 0; }
.quick button:hover, .quick button.sel { background: var(--soft); }
.quick b { color: var(--accent); margin-right: 8px; }
.quick span { color: var(--muted); font-size: 14px; }

/* ================= Diálogos ================= */
dialog { border: 1px solid var(--line); border-radius: 16px; padding: 24px; background: var(--panel); color: var(--ink); width: min(440px, 92vw); max-height: 90vh; }
dialog::backdrop { background: rgba(8, 14, 20, .5); }
dialog h3 { margin: 0 0 6px; font-size: 19px; }
dialog > p, dialog form > p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--soft); }
.field textarea { min-height: 110px; resize: vertical; }
.field small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.field.check label { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.field.check input { width: auto; }
.form-err { color: var(--danger); font-size: 14px; min-height: 1.2em; margin: 4px 0 0; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.qrframe { width: 288px; height: 288px; margin: 8px auto 16px; border-radius: 12px; background: #fff; display: grid; place-items: center; border: 1px solid var(--line); color: #555; text-align: center; padding: 12px; font-size: 14px; }
.qrframe img { width: 264px; height: 264px; image-rendering: pixelated; }
.qrframe .ok { font-size: 64px; color: #1E9E6A; }
#dlgQr { text-align: center; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--panel); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 50; max-width: 90vw; }

/* ================= Celular ================= */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .rail { grid-row: 2; flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 6px; gap: 2px; }
  .rail-logo, .rail-spacer, .rail-user { display: none; }
  .rail-btn { flex: 0 0 auto; min-width: 72px; padding: 6px 4px; }
  .stage { grid-row: 1; }
  .chat-view { grid-template-columns: 1fr; }
  .chat-view .main { display: none; }
  .chat-view.chat-open .side { display: none; }
  .chat-view.chat-open .main { display: flex; }
  .back { display: grid; }
  .msg { max-width: 85%; }
  .numero-row { grid-template-columns: 40px 1fr; }
  .numero-row .avatar { width: 40px; height: 40px; }
  .numero-row .pill, .numero-actions { grid-column: 2; justify-self: start; justify-content: flex-start; }
  .numero-detail { padding-left: 16px; }
}
