/* modern fintech glassmorphism theme */
:root {

    --bg-base: #fafafa;
    --bg-surface: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --border-glass: #e5e5e5;

    --text-main: #111111;
    --text-muted: #666666;

    --primary: #d4af37;
    --primary-hover: #c5a028;
    --secondary: #262626;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    --nav-bg: rgba(255, 255, 255, 0.95);
    --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    --shadow-glow: 0 10px 25px -5px rgba(212, 175, 55, 0.4);

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
}

[data-theme="dark"] {

    --bg-base: #0b0b0b;
    --bg-surface: #141414;
    --bg-glass: rgba(20, 20, 20, 0.7);
    --border-glass: #262626;

    --text-main: #e3e2e7;
    --text-muted: #d0c5af;

    --primary: #d4af37;
    --primary-hover: #f2ca50;

    --nav-bg: rgba(11, 11, 11, 0.85);
    --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    transition: background-color 0.4s ease, color 0.4s ease;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.glassmorphism {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-soft);
}

.shadow-glow { box-shadow: var(--shadow-glow); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-bold { font-weight: 700; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.full-width { width: 100%; }
.flex-row { display: flex; align-items: center; justify-content: space-between; }
.flex-row-around { display: flex; align-items: center; justify-content: space-around; }
.gap-half { gap: 0.5rem; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.b-0 { border: none !important; }
.pl-0 { padding-left: 0 !important; }

.bg-shape {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.5;
}
.bg-shape.shadow-1 {
    width: 300px; height: 300px;
    background: var(--primary);
    top: -100px; left: -100px;
}
.bg-shape.shadow-2 {
    width: 400px; height: 400px;
    background: var(--secondary);
    bottom: -150px; right: -100px;
}

.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    z-index: 10;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    border-radius: var(--radius-xl);
    text-align: center;
    animation: fadeUp 0.6s ease-out forwards;
}
.auth-header { margin-bottom: 30px; }
.auth-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.auth-header p { color: var(--text-muted); font-size: 0.95rem; }
.brand-logo i { font-size: 3rem; color: var(--primary); margin-bottom: 15px; }

.input-modern {
    position: relative;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    overflow: hidden;
    transition: all 0.3s ease;
}
.input-modern:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}
.input-modern .icon {
    padding: 0 15px;
    color: var(--text-muted);
}
.input-modern input, .input-modern select, .input-modern textarea {
    width: 100%;
    padding: 15px 15px 15px 0;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
}
.input-modern select option { background: var(--bg-surface); color: var(--text-main); }
.micro-label { font-size: 0.75rem; color: var(--text-muted); position: absolute; top: -20px; left: 0; }

.btn-primary, .btn-secondary {
    border: none;
    border-radius: var(--radius-md);
    padding: 15px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}
.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}
.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-main);
    border: 1px solid var(--border-glass);
}
.btn-secondary:hover {
    background: var(--bg-surface);
    transform: translateY(-2px);
}
.auth-action-btn { width: 100%; margin-bottom: 15px; }
.auth-switch { color: var(--text-muted); font-size: 0.9rem; margin-top: 10px; }
.auth-switch span { color: var(--primary); font-weight: 600; cursor: pointer; }
.auth-msg { margin-top: 15px; font-size: 0.9rem; }

.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    position: relative;
    z-index: 10;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 10px;
}
.header-titles h2 { font-size: 1.8rem; font-weight: 700; }
.header-titles p { color: var(--text-muted); font-size: 0.9rem; }
.app-icon-btn, .nav-icon-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    width: 45px; height: 45px;
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-size: 1.2rem; cursor: pointer; transition: 0.3s;
}

.app-content-area {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 100px; 
}

.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.balance-card-wrapper {
    position: relative;
    border-radius: var(--radius-xl);
    padding: 30px 20px;
    overflow: hidden;
    margin-bottom: 20px;
}
.balance-slider {
    position: relative;
    height: 160px;
    overflow: hidden;
}
.slider-pane {
    position: absolute;
    top: 0; left: 0; width: 100%; min-height: 100%;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
}
.card-subtitle { color: var(--text-muted); font-size: 0.95rem; font-weight: 500; margin-bottom: 5px; }
.total-balance { font-size: 2.5rem; font-weight: 800; letter-spacing: -1px; margin-top: 10px; }

.slider-controls {
    display: flex; justify-content: center; gap: 8px; margin-top: 20px;
}
.slider-controls .nav-btn {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-muted); opacity: 0.3;
    border: none; cursor: pointer; transition: 0.3s;
}
.slider-controls .nav-btn.active {
    width: 24px; border-radius: 4px;
    background: var(--primary); opacity: 1;
}

