/* =============================================
   Creaciones Angie — Cotizador
   Design tokens
   ============================================= */

:root {
    --bg:          #FDF5EF;
    --primary:     #C94060;
    --secondary:   #B87620;
    --accent:      #E0607A;
    --text:        #3A2216;
    --text-light:  #7A5640;
    --white:       #ffffff;
    --danger:      #D32F2F;
    --success:     #2E7D32;
    --border:      #E5D4C4;
    --sidebar-w:   260px;
    --topbar-h:    60px;
    --radius:      10px;
    --shadow:      0 2px 12px rgba(58, 34, 22, 0.10);
    --shadow-lg:   0 8px 28px rgba(58, 34, 22, 0.18);
}

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

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
}

/* =============================================
   SIDEBAR
   ============================================= */

.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: linear-gradient(160deg, #2E1810 0%, #180C06 100%);
    color: var(--white);
    display: flex;
    flex-direction: column;
    z-index: 200;
    overflow: hidden;
    transition: transform 0.28s cubic-bezier(.4,0,.2,1);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.brand-icon {
    font-size: 22px;
    color: var(--primary);
    flex-shrink: 0;
    filter: drop-shadow(0 0 6px rgba(201,64,96,0.50));
}

img.brand-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    font-size: unset;
    color: unset;
}

.brand-texts {
    min-width: 0;
}

.brand-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.1px;
    display: block;
}

.brand-tagline {
    font-size: 10px;
    font-weight: 400;
    color: rgba(255,255,255,0.35);
    letter-spacing: 0.6px;
    text-transform: uppercase;
    display: block;
    margin-top: 1px;
}

/* Botón ✕ solo visible en mobile */
.sidebar-close {
    display: none;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.45);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
    border-radius: var(--radius);
    transition: color 0.15s;
}
.sidebar-close:hover { color: var(--primary); }

.sidebar-nav {
    list-style: none;
    flex: 1;
    padding: 10px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    color: rgba(255,255,255,0.60);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.sidebar-nav li a i {
    font-size: 16px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    transition: color 0.15s;
}

.sidebar-nav li a:hover {
    background-color: rgba(201, 64, 96, 0.12);
    color: rgba(255,255,255,0.88);
    border-left-color: rgba(201,64,96,0.45);
}

.sidebar-nav li a.active {
    background-color: rgba(201, 64, 96, 0.20);
    color: #fff;
    border-left-color: var(--primary);
    font-weight: 600;
}

.sidebar-nav li a.active i {
    color: var(--primary);
    filter: drop-shadow(0 0 4px rgba(201,64,96,0.55));
}

.nav-section {
    padding: 16px 18px 5px;
}

.nav-section span {
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.22);
}

.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-top: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
    gap: 8px;
    min-width: 0;
    background: rgba(0,0,0,0.18);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
}

.sidebar-user-icon {
    font-size: 20px;
    color: rgba(255,255,255,0.40);
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,0.58);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.38);
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    flex-shrink: 0;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
}
.btn-logout:hover {
    color: #ff6b7a;
    background: rgba(255,107,122,0.12);
}

/* =============================================
   OVERLAY — solo mobile
   ============================================= */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.50);
    z-index: 190;
    opacity: 0;
    transition: opacity 0.28s;
    backdrop-filter: blur(2px);
}

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

/* =============================================
   MAIN WRAPPER
   ============================================= */

.main-wrapper {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--topbar-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    box-shadow: 0 2px 10px rgba(58,34,22,0.07);
}

/* Línea de acento degradado en la parte inferior del topbar */
.topbar::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 60%, transparent 100%);
}

.sidebar-toggle {
    background: transparent;
    border: none;
    font-size: 22px;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.sidebar-toggle:hover { color: var(--primary); background: rgba(201,64,96,0.08); }

.topbar-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.2px;
}

.topbar-spacer { flex: 1; }

