/* style.css V.25 */

:root {
    --primary: #1976d2; --primary-dark: #0d47a1; --danger: #d32f2f;
    --text-primary-legacy: #212121; --text-muted-legacy: #757575; --bg-light: #f5f5f5;
    --bg-dark: #1a1d21; --bg-sidebar: #22262b; --bg-panel: #2c2f36;
    --border-color: #3a3f48; --text-light: #e0e0e0; --text-muted: #9e9e9e;
    --accent-green: #4caf50; --accent-red: #f44336; --accent-blue: #2196f3; --accent-yellow: #ffc107;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-dark); color: var(--text-light);
    display: flex; flex-direction: column; overscroll-behavior: none; font-size: 14px;
}

/* 1. ESTILOS DE LOGIN */
#loginScreen {
    display: flex; align-items: center; justify-content: center;
    flex: 1; padding: 20px; background: var(--bg-light);
}
.login-card {
    background: #fff; padding: 30px; border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); width: 100%; max-width: 380px;
    text-align: center; color: var(--text-primary-legacy);
}
.login-logo { font-size: 24px; font-weight: 800; color: var(--primary); }
.login-desc { font-size: 14px; color: var(--text-muted-legacy); margin-bottom: 25px; }
#adminAuthSection { display: none; }
.employee-section, #adminAuthSection { border: 1px solid #e0e0e0; padding: 20px; border-radius: 8px; }
.field-label { font-size: 13px; font-weight: 600; color: #555; text-align: left; margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="search"], input[type="number"], input[type="email"], select, textarea {
    width: 100%; padding: 12px; font-size: 16px; border: 1px solid #ccc;
    border-radius: 8px; margin-bottom: 15px; appearance: none; background: #fff; color: #212121;
}
.user-select { font-size:18px; font-weight:700; text-align: center; }
.login-btn {
    background: var(--primary); color: #fff; width: 100%; border: none; padding: 14px;
    font-size: 16px; font-weight: 700; border-radius: 8px; cursor: pointer; margin-top: 10px;
}
.admin-link { margin-top: 20px; font-size: 13px; color: var(--text-muted-legacy); cursor: pointer; text-decoration: underline; }
.btn-secondary { background: #e0e0e0; color: #333; margin-top: 8px; }
.error { color: var(--danger); font-size: 13px; margin-top: 10px; font-weight: 600; }
.login-mode-switch { margin-top: 15px; font-size: 13px; color: #1565c0; cursor: pointer; text-decoration: underline; text-align: center; }
.login-mode-section { border: 1px solid #e0e0e0; padding: 20px; border-radius: 8px; }

/* 2. ESTILOS APP INVENTARIO */
#appContainer { display: none; flex: 1; flex-direction: column; background: var(--bg-light); color: var(--text-primary-legacy); }
.header { display: flex; justify-content: space-between; align-items: center; background: #fff; padding: 12px 16px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); position: sticky; top: 0; z-index: 100; flex-wrap: wrap; }
.header-brand { display: flex; align-items: center; gap: 12px; }
.btn-home { font-size: 24px; background: none; border: none; padding: 0 5px; cursor: pointer; }
.brand-info { display: flex; flex-direction: column; }
.brand-title { font-weight: 800; font-size: 16px; color: var(--primary-dark); }
.brand-user { font-size: 12px; color: var(--text-muted-legacy); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.btn-config, .btn-logout { font-size: 24px; background: none; border: none; cursor: pointer; color: #333; }
.btn-back-inventory { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.page { padding: 16px; flex: 1; overflow-y: auto; }
.product-list { margin-top: 16px; }
.product-card { background: #fff; border-radius: 10px; padding: 12px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: stretch; box-shadow: 0 1px 3px rgba(0,0,0,0.05); border: 1px solid #eee; }
.product-left { flex: 1; }
.product-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; color: #212121; }
.product-ref { font-size: 12px; color: var(--text-muted-legacy); }
.local-data-preview { font-size: 11px; background: #e3f2fd; color: #1565c0; padding: 4px 8px; border-radius: 6px; margin-top: 8px; display: inline-block; }
.product-right { display: flex; flex-direction: column; align-items: center; justify-content: center; background: #f0f4f8; border-radius: 8px; padding: 0 16px; margin-left: 10px; text-align: center; cursor: pointer; min-width: 100px; }
.count-label { font-size: 10px; color: #546e7a; font-weight: 600; }
.count-value { font-size: 22px; font-weight: 800; color: var(--primary-dark); }
.tap-hint { font-size: 10px; color: #78909c; margin-top: 2px; }
.loading { text-align: center; padding: 20px; color: var(--text-muted-legacy); }
.product-card.status-pending .product-right { background-color: #fff3e0; }
.product-card.status-pending .count-label { color: #e65100; }
.product-card.status-pending .count-value { color: #e65100; }
.product-card.status-pending .tap-hint { color: #e65100; font-weight: 700; }
.btn-load-more { display: block; width: 100%; padding: 14px; margin-top: 10px; margin-bottom: 20px; font-size: 15px; font-weight: 700; color: var(--primary); background: #e3f2fd; border: 2px dashed var(--primary); border-radius: 10px; cursor: pointer; text-align: center; }
.btn-load-more:hover { background: #bbdefb; }
.progress-indicator-container { background: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); margin-bottom: 16px; border: 1px solid #e0e0e0; }
.progress-text { font-size: 13px; font-weight: 700; color: #333; margin-bottom: 8px; text-align: center; }
.progress-bar-track { width: 100%; height: 12px; background: #e0e0e0; border-radius: 6px; overflow: hidden; }
.progress-bar-fill { height: 100%; background-color: var(--primary); border-radius: 6px; transition: width 0.4s ease-in-out, background-color 0.4s ease-in-out; min-width: 0; }

/* 3. ESTILOS NUEVO DASHBOARD */
#newDashboardScreen { display: none; flex-direction: row; width: 100%; height: 100%; overflow: hidden; }
#sidebar { width: 260px; background: var(--bg-sidebar); display: flex; flex-direction: column; flex-shrink: 0; border-right: 1px solid var(--border-color); }
.sidebar-header { padding: 25px 20px; text-align: center; }
.sidebar-logo { font-size: 28px; font-weight: 800; color: var(--text-light); margin: 0; }
.sidebar-header .header-title p { margin: 8px 0 0 0; color: var(--text-muted); font-size: 15px; }
.sidebar-nav { list-style: none; padding: 0 15px; margin: 0; flex: 1; }
.nav-item { margin-bottom: 5px; }
.nav-item a { display: block; padding: 12px 15px; text-decoration: none; color: var(--text-muted); border-radius: 8px; font-weight: 500; transition: all 0.2s ease-in-out; }
.nav-item a:hover { background: var(--bg-panel); color: var(--text-light); }
.nav-item.active a { background: var(--accent-blue); color: #fff; font-weight: 700; }
.sidebar-footer { padding: 15px; border-top: 1px solid var(--border-color); }
.user-profile-widget { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.user-avatar { font-size: 24px; }
.user-info { display: flex; flex-direction: column; }
.user-name { font-weight: 700; }
.user-role { font-size: 12px; color: var(--text-muted); }
.sidebar-logout-btn { width: 100%; padding: 10px; border: 1px solid var(--border-color); background: transparent; color: var(--text-muted); border-radius: 8px; cursor: pointer; }
.sidebar-logout-btn:hover { background: var(--bg-panel); color: var(--text-light); }
#mainContent { flex: 1; padding: 15px 20px; overflow-y: auto; display: flex; flex-direction: column; }
.main-header { width: 100%; margin-bottom: 10px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; width: 100%; }
.kpi-card { background: var(--bg-panel); padding: 5px 12px; border-radius: 8px; border: 1px solid var(--border-color); }
.kpi-value { font-size: 16px; font-weight: 700; margin-bottom: 0; }
.kpi-label { color: var(--text-muted); font-size: 10px; margin-bottom: 2px; }
.kpi-trend { font-weight: 600; font-size: 10px; }
.kpi-trend.positive { color: var(--accent-green); }
.kpi-trend.negative { color: var(--accent-red); }
.kpi-extra { font-size: 9px; color: var(--text-muted); }
.main-panel-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; flex: 1; }
.panel { background: var(--bg-panel); padding: 20px; border-radius: 12px; border: 1px solid var(--border-color); display: flex; flex-direction: column; }
.panel h3 { margin-top: 0; }
.chart-placeholder, .table-placeholder { min-height: 150px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); border: 2px dashed var(--border-color); border-radius: 8px; margin-top: 15px; flex: 1; }

/* 4. MODALES */
.modal-backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); display: none; align-items: center; justify-content: center; z-index: 200; padding: 20px; }
.modal { background: white; border-radius: 12px; width: 100%; max-width: 420px; overflow: hidden; max-height: 90vh; display: flex; flex-direction: column; color: var(--text-primary-legacy); }
.modal-content { padding: 20px; overflow-y: auto; }
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 15px; }
.info-row { display: flex; justify-content: space-between; font-size: 14px; background: #f5f5f5; padding: 10px; border-radius: 8px; margin-bottom: 15px; }
.advanced-box { border: 1px solid #e0e0e0; padding: 15px; border-radius: 8px; margin-top: 10px; background: #fafafa; }
.btn-link { background: none; border: none; color: var(--primary); font-size: 13px; cursor: pointer; text-decoration: underline; padding: 5px 0; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; padding-top: 20px; border-top: 1px solid #eee; }
.btn { flex: 1; padding: 12px; font-size: 16px; font-weight: 700; border-radius: 8px; cursor: pointer; border: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-ghost { background: #eee; color: #333; }
.btn-excel { background: #1e8e3e; color: #fff; width:100%; }
.btn-audit { background: #8e24aa; color: #fff; width:100%; }
.btn-reset { background: #d32f2f; color: #fff; width:100%; }
.tabs-header { display: flex; border-bottom: 1px solid #eee; background: #f9f9f9; }
.tab-btn { flex: 1; padding: 12px; background: none; border: none; border-bottom: 3px solid transparent; cursor: pointer; font-weight: 600; font-size: 13px; color: #555; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: #fff; }
.tab-content { display: none; padding-top: 10px; }
.tab-content.active { display: block; }
.user-list-item { display: flex; justify-content: space-between; align-items: center; padding: 12px; background: #fff; border: 1px solid #eee; margin-bottom: 8px; border-radius: 8px; }
.user-info-name { font-weight: 700; color: #333; font-size: 15px; }
.user-info-stats { font-size: 12px; color: #888; }
.user-actions { display: flex; gap: 8px; }
.btn-delete-user, .btn-edit-user { border: none; padding: 6px 10px; border-radius: 6px; font-size: 14px; font-weight: 700; cursor: pointer; }
.btn-delete-user { background: #ffebee; color: #d32f2f; }
.btn-edit-user { background: #fff3e0; color: #e65100; }
.permissions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: #f9f9f9; padding: 10px; border-radius: 8px; border: 1px solid #eee; }
.permission-item { display: flex; align-items: center; }
.permission-item input { width: auto; margin-bottom: 0; margin-right: 8px; }
.permission-item label { font-size: 14px; }
#adminPermissionItem { grid-column: 1 / -1; background:#fff3e0; padding:5px; border-radius: 4px; border: 1px solid #ffe0b2; }
input:-webkit-autofill { -webkit-box-shadow: 0 0 0 30px white inset !important; }
.loading-spinner { border: 4px solid #f3f3f3; border-top: 4px solid var(--primary); border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; margin-left: auto; margin-right: auto; }

/* 4b. ESTILOS APP REGISTRO DE COMPRAS */
#purchaseOrderScreen { display: none; flex: 1; flex-direction: column; background: var(--bg-light); color: var(--text-primary-legacy); }
.card { background: #fff; padding: 16px; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); margin-bottom: 16px; }
#poSearchResults, #poProviderResults { max-height: 200px; overflow-y: auto; border: 1px solid #eee; border-radius: 8px; margin-top: -10px; background: #fff; z-index: 10; position: relative; }
.search-result-item { padding: 12px; border-bottom: 1px solid #f0f0f0; cursor: pointer; }
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background-color: #f5f5f5; }
.search-result-item .product-name { font-weight: 600; }
.search-result-item .product-ref { font-size: 12px; color: var(--text-muted-legacy); }
.po-add-form { margin-top: 15px; padding-top: 15px; border-top: 1px solid #eee; }
.po-add-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 15px; margin-bottom: 15px; }
.po-list-item { display: flex; flex-direction: column; align-items: stretch; padding: 12px; background: #f9f9f9; border: 1px solid #eee; border-radius: 8px; margin-bottom: 8px; }
.po-list-item-main { display: flex; align-items: center; }
.po-list-item-details { flex: 1; }
.po-list-item .product-name { font-weight: 700; font-size: 15px; color: #212121; }
.po-list-item .product-info { font-size: 13px; color: #555; }
.btn-delete-po-item { background: #ffebee; color: #d32f2f; border: none; font-size: 18px; font-weight: bold; padding: 8px 12px; border-radius: 6px; cursor: pointer; margin-left: 15px; }
.po-list-item.status-unknown { background-color: #ffebee; border-color: #ffcdd2; }
.po-list-item.status-sync-alert { background-color: #fffde7; border-color: #fff9c4; }
.po-list-item-alert-text { font-size: 12px; color: #c62828; font-weight: 500; margin-bottom: 8px; }
.po-sync-details { font-size: 11px; color: #666; background: rgba(255,255,255,0.5); padding: 4px; border-radius: 4px; margin-bottom: 8px; }
.po-sync-details .old-name { text-decoration: line-through; }
.po-sync-details .new-name { font-weight: bold; color: #2e7d32; }
.po-list-item-actions { margin-top: 10px; padding-top: 10px; border-top: 1px dashed #ccc; display: flex; gap: 8px; }
.btn-po-action { flex: 1; padding: 6px 8px; font-size: 12px; font-weight: 700; border-radius: 6px; cursor: pointer; border: 1px solid transparent; }
.btn-po-link { background-color: #e3f2fd; color: #1565c0; border-color: #bbdefb; }
.btn-po-create { background-color: #e8f5e9; color: #2e7d32; border-color: #c8e6c9; }
.btn-po-update { background-color: #fff3e0; color: #ef6c00; border-color: #ffe0b2; }

/* 5. PANTALLA DE TRANSFERENCIAS */
#transferScreen { display: none; flex: 1; flex-direction: column; background: var(--bg-light); color: var(--text-primary-legacy); }
.transfer-list { margin-top: 0; }
.tf-card { background: #fff; border-radius: 10px; padding: 14px; margin-bottom: 10px; border: 1px solid #e0e0e0; box-shadow: 0 1px 3px rgba(0,0,0,0.05); cursor: pointer; transition: box-shadow 0.2s, transform 0.15s; }
.tf-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); transform: translateY(-1px); }
.tf-card:active { transform: translateY(0); }
.tf-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tf-card-name { font-size: 15px; font-weight: 800; color: #212121; }
.tf-state-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap; }
.tf-state-badge.state-solicitado { background: #fff3e0; color: #e65100; }
.tf-state-badge.state-en_transito { background: #e3f2fd; color: #1565c0; }
.tf-state-badge.state-preparado { background: #e8f5e9; color: #2e7d32; }
.tf-card-route { font-size: 13px; color: #555; margin-bottom: 6px; }
.tf-card-route strong { color: #212121; }
.tf-card-meta { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: #9e9e9e; }
.tf-card-products { font-weight: 600; color: #757575; }
.tf-search-results { max-height: 200px; overflow-y: auto; border: 1px solid #eee; border-radius: 8px; margin-top: -10px; background: #fff; z-index: 10; position: relative; }
.tf-search-results:empty { display: none; }
.tf-search-item { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; cursor: pointer; transition: background 0.15s; }
.tf-search-item:last-child { border-bottom: none; }
.tf-search-item:hover { background-color: #e8f5e9; }
.tf-search-item-name { font-weight: 600; font-size: 14px; color: #212121; }
.tf-search-item-ref { font-size: 12px; color: var(--text-muted-legacy); margin-top: 1px; }
.transfer-product-list { margin-top: 8px; }
.tf-product-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; background: #f9f9f9; border: 1px solid #eee; border-radius: 8px; margin-bottom: 6px; }
.tf-product-info { flex: 1; }
.tf-product-name { font-weight: 700; font-size: 14px; color: #212121; }
.tf-product-ref { font-size: 11px; color: var(--text-muted-legacy); margin-top: 2px; }
.tf-product-qty { font-size: 18px; font-weight: 800; color: var(--primary-dark); min-width: 50px; text-align: center; }
.tf-product-uom { font-size: 10px; color: #757575; font-weight: 600; }
.tf-product-remove { background: #ffebee; color: #d32f2f; border: none; font-size: 16px; font-weight: bold; padding: 6px 10px; border-radius: 6px; cursor: pointer; margin-left: 10px; }
.tf-product-remove:hover { background: #ffcdd2; }
.tf-detail-route { display: flex; align-items: center; gap: 10px; background: #f5f5f5; padding: 12px; border-radius: 8px; margin-top: 10px; }
.tf-detail-route-item { flex: 1; text-align: center; }
.tf-detail-route-item .field-label { margin-bottom: 2px; font-size: 11px; }
.tf-detail-route-arrow { font-size: 20px; font-weight: 800; color: #00897b; flex-shrink: 0; }
.tf-detail-qty-row { display: flex; align-items: center; gap: 8px; }
.tf-detail-qty-label { font-size: 11px; color: #757575; min-width: 65px; }
.tf-detail-qty-value { font-size: 15px; font-weight: 700; color: #212121; }
.tf-detail-qty-input { width: 80px; padding: 8px; font-size: 15px; font-weight: 700; text-align: center; border: 2px solid #bbdefb; border-radius: 8px; margin-bottom: 0; }
.tf-detail-qty-input:focus { border-color: var(--primary); outline: none; }
.tf-empty-state { text-align: center; padding: 40px 20px; color: #9e9e9e; }
.tf-empty-state-icon { font-size: 40px; margin-bottom: 10px; opacity: 0.6; }
.tf-empty-state-text { font-size: 14px; font-weight: 600; }
.tf-empty-state-sub { font-size: 12px; margin-top: 4px; }
.tf-product-item.tf-item-pending { background: #fff8e1; border-color: #ffecb3; }
.tf-product-item.tf-item-prepared { background: #e8f5e9; border-color: #c8e6c9; }
.tf-product-item.tf-item-received { background: #c8e6c9; border-color: #a5d6a7; }
.tf-item-check-btn { width: 40px; height: 40px; border-radius: 50%; border: 2px solid #e0e0e0; background: #fff; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-left: 10px; transition: all 0.2s; }
.tf-item-check-btn:hover { border-color: #4caf50; background: #e8f5e9; }
.tf-item-check-btn.checked { background: #4caf50; border-color: #388e3c; color: #fff; }
.tf-item-check-btn.checked:hover { background: #388e3c; }
.tf-detail-search { width: 100%; padding: 10px 12px; font-size: 14px; border: 1px solid #ccc; border-radius: 8px; margin-bottom: 12px; background: #fff; color: #212121; }
.tf-detail-search:focus { border-color: var(--primary); outline: none; }
.tf-progress-container { margin-top: 8px; }
.tf-progress-track { width: 100%; height: 6px; background: #e0e0e0; border-radius: 3px; overflow: hidden; }
.tf-progress-fill { height: 100%; border-radius: 3px; transition: width 0.3s ease; }
.tf-progress-fill.progress-pending { background: #ffc107; }
.tf-progress-fill.progress-done { background: #4caf50; }
.tf-progress-label { font-size: 10px; color: #757575; margin-top: 3px; text-align: right; }
.tf-state-badge.state-requested { background: #fff3e0; color: #e65100; }
.tf-state-badge.state-preparing { background: #fff8e1; color: #f9a825; }
.tf-state-badge.state-ready { background: #e8f5e9; color: #2e7d32; }
.tf-state-badge.state-receiving { background: #e3f2fd; color: #1565c0; }
.tf-state-badge.state-sent { background: #e8f5e9; color: #1b5e20; font-weight: 800; }

/* 6. PANTALLA DE PRECIO */
#priceCheckScreen { display: none; flex: 1; flex-direction: column; align-items: center; justify-content: center; background: var(--bg-light); color: var(--text-primary-legacy); }

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* 7. PANTALLA MÓDULO IA AGENT */
#iaAgentScreen { display: none; flex: 1; flex-direction: column; background: var(--bg-dark); color: var(--text-light); height: 100%; }
.ia-agent-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--bg-sidebar); border-bottom: 1px solid var(--border-color); flex-shrink: 0; position: sticky; top: 0; z-index: 100; }
.ia-agent-header-left { display: flex; align-items: center; gap: 10px; }
.ia-agent-header-left .btn-home { color: var(--text-light); }
.ia-agent-brain { font-size: 26px; line-height: 1; }
.ia-agent-title { font-weight: 800; font-size: 16px; color: var(--text-light); }
.ia-agent-model { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.ia-agent-header-right { display: flex; align-items: center; }
.ia-agent-user { font-size: 12px; color: var(--text-muted); background: var(--bg-panel); padding: 4px 12px; border-radius: 20px; border: 1px solid var(--border-color); }
.ia-agent-chat-area { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.ia-chat-welcome { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 60px 20px; flex: 1; }
.ia-chat-welcome-icon { font-size: 56px; margin-bottom: 20px; opacity: 0.8; }
.ia-chat-welcome-title { font-size: 20px; font-weight: 700; color: var(--text-light); margin-bottom: 10px; }
.ia-chat-welcome-desc { font-size: 14px; color: var(--text-muted); max-width: 400px; line-height: 1.6; }
.ia-chat-bubble { max-width: 80%; padding: 12px 16px; border-radius: 14px; font-size: 14px; line-height: 1.55; word-wrap: break-word; animation: iaFadeIn 0.2s ease-out; }
.ia-chat-bubble.user { background: var(--accent-blue); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.ia-chat-bubble.ia { background: var(--bg-panel); color: var(--text-light); align-self: flex-start; border-bottom-left-radius: 4px; border: 1px solid var(--border-color); }
.ia-chat-bubble .bubble-sender { font-size: 10px; font-weight: 700; margin-bottom: 4px; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.5px; }
.ia-chat-bubble.user .bubble-sender { color: rgba(255, 255, 255, 0.7); }
.ia-chat-bubble.ia .bubble-sender { color: var(--accent-blue); }
.ia-chat-thinking { align-self: flex-start; display: flex; align-items: center; gap: 6px; padding: 12px 18px; background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 14px; border-bottom-left-radius: 4px; }
.ia-chat-thinking-dot { width: 8px; height: 8px; background: var(--text-muted); border-radius: 50%; animation: iaThinkingBounce 1.2s infinite; }
.ia-chat-thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.ia-chat-thinking-dot:nth-child(3) { animation-delay: 0.4s; }
.ia-agent-input-bar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--bg-sidebar); border-top: 1px solid var(--border-color); flex-shrink: 0; }
.ia-agent-input { flex: 1; padding: 12px 16px; font-size: 15px; border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-dark); color: var(--text-light); outline: none; margin-bottom: 0; transition: border-color 0.2s; }
.ia-agent-input::placeholder { color: var(--text-muted); }
.ia-agent-input:focus { border-color: var(--accent-blue); }
.ia-chat-mic-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border-color); background: var(--bg-dark); font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.2s; }
.ia-chat-mic-btn:hover { background: var(--bg-panel); border-color: var(--accent-green); }
.ia-chat-mic-btn.listening { background: rgba(244, 67, 54, 0.15); border-color: var(--accent-red); animation: iaMicPulse 1.5s infinite; }
.ia-chat-send-btn { width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--accent-blue); color: #fff; font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.2s; }
.ia-chat-send-btn:hover { background: #1e88e5; transform: scale(1.05); }
.ia-chat-send-btn:active { transform: scale(0.95); }

@keyframes iaFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes iaThinkingBounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-6px); opacity: 1; } }
@keyframes iaMicPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.3); } 50% { box-shadow: 0 0 0 10px rgba(244, 67, 54, 0); } }

/* 8. MODAL VINCULAR PRODUCTO */
#linkProductBackdrop .search-result-item { padding: 12px; border-bottom: 1px solid #f0f0f0; cursor: pointer; transition: background 0.15s; }
#linkProductBackdrop .search-result-item:last-child { border-bottom: none; }
#linkProductBackdrop .search-result-item:hover { background-color: #e3f2fd; }
#linkProductBackdrop .search-result-item .product-name { font-weight: 700; font-size: 14px; color: #212121; }
#linkProductBackdrop .search-result-item .product-ref { font-size: 12px; color: var(--text-muted-legacy); margin-top: 2px; }
#linkProductSearchInput { margin-bottom: 10px; }
#linkProductSearchResults .link-no-results { text-align: center; padding: 20px; color: #999; font-size: 13px; }

/* 9. ESTILOS DE ESTADO DE SINCRONIZACIÓN */
#offlineIndicator { display: none; background-color: var(--danger); color: white; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px; text-transform: uppercase; cursor: pointer; }
#syncPendingIndicator { display: none; }
#btnRetrySync { background-color: #fff3e0; color: #e65100; border: 1px solid #ffe0b2; font-size: 13px; font-weight: 700; padding: 5px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; transition: background-color 0.2s; }
#btnRetrySync:hover { background-color: #ffe0b2; }
#btnRetrySync:disabled { cursor: not-allowed; opacity: 0.6; }

/* 10. BANNER DE ADVERTENCIA DE ALMACENAMIENTO */
.storage-banner { width: 100%; order: 3; text-align: center; font-size: 12px; font-weight: 700; padding: 4px 0; margin-top: 8px; transition: background-color 0.3s ease-in-out; }
.storage-banner.status-warning { background-color: var(--accent-yellow); color: #333; }
.storage-banner.status-critical { background-color: var(--danger); color: white; }

/* 11. SUB-DASHBOARD DE INVENTARIO */
#inventoryDashScreen { display: none; flex: 1; flex-direction: column; background: var(--bg-light); min-height: 100vh; }
.inv-dash-container { flex: 1; display: flex; align-items: center; justify-content: center; padding: 30px 20px; }
.inv-dash-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; max-width: 380px; width: 100%; }
.inv-dash-card { background: #fff; border-radius: 14px; padding: 24px 16px; text-align: center; cursor: pointer; border: 1px solid #e0e0e0; box-shadow: 0 2px 4px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06); transition: transform 0.25s ease, box-shadow 0.25s ease; position: relative; overflow: hidden; }
.inv-dash-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, #1976d2, #42a5f5); opacity: 0; transition: opacity 0.25s ease; }
.inv-dash-card:hover { transform: translateY(-4px); box-shadow: 0 4px 8px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.1); }
.inv-dash-card:hover::before { opacity: 1; }
.inv-dash-card:nth-child(2)::before { background: linear-gradient(90deg, #00897b, #4db6ac); }
.inv-dash-card:active { transform: translateY(-1px); }
.inv-dash-card-icon { width: 64px; height: 64px; margin: 0 auto 12px; display: flex; align-items: center; justify-content: center; background: linear-gradient(145deg, #f5f5f5, #e8e8e8); border-radius: 16px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.06); }
.inv-dash-card-title { font-size: 15px; font-weight: 700; color: #212121; margin-bottom: 4px; }
.inv-dash-card-desc { font-size: 11px; color: #757575; line-height: 1.4; }

/* 12. MODULO DE FACTURACION — DASHBOARD + POS */
#billingDashScreen { display: none; flex: 1; flex-direction: column; background: var(--bg-light); min-height: 100vh; }
.billing-dash-container { flex: 1; display: flex; align-items: center; justify-content: center; padding: 30px 20px; }
.billing-dash-card { background: #fff; border-radius: 16px; width: 100%; max-width: 420px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); overflow: hidden; border: 1px solid #e0e0e0; }
.billing-dash-card-header { background: linear-gradient(135deg, #1565c0, #1976d2); padding: 24px 20px; display: flex; align-items: center; gap: 14px; }
.billing-dash-card-icon { font-size: 36px; }
.billing-dash-card-title { font-size: 22px; font-weight: 800; color: #fff; }
.billing-dash-card-body { padding: 24px 20px; }
.billing-candidate-btn { display: block; width: 100%; padding: 10px; margin-bottom: 6px; background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; text-align: left; }
.billing-candidate-btn:hover { background: #bbdefb; }
#billingPOSScreen { display: none; flex: 1; flex-direction: column; background: var(--bg-light); color: var(--text-primary-legacy); height: 100vh; overflow: hidden; }
.billing-pos-layout { display: flex; flex: 1; height: 100%; overflow: hidden; }
.billing-pos-left { width: 380px; flex-shrink: 0; display: flex; flex-direction: column; background: #fff; border-right: 1px solid #e0e0e0; overflow: hidden; transition: background-color 0.3s ease; }
.billing-pos-left-header { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #eee; flex-shrink: 0; }
.billing-pos-back-btn { background: none; border: 1px solid #ccc; border-radius: 8px; font-size: 20px; width: 40px; height: 40px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.billing-pos-back-btn:hover { background: #f5f5f5; }
.billing-pos-toggle { display: flex; background: #f0f0f0; border-radius: 8px; padding: 3px; margin-bottom: 10px; }
.billing-toggle-btn { flex: 1; padding: 8px 8px; border: none; border-radius: 6px; font-size: 12px; font-weight: 700; cursor: pointer; background: transparent; color: #757575; transition: all 0.2s; white-space: nowrap; }
.billing-toggle-btn.billing-toggle-active { background: #1976d2; color: #fff; box-shadow: 0 2px 4px rgba(25,118,210,0.3); }
.billing-customer-section { padding: 10px 14px; border-bottom: 1px solid #eee; flex-shrink: 0; position: relative; }
.billing-customer-section input[type="search"] { margin-bottom: 0; padding: 10px 12px; font-size: 14px; }
.billing-customer-results { position: absolute; left: 14px; right: 14px; top: 52px; background: #fff; border: 1px solid #ddd; border-radius: 8px; max-height: 200px; overflow-y: auto; z-index: 50; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.billing-customer-result-item { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid #f0f0f0; transition: background 0.15s; }
.billing-customer-result-item:last-child { border-bottom: none; }
.billing-customer-result-item:hover { background: #e3f2fd; }
.billing-customer-result-name { font-weight: 700; font-size: 14px; color: #212121; }
.billing-customer-result-detail { font-size: 12px; color: #757575; margin-top: 2px; }
.billing-customer-no-results { padding: 16px; text-align: center; color: #999; font-size: 13px; }
.billing-selected-customer { display: flex; align-items: center; gap: 8px; background: #e8f5e9; padding: 8px 12px; border-radius: 8px; margin-top: 8px; border: 1px solid #c8e6c9; }
.billing-selected-customer-name { flex: 1; font-weight: 700; font-size: 14px; color: #2e7d32; }
.billing-selected-customer-detail { font-size: 12px; color: #555; }
.billing-clear-customer-btn { background: none; border: none; font-size: 16px; cursor: pointer; color: #c62828; padding: 2px 6px; }
.billing-cart-section { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.billing-cart-header { padding: 8px 14px; font-weight: 700; font-size: 13px; color: #555; border-bottom: 1px solid #eee; flex-shrink: 0; }
.billing-cart-list { flex: 1; overflow-y: auto; padding: 8px 14px; }
.billing-cart-empty { text-align: center; padding: 40px 20px; color: #bdbdbd; font-size: 14px; }
.billing-cart-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #f5f5f5; }
.billing-cart-item:last-child { border-bottom: none; }
.billing-cart-item-info { flex: 1; }
.billing-cart-item-name { font-weight: 700; font-size: 13px; color: #212121; }
.billing-cart-item-detail { font-size: 11px; color: #757575; margin-top: 2px; }
.billing-cart-item-right { display: flex; align-items: center; gap: 8px; }
.billing-cart-item-subtotal { font-weight: 700; font-size: 14px; color: #212121; }
.billing-cart-remove-btn { background: none; border: none; font-size: 16px; color: #d32f2f; cursor: pointer; padding: 4px; }
.billing-cart-item-itbis { font-size: 10px; color: #e65100; margin-top: 1px; font-weight: 600; }
.billing-confirm-itbis-row td { border-bottom: 1px solid #f5f5f5 !important; padding-top: 0 !important; padding-bottom: 6px !important; }
.billing-sale-fields { padding: 10px 14px; border-top: 1px solid #eee; flex-shrink: 0; }
.billing-sale-fields-row { display: flex; gap: 10px; margin-bottom: 0; }
.billing-sale-field { flex: 1; }
.billing-sale-field select, .billing-sale-field input[type="date"] { padding: 8px 10px; font-size: 13px; margin-bottom: 8px; }
.billing-sale-field .field-label { font-size: 11px; margin-bottom: 4px; }
.billing-pos-footer { padding: 14px; border-top: 2px solid #e0e0e0; flex-shrink: 0; }
.billing-pos-total { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 20px; font-weight: 800; color: #212121; }
.billing-send-btn { width: 100%; padding: 16px; font-size: 18px; font-weight: 800; border: none; border-radius: 10px; cursor: pointer; background: linear-gradient(135deg, #1565c0, #1976d2); color: #fff; box-shadow: 0 4px 12px rgba(25,118,210,0.3); transition: all 0.2s; }
.billing-send-btn:hover { background: linear-gradient(135deg, #0d47a1, #1565c0); box-shadow: 0 6px 16px rgba(25,118,210,0.4); transform: translateY(-1px); }
.billing-send-btn:active { transform: translateY(0); }
.billing-send-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.billing-pos-right { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: #fafafa; transition: background-color 0.3s ease; }
.billing-pos-right-header { padding: 10px 14px; border-bottom: 1px solid #e0e0e0; flex-shrink: 0; }

/* 13.1 BARRA DUAL DE BUSQUEDA */
.billing-pos-search-bar { display: flex; gap: 10px; align-items: stretch; }
.billing-pos-search-invoice { flex: 0 0 280px; display: flex; gap: 6px; align-items: center; }
.billing-pos-search-invoice input { flex: 1; padding: 10px 12px; font-size: 14px; border: 2px solid #e0e0e0; border-radius: 10px; margin-bottom: 0; transition: border-color 0.2s, background-color 0.2s; }
.billing-pos-search-invoice input:focus { border-color: #00897b; outline: none; }
.billing-pos-search-btn { flex-shrink: 0; width: 42px; height: 42px; border: none; border-radius: 10px; background: #00897b; color: #fff; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.billing-pos-search-btn:hover { background: #00695c; }
.billing-pos-search-product { flex: 1; }
.billing-pos-search-product input { width: 100%; padding: 10px 14px; font-size: 15px; border: 2px solid #e0e0e0; border-radius: 10px; margin-bottom: 0; transition: border-color 0.2s, background-color 0.2s; }
.billing-pos-search-product input:focus { border-color: #1976d2; outline: none; }

/* 13.2 BADGES DE STOCK */
.billing-stock-badge { position: absolute; top: 4px; left: 4px; background: #4caf50; color: #fff; font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 10px; min-width: 20px; text-align: center; }
.billing-stock-badge.billing-stock-zero { background: #f44336; }
.billing-forecast-badge { position: absolute; top: 4px; right: 4px; background: #f9a825; color: #fff; font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 10px; min-width: 20px; text-align: center; }
.billing-forecast-badge.billing-forecast-zero { background: #f44336; }
.billing-forecast-badge.billing-forecast-match { background: #4caf50; }

/* 13.3 COLORES POR METODO DE FACTURACION (panel + header + toggle + barras de busqueda) */
/* Se sincroniza el color de ambos paneles y headers (izquierdo y derecho) */
#billingPOSScreen.billing-mode-pos .billing-pos-right,
#billingPOSScreen.billing-mode-pos .billing-pos-left { background: #fafafa; }
#billingPOSScreen.billing-mode-pos .billing-pos-right-header { border-bottom-color: #e0e0e0; }

/* -- MODO CREDITO -- */
#billingPOSScreen.billing-mode-credit .billing-pos-right,
#billingPOSScreen.billing-mode-credit .billing-pos-left { background: #fffde7; }
#billingPOSScreen.billing-mode-credit .billing-pos-right-header,
#billingPOSScreen.billing-mode-credit .billing-pos-left-header { background: #f9a825; border-bottom-color: #f57f17; color: #fff; }
#billingPOSScreen.billing-mode-credit .billing-toggle-btn.billing-toggle-active { background: #f9a825; color: #fff; box-shadow: 0 2px 4px rgba(249,168,37,0.3); }
#billingPOSScreen.billing-mode-credit .billing-pos-search-invoice input,
#billingPOSScreen.billing-mode-credit .billing-pos-search-product input { border-color: #f57f17; background: #fff; }
#billingPOSScreen.billing-mode-credit .billing-pos-search-btn { background: #f9a825; }

/* -- MODO COTIZACION -- */
#billingPOSScreen.billing-mode-quote .billing-pos-right,
#billingPOSScreen.billing-mode-quote .billing-pos-left { background: #e8f5e9; }
#billingPOSScreen.billing-mode-quote .billing-pos-right-header,
#billingPOSScreen.billing-mode-quote .billing-pos-left-header { background: #43a047; border-bottom-color: #2e7d32; color: #fff; }
#billingPOSScreen.billing-mode-quote .billing-toggle-btn.billing-toggle-active { background: #43a047; color: #fff; box-shadow: 0 2px 4px rgba(67,160,71,0.3); }
#billingPOSScreen.billing-mode-quote .billing-pos-search-invoice input,
#billingPOSScreen.billing-mode-quote .billing-pos-search-product input { border-color: #2e7d32; background: #fff; }
#billingPOSScreen.billing-mode-quote .billing-pos-search-btn { background: #43a047; }

/* -- MODO ATENCION -- */
#billingPOSScreen.billing-mode-attention .billing-pos-right,
#billingPOSScreen.billing-mode-attention .billing-pos-left { background: #fff3e0; }
#billingPOSScreen.billing-mode-attention .billing-pos-right-header,
#billingPOSScreen.billing-mode-attention .billing-pos-left-header { background: #ef6c00; border-bottom-color: #e65100; color: #fff; }
#billingPOSScreen.billing-mode-attention .billing-toggle-btn.billing-toggle-active { background: #ef6c00; color: #fff; box-shadow: 0 2px 4px rgba(239,108,0,0.3); }
#billingPOSScreen.billing-mode-attention .billing-pos-search-invoice input,
#billingPOSScreen.billing-mode-attention .billing-pos-search-product input { border-color: #e65100; background: #fff; }
#billingPOSScreen.billing-mode-attention .billing-pos-search-btn { background: #ef6c00; }

/* -- Estilos adicionales para textos y botones en headers con color -- */
#billingPOSScreen:not(.billing-mode-pos) .billing-pos-left-header .billing-pos-toggle { background: rgba(0,0,0,0.1); }
#billingPOSScreen:not(.billing-mode-pos) .billing-pos-left-header .billing-toggle-btn { color: rgba(255,255,255,0.85); }
#billingPOSScreen:not(.billing-mode-pos) .billing-pos-left-header .billing-pos-back-btn { border-color: rgba(255,255,255,0.5); }
#billingPOSScreen:not(.billing-mode-pos) .billing-pos-left-header .billing-pos-back-btn:hover { background: rgba(0,0,0,0.1); }

.billing-product-grid { flex: 1; overflow-y: auto; padding: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; align-content: start; }
.billing-product-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    padding: 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    position: relative;
    min-height: 170px;
    display: flex;
    flex-direction: column;
}
.billing-product-card:hover { border-color: #1976d2; box-shadow: 0 2px 8px rgba(25,118,210,0.15); transform: translateY(-2px); }
.billing-product-card:active { transform: translateY(0); }
.billing-product-img-wrap { position: relative; width: 100%; height: 90px; min-height: 90px; flex-shrink: 0; margin-bottom: 6px; border-radius: 6px; overflow: hidden; background: #f5f5f5; display: flex; align-items: center; justify-content: center; }
.billing-product-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.billing-product-no-img { font-size: 36px; color: #ccc; }
.billing-product-name {
    font-size: 11px;
    font-weight: 600;
    color: #212121;
    line-height: 1.3;
    margin-bottom: 4px;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.billing-product-price { font-size: 12px; font-weight: 800; color: #1565c0; }
.billing-loading { grid-column: 1 / -1; text-align: center; padding: 40px 20px; color: #999; font-size: 14px; }
.billing-load-more { grid-column: 1 / -1; text-align: center; padding: 14px; background: #e3f2fd; color: #1565c0; border: 2px dashed #1976d2; border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 13px; }
.billing-load-more:hover { background: #bbdefb; }
.billing-warehouse-table { width: 100%; border-collapse: collapse; }
.billing-warehouse-table th { text-align: left; font-size: 12px; font-weight: 700; color: #555; padding: 8px; border-bottom: 2px solid #e0e0e0; }
.billing-warehouse-table td { padding: 10px 8px; font-size: 14px; border-bottom: 1px solid #f0f0f0; }
.billing-wh-qty-input { width: 80px; padding: 8px; font-size: 15px; font-weight: 700; text-align: center; border: 2px solid #bbdefb; border-radius: 8px; margin-bottom: 0; }
.billing-wh-qty-input:focus { border-color: #1976d2; outline: none; }
.billing-pos-status { padding: 10px 14px; font-size: 13px; color: #e65100; background: #fff3e0; text-align: center; font-weight: 600; flex-shrink: 0; }
.billing-confirm-header { background: #f5f5f5; padding: 12px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; line-height: 1.6; }
.billing-confirm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.billing-confirm-table th { text-align: left; font-size: 11px; font-weight: 700; color: #555; padding: 6px 8px; border-bottom: 2px solid #e0e0e0; }
.billing-confirm-table td { padding: 8px; border-bottom: 1px solid #f0f0f0; }
.billing-confirm-table tfoot td { border-top: 2px solid #212121; border-bottom: none; padding-top: 10px; }
.billing-resizer { width: 6px; background: #e0e0e0; cursor: col-resize; flex-shrink: 0; transition: background 0.2s; position: relative; }
.billing-resizer:hover, .billing-resizer-active { background: #1976d2; }
.billing-resizer::after { content: '⋮'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #999; font-size: 14px; pointer-events: none; }
.billing-resizer:hover::after, .billing-resizer-active::after { color: #fff; }
.billing-pos-total-container { margin-bottom: 10px; }
.billing-totals-breakdown { display: flex; flex-direction: column; gap: 4px; }
.billing-totals-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #555; }
.billing-totals-row.billing-totals-itbis { color: #e65100; font-weight: 600; }
.billing-totals-row.billing-totals-final { font-size: 20px; font-weight: 800; color: #212121; padding-top: 6px; border-top: 2px solid #e0e0e0; margin-top: 4px; }

@media (max-width: 768px) {
    .billing-pos-layout { flex-direction: column; }
    .billing-pos-left { width: 100%; max-height: 50vh; border-right: none; border-bottom: 2px solid #e0e0e0; }
    .billing-resizer { display: none; }
    .billing-pos-right { flex: 1; }
    .billing-product-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
    .billing-product-img-wrap { height: 70px; }
    .billing-pos-toggle { flex-wrap: wrap; }
    .billing-toggle-btn { flex: 1 1 45%; font-size: 11px; padding: 6px 4px; }
    .billing-pos-search-bar { flex-direction: column; gap: 6px; }
    .billing-pos-search-invoice { flex: 1; }
}

/* ============================================================= */
/* 14. ESTILOS CONDUCE / FACTURA                                  */
/* ============================================================= */
.inv-document { background: #fff; color: #212121; padding: 30px; font-family: 'Segoe UI', Arial, sans-serif; font-size: 13px; line-height: 1.5; max-width: 850px; margin: 0 auto; }
.inv-header { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 20px; border-bottom: 2px solid #c8a415; margin-bottom: 20px; }
.inv-header-left { flex: 1; }
.inv-logo-img { max-height: 60px; margin-bottom: 8px; }
.inv-company-name { font-size: 16px; font-weight: 800; color: #333; margin-bottom: 4px; }
.inv-company-detail { font-size: 12px; color: #555; line-height: 1.6; }
.inv-header-right { text-align: right; flex-shrink: 0; }
.inv-doc-title { font-size: 22px; font-weight: 800; color: #c8a415; margin-bottom: 8px; }
.inv-ncf { margin-bottom: 6px; }
.inv-ncf-label { font-size: 11px; color: #777; }
.inv-ncf-value { font-size: 15px; font-weight: 700; color: #c8a415; }
.inv-doc-date { font-size: 12px; color: #555; margin-bottom: 2px; }
.inv-client-section { background: #f9f9f9; border: 1px solid #e0e0e0; border-radius: 6px; padding: 14px 18px; margin-bottom: 20px; }
.inv-client-row { font-size: 13px; margin-bottom: 4px; }
.inv-client-meta { display: flex; gap: 20px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #e0e0e0; font-size: 12px; color: #555; flex-wrap: wrap; }
.inv-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-size: 12px; }
.inv-table thead th { background: #333; color: #fff; padding: 8px 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap; }
.inv-table tbody td { padding: 8px 6px; border-bottom: 1px solid #e8e8e8; vertical-align: top; }
.inv-table tbody tr:nth-child(even) { background: #fafafa; }
.inv-center { text-align: center; }
.inv-right { text-align: right; }
.inv-totals { display: flex; flex-direction: column; align-items: flex-end; margin-bottom: 20px; }
.inv-totals-row { display: flex; justify-content: space-between; width: 280px; padding: 6px 0; font-size: 13px; border-bottom: 1px solid #eee; }
.inv-totals-row span:first-child { font-weight: 600; color: #555; }
.inv-totals-row span:last-child { font-weight: 700; }
.inv-totals-grand { border-bottom: none; border-top: 2px solid #333; padding-top: 10px; margin-top: 4px; font-size: 16px; }
.inv-totals-grand span { font-weight: 800 !important; color: #212121 !important; }
.inv-footer { text-align: center; font-size: 11px; color: #888; border-top: 1px solid #e0e0e0; padding-top: 15px; margin-top: 20px; }
.inv-footer-copies { margin-top: 6px; color: #aaa; }

/* ============================================================= */
/* 15. MEDIA PRINT — ESTILOS PARA IMPRESION                      */
/* ============================================================= */
@media print {
    body > *:not(#invoiceViewerBackdrop) { display: none !important; }
    #invoiceViewerBackdrop { display: block !important; position: static !important; background: none !important; padding: 0 !important; }
    #invoiceViewerBackdrop .modal { max-width: 100% !important; width: 100% !important; max-height: none !important; box-shadow: none !important; border-radius: 0 !important; }
    #invoiceViewerBackdrop .modal > div:first-child { display: none !important; }
    #invoiceViewerContent { overflow: visible !important; }
    .inv-document { padding: 10px 0 !important; max-width: 100% !important; }
    .inv-table { font-size: 11px !important; }
    .inv-table thead th { background: #333 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .inv-doc-title { color: #333 !important; }
    .inv-header { border-bottom-color: #333 !important; }
}

