:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --income-color: #10b981;
    --expense-color: #ef4444;
    --danger-hover: #dc2626;
    --input-bg: rgba(15, 23, 42, 0.6);
    --input-border: rgba(56, 189, 248, 0.2);
    --input-focus: rgba(56, 189, 248, 0.5);
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --glow: 0 0 20px rgba(59, 130, 246, 0.15);
}

[data-theme="light"] {
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --income-color: #10b981;
    --expense-color: #ef4444;
    --danger-hover: #dc2626;
    --input-bg: #f8fafc;
    --input-border: #cbd5e1;
    --input-focus: #3b82f6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --glow: none;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.05) 0%, transparent 25%);
    background-attachment: fixed;
}

.layout-wrapper {
    display: flex;
    width: 100%;
    max-width: 1200px;
    min-height: 90vh;
    margin: 2rem;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 20px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: rgba(30, 41, 59, 0.8);
    border-right: 1px solid var(--card-border);
    padding: 2rem 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--accent);
    padding: 0 2rem;
    margin-bottom: 2rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-item i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.sidebar-footer {
    padding: 0 1rem;
    margin-top: auto;
}

.btn-logout {
    width: 100%;
    background: transparent;
    border: none;
    text-align: left;
    font-family: inherit;
    font-size: 1rem;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--expense-color);
}

/* Main Content Area */
.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    overflow-y: auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.header-title-group {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.header-title-group h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0;
    color: var(--text-primary);
}

.date-display {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

/* Cards (Glassmorphism) */
.summary-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.balance-card {
    text-align: center;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.9) 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.balance-card h3 {
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.balance-card h2 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -1px;
}

.card-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.income-card, .expense-card {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.income-card .card-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--income-color);
}

.expense-card .card-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--expense-color);
}

.card-info h4 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.card-info p {
    font-size: 1.25rem;
    font-weight: 600;
}

.income-card p {
    color: var(--income-color);
}

.expense-card p {
    color: var(--expense-color);
}

/* Views System */
.views-container {
    flex: 1;
    position: relative;
}

.view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view.active-view {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dashboard Specific Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
    margin-top: 2rem;
}

/* Typography & Headings */
h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

/* Form Styles */
.transaction-form-section {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    height: fit-content;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input, select {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

/* Custom Select Component */
.custom-select-container {
    position: relative;
    user-select: none;
    width: 100%;
}

.custom-select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-select-trigger:hover, .custom-select-container.open .custom-select-trigger {
    border-color: var(--input-focus);
}

.custom-select-container.open .custom-select-trigger {
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.custom-select-trigger i {
    color: var(--text-secondary);
    transition: transform 0.3s ease;
    font-size: 0.85rem;
}

.custom-select-container.open .custom-select-trigger i {
    transform: rotate(180deg);
}

.custom-options {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    max-height: 250px;
    overflow-y: auto;
}

.custom-options::-webkit-scrollbar {
    width: 6px;
}
.custom-options::-webkit-scrollbar-track {
    background: transparent;
}
.custom-options::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 10px;
}

.custom-select-container.open .custom-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-option {
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.9rem;
}

.custom-option:last-child {
    border-bottom: none;
}

.custom-option:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
}

.custom-option.selected {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
    font-weight: 600;
}

input::placeholder {
    color: rgba(148, 163, 184, 0.4);
}

/* Remove arrows from number input */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}

