/* Módulo "Melhoria de Processos" (13/10/2026) — Diagnóstico APQC, Análise e Melhoria,
   Automação por atividade. Só classes com prefixo mm-; reaproveita os tokens do style.css. */

.mm-home { margin-top: 28px; width: 100%; }
.mm-home-lista { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.mm-home-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 14px; padding: 10px 14px; text-align: left; }
.mm-home-info { display: flex; flex-direction: column; min-width: 0; }
.mm-home-info b { font-size: 13.5px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-home-info span { font-size: 11.5px; color: var(--text-tertiary); }
.mm-home-acoes { display: flex; gap: 6px; flex-shrink: 0; }
.mm-btn-perigo { color: var(--rose) !important; }

/* Controles de formulário */
.mm-input, .mm-textarea {
    font: inherit; font-size: 13px; color: var(--text-primary); background: var(--bg-surface);
    border: 1px solid var(--border-default); border-radius: 10px; padding: 7px 10px; width: 100%; box-sizing: border-box;
}
.mm-input:focus, .mm-textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-muted); }
.mm-textarea { min-height: 64px; resize: vertical; line-height: 1.5; }
.mm-input-sm { width: 76px; text-align: right; }
select.mm-input { width: auto; min-width: 64px; }
.mm-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.mm-row > label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.mm-row > label .mm-input { width: auto; min-width: 120px; }
.mm-grow { flex: 1 1 220px; }
.mm-grow .mm-input { width: 100% !important; }

