/* ChatBeam.
   Tipografia: Inter Tight em títulos e indicadores; IBM Plex Sans na leitura.
   Cores na proporção 60/30/10:
     60  o fundo neutro onde o conteúdo vive (gelo no claro, carbono no escuro)
     30  a moldura e as superfícies de apoio (neutros claros no claro, cinzas elevados no escuro)
     10  o lima, só para ação principal, seleção e o caminho do roteiro
   Estados (alerta, erro) aparecem como um ponto ou um filete, não como áreas coloridas. */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter Tight"; font-weight: 400; font-display: swap; src: url("/fonts/inter-tight-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter Tight"; font-weight: 500; font-display: swap; src: url("/fonts/inter-tight-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter Tight"; font-weight: 600; font-display: swap; src: url("/fonts/inter-tight-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter Tight"; font-weight: 700; font-display: swap; src: url("/fonts/inter-tight-latin-700-normal.woff2") format("woff2"); }


:root {
  color-scheme: light;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Inter Tight", "IBM Plex Sans", sans-serif;
  --carbono: #0D0F12;
  --lima: #B6F23C;
  --gelo: #F4F5F2;

  /* 60: fundo do conteúdo */
  --bg: #ECEFE8;
  --surface: #FFFFFF;
  --sunken: #E8EAE6;
  --ink: #0D0F12;
  --ink-2: #555E68;
  --line: #CBD2C5;
  --control-bg: #E8EAE6;
  --control-line: #CBD2C5;
  --panel-shadow: 0 1px 3px rgba(13, 15, 18, .04);
  --scrim: rgba(13, 15, 18, .5);
  /* 30: moldura */
  --frame: #E1E6DC;
  --frame-raised: #FFFFFF;
  --frame-line: #CBD2C5;
  --frame-ink: #0D0F12;
  --frame-ink-2: #555E68;
  --nav-active: #E8EAE6;
  /* 10: destaque */
  --accent: #B6F23C;
  --accent-hover: #A6E22C;
  --accent-ink: #3D5C00;      /* lima escura: links sobre claro */
  --beam: #547F00;            /* verde com contraste para foco e traços sobre claro */
  --beam-soft: #EAF5CF;
  /* estados */
  --warn: #B26A00;
  --bad: #B3261E;
  --r-frame: 12px; --r-panel: 10px; --r-control: 6px;
  --gap: 8px;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171A1E;
  --surface: #1E2227;
  --sunken: #252A30;
  --ink: #F4F5F2;
  --ink-2: #B3B8BF;
  --line: #32383F;
  --control-bg: #252A30;
  --control-line: #32383F;
  --panel-shadow: none;
  --frame: #14171B;
  --frame-raised: #1E2227;
  --frame-line: #32383F;
  --frame-ink: #F4F5F2;
  --frame-ink-2: #B3B8BF;
  --nav-active: #252A30;
  --accent-hover: #C3FA5A;
  --accent-ink: #B6F23C;
  --beam: #B6F23C;
  --beam-soft: #29341D;
  --warn: #F0B454;
  --bad: #F2918A;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--frame); color: var(--ink);
  font: 400 13px/1.5 var(--font);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}
/* Hierarquia: título da tela, título de painel, subtítulo de seção, texto e apoio. */
h1 { font-family: var(--font-display); font-size: 25px; line-height: 1.2; font-weight: 600; letter-spacing: -0.025em; margin: 0; }
h2 { font-family: var(--font-display); font-size: 13.5px; line-height: 1.35; font-weight: 600; letter-spacing: -0.025em; margin: 0 0 8px; }
h3 { font-size: 12.5px; line-height: 1.3; font-weight: 600; letter-spacing: 0.01em; margin: 0 0 8px; color: var(--ink-2); }
p { margin: 0 0 10px; max-width: 72ch; }
b, strong { font-weight: 600; }
a { color: var(--accent-ink); text-underline-offset: 3px; }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.pre { white-space: pre-wrap; }
:focus-visible { outline: 2px solid var(--beam); outline-offset: 2px; border-radius: 6px; }
/* Rolagem: barra fina e arredondada, sem setas nem trilho, igual em todo o sistema. */
@supports selector(::-webkit-scrollbar) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
  ::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
  ::-webkit-scrollbar-thumb { background-color: color-mix(in srgb, var(--ink-2) 30%, transparent); border: 3px solid transparent; background-clip: content-box; border-radius: 99px; min-height: 36px; }
  :hover::-webkit-scrollbar-thumb { background-color: color-mix(in srgb, var(--ink-2) 55%, transparent); }
  ::-webkit-scrollbar-thumb:hover, ::-webkit-scrollbar-thumb:active { background-color: var(--ink-2); }
  :is(.tabs, .filters, .head > .row)::-webkit-scrollbar { display: none; }
}
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--ink-2) 40%, transparent) transparent; }
  :is(.tabs, .filters, .head > .row) { scrollbar-width: none; }
}
/* Blocos com borda reservam o espaço da barra; faixas horizontais esmaecem na borda direita. */
:is(.inbox .items, .msgs, .tab-body, .drawer, .inbox .side) { scrollbar-gutter: stable; overscroll-behavior: contain; }
:is(.tabs, .filters) { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); padding-right: 28px; }