.btn-submit {
    width: 100%;
    padding: 0.875rem;
    border: none;
    border-radius: 8px;
    background-color: var(--accent);
    color: white;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn-submit:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-submit:active {
    transform: translateY(1px);
}

/* Transaction History */
.transaction-history-section {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.history-header h2 {
    margin-bottom: 0;
}

/* Debt history header: row on desktop */
.debt-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 1rem;
}
.debt-history-header .btn-add-debt-full {
    width: auto !important;
    margin-top: 0 !important;
    padding: 0.6rem 1.2rem !important;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-clear {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-clear:hover {
    color: var(--expense-color);
    background: rgba(239, 68, 68, 0.1);
}

/* Date Filter in History Header */
.date-filter-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.date-filter-input {
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: var(--input-bg);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.date-filter-input:focus {
    border-color: var(--accent);
}

.btn-clear-filter {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.btn-clear-filter:hover {
    color: var(--expense-color);
    background: rgba(239, 68, 68, 0.1);
}

.transaction-list {
    list-style-type: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-right: 0;
}

/* Custom Scrollbar */
.transaction-list::-webkit-scrollbar {
    width: 6px;
}

.transaction-list::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 10px;
}

.transaction-list::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 10px;
}

.transaction-list::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

.transaction-item:hover {
    background: rgba(15, 23, 42, 0.7);
    border-color: rgba(255, 255, 255, 0.15);
}

.transaction-item.income {
    border-left: 4px solid var(--income-color);
}

.transaction-item.expense {
    border-left: 4px solid var(--expense-color);
}

.item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.item-desc {
    font-weight: 500;
    font-size: 0.95rem;
}

.item-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.item-category {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.item-amount {
    font-weight: 600;
    font-size: 1rem;
}

.transaction-item.income .item-amount {
    color: var(--income-color);
}

.transaction-item.expense .item-amount {
    color: var(--expense-color);
}

.delete-btn {
    position: absolute;
    right: -40px;
    top: 0;
    height: 100%;
    width: 40px;
    background: var(--expense-color);
    color: white;
    border: none;
    cursor: pointer;
    transition: right 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.transaction-item:hover .delete-btn {
    right: 0;
}

.delete-btn:hover {
    background: var(--danger-hover);
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.empty-state i {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Debt/Piutang Styles */
.debt-item {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

[data-theme="light"] .debt-item {
    background: #ffffff;
}

.debt-item:hover {
    background: rgba(15, 23, 42, 0.7);
    border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="light"] .debt-item:hover {
    background: #f8fafc;
    border-color: var(--card-border);
}

.debt-item.hutang {
    border-left: 4px solid var(--expense-color);
}

.debt-item.piutang {
    border-left: 4px solid var(--income-color);
}

.debt-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.debt-desc {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.debt-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.debt-amount {
    font-weight: 700;
    font-size: 1.1rem;
}

.debt-progress-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.debt-progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.debt-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

[data-theme="light"] .debt-progress-bar {
    background: #e2e8f0;
}

.debt-progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s ease;
}

.debt-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn-debt-action {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
    border: 1px solid rgba(59, 130, 246, 0.2);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-debt-action:hover {
    background: var(--accent);
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .app-container {
        padding: 1rem;
    }
    
    .balance-card h2 {
        font-size: 2rem;
    }
    
    .delete-btn {
        right: 0;
        width: 30px;
        background: transparent;
        color: var(--expense-color);
    }
    
    .transaction-item {
        padding-right: 2.5rem;
    }
}

/* Placeholder Views Styling */
.placeholder-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    height: 100%;
    color: var(--text-secondary);
}

.placeholder-section i {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    color: var(--accent);
    opacity: 0.5;
}

.placeholder-section h2 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.dummy-settings {
    margin-top: 2rem;
    width: 100%;
    max-width: 400px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    overflow: hidden;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--card-border);
    color: var(--text-primary);
}

.setting-item:last-child {
    border-bottom: none;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    background: var(--card-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    border: 2px solid var(--accent);
}

.profile-avatar i {
    margin: 0;
    font-size: 2.5rem;
    color: var(--text-primary);
    opacity: 1;
}

.full-height {
    /* Lists grow naturally now - no min-height needed */
}

/* Login Screen Styles */
.login-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.1) 0%, transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.08) 0%, transparent 25%);
    z-index: 1000;
}

.login-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 3rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.login-header {
    text-align: center;
    color: var(--accent);
}

.login-header i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.login-header h2 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.error-msg {
    color: var(--expense-color);
    background: rgba(239, 68, 68, 0.1);
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    text-align: center;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Admin Panel Styles */
.admin-add-user {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.5rem;
}

.admin-add-user h3, .history-header h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--card-border);
    border-radius: 12px;
}

.user-item .role-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent);
}

.user-item .role-badge.admin {
    background: rgba(16, 185, 129, 0.2);
    color: var(--income-color);
}

/* Report Styles */
.report-tabs {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    background: rgba(15, 23, 42, 0.4);
    padding: 0.5rem;
    border-radius: 12px;
    border: 1px solid var(--card-border);
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.report-summary {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.report-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.25rem 1.5rem;
    border-radius: 14px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    backdrop-filter: blur(10px);
}

.report-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.report-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.report-value.income { color: var(--income-color); }
.report-value.expense { color: var(--expense-color); }

.report-income-card { border-top: 3px solid var(--income-color); }
.report-expense-card { border-top: 3px solid var(--expense-color); }
.report-balance-card { border-top: 3px solid var(--accent); }

/* Date input styling */
input[type="date"] {
    color-scheme: dark;
}
/* User Dropdown */
.user-dropdown-container {
    position: relative;
    padding: 0;
    margin: 0;
}

.user-dropdown-container .user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.user-dropdown-container .user-info:hover {
    background: transparent;
    border-color: transparent;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.user-info:hover .user-avatar {
    transform: scale(1.05);
}

.user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    left: auto;
    bottom: auto;
    min-width: 180px;
    transform-origin: top right;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 1000;
}

.user-dropdown-container.show .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-primary);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
    white-space: nowrap;
}

.dropdown-item:hover {
    background: rgba(255,255,255,0.05);
}

.dropdown-item.text-danger {
    color: var(--expense-color);
}