.mm-btn {
    font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; border-radius: 9999px; padding: 8px 16px;
    border: 1px solid var(--border-default); background: var(--bg-surface); color: var(--text-secondary); transition: all .15s;
}
.mm-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.mm-btn-primario { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.mm-btn-primario:hover { background: var(--accent-light); color: var(--on-accent); }
.mm-btn-sm { padding: 5px 11px; font-size: 12px; }
.mm-btn:disabled { opacity: .55; cursor: wait; }
.mm-btn-link { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600; padding: 0; }
.mm-btn-link:hover { text-decoration: underline; }
.mm-acoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.mm-nota { font-size: 12px; color: var(--text-tertiary); line-height: 1.55; margin: 0 0 14px; }
.mm-erro { font-size: 12.5px; color: var(--rose); margin: 6px 0 12px; }

/* Layout com trilha vertical (como a página de referência) */
.mm-layout { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: start; }
@media (max-width: 900px) { .mm-layout { grid-template-columns: 1fr; } }
.mm-steps { position: sticky; top: 12px; display: flex; flex-direction: column; }
.mm-steps-tit { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 10px 4px; }
.mm-step { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; cursor: pointer; border: 1px solid transparent; background: transparent; text-align: left; font: inherit; width: 100%; position: relative; }
.mm-step + .mm-step::before { content: ''; position: absolute; left: 25px; top: -8px; height: 8px; border-left: 1px dashed var(--border-strong); }
.mm-step:hover { background: var(--bg-hover); }
.mm-step.ativa { background: var(--accent-muted); border-color: var(--emerald-border); }
.mm-step-n { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--text-secondary); flex-shrink: 0; background: var(--bg-surface); }
.mm-step.ativa .mm-step-n { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.mm-step.feita .mm-step-n { border-color: var(--accent); color: var(--accent); }
.mm-step-txt { display: flex; flex-direction: column; min-width: 0; }
.mm-step-txt b { font-size: 13px; color: var(--text-primary); }
.mm-step-txt span { font-size: 11px; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mm-step-badge { margin-left: auto; font-size: 10.5px; font-weight: 700; background: var(--neutral-muted); color: var(--text-secondary); border-radius: 9999px; padding: 2px 7px; }

/* Resumo em cartões */
.mm-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.mm-kpi { background: var(--bg-surface); border-radius: var(--radius-lg, 16px); box-shadow: var(--shadow-md); padding: 14px 16px; }
.mm-kpi-v { font-size: 24px; font-weight: 800; color: var(--text-primary); line-height: 1.1; }
.mm-kpi-l { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-top: 4px; }
.mm-kpi-s { font-size: 11.5px; color: var(--text-tertiary); margin-top: 4px; }
.mm-kpi--ok .mm-kpi-v { color: var(--emerald); }
.mm-kpi--alerta .mm-kpi-v { color: var(--amber); }
.mm-kpi--ruim .mm-kpi-v { color: var(--rose); }

/* Chips de classificação / status */
.mm-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; border-radius: 9999px; padding: 3px 9px; white-space: nowrap; border: 1px solid transparent; }
.mm-chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.mm-chip-ok      { color: var(--emerald); background: var(--emerald-muted); border-color: var(--emerald-border); }
.mm-chip-falha   { color: var(--amber);   background: var(--amber-muted);   border-color: var(--amber-border); }
.mm-chip-nao     { color: var(--rose);    background: var(--rose-muted);    border-color: var(--rose-border); }
.mm-chip-na      { color: var(--text-tertiary); background: var(--neutral-muted); border-color: var(--border-subtle); }
.mm-chip-info    { color: var(--sky);     background: var(--sky-muted);     border-color: var(--sky-border); }
.mm-chip-violet  { color: var(--violet);  background: var(--violet-muted);  border-color: var(--violet-border); }

/* Barras de aderência por categoria */
.mm-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px 20px; margin-bottom: 20px; }
.mm-cat { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; font-size: 12.5px; color: var(--text-secondary); }
.mm-cat b { color: var(--text-primary); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-cat-pct { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text-primary); }
.mm-bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--neutral-muted); overflow: hidden; }
.mm-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* Tabela do diagnóstico */
.mm-tab-cat td.mm-cat-head { background: var(--neutral-muted); font-weight: 700; color: var(--text-primary); font-size: 12.5px; }
.mm-td-obs { min-width: 180px; }
.mm-td-obs .mm-textarea { min-height: 40px; font-size: 12px; }
.mm-prio { font-weight: 800; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.mm-lacuna { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--bg-surface); box-shadow: var(--shadow-sm); margin-bottom: 8px; }
.mm-lacuna-n { width: 26px; height: 26px; border-radius: 50%; background: var(--rose-muted); color: var(--rose); font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mm-lacuna-txt { flex: 1; min-width: 0; font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.mm-lacuna-txt b { color: var(--text-primary); display: block; }

/* Gráficos SVG */
.mm-chart { width: 100%; height: auto; display: block; font-family: inherit; }
.mm-chart .eixo { stroke: var(--border-default); stroke-width: 1; }
.mm-chart .grade { stroke: var(--border-faint); stroke-width: 1; }
.mm-chart .rotulo { fill: var(--text-tertiary); font-size: 10px; }
.mm-chart .valor { fill: var(--text-secondary); font-size: 10px; font-weight: 600; }
.mm-chart .barra { fill: var(--accent); }
.mm-chart .barra.fora { fill: var(--border-strong); }
.mm-chart .linha { fill: none; stroke: var(--amber); stroke-width: 2; stroke-linejoin: round; }
.mm-chart .ponto { fill: var(--bg-surface); stroke: var(--amber); stroke-width: 2; }
.mm-chart .corte { stroke: var(--amber); stroke-dasharray: 4 3; stroke-width: 1; }
.mm-chart .q { fill: var(--neutral-muted); stroke: var(--border-faint); }
.mm-chart .q-rapido { fill: var(--emerald-muted); }
.mm-chart .q-tit { fill: var(--text-muted); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.mm-chart .bolha { fill: var(--accent); fill-opacity: .85; stroke: var(--bg-surface); stroke-width: 2; }
.mm-chart .bolha.rapido { fill: var(--emerald); }
.mm-chart .bolha-tx { fill: var(--text-primary); font-size: 10px; font-weight: 600; }
.mm-legenda { display: flex; gap: 16px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-tertiary); margin: 6px 0 16px; }
.mm-legenda i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* Cartões de problema / solução / ação */
.mm-card { background: var(--bg-surface); border-radius: var(--radius-lg, 16px); box-shadow: var(--shadow-md); padding: 16px 18px; margin-bottom: 14px; }
.mm-card-tit { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.mm-card-tit b { font-size: 14px; color: var(--text-primary); flex: 1; }
.mm-5w { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 14px; }
.mm-5w label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.mm-5w label.mm-wide { grid-column: 1 / -1; }
.mm-porque { display: grid; grid-template-columns: 90px 1fr; gap: 8px 12px; align-items: center; margin-bottom: 8px; }
.mm-porque > span { font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.mm-raiz { background: var(--emerald-muted); border: 1px solid var(--emerald-border); border-radius: 12px; padding: 10px 12px; margin-top: 10px; }
.mm-raiz label { font-size: 11px; font-weight: 700; color: var(--emerald); text-transform: uppercase; letter-spacing: .06em; display: block; margin-bottom: 4px; }
.mm-status-nao_iniciado { color: var(--text-tertiary); background: var(--neutral-muted); border-color: var(--border-subtle); }
.mm-status-em_andamento { color: var(--sky); background: var(--sky-muted); border-color: var(--sky-border); }
.mm-status-concluido    { color: var(--emerald); background: var(--emerald-muted); border-color: var(--emerald-border); }
.mm-status-atrasado     { color: var(--rose); background: var(--rose-muted); border-color: var(--rose-border); }
.mm-atrasada { border-left: 3px solid var(--rose); }
.mm-melhora-pos { color: var(--emerald); font-weight: 800; }
.mm-melhora-neg { color: var(--rose); font-weight: 800; }
.mm-td-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mm-td-num .mm-input { text-align: right; }
.mm-tabela-edit td { padding: 7px 10px; }
.mm-tabela-edit .mm-input, .mm-tabela-edit select.mm-input { padding: 5px 8px; font-size: 12.5px; }
.mm-rapido td:first-child { border-left: 3px solid var(--emerald); }
.mm-trunca { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-ia-aviso { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-tertiary); }

@media print {
    .mm-steps, .mm-acoes, .mm-btn, .mm-home { display: none !important; }
    .mm-layout { grid-template-columns: 1fr; }
}

/* Gráficos: largura limitada (a aba é muito larga) e matriz com lista numerada ao lado */
.mm-chart { max-width: 760px; }
.mm-matriz { display: grid; grid-template-columns: minmax(0, 760px) minmax(220px, 1fr); gap: 8px 24px; align-items: start; }
@media (max-width: 1100px) { .mm-matriz { grid-template-columns: 1fr; } }
.mm-chart .bolha-n { fill: #fff; font-size: 11px; font-weight: 800; pointer-events: none; }
.mm-matriz-lista { list-style: none; margin: 0; padding: 4px 0 0; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-secondary); }
.mm-matriz-lista li { display: grid; grid-template-columns: 24px 1fr; gap: 2px 8px; align-items: center; }
.mm-matriz-lista li span { color: var(--text-primary); font-weight: 600; }
.mm-matriz-lista li small { grid-column: 2; font-size: 11px; color: var(--text-tertiary); }
.mm-n, .mm-n-rapido { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #fff; background: var(--accent); grid-row: span 2; }
.mm-n-rapido { background: var(--emerald); }

/* Escolha de assuntos na tela de análise (reunião com mais de um processo) */
.mm-assuntos { margin: 18px auto 0; max-width: 560px; text-align: left; background: var(--bg-surface); border-radius: var(--radius-lg, 16px); box-shadow: var(--shadow-lg); padding: 18px 20px; }
.mm-assuntos h4 { margin: 0 0 6px; font-size: 15px; color: var(--text-primary); }
.mm-assuntos p { margin: 0 0 12px; font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.mm-assuntos-lista { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.mm-assunto { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border-subtle); border-radius: 12px; cursor: pointer; }
.mm-assunto:hover { background: var(--bg-hover); }
.mm-assunto--outro { opacity: .7; }
.mm-assunto input { margin-top: 3px; accent-color: var(--accent); }
.mm-assunto-txt { display: flex; flex-direction: column; font-size: 12.5px; color: var(--text-secondary); }
.mm-assunto-txt b { color: var(--text-primary); font-size: 13.5px; }
.mm-assunto-txt small { color: var(--text-tertiary); font-weight: 500; }
.mm-assuntos-acoes { display: flex; gap: 8px; flex-wrap: wrap; }

/* "Pergunte à Mango sobre o processo" (chat, 13/10/2026) — mesmo desenho do chat do Jurídico */
.mm-chat { margin: 6px 40px 18px; }
.mm-chat-cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.mm-chat-cab .section-header { margin-bottom: 10px; }
.mm-chat-fechar { background: none; border: none; cursor: pointer; color: var(--text-tertiary); font-size: 16px; padding: 4px 8px; border-radius: 8px; }
.mm-chat-fechar:hover { background: var(--bg-hover); color: var(--text-primary); }
.mm-chat-lista { display: flex; flex-direction: column; gap: 10px; max-height: 440px; overflow-y: auto; padding: 4px 2px; margin-bottom: 10px; }
.mm-chat-msg { max-width: min(760px, 92%); padding: 12px 16px; border-radius: 14px; font-size: 13.5px; line-height: 1.6; }
.mm-chat-msg p { margin: 0 0 6px; color: inherit; font-size: inherit; line-height: inherit; }
.mm-chat-msg p:last-child { margin-bottom: 0; }
.mm-chat-msg ul { margin: 0 0 6px; padding-left: 18px; }
.mm-chat-usuario { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.mm-chat-usuario p { color: #fff; }
.mm-chat-mango { align-self: flex-start; background: var(--bg-base); border: 1px solid var(--border-subtle); border-bottom-left-radius: 6px; color: var(--text-primary); }
.mm-chat-pendente p { color: var(--text-tertiary); font-style: italic; }
.mm-chat-fora { border-color: var(--amber-border); background: var(--amber-muted); }
.mm-chat-erro { border-color: var(--rose-border); color: var(--rose); }
.mm-chat-mango .mm-chip { margin-bottom: 6px; }
.mm-chat-fontes, .mm-chat-sugestoes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mm-chat-fonte { border: 1px solid var(--emerald-border); background: var(--emerald-muted); color: var(--emerald); border-radius: 99px; padding: 4px 10px; font-size: 11.5px; font-weight: 600; cursor: pointer; font-family: inherit; }
.mm-chat-fonte:hover { background: var(--accent); color: #fff; }
.mm-chat-sugestao { border: 1px solid var(--border-default); background: var(--bg-surface); color: var(--text-primary); border-radius: 99px; padding: 5px 11px; font-size: 12px; cursor: pointer; text-align: left; font-family: inherit; }
.mm-chat-sugestao:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-muted); }
.mm-chat-vazio p { font-size: 12.5px; color: var(--text-tertiary); margin: 0 0 6px; }
.mm-chat-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.mm-chat-form .mm-chat-entrada { flex: 1 1 320px; min-height: 44px; }
.mm-chat-acoes { display: flex; gap: 8px; align-items: center; }
.mm-chat .mm-nota { margin: 10px 0 0; }
.mm-chat-botao.active { background: var(--accent-muted); color: var(--accent); border-color: var(--emerald-border); }
@media (max-width: 680px) { .mm-chat { margin: 6px 18px 14px; } .mm-chat-msg { max-width: 100%; } }
.pd .mm-chat, .pd .mm-chat-botao { display: none !important; }

/* ── Plano de Automação (aba 18, 26/10/2026) ───────────────────────────── */
.ra-acoes{ flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.ra-destaque{ display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; padding: 16px 18px; margin-bottom: 14px; border-radius: 16px; border: 2px solid var(--accent, #1f8a4c); background: linear-gradient(135deg, rgba(31,138,76,.08), transparent); }
.ra-destaque small, .ra-kpis small{ display: block; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 4px; }
.ra-destaque .ra-txt{ font-size: 15px; font-weight: 600; }
.ra-kpis{ display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ra-num{ font-size: 20px; color: var(--accent, #1f8a4c); }
.ra-sec{ margin-bottom: 12px; }
.ra-sec-cab{ display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.ra-sec-cab b{ display: block; font-size: 14.5px; }
.ra-sec-cab small{ display: block; font-size: 12px; color: var(--text-tertiary); }
.ra-n{ flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-muted, #e7f4ec); color: var(--accent, #1f8a4c); font-weight: 800; font-size: 12.5px; display: flex; align-items: center; justify-content: center; }
.ra-txt{ width: 100%; }
.ra-dica{ display: block; font-size: 11px; color: var(--text-tertiary); margin-top: 3px; }
.ra-grid2{ display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ra-grid3{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ra-grid2 label, .ra-grid3 label{ font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.ra-tab td{ vertical-align: top; }
.ra-cel{ min-height: 34px; width: 100%; font-size: 13px; }
.ra-gerando{ display: flex; align-items: center; gap: 10px; }
.ra-gerando .ct-spinner{ width: 16px; height: 16px; border: 2px solid rgba(0,0,0,.15); border-top-color: #1f8a4c; border-radius: 50%; animation: ra-girar .8s linear infinite; flex: none; }
@keyframes ra-girar{ to{ transform: rotate(360deg); } }
@media (max-width: 760px){ .ra-destaque, .ra-grid2, .ra-grid3{ grid-template-columns: 1fr; } }
