/* ============================================
   Livendix - Sistema de Ventas en Vivo
   Estilos principales (fusionados con nuevos)
   ============================================ */

:root {
    --primary: #FF6B35;
    --primary-dark: #E55A2B;
    --secondary: #004E89;
    --secondary-light: #0066B3;
    --accent: #00C49A;
    --accent-dark: #00A882;
    --danger: #E74C3C;
    --warning: #F39C12;
    --dark: #1A1A2E;
    --dark-card: #16213E;
    --dark-input: #0F3460;
    --light: #F5F7FA;
    --light-card: #FFFFFF;
    --text: #333333;
    --text-light: #666666;
    --text-muted: #888888;
    --border: #E1E8ED;
    --shadow: 0 2px 10px rgba(0,0,0,0.05);
    --shadow-hover: 0 5px 20px rgba(0,0,0,0.1);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--light);
    color: var(--text);
    line-height: 1.6;
    padding-bottom: 80px;
}

/* ============================================
   HEADER Y LOGO
   ============================================ */

header {
    background: var(--secondary);
    color: white;
    padding: 20px;
    text-align: center;
    margin-bottom: 25px;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 4px 20px rgba(0,78,137,0.3);
    position: relative;
    z-index: 500;
    pointer-events: auto;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo-placeholder {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    border: 2px dashed rgba(255,255,255,0.4);
}

.logo-img {
    width: auto;
    height: 46px;      /* Desktop */
    max-width: 100%;
    object-fit: contain;
}

@media (max-width: 600px) {
    .logo-img {
        height: 36px;  /* Mobile más compacto */
    }
}
.logo-img:hover {
    transform: scale(1.05);
}

.brand-text {
    text-align: left;
}

.brand-text h1 {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin: 0;
    line-height: 1.2;
}

.brand-text .tagline {
    font-size: 0.8rem;
    opacity: 0.9;
    font-weight: 400;
}

/* ============================================
   BADGES DE PLAN
   ============================================ */

.header-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 12px;
    margin-top: 12px;
}

.header-meta .plan-badge,
.header-meta .sync-status {
    margin-top: 0;
}

.header-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.header-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 1.15rem;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.header-icon-btn:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: translateY(-1px);
}

.header-icon-btn.licence-toggle {
    font-size: 1.25rem;
}

.header-icon-btn--locked {
    position: relative;
    opacity: 0.72;
}

.header-icon-btn--locked .header-icon-lock {
    position: absolute;
    right: 2px;
    bottom: 2px;
    font-size: 0.55rem;
    opacity: 0.95;
}

.plan-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 10px;
}

.plan-badge.free {
    background: rgba(255,255,255,0.25);
    color: white;
}

.plan-badge.basic {
    background: var(--secondary);
    color: white;
}

.plan-badge.premium {
    background: var(--warning);
    color: #1a1a2e;
}

.plan-badge.plus {
    background: #FFF3E0;
    color: #E65100;
}

.plan-badge.pro {
    background: #E3F2FD;
    color: #1565C0;
}

.plan-badge.business {
    background: #F3E5F5;
    color: #7B1FA2;
}

/* ============================================
   SYNC STATUS
   ============================================ */

.sync-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.2);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-top: 8px;
}

.sync-status.connected {
    background: rgba(0,196,154,0.3);
}

.sync-status.disconnected {
    background: rgba(231,76,60,0.3);
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    animation: pulse 2s infinite;
}

.sync-status.connected .sync-dot {
    background: var(--accent);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   CONTAINER Y CARDS
   ============================================ */

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.card {
    background: var(--light-card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================
   FEATURES BLOQUEADAS (PLAN GRATIS)
   ============================================ */

.locked-feature {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
    filter: grayscale(0.3);
}

.locked-feature::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(0,0,0,0.03) 10px,
        rgba(0,0,0,0.03) 20px
    );
    border-radius: inherit;
    pointer-events: none;
}

.locked-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 10;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.upgrade-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--primary);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    margin-left: 8px;
    transition: var(--transition);
}

.upgrade-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(255,107,53,0.4);
}

/* ============================================
   PUBLICIDAD (PLAN GRATIS)
   ============================================ */

@keyframes adStripeShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes adCtaPulse {
    0%, 100% { box-shadow: 0 3px 12px rgba(243, 156, 18, 0.35); }
    50% { box-shadow: 0 6px 22px rgba(243, 156, 18, 0.55); }
}

@keyframes adBannerShimmer {
    0% { transform: translateX(-120%) skewX(-12deg); }
    100% { transform: translateX(220%) skewX(-12deg); }
}

.ad-banner {
    position: relative;
    background: linear-gradient(135deg, #003d6b 0%, #0066b3 48%, #004e89 100%);
    color: white;
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    text-align: center;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 78, 137, 0.28);
}

.ad-banner-glow {
    position: absolute;
    top: -40px;
    left: -20px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 107, 53, 0.35) 0%, transparent 68%);
    pointer-events: none;
}

.ad-banner::before {
    content: 'PUBLICIDAD';
    position: absolute;
    top: 6px;
    right: 10px;
    font-size: 0.58rem;
    opacity: 0.55;
    letter-spacing: 1px;
    z-index: 2;
}

.ad-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.12) 50%, transparent 60%);
    transform: translateX(-120%) skewX(-12deg);
    animation: adBannerShimmer 5s ease-in-out infinite;
    pointer-events: none;
}

.ad-banner-body {
    position: relative;
    z-index: 1;
}

.ad-banner-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 6px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255, 107, 53, 0.22);
    border: 1px solid rgba(255, 107, 53, 0.45);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ad-banner-kicker i {
    color: #ffb347;
}

.ad-banner h3 {
    font-size: 1rem;
    margin-bottom: 6px;
    line-height: 1.3;
}

.ad-banner-text {
    font-size: 0.86rem;
    opacity: 0.92;
    margin: 0 0 10px;
    line-height: 1.45;
}

.ad-banner-perks {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin: 0 0 12px;
    padding: 0;
}

.ad-banner-perks li {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.ad-banner-perks i {
    font-size: 0.68rem;
    opacity: 0.9;
}

.ad-banner .ad-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: white;
    color: var(--secondary);
    padding: 8px 18px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.84rem;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.ad-banner .ad-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);
    color: var(--secondary-dark, #003d6b);
}

.ad-banner .ad-cta i {
    font-size: 0.78rem;
    transition: transform 0.2s ease;
}

.ad-banner .ad-cta:hover i {
    transform: translateX(3px);
}

.ad-sidebar {
    position: relative;
    background: linear-gradient(145deg, #fff9f5 0%, #f2f8ff 100%);
    border: none;
    border-radius: var(--radius);
    padding: 16px 14px;
    margin-bottom: 20px;
    text-align: center;
    overflow: hidden;
    box-shadow:
        0 6px 22px rgba(255, 107, 53, 0.14),
        inset 0 0 0 1px rgba(255, 107, 53, 0.28);
}

.ad-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--warning), var(--accent), var(--primary));
    background-size: 220% 100%;
    animation: adStripeShift 4s ease infinite;
}

.ad-sidebar-accent {
    position: absolute;
    top: -28px;
    right: -18px;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 107, 53, 0.2) 0%, transparent 72%);
    pointer-events: none;
}

.ad-sidebar .ad-label {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.ad-sidebar-hook {
    margin: 0 0 8px;
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--secondary);
}

.ad-sidebar-hook i {
    color: var(--primary);
    margin-right: 6px;
}

.ad-sidebar-copy {
    margin: 0 0 8px;
    font-size: 0.86rem;
    line-height: 1.45;
    color: var(--text);
}

.ad-sidebar-price {
    margin: 0 0 12px;
    font-size: 0.8rem;
    color: var(--text-light);
}

.ad-sidebar-price strong {
    color: var(--primary);
    font-size: 1.05rem;
}

.ad-sidebar-cta {
    width: 100%;
    max-width: 260px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: adCtaPulse 2.6s ease-in-out infinite;
}

.ad-sidebar-cta i {
    font-size: 0.82rem;
}

@media (prefers-reduced-motion: reduce) {
    .ad-banner::after,
    .ad-sidebar::before,
    .ad-sidebar-cta {
        animation: none;
    }
}

.dark-mode .ad-sidebar {
    background: linear-gradient(145deg, #1c2a3d 0%, #16213e 100%);
    box-shadow:
        0 6px 22px rgba(0, 0, 0, 0.35),
        inset 0 0 0 1px rgba(255, 107, 53, 0.35);
}

.dark-mode .ad-sidebar-hook {
    color: #9ecfff;
}

.dark-mode .ad-sidebar-copy {
    color: #ddd;
}

.dark-mode .ad-sidebar-price {
    color: #aaa;
}

/* ============================================
   FORMULARIOS
   ============================================ */

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-light);
}

input, select, textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #dbe3ec;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
    font-family: inherit;
    background: white;
    color: var(--text);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #0066B3;
    box-shadow: 0 0 0 4px rgba(0,102,179,0.12);
    background: #fff;
}

input:disabled, select:disabled, textarea:disabled {
    background: #f0f0f0;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ============================================
   BOTONES
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    margin-top: 5px;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, #ff7a00 0%, #ff9500 100%);
    border: none;
    color: white;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        filter 0.15s ease;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(255,122,0,0.28);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--border);
    color: var(--text-light);
}

