/* Monitor Blend - paleta de marca: magenta #86027b / #ac1aab, gris pizarra #5b6770,
   estilo luxury-minimal claro como raizant.com.bo/blend */
:root {
  --brand: #86027b;
  --brand-bright: #ac1aab;
  --slate: #5b6770;
  --ink: #1e2226;
  --bg: #f7f6f4;
  --card: #ffffff;
  --line: #e6e2dd;
  --ok: #1c7a3d;
  --warn-bg: #fff7e0;
  --bad: #b3261e;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; font-size: 14.5px;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- barra superior ---- */
.topbar {
  background: var(--ink); color: #fff; display: flex; align-items: center;
  padding: 0 22px; height: 54px; gap: 26px; position: sticky; top: 0; z-index: 10;
}
.topbar .logo { font-weight: 700; letter-spacing: 3px; font-size: 15px; }
.topbar .logo span { color: var(--brand-bright); }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  color: #d8d5d0; padding: 6px 14px; border-radius: 6px; font-size: 13.5px;
}
.topbar nav a:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.topbar nav a.activo { color: #fff; background: var(--brand); }
.topbar .usuario { font-size: 12.5px; color: #b9b4ae; }
.topbar .usuario b { color: #fff; }
.topbar .salir { color: #d8d5d0; font-size: 12.5px; margin-left: 12px; }

/* ---- layout ---- */
.contenido { max-width: 1280px; margin: 26px auto; padding: 0 22px; }
h1 { font-size: 21px; font-weight: 650; margin: 4px 0 2px; letter-spacing: .3px; }
.sub { color: var(--slate); font-size: 13px; margin-bottom: 18px; }

/* ---- tabs ---- */
.tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--line); margin: 16px 0 20px; flex-wrap: wrap; }
.tabs a {
  padding: 9px 16px; color: var(--slate); font-weight: 600; font-size: 13.5px;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.activo { color: var(--brand); border-bottom-color: var(--brand); }

/* ---- cards ---- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px 22px; box-shadow: 0 1px 3px rgba(30,34,38,.05);
}
.card h3 { margin: 0 0 6px; font-size: 15.5px; }
.card .num { font-size: 12px; color: var(--brand); font-weight: 700; letter-spacing: 2px; }
.card p { color: var(--slate); font-size: 13px; margin: 6px 0 0; line-height: 1.5; }
a.card { display:block; color: inherit; }
a.card:hover { text-decoration: none; border-color: var(--brand-bright); }

/* ---- KPIs ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.kpi .etiqueta { font-size: 11.5px; color: var(--slate); text-transform: uppercase; letter-spacing: 1px; }
.kpi .valor { font-size: 20px; font-weight: 700; margin-top: 4px; }
.kpi .detalle { font-size: 12px; color: var(--slate); margin-top: 2px; }
.kpi.brand .valor { color: var(--brand); }
.kpi.rojo .valor { color: var(--bad); }
.kpi.verde .valor { color: var(--ok); }

/* ---- tablas ---- */
.tabla-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; margin-bottom: 22px; }
table.datos { border-collapse: collapse; width: 100%; font-size: 13px; }
table.datos th {
  background: var(--ink); color: #fff; text-align: left; padding: 9px 12px;
  font-weight: 600; font-size: 12px; letter-spacing: .4px; position: sticky; top: 0;
}
table.datos td { padding: 7px 12px; border-bottom: 1px solid var(--line); }
table.datos tr:hover td { background: #faf6f9; }
table.datos td.num, table.datos th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.datos tr.total td { font-weight: 700; border-top: 2px solid var(--ink); background: #f3f0ee; }
table.datos tr.atencion td { background: var(--warn-bg); }
.neg { color: var(--bad); }
.pos { color: var(--ok); }

/* ---- caja explicativa ---- */
.explica {
  background: #f5eef4; border-left: 4px solid var(--brand); border-radius: 6px;
  padding: 12px 16px; font-size: 13px; color: #4a3f49; margin-bottom: 18px; line-height: 1.55;
}
.explica b { color: var(--brand); }

/* ---- boton actualizar / botones ---- */
.fila-refresh { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.btn {
  background: var(--brand); color: #fff; border: 0; border-radius: 8px;
  padding: 9px 18px; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--brand-bright); }
.btn:disabled { background: #b9a8b6; cursor: wait; }
.btn.secundario { background: var(--slate); }
.btn.chico { padding: 5px 12px; font-size: 12.5px; }
.btn.peligro { background: var(--bad); }
.ultima-act { font-size: 12.5px; color: var(--slate); }
.estado-refresh { font-size: 12.5px; font-weight: 600; }
.estado-refresh.corriendo { color: var(--brand); }
.estado-refresh.error { color: var(--bad); }

/* ---- login ---- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--ink); }
.login-caja { background: var(--card); border-radius: 14px; padding: 40px 44px; width: 360px; }
.login-caja .logo { text-align: center; font-weight: 700; letter-spacing: 4px; font-size: 18px; margin-bottom: 4px; }
.login-caja .logo span { color: var(--brand); }
.login-caja .sub { text-align: center; }
.login-caja label { display: block; font-size: 12.5px; color: var(--slate); margin: 14px 0 4px; font-weight: 600; }
.login-caja input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
}
.login-caja input:focus { outline: 2px solid var(--brand-bright); border-color: transparent; }
.login-caja .btn { width: 100%; margin-top: 20px; padding: 11px; }
.login-error { background: #fdecea; color: var(--bad); border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-top: 14px; }

/* ---- formularios admin ---- */
.form-linea { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.form-linea label { font-size: 12px; color: var(--slate); display: block; margin-bottom: 3px; font-weight: 600; }
.form-linea input[type=text], .form-linea input[type=password], .form-linea select {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 13.5px;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips label {
  display: flex; align-items: center; gap: 5px; background: var(--card); border: 1px solid var(--line);
  padding: 6px 10px; border-radius: 20px; font-size: 12.5px; cursor: pointer; margin: 0; color: var(--ink);
}
.badge { display: inline-block; background: #f0e6ef; color: var(--brand); border-radius: 12px; padding: 2px 9px; font-size: 11.5px; font-weight: 600; margin-right: 4px; }
.badge.gris { background: #e9ecee; color: var(--slate); }

/* ---- iframe embebido (EERR / flujo) ---- */
.marco { width: 100%; height: calc(100vh - 210px); border: 1px solid var(--line); border-radius: 10px; background: #fff; }

/* ---- home hero + cards pro ---- */
.hero {
  background: linear-gradient(120deg, #17191c 0%, #2a2030 55%, #3d1038 100%);
  color: #fff; border-radius: 16px; padding: 34px 38px 30px; margin-bottom: 26px;
  position: relative; overflow: hidden;
}
.hero::after {
  content: 'BLEND'; position: absolute; right: -10px; bottom: -34px;
  font-size: 120px; font-weight: 800; letter-spacing: 8px; color: rgba(255,255,255,.045);
}
.hero h1 { color: #fff; font-size: 26px; letter-spacing: 2px; margin: 0; }
.hero h1 span { color: var(--brand-bright); }
.hero .sub { color: #c9c3bd; margin: 6px 0 0; }
.hero-kpis { display: flex; gap: 34px; margin-top: 22px; flex-wrap: wrap; }
.hero-kpis .hk .et { font-size: 10.5px; letter-spacing: 1.5px; text-transform: uppercase; color: #a79fb0; }
.hero-kpis .hk .va { font-size: 21px; font-weight: 700; margin-top: 3px; }
.hero-kpis .hk .va small { font-size: 12px; font-weight: 400; color: #c9c3bd; }
.modulos { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.modulo-card {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 24px 26px 20px; color: inherit; position: relative;
  box-shadow: 0 1px 3px rgba(30,34,38,.06);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  border-top: 3px solid var(--brand);
}
.modulo-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(134,2,123,.13); border-color: var(--brand-bright); text-decoration: none; }
.modulo-card .num { font-size: 12px; color: var(--brand); font-weight: 800; letter-spacing: 3px; }
.modulo-card h3 { margin: 8px 0 6px; font-size: 17px; letter-spacing: .3px; }
.modulo-card p { color: var(--slate); font-size: 13px; margin: 0 0 14px; line-height: 1.55; }
.modulo-card .entrar { color: var(--brand); font-weight: 700; font-size: 13px; }
.modulo-card:hover .entrar { text-decoration: underline; }

/* ---- semaforo legal ---- */
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 7px; vertical-align: baseline; }
.dot.rojo { background: var(--bad); }
.dot.amarillo { background: #e6a700; }
.dot.verde { background: var(--ok); }
tr.sem-rojo td { background: #fdeceb; }
tr.sem-amarillo td { background: var(--warn-bg); }
.leyenda { display: flex; gap: 22px; font-size: 12.5px; color: var(--slate); margin: 4px 0 14px; flex-wrap: wrap; }

/* ---- buscador ---- */
.buscador {
  width: 340px; max-width: 100%; padding: 10px 14px 10px 38px; border: 1.5px solid var(--line);
  border-radius: 10px; font-size: 14px; background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6770' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 12px center;
}
.buscador:focus { outline: none; border-color: var(--brand-bright); }
.fila-buscar { display: flex; align-items: center; gap: 14px; margin: 4px 0 16px; flex-wrap: wrap; }
.contador-busqueda { font-size: 12.5px; color: var(--slate); }

/* ---- boton abrir dashboard completo ---- */
.abrir-full {
  display: inline-flex; align-items: center; gap: 8px; background: var(--ink); color: #fff;
  border-radius: 8px; padding: 9px 18px; font-size: 13.5px; font-weight: 600;
}
.abrir-full:hover { background: #000; color: #fff; text-decoration: none; }

/* ---- simulador ---- */
.sim-controles { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-end; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 18px; }
.sim-controles label { font-size: 12px; color: var(--slate); font-weight: 600; display: block; margin-bottom: 4px; }
.sim-controles input, .sim-controles select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 13.5px; width: 130px; }

/* ---- simulador consolidado ---- */
.sim-dos { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-bottom: 20px; }
.sim-panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.sim-panel > h3 { margin: 0 0 4px; font-size: 14.5px; color: var(--brand); letter-spacing: .3px; }
.sim-panel > .sub { font-size: 12px; margin-bottom: 14px; }
.sim-panel .pal-fila { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.sim-panel .pal-fila:last-child { border-bottom: 0; }
.sim-panel .pal-nom { font-size: 13px; }
.sim-panel .pal-nom small { display: block; color: var(--slate); font-size: 11.5px; }
.sim-panel input { width: 118px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; font-size: 13.5px; text-align: right; }
.sim-panel input:focus { outline: 2px solid var(--brand-bright); border-color: transparent; }
.sim-panel .pie { margin-top: 12px; padding-top: 10px; border-top: 2px solid var(--line); display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; }

table.datos td.col-cons, table.datos th.col-cons { background: #f5eef4; font-weight: 700; }
table.datos tr.linea-fuerte td { border-top: 2px solid var(--ink); font-weight: 700; }
table.datos tr.linea-margen td { background: var(--ink); color: #fff; font-weight: 700; font-size: 15px; }
table.datos tr.linea-margen td.col-cons { background: var(--brand); }
.sim-aviso { background: var(--warn-bg); border-left: 4px solid #c8a200; border-radius: 6px; padding: 12px 16px; font-size: 13px; margin-bottom: 18px; line-height: 1.55; }
tr.sem-total td { font-weight: 700; background: #f1eef0; border-top: 2px solid var(--line); }

/* Contabilidad: los tableros de Carolina se ven directo, sin boton */
.marco-alto { height: calc(100vh - 120px); min-height: 640px; }
.control-flujo { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 13.5px; }
.control-flujo summary { cursor: pointer; line-height: 1.6; }
.control-flujo .tabla-wrap { margin: 10px 0 0; }

/* Legal: detalle de pagos y cheques por contrato */
tr.con-pagos { cursor: pointer; }
tr.con-pagos .flecha { display: inline-block; transition: transform .15s; color: var(--muted, #777); }
tr.con-pagos.abierta .flecha { transform: rotate(90deg); }
tr.fila-pagos > td { background: #faf8f9; padding: 6px 8px 12px; }
table.sub-pagos { font-size: 12.5px; width: 100%; }
/* Obra: Presto vs Syneco, listas lado a lado */
.lado-a-lado { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
@media (max-width: 900px) { .lado-a-lado { grid-template-columns: 1fr; } }

/* ===== Contabilidad (estilo del Monitor Ibis: tarjetas limpias, graficos, tablas con jerarquia) ===== */
.cx { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --muted: #7d7b75; --soft: #f1efec;
      --sombra: 0 1px 2px rgba(11,11,11,.05), 0 4px 12px rgba(11,11,11,.04); }
.cx .kpis { display: grid; gap: 12px; margin: 6px 0 22px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.cx .kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 15px 17px; box-shadow: var(--sombra); }
.cx .kpi .et { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cx .kpi .v { font-size: 25px; font-weight: 660; letter-spacing: -.02em; margin: 5px 0 2px; font-variant-numeric: tabular-nums; }
.cx .kpi .n { font-size: 12px; color: var(--slate); line-height: 1.45; }
.cx .kpi.marca { border-top: 3px solid var(--brand); }
.cx .pos { color: var(--s3); } .cx .neg { color: var(--bad); }
.cx .fig { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 17px 19px 13px; margin: 14px 0 18px; box-shadow: var(--sombra); }
.cx .fig h3 { margin: 0 0 3px; font-size: 14px; font-weight: 620; }
.cx .fig .cap { margin: 0 0 12px; font-size: 12.5px; color: var(--slate); }
.cx .fig svg { display: block; width: 100%; height: auto; overflow: visible; }
.cx .leyenda { display: flex; gap: 16px; flex-wrap: wrap; margin: 0 0 10px; font-size: 12.5px; color: var(--slate); }
.cx .leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.cx .sw { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.cx h2 { margin: 26px 0 4px; font-size: 17px; font-weight: 650; }
.cx .desc { margin: 0 0 12px; color: var(--slate); font-size: 13px; max-width: 90ch; }
.cx .fuente { font-size: 12px; color: var(--muted); margin: -8px 0 16px; }
.cx table.t { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px; font-variant-numeric: tabular-nums; }
.cx .tw { border: 1px solid var(--line); border-radius: 12px; overflow: auto; box-shadow: var(--sombra); background: #fff; }
.cx table.t th { position: sticky; top: 0; background: #faf9f7; text-align: left; font-size: 11.5px; text-transform: uppercase;
                 letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.cx table.t td { padding: 8px 12px; border-bottom: 1px solid var(--soft); }
.cx table.t .num { text-align: right; white-space: nowrap; }
.cx table.t tr.grupo td { font-weight: 650; background: #fcfbfa; cursor: pointer; }
.cx table.t tr.grupo:hover td { background: #f6f3f5; }
.cx table.t tr.gt td { background: var(--ink); color: #fff; font-weight: 650; letter-spacing: .03em; font-size: 12px; text-transform: uppercase; }
.cx table.t tr.tit td { font-weight: 650; color: var(--brand); background: #fbf7fa; }
.cx table.t tr.sub td { font-weight: 620; background: #f7f5f2; }
.cx table.t tr.tot td { font-weight: 700; background: #efeae6; border-top: 2px solid var(--line); }
.cx table.t tr.det td { font-size: 12.5px; color: var(--slate); }
.cx table.t tr.det td:first-child { padding-left: 30px; }
.cx table.t tr.det2 td:first-child { padding-left: 48px; }
.cx table.t td.col-real { background: rgba(42,120,214,.04); }
.cx table.t td.col-pe { background: rgba(235,104,52,.05); }
.cx .flecha { display: inline-block; width: 14px; color: var(--muted); transition: transform .15s; }
.cx tr.abierto .flecha { transform: rotate(90deg); }
.cx .chip-real, .cx .chip-pe { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; }
.cx .chip-real { background: rgba(42,120,214,.12); color: #1d5ea8; }
.cx .chip-pe { background: rgba(235,104,52,.14); color: #b4481c; }
.cx .nota-pie { font-size: 12px; color: var(--muted); margin: 8px 2px 0; line-height: 1.5; }
.cx details.mas { margin: 14px 0; } .cx details.mas summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 13px; }
