/**
 * Bichara Óptica Mayorista - Sistema de Diseño UI/UX Pro Max
 * Paleta: Navy Profundo #0B132B + Zafiro #0284C7 + Esmeralda #059669 + Ámbar Taller #D97706
 * Tipografía: Figtree / Noto Sans / Fira Code (para recetas oftalmológicas)
 */

@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@300;400;500;600;700;800&family=Fira+Code:wght@400;500;600;700&family=Noto+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #0B132B;
    --primary-light: #1E293B;
    --primary-dark: #070D1E;
    
    /* Identidad Oficial Bichara Óptica */
    --bichara-blue: #0183CC;
    --bichara-blue-hover: #0070B0;
    --bichara-blue-dark: #005A8E;
    --bichara-blue-light: #E0F2FE;
    --bichara-blue-subtle: rgba(1, 131, 204, 0.08);
    
    --accent: #0183CC;
    --accent-hover: #0070B0;
    --accent-glow: rgba(1, 131, 204, 0.28);
    
    /* Espectro Oficial Point Lentes Multifocales */
    --point-cyan: #00AEEF;
    --point-green: #3AB54A;
    --point-orange: #F7931D;
    --point-yellow: #FFDD17;
    --point-dark: #231F20;
    --brand-spectrum: linear-gradient(90deg, #FFDD17 0% 25%, #F7931D 25% 50%, #3AB54A 50% 75%, #00AEEF 75% 100%);
    --brand-spectrum-smooth: linear-gradient(135deg, #FFDD17 0%, #F7931D 30%, #3AB54A 70%, #00AEEF 100%);
    
    --cyan: #00AEEF;
    --emerald-light: #D1FAE5;
    --emerald-300: #6EE7B7;
    --emerald: #3AB54A;
    --emerald-600: #059669;
    --emerald-700: #047857;
    --amber: #F7931D;
    --amber-light: #FEF3C7;
    --purple: #7C3AED;
    --purple-light: #EDE9FE;
    --rose: #E11D48;
    --rose-light: #FFE4E6;
    
    --bg-main: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-card-subtle: #F1F5F9;
    --border-color: #E2E8F0;
    --border-color-focus: #38BDF8;
    
    --text-main: #0F172A;
    --text-muted: #64748B;
    --text-light: #94A3B8;
    --text-on-primary: #FFFFFF;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.09), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
    --shadow-glow: 0 0 20px rgba(2, 132, 199, 0.2);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --font-heading: 'Figtree', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Noto Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Fira Code', monospace;
    
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    max-width: 100vw;
}

html {
    overflow-x: hidden;
    max-width: 100vw;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.25;
    color: var(--text-main);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==========================================================================
   LAYOUT PRINCIPAL (HEADER, NAVBAR, SIDEBAR, CONTENT)
   ========================================================================== */
.app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Top Navbar */
.top-navbar {
    background: linear-gradient(90deg, #070E1E 0%, #0B172E 50%, #060C1A 100%);
    color: #FFFFFF;
    min-height: 72px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    position: relative;
}

/* Línea Inferior Multicolor Oficial Point / Bichara */
.top-navbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--brand-spectrum);
    z-index: 1001;
}

.nav-brand-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #FFFFFF;
    text-decoration: none;
    white-space: nowrap;
}

.brand-logo-badge {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    box-shadow: 0 0 0 2px var(--bichara-blue), 0 4px 12px rgba(1, 131, 204, 0.4);
    flex-shrink: 0;
    overflow: hidden;
    transition: transform var(--transition-fast);
}

.nav-brand:hover .brand-logo-badge {
    transform: scale(1.06);
}

.nav-brand-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-text-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.brand-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-name {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 800;
    color: #FFFFFF;
    letter-spacing: -0.01em;
    line-height: 1.15;
}

.brand-name-sub {
    font-size: 0.86rem;
    font-weight: 600;
    color: #38BDF8;
}

