/* PrestFast: interfaz empresarial para la app Android y web. */
:root {
    --pf-obsidian-darkest: #172b40;
    --pf-obsidian: #1d344c;
    --pf-obsidian-card: #243e59;
    --pf-blue: #315f86;
    --pf-blue-hover: #254c70;
    --pf-cyan: #315f86;
    --pf-cyan-light: #557b9c;
    --pf-emerald: #376c59;
    --pf-emerald-dark: #2b5949;
    --pf-amber: #a17332;
    --pf-amber-dark: #805a28;
    --pf-rose: #a35b5b;
    --pf-rose-dark: #874747;
    --pf-bg: #f4f6f8;
    --pf-surface: #fff;
    --pf-text-primary: #192c40;
    --pf-text-secondary: #526579;
    --pf-text-muted: #708196;
    --pf-border: #dce3e9;
    --pf-border-subtle: #e8edf1;
    --pf-shadow-xs: none;
    --pf-shadow-sm: 0 1px 3px rgba(25, 44, 64, .05);
    --pf-shadow-md: 0 3px 12px rgba(25, 44, 64, .07);
    --pf-shadow-lg: 0 8px 28px rgba(25, 44, 64, .1);
    --pf-radius-md: 10px;
    --pf-radius-lg: 12px;
    --pf-radius-xl: 14px;
}

html { text-size-adjust: 100%; -webkit-text-size-adjust: 100%; }
body { background: var(--pf-bg); }
button, input, select, textarea { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--pf-blue);
    outline-offset: 2px;
}

