/* ============================================================
   FARMAEXCHANGE - Estilos CSS
   ============================================================ */

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #dbeafe;
    --secondary: #10b981;
    --secondary-dark: #059669;
    --secondary-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-lg: 16px;
}

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

/* Clase global para ocultar elementos */
.hidden {
    display: none !important;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--gray-50) 0%, #e0f2fe 100%);
    min-height: 100vh;
    color: var(--gray-800);
}

/* ============================================================
   LAYOUT - TOPBAR (Horizontal Navigation)
   ============================================================ */

.app-container {
    display: flex;
}

/* Topbar Layout Mode */
.app-container.app-topbar {
    flex-direction: column;
}

/* ============================================================
   TOPBAR STYLES
   ============================================================ */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--gray-200);
    padding: 0 16px;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-logo {
    height: 32px;
    width: auto;
}

.topbar-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    display: none;
}

@media (min-width: 1200px) {
    .topbar-title {
        display: block;
    }
}

/* Navigation Items */
.topbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
    overflow-x: auto;
    padding: 0 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.topbar-nav::-webkit-scrollbar {
    display: none;
}

.topbar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    color: var(--gray-500);
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    position: relative;
    min-width: 64px;
}

.topbar-item:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.topbar-item.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.topbar-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.topbar-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

@media (max-width: 900px) {
    .topbar-label {
        display: none;
    }
    .topbar-item {
        min-width: 44px;
        padding: 10px;
    }
}

.topbar-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    background: var(--danger);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar-badge.hidden {
    display: none;
}

.topbar-item.active .topbar-badge {
    background: white;
    color: var(--primary);
}

/* Right Section */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.topbar-farmacia select {
    padding: 8px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.8rem;
    background: white;
    cursor: pointer;
    color: var(--gray-700);
    max-width: 180px;
}

.topbar-farmacia select:hover {
    border-color: var(--primary);
}

.topbar-farmacia select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

@media (max-width: 768px) {
    .topbar-farmacia select {
        max-width: 120px;
        font-size: 0.75rem;
        padding: 6px 8px;
    }
}

.topbar-notif {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: var(--gray-100);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.topbar-notif:hover {
    background: var(--gray-200);
}

.topbar-notif svg {
    width: 20px;
    height: 20px;
    color: var(--gray-600);
}

/* Hide old sidebar in topbar mode */
.app-topbar .sidebar {
    display: none;
}

/* ============================================================
   OLD SIDEBAR STYLES (kept for compatibility)
   ============================================================ */

.sidebar {
    width: 240px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--gray-100);
    text-align: center;
}

.logo-img {
    max-width: 180px;
    height: auto;
    margin-bottom: 5px;
}

.logo {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-subtitle {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 5px;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--gray-600);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.nav-item:hover {
    background: var(--gray-100);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow);
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item span:not(.nav-badge) {
    flex: 1;
    text-align: left;
}

.nav-badge {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item.active .nav-badge {
    background: rgba(255,255,255,0.25);
    color: white;
}

.nav-badge.hidden {
    display: none;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--gray-100);
}

.farmacia-selector {
    margin-bottom: 12px;
}

.farmacia-selector label {
    display: block;
    font-size: 0.7rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.farmacia-selector select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.8rem;
    background: white;
    cursor: pointer;
    color: var(--gray-700);
}

.farmacia-selector select:hover {
    border-color: var(--primary);
}

.farmacia-selector select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.farmacia-info {
    background: var(--gray-50);
    padding: 10px 12px;
    border-radius: var(--radius);
}

.farmacia-label {
    font-size: 0.7rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.farmacia-nombre {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 0.85rem;
}

.farmacia-codigo {
    font-size: 0.7rem;
    color: var(--gray-500);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 24px;
    overflow-y: auto;
}

/* Topbar layout adjustments */
.app-topbar .main-content {
    margin-left: 0;
    padding: 20px;
}

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

/* Hide main-header in topbar mode (integrated into topbar) */
.app-topbar .main-header {
    display: none;
}

.header-title h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-800);
}

.header-subtitle {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-top: 4px;
}

