/* ============================================================
   CERTIFICADOS Y FDS — ESTILO ADMINISTRACIÓN FLOMAY
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Arial, sans-serif;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

:root {
    --transition-speed: 0.3s;
    --bg-dark: #f0f2f5;
    --bg-darker: #ffffff;
    --text-light: #1a1b1e;
    --text-gray: #4b5563;
    --text-soft: #718096;
    --primary-blue: #3b82f6;
    --accent-dark: #2563eb;
    --green: #059669;
    --green-light: #10b981;
    --orange: #d97706;
    --orange-light: #f59e0b;
    --red: #dc2626;
    --red-light: #ef4444;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --overlay-color: rgba(255, 255, 255, 0.35);
    --border: #dde3ec;
}

/* Degradado para el fondo de la página */
body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e5e9f2 100%);
    min-height: 100vh;
}

/* ---- HEADER ---- */
header {
    background-color: var(--bg-darker);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-image {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.logo {
    color: var(--text-light);
    font-weight: bold;
    font-size: 1.2rem;
}

.search-bar {
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 400px;
    margin: 0 2rem;
}

.search-bar input {
    padding: 0.8rem;
    border: none;
    border-radius: 20px;
    width: 100%;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-light);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.search-bar input::placeholder { color: var(--text-gray); }

.search-bar input:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.08);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logout-button {
    background-color: transparent;
    border: 1px solid var(--primary-blue);
    color: var(--primary-blue);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.logout-button:hover {
    background-color: var(--primary-blue);
    color: white;
}

#userName {
    font-weight: 500;
    color: var(--text-light);
}

/* ---- MAIN ---- */
.main-content {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem 70px 1rem;
}

/* ---- TABS PRINCIPALES ---- */
.tabs-wrapper {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 0.5rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.tab-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--text-gray);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-main:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-blue);
}

.tab-main.active {
    background: var(--primary-blue);
    color: white;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.tab-main i { font-size: 1.1rem; }

/* ---- TAB PANELS ---- */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- CONTROLS BAR ---- */
.controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 1.2rem 1.5rem;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.8);
    gap: 1rem;
    flex-wrap: wrap;
}

.filters {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.filters select {
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    color: var(--text-light);
    cursor: pointer;
    min-width: 160px;
    transition: all 0.3s ease;
}

.filters select:hover { border-color: var(--primary-blue); }
.filters select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.refresh-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2);
}

.refresh-button:hover {
    background: var(--accent-dark);
    box-shadow: 0 6px 10px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

.refresh-button.btn-danger {
    background: var(--red);
    box-shadow: 0 4px 6px rgba(220, 38, 38, 0.2);
}

.refresh-button.btn-danger:hover {
    background: #b91c1c;
    box-shadow: 0 6px 10px rgba(220, 38, 38, 0.3);
}

.panel-desc {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-gray);
    font-size: 0.9rem;
}

.stats {
    display: flex;
    gap: 1rem;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.8rem 1.5rem;
    background: rgba(59, 130, 246, 0.05);
    border-radius: 12px;
    min-width: 100px;
}

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

.stat-label {
    font-size: 0.7rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.2rem;
}

/* ---- SECCIONES ---- */
.conductores-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.conductor-section {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.8);
    overflow: hidden;
    transition: all 0.3s ease;
}

.conductor-section:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    transform: translateY(-3px);
}

.conductor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-dark));
    color: white;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.conductor-header::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100%;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.1) 100%);
    transform: skewX(-25deg) translateX(100%);
    transition: transform 0.5s ease;
}

.conductor-section:hover .conductor-header::after {
    transform: skewX(-25deg) translateX(70%);
}

.conductor-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.conductor-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transition: transform 0.3s ease;
}

.conductor-section:hover .conductor-avatar {
    transform: scale(1.1);
}

.conductor-avatar.grupo-hipoclorito { background: rgba(255, 255, 255, 0.25); }
.conductor-avatar.grupo-sosa { background: rgba(255, 255, 255, 0.25); }
.conductor-avatar.grupo-sulfurico { background: rgba(255, 255, 255, 0.25); }
.conductor-avatar.grupo-citrico { background: rgba(255, 255, 255, 0.25); }
.conductor-avatar.grupo-sosa25 { background: rgba(255, 255, 255, 0.25); }
.conductor-avatar.grupo-sosa32 { background: rgba(255, 255, 255, 0.25); }

