/* ============================================================================
   protec-assistente.css — editor do assistente virtual por blocos (BotFlowsView, Lote 7)
   Prefixo as-. Hierarquia do protótipo (docs/ux/demo-assistente.html): página bege, colunas
   brancas (fluxos, simulador), blocos em cartões brancos com a cor do tipo à esquerda,
   conversa do simulador no fundo azul-acinzentado do chat.
   ============================================================================ */

.as { display: grid; grid-template-columns: 260px minmax(0, 1fr) 360px; height: 100%; min-height: 0; background: var(--bg); }
.as--sem-sim { grid-template-columns: 260px minmax(0, 1fr); }

/* ── Lista de fluxos ── */
.as-fluxos { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--border); }
.as-fluxos-h { display: flex; align-items: center; justify-content: space-between; padding: 12px; border-bottom: 1px solid var(--border); }
.as-fluxos-h b { font-size: 14px; color: var(--text); }
.as-fluxos-lista { flex: 1; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.as-fluxo {
    display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%; padding: 9px 10px;
    border: 1px solid transparent; border-radius: 10px; background: transparent; text-align: left; cursor: pointer;
    font: inherit; color: var(--text);
}
.as-fluxo:hover { background: var(--surface-2); }
.as-fluxo--on, .as-fluxo--on:hover { background: var(--accent-soft); border-color: var(--accent); }
.as-fluxo b { font-size: 13px; }
.as-fluxo small { font-size: 11.5px; color: var(--text-2); }
.as-fluxos-pe { padding: 10px 12px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); }
.as-nada { padding: 16px 10px; text-align: center; font-size: 12.5px; color: var(--text-2); }

