:root {
  --navy-950: #050f26;
  --navy-900: #0b1b3f;
  --navy-800: #13285a;
  --navy-700: #1d3672;
  --ciano: #22d3ee;
  --menta: #5eead4;
  --acento: #0e7490;
  --acento-forte: #0b5d73;
  --acento-suave: #e0f7fa;
  --fundo: #f4f6fb;
  --superficie: #ffffff;
  --borda: #e2e8f0;
  --texto: #0f172a;
  --texto-2: #475569;
  --texto-3: #64748b;
  --verde: #15803d;
  --verde-suave: #dcfce7;
  --ambar: #b45309;
  --ambar-suave: #fef3c7;
  --vermelho: #b91c1c;
  --vermelho-suave: #fee2e2;
  --azul: #1d4ed8;
  --azul-suave: #dbeafe;
  --raio: 12px;
  --sombra: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .05);
  --fonte: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--fonte); font-size: 14px; color: var(--texto); background: var(--fundo); line-height: 1.5; }
a { color: var(--acento); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.carregando { padding: 48px; text-align: center; color: var(--texto-3); }

/* ---------- Acesso (login / configuração) ---------- */
.acesso { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.acesso-marca {
  background: radial-gradient(1200px 600px at 20% 10%, var(--navy-800), var(--navy-950));
  color: #e2e8f0; padding: 48px; display: flex; flex-direction: column; justify-content: center; gap: 28px;
}
.acesso-marca img { width: min(520px, 100%); border-radius: 16px; }
.acesso-marca ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; max-width: 520px; }
.acesso-marca li { display: flex; gap: 12px; align-items: flex-start; color: #cbd5e1; }
.acesso-marca li b { color: #fff; display: block; }
.acesso-marca .ponto { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none;
  background: linear-gradient(135deg, var(--ciano), var(--menta)); }
.acesso-form { display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.acesso-form form { width: min(400px, 100%); display: grid; gap: 14px; }
.acesso-form h1 { font-size: 26px; }
.acesso-form p.sub { margin: -6px 0 6px; color: var(--texto-2); }

/* ---------- Estrutura ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.lateral { background: var(--navy-900); color: #cbd5e1; display: flex; flex-direction: column; position: sticky; top: 0;
  height: 100vh; overflow-y: auto; }
.marca { display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; }
.marca img { width: 34px; height: 34px; }
.marca b { color: #fff; font-size: 19px; letter-spacing: .14em; }
.marca small { display: block; color: var(--ciano); font-size: 9.5px; letter-spacing: .16em; margin-top: 1px; }
.menu { padding: 6px 12px 20px; display: grid; gap: 2px; }
.menu .grupo { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #7c8db5; padding: 14px 10px 6px; }
.menu a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #cbd5e1; }
.menu a:hover { background: var(--navy-800); color: #fff; text-decoration: none; }
.menu a.ativo { background: linear-gradient(90deg, rgba(34, 211, 238, .18), rgba(94, 234, 212, .06)); color: #fff;
  box-shadow: inset 3px 0 0 var(--ciano); }
.menu svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }
.lateral .rodape { margin-top: auto; padding: 14px 20px; border-top: 1px solid var(--navy-800); font-size: 12px; color: #7c8db5; }

.principal { min-width: 0; display: flex; flex-direction: column; }
.topo { display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: var(--superficie);
  border-bottom: 1px solid var(--borda); position: sticky; top: 0; z-index: 5; }
.topo .busca { position: relative; flex: 1; max-width: 460px; }
.topo .busca input { width: 100%; padding-left: 34px; }
.topo .busca svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px;
  stroke: var(--texto-3); fill: none; stroke-width: 2; }
.busca-res { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--superficie);
  border: 1px solid var(--borda); border-radius: 10px; box-shadow: var(--sombra); overflow: hidden; z-index: 20; }
.busca-res a { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; color: var(--texto); }
.busca-res a:hover { background: var(--fundo); text-decoration: none; }
.busca-res small { color: var(--texto-3); }
.topo .usuario { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  color: var(--navy-900); background: linear-gradient(135deg, var(--ciano), var(--menta)); flex: none; }
.usuario .nome { line-height: 1.2; }
.usuario .nome small { display: block; color: var(--texto-3); }
.topo .btn-menu { display: none; }
#conteudo { padding: 24px 28px 48px; max-width: 1400px; width: 100%; }

/* ---------- Componentes ---------- */
.cabecalho { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.cabecalho h1 { font-size: 22px; }
.cabecalho p { margin: 4px 0 0; color: var(--texto-2); }
.acoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--borda);
  background: var(--superficie); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn.primario { background: var(--acento); border-color: var(--acento); color: #fff; }
.btn.primario:hover { background: var(--acento-forte); }
.btn.perigo { color: var(--vermelho); }
.btn.pequeno { padding: 4px 10px; font-size: 12.5px; }
.btn.fantasma { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

input, select, textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: 8px; padding: 8px 10px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(14, 116, 144, .25); border-color: var(--acento); }
textarea { resize: vertical; min-height: 80px; }
textarea.grande { min-height: 320px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
label.campo { display: grid; gap: 4px; font-weight: 600; font-size: 12.5px; color: var(--texto-2); }
label.campo.largo, .grade-form > .largo { grid-column: 1 / -1; }
.subtitulo-form { border-top: 1px solid var(--borda); padding-top: 12px; margin-top: 4px; }
.subtitulo-form b { display: block; font-size: 14px; }
.subtitulo-form small { color: var(--texto-3); }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
label.check input { width: auto; }
.grade-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.cartao { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra); }
.cartao > .titulo { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px;
  border-bottom: 1px solid var(--borda); }
.cartao > .titulo h2 { font-size: 15px; }
.cartao > .corpo { padding: 16px 18px; }
.vazio { padding: 28px 16px; text-align: center; color: var(--texto-3); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; }
.kpi span { color: var(--texto-2); font-size: 12.5px; font-weight: 600; }
.kpi strong { display: block; font-size: 26px; margin-top: 6px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--texto-3); }
.kpi.alerta strong { color: var(--vermelho); }
.grade-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grade-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }

.tabela-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--borda); vertical-align: top; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-3); background: #f8fafc; white-space: nowrap; }
tbody tr:hover { background: #f8fafc; }
tbody tr.clicavel { cursor: pointer; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.acoes-linha { white-space: nowrap; text-align: right; }
.filtros { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--borda); flex-wrap: wrap; }
.filtros input[type=search] { max-width: 320px; }
.filtros select { width: auto; min-width: 150px; }
.totais { display: flex; gap: 24px; padding: 12px 14px; flex-wrap: wrap; color: var(--texto-2); }
.totais b { color: var(--texto); font-variant-numeric: tabular-nums; }

.selo { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: #f1f5f9; color: var(--texto-2); white-space: nowrap; }
.selo.verde { background: var(--verde-suave); color: var(--verde); }
.selo.ambar { background: var(--ambar-suave); color: var(--ambar); }
.selo.vermelho { background: var(--vermelho-suave); color: var(--vermelho); }
.selo.azul { background: var(--azul-suave); color: var(--azul); }
.selo.ciano { background: var(--acento-suave); color: var(--acento-forte); }

.lista { list-style: none; margin: 0; padding: 0; }
.lista li { display: flex; gap: 12px; align-items: flex-start; padding: 11px 18px; border-bottom: 1px solid var(--borda); }
.lista li:last-child { border-bottom: 0; }
.lista .data { min-width: 52px; text-align: center; border-radius: 8px; background: var(--fundo); padding: 4px 6px; line-height: 1.15; }
.lista .data b { display: block; font-size: 17px; }
.lista .data small { color: var(--texto-3); text-transform: uppercase; font-size: 10.5px; }
.lista .data.atraso { background: var(--vermelho-suave); color: var(--vermelho); }
.lista .info { flex: 1; min-width: 0; }
.lista .info small { color: var(--texto-3); display: block; }

.faixa-alerta { background: var(--ambar-suave); color: var(--ambar); padding: 10px 28px; border-bottom: 1px solid #fcd34d; font-weight: 600; }
.faixa-alerta a { color: inherit; text-decoration: underline; }
.planos { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.plano-card { padding: 18px; display: grid; gap: 10px; align-content: start; position: relative; }
.plano-card.atual { outline: 2px solid var(--acento); }
.plano-card.destaque::before { content: "Mais escolhido"; position: absolute; top: -10px; left: 16px; background: var(--acento);
  color: #fff; font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.plano-card h3 { font-size: 17px; }
.plano-card .preco { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.plano-card .preco small { font-size: 13px; font-weight: 500; color: var(--texto-3); }
.plano-card ul { margin: 0; padding-left: 18px; color: var(--texto-2); display: grid; gap: 4px; }
.alternar { display: inline-flex; border: 1px solid var(--borda); border-radius: 999px; padding: 3px; background: var(--superficie); }
.alternar button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--texto-2); }
.alternar button.ativo { background: var(--acento); color: #fff; }
.barra-uso { height: 8px; border-radius: 999px; background: #e2e8f0; overflow: hidden; margin-top: 6px; }
.barra-uso i { display: block; height: 100%; background: var(--acento); border-radius: 999px; }
.barra-uso.cheia i { background: var(--vermelho); }
.faixa-busca { display: flex; gap: 12px; align-items: center; padding: 12px 16px; margin-bottom: 14px; border-radius: var(--raio);
  background: var(--acento-suave); border: 1px solid #a5e9f2; color: var(--acento-forte); }
.faixa-busca small { display: block; color: var(--texto-2); }
.giro { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid #a5e9f2; border-top-color: var(--acento); flex: none;
  animation: girar .8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.lista li > div[style] small { display: block; color: var(--texto-3); }

/* Gráfico de barras simples */
.barras { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; align-items: end; height: 180px; padding: 8px 4px 0; }
.barras .col { display: grid; gap: 6px; justify-items: center; height: 100%; grid-template-rows: 1fr auto; }
.barras .par { display: flex; gap: 4px; align-items: flex-end; height: 100%; }
.barras .b { width: 14px; border-radius: 4px 4px 0 0; min-height: 2px; }
.barras .b.rec { background: var(--acento); }
.barras .b.desp { background: #94a3b8; }
.barras small { color: var(--texto-3); font-size: 11px; }
.legenda { display: flex; gap: 16px; font-size: 12px; color: var(--texto-2); margin-top: 10px; }
.legenda i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(3, minmax(260px, 1fr)); gap: 16px; overflow-x: auto; }
.coluna { background: #eef2f7; border-radius: var(--raio); padding: 10px; min-height: 300px; }
.coluna.sobre { outline: 2px dashed var(--acento); }
.coluna h3 { font-size: 13px; padding: 4px 6px 10px; display: flex; justify-content: space-between; }
.tcard { background: var(--superficie); border: 1px solid var(--borda); border-radius: 10px; padding: 10px 12px;
  margin-bottom: 8px; cursor: grab; box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
.tcard:active { cursor: grabbing; }
.tcard b { display: block; margin-bottom: 4px; }
.tcard .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--texto-3); }

/* Calendário */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--borda); border-left: 1px solid var(--borda); }
.cal .dsem { font-size: 11px; text-transform: uppercase; color: var(--texto-3); padding: 6px 8px; background: #f8fafc;
  border-right: 1px solid var(--borda); border-bottom: 1px solid var(--borda); font-weight: 700; }
.cal .dia { min-height: 104px; padding: 6px; border-right: 1px solid var(--borda); border-bottom: 1px solid var(--borda); cursor: pointer; }
.cal .dia:hover { background: #f8fafc; }
.cal .dia.fora { background: #fafbfc; color: #cbd5e1; }
.cal .dia.hoje .n { background: var(--acento); color: #fff; border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; }
.cal .dia.feriado { background: #fff7ed; }
.cal .n { font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.cal .ev { font-size: 11.5px; padding: 2px 6px; border-radius: 4px; margin-bottom: 3px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; background: var(--acento-suave); color: var(--acento-forte); }
.cal .ev.Audiência { background: var(--azul-suave); color: var(--azul); }
.cal .ev.feito { opacity: .55; text-decoration: line-through; }
.cal .ev.atraso { background: var(--vermelho-suave); color: var(--vermelho); }
.cal .fer { font-size: 10.5px; color: var(--ambar); }

/* Detalhe */
.detalhes { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 20px; }
.detalhes div small { display: block; color: var(--texto-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; }
.linha-tempo { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--borda); }
.linha-tempo li { position: relative; padding: 0 0 16px 14px; }
.linha-tempo li::before { content: ""; position: absolute; left: -21px; top: 5px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--acento); border: 2px solid #fff; }
.linha-tempo small { color: var(--texto-3); }
.abas { display: flex; gap: 4px; border-bottom: 1px solid var(--borda); margin-bottom: 16px; overflow-x: auto; }
.abas button { border: 0; background: none; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--texto-2);
  border-bottom: 2px solid transparent; white-space: nowrap; }
.abas button.ativo { color: var(--acento); border-bottom-color: var(--acento); }

/* IA */
.ia-saida { line-height: 1.65; }
.ia-saida h2 { font-size: 16px; margin: 18px 0 6px; }
.ia-saida h3 { font-size: 14px; margin: 14px 0 4px; }
.ia-saida blockquote { margin: 0 0 10px; padding: 8px 12px; background: var(--acento-suave); border-left: 3px solid var(--acento); border-radius: 6px; }
.ia-saida ul, .ia-saida ol { padding-left: 22px; }
.ia-saida p { margin: 0 0 10px; }
.ia-saida code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; }
.doc-saida { white-space: pre-wrap; font-family: Georgia, "Times New Roman", serif; font-size: 14.5px; line-height: 1.7;
  background: #fff; border: 1px solid var(--borda); padding: 28px; border-radius: 8px; max-height: 60vh; overflow: auto; }
.aviso-ia { font-size: 12.5px; color: var(--texto-3); }
.pilula-ia { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px;
  border-radius: 999px; background: var(--acento-suave); color: var(--acento-forte); }
.pilula-ia svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.pilula-ia.off { background: var(--ambar-suave); color: var(--ambar); }

/* Modal e avisos */
#modal-camada { position: fixed; inset: 0; background: rgba(5, 15, 38, .55); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--superficie); border-radius: 14px; width: min(760px, 100%); max-height: calc(100vh - 32px);
  display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(5, 15, 38, .35); }
.modal.largo { width: min(980px, 100%); }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--borda); }
.modal header h2 { font-size: 17px; }
.modal .corpo { padding: 20px; overflow-y: auto; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--borda); }
#avisos { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; }
.aviso { background: var(--navy-900); color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--sombra); max-width: 360px; }
.aviso.erro { background: var(--vermelho); }
.erro-form { color: var(--vermelho); background: var(--vermelho-suave); padding: 8px 12px; border-radius: 8px; }

/* ---------- Responsivo ---------- */
@media (max-width: 1080px) {
  .grade-2, .grade-3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .acesso { grid-template-columns: 1fr; }
  .acesso-marca { padding: 28px 16px; }
  .acesso-marca ul { display: none; }
  .app { grid-template-columns: 1fr; }
  .lateral { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .app.menu-aberto .lateral { transform: none; box-shadow: 0 0 0 100vmax rgba(5, 15, 38, .5); }
  .topo .btn-menu { display: inline-flex; }
  .topo { padding: 10px 16px; }
  .usuario .nome { display: none; }
  #conteudo { padding: 18px 16px 40px; }
  .grade-form { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(3, 82vw); }
  .cal .dia { min-height: 64px; padding: 3px; }
  .cal .ev { font-size: 0; height: 6px; padding: 0; }
  .cal .fer { display: none; }
}
