/* Painel do WhatsApp dos agentes. Sem framework; tema segue o sistema (claro/escuro). */

@font-face {
  font-family: "Schibsted Grotesk";
  src: url("/fonts/schibsted-grotesk.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ground: #eef0f3;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --ink: #151b28;
  --ink-2: #555e70;
  --ink-3: #6b7385;
  --line: #dde1e8;
  --line-2: #c6ccd7;
  --shell: #17213a;
  --shell-2: #22304f;
  --shell-ink: #eef1f8;
  --shell-ink-2: #aab4ca;
  --primary: #2a49c4;
  --primary-hover: #213ba3;
  --primary-ink: #ffffff;
  --primary-soft: #e8edfc;
  --focus: #2a49c4;
  --ok: #157a46;
  --ok-lamp: #22b263;
  --ok-soft: #e3f4ea;
  --warn: #8a5a00;
  --warn-lamp: #e5a417;
  --warn-soft: #fbf0d6;
  --bad: #b8322b;
  --bad-lamp: #e5484d;
  --bad-soft: #fbe7e6;
  --off-lamp: #a3aab8;
  --shadow: 0 1px 2px rgb(21 27 40 / .05), 0 4px 14px -6px rgb(21 27 40 / .12);
  --shadow-lg: 0 24px 60px -20px rgb(10 15 30 / .45);
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ground: #0e121a;
    --surface: #161b26;
    --surface-2: #1b2130;
    --ink: #e7eaf1;
    --ink-2: #a3abbb;
    --ink-3: #8b94a6;
    --line: #262e3d;
    --line-2: #364052;
    --shell: #121a2e;
    --shell-2: #1d2843;
    --shell-ink: #e7ebf5;
    --shell-ink-2: #98a3bc;
    --primary: #7f98ff;
    --primary-hover: #9aadff;
    --primary-ink: #0b1124;
    --primary-soft: #1f2947;
    --focus: #9aadff;
    --ok: #55cf8c;
    --ok-lamp: #3dd68c;
    --ok-soft: #14301f;
    --warn: #f0bc4c;
    --warn-lamp: #f0b429;
    --warn-soft: #33270c;
    --bad: #ff8078;
    --bad-lamp: #ff5f5a;
    --bad-soft: #3a1918;
    --off-lamp: #5d6678;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 18px -8px rgb(0 0 0 / .5);
    --shadow-lg: 0 30px 70px -20px rgb(0 0 0 / .7);
  }
}

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

html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
button, label, input { touch-action: manipulation; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--ink);
  font: 400 15px/1.5 "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--primary);
  scrollbar-color: var(--line-2) transparent;
}
::selection { background: var(--primary); color: var(--primary-ink); }

