/* ═══════════════════════════════════════════════════════════════
   Sistema de Inventario — Design System v3
   ---------------------------------------------------------------
   Tokens + componentes globales. Los nombres de clase existentes se
   conservan (el JS los usa como selectores); solo cambia su estilo.
   Los colores de marca (--primary-color, --sidebar-color, etc.) los
   puede sobrescribir el cliente desde Configuración (theme.js).
   ═══════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* ── Marca (configurable por el cliente) ── */
    --primary-color: #4e73df;
    --secondary-color: #64748b;
    --success-color: #16a34a;
    --info-color: #0ea5e9;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --sidebar-color: #2c3e50;
    --sidebar-header-color: #1a2a3a;
    --sidebar-text-color: #ffffff;
    --accent-color: #1cc88a;

    /* ── Superficies y texto ── */
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafd;
    --light-color: #f8fafd;
    --dark-color: #1e293b;
    --text-1: #1e293b;
    --text-2: #5b6b7f;
    --text-3: #94a3b8;
    --border-color: #e4e9f2;
    --border-strong: #cbd5e1;

    /* ── Geometría y elevación ── */
    --sidebar-width: 250px;
    --header-height: 60px;
    --border-radius: 10px;
    --radius-sm: 8px;
    --radius-lg: 14px;
    --box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px -6px rgba(15, 23, 42, .08);
    --shadow-md: 0 8px 30px -8px rgba(15, 23, 42, .16);
    --shadow-pop: 0 18px 44px -12px rgba(15, 23, 42, .22);
    --focus-ring: 0 0 0 3px color-mix(in srgb, var(--primary-color) 22%, transparent);

    /* ── Movimiento ── */
    --transition-speed: 0.2s;
    --ease: cubic-bezier(.4, 0, .2, 1);

    /* ── Tipografía ── */
    --font: 'Inter', 'Nunito', system-ui, -apple-system, sans-serif;
}

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

html {
    overflow-y: scroll; /* Evita saltos de layout entre páginas */
}

/* ── Scrollbar global ── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: #c3ccd9;
    border-radius: 8px;
    border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: #9aa7b8; }

body {
    font-family: var(--font);
    background-color: var(--bg);
    color: var(--text-1);
    font-size: 14px;
    line-height: 1.55;
    min-height: 101vh;
    display: flex;
    -webkit-font-smoothing: antialiased;
}

/* ── Accesibilidad ── */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ═════════════════════════ SIDEBAR ═════════════════════════ */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-color);
    color: var(--sidebar-text-color);
    position: fixed;
    height: 100vh;
    transition: width var(--transition-speed) var(--ease);
    z-index: 100;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border: 0; }

.sidebar-header {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: var(--header-height);
    background-color: var(--sidebar-header-color);
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.sidebar-header i {
    font-size: 22px;
    margin-right: 4px;
    opacity: .95;
}

.sidebar-header h1 {
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: -.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-menu {
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    border-left: 3px solid transparent;
    color: var(--sidebar-text-color);
    opacity: .82;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: .01em;
    transition: background-color .18s var(--ease), opacity .18s var(--ease);
}

.menu-item i {
    font-size: 16px;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.menu-item span {
    margin-left: 10px;
    white-space: nowrap;
}

.menu-item:hover {
    background-color: rgba(255, 255, 255, 0.09);
    opacity: 1;
}

.menu-item.active {
    background-color: rgba(255, 255, 255, 0.14);
    border-left-color: var(--primary-color);
    opacity: 1;
    font-weight: 600;
}

/* ═════════════════════ CONTENIDO PRINCIPAL ═════════════════ */
.main-content {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-speed) var(--ease);
}

.header {
    height: var(--header-height);
    background-color: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-search {
    position: relative;
    width: 320px;
}

.header-search input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    border: 1px solid var(--border-color);
    background: var(--surface-2);
    border-radius: 999px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text-1);
    transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
.header-search input::placeholder { color: var(--text-3); }
.header-search input:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--primary-color);
    box-shadow: var(--focus-ring);
}

.header-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
    font-size: 13px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.notification-icon {
    position: relative;
    margin-right: 14px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color .18s var(--ease);
}
.notification-icon:hover { background-color: var(--surface-2); }