/* ---------- Estação: cabeçalho, área útil e dock ---------- */
.shell { position:relative; display:grid; grid-template-rows:44px minmax(0,1fr) 52px; height:100vh; height:100dvh; background:var(--bg); overflow:hidden; }
body:has(.shell) { overflow:hidden; }
.topbar { display:flex; align-items:center; gap:14px; padding:0 16px; border-bottom:1px solid var(--line); min-width:0; color:var(--ink); background:var(--frame); }
.home-brand { display:flex; flex:none; text-decoration:none; }
.wordmark { display:flex; align-items:center; padding:0; }
.brand-logo { display:block; width:96px; height:auto; max-width:100%; }
.brand-logo-dark, [data-theme="dark"] .brand-logo-light { display:none; }
[data-theme="dark"] .brand-logo-dark { display:block; }
.company-switcher { min-width:0; max-width:320px; }
.company-name, .company-pick { font:500 13px var(--font); color:var(--ink); }
.company-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.company-pick { width:100%; padding:6px 28px 6px 10px; background:transparent; border:1px solid transparent; }
.topbar-context { font-size:11px; color:var(--ink-2); white-space:nowrap; padding:2px 8px; border-radius:99px; background:var(--sunken); }
.topbar .foot { position:relative; margin-left:auto; flex:none; }
.topbar .theme-toggle { flex:none; }
.topbar .theme-toggle+.foot { margin-left:0; }
.user-btn { display:flex; align-items:center; gap:8px; background:var(--surface); border:1px solid var(--line); border-radius:8px; padding:4px 8px; text-align:left; }
.user-details { display:grid; min-width:0; max-width:150px; }
.user-btn .who { font-size:12px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.user-btn .role { font-size:10px; color:var(--ink-2); }
.user-menu { position:absolute; right:0; top:calc(100% + 8px); width:200px; display:grid; padding:6px; background:var(--surface); border:1px solid var(--line); border-radius:10px; box-shadow:0 8px 24px var(--scrim); z-index:15; }
.user-menu[hidden] { display:none; }
.user-menu a,.user-menu button { padding:8px 10px; border:0; background:none; color:var(--ink); text-align:left; text-decoration:none; border-radius:6px; }
.user-menu a:hover,.user-menu button:hover { background:var(--sunken); }
.canvas { display:flex; flex-direction:column; min-width:0; min-height:0; padding:8px 12px 0; gap:8px; }
/* Título e ações da tela vivem na barra do topo: uma faixa só para a moldura. */
.head { display:flex; align-items:center; justify-content:space-between; gap:14px; flex:1; min-width:0; }
.head>div:first-child { display:flex; align-items:baseline; gap:10px; min-width:0; padding-left:14px; border-left:1px solid var(--line); }
.head h1 { flex:none; font-size:16px; white-space:nowrap; }
.head .sub { display:none; flex:1; min-width:0; color:var(--ink-2); font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
@media (min-width:1181px) { .shell[data-page="roteiro"] .head .sub { display:block; } }
.head>.row { justify-content:flex-end; flex:none; flex-wrap:nowrap; gap:6px; }
.head>.row:empty { display:none; }
.head select { width:auto; max-width:280px; }
.dock-area { display:flex; align-items:center; justify-content:center; padding:4px 16px 6px; min-width:0; background:var(--frame); }
.rail { display:flex; color:var(--ink-2); background:var(--surface); border:1px solid var(--line); border-radius:12px; padding:3px 8px; height:46px; max-width:100%; box-shadow:0 4px 14px var(--scrim); z-index:10; }
.rail-links,.rail .group { display:flex; align-items:center; gap:4px; }
.rail a { position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:1px; min-width:58px; height:40px; padding:0 6px; color:inherit; text-decoration:none; border-radius:8px; flex:none; }
.rail a:hover { background:var(--sunken); color:var(--ink); }
.rail a.on { background:var(--accent); color:var(--carbono); }
.rail a .icon { width:16px; height:16px; }
.rail a .label { font-size:10px; line-height:1.2; white-space:nowrap; }
.group-label { display:none; }
.rail .group+.group { margin-left:6px; padding-left:8px; border-left:1px solid var(--line); }
.count { background:var(--accent); color:var(--carbono); font-size:10px; font-weight:600; border-radius:99px; padding:0 5px; line-height:17px; }
.rail a .count { position:absolute; right:-3px; top:-3px; border:1px solid var(--surface); }
.icon-btn { background:transparent; border:0; color:var(--ink-2); padding:8px; border-radius:8px; display:grid; place-items:center; }
.icon-btn:hover { background:var(--sunken); color:var(--ink); }
.rail-head,.mobile-shortcuts,.mobile-nav-close,.nav-backdrop { display:none; }

/* O palco: a área útil do quadro. */
.stage { flex:1; min-height:0; min-width:0; padding:0; background:var(--bg); overflow:hidden; }
.stage.single { overflow-y: auto; display: flex; flex-direction: column; gap: var(--gap); }
.stage.fill { display: flex; flex-direction: column; gap: var(--gap); }
.stage.fill > * { flex: 1; min-height: 0; }
.stage.fill > .note, .stage.fill > .working { flex: none; }
.stage.layout { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr) clamp(280px, 30%, 420px); }
.stage.layout.half { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.pane { min-height: 0; min-width: 0; overflow-y: auto; display: flex; flex-direction: column; gap: var(--gap); border-radius: var(--r-panel); }
/* O último painel de cada coluna estica até o fim da moldura, para não sobrar vazio embaixo. */
.pane > .tabbed:last-child, .pane > .fill-form:last-child { flex: 1 0 auto; }

/* Faixa de avisos e progresso: some quando vazia e nunca estica. */
.slot { flex: none !important; }
.slot:empty { display: none; }

/* Roteiro: leitura e ajustes usam a altura; o mapa abre quando necessário. */
.roteiro { display:grid; gap:var(--gap); grid-template-columns:minmax(0,1.2fr) minmax(0,1fr); min-height:0; }
.playbook-stages { display:flex; flex-direction:column; gap:10px; min-height:0; min-width:0; }
.stage-picker { flex:none; flex-wrap:nowrap; }
.stage-track { display:flex; gap:4px; flex:1; min-width:0; overflow-x:auto; scrollbar-width:none; }
.stage-track::-webkit-scrollbar { display:none; }
.stage-track button { flex:none; display:inline-flex; align-items:center; gap:6px; padding:4px 12px 4px 4px; border-radius:99px; background:transparent; color:var(--ink-2); }
.stage-track button i { display:grid; place-items:center; width:20px; height:20px; border-radius:50%; background:var(--sunken); font-style:normal; font-size:11px; font-weight:600; }
.stage-track button[aria-selected="true"] { border-color:var(--beam); color:var(--ink); font-weight:600; }
.stage-track button[aria-selected="true"] i { background:var(--accent); color:var(--carbono); }
.playbook-stages>.inspector { flex:1; min-height:0; overflow-y:auto; }
.roteiro>.tabbed { min-height:0; overflow:hidden; }
.inspector .cols { grid-template-columns:minmax(0,1fr); }
.inspector .cols>.stack { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
.drawer.map-drawer { width:min(1100px,100%); display:flex; flex-direction:column; gap:16px; }
.playbook-map { flex:1; min-height:260px; }
.playbook-map>.flow-wrap { height:100%; }

/* ---------- Superfícies ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 10px 14px; margin: 0; }
.panel:has(> table) { overflow-x: auto; }
/* Título de painel separado do conteúdo por um fio: deixa claro onde cada bloco começa. */
.panel > h2:first-child, .panel > .row.spread:first-child:not(.item) { margin-bottom: 8px; }
.panel > .row.spread:first-child h2 { margin: 0; }
.panel.flush { padding: 0; overflow: hidden; }
.panel>.row.spread:first-child>h2 { flex:1; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--gap); align-items: start; }
.grid2 { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(210px,100%),1fr)); gap:0 16px; align-items:start; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.under-map { margin: 12px 0 0; }

/* Opções menos usadas ficam recolhidas. */

/* Abas */
.tabbed { padding: 0; display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; gap: 2px; padding: 4px 8px 0; border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; }
.tab { border: 0; background: transparent; border-radius: 9px 9px 0 0; padding: 6px 10px 8px; color: var(--ink-2); font-weight: 500; display: flex; align-items: center; gap: 7px; position: relative; }
.tab:hover { background: var(--sunken); color: var(--ink); }
.tab { font-size: 13.5px; }
.tab[aria-selected="true"] { color: var(--ink); font-weight: 600; }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--beam); border-radius: 2px; }
.shell[data-page="ajustes"] .tabbed { width:100%; max-width:920px; margin-inline:auto; flex:none; }
.shell[data-page="ajustes"] .tab-body>.panel { padding:0; border:0; background:none; }
.shell[data-page="ajustes"] .tab-body>form>button { justify-self:start; align-self:flex-start; }
@media (min-width:700px) {
  .shell[data-page="ajustes"] .tab-body>form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 16px; align-items:end; }
  .shell[data-page="ajustes"] .tab-body>form>:not(.field), .shell[data-page="ajustes"] .tab-body>form>.field:has(textarea) { grid-column:1/-1; }
  .shell[data-page="ajustes"] .tab-body>form>.field { margin:0; }
}
.tab-body { padding: 10px 14px; overflow-y: auto; flex: 1; min-height: 0; }

