:root{
  --red:#d60000;
  --red2:#ff2a2a;
  --text:#111;
  --muted:#6b7280;
  --bg:#f6f7fb;
  --card:#fff;
  --border:#e5e7eb;
  --shadow: 0 10px 30px rgba(0,0,0,.08);
  --radius:16px;
}

*{ box-sizing:border-box; }
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--text);
  background:var(--bg);
}

.container{
  width:min(1100px, 92%);
  margin: 0 auto;
}

.topbar{
  background:#fff;
  border-bottom:1px solid var(--border);
  position:sticky;
  top:0;
  z-index:50;
}

.topbar__inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 0;
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
}
.brand__logo{
  height: 42px;
  width: auto;
  display: block;
}
.brand__title{
  font-weight:800;
  letter-spacing:.2px;
}
.brand__subtitle{
  color:var(--muted);
  font-size:13px;
}

.nav{ display:flex; gap:18px; }
.nav__link{
  text-decoration:none;
  color:#b40000;
  font-weight:600;
  font-size:14px;
}
.nav__link:hover{ color:var(--red); }

.hero{
  padding:26px 0 10px;
}
.hero h1{ margin:0 0 6px; font-size:28px; }
.muted{ color:var(--muted); }

.grid-2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:18px;
  padding-bottom:28px;
}
@media (max-width: 900px){
  .grid-2{ grid-template-columns:1fr; }
  .nav{ display:none; } /* simple, luego hacemos menú móvil */
}

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:18px;
  box-shadow: var(--shadow);
}

.card h2{
  margin:0 0 14px;
  font-size:18px;
}

.label{
  display:block;
  font-size:13px;
  color:var(--muted);
  margin:10px 0 6px;
}

.input{
  width:100%;
  padding:12px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  outline:none;
  background:#fff;
}
.input:focus{
  border-color: rgba(214,0,0,.55);
  box-shadow: 0 0 0 4px rgba(214,0,0,.10);
}

.btn{
  border-radius:999px;
  padding:12px 14px;
  font-weight:700;
  cursor:pointer;
  border:1px solid transparent;
}
.btn-block{ width:100%; margin-top:14px; }

.btn-primary{
  background: var(--red);
  color:#fff;
}
.btn-primary:hover{ background: var(--red2); }

.btn-outline{
  background:#fff;
  color:var(--red);
  border-color: rgba(214,0,0,.45);
}
.btn-outline:hover{
  background: rgba(214,0,0,.06);
}

.hr{
  border:none;
  border-top:1px solid var(--border);
  margin:16px 0;
}

.h3{ margin:0 0 10px; font-size:15px; }

.list{ display:flex; flex-direction:column; gap:10px; }
.result{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  text-decoration:none;
  color:inherit;
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
  background:#fff;
}
.result:hover{ border-color: rgba(214,0,0,.35); }

.result__name{ font-weight:800; }
.result__meta{ color:var(--muted); font-size:13px; margin-top:4px; }

.badge{
  background: rgba(214,0,0,.08);
  color: var(--red);
  font-weight:800;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  text-align:right;
}
.small{ font-size:12px; }

.flash-wrap{ margin:16px 0; display:flex; flex-direction:column; gap:10px; }
.flash{
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--border);
  background:#fff;
}
.flash--success{ border-color: rgba(16,185,129,.35); }
.flash--warning{ border-color: rgba(245,158,11,.35); }
.flash--danger{ border-color: rgba(239,68,68,.35); }

/* =========================
   LOTE (detalle)
========================= */

.backlink{
  display:inline-flex;
  gap:.5rem;
  align-items:center;
  margin: 10px 0 14px;
  color:#a10f0f;
  font-weight:600;
  text-decoration:none;
}
.backlink:hover{ text-decoration:underline; }

.page-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  padding: 14px 0 8px;
  border-bottom: 1px solid rgba(0,0,0,.08);
  margin-bottom: 14px;
}

.page-title{
  margin:0;
  font-size: 24px;
  letter-spacing: -.2px;
}
.page-subtitle{
  margin-top:6px;
  color: rgba(0,0,0,.6);
  font-weight:600;
}

.client-pill{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:6px;
  padding: 10px 12px;
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 14px;
  background: #fff;
  min-width: 260px;
}
.client-pill__label{
  font-size: 12px;
  color: rgba(0,0,0,.55);
}
.client-pill__name{
  font-weight:800;
  letter-spacing: .2px;
}

