/* ============================================
   GestiónPRO — Modern Dashboard Theme
   Inspired by: Dynamic Pricing Dashboard UI
   ============================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Custom Properties (Design Tokens) --- */
:root {
    /* Primary Palette */
    --primary: #00B8D4;
    --primary-light: #E0F7FA;
    --primary-dark: #0097A7;
    
    /* Accent Colors */
    --accent-purple: #7C4DFF;
    --accent-purple-light: #EDE7F6;
    --accent-pink: #FF4081;
    --accent-teal: #1DE9B6;
    --accent-orange: #FF9100;
    
    /* Status Colors */
    --success: #00C853;
    --success-light: #E8F5E9;
    --warning: #FFD600;
    --warning-light: #FFFDE7;
    --danger: #FF1744;
    --danger-light: #FFEBEE;
    --info: #00B0FF;
    --info-light: #E1F5FE;
    
    /* Neutrals */
    --bg-body: #F0F2F5;
    --bg-sidebar: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-card-hover: #FAFBFC;
    --border-color: #E8ECF0;
    --text-primary: #1A202C;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --text-white: #FFFFFF;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --shadow-xl: 0 20px 40px -4px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.04);
    --shadow-card-hover: 0 8px 30px rgba(0, 0, 0, 0.08);
    
    /* Borders */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Global --- */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: row;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 14px;
    line-height: 1.6;
}

/* --- Scrollbar Customization --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    max-height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    transition: width var(--transition-slow), transform var(--transition-slow);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent-purple));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.sidebar-brand-text small {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.sidebar-nav-section {
    margin-bottom: 8px;
}

.sidebar-nav-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 8px 12px 6px;
    margin: 0;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
    position: relative;
}

.sidebar-nav-item i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
    transition: color var(--transition-fast);
}

.sidebar-nav-item:hover {
    background: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
}

.sidebar-nav-item:hover i {
    color: var(--primary);
}

.sidebar-nav-item.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-white);
    box-shadow: 0 4px 12px rgba(0, 184, 212, 0.3);
}

.sidebar-nav-item.active i {
    color: var(--text-white);
}

.sidebar-nav-item .badge-nav {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    font-weight: 600;
}

.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-teal), var(--primary));
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-user-actions .btn {
    padding: 4px 8px;
    font-size: 13px;
}

/* Sidebar toggle button */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1060;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--primary-light);
    color: var(--primary);
}

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

.main-content > main {
    flex: 1;
    padding: 28px 32px;
}

/* Top bar within main content */
.topbar {
    padding: 16px 32px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.3px;
}

.topbar-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ============================================
   CARDS — The Heart of the Design
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    transition: all var(--transition-base);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-card-hover);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 18px 24px;
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.card-body {
    padding: 24px;
}

.card-footer {
    background: transparent;
    border-top: 1px solid var(--border-color);
    padding: 14px 24px;
}

/* ============================================
   STAT CARDS (Dashboard KPIs)
   ============================================ */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 0 4px 4px 0;
}

.stat-card.stat-success::before { background: var(--success); }
.stat-card.stat-danger::before { background: var(--danger); }
.stat-card.stat-warning::before { background: var(--accent-orange); }
.stat-card.stat-info::before { background: var(--primary); }
.stat-card.stat-purple::before { background: var(--accent-purple); }

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

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-card.stat-success .stat-card-icon {
    background: var(--success-light);
    color: var(--success);
}
.stat-card.stat-danger .stat-card-icon {
    background: var(--danger-light);
    color: var(--danger);
}
.stat-card.stat-warning .stat-card-icon {
    background: var(--warning-light);
    color: var(--accent-orange);
}
.stat-card.stat-info .stat-card-icon {
    background: var(--info-light);
    color: var(--primary);
}
.stat-card.stat-purple .stat-card-icon {
    background: var(--accent-purple-light);
    color: var(--accent-purple);
}

.stat-card-content {
    flex: 1;
    min-width: 0;
}

.stat-card-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.stat-card-label {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 4px;
}

.stat-card-link {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    margin-top: 8px;
    transition: color var(--transition-fast);
}

.stat-card-link:hover {
    color: var(--primary-dark);
    text-decoration: none;
}

/* ============================================
   TABLES — Clean & Modern
   ============================================ */
.table {
    margin-bottom: 0;
    font-size: 13.5px;
}

.table thead th {
    background: var(--bg-body);
    border-bottom: 2px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    white-space: nowrap;
}