.btn-secondary:hover:not(:disabled) {
    background: #d0d7dd;
}

.btn-success {
    background: var(--accent);
    color: white;
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,196,154,0.4);
}

.btn-danger {
    background: var(--danger);
    color: white;
    padding: 8px 16px;
    font-size: 0.85rem;
    width: auto;
}

.btn-warning {
    background: #F5576C;
    color: white;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
    width: auto;
    margin-top: 0;
}

.btn-premium {
    background: var(--warning);
    color: #1a1a2e;
    font-weight: 700;
}

.btn-premium:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(247,151,30,0.4);
}

/* ============================================
   TABS
   ============================================ */

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: var(--light-card);
    padding: 5px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    border: none;
    background: transparent;
    color: var(--text-light);
    white-space: nowrap;
    min-width: 80px;
}

.tab.active {
    background: var(--primary);
    color: white;
}

.tab:hover:not(.active) {
    background: rgba(255,107,53,0.1);
    color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============================================
   ESTADÍSTICAS
   ============================================ */

/* Panel de estadísticas colapsable */
.stats-panel {
    margin-bottom: 20px;
    background: var(--light-card);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.stats-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 12px 15px;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
}

.stats-panel-header:hover .stats-panel-title {
    color: var(--secondary);
}

.stats-panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
    flex: 1;
    min-width: 0;
}

.stats-panel-preview {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 55%;
}

.stats-panel--collapsed .stats-panel-preview {
    display: block;
}

.stats-panel:not(.stats-panel--collapsed) .stats-panel-preview {
    display: none;
}

.stats-panel-chevron {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 78, 137, 0.08);
    transition: transform 0.25s ease;
}

.stats-panel--collapsed .stats-panel-chevron {
    transform: rotate(-90deg);
}

.stats-panel-body {
    overflow: hidden;
    max-height: 400px;
    transition: max-height 0.35s ease, opacity 0.25s ease;
    padding: 0 15px 15px;
}

.stats-panel-body.is-collapsed {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
}

.stats-panel-body .stats {
    margin-bottom: 0;
}

.stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--light-card);
    border-radius: var(--radius-sm);
    padding: 15px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================
   VENTAS
   ============================================ */

.sale-item {
    background: #f8f9ff;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    border-left: 4px solid var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    transition: var(--transition);
}

.sale-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    flex-shrink: 0;
    min-width: 110px;
}

.sale-total {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.sale-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    min-width: 40px;
    padding: 8px 12px;
    font-size: 0.85rem;
    border-radius: 10px;
}

.sale-delete-label {
    font-weight: 600;
}

.legal-content p {
    margin-bottom: 10px;
    line-height: 1.6;
    color: var(--text-muted);
}

/* Animación para nuevas ventas en tiempo real */
.sale-item.new-sale {
    animation: saleAppear 0.22s ease;
}

.sale-item:hover {
    background: #f0f2ff;
    transform: translateX(3px);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes saleAppear {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sale-badge {
    display: inline-block;
    background: #e8f5e9;
    color: #2e7d32;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
}

/* ============================================
   CLIENTES
   ============================================ */

.client-list-item {
    background: #f8f9ff;
    border-radius: var(--radius-sm);
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
}

.client-list-item:hover {
    background: #eef0ff;
    transform: translateX(5px);
}

.client-list-info h4 {
    color: var(--text);
    margin-bottom: 4px;
}

.client-list-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.total-badge {
    background: var(--primary);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
}

/* ============================================
   AUTOCOMPLETADO
   ============================================ */

.autocomplete-container {
    position: relative;
}

#salesFormCard,
#salesFormCard .sale-input-grid,
#salesFormCard .product-col.autocomplete-container,
#sales-tab.tab-content.active,
#sales-tab .card {
    overflow: visible;
}

#sales-tab .autocomplete-container {
    z-index: 50;
}

#salesFormCard .autocomplete-container.is-open,
#salesFormCard .product-col.autocomplete-container.is-open {
    z-index: 100000;
    position: relative;
}

#salesFormCard .sale-input-grid {
    position: relative;
    z-index: 1;
}

.product-autocomplete-list {
    z-index: 100001;
}

.autocomplete-list,
.autocomplete-list.autocomplete-list--portal {
    position: fixed;
    top: auto;
    left: auto;
    right: auto;
    background: #ffffff;
    border: 2px solid var(--primary);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    max-height: 240px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 100001;
    display: none;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    pointer-events: auto;
}

.autocomplete-list.open,
.autocomplete-list--portal.open {
    display: block !important;
    background: #ffffff !important;
}

.product-autocomplete-list.open {
    background: #ffffff !important;
}

.autocomplete-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    background: #ffffff;
}

.autocomplete-item:hover {
    background: #f8f9ff;
}

.dark-mode .autocomplete-item {
    background: var(--dark-card);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.dark-mode .autocomplete-item:hover {
    background: var(--dark-input);
}

.autocomplete-item .client-name {
    font-weight: 600;
}

.autocomplete-item .client-phone {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ============================================
   MODALES
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    padding: 25px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlide 0.3s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

@keyframes modalSlide {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    color: var(--text);
    font-size: 1.2rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    width: auto;
    padding: 0;
    transition: var(--transition);
}

.close-btn:hover {
    color: var(--danger);
    transform: rotate(90deg);
}

/* Modal de upgrade */
.upgrade-modal .plan-options {
    display: grid;
    gap: 15px;
    margin: 20px 0;
}

.plan-option {
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.plan-option:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.plan-option.recommended {
    border-color: var(--primary);
    background: #FFF8F5;
}

.plan-option.recommended::before {
    content: 'RECOMENDADO';
    position: absolute;
    top: -10px;
    right: 15px;
    background: var(--primary);
    color: white;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
}

.plan-option h4 {
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.plan-option .price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 10px;
}

.plan-option .price span {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 400;
}

.plan-features {
    list-style: none;
    font-size: 0.9rem;
    color: var(--text-light);
}

.plan-features li {
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.plan-features li::before {
    content: '✓';
    color: var(--accent);
    font-weight: 700;
}

.plan-features li.feature-excluded::before {
    content: '✗';
    color: #c0392b;
}

.plan-features li.feature-excluded {
    color: var(--text-muted);
}

/* ============================================
   NOTIFICACIONES
   ============================================ */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--accent);
    color: white;
    padding: 15px 20px;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 3000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    font-weight: 600;
    max-width: 350px;
}

.notification.show {
    transform: translateX(0);
}

.notification.error {
    background: var(--danger);
}

.notification.warning {
    background: var(--warning);
}

/* ============================================
   BOTÓN FLOTANTE
   ============================================ */

.floating-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255,107,53,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: var(--transition);
}

.floating-btn:hover {
    transform: scale(1.1) rotate(90deg);
}

/* ============================================
   CONFIGURACIÓN INICIAL / LOGIN
   ============================================ */

.setup-section {
    background: #E3F2FD;
    border: 2px solid #90CAF9;
    border-radius: var(--radius);
    padding: 25px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.setup-section h3 {
    color: #0D47A1;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.setup-section p {
    color: #1565C0;
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.licence-input {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.licence-input input {
    flex: 1;
    text-align: center;
    letter-spacing: 4px;
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
}

.licence-status {
    padding: 10px;
    border-radius: var(--radius-sm);
    margin-top: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    display: none;
}

.licence-status.success {
    background: #d4edda;
    color: #155724;
    display: block;
}

.licence-status.error {
    background: #f8d7da;
    color: #721c24;
    display: block;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 60px;
    height: 60px;
    margin-bottom: 15px;
    opacity: 0.3;
}


/* ============================================
   VARIANTES DE PRODUCTO
   Solo estilos en #variantSection — no tocar JS/sync
   ============================================ */

#variantSection.product-variants {
    margin-top: 16px;
    padding: 0;
    background: linear-gradient(180deg, #fff9f6 0%, #ffffff 55%);
    border: 1px solid #ffdccc;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

#variantSection.is-collapsed {
    padding-bottom: 0;
}

.variant-section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 12px 14px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    color: inherit;
    transition: background 0.15s ease;
}

.variant-section-toggle:hover {
    background: rgba(255, 107, 53, 0.06);
}

.variant-section-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.variant-toggle-left {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.variant-toggle-icon {
    color: var(--primary);
    font-size: 0.95rem;
}

.variant-toggle-hint {
    font-size: 0.78rem;
    color: #888;
    flex-shrink: 0;
}

.variant-chevron {
    font-size: 0.75rem;
    color: #888;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

#variantSection:not(.is-collapsed) .variant-chevron {
    transform: rotate(180deg);
}

#variantSection.is-collapsed .variant-section-body {
    display: none;
}

.variant-section-body {
    padding: 0 16px 14px;
    border-top: 1px solid #ffe8dc;
}

#variantSection .variant-section-label {
    display: inline;
    margin: 0;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--secondary);
    letter-spacing: 0.02em;
}

.variant-section-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 6px;
    border-radius: 999px;
    background: #ffe8dc;
    color: var(--secondary);
    font-size: 0.72rem;
    font-weight: 700;
}