.btn-icon {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    border: none;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

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

.btn-icon svg {
    width: 22px;
    height: 22px;
    color: var(--gray-600);
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   SECTIONS
   ============================================================ */

.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

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

.stat-card.highlight {
    background: linear-gradient(135deg, var(--warning-light) 0%, #fef9c3 100%);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-800);
}

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

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.action-card {
    padding: 32px;
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.action-card.blue {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.action-card.green {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
    color: white;
}

.action-card:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

.action-icon {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.2);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.action-icon svg {
    width: 24px;
    height: 24px;
}

.action-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.action-card p {
    opacity: 0.8;
    font-size: 0.9rem;
}

/* Alert Box */
.alert-box {
    background: var(--warning-light);
    border: 1px solid #fcd34d;
    border-radius: var(--radius-lg);
    padding: 20px;
}

.alert-box.hidden {
    display: none;
}

.alert-box h4 {
    color: #92400e;
    font-size: 1rem;
    margin-bottom: 12px;
}

/* ============================================================
   FILTER BAR
   ============================================================ */

.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    background: white;
    padding: 16px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.filter-search {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.filter-search svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--gray-400);
}

.filter-search input {
    width: 100%;
    padding: 10px 14px 10px 42px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.filter-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.filter-bar select {
    padding: 10px 32px 10px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E") no-repeat right 10px center;
    background-size: 16px;
    cursor: pointer;
    appearance: none;
    min-width: 160px;
}

.filter-bar select:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-bar select:not([value=""]):not(:first-child) {
    border-color: var(--primary);
    background-color: var(--primary-light);
}

.btn-clear-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--gray-100);
    color: var(--gray-600);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-clear-filters:hover {
    background: var(--gray-200);
}

.btn-clear-filters svg {
    width: 16px;
    height: 16px;
}

.result-count {
    font-size: 0.9rem;
    color: var(--gray-500);
    margin-bottom: 16px;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-primary svg {
    width: 18px;
    height: 18px;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--gray-100);
    color: var(--gray-700);
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-success {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-danger {
    background: var(--danger-light);
    color: var(--danger);
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* ============================================================
   PRODUCTS GRID
   ============================================================ */

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.product-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.product-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.product-image {
    aspect-ratio: 16/10;
    background: var(--gray-100);
    position: relative;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-badge {
    position: absolute;
    top: 10px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

.product-badge.left {
    left: 10px;
    background: rgba(255,255,255,0.95);
    color: var(--gray-700);
}

.product-badge.right {
    right: 10px;
}

.product-badge.active {
    background: var(--secondary);
    color: white;
}

.product-badge.warning {
    background: var(--warning);
    color: white;
}

.product-badge.superfamilia {
    bottom: 10px;
    top: auto;
    left: 10px;
    background: rgba(0,0,0,0.6);
    color: white;
}

.product-info {
    padding: 16px;
}

.product-familia {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 4px;
}

.product-name {
    font-weight: 700;
    color: var(--gray-800);
    font-size: 0.95rem;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-lab {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-bottom: 12px;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.product-price.green {
    color: var(--secondary);
}

/* Contenedor de precio con descuento */
.product-price-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.product-price-original {
    font-size: 0.9rem;
    color: var(--gray-400);
    text-decoration: line-through;
}

.product-discount-badge {
    background: var(--danger);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
}

.product-stock {
    font-size: 0.75rem;
    color: var(--gray-400);
}

.product-actions {
    display: flex;
    gap: 8px;
}

.btn-add-cart {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-cart:hover {
    background: var(--primary-dark);
}

.btn-add-cart svg {
    width: 16px;
    height: 16px;
}

.btn-delete {
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.btn-delete:hover {
    background: var(--danger-light);
}

.btn-delete svg {
    width: 18px;
    height: 18px;
}

/* Farmacia info en producto */
.product-farmacia {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-bottom: 8px;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: var(--radius-lg);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--gray-300);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.25rem;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--gray-500);
    margin-bottom: 20px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--gray-500);
}

/* ============================================================
   CART
   ============================================================ */

.cart-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-item {
    display: flex;
    gap: 16px;
    background: white;
    padding: 16px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: var(--radius);
    object-fit: cover;
    background: var(--gray-100);
}

.cart-item-info {
    flex: 1;
}

.cart-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.cart-item-name {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 0.95rem;
}

.cart-item-farmacia {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.cart-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.cart-quantity {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-quantity button {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: var(--gray-100);
    cursor: pointer;
    font-size: 1rem;
}

.cart-quantity span {
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

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

.cart-summary {
    background: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 24px;
}

.cart-summary h3 {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.summary-row.total {
    border-top: 1px solid var(--gray-200);
    padding-top: 12px;
    margin-top: 12px;
    font-size: 1.1rem;
    font-weight: 700;
}

.summary-row.total span:last-child {
    color: var(--primary);
}

.cart-summary .btn-primary {
    width: 100%;
    justify-content: center;
    margin-top: 20px;
    padding: 14px;
}

.cart-summary-note {
    font-size: 0.75rem;
    color: var(--gray-400);
    text-align: center;
    margin-top: 12px;
}

/* Carrito agrupado por farmacia */
.carrito-grupo-farmacia {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    overflow: hidden;
}

.carrito-grupo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.carrito-grupo-farmacia-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.carrito-grupo-nombre {
    font-weight: 600;
    font-size: 1rem;
}

.carrito-grupo-total {
    font-weight: 700;
    font-size: 1.1rem;
}

.carrito-grupo-items {
    padding: 16px;
}

.carrito-grupo-items .cart-item {
    border: none;
    box-shadow: none;
    border-bottom: 1px solid var(--gray-100);
    border-radius: 0;
    margin-bottom: 0;
}

.carrito-grupo-items .cart-item:last-child {
    border-bottom: none;
}

.cart-item-cod {
    font-size: 0.75rem;
    color: var(--gray-400);
}

.carrito-grupo-footer {
    padding: 16px 20px;
    border-top: 2px solid var(--gray-200);
    background: var(--gray-50);
}

.carrito-grupo-resumen {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--gray-300);
}

.carrito-grupo-resumen-linea {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--gray-600);
    margin-bottom: 4px;
}

.carrito-grupo-resumen-linea.total {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0;
    padding-top: 4px;
}

.carrito-grupo-resumen-linea.total span:last-child {
    color: var(--primary);
}

.btn-enviar-pedido {
    width: 100%;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
}

.btn-enviar-pedido svg {
    flex-shrink: 0;
}

/* ============================================================
   ORDERS LIST
   ============================================================ */

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

.order-card {
    background: white;
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.order-card.pending {
    border: 2px solid var(--warning);
}

.order-card.no-visto {
    border-left: 4px solid var(--primary);
    background: linear-gradient(135deg, #f0f9ff, white);
}

.nuevo-badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    vertical-align: middle;
    animation: pulse 2s infinite;
}

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

.alerta-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #dbeafe, #eff6ff);
    border: 1px solid #93c5fd;
    border-radius: var(--radius);
    margin-bottom: 16px;
    color: #1e40af;
    font-size: 0.9rem;
}

.alerta-info svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

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

.order-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.order-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.order-icon.blue {
    background: var(--primary-light);
    color: var(--primary);
}

.order-icon.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.order-icon.green {
    background: var(--secondary-light);
    color: var(--secondary);
}

.order-icon svg {
    width: 22px;
    height: 22px;
}

.order-number {
    font-weight: 700;
    color: var(--gray-800);
}

.order-meta {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.order-status-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.order-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.order-badge.pendiente {
    background: var(--warning-light);
    color: #92400e;
}

.order-badge.confirmado {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.order-badge.enviado {
    background: #cffafe;
    color: #0e7490;
}

.order-badge.recibido {
    background: var(--secondary-light);
    color: var(--secondary-dark);
}

.order-badge.cancelado {
    background: var(--danger-light);
    color: var(--danger);
}

.order-total {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gray-800);
}

.order-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--gray-100);
    margin-top: 12px;
}

.order-products {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.order-actions {
    display: flex;
    gap: 8px;
}

/* ============================================================
   CONFIG / FARMACIAS / GRUPOS
   ============================================================ */

.config-section {
    background: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.config-section h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.config-description {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* Lista de grupos */
.grupos-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.grupo-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-light) 0%, #e0f2fe 100%);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
}

.grupo-icon {
    width: 48px;
    height: 48px;
    background: var(--primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 0.8rem;
}

.grupo-info {
    flex: 1;
}

.grupo-nombre {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 1rem;
}

.grupo-meta {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-top: 2px;
}

/* Lista de farmacias */
.farmacias-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.farmacia-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.farmacia-data {
    display: flex;
    align-items: center;
    gap: 14px;
}

.farmacia-avatar {
    width: 44px;
    height: 44px;
    background: var(--primary-light);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--primary);
    font-size: 0.9rem;
}

.farmacia-card-name {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 0.95rem;
}

.farmacia-card-city {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.farmacia-badges {
    display: flex;
    gap: 8px;
    align-items: center;
}

.badge-grupo {
    padding: 4px 10px;
    background: var(--secondary-light);
    color: var(--secondary-dark);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-productos {
    padding: 4px 10px;
    background: var(--gray-200);
    color: var(--gray-600);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.empty-state-mini {
    text-align: center;
    padding: 24px;
    color: var(--gray-500);
}

.empty-state-mini p {
    margin: 4px 0;
}

.empty-state-mini .text-sm {
    font-size: 0.85rem;
    color: var(--gray-400);
}

/* ============================================================
   MÉTODOS DE COBRO
   ============================================================ */

.metodos-cobro-container {
    margin-top: 20px;
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.metodos-cobro-lista {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.metodo-cobro-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: white;
    border-radius: var(--radius-lg);
    border: 2px solid var(--gray-200);
    transition: all 0.2s ease;
}

.metodo-cobro-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.metodo-cobro-card.inactivo {
    opacity: 0.5;
    background: var(--gray-50);
    border-style: dashed;
}

.metodo-cobro-card.inactivo:hover {
    transform: none;
    box-shadow: none;
}

.metodo-cobro-icon {
    font-size: 2rem;
    min-width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-light), var(--gray-100));
    border-radius: 12px;
    border: none;
}

.metodo-cobro-card.inactivo .metodo-cobro-icon {
    background: var(--gray-100);
    filter: grayscale(1);
}

.metodo-cobro-info {
    flex: 1;
    min-width: 0;
}

.metodo-cobro-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.metodo-cobro-nombre {
    font-weight: 700;
    color: var(--gray-800);
    font-size: 1rem;
}

.badge-inactivo {
    padding: 3px 10px;
    background: var(--gray-200);
    color: var(--gray-500);
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metodo-cobro-detalle {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin: 0;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    background: var(--gray-50);
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

.metodo-cobro-instrucciones {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-style: italic;
    margin: 8px 0 0 0;
    padding-left: 12px;
    border-left: 2px solid var(--gray-200);
}

.metodo-cobro-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.metodo-cobro-actions .btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    color: var(--gray-500);
    transition: all 0.2s ease;
}

.metodo-cobro-actions .btn-icon:hover {
    background: var(--gray-100);
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.metodo-cobro-actions .btn-danger-icon:hover {
    background: var(--danger-light, #fee2e2);
    color: var(--danger);
    border-color: var(--danger);
}

.btn-add-metodo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    width: 100%;
    font-weight: 600;
    border-radius: var(--radius-lg);
}

.btn-add-metodo svg {
    flex-shrink: 0;
}

.empty-state-mini {
    text-align: center;
    padding: 32px 20px;
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--gray-300);
}

.empty-state-mini p {
    margin: 0;
    color: var(--gray-500);
}

.empty-state-mini p:first-child {
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 4px;
}

.empty-state-mini .text-sm {
    font-size: 0.85rem;
}

/* Modal método cobro */
.campos-metodo {
    margin-top: 16px;
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

.campos-metodo .form-group {
    margin-bottom: 12px;
}

.campos-metodo .form-group:last-child {
    margin-bottom: 0;
}

.form-hint {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin: 8px 0;
    padding: 12px;
    background: var(--gray-100);
    border-radius: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Métodos de cobro en detalle de pedido */
.metodos-pago-vendedor {
    margin-top: 20px;
    padding: 16px;
    background: var(--primary-light);
    border-radius: var(--radius);
    border: 1px solid var(--primary);
}

.metodos-pago-vendedor h4 {
    color: var(--primary-dark);
    margin-bottom: 12px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.metodos-pago-lista {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.metodo-pago-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--white);
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}

.metodo-pago-item .icono {
    font-size: 1.4rem;
}

.metodo-pago-item .info {
    flex: 1;
}

.metodo-pago-item .tipo {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-800);
}

.metodo-pago-item .detalle {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-top: 2px;
}

.metodo-pago-item .instrucciones {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-style: italic;
    margin-top: 4px;
}

/* Modal Confirmar Pedido - Selector de método de pago */
.modal-intro {
    color: var(--gray-600);
    margin-bottom: 16px;
}

.confirmar-pedido-farmacias {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.confirmar-pedido-farmacia {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--gray-200);
}

.confirmar-pedido-farmacia .farmacia-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--gray-200);
}

.confirmar-pedido-farmacia .farmacia-nombre {
    font-weight: 600;
    color: var(--gray-800);
}

.confirmar-pedido-farmacia .farmacia-total {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
}

.metodos-pago-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.metodos-pago-titulo {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin-bottom: 4px;
}

.metodo-pago-opcion {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--white);
    border-radius: 8px;
    border: 2px solid var(--gray-200);
    cursor: pointer;
    transition: all 0.2s ease;
}

.metodo-pago-opcion:hover {
    border-color: var(--primary-light);
    background: var(--gray-50);
}

.metodo-pago-opcion input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.metodo-pago-opcion input[type="radio"]:checked + .metodo-pago-contenido {
    color: var(--primary);
}

.metodo-pago-opcion:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
}

.metodo-pago-contenido {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.metodo-pago-contenido .icono {
    font-size: 1.5rem;
}

.metodo-pago-contenido .info {
    display: flex;
    flex-direction: column;
}

.metodo-pago-contenido .tipo {
    font-weight: 600;
    font-size: 0.95rem;
}

.metodo-pago-contenido .detalle {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.sin-metodos {
    color: var(--gray-500);
    font-style: italic;
    padding: 12px;
    background: var(--warning-light);
    border-radius: 8px;
    text-align: center;
}

/* Permisos (mantenido por compatibilidad) */
.farmacia-permisos {
    display: flex;
    gap: 24px;
}

.permiso-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.permiso-toggle span {
    font-size: 0.8rem;
    color: var(--gray-600);
}

/* ============================================================
   MODAL
   ============================================================ */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.modal.modal-superior {
    z-index: 1100;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-large {
    width: 100%;
    max-width: 1100px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
}

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

.modal-subtitle {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.btn-close {
    padding: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--gray-500);
    border-radius: var(--radius);
}

.btn-close:hover {
    background: var(--gray-100);
}

.btn-close svg {
    width: 20px;
    height: 20px;
}

.modal-filters {
    padding: 10px 16px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.filter-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.modal-filters .filter-search {
    flex: 1;
    min-width: 150px;
    max-width: 200px;
}

.modal-filters .filter-search input {
    padding: 6px 10px 6px 32px;
    font-size: 0.8rem;
}

.modal-filters .filter-search svg {
    left: 10px;
    width: 14px;
    height: 14px;
}

.modal-filters select {
    padding: 6px 24px 6px 8px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 0.75rem;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E") no-repeat right 4px center;
    background-size: 12px;
    appearance: none;
    cursor: pointer;
    max-width: 120px;
}

/* Selector de vista */
.view-selector {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    padding: 3px;
    background: white;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
}

.view-label {
    font-size: 0.7rem;
    color: var(--gray-500);
    padding-left: 4px;
}

.view-btn {
    padding: 5px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    color: var(--gray-400);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn:hover {
    background: var(--gray-100);
    color: var(--primary);
}

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

.view-btn svg {
    width: 14px;
    height: 14px;
    display: block;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 12px 20px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* ============================================================
   VISTAS DE PRODUCTOS EN MODAL
   ============================================================ */

.productos-container {
    min-height: 200px;
}

/* Vista Mini (Iconos MUY pequeños) */
.view-mini {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
    gap: 6px;
}

.view-mini .med-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 4px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    position: relative;
    background: white;
}

.view-mini .med-item:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.view-mini .med-item.publicado {
    border-color: var(--secondary);
    background: var(--secondary-light);
}

.view-mini .med-img {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--gray-100);
    margin-bottom: 4px;
}

.view-mini .med-name {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--gray-700);
    line-height: 1.15;
    max-height: 2.3em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 2px;
    word-break: break-word;
}

.view-mini .med-price {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--primary);
}

.view-mini .med-stock {
    font-size: 0.55rem;
    color: var(--gray-400);
}

.view-mini .med-check {
    display: none;
}

.view-mini .med-item.publicado .med-check {
    display: flex;
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: var(--secondary);
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    color: white;
}

.view-mini .med-check svg {
    width: 8px;
    height: 8px;
}

/* Vista Grid (Tarjetas pequeñas) */
.view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}

.view-grid .med-item {
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.15s;
    cursor: pointer;
    background: white;
}

.view-grid .med-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.view-grid .med-item.publicado {
    border-color: var(--secondary);
    background: var(--secondary-light);
}

.view-grid .med-img {
    width: 100%;
    height: 60px;
    object-fit: cover;
    background: var(--gray-100);
}

.view-grid .med-content {
    padding: 6px 8px;
}

.view-grid .med-badges {
    display: none;
}

.view-grid .med-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gray-800);
    line-height: 1.2;
    max-height: 2.4em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 2px;
}

.view-grid .med-lab {
    font-size: 0.6rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.view-grid .med-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid var(--gray-100);
}

.view-grid .med-price {
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--primary);
}

.view-grid .med-stock {
    font-size: 0.6rem;
    color: var(--gray-500);
}

.view-grid .btn-pub {
    padding: 3px 6px;
    font-size: 0.6rem;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: var(--primary);
    color: white;
    transition: all 0.15s;
}

.view-grid .btn-pub:hover {
    background: var(--primary-dark);
}

.view-grid .med-item.publicado .btn-pub {
    background: var(--secondary);
    pointer-events: none;
}

/* Vista Lista */
.view-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.view-list .med-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    transition: all 0.15s;
    cursor: pointer;
    background: white;
}

.view-list .med-item:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.view-list .med-item.publicado {
    border-color: var(--secondary);
    background: var(--secondary-light);
}

.view-list .med-img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--gray-100);
    flex-shrink: 0;
}

.view-list .med-main {
    flex: 1;
    min-width: 0;
}

.view-list .med-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.view-list .med-meta {
    font-size: 0.65rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.view-list .med-price {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.8rem;
    margin-right: 10px;
    white-space: nowrap;
}

.view-list .med-stock {
    font-size: 0.65rem;
    color: var(--gray-500);
    margin-right: 10px;
    white-space: nowrap;
}

.view-list .btn-pub {
    padding: 4px 10px;
    font-size: 0.65rem;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: var(--primary);
    color: white;
    white-space: nowrap;
}

.view-list .btn-pub:hover {
    background: var(--primary-dark);
}

.view-list .med-item.publicado .btn-pub {
    background: var(--secondary);
    pointer-events: none;
}

/* Vista Detalle */
.view-detail {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.view-detail .med-item {
    display: flex;
    gap: 12px;
    padding: 10px;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    transition: all 0.15s;
    cursor: pointer;
    background: white;
}

.view-detail .med-item:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.view-detail .med-item.publicado {
    border-color: var(--secondary);
    background: var(--secondary-light);
}

.view-detail .med-img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--gray-100);
    flex-shrink: 0;
}

.view-detail .med-main {
    flex: 1;
    min-width: 0;
}

.view-detail .med-badges {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.view-detail .med-badge {
    padding: 2px 6px;
    font-size: 0.6rem;
    font-weight: 500;
    border-radius: 3px;
}

.view-detail .med-badge.sf {
    background: var(--gray-200);
    color: var(--gray-700);
}

.view-detail .med-badge.f {
    background: var(--primary-light);
    color: var(--primary);
}

.view-detail .med-badge.lab {
    background: var(--warning-light);
    color: var(--warning);
}

.view-detail .med-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 2px;
}

.view-detail .med-lab {
    font-size: 0.7rem;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.view-detail .med-stats {
    display: flex;
    gap: 16px;
}

.view-detail .med-stat {
    display: flex;
    flex-direction: column;
}

.view-detail .med-stat-label {
    font-size: 0.55rem;
    color: var(--gray-400);
    text-transform: uppercase;
}

.view-detail .med-stat-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gray-800);
}

.view-detail .med-stat-value.price {
    color: var(--primary);
}

.view-detail .med-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    gap: 4px;
}

.view-detail .btn-pub {
    padding: 6px 14px;
    font-size: 0.7rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: var(--primary);
    color: white;
    transition: all 0.15s;
}

.view-detail .btn-pub:hover {
    background: var(--primary-dark);
}

.view-detail .med-item.publicado .btn-pub {
    background: var(--secondary);
    pointer-events: none;
}

/* Responsive modal */
@media (max-width: 768px) {
    .modal {
        padding: 0;
    }
    
    .modal-content {
        max-height: 100vh;
        border-radius: 0;
    }
    
    .modal-large {
        max-width: 100%;
    }
    
    .filter-row {
        flex-direction: column;
    }
    
    .view-mini {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    
    .view-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    
    .view-list .med-item {
        flex-wrap: wrap;
    }
    
    .view-list .med-main {
        flex: 1 1 100%;
        order: 1;
    }
    
    .view-detail .med-item {
        flex-direction: column;
    }
    
    .view-detail .med-img {
        width: 100%;
        height: 120px;
    }
}

.medicamento-publicado {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--secondary);
    font-size: 0.8rem;
    font-weight: 600;
}

.medicamento-publicado svg {
    width: 16px;
    height: 16px;
}

.btn-publicar {
    padding: 6px 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-publicar:hover {
    background: var(--primary-dark);
}

/* ============================================================
   TOAST
   ============================================================ */

.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 14px 20px;
    border-radius: var(--radius);
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
    z-index: 2000;
    animation: toastIn 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.toast.hidden {
    display: none;
}

.toast.success {
    background: var(--secondary);
}

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

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

/* ============================================================
   SECTION HEADER
   ============================================================ */

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

.section-header .header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

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

.header-actions {
    position: relative;
}

.btn-icon {
    position: relative;
    padding: 10px;
    border: none;
    background: var(--gray-100);
    border-radius: 10px;
    cursor: pointer;
    color: var(--gray-600);
    transition: all 0.15s;
}

.btn-icon:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

.btn-icon svg {
    width: 22px;
    height: 22px;
}

.notif-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notif-badge.hidden {
    display: none;
}

/* Panel de notificaciones */
.notif-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    max-height: 480px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 1000;
    overflow: hidden;
}

.notif-panel.hidden {
    display: none;
}

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--gray-100);
}

.notif-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.btn-text {
    border: none;
    background: none;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
}

.btn-text:hover {
    text-decoration: underline;
}

.notif-list {
    max-height: 400px;
    overflow-y: auto;
}

.notif-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--gray-400);
    font-size: 0.9rem;
}

.notif-item {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-50);
    cursor: pointer;
    transition: background 0.15s;
}