/* ---------- Formulários ---------- */
label.field { display:flex; flex-direction:column; gap:6px; margin:0 0 12px; min-width:0; }
label.field > span { display:block; font-weight:500; font-size:13px; line-height:1.4; color:var(--ink-2); min-height:19px; }
label.field > small { display: block; color: var(--ink-2); margin-top: 0; font-size: 12px; line-height: 1.4; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 6px 10px; border: 1px solid var(--control-line); border-radius: var(--r-control);
  background: var(--control-bg); color: var(--ink); font: inherit;
}
input:hover, select:hover, textarea:hover { border-color: var(--ink-2); }
input::placeholder, textarea::placeholder { color: var(--ink-2); opacity: .7; }
input[type=file] { font: inherit; font-size: 13px; color: var(--ink-2); max-width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; padding: 6px 12px; margin-right: 10px; border-radius: var(--r-control); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
textarea { min-height: 84px; resize: vertical; line-height: 1.45; display: block; }
textarea.tall { min-height: 180px; }
label.check { display: flex; gap: 9px; align-items: flex-start; margin-bottom: 12px; }
label.check input { margin-top: 3px; accent-color: var(--beam); }
/* Campo que ocupa a altura que sobrar no painel (editor de documento, material). */
.fill-form { display: flex; flex-direction: column; }
.fill-form .field.stretch { flex: 1; display: flex; flex-direction: column; min-height: 160px; }
.fill-form .field.stretch textarea { flex: 1; resize: none; }

button {
  font: inherit; font-weight: 500; padding: 5px 11px; border-radius: var(--r-control); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap;
}
button:hover { background: var(--sunken); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--carbono); font-weight: 600; }
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.quiet { border-color: transparent; background: transparent; color: var(--ink-2); padding: 4px 8px; font-weight: 500; }
button.quiet:hover { color: var(--ink); background: var(--sunken); }
button.danger { color: var(--bad); }
button.sm { padding: 4px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }

/* ---------- Listas e tabelas ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; font-weight: 600; color: var(--ink-2); padding-top: 2px; letter-spacing: 0.01em; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--sunken) 45%, transparent); }
td.actions { text-align: right; white-space: nowrap; }
td.actions .row { justify-content: flex-end; flex-wrap: nowrap; gap: 6px; }
td.wrap { word-break: break-all; font-size: 12.5px; color: var(--ink-2); min-width: 180px; }
.item { padding: 13px 0; border-bottom: 1px solid var(--line); }
.item:first-of-type { padding-top: 2px; }
.item:last-child { border-bottom: 0; padding-bottom: 0; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--sunken); color: var(--ink-2); line-height: 20px; }
.chip.live, .chip.warn, .chip.bad, .chip.human { color: var(--ink); }
.chip.live::before, .chip.warn::before, .chip.bad::before, .chip.human::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--beam); flex: none; }
.chip.warn::before { background: var(--warn); }
.chip.bad::before { background: var(--bad); }
.chip.human::before { background: var(--ink-2); }
.note { background: var(--surface); color: var(--ink); padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); border-left: 3px solid var(--warn); }
.note.bad { border-left-color: var(--bad); }
.note.ok { border-left-color: var(--beam); }
.note a { font-weight: 600; }
.empty { color: var(--ink-2); padding: 16px 12px; text-align: center; margin: auto; }

/* ---------- Visão geral ---------- */
.overview { display:grid; grid-template-columns:repeat(12,minmax(0,1fr)); gap:var(--gap); align-content:start; overflow:auto; min-height:0; }
.overview>* { grid-column:1/-1; }
.overview-metrics { display:grid; grid-template-columns:repeat(auto-fit,minmax(120px,1fr)); background:var(--surface); border:1px solid var(--line); border-radius:var(--r-panel); overflow:hidden; }
.overview>.overview-attention { grid-column:span 4; order:1; }
.overview>.overview-funnel { grid-column:span 5; order:2; }
.overview>.overview-usage { grid-column:span 3; order:3; }
.overview>.overview-health { order:4; }
.overview>.panel { min-width:0; }
.tile { display:flex; flex-direction:column-reverse; align-items:flex-start; min-width:0; padding:8px 14px; border-right:1px solid var(--line); }
.tile b { white-space:nowrap; font:600 20px/1.1 var(--font-display); letter-spacing:-.025em; }
.tile b.word { font-size:16px; color:var(--ink-2); }
.tile span { font-size:12px; color:var(--ink-2); }
.tile.accent b { color:var(--accent-ink); }
.tile b small { font:400 12px/1 var(--font); color:var(--ink-2); letter-spacing:0; }
/* Consumo de IA: dias em barras e fatias por atividade. */
.stage.single>.overview-metrics { flex:none; }
.usage-month { flex:none; }
.usage-month b { min-width:128px; text-align:center; font-weight:600; }
.usage-month button { min-width:30px; padding:4px 8px; }
.usage-split { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.2fr); gap:var(--gap); align-items:start; }
.usage-days { display:flex; align-items:flex-end; gap:3px; height:120px; margin-bottom:6px; }
.usage-days i { flex:1; min-width:2px; border-radius:2px; background:var(--line); }
.usage-days i.peak { background:var(--beam); }
.usage-groups { display:grid; gap:12px; }
.usage-share { height:5px; margin:4px 0 2px; border-radius:3px; background:var(--sunken); }
.usage-share i { display:block; height:100%; border-radius:3px; background:var(--beam); }
details.panel>summary { cursor:pointer; font-weight:600; }
details.panel[open]>summary { margin-bottom:8px; }
@media (max-width:760px) { .usage-split { grid-template-columns:1fr; } }
.funnel-bars { display:grid; gap:4px; }
.funnel-bars>div { display:grid; grid-template-columns:minmax(90px,1fr) minmax(40px,1fr) 28px; align-items:center; gap:10px; min-height:20px; line-height:1.3; font-size:12px; }
.funnel-bars i { display:block; height:5px; border-radius:4px; background:var(--sunken); overflow:hidden; }
.funnel-bars i b { display:block; height:100%; background:var(--beam); border-radius:inherit; }
.funnel-bars strong { text-align:right; }
.attention-row { display:flex; gap:10px; padding:6px 0; align-items:center; }
.attention-row+.attention-row { border-top:1px solid var(--line); }
.attention-row>b { font:600 20px/1 var(--font-display); min-width:24px; text-align:center; }
.attention-row p { margin:0; }
.overview-health { display:flex; align-items:center; gap:24px; padding:6px 14px; }
.overview-health>h2:first-child { border:0; padding:0; margin:0; font-size:14px; flex:none; }
.health-items { flex:1; display:flex; gap:10px 20px; flex-wrap:wrap; justify-content:space-between; }
.health-item { display:flex; align-items:center; gap:8px; font-size:12px; color:var(--ink-2); }
.health-item.done>span:first-child { color:var(--accent-ink); }
.overview-funnel>p { margin:0 0 8px; }
.score { font-size: 50px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.score small { font-size: 18px; color: var(--ink-2); font-weight: 500; letter-spacing: 0; }
.results { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }

/* ---------- O feixe ---------- */
.beam { display: flex; align-items: stretch; overflow-x: auto; padding: 4px 0 2px; }
.beam .step { flex: 1 1 0; min-width: 92px; position: relative; padding: 20px 12px 0 0; font-size: 13px; line-height: 1.3; color: var(--ink-2); overflow-wrap: anywhere; }
.beam .step::before { content: ""; position: absolute; top: 5px; left: 0; right: 0; height: 3px; background: var(--line); }
.beam .step::after { content: ""; position: absolute; top: 0; left: 0; width: 13px; height: 13px; border-radius: 50%; background: var(--surface); border: 3px solid var(--line); }
.beam .step.has::after { background: var(--beam); border-color: var(--beam); }
.beam .step.now { color: var(--ink); font-weight: 600; }
.beam .step.now::after { border-color: var(--beam); background: var(--surface); box-shadow: 0 0 0 4px var(--beam-soft); }
.beam .step:last-child::before { right: auto; width: 13px; }
.beam .step b { display: block; font-size: 26px; font-weight: 600; color: var(--ink); letter-spacing: -0.03em; line-height: 1.15; }
.beam.vertical { flex-direction: column; overflow: visible; }
.beam.vertical .step { padding: 0 0 13px 24px; min-width: 0; }
.beam.vertical .step::before { top: 6px; bottom: -6px; left: 5px; right: auto; width: 3px; height: auto; }
.beam.vertical .step::after { top: 3px; }
.beam.vertical .step:last-child::before { display: none; }

/* ---------- Mapa do roteiro ---------- */
.flow-wrap { overflow: hidden; background: var(--sunken); border-radius: var(--r-panel); border: 1px solid var(--line); display: grid; place-items: center; min-height: 180px; }
.flow-sizer { position: relative; }
.flow { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.flow svg { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.flow path { fill: none; stroke: var(--ink-2); stroke-width: 1.5; opacity: .38; }
.flow path.far { opacity: .22; }
.flow path.back { stroke-dasharray: 4 5; }
.flow path.hot { stroke: var(--beam); stroke-width: 3; opacity: 1; }
.node { position: absolute; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; text-align: left; font-weight: 400; white-space: normal; overflow: hidden; display: flex; flex-direction: column; gap: 3px; }
.node:hover { background: var(--surface); border-color: var(--ink-2); }
.node.on { border-color: var(--beam); box-shadow: 0 0 0 3px var(--beam-soft); }
.node.next { border-color: var(--beam); }
.node strong, .node span { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.node strong { font-weight: 600; line-height: 1.25; -webkit-line-clamp: 2; flex: none; }
.node span { -webkit-line-clamp: 2; font-size: 12.5px; line-height: 1.35; color: var(--ink-2); flex: none; }
.node em { margin-top: auto; font-style: normal; font-size: 12px; font-weight: 600; color: var(--accent-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node.inicio { border-left: 4px solid var(--beam); }
.node.fim { border-right: 4px solid var(--ink); }
.inspector .cols { margin-top: 14px; gap: 24px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.exit-read { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.exit-read:last-child { border-bottom: 0; }

/* ---------- Conversas ---------- */
.inbox { position:relative; display:grid; grid-template-columns:300px minmax(0,1fr); gap:var(--gap); height:100%; min-height:0; background:transparent; }
.inbox.two { grid-template-columns: minmax(0, 1fr) 300px; }
.inbox > div { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.inbox .list,.inbox .thread { background:var(--surface); border:1px solid var(--line); border-radius:var(--r-panel); overflow:hidden; }
.inbox .side { padding:12px; overflow-y:auto; gap:12px; background:var(--surface); border:1px solid var(--line); border-radius:var(--r-panel); }
.inbox:not(.two)>.side { display:none; }
.inbox.details-open:not(.two)>.side { display:flex; position:absolute; top:0; right:0; bottom:0; width:min(340px,100%); z-index:4; box-shadow:-12px 0 30px var(--scrim); }
.inbox .side>.row:first-child h2 { margin:0; }
.inbox .items { padding:4px; }
.inbox .conv { border:0; border-radius:8px; }
.inbox .conv .top .chip { font-size:11px; padding:0 7px; line-height:1.7; }
/* Com espaço, os detalhes ficam ao lado da conversa, sem abrir e fechar. */
@media (min-width:1200px) {
  .inbox:not(.two):has(>.side:not(:empty)) { grid-template-columns:300px minmax(0,1fr) 280px; }
  .inbox:not(.two):has(>.side:not(:empty))>.side { display:flex; position:static; width:auto; box-shadow:none; }
  .inbox [aria-controls="conversation-details"], .inbox .side>.row:first-child button { display:none; }
}
.inbox .thread>.bar { flex:none; }

.inbox .search { padding: 8px; border-bottom: 1px solid var(--line); }
.filters { display:flex; flex-wrap:nowrap; gap:2px; overflow-x:auto; margin-top:6px; padding:3px; background:var(--sunken); border-radius:8px; }
.inbox .items { overflow-y: auto; flex: 1; }
.chip-btn { flex:none; font-size: 12.5px; padding: 4px 9px; border: 0; border-radius: 6px; background: transparent; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.chip-btn.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--panel-shadow); }
.conv { padding: 7px 10px; border-bottom: 1px solid var(--line); cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "top foot" "prev prev"; align-items: baseline; column-gap: 8px; width: 100%; text-align: left; border-radius: 0; border-width: 0 0 1px; font-weight: 400; white-space: normal; background: transparent; }
.conv:hover { background: var(--sunken); }
.conv-swipe { position: relative; overflow: hidden; border-radius: 8px; }
.conv-swipe .conv { position: relative; background: var(--surface); transition: transform .18s ease-out; touch-action: pan-y; }
.conv-swipe .conv:hover, .conv-swipe .conv.on { background: var(--sunken); }
.conv-action { position: absolute; top: 0; right: 0; bottom: 0; width: 112px; border: 0; border-radius: 0; background: var(--accent); color: var(--carbono); font-weight: 600; }
.conv-swipe:not(.open) .conv-action { visibility: hidden; }
.conv.on { background: var(--sunken); box-shadow: inset 3px 0 0 var(--beam); }
.conv .top { grid-area: top; display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 600; }
.conv .top>span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .prev { grid-area: prev; color: var(--ink-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { padding: 11px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.thread > .note { margin: 10px 16px 0; }
.msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; background: var(--surface); min-height: 0; }
.conversation-live { display:flex; align-items:center; flex-wrap:wrap; gap:8px 16px; }
.conversation-warnings { flex:none; }
.conversation-warnings:empty { display:none; }
.conversation-warnings>.note { margin:10px 16px 0; }
.handoff-summary { margin:8px 16px; font-size:12px; }
.handoff-summary summary { cursor:pointer; font-weight:600; }
.handoff-summary dl { margin-top:8px; max-height:180px; overflow:auto; }
.handoff-summary dd { margin:0; overflow-wrap:anywhere; }
.reply-suggestion { display:flex; flex-direction:column; align-items:center; gap:3px; }
.reply-suggestion span { font-size:10px; }
.conv-assignee { max-width:90px; color:var(--ink-2); font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.conv-foot { grid-area:foot; display:flex; align-items:center; gap:8px; }
.inbox-pagination { display:flex; align-items:center; flex-direction:column; gap:8px; padding:12px 4px; }
.history-more { align-self:center; flex:none; }
.quick-replies-list { display:flex; flex-direction:column; gap:12px; max-height:42dvh; overflow:auto; }
.quick-reply-item { border:1px solid var(--line); border-radius:var(--r-panel); padding:12px; }
.quick-reply-item p { white-space:pre-wrap; overflow-wrap:anywhere; max-height:140px; overflow:auto; font-size:13px; }
.send { flex-wrap:wrap; }
.send textarea { flex:1; min-width:0; width:auto; }
.compose-tools { display:flex; flex-wrap:wrap; align-items:center; gap:8px; flex-basis:100%; }
.compose-tools .reply-suggestion { flex-direction:row; gap:6px; }
.conv-foot>.muted { flex-shrink:0; }
.conv-foot>.conv-assignee { min-width:0; }
.conversation-assignment { display:grid; gap:8px; padding-bottom:14px; border-bottom:1px solid var(--line); }
.conversation-assignment h3,.conversation-assignment p { margin:0; }
.conversation-assignment select { width:100%; min-width:0; }
.conversation-assignment small { font-size:11px; }
.msg { max-width: min(74%, 620px); padding: 7px 11px; border-radius: 12px 12px 12px 4px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--line); align-self: flex-start; }
.msg.out { align-self: flex-end; border-radius: 12px 12px 4px 12px; background: var(--sunken); border-color: transparent; }
/* Resposta de atendente humano: mesma família de cor, só com contorno, para distinguir da IA. */
.msg.humano { background: var(--surface); border-color: var(--ink-2); }
.msg .meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.msg .meta button { font-size: 11.5px; padding: 0 4px; }
.why { align-self: flex-end; max-width: min(78%, 560px); width: 100%; background: var(--surface); border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; }
.why dt { color: var(--ink-2); font-size: 12.5px; margin-top: 8px; }
.why dt:first-child { margin-top: 0; }
.why dd { margin: 2px 0 0; }
.send { padding: 10px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: flex-end; }
.send textarea { min-height: 42px; height: 42px; }
.original-media { display:flex; flex-direction:column; align-items:flex-start; gap:8px; margin-top:8px; }
.original-media img,.original-media video { max-width:100%; max-height:260px; border-radius:var(--r-panel); object-fit:contain; }
.original-media audio { width:min(280px,100%); }
.attachment-picker { flex:none; padding:0 12px 10px; border-top:1px solid var(--line); }
.attachment-picker summary { cursor:pointer; color:var(--ink-2); font-size:12px; padding-top:8px; }
.attachment-controls { display:flex; align-items:center; flex-wrap:wrap; gap:8px; padding-top:8px; }
.attachment-controls input { min-width:0; max-width:100%; flex:1 1 180px; font-size:12px; }
.attachment-controls>span { flex:1 1 160px; overflow-wrap:anywhere; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; overflow-wrap: break-word; min-width: 0; }
.kv.stacked { grid-template-columns: 1fr; gap: 0; }
.kv.stacked dt { font-weight: 600; color: var(--ink); margin-top: 8px; }
.kv.stacked dt:first-child { margin-top: 0; }
.kv.stacked dd { color: var(--ink-2); }
.only-mobile { display: none; }

/* ---------- Gaveta ---------- */
.more { position:relative; display:inline-flex; }
.more-btn { min-width:30px; padding-left:0; padding-right:0; font-size:16px; line-height:1; }
.more-menu { position:fixed; z-index:40; min-width:190px; display:grid; padding:5px; background:var(--surface); border:1px solid var(--line); border-radius:10px; box-shadow:0 14px 34px var(--scrim); }
.more-menu[hidden] { display:none; }
.more-menu button, .more-menu a { display:block; width:100%; padding:8px 10px; border:0; border-radius:6px; background:none; color:var(--ink); font-size:13px; font-weight:400; text-align:left; text-decoration:none; }
.more-menu button:hover, .more-menu a:hover { background:var(--sunken); }
.more-menu button.danger { color:var(--bad); }
.more-menu label.check { padding:8px 10px; margin:0; font-size:13px; border-radius:6px; }
.more-menu label.check:hover { background:var(--sunken); }
.drawer > form { display:flex; flex-direction:column; }
.drawer > form > button { align-self:flex-start; }
.drawer { width: min(520px, 100%); height: 100%; background: var(--surface); padding: 22px 24px 32px; overflow-y: auto; animation: slide .18s ease-out; border-radius: var(--r-frame); }
.drawer-modal { position:fixed; inset:10px 10px 10px auto; margin:0; max-width:calc(100% - 20px); max-height:calc(100dvh - 20px); height:calc(100dvh - 20px); color:var(--ink); border:1px solid var(--line); }
.drawer-modal::backdrop,.confirm-dialog::backdrop { background:var(--scrim); }
.confirm-dialog { width:min(480px,calc(100% - 32px)); max-height:calc(100dvh - 32px); padding:22px; color:var(--ink); background:var(--surface); border:1px solid var(--line); border-radius:var(--r-panel); overflow:auto; }
.confirm-dialog .row { justify-content:flex-end; margin-top:18px; }
.connection-notice { position:fixed; top:8px; left:50%; transform:translateX(-50%); width:max-content; max-width:calc(100% - 24px); padding:10px 16px; border:1px solid var(--warn); background:var(--surface); color:var(--ink); border-radius:var(--r-control); z-index:30; font-size:12px; box-shadow:var(--panel-shadow); }
.connection-notice[hidden] { display:none; }
.canvas { position:relative; }
.page-beam { position:fixed; top:0; left:0; right:0; z-index:60; height:2px; background:var(--accent); transform-origin:left; animation:beam 1.6s cubic-bezier(.2,.7,.2,1) forwards; }
@keyframes beam { from { transform:scaleX(0); } to { transform:scaleX(.92); } }
.page-loading { position:fixed; inset:0; z-index:25; display:grid; align-content:start; gap:10px; padding:16px; background:var(--bg); animation:fade .2s ease-out; }
@keyframes fade { from { opacity:0; } }
@keyframes rise { from { opacity:0; transform:translateY(8px); } }
@keyframes pop { from { opacity:0; transform:scale(.96); } }
/* Troca de tela: o conteúdo novo sobe e aparece, em sequência curta. */
/* backwards, não both: transform que sobra no fim prende menus de posição fixa dentro do painel. */
.stage.enter>* { animation:rise .26s cubic-bezier(.2,.7,.2,1) backwards; }
.stage.enter>*:nth-child(2) { animation-delay:.04s; }
.stage.enter>*:nth-child(n+3) { animation-delay:.08s; }
.entry-auth-card, .public>main, .lp-hero { animation:rise .3s cubic-bezier(.2,.7,.2,1) both; }
/* Aberturas: menus, abas, painéis e seções aparecem sem salto. */
.more-menu, .user-menu { transform-origin:top right; animation:pop .14s ease-out; }
.tab-body>* { animation:fade .18s ease-out; }
details[open]>:not(summary) { animation:rise .2s ease-out; }
.confirm-dialog { animation:pop .16s ease-out; }
/* Troca de tema: a tela antiga fica parada e a nova se revela por cima, sem o cruzamento padrão. */
.theme-switch::view-transition-old(root), .theme-switch::view-transition-new(root) { animation:none; mix-blend-mode:normal; }
.theme-switch::view-transition-new(root) { z-index:1; }
/* Ao escurecer, é a tela clara que fica por cima e se recolhe. */
.theme-darken::view-transition-old(root) { z-index:2; }
.drawer-modal::backdrop, .confirm-dialog::backdrop { animation:fade .18s ease-out; }
button, .button-link, .conv, .tab, .rail a, .chip-btn, input, select, textarea { transition:background-color .14s, border-color .14s, color .14s, box-shadow .14s; }
button:active { transform:scale(.98); }
/* Ação em andamento: o botão responde no toque, antes do servidor. */
[aria-busy="true"] { position:relative; pointer-events:none; color:transparent !important; }
[aria-busy="true"]::after { content:""; position:absolute; inset:0; margin:auto; width:14px; height:14px; border-radius:50%; border:2px solid var(--ink-2); border-top-color:transparent; animation:spin .7s linear infinite; }
button.primary[aria-busy="true"]::after { border-color:var(--carbono); border-top-color:transparent; }
@keyframes spin { to { transform:rotate(360deg); } }
.canvas>.page-loading { position:absolute; }
.page-loading i { height:14px; border-radius:7px; background:linear-gradient(90deg,var(--sunken),var(--line),var(--sunken)); background-size:200% 100%; animation:shimmer 1.3s linear infinite; }
.page-loading i:nth-child(1) { width:38%; height:22px; }
.page-loading i:nth-child(2) { height:72px; border-radius:var(--r-panel); }
.page-loading i:nth-child(3) { width:82%; }
.page-loading i:nth-child(4) { width:56%; }
@keyframes shimmer { to { background-position:-200% 0; } }
.typing { display:inline-flex; gap:5px; align-items:center; }
.typing i { width:6px; height:6px; border-radius:50%; background:var(--beam); animation:typing 1.2s infinite; }
.typing i:nth-child(2) { animation-delay:.15s; }
.typing i:nth-child(3) { animation-delay:.3s; }
@keyframes typing { 0%,60%,100% { opacity:.3; transform:none; } 30% { opacity:1; transform:translateY(-3px); } }
.page-problem { min-height:100dvh; display:grid; place-items:center; padding:24px; background:var(--bg); }
.page-problem>.panel { width:min(520px,100%); padding:28px; }
.page-problem h1 { margin:20px 0 14px; }
.pwa-controls { display:flex; gap:8px; flex-wrap:wrap; }
.pwa-controls:empty { display:none; }
.user-menu .pwa-controls { display:grid; }
@media(max-width:760px) { .drawer-modal { inset:0; width:100%; max-width:100%; height:100dvh; max-height:100dvh; border-radius:0; } .confirm-dialog button { min-height:44px; } }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.exit { display: grid; grid-template-columns: 150px 1fr auto; gap: 8px; margin-bottom: 8px; }

/* ---------- Trabalho em andamento ---------- */
.working { display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--frame); color: var(--frame-ink); border: 1px solid var(--frame-line); border-radius: var(--r-panel); }
.working i { flex: none; width: 34px; height: 3px; border-radius: 2px; background: var(--accent); animation: sweep 1.1s ease-in-out infinite alternate; transform-origin: left center; }
@keyframes sweep { from { transform: scaleX(.25); opacity: .5; } to { transform: scaleX(1); opacity: 1; } }

/* ---------- Entrada ---------- */
.login { height:100vh; height:100dvh; display:grid; grid-template-columns:minmax(0,1fr) minmax(300px,420px); padding:48px max(32px,calc((100vw - 1100px)/2)); gap:64px; background:var(--bg); overflow:auto; align-items:center; }
.login .brand { color:var(--ink); padding:0; display:flex; flex-direction:column; justify-content:space-between; gap:70px; }
.login .brand h1 { font-size:48px; line-height:1.1; letter-spacing:-.025em; max-width:16ch; }
.login .brand .ray { width: 120px; height: 5px; background: var(--accent); border-radius: 3px; transform: rotate(-24deg); transform-origin: left; margin: 0 0 56px 4px; }
.login .box { background:var(--surface); border:1px solid var(--line); border-radius:var(--r-panel); padding:28px; }
.login form { width:100%; padding:0; }
.login .box h1 { font-size:26px; text-align:center; margin-bottom:10px; }
.login .box p { text-align:center; }
.login form>button.primary { width:100%; margin-top:4px; }
.login .wordmark { padding: 0; }
.login .brand-logo { width: 168px; }

#toast { position: fixed; left: 50%; bottom: 64px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: calc(100% - 24px); z-index: 40; pointer-events: none; }
#toast div { background: var(--carbono); color: var(--gelo); padding: 8px 16px; border-radius: 18px; max-width: 420px; border: 1px solid #2A3036; font-weight: 500; animation: toast-in .18s ease-out; }
#toast div.err { border-color: #F2918A; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.qr { width: 240px; height: 240px; display: block; margin: 8px 0; border-radius: 10px; background: #fff; padding: 8px; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } [aria-busy="true"] { color: inherit !important; opacity: .6; } [aria-busy="true"]::after { content: none; } }

@media (max-width: 1180px) {
  /* A situação do roteiro cede lugar ao título e às ações antes que eles se sobreponham. */
  .topbar-context { display:none; }
  .inbox { grid-template-columns: 260px minmax(0, 1fr); }

  th, td { padding-left: 6px; padding-right: 6px; }
}
@media (max-width: 760px) {
  :root { --gap: 10px; }
  .stage.layout, .stage.layout.half { display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; }
  .pane { flex: none; overflow: visible; }
  .panel { padding: 14px; }
  label.field { margin-bottom: 10px; }
  textarea { min-height: 72px; }
  .panel:not(.overview-health) > h2:first-child, .panel > .row.spread:first-child:not(.item) { padding-bottom: 10px; margin-bottom: 12px; }
  .stage.fill > * { flex: none; }
  .stage.fill > .inbox, .stage.fill > .roteiro { flex: 1; min-height: 0; }

  .inbox, .inbox.two { grid-template-columns: minmax(0, 1fr); height: 100%; }
  .inbox.two { grid-template-rows: minmax(220px, 2fr) minmax(0, 1fr); }
  .inbox .list { border-right: 0; min-height: 0; }
  .inbox .thread { height: 100%; min-height: 0; }
  .inbox.two .side { border-left: 0; border-top: 1px solid var(--line); }
  .inbox:not(.two):not(.open) .thread, .inbox:not(.two).open .list { display:none; }
  .inbox:not(.two) { gap:0; }
  .only-mobile { display: inline-block; }
  .inspector .cols, .exit { grid-template-columns: 1fr; }
  .roteiro { display: flex; flex-direction: column; overflow-y: auto; }
  .playbook-stages { flex:none; min-height:0; }
  .playbook-stages>.inspector { overflow:visible; }
  .inspector .cols>.stack { grid-template-columns:1fr; }
  .roteiro .flow-wrap { height: 100%; }
  .roteiro > .inspector, .roteiro > .tabbed { flex: none; overflow: visible; }
  .qr { max-width: 100%; height: auto; aspect-ratio: 1; }
  .login { grid-template-columns: 1fr; height: auto; min-height: 100dvh; }
  .login .brand { padding: 24px; min-height: 200px; }
  .login .brand h1 { font-size: 30px; }
  .login .box { padding: 24px 0; }
}

@media (max-width: 600px) {
  .responsive-table, .responsive-table tbody { display: block; width: 100%; }
  .responsive-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .responsive-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .responsive-table tbody tr:last-child { border-bottom: 0; }
  .responsive-table td { display: block; min-width: 0; padding: 0; border: 0; white-space: normal; overflow-wrap: anywhere; }
  .responsive-table td:first-child, .responsive-table td.actions { grid-column: 1 / -1; }
  .responsive-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 3px; font-size: 11px; font-weight: 500; color: var(--ink-2); }
  .responsive-table td.actions { text-align: left; }
  .responsive-table td.actions .row { justify-content: flex-start; }
}

@media (max-height: 800px) and (min-width: 761px) {
  .panel { padding: 10px 14px; }
  .panel:not(.overview-health) > h2:first-child, .panel > .row.spread:first-child:not(.item) { padding-bottom: 6px; margin-bottom: 8px; }
  .panel.overview-health { padding:10px 16px; }
  label.field { margin-bottom: 10px; }
  textarea:not(.tall) { min-height: 64px; }
}

/* Telas de fora do painel e avisos com link para copiar */
.quiet-link { display: inline-block; margin-top: 14px; font-size: 13px; color: var(--ink-2); }
.note input[readonly] { width: 100%; margin-top: 8px; font-size: 12.5px; }
.note p { margin: 4px 0 0; }
.mail-body { white-space: pre-wrap; font: inherit; font-size: 12.5px; color: var(--ink-2); margin: 8px 0 0; max-width: 60ch; }
td .muted { font-size: 12.5px; }

/* Como responde: pergunta do cliente e resposta da agente, lado a lado como no WhatsApp */
.preview-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); align-content: start; }
.preview-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 12px; align-content: start; }
.preview-card.approved { border-color: var(--beam); }
.preview-chat { display: flex; flex-direction: column; gap: 6px; background: var(--bg); border-radius: 10px; padding: 12px; }
.preview-chat .msg { max-width: 88%; }
.preview-chat .msg.in { align-self: flex-start; }
.preview-card .adjust { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.preview-card .adjust[hidden] { display: none; }
.button-link { display: inline-block; font-weight: 600; }

/* Páginas que o cliente da empresa abre por link */
.public { min-height: 100dvh; background: var(--bg); display: grid; grid-template-rows: auto 1fr; }
.public > header { background: var(--frame); color: var(--frame-ink); padding: 14px 24px; }
.public > main { width: min(760px, 100%); margin: 0 auto; padding: 28px 20px 56px; display: grid; gap: 18px; align-content: start; }
.public .intro h1 { font-size: 26px; line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 8px; }
.public .intro p { max-width: 62ch; margin: 0; }
.public .stack { display: grid; gap: 16px; }
.public .preview-list { grid-template-columns: 1fr; }
.public textarea[hidden] { display: none; }
.connect-page { max-width:460px; margin-inline:auto; }
.connect-steps { list-style:none; counter-reset:step; display:grid; gap:12px; margin:8px 0; padding:0; }
.connect-steps li { counter-increment:step; display:grid; grid-template-columns:28px 1fr; gap:10px; align-items:start; }
.connect-steps li::before { content:counter(step); display:grid; place-items:center; width:26px; height:26px; border-radius:50%; background:var(--accent); color:var(--carbono); font-size:13px; font-weight:700; }
.connect-steps b { display:block; }
.connect-steps span { color:var(--ink-2); }
.briefing { width:100%; max-width:640px; margin-inline:auto; }
.briefing .field[hidden] { display:none; }
.briefing .field>span { font:600 19px/1.25 var(--font-display); color:var(--ink); }
.briefing textarea { min-height:200px; }
.briefing-bar { height:4px; border-radius:4px; background:var(--sunken); overflow:hidden; }
.briefing-bar i { display:block; height:100%; background:var(--accent); transition:width .2s; }
.preview-card button[aria-pressed="true"] { background:var(--accent); border-color:var(--accent); color:var(--carbono); font-weight:600; }
.preview-card[data-choice="change"] { border-color:var(--warn); }
.approval-bar { position:sticky; bottom:8px; z-index:5; align-items:end; box-shadow:0 -6px 24px var(--scrim); }
.approval-count { flex-basis:100%; }
.connect-page h1 { margin-bottom:12px; }
.connect-page .qr { margin:0 auto; }
.connect-page p { margin-left:auto; margin-right:auto; }
.shell[data-page="whatsapp"] td.actions .row { flex-wrap:wrap; }

/* O dock vira um acesso rápido no celular; todos os destinos seguem no menu. */
@media (max-width:1000px) {
  .topbar-context { display:none; }
  .overview>.overview-attention,.overview>.overview-funnel { grid-column:span 6; }
  .overview>.overview-usage { grid-column:1/-1; }
  .inbox:not(.open):has(.thread>.empty) { grid-template-columns:minmax(0,1fr); }
  .inbox:not(.open):has(.thread>.empty)>.thread { display:none; }
  .rail a { min-width:34px; padding:0; }
  .rail a .label { display:none; }
  .overview-health { flex-direction:column; align-items:stretch; gap:12px; }
}
@media (max-width:760px) {
  .shell { grid-template-rows:auto minmax(0,1fr) auto; }
  .topbar { flex-wrap:wrap; min-height:44px; padding:0 8px; gap:6px; row-gap:0; }
  .home-brand { display:none; }
  .company-switcher { flex:none; max-width:130px; }
  .head { display:contents; }
  .head>div:first-child { flex:1; padding-left:4px; border-left:0; }
  .head h1 { flex:1; min-width:0; font-size:17px; overflow:hidden; text-overflow:ellipsis; }
  .head>.row { order:10; flex-basis:100%; justify-content:flex-start; overflow-x:auto; padding-bottom:6px; }
  .head>.row:has(>:is(button,a):only-child), .head>.row:has(.conversation-live) { order:0; flex-basis:auto; padding-bottom:0; }
  .conversation-live [role=status] { display:none; }
  .user-details { display:none; }
  .user-btn { padding:8px; }
  .canvas { padding:6px 6px 0; gap:6px; }
  .head select { max-width:180px; }
  .dock-area { padding:2px 6px 2px; }
  .rail { display:none; }
  .mobile-shortcuts { display:flex; justify-content:space-around; align-items:center; width:min(460px,100%); height:54px; border:1px solid var(--line); background:var(--surface); border-radius:12px; padding:5px; }
  .mobile-shortcuts a { position:relative; text-decoration:none; display:flex; align-items:center; gap:5px; flex-direction:column; font-size:10px; color:var(--ink-2); padding:2px 8px; }
  .mobile-shortcuts a.on { color:var(--accent-ink); }
  .mobile-shortcuts .count { position:absolute; right:0; top:0; }
  .nav-backdrop { position:absolute; inset:0; background:var(--scrim); z-index:10; }
  .nav-open .nav-backdrop { display:block; }
  .nav-open .rail { display:flex; position:absolute; bottom:80px; left:16px; right:16px; height:auto; max-height:calc(100% - 100px); flex-direction:column; padding:16px; gap:12px; overflow:auto; z-index:11; }
  .rail-head { display:flex; align-items:center; justify-content:space-between; }
  .mobile-nav-close { display:grid; }
  .rail-links,.rail .group { display:flex; flex-direction:column; align-items:stretch; gap:4px; }
  .rail a { flex-direction:row; justify-content:flex-start; gap:12px; width:100%; height:auto; min-height:40px; padding:8px 12px; }
  .rail a .label { display:block; font-size:13px; white-space:normal; }
  .group-label { display:block; font:600 11px var(--font); letter-spacing:.08em; text-transform:uppercase; color:var(--ink-2); padding:8px 12px 2px; }
  .rail a .count { position:static; margin-left:auto; }
  .rail .group+.group { margin:4px 0 0; padding:4px 0 0; border-left:0; border-top:1px solid var(--line); }
  .overview { display:flex; flex-direction:column; overflow:visible; }
  .stage:has(>.overview) { overflow:auto; }
  .overview-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .tile { flex-direction:row; align-items:baseline; justify-content:space-between; padding:7px 10px; border-bottom:1px solid var(--line); }
  .tile b { font-size:17px; }
  .overview-health { gap:14px; }
  .health-items { flex-direction:column; gap:10px; }
  .inbox.two { gap:12px; }
  .inbox.details-open:not(.two)>.side { width:100%; }
  .login { padding:24px 16px; gap:24px; height:100dvh; grid-template-rows:auto minmax(0,1fr); }
  .login .brand { padding:0; min-height:0; gap:0; }
  .login .brand>div:last-child { display:none; }
  .login .box { align-self:start; padding:24px 20px; }
  .public>main { padding:20px 16px 32px; }
}
@media (max-width:420px) {
  .company-pick { font-size:12px; padding-left:4px; }
  .head button { font-size:12px; padding:7px 9px; }
  .panel>.row.spread:first-child { gap:8px; }
}
/* Autenticador: configuração local e códigos com leitura preservada em telas pequenas. */
.mfa-form { display: grid; gap: 12px; min-width: 0; }
.mfa-form h2, .mfa-form p { margin: 0; }
.mfa-key { font-family: monospace; font-size: .85rem; letter-spacing: .04em; }
.mfa-recovery { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.mfa-recovery code { overflow-wrap: anywhere; text-align: center; font-size: .85rem; }