.variant-section-hint {
    margin: 0 0 10px;
    font-size: 0.82rem;
    color: #666;
    line-height: 1.4;
}

.variant-for-sale-row {
    margin-bottom: 10px;
}

.variant-for-sale-row label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary);
}

.variant-tags-empty {
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
}

.variant-tag-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0;
    max-width: 100%;
}

.variant-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 0;
    min-height: 0;
}

.variant-tag {
    background: #e3f2fd;
    color: #1976d2;
    padding: 5px 12px;
    border-radius: 999px 0 0 999px;
    font-size: 0.8rem;
    cursor: pointer;
    border: 1px solid #bbdefb;
    border-right: none;
    transition: var(--transition);
    font-family: inherit;
}

.variant-tag-label.active,
.variant-tag-label.active + .variant-tag-remove {
    background: #1976d2;
    color: white;
    border-color: #1565c0;
}

.variant-tag-remove {
    background: #e3f2fd;
    color: #c62828;
    border: 1px solid #bbdefb;
    border-left: none;
    border-radius: 0 999px 999px 0;
    padding: 5px 8px;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
}

.variant-tag-wrap:hover .variant-tag,
.variant-tag-wrap:hover .variant-tag-remove {
    background: #1976d2;
    color: white;
    border-color: #1565c0;
}

.variant-tag-wrap:hover .variant-tag-remove {
    color: #ffcdd2;
}

.variant-tag:hover {
    background: #1976d2;
    color: white;
}

.variant-tag.active {
    background: #1976d2;
    color: white;
}

#variantSection .add-variant-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 18px;
    width: auto;
    max-width: 100%;
    border: 2px dashed var(--primary);
    border-radius: 999px;
    background: #ffffff;
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition:
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.15s ease;
}

#variantSection .add-variant-btn i {
    font-size: 0.85rem;
    line-height: 1;
}

#variantSection .add-variant-btn:hover {
    background: linear-gradient(135deg, #ff7a00 0%, #ff9500 100%);
    border-color: transparent;
    border-style: solid;
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(255, 107, 53, 0.28);
    transform: translateY(-1px);
}

#variantSection .add-variant-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.2);
}

#variantSection .add-variant-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.35);
}

#variantSection .variant-input-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: stretch;
    margin-top: 12px;
}

#variantSection .variant-input-row input {
    flex: 1 1 180px;
    min-width: 0;
    margin: 0;
}

#variantSection .variant-add-confirm {
    flex: 0 0 auto;
    width: auto;
    min-width: 96px;
    margin: 0;
    padding: 10px 16px;
}

.dark-mode #variantSection.product-variants {
    background: linear-gradient(180deg, rgba(255, 107, 53, 0.08) 0%, var(--dark-card) 60%);
    border-color: rgba(255, 107, 53, 0.35);
}

.dark-mode .variant-section-body {
    border-top-color: rgba(255, 107, 53, 0.25);
}

.dark-mode .variant-section-toggle:hover {
    background: rgba(255, 107, 53, 0.12);
}

.dark-mode .variant-section-count {
    background: rgba(255, 107, 53, 0.25);
    color: #ffdccc;
}

.dark-mode #variantSection .variant-section-label {
    color: #f0f4f8;
}

.dark-mode #variantSection .add-variant-btn {
    background: var(--dark-input);
    color: #ffb899;
    border-color: rgba(255, 107, 53, 0.55);
}

.dark-mode #variantSection .add-variant-btn:hover {
    background: linear-gradient(135deg, #ff7a00 0%, #ff9500 100%);
    color: #ffffff;
    border-color: transparent;
}

/* ============================================
   CHECKBOXES
   ============================================ */

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.checkbox-wrapper input[type="checkbox"] {
    width: auto;
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.checkbox-wrapper label {
    margin: 0;
    font-weight: normal;
    cursor: pointer;
}

/* ============================================
   EXPORTACIONES
   ============================================ */

.export-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

/* ============================================
   DARK MODE
   ============================================ */

.dark-mode {
    --text-muted: #b8c4d4;
    --text-light: #d0dae6;
    background: var(--dark);
    color: #f0f4f8;
}

.dark-mode .card,
.dark-mode .stat-card,
.dark-mode .client-list-item {
    background: var(--dark-card);
    color: #f0f4f8;
}

.dark-mode label,
.dark-mode p,
.dark-mode small,
.dark-mode .help-text,
.dark-mode .form-hint,
.dark-mode .stat-label,
.dark-mode .sale-meta,
.dark-mode .client-list-info p,
.dark-mode .summary-line,
.dark-mode .session-info,
.dark-mode .plan-hint,
.dark-mode #syncText {
    color: var(--text-light);
}

.dark-mode h2,
.dark-mode h3,
.dark-mode h4,
.dark-mode .client-list-info h4,
.dark-mode .stat-value,
.dark-mode .sale-item strong,
.dark-mode .modal-header h3 {
    color: #f5f8fc;
}

.dark-mode input,
.dark-mode select,
.dark-mode textarea {
    background: var(--dark-input);
    border-color: #2a4a6e;
    color: #f5f8fc;
}

.dark-mode input::placeholder,
.dark-mode textarea::placeholder {
    color: #8fa3b8;
}

.dark-mode .sale-item {
    background: var(--dark-input);
    color: #f0f4f8;
}

.dark-mode .autocomplete-list,
.dark-mode .autocomplete-list--portal {
    background: var(--dark-card);
    border-color: var(--primary);
}

.dark-mode .autocomplete-list.open,
.dark-mode .autocomplete-list--portal.open,
.dark-mode .product-autocomplete-list.open {
    background: var(--dark-card) !important;
}

.dark-mode .autocomplete-item {
    color: #f0f4f8;
    background: var(--dark-card);
}

.dark-mode .autocomplete-item:hover {
    background: var(--dark-input);
}

.dark-mode .tabs {
    background: var(--dark-card);
}

.dark-mode .tab-btn {
    color: var(--text-light);
}

.dark-mode .tab-btn.active {
    color: #fff;
}

.dark-mode .client-list-info h4 {
    color: #f5f8fc;
}

.dark-mode .btn-secondary {
    color: #f0f4f8;
    border-color: #4a6a8a;
}

.dark-mode .sync-status {
    color: var(--text-light);
}

header .theme-toggle,
header .session-toggle {
    position: static;
}

/* ============================================
   LIVE INDICATOR
   ============================================ */

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(239,68,68,0.08);
    color: #ef4444;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.85rem;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    animation: livePulse 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes livePulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.4);
        opacity: 0.5;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================
   SESSION INFO
   ============================================ */

.session-info {
    background: #e8f5e9;
    border-radius: var(--radius-sm);
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid #c8e6c9;
}

.session-info h3 {
    color: #2e7d32;
    margin-bottom: 5px;
    font-size: 1rem;
}

.session-info p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.session-code {
    font-size: 1.8rem;
    font-weight: 800;
    text-align: center;
    color: var(--secondary);
    letter-spacing: 8px;
    margin: 10px 0;
    font-family: 'Courier New', monospace;
    background: rgba(0,78,137,0.1);
    padding: 10px;
    border-radius: var(--radius-sm);
}

/* ============================================
   BANNER DESCONECTADO
   ============================================ */

.disconnected-banner {
    background: #ffebee;
    color: #c62828;
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 15px;
    text-align: center;
    font-weight: 600;
    display: none;
    border: 1px solid #ef9a9a;
}

