:root {
    --primary: #92a28e;
    --primary-hover: #92a28e;
    --secondary: #64748b;
    --accent: #f59e0b;
    --warning: #fef9c3;
    --success: #10b96f;
    --danger: #b62727;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --sidebar-bg: #001e2b;
    --sidebar-text: #f1f5f9;
    --sidebar-active: rgba(255,255,255,0.15);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 0.5rem;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    --gap: 1rem;
}

* {
    margin: 0;.dashboard-grid
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    transition: var(--transition);
    z-index: 100;
    flex-shrink: 0;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Header */
.top-nav {
    height: 64px;
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.page-container {
    padding: 2rem;
    max-width: 1350px;
    width: 100%;
    margin: 0 auto;
}

/* Typography */
h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-main);
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Sidebar Nav */
.sidebar-header {
    padding: 2rem;
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
}

.sidebar-nav {
    flex: 1;
    padding: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius);
    margin-bottom: 0.25rem;
    transition: var(--transition);
    gap: 0.75rem;
    font-size: 0.9375rem;
    opacity: 0.8;
}

.nav-item:hover {
    background-color: var(--sidebar-active);
    opacity: 1;
}

.nav-item.active {
    background-color: var(--primary);
    color: white;
    opacity: 1;
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Auth Pages */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top left, #f1f5f9, #e2e8f0);
    padding: 2rem;
}

.auth-card {
    background: var(--surface);
    padding: 2.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: #fff;
    transition: var(--transition);
    font-size: 0.9375rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .5rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    font-size: 0.9375rem;
    gap: 0.5rem;
    text-decoration: none;
    color: inherit;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-block {
    width: 100%;
}

.btn-link {
    background: none;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.875rem;
}

.btn-link:hover {
    text-decoration: underline;
}

/* Cards & Dashboard */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--gap);
    margin-bottom: var(--gap);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap);
}

@media (max-width: 768px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

.grid-span-2 {
    grid-column: span 2;
}

@media (max-width: 768px) {
    .grid-span-2 {
        grid-column: span 1;
    }
}

/* Table */
.table-container {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background-color: #f8fafc;
    padding: 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-main);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #f8fafc;
}

.tag {
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.tag-success {
    background-color: #e3fcdc;
    color: #38a43d;
}

.tag-warning {
    background-color: #fef9c3;
    color: #854d0e;
}

.tag-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Micro-animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Tooltip styling */
[data-tooltip] {
    position: relative;
    cursor: pointer;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    top: 125%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background-color: var(--sidebar-bg);
    color: white;
    font-size: 0.75rem;
    border-radius: var(--radius);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    top: 110%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: var(--sidebar-bg);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 1000;
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

.credit-badge-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--background);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-weight: 500;
    color: var(--text-main);
}

.credit-value {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.1rem;
}

/* Mobile Responsiveness */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        left: -260px;
        transition: var(--transition);
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    }

    .sidebar.active {
        left: 0;
    }

    .top-nav {
        padding: 0 1rem;
    }

    .nav-left h2 {
        font-size: 1.15rem;
    }

    .page-container {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        text-align: center;
    }

    .mobile-toggle {
        display: flex !important;
    }

    .nav-right .user-info {
        display: none;
    }

    .credit-badge-container {
        padding: 0.4rem 0.6rem;
    }

    .credit-badge-container span {
        display: none;
    }

    .header-actions .btn span,
    .header-actions .btn {
        padding: 0.5rem;
    }

    .header-actions .btn {
        font-size: 0;
        /* Hide text */
    }

    .header-actions .btn i {
        font-size: 1.25rem;
        margin: 0 !important;
    }
}

.mobile-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    margin-right: 0.5rem;
}

/* Sidebar overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 95;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
}

.desktop-only {
    display: block;
}

.filter-toggle-btn {
    display: none;
}

@media (max-width: 992px) {

    :root {
        --gap: 1rem;
    }

    .filters-sidebar {
        position: fixed;
        right: -320px;
        top: 0;
        bottom: 0;
        width: 300px;
        background-color: var(--surface);
        z-index: 101;
        transition: var(--transition);
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.15);
        padding: 2rem 1.5rem;
        overflow-y: auto;
        display: block !important;
    }

    .filters-sidebar.active {
        right: 0;
    }

    .filters-sidebar .card {
        box-shadow: none;
        border: none;
        padding: 0;
        margin-bottom: 0 !important;
    }
    
    .filters-sidebar form {
        display: flex !important;
        flex-direction: column;
        gap: var(--gap) !important;
    }
    
    .filters-sidebar form .form-group {
        margin-bottom: 0 !important;
    }

    .filter-toggle-btn {
        display: inline-flex;
        margin-bottom: 1rem;
    }

    .filter-close-btn {
        display: block !important;
        position: absolute;
        top: 1rem;
        right: 1.5rem;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--text-muted);
        cursor: pointer;
    }
    
    .desktop-only {
        display: none !important;
    }
}

.dashboard-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); margin-bottom: var(--gap);
}

/* Tooltip mobile adjustment */
@media (max-width: 768px) {
    [data-tooltip]::before {
        display: none;
    }

    header .nav-right{
        display: none !important;
    }

    header .nav-left {
        width: 100%;
        justify-content: space-between;
    }

    .dashboard-grid { 
        grid-template-columns: 1fr;
    }

    td {
        padding: 0.5rem;
        font-size: 0.75rem;
    }

    .text-muted {
        font-size: 0.75rem;
    }

    .card {
        padding: 1rem;
    }

    .tag {
        font-size: 0.6rem;
    }

}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding-bottom: 2rem;
    flex-wrap: wrap;
}

.pagination-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 40px;
    padding: 0 1rem;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.pagination-item:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.pagination-item.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.pagination-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}