.brand-tagline {
    font-size: 0.68rem;
    color: #94A3B8;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.brand-icon-pill {
    width: 42px;
    height: 42px;
    background: #FFFFFF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    box-shadow: 0 0 0 2px var(--bichara-blue), 0 3px 10px rgba(1, 131, 204, 0.35);
}

.brand-tag {
    font-size: 0.68rem;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-left: 0.25rem;
    white-space: nowrap;
}

.brand-tag-admin {
    background: rgba(56, 189, 248, 0.15);
    color: #38BDF8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.brand-tag-taller {
    background: rgba(245, 158, 11, 0.2);
    color: #FCD34D;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.brand-tag-client {
    background: rgba(16, 185, 129, 0.15);
    color: #34D399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link {
    color: #CBD5E1;
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    font-size: 0.86rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.nav-link:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.08);
}

.nav-link.active {
    color: #FFFFFF;
    background: rgba(2, 132, 199, 0.25);
    border-color: rgba(56, 189, 248, 0.4);
}

.nav-link-scan {
    color: #FCD34D !important;
}

.nav-link-scan:hover {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #FDE68A !important;
}

.nav-link-scan.active {
    background: rgba(245, 158, 11, 0.25) !important;
    border-color: rgba(245, 158, 11, 0.5) !important;
    color: #FCD34D !important;
}

/* Nav Dropdown Menu */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: inherit;
}

.dropdown-chevron {
    transition: transform 0.2s ease;
    margin-left: -2px;
}

.nav-dropdown:hover .dropdown-chevron,
.nav-dropdown.is-open .dropdown-chevron {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 235px;
    background: #0F172A;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.55), 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 0.4rem;
    list-style: none;
    display: none;
    flex-direction: column;
    gap: 0.2rem;
    z-index: 1200;
    backdrop-filter: blur(12px);
    animation: fadeInDropdown 0.16s ease-out;
}

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

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu,
.nav-dropdown.is-open .nav-dropdown-menu {
    display: flex;
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.8rem;
    color: #CBD5E1;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.15s ease;
}

.nav-dropdown-item:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.08);
}

.nav-dropdown-item.active {
    color: #38BDF8;
    background: rgba(56, 189, 248, 0.12);
}

.nav-dropdown-item svg {
    flex-shrink: 0;
    color: #38BDF8;
}

.nav-dropdown-item strong {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.2;
}

.nav-dropdown-item small {
    display: block;
    font-size: 0.72rem;
    color: #94A3B8;
    font-weight: 500;
    margin-top: 1px;
}

/* Action CTA Buttons in Nav */
.nav-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 35px;
    padding: 0 0.85rem;
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: 8px;
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.15s ease;
    background: linear-gradient(135deg, #0284C7 0%, #0369A1 100%);
    color: #FFFFFF !important;
    border: 1px solid rgba(56, 189, 248, 0.4);
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

.nav-cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.45);
    background: linear-gradient(135deg, #0369A1 0%, #0284C7 100%);
}

.nav-cta-green {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    border-color: rgba(52, 211, 153, 0.4);
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.nav-cta-green:hover {
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.45);
}

/* User Profile Container */
.user-dropdown-container {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
}

.nav-user-dropdown {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.25rem 0.65rem 0.25rem 0.4rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.user-avatar-circle {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #0284C7 0%, #38BDF8 100%);
    color: #FFFFFF;
    font-weight: 800;
    font-size: 0.85rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-info-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    text-align: left;
}

.user-name-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #FFFFFF;
    white-space: nowrap;
    line-height: 1.2;
    display: block;
}

.user-role-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
    display: inline-block;
    line-height: 1.2;
    letter-spacing: 0.02em;
}

.user-role-badge-admin {
    background: rgba(56, 189, 248, 0.15);
    color: #38BDF8;
    border: 1px solid rgba(56, 189, 248, 0.35);
}

.user-role-badge-taller {
    background: rgba(245, 158, 11, 0.15);
    color: #F59E0B;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.user-optica-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #FFFFFF;
    line-height: 1.2;
}

