@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@500;700;800&family=Inter:wght@400;500;600;700&display=swap');

/* Tema oscuro inspirado en Sisprov: azul noche, acento cian y CTA verde. */
:root {
  --primary: #28c7ff;
  --cyan: #72d9ff;
  --success: #1ecb79;
  --success-dark: #0b9f59;
  --danger: #fb7185;
  --amber: #fbbf24;
  --violet: #a78bfa;
  --page: #030913;
  --surface: #0a1524;
  --surface-2: #0e1f31;
  --sidebar: #050d19;
  --sidebar-soft: #0a1524;
  --ink: #f4f9fd;
  --muted: #93a8ba;
  --border: rgba(40, 199, 255, .16);
  --font-body: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-head: 'Manrope', 'Inter', sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--page);
  color: var(--ink);
  font-size: 15px;
}

h1, h2, h3, h4, h5, .brand-text, button, .button, th, .topbar-title strong {
  font-family: var(--font-head);
  font-weight: 700;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--cyan); }

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

.sidebar {
  width: 244px;
  flex: 0 0 244px;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.2rem .85rem;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(10, 21, 36, .98), rgba(3, 9, 19, .99));
  border-right: 1px solid var(--border);
  color: #b2c0cd;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .25rem .4rem 1.2rem;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
}
.brand:hover { color: var(--ink); }

.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #1ecb79, #0b9f59);
  font-family: var(--font-head);
  font-weight: 800;
  font-size: .95rem;
  letter-spacing: -.5px;
  color: #02110a;
}