.history-section {
    border-radius: var(--radius-lg);
    padding: 20px;
    min-height: 400px;
}
.history-header h3 { margin-bottom: 15px; font-size: 1.2rem; }
.history-filters {
    display: flex; gap: 10px; margin-bottom: 20px;
}
.search-box {
    flex: 2;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 10px 15px;
    display: flex; align-items: center;
    border: 1px solid var(--border-glass);
}
.search-box input { border: none; background: transparent; color: var(--text-main); outline: none; margin-left: 10px; width: 100%;}
.modern-select {
    flex: 1; padding: 10px; border-radius: var(--radius-md); border: 1px solid var(--border-glass);
    background: var(--bg-surface); color: var(--text-main); outline: none; cursor: pointer;
}

.list-container {
    display: flex; flex-direction: column; gap: 10px;
    max-height: 250px; overflow-y: auto; padding-right: 5px;
}
.list-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 15px; border-radius: var(--radius-md);
    background: var(--bg-surface); border: 1px solid var(--border-glass);
}
.btn-danger-icon {
    background: rgba(239, 68, 68, 0.1); color: var(--danger);
    border: none; width: 32px; height: 32px; border-radius: var(--radius-sm);
    display: flex; justify-content: center; align-items: center; cursor: pointer;
    transition: 0.3s;
}
.btn-danger-icon:hover { background: var(--danger); color: white; }

