/* ============ VARIABLES ============ */
:root {
    --primary-color: #f5c518;
    --primary-dark: #d4a80e;
    --secondary-color: #e6b800;
    --accent-color: #f5c518;
    --success-color: #34d399;
    --warning-color: #fbbf24;
    --danger-color: #ef4444;
    --info-color: #60a5fa;
    
    --bg-color: #0f0f0f;
    --sidebar-bg: #000000;
    --card-bg: #1a1a1a;
    --text-color: #e5e5e5;
    --text-light: #9ca3af;
    --border-color: #2a2a2a;
    
    --sidebar-width: 240px;
    --header-height: 64px;
    --border-radius: 10px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4), 0 4px 10px rgba(0, 0, 0, 0.3);
}

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

::selection {
    background: var(--primary-color);
    color: #000;
}


body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    min-height: 100vh;
}

/* Global Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.text-muted {
    color: var(--text-light);
    font-size: 0.85rem;
}

/* ============ SIDEBAR ============ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 1001;
    transition: transform 0.3s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

/* Overlay para móvil */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.sidebar-header {
    padding: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.3rem;
    font-weight: 600;
}

.logo i {
    font-size: 1.8rem;
    color: var(--primary-color);
    -webkit-text-fill-color: var(--primary-color);
}

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

.sidebar-nav ul {
    list-style: none;
}

.nav-item {
    margin: 1px 10px;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    border-radius: 7px;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    line-height: 1.2;
}

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

.nav-item.active a {
    color: #0a0a0a;
    background: var(--primary-color);
    font-weight: 600;
}

.nav-item i {
    font-size: 0.95rem;
    width: 18px;
    text-align: center;
}

.nav-separator {
    padding: 10px 22px 4px;
    font-size: 0.65rem;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
}

.sidebar-footer {
    padding: 10px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
}

.sidebar-footer .btn {
    padding: 7px 10px;
    font-size: 0.82rem;
}

.user-info {
    padding: 8px 10px !important;
    font-size: 0.85rem;
}

/* ============ SCROLLBAR ============ */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.user-info:hover {
    background: rgba(245, 197, 24, 0.15);
    color: var(--primary-color);
}

.user-info i {
    font-size: 1.2rem;
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.9);
    border-color: rgba(239, 68, 68, 0.9);
    color: white;
}

/* ============ MAIN CONTENT ============ */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: #111111;
    display: flex;
    align-items: center;
    padding: 0 40px;
    gap: 20px;
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-color);
    cursor: pointer;
}

.top-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
}

.header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 15px;
}

.current-date {
    color: var(--text-light);
    font-size: 0.9rem;
}

.content-area {
    padding: 40px;
    flex: 1;
}

/* ============ PAGES ============ */
.page {
    display: none;
}

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

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

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 15px;
    flex-wrap: wrap;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

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

/* ============ DASHBOARD ============ */
.dashboard-welcome {
    background: #0a0a0a;
    color: #fff;
    padding: 20px 30px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border-left: 4px solid var(--primary-color);
}

.dashboard-welcome h2 {
    font-size: 1.4rem;
    margin-bottom: 0;
    font-weight: 600;
}

.dashboard-welcome p {
    opacity: 0.7;
    font-size: 0.95rem;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    border-top: 3px solid var(--primary-color);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
}

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

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.btn-icon-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    color: var(--text-color);
}

.btn-icon-card:hover {
    background: var(--primary-color);
    color: #000;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 197, 24, 0.2);
}

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

.btn-icon-card span {
    font-size: 0.7rem;
    font-weight: 500;
}

.card-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
}

.card-info h3 {
    font-size: 1.1rem;
    margin-bottom: 5px;
}

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

.techniques-section {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
}

.techniques-section h3 {
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.techniques-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.technique-card {
    padding: 20px;
    background: var(--bg-color);
    border-radius: 10px;
    text-align: center;
    transition: all 0.3s ease;
}

.technique-card:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
}

.technique-card i {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.technique-card:hover i {
    color: #fff;
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary-color);
    color: #000;
    border: none;
    font-weight: 600;
}

.btn-primary:hover {
    transform: translateY(-1px);
    background: #e6b800;
    box-shadow: 0 4px 12px rgba(245, 197, 24, 0.3);
}

.btn-secondary {
    background: #252525;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #333;
}

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

.btn-danger {
    background: var(--danger-color);
    color: #fff;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* ============ FORMS ============ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #444;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background: #1e1e1e !important;
    color: #ffffff !important;
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.4) !important;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #252525 !important;
    box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.2);
}

/* Force select and option visibility */
select.form-control, 
select.form-control option,
select {
    color: #ffffff !important;
    background-color: #1a1a1a !important;
    border: 1px solid #444 !important;
    height: 42px !important;
    line-height: 42px !important;
    padding: 0 16px !important;
}

select.form-control {
    cursor: pointer;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23f5c518' d='M1 4l5 5 5-5z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 12px !important;
    padding-right: 40px !important;
}

option {
    background-color: #1a1a1a !important;
    color: #ffffff !important;
    padding: 12px !important;
}

/* Checkboxes style */
input[type="checkbox"] {
    accent-color: var(--primary-color);
    cursor: pointer;
    width: 20px;
    height: 20px;
    vertical-align: middle;
}

/* ============ NUMERIC STEPPER ============ */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}

.numeric-stepper {
    display: flex;
    align-items: center;
    background: #111;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    height: 40px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.numeric-stepper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.15);
}

.numeric-stepper.sm {
    height: 32px;
}

.numeric-stepper input {
    background: transparent !important;
    border: none !important;
    color: var(--text-color) !important;
    text-align: center;
    font-weight: 600;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 0.95rem;
}

.stepper-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
    user-select: none;
}

.numeric-stepper.sm .stepper-btn {
    width: 28px;
    font-size: 0.9rem;
}

.stepper-btn:hover {
    background: var(--primary-color);
    color: #000;
}

.stepper-btn:active {
    transform: scale(0.9);
}

.stepper-btn.down {
    border-right: 1px solid var(--border-color);
}

.stepper-btn.up {
    border-left: 1px solid var(--border-color);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

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

select.form-control {
    cursor: pointer;
    background-color: #111;
    color: var(--text-color);
}

.input-sm {
    padding: 4px 10px !important;
    font-size: 0.85rem !important;
    height: 32px !important;
}

select.form-control optgroup {
    font-weight: 600;
    color: var(--primary-color);
    background: var(--bg-color);
    padding: 5px 0;
}

select.form-control option {
    padding: 8px 12px;
    color: var(--text-color);
}

/* Producto select con más espacio */
.producto-select {
    min-width: 250px;
}

/* ============ TABLES ============ */
.table-container {
    overflow-x: auto;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: #111;
    font-weight: 600;
    color: var(--text-color);
}

tr:hover {
    background: #222;
}

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

.filters-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

/* ============ CARDS ============ */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 30px;
}

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

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    background: #111;
    border-top: 1px solid var(--border-color);
}

/* ============ MODAL ============ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

/* Modal genérico (openModal) — debe quedar por encima de cualquier modal específico */
#modalOverlay {
    z-index: 2600;
}
#modalOverlay .modal {
    z-index: 2601;
}

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