/* Override Bootstrap's dark table header */
.table-dark {
    --bs-table-bg: var(--bg-body);
    --bs-table-color: var(--text-secondary);
    --bs-table-border-color: var(--border-color);
}

.table > tbody > tr > td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

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

.table-hover > tbody > tr:hover > td {
    background: var(--primary-light);
}

.table-striped > tbody > tr:nth-of-type(odd) > td {
    background: rgba(0, 0, 0, 0.01);
}

/* ============================================
   BUTTONS — Refined
   ============================================ */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13.5px;
    padding: 8px 18px;
    transition: all var(--transition-fast);
    border: none;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 2px 8px rgba(0, 184, 212, 0.25);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #00838F);
    box-shadow: 0 4px 14px rgba(0, 184, 212, 0.35);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #00A846);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 200, 83, 0.25);
}
.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 200, 83, 0.35);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #D50032);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--accent-orange), #FB8C00);
    color: white;
}
.btn-warning:hover { color: white; }

.btn-info {
    background: linear-gradient(135deg, var(--info), #0091EA);
    color: white;
}
.btn-info:hover { color: white; }

.btn-secondary {
    background: var(--bg-body);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 15px;
    border-radius: var(--radius-md);
}

/* ============================================
   FORMS — Sleek Inputs
   ============================================ */
.form-control, .form-select {
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13.5px;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    background-color: var(--bg-card);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 184, 212, 0.12);
    outline: none;
}

.form-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.input-group-text {
    background: var(--bg-body);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
}

/* ============================================
   BADGES — Pill Style
   ============================================ */
.badge {
    font-weight: 600;
    font-size: 11px;
    padding: 5px 10px;
    border-radius: var(--radius-full);
    letter-spacing: 0.3px;
}

.badge.bg-success {
    background: var(--success-light) !important;
    color: var(--success) !important;
}

.badge.bg-danger {
    background: var(--danger-light) !important;
    color: var(--danger) !important;
}

.badge.bg-warning {
    background: var(--warning-light) !important;
    color: #F57F17 !important;
}

.badge.bg-info {
    background: var(--info-light) !important;
    color: var(--info) !important;
}

/* ============================================
   MODALS — Modern Feel
   ============================================ */
.modal-content {
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 20px 24px;
    background: var(--bg-card);
}

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

.modal-body {
    padding: 24px;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
    background: var(--bg-body);
}

.btn-close {
    opacity: 0.5;
    transition: opacity var(--transition-fast);
}
.btn-close:hover {
    opacity: 1;
}

/* ============================================
   ALERTS — Softer
   ============================================ */
.alert {
    border: none;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: 500;
    padding: 14px 20px;
}

.alert-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
}

.alert-warning {
    background: var(--warning-light);
    color: #F57F17;
}

.alert-info {
    background: var(--info-light);
    color: var(--info);
}

/* ============================================
   FOOTER — Subtle
   ============================================ */
.app-footer {
    padding: 16px 32px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

.app-footer p {
    margin: 0;
}

/* ============================================
   DASHBOARD PAGE SPECIFIC
   ============================================ */
.dashboard-welcome {
    margin-bottom: 28px;
}

.dashboard-welcome h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.dashboard-welcome p {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
}

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

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

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

.chart-card-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.chart-card-body {
    padding: 20px 24px;
}

/* ============================================
   DROPDOWN MENUS — Override Bootstrap
   ============================================ */
.dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    min-width: 180px;
}

.dropdown-item {
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

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

/* ============================================
   LOGIN PAGE — Standalone
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #F0F2F5 0%, #E0F7FA 50%, #EDE7F6 100%);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.login-card .card-body {
    padding: 40px;
}

.login-logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--accent-purple));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    margin: 0 auto 24px;
}

.login-title {
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.login-subtitle {
    text-align: center;
    font-size: 13.5px;
    color: var(--text-muted);
    margin-bottom: 32px;
}

/* ============================================
   SEARCH RESULTS in POS 
   ============================================ */
.list-group-item-action {
    border: 1px solid var(--border-color);
    font-size: 13.5px;
    padding: 10px 14px;
    transition: all var(--transition-fast);
}

.list-group-item-action:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeInUp 0.4s ease-out forwards;
}