.conductor-details h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: white;
}

.conductor-details p {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 0.2rem;
}

.conductor-stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-group-action, .btn-generar-grupo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-group-action:hover, .btn-generar-grupo:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

/* ---- CARDS DE ARTÍCULOS ---- */
.pedidos-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.2rem;
    padding: 1.5rem;
    background: var(--bg-dark);
}

.pedido-card {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 1.2rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.pedido-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-blue);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pedido-card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(-5px);
}

.pedido-card:hover::before {
    opacity: 1;
}

.pedido-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.pedido-title h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 0.3rem;
}

.pedido-title span {
    font-size: 0.85rem;
    color: var(--text-gray);
}

.pedido-title strong {
    color: var(--primary-blue);
    font-weight: 600;
}

.pedido-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.detail-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.88rem;
    color: var(--text-gray);
}

.detail-row i {
    width: 16px;
    color: var(--primary-blue);
    flex-shrink: 0;
}

.detail-row.muted {
    color: var(--text-soft);
}

.detail-row.muted i {
    color: var(--text-soft);
}

.certificado-lote {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--primary-blue);
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.pedido-actions {
    display: flex;
    gap: 0.6rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.btn-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem 0.9rem;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

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

.btn-primary:hover {
    background: var(--accent-dark);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-dark);
    color: var(--text-gray);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
}

.btn-warning {
    background: rgba(220, 38, 38, 0.1);
    color: var(--red);
    border: 1px solid rgba(220, 38, 38, 0.2);
    flex: 0;
    padding: 0.7rem 0.8rem;
}

.btn-warning:hover {
    background: var(--red);
    color: white;
    transform: translateY(-2px);
}