.dropdown-item.text-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}
/* ================================
   TOAST NOTIFICATION SYSTEM
================================ */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem 1.25rem;
    min-width: 280px;
    max-width: 360px;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    pointer-events: all;
    animation: toastSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 4px 0 0 4px;
}

.toast.success::before { background: var(--income-color); }
.toast.error::before   { background: var(--expense-color); }
.toast.warning::before { background: #f59e0b; }
.toast.info::before    { background: var(--accent); }

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast.success .toast-icon { color: var(--income-color); }
.toast.error   .toast-icon { color: var(--expense-color); }
.toast.warning .toast-icon { color: #f59e0b; }
.toast.info    .toast-icon { color: var(--accent); }

.toast-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.toast-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.toast-message {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.25rem;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color 0.2s;
}

.toast-close:hover { color: var(--text-primary); }

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 14px 14px;
    animation: toastProgress 4s linear forwards;
}

.toast.success .toast-progress { background: var(--income-color); }
.toast.error   .toast-progress { background: var(--expense-color); }
.toast.warning .toast-progress { background: #f59e0b; }
.toast.info    .toast-progress { background: var(--accent); }

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(100%) scale(0.9); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastSlideOut {
    from { opacity: 1; transform: translateX(0) scale(1); }
    to   { opacity: 0; transform: translateX(110%) scale(0.9); }
}

@keyframes toastProgress {
    from { width: 100%; }
    to   { width: 0%; }
}

/* ================================
   CUSTOM CONFIRM MODAL
================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

.modal-card {
    background: rgba(30, 41, 59, 0.98);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 2rem;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    animation: modalPopIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.modal-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.modal-icon.danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--expense-color);
}

.modal-icon.question {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
}

.modal-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    width: 100%;
    margin-top: 0.75rem;
}

.modal-btn {
    flex: 1;
    padding: 0.875rem;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn.cancel {
    background: rgba(255,255,255,0.07);
    color: var(--text-secondary);
    border: 1px solid var(--card-border);
}

.modal-btn.cancel:hover {
    background: rgba(255,255,255,0.12);
    color: var(--text-primary);
}

.modal-btn.confirm {
    background: var(--expense-color);
    color: white;
}

.modal-btn.confirm:hover {
    background: var(--danger-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.modal-btn.confirm.safe {
    background: var(--accent);
}

.modal-btn.confirm.safe:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

@keyframes modalPopIn {
    from { opacity: 0; transform: scale(0.85) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ================================
   ANDROID / MOBILE RESPONSIVE
================================ */
@media (max-width: 768px) {
    body { align-items: flex-start; }

    .layout-wrapper {
        flex-direction: column;
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
        border: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    /* Mobile Bottom Navigation */
    .sidebar {
        width: 100%;
        flex-direction: row;
        padding: 0;
        border-right: none;
        border-top: 1px solid var(--card-border);
        background: rgba(15, 23, 42, 0.98);
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        height: 64px;
        justify-content: space-around;
        align-items: center;
    }

    .logo, .sidebar-footer { display: none; }

    .nav-links {
        flex-direction: row;
        padding: 0;
        gap: 0;
        width: 100%;
        justify-content: space-around;
        align-items: center;
        height: 100%;
    }

    .nav-item {
        flex-direction: column;
        padding: 0.5rem 0.25rem;
        gap: 0;
        font-size: 0;
        border-radius: 8px;
        align-items: center;
        justify-content: center;
        min-width: 56px;
    }

    .nav-item i { font-size: 1.5rem; width: auto; }
    .nav-item span { display: none; }

    .nav-item.active {
        background: transparent;
        box-shadow: none;
        color: var(--accent);
    }

    .main-container {
        padding: 1rem;
        padding-bottom: 80px; /* Space for bottom nav */
    }

    .summary-cards { gap: 0.75rem; }
    .balance-card h2 { font-size: 1.75rem; }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .report-summary {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .card-group {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .card { padding: 1rem; }
    
    .income-card, .expense-card {
        gap: 0.5rem;
        flex-direction: column;
        text-align: center;
        align-items: center;
        padding: 1rem 0.5rem;
    }

    .card-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .card-info h4 { font-size: 0.75rem; }
    .card-info p { font-size: 1rem; word-break: break-word; }

    .transaction-form-section, .transaction-history-section {
        border-radius: 12px;
    }

    .delete-btn {
        right: 0;
        width: 36px;
        background: transparent;
        color: var(--expense-color);
        font-size: 1rem;
    }

    .transaction-item {
        padding: 0.75rem;
        padding-right: 2.5rem;
    }

    .item-desc { font-size: 0.85rem; }
    .item-amount { font-size: 0.85rem; }
    .item-meta { font-size: 0.65rem; gap: 0.5rem; }
    
    .item-category { padding: 2px 4px; }

    .toast-container {
        top: auto;
        bottom: 80px;
        right: 1rem;
        left: 1rem;
    }

    .toast {
        min-width: unset;
        max-width: 100%;
    }

    header h2, .header-title-group h2 { font-size: 1.25rem; }
    .date-display { display: block; font-size: 0.75rem; }
    .modal-card { padding: 1.5rem; }

    /* Debt header: stack title then full-width button */
    .debt-history-header, .admin-header, .stack-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }
    .debt-history-header h2, .admin-header h2, .stack-header h2 { font-size: 1rem; margin: 0; }
    .btn-add-debt-full, .admin-header .btn-submit {
        width: 100% !important;
        margin-top: 0 !important;
        padding: 0.65rem 1rem !important;
        font-size: 0.9rem !important;
    }

    /* Removed forced display for #nav-settings to allow role-based visibility */
}

/* User Item Mobile/Android Style */
.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: transparent;
    border-bottom: 1px solid var(--card-border);
    transition: background 0.2s;
}
.user-item:hover {
    background: rgba(255, 255, 255, 0.05);
}
.user-item:last-child {
    border-bottom: none;
}
#user-list {
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
}

/* Installment list in modal keeps scroll */
#list-installments {
    max-height: 150px;
    overflow-y: auto;
}

/* Print Styles for PDF Download A4 - Table Format */
@media print {
    @page {
        size: A4;
        margin: 15mm 20mm;
    }
    body {
        background: white !important;
        color: black !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    /* Hide everything except print area */
    body > * {
        display: none !important;
    }
    #print-report-area {
        display: block !important;
        position: static !important;
        width: 100%;
        max-width: 100%;
    }
    .print-header {
        text-align: center;
        margin-bottom: 1.2rem;
        border-bottom: 2px solid #333;
        padding-bottom: 1rem;
    }
    .print-header h1 {
        font-size: 1.6rem;
        font-weight: 700;
        margin-bottom: 0.3rem;
        color: #111;
    }
    .print-header p {
        margin: 0.15rem 0;
        color: #444;
    }
    .print-saldo {
        margin-bottom: 1rem;
        font-size: 1rem;
        padding: 0.6rem 0;
        border-bottom: 1px solid #ccc;
    }
    .print-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.9rem;
        margin-top: 0.5rem;
        table-layout: fixed;
    }
    .print-table colgroup col:nth-child(1) { width: 8%; }
    .print-table colgroup col:nth-child(2) { width: 32%; }
    .print-table colgroup col:nth-child(3) { width: 20%; }
    .print-table colgroup col:nth-child(4) { width: 20%; }
    .print-table colgroup col:nth-child(5) { width: 20%; }
    .print-table th {
        background: #1e293b;
        color: white;
        padding: 9px 12px;
        text-align: left;
        font-weight: 600;
        border: 1px solid #334;
    }
    .print-table td {
        padding: 8px 12px;
        border: 1px solid #e2e8f0;
        vertical-align: top;
        word-break: break-word;
    }
    .print-table tr:nth-child(even) td {
        background: #f8fafc;
    }
    .print-table tr:first-child td {
        border-top: none;
    }
}