.topbar-user-area {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    white-space: nowrap;
    padding: 5px 14px;
    background: var(--bg);
    border-radius: 20px;
    border: 1px solid var(--border);
}

.btn-topbar-logout {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--danger, #e53e3e);
    padding: 0 0 0 8px;
    border-left: 1px solid var(--border);
    line-height: 1;
}

.btn-topbar-logout:hover {
    color: var(--danger-dark, #c53030);
}

/* =============================================
   CONTENT
   ============================================= */

.content {
    flex: 1;
    padding: 28px 32px;
    width: 100%;
    min-width: 0;
}

/* =============================================
   FLASH MESSAGES
   ============================================= */

.flash-container {
    padding: 0 32px;
    margin-top: 16px;
}

.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.alert-error {
    background: #fde8ec;
    color: #b71c1c;
    border: 1px solid #f5c0c8;
    border-left: 4px solid var(--danger);
}
.alert-success {
    background: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #a5d6a7;
    border-left: 4px solid var(--success);
}

/* =============================================
   PAGE HEADER
   ============================================= */

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

.page-header h1 {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.3px;
}

/* =============================================
   CARDS
   ============================================= */

.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
    padding-bottom: 12px;
    padding-left: 10px;
    border-bottom: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    letter-spacing: -0.1px;
}

/* ── Variante sin padding — para tarjetas con tabla full-width ── */
.card--flush {
    padding: 0;
    overflow: clip;     /* recorta el border-radius sin bloquear el scroll horizontal del hijo */
}

.card--flush .table-wrapper { margin: 0; }

