/* ============================================================
   RICH · Gestión de Cesiones
   Paleta extraída de la identidad de marca (isotipo SR):
   negro #0B0B0B · dorado #CEAB5A · azul noche #10293C · marfil #F7F4EF
   ============================================================ */

:root {
  --rich-negro: #0b0b0b;
  --rich-dorado: #ceab5a;
  --rich-dorado-suave: #e4cd97;
  --rich-navy: #10293c;
  --rich-navy-suave: #1c3b54;
  --rich-marfil: #f7f4ef;
  --rich-blanco: #ffffff;
  --rich-gris-texto: #4a4a46;
  --rich-borde: #e4ded2;
  --rich-error: #a3342b;
  --rich-error-bg: #fbeae8;
  --rich-ok: #2f6b45;
  --rich-ok-bg: #eaf3ec;
  --rich-warn: #8a6412;
  --rich-warn-bg: #fbf1dd;
  --sombra: 0 8px 24px rgba(11, 11, 11, 0.08);
  --radio: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--rich-marfil);
  color: var(--rich-negro);
  font-family: "Jost", "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3, h4 {
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--rich-negro);
  margin: 0 0 0.5em;
}

a { color: var(--rich-navy); }

/* ---------- Pantalla de login / instalación ---------- */
.pantalla-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(circle at top, var(--rich-navy) 0%, var(--rich-negro) 70%);
  padding: 24px;
}

.tarjeta-login {
  background: var(--rich-blanco);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 40px 36px;
  max-width: 380px;
  width: 100%;
  text-align: center;
}

.logo-login {
  height: 64px;
  margin-bottom: 18px;
  filter: invert(1);
}

.tarjeta-login h1 {
  font-size: 22px;
  margin-bottom: 6px;
}

.subtexto {
  color: var(--rich-gris-texto);
  font-size: 13.5px;
  margin-bottom: 22px;
}

.tarjeta-login form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

.tarjeta-login label {
  font-size: 13px;
  font-weight: 600;
  color: var(--rich-negro);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ---------- Formularios ---------- */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], select, textarea {
  font-family: inherit;
  font-size: 14.5px;
  padding: 10px 12px;
  border: 1px solid var(--rich-borde);
  border-radius: 7px;
  background: var(--rich-marfil);
  color: var(--rich-negro);
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--rich-dorado);
  background: var(--rich-blanco);
  box-shadow: 0 0 0 3px rgba(206, 171, 90, 0.25);
}

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

.boton {
  display: inline-block;
  padding: 11px 20px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: transform .05s ease, box-shadow .15s ease;
}
.boton:active { transform: translateY(1px); }