.notification-icon i {
    font-size: 16px;
    color: var(--text-2);
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: var(--danger-color);
    color: white;
    font-size: 10px;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: none !important; /* Notificaciones ocultas por decisión del usuario */
    align-items: center;
    justify-content: center;
}

/* ── Menú de usuario ── */
.user-dropdown {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    position: relative;
    padding: 5px 10px 5px 6px;
    border-radius: 999px;
    transition: background-color .18s var(--ease);
}
.user-dropdown:hover { background-color: var(--surface-2); }

.user-dropdown img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.user-dropdown span {
    font-weight: 600;
    font-size: 13.5px;
    color: var(--text-1);
}

.user-dropdown > i { font-size: 11px; color: var(--text-3); }

.dropdown-content {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background-color: var(--surface);
    min-width: 260px;
    box-shadow: var(--shadow-pop);
    border-radius: var(--radius-lg);
    z-index: 1000;
    overflow: hidden;
    border: 1px solid var(--border-color);
    animation: dropdownFadeIn 0.18s var(--ease);
}

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

.dropdown-content.show { display: block; }

.dropdown-user-info {
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    background-color: var(--surface-2);
    border-bottom: 1px solid var(--border-color);
}

.dropdown-user-info img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid var(--surface);
    box-shadow: var(--box-shadow);
}

.dropdown-user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dropdown-user-details .fullname {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-user-details .username {
    font-size: 12.5px;
    color: var(--text-2);
}

.dropdown-content a {
    color: var(--text-1);
    padding: 11px 18px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
    font-weight: 500;
    font-size: 13.5px;
}

.dropdown-content a i {
    font-size: 15px;
    width: 20px;
    text-align: center;
    color: var(--text-3);
    transition: color 0.15s var(--ease);
}

.dropdown-content a:hover {
    background-color: color-mix(in srgb, var(--primary-color) 7%, transparent);
    color: var(--primary-color);
}

.dropdown-content a:hover i { color: var(--primary-color); }

.dropdown-content .dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 4px 0;
}

/* ═════════════════════════ PÁGINA ══════════════════════════ */
.page-content {
    padding: 26px 28px 48px;
    max-width: 1440px;
}

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

.section-title {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--text-1);
}

.date-filter select {
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text-1);
}

/* ═════════════════════════ CARDS ═══════════════════════════ */
.card {
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.summary-card {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    background-color: var(--surface);
    transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.card-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    flex-shrink: 0;
}

.card-icon i {
    font-size: 19px;
    color: white;
}

.card-info h3 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-2);
    margin-bottom: 4px;
}

.card-info .number {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--text-1);
    font-variant-numeric: tabular-nums;
}

.bg-primary { background-color: var(--primary-color); }
.bg-success { background-color: var(--success-color); }
.bg-warning { background-color: var(--warning-color); }
.bg-danger  { background-color: var(--danger-color); }
.bg-info    { background-color: var(--info-color); }

/* ═════════════════════════ GRÁFICOS ════════════════════════ */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.chart-card {
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 20px;
}

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

.chart-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-1);
}

.chart-actions select {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: var(--surface);
}

.chart {
    height: 300px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
}

.chart-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
}

.bar {
    width: 30px;
    background-color: var(--primary-color);
    border-radius: 4px 4px 0 0;
    transition: height 0.4s var(--ease);
}

.pie-chart {
    position: relative;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background-color: var(--surface-2);
    margin: 0 auto;
}

.pie-segment {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--primary-color);
}

/* ═════════════════════════ TABLAS ══════════════════════════ */
.table-container {
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

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

.table-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-1);
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

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

.data-table th {
    background-color: var(--surface-2);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-2);
    white-space: nowrap;
}

.data-table td { color: var(--text-1); }