.card--flush .pagination {
    padding: 10px 20px;
    margin-top: 0;
}

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

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.stat-card--primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-color: transparent;
    color: #fff;
}
.stat-card--primary .stat-label { color: #fff; }
.stat-card--primary .stat-hint  { color: rgba(255,255,255,0.80); }
.stat-card--primary:hover { box-shadow: 0 10px 32px rgba(201,64,96,0.35); }

.stat-icon {
    font-size: 22px;
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
    /* default */
    background: rgba(201, 64, 96, 0.10);
    color: var(--primary);
}

.stat-card:hover .stat-icon { background: rgba(201, 64, 96, 0.17); }

.stat-card--primary .stat-icon {
    background: rgba(255,255,255,0.22);
    color: #fff;
}

/* Variantes de color para íconos del dashboard */
.icon-rose   { color: var(--primary);  background: rgba(201,64,96,0.10);  }
.icon-amber  { color: var(--secondary); background: rgba(184,118,32,0.10); }
.icon-blue   { color: #1565C0;          background: rgba(21,101,192,0.10); }
.icon-green  { color: #2E7D32;          background: rgba(46,125,50,0.10);  }
.icon-orange { color: #E65100;          background: rgba(230,81,0,0.10);   }
.icon-violet { color: #6A1B9A;          background: rgba(106,27,154,0.10); }

.stat-card:hover .icon-rose   { background: rgba(201,64,96,0.18);  }
.stat-card:hover .icon-amber  { background: rgba(184,118,32,0.18); }
.stat-card:hover .icon-blue   { background: rgba(21,101,192,0.18); }
.stat-card:hover .icon-green  { background: rgba(46,125,50,0.18);  }

.stat-label {
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
    letter-spacing: -0.1px;
}

.stat-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background 0.15s, transform 0.10s, box-shadow 0.15s;
    white-space: nowrap;
    letter-spacing: 0.1px;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #fff;
    box-shadow: 0 2px 10px rgba(201,64,96,0.28);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #b03050, #c94060);
    box-shadow: 0 4px 18px rgba(201,64,96,0.40);
    color: #fff;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary) 0%, #D49030 100%);
    color: #fff;
    box-shadow: 0 2px 10px rgba(184,118,32,0.28);
}
.btn-secondary:hover {
    background: linear-gradient(135deg, #9A6510, #B87620);
    box-shadow: 0 4px 18px rgba(184,118,32,0.38);
}

.btn-outline {
    background-color: transparent;
    border: 1.5px solid var(--border);
    color: var(--text);
}
.btn-outline:hover {
    background-color: var(--bg);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 2px 8px rgba(211,47,47,0.22);
}
.btn-danger:hover {
    background: #b71c1c;
    box-shadow: 0 4px 14px rgba(211,47,47,0.34);
}

.btn-sm { padding: 4px 12px; font-size: 12px; }

/* =============================================
   TABLES
   ============================================= */

.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead th {
    background-color: var(--bg);
    color: var(--text-light);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    padding: 12px 14px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:hover { background-color: #fdf0ea; }
tbody tr:last-child td { border-bottom: none; }

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

/* =============================================
   FORMS
   ============================================= */

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

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    letter-spacing: 0.1px;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
    background-color: var(--white);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(201,64,96,0.12);
}

.form-check { display: flex; align-items: center; gap: 0; }

.check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    margin: 0;
}

.check-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-error {
    display: block;
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
    font-weight: 500;
}

.form-hint {
    display: inline;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-light);
    margin-left: 6px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* =============================================
   BADGES
   ============================================= */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.badge-active   { background: #dcfce7; color: #166534; }
.badge-inactive { background: #fde8ec; color: #9b1c2e; }
.badge-draft    { background: #fff3e0; color: #9a3412; }
.badge-sent     { background: #dbeafe; color: #1e3a8a; }
.badge-accepted { background: #dcfce7; color: #166534; }
.badge-rejected { background: #fde8ec; color: #9b1c2e; }

/* =============================================
   PAGINATION
   ============================================= */

.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border: 1.5px solid var(--border);
    color: var(--text);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pagination a:hover        { background: var(--bg); border-color: var(--primary); color: var(--primary); }
.pagination .page-current  {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(201,64,96,0.30);
}
.pagination .page-disabled { color: var(--text-light); pointer-events: none; opacity: 0.40; }

/* Paginación simple: solo flechas + "Página X de Y" */
.pagination--simple {
    gap: 8px;
}

.pagination--simple a {
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
}

.page-info {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    padding: 0 8px;
    white-space: nowrap;
}

.page-info strong {
    color: var(--text);
    font-weight: 700;
}

/* =============================================
   PRICES
   ============================================= */

.price          { font-weight: 700; font-variant-numeric: tabular-nums; }
.price-provider { color: var(--text-light); }
.price-sale     { color: var(--secondary); font-weight: 700; }

/* =============================================
   UTILITIES
   ============================================= */

.d-inline   { display: inline; }
.text-muted { color: var(--text-light); font-size: 13px; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px;  }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px;  }
.mb-2 { margin-bottom: 16px; }

/* =============================================
   RESPONSIVE — MOBILE (≤ 768px)
   ============================================= */

@media (max-width: 768px) {

    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    .sidebar.is-open {
        transform: translateX(0);
        box-shadow: 4px 0 32px rgba(0,0,0,0.30);
    }

    .sidebar-close {
        display: block;
    }

    .main-wrapper {
        margin-left: 0;
    }

    .topbar {
        padding: 0 16px;
        gap: 8px;
    }

    .topbar-user-area {
        display: none;
    }

    .content {
        padding: 16px;
    }

    .flash-container {
        padding: 0 16px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header h1 {
        font-size: 19px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }

    table thead th:nth-child(5),
    table tbody td:nth-child(5) {
        display: none;
    }

    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group,
    .filter-group--wide { min-width: 0; width: 100%; }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .card {
        padding: 16px;
    }
}

@media (max-width: 480px) {

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    table thead th:nth-child(4),
    table tbody td:nth-child(4) {
        display: none;
    }
}

/* =============================================
   TOAST NOTIFICATIONS  (toastr-style)
   ============================================= */

.toast-container {
    position: fixed;
    top: 76px;
    right: 20px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 380px;
    width: calc(100% - 32px);
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 14px;
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(58, 34, 22, 0.18);
    pointer-events: auto;
    transform: translateX(calc(100% + 24px));
    opacity: 0;
    transition: transform 0.28s cubic-bezier(.4, 0, .2, 1), opacity 0.28s;
    line-height: 1.45;
}

.toast.toast--visible {
    transform: translateX(0);
    opacity: 1;
}

.toast.toast--hiding {
    transform: translateX(calc(100% + 24px));
    opacity: 0;
}

.toast-error {
    background: #fde8ec;
    color: #b71c1c;
    border: 1px solid #f5c0c8;
    border-left: 4px solid var(--danger);
}

.toast-success {
    background: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #a5d6a7;
    border-left: 4px solid var(--success);
}

.toast-icon {
    font-size: 15px;
    flex-shrink: 0;
    margin-top: 1px;
}

.toast-text { flex: 1; }

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: currentColor;
    opacity: 0.50;
    padding: 0 2px;
    flex-shrink: 0;
    line-height: 1;
    margin-top: 1px;
    transition: opacity 0.15s;
}
.toast-close:hover { opacity: 1; }

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

.filter-card { padding: 16px 20px; margin-bottom: 16px; }

.filter-form {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 140px;
}

.filter-group--wide { flex: 1; min-width: 200px; }

.filter-group label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    margin-bottom: 0;
}

.filter-group select,
.filter-group input {
    height: 36px;
    padding: 0 10px;
    font-size: 13px;
}

.filter-actions {
    display: flex;
    gap: 6px;
    align-self: flex-end;
    padding-bottom: 0;
}

.input-search {
    position: relative;
    display: flex;
    align-items: center;
}

.input-search-icon {
    position: absolute;
    left: 10px;
    color: var(--text-light);
    font-size: 13px;
    pointer-events: none;
    z-index: 1;
}

.input-search-field {
    padding-left: 32px !important;
}

/* =============================================
   CONFIGURACION TABLE
   ============================================= */

.table-configuracion { table-layout: auto; }

.table-configuracion .col-cfg-clave    { min-width: 160px; }
.table-configuracion .col-cfg-valor    { width: 120px; font-weight: 600; }
.table-configuracion .col-cfg-desc     { min-width: 200px; }
.table-configuracion .col-cfg-acciones { width: 60px; }

/* Override global nth-child(4) — keep actions always visible */
.table-configuracion thead th:nth-child(4),
.table-configuracion tbody td:nth-child(4) { display: table-cell !important; }

@media (max-width: 768px) {
    .table-configuracion .col-cfg-desc { display: none; }
}

/* =============================================
   USUARIOS TABLE
   ============================================= */

.table-usuarios { table-layout: auto; }

.table-usuarios .col-u-nombre   { min-width: 120px; }
.table-usuarios .col-u-email    { min-width: 160px; }
.table-usuarios .col-u-rol      { width: 100px; }
.table-usuarios .col-u-estado   { width: 100px; }
.table-usuarios .col-u-creado   { width: 110px; white-space: nowrap; }
.table-usuarios .col-u-acciones { width: 90px; }

/* Override global nth-child rules; use class-based hiding instead */
@media (max-width: 768px) {
    .table-usuarios thead th:nth-child(5),
    .table-usuarios tbody td:nth-child(5) { display: table-cell !important; }

    .table-usuarios .col-u-email,
    .table-usuarios .col-u-creado { display: none; }
}

@media (max-width: 480px) {
    /* Restore Estado — global hides col 4 at 480px */
    .table-usuarios thead th:nth-child(4),
    .table-usuarios tbody td:nth-child(4) { display: table-cell !important; }

    .table-usuarios .col-u-rol { display: none; }

    .table-usuarios .td-actions { flex-direction: column; gap: 4px; }
}

/* =============================================
   PRODUCT TABLE SPECIFICS
   ============================================= */

.table-productos { table-layout: fixed; }

.table-productos .col-sku       { width: 110px; }
.table-productos .col-nombre    { width: auto;  }
.table-productos .col-categoria { width: 130px; }
.table-productos .col-proveedor { width: 130px; }
.table-productos .col-num       { width: 110px; text-align: right; }
.table-productos .col-pct       { width: 90px;  text-align: center; }
.table-productos .col-venta     { font-weight: 700; }
.table-productos .col-estado    { width: 80px; }
.table-productos .col-acciones  { width: 80px; }

/* ── Responsive overrides for productos table ──
   Override global nth-child rules and use class-based hiding instead */
@media (max-width: 768px) {
    .table-productos { table-layout: auto; }

    /* Restore columns hidden by global nth-child rule; hide by class instead */
    .table-productos thead th:nth-child(4),
    .table-productos tbody td:nth-child(4),
    .table-productos thead th:nth-child(5),
    .table-productos tbody td:nth-child(5) { display: table-cell !important; }

    /* Hide low-priority columns */
    .table-productos .col-categoria,
    .table-productos .col-proveedor,
    .table-productos .col-pct { display: none; }

    /* Let nombre column breathe */
    .table-productos .col-nombre    { width: auto; min-width: 130px; }
    .producto-nombre                { white-space: normal; max-width: 200px; }
    .producto-desc                  { white-space: normal; max-width: 200px; }
}

@media (max-width: 480px) {
    /* On very small screens keep only: Nombre, Precio venta, Estado, Acciones */
    .table-productos .col-sku,
    .table-productos .col-precio-prov { display: none; }

    .producto-nombre { max-width: 140px; }
    .producto-desc   { max-width: 140px; }

    /* Stack action buttons */
    .table-productos .td-actions {
        flex-direction: column;
        gap: 4px;
    }
}

.sku-code {
    display: inline-block;
    font-family: 'Courier New', Courier, monospace;
    font-size: 11.5px;
    font-weight: 700;
    background: rgba(58, 34, 22, 0.06);
    color: var(--text);
    padding: 3px 8px;
    border-radius: 5px;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

.col-nombre-cell { vertical-align: middle; }

.producto-nombre {
    font-weight: 600;
    color: var(--text);
    font-size: 13.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
    display: block;
}

.producto-desc {
    font-size: 11.5px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
    display: block;
    margin-top: 2px;
}

.tag-categoria {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(201, 64, 96, 0.08);
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.pct-badge {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.pct-propio   { background: #dcfce7; color: #166534; }
.pct-heredado { background: #fef9c3; color: #713f12; }

.price-provider { color: var(--text-light); font-variant-numeric: tabular-nums; }
.price-sale     { color: var(--secondary);  font-variant-numeric: tabular-nums; font-weight: 700; }

/* Input with prefix/suffix ($, %) */

.input-prefix,
.input-suffix {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.input-prefix:focus-within,
.input-suffix:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(201, 64, 96, 0.12);
}
.input-prefix input,
.input-suffix input {
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    flex: 1;
}
.input-prefix-symbol,
.input-suffix-symbol {
    padding: 0 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    background: var(--bg);
    border-right: 1.5px solid var(--border);
    height: 100%;
    display: flex;
    align-items: center;
    white-space: nowrap;
}
.input-suffix-symbol {
    border-right: none;
    border-left: 1.5px solid var(--border);
}

/* Form layout helpers for modals */

.form-row {
    display: flex;
    gap: 14px;
    margin-bottom: 0;
}
.form-row .form-group { margin-bottom: 18px; }
.form-group--grow { flex: 1; }
.form-group--sku  { width: 130px; flex-shrink: 0; }
.form-group--half { flex: 1; }

.modal-body--scroll {
    max-height: 68vh;
    overflow-y: auto;
    padding-right: 20px;
    padding-left: 24px;
    padding-top: 20px;
    padding-bottom: 4px;
}
.modal-body--scroll .form-group:last-child { margin-bottom: 0; }

.req { color: var(--danger); }

/* Empty state */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 24px;
    gap: 8px;
    text-align: center;
}
.empty-state-icon {
    font-size: 40px;
    color: var(--border);
    margin-bottom: 4px;
}
.empty-state-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.empty-state-hint {
    font-size: 13px;
    color: var(--text-light);
}

/* =============================================
   RESPONSIVE — DESKTOP (> 768px)
   ============================================= */

@media (min-width: 769px) {

    .sidebar {
        transform: translateX(0) !important;
    }

    .sidebar-overlay {
        display: none !important;
    }

    .sidebar-close {
        display: none !important;
    }

    .sidebar-toggle {
        display: none;
    }
}

/* =============================================
   MODALS
   ============================================= */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.50);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.22s, visibility 0.22s;
}

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

.modal {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    margin: 16px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    transform: translateY(-16px);
    transition: transform 0.22s;
}

.modal-overlay.is-open .modal {
    transform: translateY(0);
}

.modal--sm { max-width: 400px; }

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

.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.2px;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
    line-height: 1;
    flex-shrink: 0;
}
.modal-close:hover { color: var(--primary); background: rgba(201,64,96,0.08); }

.modal-body { padding: 20px 24px; }

.modal-body p { font-size: 14px; color: var(--text-light); line-height: 1.6; }

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

@media (max-width: 480px) {
    .modal { margin: 0; border-radius: var(--radius) var(--radius) 0 0; max-height: 92vh; align-self: flex-end; }
    .modal-overlay { align-items: flex-end; }
    .modal-footer { flex-direction: column-reverse; }
    .modal-footer .btn { width: 100%; justify-content: center; }

    .toast-container { right: 12px; left: 12px; top: 68px; max-width: 100%; }
    .toast { transform: translateY(-20px); }
    .toast.toast--visible  { transform: translateY(0); }
    .toast.toast--hiding   { transform: translateY(-20px); }

    .form-row { flex-direction: column; gap: 0; }
    .form-group--sku { width: 100%; }

    .table-productos .col-categoria,
    .table-productos .col-proveedor { display: none; }
}

/* ── Detalle / cotizaciones ─────────────────────────────────────────────── */

.page-header-back {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.detail-value {
    margin: 0;
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
}

.confirm-dialog {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 8px 0;
}

.confirm-dialog p {
    margin: 0;
    font-size: 14px;
    color: var(--text);
    line-height: 1.5;
}

.confirm-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.confirm-icon--danger { color: var(--danger); }

.modal--narrow { max-width: 420px; }

.total-row td {
    border-top: 2px solid var(--border);
    background: var(--surface);
    font-weight: 600;
}

/* =============================================
   CATEGORY TABLE
   ============================================= */

.table-categorias { table-layout: auto; }

/* Nombre cell: stack description below name on mobile */
.categoria-nombre {
    font-weight: 600;
    font-size: 14px;
    display: block;
}

/* Description shown inline under name only on mobile */
.categoria-desc-mobile {
    display: none;
    font-size: 11.5px;
    margin-top: 2px;
}

/* Override global nth-child(5) hide — keep actions visible on all screens */
.table-categorias thead th:nth-child(5),
.table-categorias tbody td:nth-child(5) {
    display: table-cell !important;
}

@media (max-width: 768px) {
    /* Hide description and percentage columns; show inline description under name */
    .table-categorias .col-desc,
    .table-categorias .col-pct {
        display: none;
    }

    .table-categorias .categoria-desc-mobile {
        display: block;
    }
}

@media (max-width: 480px) {
    /* On very small screens keep Estado column visible but tighten padding */
    .table-categorias thead th,
    .table-categorias tbody td {
        padding: 10px 10px;
    }

    .table-categorias .td-actions {
        flex-direction: column;
        gap: 4px;
    }

    .table-categorias .td-actions .btn-sm {
        padding: 6px 10px;
    }
}