.disconnected-banner.show {
    display: block;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 600px) {
    .stats {
        grid-template-columns: 1fr;
    }

    .sale-item {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .sale-item-actions {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        min-width: 0;
    }

    .header-icon-btn {
        width: 44px;
        height: 44px;
    }

    .export-options {
        grid-template-columns: 1fr;
    }

    .tabs {
        gap: 5px;
    }

    .tab {
        font-size: 0.8rem;
        padding: 8px;
        min-width: 70px;
    }

    .logo-container {
        flex-direction: column;
        gap: 10px;
    }

    .brand-text {
        text-align: center;
    }

    .plan-options {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================
   UTILIDADES
   ============================================ */

.hidden {
    display: none !important;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }






/* ============================================
   CLIENT TAG SELECTOR
   ============================================ */

.client-tag-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tag-option {
    flex: 1;
    min-width: 100px;
    cursor: pointer;
    position: relative;
}

.tag-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.tag-option span {
    display: block;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    border: 2px solid transparent;
    transition: var(--transition);
}

.tag-option.green span {
    background: #e8f5e9;
    color: #2e7d32;
    border-color: #a5d6a7;
}

.tag-option.orange span {
    background: #fff3e0;
    color: #ef6c00;
    border-color: #ffcc80;
}

.tag-option.red span {
    background: #ffebee;
    color: #c62828;
    border-color: #ef9a9a;
}

.tag-option input[type="radio"]:checked + span {
    box-shadow: 0 0 0 3px;
    transform: scale(1.02);
}

.tag-option.green input[type="radio"]:checked + span {
    background: #2e7d32;
    color: white;
    box-shadow: 0 0 0 3px rgba(46,125,50,0.3);
}

.tag-option.orange input[type="radio"]:checked + span {
    background: #ef6c00;
    color: white;
    box-shadow: 0 0 0 3px rgba(239,108,0,0.3);
}

.tag-option.red input[type="radio"]:checked + span {
    background: #c62828;
    color: white;
    box-shadow: 0 0 0 3px rgba(198,40,40,0.3);
}

/* Tag badges in client list */
.client-tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 8px;
}

.client-tag-badge.green {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.client-tag-badge.orange {
    background: #fff3e0;
    color: #ef6c00;
    border: 1px solid #ffcc80;
}

.client-tag-badge.red {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

/* ============================================
   CLIENT LIMIT BANNER
   ============================================ */

.client-limit-banner {
    background: #FFF3E0;
    border: 2px solid var(--warning);
    border-radius: var(--radius);
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Dark mode para limit banner */
.dark-mode .client-limit-banner {
    background: #3E2723;
    border-color: var(--warning);
}

.client-limit-banner.full {
    background: #FFEBEE;
    border-color: var(--danger);
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.client-limit-banner span {
    font-weight: 700;
    color: #856404;
    font-size: 0.9rem;
}

.client-limit-bar {
    width: 100%;
    height: 8px;
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
    overflow: hidden;
}

.client-limit-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.client-limit-fill.warning {
    background: var(--warning);
}

.client-limit-fill.danger {
    background: var(--danger);
}

.limit-reached-message {
    background: #ffebee;
    color: #c62828;
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-top: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    border: 1px solid #ef9a9a;
}

/* ============================================
   HELP / FAQ STYLES
   ============================================ */

.help-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.help-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.help-section h3 {
    font-size: 1.1rem;
    color: var(--secondary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-guide {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.guide-step {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    background: #f8f9ff;
    padding: 15px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary);
}

.guide-number {
    width: 32px;
    height: 32px;
    min-width: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
}

.guide-text {
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.5;
}

.guide-text kbd {
    background: var(--dark);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: monospace;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: var(--transition);
}

.faq-item:hover {
    border-color: var(--primary);
}

.faq-question {
    width: 100%;
    background: white;
    border: none;
    padding: 15px;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.faq-question:hover {
    background: #f8f9ff;
}

.faq-icon {
    transition: transform 0.3s ease;
    color: var(--primary);
    font-size: 0.8rem;
}

.faq-item.open .faq-icon {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background: #fafafa;
}

.faq-item.open .faq-answer {
    max-height: 300px;
    padding: 0 15px 15px;
}

.faq-answer p {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.6;
}

.contact-info {
    background: #f8f9ff;
    padding: 15px;
    border-radius: var(--radius-sm);
}

.contact-info p {
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.contact-info a {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 600;
}

.contact-info a:hover {
    text-decoration: underline;
}

/* ============================================
   FOOTER
   ============================================ */

.livendi-footer {
    background: var(--dark);
    color: rgba(255,255,255,0.7);
    padding: 30px 20px;
    margin-top: 40px;
    border-radius: 20px 20px 0 0;
    text-align: center;
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.footer-links a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-copy {
    font-size: 0.8rem;
    opacity: 0.6;
}

.footer-reset-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 0;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.15s ease;
}

.footer-reset-btn:hover {
    color: rgba(255, 255, 255, 0.75);
}

.reset-app-warning-banner {
    background: #ffebee;
    border: 1px solid #ef9a9a;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 14px;
}

.reset-app-warning-title {
    color: #c62828;
    font-weight: 700;
    font-size: 0.95rem;
    margin: 0 0 10px;
}

.reset-app-warning-body {
    color: #555;
    font-size: 0.9rem;
    line-height: 1.55;
    margin: 0;
    white-space: pre-line;
}

.reset-app-note-banner {
    background: #fff3e0;
    border: 1px solid #ffcc80;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.reset-app-note-banner p {
    color: #5d4037;
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
}

.dark-mode .livendi-footer {
    background: #0a0a1a;
}

/* ============================================
   HELP FLOATING BUTTON
   ============================================ */

.help-floating-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--secondary);
    color: white;
    border: none;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,78,137,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: var(--transition);
}

.help-floating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,78,137,0.5);
}

/* ============================================
   PWA INSTALL PROMPT
   ============================================ */

.install-prompt-btn {
    position: fixed;
    bottom: 140px;
    left: 20px;
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,201,154,0.4);
    z-index: 99;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    transform: translateY(20px);
    animation: slideInInstall 0.5s ease-out 0.2s forwards;
}

.install-prompt-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,201,154,0.5);
}

@keyframes slideInInstall {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.install-app-banner {
    background: linear-gradient(135deg, rgba(0, 78, 137, 0.08), rgba(0, 201, 154, 0.12));
    border: 1px solid rgba(0, 78, 137, 0.25);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 16px;
}

.install-app-banner-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.install-app-banner-text {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.92rem;
    color: var(--text);
    flex: 1;
    min-width: 200px;
}

.install-app-banner-text i {
    color: var(--accent);
    font-size: 1.25rem;
    margin-top: 2px;
}

.install-app-banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.install-app-banner-close {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
}

.install-app-modal-content {
    max-width: 480px;
}

.install-app-notice {
    background: rgba(0, 78, 137, 0.08);
    border: 1px solid rgba(0, 78, 137, 0.2);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 14px;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text);
}

.install-app-notice p {
    margin: 0;
}

.install-app-icon-wrap {
    text-align: center;
    margin-bottom: 14px;
}

.install-app-icon {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dark-mode .install-app-notice {
    background: rgba(0, 120, 200, 0.12);
    border-color: rgba(0, 196, 154, 0.25);
}

.install-app-intro {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 16px;
    line-height: 1.5;
}

.install-app-installed-note {
    background: rgba(0, 201, 154, 0.12);
    border: 1px solid rgba(0, 201, 154, 0.35);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 14px;
    font-size: 0.9rem;
    color: var(--text);
}

.install-app-native-btn {
    width: 100%;
    margin-bottom: 16px;
    font-size: 1rem;
    padding: 14px;
}

.install-app-steps {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
}

.install-app-step {
    display: grid;
    grid-template-columns: 28px 32px 1fr;
    gap: 10px;
    align-items: start;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.install-app-step:last-child {
    border-bottom: none;
}

.install-app-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.install-app-step-icon {
    color: var(--primary);
    font-size: 1.1rem;
    padding-top: 4px;
}

.install-app-step-text {
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--text);
}

.install-app-tip {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--bg-alt, #f5f7fa);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin: 0;
    line-height: 1.45;
}

.dark-mode .install-app-tip {
    background: rgba(255, 255, 255, 0.06);
}

.dark-mode .install-app-banner {
    background: linear-gradient(135deg, rgba(0, 120, 200, 0.15), rgba(0, 201, 154, 0.1));
}

/* ============================================
   LOADING ANIMATION
   ============================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--secondary);
    display: none;
    pointer-events: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.is-active {
    display: flex;
    pointer-events: auto;
    animation: fadeOutLoading 2s ease-in-out 0.8s forwards;
}

.loading-content {
    text-align: center;
    color: white;
    animation: scaleIn 0.8s ease-out;
}

.loading-logo {
    width: 96px;
    height: 96px;
    margin-bottom: 20px;
    border-radius: 20px;
    object-fit: cover;
    animation: bounceIn 1s ease-out;
}

.loading-text {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.loading-subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 400;
}

@keyframes fadeOutLoading {
    0% { opacity: 1; }
    90% { opacity: 1; }
    100% { opacity: 0; visibility: hidden; }
}

@keyframes scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

/* ============================================
   EXPORT NOTICE
   ============================================ */

.export-notice {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: var(--radius-sm);
    padding: 12px 15px;
    margin-top: 15px;
    font-size: 0.9rem;
    color: #1565c0;
}

.export-notice strong {
    color: #0d47a1;
}

/* ============================================
   DARK MODE ADDITIONS
   ============================================ */

.dark-mode .client-limit-banner {
    background: #3E2723;
    border-color: var(--warning);
}

.dark-mode .client-limit-banner span {
    color: #ffe0b2;
}

.dark-mode .guide-step {
    background: var(--dark-input);
}

.dark-mode .faq-item {
    border-color: var(--dark-input);
}

.dark-mode .faq-question {
    background: var(--dark-card);
    color: #eee;
}

.dark-mode .faq-question:hover {
    background: var(--dark-input);
}

.dark-mode .faq-answer {
    background: var(--dark-input);
}

.dark-mode .faq-answer p {
    color: #bbb;
}

.dark-mode .contact-info {
    background: var(--dark-input);
}

.dark-mode .export-notice {
    background: #1a237e;
    border-color: #3949ab;
    color: #90caf9;
}

.dark-mode .export-notice strong {
    color: #bbdefb;
}

/* ============================================
   RESPONSIVE ADDITIONS
   ============================================ */

@media (max-width: 600px) {
    .client-tag-selector {
        flex-direction: column;
    }

    .tag-option {
        min-width: auto;
    }

    .guide-step {
        flex-direction: column;
        gap: 10px;
    }

    .footer-links {
        gap: 15px;
    }

    .help-floating-btn {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
}


/* ============================================
   MOBILE INPUT IMPROVEMENTS
   Aumenta altura, tama\u00f1o de texto y espaciado
   en pantallas peque\u00f1as para mejor legibilidad
   ============================================ */

@media (max-width: 600px) {
    /* Inputs m\u00e1s altos y texto m\u00e1s grande */
    input, select, textarea {
        padding: 14px 16px;
        font-size: 1.05rem;
        min-height: 48px;
    }

    /* Placeholder m\u00e1s visible */
    input::placeholder, textarea::placeholder {
        font-size: 0.95rem;
        opacity: 0.7;
    }

    /* Grid de producto/precio/cantidad en columna para m\u00e1s espacio */
    .card > div[style*="grid-template-columns: 2fr 1fr 1fr auto"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .card > div[style*="grid-template-columns: 2fr 1fr 1fr auto"] .form-group {
        margin-bottom: 0;
    }

    .card > div[style*="grid-template-columns: 2fr 1fr 1fr auto"] .btn {
        margin-top: 5px !important;
        margin-bottom: 0 !important;
        min-height: 48px;
    }

    /* Etiquetas m\u00e1s grandes */
    label {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }

    /* Autocomplete items m\u00e1s altos */
    .autocomplete-item {
        padding: 14px 15px;
        font-size: 1rem;
    }

    /* Selector de etiquetas en columna */
    .client-tag-selector {
        flex-direction: column;
    }

    .tag-option span {
        padding: 14px 12px;
        font-size: 0.95rem;
    }

    /* Tabs m\u00e1s altos y texto m\u00e1s grande */
    .tab {
        padding: 12px 8px;
        font-size: 0.9rem;
        min-height: 44px;
    }

    /* Cards con m\u00e1s padding */
    .card {
        padding: 18px 15px;
    }

    /* Sale items m\u00e1s espaciados */
    .sale-item {
        padding: 18px 15px;
        gap: 12px;
    }

    .sale-info h4 {
        font-size: 1rem;
        margin-bottom: 6px;
    }

    .sale-info p {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    /* Client list items m\u00e1s altos */
    .client-list-item {
        padding: 18px 15px;
    }

    .client-list-info h4 {
        font-size: 1rem;
    }

    .client-list-info p {
        font-size: 0.9rem;
    }

    /* Botones m\u00e1s altos */
    .btn {
        min-height: 48px;
        font-size: 1rem;
        padding: 14px 24px;
    }

    .btn-small {
        min-height: 40px;
        padding: 10px 16px;
    }

    /* Modal content m\u00e1s espacio */
    .modal-content {
        padding: 20px 15px;
    }

    /* Licencia input m\u00e1s grande */
    .licence-input input {
        font-size: 1.1rem;
        padding: 14px;
        min-height: 48px;
    }

    /* Session code m\u00e1s grande */
    .session-code {
        font-size: 1.5rem;
        padding: 12px;
    }

    /* Stats cards m\u00e1s altos */
    .stat-card {
        padding: 18px 12px;
    }

    .stat-number {
        font-size: 1.6rem;
    }

    .stat-label {
        font-size: 0.85rem;
    }

    /* Checkbox wrapper m\u00e1s espacio */
    .checkbox-wrapper {
        margin: 15px 0;
    }

    .checkbox-wrapper input[type="checkbox"] {
        width: 22px;
        height: 22px;
    }

    /* Export options botones m\u00e1s altos */
    .export-options .btn {
        min-height: 48px;
        font-size: 0.95rem;
    }

    /* Guide steps m\u00e1s espaciados */
    .guide-step {
        padding: 18px 15px;
    }

    .guide-text {
        font-size: 0.95rem;
    }

    /* FAQ questions m\u00e1s altos */
    .faq-question {
        padding: 18px 15px;
        font-size: 0.95rem;
    }

    /* Contact info m\u00e1s espaciado */
    .contact-info p {
        font-size: 0.95rem;
        margin-bottom: 10px;
    }

    /* Footer links m\u00e1s espaciados */
    .footer-links {
        gap: 20px;
    }

    .footer-links a {
        font-size: 0.95rem;
    }

    /* Floating buttons m\u00e1s grandes para touch */
    .floating-btn {
        width: 65px;
        height: 65px;
        font-size: 1.8rem;
    }

    .help-floating-btn {
        width: 55px;
        height: 55px;
        font-size: 1.5rem;
    }

    /* Theme toggle m\u00e1s grande */
    .theme-toggle {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }

    /* Limit banner m\u00e1s espaciado */
    .client-limit-banner {
        padding: 18px 15px;
    }

    /* Ad banner m\u00e1s espaciado */
    .ad-banner {
        padding: 20px 15px;
    }

    .ad-banner h3 {
        font-size: 1.05rem;
    }

    .ad-banner p,
    .ad-banner-text {
        font-size: 0.9rem;
    }

    .ad-banner-perks li {
        font-size: 0.7rem;
    }

    /* Setup section m\u00e1s espaciado */
    .setup-section {
        padding: 22px 15px;
    }

    .setup-section h3 {
        font-size: 1.1rem;
    }

    .setup-section p {
        font-size: 0.95rem;
    }
}

/* Extra: inputs siempre con texto legible (evita zoom en iOS) */
input, select, textarea {
    font-size: 16px; /* Previene zoom en iOS Safari */
}

@media (max-width: 600px) {
    input, select, textarea {
        font-size: 16px; /* Mantiene 16px en mobile para evitar zoom iOS */
    }
}

/* ============================================
   SEMÁFORO CLIENTE - INDICADOR EN AUTOCOMPLETADO
   ============================================ */

.autocomplete-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    background: #ffffff;
}

.autocomplete-item:hover {
    background: #f8f9ff;
}

.dark-mode .autocomplete-item {
    background: var(--dark-card);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.dark-mode .autocomplete-item:hover {
    background: var(--dark-input);
}

.autocomplete-item .client-name {
    font-weight: 600;
}

.autocomplete-item .client-phone {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Indicador semáforo en autocomplete */
.semaforo-indicator {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-left: 8px;
    border: 2px solid white;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

.semaforo-indicator.verde {
    background: #2e7d32;
}

.semaforo-indicator.naranja {
    background: #ef6c00;
}

.semaforo-indicator.rojo {
    background: #c62828;
}

/* Info del cliente en autocomplete con semáforo */
.autocomplete-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

/* ============================================
   SEMÁFORO EN DETALLE DE CLIENTE (modal)
   ============================================ */

.semaforo-display {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: 8px;
}

.semaforo-display.verde {
    background: #e8f5e9;
    color: #2e7d32;
}

.semaforo-display.naranja {
    background: #fff3e0;
    color: #ef6c00;
}

.semaforo-display.rojo {
    background: #ffebee;
    color: #c62828;
}

/* Selector de semáforo en edición de cliente */
.semaforo-selector {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.semaforo-option {
    flex: 1;
    cursor: pointer;
    position: relative;
}

.semaforo-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.semaforo-option .semaforo-circle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    transition: var(--transition);
    background: #f5f5f5;
}

.semaforo-option .semaforo-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.1);
}

.semaforo-option.verde .semaforo-dot {
    background: #2e7d32;
}

.semaforo-option.naranja .semaforo-dot {
    background: #ef6c00;
}

.semaforo-option.rojo .semaforo-dot {
    background: #c62828;
}

.semaforo-option .semaforo-label-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
}

.semaforo-option input[type="radio"]:checked + .semaforo-circle {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: scale(1.05);
}

/* ============================================
   MOBILE: Producto/Precio/Cantidad/Botón en una fila
   ============================================ */

@media (max-width: 600px) {
    /* Grid de venta: producto arriba, precio+cantidad+boton abajo */
    .sale-input-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .sale-input-grid .product-col {
        grid-column: 1 / -1;
    }

    .sale-input-grid .product-col label,
    .sale-input-grid .price-col label,
    .sale-input-grid .qty-col label {
        display: block;
        margin-bottom: 6px;
    }

    /* En mobile: precio, cantidad y botón en una fila */
    .sale-input-grid {
        grid-template-columns: 1fr 1fr auto;
        gap: 10px;
        align-items: start;
    }

    .sale-input-grid .product-col {
        grid-column: 1 / -1;
    }

    .sale-input-grid .price-col,
    .sale-input-grid .qty-col {
        margin-bottom: 0;
    }

    .sale-input-grid .price-col label,
    .sale-input-grid .qty-col label {
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .sale-input-grid .btn-add-col {
        margin: 0;
        min-height: 48px;
        width: 48px;
        padding: 0;
        font-size: 1.3rem;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-top: 26px;
        line-height: 1;
    }
}

/* Desktop: producto ancho, resto compacto */
@media (min-width: 601px) {
    .sale-input-grid {
        display: grid;
        grid-template-columns: 3fr 100px 80px 50px;
        gap: 10px;
        align-items: end;
    }

    .sale-input-grid .product-col {
        grid-column: auto;
    }

    .sale-input-grid .price-col,
    .sale-input-grid .qty-col,
    .sale-input-grid .btn-add-col {
        display: block;
    }

    .sale-input-grid .form-group {
        margin-bottom: 15px;
    }

    .sale-input-grid .btn-add-col {
        margin-bottom: 15px;
        width: 50px;
        padding: 0;
        min-height: 48px;
    }
}


/* ============================================
   SESSION TOGGLE BUTTON (header)
   ============================================ */

.session-toggle {
    position: fixed;
    top: 20px;
    right: 70px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    z-index: 100;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.session-toggle:hover {
    background: rgba(231,76,60,0.5);
    transform: rotate(180deg);
}

/* ============================================
   SESSION OPTIONS MODAL
   ============================================ */

#sessionOptionsModal .modal-content {
    animation: modalSlide 0.3s ease;
}

#sessionOptionsModal .btn-block {
    width: 100%;
    margin-top: 0;
}

/* ============================================
   SESSION INFO - BOTÓN CERRAR
   ============================================ */

.session-info .btn-small {
    margin-top: 0;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .session-info > div {
        flex-direction: column;
    }

    .session-info .btn-small {
        width: 100%;
        margin-top: 10px;
    }

    .session-toggle {
        right: 65px;
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
}


/* ============================================
   BARRA DE ORDENAMIENTO DE VENTAS
   ============================================ */

.sales-sort-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9ff;
    border: 1px solid #e1e8ed;
    border-radius: var(--radius-sm);
    padding: 10px 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.sales-count {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 600;
}

.btn-sort-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: white;
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-sort-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(255,107,53,0.15);
}

.btn-sort-toggle i {
    color: var(--primary);
}

.btn-sort-toggle strong {
    color: var(--primary);
    font-weight: 700;
}

.sort-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* ============================================
   HORA SUTIL EN VENTAS
   ============================================ */

.sale-time {
    display: inline-block;
    font-size: 0.75rem;
    color: #bbb;
    margin-top: 4px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.sale-time::before {
    content: '\f017';
    font-family: 'Font Awesome 6 Free';
    font-weight: 400;
    margin-right: 4px;
    font-size: 0.7rem;
}

.dark-mode .sale-time {
    color: #666;
}

.dark-mode .sales-sort-bar {
    background: var(--dark-input);
    border-color: var(--dark);
}

.dark-mode .btn-sort-toggle {
    background: var(--dark-card);
    border-color: var(--dark-input);
    color: #aaa;
}

.dark-mode .btn-sort-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}


/* ============================================
   AVISO DE SESION ACTIVA (anti-trampa)
   ============================================ */

.licence-session-warning {
    margin-top: 15px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.session-warning-box {
    background: #FFF3E0;
    border: 2px solid #FF9800;
    border-radius: var(--radius-sm);
    padding: 15px;
    text-align: center;
}

.session-warning-box p {
    margin: 0 0 8px 0;
    color: #E65100;
    font-size: 0.95rem;
}

.session-warning-box code {
    background: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--secondary);
    border: 1px solid #FFCC80;
}

.session-warning-box .btn {
    margin-top: 0;
    font-size: 0.85rem;
    padding: 8px 16px;
}

.dark-mode .session-warning-box {
    background: #3E2723;
    border-color: #FF9800;
}

.dark-mode .session-warning-box p {
    color: #FFE0B2;
}

.dark-mode .session-warning-box code {
    background: var(--dark-card);
    color: var(--primary);
    border-color: #5D4037;
}



/* ============================================
   ESTILOS NUEVOS v2 - Multi-sesion, Reactivacion, Recuperacion
   (Fusionados desde livendi(1).css)
   ============================================ */

/* ============================================
   BANNER DE REACTIVACION RAPIDA
   ============================================ */

#reactivateBanner {
    animation: slideDown 0.4s ease;
}

#reactivateBanner .setup-section {
    background: #e8f5e9 !important;
    border-color: #4caf50 !important;
}

#reactivateBanner h3 {
    color: #2e7d32;
}

#reactivateBanner p {
    color: #388e3c;
}

.reactivate-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.reactivate-actions .btn {
    flex: 1;
    min-width: 150px;
}

/* ============================================
   MODAL SELECTOR DE SESIONES
   ============================================ */

#sessionSelectorModal .modal-content {
    max-width: 480px;
}

.session-list-item {
    background: #f8f9ff;
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.session-list-item:hover {
    border-color: var(--primary);
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.session-list-item .session-info {
    flex: 1;
}

.session-list-item .session-code {
    font-weight: 700;
    color: var(--secondary);
    font-size: 1.1rem;
    font-family: 'Courier New', monospace;
}

.session-list-item .device-session-label {
    font-weight: 700;
    color: var(--secondary);
    font-size: 1rem;
    letter-spacing: normal;
    font-family: inherit;
}

.session-list-item .device-primary-badge {
    color: #2e7d32;
    font-size: 0.85rem;
    font-weight: 600;
}

.session-list-item .session-meta {
    font-size: 0.8rem;
    color: #888;
    margin-top: 4px;
}

.session-list-item .session-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.session-limit-info {
    background: #fff3e0;
    border: 1px solid #ffcc80;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 15px;
    text-align: center;
}

.session-limit-info p {
    color: #e65100;
    margin: 0;
    font-size: 0.9rem;
}

/* ============================================
   MODAL DE VISTA DE SESION HISTORICA
   ============================================ */

#sessionHistoryViewModal .modal-content {
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
}

.session-history-sale {
    background: #f8f9ff;
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 8px;
    border-left: 3px solid var(--primary);
    transition: var(--transition);
}

.session-history-sale:hover {
    background: #eef0ff;
}

.session-history-client-group {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
}

.session-history-client-group .client-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
}

.session-history-client-group .client-name {
    font-weight: 700;
    color: var(--text);
    font-size: 1rem;
}

.session-history-client-group .client-total {
    color: var(--primary);
    font-weight: 800;
    font-size: 1.1rem;
}

.session-history-client-group .sale-items {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.6;
}

/* ============================================
   BOTON RECUPERAR SESION
   ============================================ */

.btn-recover {
    background: linear-gradient(135deg, #00C49A 0%, #00A882 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.btn-recover:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,196,154,0.4);
}

.btn-recover i {
    font-size: 1.1rem;
}

/* ============================================
   ANIMACIONES ADICIONALES
   ============================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================
   DARK MODE - Nuevos elementos
   ============================================ */

.dark-mode .session-list-item {
    background: var(--dark-input);
    border-color: var(--dark);
}

.dark-mode .session-list-item:hover {
    border-color: var(--primary);
}

.dark-mode .session-history-sale {
    background: var(--dark-input);
}

.dark-mode .session-history-client-group {
    background: var(--dark-card);
    border-color: var(--dark-input);
}

.dark-mode .session-limit-info {
    background: #3E2723;
    border-color: #FF9800;
}

.dark-mode .session-limit-info p {
    color: #FFE0B2;
}

.dark-mode #reactivateBanner .setup-section {
    background: #1b5e20 !important;
    border-color: #4caf50 !important;
}

.dark-mode #reactivateBanner h3 {
    color: #a5d6a7;
}