.stat-card { animation: fadeInUp 0.4s ease-out; }
.stat-card:nth-child(1) { animation-delay: 0s; }
.stat-card:nth-child(2) { animation-delay: 0.05s; }
.stat-card:nth-child(3) { animation-delay: 0.1s; }
.stat-card:nth-child(4) { animation-delay: 0.15s; }

/* ============================================
   RESPONSIVE — Tablet (≤991px)
   ============================================ */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }
    
    .sidebar.show {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }
    
    .sidebar-toggle {
        display: flex;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .main-content > main {
        padding: 20px 16px;
        padding-top: 70px;
    }

    .topbar {
        padding: 12px 16px;
        padding-left: 64px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-card-value {
        font-size: 22px;
    }

    /* Tables responsive */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Charts stack vertically */
    .row .col-lg-8,
    .row .col-lg-4 {
        width: 100%;
    }
    
    /* Cards */
    .card-header {
        padding: 14px 16px;
        flex-direction: column;
        gap: 10px;
    }
    
    .card-body {
        padding: 16px;
    }
    
    /* Dashboard welcome */
    .dashboard-welcome h1 {
        font-size: 20px;
    }
    
    /* Bootstrap row/col overrides */
    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }
    
    .row > .col-md-7,
    .row > .col-md-5 {
        width: 100%;
        margin-bottom: 16px;
    }
}

/* ============================================
   RESPONSIVE — Small Tablet (≤767px)
   ============================================ */
@media (max-width: 767px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .stat-card {
        padding: 14px;
        gap: 12px;
    }
    
    .stat-card-icon {
        width: 42px;
        height: 42px;
        font-size: 17px;
    }
    
    .stat-card-value {
        font-size: 20px;
    }
    
    .stat-card-label {
        font-size: 11.5px;
    }

    /* Modal adjustments */
    .modal-dialog {
        margin: 8px;
    }
    
    .modal-content {
        border-radius: var(--radius-lg);
    }
    
    .modal-body {
        padding: 16px;
    }
    
    /* Table font */
    .table {
        font-size: 12.5px;
    }
    
    .table thead th {
        font-size: 10.5px;
        padding: 10px 12px;
    }
    
    .table > tbody > tr > td {
        padding: 10px 12px;
    }
    
    /* Buttons */
    .btn {
        padding: 7px 14px;
        font-size: 12.5px;
    }
    
    .btn-sm {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    h1, .h1 { font-size: 22px; }
    h2, .h2 { font-size: 19px; }
    h3, .h3 { font-size: 16px; }
}

/* ============================================
   RESPONSIVE — Mobile (≤575px)
   ============================================ */
@media (max-width: 575px) {
    .main-content > main {
        padding: 16px 10px;
        padding-top: 64px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .stat-card {
        padding: 14px 16px;
    }
    
    .stat-card-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .stat-card-value {
        font-size: 22px;
    }
    
    /* Dashboard welcome */
    .dashboard-welcome h1 {
        font-size: 18px;
    }
    
    .dashboard-welcome p {
        font-size: 12.5px;
    }
    
    /* Card adjustments */
    .card {
        border-radius: var(--radius-md);
    }
    
    .card-header {
        padding: 12px 14px;
        font-size: 14px;
    }
    
    .card-body {
        padding: 14px;
    }
    
    /* Chart */
    .chart-card {
        border-radius: var(--radius-md);
    }
    
    .chart-card-header {
        padding: 14px 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .chart-card-header h3 {
        font-size: 14px;
    }
    
    .chart-card-body {
        padding: 12px 14px;
    }
    
    /* Forms */
    .form-control, .form-select {
        padding: 9px 12px;
        font-size: 13px;
    }
    
    /* Modal */
    .modal-dialog.modal-lg {
        max-width: 100%;
    }
    
    .modal-header {
        padding: 14px 16px;
    }
    
    .modal-title {
        font-size: 15px;
    }
    
    /* Tables collapse better */
    .table thead th {
        font-size: 10px;
        padding: 8px 10px;
        letter-spacing: 0.3px;
    }
    
    .table > tbody > tr > td {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    /* Footer */
    .app-footer {
        padding: 12px 16px;
        font-size: 11px;
    }
    
    /* Login page mobile */
    .login-card .card-body {
        padding: 28px 20px;
    }
    
    .login-title {
        font-size: 20px;
    }
    
    .login-logo {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1035;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
    display: block;
}

/* ============================================
   UTILITY OVERRIDES
   ============================================ */
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--primary-dark);
}

/* Fix container inside sidebar layout */
.container, .container-fluid {
    max-width: 100%;
}

/* Pagination */
.page-link {
    border-radius: 6px;
    margin: 0 2px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}
.page-link:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}
.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
}

/* SweetAlert2 overrides */
.swal2-popup {
    border-radius: var(--radius-xl) !important;
    font-family: 'Inter', sans-serif !important;
}

.swal2-confirm {
    border-radius: var(--radius-sm) !important;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
}

/* ============================================
   SPEECH DICTATION — Microphone Buttons
   ============================================ */

/* Wrapper around input + mic button */
.speech-input-wrapper {
    position: relative;
    display: flex;
    align-items: stretch;
}

.speech-input-wrapper .form-control,
.speech-input-wrapper textarea.form-control {
    padding-right: 42px; /* Space for the mic button */
    flex: 1;
}

/* Mic button inside input */
.btn-speech-mic {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-body);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
    padding: 0;
    z-index: 5;
    font-size: 13px;
}

