:root {
  --bg:         #f6f7f9;
  --panel:      #ffffff;
  --sidebar:    #00376a;
  --sidebar-2:  #002850;
  --line:       #e6e9ee;
  --line-soft:  #eef0f4;
  --naranja:    #ff6e05;
  --naranja-tint: #fff0e4;
  --amarillo:   #ffcc00;
  --amarillo-tint: #fff8e0;
  --azul:       #00376a;
  --azul-tint:  #e5edf5;
  --gris:       #707070;
  --gris-tint:  #f1eee8;
  --verde:      #1e9e63;
  --verde-tint: #e3f6ec;
  --rojo:       #e0402c;
  --rojo-tint:  #fdece9;
  --morado:     #6b5bd6;
  --morado-tint:#eeecfb;
  --text:       #1b2430;
  --text-soft:  #5b6472;
  --text-dim:   #9aa2ad;
  --radius:     14px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', Arial, sans-serif;
  font-size: 14px;
}
h1, h2, .display { font-family: 'Space Grotesk', 'Inter', sans-serif; letter-spacing: -.01em; }
.mono { font-family: 'IBM Plex Mono', 'Consolas', monospace; font-variant-numeric: tabular-nums; }
a { color: var(--azul); text-decoration: none; }

.layout { display: flex; min-height: 100vh; }