.dark-mode #reactivateBanner p {
    color: #c8e6c9;
}

/* ============================================
   RESPONSIVE - Modales de sesion
   ============================================ */

@media (max-width: 600px) {
    #sessionSelectorModal .modal-content,
    #sessionHistoryViewModal .modal-content {
        padding: 20px 15px;
        margin: 10px;
    }

    .session-list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .session-list-item .session-actions {
        width: 100%;
        justify-content: stretch;
    }

    .session-list-item .session-actions .btn {
        flex: 1;
    }

    .reactivate-actions {
        flex-direction: column;
    }

    .reactivate-actions .btn {
        width: 100%;
    }

    .btn-recover {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   CONSULTA DE SESION ARCHIVADA
   ============================================ */

.historical-session-banner {
    background: linear-gradient(135deg, #1565c0 0%, #004e89 100%);
    color: #fff;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.historical-session-banner-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.historical-session-banner-text {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.9rem;
}

.historical-session-banner-text i {
    font-size: 1.25rem;
    margin-top: 2px;
    opacity: 0.9;
}

.historical-session-banner-detail {
    display: block;
    font-size: 0.85rem;
    opacity: 0.92;
    font-weight: 400;
    margin-top: 2px;
}

.historical-session-banner .btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
}

.historical-session-banner .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.35);
}

