/* =========================================================================
   PRESTA SIEMPRE · OPERACIONES — SISTEMA MÓVIL ("CERO COMPUTADORA")
   Inspirado en Komitachi 2.0 + Paleta Oficial del Logotipo Presta Siempre
   ========================================================================= */
:root {
    --ps-navy: #16263e;
    --ps-navy-deep: #0e1a2b;
    --ps-emerald: #38961d;
    --ps-emerald-deep: #256f11;
    --ps-lime: #8bc500;
    --ps-green-tint: #f2f9ee;
    --ps-green-line: #cfe6c3;
    --ps-amber: #d97706;
    --ps-crimson: #dc2626;
    --ps-bg: #f4f7f5;
    --ps-card-border: #e2e8e4;
}

html, body {
    background-color: var(--ps-bg) !important;
    color: var(--ps-navy-deep);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overscroll-behavior-y: contain;
    overflow-x: hidden !important;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    letter-spacing: -0.022em;
}

/* Evitar auto-zoom en iOS Safari (fuente mínima obligatoria 16px en campos) */
input, select, textarea, .form-control, .form-select {
    font-size: 16px !important;
    min-height: 48px;
    border-radius: 11px !important;
    border-color: #cbd5cf;
}

input:focus, select:focus, textarea:focus, .form-control:focus, .form-select:focus {
    border-color: var(--ps-emerald) !important;
    box-shadow: 0 0 0 3px rgba(56, 150, 29, 0.14) !important;
}

/* Sobrescribir botones primarios/éxito con el Verde Oficial Presta Siempre */
.btn-success {
    background-color: var(--ps-emerald) !important;
    border-color: var(--ps-emerald) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 2px 6px rgba(56, 150, 29, 0.18);
}

.btn-success:hover, .btn-success:active {
    background-color: var(--ps-emerald-deep) !important;
    border-color: var(--ps-emerald-deep) !important;
}

.btn-dark {
    background-color: var(--ps-navy) !important;
    border-color: var(--ps-navy) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 6px rgba(22, 38, 62, 0.15);
}

.btn-dark:hover, .btn-dark:active {
    background-color: var(--ps-navy-deep) !important;
    border-color: var(--ps-navy-deep) !important;
}

.text-success {
    color: var(--ps-emerald-deep) !important;
}

/* Áreas táctiles mínimas 48x48 px para operación caminando en calle */
.btn-touch, .ps-action-btn {
    min-height: 48px;
    min-width: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font-weight: 600;
    border-radius: 12px;
    padding: 0.6rem 1rem;
}

/* Cinta superior Modo Demostración Activo */
.ps-demo-ribbon {
    background-color: var(--ps-navy-deep);
    border-bottom: 1px solid rgba(139, 197, 0, 0.35);
    color: #e2e8f0;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ps-demo-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--ps-lime);
    display: inline-block;
    margin-right: 6px;
}

/* Header Superior Ejecutivo Azul Marino Escudo */
.ps-top-bar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background-color: var(--ps-navy);
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 40px 40px;
    color: #ffffff;
    padding: calc(0.55rem + env(safe-area-inset-top, 0px)) 0.9rem 0.65rem 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 6px 18px rgba(14, 26, 43, 0.18);
}

/* Píldora blanca para logotipo oficial (homologada con .kom-admin-logo-pill) */
.ps-logo-pill {
    background: #ffffff;
    border-radius: 10px;
    padding: 3px 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
}

.ps-logo-pill img {
    height: 32px;
    width: auto;
    object-fit: contain;
}

/* Contenedor Principal con espacio seguro para Bottom Bar */
.ps-mobile-viewport {
    max-width: 680px;
    margin: 0 auto;
    padding: 0.9rem 0.85rem calc(96px + env(safe-area-inset-bottom, 0px)) 0.85rem;
}

/* Tarjetas Compactas de Precisión (Inspiradas en .kom-card de Komitachi 2.0) */
.ps-stack-card {
    background: #ffffff;
    border: 1px solid var(--ps-card-border);
    border-radius: 15px;
    padding: 1rem 1.05rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 2px rgba(14, 26, 43, 0.03), 0 8px 20px -8px rgba(14, 26, 43, 0.05);
    transition: transform 0.14s ease, border-color 0.16s ease;
}

.ps-stack-card:active {
    transform: scale(0.993);
}

.ps-semaphore-green { box-shadow: inset 3.5px 0 0 var(--ps-emerald), 0 4px 14px rgba(14, 26, 43, 0.04); }
.ps-semaphore-amber { box-shadow: inset 3.5px 0 0 #d97706, 0 4px 14px rgba(14, 26, 43, 0.04); }
.ps-semaphore-red   { box-shadow: inset 3.5px 0 0 #dc2626, 0 4px 14px rgba(14, 26, 43, 0.04); }
.ps-semaphore-blue  { box-shadow: inset 3.5px 0 0 var(--ps-navy), 0 4px 14px rgba(14, 26, 43, 0.04); }

/* Filtros en Píldoras Deslizables (Chips) */
.ps-chips-bar {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    padding-bottom: 0.4rem;
    margin-bottom: 0.85rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.ps-chips-bar::-webkit-scrollbar { display: none; }

.ps-chip {
    white-space: nowrap;
    min-height: 42px;
    padding: 0.45rem 0.95rem;
    border-radius: 10px;
    font-size: 0.84rem;
    font-weight: 600;
    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5cf;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.15s ease;
}

.ps-chip.active {
    background: var(--ps-navy);
    color: #ffffff;
    border-color: var(--ps-navy);
    box-shadow: inset 0 -2px 0 var(--ps-lime);
}

/* Barra de Navegación Inferior Fija (Zona del Pulgar) */
.ps-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    border-top: 1px solid #d5ded8;
    padding: 0.35rem 0.4rem calc(0.35rem + env(safe-area-inset-bottom, 0px)) 0.4rem;
    box-shadow: 0 -6px 20px rgba(14, 26, 43, 0.07);
}

.ps-bottom-nav-inner {
    max-width: 680px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.2rem;
}

.ps-nav-tab {
    min-height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #5b6777;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 11px;
    border: none;
    background: transparent;
    transition: all 0.15s ease;
}

.ps-nav-tab i {
    font-size: 1.22rem;
    margin-bottom: 2px;
}

.ps-nav-tab.active {
    color: var(--ps-emerald-deep);
    background: var(--ps-green-tint);
    font-weight: 700;
    box-shadow: inset 0 2px 0 var(--ps-lime);
}

/* Bottom Sheets desplegables */
.offcanvas-bottom.ps-bottom-sheet {
    height: auto !important;
    max-height: 88vh !important;
    border-top-left-radius: 22px;
    border-top-right-radius: 22px;
    max-width: 680px;
    margin: 0 auto;
    border-top: 1px solid var(--ps-card-border);
}

.ps-sheet-handle {
    width: 44px;
    height: 5px;
    background: #cbd5cf;
    border-radius: 99px;
    margin: 8px auto 4px auto;
}

/* Touch Canvas para Firma Autógrafa */
.ps-signature-canvas {
    width: 100%;
    height: 175px;
    background: #f8faf8;
    border: 2px dashed #94a3b8;
    border-radius: 14px;
    touch-action: none;
}

/* Visor de Documentos a Pantalla Completa con Pinch-to-Zoom */
.ps-zoom-viewer {
    overflow: auto;
    touch-action: pinch-zoom pan-x pan-y;
    max-height: 75vh;
    background: #0b1320;
    border-radius: 12px;
    text-align: center;
}