.user-role-sub {
    font-size: 0.7rem;
    color: #94A3B8;
}

.nav-logout-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #94A3B8;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.15s ease;
    flex-shrink: 0;
    text-decoration: none;
}

.nav-logout-btn:hover {
    color: #EF4444;
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    transform: scale(1.05);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: #FFFFFF;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-collapse {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    margin-left: 1.25rem;
    min-width: 0;
}

/* Spans responsivos para textos largos / cortos en menú */
.nav-text-short {
    display: none;
}
.nav-text-full {
    display: inline;
}

/* ==========================================================================
   NAVBAR RESPONSIVE & ADAPTIVE STYLES (LAPTOP & COMPACT DESKTOP)
   ========================================================================== */
/* Notebooks estándar (1366px, 1400px, 1440px y 1080p con escalado al 125%) */
@media (max-width: 1480px) {
    .nav-text-full {
        display: none !important;
    }
    .nav-text-short {
        display: inline !important;
    }
    .top-navbar {
        padding: 0.4rem 1rem;
        min-height: 62px;
    }
    .mobile-menu-collapse {
        margin-left: 0.85rem;
    }
    .brand-tag {
        display: none !important;
    }
    .brand-tagline {
        display: none !important;
    }
    .brand-name {
        font-size: 1.05rem;
    }
    .nav-menu {
        gap: 0.25rem;
    }
    .nav-link {
        padding: 0.35rem 0.55rem;
        font-size: 0.82rem;
        gap: 0.32rem;
    }
    .nav-link svg {
        width: 15px;
        height: 15px;
    }
    .nav-cta-btn {
        padding: 0 0.65rem;
        height: 32px;
        font-size: 0.78rem;
        gap: 0.28rem;
    }
    .nav-cta-btn svg {
        width: 13px;
        height: 13px;
    }
    .user-dropdown-container {
        gap: 0.45rem;
    }
    .user-role-badge {
        display: none !important;
    }
    .user-name-title {
        max-width: 110px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.8rem;
    }
    .user-avatar-circle {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
    .nav-logout-btn {
        width: 32px;
        height: 32px;
    }
}

/* Notebooks compactas y pantallas pequeñas (1025px a 1260px) */
@media (max-width: 1260px) {
    .top-navbar {
        padding: 0.35rem 0.65rem;
        min-height: 58px;
    }
    .mobile-menu-collapse {
        margin-left: 0.5rem;
    }
    .brand-logo-badge {
        width: 36px;
        height: 36px;
    }
    .brand-name {
        font-size: 0.95rem;
    }
    .brand-tagline {
        display: none !important;
    }
    .brand-name-sub {
        display: none !important;
    }
    .nav-menu {
        gap: 0.18rem;
    }
    .nav-link {
        padding: 0.3rem 0.45rem;
        font-size: 0.78rem;
        gap: 0.25rem;
    }
    .nav-cta-btn {
        padding: 0 0.5rem;
        height: 30px;
        font-size: 0.74rem;
        gap: 0.2rem;
    }
    .user-info-text {
        display: none !important;
    }
    .nav-user-dropdown {
        padding: 0.15rem;
        background: none;
        border: none;
    }
    .user-avatar-circle {
        width: 28px;
        height: 28px;
        font-size: 0.76rem;
    }
    .nav-logout-btn {
        width: 30px;
        height: 30px;
    }
}

/* Page Container */
.page-container {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title-wrap h1 {
    font-size: 1.75rem;
    letter-spacing: -0.02em;
    color: var(--primary);
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* ==========================================================================
   BUTTONS & ACTIONS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-heading);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
    line-height: 1.2;
}

.btn-primary {
    background: var(--accent);
    color: #FFFFFF;
    box-shadow: 0 2px 4px rgba(2, 132, 199, 0.2);
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: #FFFFFF;
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--primary);
    color: #FFFFFF;
}

