/* =====================================================
   Sistema POS - Gestión Negocios
   Estilos Premium
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables ── */
:root {
    /* Primary Palette */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.15);

    /* Accent */
    --accent: #06b6d4;
    --accent-light: #22d3ee;

    /* Success / Warning / Danger */
    --success: #00774f;
    --success-light: #099e68;
    --warning: #f59e0b;
    --warning-light: #fbbf24;
    --danger: #ef4444;
    --danger-light: #f87171;

    /* Dark Theme */
    --bg-body: #0f1117;
    --bg-sidebar: #13151d;
    --bg-card: #1a1d2b;
    --bg-card-hover: #1f2336;
    --bg-input: #1e2130;
    --bg-dropdown: #1a1d2b;

    /* Borders */
    --border-color: rgba(255, 255, 255, 0.06);
    --border-active: rgba(99, 102, 241, 0.4);

    /* Text */
    --text-primary: #e8eaf0;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --text-white: #ffffff;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);

    /* Layout */
    --sidebar-width: 270px;
    --sidebar-collapsed: 70px;
    --header-height: 64px;
    --border-radius: 10px;
    --border-radius-sm: 6px;
    --border-radius-lg: 16px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition: 0.25s ease;
    --transition-slow: 0.4s ease;
}

/* ── Temas de Color ── */

/* Tema Claro (Light) */
body.theme-light {
    --bg-body: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-card: #f1f5f9;
    --bg-card-hover: #e2e8f0;
    --bg-input: #f8fafc;
    --bg-sidebar-hover: rgba(0, 0, 0, 0.04);
    --bg-submenu: rgba(0, 0, 0, 0.03);
    --border-color: #cbd5e1;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-white: #0f172a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Tema Sepia */
body.theme-sepia {
    --bg-body: #c3ba9d;
    --bg-sidebar: #afa58d;
    --bg-card: #bdb396;
    --bg-card-hover: #b1a98c;
    --bg-input: #dcd4bc;
    --bg-sidebar-hover: rgba(0, 0, 0, 0.08);
    --bg-submenu: rgba(0, 0, 0, 0.06);
    --border-color: #a3997d;
    --text-primary: #3c3225;
    --text-secondary: #4d4436;
    --text-muted: #6e6456;
    --text-white: #2b2216;
    --primary: #6d482d;
    --primary-light: #8b5e3c;
}

/* Tema Verde Claro */
body.theme-verde-claro {
    --primary: #059669;
    --primary-light: #10b981;
    --bg-body: #f0fdf4;
    --bg-sidebar: #ecfdf5;
    --bg-card: #dcfce7;
    --bg-card-hover: #bbf7d0;
    --bg-input: #f0fdf4;
    --bg-sidebar-hover: rgba(5, 150, 105, 0.08);
    --bg-submenu: rgba(5, 150, 105, 0.05);
    --border-color: #86efac;
    --text-primary: #064e3b;
    --text-secondary: #065f46;
    --text-muted: #10b981;
    --text-white: #064e3b;
}

/* Tema Azul Claro */
body.theme-azul-claro {
    --primary: #0369a1;
    --primary-light: #629bb6;
    --bg-body: #a8d5f3;
    --bg-sidebar: #9cceef;
    --bg-card: #9cccecc9;
    --bg-card-hover: #82b6df;
    --bg-input: #b9dff8;
    --bg-sidebar-hover: rgba(2, 132, 199, 0.1);
    --bg-submenu: rgba(2, 132, 199, 0.08);
    --border-color: #5ba3c4;
    --text-primary: #011522;
    --text-secondary: #053049;
    --text-muted: #032c42;
    --text-white: #031522;
}

/* Tema Oscuro */
body.theme-dark {
    --bg-body: #0f1117;
    --bg-sidebar: #13151d;
    --bg-card: #1a1d2b;
    --bg-card-hover: #1f2336;
    --bg-input: #1e2130;
    --bg-sidebar-hover: rgba(255, 255, 255, 0.04);
    --bg-submenu: rgba(0, 0, 0, 0.15);
    --border-color: rgba(255, 255, 255, 0.06);
    --text-primary: #e8eaf0;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --text-white: #ffffff;
}

/* ── Reset & Base ── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-light);
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ── LOGIN PAGE ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 50%, rgba(6, 182, 212, 0.06) 0%, transparent 50%);
    animation: loginBgMove 20s ease-in-out infinite alternate;
}

@keyframes loginBgMove {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(-5%, -5%);
    }
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 48px 40px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: loginSlideIn 0.6s ease;
}

@keyframes loginSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo .logo-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 16px;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.login-logo h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: -0.5px;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 4px;
}

/* ── LAYOUT ── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width var(--transition);
    overflow: hidden;
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: var(--header-height);
}

.sidebar-header .logo-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.25);
}

.sidebar-header .logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-white);
    white-space: nowrap;
    letter-spacing: -0.3px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.sidebar-section {
    margin-bottom: 4px;
}

.sidebar-section-title {
    padding: 12px 24px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 400;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-link:hover {
    color: var(--text-white);
    background: var(--bg-sidebar-hover);
}

.nav-link.active {
    color: var(--primary-light);
    background: var(--primary-glow);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-link .nav-icon {
    width: 22px;
    min-width: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.nav-link .nav-text {
    flex: 1;
    white-space: nowrap;
}

.nav-link .nav-arrow {
    font-size: 0.7rem;
    transition: transform var(--transition-fast);
    color: var(--text-muted);
}

.nav-item.open>.nav-link .nav-arrow {
    transform: rotate(90deg);
}

/* Submenú */
.nav-submenu {
    display: none;
    padding-left: 0;
    list-style: none;
    background: var(--bg-submenu);
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.nav-item.open>.nav-submenu {
    display: block;
}

.nav-submenu .nav-link {
    padding: 8px 24px 8px 58px;
    font-size: 0.83rem;
    font-weight: 400;
}

.nav-submenu .nav-link::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-muted);
    position: absolute;
    left: 42px;
    top: 50%;
    transform: translateY(-50%);
    transition: background var(--transition-fast);
}