.modal {
    background: #1a1a1a;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    border: 1px solid var(--border-color);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal.modal-lg,
.modal.modal-large {
    max-width: 1000px;
}

.modal.modal-xl {
    max-width: 1300px;
}

.modal.modal-fullscreen {
    width: 98%;
    max-width: none;
    height: 98vh;
    max-height: none;
}

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

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

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto !important;
    max-height: calc(90vh - 120px);
    min-height: 0;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.modal-fullscreen .modal-body {
    max-height: calc(98vh - 120px);
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============ TOAST ============ */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #1a1a1a;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
    color: var(--text-color);
}

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

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
}

.toast i {
    font-size: 1.2rem;
}

.toast.success i { color: var(--success-color); }
.toast.error i { color: var(--danger-color); }
.toast.warning i { color: var(--warning-color); }

/* ============ PRODUCTOS GRID ============ */
.productos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.producto-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

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

.producto-image {
    height: 180px;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.producto-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
    box-sizing: border-box;
}

.producto-image i {
    font-size: 4rem;
    color: var(--border-color);
}

.btn-icon {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-light);
    transition: all 0.2s ease;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(0,0,0,0.05);
    transform: scale(1.1);
}

.producto-info {
    padding: 20px;
}

.producto-info h4 {
    margin-bottom: 5px;
}