/* --- Light Mode Overrides for Hardcoded Dark Colors --- */
[data-theme="light"] body {
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.05) 0%, transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.03) 0%, transparent 25%);
}

[data-theme="light"] .layout-wrapper {
    background: rgba(255, 255, 255, 0.7);
}

[data-theme="light"] .sidebar {
    background: rgba(255, 255, 255, 0.9);
}

[data-theme="light"] .nav-item:not(.active):hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] header {
    background: rgba(248, 250, 252, 0.95);
}

[data-theme="light"] .balance-card {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

[data-theme="light"] .balance-card h3,
[data-theme="light"] .balance-card h2 {
    color: #ffffff;
}

[data-theme="light"] .transaction-item,
[data-theme="light"] .admin-stat-card,
[data-theme="light"] .admin-table td {
    background: #ffffff;
}

[data-theme="light"] .transaction-item:hover,
[data-theme="light"] .admin-table tr:hover {
    background: #f8fafc;
}

[data-theme="light"] .admin-table th {
    background: #f1f5f9;
}

[data-theme="light"] .user-dropdown-menu {
    background: #ffffff;
}

[data-theme="light"] .modal-card {
    background: #ffffff;
    border-color: var(--card-border);
}

[data-theme="light"] .mobile-nav {
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid var(--card-border);
}

[data-theme="light"] .transaction-list::-webkit-scrollbar-track {
    background: #f1f5f9;
}

[data-theme="light"] .item-category {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
}

[data-theme="light"] .btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

[data-theme="light"] .toast {
    background: #ffffff;
    border-color: var(--card-border);
    box-shadow: var(--shadow-lg);
}
