/* whatsmeow-vip — painel de operação.
   Visual de ERP: sóbrio, denso e previsível. Sem gradiente, sem animação
   decorativa; cor só onde ela informa (estado da sessão, ação primária). */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e1e5ea;
  --border-strong: #cdd4dd;
  --text: #1c2431;
  --text-muted: #667085;
  --primary: #1c5fd0;
  --primary-hover: #1750b0;
  --primary-soft: #eaf1fd;
  --danger: #b42318;
  --danger-soft: #fdeceb;
  --ok: #17794b;
  --ok-soft: #e7f5ee;
  --warn: #b54708;
  --warn-soft: #fdf3e7;
  --info: #1c5fd0;
  --info-soft: #eaf1fd;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --radius: 8px;
  --sidebar-w: 236px;
}

:root[data-theme="dark"] {
  --bg: #0f1319;
  --surface: #161c25;
  --surface-2: #1b222c;
  --border: #262f3b;
  --border-strong: #33404f;
  --text: #e5e9f0;
  --text-muted: #94a1b2;
  --primary: #5b9bf8;
  --primary-hover: #7bb0fa;
  --primary-soft: #16263f;
  --danger: #f87171;
  --danger-soft: #331b1b;
  --ok: #4ade80;
  --ok-soft: #14291f;
  --warn: #fbbf24;
  --warn-soft: #2e2413;
  --info: #5b9bf8;
  --info-soft: #16263f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 14px/1.5 Inter, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 20px; }
h3 { font-size: 15px; }
h4 { font-size: 13px; }
a { color: var(--primary); }
code, pre, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.err { color: var(--danger); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.wrap { flex-wrap: wrap; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box {
  width: 100%; max-width: 380px; background: var(--surface); padding: 28px;
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
}
.login-box h1 { font-size: 20px; margin-bottom: 4px; }
.login-box p { margin: 0 0 18px; }
.login-box input { width: 100%; margin-bottom: 14px; }
.login-box .btn { width: 100%; justify-content: center; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
  padding: 18px 20px 16px; font-weight: 600; font-size: 15px;
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px;
}
.brand span { color: var(--primary); }
.brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.brand .dot.live { background: var(--ok); }
.sidebar nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px;
  color: var(--text); text-decoration: none; font-size: 13.5px;
}
.sidebar nav a:hover { background: var(--surface-2); }
.sidebar nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 500; }
.sidebar nav a .ico { width: 16px; text-align: center; opacity: .8; }
.sidebar nav .group { padding: 14px 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }

.content { padding: 22px 26px 40px; min-width: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- cartões ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card + .card { margin-top: 16px; }
.card.pad { padding: 18px; }
.card-head { padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h3 { font-size: 14px; }
.card-body { padding: 16px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .v { font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.kpi .l { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.kpi .sub { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }
.kpi.alert { border-color: var(--danger); }
.kpi.alert .v { color: var(--danger); }

/* ---------- tabela ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-weight: 500; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-muted); padding: 10px 14px;
  border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
.table th.right { text-align: right; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table.compact td, .table.compact th { padding: 7px 12px; font-size: 12.5px; }
.table .row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
/* O menu de ações nasce dentro da tabela (que rola no eixo X) e do cartão (que
   recorta para arredondar os cantos). Sem liberar os dois, ele sai cortado.
   A classe entra só enquanto existe um menu aberto. */
.menu-aberto { overflow: visible !important; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: 6px; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--danger); border-color: var(--border-strong); }
.btn.danger:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.link { border: 0; background: none; color: var(--primary); padding: 4px; }
.btn.link:hover { background: none; text-decoration: underline; }
.btn.icon { padding: 6px 8px; }

/* Menu "⋯" das ações de linha: <details> nativo, sem biblioteca. */
.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-box {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 168px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 6px 18px rgba(16, 24, 40, .16); padding: 6px; display: flex; flex-direction: column; gap: 4px;
}
.menu-box .btn { border: 0; justify-content: flex-start; width: 100%; }
.menu-box .btn:hover { background: var(--surface-2); }

/* ---------- formulário ---------- */
label { display: block; font-size: 12.5px; font-weight: 500; margin: 14px 0 5px; }
label.inline-check { display: flex; align-items: center; gap: 7px; font-weight: 400; margin: 0; cursor: pointer; }
/* `input:not([type])` é obrigatório: um <input> sem type é campo de texto para
   o HTML, mas NÃO casa com input[type="text"] no CSS — e quase todo campo do
   painel é escrito sem type. Sem esta linha, metade dos formulários aparece
   com o visual cru do navegador. */
input:not([type]),
input[type="text"], input[type="password"], input[type="search"], input[type="number"],
input[type="tel"], input[type="email"], input[type="url"], input[type="date"],
select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px;
}
input:not([type]):focus,
input[type="text"]:focus, input[type="password"]:focus, input[type="search"]:focus,
input[type="number"]:focus, input[type="tel"]:focus, input[type="email"]:focus,
input[type="url"]:focus, input[type="date"]:focus,
select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: .8; }
input[readonly] { background: var(--surface-2); color: var(--text-muted); }
textarea { resize: vertical; min-height: 76px; }

/* O seletor de arquivo nativo destoa do resto; o botão interno vira um .btn. */
input[type="file"] {
  width: 100%; font: inherit; font-size: 13px; color: var(--text-muted);
  padding: 7px 0;
}
input[type="file"]::file-selector-button {
  margin-right: 10px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--surface); color: var(--text);
}
input[type="file"]::file-selector-button:hover { background: var(--surface-2); }
.field-help { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input, .inline select { flex: 1; }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 7px; }
.checks label { display: flex; align-items: center; gap: 7px; margin: 0; font-weight: 400; font-size: 12.5px; }
.checks input { width: auto; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type="search"] { max-width: 280px; }
.toolbar select { width: auto; min-width: 150px; }

/* ---------- paginação ---------- */
.pager {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap;
}
.pager label { display: flex; align-items: center; }

/* ---------- selos ---------- */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px;
  font-weight: 500; background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border);
}
.badge.WORKING { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.FAILED { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.SCAN_QR_CODE { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.STARTING { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.STOPPED { background: var(--surface-2); color: var(--text-muted); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); font-size: 11.5px; color: var(--text-muted); }

/* ---------- gráfico ---------- */
.chart { display: block; width: 100%; height: 170px; }
.chart .bar-in { fill: var(--primary); }
.chart .bar-out { fill: var(--ok); }
.chart .axis { stroke: var(--border); stroke-width: 1; }
.chart .lbl { fill: var(--text-muted); font-size: 10px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-muted); }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 5px; }

/* ---------- conversas ---------- */
.chat-layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.chat-list { max-height: calc(100vh - 220px); overflow-y: auto; }
.chat-item { padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.chat-item:hover { background: var(--surface-2); }
.chat-item.active { background: var(--primary-soft); }
.chat-item .t { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.chat-item .nm { font-weight: 500; font-size: 13.5px; }
.chat-item .pv { font-size: 12px; color: var(--text-muted); }
.thread { display: flex; flex-direction: column; height: calc(100vh - 220px); }
.thread-head { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.thread-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.msg { max-width: 68%; padding: 8px 11px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); font-size: 13.5px; }
.msg.out { align-self: flex-end; background: var(--primary-soft); border-color: transparent; }
.msg .meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; display: flex; gap: 8px; justify-content: flex-end; }
.msg .who { font-size: 11.5px; font-weight: 500; color: var(--primary); margin-bottom: 2px; }
.msg img, .msg video { max-width: 100%; border-radius: 6px; display: block; margin-bottom: 6px; }
.msg .file { display: flex; align-items: center; gap: 8px; }
.composer { border-top: 1px solid var(--border); padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.composer textarea { min-height: 54px; }
.reply-to { background: var(--surface-2); border-left: 3px solid var(--primary); padding: 6px 10px; font-size: 12px; border-radius: 4px; display: flex; justify-content: space-between; gap: 8px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(16, 24, 40, .48); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal-box {
  background: var(--surface); border-radius: 10px; width: 100%; max-width: 540px;
  max-height: 88vh; overflow-y: auto; box-shadow: 0 12px 32px rgba(16, 24, 40, .22);
}
.modal-box.wide { max-width: 860px; }
.modal-box > header { padding: 15px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--surface); }
.modal-box > div { padding: 20px; }
.qr-wrap { display: grid; place-items: center; gap: 8px; padding: 12px; background: var(--surface-2); border-radius: 8px; }
.qr-wrap img { width: 260px; height: 260px; background: #fff; border-radius: 6px; }
.pair-code { font-size: 26px; letter-spacing: .22em; text-align: center; padding: 14px; background: var(--surface-2); border-radius: 8px; font-family: ui-monospace, monospace; }

/* ---------- abas ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button {
  border: 0; background: none; padding: 9px 14px; font: inherit; font-size: 13px; color: var(--text-muted);
  cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

/* ---------- avisos ---------- */
.notice { padding: 11px 14px; border-radius: 6px; font-size: 13px; border: 1px solid var(--border); background: var(--surface-2); }
.notice.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.notice.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.notice.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.empty { padding: 34px 20px; text-align: center; color: var(--text-muted); font-size: 13px; }

#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: 6px; padding: 10px 14px; box-shadow: var(--shadow); font-size: 13px; max-width: 360px; }
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }

pre {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px;
  padding: 12px 14px; overflow-x: auto; font-size: 12.5px; margin: 8px 0 0;
}
.list { margin: 8px 0 0; padding-left: 18px; }
.list li { margin-bottom: 6px; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; font-size: 13px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; }

/* ---------- responsivo ----------
   Três degraus: até 1100 px as grades viram uma coluna; até 860 px o menu vira
   gaveta e lista/conversa passam a ocupar a tela inteira, uma de cada vez; até
   640 px as tabelas viram cartões (o rótulo de cada célula vem do <th>, posto
   por WM.rotularTabelas) e modal, avisos e formulários usam a largura toda. */
.topbar, .scrim, .so-celular { display: none; }
.thread-title { min-width: 0; flex: 1; }
.thread-title strong { display: block; }

@media (max-width: 1100px) {
  .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  /* rows explícitas: sem isso a sobra do min-height vai para a linha da barra
     do topo e abre um buraco em branco embaixo dela nas telas curtas */
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30;
    height: 52px; padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .brand-mini { font-weight: 600; font-size: 15px; white-space: nowrap; }
  .brand-mini span { color: var(--primary); }
  #topTitle { margin-left: auto; max-width: 45%; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: auto; width: min(280px, 84vw); z-index: 60;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: none;
  }
  body.menu-on .sidebar { transform: none; box-shadow: 0 0 24px rgba(16, 24, 40, .25); }
  .scrim { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 55; }
  body.menu-on .scrim { display: block; }
  body.menu-on { overflow: hidden; }
  .sidebar nav a { padding: 11px 10px; font-size: 14.5px; }
  .content { padding: 16px 16px 32px; }

  /* conversas: uma coisa de cada vez */
  .chat-layout { grid-template-columns: 1fr; gap: 0; }
  .chat-layout .thread { display: none; }
  .chat-layout.com-chat > .card:first-child { display: none; }
  .chat-layout.com-chat .thread { display: flex; }
  .chat-list { max-height: none; }
  .thread { height: calc(100dvh - 52px - 32px); min-height: 380px; }
  .so-celular { display: inline-flex; }
  .thread-head { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
  .thread-acts { width: 100%; }
  .thread-acts .btn { flex: 1; justify-content: center; }
  .thread-body { padding: 12px; }
  .msg { max-width: 88%; }
  .composer { padding: 10px 12px; }
}

@media (max-width: 640px) {
  h2 { font-size: 18px; }
  .page-head { margin-bottom: 14px; }
  .page-head > div:first-child { width: 100%; }
  .actions { width: 100%; }
  .actions > select, .actions > input { flex: 1 1 100%; }
  .actions > .btn { flex: 1 1 auto; justify-content: center; }
  .toolbar > * { flex: 1 1 100%; }
  .toolbar input[type="search"], .toolbar select { max-width: none; width: 100%; }
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi .v { font-size: 20px; }
  .card-head { flex-wrap: wrap; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; overflow-wrap: anywhere; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1 1 auto; justify-content: center; }
  .inline { flex-wrap: wrap; }
  .inline > .btn { flex: 1 1 auto; justify-content: center; }
  .checks { grid-template-columns: 1fr; }
  .pager { justify-content: center; }
  .pager .spacer { display: none; }
  .pager > span:first-child { width: 100%; text-align: center; }
  .composer .row .btn { flex: 1 1 auto; justify-content: center; }
  .composer .row .spacer { display: none; }
  .legend { flex-wrap: wrap; }
  pre { font-size: 11.5px; }
  code { overflow-wrap: anywhere; }

  /* 16 px evita o zoom automático do iPhone ao tocar num campo */
  input:not([type]), input[type="text"], input[type="password"], input[type="search"],
  input[type="number"], input[type="tel"], input[type="email"], input[type="url"],
  input[type="date"], select, textarea { font-size: 16px; }

  /* tabelas em cartões */
  .table-wrap { overflow-x: visible; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tbody tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table tbody tr:hover { background: none; }
  .table td, .table.compact td {
    display: flex; gap: 12px; justify-content: space-between; align-items: baseline;
    padding: 4px 0; border: 0; text-align: right; font-size: 13.5px;
    max-width: none !important; white-space: normal; overflow-wrap: anywhere;
  }
  .table td::before {
    content: attr(data-label); flex: 0 0 auto; max-width: 42%; text-align: left;
    font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted);
  }
  .table td:not([data-label])::before, .table td[data-label=""]::before { content: none; }
  .table td[data-label=""] { justify-content: flex-end; }
  .table td:first-child { font-size: 14.5px; }
  .table td[colspan] { display: block; text-align: center; }
  .table td.truncate { text-overflow: clip; }
  .table .row-actions { justify-content: flex-end; width: 100%; padding-top: 6px; }
  .table td:has(.row-actions)::before { content: none; }

  .modal { padding: 0; place-items: end stretch; }
  .modal-box, .modal-box.wide { max-width: none; max-height: 92dvh; border-radius: 12px 12px 0 0; }
  .modal-box > header { padding: 13px 16px; }
  .modal-box > div { padding: 16px; }
  .qr-wrap img { width: min(260px, 70vw); height: auto; aspect-ratio: 1; }
  .pair-code { font-size: 22px; letter-spacing: .14em; }

  #toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
}