.brand-copy { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text { font-size: 1.22rem; font-weight: 800; color: var(--ink); letter-spacing: .2px; }
.brand-copy small {
  margin-top: .25rem;
  color: var(--muted);
  font-size: .63rem;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.side-nav { flex: 1; margin-top: 1rem; overflow-y: auto; }
.nav-label {
  margin: 1.15rem .6rem .45rem;
  color: #60768a;
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.side-nav a {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin: .12rem 0;
  padding: .62rem .7rem;
  border-left: 3px solid transparent;
  border-radius: 10px;
  color: #b2c0cd;
  font-size: .88rem;
  font-weight: 500;
}
.side-nav a:hover { background: rgba(40, 199, 255, .06); color: var(--ink); }
.side-nav a.active {
  background: linear-gradient(135deg, rgba(40, 199, 255, .14), rgba(40, 199, 255, .04));
  border-left-color: var(--primary);
  color: var(--ink);
  font-weight: 600;
}

.nav-dot {
  width: 7px; height: 7px; flex: 0 0 7px;
  border-radius: 50%;
  background: #60768a;
}
.side-nav a.active .nav-dot { background: var(--primary); box-shadow: 0 0 9px rgba(40, 199, 255, .8); }

.sidebar-foot {
  display: grid;
  gap: .25rem;
  padding: .9rem .6rem .15rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .74rem;
}
.sidebar-foot small { font-size: .7rem; color: #60768a; }
.sidebar-guest { margin-top: auto; }
.status-dot {
  display: inline-block;
  width: 7px; height: 7px; margin-right: .4rem;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(30, 203, 121, .16);
}

.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 64px;
  padding: .7rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(3, 9, 19, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { display: flex; flex-direction: column; line-height: 1.2; }
.topbar-kicker { color: var(--muted); font-size: .62rem; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase; }
.topbar-title strong { font-size: 1.02rem; color: var(--ink); }
.topbar-user { display: flex; align-items: center; gap: .7rem; }
.user-name { font-size: .84rem; font-weight: 600; }
.role {
  padding: .2rem .7rem;
  border-radius: 20px;
  background: rgba(40, 199, 255, .1);
  color: var(--primary);
  font-size: .72rem;
  font-weight: 600;
  text-transform: capitalize;
}
.logout {
  padding-left: .7rem;
  border-left: 1px solid var(--border);
  color: var(--danger);
  font-size: .8rem;
  font-weight: 600;
}
.logout:hover { color: #ff9aa8; }

.content {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.6rem 2rem 2.5rem;
  flex: 1;
}

.section-title {
  display: flex; align-items: center; gap: .65rem;
  margin: 0 0 1.25rem;
  color: var(--ink);
  font-size: 1.55rem;
}
.section-title::before {
  content: ""; width: 4px; height: 1.5rem; flex: 0 0 4px;
  border-radius: 2px; background: var(--primary);
}
.page-lead { margin: -.7rem 0 1.4rem; color: var(--muted); font-size: .92rem; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.page-heading .section-title { margin-bottom: .35rem; }
.page-heading .button { margin-top: .15rem; }
.muted { color: var(--muted); font-size: .88rem; }

.lote-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: .6rem;
  margin-bottom: .75rem; padding: .65rem .8rem;
  border: 1px solid var(--border); border-radius: 10px;
  background: rgba(14, 31, 49, .55);
}
.lote-todo { display: inline-flex; align-items: center; gap: .4rem; margin: 0; font-size: .82rem; }
.lote-todo input, .col-seleccion input { width: auto; margin: 0; }
.lote-control { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.lote-bar select, .lote-bar input { width: auto; min-width: 130px; margin: 0; }
.lote-bar .button-secondary.peligro:hover { background: var(--danger); color: #1a0509; }
.col-seleccion { width: 34px; text-align: center; }

.table-scroll { overflow-x: auto; }
.table-scroll.tabla-ancha table { min-width: 1100px; }

/* Barra horizontal arriba, como antes: no hace falta bajar hasta el final de la tabla. */
.table-scrollbar-top {
  height: 12px; margin-bottom: .35rem;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: thin;
}
.table-scrollbar-top > div { height: 1px; }
.table-scrollbar-top.oculta { display: none; }
.table-scrollbar-top::-webkit-scrollbar { height: 10px; }
.table-scrollbar-top::-webkit-scrollbar-track { border-radius: 10px; background: rgba(40, 199, 255, .07); }
.table-scrollbar-top::-webkit-scrollbar-thumb { border-radius: 10px; background: #3d5a70; }

/* Primera columna fija al recorrer las tablas anchas. */
.table-scroll.tabla-ancha thead th:first-child,
.table-scroll.tabla-ancha tbody td:first-child {
  position: sticky; left: 0; z-index: 1;
  box-shadow: 1px 0 0 var(--border);
}
.table-scroll.tabla-ancha thead th:first-child { z-index: 2; background: var(--surface-2); }
.table-scroll.tabla-ancha tbody td:first-child { background: var(--surface); }
.table-scroll.tabla-ancha tbody tr:hover td:first-child { background: #122238; }

.block-title {
  margin: 1.6rem 0 .8rem; color: var(--cyan);
  font-size: .98rem; letter-spacing: .7px; text-transform: uppercase;
}

.card {
  padding: 1.25rem;
  background: linear-gradient(150deg, rgba(14, 31, 49, .84), rgba(6, 16, 28, .95));
  border: 1px solid var(--border);
  border-radius: 12px;
}
.content > .card + .card { margin-top: 1rem; }
.card h2 {
  margin: 0 0 1rem; padding-bottom: .6rem;
  border-bottom: 1px solid var(--border);
  color: var(--ink); font-size: 1.05rem;
}
.card.login { max-width: 420px; margin: 2rem auto; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid .card { display: flex; flex-direction: column; gap: .35rem; transition: border-color .2s, transform .2s; }
.grid .card:hover { transform: translateY(-2px); border-color: rgba(40, 199, 255, .45); }
.grid strong { color: var(--ink); font-size: 1.85rem; overflow-wrap: anywhere; }
.grid span { color: var(--muted); font-size: .71rem; letter-spacing: .7px; text-transform: uppercase; }
.metric-accent, .metric-blue, .metric-cyan, .metric-red, .metric-amber { border-left-width: 4px; border-left-style: solid; }
.metric-accent { border-left-color: var(--success); }
.metric-blue { border-left-color: var(--primary); }
.metric-cyan { border-left-color: var(--cyan); }
.metric-red { border-left-color: var(--danger); }
.metric-amber { border-left-color: var(--amber); }

.shortcut-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: .75rem; }
.shortcut {
  display: flex; flex-direction: column; gap: .2rem;
  padding: .9rem 1rem;
  border: 1px solid var(--border); border-left: 3px solid var(--success);
  border-radius: 10px; background: var(--surface); color: var(--ink); font-weight: 600;
}
.shortcut small { color: var(--muted); font-size: .74rem; font-weight: 400; }
.shortcut:hover { background: var(--surface-2); border-color: var(--success); color: var(--ink); }
.shortcut.blue { border-left-color: var(--primary); }
.shortcut.blue:hover { border-color: var(--primary); }

.formulario { max-width: 720px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
label { display: block; margin-bottom: 1rem; color: #c7d5e2; font-size: .86rem; font-weight: 600; }
input, select, textarea {
  display: block; width: 100%; max-width: 100%;
  margin-top: .35rem; padding: .6rem .7rem;
  border: 1px solid rgba(40, 199, 255, .24); border-radius: 8px;
  background: #06111f; color: var(--ink);
  font-family: var(--font-body); font-size: .93rem;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(40, 199, 255, .12);
}
input[type="checkbox"], input[type="radio"] { display: inline-block; width: auto; margin: 0 .4rem 0 0; }

/* Buscador de clientes en el formulario de pagos. */
.autocompletar { position: relative; display: block; }
.cliente-buscar { margin-top: .35rem; }
.sugerencias {
  position: absolute; top: calc(100% - .15rem); left: 0; right: 0; z-index: 30;
  max-height: 230px; overflow: auto; padding: .25rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); box-shadow: 0 16px 30px rgba(0, 0, 0, .45);
}
.sugerencia {
  display: block; width: 100%; margin: 0; padding: .45rem .55rem;
  border: 0; border-radius: 6px; background: transparent;
  color: var(--ink); text-align: left; font-family: var(--font-body);
  font-size: .82rem; font-weight: 500; cursor: pointer;
}
.sugerencia:hover, .sugerencia.activa {
  background: rgba(40, 199, 255, .14); color: var(--ink); filter: none;
}
.sugerencia-vacia { display: block; padding: .5rem; color: var(--muted); font-size: .8rem; }
.datos-cliente { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; max-width: 720px; }
.datos-cliente label { margin-bottom: 1rem; }
.datos-cliente input[readonly] { color: var(--cyan); font-weight: 600; }

button, .button {
  display: inline-block; padding: .65rem 1.15rem;
  border: 0; border-radius: 10px;
  background: linear-gradient(135deg, var(--success), var(--success-dark));
  color: #02110a;
  font-family: var(--font-body); font-size: .88rem; font-weight: 700;
  cursor: pointer; transition: filter .2s;
}
button:hover, .button:hover { filter: brightness(1.12); color: #02110a; }
.button-secondary { background: #1b2b40; color: var(--ink); }
.button-secondary:hover { background: var(--danger); color: #1a0509; }

.filtros {
  display: flex; align-items: end; flex-wrap: wrap; gap: .75rem;
  margin-bottom: 1rem; padding: 1rem;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}
.filtros input, .filtros select { width: auto; min-width: 210px; margin: 0; }
.filtros button { margin-left: auto; }

/* Listados dinámicos: búsqueda, filtro por columna, orden y scroll interno. */
.listado-controles {
  position: sticky; top: 64px; z-index: 8;
  display: flex; align-items: center; flex-wrap: wrap; gap: .75rem;
  margin-bottom: .6rem; padding: .6rem .8rem;
  border: 1px solid rgba(40, 199, 255, .22); border-radius: 10px;
  background: rgba(10, 21, 36, .98);
}
.buscador-global { flex: 1 1 320px; min-width: 220px; margin: 0; }
.buscador-pista { color: var(--muted); font-size: .72rem; }
.listado-contador { margin: 0 0 .6rem; color: var(--muted); font-size: .82rem; }
.lote-bar { position: sticky; z-index: 8; background: rgba(10, 21, 36, .98); }
.table-scrollbar-top { position: sticky; z-index: 7; background: var(--page); }
.th-orden { cursor: pointer; user-select: none; }
.th-orden:hover { color: var(--ink); }
.th-orden .flecha { color: var(--primary); margin-right: .3rem; }
.filtro-columna {
  display: block; width: 100%; min-width: 0; margin: .4rem 0 0;
  padding: .3rem .45rem; font-size: .72rem; font-weight: 400;
  letter-spacing: 0; text-transform: none; white-space: normal;
}
.tabla-dinamica { min-height: 200px; overflow: auto; }
.tabla-dinamica tbody tr[hidden] { display: none; }

table {
  width: 100%; border: 1px solid var(--border);
  border-collapse: separate; border-spacing: 0; border-radius: 12px;
  background: var(--surface); box-shadow: none; font-size: .88rem;
}
thead th {
  padding: .75rem .85rem; border-bottom: 2px solid var(--primary);
  background: var(--surface-2); color: var(--muted);
  font-size: .7rem; letter-spacing: .6px; text-align: left; text-transform: uppercase; white-space: nowrap;
}
thead th:first-child { border-top-left-radius: 12px; }
thead th:last-child { border-top-right-radius: 12px; }
tbody td { padding: .7rem .85rem; border-top: 1px solid var(--border); vertical-align: top; }
tbody tr:first-child td { border-top: 0; }
tbody tr:hover { background: rgba(40, 199, 255, .04); }
code { color: var(--cyan); font-size: .88em; }

.badge {
  display: inline-block; padding: .16rem .55rem; border-radius: 20px;
  background: rgba(40, 199, 255, .09); color: var(--cyan);
  font-size: .68rem; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
}
.badge-green { background: rgba(30, 203, 121, .13); color: #5ee0a3; }
.badge-blue { background: rgba(40, 199, 255, .11); color: var(--cyan); }
.badge-red { background: rgba(251, 113, 133, .12); color: var(--danger); }
.badge-amber { background: rgba(251, 191, 36, .11); color: var(--amber); }

.saldo-favor { color: #5ee0a3; }
.saldo-deuda { color: var(--danger); }
.saldo-col { white-space: nowrap; }

.flashes { margin-bottom: 1rem; }
.flash { margin-bottom: .5rem; padding: .75rem 1rem; border-radius: 10px; }
.flash.error { background: rgba(251, 113, 133, .1); color: var(--danger); border-left: 4px solid var(--danger); }
.flash.info { background: rgba(40, 199, 255, .08); color: var(--cyan); border-left: 4px solid var(--primary); }
.error { display: block; color: var(--danger); font-size: .8rem; }
.aviso { color: var(--muted); font-size: .88rem; }

.acciones { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }
.inline-form { display: inline-block; margin: 0; }
.rango-form { display: flex; align-items: end; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }
.rango-form label { flex: 1 1 150px; margin-bottom: 0; }
.modo-ip { padding: 1rem; margin-bottom: 1rem; border: 1px solid var(--border); border-radius: 10px; }
.modo-ip legend { padding: 0 .4rem; color: var(--ink); font-family: var(--font-head); font-weight: 700; }
.modo-ip label { display: inline-flex; align-items: center; gap: .4rem; margin: 0 1rem 1rem 0; }
.modo-ip label:last-child { display: block; margin-right: 0; }

.timeline { display: grid; gap: .75rem; margin-bottom: 1rem; }
.comentario { padding: .75rem 1rem; border-left: 3px solid var(--success); border-radius: 10px; background: rgba(30, 203, 121, .06); }
.comentario p { margin: .2rem 0; }
.comentario small { margin-left: .5rem; color: var(--muted); }
.pill { display: inline-block; margin-left: .4rem; padding: .1rem .55rem; border-radius: 20px; background: var(--success); color: #02110a; font-size: .68rem; letter-spacing: .4px; text-transform: uppercase; }
.pill-interno { background: #3b4a4e; color: var(--ink); }

.app-footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1.5rem;
  padding: 1rem 2rem; border-top: 1px solid var(--border);
  color: var(--muted); font-size: .78rem;
}
.app-footer strong { color: var(--cyan); }

/* Panel principal: KPIs, acciones requeridas, routers, cobros y actividad. */
.dash-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.25rem;
}
.dash-head h1 { margin: 0; font-size: 1.75rem; letter-spacing: -.5px; }
.dash-kicker { color: var(--muted); font-size: .78rem; letter-spacing: .5px; }
.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); gap: .85rem; margin-bottom: .9rem; }
.dash-kpi {
  position: relative; overflow: hidden;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border); border-radius: 12px;
  background: linear-gradient(150deg, rgba(14, 31, 49, .9), rgba(6, 16, 28, .96));
}
.dash-kpi::after { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--primary), transparent); opacity: .55; }
.dash-kpi .lbl { color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }
.dash-kpi .num { margin-top: .3rem; font: 800 1.85rem/1.15 var(--font-head); overflow-wrap: anywhere; }
.dash-kpi .sub { margin-top: .25rem; color: var(--muted); font-size: .74rem; }
.dash-kpi.is-red .num { color: var(--danger); }
.dash-kpi.is-amber .num { color: var(--amber); }
.dash-kpi.is-cyan .num { color: var(--primary); }
.cyan { color: var(--primary); }
.red { color: var(--danger); }
.amber { color: var(--amber); }

/* Dos cuadros cuadrados: operación y cobros. Mantiene la paleta Sisprov. */
.dash-cuadros { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 270px; gap: .9rem; margin-bottom: .9rem; }
.dash-cuadro {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 0; padding: 1.1rem 1.2rem;
  border: 1px solid var(--border); border-radius: 12px;
  background: linear-gradient(150deg, rgba(14, 31, 49, .9), rgba(6, 16, 28, .96));
}
.dash-cuadro::after { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--primary), transparent); opacity: .55; }
.dash-cuadro-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: .75rem;
  margin-bottom: .6rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border);
}
.dash-cuadro-head h2 { margin: 0; padding: 0; border: 0; font-size: 1rem; }
.dash-cuadro-head .hint { color: var(--muted); font-size: .7rem; letter-spacing: .5px; text-transform: uppercase; }
.dash-cuadro-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; flex: 1; align-content: center; }
.dash-cuadro-grid.tres { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-cuadro-item {
  padding: .55rem .6rem; border: 1px solid rgba(40, 199, 255, .12);
  border-radius: 10px; background: rgba(6, 16, 28, .55);
}
.dash-cuadro-item .lbl { color: var(--muted); font-size: .66rem; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; }
.dash-cuadro-item .num { margin-top: .2rem; font: 800 1.3rem/1.15 var(--font-head); overflow-wrap: anywhere; }
.dash-cuadro-item .sub { margin-top: .25rem; color: var(--muted); font-size: .72rem; }
.dash-cuadro-item.is-red .num { color: var(--danger); }
.dash-cuadro-item.is-amber .num { color: var(--amber); }
.dash-cuadro-item.is-cyan .num { color: var(--primary); }

.dash-cuadro .dash-table { margin-top: .2rem; }
.dash-cuadro .dash-table th, .dash-cuadro .dash-table td { padding: .35rem .4rem; font-size: .78rem; }
.dash-cuadro .dash-time { padding: .42rem 0; font-size: .78rem; }

.spark {
  position: relative; height: 30px; margin-top: .25rem;
  border: 1px solid rgba(40, 199, 255, .12); border-radius: 8px;
  background: linear-gradient(180deg, rgba(40, 199, 255, .07), rgba(6, 16, 28, .5));
  overflow: hidden;
}
.spark svg { display: block; width: 100%; height: 100%; }
.spark polyline { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; }
.spark .spark-vacio {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--muted); font-size: .68rem; letter-spacing: .4px; text-transform: uppercase;
}
.spark-tiempo { margin-top: .1rem; color: var(--muted); font-size: .62rem; }
.dash-cuadro-router { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .3rem 0; border-top: 1px solid var(--border); }
.dash-cuadro-router:first-of-type { border-top: 0; }
.dash-cuadro-router .router-nombre { font-size: .84rem; font-weight: 700; }
.dash-cuadro-router .router-detalle { color: var(--muted); font-size: .68rem; }
.dash-cuadro-router .router-grafica { flex: 0 0 45%; min-width: 0; }
.dash-placeholder { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: .84rem; text-align: center; }

/* Ficha de cliente: los mismos cuadros cuadrados del panel. */
.detalle-cuadro { overflow: auto; padding: .75rem .85rem; }
.detalle-datos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .1rem .55rem; }
.detalle-dato {
  display: block; padding: .06rem 0; border-bottom: 1px solid rgba(40, 199, 255, .09);
  font-size: .72rem;
}
.detalle-dato > span { display: block; color: var(--muted); font-size: .58rem; letter-spacing: .5px; text-transform: uppercase; }
.detalle-dato > b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.detalle-dato > b.detalle-largo {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.detalle-acciones { display: flex; align-items: center; flex-wrap: nowrap; gap: .25rem; margin-top: auto; padding-top: .3rem; }
.detalle-acciones-conexion { grid-column: 1 / -1; margin-top: .15rem; padding-top: .15rem; }
.detalle-acciones .button { padding: .3rem .5rem; font-size: .68rem; }
.detalle-inline { display: flex; align-items: center; gap: .25rem; margin: 0; }
.detalle-inline select, .detalle-inline button { width: auto; min-width: 0; margin: 0; padding: .3rem .4rem; font-size: .66rem; }
.detalle-cuadro .dash-cuadro-head h2 { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detalle-cuadro .dash-table { margin-top: .5rem; }

/* Cuentas: los seis cuadros del panel, con tablas y acciones compactas. */
.cuentas-cuadro { overflow: auto; padding: .75rem .85rem; }
.cuentas-cuadro .dash-cuadro-head { margin-bottom: .4rem; padding-bottom: .4rem; }
.cuentas-cuadro .dash-cuadro-head h2 { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cuentas-cuadro .dash-cuadro-grid { gap: .35rem; }
.cuentas-cuadro .dash-cuadro-item { padding: .4rem .5rem; }
.cuentas-cuadro .dash-cuadro-item .num { font-size: 1.05rem; }
.cuentas-cuadro .dash-cuadro-item .sub { font-size: .64rem; }
.cuentas-tabla { width: 100%; table-layout: fixed; }
.cuentas-tabla th, .cuentas-tabla td {
  padding: .25rem .3rem; font-size: .7rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cuentas-tabla .accion { width: 58px; text-align: right; }
.cuentas-tabla .accion-doble { display: flex; gap: .2rem; justify-content: flex-end; }
.cuentas-tabla button { padding: .2rem .35rem; font-size: .64rem; }
.cuentas-tabla .anulado { color: var(--muted); text-decoration: line-through; }
.cuentas-reglas { margin: .45rem 0 0; color: var(--muted); font-size: .68rem; line-height: 1.4; }

.usuarios-rol { margin: .6rem 0 0; padding: 0; list-style: none; overflow-y: auto; }
.usuarios-rol li {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  padding: .3rem 0; border-top: 1px solid var(--border); font-size: .76rem;
}
.usuarios-rol li:first-child { border-top: 0; }
.usuario-nombre { flex: 1; min-width: 90px; font-weight: 700; overflow-wrap: anywhere; }

.portal-body { background: var(--page); }
.portal-content { max-width: 1280px; margin: 0 auto; padding: 1.1rem 1.4rem 1.8rem; }
.portal-bar { display: flex; justify-content: flex-end; margin-bottom: .55rem; }
.portal-content .dash-cuadros {
  grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 185px;
  gap: .7rem; margin-bottom: 0;
}
.portal-content .dash-cuadro { padding: .65rem .85rem; border-radius: 11px; }
.portal-content .dash-cuadro-head { margin-bottom: .3rem; padding-bottom: .3rem; }
.portal-content .dash-cuadro-head h2 { font-size: .88rem; }
.portal-content .dash-cuadro-head .hint { font-size: .62rem; }
.portal-content .dash-cuadro-grid { gap: .3rem; }
.portal-content .dash-cuadro-item { padding: .32rem .45rem; border-radius: 8px; }
.portal-content .dash-cuadro-item .lbl { font-size: .58rem; letter-spacing: .5px; }
.portal-content .dash-cuadro-item .num { margin-top: .12rem; font-size: 1.08rem; }
.portal-cliente { margin: 0 0 .2rem; color: var(--muted); font-size: .68rem; overflow-wrap: anywhere; }
.portal-salir {
  padding: .32rem .7rem; border: 1px solid var(--border); border-radius: 9px;
  background: rgba(14, 31, 49, .92); color: var(--ink);
  font: 700 .72rem var(--font-body); text-decoration: none;
}
.portal-salir:hover { border-color: var(--primary); color: var(--primary); }
.portal-boton {
  display: inline-block; padding: .32rem .7rem; border: 1px solid var(--primary);
  border-radius: 9px; background: var(--primary); color: #04121d;
  font: 800 .7rem var(--font-body); text-decoration: none; cursor: pointer;
}
.portal-boton:hover { filter: brightness(1.08); }
.portal-link { color: var(--muted); font-size: .72rem; text-decoration: none; }
.portal-link:hover { color: var(--primary); }
.portal-cuenta-accion { margin-top: .25rem; }
.portal-cuenta-accion .portal-boton { padding: .22rem .55rem; font-size: .66rem; }
.portal-pago-form { max-width: 520px; margin: 0 auto; padding: 1rem 1.2rem; }
.portal-qr-card {
  display: grid; justify-items: center; align-content: center; gap: .45rem;
  max-width: 420px; margin: 0 auto; padding: 1rem 1.2rem;
}
.portal-qr-card .dash-cuadro-head, .portal-qr-card .portal-qr-datos { width: 100%; }
.portal-form { display: grid; gap: .45rem; margin-top: .6rem; }
.portal-form label {
  color: var(--muted); font-size: .66rem; font-weight: 700;
  letter-spacing: .6px; text-transform: uppercase;
}
.portal-form input, .portal-form select {
  width: 100%; padding: .5rem .6rem; border: 1px solid var(--border);
  border-radius: 9px; background: var(--surface-2); color: var(--ink);
  font: 600 .85rem var(--font-body);
}
.portal-form-acciones { display: flex; align-items: center; gap: .7rem; margin-top: .3rem; }
.portal-qr { width: 100%; display: grid; place-items: center; margin: .2rem 0; }
.portal-qr svg {
  display: block; width: 240px; height: 240px;
  background: #fff; padding: .35rem; border-radius: 10px; box-sizing: border-box;
}
.portal-qr-datos {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .4rem; font-size: .75rem;
}
.portal-conexion { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.portal-conexion strong { font-size: .7rem; }
.portal-conexion small { color: var(--cyan); font-size: .62rem; }

.portal-lista { margin: .25rem 0 0; padding: 0; list-style: none; overflow-y: auto; }
.portal-lista li {
  display: flex; align-items: center; gap: .3rem; flex-wrap: wrap;
  padding: .18rem 0; border-top: 1px solid var(--border); font-size: .68rem;
}
.portal-lista li:first-child { border-top: 0; }
.portal-lista small { color: var(--muted); font-size: .68rem; }
.portal-monto { font-weight: 800; color: var(--ink); }
.portal-credito { color: #5ee0a3; }
.portal-debito { color: var(--danger); }
.portal-mono { font-family: ui-monospace, monospace; color: var(--cyan); font-size: .72rem; }

.dash-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: .9rem; margin-bottom: .9rem; }
.dash-full { margin-bottom: .9rem; }
.dash-grid .card { margin: 0; }
.dash-grid h2 { border: 0; padding: 0; font-size: .98rem; }
.dash-tarea { display: flex; align-items: center; gap: .75rem; padding: .7rem 0; border-top: 1px solid var(--border); }
.dash-tarea:first-of-type { border-top: 0; }
.dash-badge {
  min-width: 44px; text-align: center; padding: .35rem .5rem;
  border-radius: 9px; background: rgba(40, 199, 255, .09);
  color: var(--primary); font: 800 .95rem var(--font-head);
}
.dash-badge.r { background: rgba(251, 113, 133, .1); color: var(--danger); }
.dash-badge.a { background: rgba(251, 191, 36, .1); color: var(--amber); }
.dash-tarea .txt { flex: 1; min-width: 0; }
.dash-tarea .txt b { display: block; font-size: .88rem; }
.dash-tarea .txt small { color: var(--muted); font-size: .75rem; }
.dash-tarea .button { padding: .45rem .75rem; font-size: .75rem; white-space: nowrap; }

.dash-router { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .6rem 0; border-top: 1px solid var(--border); }
.dash-router:first-of-type { border-top: 0; }
.dash-router b { font-size: .86rem; }
.dash-router small { color: var(--muted); font-size: .72rem; }
.dash-chip { padding: .2rem .55rem; border-radius: 20px; background: rgba(40, 199, 255, .09); color: var(--primary); font-size: .66rem; font-weight: 700; white-space: nowrap; }
.dash-chip.ok { background: rgba(30, 203, 121, .12); color: #5ee0a3; }
.dash-chip.off { background: rgba(251, 113, 133, .1); color: var(--danger); }
.dash-track { height: 6px; border-radius: 4px; background: rgba(40, 199, 255, .08); overflow: hidden; }
.dash-track > i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--success)); }

.dash-table { width: 100%; border: 0; }
.dash-table th, .dash-table td { padding: .48rem .4rem; font-size: .82rem; }
.dash-table th { border-top: 0; }
.dash-time { display: flex; gap: .7rem; padding: .5rem 0; border-top: 1px solid var(--border); font-size: .82rem; }
.dash-time:first-of-type { border-top: 0; }
.dash-time .hora { color: var(--muted); font-size: .72rem; min-width: 40px; }

@media (max-width: 980px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    position: static; width: 100%; height: auto; flex-basis: auto; padding: .8rem 1rem;
  }
  .brand { padding-bottom: .8rem; }
  .side-nav { display: flex; gap: .35rem; margin-top: .6rem; padding-bottom: .3rem; overflow-x: auto; }
  .nav-label, .sidebar-foot { display: none; }
  .side-nav a { margin: 0; border-left: 0; border-bottom: 3px solid transparent; white-space: nowrap; }
  .side-nav a.active { border-bottom-color: var(--primary); }
  .topbar { padding: .65rem 1rem; }
  .content { padding: 1.2rem 1rem 2rem; }
  .app-footer { padding: 1rem; }
  .dash-grid, .dash-cuadros { grid-template-columns: 1fr; }
  .dash-cuadros { grid-auto-rows: auto; }
}

@media (max-width: 600px) {
  .user-name { display: none; }
  .page-heading { flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid strong { font-size: 1.45rem; }
  .filtros input, .filtros select { min-width: 100%; }
  .filtros button { margin-left: 0; }
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-cuadro-grid, .dash-cuadro-grid.tres { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-cuadro { min-height: 0; }
}

@media (max-width: 640px) {
  .portal-content { padding: .8rem .8rem 1.2rem; }
  .portal-content .dash-cuadros { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .portal-content .dash-cuadro { min-height: 120px; }
  .portal-qr svg { width: 200px; height: 200px; }
}