.summary-historical-note {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 0.9rem;
    color: #1565c0;
}

.client-detail-archive-note {
    background: #fff3e0;
    border: 1px solid #ffcc80;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 14px;
    font-size: 0.85rem;
    color: #e65100;
}

.session-history-item {
    background: #f5f5f5;
    border-radius: 10px;
    padding: 12px 15px;
    border: 1px solid #e0e0e0;
    margin-bottom: 0;
}

.session-history-item--current {
    background: #e8f5e9;
    border-color: #a5d6a7;
}

.session-history-item-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.session-history-code {
    font-size: 0.95rem;
}

.session-history-badge-current {
    color: #2e7d32;
    font-size: 0.75rem;
    margin-left: 8px;
}

.session-history-total {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.1rem;
}

.session-history-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 15px;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 10px;
}

.session-history-date {
    margin-left: auto;
    color: #888;
    font-size: 0.8rem;
}

.btn-danger.session-delete-btn {
    padding: 6px 10px;
}

.session-delete-btn i {
    pointer-events: none;
}

.session-history-export-btns {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.session-history-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.session-history-hint {
    font-size: 0.85rem;
    color: #666;
}

.session-cleanup-body {
    max-height: min(60vh, 480px);
    overflow-y: auto;
    padding: 0 4px 12px;
}

.session-cleanup-summary {
    background: #f5f7fa;
    border: 1px solid #e0e6ed;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.session-cleanup-summary ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

.session-cleanup-intro,
.session-cleanup-hint {
    font-size: 0.88rem;
    color: #666;
    line-height: 1.5;
}

.session-cleanup-section {
    margin-bottom: 18px;
}

.session-cleanup-section h4 {
    margin: 0 0 6px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.session-cleanup-group {
    border: 1px solid #e0e6ed;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    background: #fff;
}

.session-cleanup-group-head {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #444;
}

.session-cleanup-keep {
    font-size: 0.85rem;
    color: #2e7d32;
    margin-bottom: 8px;
    padding: 8px 10px;
    background: #e8f5e9;
    border-radius: 8px;
}

.session-cleanup-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.session-cleanup-list li {
    margin-bottom: 6px;
}

.session-cleanup-list label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #eee;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.88rem;
}

.session-cleanup-list label:hover {
    background: #fafafa;
}

.session-cleanup-code {
    font-weight: 600;
    font-family: monospace;
}

.session-cleanup-meta {
    color: #888;
    font-size: 0.82rem;
}

.session-cleanup-tag {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 2px 6px;
    border-radius: 4px;
    background: #eee;
    color: #555;
}

.session-cleanup-tag--dup {
    background: #fff3e0;
    color: #e65100;
}

.session-cleanup-tag--empty {
    background: #eceff1;
    color: #546e7a;
}

.session-cleanup-toolbar {
    margin-bottom: 12px;
}

.session-cleanup-select-all {
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.session-cleanup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.session-cleanup-loading,
.session-cleanup-empty,
.session-cleanup-error {
    text-align: center;
    padding: 24px 12px;
    color: #666;
}

.session-cleanup-empty i {
    color: #43a047;
    font-size: 2rem;
    margin-bottom: 8px;
}

.session-cleanup-error {
    color: #c62828;
}

.dark-mode .session-cleanup-summary {
    background: var(--dark-input);
    border-color: #2a4a6e;
}

.dark-mode .session-cleanup-group {
    background: var(--dark-input);
    border-color: #2a4a6e;
}

.dark-mode .session-cleanup-list label {
    border-color: #2a4a6e;
}

.dark-mode .session-cleanup-list label:hover {
    background: rgba(255, 255, 255, 0.04);
}

.dark-mode .session-history-item {
    background: var(--dark-input);
    border-color: #2a4a6e;
}

.dark-mode .session-history-item--current {
    background: #1b3d2f;
    border-color: #2e7d32;
}

.dark-mode .summary-historical-note {
    background: #1a3a5c;
    border-color: #2a5a8a;
    color: #90caf9;
}

.dark-mode .client-detail-archive-note {
    background: #3e2723;
    border-color: #6d4c41;
    color: #ffcc80;
}

.dark-mode .historical-session-banner {
    background: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
}

/* ============================================
   WHATSAPP SETTINGS (COLAPSABLE)
   ============================================ */

.whatsapp-settings-card {
    overflow: hidden;
}

.whatsapp-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0;
    margin: 0 0 8px;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
    gap: 12px;
}

.whatsapp-settings-header:hover .whatsapp-settings-title {
    color: var(--secondary);
}

.whatsapp-settings-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    transition: color 0.2s ease;
}

.whatsapp-settings-chevron {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(37, 211, 102, 0.12);
    color: #25D366;
    transition: transform 0.25s ease, background 0.2s ease;
}

.whatsapp-settings-card--collapsed .whatsapp-settings-chevron {
    transform: rotate(-90deg);
}

.whatsapp-settings-preview {
    font-size: 0.9rem;
    color: #666;
    margin: 0 0 12px;
    padding-left: 2px;
}

.whatsapp-settings-preview.hidden {
    display: none;
}

.whatsapp-settings-body {
    overflow: hidden;
    max-height: 2000px;
    transition: max-height 0.35s ease, opacity 0.25s ease;
    opacity: 1;
}

.whatsapp-settings-body.is-collapsed {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
    margin: 0;
    padding: 0;
}

.whatsapp-settings-card--collapsed .whatsapp-settings-intro,
.whatsapp-settings-card--collapsed .whatsapp-settings-actions {
    /* handled by body collapse */
}

.whatsapp-settings-intro {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
}

.whatsapp-settings-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.whatsapp-preview-group {
    margin-top: 4px;
}

.whatsapp-preview-hint {
    font-size: 0.85rem;
    color: #666;
    margin: 0 0 8px;
    line-height: 1.4;
}

.whatsapp-message-preview {
    margin: 0;
    padding: 12px 14px;
    background: #e8f5e9;
    border: 1px solid rgba(37, 211, 102, 0.35);
    border-radius: 10px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.92rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #1a1a1a;
    max-height: 280px;
    overflow-y: auto;
}

.dark-mode .whatsapp-message-preview {
    background: rgba(37, 211, 102, 0.08);
    border-color: rgba(37, 211, 102, 0.25);
    color: #e8eef2;
}

.dark-mode .whatsapp-preview-hint {
    color: var(--text-light);
}

.dark-mode .whatsapp-settings-title {
    color: #f0f4f8;
}

.dark-mode .whatsapp-settings-preview {
    color: var(--text-light);
}

/* ============================================
   MODAL DE SESIONES ANTERIORES
   ============================================ */

#previousSessionsModal .modal-content {
    max-width: 520px;
    animation: modalSlide 0.3s ease;
}