/* ---------- SIDEBAR ---------- */
.sidebar {
  width: 240px;
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.marca-card { background: #fff; border-radius: 12px; padding: 14px 12px 10px; display:flex; align-items:center; justify-content:center; margin-bottom: 22px; }
.marca-card img { width: 100%; height:auto; display:block; }
.etq-modulo { font-family:'Space Grotesk',sans-serif; font-size: 10.5px; color: #ffcc00; text-transform:uppercase; letter-spacing:.14em; margin: -12px 0 20px 4px; }

nav.side { display:flex; flex-direction:column; gap: 3px; margin-top: 4px; }
nav.side a {
  display:flex; align-items:center; gap:10px;
  padding: 10px 12px; border-radius: 9px;
  color: #b9cbe0; text-decoration:none; font-size: 13.5px;
  cursor:pointer; border: 1px solid transparent;
}
nav.side a .dot { width:6px; height:6px; border-radius:50%; background: #345f8a; flex-shrink:0; }
nav.side a:hover { background: rgba(255,255,255,.06); color:#fff; }
nav.side a.activo { background: rgba(255,204,0,.14); color:#ffe9a8; border-color: rgba(255,204,0,.3); }
nav.side a.activo .dot { background: var(--amarillo); box-shadow: 0 0 6px rgba(255,204,0,.7); }
nav.side .sep { height:1px; background: rgba(255,255,255,.1); margin: 14px 4px; }
nav.side .etiqueta { font-size:10px; text-transform:uppercase; letter-spacing:.12em; color: #6a89ab; padding: 0 12px; margin: 2px 0 4px; }

.pulso { display:flex; align-items:center; gap:7px; font-size:11px; color: #7f9cbc; margin-top: 16px; padding: 0 8px;}
.pulso .led { width:6px; height:6px; border-radius:50%; background: var(--amarillo); box-shadow: 0 0 8px rgba(255,204,0,.8); animation: parpadeo 2s ease-in-out infinite; }
@keyframes parpadeo { 0%,100% { opacity:1; } 50% { opacity:.3; } }

.side-footer { margin-top:auto; padding-top: 16px; border-top:1px solid rgba(255,255,255,.1); }
.side-footer .usuario { font-size: 12.5px; color: #fff; }
.side-footer .rol { font-size: 11px; color: #7f9cbc; }
.side-footer .salir { font-size: 11.5px; color: #7f9cbc; text-decoration:none; }
.side-footer .excel { font-size: 11.5px; color: #ffe9a8; text-decoration:none; display:block; margin-bottom:6px; }

/* ---------- MAIN ---------- */
main.contenedor { flex: 1; padding: 30px 40px 60px; max-width: 1260px; }
h1 { font-size: 25px; margin:0 0 4px; font-weight:600; color: var(--sidebar); }
h2 { font-size: 16px; font-weight:600; color:var(--sidebar); margin-top:0; }
.subtitulo { color: var(--text-soft); font-size: 13px; margin-bottom: 20px; }
.encabezado { display:flex; justify-content:space-between; align-items:flex-end; margin-bottom: 22px; flex-wrap:wrap; gap:10px; }
.encabezado .sub { color: var(--text-soft); font-size: 13px; }

.migas { font-size: 13px; margin-bottom: 14px; color: var(--text-soft); }

.btn {
  display: inline-block;
  font-family:'Inter',sans-serif; font-size: 13px; font-weight:500;
  padding: 9px 15px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); cursor:pointer; text-decoration:none;
  transition: all .15s;
}
.btn:hover { border-color: var(--naranja); color: var(--naranja); text-decoration:none; }
.btn-naranja { background: var(--naranja); border-color: var(--naranja); color:#fff; font-weight: 600; }
.btn-naranja:hover { color:#fff; box-shadow: 0 4px 14px rgba(255,110,5,.3); }
.btn-verde { background: var(--verde); border-color: var(--verde); color:#fff; font-weight:600; }
.btn-verde:hover { color:#fff; }
.btn-azul { background: var(--azul); border-color: var(--azul); color:#fff; font-weight:600; }
.btn-azul:hover { color:#fff; }
.btn-sec { background: #fff; color: var(--azul); }
.btn-sm { padding: 6px 11px; font-size:12px; }

/* ---------- KPI cards ---------- */
.tarjetas, .kpis { display:grid; grid-template-columns: repeat(auto-fit, minmax(170px,1fr)); gap: 12px; margin-bottom: 22px; }
.tarjeta, .kpi {
  background: var(--panel); border:1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; position:relative; overflow:hidden; box-shadow: 0 1px 2px rgba(20,30,50,.04);
}
.tarjeta .orbe, .kpi .orbe { position:absolute; right:-22px; top:-22px; width:64px; height:64px; border-radius:50%; opacity:.16; background: radial-gradient(circle, var(--c1), var(--c2)); }
.naranja .orbe { --c1: #ff6e05; --c2: #ffcc00; } .naranja .num, .naranja .val { color: var(--naranja); }
.amarillo .orbe { --c1: #ffcc00; --c2: #ff6e05; } .amarillo .num, .amarillo .val { color: #b98600; }
.verde .orbe { --c1: #1e9e63; --c2: #7fd3ac; } .verde .num, .verde .val { color: var(--verde); }
.azul .orbe { --c1: #00376a; --c2: #4a7db3; } .azul .num, .azul .val { color: var(--azul); }
.morado .orbe { --c1: #6b5bd6; --c2: #a79ded; } .morado .num, .morado .val { color: var(--morado); }
.tarjeta .num, .kpi .val { font-family:'IBM Plex Mono', monospace; font-size: 21px; font-weight:500; color: var(--sidebar); position:relative; }
.tarjeta .lbl, .kpi .lbl { font-size: 11.5px; color: var(--text-soft); margin-top: 5px; position:relative; }
.kpi .sub2 { font-size: 10.5px; color: var(--text-dim); margin-top:2px; position:relative; }

.fuentes { display:flex; gap:10px; margin-bottom:18px; flex-wrap:wrap; }
.fuente-card { flex:1; min-width:180px; background: var(--panel); border:1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
.fuente-card .titulo { font-size:12px; text-transform:uppercase; letter-spacing:.06em; color: var(--text-dim); margin-bottom:6px; }
.fuente-card .val { font-family:'IBM Plex Mono',monospace; font-size:18px; font-weight:500; color: var(--sidebar); }
.fuente-card .detalle { font-size:11.5px; color: var(--text-soft); margin-top:4px; }

/* ---------- panel / tabla ---------- */
.panel { background: var(--panel); border:1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 20px; box-shadow: 0 1px 2px rgba(20,30,50,.03); }

table { width:100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align:left; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
th { background: var(--bg); color: var(--text-dim); font-weight:600; font-size: 10.5px; text-transform:uppercase; letter-spacing:.05em; border-top:1px solid var(--line); border-bottom:1px solid var(--line); }
tr:hover td { background: #fafbfd; }
.cedula { color: var(--text-dim); font-size:11.5px; font-family:'IBM Plex Mono',monospace; }
.monto { font-family:'IBM Plex Mono',monospace; text-align:right; font-weight:500; color:var(--sidebar); }

/* ---------- chips (estado / grupo) ---------- */
.badge, .chip {
  display:inline-flex; align-items:center; gap:5px; font-family:'IBM Plex Mono',monospace; font-size: 10px; font-weight:500;
  letter-spacing:.02em; padding: 3px 9px; border-radius: 20px; border:1px solid; white-space:nowrap;
}
.badge::before, .chip::before { content:""; width:5px; height:5px; border-radius:50%; background: currentColor; flex-shrink:0; }
.badge-paz, .chip-verde     { background: var(--verde-tint); color: var(--verde); border-color:#bfe6d2; }
.badge-cobro, .chip-rojo    { background: var(--rojo-tint); color: var(--rojo); border-color:#f3c6bd; }
.badge-nomina, .chip-amarillo { background: var(--amarillo-tint); color:#8a6600; border-color:#f2dfa0; }
.badge-azul, .chip-azul     { background: var(--azul-tint); color: var(--azul); border-color:#c7d7e8; }
.badge-otro, .chip-gris     { background: var(--gris-tint); color: #5c5648; border-color:#ddd5c4; }
.badge-acuerdo, .chip-morado { background: var(--morado-tint); color: var(--morado); border-color:#d3cdf5; }
.badge-fogacobranza { background: #efeae2; color: #4a4238; border-color:#d8cfbd; }

.tipo-tag { font-size:11px; padding:2px 8px; border-radius:6px; background:#f1f3f6; color:var(--text-soft); font-weight:500; }

.prio-dot { display:inline-block; width:7px; height:7px; border-radius:50%; margin-right:6px; vertical-align:middle; }
.prio-alta { background: var(--rojo); } .prio-media { background: #b98600; } .prio-baja { background: var(--verde); } .prio-cerrado { background: var(--text-dim); }

/* ---------- mini kanban (Resumen) ---------- */
.kanban { display:grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap:12px; }
.kcol { background: var(--bg); border-radius: 10px; padding: 10px; }
.kcol h3 { font-size:11.5px; margin:2px 4px 8px; color:var(--text-soft); display:flex; justify-content:space-between; font-weight:600; }
.kcard { background:#fff; border:1px solid var(--line); border-radius:8px; padding:8px 10px; margin-bottom:6px; font-size:12px; }
.kcard a { color: var(--text); }
.kcard .nom { font-weight:500; }
.kcard .val { font-family:'IBM Plex Mono',monospace; color: var(--text-soft); font-size:11.5px; margin-top:2px; }

/* ---------- alertas ---------- */
.alerta { padding: 10px 14px; border-radius: var(--radius); font-size: 13.5px; margin-bottom: 16px; }
.alerta-error { background: var(--rojo-tint); color: var(--rojo); border: 1px solid #f3c6bd; }
.alerta-ok { background: var(--verde-tint); color: var(--verde); border: 1px solid #bfe6d2; }
.alerta-aviso { background: var(--amarillo-tint); color: #8a6600; border: 1px solid #f2dfa0; }

.aviso-hoy { background: var(--amarillo-tint); border:1px solid #f2dfa0; border-radius: var(--radius); padding: 16px 20px; margin-bottom: 22px; }
.aviso-hoy .titulo { font-family:'Space Grotesk',sans-serif; font-size:14.5px; color: #8a6600; margin-bottom:10px; display:flex; align-items:center; gap:8px; font-weight:600; }
.aviso-hoy .titulo .led { width:7px; height:7px; border-radius:50%; background: var(--naranja); box-shadow:0 0 8px rgba(255,110,5,.6); animation: parpadeo 1.6s ease-in-out infinite; }
.fila-aviso { display:flex; justify-content:space-between; align-items:center; padding:8px 0; border-top:1px solid #f0e2ac; font-size:13px; flex-wrap:wrap; gap:6px; }
.fila-aviso:first-of-type { border-top:none; }
.estampilla { font-family:'IBM Plex Mono',monospace; font-size:10.5px; padding:4px 10px; border-radius:20px; font-weight:500; letter-spacing:.02em; border:1px solid; }
.estampilla.dos-dias { background: #fff; color: #b98600; border-color:#f2dfa0; }
.estampilla.hoy { background: var(--azul-tint); color: var(--azul); border-color:#c7d7e8; }
.estampilla.atrasado { background: var(--rojo-tint); color:var(--rojo); border-color:#f3c6bd; }

.foga-alert { background: var(--gris-tint); border:1px solid #ddd5c4; border-radius: var(--radius); padding:16px 20px; margin-bottom:20px; }
.foga-alert .titulo { font-family:'Space Grotesk',sans-serif; font-weight:600; font-size:14px; color:#5c5648; margin-bottom:6px; }
.foga-alert .tel { font-family:'IBM Plex Mono',monospace; font-size:19px; color: var(--sidebar); font-weight:600; }

.aviso-legal { font-size: 12px; color: #8a5a5a; background: var(--rojo-tint); border: 1px solid #f3c6bd; border-radius: var(--radius); padding: 8px 12px; margin-bottom: 16px; }
.nota-caja { background: var(--bg); border:1px solid var(--line); border-radius:8px; padding:12px 14px; font-size:12.5px; line-height:1.55; color:var(--text-soft); margin-bottom:12px; }
.nota-caja .flabel { font-size:10.5px; text-transform:uppercase; letter-spacing:.05em; color:var(--text-dim); margin-bottom:4px; }

/* ---------- formularios ---------- */
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=file], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 13.5px; font-family: inherit; background: var(--bg); color: var(--text);
}
label { font-size: 13px; font-weight: 600; color: var(--text-soft); display: block; margin-bottom: 4px; margin-top: 12px; }
.fila-filtros { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; align-items: end; }
.fila-filtros > div { flex: 1; min-width: 160px; }

.login-caja { max-width: 380px; margin: 90px auto; background: #fff; padding: 32px; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: 0 2px 20px rgba(0,55,106,.08); text-align:center; }
.login-caja img { max-width: 200px; margin-bottom: 18px; }
.login-caja h1 { text-align: center; margin-bottom: 22px; font-size:19px; }
.login-caja form { text-align:left; }

.linea-historial { border-bottom: 1px solid var(--line-soft); padding: 8px 0; font-size: 13px; }
.linea-historial .meta { color: var(--text-dim); font-size: 11.5px; }

textarea.copiable { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; min-height: 90px; }

@media (max-width: 780px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; }
  main.contenedor { padding: 18px; }
  .ficha-grid { grid-template-columns: 1fr !important; }
}
