:root {
  --akp-red: #C0202B;
  --akp-red-dark: #8f1620;
  --akp-bg: #F3F4F6;
  --akp-card: #FFFFFF;
  --akp-border: #E5E7EB;
  --akp-text: #1F2937;
  --akp-text-muted: #6B7280;
  --akp-green: #059669;
  --akp-amber: #D97706;
  --akp-blue: #2563EB;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--akp-bg);
  color: var(--akp-text);
}
a { color: inherit; text-decoration: none; }

/* ---------- Top bar ---------- */
.topbar {
  background: linear-gradient(135deg, var(--akp-red), var(--akp-red-dark));
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
}
.brand { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-size: 22px; font-weight: 800; letter-spacing: 0.5px; }
.brand-sub { font-size: 11px; font-weight: 600; letter-spacing: 1px; opacity: 0.9; }
.topbar-right { display: flex; align-items: center; gap: 18px; font-size: 13px; }
.status-pill { display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,0.15); padding: 5px 10px; border-radius: 14px; font-weight: 600; }
.dot-green { width: 8px; height: 8px; border-radius: 50%; background: #4ADE80; box-shadow: 0 0 0 3px rgba(74,222,128,0.3); }
.topbar-user { font-weight: 600; opacity: 0.95; }
.topbar-link { font-weight: 600; padding: 6px 10px; border-radius: 6px; background: rgba(255,255,255,0.12); }
.topbar-link:hover { background: rgba(255,255,255,0.25); }

/* ---------- Impersonate banner ---------- */
.impersonate-banner {
  background: #FEF3C7;
  border-bottom: 1px solid #FCD34D;
  color: #92400E;
  padding: 10px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.impersonate-exit { font-weight: 700; text-decoration: underline; }

/* ---------- Tabs ---------- */
.tabnav {
  background: #fff;
  border-bottom: 1px solid var(--akp-border);
  padding: 0 28px;
  display: flex;
  gap: 6px;
}
.tab {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--akp-text-muted);
  border-bottom: 3px solid transparent;
}
.tab:hover { color: var(--akp-text); }
.tab-active { color: var(--akp-red); border-bottom-color: var(--akp-red); }
.tab-disabled { color: #C4C9D1; cursor: not-allowed; }

/* ---------- Layout ---------- */
.main-content { padding: 24px 28px 48px; max-width: 1400px; margin: 0 auto; }
.page-title { font-size: 20px; font-weight: 700; margin: 4px 0 18px; }

/* ---------- KPI cards ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi-card { background: var(--akp-card); border: 1px solid var(--akp-border); border-radius: 10px; padding: 16px 18px; }
.kpi-label { font-size: 12px; color: var(--akp-text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.kpi-value { font-size: 26px; font-weight: 800; margin-top: 6px; }
.kpi-sub { font-size: 12px; color: var(--akp-text-muted); margin-top: 4px; }
.kpi-card.accent-red .kpi-value { color: var(--akp-red); }
.kpi-card.accent-green .kpi-value { color: var(--akp-green); }
.kpi-card.accent-amber .kpi-value { color: var(--akp-amber); }
.kpi-card.accent-blue .kpi-value { color: var(--akp-blue); }

/* ---------- Hero (Saldo Total + Total Vencido) ---------- */
.hero-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 22px; }
@media (max-width: 980px) { .hero-grid { grid-template-columns: 1fr; } }
.hero-card { background: var(--akp-card); border: 1px solid var(--akp-border); border-radius: 16px; padding: 20px 22px; min-height: 140px; display: flex; flex-direction: column; justify-content: space-between; }
.hero-card-head { display: flex; align-items: center; justify-content: space-between; }
.hero-label { font-size: 12px; font-weight: 700; color: var(--akp-text-muted); text-transform: uppercase; letter-spacing: 0.6px; }
.hero-value { font-size: 38px; font-weight: 800; letter-spacing: -0.5px; line-height: 1; margin-top: 10px; }
.hero-sub { font-size: 12px; color: var(--akp-text-muted); margin-top: 10px; }
.hero-card-accent { background: #FBE9EA; border: 1px solid #F5C6C9; position: relative; overflow: hidden; color: var(--akp-red-dark); }
.hero-card-accent .hero-label { color: var(--akp-red-dark); opacity: 0.75; }
.hero-card-accent .hero-sub { color: var(--akp-red-dark); opacity: 0.75; }
.hero-card-accent .hero-value { color: var(--akp-red-dark); }
.hero-watermark { position: absolute; right: -10px; bottom: -22px; font-size: 100px; font-weight: 200; line-height: 1; opacity: 0.12; color: var(--akp-red); pointer-events: none; user-select: none; }

/* ---------- Estructura por Empresa: Disponible vs Comprometido ---------- */
.estructura-legend { display: flex; gap: 16px; font-size: 11px; font-weight: 700; color: var(--akp-text-muted); }
.estructura-bar { display: flex; width: 100%; height: 8px; background: #E5E7EB; border-radius: 6px; overflow: hidden; }
.estructura-bar .bar-disponible { background: var(--akp-green); }
.estructura-bar .bar-comprometido { background: var(--akp-red); }

/* ---------- Tarjetas por empresa (Balance + Vencido fusionados) ---------- */
.empresa-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1100px) { .empresa-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .empresa-grid { grid-template-columns: 1fr; } }
.empresa-grid .empresa-card { margin-top: 0; }
.empresa-balance-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin: 10px 0 8px; }
.empresa-balance-label { font-size: 11px; font-weight: 700; color: var(--akp-text-muted); text-transform: uppercase; letter-spacing: .03em; }
.empresa-balance-label.label-vencido { color: var(--akp-red); }
.empresa-balance-value { font-size: 20px; font-weight: 800; margin-top: 2px; }
.empresa-balance-value.value-vencido { color: var(--akp-red); }
.empresa-card .empresa-vencido-row { display: flex; justify-content: space-between; font-size: 12px; margin: 8px 0; color: var(--akp-text-muted); }
.empresa-card .empresa-vencido-row strong { color: var(--akp-red); }
.bank-badge { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 20px; border-radius: 5px; font-size: 9px; font-weight: 800; margin-right: 8px; color: #fff; flex-shrink: 0; }
.bank-row { display: flex; align-items: center; font-size: 12px; padding: 6px 0; }
.bank-row-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.bank-row-name { font-weight: 700; color: var(--akp-text); }
.bank-row-pct { color: var(--akp-text-muted); font-size: 11px; }
.bank-row-amount { font-weight: 700; color: var(--akp-text); white-space: nowrap; }

/* Desglose de cuentas bancarias por empresa: plegable (resumen siempre visible,
   detalle de cada banco a un toque). Por defecto abierto (igual que antes en
   desktop); en móvil, assets/mobile.js lo colapsa al cargar para que la tarjeta
   no se sienta "muy grande". */
.empresa-bancos { margin-top: 2px; }
.empresa-bancos > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: 8px 0 6px; font-size: 11.5px; font-weight: 700; color: var(--akp-text-muted); text-transform: uppercase; letter-spacing: .03em; border-top: 1px solid #F3F4F6; margin-top: 6px; }
.empresa-bancos > summary::-webkit-details-marker { display: none; }
.empresa-bancos-chevron { color: var(--akp-text-muted); font-size: 11px; transition: transform .15s ease; }
.empresa-bancos[open] > summary .empresa-bancos-chevron { transform: rotate(180deg); }

.ver-pagos-btn { display: block; width: 100%; text-align: center; margin-top: 12px; padding: 9px; border-radius: 8px; background: #F3F4F6; color: var(--akp-red); font-weight: 700; font-size: 12px; text-decoration: none; border: none; font-family: inherit; cursor: pointer; }
.ver-pagos-btn:hover { background: #E5E7EB; }
.sin-dato { color: var(--akp-text-muted); font-style: italic; }

/* ---------- Filtros tipo pill (Pagos Pendientes) ---------- */
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.pill { display: inline-block; padding: 6px 14px; border-radius: 16px; font-size: 12px; font-weight: 700; border: 1px solid var(--akp-border); background: #fff; color: var(--akp-text-muted); font-family: inherit; cursor: pointer; }
.pill:hover { background: #F9FAFB; }
.pill-active { background: var(--akp-text); border-color: var(--akp-text); color: #fff; }
.pill-active.pill-danger { background: var(--akp-red); border-color: var(--akp-red); }
.pill-count-danger { background: #FEE2E2; color: #B91C1C; padding: 2px 9px; border-radius: 10px; font-size: 11px; font-weight: 800; margin-left: 8px; }

/* ---------- Pagination ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; font-size: 12px; color: var(--akp-text-muted); }
.pager-links { display: flex; gap: 6px; }
.pager-links a, .pager-links span { padding: 5px 11px; border-radius: 6px; border: 1px solid var(--akp-border); }
.pager-links a:hover { background: #F9FAFB; }
.pager-links .pager-disabled { color: #C4C9D1; }

/* ---------- Detalle de facturas vencidas por proveedor (Microsip) ---------- */
.proveedor-detail { border: 1px solid var(--akp-border); border-left: 4px solid var(--akp-red); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.proveedor-detail summary { list-style: none; cursor: pointer; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; background: #fff; text-align: left; }
.proveedor-detail summary::-webkit-details-marker { display: none; }
.proveedor-detail summary:hover { background: #FAFAFA; }
.proveedor-summary-left { flex: 1 1 auto; min-width: 0; text-align: left; }
.proveedor-summary-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.proveedor-summary-name { font-weight: 700; text-align: left; }
.proveedor-summary-meta { font-size: 12px; color: var(--akp-text-muted); margin-top: 3px; text-align: left; }
.vencido-badge { display: inline-block; background: #FDE2E3; color: var(--akp-red); font-weight: 800; font-size: 10.5px; letter-spacing: 0.2px; text-transform: uppercase; padding: 3px 9px; border-radius: 10px; white-space: nowrap; }
.proveedor-summary-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.proveedor-summary-total { font-weight: 800; color: var(--akp-red); font-size: 15px; white-space: nowrap; }
.proveedor-summary-chevron { color: var(--akp-text-muted); font-size: 13px; line-height: 1; transition: transform .15s ease; flex-shrink: 0; }
.proveedor-detail[open] .proveedor-summary-chevron { transform: rotate(180deg); }
.proveedor-detail table.akp-table { margin: 0; }
.proveedor-detail table.akp-table th, .proveedor-detail table.akp-table td { padding: 8px 16px; }

/* ---------- Cards / panels ---------- */
.panel { background: var(--akp-card); border: 1px solid var(--akp-border); border-radius: 10px; padding: 18px 20px; margin-bottom: 20px; }
.panel-title { font-size: 15px; font-weight: 700; margin: 0 0 14px; }
.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 980px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- Tables ---------- */
table.akp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.akp-table th { text-align: left; padding: 10px 12px; color: var(--akp-text-muted); font-weight: 600; border-bottom: 2px solid var(--akp-border); white-space: nowrap; }
table.akp-table td { padding: 10px 12px; border-bottom: 1px solid var(--akp-border); vertical-align: middle; }
table.akp-table tr:hover td { background: #FAFAFA; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; }
.badge-tesoreria { background: #DBEAFE; color: #1D4ED8; }
.badge-director { background: #EDE9FE; color: #6D28D9; }
.badge-contador { background: #D1FAE5; color: #047857; }
.badge-developer { background: #1F2937; color: #fff; }
.badge-default { background: #E5E7EB; color: #374151; }
.badge-status-pagado { background: #D1FAE5; color: #047857; }
.badge-status-pendiente_autorizacion { background: #FEF3C7; color: #92400E; }
.badge-status-autorizado { background: #DBEAFE; color: #1D4ED8; }
.badge-status-vencido { background: #FEE2E2; color: #B91C1C; }
.badge-status-rechazado { background: #F3F4F6; color: #4B5563; }

/* ---------- Avatares ---------- */
.avatar { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0; }

/* ---------- Vista de usuario (cards de login) ---------- */
.user-list { display: flex; flex-direction: column; gap: 10px; }
.user-row { display: flex; align-items: center; gap: 14px; background: var(--akp-card); border: 1px solid var(--akp-border); border-radius: 10px; padding: 14px 18px; }
.user-row .user-info { flex: 1; }
.user-row .user-name { font-weight: 700; font-size: 14px; }
.user-row .user-email { font-size: 12px; color: var(--akp-text-muted); }
.btn { display: inline-block; padding: 8px 14px; border-radius: 6px; font-size: 13px; font-weight: 600; border: 1px solid var(--akp-border); background: #fff; cursor: pointer; }
.btn:hover { background: #F9FAFB; }
.btn-primary { background: var(--akp-red); border-color: var(--akp-red); color: #fff; }
.btn-primary:hover { background: var(--akp-red-dark); }
.btn-dark { background: var(--akp-text); border-color: var(--akp-text); color: #fff; }
.btn-dark:hover { background: #111827; }
.btn-amber { background: var(--akp-amber); border-color: var(--akp-amber); color: #fff; }
.btn-amber:hover { filter: brightness(0.92); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-recargar { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 6px; font-size: 12px; font-weight: 600; border: 1px solid var(--akp-border); background: #fff; color: var(--akp-text-muted); cursor: pointer; font-family: inherit; flex-shrink: 0; }
.btn-recargar:hover { background: #F9FAFB; color: var(--akp-text); }

.btn-trash-form { display: inline-block; margin: 0; }
.btn-trash { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--akp-border); background: #fff; color: var(--akp-text-muted); cursor: pointer; font-size: 13px; line-height: 1; padding: 0; }
.btn-trash:hover { background: #FEF2F2; border-color: #FCA5A5; color: var(--akp-red); }

.toggle-row { display: flex; align-items: center; justify-content: space-between; background: #fff; border: 1px solid var(--akp-border); border-radius: 10px; padding: 14px 18px; margin-bottom: 18px; }
.switch { position: relative; display: inline-block; width: 42px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background-color: #D1D5DB; border-radius: 22px; transition: .2s; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background-color: var(--akp-green); }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* ---------- Progress bars (Saldos) ---------- */
.progress-track { width: 100%; height: 8px; background: #E5E7EB; border-radius: 6px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 6px; }
.empresa-card { border: 1px solid var(--akp-border); border-radius: 10px; padding: 16px 18px; background: #fff; }
.empresa-card + .empresa-card { margin-top: 12px; }
.empresa-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.empresa-name { font-weight: 700; font-size: 14px; }
.bank-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--akp-text-muted); padding: 4px 0; }

/* ---------- Filtros ---------- */
.filter-bar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filter-bar input, .filter-bar select { padding: 8px 12px; border: 1px solid var(--akp-border); border-radius: 6px; font-size: 13px; }
.filter-bar input[type="text"] { flex: 1; min-width: 200px; }

/* ---------- Paginacion ---------- */
.paginacion { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.pag-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 6px; font-size: 13px; font-weight: 600; border: 1px solid var(--akp-border); background: #fff; color: var(--akp-text-muted); cursor: pointer; font-family: inherit; }
.pag-btn:hover:not(:disabled) { background: #F9FAFB; color: var(--akp-text); }
.pag-btn:disabled { opacity: 0.4; cursor: default; }
.pag-btn-activa { background: var(--akp-red); border-color: var(--akp-red); color: #fff; }
.pag-btn-activa:hover { background: var(--akp-red); color: #fff; }
.pag-ellipsis { padding: 0 4px; color: var(--akp-text-muted); font-size: 13px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--akp-red), var(--akp-red-dark)); }
.login-card { background: #fff; border-radius: 14px; padding: 36px 34px; width: 100%; max-width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,0.25); }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card p.sub { color: var(--akp-text-muted); font-size: 13px; margin: 0 0 24px; }
.login-card label { font-size: 12px; font-weight: 600; color: var(--akp-text-muted); display: block; margin-bottom: 6px; }
.login-card input { width: 100%; padding: 10px 12px; border: 1px solid var(--akp-border); border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.password-field { position: relative; margin-bottom: 16px; }
.password-field input { padding-right: 56px; margin-bottom: 0; }
.login-card button.toggle-password {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: auto; height: auto; border: none; background: none; color: var(--akp-red);
  font-size: 12px; font-weight: 700; cursor: pointer; padding: 6px 8px; margin: 0; border-radius: 6px;
}
.login-card button.toggle-password:hover { background: #FEE2E2; }
.login-card button:not(.toggle-password) { width: 100%; padding: 12px; border: none; border-radius: 8px; background: var(--akp-red); color: #fff; font-weight: 700; font-size: 14px; cursor: pointer; }
.login-card button:hover { background: var(--akp-red-dark); }
.login-error { background: #FEE2E2; color: #B91C1C; padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.login-logo { text-align: center; margin-bottom: 18px; font-size: 26px; font-weight: 800; color: var(--akp-red); }

/* ---------- Editable table (Balances) ---------- */
.akp-table input[type="number"], .akp-table input[type="text"], .akp-table input[type="date"] {
  width: 100%; padding: 6px 8px; border: 1px solid var(--akp-border); border-radius: 6px; font-size: 13px;
}
.toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-bottom: 14px; }
.autosave-indicator { font-size: 12px; color: var(--akp-text-muted); margin-right: auto; opacity: 0; transition: opacity .25s ease; }
.autosave-indicator.autosave-visible { opacity: 1; }
.autosave-indicator.autosave-error { color: var(--akp-red); font-weight: 700; }

.empty-state { text-align: center; color: var(--akp-text-muted); padding: 30px; font-size: 13px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--akp-text-muted); margin-top: 10px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 5px; }

.chart-box { position: relative; width: 100%; height: 260px; }
.chart-box canvas { max-width: 100%; }

/* ---------- Modulos ejecutivos: Ventas, CxC y Nomina ---------- */
.module-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 2px 0 18px; }
.module-heading .page-title { margin: 0 0 4px; }
.module-context, .data-cut, .panel-meta, .cell-sub { color: var(--akp-text-muted); font-size: 12px; }
.data-cut { padding: 7px 10px; border: 1px solid var(--akp-border); border-radius: 6px; background: #fff; white-space: nowrap; }
.module-filters { display: flex; align-items: flex-end; gap: 10px; padding: 14px; margin-bottom: 18px; background: #fff; border: 1px solid var(--akp-border); border-radius: 8px; }
.module-filters label { display: flex; flex-direction: column; gap: 5px; min-width: 160px; color: var(--akp-text-muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.module-filters input, .module-filters select, .inline-period-filter select { min-height: 38px; padding: 7px 10px; border: 1px solid var(--akp-border); border-radius: 6px; background: #fff; color: var(--akp-text); font-family: inherit; font-size: 13px; text-transform: none; }
.module-filters .filter-grow { flex: 1; min-width: 220px; }
.compact-filters { padding: 0 0 14px; border: 0; border-bottom: 1px solid var(--akp-border); border-radius: 0; }
.executive-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.panel-heading-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.panel-heading-row .panel-title { margin-bottom: 3px; }
.table-action { text-align: right; white-space: nowrap; }
.rank-number { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: #F3F4F6; color: #374151; font-size: 12px; font-weight: 800; }
.trend { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.trend-up { color: #047857; background: #D1FAE5; }
.trend-down { color: #B91C1C; background: #FEE2E2; }
.trend-neutral { color: #4B5563; background: #F3F4F6; }
.back-link { display: inline-block; margin-bottom: 8px; color: var(--akp-red); font-size: 12px; font-weight: 700; }
.seller-name { font-size: 24px; }
.inline-period-filter select { min-width: 110px; }
.stat-list { display: flex; flex-direction: column; }
.stat-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 54px; padding: 10px 0; border-bottom: 1px solid #EEF0F2; font-size: 13px; }
.stat-row:last-child { border-bottom: 0; }
.stat-row > span { color: var(--akp-text-muted); }
.stat-row strong { font-size: 14px; }
.stat-row-stack > span { display: flex; flex-direction: column; gap: 3px; }
.stat-row-stack > span > strong { color: var(--akp-text); }
.stat-row small { color: var(--akp-text-muted); font-size: 11px; }
.compact-list { display: flex; flex-direction: column; }
.compact-list-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 52px; padding: 8px 0; border-bottom: 1px solid #EEF0F2; font-size: 12px; }
.compact-list-row:last-child { border-bottom: 0; }
.compact-list-row:hover .compact-list-main strong { color: var(--akp-red); }
.compact-list-main { display: flex; flex-direction: column; min-width: 0; }
.compact-list-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-list-main small { margin-top: 2px; color: var(--akp-text-muted); }
.portfolio-list { display: flex; flex-direction: column; gap: 9px; }
.portfolio-item { border: 1px solid var(--akp-border); border-radius: 8px; overflow: hidden; background: #fff; scroll-margin-top: 80px; }
.portfolio-item > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 14px 16px; cursor: pointer; list-style: none; }
.portfolio-item > summary::-webkit-details-marker { display: none; }
.portfolio-item > summary:hover { background: #FAFAFA; }
.portfolio-client, .portfolio-amounts { display: flex; flex-direction: column; gap: 3px; }
.portfolio-client span { color: var(--akp-text-muted); font-size: 11px; }
.portfolio-amounts { align-items: flex-end; font-size: 13px; }
.portfolio-amounts > strong { font-size: 16px; }
.amount-due { color: var(--akp-red); font-size: 11px; font-weight: 700; }
.aging-strip { display: flex; gap: 20px; padding: 10px 16px; border-top: 1px solid #EEF0F2; border-bottom: 1px solid #EEF0F2; background: #F9FAFB; color: var(--akp-text-muted); font-size: 11px; }
.aging-strip strong { color: var(--akp-text); }
.portfolio-item .table-scroll { padding: 0 6px; }
.profile-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 4px 0 16px; background: var(--akp-border); border: 1px solid var(--akp-border); border-radius: 8px; overflow: hidden; }
.profile-metrics > div { display: flex; flex-direction: column; gap: 5px; padding: 14px; background: #fff; }
.profile-metrics span { color: var(--akp-text-muted); font-size: 11px; }
.profile-metrics strong { font-size: 18px; }
.collection-hero { display: flex; align-items: stretch; justify-content: space-between; gap: 24px; margin: 0 0 18px; padding: 22px 24px; border-radius: 8px; background: #087A55; color: #fff; }
.collection-hero-main { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.collection-eyebrow { margin-bottom: 5px; color: #D1FAE5; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0; }
.collection-hero-main > strong { font-size: 32px; line-height: 1.05; }
.collection-hero-main > small { margin-top: 7px; color: #D1FAE5; font-size: 12px; }
.collection-hero-split { display: grid; grid-template-columns: repeat(2, minmax(120px, 1fr)); min-width: 330px; border-left: 1px solid rgba(255,255,255,.28); }
.collection-hero-split > div { display: flex; flex-direction: column; justify-content: center; gap: 5px; padding: 2px 20px; }
.collection-hero-split span { color: #D1FAE5; font-size: 11px; }
.collection-hero-split strong { font-size: 20px; }
.receivable-amount { color: #047857; }
.payment-outlook { padding: 12px 16px; border-top: 1px solid #D1FAE5; background: #F0FDF4; }
.payment-outlook > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; }
.payment-outlook > div:first-child span { color: #4B5563; }
.payment-outlook > div:first-child strong { color: #047857; }
.payment-outlook small { display: block; margin-top: 6px; color: #4B5563; font-size: 10.5px; }
.payment-track { height: 5px; margin-top: 8px; overflow: hidden; border-radius: 3px; background: #D1FAE5; }
.payment-track span { display: block; height: 100%; border-radius: inherit; background: #059669; }
.payment-medium { border-color: #FDE68A; background: #FFFBEB; }
.payment-medium .payment-track { background: #FEF3C7; }
.payment-medium .payment-track span { background: #D97706; }
.payment-medium > div:first-child strong { color: #B45309; }
.payment-low { border-color: #FECACA; background: #FEF2F2; }
.payment-low .payment-track { background: #FEE2E2; }
.payment-low .payment-track span { background: #DC2626; }
.payment-low > div:first-child strong { color: #B91C1C; }
.payment-unknown .payment-track span { width: 0; }

@media (max-width: 1050px) {
  .executive-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .module-heading { align-items: flex-start; margin-bottom: 14px; }
  .module-heading .data-cut { display: none; }
  .module-context { line-height: 1.35; }
  .module-filters { display: grid; grid-template-columns: 1fr 1fr; padding: 12px; }
  .module-filters label, .module-filters .filter-grow { min-width: 0; }
  .module-filters .filter-grow { grid-column: 1 / -1; }
  .module-filters .btn { width: 100%; text-align: center; }
  .compact-filters { padding: 0 0 12px; background: transparent; }
  .executive-kpis { grid-template-columns: 1fr 1fr; }
  .executive-kpis .kpi-card { min-height: 116px; }
  .executive-kpis .kpi-value { font-size: 22px; overflow-wrap: anywhere; }
  .panel-heading-row { align-items: flex-start; }
  .data-table .table-action { text-align: left; }
  .data-table .table-action .btn { width: 100%; text-align: center; }
  .seller-profile-grid { grid-template-columns: 1fr; }
  .inline-period-filter select { min-height: 42px; font-size: 16px; }
  .compact-list-row { min-height: 58px; }
  .portfolio-panel { padding-left: 0; padding-right: 0; background: transparent; border: 0; box-shadow: none; }
  .portfolio-panel > .panel-heading-row, .portfolio-panel > .module-filters { margin-left: 0; margin-right: 0; }
  .portfolio-item { border: 0; border-radius: 12px; box-shadow: 0 1px 2px rgba(15,23,42,.08); }
  .portfolio-item > summary { grid-template-columns: 1fr; gap: 10px; padding: 14px; }
  .portfolio-amounts { align-items: flex-start; flex-direction: row; justify-content: space-between; }
  .aging-strip { overflow-x: auto; gap: 16px; padding: 10px 14px; white-space: nowrap; }
  .portfolio-item .table-scroll { padding: 0; }
  .portfolio-item table.akp-table.data-table,
  .portfolio-item table.akp-table.data-table tbody,
  .portfolio-item table.akp-table.data-table tr,
  .portfolio-item table.akp-table.data-table td,
  .portfolio-item table.akp-table.data-table th { display: revert; width: auto; }
  .portfolio-item table.akp-table.data-table { min-width: 680px; border-collapse: collapse; }
  .portfolio-item table.akp-table.data-table thead { display: table-header-group; }
  .portfolio-item table.akp-table.data-table tr { border: 0; border-radius: 0; margin: 0; padding: 0; }
  .portfolio-item table.akp-table.data-table td { padding: 9px 12px; }
  .portfolio-item table.akp-table.data-table td::before { content: none !important; }
  .profile-metrics { grid-template-columns: 1fr 1fr; }
  .collection-hero { flex-direction: column; gap: 18px; padding: 18px; }
  .collection-hero-main > strong { font-size: 28px; }
  .collection-hero-split { min-width: 0; border-top: 1px solid rgba(255,255,255,.28); border-left: 0; }
  .collection-hero-split > div { padding: 14px 8px 0; }
  .collection-hero-split > div:first-child { padding-left: 0; }
  .portfolio-amounts .receivable-amount { text-align: right; }
}

@media (max-width: 420px) {
  .module-filters, .executive-kpis { grid-template-columns: 1fr; }
  .module-filters .filter-grow { grid-column: auto; }
  .profile-metrics { grid-template-columns: 1fr; }
}

/* ---------- Modal de vista previa de reporte (Balances) ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(17,24,39,0.55); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 1000; }
.modal-box { background: #fff; border-radius: 12px; padding: 22px 24px; max-width: 920px; width: 100%; max-height: 88vh; overflow-y: auto; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-sub { font-size: 12px; color: var(--akp-text-muted); margin-top: 2px; }
.modal-close { border: none; background: none; font-size: 16px; cursor: pointer; color: var(--akp-text-muted); }
.modal-warning { background: #FEF2F2; border: 1px solid #FCA5A5; color: var(--akp-red-dark); border-radius: 8px; padding: 10px 14px; font-size: 13px; font-weight: 700; margin: 14px 0; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- Documento del reporte (igual al PDF impreso: reporte_imprimir.php) ---------- */
.reporte-preview-scroll { border: 1px solid var(--akp-border); border-radius: 10px; padding: 24px; background: #fff; }
/* Reporte de Balances: estructura y valores copiados literalmente del generador original
   (la funcion `Q` de la app de referencia), no una aproximacion visual. */
.reporte-doc { max-width: 960px; margin: 0 auto; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: #1F2937; }

.reporte-header { display: flex; align-items: center; gap: 20px; padding-bottom: 18px; margin-bottom: 28px; border-bottom: 3px solid #E31E24; }
.reporte-logo-img { width: 140px; height: auto; }
.reporte-title { font-size: 17px; font-weight: 700; color: #1F2937; text-transform: uppercase; letter-spacing: 1px; }
.reporte-sub { font-size: 12px; color: #6B7280; margin-top: 4px; text-transform: capitalize; }

.reporte-kpis { display: grid; gap: 14px; margin-bottom: 20px; }
.reporte-kpi { background: #F9FAFB; border-radius: 10px; padding: 16px; text-align: center; border: 1px solid #E5E7EB; }
.reporte-kpi-label { font-size: 10px; color: #6B7280; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 5px; font-weight: 500; }
.reporte-kpi-value { font-size: 18px; font-weight: 700; color: #1F2937; font-family: 'SF Mono', Monaco, monospace; }
.reporte-kpi-cierre { background: linear-gradient(135deg, #E31E24 0%, #c41920 100%); border: none; }
.reporte-kpi-cierre .reporte-kpi-label,
.reporte-kpi-cierre .reporte-kpi-value { color: #fff; }
.reporte-kpi-diff { font-size: 11px; margin-top: 4px; font-family: monospace; }
.reporte-kpi-diff.pos { color: #16a34a; }
.reporte-kpi-diff.neg { color: #dc2626; }
.reporte-kpi-cierre .reporte-kpi-diff.pos { color: rgba(255,255,255,.8); }
.reporte-kpi-cierre .reporte-kpi-diff.neg { color: rgba(255,200,200,.9); }

.reporte-kpi-debes { background: #FFF7ED; border-radius: 10px; padding: 16px; text-align: center; border: 2px solid #f97316; }
.reporte-kpi-debes .reporte-kpi-label { color: #ea580c; font-weight: 600; }
.reporte-kpi-debes .reporte-kpi-value { color: #ea580c; font-family: 'SF Mono', Monaco, monospace; }

.reporte-warning { background: #FEF2F2; border: 1px solid #FCA5A5; color: var(--akp-red-dark); border-radius: 8px; padding: 12px 16px; font-size: 13px; font-weight: 700; margin-bottom: 20px; }

.reporte-table { width: 100%; border-collapse: collapse; margin-bottom: 28px; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.reporte-table thead th { background: #1F2937; color: #fff; padding: 12px; text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.reporte-table thead th:not(:first-child) { text-align: right; }

.reporte-empresa-band td { padding: 10px 18px; background: #1F2937; border-bottom: none; }
.reporte-empresa-flex { display: flex; align-items: center; justify-content: space-between; }
.reporte-empresa-nombre { font-size: 11px; font-weight: 700; color: #fff; text-transform: uppercase; letter-spacing: .5px; }
.reporte-empresa-total-wrap { text-align: right; }
.reporte-empresa-total { font-size: 17px; font-weight: 700; color: #fff; font-family: monospace; line-height: 1.1; }
.reporte-empresa-total-label { font-size: 9px; color: rgba(255,255,255,.5); text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }

.reporte-cuenta-celda { padding: 10px 12px 10px 20px; border-bottom: 1px solid #E5E7EB; vertical-align: top; }
.reporte-cuenta-banco { font-weight: 600; color: #1F2937; font-size: 12px; }
.reporte-cuenta-num { font-weight: 400; color: #9CA3AF; font-family: monospace; font-size: 10px; margin-left: 6px; }
.reporte-cuenta-nota { font-size: 10px; color: #9CA3AF; margin-top: 2px; }

.reporte-monto { text-align: right; font-family: monospace; vertical-align: top; }
.reporte-cuenta-row .reporte-monto { padding: 10px 12px; border-bottom: 1px solid #E5E7EB; }
.reporte-monto-prev { font-size: 12px; color: #6B7280; font-weight: 400; }
.reporte-monto-ultimo { font-size: 13px; color: #1F2937; font-weight: 700; }
.reporte-monto-diff { font-size: 10px; margin-top: 1px; }
.reporte-monto-diff.pos { color: #16a34a; }
.reporte-monto-diff.neg { color: #dc2626; }

.reporte-subtotal-label { padding: 8px 12px; background: #F9FAFB; font-size: 11px; font-weight: 700; color: #374151; border-top: 2px solid #E5E7EB; }
.reporte-subtotal-row .reporte-monto { padding: 8px 12px; background: #F9FAFB; border-top: 2px solid #E5E7EB; }
.reporte-subtotal-prev { font-size: 12px; font-weight: 600; color: #6B7280; }
.reporte-subtotal-ultimo { font-size: 13px; font-weight: 700; color: #1F2937; }

.reporte-spacer { height: 10px; padding: 0; border: none; }

.reporte-empty { text-align: center; color: var(--akp-text-muted); padding: 24px; }

.reporte-footer { font-size: 10px; color: #9CA3AF; text-align: center; padding-top: 18px; border-top: 1px solid #E5E7EB; }
.reporte-footer-brand { color: #E31E24; font-weight: 600; }

/* Color de columnas de corte en la tabla editable: primero = apertura, ultimo = cierre, intermedios = corte. */
.corte-col-first { background: #EFF6FF; }
.corte-col-last { background: #ECFDF5; }
.corte-col-mid { background: #FFFBEB; }

/* ---------- Barra "Mis empresas" (Balances) ---------- */
.mis-empresas-bar {
  background: var(--akp-card);
  border: 1px solid var(--akp-border);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--akp-text-muted);
  margin-bottom: 18px;
}
.mis-empresas-bar strong { color: var(--akp-text); }

/* ---------- Lista de cuentas estilo tarjeta (Balances) ---------- */
.cortes-header-bar {
  display: grid;
  gap: 1px;
  padding: 8px 0 8px 0;
  margin-left: 50px;
  border-bottom: 2px solid var(--akp-border);
}
.cortes-footer-bar { border-top: 2px solid var(--akp-text); border-bottom: none; font-weight: 700; }
.cortes-header-item {
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--akp-text-muted);
}
.cortes-header-item input[type="text"] {
  font-weight: 700;
  border: none;
  background: transparent;
  width: 100%;
  padding: 2px;
  color: var(--akp-text);
  font-size: 13px;
}
.cortes-header-del { border: none; background: none; color: var(--akp-red); cursor: pointer; font-weight: 700; flex-shrink: 0; }
.cortes-header-notas { font-weight: 600; }

.account-list { display: flex; flex-direction: column; }
.account-card { border-bottom: 1px solid var(--akp-border); padding: 12px 0; }
.account-card:first-child { border-top: 1px solid var(--akp-border); }

.account-card-identity { display: flex; align-items: center; gap: 12px; }
.account-card-text { flex: 1; min-width: 0; }
.account-card-empresa { font-weight: 700; font-size: 13px; color: var(--akp-text); }
.account-card-meta { font-size: 12px; color: var(--akp-text-muted); margin-top: 2px; }
.account-card-check { flex-shrink: 0; padding: 0 10px; }
.account-card-check input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--akp-red); cursor: pointer; }

.account-card-values { display: grid; gap: 1px; margin-top: 10px; margin-left: 50px; }
.account-card-values input { width: 100%; }

/* Pill de banco mas redondeado para que combine con la tarjeta de identidad. */
.account-card-identity .bank-badge { width: 38px; height: 24px; border-radius: 7px; font-size: 10px; }

/* ---------- Encabezado de pagina con acciones (Todas/Ninguna/Nuevo dia) ---------- */
.page-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.page-title-row .page-title { margin-bottom: 2px; }
.page-subtitle { font-size: 13px; color: var(--akp-text-muted); margin: 0 0 18px; }
.page-title-actions { display: flex; align-items: center; gap: 16px; padding-top: 6px; }
.link-action { font-size: 13px; font-weight: 700; color: var(--akp-text); }
.link-action:hover { color: var(--akp-red); }
.btn-outline-red { background: #fff; border: 1px solid var(--akp-red); color: var(--akp-red); }
.btn-outline-red:hover { background: #FEF2F2; }

/* ---------- Pestanas tipo pill (Balances / Historial) ---------- */
.subtab-pills { display: flex; gap: 8px; margin-bottom: 20px; }
.subtab-pill { flex: 1; text-align: center; padding: 11px 18px; border-radius: 999px; background: #fff; border: 1px solid var(--akp-border); font-weight: 600; font-size: 14px; color: var(--akp-text-muted); transition: background .15s, color .15s, border-color .15s; }
.subtab-pill:hover { background: #F9FAFB; }
.subtab-pill-active, .subtab-pill-active:hover { background: #FDEBEC; color: var(--akp-red); border-color: #F6C9CC; font-weight: 700; }

/* ---------- KPIs de Balances (Cuentas / Inicio / Cierre) ---------- */
.kpi-grid-balances { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 980px) { .kpi-grid-balances { grid-template-columns: 1fr; } }
.kpi-grid-balances .kpi-card { border-radius: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.kpi-caption { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--akp-text-muted); background: #F3F4F6; padding: 1px 6px; border-radius: 4px; margin-left: 4px; }
.kpi-card-cierre { background: #FBEDEE; border-color: #F4D2D4; }
.kpi-card-cierre .kpi-label { color: var(--akp-red-dark); opacity: .8; }
.kpi-card-cierre .kpi-value { color: var(--akp-red-dark); }
.kpi-card-cierre .kpi-caption { background: rgba(255,255,255,.6); color: var(--akp-red-dark); }
.kpi-card-cierre .kpi-diff { font-size: 12px; font-weight: 700; color: var(--akp-red-dark); opacity: .85; margin-top: 4px; }

/* ---------- Tabla de cuentas editable (Balances) ---------- */
.balances-table th, .balances-table td { vertical-align: middle; }
.balances-table thead th { white-space: nowrap; }
.balances-table .corte-th { text-align: center; padding: 10px 12px; min-width: 130px; }
.corte-th-row { display: flex; align-items: center; justify-content: center; gap: 4px; }
.corte-th-row input[type="text"] { width: 70px; text-align: center; font-weight: 700; border: none; background: transparent; color: var(--akp-text); font-size: 13px; padding: 2px; text-transform: none; border-radius: 4px; }
.corte-th-row input[type="text"]:focus { background: #F9FAFB; outline: none; }
.corte-th-caption { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--akp-text-muted); margin-top: 2px; }
.corte-add-btn-inline { flex-shrink: 0; width: 20px; height: 20px; line-height: 18px; padding: 0; border: 1px solid #F2D9B3; border-radius: 50%; background: #FFF7E8; color: var(--akp-amber); font-weight: 700; font-size: 14px; cursor: pointer; transition: background .15s; }
.corte-add-btn-inline:hover { background: #FEF0CE; }
.balances-table input[type="number"], .balances-table input[type="text"] { width: 100%; padding: 6px 8px; border: 1px solid var(--akp-border); border-radius: 6px; font-size: 13px; background: #fff; }
.balances-cuenta-cell { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.balances-cuenta-cell .incluir-check { width: 18px; height: 18px; accent-color: var(--akp-red); cursor: pointer; flex-shrink: 0; }
.balances-cuenta-text { min-width: 0; }
.balances-cuenta-empresa { font-weight: 700; font-size: 13px; color: var(--akp-text); }
.balances-cuenta-meta { font-size: 11.5px; color: var(--akp-text-muted); margin-top: 1px; }
.balances-footer-row td { background: #F9FAFB; font-weight: 700; border-top: 1px solid var(--akp-border); color: var(--akp-text); }
.balances-actions-row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* ============================================================
   RESPONSIVE / MÓVIL
   El hook en assets/mobile.js detecta pantallas móviles y agrega la clase
   "akp-mobile" a <html>, envuelve cada tabla en .table-scroll, y convierte
   la navegación principal en un menú de hamburguesa. Esta sección aplica
   ese comportamiento visualmente y ajusta el layout general para pantallas
   chicas (la mayoría vía @media, para que funcione aunque JS tarde en correr).
   ============================================================ */

/* Tablas anchas: scroll horizontal en vez de romper el layout. */
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table.akp-table { width: 100%; }

/* Menú de hamburguesa para la navegación principal (solo pestañas de arriba). */
.tabnav-toggle {
  display: none;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: #fff;
  border: none;
  border-bottom: 1px solid var(--akp-border);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--akp-text);
  cursor: pointer;
}
.tabnav-toggle-icon { font-size: 16px; line-height: 1; }
.tabnav-toggle-open { color: var(--akp-red); }

/* ---------- Barra de navegación inferior (solo móvil) ---------- */
.bottom-nav { display: none; }

@media (max-width: 768px) {
  html.akp-mobile body, body { -webkit-text-size-adjust: 100%; }

  .chart-box { height: 200px; }

  .modal-box { padding: 16px; max-height: 92vh; }
  .modal-footer { flex-direction: column; }
  .modal-footer .btn { width: 100%; }

  .reporte-preview-scroll { padding: 14px; overflow-x: auto; }
  .reporte-kpis { flex-direction: column; }
  .reporte-table { font-size: 12px; min-width: 480px; }

  /* --- Barra superior --- */
  .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
  .brand-name { font-size: 18px; }
  .brand-sub { font-size: 9px; }
  .topbar-right { gap: 10px; font-size: 12px; flex-wrap: wrap; }
  .topbar-user { display: none; }

  .impersonate-banner { flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 16px; font-size: 12px; }

  /* --- Navegación principal: en móvil vive en la barra inferior, no arriba --- */
  .tabnav-toggle, .main-tabnav { display: none !important; }

  /* --- Layout general (se deja espacio abajo para la barra de navegación fija) --- */
  .main-content { padding: 16px 14px 90px; }
  .page-title { font-size: 18px; margin: 2px 0 14px; }

  /* --- Evitar que iOS haga zoom automático al enfocar inputs --- */
  input, select, textarea, button { font-size: 16px; }
  .btn, .pill, .tab { font-size: 13px; }

  /* --- KPIs y hero cards --- */
  .kpi-grid { grid-template-columns: 1fr; gap: 12px; }
  .kpi-card { padding: 14px 16px; }
  .kpi-value { font-size: 22px; }
  .hero-grid { gap: 12px; }
  .hero-card { padding: 16px 18px; min-height: auto; }
  .hero-value { font-size: 30px; }

  /* --- Paneles --- */
  .panel { padding: 14px 16px; }
  .panel-title { font-size: 14px; }
  .panel-title[style*="space-between"] { flex-wrap: wrap; gap: 8px; }

  /* --- Botones y filtros: apilados y fáciles de tocar --- */
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .btn { width: 100%; padding: 11px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar input[type="text"] { min-width: 0; }
  .pill { padding: 8px 14px; }
  .btn, .ver-pagos-btn, .tab { min-height: 40px; }

  /* --- Detalle de proveedores/facturas vencidas: apilar en vez de comprimir --- */
  .proveedor-detail summary { flex-wrap: wrap; gap: 10px; }
  .proveedor-summary-right { width: 100%; justify-content: space-between; }

  /* --- Lista de usuarios (Vista de Usuario): ver tarjeta rediseñada más abajo --- */
  .user-row form { width: 100%; }
  .user-row .btn { width: 100%; }

  .estructura-legend { font-size: 10px; gap: 10px; }

  /* --- Login --- */
  .login-wrap { padding: 16px; }
  .login-card { padding: 28px 22px; }

  /* --- Lista de cuentas estilo tarjeta (Balances) --- */
  .mis-empresas-bar { font-size: 12px; }
  .cortes-header-bar { margin-left: 0; overflow-x: auto; }
  .account-card-values { margin-left: 0; overflow-x: auto; }
  .account-card-identity { flex-wrap: wrap; }

  /* --- Encabezado + tabla de Balances --- */
  .page-title-row { flex-direction: column; align-items: stretch; }
  .page-title-actions { flex-wrap: wrap; padding-top: 0; }
  .subtab-pills { gap: 8px; }
  .subtab-pill { padding: 10px 12px; font-size: 13px; }
  .kpi-grid-balances .kpi-card { padding: 12px 14px; }
  .balances-table .corte-th { min-width: 110px; }
  .balances-cuenta-cell { min-width: 180px; }
  .balances-actions-row { flex-direction: column-reverse; align-items: stretch; }
  .balances-actions-row .btn { width: 100%; }

  /* --- Tabla de Balances: en vez de cardificarla (perdería la comparación lado a
     lado de varios cortes y los controles de renombrar/agregar/quitar corte en el
     encabezado), se fija la primera columna ("Cuenta") y el resto se desplaza
     horizontalmente debajo, como en una hoja de cálculo o app bancaria. --- */
  .balances-table th:first-child,
  .balances-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
    box-shadow: 2px 0 6px rgba(0,0,0,0.08);
  }
  .balances-table thead th:first-child { z-index: 3; }
  .balances-table tfoot td:first-child { background: #F9FAFB; }
  .balances-table input[type="number"],
  .balances-table input[type="text"] { min-height: 38px; }

  /* --- Modal a pantalla completa: se siente como una vista nativa, no como un
     recuadro flotante --- */
  .modal-overlay { padding: 0; align-items: stretch; }
  .modal-box { width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; }

  /* ============================================================
     Tablas simples (listas de registros de solo lectura) -> tarjetas
     apiladas, no filas comprimidas. Cada <td> trae data-label="..." desde
     PHP; se oculta el <thead> y el label se muestra arriba del valor.
     Se excluyen .balances-table (cuadrícula editable, tratamiento de arriba)
     y .reporte-table (debe verse igual al PDF impreso, nunca se toca).
     ============================================================ */
  table.akp-table:not(.balances-table):not(.reporte-table) thead { display: none; }
  table.akp-table:not(.balances-table):not(.reporte-table),
  table.akp-table:not(.balances-table):not(.reporte-table) tbody,
  table.akp-table:not(.balances-table):not(.reporte-table) tr,
  table.akp-table:not(.balances-table):not(.reporte-table) td {
    display: block;
    width: 100%;
  }
  table.akp-table:not(.balances-table):not(.reporte-table) tr {
    border: 1px solid var(--akp-border);
    border-radius: 10px;
    margin-bottom: 10px;
    padding: 4px 14px;
    background: #fff;
  }
  table.akp-table:not(.balances-table):not(.reporte-table) td {
    padding: 8px 0;
    border-bottom: 1px solid #F3F4F6;
    text-align: left;
  }
  table.akp-table:not(.balances-table):not(.reporte-table) td:last-child { border-bottom: none; }
  table.akp-table:not(.balances-table):not(.reporte-table) td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    display: block;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--akp-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 3px;
  }
  table.akp-table:not(.balances-table):not(.reporte-table) td[data-label=""] {
    text-align: center;
    padding-top: 10px;
  }
  /* Tablas dentro de un <details> (facturas por proveedor, historial de cortes):
     ya están dentro de una tarjeta acordeón, no se duplica el borde. */
  .proveedor-detail table.akp-table:not(.balances-table):not(.reporte-table) {
    padding: 0 14px 8px;
  }
  .proveedor-detail table.akp-table:not(.balances-table):not(.reporte-table) tr {
    border: none;
    border-radius: 0;
    margin-bottom: 0;
    border-bottom: 1px solid var(--akp-border);
    padding: 10px 0;
  }
  .proveedor-detail table.akp-table:not(.balances-table):not(.reporte-table) tr:last-child { border-bottom: none; }

  /* --- Vista de Usuario: tarjeta de usuario más clara (identidad arriba,
     badges en su propia fila, acción de ancho completo abajo) --- */
  .user-row { position: relative; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px 16px 14px 70px; }
  .user-row .avatar { position: absolute; left: 18px; top: 14px; }
  .user-row .user-info { width: 100%; min-height: 36px; }

  /* --- Barra de navegación inferior --- */
  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    border-top: 1px solid var(--akp-border);
    box-shadow: 0 -3px 12px rgba(0,0,0,0.08);
    z-index: 800;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 9px 4px 8px;
    color: var(--akp-text-muted);
    font-size: 11px;
    font-weight: 700;
  }
  .bottom-nav-icon { font-size: 19px; line-height: 1; }
  .bottom-nav-active { color: var(--akp-red); }
  .bottom-nav-active .bottom-nav-icon { transform: translateY(-1px); }
  .bottom-nav-disabled { opacity: 0.4; }
}

@media (max-width: 420px) {
  .brand-sub { display: none; }
  .status-pill-label { display: none; }
  .hero-value { font-size: 26px; }
  .kpi-value { font-size: 20px; }
}

/* ============================================================
   Mobile polish overrides.
   Scope: solo pantallas chicas. No cambia PHP ni comportamiento desktop.
   ============================================================ */
@media (max-width: 768px) {
  body {
    background: #F6F7F9;
    overflow-x: hidden;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding: 12px 14px;
    gap: 10px;
  }
  .brand { min-width: 0; }
  .brand-name {
    font-size: 18px;
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brand-sub {
    font-size: 9px;
    letter-spacing: .04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar-right {
    justify-content: flex-end;
    gap: 8px;
  }
  .status-pill,
  .topbar-user {
    display: none;
  }
  .topbar-link {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,.16);
    font-size: 12px;
  }

  .main-content {
    width: 100%;
    max-width: none;
    padding: 14px 12px calc(86px + env(safe-area-inset-bottom, 0px));
  }
  .page-title {
    font-size: 19px;
    line-height: 1.2;
    margin: 4px 0 12px;
  }
  .page-subtitle {
    margin-bottom: 12px;
  }

  .panel,
  .hero-card,
  .kpi-card,
  .empresa-card,
  .user-row,
  .mis-empresas-bar {
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(16,24,40,.04);
  }
  .panel {
    padding: 14px;
    margin-bottom: 14px;
  }
  .panel-title {
    line-height: 1.25;
    margin-bottom: 12px;
  }

  .hero-grid,
  .kpi-grid,
  .grid-2,
  .grid-3,
  .empresa-grid {
    gap: 12px;
  }
  .hero-card {
    padding: 16px;
    min-height: 118px;
  }
  .hero-label,
  .kpi-label {
    letter-spacing: .04em;
  }
  .hero-value {
    font-size: 28px;
    letter-spacing: 0;
  }
  .hero-sub {
    line-height: 1.35;
  }
  .hero-watermark {
    display: none;
  }

  .empresa-card {
    padding: 14px;
  }
  .empresa-head {
    align-items: flex-start;
  }
  .empresa-name {
    line-height: 1.25;
  }
  .empresa-balance-row {
    align-items: flex-start;
  }
  .empresa-balance-value {
    font-size: 18px;
  }
  .bank-row {
    gap: 8px;
    padding: 7px 0;
  }
  .bank-row-amount {
    font-size: 12px;
  }

  .pill-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-right: -14px;
    padding-right: 14px;
  }
  .pill {
    flex: 0 0 auto;
    border-radius: 999px;
    white-space: nowrap;
  }
  .filter-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 136px;
    gap: 8px;
  }
  .filter-bar input,
  .filter-bar select {
    width: 100%;
    min-height: 42px;
    border-radius: 8px;
  }

  .proveedor-detail {
    border-left-width: 3px;
    border-radius: 10px;
  }
  .proveedor-detail summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    padding: 13px 14px;
  }
  .proveedor-summary-top {
    align-items: flex-start;
  }
  .proveedor-summary-name {
    line-height: 1.25;
  }
  .proveedor-summary-right {
    width: 100%;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid #F3F4F6;
  }
  .proveedor-summary-chevron {
    display: none;
  }

  /* Dentro del acordeon conviene tabla con scroll, no tarjetas dentro de tarjetas. */
  .proveedor-detail table.akp-table:not(.balances-table):not(.reporte-table),
  .proveedor-detail table.akp-table:not(.balances-table):not(.reporte-table) tbody,
  .proveedor-detail table.akp-table:not(.balances-table):not(.reporte-table) tr,
  .proveedor-detail table.akp-table:not(.balances-table):not(.reporte-table) td,
  .proveedor-detail table.akp-table:not(.balances-table):not(.reporte-table) th {
    display: revert;
    width: auto;
  }
  .proveedor-detail table.akp-table:not(.balances-table):not(.reporte-table) {
    min-width: 620px;
    padding: 0;
    border-collapse: collapse;
  }
  .proveedor-detail table.akp-table:not(.balances-table):not(.reporte-table) thead {
    display: table-header-group;
  }
  .proveedor-detail table.akp-table:not(.balances-table):not(.reporte-table) tr {
    border: none;
    margin: 0;
    padding: 0;
  }
  .proveedor-detail table.akp-table:not(.balances-table):not(.reporte-table) td {
    border-bottom: 1px solid var(--akp-border);
    padding: 9px 12px;
  }
  .proveedor-detail table.akp-table:not(.balances-table):not(.reporte-table) td::before {
    content: none !important;
  }

  .table-scroll {
    border-radius: 10px;
  }
  .balances-table {
    min-width: 680px;
  }
  .balances-table .corte-th {
    min-width: 122px;
  }
  .balances-cuenta-cell {
    min-width: 210px;
  }
  .page-title-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }
  .page-title-actions .btn {
    width: 100%;
    text-align: center;
  }
  .link-action {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--akp-border);
    border-radius: 8px;
    background: #fff;
  }

  .bottom-nav {
    gap: 8px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(10px);
  }
  .bottom-nav-item {
    min-height: 42px;
    flex-direction: row;
    padding: 0 10px;
    border: 1px solid var(--akp-border);
    border-radius: 10px;
    background: #fff;
    font-size: 12px;
    letter-spacing: 0;
  }
  .bottom-nav-icon {
    display: none !important;
  }
  .bottom-nav-active {
    background: #FDEBEC;
    border-color: #F2C7CB;
    color: var(--akp-red);
  }

  .btn-trash {
    width: 34px;
    height: 34px;
    font-size: 0;
  }
  .btn-trash::before {
    content: "x";
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
  }
}

@media (max-width: 420px) {
  .filter-bar {
    grid-template-columns: 1fr;
  }
  .hero-value {
    font-size: 25px;
  }
  .empresa-balance-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .empresa-balance-col[style] {
    text-align: left !important;
  }
  .page-title-actions {
    grid-template-columns: 1fr;
  }
  .bottom-nav-item {
    font-size: 11px;
    padding: 0 6px;
  }
}

/* ============================================================
   Mobile app shell.
   Esta capa trata el telefono como interfaz principal: top app bar,
   secciones tipo pantalla, listas tactiles y navegacion persistente.
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --mobile-pad: 14px;
    --mobile-radius: 14px;
    --mobile-touch: 48px;
  }

  html.akp-mobile {
    background: #F4F5F7;
  }

  html.akp-mobile body {
    min-width: 0;
    background:
      linear-gradient(180deg, #FFFFFF 0, #F4F5F7 108px);
    color: #172033;
  }

  html.akp-mobile .topbar {
    position: sticky;
    top: 0;
    z-index: 900;
    min-height: 58px;
    padding: max(10px, env(safe-area-inset-top, 0px)) var(--mobile-pad) 10px;
    background: #B71928;
    box-shadow: 0 1px 0 rgba(255,255,255,.12), 0 6px 18px rgba(80,0,10,.18);
  }

  html.akp-mobile .topbar-left {
    min-width: 0;
  }

  html.akp-mobile .brand-name {
    font-size: 17px;
    line-height: 1.1;
  }

  html.akp-mobile .brand-sub {
    display: none;
  }

  html.akp-mobile .topbar-link {
    min-width: 58px;
    min-height: 38px;
    justify-content: center;
    border-radius: 999px;
    background: rgba(255,255,255,.16);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
  }

  html.akp-mobile .topbar-link[href="usuarios.php"] {
    display: none;
  }

  html.akp-mobile .main-tabnav {
    display: none !important;
  }

  html.akp-mobile .main-content {
    padding: 16px var(--mobile-pad) calc(82px + env(safe-area-inset-bottom, 0px));
  }

  html.akp-mobile .page-title-row {
    margin: 0 0 12px;
  }

  html.akp-mobile .page-title {
    margin: 0 0 10px;
    font-size: 24px;
    line-height: 1.08;
    letter-spacing: 0;
    font-weight: 800;
  }

  html.akp-mobile .page-subtitle,
  html.akp-mobile .hero-sub,
  html.akp-mobile .kpi-sub,
  html.akp-mobile .panel-sub {
    font-size: 12px !important;
    line-height: 1.35;
  }

  html.akp-mobile .panel {
    border: 0;
    border-radius: var(--mobile-radius);
    padding: 16px;
    margin: 0 0 14px;
    box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.05);
  }

  html.akp-mobile .panel-title {
    font-size: 15px;
    line-height: 1.2;
    margin-bottom: 12px;
  }

  html.akp-mobile .btn,
  html.akp-mobile .ver-pagos-btn,
  html.akp-mobile .btn-recargar,
  html.akp-mobile .subtab-pill,
  html.akp-mobile .pill,
  html.akp-mobile input,
  html.akp-mobile select,
  html.akp-mobile button {
    min-height: var(--mobile-touch);
  }

  html.akp-mobile .btn,
  html.akp-mobile .btn-recargar,
  html.akp-mobile .ver-pagos-btn {
    border-radius: 12px;
    font-weight: 800;
  }

  html.akp-mobile .bottom-nav {
    left: 10px;
    right: 10px;
    bottom: 8px;
    border: 1px solid rgba(15,23,42,.08);
    border-radius: 18px;
    padding: 7px;
    box-shadow: 0 14px 34px rgba(15,23,42,.18);
  }

  html.akp-mobile .bottom-nav-item {
    min-height: 46px;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: #667085;
    font-size: 12px;
  }

  html.akp-mobile .bottom-nav-active {
    background: #B71928;
    color: #fff;
  }

  html.akp-mobile .hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 14px;
  }

  html.akp-mobile .hero-card {
    position: relative;
    min-height: 122px;
    border: 0;
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.05);
  }

  html.akp-mobile .hero-card:first-child {
    background: #172033;
    color: #fff;
  }

  html.akp-mobile .hero-card:first-child .hero-label,
  html.akp-mobile .hero-card:first-child .hero-sub {
    color: rgba(255,255,255,.72);
  }

  html.akp-mobile .hero-card-accent {
    background: #FFF0F1;
    color: #8F1620;
  }

  html.akp-mobile .hero-label,
  html.akp-mobile .kpi-label,
  html.akp-mobile .empresa-balance-label {
    font-size: 11px;
    letter-spacing: .04em;
  }

  html.akp-mobile .hero-value {
    font-size: clamp(28px, 8vw, 34px);
    line-height: 1;
    margin-top: 8px;
  }

  html.akp-mobile .kpi-grid {
    gap: 10px;
    margin-bottom: 14px;
  }

  html.akp-mobile .kpi-card {
    border: 0;
    border-radius: var(--mobile-radius);
    padding: 16px;
    box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.05);
  }

  html.akp-mobile .kpi-value {
    font-size: 26px;
    line-height: 1.1;
  }

  html.akp-mobile .empresa-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  html.akp-mobile .empresa-card {
    border: 0;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(15,23,42,.05);
  }

  html.akp-mobile .empresa-card + .empresa-card {
    margin-top: 0;
  }

  html.akp-mobile .empresa-name {
    font-size: 15px;
    line-height: 1.2;
  }

  html.akp-mobile .empresa-balance-row {
    margin: 14px 0 12px;
  }

  html.akp-mobile .empresa-balance-value {
    font-size: 20px;
    line-height: 1.1;
  }

  html.akp-mobile .estructura-bar {
    height: 10px;
    border-radius: 999px;
  }

  html.akp-mobile .bank-row {
    min-height: 44px;
    padding: 8px 0;
    border-bottom: 1px solid #F1F3F5;
  }

  html.akp-mobile .bank-row:last-child {
    border-bottom: 0;
  }

  html.akp-mobile .empresa-bancos > summary {
    min-height: 40px;
    font-size: 11px;
  }

  html.akp-mobile .bank-badge {
    width: 34px;
    height: 24px;
    border-radius: 7px;
    font-size: 10px;
  }

  html.akp-mobile .ver-pagos-btn {
    margin-top: 12px;
    background: #F3F4F6;
    color: #B71928;
  }

  html.akp-mobile #pagos-pendientes {
    padding-left: 0;
    padding-right: 0;
    background: transparent;
    box-shadow: none;
  }

  html.akp-mobile #pagos-pendientes > .panel-title,
  html.akp-mobile #pagos-pendientes > .pill-row,
  html.akp-mobile #pagos-pendientes > .filter-bar,
  html.akp-mobile #pagos-pendientes > .paginacion,
  html.akp-mobile #pagos-pendientes > .kpi-sub {
    margin-left: 0;
    margin-right: 0;
  }

  html.akp-mobile #pagos-pendientes .panel-title {
    padding: 0 2px;
  }

  html.akp-mobile .pill-count-danger {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    font-size: 10px;
  }

  html.akp-mobile .pill-row {
    margin: 0 -14px 10px 0;
    padding: 0 14px 4px 0;
  }

  html.akp-mobile .pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    background: #fff;
    border: 1px solid #E5E7EB;
    color: #475467;
  }

  html.akp-mobile .pill-active {
    background: #172033;
    border-color: #172033;
    color: #fff;
  }

  html.akp-mobile .filter-bar {
    grid-template-columns: 1fr;
    margin-bottom: 12px;
  }

  html.akp-mobile .filter-bar input,
  html.akp-mobile .filter-bar select {
    border: 0;
    border-radius: 13px;
    padding: 0 14px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15,23,42,.06);
  }
  /* El <select> nativo sin "appearance:none" se ve roto encima de este diseño
     (pierde el borde, no queda claro que es desplegable). Se reemplaza la flecha
     del sistema por una propia y se le da aire a la derecha para que no se encime
     con el texto. Al ser <select> nativo, en el teléfono sigue abriendo el picker
     propio del sistema (la forma "de app" de elegir una opción). */
  html.akp-mobile .filter-bar select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 38px;
    font-weight: 700;
    color: #172033;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23667085'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 10.94l3.71-3.71a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.21 8.27a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
  }

  html.akp-mobile .proveedor-detail {
    border: 0;
    border-radius: 16px;
    margin-bottom: 10px;
    box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 8px 22px rgba(15,23,42,.04);
  }

  html.akp-mobile .proveedor-detail summary {
    min-height: 76px;
    padding: 15px 16px;
    border-left: 4px solid #B71928;
    border-radius: 16px;
  }

  html.akp-mobile .proveedor-detail[open] summary {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  html.akp-mobile .proveedor-summary-top {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  html.akp-mobile .proveedor-summary-name {
    font-size: 14px;
    overflow-wrap: anywhere;
  }

  html.akp-mobile .vencido-badge {
    align-self: start;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 9px;
  }

  html.akp-mobile .proveedor-summary-total {
    font-size: 17px;
  }

  html.akp-mobile .pag-btn {
    min-height: 42px;
    min-width: 42px;
    border-radius: 12px;
  }

  html.akp-mobile .page-title-actions {
    position: sticky;
    top: 58px;
    z-index: 700;
    grid-template-columns: 1fr 1fr;
    padding: 8px 0;
    background: rgba(244,245,247,.92);
    backdrop-filter: blur(10px);
  }

  html.akp-mobile .page-title-actions .btn-primary,
  html.akp-mobile .balances-actions-row .btn-dark {
    background: #172033;
    border-color: #172033;
  }

  html.akp-mobile .mis-empresas-bar {
    border: 0;
    border-radius: var(--mobile-radius);
    padding: 12px 14px;
    line-height: 1.35;
  }

  html.akp-mobile .subtab-pills {
    position: sticky;
    top: 58px;
    z-index: 650;
    margin: 0 0 12px;
    padding: 8px 0;
    background: rgba(244,245,247,.92);
    backdrop-filter: blur(10px);
  }

  html.akp-mobile .subtab-pill {
    border: 0;
    background: #fff;
    box-shadow: inset 0 0 0 1px #E5E7EB;
  }

  html.akp-mobile .subtab-pill-active {
    background: #B71928;
    color: #fff;
    box-shadow: none;
  }

  html.akp-mobile .balances-table {
    min-width: 720px;
    font-size: 13px;
  }

  html.akp-mobile .balances-table th,
  html.akp-mobile .balances-table td {
    padding: 10px 12px;
  }

  html.akp-mobile .balances-table input[type="number"],
  html.akp-mobile .balances-table input[type="text"] {
    min-height: 46px;
    border-radius: 10px;
    font-size: 16px;
  }

  html.akp-mobile .balances-cuenta-cell {
    min-width: 230px;
  }

  html.akp-mobile .balances-cuenta-empresa {
    font-size: 14px;
    line-height: 1.2;
  }

  html.akp-mobile .balances-cuenta-meta {
    font-size: 12px;
  }

  html.akp-mobile .balances-table th:first-child,
  html.akp-mobile .balances-table td:first-child {
    width: 264px;
  }

  html.akp-mobile .balances-actions-row {
    position: static;
    padding: 12px 0 0;
    background: none;
  }

  html.akp-mobile .user-row {
    border: 0;
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(15,23,42,.06);
  }
}

@media (max-width: 420px) {
  html.akp-mobile .page-title {
    font-size: 22px;
  }

  html.akp-mobile .hero-value {
    font-size: 28px;
  }

  html.akp-mobile .empresa-balance-row {
    grid-template-columns: 1fr 1fr;
  }

  html.akp-mobile .empresa-balance-col[style] {
    text-align: right !important;
  }

  html.akp-mobile .page-title-actions {
    grid-template-columns: 1fr 1fr;
  }
}