.prev-session-card {
    transition: all 0.3s ease;
}

.prev-session-card:hover {
    border-color: var(--primary);
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.dark-mode .prev-session-card {
    background: var(--dark-input);
    border-color: var(--dark);
}

.dark-mode .prev-session-card:hover {
    border-color: var(--primary);
}

/* ============================================
   FIX: BOTON DE SESIONES EN MOVIL
   ============================================ */

.session-toggle {
    position: fixed;
    top: calc(20px + env(safe-area-inset-top, 0px));
    right: 70px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 44px;
    height: 44px;

    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    z-index: 100;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.session-toggle:hover {
    background: rgba(231,76,60,0.5);
    transform: rotate(180deg);
}

.theme-toggle {
    position: fixed;
    top: calc(20px + env(safe-area-inset-top, 0px));
    right: 20px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 100;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.theme-toggle:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(20deg);
}

@media (max-width: 600px) {
    .session-toggle {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
        right: 72px;
        top: calc(12px + env(safe-area-inset-top, 0px));
    }

    .theme-toggle {
        width: 48px;
        height: 48px;
        font-size: 1.3rem;
        right: 16px;
        top: calc(12px + env(safe-area-inset-top, 0px));
    }
}

@media (max-width: 380px) {
    .session-toggle {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
        right: 66px;
    }

    .theme-toggle {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
        right: 14px;
    }
}
/* ============================================
   CORRECCIONES CSS - Livendix v2.1
   Agregar al final de livendi.css
   ============================================ */

/* Ocultar elementos con clase hidden */
.hidden {
    display: none !important;
}

/* Espaciado cuando sessionInfo está oculto */
#sessionInfo.hidden + #localModeInfo {
    margin-top: 0;
}

/* Animación suave para mostrar/ocultar */
.session-info {
    transition: all 0.3s ease;
}

/* Estado de sync corregido */
.sync-status.local {
    background: #FFF3E0;
    color: #E65100;
}

.sync-status.local .sync-dot {
    background: #FF9800;
    animation: none;
}

.sync-status.connected {
    background: #E8F5E9;
    color: #2E7D32;
}

.sync-status.connected .sync-dot {
    background: #4CAF50;
    animation: pulse 2s infinite;
}

.sync-status.disconnected {
    background: #FFEBEE;
    color: #C62828;
}

.sync-status.disconnected .sync-dot {
    background: #F44336;
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Banner de modo local */
#localModeInfo {
    border: 1px solid #FF9800;
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 15px;
}

/* Mejora visual para el setup en plan gratis */
.setup-section {
    transition: all 0.3s ease;
}

.licence-recover-block {
    margin-top: 14px;
}

.licence-recover-toggle,
.btn-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--primary, #004E89);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.licence-recover-toggle:hover,
.btn-link:hover {
    opacity: 0.85;
}

.licence-recover-form {
    margin-top: 8px;
}

.licence-forget-section .btn-danger {
    width: 100%;
    max-width: 320px;
}

.export-plan-btn .export-plan-hint {
    font-size: 0.7rem;
    display: block;
    margin-top: 2px;
}

.export-plan-hint.hidden {
    display: none !important;
}

.clients-sync-hint {
    display: flex;
    align-items: center;
    gap: 8px;
}

.setup-section.hidden {
    display: none !important;
}

/* ============================================
   SCROLL LIMPIO
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.18);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.3);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.18) transparent;
}

.dark-mode ::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
}

.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.25);
}

.dark-mode * {
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

/* ============================================
   LIVENDIX CSS v2.2 - Refinamiento Visual
   ============================================
   Cambios aplicados:
   1. Header con gradiente azul y sticky positioning
   2. Cards con hover translateY(-2px) y shadow premium
   3. Sync dot con animación pulseSync y glow
   4. Live badge con estilo pill y livePulse
   5. Inputs con border #dbe3ec y focus ring azul
   6. Botón primary con gradiente naranja y :active scale
   7. Animación saleAppear para nuevas ventas
   8. Reducción de tonos crema (setup-section a azul)
   9. Scroll limpio en WebKit y Firefox
   10. Logo optimizado con drop-shadow

   Principio: "Más claro, rápido y confiable"
   ============================================ */

/* Header: iconos en fila (anula position:fixed de reglas legacy) */
header .header-icon-btn,
header .header-icon-btn.theme-toggle,
header .header-icon-btn.session-toggle {
    position: static !important;
    top: auto !important;
    right: auto !important;
    z-index: auto;
}

.sale-delete-btn i {
    font-size: 1rem;
    line-height: 1;
}

/* WhatsApp resumen */
.summary-delivery-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 14px;
    background: #f5f7fa;
    border-radius: 12px;
    border: 1px solid var(--border, #e8ecf1);
}

.summary-delivery-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.9rem;
    font-weight: 600;
}