.data-table tbody tr {
    transition: background-color .13s var(--ease);
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover {
    background-color: color-mix(in srgb, var(--primary-color) 4%, var(--surface));
}

/* Fila de "cargando" que inserta el JS */
.loading-row td {
    text-align: center;
    color: var(--text-3);
    padding: 28px 16px !important;
    font-size: 13px;
}

/* ── Badges de estado ── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .02em;
    white-space: nowrap;
}
.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-badge.active,
.status-badge.completed {
    background-color: rgba(22, 163, 74, 0.1);
    color: #15803d;
}

.status-badge.inactive {
    background-color: rgba(100, 116, 139, 0.12);
    color: #475569;
}

.status-badge.pending {
    background-color: rgba(217, 119, 6, 0.1);
    color: #b45309;
}

.status-badge.cancelled {
    background-color: rgba(220, 38, 38, 0.09);
    color: #b91c1c;
}

.status-badge.received {
    background-color: rgba(14, 165, 233, 0.1);
    color: #0369a1;
}

/* ── Botones de acción por fila ── */
.action-buttons {
    display: flex;
    gap: 6px;
}

.btn-icon {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    font-size: 12.5px;
    cursor: pointer;
    transition: transform .15s var(--ease), filter .15s var(--ease), background-color .15s var(--ease);
}
.btn-icon:hover { transform: translateY(-1px); filter: brightness(.94); opacity: 1; }
.btn-icon:active { transform: translateY(0); }

.view-btn    { background-color: rgba(14, 165, 233, 0.12);  color: #0369a1; }
.edit-btn    { background-color: rgba(217, 119, 6, 0.12);   color: #b45309; }
.delete-btn  { background-color: rgba(220, 38, 38, 0.1);    color: #b91c1c; }
.print-btn   { background-color: color-mix(in srgb, var(--primary-color) 12%, transparent); color: var(--primary-color); }
.restock-btn { background-color: rgba(22, 163, 74, 0.12);   color: #15803d; }
.complete-btn{ background-color: rgba(22, 163, 74, 0.12);   color: #15803d; }
.cancel-btn  { background-color: rgba(220, 38, 38, 0.1);    color: #b91c1c; }
.receive-btn { background-color: rgba(14, 165, 233, 0.12);  color: #0369a1; }

/* ═════════════════════════ PAGINACIÓN ══════════════════════ */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    gap: 6px;
}

.pagination-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background-color: var(--surface);
    color: var(--text-2);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s var(--ease);
}

.pagination-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--primary-color) 60%, transparent);
}

.pagination-btn:hover:not(.active) {
    background-color: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text-1);
}

.pagination-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    color: var(--text-3);
}

/* ═════════════════════════ BOTONES ═════════════════════════ */
.btn {
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: .01em;
    cursor: pointer;
    transition: filter .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    white-space: nowrap;
}

.btn i { font-size: 13px; }

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 14px -6px color-mix(in srgb, var(--primary-color) 70%, transparent);
}

.btn-secondary {
    background-color: var(--surface);
    color: var(--text-1);
    border-color: var(--border-strong);
}
.btn-secondary:hover { background-color: var(--surface-2); }

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

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

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

.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

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

/* ═════════════════ ACCIONES DE SECCIÓN / BÚSQUEDA ══════════ */
.section-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.search-filter {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-filter input {
    padding: 9px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text-1);
    width: 260px;
    transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.search-filter input::placeholder { color: var(--text-3); }

.search-filter select {
    padding: 9px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text-1);
}

.search-filter input:focus,
.search-filter select:focus,
.date-filter select:focus,
.chart-actions select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--focus-ring);
}

/* ═════════════════════════ TABS ════════════════════════════ */
.inventory-tabs,
.sales-tabs,
.purchases-tabs,
.reports-tabs,
.config-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab {
    padding: 10px 18px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13.5px;
    color: var(--text-2);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: color .15s var(--ease), border-color .15s var(--ease), background-color .15s var(--ease);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tab:hover { color: var(--text-1); background-color: var(--surface-2); }

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content { display: none; }
.tab-content.active {
    display: block;
    animation: tabFadeIn .2s var(--ease);
}
@keyframes tabFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═════════════════════════ FORMULARIOS ═════════════════════ */
.form-row {
    display: flex;
    gap: 18px;
    margin-bottom: 4px;
}

.form-group {
    flex: 1;
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 12.5px;
    color: var(--text-2);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-family: inherit;
    font-size: 13.5px;
    color: var(--text-1);
    transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-3); }

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

.form-group textarea {
    min-height: 90px;
    resize: vertical;
}

/* ══════════════════════════════════════════════════════════════════════
   PLAN GATING — candados de menú, insignia de plan y pantalla de upgrade
   (generado por js/plan.js según el plan de la suscripción)
   ══════════════════════════════════════════════════════════════════════ */
