/* assets/css/main.css */
:root {
  --color-primario: #00aaaa;
  --color-secundario: #83dc52;
  --color-error: #e60050;
  --color-texto: #333;
  --color-texto-claro: #555;
  --color-borde: #ddd;
  --color-borde-suave: #eee;
  --color-fondo: #f9f9f9;
  --color-blanco: #fff;
  --sombra: 0 0 10px rgba(0, 0, 0, 0.05);
  --sombra-media: 0 8px 24px rgba(0, 0, 0, 0.08);
  --radio-borde: 6px;
}

/* Decimales pequeños en montos */
span.dec {
  font-size: 0.75em;
  vertical-align: baseline;
  opacity: 0.5;
}

/* Resumen cards compartido entre costos e inventario */
.resumen-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.resumen-card {
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.resumen-card--azul {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.resumen-card--verde {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.resumen-card--rojo {
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.resumen-card--gris {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
}

.resumen-card--naranja {
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.resumen-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.resumen-valor {
  font-size: 26px;
  font-weight: 700;
  color: #1f2937;
}

.resumen-sub {
  font-size: 12px;
  color: #6b7280;
}

@media (max-width: 900px) {
  .resumen-grid {
    grid-template-columns: 1fr;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 20px;
  background: var(--color-fondo);
  color: var(--color-texto);
  line-height: 1.4;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

h1,
h2,
h3 {
  color: #2c3e50;
  margin-top: 0;
}

h1 {
  font-size: 1.5em;
  margin-bottom: 20px;
}

h2 {
  font-size: 1.2em;
}

h3 {
  font-size: 1em;
}

.seccion-titulo {
  margin-bottom: 10px;
}

section {
  margin-bottom: 0;
}

fieldset {
  border: 1px solid var(--color-borde);
  border-radius: var(--radio-borde);
  padding: 15px;
  margin-bottom: 0;
  background: var(--color-blanco);
}

legend {
  font-size: 1.1rem;
  font-weight: bold;
  padding: 0 6px;
  color: #2c3e50;
}

.form-group {
  margin-bottom: 15px;
  position: relative;
}

.form-group-dc {
  position: relative;
  margin-bottom: 10px;
}

label {
  display: block;
  font-weight: bold;
  margin-bottom: 4px;
  font-size: 0.9em;
  color: var(--color-texto-claro);
}

input,
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-borde);
  border-radius: var(--radio-borde);
  font-size: 0.95em;
  background: #fff;
  color: var(--color-texto);
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 2px solid rgba(0, 170, 170, 0.25);
  border-color: var(--color-primario);
}

textarea {
  resize: vertical;
  min-height: 70px;
}

select {
  background-color: white;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23333' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  appearance: none;
  padding-right: 30px !important;
}

button {
  padding: 10px 15px;
  border: none;
  border-radius: var(--radio-borde);
  cursor: pointer;
  font-weight: bold;
  font-size: 0.9em;
  transition: background-color 0.3s, transform 0.2s;
}

button:hover {
  transform: translateY(-1px);
}

.oculto {
  display: none !important;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
}

.resaltado {
  background-color: #9ffff7 !important;
}

/* ------ Modal compartido ------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-content.modal-sm {
  max-width: 520px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #6b7280;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: #1f2937;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-body .field {
  display: flex;
  flex-direction: column;
}

.modal-body .field label {
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
}

.modal-body .field input,
.modal-body .field select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  color: #1f2937;
  box-sizing: border-box;
}

.modal-body .field input:focus,
.modal-body .field select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
}

.form-row {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

.form-row .field {
  display: flex;
  flex-direction: column;
  min-width: 140px;
  flex: 1 1 160px;
}

.btn-cancelar {
  background: #6b7280;
}

.btn-cancelar:hover {
  background: #4b5563;
}

/* Banner de proyección personal */
.banner-proyeccion {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 12px 20px;
  margin-bottom: 16px;
  font-size: 15px;
  color: #166534;
  text-align: center;
  font-weight: 500;
}

/* Rentabilidad por documento */
.utilidad-pos {
  color: #059669;
  font-weight: 600;
}
.utilidad-neg {
  color: #b91c1c;
  font-weight: 600;
}