h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 650; letter-spacing: -.012em; text-wrap: balance; }
h1 { font-size: 1.75rem; letter-spacing: -.02em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.0625rem; }
h4 { font-size: .9375rem; }
p { margin: 0; text-wrap: pretty; }
code, .mono { font-family: var(--mono); font-size: .86em; }
strong { font-weight: 650; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.i-lg { width: 26px; height: 26px; stroke-width: 1.5; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }

.hint { color: var(--ink-2); font-size: .875rem; }
.note { color: var(--ink-2); font-size: .8125rem; }
.error { color: var(--bad); font-size: .875rem; font-weight: 500; }
.error:empty { display: none; }

/* ---------------------------------------------------------------- botões */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 7px 14px;
  font: inherit; font-size: .875rem; font-weight: 600; line-height: 1.2; white-space: nowrap;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  cursor: pointer; transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn:disabled { opacity: .55; cursor: default; }
.btn .i { width: 16px; height: 16px; }
.btn-primary { color: var(--primary-ink); background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.btn-block { width: 100%; min-height: 42px; font-size: .9375rem; }
.btn-shell { color: var(--shell-ink); background: transparent; border-color: rgb(255 255 255 / .18); }
.btn-shell:hover { background: var(--shell-2); border-color: rgb(255 255 255 / .3); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-btn {
  display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  color: var(--ink-2); background: transparent; border: 0; border-radius: var(--r-sm); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* ---------------------------------------------------------------- campos */

.field { display: grid; gap: 5px; align-content: start; }
.field > span { font-size: .8125rem; font-weight: 600; color: var(--ink); }
.field > span em { font-style: normal; font-weight: 400; color: var(--ink-3); }
.field small { color: var(--ink-2); font-size: .8125rem; }
input:not([type="checkbox"], [type="radio"]), textarea {
  width: 100%; min-height: 38px; padding: 8px 11px;
  font: inherit; font-size: .9375rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 64px; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
input:not([type="checkbox"], [type="radio"]):hover, textarea:hover { border-color: var(--ink-3); }
input:not([type="checkbox"], [type="radio"]):focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}
input[readonly] { background: var(--surface-2); }
input.mono { font-family: var(--mono); font-size: .8125rem; }
input[type="number"] { font-variant-numeric: tabular-nums; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; font-size: .8125rem; font-weight: 600; }

/* interruptores (checkbox com role="switch") */
.switches { display: grid; gap: 2px; }
.switch {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 14px;
  padding: 9px 10px; margin: 0 -10px; border-radius: var(--r-sm); cursor: pointer;
}
.switch:hover { background: var(--surface-2); }
.switch-text { display: grid; gap: 1px; min-width: 0; }
.switch-text b { font-weight: 550; font-size: .9375rem; }
.switch-text small { color: var(--ink-2); font-size: .8125rem; }
.switch input {
  appearance: none; margin: 0; flex: none; cursor: pointer;
  position: relative; width: 38px; height: 22px; border-radius: 999px;
  background: var(--line-2); transition: background-color .18s;
}
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: transform .18s cubic-bezier(.2, .8, .2, 1);
}
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(16px); }
@media (prefers-color-scheme: dark) {
  .switch input::after { background: #e7eaf1; }
  .switch input:checked::after { background: var(--primary-ink); }
}

/* ---------------------------------------------------------------- login */

.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(1000px 500px at 85% -10%, var(--shell-2), transparent 70%),
    var(--shell);
}
.login-card { width: min(400px, 100%); display: grid; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.01em; }
.brand img { border-radius: 7px; flex: none; }
.brand-login { color: var(--shell-ink); font-size: 1rem; }
.login-form {
  display: grid; gap: 16px; padding: 28px 24px 24px;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
}
.login-form .lede { color: var(--ink-2); margin-top: -8px; }

/* ---------------------------------------------------------------- moldura */

.shell { background: var(--shell); color: var(--shell-ink); border-bottom: 1px solid rgb(255 255 255 / .06); }
.shell-in {
  max-width: 1240px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 16px; min-height: 60px;
}
.shell .brand { font-size: 1rem; margin-right: auto; min-width: 0; }
.shell .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-summary { display: flex; gap: 14px; color: var(--shell-ink-2); font-size: .875rem; font-variant-numeric: tabular-nums; }
.shell-summary b { color: var(--shell-ink); font-weight: 600; }
.shell-summary .sum-item { display: inline-flex; align-items: center; gap: 7px; }
.shell-summary .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--off-lamp); }
.shell-summary .dot.ok { background: var(--ok-lamp); box-shadow: 0 0 0 3px rgb(61 214 140 / .18); }
.shell-summary .dot.bad { background: var(--bad-lamp); }
.shell-summary .dot.paused { background: transparent; border: 1.5px solid var(--shell-ink-2); }

.layout {
  max-width: 1240px; margin: 0 auto; padding: 28px 24px 64px;
  display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr) 340px; align-items: start;
}
.work { display: grid; gap: 36px; min-width: 0; }
.side { position: sticky; top: 24px; min-width: 0; }
.block { display: grid; gap: 14px; min-width: 0; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
}

/* ---------------------------------------------------------------- novo número */

.new-form { display: grid; gap: 20px; padding: 20px; }
.panel-head { display: grid; gap: 4px; }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.new-form .switches { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); column-gap: 28px; }

/* ---------------------------------------------------------------- números */