/* For textarea, position at top-right */
.speech-input-wrapper textarea.form-control ~ .btn-speech-mic {
    top: 12px;
    transform: none;
}

.btn-speech-mic:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-50%) scale(1.1);
}

.speech-input-wrapper textarea.form-control ~ .btn-speech-mic:hover {
    transform: scale(1.1);
}

/* Listening state — glowing red pulse */
.btn-speech-mic.speech-listening {
    color: var(--danger);
    background: var(--danger-light);
    border-color: var(--danger);
    animation: speech-pulse 1.2s ease-in-out infinite;
}

.btn-speech-mic.speech-listening:hover {
    transform: translateY(-50%) scale(1.05);
}

.speech-input-wrapper textarea.form-control ~ .btn-speech-mic.speech-listening:hover {
    transform: scale(1.05);
}

/* Input glow when actively recording */
.speech-active-input {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(255, 23, 68, 0.15) !important;
}

/* Pulse animation */
@keyframes speech-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 23, 68, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(255, 23, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 23, 68, 0);
    }
}

/* ============================================
   ACTION BUTTONS — Spacing between icons
   ============================================ */
.table td .btn + .btn,
.table td a.btn + a.btn {
    margin-left: 4px;
}

.table td {
    white-space: nowrap;
}

/* Small vertical breathing room for icon buttons in tables */
.table td .btn-sm {
    margin-top: 2px;
    margin-bottom: 2px;
}

/* ============================================
   MAIN CONTENT — Prevent horizontal overflow
   ============================================ */
.main-content {
    overflow-x: hidden;
    max-width: 100vw;
}
.main-content > main .container-fluid {
    max-width: 100%;
    overflow-x: auto;
}

/* ============================================
   TEMA OSCURO — Dark Mode
   ============================================ */
body.tema-oscuro {
    --primary: #63B3ED;
    --primary-light: #1A2332;
    --primary-dark: #3182CE;
    
    --accent-purple: #B794F4;
    --accent-purple-light: #2D2541;
    --accent-pink: #FC8181;
    --accent-teal: #68D391;
    --accent-orange: #F6AD55;
    
    --success: #68D391;
    --success-light: #1C2E25;
    --warning: #F6E05E;
    --warning-light: #2D2A1A;
    --danger: #FC8181;
    --danger-light: #2D1F1F;
    --info: #63B3ED;
    --info-light: #1A2332;
    
    --bg-body: #111318;
    --bg-sidebar: #1A1D23;
    --bg-card: #1E2128;
    --bg-card-hover: #252830;
    --border-color: #2D3748;
    --text-primary: #E2E8F0;
    --text-secondary: #A0AEC0;
    --text-muted: #718096;
    --text-white: #FFFFFF;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 40px -4px rgba(0, 0, 0, 0.5);
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.2);
    --shadow-card-hover: 0 8px 30px rgba(0, 0, 0, 0.3);
}

