/* Prancha Técnica em Grafite
   Camadas de grafite (8B → 2B), fios de 1px como traço de régua,
   latão como único destaque, vermelho só para suporte. */
:root {
  --g8: #121315;          /* fundo */
  --g6: #1a1b1e;          /* painéis */
  --g4: #24262a;          /* selecionado, suas mensagens */
  --g2: #3a3d42;          /* bordas fortes */
  --line: #2e3035;        /* fio de régua */
  --ink: #e4e5e7;
  --ink-2: #a3a7ae;
  --ink-3: #82868d;
  --brass: #b8996a;
  --brass-hi: #ccb083;
  --brass-ink: #17130c;
  --sos: #e07059;         /* #C2553F clareado para passar AA em texto pequeno; só para suporte */
  --sos-bg: #2a1a17;
  --ok: #8fae8b;

  --f-display: "Archivo", "Arial Narrow", sans-serif;
  --f-text: "Onest", system-ui, sans-serif;
  --f-num: "Martian Mono", ui-monospace, monospace;

  --ease: cubic-bezier(.16, 1, .3, 1);
  --r: 2px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.5 var(--f-text);
  background: var(--g8);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  caret-color: var(--brass);
}
::selection { background: var(--brass); color: var(--brass-ink); }
* { scrollbar-width: thin; scrollbar-color: var(--g2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--g2); border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }
.sm-only { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }
.num { font-family: var(--f-num); font-variation-settings: "wdth" 87.5; font-variant-numeric: tabular-nums; font-size: .86em; }
.error { color: var(--sos); min-height: 1.3em; margin: 0; font-size: 13px; }
a { color: var(--brass); text-underline-offset: 3px; }
a:hover { color: var(--brass-hi); }
code {
  font-family: var(--f-num); font-variation-settings: "wdth" 87.5; font-size: .84em;
  background: var(--g4); border: 1px solid var(--line); padding: 0 5px; border-radius: var(--r);
}
h1, h2, h3 { margin: 0; text-wrap: balance; }
.title {
  font-family: var(--f-display); font-stretch: 118%; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em; font-size: 22px; line-height: 1.15;
}
h3 { font-size: 14px; font-weight: 600; }
:focus-visible { outline: 1px solid var(--brass); outline-offset: 2px; }
.ic { width: 20px; height: 20px; flex: none; }

/* ---------- campos ---------- */
input, textarea, select {
  font: inherit; color: var(--ink);
  background: var(--g8);
  border: 1px solid var(--g2);
  border-radius: var(--r);
  padding: 9px 11px;
  width: 100%;
  transition: border-color .15s;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
textarea { resize: vertical; line-height: 1.5; }
input:hover, textarea:hover, select:hover { border-color: #4a4d53; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brass); }
select { appearance: none; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: right 15px center, right 10px center; background-size: 5px 5px; background-repeat: no-repeat; }
input[type="checkbox"] {
  appearance: none; width: 16px; height: 16px; padding: 0; flex: none;
  border: 1px solid var(--ink-3); background: var(--g8); display: grid; place-items: center; cursor: pointer;
}
input[type="checkbox"]:checked { background: var(--brass); border-color: var(--brass); }
input[type="checkbox"]:checked::after { content: ""; width: 8px; height: 4px; border: solid var(--brass-ink); border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg); }

.field { display: grid; gap: 6px; }
.field-label, .tb-label {
  font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
}
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }

/* ---------- botões ---------- */
.btn {
  font: 500 13px/1 var(--f-text); cursor: pointer;
  height: 36px; padding: 0 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--g2); border-radius: var(--r);
  background: transparent; color: var(--ink); white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--g4); border-color: #4a4d53; }