.numbers { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.number {
  container-type: inline-size;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
}
.number.is-open { border-color: var(--line-2); }

.number-row {
  display: grid; align-items: center; gap: 6px 14px; padding: 16px 18px;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "lamp id"
    ".    facts"
    ".    actions";
}
@container (min-width: 640px) {
  .number-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "lamp id actions"
      ".    facts actions";
  }
}
.lamp { grid-area: lamp; align-self: start; margin-top: 6px; }
.number-id { grid-area: id; min-width: 0; }
.title-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.status { display: flex; gap: 6px; flex-wrap: wrap; }
.facts { grid-area: facts; }
.row-actions { grid-area: actions; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start; }
@container (min-width: 640px) {
  .row-actions { justify-content: flex-end; align-self: center; }
}

.number-id h3 { overflow-wrap: anywhere; }
.number-sub { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin-top: 3px; color: var(--ink-2); font-size: .875rem; }
.handle {
  padding: 1px 7px; border-radius: 5px; font-size: .78rem;
  color: var(--ink); background: var(--surface-2); border: 1px solid var(--line);
}

/* A lâmpada: o estado de cada linha, como num painel de comutação. */
.lamp {
  position: relative; width: 12px; height: 12px; border-radius: 50%;
  background: var(--off-lamp);
  box-shadow: inset 0 -1px 1px rgb(0 0 0 / .18), inset 0 1px 1px rgb(255 255 255 / .4);
}
.number[data-state="open"] .lamp {
  background: var(--ok-lamp);
  box-shadow: inset 0 -1px 1px rgb(0 0 0 / .15), inset 0 1px 1px rgb(255 255 255 / .5), 0 0 0 4px color-mix(in srgb, var(--ok-lamp) 20%, transparent), 0 0 12px color-mix(in srgb, var(--ok-lamp) 55%, transparent);
}
.number[data-state="connecting"] .lamp { background: var(--warn-lamp); animation: lamp-blink 1.6s ease-in-out infinite; }
.number[data-state="close"] .lamp, .number[data-state="missing"] .lamp, .number[data-state="error"] .lamp { background: var(--bad-lamp); }
.number.is-paused .lamp { background: transparent; box-shadow: inset 0 0 0 2px var(--off-lamp); }
@keyframes lamp-blink { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
  .number[data-state="connecting"] .lamp { animation: none; }
  .spinner { animation-duration: 3s !important; }
  * { transition-duration: 0s !important; }
}

.state, .paused-tag {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  font-size: .75rem; font-weight: 600; line-height: 1.5; white-space: nowrap;
  color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line);
}
.number[data-state="open"] .state { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.number[data-state="connecting"] .state { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.number[data-state="close"] .state, .number[data-state="missing"] .state, .number[data-state="error"] .state { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.paused-tag { color: var(--ink); background: transparent; border-color: var(--line-2); }

.facts { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 6px 0 0; font-size: .8125rem; }
.facts div { display: flex; gap: 6px; align-items: baseline; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; font-weight: 600; }
.facts dd.zero { color: var(--bad); }

.chev { transition: transform .2s cubic-bezier(.2, .8, .2, 1); }
[data-toggle][aria-expanded="true"] .chev { transform: rotate(180deg); }
[data-toggle][aria-expanded="true"] { color: var(--ink); background: var(--surface-2); border-color: var(--line); }

.row-error { padding: 0 18px 14px 44px; }

.number-body {
  border-top: 1px solid var(--line);
  background: linear-gradient(var(--surface-2), var(--surface) 120px);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  display: grid; gap: 0;
}
.edit { display: grid; gap: 18px; padding: 20px 18px 22px 44px; grid-template-columns: minmax(0, 1fr); }
@container (min-width: 720px) {
  .edit { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); column-gap: 36px; }
  .edit .form-foot, .edit > .error { grid-column: 1 / -1; }
}
.edit-fields { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr) 140px; align-content: start; }
.edit-fields .field-wide { grid-column: 1 / -1; }
.saved { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-size: .875rem; font-weight: 600; }

/* grupos */
.groups { display: grid; gap: 12px; padding: 20px 18px 22px 44px; border-top: 1px solid var(--line); }
.groups-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
}
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: block; padding: 5px 12px; border-radius: 6px;
  font-size: .8125rem; font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.segmented label:hover span { color: var(--ink); }
.segmented input:checked + span { color: var(--ink); background: var(--surface); box-shadow: 0 1px 2px rgb(0 0 0 / .12), 0 0 0 1px var(--line); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }

