:root {
  --bg: #0b0d10;
  --surface: #13171c;
  --surface-2: #191e25;
  --linha: #252c35;
  --texto: #e8edf4;
  --texto-fraco: #8e9aab;
  --azul: #4c8dff;
  --verde: #2fbf71;
  --amarelo: #e8b339;
  --vermelho: #f2555a;
  --fonte: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--texto);
  font-family: var(--fonte);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

a {
  color: var(--azul);
}

.oculto {
  display: none !important;
}

/* ---------- topo ---------- */

header.topo {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--linha);
  position: sticky;
  top: 0;
  z-index: 20;
}

header.topo h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

header.topo .codigo {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--texto-fraco);
}

.espaco {
  flex: 1;
}

main {
  padding: 20px;
  max-width: 100%;
}

/* ---------- botoes ---------- */

button {
  background: var(--surface-2);
  border: 1px solid var(--linha);
  color: var(--texto);
  padding: 7px 13px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.12s, border-color 0.12s;
}

button:hover:not(:disabled) {
  background: #222934;
  border-color: #333d4a;
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

button.primario {
  background: var(--azul);
  border-color: var(--azul);
  color: #fff;
}

button.primario:hover:not(:disabled) {
  background: #3d7ced;
  border-color: #3d7ced;
}

button.perigo:hover:not(:disabled) {
  background: #3a1c1f;
  border-color: var(--vermelho);
  color: var(--vermelho);
}

button.discreto {
  background: none;
  border: none;
  color: var(--texto-fraco);
  padding: 4px 7px;
}

button.discreto:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--texto);
}

/* ---------- login ---------- */

.login {
  max-width: 320px;
  margin: 14vh auto;
  background: var(--surface);
  border: 1px solid var(--linha);
  border-radius: 10px;
  padding: 26px;
}

.login h2 {
  margin: 0 0 4px;
  font-size: 17px;
}

.login p {
  margin: 0 0 18px;
  color: var(--texto-fraco);
  font-size: 13px;
}

.login input,
.campo input,
.campo select,
.campo textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--linha);
  border-radius: 6px;
  padding: 8px 10px;
}

.login input:focus,
.campo input:focus,
.campo select:focus,
table input:focus,
table select:focus {
  outline: none;
  border-color: var(--azul);
}

.login button {
  width: 100%;
  margin-top: 12px;
}

.erro {
  color: var(--vermelho);
  font-size: 13px;
  margin-top: 10px;
  min-height: 18px;
}

/* ---------- cabecalho do orcamento ---------- */

.cartao {
  background: var(--surface);
  border: 1px solid var(--linha);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.grade {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.campo label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--texto-fraco);
  margin-bottom: 5px;
}

.campo textarea {
  resize: vertical;
  min-height: 38px;
}

.dica-campo {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--texto-fraco);
  min-height: 14px;
}

.aliquotas {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--linha);
}

.aliquotas .dica {
  font-size: 12px;
  color: var(--texto-fraco);
  margin: 0 0 10px;
}

/* ---------- tabela de itens ---------- */

.rolagem {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--linha);
  border-radius: 10px;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 1100px;
}

th {
  text-align: right;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--texto-fraco);
  font-weight: 600;
  padding: 10px 8px;
  border-bottom: 1px solid var(--linha);
  white-space: nowrap;
  background: var(--surface);
  position: sticky;
  top: 0;
}

th.esq,
td.esq {
  text-align: left;
}

td {
  padding: 3px 6px;
  text-align: right;
  border-bottom: 1px solid #1c222a;
  white-space: nowrap;
}

tbody tr:hover td {
  background: #161b21;
}

table input,
table select {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 5px 6px;
  text-align: right;
  width: 100%;
  min-width: 56px;
}

table input:hover,
table select:hover {
  border-color: var(--linha);
}

table input.esq {
  text-align: left;
}

table td.calc {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--texto-fraco);
  padding-right: 10px;
}

table td.calc.forte {
  color: var(--texto);
}

td .neg,
.neg {
  color: var(--vermelho);
}

.col-desc input {
  min-width: 260px;
}

.col-pn input {
  min-width: 120px;
}

.col-modalidade select {
  min-width: 112px;
}

/* Coluna de imposto que nao se aplica a modalidade daquela linha (ex: ISS
   numa linha de estoque proprio) - ver resolverModalidade em app.js. */
.mudo {
  opacity: 0.35;
}

tfoot td {
  border-top: 1px solid var(--linha);
  border-bottom: none;
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 11px 8px;
  background: var(--surface-2);
}

tfoot td.rotulo {
  font-family: var(--fonte);
  font-weight: 600;
  text-align: left;
}

.acoes-tabela {
  display: flex;
  gap: 8px;
  padding: 11px;
}

/* ---------- resumo ---------- */

.resumo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 1px;
  background: var(--linha);
  border: 1px solid var(--linha);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 16px;
}

.resumo div {
  background: var(--surface);
  padding: 13px 14px;
}

.resumo span {
  display: block;
  font-size: 10.5px
  ;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--texto-fraco);
  margin-bottom: 5px;
}

.resumo strong {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
}

.resumo div.destaque {
  background: var(--surface-2);
}

/* ---------- lista ---------- */

table.lista {
  min-width: 860px;
}

table.lista td {
  padding: 10px 8px;
}

table.lista tbody tr {
  cursor: pointer;
}

.etiqueta {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--linha);
  color: var(--texto-fraco);
}

.etiqueta.rascunho {
  color: var(--texto-fraco);
}

.etiqueta.enviado {
  color: var(--amarelo);
  border-color: #4a3c1c;
}

.etiqueta.aprovado {
  color: var(--verde);
  border-color: #1d4231;
}

.etiqueta.perdido {
  color: var(--vermelho);
  border-color: #452126;
}

.vazio {
  padding: 40px 20px;
  text-align: center;
  color: var(--texto-fraco);
}

.aviso {
  background: #2a2113;
  border: 1px solid #4a3c1c;
  color: #f0cd84;
  border-radius: 8px;
  padding: 11px 14px;
  margin-bottom: 16px;
  font-size: 13px;
}

@media (prefers-color-scheme: light) {
  /* A ferramenta e de uso interno e foi desenhada no escuro de proposito:
     a leitura de numero em coluna densa fica melhor com fundo escuro. */
}