a.menu-item.plan-locked {
  opacity: 0.55;
  cursor: not-allowed;
}
a.menu-item.plan-locked .plan-lock-ico {
  margin-left: auto;
  font-size: 0.7rem;
  opacity: 0.8;
}
.plan-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  color: inherit;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 180ms ease;
}
.plan-badge:hover { background: rgba(255, 255, 255, 0.12); }
.plan-upgrade-state {
  max-width: 520px;
  margin: 8vh auto;
  padding: 40px 32px;
  text-align: center;
  border-radius: 14px;
  background: var(--surface-color, var(--sidebar-color, #fff));
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}
.plan-upgrade-state .plan-upgrade-ico {
  width: 64px; height: 64px;
  margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 1.5rem;
  background: color-mix(in srgb, var(--primary-color) 14%, transparent);
  color: var(--primary-color);
}
.plan-upgrade-state h2 { margin-bottom: 10px; font-size: 1.25rem; }
.plan-upgrade-state p { opacity: 0.8; margin-bottom: 22px; line-height: 1.55; }
.plan-toast a { margin-left: 8px; font-weight: 700; text-decoration: underline; color: inherit; }

/* ═════════════════════════ MODALES ═════════════════════════ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(3px);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-pop);
    width: 90%;
    max-width: 600px;
    margin: 48px auto;
    animation: modalFadeIn 0.22s var(--ease);
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-18px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

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

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--text-1);
}

.close-modal,
.close {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-3);
    transition: background-color .15s var(--ease), color .15s var(--ease);
}
.close-modal:hover,
.close:hover {
    background-color: var(--surface-2);
    color: var(--text-1);
}

.modal-body { padding: 22px; }

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

/* ═════════════════ NOTIFICACIONES (toasts del JS) ══════════ */
.notification {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    max-width: 380px;
    margin-bottom: 10px;
    padding: 12px 16px 12px 14px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    border-left-width: 4px;
    background: var(--surface);
    color: var(--text-1);
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.45;
    box-shadow: var(--shadow-md);
    animation: toastIn .25s var(--ease);
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(24px); }
    to { opacity: 1; transform: translateX(0); }
}
.notification::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 14px;
    flex-shrink: 0;
}
.notification.success { border-left-color: var(--success-color); }
.notification.success::before { content: "\f058"; color: var(--success-color); }
.notification.error { border-left-color: var(--danger-color); }
.notification.error::before { content: "\f057"; color: var(--danger-color); }
.notification.info { border-left-color: var(--info-color); }
.notification.info::before { content: "\f05a"; color: var(--info-color); }
.notification.warning { border-left-color: var(--warning-color); }
.notification.warning::before { content: "\f071"; color: var(--warning-color); }

/* ══════════════════ ESTADOS VACÍOS ═════════════════════════ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 40px 20px;
    color: var(--text-2);
}
.empty-state i {
    font-size: 34px;
    color: var(--text-3);
    margin-bottom: 4px;
}
.empty-state p { font-size: 13.5px; max-width: 320px; }

/* ═════════════════════════ POS ═════════════════════════════ */
.pos-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.pos-categories {
    display: flex;
    overflow-x: auto;
    margin-bottom: 15px;
    padding-bottom: 5px;
    gap: 8px;
}

.pos-category {
    padding: 7px 15px;
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s var(--ease);
}
.pos-category:hover { border-color: var(--border-strong); color: var(--text-1); }

.pos-category.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pos-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 8px;
}

.pos-product-card {
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
}

.pos-product-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: color-mix(in srgb, var(--primary-color) 45%, var(--border-color));
}

.pos-product-card img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 10px;
}

.pos-product-card h4 {
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-1);
}

.pos-product-card .price {
    font-weight: 700;
    color: var(--primary-color);
    font-variant-numeric: tabular-nums;
}

.pos-cart {
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
    height: 600px;
}

.pos-cart-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.pos-cart-header h3 {
    margin-bottom: 10px;
    font-size: 15.5px;
    font-weight: 700;
    color: var(--text-1);
}

.customer-select select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13.5px;
    background: var(--surface);
}

.pos-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

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

.item-details h4 {
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-1);
}

.item-details p {
    font-size: 12px;
    color: var(--text-2);
}