.notif-item:hover {
    background: var(--gray-50);
}

.notif-item.no-leida {
    background: var(--primary-light);
}

.notif-item.no-leida:hover {
    background: #e0e7ff;
}

.notif-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.notif-icon.confirmado { background: #dcfce7; }
.notif-icon.preparando { background: #fef3c7; }
.notif-icon.enviado { background: #dbeafe; }
.notif-icon.recibido { background: #d1fae5; }
.notif-icon.cancelado { background: #fee2e2; }
.notif-icon.nuevo { background: var(--primary-light); }

.notif-content {
    flex: 1;
    min-width: 0;
}

.notif-titulo {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 2px;
}

.notif-mensaje {
    font-size: 0.8rem;
    color: var(--gray-500);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-fecha {
    font-size: 0.7rem;
    color: var(--gray-400);
    margin-top: 4px;
}

/* ============================================================
   MODAL GESTIÓN DE VENTAS
   ============================================================ */

.venta-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 16px;
    background: var(--gray-50);
    border-radius: 10px;
    margin-bottom: 20px;
}

.venta-info .label {
    display: block;
    font-size: 0.7rem;
    color: var(--gray-400);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.venta-info .value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
}

.venta-estado-actual {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.venta-estado-actual .label {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.estado-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.estado-badge.pendiente {
    background: #fef3c7;
    color: #92400e;
}

.estado-badge.confirmado {
    background: #dbeafe;
    color: #1e40af;
}

.estado-badge.preparando {
    background: #e0e7ff;
    color: #4338ca;
}

.estado-badge.enviado {
    background: #d1fae5;
    color: #065f46;
}

.estado-badge.recibido {
    background: #dcfce7;
    color: #166534;
}

.estado-badge.cancelado {
    background: #fee2e2;
    color: #991b1b;
}

.venta-lineas {
    margin-bottom: 20px;
}

.venta-lineas h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 10px;
}

.linea-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--gray-50);
    border-radius: 8px;
    margin-bottom: 6px;
}

.linea-nombre {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-700);
}

.linea-detalle {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.linea-precio {
    font-weight: 600;
    color: var(--primary);
}

.venta-acciones h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 12px;
}

.estado-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-estado {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 2px solid var(--gray-200);
    background: white;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-estado:hover {
    border-color: var(--gray-300);
    background: var(--gray-50);
}

.btn-estado.confirmar {
    border-color: #93c5fd;
    color: #1e40af;
}
.btn-estado.confirmar:hover {
    background: #dbeafe;
}

.btn-estado.preparar {
    border-color: #c4b5fd;
    color: #5b21b6;
}
.btn-estado.preparar:hover {
    background: #ede9fe;
}

.btn-estado.enviar {
    border-color: #6ee7b7;
    color: #065f46;
}
.btn-estado.enviar:hover {
    background: #d1fae5;
}

.btn-estado.cancelar {
    border-color: #fca5a5;
    color: #991b1b;
}
.btn-estado.cancelar:hover {
    background: #fee2e2;
}

.btn-estado:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-estado svg {
    width: 18px;
    height: 18px;
}

.venta-envio,
.venta-cancelacion {
    margin-top: 16px;
    padding: 16px;
    background: var(--gray-50);
    border-radius: 10px;
}

.venta-envio-info {
    margin-top: 16px;
    padding: 16px;
    background: linear-gradient(135deg, #e0f2fe, #f0f9ff);
    border-radius: 10px;
    border-left: 4px solid var(--primary);
}

.venta-envio-info p {
    margin: 6px 0;
    font-size: 0.9rem;
    color: var(--gray-700);
}

.venta-envio-info p strong {
    color: var(--gray-900);
}

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

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

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

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cart-layout {
        grid-template-columns: 1fr;
    }
    
    .cart-summary {
        position: static;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .filter-bar {
        flex-direction: column;
    }
    
    .filter-bar select {
        width: 100%;
    }
    
    .medicamentos-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   PANEL DE ADMINISTRACIÓN
   ============================================================ */

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

.admin-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

.admin-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
}

.admin-grupos {
    display: grid;
    gap: 16px;
}

.admin-grupo-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.grupo-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.grupo-info h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0 0 4px 0;
}

.grupo-codigo {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-family: monospace;
}

.grupo-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    background: white;
    color: var(--gray-600);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--gray-50);
    color: var(--gray-900);
}

.btn-danger-icon:hover {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.grupo-descripcion {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin: 0 0 16px 0;
}

.grupo-farmacias {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 12px;
}

.farmacias-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-600);
    display: block;
    margin-bottom: 8px;
}

.farmacias-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.farmacia-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: white;
    border: 1px solid var(--gray-200);
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--gray-700);
}