.nav-submenu .nav-link:hover::before,
.nav-submenu .nav-link.active::before {
    background: var(--primary-light);
    left: 42px;
    width: 5px;
    top: 50%;
    bottom: auto;
}

.nav-submenu .sub-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.04);
    margin: 4px 24px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
}

.user-details {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.btn-logout {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all var(--transition-fast);
    font-size: 1rem;
}

.btn-logout:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* ── HEADER ── */
.main-header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 500;
    backdrop-filter: blur(10px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-white);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.breadcrumb a {
    color: var(--text-secondary);
}

.breadcrumb a:hover {
    color: var(--primary-light);
}

.breadcrumb .separator {
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-date {
    font-size: 0.82rem;
    color: var(--text-secondary);
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--border-radius-sm);
}

/* ── MAIN CONTENT ── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition);
}

.content-area {
    padding: 28px;
}

/* ── CARDS ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-white);
}

.card-body {
    padding: 16px 18px;
}

.card-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* ── STAT CARDS ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity var(--transition);
}

.stat-card:hover {
    border-color: var(--border-active);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.stat-card:hover::after {
    opacity: 1;
}

.stat-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-icon.blue {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-light);
}

.stat-icon.cyan {
    background: rgba(6, 182, 212, 0.12);
    color: var(--accent-light);
}

.stat-icon.green {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success-light);
}

.stat-icon.orange {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning-light);
}

.stat-icon.red {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger-light);
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-white);
    line-height: 1.2;
}

.stat-change {
    font-size: 0.75rem;
    margin-top: 4px;
}

.stat-change.up {
    color: var(--success);
}

.stat-change.down {
    color: var(--danger);
}

/* ── FORMS ── */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    transition: all var(--transition-fast);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 5.5l6.5 6.5 6.5-6.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-check label {
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: #1a1d2b;
}

.btn-warning:hover {
    background: #d97706;
    transform: translateY(-1px);
    color: #1a1d2b;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
    color: white;
}

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary-light);
    background: var(--primary-glow);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 0.95rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
}

/* ── TABLES ── */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius);
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: rgba(255, 255, 255, 0.03);
}

table th {
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

table td {
    padding: 12px 16px;
    font-size: 0.85rem;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background var(--transition-fast);
}

table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

table .text-right {
    text-align: right;
}

table .text-center {
    text-align: center;
}

/* ── BADGES ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 20px;
    letter-spacing: 0.3px;
    border: 1px solid var(--border-color);
}

.badge-success {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success-light);
    text-shadow: white 0px 0px 1px;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning-light);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger-light);
}

.badge-info {
    background: rgba(6, 182, 212, 0.12);
    color: var(--accent-light);
}

.badge-primary {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-light);
}

/* ── ALERTS ── */
.alert {
    padding: 14px 18px;
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: alertSlide 0.3s ease;
}

@keyframes alertSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--success-light);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger-light);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: var(--warning-light);
}

.alert-info {
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.2);
    color: var(--accent-light);
}

/* ── PAGINATION ── */
.pagination-nav {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.pagination {
    display: flex;
    list-style: none;
    gap: 4px;
}

.pagination li a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-sm);
    font-size: 0.82rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.pagination li a:hover {
    border-color: var(--primary);
    color: var(--primary-light);
}

.pagination li.active a {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ── MODAL ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-white);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.06);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ── SEARCH BAR ── */
.search-bar {
    position: relative;
    max-width: 360px;
}

.search-bar input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: all var(--transition-fast);
}

.search-bar input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-bar .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ── TOOLBAR ── */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── EMPTY STATE ── */
.empty-state {
    text-align: center;
    padding: 60px 24px;
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ── DASHBOARD GRID ── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

/* ── UTILITIES ── */
.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.text-primary {
    color: var(--primary-light);
}

.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;
}

.mb-3 {
    margin-bottom: 24px;
}

.d-flex {
    display: flex;
}

.align-center {
    align-items: center;
}

.gap-1 {
    gap: 8px;
}

.gap-2 {
    gap: 16px;
}

.flex-1 {
    flex: 1;
}

/* ── RESPONSIVE ── */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px;
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 640px) {
    .content-area {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-bar {
        max-width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* ── LOADING ── */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Permissions Grid ── */
.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}

.perm-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--border-radius-sm);
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.perm-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-color);
}

/* ── Tab Navigation ── */
.tab-nav {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.tab-link {
    padding: 10px 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab-link:hover {
    color: var(--text-white);
}

.tab-link.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary);
}

/* ── REMOVE NUMBER INPUT SPINNERS ── */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
    appearance: none;
}