/* Mesa: menu lateral com a marca do consultório, barra de topo com o WhatsApp ao vivo e a área de trabalho.
   A cor do consultório entra por --t, definida pelo app a partir da configuração do cliente. */
:root {
  --ground: #F5F3F1;
  --surface: #FFFFFF;
  --sunk: #EFECE9;
  --ink: #1D1719;
  --muted: #6A5F62;
  --line: #E3DDDA;
  --t: #8A2B50; --t-ink: #FFFFFF; --t-tint: #F6E8EE; --t-soft: #FBF4F7;
  --ok: #17845E; --ok-tint: #E2F3EB; --ok-ring: rgba(23, 132, 94, .5);
  --ask: #9A6200; --ask-tint: #FCF0D9;
  --tell: #3E5F94; --tell-tint: #E7EEF8;
  --stop: #B03A22; --stop-tint: #FBE8E2;
  --ph1: #B4567C; --ph2: #7A5BA6; --ph3: #2E8A74;
  --shadow: rgba(40, 20, 28, .08);
  --shadow-2: rgba(40, 20, 28, .16);
  --glass: rgba(245, 243, 241, .88);
  --display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", sans-serif;
  --ui: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #120F10; --surface: #1B1719; --sunk: #161314; --ink: #EFE7E9; --muted: #A99BA0; --line: #2F282B;
    --t-ink: #1D0E15; --t-tint: #33202A; --t-soft: #221A1E;
    --ok: #6FD7B0; --ok-tint: #12281F; --ok-ring: rgba(111, 215, 176, .45); --ask: #F2C374; --ask-tint: #2D2413;
    --tell: #9FBAEA; --tell-tint: #182339; --stop: #F4A890; --stop-tint: #351A11;
    --ph1: #E58BB0; --ph2: #B9A0E3; --ph3: #74CDB6;
    --shadow: rgba(0,0,0,.45); --shadow-2: rgba(0,0,0,.6); --glass: rgba(18, 15, 16, .86);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--ui); font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--display); margin: 0; text-wrap: balance; }
p, ul, ol, dl { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--t); outline-offset: 2px; }
code { font-family: var(--mono); font-size: .88em; }