.btn:active { background: var(--g2); }
.btn.primary { background: var(--brass); border-color: var(--brass); color: var(--brass-ink); font-weight: 600; }
.btn.primary:hover { background: var(--brass-hi); border-color: var(--brass-hi); }
.btn.danger { color: var(--ink-2); }
.btn.danger:hover { color: var(--ink); border-color: var(--ink-3); background: var(--g4); }
.btn.small { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.icon { width: 36px; padding: 0; border-color: transparent; color: var(--ink-2); }
.btn.icon:hover { color: var(--ink); }
.btn.block { width: 100%; height: 44px; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-sheet { width: 100%; max-width: 420px; border: 1px solid var(--ink-3); background: var(--g6); }
.login-title { padding: 28px 28px 22px; border-bottom: 1px solid var(--g2); }
.login-title h1 {
  font-family: var(--f-display); font-stretch: 125%; font-weight: 800; text-transform: uppercase;
  font-size: 26px; letter-spacing: .02em;
}
.login-title p { margin: 8px 0 0; }
.login-fields { padding: 24px 28px 28px; display: grid; gap: 14px; }

/* ---------- casca ---------- */
.app { display: grid; grid-template-columns: 76px 1fr; height: 100vh; height: 100dvh; }
.rail {
  border-right: 1px solid var(--line); background: var(--g8);
  display: flex; flex-direction: column; align-items: stretch; padding: 18px 0 12px; gap: 2px;
}
.brand { display: grid; justify-items: center; gap: 6px; padding-bottom: 20px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.bot-mark {
  width: 38px; height: 38px; border: 1px solid var(--brass); color: var(--brass);
  display: grid; place-items: center; font: 800 14px var(--f-display); font-stretch: 120%; text-transform: uppercase;
}
.status { font-size: 0; color: var(--ink-3); display: flex; align-items: center; gap: 5px; }
.status.ok, .status.off { font-size: 0; }
.status::before { content: ""; width: 6px; height: 6px; background: var(--ink-3); }
.status.ok::before { background: var(--ok); }
.status.off::before { background: transparent; border: 1px solid var(--ink-3); }
.nav-item {
  position: relative; font: 500 11px/1.2 var(--f-text); cursor: pointer; color: var(--ink-3);
  background: none; border: 0; padding: 11px 4px;
  display: grid; justify-items: center; gap: 6px;
  transition: color .15s;
}
.nav-item::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 1px; background: transparent; }
.nav-item:hover { color: var(--ink); }
.nav-item.active { color: var(--ink); }
.nav-item.active .ic { color: var(--brass); }
.nav-item.active::before { background: var(--brass); }
.nav-item.logout { margin-top: auto; }
.badge {
  position: absolute; top: 4px; left: 50%; margin-left: 6px;
  background: var(--brass); color: var(--brass-ink);
  font: 600 11px/1 var(--f-num); font-variation-settings: "wdth" 87.5; padding: 3px 5px; min-width: 18px; text-align: center;
}

.content { overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.view { flex: 1; overflow: auto; padding: 36px 44px 56px; }
.view-header {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap;
  padding-bottom: 20px; margin-bottom: 28px; border-bottom: 1px solid var(--line);
}
.view-header p { margin: 6px 0 0; max-width: 64ch; }
.view-header:has(+ .table-wrap), .view-header:has(+ .ledger) { border-bottom: 0; margin-bottom: 0; }

.search-box { position: relative; }
.search-box .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-3); pointer-events: none; }
.search-box input { padding-left: 34px; }
.search-box.inline { width: 300px; max-width: 100%; }
input[type="search"]::-webkit-search-cancel-button { filter: grayscale(1) brightness(.7); }

/* ---------- conversas ---------- */
.chats-view { display: grid; grid-template-columns: 340px minmax(0, 1fr); padding: 0; overflow: hidden; }
.chat-list-pane { border-right: 1px solid var(--line); background: var(--g6); display: flex; flex-direction: column; min-height: 0; }
.pane-head { padding: 24px 20px 16px; border-bottom: 1px solid var(--line); }
.pane-head .title { font-size: 18px; }
.pane-sub { display: flex; justify-content: space-between; gap: 8px; margin: 6px 0 0; font-size: 12px; color: var(--ink-3); }
.chat-list-pane .search-box { margin: 14px 20px 10px; }
.filters { display: flex; gap: 6px; padding: 0 20px 14px; border-bottom: 1px solid var(--line); }
.filter {
  font: 500 12px/1 var(--f-text); color: var(--ink-2); cursor: pointer;
  background: none; border: 1px solid var(--line); border-radius: var(--r); padding: 6px 9px;
  display: inline-flex; gap: 6px; align-items: center;
}
.filter:hover { border-color: var(--g2); color: var(--ink); }
.filter.active { border-color: var(--brass); color: var(--brass); }
.filter .num { font-size: 11px; }
.chat-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.chat-item {
  position: relative; display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 4px 10px;
  padding: 13px 20px; border-bottom: 1px solid var(--line); cursor: pointer;
  transition: background-color .12s;
}
.chat-item:hover { background: #1f2023; }
.chat-item.active { background: var(--g4); }
.chat-item.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--brass); }
.chat-item .seq { color: var(--ink-3); padding-top: 3px; font-size: 11px; }
.chat-item .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .last { color: var(--ink-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .meta { display: grid; justify-items: end; align-content: start; gap: 6px; font-size: 11px; color: var(--ink-3); }
.chat-item.unread .name { color: #fff; }
.chat-item .count {
  background: var(--brass); color: var(--brass-ink); font: 600 11px/1 var(--f-num);
  font-variation-settings: "wdth" 87.5; padding: 3px 5px; min-width: 18px; text-align: center;
}
.st {
  display: inline-block; margin-top: 6px; font-size: 11px; font-weight: 600; letter-spacing: .04em;
  padding: 1px 6px; border: 1px solid currentColor; border-radius: var(--r);
}
.st.support { color: var(--sos); }
.st.new, .st.waiting { color: var(--brass); }
.st.done { color: var(--ink-3); border-color: var(--g2); }
.list-empty { padding: 32px 20px; color: var(--ink-2); }

.chat-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.empty-state { margin: auto; padding: 40px; max-width: 380px; text-align: center; }
.empty-title { font-family: var(--f-display); font-stretch: 118%; text-transform: uppercase; font-weight: 700; letter-spacing: .03em; margin: 0 0 8px; }
.empty-state .muted { margin: 0; }

.chat-open {
  display: grid; height: 100%; min-height: 0;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.chat-header {
  grid-column: 1; display: flex; align-items: center; gap: 10px;
  min-height: 78px; padding: 12px 32px; border-bottom: 1px solid var(--line);
}
.chat-id { flex: 1; min-width: 0; }
.chat-id .seq { color: var(--brass); font-size: 11px; }
.chat-id h2 { font-size: 18px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-id .muted { margin-top: 1px; }
.back { display: none; }
.stamp-toggle { display: none; }

.messages {
  grid-column: 1; overflow-y: auto; padding: 28px 32px;
  display: flex; flex-direction: column; gap: 16px;
}
.day-sep {
  align-self: stretch; display: flex; align-items: center; gap: 12px; margin: 8px 0 0;
  font: 500 11px var(--f-num); font-variation-settings: "wdth" 87.5; letter-spacing: .1em; color: var(--ink-3); text-transform: uppercase;
}
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 14px; max-width: min(680px, 92%); }
.msg .time {
  text-align: right; padding: 3px 12px 0 0; border-right: 1px solid var(--line);
  font: 11px var(--f-num); font-variation-settings: "wdth" 87.5; color: var(--ink-3);
}
.msg .who { display: block; font-size: 11px; color: var(--ink-3); margin-bottom: 4px; }
.msg .tx {
  background: var(--g6); border: 1px solid var(--line); padding: 9px 13px;
  white-space: pre-wrap; overflow-wrap: anywhere; border-radius: var(--r);
}
.msg.out.admin { align-self: flex-end; }
.msg.out.admin .who { color: var(--brass); }
.msg.out.admin .tx { background: var(--g4); border-color: var(--g2); }
.msg.out.bot .tx { background: transparent; border-style: dashed; border-color: var(--g2); color: var(--ink-2); }
.messages > .empty-state { margin: auto; }

.composer {
  grid-column: 1; display: flex; gap: 10px; align-items: flex-end;
  padding: 14px 32px 18px; border-top: 1px solid var(--line);
}
.composer textarea { max-height: 180px; min-height: 44px; resize: none; background: var(--g6); padding: 11px 13px; }
.composer .btn { height: 44px; padding: 0 20px; }

/* Carimbo do membro */
.stamp {
  grid-column: 2; grid-row: 1 / 4; position: relative;
  border-left: 1px solid var(--line); background: var(--g6);
  padding: 24px; overflow-y: auto;
}
#user-assets.hidden { display: block !important; }
.stamp-close { display: none; position: absolute; top: 12px; right: 12px; }
.tb { border: 1px solid var(--ink-3); display: grid; grid-template-columns: 1fr 1fr; }
.tb-cell {
  display: grid; gap: 3px; padding: 9px 11px; min-width: 0;
  border-bottom: 1px solid var(--g2); border-right: 1px solid var(--g2);
}
.tb-cell:nth-child(2n+1):not(.full) { border-right: 0; }
.tb-cell:nth-last-child(-n+2) { border-bottom: 0; }
.tb-cell.full { grid-column: 1 / -1; border-right: 0; }
.tb-value { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-value.num { font-size: 12.5px; }
.tb-value.big { font: 700 20px/1.2 var(--f-display); font-stretch: 105%; white-space: normal; text-wrap: balance; }
.stamp-head { display: flex; justify-content: space-between; align-items: baseline; margin: 28px 0 4px; }
.stamp-head h3 { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.stamp-head .num { font-size: 11px; }
.ticker-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
.ticker-grid li {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  border-bottom: 1px solid var(--g2); padding: 9px 0; min-width: 0;
}
.ticker-grid .tk { font: 500 19px/1.1 var(--f-num); font-variation-settings: "wdth" 87.5; letter-spacing: .01em; }
.ticker-grid .rm {
  width: 24px; height: 24px; display: grid; place-items: center; padding: 0; cursor: pointer;
  background: none; border: 0; color: var(--ink-3); opacity: 0; transition: opacity .15s, color .15s;
}
.ticker-grid .rm .ic { width: 14px; height: 14px; }
.ticker-grid li:hover .rm, .ticker-grid .rm:focus-visible { opacity: 1; }
.ticker-grid .rm:hover { color: var(--ink); }
.ticker-grid .none { grid-column: 1 / -1; color: var(--ink-2); border-bottom: 0; font-size: 13px; }
.support-note {
  margin: 20px 0 0; padding: 10px 12px; font-size: 12.5px;
  border: 1px solid var(--sos); color: var(--sos); background: var(--sos-bg); border-radius: var(--r);
}
/* O carimbo se assenta ao abrir uma conversa: as células são "riscadas" de cima para baixo. */
.stamp.drawn .tb { animation: draw .42s var(--ease) both; }
.stamp.drawn .ticker-grid li { animation: settle .38s var(--ease) both; animation-delay: calc(var(--i, 0) * 28ms + 120ms); }
@keyframes draw { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }
@keyframes settle { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- tabelas ---------- */
.table-wrap { overflow-x: auto; border-top: 1px solid var(--ink-3); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.table th { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.table th:first-child, .table td:first-child { padding-left: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; text-align: right; }
.table td.num, .table th.num { text-align: right; }
.table tbody tr:hover { background: var(--g6); }
.table .member .muted { margin-left: 6px; font-size: 12.5px; }
.table .tk { font: 500 15px var(--f-num); font-variation-settings: "wdth" 87.5; }
.table .empty-row td { color: var(--ink-2); padding: 28px 0; white-space: normal; }
.summary { color: var(--ink-3); margin: 14px 0 0; text-align: right; font-size: 11.5px; }

/* ---------- respostas automáticas (livro de regras) ---------- */
.ledger { border-top: 1px solid var(--ink-3); }
.rule { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 20px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.rule .seq { color: var(--ink-3); padding-top: 22px; font-size: 11px; }
.rule-body { display: grid; gap: 14px; }
.rule.inactive .rule-body > :not(.actions) { opacity: .55; }
.ledger-empty { padding: 40px 0; color: var(--ink-2); }
.rule .actions { justify-content: space-between; }
.rule .actions .right { display: flex; gap: 8px; margin-left: auto; }

.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; align-items: end; }
.grid-2.even { grid-template-columns: 1fr 1fr; }

/* ---------- ajustes (pranchas com legenda à esquerda) ---------- */
.sheet { display: grid; grid-template-columns: 240px minmax(0, 640px); gap: 40px; padding: 28px 0; border-bottom: 1px solid var(--line); }
.sheet:first-of-type { padding-top: 0; }
.sheet-label h3 { font-family: var(--f-display); font-stretch: 112%; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.sheet-label p { margin: 6px 0 0; }
.sheet-body { display: grid; gap: 16px; margin: 0; }
.conn { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--g2); border-radius: var(--r); }
.conn .dot { width: 8px; height: 8px; flex: none; border: 1px solid var(--ink-3); }
.conn.ok .dot { background: var(--ok); border-color: var(--ok); }
.conn strong { display: block; font-weight: 600; }
.conn .small { display: block; margin-top: 2px; }
.howto { color: var(--ink-2); font-size: 13px; }
.howto summary { cursor: pointer; color: var(--ink); width: fit-content; }
.howto summary:hover { color: var(--brass); }
.howto ol { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.commands { grid-template-columns: max-content 1fr; gap: 10px 24px; }
.commands dt { display: flex; gap: 6px; }
.commands dd { margin: 0; color: var(--ink-2); }

/* ---------- menus ---------- */
.menus-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 36px; align-items: start; }
.menus-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink-3); }
.menus-list li {
  position: relative; padding: 11px 12px; border-bottom: 1px solid var(--line); cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.menus-list li:hover { background: var(--g6); }
.menus-list li.active { background: var(--g4); }
.menus-list li.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--brass); }
.menus-list .tag { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--brass); }
.menu-editor form { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 36px; align-items: start; }
.menu-main { display: grid; gap: 18px; }
.menu-main h3, .menu-side h3 { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }
.btn-rows { display: grid; }
.btn-row {
  display: grid; grid-template-columns: 1.2fr 64px 1.5fr 1.3fr 36px; gap: 8px; align-items: start;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.btn-row .hint { font-size: 12.5px; color: var(--ink-3); padding: 9px 0; }
.btn-row-head { display: grid; grid-template-columns: 1.2fr 64px 1.5fr 1.3fr 36px; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--g2); }
.btn-row-head span { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.menu-side { position: sticky; top: 0; }
.preview { background: #0d0e10; border: 1px solid var(--line); padding: 16px; display: grid; gap: 6px; border-radius: var(--r); }
.preview .bubble { background: var(--g4); padding: 9px 12px; white-space: pre-wrap; border-radius: var(--r); margin-bottom: 4px; }
.preview .kb-row { display: flex; gap: 6px; }
.preview .kb-btn {
  flex: 1; text-align: center; background: var(--g6); border: 1px solid var(--g2); padding: 8px; font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: var(--r);
}
.menu-editor .actions { grid-column: 1 / -1; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 18px; }

/* ---------- aviso ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--g8); padding: 11px 16px; font-weight: 500; border-radius: var(--r);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45); z-index: 20; max-width: calc(100% - 32px);
  animation: toast-in .3s var(--ease);
}
.toast.err { background: var(--g4); color: var(--ink); border: 1px solid var(--g2); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- telas médias: carimbo vira gaveta ---------- */
@media (max-width: 1279px) {
  .chat-open { grid-template-columns: minmax(0, 1fr); }
  .stamp-toggle { display: inline-flex; }
  #user-assets.hidden { display: none !important; }
  .stamp {
    position: absolute; right: 0; top: 0; bottom: 0; width: min(340px, 100%); z-index: 5;
    box-shadow: -18px 0 40px rgba(0, 0, 0, .5);
  }
  .chat-pane { position: relative; }
  .stamp-close { display: grid; }
  .stamp .tb { margin-top: 32px; }
  .menu-editor form { grid-template-columns: minmax(0, 1fr); }
  .menu-side { position: static; }
  .sheet { grid-template-columns: 1fr; gap: 16px; }
}

/* ---------- celular ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .rail {
    grid-row: 2; flex-direction: row; padding: 0; border-right: 0; border-top: 1px solid var(--line);
    overflow-x: auto; justify-content: space-around;
  }
  .brand { display: none; }
  .nav-item { flex: 1; padding: 9px 2px 10px; }
  .nav-item::before { left: 8px; right: 8px; top: 0; bottom: auto; width: auto; height: 1px; }
  .nav-item.logout { margin-top: 0; }
  .view { padding: 24px 16px 40px; }
  .chats-view { grid-template-columns: 1fr; padding: 0; }
  .pane-head { padding: 20px 16px 14px; }
  .chat-list-pane .search-box { margin: 12px 16px 10px; }
  .filters { padding: 0 16px 12px; }
  .chat-item { padding: 13px 16px; }
  .chat-list-pane { border-right: 0; }
  .chat-header { flex-wrap: wrap; row-gap: 8px; }
  .chat-id { flex: 1 1 calc(100% - 46px); }
  .chat-id h2 { white-space: normal; }
  .chat-sub-id { display: none; }
  #support-done, .stamp-toggle { margin-left: auto; }
  #support-done + .stamp-toggle { margin-left: 0; }
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }
  .chats-view.has-open .chat-list-pane { display: none; }
  .chats-view:not(.has-open) .chat-pane { display: none; }
  .back { display: inline-flex; }
  .chat-header { padding: 10px 12px; min-height: 64px; }
  .messages { padding: 20px 16px; }
  .msg { grid-template-columns: 44px minmax(0, 1fr); gap: 10px; max-width: 100%; }
  .composer { padding: 10px 12px 12px; }
  .lg-only { display: none; }
  .sm-only { display: inline; }
  .grid-2, .grid-2.even { grid-template-columns: 1fr; }
  .btn-row { grid-template-columns: minmax(0, 1fr) 64px 36px; }
  .btn-row > :nth-child(3), .btn-row > :nth-child(4) { grid-column: 1 / -1; grid-row: auto; }
  .btn-row > .btn { grid-column: 3; grid-row: 1; }
  .btn-row-head { display: none; }
  .menus-layout { grid-template-columns: 1fr; gap: 20px; }
  .rule { grid-template-columns: 1fr; gap: 6px; }
  .rule .seq { padding-top: 0; }
  .search-box.inline { width: 100%; }
  .table .member .muted { display: block; margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