.brand-lockup { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.brand-lockup img { width: 34px; height: 34px; flex: none; filter: none; }
.brand-lockup > span { display: block; color: #1c344e; font-size: 1.15rem; font-weight: 800; letter-spacing: -.035em; line-height: 1.05; white-space: nowrap; }
.brand-lockup > span > span { color: #35657f; }
.brand-lockup small { display: block; margin-top: 5px; font-size: .5rem; letter-spacing: .1em; color: #617385; font-weight: 800; }

.main-header {
    height: 62px;
    min-height: 62px;
    padding: 0 14px;
    gap: 10px;
    background: #fff;
    color: var(--pf-text-primary);
    border-bottom: 1px solid var(--pf-border);
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.navbar-brand-section, .header-actions { display: flex; align-items: center; gap: 10px; min-width: 0; }
.navbar-brand-section { flex: 1; }
.header-actions { flex: none; }
.nav-toggle-btn, .btn-logout {
    width: 40px; height: 40px; flex: none;
    background: #f1f4f7; color: #2d4863;
    border: 1px solid var(--pf-border); border-radius: 10px;
    box-shadow: none; transform: none;
}
.nav-toggle-btn:hover, .btn-logout:hover { background: #e9eef3; color: #1d344c; border-color: #cbd6df; transform: none; }
.user-badge { min-width: 0; padding: 3px 7px 3px 3px; background: #f4f6f8; border: 1px solid var(--pf-border); border-radius: 10px; backdrop-filter: none; }
.user-badge:hover { background: #f4f6f8; border-color: var(--pf-border); }
.user-avatar-circle { width: 30px; height: 30px; background: #dce7f0; color: #2f5676; box-shadow: none; }
.user-status-dot { background: #4e8068; border-color: #f4f6f8; }
.user-name { color: #1c344e; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { color: #526579; }

.app-wrapper { background: var(--pf-bg); padding-bottom: 76px; min-height: 100dvh; }
.content-wrapper { max-width: 1160px; padding: 18px 16px; }
.content-header { margin-bottom: 18px; }
.content-title { color: var(--pf-text-primary); font-size: clamp(1.15rem, 4.4vw, 1.4rem); letter-spacing: -.025em; }
.content-subtitle { color: var(--pf-text-secondary); font-size: .78rem; line-height: 1.45; }
.title-icon-badge, .actions-title-badge { background: #e9eff4; border: 0; box-shadow: none; color: #315f86; }
.status-live-chip { padding: 5px 10px; background: #eef4f0; color: #376c59; border: 1px solid #d6e4db; box-shadow: none; font-size: .72rem; }
.pulse-beacon { background: #4e8068; }
.pulse-beacon::after { display: none; animation: none; }

.stat-cards-grid { gap: 10px; margin-bottom: 16px; }
#view-app .stat-card-corp, #view-app .stat-card-premium {
    padding: 14px;
    border: 1px solid var(--pf-border) !important;
    border-radius: 12px;
    background: #fff !important;
    box-shadow: var(--pf-shadow-sm);
    transition: none;
}
.stat-card-corp:hover, .stat-card-premium:hover { transform: none; box-shadow: var(--pf-shadow-sm); }
#view-app .stat-card-corp.accent-emerald { border-left: 3px solid #4c7766 !important; }
#view-app .stat-card-corp.accent-amber { border-left: 3px solid #a17c46 !important; }
#view-app .stat-card-corp.accent-blue { border-left: 3px solid #557b9c !important; }
#view-app .stat-card-corp.accent-rose { border-left: 3px solid #a56868 !important; }
.stat-card-corp-top { align-items: flex-start; gap: 5px; margin-bottom: 15px; }
.stat-corp-label { min-width: 0; white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.3; font-size: .69rem; color: #526579; }
.stat-corp-icon { width: 30px; height: 30px; border-radius: 8px; font-size: .82rem; border: 0 !important; box-shadow: none; }
.stat-card-corp.accent-emerald .stat-corp-icon { color: #376c59; background: #eaf2ed; }
.stat-card-corp.accent-amber .stat-corp-icon { color: #805a28; background: #f4efe5; }
.stat-card-corp.accent-blue .stat-corp-icon { color: #315f86; background: #e9eff5; }
.stat-card-corp.accent-rose .stat-corp-icon { color: #874747; background: #f5ecec; }
.stat-card-corp:hover .stat-corp-icon { transform: none; }
.stat-corp-amount { color: #192c40; font-size: clamp(1.16rem, 4vw, 1.55rem); line-height: 1.2; margin-bottom: 7px; }
.stat-corp-currency { color: #617385; font-size: .68rem; }
.stat-corp-unit { font-size: .7rem; }
#view-app .stat-card-corp .stat-tag-corp { background: transparent !important; color: #617385 !important; border: 0 !important; padding: 0; border-radius: 0; font-size: .67rem; }

.actions-card-premium { padding: 16px; border: 1px solid var(--pf-border); border-radius: 14px; box-shadow: var(--pf-shadow-sm); }
.actions-card-header { margin-bottom: 14px; }
.actions-card-title { font-size: 1rem; color: #1c344e; }
.actions-card-desc { color: #617385; font-size: .76rem; }
.action-hero-btn { min-height: 72px; padding: 14px; border: 1px solid #284664; border-radius: 11px; background: #243e59; box-shadow: none; text-align: left; transition: none; }
.action-hero-btn::after { display: none; }
.action-hero-btn:hover { background: #243e59; border-color: #284664; box-shadow: none; transform: none; }
.action-hero-icon { width: 38px; height: 38px; border: 0; border-radius: 9px; background: #395772; color: #fff; box-shadow: none; font-size: 1rem; }
.action-hero-text h4 { font-size: .93rem; }
.action-hero-text p { color: #d7e0e8; font-size: .72rem; line-height: 1.4; }
.action-hero-chevron { width: 26px; height: 26px; border: 0; background: transparent; }
.action-hero-btn:hover .action-hero-chevron { transform: none; background: transparent; border: 0; }
.action-subgrid { gap: 9px; margin-top: 10px; }
.action-tile-btn { min-height: 62px; padding: 11px 12px; border: 1px solid var(--pf-border); border-radius: 10px; box-shadow: none; transition: none; }
.action-tile-btn:hover { transform: none; box-shadow: none; border-color: #bac9d5; }
.action-tile-icon { width: 36px; height: 36px; border-radius: 8px; }
.action-tile-green .action-tile-icon, .action-tile-blue .action-tile-icon { background: #e9eff4; color: #315f86; border: 0; }
.action-tile-btn:hover .action-tile-icon { transform: none; }
.action-tile-text h4 { color: #1c344e; font-size: .87rem; }
.action-tile-text p { color: #617385; font-size: .7rem; line-height: 1.4; }

.footer-movil { height: 66px; padding: 0 4px; background: #fff; border-top: 1px solid var(--pf-border); box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.footer-btn { min-width: 0; padding: 5px 1px; color: #617385; font-size: .66rem; transition: none; }
.footer-btn.active { color: #244c70; }
.footer-btn.active::before { content: ''; position: absolute; top: 0; left: 25%; right: 25%; height: 2px; background: #315f86; }
.footer-icon-wrapper { padding: 3px 7px; border-radius: 7px; margin-bottom: 2px; }
.footer-btn.active .footer-icon-wrapper { background: transparent; color: #244c70; transform: none; }
.footer-icon-wrapper i { font-size: 1.05rem; }
.footer-btn.active i, .footer-btn:active { transform: none; }

.main-sidebar { background: #1d344c; box-shadow: none; border-right: 1px solid #304a64; }
.sidebar-brand .brand-lockup > span { color: #fff; }
.sidebar-brand .brand-lockup > span > span { color: #b9d0e0; }
.sidebar-brand .brand-lockup small { color: #b2c1ce; }
.main-sidebar .sidebar-item.active a { background: #31506b; color: #fff; box-shadow: none; }
.btn-easypres, .login-page #btn-login-submit { background: #315f86; border: 1px solid #315f86; box-shadow: none; transform: none; }
.btn-easypres:hover, .login-page #btn-login-submit:hover { background: #254c70; border-color: #254c70; box-shadow: none; transform: none; filter: none; }
.form-control:focus { border-color: #315f86; box-shadow: 0 0 0 2px #315f8626; }
.card-adminlte { box-shadow: var(--pf-shadow-sm); border-radius: 12px; }
.small-box.bg-success { background: #376c59 !important; }
.small-box.bg-warning { background: #a17332 !important; }
.small-box.bg-info { background: #315f86 !important; }
.small-box.bg-danger { background: #a35b5b !important; }
.ruta-filter-pill.active { background: #315f86; border-color: #315f86; box-shadow: none; }
.ruta-card.card-cobrado-hoy { border-left-color: #376c59; }
.prestamo-card:hover { transform: none; box-shadow: var(--pf-shadow-sm); }
.prestamo-avatar { background: #315f86; box-shadow: none; }
.prestamo-id-badge, .metric-item .metric-val.balance, .btn-action-pagare i { color: #315f86; }
.prestamo-grid-metrics { background: #f4f6f8; border-color: var(--pf-border); }
.btn-action-reenganche, .btn-cobrar-quick, .btn-call-whatsapp { background: #376c59; box-shadow: none; }
.btn-action-reenganche:hover, .btn-cobrar-quick:hover, .btn-call-whatsapp:hover { background: #2b5949; box-shadow: none; transform: none; }
.customer-avatar { background: #e9eff4; color: #315f86; border-color: #d6e0e8; }
.search-input-wrapper .prestamo-search-input:focus { border-color: #315f86; box-shadow: 0 0 0 2px #315f8626; }
.search-input-wrapper:focus-within .search-icon { color: #315f86; }

.login-page { min-height: 100dvh; width: 100%; padding: 24px 18px; overflow-y: auto; background: #f4f6f8; }
.login-box { max-width: 420px; }
.login-logo { margin-bottom: 20px; justify-content: center; }
.login-logo.brand-lockup img { width: 48px; height: 48px; }
.login-logo.brand-lockup > span { font-size: 1.55rem; }
.login-logo.brand-lockup small { font-size: .55rem; }
.login-page .login-card { padding: 26px 22px; background: #fff; border: 1px solid var(--pf-border); border-radius: 14px; box-shadow: var(--pf-shadow-md); backdrop-filter: none; -webkit-backdrop-filter: none; transition: none; }
.login-page .login-card:hover { border-color: var(--pf-border); box-shadow: var(--pf-shadow-md); }
.login-page .login-box-msg, #view-subscription .login-card h2 { color: #1c344e; }
.login-page .login-box-msg i { color: #315f86 !important; }
.login-page .input-group .form-control, .login-page .input-group-append { background: #fff; color: #1c344e; border-color: #bfcbd5; }
.login-page .input-group .form-control::placeholder { color: #697a89; }
.login-page .input-group .form-control:focus { background: #fff; border-color: #315f86; box-shadow: 0 0 0 2px #315f8626; }
.login-page .input-group:focus-within .input-group-append { background: #fff; border-color: #315f86; color: #315f86; }
.forgot-pass-link, #view-subscription .login-card, #view-subscription .login-card p { color: #526579; }
.login-page .btn-whatsapp-help { background: #eef3f7; border: 1px solid #d6e0e8; color: #315f86; box-shadow: none; }
.login-page .btn-whatsapp-help:hover { background: #e5edf3; color: #254c70; border-color: #bfcbd5; box-shadow: none; transform: none; }
.login-page .help-links a:not(.btn-whatsapp-help), #view-subscription .login-card a { color: #315f86; }
.login-page .help-links { display: flex; flex-direction: column; align-items: stretch; gap: 11px; margin-top: 18px; font-size: .78rem; }
.login-page .help-links a:not(.btn-whatsapp-help) { display: block; line-height: 1.4; }
.login-page .btn-whatsapp-help { width: 100%; font-size: .82rem; }

@media (max-width: 520px) {
    .main-header { padding: 0 10px; }
    .header-actions { gap: 6px; }
    .user-badge { padding: 3px; }
    .user-info-text { display: none; }
    .content-wrapper { padding: 16px 12px; }
    .content-subtitle { max-width: 100%; }
    .prestamo-grid-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; padding: 10px 6px; }
    .metric-item .metric-label { font-size: .58rem; line-height: 1.3; }
    .metric-item .metric-val { font-size: .8rem; white-space: normal; overflow-wrap: anywhere; }
    .prestamo-card-actions { flex-wrap: wrap; }
    .prestamo-card-actions > * { min-width: 120px; }
    .search-kbd-hint { display: none; }
    .search-input-wrapper .prestamo-search-input { padding-right: 12px; }
}
@media (max-width: 360px) {
    .main-header { gap: 6px; }
    .navbar-brand-section { gap: 6px; }
    .brand-lockup > span { font-size: 1rem; }
    .stat-card-corp { padding: 11px; }
    .stat-corp-icon { width: 26px; height: 26px; }
    .footer-btn { font-size: .58rem; }
}
@media (min-width: 768px) {
    .content-wrapper { padding: 24px; }
    .footer-movil { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Navegación horizontal en navegador; la APK conserva su navegación móvil. */
body.pf-web #main-sidebar {
    position: sticky;
    top: 62px;
    left: auto;
    z-index: 1029;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 0;
    overflow: visible;
    background: #fff;
    border: 0;
    border-bottom: 1px solid var(--pf-border);
    box-shadow: none;
}
body.pf-web #main-sidebar .sidebar-brand,
body.pf-web .nav-toggle-btn,
body.pf-web #sidebar-overlay,
body.pf-web .footer-movil { display: none !important; }
body.pf-web #main-sidebar .sidebar-menu {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    width: 100%;
    margin: 0;
    padding: 7px 16px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    list-style: none;
}
body.pf-web #main-sidebar .sidebar-item { flex: none; }
body.pf-web #main-sidebar .sidebar-item a {
    gap: 7px;
    margin: 0;
    padding: 9px 11px;
    color: #3e5369;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: .78rem;
    white-space: nowrap;
    transform: none;
}
body.pf-web #main-sidebar .sidebar-item a i { width: auto; font-size: .85rem; }
body.pf-web #main-sidebar .sidebar-item a:hover { background: #eef3f7; color: #1d344c; }
body.pf-web #main-sidebar .sidebar-item.active a { background: #e8eff5; color: #244e72; border-color: #d6e2ec; }
body.pf-web .app-wrapper { padding-bottom: 0; }

.pf-login-error { margin: 12px 0 0; padding: 10px 12px; background: #fff2f1; color: #8d3636; border: 1px solid #e8bdbb; border-radius: 8px; font-size: .84rem; line-height: 1.4; }
.pf-login-error[hidden] { display: none; }

.pf-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.pf-metric { min-width: 0; padding: 17px; background: #fff; border: 1px solid var(--pf-border); border-left: 4px solid var(--metric-color); border-radius: 12px; box-shadow: var(--pf-shadow-sm); }
.pf-metric-green { --metric-color: #668f75; --metric-soft: #eaf2ec; }
.pf-metric-gold { --metric-color: #aa8955; --metric-soft: #f5f0e6; }
.pf-metric-blue { --metric-color: #6286a7; --metric-soft: #eaf0f5; }
.pf-metric-rose { --metric-color: #ad7373; --metric-soft: #f5ecec; }
.pf-metric-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 16px; color: #5c7084; font-size: .71rem; font-weight: 800; text-transform: uppercase; letter-spacing: .025em; }
.pf-metric-head i { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 8px; background: var(--metric-soft); color: var(--metric-color); font-size: .85rem; }
.pf-metric strong { display: block; color: #1d344c; font-size: clamp(1.2rem, 2vw, 1.65rem); line-height: 1.2; overflow-wrap: anywhere; }
.pf-metric small { display: block; margin-top: 8px; color: #66798b; font-size: .72rem; }
.pf-chart-card { width: 100%; margin-bottom: 16px; padding: 24px; background: #fff; border: 1px solid var(--pf-border); border-radius: 14px; box-shadow: var(--pf-shadow-sm); }
.pf-chart-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 26px; }
.pf-chart-heading h2 { color: #1c344e; font-size: clamp(1.1rem, 2.8vw, 1.45rem); line-height: 1.3; }
.pf-chart-eyebrow { margin: 0 0 4px; color: #60758a; font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.pf-chart-total { display: grid; gap: 3px; text-align: right; white-space: nowrap; }
.pf-chart-total small { color: #60758a; font-size: .72rem; }
.pf-chart-total strong { color: #1d344c; font-size: 1.22rem; }
.pf-chart-plot { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; width: 100%; }
.pf-chart-day { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.pf-chart-value { max-width: 100%; min-height: 22px; overflow: hidden; text-overflow: ellipsis; color: #526579; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.pf-chart-track { display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 210px; border-bottom: 1px solid #aebdca; background: linear-gradient(to top, #e9eef3 1px, transparent 1px) 0 0 / 100% 25%; }
.pf-chart-bar { display: block; width: min(48px, 70%); min-height: 0; background: #315f86; border-radius: 7px 7px 0 0; }
.pf-chart-label { padding-top: 10px; color: #526579; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.pf-chart-empty { margin: 20px 0 0; color: #60758a; font-size: .85rem; text-align: center; }
.pf-actions { padding: 20px; background: #fff; border: 1px solid var(--pf-border); border-radius: 14px; box-shadow: var(--pf-shadow-sm); }
.pf-actions-heading { margin-bottom: 14px; }
.pf-actions-heading h2 { color: #1d344c; font-size: 1.05rem; }
.pf-actions-heading p { margin-top: 3px; color: #60758a; font-size: .78rem; }
.pf-action-route, .pf-action-tile { display: flex; align-items: center; gap: 12px; width: 100%; border-radius: 10px; cursor: pointer; text-align: left; font: inherit; }
.pf-action-route { min-height: 68px; padding: 13px 16px; border: 1px solid #31526f; background: #294866; color: #fff; }
.pf-action-route:hover { background: #24415c; }
.pf-action-route > i:first-child { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 8px; background: #3d5e7b; }
.pf-action-route > i:last-child { margin-left: auto; }
.pf-action-route span, .pf-action-tile span { display: grid; gap: 3px; }
.pf-action-route strong, .pf-action-tile strong { font-size: .88rem; }
.pf-action-route small { color: #d7e3ec; font-size: .72rem; }
.pf-action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.pf-action-tile { min-height: 62px; padding: 11px 14px; border: 1px solid var(--pf-border); background: #fff; color: #25435e; }
.pf-action-tile:hover { background: #f5f8fa; border-color: #c8d6e1; }
.pf-action-tile > i { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 8px; background: #eaf0f5; color: #315f86; }
.pf-action-tile small { color: #60758a; font-size: .7rem; }
@media (max-width: 900px) { .pf-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
    .pf-metrics { gap: 9px; }
    .pf-metric { padding: 12px; }
    .pf-metric-head { margin-bottom: 12px; font-size: .64rem; }
    .pf-metric strong { font-size: 1.14rem; }
    body.pf-web #main-sidebar .sidebar-menu { padding: 6px 10px; }
    .pf-chart-card { padding: 18px 12px; }
    .pf-chart-heading { gap: 8px; margin-bottom: 18px; }
    .pf-chart-total strong { font-size: .92rem; }
    .pf-chart-plot { gap: 4px; }
    .pf-chart-track { height: 165px; }
    .pf-chart-value, .pf-chart-label { font-size: .58rem; }
    .pf-actions { padding: 15px; }
    .pf-action-grid { grid-template-columns: 1fr; }
}