.tag-remove {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
    margin-left: 2px;
}

.tag-remove:hover {
    color: #dc2626;
}

.no-farmacias {
    font-size: 0.85rem;
    color: var(--gray-400);
    font-style: italic;
}

/* Tabla de farmacias */
.farmacias-table {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.table-header {
    display: grid;
    grid-template-columns: 100px 1fr 150px 1fr;
    gap: 16px;
    padding: 12px 16px;
    background: var(--gray-50);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-row {
    display: grid;
    grid-template-columns: 100px 1fr 150px 1fr;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.9rem;
    align-items: center;
}

.table-row:last-child {
    border-bottom: none;
}

.table-row:hover {
    background: var(--gray-50);
}

.table-row .farmacia-codigo {
    font-family: monospace;
    font-weight: 600;
    color: var(--primary);
}

.table-row .farmacia-nombre {
    font-weight: 500;
    color: var(--gray-900);
}

.table-row .farmacia-ciudad {
    color: var(--gray-600);
}

.table-row .farmacia-grupos {
    font-size: 0.85rem;
    color: var(--gray-600);
}

.table-row .farmacia-grupos em {
    color: var(--gray-400);
}

/* Modal estilos adicionales */
.modal-small {
    max-width: 400px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.farmacias-checkboxes {
    max-height: 250px;
    overflow-y: auto;
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 12px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s ease;
}

.checkbox-item:hover {
    background: white;
}

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

.checkbox-item span {
    font-size: 0.9rem;
    color: var(--gray-700);
}

.btn-danger {
    background: #dc2626;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* Admin section spacing */
.admin-section {
    margin-top: 32px;
}

@media (max-width: 768px) {
    .table-header,
    .table-row {
        grid-template-columns: 80px 1fr;
    }
    
    .table-header span:nth-child(3),
    .table-header span:nth-child(4),
    .table-row span:nth-child(3),
    .table-row span:nth-child(4) {
        display: none;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .admin-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
}

/* ============================================================
   DASHBOARD
   ============================================================ */

/* KPIs */
.dashboard-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.kpi-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
}

.kpi-card.blue .kpi-icon {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
}

.kpi-card.green .kpi-icon {
    background: linear-gradient(135deg, #10b981, #34d399);
}

.kpi-card.purple .kpi-icon {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
}

.kpi-card.orange .kpi-icon {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-icon svg {
    width: 28px;
    height: 28px;
    color: white;
}

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

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}

.kpi-label {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-weight: 500;
}

.kpi-detail {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 2px;
}

/* Alertas del dashboard */
.dashboard-alerts {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.dashboard-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.dashboard-alert:hover {
    transform: translateX(4px);
}

.dashboard-alert.warning {
    background: linear-gradient(135deg, #fef3c7, #fef9c3);
    border: 1px solid #fcd34d;
}

.dashboard-alert.info {
    background: linear-gradient(135deg, #dbeafe, #e0f2fe);
    border: 1px solid #93c5fd;
}

.dashboard-alert.danger {
    background: linear-gradient(135deg, #fee2e2, #fef2f2);
    border: 1px solid #fca5a5;
}

.dashboard-alert.success {
    background: linear-gradient(135deg, #d1fae5, #ecfdf5);
    border: 1px solid #6ee7b7;
}

.dashboard-alert .alert-icon {
    font-size: 1.2rem;
}

.dashboard-alert .alert-text {
    flex: 1;
    font-size: 0.9rem;
    color: var(--gray-700);
}

.dashboard-alert .alert-action {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary);
}

/* Gráficas */
.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    overflow: hidden;
}

.chart-card.large {
    grid-column: span 2;
}

.chart-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
}

.chart-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
}

.chart-body {
    padding: 20px;
    height: 280px;
    position: relative;
}

.chart-card.large .chart-body {
    height: 320px;
}

/* Rankings */
.dashboard-rankings {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.ranking-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    overflow: hidden;
}

.ranking-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
}

.ranking-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0 0 4px 0;
}

.ranking-subtitle {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.ranking-body {
    padding: 12px 16px;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-50);
}

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

.ranking-position {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-600);
}

.ranking-item:nth-child(1) .ranking-position {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
}

.ranking-item:nth-child(2) .ranking-position {
    background: linear-gradient(135deg, #9ca3af, #6b7280);
    color: white;
}

.ranking-item:nth-child(3) .ranking-position {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: white;
}

.ranking-info {
    flex: 1;
    min-width: 0;
}

.ranking-name {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-detail {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-500);
}

.ranking-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
}

.ranking-empty {
    padding: 20px;
    text-align: center;
    color: var(--gray-400);
    font-size: 0.9rem;
}

/* Actividad */
.dashboard-activity {
    margin-bottom: 24px;
}

.activity-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    overflow: hidden;
}

.activity-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
}

.activity-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
}

.activity-body {
    padding: 12px 16px;
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-50);
}

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

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon.green {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #059669;
}

.activity-icon.blue {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #2563eb;
}

.activity-icon svg {
    width: 20px;
    height: 20px;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-800);
}

.activity-subtitle {
    display: block;
    font-size: 0.8rem;
    color: var(--gray-500);
}

.activity-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.activity-amount {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-800);
}

.activity-status {
    font-size: 0.7rem;
    padding: 2px 8px;
}

.activity-empty {
    padding: 30px;
    text-align: center;
    color: var(--gray-400);
}