.item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-control {
    display: flex;
    align-items: center;
}

.qty-btn {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--surface-2);
    color: var(--text-1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color .15s var(--ease);
}
.qty-btn:hover { background-color: var(--border-color); }

.quantity-control input {
    width: 42px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    padding: 4px 2px;
    margin: 0 5px;
}

.item-total {
    font-weight: 700;
    color: var(--text-1);
    font-variant-numeric: tabular-nums;
}

.remove-item {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 4px 6px;
    transition: background-color .15s var(--ease);
}
.remove-item:hover { background-color: rgba(220, 38, 38, .08); }

.pos-cart-summary {
    padding: 15px;
    border-top: 1px solid var(--border-color);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13.5px;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}

.summary-row.total {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-1);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.payment-methods {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin: 15px 0;
}

.payment-method {
    flex: 1;
    text-align: center;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    color: var(--text-2);
    cursor: pointer;
    transition: all .15s var(--ease);
}

.payment-method.active {
    background-color: color-mix(in srgb, var(--primary-color) 9%, transparent);
    border-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.payment-method i {
    font-size: 18px;
    margin-bottom: 5px;
    display: block;
}

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

.checkout-btn {
    flex: 3;
    padding: 11px;
    background-color: var(--success-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: filter .15s var(--ease), transform .15s var(--ease);
    box-shadow: 0 4px 14px -6px color-mix(in srgb, var(--success-color) 70%, transparent);
}
.checkout-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }

.clear-cart-btn {
    flex: 1;
    padding: 11px;
    background-color: transparent;
    color: var(--danger-color);
    border: 1px solid color-mix(in srgb, var(--danger-color) 45%, transparent);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s var(--ease);
}
.clear-cart-btn:hover { background-color: rgba(220, 38, 38, .07); }

/* ══════════════════ DETALLES (modales de ver) ══════════════ */
.sale-details,
.purchase-details,
.supplier-details,
.client-details {
    margin-bottom: 20px;
}

.detail-row {
    display: flex;
    margin-bottom: 8px;
    padding: 6px 0;
    border-bottom: 1px dashed var(--border-color);
}
.detail-row:last-child { border-bottom: none; }

.detail-label {
    font-weight: 600;
    width: 150px;
    flex-shrink: 0;
    font-size: 13px;
    color: var(--text-2);
}

.detail-value {
    flex: 1;
    font-size: 13.5px;
    color: var(--text-1);
}

.sale-items,
.purchase-items,
.supplier-purchases,
.client-sales {
    margin-bottom: 20px;
}

.sale-items h4,
.purchase-items h4,
.sale-notes h4,
.purchase-notes h4,
.supplier-purchases h4,
.client-sales h4 {
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-2);
}

.sale-summary,
.purchase-summary {
    margin-bottom: 20px;
    padding: 15px;
    background-color: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

/* ═════════════════════════ REPORTES ════════════════════════ */
.report-header { margin-bottom: 20px; }

.report-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 5px;
}

.date-range-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.date-range-filter input[type="date"] {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13.5px;
    background: var(--surface);
    color: var(--text-1);
}

.custom-report-builder {
    background-color: var(--surface-2);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
}

.custom-report-result {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.report-placeholder {
    text-align: center;
    color: var(--text-2);
}

.report-placeholder i {
    font-size: 44px;
    margin-bottom: 10px;
    color: var(--text-3);
}

/* ═════════════════════ CONFIGURACIÓN ═══════════════════════ */
.backup-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.backup-section h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 8px;
}

.backup-section p {
    margin-bottom: 15px;
    font-size: 13.5px;
    color: var(--text-2);
}

.backup-history h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 15px;
}

/* ═════════════════════════ RESPONSIVE ══════════════════════ */
@media (max-width: 992px) {
    .sidebar { width: 70px; }

    .sidebar-header { justify-content: center; padding: 18px 8px; }
    .sidebar-header h1 { display: none; }

    .menu-item { justify-content: center; padding: 12px 8px; }
    .menu-item i { width: auto; }
    .menu-item span { display: none; }

    .main-content { margin-left: 70px; }

    .charts-container { grid-template-columns: 1fr; }
    .summary-cards { grid-template-columns: repeat(2, 1fr); }
    .pos-container { grid-template-columns: 1fr; }
    .page-content { padding: 20px 18px 40px; }
}