.picker { display: grid; gap: 10px; }
.chips, .results { list-style: none; margin: 0; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chips li {
  display: inline-flex; align-items: center; gap: 2px; max-width: 100%;
  padding: 3px 3px 3px 11px; border-radius: 999px;
  font-size: .8125rem; font-weight: 550;
  color: var(--ink); background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
}
.chips li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chip-remove {
  display: grid; place-items: center; width: 22px; height: 22px; padding: 0; flex: none;
  color: var(--ink-2); background: transparent; border: 0; border-radius: 50%; cursor: pointer;
}
.chip-remove .i { width: 14px; height: 14px; stroke-width: 2; }
.chip-remove:hover { color: var(--bad); background: var(--surface); }

.search { position: relative; display: block; }
.search .i { position: absolute; left: 11px; top: 50%; translate: 0 -50%; color: var(--ink-3); pointer-events: none; }
.search input { padding-left: 36px !important; }
.results {
  max-height: 320px; overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
}
.results:empty { display: none; }
.results li { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 12px; }
.results li + li { border-top: 1px solid var(--line); }
.results li.on { background: color-mix(in srgb, var(--primary-soft) 60%, transparent); }
.result-name { flex: 1; min-width: 0; display: grid; }
.result-name b { font-weight: 550; overflow-wrap: anywhere; }
.result-name small { color: var(--ink-2); font-size: .8125rem; }
.results .btn { min-height: 30px; padding: 4px 10px; font-size: .8125rem; }

.number-foot {
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px;
  padding: 12px 18px; border-top: 1px solid var(--line);
}

.empty {
  display: grid; gap: 4px; justify-items: center; text-align: center; padding: 40px 20px;
  color: var(--ink-2); border: 1.5px dashed var(--line-2); border-radius: var(--r-lg);
}
.empty strong { color: var(--ink); }

/* ---------------------------------------------------------------- OpenBot */

.openbot { display: grid; gap: 16px; padding: 20px; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 10px; font-size: .875rem; color: var(--ink-2); }
.steps li { counter-increment: s; display: grid; grid-template-columns: 22px 1fr; gap: 10px; }
.steps li::before {
  content: counter(s); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  font-size: .75rem; font-weight: 700; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line);
}
.steps code { white-space: nowrap; color: var(--ink); background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* ---------------------------------------------------------------- atividade */

.table-panel { overflow: hidden; }
.activity { width: 100%; border-collapse: collapse; font-size: .875rem; }
.activity th {
  text-align: left; font-size: .75rem; font-weight: 600; color: var(--ink-2);
  padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.activity td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.activity td[data-col="slug"], .activity td[data-col="tool"], .activity td.phone { white-space: nowrap; }
.activity td[data-col="target"], .activity td[data-col="result"] { overflow-wrap: anywhere; }
.activity tbody tr:last-child td { border-bottom: 0; }
.activity tbody tr:hover td { background: var(--surface-2); }
.activity .when { white-space: nowrap; color: var(--ink-2); }
.activity .tool { font-family: var(--mono); font-size: .8125rem; }
.activity .res { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--ok); }
.activity .res .i { width: 15px; height: 15px; stroke-width: 2.2; }
.activity td.fail { color: var(--bad); }
.activity td.nothing { color: var(--ink-2); text-align: center; padding: 28px 14px; }

/* ---------------------------------------------------------------- conectar */

dialog {
  width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); overscroll-behavior: contain;
}
dialog::backdrop { background: rgb(10 14 24 / .55); backdrop-filter: blur(2px); }
dialog[open] { animation: rise .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.dialog-body { display: grid; gap: 16px; padding: 20px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: -2px -6px -4px 0; }
.dialog-head h2 { padding-top: 4px; }
.dialog-foot { display: flex; justify-content: flex-end; }
.connect-choose { display: grid; gap: 10px; }
.connect-choose > p { color: var(--ink-2); font-size: .9375rem; margin-bottom: 4px; }
.connect-choose > p strong { color: var(--ink); font-weight: 600; }
.choice {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: start; text-align: left;
  width: 100%; padding: 14px 16px; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r);
}
button.choice { cursor: pointer; }
button.choice:hover { border-color: var(--primary); background: var(--primary-soft); }
.choice > .i { color: var(--primary); margin-top: 1px; }
.choice strong { display: block; font-weight: 650; }
.choice small { display: block; color: var(--ink-2); font-size: .8125rem; }
.choice span { display: grid; gap: 1px; }
.inline-field { display: flex; gap: 8px; margin-top: 10px; }
.inline-field input { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }

.connect-show { display: grid; gap: 12px; justify-items: center; text-align: center; }
.qr-frame { padding: 12px; background: #fff; border-radius: var(--r); border: 1px solid var(--line); }
.qr-frame img { display: block; width: min(264px, 64vw); aspect-ratio: 1; }
.qr-note { color: var(--ink-2); font-size: .8125rem; max-width: 34ch; }
.pairing-box { display: grid; gap: 10px; justify-items: center; }
.pairing {
  font: 650 2rem/1.1 var(--mono); letter-spacing: .14em; padding: 14px 18px;
  border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.waiting { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: .875rem; }
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--line-2); border-top-color: var(--primary); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.connect-done { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 8px 0; }
.done-mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; color: var(--ok); background: var(--ok-soft); }
.done-mark .i { width: 28px; height: 28px; stroke-width: 2.2; }

/* ---------------------------------------------------------------- telas estreitas */

@media (max-width: 1040px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; }
}
@media (max-width: 1040px) and (min-width: 700px) {
  .openbot { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 28px; align-items: start; }
  .openbot h2, .openbot .steps { grid-column: 1; }
  .openbot .field, .openbot .btn-row, .openbot .note { grid-column: 2; }
  .openbot h2 { grid-row: 1; } .openbot .steps { grid-row: 2 / 5; }
  .openbot .field { grid-row: 1 / 3; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  h1 { font-size: 1.5rem; }
  .shell-in { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
  .shell .brand { font-size: .9375rem; }
  .shell-summary { order: 3; width: 100%; gap: 12px; font-size: .8125rem; padding-top: 2px; }
  .btn-shell { padding: 6px 10px; min-height: 32px; }
  .layout { padding: 20px 16px 48px; gap: 28px; }
  .work { gap: 28px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .new-form { padding: 16px; }
  .new-form .switches { grid-template-columns: minmax(0, 1fr); }
  .number-row { padding: 14px 14px 12px; column-gap: 12px; }
  .facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
  .facts div { display: grid; gap: 0; }
  .facts dt { font-size: .75rem; }
  .row-actions { grid-column: 1 / -1; margin-top: 6px; }
  .row-actions .btn { flex: 1 1 0; }
  .row-actions [data-toggle] {
    flex-basis: 100%; justify-content: space-between; margin: 2px -14px -12px; padding: 12px 14px; min-height: 44px;
    border-radius: 0 0 var(--r-lg) var(--r-lg); border-top: 1px solid var(--line);
  }
  .is-open .row-actions [data-toggle] { border-radius: 0; }
  .row-error { padding: 0 14px 12px 38px; }
  .edit, .groups { padding: 16px 14px 18px; }
  .edit-fields { grid-template-columns: minmax(0, 1fr); }
  .number-foot { padding: 10px 14px; justify-content: stretch; }
  .number-foot .btn { flex: 1; }
  .segmented { width: 100%; }
  .segmented label { flex: 1; text-align: center; }
  .openbot { padding: 16px; }

  /* tabela vira lista */
  .activity thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .activity tr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .activity tbody tr:last-child { border-bottom: 0; }
  .activity td { padding: 0; border: 0; }
  .activity tbody tr:hover td { background: none; }
  .activity td[data-col="when"] { grid-column: 1 / -1; font-size: .8125rem; }
  .activity td[data-col="slug"] { font-weight: 600; }
  .activity td[data-col="target"], .activity td[data-col="result"] { grid-column: 1 / -1; }
  .activity td[data-col="target"]::before { content: "para "; color: var(--ink-3); }
  .activity td.none { display: none; }
  .activity td.nothing { grid-column: 1 / -1; }
  .dialog-body { padding: 16px; }
  .inline-field { flex-wrap: wrap; }
  .inline-field .btn { flex: 1; }
}
