:root {
    --bg-dark: #0f1014;
    /* Deep dark background */
    --bg-card: #18191f;
    /* Slightly lighter for cards */
    --primary: #6366f1;
    /* Indigo/Purple accent */
    --primary-hover: #4f46e5;
    --text-main: #ffffff;
    --text-muted: #9ca3af;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --border: #2d2d35;
    --glass: rgba(255, 255, 255, 0.03);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Utilities */
.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.glass-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
    border-radius: 16px;
}

.content-panel {
    padding: 2rem;
}

/* Auth Layout */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: radial-gradient(circle at top right, #2e1065 0%, transparent 40%),
        radial-gradient(circle at bottom left, #0f172a 0%, transparent 40%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #000;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: white;
    outline: none;
    transition: all 0.3s;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

/* Dashboard Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo span {
    color: var(--primary);
}

.nav-menu {
    flex: 1;
}

.nav-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
    letter-spacing: 0.05em;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--text-muted);
    transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background: var(--glass);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.nav-link svg {
    width: 20px;
    height: 20px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
    background: radial-gradient(circle at top left, rgba(99, 102, 241, 0.05) 0%, transparent 50%);
}

.header-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.header-subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 1.75rem;
    font-weight: 700;
}

.stat-card .icon-bg {
    position: absolute;
    right: -10px;
    bottom: -10px;
    font-size: 5rem;
    opacity: 0.05;
    color: white;
}

/* Charts & Tables */
/* Custom Dashboard Layout */
.dashboard-grid-top {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    /* Large Saldo, Stack, Chart */
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-grid-bottom {
    display: grid;
    grid-template-columns: 2.5fr 1fr;
    /* Trend Chart, Transaction List */
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 1024px) {
    .dashboard-grid-top {
        grid-template-columns: 1fr 1fr;
    }

    .saldo-card-container {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {

    .dashboard-grid-top,
    .dashboard-grid-bottom {
        grid-template-columns: 1fr;
    }

    .saldo-card-container {
        grid-column: span 1;
    }
}

.charts-grid {
    /* Legacy support or generic usage */
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-container {
    padding: 1.5rem;
    height: 400px;
    display: flex;
    flex-direction: column;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: var(--glass);
}

.action-btn {
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    margin-right: 0.5rem;
    cursor: pointer;
    border: none;
}

.btn-edit {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

.btn-delete {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Responsive */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    /* Responsive Table Card View */
    .table-container table,
    .table-container thead,
    .table-container tbody,
    .table-container th,
    .table-container td,
    .table-container tr {
        display: block !important;
        width: 100% !important;
    }

    .table-container thead tr {
        position: absolute !important;
        top: -9999px;
        left: -9999px;
    }

    .table-container tr {
        background: var(--glass);
        border: 1px solid var(--border);
        border-radius: 12px;
        margin-bottom: 1rem;
        padding: 1.25rem;
    }

    .table-container td {
        border: none;
        position: relative;
        padding: 0.5rem 0;
        padding-left: 0;
        text-align: left;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .table-container td:before {
        content: attr(data-label);
        font-size: 0.75rem;
        color: var(--text-muted);
        text-transform: uppercase;
        font-weight: 600;
        margin-bottom: 0.25rem;
    }

    .table-container td:last-child {
        flex-direction: row;
        justify-content: flex-start;
        gap: 0.5rem;
        padding-top: 1rem;
        margin-top: 0.5rem;
        border-top: 1px solid var(--border);
    }

    .table-container td:last-child:before {
        display: none;
    }

    /* Adjust header for mobile */
    .header-title {
        font-size: 1.2rem;
    }

    .content-panel {
        padding: 1rem !important;
    }

    /* Fix header layout */
    .dashboard-grid-top,
    .dashboard-grid-bottom {
        padding: 0;
        margin-left: 0;
        margin-right: 0;
    }
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0;
    margin-right: 1rem;
}