@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@400;500;600;700&display=swap');

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Hind Siliguri', 'Segoe UI', Arial, sans-serif;
    background: #f1f5f4;
    color: #1f2937;
}

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

.auth-page {
    min-height: 100vh;
    display: flex;
}

/* ---- Left branding panel ---- */
.auth-showcase {
    position: relative;
    flex: 1.1;
    background: linear-gradient(155deg, #0f9d58 0%, #0c7a44 50%, #063d24 100%);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 60px;
    overflow: hidden;
}
.auth-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.35;
    animation: authFloat 10s ease-in-out infinite;
}
.blob-1 { width: 340px; height: 340px; background: #34d399; top: -80px; left: -80px; animation-delay: 0s; }
.blob-2 { width: 260px; height: 260px; background: #22c55e; bottom: -60px; right: -40px; animation-delay: 2s; }
.blob-3 { width: 200px; height: 200px; background: #a7f3d0; top: 45%; left: 55%; animation-delay: 4s; }
@keyframes authFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(20px, -25px) scale(1.08); }
}

.auth-showcase-content { position: relative; z-index: 2; max-width: 480px; animation: authFadeUp .7s ease both; }
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 48px; }
.auth-logo-icon {
    width: 46px; height: 46px;
    background: rgba(255,255,255,0.18);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    backdrop-filter: blur(4px);
}
.auth-logo-text { font-family: 'Inter', 'Hind Siliguri', sans-serif; font-weight: 700; font-size: 16px; letter-spacing: .2px; }

.auth-headline {
    font-size: 34px;
    line-height: 1.35;
    font-weight: 700;
    margin: 0 0 18px;
}
.auth-subline {
    font-size: 15px;
    line-height: 1.7;
    color: rgba(255,255,255,0.82);
    margin: 0 0 44px;
    max-width: 420px;
}

.auth-feature-list { display: flex; flex-direction: column; gap: 20px; }
.auth-feature { display: flex; align-items: flex-start; gap: 14px; }
.auth-feature-icon {
    width: 42px; height: 42px;
    flex-shrink: 0;
    background: rgba(255,255,255,0.14);
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px;
}
.auth-feature strong { display: block; font-size: 14.5px; margin-bottom: 2px; }
.auth-feature span { font-size: 13px; color: rgba(255,255,255,0.75); }

