:root {
  --noite: #07111f;
  --noite-2: #0e1c31;
  --laranja: #f47b20;
  --laranja-escuro: #a84a08;
  --fundo: #f4f5f7;
  --cartao: #ffffff;
  --tinta: #0f1b2d;
  --texto: #445168;
  --suave: #6b778c;
  --linha: #dfe3ea;
  --verde: #1a7f4b;
  --vermelho: #b3261e;
  --raio: 8px;
  --sans: "Inter", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 400 15px/1.5 var(--sans); color: var(--texto); background: var(--fundo); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; color: var(--tinta); font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--laranja); outline-offset: 2px; }
[hidden] { display: none !important; }

.carregando { display: grid; place-items: center; min-height: 100vh; }
.carregando__txt { color: var(--suave); }

/* Botões e campos */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 40px; padding: .5rem 1rem; border: 1px solid var(--linha); border-radius: var(--raio); background: var(--cartao); color: var(--tinta); font-weight: 600; font-size: .9rem; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #b9c0cc; }
.btn--primario { background: var(--laranja); border-color: var(--laranja); color: var(--noite); }
.btn--primario:hover { background: #ff8d38; border-color: #ff8d38; }
.btn--escuro { background: var(--noite); border-color: var(--noite); color: #fff; }
.btn--perigo { color: var(--vermelho); }
.btn--sm { min-height: 32px; padding: .25rem .7rem; font-size: .82rem; }
.btn[disabled] { opacity: .55; cursor: default; }

.campo { display: grid; gap: .3rem; }
.campo label, .rotulo { font-size: .78rem; font-weight: 600; color: var(--suave); text-transform: uppercase; letter-spacing: .06em; }
.campo input, .campo select, .campo textarea { width: 100%; min-height: 40px; padding: .5rem .7rem; border: 1px solid var(--linha); border-radius: var(--raio); background: #fff; color: var(--tinta); }
.campo textarea { min-height: 84px; resize: vertical; }
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: none; border-color: var(--laranja); box-shadow: 0 0 0 3px rgba(244, 123, 32, .2); }
.grade-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.pilha { display: grid; gap: .9rem; }

/* Entrada */
.entrada { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: var(--noite); }
.entrada__caixa { width: min(100%, 400px); padding: 2rem; background: var(--cartao); border-radius: 12px; }
.entrada__logo { display: block; height: 56px; width: auto; margin: 0 auto 1.5rem; }
.entrada__caixa h1 { text-align: center; margin-bottom: .35rem; }
.entrada__sub { text-align: center; color: var(--suave); margin-bottom: 1.5rem; }
.entrada__demo { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--linha); display: grid; gap: .6rem; }
.entrada__demo p { font-size: .85rem; color: var(--suave); text-align: center; }

/* Estrutura */
.casca { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.lateral { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 1.25rem 1rem; background: var(--noite); color: rgba(255, 255, 255, .78); }
.lateral__logo { height: 44px; width: auto; align-self: flex-start; margin-bottom: 1.75rem; }
.lateral nav { display: grid; gap: .2rem; }
.lateral nav a { display: block; padding: .6rem .75rem; border-radius: var(--raio); text-decoration: none; font-weight: 500; font-size: .93rem; }
.lateral nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.lateral nav a.ativo { background: rgba(244, 123, 32, .16); color: #fff; box-shadow: inset 3px 0 0 var(--laranja); }
.lateral__pe { margin-top: auto; padding-top: 1rem; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .85rem; }
.lateral__pe strong { display: block; color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.lateral__pe button { margin-top: .6rem; padding: 0; background: none; border: 0; color: rgba(255, 255, 255, .78); text-decoration: underline; cursor: pointer; }
.demo-faixa { margin-bottom: 1rem; padding: .5rem .65rem; border-radius: var(--raio); background: rgba(244, 123, 32, .16); color: #ffd0a8; font-size: .78rem; line-height: 1.35; }

.principal { padding: 1.5rem clamp(1rem, 3vw, 2.25rem) 3rem; min-width: 0; }
.topo { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.topo__acoes { display: flex; gap: .6rem; flex-wrap: wrap; }
.resumo { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem; margin-bottom: 1.25rem; }
.resumo div { padding: .9rem 1rem; background: var(--cartao); border: 1px solid var(--linha); border-radius: var(--raio); }
.resumo strong { display: block; font-size: 1.15rem; overflow-wrap: anywhere; color: var(--tinta); font-weight: 700; }
.resumo span { font-size: .8rem; color: var(--suave); }

/* Funil */
.funil { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: .9rem; overflow-x: auto; padding-bottom: 1rem; align-items: start; }
.coluna { background: #e9ecf1; border-radius: var(--raio); padding: .6rem; min-height: 180px; }
.coluna.sobre { outline: 2px dashed var(--laranja); outline-offset: -2px; }
.coluna__cab { display: flex; justify-content: space-between; align-items: baseline; padding: .25rem .4rem .6rem; }
.coluna__cab h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }
.coluna__cab span { font-size: .78rem; color: var(--suave); }
.coluna__lista { display: grid; gap: .5rem; }
.lead { display: block; width: 100%; text-align: left; padding: .7rem .8rem; background: var(--cartao); border: 1px solid var(--linha); border-radius: var(--raio); cursor: grab; }
.lead:hover { border-color: #b9c0cc; }
.lead.arrastando { opacity: .4; }
.lead strong { display: block; color: var(--tinta); font-weight: 600; }
.lead small { display: block; color: var(--suave); }
.lead__pe { display: flex; justify-content: space-between; gap: .5rem; margin-top: .5rem; font-size: .78rem; color: var(--suave); }
.lead__valor { color: var(--tinta); font-weight: 600; }
.etiqueta { display: inline-block; padding: .1rem .5rem; border-radius: 99px; background: #eef1f5; color: var(--texto); font-size: .72rem; font-weight: 600; }
.etiqueta--site { background: #fdebdc; color: var(--laranja-escuro); }
.etiqueta--aprovado, .etiqueta--ganho { background: #dcf3e6; color: var(--verde); }
.etiqueta--recusado, .etiqueta--perdido { background: #fbe1df; color: var(--vermelho); }
.etiqueta--enviado { background: #e0ebff; color: #1d4f9c; }
.vazio { padding: 2.5rem 1rem; text-align: center; color: var(--suave); background: var(--cartao); border: 1px dashed var(--linha); border-radius: var(--raio); }

/* Tabelas e cartões */
.cartao { background: var(--cartao); border: 1px solid var(--linha); border-radius: var(--raio); padding: 1.25rem; }
.tabela-rolo { overflow-x: auto; background: var(--cartao); border: 1px solid var(--linha); border-radius: var(--raio); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--linha); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); font-weight: 600; background: #fafbfc; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tr.clicavel { cursor: pointer; }
tr.clicavel:hover td { background: #fafbfc; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Orçamento */
.orc { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.25rem; align-items: start; }
.itens td { padding: .35rem .4rem; }
.itens input { width: 100%; min-height: 36px; padding: .35rem .5rem; border: 1px solid transparent; border-radius: 6px; background: transparent; }
.itens input:hover { border-color: var(--linha); }
.itens input:focus { outline: none; border-color: var(--laranja); background: #fff; }
.itens .num input { text-align: right; }
.itens .c-un { width: 72px; } .itens .c-qtd { width: 96px; } .itens .c-valor { width: 140px; } .itens .c-sub { width: 130px; } .itens .c-x { width: 44px; }
.remover { width: 32px; height: 32px; border: 0; border-radius: 6px; background: none; color: var(--suave); cursor: pointer; font-size: 1.1rem; }
.remover:hover { background: #fbe1df; color: var(--vermelho); }
.totais { display: grid; gap: .5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--linha); }
.totais div { display: flex; justify-content: space-between; gap: 1rem; }
.totais .total { font-size: 1.2rem; font-weight: 700; color: var(--tinta); }

/* Gaveta lateral */
.gaveta-fundo { position: fixed; inset: 0; z-index: 40; background: rgba(7, 17, 31, .45); }
.gaveta { position: fixed; z-index: 41; top: 0; right: 0; bottom: 0; width: min(100%, 460px); padding: 1.25rem 1.5rem 2rem; background: var(--cartao); overflow-y: auto; transform: translateX(105%); transition: transform .22s ease; box-shadow: -18px 0 50px rgba(7, 17, 31, .2); }
.gaveta.aberta { transform: none; }
.gaveta__cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.1rem; }
.fechar { width: 36px; height: 36px; flex: none; border: 1px solid var(--linha); border-radius: var(--raio); background: #fff; cursor: pointer; font-size: 1.1rem; }
.gaveta__acoes { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.1rem; }
.historico { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--linha); }
.historico ul { list-style: none; margin: .9rem 0 0; padding: 0; display: grid; gap: .75rem; }
.historico li { padding-top: .75rem; border-top: 1px solid var(--linha); }
.historico small { display: block; color: var(--suave); font-size: .78rem; }
.nota { display: flex; gap: .5rem; margin-top: .75rem; }
.nota input { flex: 1; min-height: 40px; padding: .5rem .7rem; border: 1px solid var(--linha); border-radius: var(--raio); }

.avisos { position: fixed; z-index: 60; left: 50%; bottom: 1.25rem; transform: translateX(-50%); display: grid; gap: .5rem; }
.aviso { padding: .7rem 1.1rem; border-radius: var(--raio); background: var(--noite); color: #fff; font-size: .9rem; box-shadow: 0 10px 30px rgba(7, 17, 31, .3); }
.aviso--erro { background: var(--vermelho); }

/* Só na impressão do orçamento */
.papel-cab { display: none; }

@media (max-width: 900px) {
  .casca { grid-template-columns: 1fr; }
  .lateral { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .75rem; padding: .75rem 1rem; }
  .lateral__logo { height: 34px; margin: 0; }
  .lateral nav { display: flex; gap: .15rem; overflow-x: auto; flex: 1 1 100%; order: 3; }
  .lateral nav a { white-space: nowrap; padding: .45rem .7rem; }
  .lateral nav a.ativo { box-shadow: inset 0 -3px 0 var(--laranja); }
  .lateral__pe { margin: 0 0 0 auto; padding: 0; border: 0; display: flex; gap: .75rem; align-items: center; }
  .lateral__pe strong { display: none; }
  .lateral__pe button { margin: 0; }
  .demo-faixa { order: 4; flex: 1 1 100%; margin: 0; }
  .resumo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .orc { grid-template-columns: 1fr; }
  .grade-2 { grid-template-columns: 1fr; }
}

@media print {
  body { background: #fff; font-size: 12px; }
  .lateral, .topo__acoes, .nao-imprime, .gaveta, .gaveta-fundo, .avisos, .c-x, .remover { display: none !important; }
  .casca { display: block; }
  .principal { padding: 0; }
  .orc { display: block; }
  .cartao, .tabela-rolo { border: 0; padding: 0; }
  .papel-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 2rem; padding-bottom: 1rem; margin-bottom: 1.25rem; border-bottom: 2px solid var(--noite); }
  .papel-cab img { height: 64px; }
  .papel-cab address { font-style: normal; text-align: right; font-size: 11px; line-height: 1.5; }
  .itens input, .campo input, .campo select, .campo textarea { border: 0 !important; padding: 0; min-height: 0; background: none; box-shadow: none; appearance: none; }
  .campo textarea { resize: none; }
  th { background: none; }
}
.campo-linha { min-width: 170px; }