/* Responsive Dashboard */
@media (max-width: 1200px) {
    .dashboard-kpis {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-rankings {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dashboard-kpis {
        grid-template-columns: 1fr;
    }
    
    .dashboard-charts {
        grid-template-columns: 1fr;
    }
    
    .chart-card.large {
        grid-column: span 1;
    }
    
    .kpi-card {
        padding: 16px;
    }
    
    .kpi-icon {
        width: 48px;
        height: 48px;
    }
    
    .kpi-value {
        font-size: 1.5rem;
    }
}

/* ============================================================
   PROPUESTAS INTELIGENTES
   ============================================================ */

.propuestas-container {
    max-width: 1000px;
}

/* Tabs */
.propuestas-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 12px;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

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

.tab-content {
    display: none;
}

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

/* Config cards */
.config-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
}

.config-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0 0 4px 0;
}

.config-desc {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin: 0 0 16px 0;
}

/* Toggle switch */
.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    margin-bottom: 16px;
}

.toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    width: 48px;
    height: 26px;
    background: var(--gray-300);
    border-radius: 13px;
    position: relative;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.toggle-switch .slider::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .slider {
    background: var(--primary);
}

.toggle-switch input:checked + .slider::after {
    transform: translateX(22px);
}

.toggle-label {
    font-size: 0.9rem;
    color: var(--gray-700);
    line-height: 1.4;
}

/* Config options */
.config-options {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 12px;
}

.config-inline {
    font-size: 0.9rem;
    color: var(--gray-700);
    margin: 0;
    line-height: 2.2;
}

.config-inline input[type="number"] {
    width: 70px;
    padding: 6px 10px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
    text-align: center;
    margin: 0 4px;
}

.checkbox-inline {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--gray-700);
    cursor: pointer;
}

.checkbox-inline input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.checkbox-inline input[type="number"] {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    text-align: center;
    margin: 0 4px;
}

/* Radio group */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--gray-700);
    cursor: pointer;
}

.radio-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.radio-option input[type="number"] {
    width: 70px;
    padding: 4px 8px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    text-align: center;
    margin: 0 4px;
}

/* Config actions */
.config-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-200);
}

/* Exclusiones */
.exclusiones-header {
    margin-bottom: 24px;
}

.exclusiones-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.exclusiones-header p {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin: 0;
}

.add-exclusion-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--gray-50);
    border-radius: var(--radius-lg);
}

.form-intro {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin: 0 0 8px 0;
}

.exclusion-nivel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

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

.nivel-header label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-700);
}

.nivel-count {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.exclusion-nivel select {
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: white;
}

.btn-excluir {
    align-self: flex-start;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-excluir:hover:not(:disabled) {
    background: #b91c1c;
}

.btn-excluir:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
}

.search-exclusion {
    position: relative;
}

.search-exclusion input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
}

.search-result-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--gray-100);
}

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

.search-result-item:hover {
    background: var(--gray-50);
}

.search-result-item.no-results {
    color: var(--gray-500);
    cursor: default;
}

/* Exclusion groups */
.exclusiones-list {
    display: grid;
    gap: 20px;
}

.exclusion-group h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 12px 0;
}

.exclusion-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.exclusion-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fee2e2;
    color: #991b1b;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.exclusion-tag .tag-remove {
    background: none;
    border: none;
    color: #991b1b;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
    opacity: 0.7;
}

.exclusion-tag .tag-remove:hover {
    opacity: 1;
}

.no-exclusions {
    font-size: 0.85rem;
    color: var(--gray-400);
    font-style: italic;
}

/* Resultados */
.resultados-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.resultados-info h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 4px 0;
}

.resultados-info p {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin: 0;
}

.resultados-actions {
    display: flex;
    gap: 10px;
}

/* Criterios filter */
.criterios-filter {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--gray-100);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-badge input {
    display: none;
}

.filter-badge:hover {
    background: var(--gray-200);
}

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