.btn-secondary:hover {
    background: var(--primary-light);
    color: #FFFFFF;
    transform: translateY(-1px);
}

.btn-success {
    background: var(--emerald);
    color: #FFFFFF;
}

.btn-success:hover {
    background: #047857;
    color: #FFFFFF;
}

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background: #F1F5F9;
    border-color: #CBD5E1;
}

.btn-whatsapp {
    background: #25D366;
    color: #FFFFFF;
    box-shadow: 0 2px 6px rgba(37, 211, 102, 0.3);
}

.btn-whatsapp:hover {
    background: #1EBE5D;
    color: #FFFFFF;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.btn-block {
    width: 100%;
}

/* ==========================================================================
   CARDS & GRIDS
   ========================================================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    min-width: 0; /* Previene blowout de flex/grid con tablas internas */
    transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
}

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

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.grid-cols-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.grid-cols-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.grid-cols-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

.layout-split {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: start;
}

.layout-split > div {
    min-width: 0; /* Prevents grid blowout with wide tables */
}

.grid-radios {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.grid-radios-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.order-type-card {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.25rem;
    cursor: pointer;
    background: #FFFFFF;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    position: relative;
}

.order-type-card:hover {
    border-color: #38BDF8;
    background: #F8FAFC;
    transform: translateY(-1px);
}

.order-type-card.active {
    border-color: #0284C7;
    background: #F0F9FF;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.14);
}

.order-type-card input[type="radio"] {
    margin-top: 0.25rem;
    accent-color: #0284C7;
    width: 1.2rem;
    height: 1.2rem;
    cursor: pointer;
}

.grid-cols-5-sm {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 1rem;
    align-items: flex-end;
}

/* KPI / Stat Cards */
.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-icon-blue { background: #E0F2FE; color: #0284C7; }
.kpi-icon-amber { background: #FEF3C7; color: #D97706; }
.kpi-icon-purple { background: #EDE9FE; color: #7C3AED; }
.kpi-icon-emerald { background: #D1FAE5; color: #059669; }
.kpi-icon-slate { background: #F1F5F9; color: #475569; }

.kpi-data {
    display: flex;
    flex-direction: column;
}

.kpi-number {
    font-size: 1.6rem;
    font-weight: 800;
    font-family: var(--font-heading);
    color: var(--primary);
    line-height: 1.1;
}

.kpi-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 0.2rem;
}

/* ==========================================================================
   STATUS PILLS & GLOWS
   ========================================================================== */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font-heading);
    white-space: nowrap;
}

.pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
    animation: pulseGlow 2s infinite ease-in-out;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

.badge-info { background: #E0F2FE; color: #0369A1; border: 1px solid #BAE6FD; }
.badge-warning { background: #FEF3C7; color: #B45309; border: 1px solid #FDE68A; }
.badge-purple { background: #EDE9FE; color: #6D28D9; border: 1px solid #DDD6FE; }
.badge-primary { background: #DBEAFE; color: #1D4ED8; border: 1px solid #BFDBFE; }
.badge-success { background: #D1FAE5; color: #047857; border: 1px solid #A7F3D0; }
.badge-danger { background: #FFE4E6; color: #BE123C; border: 1px solid #FECDD3; }
.badge-secondary { background: #F1F5F9; color: #475569; border: 1px solid #E2E8F0; }

.priority-pill {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}
.priority-urgente { background: #FEE2E2; color: #DC2626; border: 1px solid #FCA5A5; }
.priority-normal { background: #F1F5F9; color: #64748B; }

/* ==========================================================================
   MERCADO LIBRE STYLE TRACKING COMPONENT
   ========================================================================== */
.tracking-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.tracking-header-card {
    background: #FFFFFF;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.tracking-header-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #0284C7, #06B6D4, #10B981);
}

.tracking-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.tracking-code-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: #F8FAFC;
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
}

.pulse-radar {
    width: 9px;
    height: 9px;
    background: #0284C7;
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(2, 132, 199, 0.4);
    animation: radarPulse 1.8s infinite;
}

@keyframes radarPulse {
    0% { box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(2, 132, 199, 0); }
    100% { box-shadow: 0 0 0 0 rgba(2, 132, 199, 0); }
}

.btn-copy-code {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.2rem;
    display: flex;
    align-items: center;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast);
}

.btn-copy-code:hover {
    color: var(--accent);
}

.tracking-hero {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2.25rem;
}

.hero-icon-wrap {
    width: 68px;
    height: 68px;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
}

.status-bg-recibido { background: #E0F2FE; color: #0284C7; }
.status-bg-en_taller { background: #FEF3C7; color: #D97706; }
.status-bg-control_calidad { background: #EDE9FE; color: #7C3AED; }
.status-bg-en_camino { background: #DBEAFE; color: #2563EB; }
.status-bg-finalizado { background: #D1FAE5; color: #059669; }
.status-bg-cancelado { background: #FEE2E2; color: #DC2626; }

.hero-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.35rem;
}

.hero-description {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 680px;
}

.hero-eta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.6rem;
    background: #F1F5F9;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: #334155;
}

/* Stepper Progress Bar (Mercado Libre) */
.stepper-wrapper {
    position: relative;
    padding: 1rem 0;
    margin-top: 1rem;
}

.stepper-progress-bar-bg {
    position: absolute;
    top: 32px;
    left: 40px;
    right: 40px;
    height: 6px;
    background: #E2E8F0;
    border-radius: var(--radius-full);
    z-index: 1;
}

.stepper-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0284C7, #059669);
    border-radius: var(--radius-full);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.stepper-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    z-index: 2;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 120px;
}

.step-circle {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #FFFFFF;
    border: 3px solid #CBD5E1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94A3B8;
    position: relative;
    transition: all var(--transition-normal);
}

.step-icon {
    width: 20px;
    height: 20px;
}

.check-icon {
    width: 22px;
    height: 22px;
    stroke: #FFFFFF;
}

.step-content {
    margin-top: 0.75rem;
}

.step-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
}

.step-sub {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 0.15rem;
}

/* Step States */
.step-item.step-done .step-circle {
    background: #059669;
    border-color: #059669;
    color: #FFFFFF;
}

.step-item.step-done .step-title {
    color: #059669;
}

.step-item.step-active .step-circle {
    background: #0284C7;
    border-color: #0284C7;
    color: #FFFFFF;
    box-shadow: 0 0 0 6px rgba(2, 132, 199, 0.2);
    animation: activeStepPulse 2.2s infinite;
}

@keyframes activeStepPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 6px rgba(2, 132, 199, 0.2); }
    50% { transform: scale(1.06); box-shadow: 0 0 0 10px rgba(2, 132, 199, 0.1); }
}

.step-item.step-active .step-title {
    color: #0284C7;
    font-weight: 800;
}

/* Timeline Historial */
.tracking-history-card {
    background: #FFFFFF;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
}

.history-title-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.history-title-row h3 {
    font-size: 1.15rem;
}

.timeline-list {
    position: relative;
    padding-left: 1.5rem;
}

.timeline-list::before {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 7px;
    width: 2px;
    background: #E2E8F0;
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -1.5rem;
    top: 3px;
}

.timeline-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #CBD5E1;
    border: 3px solid #FFFFFF;
    box-shadow: 0 0 0 1px #CBD5E1;
}

.timeline-item.timeline-current .timeline-dot {
    background: #0284C7;
    box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.25);
}

.timeline-body {
    padding-left: 0.5rem;
}

.timeline-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.timeline-step-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
}

.timeline-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.timeline-desc {
    font-size: 0.88rem;
    color: #475569;
    margin-top: 0.25rem;
}

.tracking-actions-bar {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ==========================================================================
   PRESCRIPTION MATRIX & OFTALMOLOGÍA FORM
   ========================================================================== */
.receta-matrix-card {
    background: #FFFFFF;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.receta-table {
    width: 100%;
    min-width: 650px;
    border-collapse: collapse;
}

.receta-table th, .receta-table td {
    padding: 0.75rem 0.85rem;
    text-align: center;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.receta-table th {
    background: #F1F5F9;
    font-weight: 700;
    color: var(--primary);
    font-family: var(--font-heading);
}

.receta-eye-header {
    font-weight: 800;
    font-size: 1rem;
    color: #FFFFFF;
}

.receta-od { background: #0369A1 !important; }
.receta-oi { background: #0F766E !important; }

.receta-input {
    width: 100%;
    min-width: 65px;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    padding: 0.5rem 0.25rem;
    border: 1px solid #CBD5E1;
    border-radius: var(--radius-sm);
    background: #FFFFFF;
    transition: all var(--transition-fast);
}

.receta-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* Custom Form Groups */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.4rem;
}

.form-label .required {
    color: var(--rose);
}

.form-control, .form-select {
    width: 100%;
    padding: 0.65rem 0.9rem;
    font-size: 0.92rem;
    font-family: inherit;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #FFFFFF;
    color: var(--text-main);
    transition: all var(--transition-fast);
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

/* File Upload Drag & Drop */
.upload-dropzone {
    border: 2px dashed #CBD5E1;
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    text-align: center;
    background: #F8FAFC;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.upload-dropzone:hover, .upload-dropzone.dragover {
    border-color: var(--accent);
    background: #E0F2FE;
}

.upload-icon {
    width: 40px;
    height: 40px;
    color: var(--accent);
    margin: 0 auto 0.5rem;
}

/* ==========================================================================
   DATA TABLES
   ========================================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: #FFFFFF;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.data-table th {
    background: #F8FAFC;
    color: var(--primary);
    font-weight: 700;
    font-family: var(--font-heading);
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: #334155;
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: #F8FAFC;
}

/* ==========================================================================
   FLASH ALERTS & TOASTS
   ========================================================================== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-error, .alert-danger { background: #FFE4E6; color: #9F1239; border: 1px solid #FECDD3; }
.alert-info { background: #E0F2FE; color: #075985; border: 1px solid #BAE6FD; }
.alert-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }

/* ==========================================================================
   MODAL DIALOGS
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    background: #FFFFFF;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 540px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform var(--transition-bounce);
}

.modal-backdrop.show .modal-card {
    transform: translateY(0);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    background: var(--primary);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.15rem;
    color: #FFFFFF;
}

.modal-close {
    background: none;
    border: none;
    color: #94A3B8;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: #FFFFFF;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    background: #F8FAFC;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 992px) {
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
    .layout-split { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
    .top-navbar {
        height: auto;
        min-height: 64px;
        padding: 0.75rem 1.25rem;
        flex-direction: column;
        align-items: stretch;
    }
    .nav-brand-container {
        display: flex;
        width: 100%;
        align-items: center;
        justify-content: space-between;
    }
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .mobile-menu-collapse {
        display: none;
        flex-direction: column;
        width: 100%;
        margin-left: 0;
        margin-top: 0.85rem;
        gap: 0.85rem;
        padding-top: 0.85rem;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
    .mobile-menu-collapse.show {
        display: flex;
    }
    .mobile-menu-collapse nav {
        width: 100%;
    }
    .nav-menu {
        flex-direction: column;
        width: 100%;
        align-items: stretch;
        gap: 0.45rem;
    }
    .nav-menu > li {
        width: 100%;
    }
    .nav-link {
        width: 100%;
        justify-content: flex-start;
        padding: 0.65rem 0.85rem;
        font-size: 0.92rem;
        border-radius: 8px;
    }
    .nav-cta-btn {
        width: 100%;
        justify-content: center;
        height: 38px;
        font-size: 0.88rem;
    }
    .nav-dropdown {
        width: 100%;
    }
    .nav-dropdown-toggle {
        width: 100%;
        justify-content: space-between;
    }
    .nav-dropdown-menu {
        position: static;
        width: 100%;
        min-width: 100%;
        box-shadow: none;
        background: rgba(15, 23, 42, 0.7);
        border: 1px solid rgba(255, 255, 255, 0.08);
        margin-top: 0.35rem;
        padding: 0.5rem;
        border-radius: 8px;
        display: none;
    }
    .nav-dropdown.is-open .nav-dropdown-menu {
        display: flex;
    }
    .user-dropdown-container {
        width: 100%;
        justify-content: space-between;
        margin-top: 0.25rem;
        padding-top: 0.85rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
    .layout-split { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .grid-cols-2, .grid-cols-3, .grid-cols-4 {
        grid-template-columns: 1fr;
    }
    .grid-radios, .grid-radios-2 {
        grid-template-columns: 1fr;
    }
    .grid-cols-5-sm {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }
    .stepper-steps {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    .stepper-progress-bar-bg {
        display: none;
    }
    .step-item {
        flex-direction: row;
        width: 100%;
        text-align: left;
        gap: 1rem;
    }
    .step-content {
        margin-top: 0;
    }
    .tracking-hero {
        flex-direction: column;
        text-align: center;
    }
}

/* ==========================================================================
   BOTONERA DE ESTADOS DE TALLER (1-CLIC DIRECTO)
   ========================================================================== */
.quick-status-btn-group {
    display: flex;
    gap: 3px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.btn-step {
    border: 1px solid #CBD5E1;
    background: #FFFFFF;
    color: #475569;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    transition: all 0.15s ease;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.3;
}

.btn-step:hover {
    background: #F1F5F9;
    border-color: #94A3B8;
    color: #0F172A;
    transform: translateY(-1px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-step.btn-step-active {
    font-weight: 800;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.btn-step.btn-step-active.is-recibido {
    background: #0284C7;
    color: #FFFFFF;
    border-color: #0284C7;
}

.btn-step.btn-step-active.is-taller {
    background: #D97706;
    color: #FFFFFF;
    border-color: #D97706;
}

.btn-step.btn-step-active.is-camino {
    background: #4F46E5;
    color: #FFFFFF;
    border-color: #4F46E5;
}

.btn-step.btn-step-active.is-entregado {
    background: #059669;
    color: #FFFFFF;
    border-color: #059669;
}

/* ==========================================================================
   IDENTIDAD OFICIAL: MARTÍN BICHARA E HIJOS / POINT LENTES MULTIFOCALES
   ========================================================================== */
.brand-spectrum-bar {
    height: 3px;
    background: var(--brand-spectrum);
    border-radius: 2px;
    width: 100%;
}

.brand-card-accent {
    position: relative;
    overflow: hidden;
}

.brand-card-accent::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--brand-spectrum);
    z-index: 2;
}

.brand-point-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.85rem;
    background: #0B132B;
    color: #FFFFFF;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid rgba(0, 174, 239, 0.35);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.brand-point-badge img {
    height: 18px;
    width: 18px;
    object-fit: contain;
}

.brand-hero-box {
    background: linear-gradient(135deg, #070E1E 0%, #0F1D36 100%);
    border-radius: var(--radius-xl);
    padding: 2rem 2.5rem;
    color: #FFFFFF;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-hero-box::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--brand-spectrum);
}

/* ==========================================================================
   Componente de Búsqueda y Autocompletado de Clientes por Código / Nombre
   ========================================================================== */
.client-search-wrapper {
    position: relative;
    width: 100%;
}

.client-search-input-group {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.client-search-icon {
    position: absolute;
    left: 0.85rem;
    color: #64748B;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.client-search-input {
    width: 100%;
    padding: 0.7rem 2.2rem 0.7rem 2.6rem;
    font-size: 0.95rem;
    font-weight: 500;
    border: 2px solid #38BDF8;
    border-radius: var(--radius-md);
    background: #FFFFFF;
    color: #0F172A;
    box-shadow: 0 2px 6px rgba(56, 189, 248, 0.12);
    transition: all 0.2s ease;
}

.client-search-input:focus {
    outline: none;
    border-color: #0284C7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.25);
}

.btn-clear-client-search {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    color: #94A3B8;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: color 0.15s ease;
    z-index: 2;
}

.btn-clear-client-search:hover {
    color: #0F172A;
    background: rgba(0, 0, 0, 0.05);
}

.client-search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 1050;
    margin: 0;
    padding: 0.35rem 0;
    list-style: none;
}

.client-search-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.95rem;
    cursor: pointer;
    border-bottom: 1px solid #F1F5F9;
    transition: background 0.15s ease;
    gap: 0.75rem;
}

.client-search-item:last-child {
    border-bottom: none;
}

.client-search-item:hover,
.client-search-item.active {
    background: #F0F9FF;
}

.client-code-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    background: #0284C7;
    color: #FFFFFF;
    font-weight: 700;
    font-size: 0.8rem;
    border-radius: 4px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.client-code-badge-subtle {
    background: #E0F2FE;
    color: #0369A1;
    border: 1px solid #BAE6FD;
}

.client-selected-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #F0F9FF 0%, #E0F2FE 100%);
    border: 2px solid #38BDF8;
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.12);
    gap: 0.75rem;
}

.client-selected-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.client-selected-name {
    font-size: 1rem;
    font-weight: 700;
    color: #0369A1;
}

.client-selected-sub {
    font-size: 0.8rem;
    color: #475569;
}

/* ==========================================================================
   Componente de Búsqueda y Autocompletado de Cristales / Productos por Código
   ========================================================================== */
.product-search-wrapper {
    position: relative;
    width: 100%;
}

.product-search-input-group {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.product-search-icon {
    position: absolute;
    left: 0.85rem;
    color: #64748B;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.product-search-input {
    width: 100%;
    padding: 0.7rem 2.2rem 0.7rem 2.6rem;
    font-size: 0.92rem;
    font-weight: 500;
    border: 2px solid #38BDF8;
    border-radius: var(--radius-md);
    background: #FFFFFF;
    color: #0F172A;
    box-shadow: 0 2px 6px rgba(56, 189, 248, 0.12);
    transition: all 0.2s ease;
}

.product-search-input:focus {
    outline: none;
    border-color: #0284C7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.25);
}

.product-search-input-green {
    border-color: #34D399;
    box-shadow: 0 2px 6px rgba(52, 211, 153, 0.12);
}

.product-search-input-green:focus {
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.25);
}

.btn-clear-product-search {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    color: #94A3B8;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: color 0.15s ease;
    z-index: 2;
}

.btn-clear-product-search:hover {
    color: #0F172A;
    background: rgba(0, 0, 0, 0.05);
}

.product-search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    border-radius: var(--radius-md);
    box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 1050;
    margin: 0;
    padding: 0.35rem 0;
    list-style: none;
}

.product-search-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.95rem;
    cursor: pointer;
    border-bottom: 1px solid #F1F5F9;
    transition: background 0.15s ease;
    gap: 0.75rem;
}

.product-search-item:last-child {
    border-bottom: none;
}

.product-search-item:hover,
.product-search-item.active {
    background: #F0F9FF;
}

.product-search-item.active-green:hover,
.product-search-item.active-green.active {
    background: #ECFDF5;
}

.product-code-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    background: #0284C7;
    color: #FFFFFF;
    font-weight: 700;
    font-size: 0.8rem;
    border-radius: 4px;
    letter-spacing: 0.5px;
    font-family: var(--font-mono);
    flex-shrink: 0;
}

.product-code-badge-green {
    background: #059669;
}

.product-selected-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #F0F9FF 0%, #E0F2FE 100%);
    border: 2px solid #38BDF8;
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.12);
    gap: 0.75rem;
}

.product-selected-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.product-selected-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0369A1;
}

.product-selected-sub {
    font-size: 0.78rem;
    color: #475569;
}