.badge-tipo {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-tipo.acidos { background: rgba(220, 38, 38, 0.1); color: #b91c1c; }
.badge-tipo.HIPOCLORITO { background: rgba(37, 99, 235, 0.1); color: #1d4ed8; }
.badge-tipo.SOSA { background: rgba(5, 150, 105, 0.1); color: #047857; }
.badge-tipo.SULFURICO { background: rgba(220, 38, 38, 0.1); color: #b91c1c; }
.badge-tipo.SOSA25 { background: rgba(124, 58, 237, 0.1); color: #6d28d9; }
.badge-tipo.SOSA32 { background: rgba(14, 116, 144, 0.1); color: #0e7490; }
.badge-tipo.sales { background: rgba(5, 150, 105, 0.1); color: #047857; }
.badge-tipo.otros { background: rgba(107, 114, 128, 0.1); color: #4b5563; }

/* ---- FDS SECTION ---- */
.fds-header {
    background: linear-gradient(135deg, var(--green), #047857);
}

.fds-path {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

.fds-count-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-fds-upload {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-fds-upload:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Drop zone */
.fds-dropzone {
    padding: 1rem 1.5rem 1.2rem;
    transition: all 0.3s ease;
    min-height: 80px;
    position: relative;
    background: var(--bg-dark);
}

.fds-dropzone.drag-over {
    background: rgba(5, 150, 105, 0.08);
    outline: 2px dashed var(--green);
    outline-offset: -8px;
    border-radius: 8px;
}

.fds-drop-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    color: var(--text-soft);
    font-size: 0.85rem;
    padding: 0.8rem;
    border: 2px dashed var(--border);
    border-radius: 8px;
    margin-top: 1rem;
    opacity: 0.6;
    transition: all 0.3s ease;
}

.fds-dropzone:hover .fds-drop-hint {
    opacity: 1;
    border-color: var(--green);
    color: var(--green);
}

.fds-drop-hint i {
    font-size: 1.2rem;
}

.fds-files-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.fds-file-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.1rem;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    gap: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}

.fds-file-row:hover {
    border-color: var(--green);
    background: rgba(16, 185, 129, 0.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.fds-file-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex: 1;
    min-width: 0;
}

.fds-pdf-icon {
    color: #dc2626;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.fds-file-name {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fds-file-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-fds-dl,
.btn-fds-replace,
.btn-fds-del {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    border: none;
    font-family: inherit;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-fds-dl {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-blue);
}

.btn-fds-dl:hover {
    background: var(--primary-blue);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.btn-fds-replace {
    background: rgba(217, 119, 6, 0.1);
    color: var(--orange);
}

.btn-fds-replace:hover {
    background: var(--orange);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(217, 119, 6, 0.3);
}

.btn-fds-del {
    background: rgba(220, 38, 38, 0.1);
    color: var(--red);
}

.btn-fds-del:hover {
    background: var(--red);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3);
}

.fds-empty-group {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1.2rem;
    color: var(--text-soft);
    font-size: 0.9rem;
    border: 2px dashed var(--border);
    border-radius: 8px;
    background: white;
}

.fds-empty-group i {
    color: var(--text-soft);
    font-size: 1.3rem;
}

.loading-fds {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 3rem;
    color: var(--text-soft);
    font-size: 1rem;
    justify-content: center;
}

/* ---- MODALES ---- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal-overlay.visible {
    opacity: 1;
}

.modal-box {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 640px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s;
}

.modal-overlay.visible .modal-box {
    transform: translateY(0);
}

.modal-small {
    max-width: 450px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.3rem 1.8rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-dark));
    color: white;
}

.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.modal-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.modal-body {
    padding: 1.5rem 1.8rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1rem 1.8rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    background: var(--bg-dark);
}

.modal-desc {
    font-size: 0.95rem;
    color: var(--text-gray);
    margin-bottom: 1rem;
}

.btn-modal-cancel {
    padding: 0.65rem 1.3rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    color: var(--text-gray);
    transition: all 0.3s ease;
}

.btn-modal-cancel:hover {
    background: var(--bg-dark);
    transform: translateY(-2px);
}

.btn-modal-ok {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2);
}

.btn-modal-ok:hover {
    background: var(--accent-dark);
    box-shadow: 0 6px 10px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

/* Lote modal */
.lote-options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.lote-option {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.9rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    background: white;
}

.lote-option:hover {
    border-color: var(--primary-blue);
    background: rgba(59, 130, 246, 0.03);
}

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

.input-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.lote-text-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1.05rem;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    color: var(--text-light);
    background: var(--bg-dark);
    transition: all 0.3s ease;
}

.lote-text-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.lote-hint {
    font-size: 0.78rem;
    color: var(--text-soft);
    margin-top: 0.4rem;
}

/* Historial modal */
.historial-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.88rem;
    color: var(--text-gray);
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.historial-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.historial-row {
    display: grid;
    grid-template-columns: 36px 1fr 1fr auto auto;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    background: var(--bg-dark);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 0.88rem;
    transition: all 0.3s ease;
}

.historial-row:hover {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.historial-num {
    color: var(--text-soft);
    font-size: 0.8rem;
    text-align: center;
    font-weight: 600;
}

.historial-lote {
    font-family: 'Courier New', monospace;
    color: var(--primary-blue);
    font-weight: 600;
}

.historial-fecha {
    color: var(--text-gray);
}

.historial-tipo {
    color: var(--text-soft);
    font-size: 0.8rem;
    white-space: nowrap;
}

.historial-usuario {
    color: var(--text-soft);
    font-size: 0.8rem;
    white-space: nowrap;
}

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-soft);
}

.empty-state i {
    font-size: 3rem;
    color: var(--border);
    margin-bottom: 1.5rem;
    display: block;
}

.empty-state h3 {
    font-size: 1.2rem;
    color: var(--text-gray);
    margin-bottom: 0.5rem;
}

.empty-state.small {
    padding: 2rem;
}

/* ---- NAVIGATION BAR ---- */
.navigation-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
    padding: 5px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.nav-item {
    color: var(--text-gray);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.9em;
    transition: color 0.3s ease;
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary-blue);
}

.nav-item i {
    font-size: 1.5em;
}

/* ---- NOTIFICATIONS ---- */
.notification {
    position: fixed;
    top: 5rem;
    right: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.3rem;
    z-index: 3000;
    max-width: 380px;
    animation: slideIn 0.3s ease;
}

.notification.success {
    border-left: 4px solid var(--green);
}

.notification.error {
    border-left: 4px solid var(--red);
}

.notification.warning {
    border-left: 4px solid var(--orange);
}

.notification.info {
    border-left: 4px solid var(--primary-blue);
}

.notification.success i {
    color: var(--green);
}

.notification.error i {
    color: var(--red);
}

.notification.warning i {
    color: var(--orange);
}

.notification.info i {
    color: var(--primary-blue);
}

.notification i {
    font-size: 1.3rem;
    margin-top: 0.1rem;
    flex-shrink: 0;
}

.notification-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-light);
}

.notification-message {
    font-size: 0.88rem;
    color: var(--text-gray);
    margin-top: 0.2rem;
}

.loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-top: 0.4rem;
}

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

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    header {
        padding: 0.5rem 1rem;
        height: auto;
        flex-direction: column;
        gap: 0.5rem;
    }

    .logo-container {
        width: 100%;
        justify-content: center;
    }

    .search-bar {
        width: 100%;
        margin: 0.5rem 0;
    }

    .main-content {
        padding: 1rem 1rem 5rem;
    }

    .controls-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filters {
        flex-direction: column;
    }

    .tabs-wrapper {
        width: 100%;
    }

    .tab-main {
        flex: 1;
        justify-content: center;
    }

    .pedidos-list {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .historial-row {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
    }
}

@media (max-width: 480px) {
    .stat-card {
        min-width: 80px;
    }

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

/* ============================================================
   MODAL AÑADIR / EDITAR ARTÍCULO
   ============================================================ */

.modal-producto {
    max-width: 720px;
}

.btn-success {
    background: linear-gradient(135deg, #059669, #10b981) !important;
    color: white !important;
    border: none !important;
}

.btn-success:hover {
    background: linear-gradient(135deg, #047857, #059669) !important;
    transform: translateY(-1px);
}

/* Secciones del formulario */
.form-section {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem 1.4rem;
    margin-bottom: 1.2rem;
}

.form-section:last-of-type {
    margin-bottom: 0;
}

.form-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-blue);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem;
    margin-bottom: 0.9rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.9rem;
}

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

.input-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-gray);
}

.req {
    color: var(--red);
    font-weight: 700;
}

.form-input {
    padding: 0.6rem 0.85rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text-light);
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input:read-only {
    background: #f1f5f9;
    color: var(--text-soft);
}

.field-hint {
    font-size: 0.75rem;
    color: var(--text-soft);
    line-height: 1.4;
}

/* Plantilla estado */
.plantilla-estado {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.9rem;
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.plantilla-estado.ok {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}

/* Upload plantilla */
.btn-upload-plantilla {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-dark));
    color: white;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: fit-content;
    margin-top: 0.2rem;
}

.btn-upload-plantilla:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

/* FDS path preview */
.fds-path-preview {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    background: #eff6ff;
    border: 1.5px dashed #93c5fd;
    border-radius: 8px;
    font-size: 0.88rem;
    color: #1e40af;
    font-family: 'Courier New', monospace;
}

.fds-path-preview i {
    color: #3b82f6;
    font-size: 1rem;
}

/* Error */
.form-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    border-radius: 8px;
    padding: 0.7rem 1rem;
    font-size: 0.88rem;
    margin-top: 0.8rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

/* Danger modal button */
.btn-danger-modal {
    background: var(--red) !important;
    margin-right: auto;
}

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

/* Edit button on cards */
.btn-edit-producto {
    background: #f59e0b;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.4rem 0.7rem;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-edit-producto:hover {
    background: #d97706;
    transform: translateY(-1px);
}

/* Plantilla badge on group header */
.plantilla-badge {
    font-size: 0.75rem;
    background: #e0e7ff;
    color: #3730a3;
    border-radius: 6px;
    padding: 0.2rem 0.55rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

@media (max-width: 640px) {
    .form-row-2 { grid-template-columns: 1fr; }
    .modal-producto { max-width: 98vw; }
}