@keyframes pulso { 0% { box-shadow: 0 0 0 0 var(--ok-ring); } 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes acende { from { box-shadow: 0 0 0 4px var(--t-tint); border-color: var(--t); } to { box-shadow: 0 1px 2px var(--shadow); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-box { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 26px; display: grid; gap: 10px; box-shadow: 0 10px 40px var(--shadow); }
.login-box h1 { font-size: 24px; margin: 8px 0 4px; }
.login-box label { font-size: 13px; font-weight: 650; color: var(--muted); }
.login-marca { display: flex; gap: 10px; align-items: center; }
.login-marca .av { width: 38px; height: 38px; border-radius: 12px; background: var(--t); color: var(--t-ink); display: grid; place-items: center; font-family: var(--display); font-weight: 800; }
.login-marca b { display: block; font-family: var(--display); font-size: 16px; line-height: 1.1; }
.login-marca small { font-size: 11.5px; color: var(--muted); }
.login-box input[readonly] { background: var(--sunk); color: var(--muted); }
.login-dica { text-align: center; margin-top: 2px; }
.login-box.permissao { width: min(520px, 100%); }
.doc { max-width: 720px; margin: 0 auto; padding-block: 32px 56px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 14px; line-height: 1.6; }
.doc h1 { font-size: clamp(26px, 5vw, 36px); margin-top: 12px; }
.doc h2 { font-size: 18px; margin-top: 14px; }
.doc ul { padding-left: 20px; display: grid; gap: 6px; margin: 0; }
.doc p { margin: 0; max-width: 68ch; }
.doc-lead { color: var(--muted); font-size: 16px; }
.pagina-marca { background: #FBF8F7; color: #1E2422; color-scheme: light; }
.doc-marca { --muted: #5C6461; --line: #E6DEDF; gap: 16px; }
.doc-marca h1, .doc-marca h2 { font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif; color: var(--marca); font-weight: 600; letter-spacing: .01em; }
.doc-marca h1 { font-size: clamp(30px, 6vw, 44px); margin-top: 4px; }
.doc-marca h2 { font-size: 24px; margin-top: 18px; }
.doc-marca a { color: var(--marca); }
.doc-marca ul li::marker { color: var(--marca-clara); }
.marca-topo { display: grid; justify-items: center; padding-block: 8px 4px; }
.marca-logo { width: min(240px, 62vw); height: auto; }
.marca-rotulo { justify-self: center; text-align: center; font-size: 12.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: color-mix(in srgb, var(--marca-clara), #000 40%); }
.doc-marca > h1 { text-align: center; }
.doc-marca > .doc-lead { text-align: center; justify-self: center; color: #4B5250; }
.marca-acoes { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: center; margin-block: 6px 4px; }
.marca-acoes span { font-size: 13.5px; color: #5C6461; }
.marca-botao { display: inline-block; background: var(--marca); color: #FFFFFF !important; text-decoration: none; font-weight: 700; padding: 11px 22px; border-radius: 999px; }
.marca-botao:hover { background: color-mix(in srgb, var(--marca) 85%, #000); }
.doc-marca .doc-pe { text-align: center; max-width: none; border-top-color: var(--marca-clara); }
.doc-pe { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.permissao-form { display: grid; gap: 10px; }
.permissao-quem { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.permissao-alerta { background: var(--ask-tint, #FCF0D9); color: var(--ink); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; font-weight: 600; }
.permissao-listas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.permissao-listas h2 { font-size: 14px; margin: 0 0 4px; }
.permissao-listas ul { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--muted); display: grid; gap: 4px; }
.permissao-caixa { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; font-size: 13.5px; font-weight: 500; color: var(--ink); }
.permissao-caixa input { width: 18px; height: 18px; margin-top: 2px; }
.permissao-botoes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.permissao-opcoes { display: grid; gap: 8px; }
.permissao-opcoes a { text-decoration: none; text-align: center; }
@media (max-width: 520px) { .permissao-listas { grid-template-columns: 1fr; } }
.erro { color: var(--stop); font-size: 13px; min-height: 1.2em; }

.campo, .login-box input { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 11px; padding: 10px 12px; }
.campo:focus, .login-box input:focus { outline: none; border-color: var(--t); box-shadow: 0 0 0 3px var(--t-tint); }
textarea.campo { resize: vertical; min-height: 84px; line-height: 1.45; }

/* ---------- casca ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100%; }
.side { position: sticky; top: 0; align-self: start; height: 100vh; background: var(--surface); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 18px; }
.marca { display: grid; grid-template-columns: 42px 1fr; gap: 11px; align-items: center; padding: 2px 4px; }
.marca .av { width: 42px; height: 42px; border-radius: 13px; background: var(--t); color: var(--t-ink); display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: .02em; }
.marca b { display: block; font-family: var(--display); font-size: 15.5px; line-height: 1.12; }
.marca small { font-size: 11.5px; color: var(--muted); }
.troca { position: relative; }
.troca > button { width: 100%; border: 1px dashed var(--line); background: none; border-radius: 10px; padding: 6px 10px; font-size: 12px; color: var(--muted); cursor: pointer; text-align: left; }
.tlist { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px var(--shadow-2); padding: 6px; z-index: 30; display: grid; gap: 2px; }
.tlist button { display: grid; grid-template-columns: 26px 1fr auto; gap: 9px; align-items: center; text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 9px; cursor: pointer; }
.tlist button:hover { background: var(--sunk); }
.tlist .av { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 10.5px; color: #fff; font-family: var(--display); background: var(--muted); }
.menu { display: grid; gap: 3px; }
.menu button { display: flex; align-items: center; gap: 11px; width: 100%; border: 0; background: none; text-align: left; padding: 9px 11px; border-radius: 11px; cursor: pointer; font-weight: 600; color: var(--ink); }
.menu button:hover { background: var(--t-soft); }
.menu button[aria-current="true"] { background: var(--t-tint); color: var(--t); }
.menu svg { width: 18px; height: 18px; flex: none; }
.menu .badge { margin-left: auto; font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 99px; background: var(--t); color: var(--t-ink); font-variant-numeric: tabular-nums; }
.canal-lado { margin-top: auto; }
.canal-lado .online { width: 100%; border-radius: 14px; padding: 10px 12px; align-items: center; text-align: left; }
.canal-lado .online span { display: grid; gap: 1px; min-width: 0; }
.canal-lado .online b { font-size: 13px; }
.canal-lado .online small { font-size: 11.5px; font-weight: 600; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot { display: flex; justify-content: space-between; gap: 8px; padding: 0 4px; font-size: 12px; color: var(--muted); align-items: center; }
.link { border: 0; background: none; color: var(--muted); cursor: pointer; text-decoration: underline; padding: 0; font-size: 12px; }

.work { min-width: 0; padding: 24px 24px 80px; display: grid; gap: 18px; align-content: start; }
.topbar { position: sticky; top: 0; z-index: 12; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 14px 12px; background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); margin-inline: -24px; padding-inline: 24px; flex-wrap: wrap; }
.ctx { display: flex; flex-wrap: wrap; gap: 6px; }
.ctx span { font-size: 12px; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 3px 11px; color: var(--muted); }
.ctx b { color: var(--ink); font-weight: 700; }
.canal-wrap { position: relative; }
.online { display: inline-flex; align-items: center; gap: 9px; border: 1px solid var(--ok); background: var(--ok-tint); color: var(--ok); border-radius: 99px; padding: 6px 14px 6px 11px; font-weight: 750; font-size: 13px; cursor: pointer; }
.online i { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); animation: pulso 1.8s ease-out infinite; flex: none; }
.online small { font-weight: 600; opacity: .8; }
.online.off { border-color: var(--stop); background: var(--stop-tint); color: var(--stop); }
.online.off i { background: var(--stop); animation: none; }
.online.nao { border-color: var(--line); background: var(--sunk); color: var(--muted); }
.online.nao i { background: var(--muted); animation: none; }
.pop { position: absolute; right: 0; top: calc(100% + 8px); width: min(320px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px var(--shadow-2); padding: 14px; display: grid; gap: 10px; z-index: 35; }
.pop h3 { font-size: 15px; }

.head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-end; justify-content: space-between; padding-top: 6px; }
.head h1 { font-size: clamp(1.5rem, 3vw, 2.05rem); letter-spacing: -.025em; line-height: 1.05; }
.head p { color: var(--muted); font-size: 14px; max-width: 68ch; margin-top: 6px; }

/* ---------- peças ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: grid; gap: 3px; box-shadow: 0 1px 2px var(--shadow); }
.kpi .lab { font-size: 12px; color: var(--muted); font-weight: 600; display: flex; gap: 7px; align-items: center; }
.kpi .lab i { width: 8px; height: 8px; border-radius: 3px; background: var(--t); }
.kpi .lab i.ask { background: var(--ask); } .kpi .lab i.ok { background: var(--ok); } .kpi .lab i.tell { background: var(--tell); }
.kpi b { font-family: var(--display); font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: 0 1px 2px var(--shadow); }
.ph { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.ph h2 { font-size: 16px; }
.sub { font-size: 12.5px; color: var(--muted); }
.row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 11px 18px; border-top: 1px solid var(--line); }
.rows > .row:first-child { border-top: 0; }
.row .txt { min-width: 0; display: grid; gap: 1px; }
.row .txt b { font-weight: 650; font-size: 14px; }
.row .txt span { font-size: 12.5px; color: var(--muted); }
.row .fim { display: flex; gap: 6px; align-items: center; }
.vazio { color: var(--muted); font-size: 13px; padding: 18px; text-align: center; }
.duas { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(0,1fr); gap: 16px; align-items: start; }
.mini { font-size: 12.5px; color: var(--muted); }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.chip.faz { background: var(--ok-tint); color: var(--ok); }
.chip.pede { background: var(--ask-tint); color: var(--ask); }
.chip.avisa { background: var(--tell-tint); color: var(--tell); }
.chip.trava, .chip.erro { background: var(--stop-tint); color: var(--stop); }
.chip.claude { background: var(--tell-tint); color: var(--tell); }
.claude-fez { list-style: none; padding: 0; margin: 0; display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
.claude-fez span { color: var(--ink); font-variant-numeric: tabular-nums; margin-right: 8px; }
.claude-fez em { font-style: normal; color: var(--muted); opacity: .85; }
.chip.cod, .chip.desligada { background: var(--sunk); color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 700; }
.ini { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--t-tint); color: var(--t); font-family: var(--display); font-weight: 800; font-size: 12px; flex: none; }

.b { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 7px 12px; cursor: pointer; font-weight: 650; font-size: 12.5px; white-space: nowrap; }
.b:hover { border-color: var(--t); color: var(--t); }
.b.p { background: var(--t); border-color: var(--t); color: var(--t-ink); }
.b.p:hover { color: var(--t-ink); filter: brightness(1.06); }
.b.sm { padding: 5px 10px; font-size: 12px; border-radius: 9px; }
.b.grande { padding: 11px 16px; font-size: 14.5px; margin-top: 6px; }
.b:disabled { opacity: .55; cursor: wait; }

/* ---------- quadro ---------- */
.fases { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.fase { flex: none; display: grid; gap: 7px; align-content: start; }
.fase > span { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; padding-left: 4px; display: flex; gap: 7px; align-items: center; }
.fase > span::before { content: ""; width: 16px; height: 3px; border-radius: 3px; background: currentColor; }
.ph1 { color: var(--ph1); } .ph2 { color: var(--ph2); } .ph3 { color: var(--ph3); }
.fase .cols { display: flex; gap: 11px; }
.col { width: 248px; background: var(--sunk); border: 1px solid var(--line); border-radius: 16px; display: flex; flex-direction: column; min-height: 340px; }
.col-h { padding: 11px 12px 8px; display: grid; gap: 7px; }
.col-h .t { display: flex; gap: 8px; align-items: baseline; }
.col-h .t .n { font-family: var(--display); font-weight: 800; font-size: 12px; }
.col-h .t b { font-family: var(--display); font-size: 14.5px; flex: 1; line-height: 1.15; }
.col-h .t .c { font-size: 11px; font-weight: 800; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 0 7px; }
.col-h .autos { display: flex; flex-wrap: wrap; gap: 4px; }
.col-h .autos .chip { font-size: 10.5px; padding: 1px 7px; font-weight: 700; }
.cards { display: grid; gap: 9px; padding: 2px 10px 12px; align-content: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 10px 11px; display: grid; gap: 7px; box-shadow: 0 1px 2px var(--shadow); }
.card.flash { animation: acende 1.4s ease-out; }
.card .top { display: flex; gap: 9px; align-items: center; }
.card .top .ini { width: 28px; height: 28px; font-size: 11px; }
.card .top b { font-size: 13.5px; flex: 1; min-width: 0; line-height: 1.2; }
.nomebtn { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: inherit; cursor: pointer; text-align: left; }
.nomebtn:hover { color: var(--t); text-decoration: underline; }
.card .meta { font-size: 11.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 3px 9px; }
.alerta { font-size: 11.5px; color: var(--ask); font-weight: 650; display: flex; gap: 6px; align-items: center; }
.alerta::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.card .acts { display: flex; flex-wrap: wrap; gap: 5px; }
.consulta-linha { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; font-size: 12px; font-weight: 650; }
.consulta-linha .chip { font-size: 10.5px; padding: 1px 7px; }
.semanas { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; }
.semanas i { height: 7px; border-radius: 3px; background: var(--line); }
.semanas i.sim { background: var(--ok); }
.semanas i.nao { background: var(--stop); }
.semanas i.agora { background: none; box-shadow: inset 0 0 0 1.5px var(--t); }
.semlab { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; }

/* ---------- pacientes ---------- */
.pac { display: grid; grid-template-columns: 300px minmax(0,1fr); gap: 16px; align-items: start; }
.lista { display: grid; gap: 8px; align-content: start; position: sticky; top: 76px; }
.lista .itens { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; max-height: 64vh; overflow-y: auto; }
.lista .it { width: 100%; display: grid; grid-template-columns: 32px 1fr auto; gap: 10px; align-items: center; text-align: left; border: 0; border-top: 1px solid var(--line); background: none; padding: 9px 12px; cursor: pointer; }
.lista .it:first-child { border-top: 0; }
.lista .it:hover { background: var(--t-soft); }
.lista .it[aria-current="true"] { background: var(--t-tint); }
.lista .it b { font-size: 13.5px; display: block; }
.lista .it small { font-size: 11.5px; color: var(--muted); }
.ficha { display: grid; gap: 14px; min-width: 0; }
.ficha-h { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; display: grid; grid-template-columns: 56px minmax(0,1fr) auto; gap: 14px; align-items: center; box-shadow: 0 1px 2px var(--shadow); }
.ficha-h .ini { width: 56px; height: 56px; font-size: 19px; }
.ficha-h h2 { font-size: 21px; letter-spacing: -.01em; }
.ficha-h p { font-size: 13px; color: var(--muted); }
.ficha-h .chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.secoes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.sec { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: grid; gap: 10px; align-content: start; box-shadow: 0 1px 2px var(--shadow); min-width: 0; }
.sec.larga { grid-column: 1 / -1; }
.sec-h { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.sec-h h3 { font-size: 15px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.linha { display: grid; grid-template-columns: 12px 1fr; gap: 10px; font-size: 13px; }
.linha .pt { width: 9px; height: 9px; border-radius: 50%; background: var(--t); margin-top: 6px; }
.linha span { color: var(--muted); font-size: 12px; display: block; }
.mover { display: flex; gap: 8px; flex-wrap: wrap; }
.mover select { flex: 1; min-width: 160px; }
.conversa { display: grid; gap: 8px; max-height: 360px; overflow-y: auto; padding-right: 4px; }

/* ---------- conversas, fila, automações ---------- */
.msgin { display: grid; gap: 7px; padding: 13px 18px; border-top: 1px solid var(--line); }
.msgin:first-child { border-top: 0; }
.bolha { background: var(--sunk); border-radius: 14px; border-top-left-radius: 4px; padding: 9px 12px; font-size: 13.5px; max-width: 60ch; white-space: pre-line; overflow-wrap: anywhere; }
.bolha.saida { background: var(--t-tint); border-top-left-radius: 14px; border-top-right-radius: 4px; justify-self: end; }
.regra { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.regra b { color: var(--ink); }
.regra .seta { color: var(--t); font-weight: 800; }
.regra.fim { justify-content: flex-end; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 13px; cursor: pointer; font-size: 13px; font-weight: 650; }
.tab[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--ground); }
.regras { display: grid; gap: 10px; }
.grupo-t { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 8px 4px 0; }
.rg { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 15px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px 14px; align-items: center; box-shadow: 0 1px 2px var(--shadow); }
.rg .q { display: grid; gap: 5px; min-width: 0; }
.rg .q b { font-size: 14px; }
.rg .ctl { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.linha-regra { font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pill { font-size: 12px; border-radius: 7px; padding: 2px 8px; background: var(--sunk); font-weight: 650; }
.pill.quando { background: var(--tell-tint); color: var(--tell); }
.pill.faz { background: var(--t-tint); color: var(--t); }
.autonomia { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.autonomia button { border: 0; background: none; padding: 6px 10px; font-size: 12px; font-weight: 650; cursor: pointer; color: var(--muted); }
.autonomia button + button { border-left: 1px solid var(--line); }
.autonomia button[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.autonomia button:disabled { opacity: .45; cursor: not-allowed; }
.sw { position: relative; width: 40px; height: 23px; border-radius: 99px; background: var(--sunk); border: 1px solid var(--line); cursor: pointer; flex: none; padding: 0; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: var(--muted); transition: left .15s ease; }
.sw[aria-pressed="true"] { background: var(--ok-tint); border-color: var(--ok); }
.sw[aria-pressed="true"]::after { left: 19px; background: var(--ok); }
.sw:disabled { cursor: not-allowed; opacity: .7; }
.stage-cfg { display: grid; grid-template-columns: 220px minmax(0,1fr); gap: 16px; }
.stage-list { display: grid; gap: 3px; align-content: start; }
.stage-list button { text-align: left; border: 1px solid transparent; background: none; padding: 8px 11px; border-radius: 10px; cursor: pointer; font-weight: 600; display: flex; gap: 9px; align-items: baseline; }
.stage-list button span { font-family: var(--display); color: var(--t); font-size: 12px; font-weight: 800; }
.stage-list button[aria-pressed="true"] { background: var(--surface); border-color: var(--line); box-shadow: 0 1px 3px var(--shadow); }
.cfg { display: grid; gap: 12px; align-content: start; min-width: 0; }
.cfg h3 { font-size: 18px; }
.cfg h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
pre.json { background: var(--sunk); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-family: var(--mono); font-size: 12px; overflow-x: auto; margin: 0; line-height: 1.5; }

/* ---------- caixa de entrada ---------- */
.inbox { display: grid; grid-template-columns: 300px minmax(0, 1fr) 320px; height: calc(100vh - 150px); min-height: 520px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: 0 1px 2px var(--shadow); }
.inbox-lista { border-right: 1px solid var(--line); display: grid; grid-template-rows: auto auto 1fr; gap: 8px; padding: 12px; min-height: 0; }
.inbox-abas { display: flex; gap: 4px; flex-wrap: wrap; }
.inbox-abas button { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 4px 10px; font-size: 12px; font-weight: 650; cursor: pointer; }
.inbox-abas button b { background: var(--t); color: var(--t-ink); border-radius: 99px; padding: 0 6px; margin-left: 3px; font-size: 11px; }
.inbox-abas button[aria-pressed="true"] { background: var(--ink); color: var(--ground); border-color: var(--ink); }
.inbox-itens { overflow-y: auto; min-height: 0; margin-inline: -12px; }
.inbox-item { width: 100%; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; text-align: left; border: 0; border-top: 1px solid var(--line); background: none; padding: 10px 12px; cursor: pointer; }
.inbox-item:hover { background: var(--t-soft); }
.inbox-item.aberta { background: var(--t-tint); }
.inbox-item .ini { width: 34px; height: 34px; }
.inbox-item-txt { min-width: 0; display: grid; gap: 2px; }
.inbox-item .linha1 { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.inbox-item .linha1 b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-item .linha1 small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.inbox-item .linha2 { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-item.nova .linha2 { color: var(--ink); font-weight: 600; }
.inbox-item .linha3 { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.nlidas { margin-left: auto; background: var(--ok); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 800; padding: 0 7px; }
.etq { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap; }
.inbox-conversa { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; min-width: 0; }
.inbox-vazia { grid-row: 1 / -1; display: grid; place-items: center; color: var(--muted); }
.inbox-cab { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.inbox-cab > div { flex: 1; min-width: 0; }
.inbox-cab b { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-cab .mini { display: flex; gap: 6px; align-items: center; }
.inbox-cab .voltar { display: none; }
.inbox-msgs { overflow-y: auto; padding: 14px 16px; display: grid; gap: 8px; align-content: start; background: var(--sunk); }
.dia { justify-self: center; font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 1px 10px; margin: 6px 0; }
.msg { display: grid; gap: 3px; justify-items: start; max-width: 78%; }
.msg.sai { justify-self: end; justify-items: end; }
.msg .bolha { max-width: 100%; background: var(--surface); }
.msg .bolha.saida { background: var(--t-tint); }
.msg.rascunho .bolha { background: var(--surface); border: 1.5px dashed var(--ask); }
.msg.falhou .bolha { border: 1.5px solid var(--stop); }
.msg .meta { font-size: 11px; color: var(--muted); }
.inbox-compor { border-top: 1px solid var(--line); padding: 10px 14px; display: grid; gap: 7px; }
.modelos { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pill-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 3px 10px; font-size: 12px; font-weight: 650; cursor: pointer; }
.pill-btn:hover { border-color: var(--t); color: var(--t); }
.mini-sel { width: auto; padding: 3px 8px; font-size: 12px; border-radius: 99px; }
.compor-linha { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.compor-linha textarea { min-height: 46px; max-height: 180px; }
.aviso-clinico { background: var(--stop-tint); color: var(--stop); border-radius: 10px; padding: 7px 11px; font-size: 13px; font-weight: 650; }
.aviso-wa { background: var(--ask-tint); color: var(--ask); border-radius: 10px; padding: 7px 11px; font-size: 13px; font-weight: 650; }
.inbox-painel { border-left: 1px solid var(--line); overflow-y: auto; padding: 12px; display: grid; gap: 12px; align-content: start; background: var(--ground); min-height: 0; }
.inbox-painel .sec { box-shadow: none; }
.prox { display: grid; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line); }
.prox:first-of-type { border-top: 0; }
.prox-h { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.prox-h b { font-size: 13.5px; }
.prox .faz-linha { font-size: 11.5px; }
.prox.desligada { opacity: .6; }
.prox .link { justify-self: start; font-size: 12px; }
.nota-conv { background: var(--tell-tint); color: var(--tell); border-radius: 8px; padding: 6px 9px; }
@media (max-width: 1240px) { .inbox { grid-template-columns: 280px minmax(0, 1fr); } .inbox-painel { display: none; } .inbox.com-conversa .inbox-painel { display: grid; grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); max-height: 360px; } .inbox.com-conversa { grid-template-rows: minmax(0, 1fr) auto; height: auto; } .inbox.com-conversa .inbox-conversa { height: calc(100vh - 190px); } }
@media (max-width: 880px) {
  .inbox { grid-template-columns: minmax(0, 1fr); height: auto; }
  .inbox-lista { border-right: 0; max-height: 70vh; }
  .inbox.com-conversa .inbox-lista { display: none; }
  .inbox:not(.com-conversa) .inbox-conversa { display: none; }
  .inbox-cab .voltar { display: inline-block; }
  .inbox.com-conversa .inbox-conversa { height: 75vh; }
  .msg { max-width: 92%; }
}

/* ---------- conexões ---------- */
.conexao { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.conexao-esq { padding: 22px; display: grid; gap: 16px; align-content: start; border-right: 1px solid var(--line); }
.conexao-dir { padding: 22px; background: var(--t-soft); }
.google-area { grid-template-columns: minmax(0, 1fr); }
.google-area .conexao-esq { border-right: 0; }
.estado-grande { display: grid; grid-template-columns: 18px 1fr; gap: 12px; align-items: start; }
.estado-grande i { width: 14px; height: 14px; border-radius: 50%; margin-top: 6px; background: var(--stop); }
.estado-grande.on i { background: var(--ok); animation: pulso 1.8s ease-out infinite; }
.estado-grande b { font-family: var(--display); font-size: 20px; display: block; line-height: 1.2; }
.estado-grande span { font-size: 13.5px; color: var(--muted); }
.qr-box { display: grid; gap: 12px; align-content: start; }
.qr-box h3 { font-size: 16px; }
.passos { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
.qr-img { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px; width: fit-content; min-width: 264px; min-height: 264px; display: grid; place-items: center; }
.qr-img img { display: block; image-rendering: pixelated; }
.codigo-par { font-family: var(--mono); font-size: 30px; font-weight: 700; letter-spacing: .14em; background: var(--surface); border: 1px dashed var(--t); border-radius: 14px; padding: 14px 18px; width: fit-content; color: var(--t); }
.linha-form { display: grid; gap: 8px; max-width: 360px; }
.linha-form label { font-size: 12.5px; font-weight: 650; color: var(--muted); }
.sucesso { background: var(--ok-tint); color: var(--ok); border: 1px solid var(--ok); border-radius: 14px; padding: 12px 16px; font-weight: 650; }
.botao-google { text-decoration: none; width: fit-content; display: inline-block; }
a.b { text-decoration: none; color: inherit; }
.tabela-rolagem { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table.previa { border-collapse: collapse; font-size: 12px; min-width: 100%; }
table.previa th, table.previa td { padding: 6px 9px; border-top: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.previa th { border-top: 0; background: var(--sunk); font-weight: 700; }
.linha-form.largo { max-width: none; }
.escolha { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; font-size: 13.5px; }
.escolha legend { font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 0 4px; }
.escolha label { display: flex; gap: 8px; align-items: baseline; }
textarea.longo { min-height: 260px; }
.tecnico { font-size: 13px; }
.tecnico summary { cursor: pointer; color: var(--muted); font-weight: 650; }
.tecnico .kv { margin-top: 8px; }
@media (max-width: 880px) { .conexao { grid-template-columns: minmax(0, 1fr); } .conexao-esq { border-right: 0; border-bottom: 1px solid var(--line); } }

/* ---------- modal e aviso ---------- */
.modal { position: fixed; inset: 0; background: rgba(20,12,16,.45); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal > form, .modal > div { background: var(--surface); border-radius: 18px; padding: 20px; max-width: 460px; width: 100%; display: grid; gap: 10px; border: 1px solid var(--line); box-shadow: 0 20px 50px var(--shadow-2); max-height: calc(100vh - 32px); overflow-y: auto; }
.modal > .largo { max-width: 760px; }
.modal h3 { font-size: 18px; }
.tutorial { gap: 12px; }
.passos-tutorial { padding-left: 22px; display: grid; gap: 12px; font-size: 14px; }
.passos-tutorial li { line-height: 1.55; }
.passos-tutorial li::marker { font-weight: 750; color: var(--t); }
.passos-tutorial ul { padding-left: 18px; margin: 6px 0 0; }
.passos-tutorial .copiavel-linha, .passos-tutorial .links-api { margin-top: 6px; }
.passos-tutorial .mini { display: block; margin-top: 6px; }
.copiavel-linha { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; background: var(--sunk); border-radius: 10px; padding: 6px 6px 6px 10px; }
.copiavel-linha code { font-size: 12.5px; overflow-wrap: anywhere; }
.links-api { display: flex; flex-wrap: wrap; gap: 6px; }
.destaque-mini { background: var(--tell-tint); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; display: block; }
.modal label { font-size: 12.5px; font-weight: 650; color: var(--muted); }
.modal .bolha { max-width: none; }
.modal .row2 { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.dois { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toast { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); background: var(--ink); color: var(--ground); border-radius: 99px; padding: 9px 16px; font-size: 13px; font-weight: 600; z-index: 70; max-width: calc(100% - 32px); box-shadow: 0 8px 22px var(--shadow-2); }
.toast.ruim { background: var(--stop); color: #fff; }

/* ---------- avisos do topo, ensaio, cópia, agenda e importação ---------- */
.faixa { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; border-radius: 14px; padding: 12px 16px; border: 1px solid var(--line); background: var(--surface); }
.faixa > div { display: grid; gap: 2px; min-width: 0; }
.faixa b { font-size: 14px; }
.faixa span { font-size: 13px; color: var(--muted); }
.faixa.ruim { background: var(--stop-tint); border-color: var(--stop); }
.faixa.ruim b { color: var(--stop); }
.faixa.ensaio { background: var(--ask-tint); border-color: var(--ask); }
.faixa.ensaio b { color: var(--ask); }
.ensaio-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 14px 16px; }
.ensaio-box .q { display: grid; gap: 4px; }
.ensaio-box.on { border-color: var(--ask); background: var(--ask-tint); }
.agenda-dia { font-size: 12.5px; background: var(--sunk); border-radius: 10px; padding: 8px 10px; margin: 0; }
.agenda-dia:empty { display: none; }
.excecao { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--ink); }
.panel.imp { padding: 20px; display: grid; gap: 14px; }
.grade-campos { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 12px; }
.grade-campos label { display: block; margin-bottom: 4px; }
.imp-resumo { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.imp-resumo > div { background: var(--sunk); border-radius: 12px; padding: 10px 12px; display: grid; gap: 2px; }
.imp-resumo b { font-family: var(--display); font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; }
.imp-resumo span { font-size: 12.5px; color: var(--muted); }
table.imp-tabela td.obs { white-space: normal; min-width: 220px; color: var(--muted); }

.anexos-linha { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.anexo-op { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; font-weight: 650; background: var(--sunk); border-radius: 99px; padding: 3px 10px; }
.anexo-op.falta { background: var(--ask-tint); color: var(--ask); }
.aviso-anexo { color: var(--ask); }
.panel.arquivos .row .txt { min-width: 0; }
.subir { position: relative; overflow: hidden; cursor: pointer; }
.subir input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.subir:focus-within { outline: 3px solid var(--t); outline-offset: 2px; }

.faixa.observa { background: var(--tell-tint); border-color: var(--tell); }
.faixa.observa b { color: var(--tell); }
.ensaio-box.observa { border-color: var(--tell); background: var(--tell-tint); }
.simulada { font-style: italic; }
.msg.simulada .bolha { background: transparent; border: 1.5px dashed var(--tell); color: var(--muted); }
.msg.simulada .meta { color: var(--tell); }

@media (max-width: 1100px) { .duas { grid-template-columns: minmax(0,1fr); } .pac { grid-template-columns: minmax(0,1fr); } .lista { position: static; } .lista .itens { max-height: 260px; } }
@media (max-width: 880px) {
  .app { grid-template-columns: minmax(0,1fr); }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); gap: 12px; }
  .menu { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; }
  .stage-cfg { grid-template-columns: minmax(0,1fr); }
  .stage-list { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; }
  .work { padding: 16px 16px 80px; }
  .canal-lado { margin-top: 0; }
  .topbar { margin-inline: -16px; padding-inline: 16px; }
  .ficha-h { grid-template-columns: 48px minmax(0,1fr); }
  .ficha-h .ini { width: 48px; height: 48px; }
  .dois { grid-template-columns: 1fr; }
}