.summary-stat--pending {
    color: #e65100;
}

.summary-stat--delivered {
    color: #2e7d32;
}

.summary-delivery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.summary-filter-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    color: #555;
    cursor: pointer;
    user-select: none;
}

.summary-filter-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary, #004E89);
}

.summary-clients-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.summary-client-card {
    background: #f8f9ff;
    border-radius: 12px;
    padding: 15px;
    border: 1px solid var(--border, #e8ecf1);
}

.summary-client-card--pending {
    border-left: 4px solid #ff9800;
}

.summary-client-card--delivered {
    border-left: 4px solid #4caf50;
    background: #f1f8f4;
    opacity: 0.95;
}

.summary-client-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px 12px;
}

.summary-delivered-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #444;
    cursor: pointer;
    user-select: none;
}

.summary-delivered-check--readonly {
    cursor: default;
    opacity: 0.85;
}

.summary-delivered-check input {
    width: 18px;
    height: 18px;
    accent-color: #4caf50;
}

.summary-delivery-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.summary-delivery-badge--pending {
    background: #fff3e0;
    color: #e65100;
}

.summary-delivery-badge--done {
    background: #e8f5e9;
    color: #2e7d32;
}

.summary-client-name {
    font-size: 1rem;
    display: block;
    margin-bottom: 8px;
}

.summary-client-total {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
}

.summary-client-lines {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.6;
    margin-bottom: 12px;
}

.summary-no-phone {
    font-size: 0.8rem;
    color: #888;
    margin: 0;
}

.btn-whatsapp {
    background: #25D366;
    color: #fff;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-whatsapp:hover {
    background: #1da851;
    color: #fff;
}

.btn-whatsapp.btn-block {
    width: 100%;
}

.whatsapp-settings-card textarea {
    width: 100%;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.5;
}

.whatsapp-settings-card code {
    background: #f0f2f5;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.payment-method-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.payment-method-tab {
    flex: 1;
    min-width: 120px;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

.payment-method-tab.active {
    border-color: var(--primary);
    background: #e8f0fe;
    color: var(--primary);
}

.btn-mercadopago {
    background: #009ee3;
    color: #fff;
    width: 100%;
    margin-top: 8px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-mercadopago:hover {
    background: #007eb5;
    color: #fff;
}

.plan-mp-note {
    font-size: 0.75rem;
    color: #666;
    text-align: center;
    margin-top: 6px;
    line-height: 1.3;
}

/* Analiticas avanzadas (Resumen) */
.analytics-card {
    margin-bottom: 20px;
    overflow: hidden;
}

.analytics-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 0 0 12px;
    margin: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
}

.analytics-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.1rem;
    flex: 1;
    min-width: 0;
}

.analytics-card-preview {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 45%;
}

.analytics-card--collapsed .analytics-card-preview {
    display: block;
}

.analytics-card:not(.analytics-card--collapsed) .analytics-card-preview {
    display: none;
}

.analytics-card-chevron {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 78, 137, 0.08);
    transition: transform 0.25s ease;
}

.analytics-card--collapsed .analytics-card-chevron {
    transform: rotate(-90deg);
}

.analytics-card-body {
    overflow: hidden;
    max-height: 3000px;
    transition: max-height 0.35s ease, opacity 0.25s ease;
}

.analytics-card-body.is-collapsed {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

.analytics-plan-note {
    font-size: 0.88rem;
    color: var(--text-muted, #666);
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(0, 78, 137, 0.06);
    border: 1px dashed rgba(0, 78, 137, 0.2);
}

.analytics-muted {
    font-size: 0.88rem;
    color: #666;
    margin: 0 0 12px;
    line-height: 1.45;
}

.analytics-subtitle {
    font-size: 0.95rem;
    color: var(--secondary);
    margin: 0 0 10px;
}

.analytics-block {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.analytics-kpi-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 12px 0 4px;
}

.analytics-kpi {
    background: #f5f8fc;
    border-radius: 10px;
    padding: 12px 10px;
    text-align: center;
}

.analytics-kpi-num {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--secondary);
}

.analytics-kpi-label {
    display: block;
    font-size: 0.75rem;
    color: #666;
    margin-top: 4px;
}

.analytics-top-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.analytics-top-item {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    background: #fafafa;
    border-radius: 8px;
    font-size: 0.9rem;
}

.analytics-top-rank {
    font-weight: 700;
    color: var(--primary);
}

.analytics-top-meta {
    font-size: 0.82rem;
    color: #666;
    white-space: nowrap;
}

.analytics-hourly-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.analytics-hour-row {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    gap: 8px;
    align-items: center;
    font-size: 0.85rem;
}

.analytics-hour-bar-wrap {
    height: 8px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
}

.analytics-hour-bar {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--secondary), #0066B3);
    border-radius: 4px;
}

.analytics-hour-meta {
    font-size: 0.8rem;
    color: #666;
    white-space: nowrap;
}

.analytics-compare-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.analytics-compare-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
    padding: 10px 12px;
    background: #fafafa;
    border-radius: 8px;
    font-size: 0.88rem;
}

.analytics-compare-label {
    font-weight: 600;
    color: #333;
}

.analytics-compare-values {
    grid-column: 1 / -1;
    color: #555;
    font-size: 0.85rem;
}

.analytics-vs {
    color: #999;
    font-size: 0.8rem;
}

.analytics-delta {
    font-weight: 600;
    font-size: 0.82rem;
    text-align: right;
}

.analytics-delta-up { color: #2e7d32; }
.analytics-delta-down { color: #c62828; }
.analytics-delta-neutral { color: #888; }

.dark-mode .analytics-kpi {
    background: #1e2a38;
}

.dark-mode .analytics-top-item,
.dark-mode .analytics-compare-row {
    background: #243447;
}

.dark-mode .analytics-muted,
.dark-mode .analytics-kpi-label,
.dark-mode .analytics-top-meta,
.dark-mode .analytics-hour-meta {
    color: #aaa;
}

@media (max-width: 600px) {
    .analytics-kpi-row {
        grid-template-columns: 1fr;
    }
    .analytics-hour-row {
        grid-template-columns: 64px 1fr;
    }
    .analytics-hour-meta {
        grid-column: 2;
    }
}

/* ============================================
   OVERLAY PROMO PLUS (plan Gratis)
   ============================================ */

.plus-promo-overlay {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 30, 60, 0.55);
    backdrop-filter: blur(4px);
}

.plus-promo-overlay.hidden {
    display: none;
}

.plus-promo-overlay.active {
    display: flex;
}

.plus-promo-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 28px 24px 22px;
    border-radius: var(--radius);
    background: var(--light-card);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
    animation: modalSlide 0.35s ease;
    text-align: center;
}

.plus-promo-close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
}

.plus-promo-close:hover {
    color: var(--text);
}

.plus-promo-title {
    margin: 0 0 12px;
    font-size: 1.55rem;
    line-height: 1.25;
    color: var(--secondary);
}

.plus-promo-subtitle {
    margin: 0 0 14px;
    font-size: 0.98rem;
    line-height: 1.55;
    color: var(--text);
    text-align: left;
}

.plus-promo-detail {
    margin: 0 0 10px;
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--text-light);
}

.plus-promo-timer {
    margin: 0 0 18px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.plus-promo-cta {
    width: 100%;
    margin-bottom: 14px;
}

.plus-promo-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.plus-promo-link {
    border: none;
    background: transparent;
    color: var(--secondary-light);
    font-size: 0.88rem;
    cursor: pointer;
    padding: 4px 2px;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.plus-promo-link:hover {
    color: var(--secondary);
}

.plus-promo-sep {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.dark-mode .plus-promo-card {
    background: var(--dark-card);
    color: #eee;
}

.dark-mode .plus-promo-title {
    color: #7ec8ff;
}

.dark-mode .plus-promo-subtitle {
    color: #ddd;
}

.dark-mode .plus-promo-detail,
.dark-mode .plus-promo-timer {
    color: #aaa;
}

.dark-mode .plus-promo-close {
    color: #888;
}

.dark-mode .plus-promo-close:hover {
    color: #ddd;
}

.dark-mode .plus-promo-link {
    color: #7ec8ff;
}

@media (max-width: 480px) {
    .plus-promo-card {
        padding: 24px 18px 18px;
    }

    .plus-promo-title {
        font-size: 1.35rem;
    }
}