.producto-info .referencia {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.producto-info .precio {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.producto-actions {
    padding: 15px 20px;
    background: #111;
    display: flex;
    gap: 10px;
}

/* ============ TABLAS DE PRECIOS ============ */
.tablas-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tecnica-section {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.tecnica-header {
    padding: 16px 20px;
    background: #0a0a0a;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tecnica-header .btn {
    background: var(--primary-color);
    color: #0a0a0a;
    font-weight: 600;
}

.tecnica-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tablas-list {
    padding: 20px;
    display: grid;
    gap: 15px;
}

.tabla-item {
    background: var(--bg-color);
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tabla-item-info h4 {
    margin-bottom: 5px;
}

.tabla-item-info p {
    color: var(--text-light);
    font-size: 0.85rem;
}

/* ============ PRESUPUESTOS ============ */
.presupuestos-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.presupuesto-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.presupuesto-info h4 {
    margin-bottom: 5px;
    color: var(--primary-color);
}

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

.presupuesto-total {
    text-align: right;
}

.presupuesto-total .total {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success-color);
}

.presupuesto-total .fecha {
    color: var(--text-light);
    font-size: 0.85rem;
}

.estado-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

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

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

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

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

/* ============ MAQUETAS ============ */
.maquetas-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.maqueta-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.maqueta-preview {
    height: 200px;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.maqueta-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scale(1.35);
}

.maqueta-info {
    padding: 15px;
    flex: 1;
}

.maqueta-info h4 {
    margin-bottom: 5px;
    font-size: 1rem;
    word-break: break-word;
}

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

.maqueta-card .producto-actions {
    padding: 10px 15px 15px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.maqueta-card .producto-actions .btn {
    flex: 1;
    min-width: 80px;
    justify-content: center;
}

/* ============ EDITOR DE MAQUETAS (Premium Utopía) ============ */
.maquetasList, .maquetas-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    padding: 10px 0;
}

.maqueta-card {
    background: rgba(26, 26, 26, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.maqueta-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--primary-color);
}

.maqueta-preview {
    width: 100%;
    height: 220px;
    background: #fdfdfd;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    border-bottom: 2px solid var(--primary-color);
}

.maqueta-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scale(1.35);
    transition: transform 0.3s ease;
}

/* ============ PRODUCT TABS & EDITOR ============ */
.producto-tab.active { background: rgba(245, 197, 24, 0.05) !important; }
.table-compact th { font-size: 0.75rem; text-transform: uppercase; color: var(--text-light); }
.btn-icon-sm { width: 28px; height: 28px; border-radius: 6px; border: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: transform 0.2s; }
.badge-stock { background: #333; padding: 2px 8px; border-radius: 12px; font-size: 0.75rem; }


.maqueta-card:hover .maqueta-preview img {
    transform: scale(1.45);
}

.maqueta-info {
    padding: 18px 20px 10px;
}

.maqueta-info h4 {
    color: #fff;
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.maqueta-info p {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 0;
}

.maqueta-card .producto-actions {
    display: flex;
    gap: 8px;
    padding: 10px 20px 20px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

/* Modal Maqueta Editor */
.maqueta-editor {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    height: calc(90vh - 120px);
}

.editor-canvas-container {
    background: #0a0a0a;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    height: 100%;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5);
    padding: 50px 30px; /* Margen optimizado */
}

#maquetaCanvas {
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    background: #fdfdfd; 
    transition: transform 0.2s ease;
}

.canvas-instructions {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    padding: 8px 16px;
    border-radius: 20px;
    color: #fff;
    font-size: 0.8rem;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.zonas-tabs {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    background: rgba(30, 30, 30, 0.8);
    backdrop-filter: blur(10px);
    padding: 6px;
    border-radius: 25px;
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.zona-tab {
    background: transparent;
    border: none;
    color: #aaa;
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s;
}

.zona-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.zona-tab.active {
    background: var(--primary-color);
    color: #000;
    font-weight: 600;
}

.editor-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    padding-right: 15px;
}

.control-section {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
}

.control-section h4 {
    margin-bottom: 15px;
    color: var(--primary-color);
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 10px;
}

.size-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.size-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text-color);
}

.size-info-row span:last-child {
    font-weight: 600;
    color: #fff;
}

.upload-area {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 25px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.1);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(245, 197, 24, 0.05);
}

.upload-area i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.upload-area p {
    font-size: 0.9rem;
    color: var(--text-light);
    margin: 0;
}

@media (max-width: 1024px) {
    .maqueta-editor {
        grid-template-columns: 1fr;
        height: auto;
    }
    .editor-canvas-container {
        height: 60vh;
        min-height: 400px;
    }
}


.size-info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.size-info-row:last-child {
    margin-bottom: 0;
}

.size-info-row span:first-child {
    color: var(--text-light);
}

.size-info-row span:last-child {
    font-weight: 600;
}

/* ============ PRESUPUESTO EDITOR ============ */
.presupuesto-editor {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
}

.lineas-container {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.lineas-header {
    padding: 15px 20px;
    background: var(--bg-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.lineas-list {
    max-height: 75vh;
    overflow-y: auto;
}

.linea-item {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

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

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

.linea-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.linea-grid .form-group {
    margin-bottom: 0;
}

.linea-grid label {
    font-size: 0.75rem;
    color: var(--text-light);
}

.linea-grid input {
    padding: 8px 10px;
    font-size: 0.85rem;
}

.linea-totals {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 30px;
}

.linea-total-item {
    text-align: right;
}

.linea-total-item label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
}

.linea-total-item span {
    font-size: 1.1rem;
    font-weight: 600;
}

.linea-total-item span.total {
    color: var(--success-color);
}

.presupuesto-summary {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 100px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.summary-row.total {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--success-color);
    padding-top: 15px;
    margin-top: 10px;
    border-top: 2px solid var(--primary-color);
}

/* ============ INVENTARIO ============ */
.inventario-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.inventario-tabs .tab-btn {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.inventario-tabs .tab-btn.active {
    background: var(--primary-color);
    color: #111;
    border-color: var(--primary-color);
}

.inventario-tabs .tab-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

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

.inventario-tab-content {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.badge-color {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    border: 1px solid rgba(0,0,0,0.1);
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-height: 45px;
    background: var(--bg-color);
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-color);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.tag button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 2px;
    opacity: 0.8;
}

.tag button:hover {
    opacity: 1;
}

.talla-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.talla-checkbox:hover {
    border-color: var(--primary-color);
}

.talla-checkbox input:checked + span {
    color: var(--primary-color);
    font-weight: 600;
}

.talla-checkbox:has(input:checked) {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.1);
}

.stock-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(72, 187, 120, 0.15);
    color: var(--success-color);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.table-warning {
    background-color: rgba(237, 137, 54, 0.1) !important;
}

.text-danger {
    color: var(--danger-color) !important;
}

.text-warning {
    color: var(--warning-color) !important;
}

.text-success {
    color: var(--success-color) !important;
}

.text-info {
    color: var(--info-color) !important;
}

.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.alert-success {
    background: rgba(72, 187, 120, 0.15);
    border: 1px solid rgba(72, 187, 120, 0.3);
    color: var(--success-color);
}

.alert-warning {
    background: rgba(237, 137, 54, 0.15);
    border: 1px solid rgba(237, 137, 54, 0.3);
    color: #c17a28;
}

.alert-info {
    background: rgba(66, 153, 225, 0.15);
    border: 1px solid rgba(66, 153, 225, 0.3);
    color: var(--info-color);
}

.inventario-filtros {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

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

/* Tablets landscape y pantallas medianas */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .maqueta-editor {
        grid-template-columns: 1fr;
        height: auto;
        gap: 15px;
    }
    
    .editor-canvas-container {
        min-height: 400px;
        max-height: 60vh;
    }
    
    .editor-controls {
        max-height: none;
        overflow-y: visible;
    }
    
    .presupuesto-editor {
        grid-template-columns: 1fr;
    }
    
    /* Modal fullscreen en tablet */
    .modal.modal-fullscreen {
        width: 98%;
        height: 95vh;
    }
}

/* Tablets portrait y móviles grandes */
@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }
    
    .content-area {
        padding: 12px;
    }
    
    .top-header {
        padding: 0 15px;
    }
    
    .top-header h1 {
        font-size: 1.1rem;
    }
    
    .current-date {
        display: none;
    }
    
    .page-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .page-header h2 {
        font-size: 1.2rem;
    }
    
    .page-header .btn {
        width: 100%;
        justify-content: center;
    }
    
    .dashboard-cards {
        grid-template-columns: 1fr;
    }
    
    .dashboard-welcome {
        padding: 25px 20px;
    }
    
    .dashboard-welcome h2 {
        font-size: 1.4rem;
    }
    
    .dashboard-welcome p {
        font-size: 0.95rem;
    }
    
    /* Editor de maquetas responsive */
    .maqueta-editor {
        display: flex;
        flex-direction: column;
        gap: 12px;
        height: auto;
    }
    
    .editor-canvas-container {
        min-height: 65vh;
        max-height: 75vh;
        order: 1;
        width: 100%;
        margin: 0 -12px;
        padding: 0 12px;
        box-sizing: content-box;
    }
    
    #maquetaCanvas {
        max-height: calc(100% - 45px);
        width: 100% !important;
        max-width: 100%;
        touch-action: none;
    }
    
    .zonas-tabs {
        padding: 8px;
        gap: 4px;
        flex-wrap: wrap;
    }
    
    .zona-tab {
        padding: 6px 12px;
        font-size: 0.8rem;
        flex: 1;
        min-width: 70px;
        text-align: center;
    }
    
    .editor-controls {
        order: 2;
        padding: 15px;
        max-height: none;
    }
    
    .control-section {
        margin-bottom: 18px;
    }
    
    .control-section h4 {
        font-size: 0.95rem;
        margin-bottom: 12px;
    }
    
    .upload-area {
        padding: 20px 15px;
    }
    
    .upload-area i {
        font-size: 1.5rem;
    }
    
    .upload-area p {
        font-size: 0.85rem;
    }
    
    /* Botones */
    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .btn i {
        font-size: 0.9rem;
    }
    
    /* Modal fullscreen en móvil */
    .modal.modal-fullscreen {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }
    
    .modal-header {
        padding: 12px 15px;
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--card-bg);
    }
    
    .modal-header h3 {
        font-size: 1rem;
    }
    
    .modal-body {
    padding: 20px;
    overflow-y: auto !important;
    max-height: calc(90vh - 120px);
    flex: 1;
}
    
    .modal-fullscreen .modal-body {
        max-height: calc(100vh - 55px);
        padding: 8px;
    }
    
    /* Editor canvas a pantalla completa en móvil */
    .modal-fullscreen .editor-canvas-container {
        margin: 0 -8px;
        width: calc(100% + 16px);
        border-radius: 0;
    }
    
    /* Formularios */
    .form-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-control {
        padding: 10px 12px;
        font-size: 16px; /* Evita zoom en iOS */
    }
    
    /* Tablas responsive */
    .table-responsive {
        margin: 0 -12px;
        padding: 0 12px;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
        font-size: 0.85rem;
    }
    
    /* Cards */
    .card {
        margin-bottom: 12px;
    }
    
    .card-header {
        padding: 12px 15px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    /* Presupuestos */
    .linea-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .linea-item {
        padding: 12px;
    }
    
    .linea-totals {
        flex-direction: column;
        gap: 10px;
        align-items: flex-end;
    }
    
    /* Productos grid */
    .productos-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .producto-card {
        padding: 12px;
    }
    
    .producto-card img {
        height: 120px;
    }
    
    /* Maquetas list */
    .maquetas-list {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .maqueta-card {
        padding: 12px;
    }
    
    /* Inventario */
    .inventario-filtros {
        flex-direction: column;
    }
    
    .inventario-filtros select,
    .inventario-filtros input {
        max-width: 100% !important;
        width: 100%;
    }
    
    .inventario-tabs {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .tab-btn {
        flex: 1;
        min-width: 100px;
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    .tallas-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 8px;
        padding: 12px;
    }
    
    .talla-card {
        padding: 10px 8px;
    }
    
    .talla-nombre {
        font-size: 1rem;
    }
    
    .talla-stock {
        font-size: 1.2rem;
    }
    
    /* Size info */
    .size-info {
        padding: 12px;
    }
    
    .size-info-row {
        font-size: 0.9rem;
    }
    
    /* Header actions en móvil */
    .header-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .header-actions .btn {
        flex: 1;
        min-width: 100px;
    }
}

/* Móviles pequeños */
@media (max-width: 480px) {
    .content-area {
        padding: 10px;
    }
    
    .top-header h1 {
        font-size: 1rem;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .page-header h2 {
        font-size: 1.1rem;
    }
    
    /* Editor de maquetas en móvil pequeño */
    .editor-canvas-container {
        min-height: 60vh;
        max-height: 70vh;
    }
    
    .zona-tab {
        padding: 5px 8px;
        font-size: 0.75rem;
        min-width: 60px;
    }
    
    .control-section h4 {
        font-size: 0.9rem;
    }
    
    .control-group label {
        font-size: 0.8rem;
    }
    
    .value-display {
        font-size: 0.85rem;
    }
    
    /* Sliders más touch-friendly */
    input[type="range"] {
        height: 8px;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }
    
    /* Dashboard */
    .dashboard-card {
        padding: 15px;
        gap: 12px;
    }
    
    .card-icon {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
    
    .card-info h3 {
        font-size: 0.95rem;
    }
    
    .card-info p {
        font-size: 0.8rem;
    }
    
    /* Presupuestos */
    .linea-grid {
        grid-template-columns: 1fr;
    }
    
    /* Productos */
    .productos-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .producto-card img {
        height: 100px;
    }
    
    /* Técnicas grid */
    .techniques-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .technique-card {
        padding: 15px 10px;
    }
    
    .technique-card i {
        font-size: 1.5rem;
    }
    
    /* Tallas */
    .tallas-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .btn-mini {
        width: 32px;
        height: 32px;
    }
    
    /* Clientes/Tablas */
    .table th,
    .table td {
        padding: 8px 6px;
        font-size: 0.8rem;
    }
    
    /* Accordion headers */
    .acordeon-header {
        padding: 12px 15px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .acordeon-titulo {
        width: 100%;
    }
    
    .color-header {
        padding: 10px 15px;
    }
}

/* Mejoras táctiles para todos los móviles */
@media (hover: none) and (pointer: coarse) {
    /* Áreas táctiles más grandes */
    .btn {
        min-height: 44px;
    }
    
    .nav-item a {
        padding: 16px 20px;
    }
    
    .zona-tab {
        min-height: 40px;
    }
    
    .form-control {
        min-height: 44px;
    }
    
    select.form-control {
        min-height: 44px;
    }
    
    /* Eliminar hover effects que no funcionan bien en touch */
    .dashboard-card:hover {
        transform: none;
    }
    
    .producto-card:hover {
        transform: none;
    }
    
    .technique-card:hover {
        background: var(--bg-color);
        color: inherit;
    }
    
    .technique-card:hover i {
        color: var(--primary-color);
    }
    
    /* Mejor scroll en móvil */
    .modal-body {
        -webkit-overflow-scrolling: touch;
    }
    
    .editor-controls {
        -webkit-overflow-scrolling: touch;
    }
}

/* ============ UTILITIES ============ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.flex { display: flex; }
.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

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

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: var(--text-color);
}

/* ============ CRM MODULES ============ */

/* Global Loader */
#global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

#global-loader.active {
    display: flex;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Separador de navegación */
.nav-separator {
    padding: 10px 20px 5px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 5px;
}

/* Filtros */
.filters-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filters-bar .form-control {
    max-width: 300px;
}

/* Tablas de datos */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

.data-table tr.row-urgent {
    background: rgba(245, 101, 101, 0.1);
}

.data-table tr.row-danger {
    background: rgba(245, 101, 101, 0.15);
}

.data-table .actions {
    white-space: nowrap;
}

.data-table .actions .btn {
    margin-right: 5px;
}

.data-table.mini {
    font-size: 0.85rem;
}

.data-table.mini th,
.data-table.mini td {
    padding: 8px 10px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.badge-primary { background: var(--primary-color); color: white; }
.badge-secondary { background: #a0aec0; color: white; }
.badge-success { background: var(--success-color); color: white; }
.badge-warning { background: var(--warning-color); color: white; }
.badge-danger { background: var(--danger-color); color: white; }
.badge-info { background: var(--info-color); color: white; }
.badge-dark { background: #2d3748; color: white; }

/* Select estado pedido */
.estado-pedido-select {
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

.estado-pedido-select.estado-warning { background: var(--warning-color); color: white; }
.estado-pedido-select.estado-info { background: var(--info-color); color: white; }
.estado-pedido-select.estado-primary { background: var(--primary-color); color: white; }
.estado-pedido-select.estado-success { background: var(--success-color); color: white; }
.estado-pedido-select.estado-danger { background: var(--danger-color); color: white; }
.estado-pedido-select.estado-secondary { background: #a0aec0; color: white; }
.estado-pedido-select.estado-dark { background: #2d3748; color: white; }

.btn-purple { background: #7c3aed; color: white; border: none; }
.btn-purple:hover { background: #6d28d9; color: white; }
.badge-dark { background: #2d3748; color: white; }

.estado-pedido-select:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.estado-pedido-select option {
    background: white;
    color: var(--text-color);
}

/* Modal sizes */
.modal.modal-lg {
    max-width: 900px;
}

.modal.modal-xl {
    max-width: 1100px;
}

/* Form rows */
.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* Form actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

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

.search-result-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.search-result-item:hover {
    background: rgba(102, 126, 234, 0.1);
}

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

/* Líneas section */
.lineas-section {
    margin: 20px 0;
    padding: 15px;
    background: var(--bg-color);
    border-radius: var(--border-radius);
}

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

.lineas-header h4 {
    margin: 0;
}

/* Totales section */
.totales-section {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 30px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.totales-display {
    text-align: right;
}

.totales-display p {
    margin-bottom: 5px;
}

.totales-display .total {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* Cliente info grid */
.cliente-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.cliente-info-grid .info-section {
    background: var(--bg-color);
    padding: 15px;
    border-radius: var(--border-radius);
}

.cliente-info-grid .info-section.full-width {
    grid-column: 1 / -1;
}

.info-section h4 {
    margin-bottom: 10px;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.info-section p {
    margin-bottom: 5px;
    font-size: 0.9rem;
}

/* Cliente historial */
.cliente-historial {
    margin-top: 20px;
}

.cliente-historial h4 {
    margin: 20px 0 10px;
    color: var(--text-color);
}

/* Pedido/Factura info grid */
.pedido-info-grid,
.factura-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.pedido-totales,
.factura-totales {
    text-align: right;
    margin-top: 20px;
    padding: 15px;
    background: var(--bg-color);
    border-radius: var(--border-radius);
}

.pedido-totales .total,
.factura-totales .total {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 10px;
}

/* Text utilities */
.text-muted {
    color: var(--text-light);
    font-size: 0.85rem;
}

/* Position relative for search dropdowns */
.form-group {
    position: relative;
}

/* Responsive adjustments for CRM */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }
    
    .filters-bar {
        flex-direction: column;
    }
    
    .filters-bar .form-control {
        max-width: 100%;
    }
    
    .totales-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .totales-display {
        text-align: left;
    }
    
    .data-table {
        display: block;
        overflow-x: auto;
    }
    
    .cliente-info-grid,
    .pedido-info-grid,
    .factura-info-grid {
        grid-template-columns: 1fr;
    }
}

/* ============ PEDIDOS CARD GRID ============ */
.pedidos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
}

.pedido-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.pedido-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.pedido-card.macro-activo {
    border: 1px solid #10b981;
    background: rgba(16, 185, 129, 0.15); /* deep emerald tint */
}
.pedido-card.macro-activo:hover {
    border-color: #34d399;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.25);
    transform: translateY(-2px);
}

.pedido-card.macro-pendiente {
    border: 1px solid #fbbf24;
    background: rgba(251, 191, 36, 0.15); /* amber tint */
}
.pedido-card.macro-pendiente:hover {
    border-color: #fcd34d;
    box-shadow: 0 4px 20px rgba(251, 191, 36, 0.4);
    background: rgba(251, 191, 36, 0.25);
    transform: translateY(-2px);
}

.pedido-card.macro-finalizado {
    border: 1px solid #ef4444;
    background: rgba(239, 68, 68, 0.15); /* deep crimson tint */
    opacity: 0.9;
}
.pedido-card.macro-finalizado:hover {
    border-color: #f87171;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.25);
    opacity: 1;
    transform: translateY(-2px);
}

.pedido-card.macro-cancelado {
    border: 1px solid #9ca3af;
    background: rgba(156, 163, 175, 0.12); /* slate tint */
    opacity: 0.65;
}
.pedido-card.macro-cancelado:hover {
    border-color: #d1d5db;
    box-shadow: 0 4px 20px rgba(156, 163, 175, 0.2);
    background: rgba(156, 163, 175, 0.22);
    opacity: 0.95;
    transform: translateY(-2px);
}

.pedido-card.urgent {
    border-color: rgba(239, 68, 68, 0.6) !important;
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.25) !important;
}

.pedido-card-status {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 5px;
}

.pedido-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px 6px;
}

.pedido-card-numero {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary-color);
    letter-spacing: 0.5px;
}

.pedido-card-badges {
    display: flex;
    gap: 4px;
    align-items: center;
}

.pedido-card-cliente {
    padding: 0 14px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 6px;
}

.pedido-card-cliente i {
    color: var(--text-light);
    font-size: 0.75rem;
}

.pedido-card-meta {
    display: flex;
    gap: 14px;
    padding: 6px 14px;
    font-size: 0.73rem;
    color: var(--text-light);
}

.pedido-card-meta i {
    margin-right: 3px;
    font-size: 0.65rem;
}

.pedido-card-lineas {
    padding: 0 14px 4px;
    font-size: 0.72rem;
    color: var(--text-light);
}

.pedido-card-lineas i {
    margin-right: 3px;
    font-size: 0.65rem;
}

.pedido-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px 10px;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

.pedido-card-total {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--primary-color);
}

.pedido-card-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.estado-pedido-select-mini {
    background: rgba(255,255,255,0.06);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 3px 4px;
    font-size: 0.65rem;
    cursor: pointer;
    max-width: 90px;
    appearance: auto;
}

.estado-pedido-select-mini:focus {
    outline: none;
    border-color: var(--primary-color);
}

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

/* ============ CRM DASHBOARD ============ */
.crm-dashboard {
    padding: 10px 0;
}

.crm-header {
    background: rgba(245, 197, 24, 0.08);
    border: 1px solid rgba(245, 197, 24, 0.2);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
}

.crm-status-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.crm-status-flow .status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px 15px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.75rem;
    color: var(--text-light);
    opacity: 0.45;
    transition: all 0.3s;
}

.crm-status-flow .status-item i {
    font-size: 1.2rem;
}

.crm-status-flow .status-item.active {
    background: rgba(245, 197, 24, 0.15);
    border-color: var(--primary-color);
    color: var(--primary-color);
    opacity: 1;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(245, 197, 24, 0.15);
}

.crm-status-flow .status-item.completed {
    background: rgba(52, 211, 153, 0.1);
    border-color: rgba(52, 211, 153, 0.3);
    color: var(--success-color);
    opacity: 0.8;
}

.crm-status-flow .status-arrow {
    color: var(--text-light);
    opacity: 0.3;
    font-size: 0.7rem;
}

.crm-current-status {
    display: flex;
    justify-content: center;
    gap: 10px;
    align-items: center;
}

.badge-lg {
    font-size: 1rem !important;
    padding: 8px 16px !important;
}

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

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

.crm-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.crm-card h4 {
    background: rgba(255,255,255,0.03);
    padding: 10px 15px;
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.crm-card h4 i {
    color: var(--primary-color);
    font-size: 0.85rem;
}

.crm-card-body {
    padding: 12px 15px;
}

.crm-card-body p {
    margin: 0 0 6px 0;
    font-size: 0.85rem;
    color: var(--text-color);
}

.crm-card-body p:last-child {
    margin-bottom: 0;
}

.crm-card-body i {
    color: var(--text-light);
    width: 18px;
    margin-right: 4px;
    font-size: 0.8rem;
}

.crm-card.has-data {
    border-left: 3px solid var(--success-color);
}

.crm-card.no-data {
    border-left: 3px solid var(--border-color);
}

.crm-card.internal {
    border-left: 3px solid var(--warning-color);
    background: rgba(251, 191, 36, 0.05);
}

.crm-card.full-width {
    grid-column: 1 / -1;
}

.crm-card-body.totales p {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.crm-card-body .total-big {
    font-size: 1.2rem;
    padding-top: 10px;
    border-top: 2px solid var(--primary-color);
    margin-top: 10px;
    color: var(--primary-color);
}

.factura-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.maquetas-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.maqueta-thumb {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.maqueta-thumb:hover {
    background: rgba(245, 197, 24, 0.1);
    border-color: var(--primary-color);
}

.maqueta-thumb img {
    width: 100%;
    height: 60px;
    object-fit: contain;
    border-radius: 4px;
    margin-bottom: 5px;
}

.maqueta-thumb i {
    font-size: 2rem;
    color: var(--text-light);
}

.maqueta-thumb span {
    display: block;
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.crm-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    flex-wrap: wrap;
}

/* Fotos Section */
.fotos-section {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255,255,255,0.03);
    border-radius: var(--border-radius);
    border: 1px dashed var(--border-color);
}

.fotos-section h4 {
    margin-bottom: 15px;
    color: var(--text-color);
}

.fotos-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.foto-preview-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
    border: 2px solid var(--border-color);
}

.foto-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.foto-preview-item .btn-eliminar-foto {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--danger-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s;
}

.foto-preview-item:hover .btn-eliminar-foto {
    opacity: 1;
}

/* Fotos en CRM Dashboard */
.crm-fotos-section {
    margin-top: 20px;
}

.crm-fotos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.crm-foto-item {
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s;
}

.crm-foto-item:hover {
    transform: scale(1.05);
}

.crm-foto-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
}

.mt-10 {
    margin-top: 10px;
}

/* Responsive CRM */
@media (max-width: 1024px) {
    .crm-grid {
        grid-template-columns: 1fr;
    }
    
    .crm-notes {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .crm-status-flow {
        display: none;
    }
    
    .crm-actions {
        flex-direction: column;
    }
    
    .crm-actions .btn {
        width: 100%;
    }
}

/* ============ CONTABILIDAD ============ */
#page-contabilidad .row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

#page-contabilidad .col-md-3,
#page-contabilidad .col-md-4,
#page-contabilidad .col-md-8 {
    padding: 0 10px;
    margin-bottom: 20px;
}

#page-contabilidad .col-md-3 {
    flex: 0 0 25%;
    max-width: 25%;
}

#page-contabilidad .col-md-4 {
    flex: 0 0 33.333%;
    max-width: 33.333%;
}

#page-contabilidad .col-md-8 {
    flex: 0 0 66.666%;
    max-width: 66.666%;
}

#page-contabilidad .card {
    height: 100%;
}

#page-contabilidad .card.bg-success {
    background: linear-gradient(135deg, var(--success-color), #1e7e34) !important;
}

#page-contabilidad .card.bg-danger {
    background: linear-gradient(135deg, var(--danger-color), #c82333) !important;
}

#page-contabilidad .card.bg-info {
    background: linear-gradient(135deg, #17a2b8, #138496) !important;
}

#page-contabilidad .card.bg-primary {
    background: linear-gradient(135deg, var(--primary-color), #5a47d1) !important;
}

#page-contabilidad .card.bg-warning {
    background: linear-gradient(135deg, #ffc107, #d39e00) !important;
}

#page-contabilidad .card.text-white {
    color: white !important;
}

#page-contabilidad .card.text-white h6,
#page-contabilidad .card.text-white h3,
#page-contabilidad .card.text-white small {
    color: white !important;
}

#page-contabilidad .text-center {
    text-align: center;
}

.nav-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
}

.nav-tabs .nav-item {
    margin-bottom: -2px;
}

.nav-tabs .nav-link {
    padding: 12px 24px;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    background: none;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-tabs .nav-link:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-light);
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 500;
}

.tab-content {
    padding: 20px 0;
}

.d-flex {
    display: flex;
}

.justify-content-end {
    justify-content: flex-end;
}

.mb-3 {
    margin-bottom: 15px;
}

.mb-4 {
    margin-bottom: 20px;
}

.filter-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

@media (max-width: 1024px) {
    #page-contabilidad .col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    #page-contabilidad .col-md-4,
    #page-contabilidad .col-md-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    #page-contabilidad .col-md-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .nav-tabs {
        flex-wrap: wrap;
    }
    
    .nav-tabs .nav-link {
        padding: 10px 16px;
        font-size: 14px;
    }
}

/* ============ INVENTARIO ACORDEÓN ============ */
.inventario-acordeon {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.inventario-resumen {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.resumen-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    min-width: 150px;
}

.resumen-card i {
    font-size: 1.8rem;
    color: var(--primary-color);
}

.resumen-card.warning {
    background: rgba(251, 191, 36, 0.12);
}

.resumen-card.warning i {
    color: var(--warning-color);
}

.producto-acordeon {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.acordeon-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    transition: all 0.2s;
}

.acordeon-header:hover {
    opacity: 0.95;
}

.acordeon-titulo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.acordeon-icon {
    transition: transform 0.2s;
}

.badge-stock {
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.badge-warning-small {
    background: var(--warning-color);
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
}

.acordeon-colores {
    font-size: 0.9rem;
    opacity: 0.9;
}

.acordeon-content {
    padding: 0;
}

.color-grupo {
    border-bottom: 1px solid var(--border-color);
}

.color-grupo:last-child {
    border-bottom: none;
}

.color-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    cursor: pointer;
    background: #222;
    transition: background 0.2s;
}

.color-header:hover {
    background: #2a2a2a;
}

.badge-color-grande {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.1);
}

.color-nombre {
    font-weight: 500;
    flex: 1;
}

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

.color-icon {
    color: var(--text-light);
    transition: transform 0.2s;
}

.tallas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    padding: 16px 20px;
    background: var(--card-bg);
}