.boton-primario {
  background: var(--rich-negro);
  color: var(--rich-dorado);
}
.boton-primario:hover { background: #1a1a1a; }

.boton-dorado {
  background: var(--rich-dorado);
  color: var(--rich-negro);
}
.boton-dorado:hover { background: var(--rich-dorado-suave); }

.boton-secundario {
  background: transparent;
  color: var(--rich-negro);
  border-color: var(--rich-borde);
}
.boton-secundario:hover { background: var(--rich-blanco); }

.boton-peligro {
  background: var(--rich-error-bg);
  color: var(--rich-error);
  border-color: rgba(163, 52, 43, 0.25);
}

.boton-sm { padding: 6px 12px; font-size: 12.5px; }

/* ---------- Alertas ---------- */
.alerta {
  padding: 11px 14px;
  border-radius: 7px;
  font-size: 13.5px;
  margin-bottom: 16px;
  text-align: left;
}
.alerta-error { background: var(--rich-error-bg); color: var(--rich-error); }
.alerta-ok { background: var(--rich-ok-bg); color: var(--rich-ok); }
.alerta-warn { background: var(--rich-warn-bg); color: var(--rich-warn); }

/* ---------- Layout general (app) ---------- */
.app-header {
  background: var(--rich-negro);
  color: var(--rich-marfil);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header .marca {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 17px;
  letter-spacing: 0.03em;
  color: var(--rich-blanco);
  text-decoration: none;
}

.app-header .marca img { height: 30px; }

.app-header nav {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 13.5px;
}

.app-header nav a {
  color: #d8d3c6;
  text-decoration: none;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}
.app-header nav a:hover, .app-header nav a.activo {
  color: var(--rich-dorado);
  border-bottom-color: var(--rich-dorado);
}

.app-header .usuario {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: #b9b3a3;
}

.app-header .usuario .rol-tag {
  background: var(--rich-dorado);
  color: var(--rich-negro);
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.contenedor {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

.encabezado-pagina {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.encabezado-pagina h1 { font-size: 26px; margin: 0; }
.encabezado-pagina p { color: var(--rich-gris-texto); margin: 4px 0 0; font-size: 13.5px; }

/* ---------- Tarjetas / tablas ---------- */
.tarjeta {
  background: var(--rich-blanco);
  border: 1px solid var(--rich-borde);
  border-radius: var(--radio);
  padding: 24px;
  margin-bottom: 22px;
}

.tabla-operaciones {
  width: 100%;
  border-collapse: collapse;
  background: var(--rich-blanco);
  border-radius: var(--radio);
  overflow: hidden;
  box-shadow: var(--sombra);
}

.tabla-operaciones th, .tabla-operaciones td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid var(--rich-borde);
  font-size: 13.8px;
}

.tabla-operaciones th {
  background: var(--rich-navy);
  color: var(--rich-marfil);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tabla-operaciones tbody tr:hover { background: #fbf9f5; }
.tabla-operaciones tbody tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-pendiente { background: var(--rich-warn-bg); color: var(--rich-warn); }
.badge-aprobada { background: var(--rich-ok-bg); color: var(--rich-ok); }
.badge-rechazada { background: var(--rich-error-bg); color: var(--rich-error); }

.vacio {
  text-align: center;
  padding: 60px 20px;
  color: var(--rich-gris-texto);
}

/* ---------- Formulario de operación ---------- */
.grupo-formulario {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 4px;
}
.grupo-formulario.col-1 { grid-template-columns: 1fr; }
.grupo-formulario.col-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 720px) {
  .grupo-formulario, .grupo-formulario.col-3 { grid-template-columns: 1fr; }
  .app-header { flex-wrap: wrap; height: auto; padding: 12px 18px; gap: 10px; }
  .app-header nav { flex-wrap: wrap; gap: 12px; }
}

.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.campo label { font-size: 13px; font-weight: 600; }
.campo .ayuda { font-size: 12px; color: var(--rich-gris-texto); font-weight: 400; }

.seccion-formulario {
  border-top: 3px solid var(--rich-dorado);
  padding-top: 18px;
  margin-top: 26px;
}
.seccion-formulario h3 {
  font-size: 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-linea {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}
.check-linea input { width: auto; }

/* ---------- Vista de detalle / cálculo ---------- */
.columnas-detalle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 720px) { .columnas-detalle { grid-template-columns: 1fr; } }

.panel-punta {
  border: 1px solid var(--rich-borde);
  border-radius: var(--radio);
  overflow: hidden;
}
.panel-punta .titulo-punta {
  background: var(--rich-navy);
  color: var(--rich-marfil);
  padding: 12px 18px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 16px;
}
.panel-punta .cuerpo-punta { padding: 16px 18px; }

.fila-cifra {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--rich-borde);
  font-size: 13.8px;
}
.fila-cifra:last-child { border-bottom: none; }
.fila-cifra .etiqueta { color: var(--rich-gris-texto); }
.fila-cifra .valor { font-weight: 700; text-align: right; white-space: nowrap; }
.fila-cifra.total { border-top: 2px solid var(--rich-negro); margin-top: 6px; padding-top: 10px; font-size: 15px; }
.fila-cifra.destacado .valor { color: var(--rich-navy); }
.fila-cifra.negativo .valor { color: var(--rich-error); }

.acciones-barra {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.linea-historial {
  font-size: 12.8px;
  color: var(--rich-gris-texto);
  padding: 6px 0;
  border-bottom: 1px solid var(--rich-borde);
}
.linea-historial:last-child { border-bottom: none; }

footer.pie-app {
  text-align: center;
  color: #a8a190;
  font-size: 12px;
  padding: 30px 20px 40px;
}