.transaction-table {
    width: 100%; border-collapse: collapse; text-align: left;
}
.transaction-table th {
    padding: 15px; border-bottom: 2px solid var(--border-glass);
    color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase;
}
.transaction-table td {
    padding: 15px; border-bottom: 1px solid var(--border-glass);
    vertical-align: middle;
}
.transaction-type {
    padding: 4px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600;
}
.type-expense { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.type-income { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.type-transfer { background: rgba(14, 165, 233, 0.1); color: var(--secondary); }
.desc-cell { max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.transaction-cards {
    display: flex; flex-direction: column; gap: 15px;
}
.transaction-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px; border-radius: var(--radius-md);
    background: var(--bg-surface); border: 1px solid var(--border-glass);
}
.t-icon {
    width: 40px; height: 40px; border-radius: 12px;
    display: flex; justify-content: center; align-items: center;
    margin-right: 15px; font-size: 1.2rem;
}
.t-icon.expense { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.t-icon.income { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.t-icon.transfer { background: rgba(14, 165, 233, 0.1); color: var(--secondary); }
.t-details { flex: 1; }
.t-title { font-weight: 600; margin-bottom: 4px; }
.t-meta { font-size: 0.8rem; color: var(--text-muted); }
.t-amount { font-weight: 700; font-size: 1.1rem; }
.t-actions-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.t-desc { display: flex; align-items: center; margin-top: 5px; font-size: 0.85rem; color: var(--text-muted); }

@media (max-width: 1023px) {
    .transaction-table-wrapper { display: none; }
    .transaction-cards { display: flex; }
}

.pagination-controls {
    display: flex; justify-content: center; align-items: center; gap: 15px; margin-top: 20px;
}

.widget-card {
    border-radius: var(--radius-lg); padding: 20px;
}
.widget-header h3 { font-size: 1.2rem; margin-bottom: 15px; }
.quick-action-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.quick-action-item {
    background: transparent; border: none; outline: none;
    display: flex; flex-direction: column; align-items: center; cursor: pointer;
}
.qa-icon {
    width: 50px; height: 50px; border-radius: 16px;
    display: flex; justify-content: center; align-items: center;
    font-size: 1.5rem; margin-bottom: 8px; transition: 0.3s;
}
.quick-action-item:hover .qa-icon { transform: scale(1.05); }
.quick-action-item span { color: var(--text-main); font-size: 0.85rem; font-weight: 500; }

.app-nav {
    position: fixed; bottom: 0; left: 0; width: 100%;
    height: 70px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 10px; z-index: 50;
    border-top: 1px solid var(--border-glass);
}
.nav-brand, .nav-footer { display: none; } 
.nav-menu {
    display: flex; justify-content: space-around; width: 100%; list-style: none;
}
.nav-item {
    flex: 1; display: flex; justify-content: center; align-items: center;
}
.nav-link {
    display: flex; flex-direction: column; align-items: center;
    color: var(--text-muted); text-decoration: none; transition: 0.3s;
    font-size: 1.3rem; padding: 10px;
}
.nav-label { font-size: 0.7rem; font-weight: 500; margin-top: 4px; }
.nav-item.active .nav-link { color: var(--primary); }
.nav-item:hover .nav-link { color: var(--primary-hover); }

.fab {
    position: fixed; bottom: 90px; right: 20px;
    width: 60px; height: 60px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white; font-size: 1.5rem; border: none;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer; z-index: 40; transition: 0.3s;
}
.fab:active { transform: scale(0.95); }

.app-modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 100;
    backdrop-filter: blur(4px);
}
.bottom-sheet {
    position: absolute; bottom: 0; left: 0; width: 100%;
    background: var(--bg-surface); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 20px;
    animation: slideUp 0.3s ease-out;
    max-height: 90vh; overflow-y: auto;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-drag-handle {
    width: 40px; height: 5px; background: var(--text-muted);
    border-radius: 10px; margin: 0 auto 20px; opacity: 0.3;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px;
}

.type-selector { display: flex; gap: 10px; margin-bottom: 20px; }
.type-btn {
    flex: 1; padding: 12px; border: 1px solid var(--border-glass);
    border-radius: var(--radius-md); background: transparent;
    color: var(--text-main); font-weight: 500; cursor: pointer; transition: 0.3s;
}
.type-btn.active.expense { background: var(--danger); color: white; border-color: var(--danger); }
.type-btn.active.income { background: var(--success); color: white; border-color: var(--success); }
.type-btn.active.transfer { background: var(--secondary); color: white; border-color: var(--secondary); }

.amount-display {
    text-align: right; background: transparent; padding: 10px 0;
    font-size: 3rem; font-weight: 800; border-bottom: 2px solid var(--border-glass);
    margin-bottom: 20px; display: flex; align-items: center; justify-content: flex-end;
}
.currency { font-size: 2rem; color: var(--text-muted); margin-right: 5px; }
.amount-display input {
    background: transparent; border: none; color: var(--text-main); font-size: 3rem;
    font-weight: 800; text-align: right; outline: none; width: 100%;
}
.calculator-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 25px;
}
.calc-btn {
    padding: 15px 0; border-radius: var(--radius-md); font-size: 1.2rem;
    font-weight: 600; cursor: pointer; border: 1px solid var(--border-glass);
    background: var(--bg-surface); color: var(--text-main); transition: 0.2s;
}
.calc-btn:active { transform: scale(0.95); background: var(--bg-glass); }
.calc-btn.op-btn { color: var(--primary); background: rgba(212, 175, 55, 0.1); border: none; }
.calc-btn.action-clr { color: var(--danger); }
.calc-btn.action-eq { background: var(--primary); color: white; border: none; }

@media (min-width: 1024px) {
    .app-layout { flex-direction: row; flex-wrap: nowrap; overflow: hidden; align-items: stretch; }

    .app-nav {
        position: relative; width: 260px; height: 100vh; flex-shrink: 0;
        flex-direction: column; align-items: flex-start;
        padding: 30px 20px; border-right: 1px solid var(--border-glass); border-top: none;
    }
    .nav-brand { display: block; font-size: 1.5rem; font-weight: 800; color: var(--primary); margin-bottom: 50px; padding-left: 10px;}
    .nav-brand i { margin-right: 10px; }
    .nav-menu { flex-direction: column; padding: 0; align-items: stretch; justify-content: flex-start; gap: 15px;}
    .nav-item { justify-content: flex-start; }
    .nav-link { flex-direction: row; padding: 15px; border-radius: var(--radius-md); font-size: 1rem; width: 100%;}
    .nav-link i { width: 24px; text-align: center; margin-right: 15px; font-size: 1.2rem; }
    .nav-label { font-size: 1rem; margin-top: 0; }
    .nav-item.active .nav-link { background: rgba(212, 175, 55, 0.1); }
    .nav-footer { display: flex; flex-direction: column; width: 100%; margin-top: auto; gap: 10px;}
    .nav-footer .nav-icon-btn { width: 100%; display: flex; justify-content: flex-start; padding: 15px; border-radius: var(--radius-md); background: transparent; border: none;}
    .nav-footer .nav-icon-btn i { width: 24px; text-align: center; margin-right: 15px; }

    .app-content-area { padding: 30px 40px; flex: 1; min-width: 0; width: auto; height: 100vh; overflow-y: auto; }
    .mobile-only { display: none !important; }

    .dashboard-grid { flex-direction: row; align-items: flex-start;}
    .main-col { flex: 2; width: 66%; }
    .side-col { flex: 1; width: 33%; }

    .transaction-table-wrapper { display: block; overflow-x: auto; }
    .transaction-cards { display: none; }

    .bottom-sheet {
        position: relative; margin: 5vh auto; width: 500px; max-height: 85vh;
        border-radius: var(--radius-xl); padding: 40px;
        animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    @keyframes scaleIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

    .fab { top: 30px; right: 40px; bottom: auto; }
}

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

@media (max-width: 600px) {
    .history-filters.flex-row { flex-wrap: wrap; }
    .history-filters .search-box { flex-basis: 100%; margin-bottom: 5px; }
    .modern-select { font-size: 0.8rem; padding: 10px; }
}

*::-webkit-scrollbar {
    display: none;
}
* {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Viewer Mode Specifics */
body.role-viewer .fab { display: none !important; }
body.role-viewer .t-actions-right .delete-btn { display: none !important; }
body.role-viewer .action-buttons .delete-btn { display: none !important; }
body.role-viewer .quick-action-grid { opacity: 0.8; }

.dashboard-charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 1024px) {
    .dashboard-charts-grid {
        grid-template-columns: 1fr 1fr;
    }
}