.talla-card {
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    transition: all 0.2s;
    border: 2px solid transparent;
    position: relative;
}

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

.talla-card.stock-ok {
    background: rgba(52, 211, 153, 0.15);
    border-color: var(--success-color);
    color: var(--text-color);
}

.talla-card.stock-medio {
    background: rgba(251, 191, 36, 0.15);
    border-color: var(--warning-color);
    color: var(--text-color);
}

.talla-card.stock-bajo {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--danger-color);
    color: var(--text-color);
}

.btn-editar-variante {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    background: rgba(23, 162, 184, 0.9);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    padding: 0;
    transition: all 0.2s;
    z-index: 10;
}

.btn-editar-variante:hover {
    background: #17a2b8;
    transform: scale(1.1);
}

.talla-content {
    cursor: pointer;
}

.talla-nombre {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.talla-stock {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.talla-sku {
    font-size: 0.7rem;
    color: var(--text-light);
    font-family: monospace;
    margin-bottom: 8px;
}

.talla-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.btn-mini {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.2s;
}

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

.btn-mini.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-mini.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-mini.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-mini:hover {
    transform: scale(1.1);
}

/* Dimensiones de producto */
.producto-info .dimensiones {
    color: var(--text-light);
    font-size: 0.85rem;
    margin: 5px 0;
}

.producto-info .dimensiones i {
    color: var(--primary-color);
    margin-right: 4px;
}


/* ============ SEARCHABLE SELECT ============ */
.searchable-select {
    position: relative;
    width: 100%;
}

.searchable-select-trigger {
    background: #111;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    min-height: 32px;
    transition: all 0.3s ease;
    color: var(--text-color);
}

.searchable-select-trigger:hover {
    border-color: var(--primary-color);
}

.searchable-select-trigger:after {
    content: '\f078';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 0.7rem;
    color: var(--text-light);
    margin-left: 10px;
}

.searchable-select-content {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 500px;
    max-width: 95vw;
    background: #1a1a1a;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    z-index: 4000;
    display: none;
    margin-top: 8px;
    padding: 15px;
    animation: fadeInDown 0.2s ease;
}

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

.searchable-select-content.active {
    display: block;
}

.searchable-select-search {
    margin-bottom: 12px;
}

.searchable-select-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Scrollbar personalizado para la lista */
.searchable-select-list::-webkit-scrollbar {
    width: 6px;
}
.searchable-select-list::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 10px;
}
.searchable-select-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.searchable-select-optgroup {
    font-weight: 600;
    padding: 6px 10px;
    color: var(--primary-color);
    background: rgba(245, 197, 24, 0.08);
    border-radius: 6px;
    margin: 8px 0 4px 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.searchable-select-option {
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 2px;
}

.searchable-select-option:hover {
    background: rgba(245, 197, 24, 0.1);
    color: var(--primary-color);
    padding-left: 20px;
}

.searchable-select-option.selected {
    background: #0a0a0a;
    color: var(--primary-color);
    font-weight: 500;
}

.searchable-select-option .ref {
    font-size: 0.75rem;
    opacity: 0.5;
    background: rgba(0,0,0,0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.searchable-select-option.selected .ref {
    background: rgba(245, 197, 24, 0.2);
    color: var(--primary-color);
    opacity: 1;
}

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

/* Tablet */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .content-area {
        padding: 30px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }
    
    .modal {
        width: 95%;
    }
    
    .modal.modal-large {
        max-width: 95%;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .header-buttons {
        gap: 8px;
    }
    
    .table-container {
        border-radius: 8px;
    }
    
    .presupuesto-card {
        flex-direction: column;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .top-header {
        padding: 0 24px;
        height: 56px;
    }
    
    .top-header h1 {
        font-size: 1.1rem;
    }
    
    .content-area {
        padding: 24px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .page-header h2 {
        font-size: 1.2rem;
    }
    
    .header-buttons {
        width: 100%;
    }
    
    .header-buttons .btn {
        flex: 1;
        justify-content: center;
        font-size: 0.8rem;
        padding: 8px 12px;
    }
    
    .dashboard-welcome {
        padding: 16px 20px;
    }
    
    .dashboard-welcome h2 {
        font-size: 1.2rem;
    }
    
    .quick-icons-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }
    
    .presupuesto-card {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .presupuesto-card > div {
        width: 100%;
    }
    
    .table-actions {
        flex-wrap: wrap;
    }
    
    .btn {
        padding: 10px 18px;
        font-size: 0.85rem;
    }
    
    .btn-sm {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    th, td {
        padding: 10px 8px;
        font-size: 0.85rem;
    }
    
    .modal .modal-body {
        padding: 16px;
    }
    
    .card-header {
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .card-body {
        padding: 16px;
    }
    
    .productos-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-row {
        grid-template-columns: 1fr 1fr;
    }

    .searchable-select-content {
        min-width: 280px;
    }
    
    .toast {
        min-width: auto;
        max-width: 90vw;
    }
    
    .modal-header h3 {
        font-size: 1rem;
    }
    
    .tablas-container {
        gap: 15px;
    }
    
    .tallas-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 8px;
        padding: 12px;
    }
    
    .filters-bar {
        flex-direction: column;
        gap: 8px;
    }
    
    .filters-bar .form-control {
        width: 100%;
    }
    
    .nav-tabs {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .nav-tabs .nav-link {
        font-size: 0.8rem;
        padding: 8px 12px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .content-area {
        padding: 16px;
    }
    
    .page-header {
        margin-bottom: 15px;
    }
    
    .quick-icons-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .header-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .header-buttons .btn {
        width: 100%;
        justify-content: center;
    }
    
    .searchable-select-content {
        min-width: 260px;
        left: -20px;
    }
    
    .current-date {
        display: none;
    }
    
    .modal .modal-body {
        padding: 12px;
    }
    
    .form-row {
        gap: 10px;
    }
    
    .card-header h5,
    .card-header h3 {
        font-size: 1rem;
    }
    
    .table-container {
        border-radius: 6px;
        margin: 0 -6px;
    }
    
    th, td {
        padding: 8px 6px;
        font-size: 0.8rem;
    }
    
    .dashboard-cards {
        grid-template-columns: 1fr;
    }
}

/* ============ ULTIMATE RESPONSIVE MAQUETAS ============ */
@media (max-width: 991px) {
    .maqueta-editor {
        grid-template-columns: 1fr !important;
        height: auto !important;
        max-height: none !important;
        overflow-y: visible !important;
    }
    .editor-canvas-container {
        height: 450px !important;
        min-height: 450px !important;
        padding: 40px 10px !important;
    }
    .zonas-tabs {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        width: auto !important;
        max-width: 95% !important;
        top: 10px !important;
        z-index: 1000 !important;
        background: rgba(10, 10, 10, 0.95) !important;
    }
    .zona-tab {
        flex: 0 0 auto !important;
        white-space: nowrap !important;
        padding: 5px 12px !important;
    }
}
/* ============ SORTABLEJS ============ */
.sortable-ghost {
    opacity: 0.4;
    background: var(--primary-color) !important;
    border: 2px dashed var(--primary-color) !important;
}

.sortable-drag {
    background: var(--card-bg) !important;
    box-shadow: var(--shadow-lg) !important;
    opacity: 0.9;
    transform: rotate(2deg);
    cursor: grabbing !important;
}

.category-content-grid.sorting {
    border: 1px dashed var(--primary-color);
    background: rgba(245, 197, 24, 0.05);
}

.producto-card.list-view:active {
    cursor: grabbing;
}

/* Premium Dashboard - Modern Stats & Cards */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
}

.stat-info .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 2px;
}

.stat-info .stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
    opacity: 0.7;
}

/* Premium Accents */
.premium-yellow .stat-icon { color: #fbbf24; background: rgba(251, 191, 36, 0.15); }
.premium-yellow .stat-value { color: #fbbf24; }
.premium-yellow::after { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: #fbbf24; }

.premium-green .stat-icon { color: #10b981; background: rgba(16, 185, 129, 0.15); }
.premium-green .stat-value { color: #10b981; }
.premium-green::after { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: #10b981; }

.premium-blue .stat-icon { color: #3b82f6; background: rgba(59, 130, 246, 0.15); }
.premium-blue .stat-value { color: #3b82f6; }
.premium-blue::after { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: #3b82f6; }

.pedido-mini-item:hover {
    transform: translateX(5px);
    background: rgba(16, 185, 129, 0.12) !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
}

/* ============ BALANCE & GASTOS CARDS (compactas) ============ */
.balance-resumen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.balance-card {
    padding: 14px 16px;
    border-radius: 10px;
    color: #fff;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.balance-card .balance-label {
    font-size: 0.78rem;
    font-weight: 500;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}
.balance-card .balance-valor {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 2px 0;
    line-height: 1.2;
}
.balance-card .balance-sub {
    font-size: 0.72rem;
    opacity: 0.85;
}
.balance-ingresos { background: linear-gradient(135deg, #10b981, #059669); }
.balance-gastos { background: linear-gradient(135deg, #ef4444, #dc2626); }
.balance-iva { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.balance-neto-pos { background: linear-gradient(135deg, #f5c518, #d97706); color: #1a1a1a; }
.balance-neto-neg { background: linear-gradient(135deg, #f87171, #ea580c); }

/* ============ HACIENDA — CENTRO FISCAL ============ */
#page-hacienda #hacienda-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}
#page-hacienda #hacienda-tabs li { list-style: none; }
#page-hacienda .nav-link {
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}
#page-hacienda .nav-link:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}
#page-hacienda .nav-link.active {
    background: var(--primary-color);
    color: #1a1a1a;
    border-color: var(--primary-color);
    font-weight: 700;
}
#page-hacienda .tab-content {
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cards interiores de Hacienda: mejor contraste sobre fondo oscuro */
#page-hacienda .card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 18px;
}
#page-hacienda .card-header {
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 18px;
    border-radius: 10px 10px 0 0;
}
#page-hacienda .card-body {
    padding: 18px;
}

/* Tablas fiscales internas: menos tamaño, más ligeras */
#fiscal-resultado .card {
    margin-bottom: 14px;
}
#fiscal-resultado h4,
#fiscal-resultado h5 {
    font-size: 1rem;
}
#fiscal-resultado .table-sm td,
#fiscal-resultado .table td {
    padding: 6px 10px;
    font-size: 0.88rem;
}
#fiscal-resultado .row > [class*="col-"] {
    padding: 0 6px;
}

/* Tarjetas fiscales — cabeceras con buen contraste en modo oscuro */
.fiscal-card {
    margin-bottom: 14px;
}
.fiscal-card .card-header {
    padding: 10px 14px;
    border-radius: 10px 10px 0 0;
}
.fiscal-card .card-header h5 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}
.fiscal-card.fiscal-ingresos {
    border: 1px solid rgba(16,185,129,0.4);
}
.fiscal-card.fiscal-ingresos .card-header {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}
.fiscal-card.fiscal-gastos {
    border: 1px solid rgba(239,68,68,0.4);
}
.fiscal-card.fiscal-gastos .card-header {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}
.fiscal-card.fiscal-303 {
    border: 1px solid rgba(59,130,246,0.4);
}
.fiscal-card.fiscal-303 .card-header {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
}
.fiscal-card.fiscal-130 {
    border: 1px solid rgba(245,158,11,0.4);
}
.fiscal-card.fiscal-130 .card-header {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}
.fiscal-card .table tr {
    border-color: var(--border-color);
}
.fiscal-card .table td {
    color: var(--text-color);
    padding: 6px 10px;
    font-size: 0.88rem;
}
.fiscal-card .table .text-right { text-align: right; }
.fiscal-card .bg-warning {
    background: rgba(245,158,11,0.18) !important;
    color: #f59e0b !important;
}
.fiscal-card .bg-info {
    background: rgba(6,182,212,0.18) !important;
    color: #06b6d4 !important;
}

/* Acordeón de guía autónomo */
.guia-modelo summary {
    list-style: none;
}
.guia-modelo summary::-webkit-details-marker { display: none; }
.guia-modelo[open] .guia-chevron { transform: rotate(180deg); }
.guia-modelo:hover { background: rgba(255,255,255,0.05) !important; }
.guia-modelo summary:hover { background: rgba(255,255,255,0.02); border-radius: 8px; }

/* ============================================================ */
/* MEJORAS RESPONSIVE GLOBALES (móviles y tablets)               */
/* ============================================================ */
@media (max-width: 768px) {
    /* Título del header: que ocupe más ancho */
    .top-header h1 {
        max-width: calc(100vw - 110px) !important;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Form actions: botones apilados a ancho completo */
    .form-actions {
        flex-direction: column-reverse;
        gap: 8px;
    }
    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* Modales: ocupar (casi) todo el viewport */
    .modal {
        width: 96vw !important;
        max-width: 96vw !important;
        max-height: 92vh !important;
    }
    .modal-overlay.active .modal,
    .modal-overlay .modal {
        width: 96vw;
        max-width: 96vw;
    }
    .modal-body {
        padding: 15px !important;
        max-height: calc(92vh - 110px);
        overflow-y: auto;
    }
    .modal-header {
        padding: 12px 15px;
        font-size: 1rem;
    }

    /* Filtros: siempre stack en móvil */
    .filters-bar,
    .filters-row {
        flex-direction: column;
        gap: 8px;
    }
    .filters-bar .form-control,
    .filters-row .form-control {
        width: 100%;
        max-width: 100% !important;
    }

    /* Tablas: scroll horizontal preservando encabezados */
    .table-responsive,
    .data-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        padding: 0 12px;
    }
    .data-table {
        font-size: 0.82rem;
        min-width: 560px; /* evita que columnas se compriman demasiado */
    }
    .data-table th,
    .data-table td {
        padding: 8px 6px;
    }
    .data-table .actions .btn {
        padding: 4px 8px;
        margin-right: 3px;
    }

    /* Grids de resumen fiscal / contabilidad */
    .row > [class*="col-md-"],
    .row > [class*="col-lg-"] {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 10px;
    }

    /* Stats / dashboard cards */
    .stats-grid,
    .summary-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    /* Pestañas genéricas: que quepan bien */
    .tabs,
    .nav-tabs,
    #contabilidad-tabs {
        flex-wrap: wrap;
        gap: 4px;
    }
    .nav-link,
    .tab-btn {
        flex: 1 1 auto;
        min-width: 45%;
        font-size: 0.85rem;
        padding: 8px 10px;
    }

    /* Inventario resumen */
    .inventario-resumen {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px;
    }

    /* Zonas de editar producto */
    .zonas-producto-grid,
    .zonas-tamaños-grid {
        grid-template-columns: 1fr !important;
    }

    /* Productos listado */
    .productos-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Evitar overflow horizontal general */
    html, body {
        overflow-x: hidden;
    }

    /* Inputs siempre con tamaño 16px para evitar zoom en iOS */
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="tel"],
    input[type="date"],
    input[type="password"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Móviles pequeños (≤ 480px): ajustes extra */
@media (max-width: 480px) {
    .productos-grid {
        grid-template-columns: 1fr !important;
    }
    .inventario-resumen {
        grid-template-columns: 1fr !important;
    }
    .page-header h2 {
        font-size: 1.05rem !important;
    }
    .modal {
        width: 100vw !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }
    .data-table {
        min-width: 480px;
    }
}

/* ============================================================ */
/* RESPONSIVE ESPECÍFICO PARA MÓDULOS NUEVOS                    */
/* ============================================================ */
@media (max-width: 768px) {
    /* === HACIENDA === */
    #page-hacienda #hacienda-tabs {
        padding-bottom: 6px;
    }
    #page-hacienda .nav-link {
        flex: 1 1 calc(50% - 6px);
        font-size: 0.78rem;
        padding: 7px 8px;
        justify-content: center;
        text-align: center;
    }
    #page-hacienda .nav-link i {
        margin-right: 2px;
    }
    /* Cards de ingresos/gastos fiscales se apilan */
    #fiscal-resultado .row {
        display: block;
    }
    #fiscal-resultado .col-md-6 {
        max-width: 100%;
        flex: 1 1 100%;
        margin-bottom: 12px;
    }
    /* Acordeón de guía */
    .guia-modelo summary {
        padding: 10px 12px !important;
    }
    .guia-modelo summary strong {
        font-size: 0.9rem;
    }
    .guia-modelo > div {
        padding: 4px 12px 14px 24px !important;
    }
    /* Calendario fiscal: hacer tabla más compacta */
    #calendario-fiscal-container .data-table {
        font-size: 0.78rem;
    }
    #calendario-fiscal-container .data-table th,
    #calendario-fiscal-container .data-table td {
        padding: 6px 4px;
    }

    /* === VOLCAR DESDE ROLY === */
    /* El preview usa un grid 300px + 1fr; en móvil apilar */
    #modalBody [style*="grid-template-columns:300px"] {
        grid-template-columns: 1fr !important;
    }
    /* Swatches más pequeños */
    #modalBody [onclick*="seleccionarColorRoly"] {
        width: 28px !important;
        height: 28px !important;
    }
    /* Tabla lista productos: ocultar columna de imagen para ahorrar espacio */
    #modalBody .data-table th:first-child,
    #modalBody .data-table td:first-child {
        max-width: 42px;
    }

    /* === AJUSTES DEL SISTEMA === */
    /* Formulario documentos de empresa: cada campo en su línea */
    #empresa-doc-file,
    #empresa-doc-tipo,
    #empresa-doc-nombre {
        max-width: 100% !important;
        width: 100% !important;
        margin-bottom: 8px;
    }
    /* Botones de backup se apilan */
    .card-body > div[style*="flex-wrap: wrap"] button {
        flex: 1 1 100%;
        justify-content: center;
    }
    /* Info de versión: menos columnas */
    #version-info-container > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr 1fr !important;
    }

    /* === INVENTARIO LIBRO === */
    #libro-inventario-contenido .resumen-card {
        min-width: 140px !important;
    }
    /* Tabla del libro: scroll horizontal si hace falta */
    #libro-inventario-contenido .table-responsive,
    #libro-inventario-contenido > div[style*="overflow-y:auto"] {
        overflow-x: auto;
    }

    /* === PEDIDOS — COLA DE ETIQUETAS === */
    #cola-etiquetas-badge {
        top: -4px !important;
        right: -4px !important;
        width: 18px !important;
        height: 18px !important;
        font-size: 0.65rem !important;
    }

    /* === PDF PROFORMA / FICHA TÉCNICA — no aplica (es PDF generado) === */
}

/* MÓDULO MENSAJES responsive */
@media (max-width: 768px) {
    .mensajes-wrapper {
        grid-template-columns: 1fr !important;
        height: auto !important;
    }
    #mensajes-lista-hilos {
        max-height: 40vh;
    }
    #mensajes-conversacion {
        min-height: 55vh;
    }
    .hilo-item {
        padding: 10px 12px !important;
    }
}

/* Móvil muy pequeño: tabs de Hacienda en una sola columna */
@media (max-width: 420px) {
    #page-hacienda .nav-link {
        flex: 1 1 100%;
    }
    /* Balance cards 1 columna */
    .balance-resumen-grid {
        grid-template-columns: 1fr !important;
    }
    /* Reducir swatches más */
    #modalBody [onclick*="seleccionarColorRoly"] {
        width: 24px !important;
        height: 24px !important;
    }
}
