:root { color-scheme: dark; }
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #0b0b0d;
  color: #f4f4f5;
}
h1, h2, h3 { letter-spacing: -.01em; }
button {
  font: inherit;
  cursor: pointer;
  background: #27272a;
  color: #f4f4f5;
  border: 1px solid #3f3f46;
  border-radius: .5rem;
  padding: .5rem .9rem;
}
button:hover { background: #3f3f46; }
.btn-primario { background: #2563eb; border-color: #2563eb; }
.btn-primario:hover { background: #1d4ed8; }
select, input[type="text"], input[type="number"], input[type="file"] {
  font: inherit;
  background: #18181b;
  color: #f4f4f5;
  border: 1px solid #3f3f46;
  border-radius: .5rem;
  padding: .5rem .6rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #27272a;
  position: sticky;
  top: 0;
  background: #0b0b0d;
  z-index: 5;
}
.periodo-selector { display: flex; align-items: center; gap: .4rem; }
.acciones { display: flex; gap: .5rem; }

main { max-width: 80rem; margin: 0 auto; padding: 1.5rem; display: grid; gap: 1.5rem; }

.tarjetas-resumen { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; }
.tarjeta {
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: .75rem;
  padding: 1rem 1.25rem;
}
.tarjeta .etiqueta { font-size: .8rem; color: #a1a1aa; }
.tarjeta .valor { font-size: 1.5rem; font-weight: 600; margin-top: .25rem; }
.valor.positivo { color: #4ade80; }
.valor.negativo { color: #f87171; }

.panel {
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: .75rem;
  padding: 1.25rem;
}
.ayuda { color: #a1a1aa; font-size: .9rem; line-height: 1.5; margin: .5rem 0 1rem; }

.form-upload { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.estado { margin-top: .75rem; font-size: .9rem; }
.estado.ok { color: #4ade80; }
.estado.error { color: #f87171; }

.lista-archivos { margin-top: 1rem; display: grid; gap: .4rem; }
.archivo-item {
  display: flex; justify-content: space-between; gap: 1rem;
  font-size: .85rem; color: #d4d4d8;
  background: #0f0f11; border: 1px solid #27272a; border-radius: .5rem;
  padding: .5rem .75rem;
}
.archivo-item .detalle { color: #a1a1aa; }

table { border-collapse: collapse; width: 100%; font-size: .85rem; }
th, td { border: 1px solid #27272a; padding: .4rem .6rem; text-align: right; white-space: nowrap; }
th { background: #1f1f23; text-align: center; position: sticky; top: 3.6rem; }
td.concepto, th.concepto { text-align: left; }
tr.distrito-header td { background: #1f1f23; font-weight: 600; text-align: left; }
tr.fila-neto td { font-weight: 600; background: #15201a; }
.tabla-scroll { overflow-x: auto; }
input.celda-editable {
  width: 7rem; text-align: right; background: #0f0f11; border: 1px solid #3f3f46; border-radius: .35rem; padding: .25rem .4rem;
}

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 2rem; z-index: 20; overflow-y: auto;
}
.modal.oculto { display: none; }
.modal-contenido {
  background: #18181b; border: 1px solid #27272a; border-radius: .75rem;
  padding: 1.5rem; max-width: 50rem; width: 100%; position: relative;
}
.modal-contenido .cerrar {
  position: absolute; top: .75rem; right: .75rem; border: none; background: transparent; font-size: 1.4rem; line-height: 1;
}
.lista-config { display: grid; gap: .4rem; margin: .75rem 0 1.5rem; max-height: 16rem; overflow-y: auto; }
.fila-config { display: flex; gap: .5rem; align-items: center; font-size: .85rem; }
.fila-config input { flex: 1; }
.form-articulo { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.form-articulo input { flex: 1; min-width: 8rem; }