.filter-badge .count {
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.filter-badge.active .count {
    background: rgba(255,255,255,0.3);
}

/* Select all bar */
.select-all-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.selected-count {
    font-size: 0.85rem;
    color: var(--gray-600);
    font-weight: 500;
}

/* Propuestas list */
.propuestas-list {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.propuesta-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.2s ease;
}

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

.propuesta-item:hover {
    background: var(--gray-50);
}

.propuesta-checkbox {
    flex-shrink: 0;
}

.propuesta-check {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

.propuesta-info {
    flex: 1;
    min-width: 0;
}

.propuesta-nombre {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.propuesta-detalles {
    display: block;
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 2px;
}

.propuesta-datos {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.propuesta-stock {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
}

.propuesta-precio {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.propuesta-motivos {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex-shrink: 0;
    min-width: 180px;
}

.motivo-badge {
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.motivo-badge.caducidad {
    background: #fef3c7;
    color: #92400e;
}

.motivo-badge.sobrestock {
    background: #dbeafe;
    color: #1e40af;
}

.motivo-badge.rotacion {
    background: #e0e7ff;
    color: #3730a3;
}

/* Responsive propuestas */
@media (max-width: 768px) {
    .propuestas-tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1;
        justify-content: center;
        padding: 10px 12px;
        font-size: 0.8rem;
    }
    
    .add-exclusion-form {
        flex-direction: column;
    }
    
    .add-exclusion-form select {
        width: 100%;
    }
    
    .resultados-header {
        flex-direction: column;
        gap: 12px;
    }
    
    .criterios-filter {
        flex-wrap: wrap;
    }
    
    .propuesta-item {
        flex-wrap: wrap;
    }
    
    .propuesta-motivos {
        width: 100%;
        margin-top: 8px;
    }
}

/* ============================================================
   ESTILOS PARA MODIFICACIÓN DE PEDIDOS
   ============================================================ */

/* Container de líneas de modificación */
.lineas-modificacion-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.linea-modificacion {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    gap: 16px;
}

.linea-modificacion:last-child {
    border-bottom: none;
}

.linea-modificacion.eliminada {
    background: #fef2f2;
    opacity: 0.7;
}

.linea-modificacion.modificada {
    background: #fffbeb;
}

.linea-modificacion .linea-info {
    flex: 1;
}

.linea-modificacion .linea-nombre {
    font-weight: 500;
    color: var(--gray-800);
}

.linea-modificacion .linea-detalle {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.linea-modificacion .badge-eliminada {
    display: inline-block;
    background: #ef4444;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-top: 4px;
}

.linea-modificacion .badge-reducida {
    display: inline-block;
    background: #f59e0b;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-top: 4px;
}

.linea-controles {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-cantidad {
    width: 32px;
    height: 32px;
    border: 1px solid var(--gray-300);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-cantidad:hover:not(:disabled) {
    background: var(--gray-100);
}

.btn-cantidad:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cantidad-valor {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
}

.btn-eliminar-linea {
    width: 32px;
    height: 32px;
    border: none;
    background: #fef2f2;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
}

.btn-eliminar-linea:hover {
    background: #fee2e2;
}

.btn-restaurar {
    padding: 6px 12px;
    border: 1px solid var(--gray-300);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-restaurar:hover {
    background: var(--gray-100);
}

.linea-subtotal {
    min-width: 80px;
    text-align: right;
    font-weight: 600;
    color: var(--gray-700);
}

.modificacion-totales {
    background: var(--gray-50);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.total-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.total-original {
    text-decoration: line-through;
    color: var(--gray-400);
}

.total-nuevo {
    font-weight: 600;
    color: var(--primary);
    font-size: 1.1rem;
}

/* Modal grande */
.modal-lg {
    max-width: 700px;
}

/* Estado pendiente aprobación */
.estado-badge.pendiente_aprobacion {
    background: #fef3c7;
    color: #92400e;
}

.order-card.pendiente-aprobacion {
    border-left: 4px solid #f59e0b;
}

.nuevo-badge.warning {
    background: #fef3c7;
    color: #92400e;
}

/* Detalle de modificaciones */
.modificaciones-detalle {
    background: var(--gray-50);
    padding: 16px;
    border-radius: 8px;
    max-height: 250px;
    overflow-y: auto;
}

.modificaciones-detalle pre {
    margin: 0;
    font-family: inherit;
}

/* Botón modificar */
.btn-estado.modificar {
    background: #3b82f6;
    color: white;
}

.btn-estado.modificar:hover {
    background: #2563eb;
}

/* Alert warning */
.alert-warning {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
}

/* Icon para pendiente aprobación */
.order-icon.pendiente_aprobacion {
    background: #fef3c7;
    color: #f59e0b;
}

/* ============================================================
   ESTILOS PARA MODAL APROBAR MODIFICACIONES
   ============================================================ */

.aprobar-header {
    background: var(--gray-50);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.aprobar-header p {
    margin: 4px 0;
}

.cambios-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.tabla-cambios {
    width: 100%;
    border-collapse: collapse;
}

.tabla-cambios th {
    background: var(--gray-100);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-600);
    position: sticky;
    top: 0;
}

.tabla-cambios td {
    padding: 12px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.tabla-cambios tr:last-child td {
    border-bottom: none;
}

.tabla-cambios .text-center {
    text-align: center;
}

.tabla-cambios .text-right {
    text-align: right;
}

.tabla-cambios .cambio-eliminado {
    background: #fef2f2;
}

.tabla-cambios .cambio-eliminado td {
    color: #991b1b;
}

.tabla-cambios .cambio-reducido {
    background: #fffbeb;
}

.tabla-cambios .cambio-producto {
    font-weight: 500;
    color: var(--gray-800);
}

.tabla-cambios .cambio-lab {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.tabla-cambios .eliminado {
    text-decoration: line-through;
    color: #dc2626;
}

.tabla-cambios .precio-tachado {
    text-decoration: line-through;
    color: var(--gray-400);
    font-size: 0.85rem;
}

/* Totales comparativa */
.totales-comparativa {
    background: var(--gray-50);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.totales-comparativa .total-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
}

.totales-comparativa .total-original {
    text-decoration: line-through;
    color: var(--gray-400);
}

.totales-comparativa .total-nuevo {
    font-weight: 600;
    color: var(--primary);
    font-size: 1.1rem;
}

.totales-comparativa .diferencia {
    border-top: 1px solid var(--gray-200);
    margin-top: 8px;
    padding-top: 12px;
}

.totales-comparativa .total-diferencia {
    color: #dc2626;
    font-weight: 600;
}

/* Mensaje del vendedor */
.mensaje-vendedor {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 1rem;
}

.mensaje-vendedor strong {
    color: #1e40af;
}

.mensaje-vendedor p {
    margin: 8px 0 0 0;
    color: var(--gray-700);
}

/* Alert danger para motivo cancelación */
.alert-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.alert-danger strong {
    color: #7f1d1d;
}

/* ============================================================
   ESTILOS PARA CADUCIDAD EN CATÁLOGO
   ============================================================ */

/* Badge de caducidad */
.caducidad-badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--gray-100);
    color: var(--gray-600);
    margin-top: 6px;
}

.caducidad-badge.urgente {
    background: #fef2f2;
    color: #dc2626;
    font-weight: 600;
}

.caducidad-badge.pronto {
    background: #fffbeb;
    color: #d97706;
}

/* Card con caducidad urgente */
.product-card.caducidad-urgente {
    border: 2px solid #fecaca;
}

.product-card.caducidad-urgente .product-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #dc2626;
}

/* Card con caducidad próxima */
.product-card.caducidad-pronto {
    border: 2px solid #fed7aa;
}

/* Filtro de caducidad - estilo especial */
#filtro-catalogo-caducidad {
    min-width: 160px;
}

/* Sin fecha de caducidad */
.caducidad-badge.sin-fecha {
    background: var(--gray-50);
    color: var(--gray-400);
    font-style: italic;
}

/* ============================================================
   ESTILOS PARA INTERCAMBIO INTELIGENTE
   ============================================================ */

/* Tabs de intercambio */
.intercambio-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    background: var(--gray-50);
    padding: 8px;
    border-radius: 12px;
}

.intercambio-tabs .tab-btn {
    padding: 10px 16px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-600);
    transition: all 0.2s;
}

.intercambio-tabs .tab-btn:hover {
    background: white;
    color: var(--gray-800);
}

.intercambio-tabs .tab-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Header de intercambio */
.intercambio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.intercambio-header h3 {
    margin: 0;
    color: var(--gray-800);
}

.intercambio-acciones {
    display: flex;
    gap: 10px;
}

/* Filtros de intercambio */
.intercambio-filtros {
    margin-bottom: 1rem;
    padding: 12px 16px;
    background: var(--gray-50);
    border-radius: 8px;
}

.intercambio-filtros label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Info de matches */
.matches-info {
    margin-bottom: 1.5rem;
}

.matches-resumen {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #a7f3d0;
    padding: 16px 20px;
    border-radius: 12px;
}

.matches-resumen.vacio {
    background: var(--gray-50);
    border-color: var(--gray-200);
}

.matches-count {
    font-size: 1.2rem;
    font-weight: 600;
    color: #059669;
}

.matches-resumen.vacio .matches-count,
.matches-resumen.vacio span {
    color: var(--gray-600);
}

.matches-resumen p {
    margin: 8px 0 0 0;
    color: #065f46;
    font-size: 0.9rem;
}

.matches-resumen.vacio p {
    color: var(--gray-500);
}

/* Card de producto necesitado */
.product-card.necesitado {
    border: 2px solid #10b981;
    background: linear-gradient(180deg, #ecfdf5 0%, white 30%);
}

.product-badge.success {
    background: #10b981;
    color: white;
}

.necesidad-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    background: #f0fdf4;
    padding: 8px 10px;
    border-radius: 6px;
    margin-top: 8px;
    color: #166534;
}

/* Sección de configuración */
.config-section {
    max-width: 800px;
}

.config-section h3 {
    margin-bottom: 0.5rem;
    color: var(--gray-800);
}

.config-subtitle {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

/* Cards de configuración */
.config-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 1rem;
}

.config-card.highlight {
    border-color: #fbbf24;
    background: linear-gradient(180deg, #fffbeb 0%, white 30%);
}

.config-card h4 {
    margin: 0 0 1rem 0;
    color: var(--gray-800);
    font-size: 1rem;
}

/* Switch label */
.switch-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    cursor: pointer;
}

.switch-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Config inline */
.config-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: var(--gray-600);
}

.config-inline.sub {
    margin-left: 28px;
}

.config-inline input[type="number"] {
    width: 70px;
    padding: 6px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    text-align: center;
}

.config-inline select {
    padding: 6px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
}

/* Radio group */
.config-radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--gray-600);
    cursor: pointer;
}

.radio-label input[type="radio"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Checkboxes group */
.config-checkboxes {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-100);
}

/* Config note */
.config-note {
    margin-top: 12px;
    padding: 10px 12px;
    background: #fef3c7;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #92400e;
}

/* Config footer */
.config-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

/* Exclusiones */
.exclusiones-actual {
    margin: 1rem 0;
}

.exclusion-grupo {
    margin-bottom: 8px;
}

.exclusion-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--gray-100);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    margin: 2px;
}

.btn-remove-tag {
    background: none;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    font-size: 1rem;
    padding: 0 2px;
}

.btn-remove-tag:hover {
    color: #dc2626;
}

/* Balance */
.balance-filtros {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.balance-filtros .form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.balance-filtros label {
    font-size: 0.85rem;
    color: var(--gray-600);
}

.balance-filtros input[type="date"],
.balance-filtros select {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
}

.balance-resultados {
    margin-top: 1.5rem;
}

.balance-resultados h4 {
    margin-bottom: 0.5rem;
}

.balance-tipo-precio {
    color: var(--gray-500);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.balance-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.balance-table th,
.balance-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.balance-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
}

.balance-table .text-right {
    text-align: right;
}

.balance-table .positivo {
    color: #059669;
    font-weight: 600;
}

.balance-table .negativo {
    color: #dc2626;
    font-weight: 600;
}

.balance-resumen {
    background: var(--gray-50);
    padding: 16px 20px;
    border-radius: 8px;
}

.balance-resumen h5 {
    margin: 0 0 12px 0;
}

.balance-resumen ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.balance-resumen li {
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-200);
}

.balance-resumen li:last-child {
    border-bottom: none;
}

.deuda-positiva {
    color: #059669;
}

.deuda-negativa {
    color: #dc2626;
}

/* ============================================================
   ESTILOS ADICIONALES INTERCAMBIO v2
   ============================================================ */

/* Stats de intercambio */
.intercambio-stats {
    margin-bottom: 1.5rem;
}

.stats-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.stat-item {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 16px 24px;
    text-align: center;
    flex: 1;
    min-width: 150px;
}

.stat-item.highlight {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: #10b981;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-800);
}

.stat-item.highlight .stat-number {
    color: #059669;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 4px;
}

/* Match card */
.match-card {
    border: 2px solid #10b981;
}

.match-header {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    background: #ecfdf5;
    border-bottom: 1px solid #a7f3d0;
    font-size: 0.85rem;
}

.match-farmacia {
    font-weight: 600;
    color: #065f46;
}

.match-motivo {
    color: #059669;
}

.match-detalles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 12px 0;
    padding: 10px;
    background: var(--gray-50);
    border-radius: 8px;
    font-size: 0.85rem;
}

.match-detalles .detalle {
    text-align: center;
}

.match-detalles .label {
    display: block;
    color: var(--gray-500);
    font-size: 0.75rem;
}

.match-detalles .value {
    display: block;
    font-weight: 600;
    color: var(--gray-800);
}

/* Solicitudes */
.solicitudes-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.solicitud-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    overflow: hidden;
}

.solicitud-card.warning {
    border-left: 4px solid #f59e0b;
}

.solicitud-card.success {
    border-left: 4px solid #10b981;
}

.solicitud-card.danger {
    border-left: 4px solid #ef4444;
}

.solicitud-card.info {
    border-left: 4px solid #3b82f6;
}

