/* Gerador de Minutas e Contratos — visual inspirado no Bitrix24 */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --roxo-escuro: #23235f;
  --roxo: #4c1d95;
  --roxo-claro: #7c3aed;
  --verde: #7cb342;
  --verde-escuro: #689f38;
  --azul: #4a5fd5;
  --fundo: #eef0f7;
  --borda: #e3e6f0;
  --texto: #2b2f36;
  --cinza: #6b7280;
}
html, body { height: 100%; }
body { font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif; background: var(--fundo); color: var(--texto); font-size: 14px; }
a { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }

.app { display: flex; min-height: 100vh; }

/* ---- barra lateral ---- */
.sidebar {
  width: 224px; flex-shrink: 0; color: #fff;
  background: linear-gradient(180deg, #1e1b4b 0%, #312e81 45%, #4c1d95 100%);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.12); }
.logo-mark { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #7c3aed, #2563eb); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; }
.logo-text { font-weight: 700; font-size: 16px; line-height: 1.1; }
.logo-text span { display: block; font-size: 10px; font-weight: 400; opacity: .75; margin-top: 2px; }
.sidebar nav { padding: 12px 8px; flex: 1; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: #dbeafe; font-size: 14px; margin-bottom: 2px; }
.sidebar nav a:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.sidebar nav a.ativo { background: rgba(255,255,255,.2); color: #fff; font-weight: 600; }
.sidebar nav .ic { width: 20px; text-align: center; font-size: 15px; }
.sidebar-rodape { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.12); font-size: 13px; }
.sidebar-rodape .usuario { font-weight: 600; margin-bottom: 4px; }
.sidebar-rodape a { color: #c7d2fe; }

/* ---- área principal ---- */
.principal { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topo { height: 58px; background: var(--roxo-escuro); display: flex; align-items: center; gap: 14px; padding: 0 20px; position: sticky; top: 0; z-index: 20; }
.busca { flex: 1; max-width: 520px; }
.busca input { width: 100%; padding: 9px 14px; border-radius: 20px; border: none; background: rgba(255,255,255,.14); color: #fff; font-size: 14px; outline: none; }
.busca input::placeholder { color: rgba(255,255,255,.6); }
.conteudo { padding: 22px 26px 40px; max-width: 1180px; width: 100%; margin: 0 auto; }
h1 { font-size: 24px; margin-bottom: 4px; }
.subtitulo { color: var(--cinza); margin-bottom: 18px; }

/* ---- botões ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: none; cursor: pointer; border-radius: 8px; padding: 9px 16px; font-size: 14px; font-weight: 600; background: var(--azul); color: #fff; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-verde { background: var(--verde); }
.btn-verde:hover { background: var(--verde-escuro); }
.btn-cinza { background: #fff; color: var(--texto); border: 1px solid var(--borda); }
.btn-perigo { background: #dc2626; }
.btn-pequeno { padding: 6px 10px; font-size: 13px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- cartões / tabelas ---- */
.cartao { background: #fff; border-radius: 12px; box-shadow: 0 1px 4px rgba(16,24,40,.08); padding: 18px 20px; margin-bottom: 18px; }
table.tabela { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 4px rgba(16,24,40,.08); }
.tabela th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--cinza); padding: 12px 14px; border-bottom: 1px solid var(--borda); background: #fafbff; }
.tabela td { padding: 12px 14px; border-bottom: 1px solid #f0f1f6; vertical-align: middle; }
.tabela tr:last-child td { border-bottom: none; }
.tabela tr:hover td { background: #f8f9ff; }
.tabela .acoes { white-space: nowrap; text-align: right; }
.etiqueta { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; background: #eef2ff; color: #4338ca; }
.etiqueta.orius { background: #fff3e0; color: #e65100; }
.etiqueta.tavares { background: #e0f2f1; color: #00695c; }

/* ---- estado vazio ---- */
.vazio { background: #fff; border-radius: 12px; box-shadow: 0 1px 4px rgba(16,24,40,.08); padding: 64px 20px; text-align: center; }
.vazio h2 { font-size: 26px; font-weight: 400; margin-bottom: 10px; }
.vazio p { color: var(--cinza); margin-bottom: 20px; }

/* ---- flash ---- */
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.flash.ok { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.flash.erro { background: #fdecea; color: #b71c1c; border: 1px solid #f5c6cb; }

/* ---- painel lateral animado ---- */
.overlay { position: fixed; inset: 0; background: rgba(15,15,40,.45); opacity: 0; pointer-events: none; transition: opacity .28s; z-index: 40; }
.overlay.visivel { opacity: 1; pointer-events: auto; }
.painel { position: fixed; top: 0; right: 0; height: 100vh; width: 540px; max-width: 94vw; background: #fff; box-shadow: -8px 0 30px rgba(0,0,0,.25); transform: translateX(105%); transition: transform .3s ease; z-index: 50; display: flex; flex-direction: column; }
.painel.visivel { transform: translateX(0); }
.painel-topo { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--borda); }
.painel-topo h2 { font-size: 19px; }
.fechar { border: none; background: none; font-size: 18px; cursor: pointer; color: var(--cinza); padding: 4px 8px; }
.painel-corpo { padding: 20px 22px; overflow-y: auto; flex: 1; }
.painel-rodape { padding: 16px 22px; border-top: 1px solid var(--borda); display: flex; gap: 10px; justify-content: flex-end; }

/* ---- formulários ---- */
.campo { margin-bottom: 14px; }
.campo label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 13px; }
.campo label .obrig { color: #dc2626; }
.campo input, .campo select, .campo textarea { width: 100%; padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff; }
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: 2px solid #c7d2fe; border-color: var(--azul); }
.campo textarea { min-height: 90px; resize: vertical; }
.campo .ajuda { font-size: 12px; color: var(--cinza); margin-top: 4px; }
.linha { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.linha3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
fieldset { border: 1px solid var(--borda); border-radius: 10px; padding: 14px; margin-bottom: 16px; }
legend { font-weight: 700; padding: 0 6px; }

/* ---- chips de marcação ---- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }
.chip { border: 1px solid #c7d2fe; background: #eef2ff; color: #3730a3; border-radius: 20px; padding: 5px 11px; font-size: 13px; cursor: pointer; font-family: ui-monospace, monospace; }
.chip:hover { background: #dbeafe; }
.chip small { font-family: inherit; opacity: .7; margin-left: 4px; }

/* ---- documento / timbrado ---- */
.folha { background: #fff; width: 210mm; min-height: 297mm; margin: 0 auto; padding: 18mm 20mm 22mm; position: relative; box-shadow: 0 2px 14px rgba(16,24,40,.15); }
.folha .marca-dagua { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 0; }
.folha .marca-dagua img { width: 88%; opacity: .9; }
.folha .cabecalho { text-align: center; margin-bottom: 22px; position: relative; z-index: 1; }
.folha .cabecalho img { max-width: 100%; }
.folha .cabecalho img.logo-orius { width: 100%; }
.folha .cabecalho img.logo-tavares { width: 150px; }
.folha .rodape { position: absolute; left: 0; right: 0; bottom: 12mm; text-align: center; z-index: 1; }
.folha .rodape img { width: 88%; }
.folha .corpo { position: relative; z-index: 1; font-size: 15px; line-height: 1.65; }
.folha .corpo h3 { text-align: center; margin-bottom: 18px; font-size: 17px; }
.folha .corpo p { margin-bottom: 12px; text-align: justify; }
.folha .num-pagina { text-align: center; color: #888; font-size: 12px; }

/* ---- login ---- */
.login-fundo { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e1b4b, #4c1d95 60%, #7c3aed); padding: 20px; }
.login-caixa { background: #fff; border-radius: 16px; padding: 34px 30px; width: 380px; max-width: 100%; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.login-caixa h1 { font-size: 22px; margin-bottom: 4px; }
.login-caixa p { color: var(--cinza); margin-bottom: 20px; }

/* ---- dashboard ---- */
.estatisticas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.estatistica { background: #fff; border-radius: 12px; padding: 18px; box-shadow: 0 1px 4px rgba(16,24,40,.08); }
.estatistica .numero { font-size: 30px; font-weight: 700; color: var(--roxo); }
.estatistica .rotulo { color: var(--cinza); font-size: 13px; margin-top: 2px; }
.passo { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid #f0f1f6; }
.passo:last-child { border-bottom: none; }
.passo .n { width: 30px; height: 30px; border-radius: 50%; background: var(--roxo); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.mono { font-family: ui-monospace, monospace; background: #f3f4f6; padding: 1px 6px; border-radius: 4px; font-size: 13px; }
code { font-family: ui-monospace, monospace; }

@media print {
  .sidebar, .topo, .painel, .overlay, .sem-impressao { display: none !important; }
  body { background: #fff; }
  .conteudo { padding: 0; max-width: none; }
  .folha { box-shadow: none; margin: 0; width: 100%; min-height: auto; }
}
@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .sidebar .logo-text, .sidebar nav a { font-size: 0; }
  .sidebar nav a .ic { font-size: 18px; }
  .estatisticas { grid-template-columns: repeat(2, 1fr); }
  .linha, .linha3 { grid-template-columns: 1fr; }
}