.status{
  display:inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid rgba(0,0,0,.10);
  background: #f3f3f3;
}
.status--activo{ background:#eaf7ee; border-color:#cfead7; }
.status--cancelado{ background:#ffe8e8; border-color:#ffd0d0; }
.status--pendiente{ background:#fff7db; border-color:#ffe8a8; }

/* cards */
.cards{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
  margin: 14px 0 18px;
}
.card{
  grid-column: span 3;
  background:#fff;
  border:1px solid rgba(0,0,0,.10);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.04);
}
.card__label{
  color: rgba(0,0,0,.55);
  font-size: 12px;
  font-weight:700;
}
.card__value{
  margin-top: 6px;
  font-size: 18px;
  font-weight: 900;
}
.card__hint{
  margin-top: 6px;
  font-size: 12px;
  color: rgba(0,0,0,.55);
}

.card--warn{ background: #fff7e0; border-color: #ffe2a5; }
.card--info{ background: #eef3ff; border-color: #d7e1ff; }
.card--soft{ background: #f6f6f6; }
.card--danger{ background: #ffecec; border-color: #ffc7c7; }
.card--danger-soft{ background: #fff5f5; border-color: #ffdada; }

@media (max-width: 1100px){
  .card{ grid-column: span 6; }
  .client-pill{ min-width: 220px; }
}
@media (max-width: 700px){
  .page-head{ flex-direction:column; align-items:flex-start; }
  .client-pill{ align-items:flex-start; width:100%; }
  .card{ grid-column: span 12; }
}

/* panels */
.panel{
  background:#fff;
  border:1px solid rgba(0,0,0,.10);
  border-radius: 18px;
  padding: 14px 14px 16px;
  margin: 14px 0;
  box-shadow: 0 10px 30px rgba(0,0,0,.04);
}
.panel__head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:10px;
  margin-bottom: 10px;
}
.panel__title{
  margin:0;
  font-size: 18px;
  font-weight: 900;
}
.panel__subtitle{
  color: rgba(0,0,0,.55);
  font-size: 12px;
  font-weight: 600;
}

/* form */
.grid3{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 850px){
  .grid3{ grid-template-columns: 1fr; }
}

.field__label{
  display:block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 800;
  color: rgba(0,0,0,.75);
}
.field__control{
  width:100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.12);
  background:#fff;
  outline:none;
}
.field__control:focus{
  border-color: rgba(161,15,15,.55);
  box-shadow: 0 0 0 4px rgba(161,15,15,.12);
}

.help{
  margin-top:6px;
  color: rgba(0,0,0,.55);
  font-size: 12px;
}

.actions{ margin-top: 12px; }
.btn{
  display:inline-flex;
  justify-content:center;
  align-items:center;
  gap:8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.12);
  font-weight: 900;
  cursor:pointer;
  background:#f3f3f3;
}
.btn--primary{
  width:100%;
  background:#b10f0f;
  border-color:#b10f0f;
  color:#fff;
}
.btn--primary:hover{ filter: brightness(.95); }

.empty{
  padding: 12px;
  border-radius: 14px;
  background:#f6f6f6;
  color: rgba(0,0,0,.6);
  font-weight: 700;
}

/* table */
.table-wrap{
  overflow:auto;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.10);
}
.table{
  width:100%;
  border-collapse: collapse;
  min-width: 720px;
}
.table thead th{
  text-align:left;
  padding: 10px 12px;
  background:#f4f4f4;
  font-size: 12px;
  letter-spacing: .2px;
  text-transform: uppercase;
  color: rgba(0,0,0,.65);
}
.table tbody td{
  padding: 10px 12px;
  border-top: 1px solid rgba(0,0,0,.08);
}
.table tbody tr:hover{
  background: rgba(177,15,15,.04);
}
.money{ font-weight: 900; }

/* tags */
.tag{
  display:inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid rgba(0,0,0,.10);
  background:#f3f3f3;
}
.tag--mensualidad{ background:#eef3ff; border-color:#d7e1ff; }
.tag--enganche{ background:#eaf7ee; border-color:#cfead7; }
.tag--apartado{ background:#fff7db; border-color:#ffe8a8; }
.tag--otro{ background:#f6f6f6; }

/* ===== rojo corporativo ===== */
:root{
  --brand-red: #e50000;
}

/* header/backlink */
.backlink{ color: var(--brand-red); }
.field__control:focus{
  border-color: rgba(229,0,0,.55);
  box-shadow: 0 0 0 4px rgba(229,0,0,.12);
}

/* botones */
.btn--primary{
  background: var(--brand-red);
  border-color: var(--brand-red);
}

/* hover tabla */
.table tbody tr:hover{
  background: rgba(229,0,0,.04);
}

/* ===== cabecera lote ===== */
.page-head{
  align-items: flex-start;
}

.head-left{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.client-name{
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.2px;
}

.head-right{
  display:flex;
  align-items:flex-start;
}

/* grid para registrar pago */
.grid4{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.grid2{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (max-width: 1100px){
  .grid4{ grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px){
  .grid4{ grid-template-columns: 1fr; }
  .grid2{ grid-template-columns: 1fr; }
}

.btn{
  appearance:none;
  border: 1px solid #e6e8ee;
  background: #fff;
  color: #111;
  font-weight: 700;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: transform .05s ease, filter .15s ease, box-shadow .15s ease;
}

.btn:hover{ filter: brightness(0.98); }
.btn:active{ transform: translateY(1px); }
.btn:disabled{
  opacity: .55;
  cursor: not-allowed;
}

/* tu rojo corporativo */
.btn--primary{
  background: var(--brand-red);
  border-color: var(--brand-red);
  color: #fff;
  box-shadow: 0 8px 18px rgba(229,0,0,.12);
}
.btn--primary:hover{
  filter: brightness(0.96);
}

:root{
  --brand: #e50000;
}

/* Header */
.topbar{
  background: #fff;
  border-bottom: 1px solid #e9e9ee;
}

.nav__link{
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 12px;
}

.nav__link:hover{
  background: rgba(229, 0, 0, .08);
}

.back-link{
  display:inline-block;
  margin: 6px 0 10px;
  color: var(--brand, #e50000);
  text-decoration: none;
  font-weight: 600;
}
.back-link:hover{ text-decoration: underline; }

.lote-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  padding: 8px 0 6px;
}

.lote-head__cliente{
  font-size: 28px;
  line-height: 1.15;
  font-weight: 800;
  margin-bottom: 6px;
  color: #111;
}

.lote-head__meta{
  font-size: 14px;
  color: #6b7280; /* gris */
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:6px;
}

.lote-head__meta .meta-bold{ font-weight: 700; }
.lote-head__meta .meta-normal{ font-weight: 500; }
.lote-head__meta .meta-sep{ opacity: .7; }

.status-pill{
  display:inline-flex;
  align-items:center;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  border: 1px solid rgba(0,0,0,.08);
  background: #eef2ff;
  color: #1f2937;
}

.status-pill--ok{
  background: #eaf7ee;
  color: #0f5132;
  border-color: rgba(15,81,50,.15);
}

.page-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  margin: 10px 0 18px;
}

.client-name{
  font-size: 30px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 6px;
  color:#111;
}

.meta-row{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  font-size: 14px;          /* mismo tamaño */
  color: #6b7280;           /* mismo gris */
}

.meta-item{ font-weight: 500; }
.meta-item--bold{ font-weight: 700; }
.meta-sep{ opacity: .75; }

.backlink{
  display:inline-block;
  margin: 6px 0 10px;
  text-decoration:none;
  font-weight:700;
  color: var(--brand, #e50000);
}
.backlink:hover{ text-decoration:underline; }

.dash-head { margin: 18px 0 14px; }
.dash-title { font-size: 28px; margin: 0; }
.dash-sub { margin: 6px 0 0; color: #667085; }

.leader-pill {
  display:inline-block; margin-top:10px; padding:6px 10px;
  border-radius:999px; background:#e8fff1; border:1px solid #b7f0cd;
  font-weight:600; font-size:12px;
}
.leader-pill--off { background:#f2f4f7; border-color:#e4e7ec; color:#667085; }

.dash-grid {
  margin-top:16px;
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

.dash-card{
  display:block;
  padding:16px;
  border-radius:14px;
  background:#fff;
  border:1px solid #e4e7ec;
  box-shadow:0 1px 2px rgba(16,24,40,.06);
  text-decoration:none;
  color:inherit;
}
.dash-card:hover{ border-color:#d0d5dd; transform: translateY(-1px); }

.dash-card__title{ font-weight:800; font-size:16px; margin-bottom:6px; }
.dash-card__text{ color:#667085; font-size:13px; line-height:1.35; }

.dash-card--locked{
  opacity:.55;
  pointer-events:none;
}

/* =========================
   NAVBAR - Usuario (badge)
   ========================= */

.nav__user{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border:1px solid var(--border);
  border-radius:999px;
  background:rgba(17,17,17,.04);
  color:var(--text);
  font-weight:600;
  font-size:14px;
  line-height:1;
  letter-spacing:.2px;
  max-width:220px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* separador del navbar sin inline styles */
.nav__sep{
  opacity:.35;
  margin:0 10px;
}

/* en pantallas chicas, que no rompa el menú */
@media (max-width: 640px){
  .nav__user{
    max-width:140px;
    padding:7px 10px;
    font-size:13px;
  }
}

.nav__userDot{
  width:8px;
  height:8px;
  border-radius:999px;
  background:var(--red2);
  box-shadow:0 0 0 3px rgba(214,0,0,.12);
  flex:0 0 auto;
}