.solicitud-header {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.solicitud-estado {
    font-weight: 600;
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 4px;
}

.solicitud-estado.warning {
    background: #fef3c7;
    color: #92400e;
}

.solicitud-estado.success {
    background: #d1fae5;
    color: #065f46;
}

.solicitud-estado.danger {
    background: #fee2e2;
    color: #991b1b;
}

.solicitud-estado.info {
    background: #dbeafe;
    color: #1e40af;
}

.solicitud-fecha {
    color: var(--gray-500);
    font-size: 0.85rem;
}

.solicitud-body {
    padding: 16px;
}

.solicitud-body h4 {
    margin: 0 0 8px 0;
    color: var(--gray-800);
}

.solicitud-body p {
    margin: 4px 0;
    font-size: 0.9rem;
    color: var(--gray-600);
}

.solicitud-actions {
    padding: 12px 16px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-success {
    background: #10b981;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Tab badges */
.tab-badge {
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
}

/* Config blocks */
.config-block {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--gray-200);
}

.config-block:last-child {
    border-bottom: none;
}

.config-block h4 {
    margin-bottom: 1rem;
    color: var(--gray-700);
}

.switch-label.sub,
.config-inline.sub,
.config-radio-group.sub {
    margin-left: 28px;
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    text-align: center;
    color: var(--gray-500);
}

/* Stats clicables */
.stat-item.clickable {
    cursor: pointer;
    transition: all 0.2s;
}

.stat-item.clickable:hover {
    background: var(--gray-100);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-hint {
    display: block;
    font-size: 0.7rem;
    color: var(--primary);
    margin-top: 4px;
}

/* Detalle de stats */
.detalle-stats {
    margin-top: 1rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.detalle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.detalle-header h4 {
    margin: 0;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--gray-500);
    padding: 4px 8px;
}

.btn-close:hover {
    color: var(--gray-800);
}

/* Tabla detalle */
.tabla-detalle {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.tabla-detalle th,
.tabla-detalle td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

.tabla-detalle th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
}

.tabla-detalle tbody tr:hover {
    background: var(--gray-50);
}

.motivo-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.motivo-badge.caducidad {
    background: #fef3c7;
    color: #92400e;
}

.motivo-badge.sobrestock {
    background: #dbeafe;
    color: #1e40af;
}

.motivo-badge.rotacion {
    background: #f3e8ff;
    color: #6b21a8;
}

.text-danger {
    color: #dc2626;
}

/* Checkbox principal ofrecer todo */
.config-card.highlight-primary {
    background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
    border: 2px solid var(--primary);
    padding: 1rem;
}

.config-card.highlight-primary .switch-label {
    font-size: 1.1rem;
}

/* Criterios específicos deshabilitados */
.criterios-especificos {
    transition: all 0.3s ease;
}

.criterios-especificos.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.criterios-info {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-style: italic;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: var(--gray-100);
    border-radius: 8px;
}

.motivo-badge.disponible {
    background: #dcfce7;
    color: #166534;
}

/* Header con botón actualizar */
.header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.auto-refresh-info {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 0.5rem;
}

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.btn-secondary.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

/* Texto success en línea */
.text-success {
    color: #16a34a;
}

.text-muted {
    color: var(--gray-500);
    font-style: italic;
}

/* ============================================
   BALANCE ACUMULADO Y LIQUIDACIONES
   ============================================ */

.balance-acumulado-section,
.liquidaciones-historial-section {
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.section-header h4 {
    margin: 0;
}

.balance-acumulado-lista {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

/* Tarjeta de balance con cada farmacia */
.balance-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    border-left: 4px solid var(--gray-300);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.balance-card.positivo {
    border-left-color: #16a34a;
    background: linear-gradient(135deg, #f0fdf4 0%, white 100%);
}

.balance-card.negativo {
    border-left-color: #dc2626;
    background: linear-gradient(135deg, #fef2f2 0%, white 100%);
}

.balance-card.neutro {
    border-left-color: var(--gray-400);
}

.balance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.balance-header h4 {
    margin: 0;
    font-size: 1.1rem;
}

.balance-saldo {
    font-size: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

.balance-saldo.positivo {
    background: #dcfce7;
    color: #166534;
}

.balance-saldo.negativo {
    background: #fee2e2;
    color: #991b1b;
}

.balance-saldo.neutro {
    background: var(--gray-100);
    color: var(--gray-600);
}

.balance-detalles {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-100);
}

.balance-item {
    display: flex;
    gap: 0.5rem;
}

.balance-item span:first-child {
    color: var(--gray-500);
}

.balance-actions {
    margin-top: 1rem;
}

/* Liquidación pendiente */
.liquidacion-pendiente {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.badge-warning {
    display: inline-block;
    background: #fbbf24;
    color: #78350f;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.liquidacion-estado {
    display: flex;
    gap: 1.5rem;
    margin: 0.75rem 0;
}

.liquidacion-estado span {
    font-size: 0.9rem;
}

.liquidacion-estado .aprobado {
    color: #16a34a;
}

.liquidacion-estado .pendiente {
    color: #d97706;
}

.liquidacion-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Histórico de liquidaciones */
.historial-liquidaciones {
    margin-top: 1rem;
    background: white;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid var(--gray-200);
}

.tabla-historial {
    width: 100%;
    border-collapse: collapse;
}

.tabla-historial th,
.tabla-historial td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

.tabla-historial th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-600);
}

.tabla-historial tbody tr:hover {
    background: var(--gray-50);
}

/* Secciones colapsables */
.balance-periodo-section,
.config-precio-section {
    margin-top: 1.5rem;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
}

.balance-periodo-section summary,
.config-precio-section summary {
    padding: 1rem;
    cursor: pointer;
    font-weight: 500;
    background: var(--gray-50);
    border-radius: 8px;
}

.balance-periodo-section[open] summary,
.config-precio-section[open] summary {
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid var(--gray-200);
}

.balance-periodo-section > .config-card,
.config-precio-section > .config-card {
    margin: 1rem;
}

/* ============================================
   INFO DE INVENTARIO EN SOLICITUDES
   ============================================ */

.solicitud-mi-inventario {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #7dd3fc;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.solicitud-mi-inventario h5 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: #0369a1;
}

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

@media (min-width: 600px) {
    .inventario-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.inventario-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.inventario-label {
    font-size: 0.75rem;
    color: #64748b;
}

.inventario-valor {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
}

.inventario-valor.text-danger {
    color: #dc2626;
}

.inventario-aviso {
    margin: 0.75rem 0 0 0;
    padding: 0.5rem;
    background: #fee2e2;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #991b1b;
}

.inventario-aviso.warning {
    background: #fef3c7;
    color: #92400e;
}

/* Liquidación que requiere acción */
.liquidacion-pendiente.requiere-accion {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0%, 100% { border-color: #f59e0b; }
    50% { border-color: #d97706; }
}

.liquidacion-info {
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.liquidacion-info.alerta {
    color: #b45309;
    font-weight: 500;
}

.liquidacion-pregunta {
    margin: 1rem 0 0.75rem 0;
    padding: 0.75rem;
    background: white;
    border-radius: 6px;
    font-size: 0.95rem;
}

.liquidacion-actions .btn-success {
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
}

/* ============================================
   SELECCIÓN MÚLTIPLE EN INTERCAMBIO
   ============================================ */

/* Checkbox en la esquina de la tarjeta */
.match-card {
    position: relative;
}

.match-checkbox {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
}

.match-checkbox input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: #3b82f6;
}

.match-checkbox label {
    display: none;
}

/* Botón flotante para enviar solicitudes múltiples */
.boton-flotante-solicitudes {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    padding: 15px 25px;
    border-radius: 50px;
    border: none;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.boton-flotante-solicitudes:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.boton-flotante-solicitudes.hidden {
    display: none;
}

.boton-flotante-solicitudes .contador-seleccion {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: bold;
}

/* Producto ya solicitado */
.match-card.ya-solicitado {
    opacity: 0.7;
    background: #f0f0f0;
    border: 2px dashed #999;
}

.match-card.ya-solicitado .product-info {
    pointer-events: none;
}

.solicitud-pendiente-badge {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    text-align: center;
    padding: 6px 10px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px 8px 0 0;
}

.match-card.ya-solicitado .match-header {
    margin-top: 30px;
}

/* ============================================
   INFO DE SINCRONIZACIÓN
   ============================================ */

.sync-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #e2e8f0;
}

.sync-label {
    color: #64748b;
    font-size: 0.9rem;
}

.sync-label strong {
    color: #334155;
}

.sync-info .btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}


/* ============================================
   DETALLE DE DEUDA
   ============================================ */

.balance-item.clickable {
    cursor: pointer;
    transition: background 0.2s;
    padding: 5px 8px;
    border-radius: 4px;
}

.balance-item.clickable:hover {
    background: rgba(59, 130, 246, 0.1);
}

.detalle-deuda {
    margin-top: 15px;
    border-top: 1px solid #e2e8f0;
    padding-top: 15px;
}

.detalle-deuda.hidden {
    display: none;
}

.detalle-deuda-content {
    background: #f8fafc;
    border-radius: 8px;
    padding: 15px;
}

.detalle-deuda-content .detalle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.detalle-deuda-content .detalle-header h5 {
    margin: 0;
    font-size: 1rem;
    color: #334155;
}

.detalle-deuda-content .btn-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #94a3b8;
    padding: 0;
}

.detalle-deuda-content .btn-close:hover {
    color: #64748b;
}

.tabla-detalle-deuda {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.tabla-detalle-deuda th {
    text-align: left;
    padding: 8px 10px;
    background: #e2e8f0;
    color: #475569;
    font-weight: 600;
}

.tabla-detalle-deuda td {
    padding: 8px 10px;
    border-bottom: 1px solid #e2e8f0;
}

.tabla-detalle-deuda tbody tr:hover {
    background: #f1f5f9;
}

.tabla-detalle-deuda tfoot td {
    padding: 10px;
    background: #e2e8f0;
    font-weight: 600;
}

/* ============================================================
   MODAL CONFIGURAR PUBLICACIÓN
   ============================================================ */

.config-pub-info {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.config-pub-info img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 8px;
    background: white;
    padding: 4px;
}

.config-pub-info-text {
    flex: 1;
}

.config-pub-info-text h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.config-pub-info-text p {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.config-pub-info-text .info-datos {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

.config-pub-info-text .info-datos span {
    font-size: 0.8rem;
    color: var(--gray-600);
    font-weight: 500;
}

.config-pub-section {
    margin-bottom: 20px;
}

.config-pub-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.config-pub-toggle {
    display: flex;
    background: var(--gray-100);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 12px;
}

.config-pub-toggle .toggle-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

.config-pub-toggle .toggle-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.config-pub-toggle .toggle-btn:hover:not(.active) {
    color: var(--gray-800);
}

.config-pub-input-group {
    margin-bottom: 8px;
}

.input-with-suffix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-suffix input {
    width: 100%;
    padding: 10px 40px 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.input-with-suffix input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-with-suffix .input-suffix {
    position: absolute;
    right: 12px;
    color: var(--gray-500);
    font-weight: 500;
    pointer-events: none;
}

.config-pub-preview {
    font-size: 0.85rem;
    color: var(--gray-600);
}

.config-pub-preview strong {
    color: var(--primary);
    font-weight: 600;
}

#stock-disponible-info {
    color: var(--gray-400);
    font-size: 0.8rem;
}

/* ============================================================
   MIS PRODUCTOS - TARJETAS MEJORADAS
   ============================================================ */

.product-precios,
.product-stocks {
    margin: 8px 0;
    padding: 8px 0;
    border-top: 1px solid var(--gray-100);
}

.precio-row,
.stock-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.precio-label,
.stock-label {
    color: var(--gray-500);
    min-width: 70px;
}

.precio-valor,
.stock-valor {
    font-weight: 600;
    color: var(--gray-700);
}

.precio-valor.tachado {
    text-decoration: line-through;
    color: var(--gray-400);
}

.precio-valor.venta {
    color: var(--secondary);
    font-size: 1rem;
}

.stock-valor.venta {
    color: var(--primary);
}

.descuento-badge {
    background: var(--secondary-light);
    color: var(--secondary-dark);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.stock-porcentaje {
    color: var(--gray-400);
    font-size: 0.8rem;
}

.btn-editar {
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-editar:hover {
    background: var(--primary);
    color: white;
}

.product-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--gray-100);
}

/* ============================================================
   MODAL EDITAR PRODUCTO PUBLICADO
   ============================================================ */

.edit-pub-info {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.edit-pub-info img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 8px;
    background: white;
    padding: 4px;
}

.edit-pub-info-text h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.edit-pub-info-text p {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.edit-pub-section {
    margin-bottom: 16px;
}

.edit-pub-section label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.edit-pub-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.edit-pub-row .input-with-suffix {
    flex: 1;
}

.edit-pub-original {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 4px;
}

/* ============================================================
   SELECCIÓN MÚLTIPLE EN MODAL AÑADIR PRODUCTOS
   ============================================================ */

.med-item-selectable {
    position: relative;
}

.med-item-selectable .med-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 20px;
    height: 20px;
    z-index: 10;
    cursor: pointer;
    accent-color: var(--primary);
}

.med-item-selectable.selected {
    outline: 2px solid var(--primary);
    background: var(--primary-light);
}

.seleccion-masiva-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--primary-light);
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.seleccion-masiva-bar .seleccion-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.seleccion-masiva-bar .seleccion-count {
    font-weight: 600;
    color: var(--primary);
}

.seleccion-masiva-bar .seleccion-actions {
    display: flex;
    gap: 8px;
}

.btn-seleccionar-todos {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-seleccionar-todos:hover {
    background: var(--primary);
    color: white;
}

/* Modal publicación masiva */
.pub-masiva-resumen {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 16px;
}

.pub-masiva-resumen p {
    font-size: 0.9rem;
    color: var(--gray-700);
}

.pub-masiva-resumen strong {
    color: var(--primary);
}

/* Botón publicar en vista mini */
.btn-pub-mini {
    background: var(--primary);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    margin-left: auto;
    transition: background 0.2s;
}

.btn-pub-mini:hover {
    background: var(--primary-dark);
}

/* ============================================================
   DESCUENTOS DE INTERCAMBIO
   ============================================================ */

/* Subtabs de descuentos */
.descuentos-subtabs {
    display: flex;
    gap: 4px;
    background: var(--gray-100);
    padding: 4px;
    border-radius: 8px;
    margin: 1.5rem 0 1rem;
}

.subtab-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--gray-600);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.subtab-btn:hover {
    background: var(--white);
    color: var(--gray-800);
}

.subtab-btn.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.subtab-content {
    padding: 1rem 0;
}

.subtab-content.hidden {
    display: none;
}

/* Header de descuentos */
.descuento-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.descuento-header h4 {
    margin: 0;
    flex: 1;
    min-width: 200px;
}

/* Lista de descuentos */
.descuentos-lista {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.descuento-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    transition: all 0.2s;
}

.descuento-item:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.descuento-item.inactivo {
    opacity: 0.6;
    background: var(--gray-50);
}

.descuento-item-info {
    flex: 1;
    min-width: 0;
}

.descuento-item-nombre {
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.descuento-item-detalle {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 2px;
}

.descuento-item-valor {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--secondary);
    min-width: 70px;
    text-align: right;
}

.descuento-item-acciones {
    display: flex;
    gap: 8px;
}

.descuento-item-acciones button {
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-toggle-descuento {
    background: var(--gray-100);
    color: var(--gray-600);
}

.btn-toggle-descuento:hover {
    background: var(--gray-200);
}

.btn-eliminar-descuento {
    background: var(--danger-light);
    color: var(--danger);
}

.btn-eliminar-descuento:hover {
    background: var(--danger);
    color: white;
}

/* Prioridades arrastrar y soltar */
.prioridades-container {
    margin: 1rem 0;
}

.prioridades-lista {
    list-style: none;
    padding: 0;
    margin: 0;
}

.prioridades-lista li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: grab;
    transition: all 0.2s;
    user-select: none;
}

.prioridades-lista li:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.prioridades-lista li.dragging {
    opacity: 0.5;
    border-style: dashed;
}

.prioridades-lista li.drag-over {
    border-color: var(--secondary);
    background: var(--secondary-light);
}

.drag-handle {
    color: var(--gray-400);
    font-size: 1.2rem;
    cursor: grab;
}

.prioridad-numero {
    font-weight: 700;
    color: var(--primary);
    min-width: 30px;
}

.prioridad-nombre {
    font-weight: 600;
    color: var(--gray-800);
    min-width: 120px;
}

.prioridad-desc {
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* Descuento por defecto */
.descuento-defecto-card {
    background: var(--gray-50);
    border: 2px dashed var(--gray-300);
    margin-top: 1rem;
}

.descuento-defecto-card .config-inline {
    margin-top: 8px;
}

/* Resumen de descuentos */
.resumen-descuentos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.resumen-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.resumen-card-titulo {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.resumen-card-valor {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.resumen-card-sub {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 4px;
}

/* Modal descuento producto */
.lista-busqueda-resultados {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    margin: 8px 0;
}

.lista-busqueda-resultados .text-muted {
    padding: 16px;
    text-align: center;
}

.producto-busqueda-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.2s;
}

.producto-busqueda-item:last-child {
    border-bottom: none;
}

.producto-busqueda-item:hover {
    background: var(--gray-50);
}

.producto-busqueda-item.selected {
    background: var(--primary-light);
}

.producto-busqueda-info {
    flex: 1;
}

.producto-busqueda-nombre {
    font-weight: 600;
    font-size: 0.9rem;
}

.producto-busqueda-detalle {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.producto-busqueda-pvp {
    font-weight: 600;
    color: var(--gray-700);
}

.producto-seleccionado {
    background: var(--primary-light);
    border: 2px solid var(--primary);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 1rem;
}

.producto-seleccionado-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.producto-seleccionado-info h4 {
    margin: 0 0 4px 0;
    font-size: 1rem;
}

.producto-seleccionado-info p {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin: 0;
}

.btn-quitar-seleccion {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--gray-500);
}

.btn-quitar-seleccion:hover {
    color: var(--danger);
}

/* Modal masivo */
.filtros-masivos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 1rem;
}

.acciones-masivas {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.contador-masivo {
    margin-left: auto;
    font-size: 0.9rem;
    color: var(--gray-600);
}

.contador-masivo strong {
    color: var(--primary);
}

.lista-productos-masivo {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.producto-masivo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-100);
}

.producto-masivo-item:last-child {
    border-bottom: none;
}

.producto-masivo-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.producto-masivo-info {
    flex: 1;
}

.producto-masivo-nombre {
    font-weight: 600;
    font-size: 0.9rem;
}

.producto-masivo-detalle {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.producto-masivo-pvp {
    font-weight: 600;
    color: var(--gray-700);
    min-width: 70px;
    text-align: right;
}

.producto-masivo-descuento-actual {
    font-size: 0.8rem;
    color: var(--secondary);
    min-width: 60px;
    text-align: right;
}

.descuento-masivo-aplicar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 8px;
}

.descuento-masivo-aplicar .form-group {
    margin: 0;
    flex: 1;
    max-width: 200px;
}

/* Empty state descuentos */
.descuentos-empty {
    text-align: center;
    padding: 2rem;
    color: var(--gray-500);
}

.descuentos-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Modal medium size */
.modal-medium {
    max-width: 500px;
}

/* ============================================================
   PAGINACIÓN
   ============================================================ */

.paginacion {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-top: 2rem;
    padding: 1rem;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.btn-pag {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: var(--white);
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-pag:hover:not(:disabled) {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-pag:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pag-info {
    font-size: 0.875rem;
    color: var(--gray-600);
    padding: 0 0.5rem;
}

.pag-info span {
    font-weight: 600;
    color: var(--gray-800);
}