@media (max-width: 768px) {
    .header { padding: 0 14px; }
    .header-search { display: none; }
    .user-dropdown span { display: none; }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .summary-cards { grid-template-columns: 1fr; }

    .section-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .search-filter { width: 100%; }
    .search-filter input { flex: 1; width: auto; min-width: 0; }

    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-content { width: 94%; margin: 24px auto; }
    .notification { min-width: 0; max-width: calc(100vw - 40px); }
    .section-title { font-size: 18px; }
    .pagination { flex-wrap: wrap; }
}

/* ── Teléfonos pequeños (≤576px) ─────────────────────────────────────────
   DECISIÓN DE PRODUCTO (DECISION_RESPONSIVE_POR_PLAN.md): la interfaz
   responsive es BASE de TODOS los planes (Básico, Estándar, Pro y trial).
   Nunca condicionar estas reglas al plan; las funciones móviles premium
   (escáner de cámara, alertas WhatsApp, PWA) se gatean como MÓDULOS.
   Bloque aditivo: solo ajusta densidad y evita el auto-zoom de iOS. */
@media (max-width: 576px) {
    /* El sidebar de 70px consume ~20% de una pantalla de 360px: compactar. */
    .sidebar { width: 56px; }
    .main-content { margin-left: 56px; }
    .sidebar-header { padding: 14px 4px; min-height: 52px; }
    .menu-item { padding: 11px 4px; }
    .menu-item i { font-size: 18px; }

    /* Densidad de contenido */
    .page-content { padding: 14px 10px 32px; }
    .summary-cards { gap: 10px; }
    .table-container { margin-bottom: 14px; }
    .data-table th, .data-table td { padding: 8px 10px; font-size: 13px; }

    /* iOS hace auto-zoom cuando un input tiene fuente <16px: evitarlo. */
    input, select, textarea { font-size: 16px; }

    /* Objetivos táctiles cómodos (~44px) en acciones principales */
    .btn, button.btn, .menu-item { min-height: 42px; }

    /* Modales y notificaciones a pantalla casi completa */
    .modal-content { width: 100%; margin: 10px auto; border-radius: 10px; }
    .header { gap: 8px; }
}

/* ── Menú hamburguesa (≤820px): sidebar deslizante off-canvas ────────────
   En teléfonos el riel de iconos no basta: el menú completo se oculta
   fuera de pantalla y se abre con la hamburguesa del header (script.js
   inyecta el botón y el velo). Los clientes del plan Básico nunca ven
   esto: su viewport queda fijo en 1280px (vista de escritorio, plan.js).
   NOTA: este bloque va AL FINAL del archivo a propósito — debe ganar a
   las reglas de 992px y 576px. */
.btn-menu-movil { display: none; }
.velo-menu { display: none; }
@media (max-width: 820px) {
    .btn-menu-movil {
        display: flex; align-items: center; justify-content: center;
        width: 42px; height: 42px; border: 0; border-radius: 10px;
        background: transparent; color: inherit; font-size: 20px;
        cursor: pointer; flex: none;
    }
    /* Sidebar completo (con etiquetas), oculto fuera de pantalla */
    .sidebar {
        width: 268px;
        transform: translateX(-100%);
        transition: transform .28s ease;
        z-index: 1200;
    }
    .sidebar.abierta { transform: translateX(0); box-shadow: 0 0 44px rgba(0,0,0,.4); }
    /* Revertir el modo "riel de iconos" de los breakpoints anteriores */
    .sidebar-header { justify-content: flex-start; padding: 18px 20px; }
    .sidebar-header h1 { display: block; }
    .menu-item { justify-content: flex-start; padding: 13px 18px; }
    .menu-item i { width: 24px; font-size: 17px; }
    .menu-item span { display: inline; }
    /* El contenido ocupa TODA la pantalla */
    .main-content { margin-left: 0; }
    /* Velo oscuro tras el menú abierto */
    .velo-menu {
        display: block; position: fixed; inset: 0;
        background: rgba(8, 19, 30, .5); z-index: 1100;
        opacity: 0; pointer-events: none; transition: opacity .25s ease;
    }
    .velo-menu.abierta { opacity: 1; pointer-events: auto; }
}