/* ---- Right form panel ---- */
.auth-form-side {
    flex: 1;
    min-width: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 40px 24px;
}
.auth-form-box { width: 100%; max-width: 380px; animation: authFadeUp .7s ease .1s both; }
.auth-mobile-logo { display: none; font-size: 40px; margin-bottom: 10px; }
.auth-form-header { margin-bottom: 32px; }
.auth-form-header h2 { font-size: 26px; margin: 0 0 6px; color: #111827; font-weight: 700; }
.auth-form-header p { margin: 0; color: #9ca3af; font-size: 14px; }

.auth-field { margin-bottom: 18px; }
.auth-field label { display: block; font-size: 12.5px; font-weight: 600; color: #374151; margin-bottom: 7px; }
.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    border: 1.5px solid #e5e7eb;
    border-radius: 11px;
    background: #f9fafb;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.auth-input-wrap:focus-within {
    border-color: #16a34a;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(22,163,74,0.12);
}
.auth-input-icon { padding: 0 12px; font-size: 15px; opacity: .55; }
.auth-input-wrap input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 13px 12px 13px 0;
    font-size: 14.5px;
    font-family: inherit;
    outline: none;
    color: #111827;
}
.auth-toggle-pass {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    padding: 0 12px;
    opacity: .55;
}
.auth-toggle-pass:hover { opacity: .9; }

.auth-submit-btn {
    width: 100%;
    padding: 14px;
    margin-top: 6px;
    background: linear-gradient(135deg, #16a34a, #0c7a44);
    color: #fff;
    border: none;
    border-radius: 11px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    box-shadow: 0 10px 24px rgba(15,157,88,0.35);
    transition: transform .15s, box-shadow .15s, opacity .15s;
}
.auth-submit-btn span { transition: transform .15s; }
.auth-submit-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(15,157,88,0.45); }
.auth-submit-btn:hover span { transform: translateX(3px); }
.auth-submit-btn:active { transform: translateY(0); }

.auth-footnote { text-align: center; font-size: 12px; color: #9ca3af; margin-top: 26px; }

.error-msg {
    background: #fdecea;
    color: #c0392b;
    padding: 11px 14px;
    border-radius: 9px;
    font-size: 13px;
    margin-bottom: 18px;
    border: 1px solid #fbd5d0;
}

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

@media (max-width: 900px) {
    .auth-showcase { display: none; }
    .auth-form-side { min-width: 0; }
    .auth-mobile-logo { display: block; text-align: center; }
    .auth-form-header { text-align: center; }
}

/* ================= Topbar ================= */
.topbar {
    background: linear-gradient(120deg, #0f9d58, #0c7a44);
    color: #fff;
    padding: 16px 26px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    flex-wrap: wrap;
    gap: 10px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { font-size: 30px; }
.topbar h1 { margin: 0; font-size: 18px; line-height: 1.2; }
.brand-sub { font-size: 12px; opacity: .85; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-chip {
    background: rgba(255,255,255,0.18);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
}
.logout-btn {
    color: #fff;
    background: rgba(255,255,255,0.18);
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    transition: background .15s;
}
.logout-btn:hover { background: rgba(255,255,255,0.32); }

.container { padding: 24px; max-width: 1180px; margin: 0 auto; }

/* ================= Sidebar layout ================= */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 252px;
    flex-shrink: 0;
    background: linear-gradient(190deg, #0fa863 0%, #0c7a44 55%, #063d24 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 40;
    box-shadow: 6px 0 24px rgba(0,0,0,0.1);
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}
.sidebar-brand .brand-icon {
    font-size: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.16);
    border-radius: 11px;
    flex-shrink: 0;
}
.sidebar-brand-text { font-weight: 700; font-size: 14.5px; line-height: 1.35; letter-spacing: -.1px; }

.sidebar-nav { flex: 1; padding: 18px 14px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.sidebar-nav-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.5);
    font-weight: 700;
    padding: 14px 10px 6px;
}
.sidebar-nav-label:first-child { padding-top: 2px; }

.nav-item {
    color: #fff;
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 10px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 11px;
    opacity: .85;
    border-left: 3px solid transparent;
    transition: background .15s, opacity .15s, transform .15s;
}
.nav-icon {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    font-size: 14.5px;
}
.nav-item:hover { background: rgba(255,255,255,0.12); opacity: 1; transform: translateX(3px); }
.nav-item.active {
    background: rgba(255,255,255,0.2);
    opacity: 1;
    font-weight: 600;
    border-left-color: #fff;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
}
.nav-item.active .nav-icon { background: rgba(255,255,255,0.22); }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.12);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sidebar-footer .user-chip {
    background: rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13.5px;
}
.user-avatar {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}
.sidebar-footer .logout-btn {
    text-align: center;
    background: rgba(0,0,0,0.15);
    border-radius: 10px;
    padding: 9px;
    transition: background .15s;
}
.sidebar-footer .logout-btn:hover { background: rgba(0,0,0,0.28); }

.main-content { flex: 1; min-width: 0; background: #f1f5f4; }
.page-header {
    background: #fff;
    padding: 18px 26px;
    border-bottom: 1px solid #eee;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 30;
}
.page-header h1 { margin: 0; font-size: 20px; color: #111827; font-weight: 700; letter-spacing: -.2px; }
.page-header .page-sub { font-size: 12.5px; color: #9ca3af; margin-top: 3px; }

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 60;
    background: #0f9d58;
    color: #fff;
    border: none;
    border-radius: 9px;
    width: 42px;
    height: 42px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

@media (max-width: 900px) {
    .sidebar { position: fixed; left: -252px; top: 0; transition: left .2s; box-shadow: 4px 0 20px rgba(0,0,0,0.2); }
    .sidebar.open { left: 0; }
    .sidebar-toggle { display: block; }
    .page-header { padding-left: 64px; }
}

/* ================= Filter toolbar ================= */
.toolbar {
    background: #fff;
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 22px;
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: end;
}
.toolbar-field { display: flex; flex-direction: column; min-width: 140px; }
.toolbar-field.grow { flex: 1; min-width: 200px; }
.toolbar-field label { font-size: 11px; color: #9ca3af; margin-bottom: 5px; text-transform: uppercase; letter-spacing: .3px; }
.toolbar-field select,
.toolbar-field input {
    padding: 9px 11px;
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
    font-size: 14px;
    font-family: inherit;
}
.toolbar-actions { display: flex; gap: 8px; }
.btn-primary {
    padding: 10px 18px;
    background: linear-gradient(135deg, #16a34a, #0f9d58);
    color: #fff;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(15,157,88,0.28);
    transition: transform .15s, box-shadow .15s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(15,157,88,0.35); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
    padding: 10px 16px;
    background: #f3f4f6;
    color: #4b5563;
    border-radius: 9px;
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
}
.btn-ghost:hover { background: #e5e7eb; }

/* ================= Summary cards ================= */
.cards { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.card {
    flex: 1;
    min-width: 200px;
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: 16px;
    border-top: 4px solid #ccc;
    transition: transform .18s, box-shadow .18s;
    animation: fadeInUp .5s ease both;
}
.cards .card:nth-child(1) { animation-delay: .02s; }
.cards .card:nth-child(2) { animation-delay: .08s; }
.cards .card:nth-child(3) { animation-delay: .14s; }
.cards .card:nth-child(4) { animation-delay: .2s; }
.card:hover { transform: translateY(-4px); box-shadow: 0 12px 26px rgba(0,0,0,0.1); }
.card-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    background: #f3f4f6;
    flex-shrink: 0;
}
.card.income { border-top-color: #16a34a; }
.card.expense { border-top-color: #dc2626; }
.card.balance { border-top-color: #2563eb; }
.card.admin-stat { border-top-color: #7c3aed; }
.card h3 { margin: 0 0 4px; font-size: 12px; color: #9ca3af; text-transform: uppercase; letter-spacing: .4px; }
.card .amount { font-size: 24px; font-weight: 700; }
.card.income .amount { color: #16a34a; }
.card.expense .amount { color: #dc2626; }
.card.balance .amount { color: #2563eb; }

/* ================= Charts ================= */
.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 22px;
}
.chart-canvas-wrap {
    max-width: 240px;
    margin: 0 auto;
}
.empty-note { color: #9ca3af; font-size: 14px; text-align: center; padding: 30px 0; }

.quick-links { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.quick-link {
    flex: 1;
    min-width: 200px;
    text-align: center;
    padding: 14px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    color: #fff;
    transition: opacity .15s;
}
.quick-link:hover { opacity: .9; }
.quick-link.income { background: linear-gradient(135deg, #16a34a, #0f9d58); }
.quick-link.expense { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.quick-link.neutral { background: linear-gradient(135deg, #2563eb, #1d4ed8); }

.report-mode-tabs { display: flex; gap: 10px; margin-bottom: 18px; }
.mode-tab {
    padding: 10px 18px;
    border-radius: 10px;
    background: #fff;
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: background .15s, color .15s;
}
.mode-tab:hover { background: #f3f4f6; }
.mode-tab.active { background: linear-gradient(135deg, #16a34a, #0f9d58); color: #fff; }

.chip-list { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f3f4f6;
    color: #374151;
    padding: 7px 12px;
    border-radius: 20px;
    font-size: 13px;
}
.chip a {
    color: #9ca3af;
    text-decoration: none;
    font-weight: 700;
    line-height: 1;
    transition: color .15s;
}
.chip a:hover { color: #dc2626; }

/* ================= Panels ================= */
.panel {
    background: #fff;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 2px 14px rgba(0,0,0,0.05);
    border: 1px solid #f3f4f6;
    margin-bottom: 22px;
    animation: fadeInUp .45s ease both;
}
.panel h2 { margin-top: 0; font-size: 16.5px; color: #111827; font-weight: 700; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.panel-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.export-actions { display: flex; gap: 8px; }
.btn-export {
    background: #f3f4f6;
    color: #374151;
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    transition: background .15s;
}
.btn-export:hover { background: #e5e7eb; }

/* ================= Add form ================= */
.add-form {
    display: grid;
    grid-template-columns: repeat(5, 1fr) auto;
    gap: 12px;
    align-items: end;
}
.add-form .field { display: flex; flex-direction: column; }
.add-form label { font-size: 11px; color: #9ca3af; margin-bottom: 5px; text-transform: uppercase; letter-spacing: .3px; }
.add-form select,
.add-form input {
    padding: 10px 11px;
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
    font-size: 14px;
    font-family: inherit;
}
.btn-add {
    padding: 11px 22px;
    background: linear-gradient(135deg, #16a34a, #0f9d58);
    color: #fff;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    height: 42px;
    box-shadow: 0 4px 14px rgba(15,157,88,0.28);
    transition: transform .15s, box-shadow .15s;
}
.btn-add:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(15,157,88,0.35); }

.cat-row { display: flex; gap: 6px; }
.cat-row select { flex: 1; }
.add-cat-btn {
    width: 40px;
    height: 40px;
    border: 1.5px solid #16a34a;
    background: #fff;
    color: #16a34a;
    border-radius: 9px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s, color .15s;
}
.add-cat-btn:hover { background: #16a34a; color: #fff; }

/* ================= Modal ================= */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 16px;
}
.modal-box {
    background: #fff;
    border-radius: 16px;
    padding: 26px;
    width: 360px;
    max-width: 100%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.modal-box h3 { margin-top: 0; margin-bottom: 18px; font-size: 16px; color: #1f2937; }
.modal-box input[type=text],
.modal-box input[type=number],
.modal-box input[type=date] {
    width: 100%;
    padding: 10px 11px;
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
    font-size: 14px;
    font-family: inherit;
    margin-bottom: 14px;
}
.edit-form .field { display: flex; flex-direction: column; }
.edit-form label { font-size: 11px; color: #9ca3af; margin-bottom: 5px; text-transform: uppercase; letter-spacing: .3px; }
.edit-form select { width: 100%; padding: 10px 11px; border: 1.5px solid #e5e7eb; border-radius: 9px; font-size: 14px; font-family: inherit; margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.modal-cancel {
    padding: 9px 16px;
    border: 1.5px solid #e5e7eb;
    background: #fff;
    border-radius: 9px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
}
.modal-save {
    padding: 9px 18px;
    border: none;
    background: linear-gradient(135deg, #16a34a, #0f9d58);
    color: #fff;
    border-radius: 9px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
}
.modal-save:hover { opacity: .92; }

/* ================= Table ================= */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 620px; }
table th, table td { padding: 12px 10px; border-bottom: 1px solid #f0f0f0; text-align: left; }
table th { color: #9ca3af; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
table tbody tr { transition: background .12s; }
table tbody tr:hover { background: #f9fafb; }
.type-tag {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: #fff;
    font-weight: 500;
}
.type-tag.income { background: #16a34a; }
.type-tag.expense { background: #dc2626; }
.role-tag {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: #fff;
    font-weight: 500;
}
.role-tag.admin { background: #7c3aed; }
.role-tag.user { background: #64748b; }
.status-tag {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: #fff;
    font-weight: 500;
}
.status-tag.active { background: #16a34a; }
.status-tag.inactive { background: #9ca3af; }
.amt-income { color: #16a34a; font-weight: 600; }
.amt-expense { color: #dc2626; font-weight: 600; }
.row-actions { display: flex; gap: 6px; white-space: nowrap; }
.edit-btn, .del-btn {
    text-decoration: none;
    font-size: 13px;
    border: 1.5px solid #e5e7eb;
    padding: 5px 10px;
    border-radius: 8px;
    cursor: pointer;
    background: #fff;
    font-family: inherit;
    line-height: 1.4;
}
.edit-btn:hover { border-color: #2563eb; background: #eff6ff; }
.del-btn { border-color: #fecaca; color: #dc2626; }
.del-btn:hover { background: #dc2626; color: #fff; }

@media (max-width: 900px) {
    .chart-grid { grid-template-columns: 1fr; }
    .add-form { grid-template-columns: 1fr 1fr; }
}