.as-vazio { grid-column: 2 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; color: var(--text-2); }
.as-vazio > .mud-icon-root { font-size: 44px; width: 44px; height: 44px; color: var(--text-3); }
.as-vazio > b { font-size: 15px; color: var(--text); }
.as-vazio > span { max-width: 520px; font-size: 13px; }
.as-vazio-acoes { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.as-conv-avisos { max-width: 560px; margin: 4px 0 0; padding-left: 18px; text-align: left; font-size: 12.5px; color: var(--warn-text); }

/* ── Editor ── */
.as-editor { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.as-ed-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.as-ed-tit { flex: 1; min-width: 220px; }
.as-ed-nome {
    width: 100%; margin-left: -6px; padding: 2px 6px; border: 1px solid transparent; border-radius: 8px; background: transparent;
    font: inherit; font-size: 17px; font-weight: 700; color: var(--text);
}
.as-ed-nome:hover { border-color: var(--border); }
.as-ed-nome:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.as-ed-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 3px; font-size: 12px; color: var(--text-2); }
.as-salvo { color: var(--text-3); }
.as-abas > button { flex: 0 0 auto; padding: 5px 12px; }
.as-abas .zi-selo { margin-left: 2px; }
.as-ed-corpo { flex: 1; overflow-y: auto; padding: 16px; }
.as-ed-corpo > * { max-width: 820px; margin-left: auto; margin-right: auto; }

.as-dica { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); font-size: 12.5px; color: var(--text-2); }
.as-dica .mud-icon-root { font-size: 16px; width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.as-bl-ed .as-dica, .as-regra .as-dica { margin-bottom: 0; }

.as-avisos { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--bad) 40%, var(--border)); border-radius: 12px; background: var(--surface); }
.as-avisos-h { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--text); }
.as-avisos--ok { flex-direction: row; align-items: center; gap: 8px; border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); color: var(--ok-text); font-size: 13px; }
.as-avisos--ok > span { flex: 1; }
.as-aviso { display: flex; align-items: flex-start; gap: 8px; padding: 5px 6px; border: 0; border-radius: 6px; background: transparent; text-align: left; cursor: pointer; font: inherit; font-size: 12.5px; color: var(--text-2); }
.as-aviso:hover { background: var(--surface-2); }
.as-aviso--grave { color: var(--bad-text); }
.as-aviso .mud-icon-root { font-size: 16px; width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

/* ── Blocos ── */
.as-bl { margin-bottom: 10px; border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: 12px; background: var(--surface); transition: box-shadow .15s, border-color .15s; }
.as-bl--aberto { box-shadow: var(--elev-1); }
.as-bl--aviso { border-top-color: color-mix(in srgb, var(--bad) 45%, var(--border)); border-right-color: color-mix(in srgb, var(--bad) 45%, var(--border)); border-bottom-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.as-bl--ativo { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 32%, transparent); }
.as-bl-h { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.as-bl-h:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 10px; }
.as-bl-ic { width: 30px; height: 30px; display: grid; place-items: center; flex-shrink: 0; border-radius: 8px; background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: var(--c); }
.as-bl-ic .mud-icon-root { font-size: 18px; width: 18px; height: 18px; }
.as-bl-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.as-bl-tx b { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13.5px; color: var(--text); }
.as-bl-tx b small { font-size: 11.5px; font-weight: 500; color: var(--text-3); }
.as-bl-tx > span { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-bl-inicio { padding: 0 7px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent-strong); font-size: 10.5px; font-weight: 700; }
.as-bl-alerta.mud-icon-root { color: var(--bad-text); }
.as-bl-seta.mud-icon-root { color: var(--text-3); }

.as-saidas { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px 52px; }
.as-saida {
    display: inline-flex; align-items: center; gap: 4px; max-width: 100%; height: 24px; padding: 0 9px;
    border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface-2); cursor: pointer;
    font: inherit; font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.as-saida:hover { border-color: var(--accent); }
.as-saida b { font-weight: 600; color: var(--text); }
.as-saida .mud-icon-root { font-size: 13px; width: 13px; height: 13px; }
.as-saida--sem, .as-saida--sem:hover { border-color: color-mix(in srgb, var(--bad) 50%, var(--border)); background: var(--bad-soft); color: var(--bad-text); cursor: default; }

.as-bl-ed { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px 14px 52px; border-top: 1px solid var(--border); }
.as-campo { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.as-campo > span, .as-rot { font-size: 12px; font-weight: 600; color: var(--text-2); }
.as-campo em, .as-rot em { font-style: normal; font-weight: 400; color: var(--text-3); }
.as-campo small { font-size: 11.5px; color: var(--text-3); }
.as-campo--curto { max-width: 220px; }
.as-in {
    width: 100%; min-width: 0; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 8px;
    background: var(--surface); color: var(--text); font: inherit; font-size: 13px;
}
textarea.as-in { resize: vertical; line-height: 1.45; }
.as-in:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.as-dupla { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.as-opcoes { display: flex; flex-direction: column; gap: 6px; }
.as-opcao { display: grid; grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1fr) auto auto auto; align-items: center; gap: 6px; }
.as-opcao-n { font-size: 13px; font-weight: 700; color: var(--text-2); text-align: center; }
.as-linha { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.as-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.as-check input { width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }
.as-bl-acoes { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding-top: 8px; border-top: 1px dashed var(--border); }
.as-grow { flex: 1; }

.as-add-menu { display: block; width: 100%; max-width: 820px; margin: 0 auto; }
.as-add {
    display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 42px;
    border: 1px dashed var(--border-strong); border-radius: 12px; background: transparent; cursor: pointer;
    font: inherit; font-size: 13px; font-weight: 600; color: var(--text-2);
}
.as-add:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--surface); }
.as-add-i { display: flex; align-items: flex-start; gap: 10px; padding: 2px 0; }
.as-add-i > span { display: flex; flex-direction: column; }
.as-add-i b { font-size: 13px; }
.as-add-i small { font-size: 11.5px; color: var(--text-2); white-space: normal; max-width: 300px; }

/* ── Mapa ── */
.as-mapa, .as-mapa ul { list-style: none; margin: 0; padding: 0; }
.as-mapa ul { margin-left: 16px; padding-left: 14px; border-left: 1px dashed var(--border-strong); }
.as-mapa li { padding: 4px 0; }
.as-aresta { margin-right: 6px; font-size: 11.5px; color: var(--text-3); }
.as-no {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
    border: 1px solid var(--border); border-left: 3px solid var(--c, var(--border-strong)); border-radius: 8px;
    background: var(--surface); cursor: pointer; font: inherit; font-size: 12.5px; color: var(--text);
}
.as-no .mud-icon-root { font-size: 15px; width: 15px; height: 15px; color: var(--c, var(--text-2)); }
.as-no--fila { --c: var(--accent-strong); cursor: default; }
.as-no--volta { cursor: default; border-style: dashed; color: var(--text-3); }
.as-no--sem { --c: var(--bad); cursor: default; color: var(--bad-text); }

/* ── Regras gerais ── */
.as-regra { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; padding: 14px; border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: 12px; background: var(--surface); }
.as-regra > b { font-size: 13.5px; color: var(--text); }
.as-regra .as-check input:disabled { opacity: .6; }

/* ── Simulador ── */
.as-sim { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-left: 1px solid var(--border); }
.as-sim-h { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.as-sim-h > .mud-icon-root { font-size: 18px; width: 18px; height: 18px; color: var(--accent); }
.as-sim-h b { flex: 1; min-width: 0; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-sim-h b small { font-size: 11.5px; font-weight: 500; color: var(--text-3); }
.as-sim-op { display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }
.as-sim-op label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.as-sim-op input { width: 15px; height: 15px; accent-color: var(--accent); }
.as-sim-chat { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 12px; background: var(--chat-bg); }
.as-sb { max-width: 88%; padding: 7px 10px; border-radius: 12px; font-size: 13px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.as-sb small { display: block; margin-bottom: 1px; font-size: 10.5px; font-weight: 700; color: #7c3aed; }
.as-sb--bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.as-sb--cli { align-self: flex-end; background: var(--bubble-me-bg); border: 1px solid var(--bubble-me-line); color: var(--bubble-me-fg); border-bottom-right-radius: 4px; }
.as-sis { align-self: center; max-width: 92%; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--surface); font-size: 11.5px; color: var(--text-2); text-align: center; }
.as-sis--fila { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.as-sim-sug { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; }
.as-sim-sug:empty { display: none; }
.as-sim-sug button { height: 26px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface); cursor: pointer; font: inherit; font-size: 12px; color: var(--text-2); }
.as-sim-sug button:hover { border-color: var(--accent); color: var(--accent-strong); }
.as-sim-in { display: flex; align-items: center; gap: 6px; padding: 8px 12px; }
.as-sim-in input { flex: 1; min-width: 0; height: 36px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 18px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; }
.as-sim-in input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.as-sim-vars { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px 12px; border-top: 1px solid var(--border); font-size: 12px; }
.as-sim-vars > b { margin-right: 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.as-fraco { color: var(--text-3); }

/* ── Diálogos ── */
.as-novo { display: flex; flex-direction: column; gap: 12px; min-width: min(560px, 80vw); }
.as-modelos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.as-modelo { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
.as-modelo:hover { border-color: var(--accent); }
.as-modelo:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.as-modelo--on { border-color: var(--accent); background: var(--accent-soft); }
.as-modelo b { font-size: 13px; color: var(--text); }
.as-modelo span { font-size: 12px; color: var(--text-2); }
.as-modelo small { font-size: 11.5px; color: var(--text-3); }
.as-pub { min-width: min(480px, 80vw); font-size: 13px; color: var(--text); }
.as-pub p { margin: 0 0 8px; }
.as-versoes { display: flex; flex-direction: column; gap: 6px; min-width: min(480px, 80vw); }
.as-versao { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; }
.as-versao b { min-width: 34px; font-size: 13px; }
.as-versao span { flex: 1; font-size: 12.5px; color: var(--text-2); }

/* Editor antigo dentro da tela nova */
.as-antigo-barra { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }
.as-antigo-barra > span { flex: 1; }
.as-antigo-barra .mud-icon-root { font-size: 17px; width: 17px; height: 17px; }
.as-antigo { height: calc(100% - 41px); }

/* Janela estreita: o simulador abre por cima do editor. */
@media (max-width: 1180px) {
    .as, .as--sem-sim { grid-template-columns: 220px minmax(0, 1fr); }
    .as-sim { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 92vw); z-index: 30; box-shadow: var(--elev-3); }
    .as-dupla { grid-template-columns: 1fr; }
}