/* Dark mode overrides for Bootstrap components */
body.tema-oscuro .form-control,
body.tema-oscuro .form-select {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}
body.tema-oscuro .form-control:focus,
body.tema-oscuro .form-select:focus {
    background-color: #252830;
    color: var(--text-primary);
}
body.tema-oscuro .form-control::placeholder {
    color: var(--text-muted);
}
body.tema-oscuro .form-control:disabled {
    background-color: #15171C;
    color: var(--text-muted);
}
body.tema-oscuro .input-group-text {
    background-color: #15171C;
    color: var(--text-muted);
    border-color: var(--border-color);
}
/* Tables: header, rows, stripes */
body.tema-oscuro .table-dark,
body.tema-oscuro .table thead th {
    background: #15171C !important;
    color: var(--text-secondary);
    border-color: var(--border-color);
}
body.tema-oscuro .table {
    --bs-table-bg: var(--bg-card);
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--border-color);
    --bs-table-striped-bg: #252830;
    --bs-table-striped-color: var(--text-primary);
    --bs-table-hover-bg: var(--primary-light);
    --bs-table-hover-color: var(--text-primary);
    color: var(--text-primary);
}
body.tema-oscuro .table > tbody > tr > td {
    color: var(--text-primary);
    border-color: var(--border-color);
}
body.tema-oscuro .table > tbody > tr {
    background-color: var(--bg-card);
}
body.tema-oscuro .table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-bg-type: #252830;
    color: var(--text-primary);
}
body.tema-oscuro .table-danger > td,
body.tema-oscuro .table-danger {
    --bs-table-bg: #2D1F1F !important;
    --bs-table-color: var(--text-primary) !important;
    background-color: #2D1F1F !important;
    color: #FC8181 !important;
}
/* Cards, headers, modals */
body.tema-oscuro .card {
    background: var(--bg-card);
    border-color: var(--border-color);
}
body.tema-oscuro .card-header {
    background: #15171C;
    border-color: var(--border-color);
    color: var(--text-primary);
}
body.tema-oscuro .card-body {
    color: var(--text-primary);
}
body.tema-oscuro h1, body.tema-oscuro h2, body.tema-oscuro h3,
body.tema-oscuro h4, body.tema-oscuro h5, body.tema-oscuro h6 {
    color: var(--text-primary);
}
body.tema-oscuro p, body.tema-oscuro label, body.tema-oscuro span {
    color: var(--text-secondary);
}
body.tema-oscuro .text-success { color: #68D391 !important; }
body.tema-oscuro .text-danger { color: #FC8181 !important; }
body.tema-oscuro .text-muted { color: var(--text-muted) !important; }
/* Dropdowns, list-groups */
body.tema-oscuro .dropdown-menu {
    background: var(--bg-card);
    border-color: var(--border-color);
}
body.tema-oscuro .dropdown-item {
    color: var(--text-secondary);
}
body.tema-oscuro .dropdown-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}
body.tema-oscuro .list-group-item {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}
body.tema-oscuro .list-group-item-action:hover {
    background: var(--primary-light);
}
/* Modals */
body.tema-oscuro .modal-content {
    background: var(--bg-card);
    border-color: var(--border-color);
}
body.tema-oscuro .modal-header {
    background: #15171C;
    border-color: var(--border-color);
    color: var(--text-primary);
}
body.tema-oscuro .modal-footer {
    background: #15171C;
    border-color: var(--border-color);
}
body.tema-oscuro .btn-close {
    filter: invert(1);
}
/* Sidebar */
body.tema-oscuro .sidebar-nav-item.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 4px 12px rgba(99, 179, 237, 0.3);
}
/* Alerts */
body.tema-oscuro .alert-success { background: #1C2E25; color: #68D391; border-color: #2D4A37; }
body.tema-oscuro .alert-danger { background: #2D1F1F; color: #FC8181; border-color: #4A2D2D; }
body.tema-oscuro .alert-warning { background: #2D2A1A; color: #F6E05E; border-color: #4A4420; }
body.tema-oscuro .alert-info { background: #1A2332; color: #63B3ED; border-color: #2D3F55; }
/* Badges keep Bootstrap bg but ensure text */
body.tema-oscuro .badge.bg-success { background: #2E7D32 !important; color: #fff !important; }
body.tema-oscuro .badge.bg-danger { background: #C62828 !important; color: #fff !important; }
body.tema-oscuro .badge.bg-warning { background: #F57F17 !important; color: #fff !important; }
body.tema-oscuro .badge.bg-info { background: #0277BD !important; color: #fff !important; }
body.tema-oscuro .badge.bg-primary { background: #1565C0 !important; color: #fff !important; }
/* POS-specific: card titles visible */
body.tema-oscuro .card-header h2,
body.tema-oscuro .card-header h4,
body.tema-oscuro .card-header h5 {
    color: var(--text-primary) !important;
}
/* Footer */
body.tema-oscuro footer {
    background: #15171C;
    color: var(--text-muted);
    border-top-color: var(--border-color);
}
/* Btn outline variants */
body.tema-oscuro .btn-outline-primary { color: var(--primary); border-color: var(--primary); }
body.tema-oscuro .btn-outline-secondary { color: var(--text-secondary); border-color: var(--border-color); }
body.tema-oscuro .btn-secondary {
    background: #2D3748;
    border-color: #2D3748;
    color: var(--text-primary);
}

/* ============================================
   TEMA TACNA — Colores representativos de Tacna, Perú
   Inspirado en: Arco Parabólico, desierto, cobre, 
   vid tacneña, olivos, tierra
   Paleta: Terracota + Dorado + Oliva + Arena
   ============================================ */
body.tema-tacna {
    --primary: #C2185B;
    --primary-light: #FCE4EC;
    --primary-dark: #AD1457;
    
    --accent-purple: #6D4C41;
    --accent-purple-light: #EFEBE9;
    --accent-pink: #D84315;
    --accent-teal: #558B2F;
    --accent-orange: #D4A017;
    
    --success: #558B2F;
    --success-light: #F1F8E9;
    --warning: #D4A017;
    --warning-light: #FFF8E1;
    --danger: #C62828;
    --danger-light: #FFEBEE;
    --info: #00838F;
    --info-light: #E0F7FA;
    
    --bg-body: #FBF7F3;
    --bg-sidebar: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-card-hover: #FFF8F2;
    --border-color: #E0D5CB;
    --text-primary: #3E2723;
    --text-secondary: #5D4037;
    --text-muted: #A1887F;
    --text-white: #FFFFFF;
    
    --shadow-card: 0 2px 12px rgba(93, 64, 55, 0.06);
    --shadow-card-hover: 0 8px 30px rgba(93, 64, 55, 0.12);
}

/* Sidebar */
body.tema-tacna .sidebar-brand-icon {
    background: linear-gradient(135deg, var(--primary), #D4A017);
}
body.tema-tacna .sidebar-nav-item.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 4px 12px rgba(184, 92, 56, 0.3);
}
body.tema-tacna .sidebar-nav-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}
body.tema-tacna .sidebar-user-avatar {
    background: linear-gradient(135deg, var(--primary), #D4A017);
}
/* Buttons */
body.tema-tacna .btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(184, 92, 56, 0.25);
    color: #fff;
}
body.tema-tacna .btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #6D2914);
    box-shadow: 0 4px 14px rgba(184, 92, 56, 0.35);
}
body.tema-tacna .btn-success {
    background: #558B2F; border-color: #558B2F; color: #fff;
}
body.tema-tacna .btn-success:hover {
    background: #33691E; border-color: #33691E;
}
body.tema-tacna .btn-danger {
    background: #C62828; border-color: #C62828; color: #fff;
}
body.tema-tacna .btn-danger:hover {
    background: #B71C1C; border-color: #B71C1C;
}
body.tema-tacna .btn-warning {
    background: #D4A017; border-color: #D4A017; color: #fff;
}
body.tema-tacna .btn-warning:hover {
    background: #B8860B; border-color: #B8860B; color: #fff;
}
body.tema-tacna .btn-info {
    background: #00838F; border-color: #00838F; color: #fff;
}
body.tema-tacna .btn-info:hover {
    background: #006064; border-color: #006064; color: #fff;
}
/* Stat cards */
body.tema-tacna .stat-card.stat-info::before { background: var(--primary); }
body.tema-tacna .stat-card.stat-info .stat-card-icon {
    background: var(--primary-light);
    color: var(--primary);
}
/* Links */
body.tema-tacna a { color: var(--primary); }
body.tema-tacna a:hover { color: var(--primary-dark); }
/* Login */
body.tema-tacna .login-page {
    background: linear-gradient(135deg, #FBF7F3 0%, #FFF0E8 50%, #EFEBE9 100%);
}
body.tema-tacna .login-logo {
    background: linear-gradient(135deg, var(--primary), #D4A017);
}
/* Pagination */
body.tema-tacna .page-item.active .page-link {
    background: var(--primary); border-color: var(--primary);
}
body.tema-tacna .page-link:hover {
    background: var(--primary-light); color: var(--primary); border-color: var(--primary);
}
/* SweetAlert */
body.tema-tacna .swal2-confirm {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
}