/* ============================================================
   BS Task Manager — Design System v3
   ============================================================ */

:root {
    --app-primary: #4f46e5;
    --app-primary-dark: #4338ca;
    --app-primary-light: #818cf8;
    --app-accent: #06b6d4;
    --app-success: #10b981;
    --app-warning: #f59e0b;
    --app-danger: #ef4444;
    --app-orange: #f97316;
    --app-bg: #f4f6fb;
    --app-surface: #ffffff;
    --app-surface-2: #f8fafc;
    --app-border: #e2e8f0;
    --app-text: #0f172a;
    --app-text-muted: #64748b;
    --app-radius-sm: 0.625rem;
    --app-radius: 1rem;
    --app-radius-lg: 1.25rem;
    --app-radius-xl: 1.5rem;
    --app-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    --app-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
    --app-shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
    --app-nav-width: 260px;
    --app-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #06b6d4 100%);
    --app-gradient-soft: linear-gradient(135deg, rgba(79,70,229,0.08) 0%, rgba(6,182,212,0.08) 100%);
}

[data-theme="dark"] {
    --app-bg: #0f1117;
    --app-surface: #1a1d27;
    --app-surface-2: #222633;
    --app-border: #2d3348;
    --app-text: #f1f5f9;
    --app-text-muted: #94a3b8;
    --app-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --app-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    --app-gradient-soft: linear-gradient(135deg, rgba(79,70,229,0.15) 0%, rgba(6,182,212,0.1) 100%);
}

.app-body { background: var(--app-bg) !important; color: var(--app-text); }

.app-layout { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--app-nav-width);
    flex-shrink: 0;
    background: var(--app-surface);
    border-left: 1px solid var(--app-border);
    position: fixed;
    top: 0; right: 0; bottom: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    box-shadow: var(--app-shadow-sm);
}

.app-sidebar-brand {
    padding: 1.25rem 1.5rem;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--app-text);
    text-decoration: none;
    border-bottom: 1px solid var(--app-border);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.app-sidebar-brand i {
    width: 36px; height: 36px;
    border-radius: 0.625rem;
    background: var(--app-gradient);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-sidebar-nav { flex: 1; padding: 1rem 0.75rem; overflow-y: auto; }

.app-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    border-radius: var(--app-radius-sm);
    color: var(--app-text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.925rem;
    transition: all 0.15s ease;
}

.app-nav-link i { font-size: 1.15rem; width: 1.35rem; text-align: center; }
.app-nav-link:hover { background: var(--app-surface-2); color: var(--app-primary); }
.app-nav-link.active {
    background: var(--app-gradient-soft);
    color: var(--app-primary);
    box-shadow: inset 3px 0 0 var(--app-primary);
}

.app-nav-section {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--app-text-muted);
    padding: 1rem 1rem 0.5rem;
    opacity: 0.7;
}

.app-sidebar-footer { padding: 1rem; border-top: 1px solid var(--app-border); }

.app-sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem;
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-2);
}

.app-sidebar-user-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--app-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.app-sidebar-user-info { min-width: 0; flex: 1; }
.app-sidebar-user-info strong {
    display: block;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-sidebar-user-info small { color: var(--app-text-muted); font-size: 0.75rem; }

.app-main {
    flex: 1;
    margin-right: var(--app-nav-width);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    background: rgba(255,255,255,0.85);
    border-bottom: 1px solid var(--app-border);
    padding: 0.875rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 1030;
    backdrop-filter: blur(12px);
}

[data-theme="dark"] .app-topbar { background: rgba(26,29,39,0.9); }

.app-topbar-title h1 { font-size: 1.25rem; font-weight: 800; margin: 0; }
.app-topbar-title p { margin: 0; font-size: 0.825rem; color: var(--app-text-muted); }
.app-topbar-actions { display: flex; align-items: center; gap: 0.5rem; }

.app-topbar-actions .btn-icon {
    width: 40px; height: 40px; padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--app-radius-sm);
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    color: var(--app-text-muted);
}

.app-page { padding: 1.5rem; max-width: 1440px; width: 100%; margin: 0 auto; }
.app-body .navbar.d-none.d-lg-block { display: none !important; }
.app-body .page-content { padding: 0 !important; max-width: none; }

.card {
    border: 1px solid var(--app-border) !important;
    border-radius: var(--app-radius) !important;
    box-shadow: var(--app-shadow-sm) !important;
    background: var(--app-surface) !important;
}

.card-header {
    background: var(--app-surface) !important;
    border-bottom: 1px solid var(--app-border) !important;
    font-weight: 700 !important;
    padding: 1rem 1.25rem !important;
}

.stat-card-v3 {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--app-shadow-sm);
}

.stat-card-v3:hover { transform: translateY(-3px); box-shadow: var(--app-shadow); color: inherit; }

.stat-card-v3-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.stat-card-v3-icon {
    width: 44px; height: 44px;
    border-radius: var(--app-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-card-v3.primary .stat-card-v3-icon { background: rgba(79,70,229,0.12); color: var(--app-primary); }
.stat-card-v3.warning .stat-card-v3-icon { background: rgba(245,158,11,0.12); color: var(--app-warning); }
.stat-card-v3.danger  .stat-card-v3-icon { background: rgba(239,68,68,0.12);  color: var(--app-danger); }
.stat-card-v3.info    .stat-card-v3-icon { background: rgba(6,182,212,0.12);   color: var(--app-accent); }

.stat-card-v3-label { font-size: 0.825rem; color: var(--app-text-muted); font-weight: 600; }
.stat-card-v3-value { font-size: 2rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.stat-card-v3.primary .stat-card-v3-value { color: var(--app-primary); }
.stat-card-v3.warning .stat-card-v3-value { color: var(--app-warning); }
.stat-card-v3.danger  .stat-card-v3-value { color: var(--app-danger); }
.stat-card-v3.info    .stat-card-v3-value { color: var(--app-accent); }

.btn-primary { background: var(--app-primary) !important; border-color: var(--app-primary) !important; }
.btn-primary:hover { background: var(--app-primary-dark) !important; border-color: var(--app-primary-dark) !important; }
.btn-outline-primary { color: var(--app-primary) !important; border-color: var(--app-primary) !important; }
.btn-outline-primary:hover { background: var(--app-primary) !important; }

.filter-bar {
    background: var(--app-surface) !important;
    border: 1px solid var(--app-border) !important;
    border-radius: var(--app-radius) !important;
    box-shadow: var(--app-shadow-sm) !important;
}

.quick-filters .btn.active { background: var(--app-primary) !important; border-color: var(--app-primary) !important; }

.table thead th {
    background: var(--app-surface-2) !important;
    color: var(--app-text-muted) !important;
    font-size: 0.8rem !important;
    border-bottom: 1px solid var(--app-border) !important;
}

.table-hover tbody tr:hover { background: var(--app-gradient-soft) !important; }

/* ---- FINANCIAL MODULE ---- */
.fin-shell { min-height: 200px; }

@media (max-width: 991.98px) {
    .fin-shell { margin: -0.75rem -0.75rem 0; padding: 0 0.75rem 1rem; }
}

.fin-nav {
    display: flex;
    gap: 0.35rem;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    padding: 0.35rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--app-shadow-sm);
}

.fin-nav-item {
    flex: 1;
    text-align: center;
    padding: 0.7rem 0.75rem;
    border-radius: var(--app-radius-sm);
    text-decoration: none;
    color: var(--app-text-muted);
    font-size: 0.875rem;
    font-weight: 700;
    transition: all 0.15s;
}

.fin-nav-item:hover { color: var(--app-primary); background: var(--app-surface-2); }
.fin-nav-item.active {
    background: var(--app-gradient);
    color: #fff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.fin-hero {
    background: var(--app-gradient);
    border-radius: var(--app-radius-xl);
    padding: 1.5rem;
    color: #fff;
    margin-bottom: 1.25rem;
    box-shadow: 0 12px 32px rgba(79, 70, 229, 0.3);
    position: relative;
    overflow: hidden;
}

.fin-hero::after {
    content: '';
    position: absolute;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    top: -60px; left: -40px;
}

.fin-hero-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    position: relative;
    z-index: 1;
}

.fin-hero-label { font-size: 0.9rem; opacity: 0.92; font-weight: 600; }

.fin-hero-badge {
    background: rgba(239, 68, 68, 0.95);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.3rem 0.75rem;
    border-radius: 2rem;
    white-space: nowrap;
}

.fin-hero-amount {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.25;
    position: relative;
    z-index: 1;
}

.fin-hero-empty { opacity: 0.9; margin: 0; position: relative; z-index: 1; }

.fin-grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.875rem;
    margin-bottom: 1.25rem;
}

@media (min-width: 576px) { .fin-grid-2 { grid-template-columns: 1fr 1fr; } }

.fin-tile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.125rem 1.25rem;
    border-radius: var(--app-radius);
    text-decoration: none;
    color: inherit;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    box-shadow: var(--app-shadow-sm);
    transition: transform 0.15s, box-shadow 0.15s;
}

.fin-tile:hover { transform: translateY(-2px); box-shadow: var(--app-shadow); color: inherit; }

.fin-tile-icon {
    width: 52px; height: 52px;
    border-radius: var(--app-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.fin-tile.primary .fin-tile-icon { background: rgba(79,70,229,0.12); color: var(--app-primary); }
.fin-tile.warning .fin-tile-icon { background: rgba(249,115,22,0.12); color: var(--app-orange); }
.fin-tile-body { flex: 1; min-width: 0; }
.fin-tile-body strong { display: block; font-size: 1rem; font-weight: 800; margin-bottom: 0.15rem; }
.fin-tile-body span { font-size: 0.8rem; color: var(--app-text-muted); font-weight: 600; }
.fin-tile-arrow { color: var(--app-text-muted); opacity: 0.5; }

.fin-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.fin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.9rem 1rem;
    border-radius: var(--app-radius);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    border: 2px solid var(--app-primary);
    color: var(--app-primary);
    background: var(--app-surface);
}

.fin-btn.primary {
    background: var(--app-gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

.fin-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.875rem;
}

.fin-section-head h5 { font-size: 1rem; font-weight: 800; margin: 0; }
.fin-section-head a { font-size: 0.875rem; font-weight: 600; color: var(--app-primary); text-decoration: none; }

.fin-pills {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
    margin-bottom: 1rem;
}

.fin-pills::-webkit-scrollbar { display: none; }

.fin-pill {
    flex-shrink: 0;
    padding: 0.55rem 1.1rem;
    border-radius: 2rem;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--app-text-muted);
    background: var(--app-surface);
    border: 1px solid var(--app-border);
}

.fin-pill.active {
    background: var(--app-primary);
    color: #fff;
    border-color: var(--app-primary);
    box-shadow: 0 2px 10px rgba(79, 70, 229, 0.3);
}

.fin-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    margin-bottom: 0.875rem;
    box-shadow: var(--app-shadow-sm);
    overflow: hidden;
    border-right: 4px solid transparent;
}

.fin-card-overdue { border-right-color: var(--app-danger); }
.fin-card-today   { border-right-color: var(--app-warning); }
.fin-card-paid    { opacity: 0.55; }

.fin-card-main {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 1rem 1.125rem 0.875rem;
    text-decoration: none;
    color: inherit;
}

.fin-card-icon {
    width: 46px; height: 46px;
    border-radius: var(--app-radius-sm);
    background: var(--app-gradient-soft);
    color: var(--app-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.fin-card-body { flex: 1; min-width: 0; }
.fin-card-title { font-size: 1rem; font-weight: 800; margin: 0 0 0.25rem; color: var(--app-text); }
.fin-card-meta { font-size: 0.8rem; color: var(--app-text-muted); margin: 0; font-weight: 600; }
.fin-card-desc { font-size: 0.78rem; color: var(--app-text-muted); margin: 0.35rem 0 0; }
.fin-card-amount { font-weight: 800; font-size: 1rem; white-space: nowrap; color: var(--app-primary); flex-shrink: 0; }

.fin-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem 0.875rem;
    border-top: 1px solid var(--app-border);
    background: var(--app-surface-2);
}

.fin-paid-toggle {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.65rem;
    border: none;
    border-radius: var(--app-radius-sm);
    background: rgba(16, 185, 129, 0.1);
    color: var(--app-success);
    font-size: 0.875rem;
    font-weight: 700;
    min-height: 44px;
    cursor: pointer;
}

.fin-paid-toggle.is-paid { background: rgba(16, 185, 129, 0.2); }

.fin-edit-btn {
    width: 44px; height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--app-radius-sm);
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    color: var(--app-text-muted);
    text-decoration: none;
}

.fin-list-wrap { background: transparent; border: none; box-shadow: none; }
.fin-list-wrap .card-body { padding: 0; background: transparent; }
.fin-page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.fin-page-head h4 { font-weight: 800; margin: 0; }
.fin-recurring { color: var(--app-accent); font-weight: 600; }

.fin-hub-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    border-radius: var(--app-radius-lg);
    text-decoration: none;
    color: inherit;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    box-shadow: var(--app-shadow-sm);
    min-height: 160px;
    transition: all 0.2s;
}

.fin-hub-tile:hover { transform: translateY(-4px); box-shadow: var(--app-shadow); color: inherit; }
.fin-hub-tile i { font-size: 2.75rem; margin-bottom: 0.875rem; }
.fin-hub-tile.primary i { color: var(--app-primary); }
.fin-hub-tile.warning i { color: var(--app-orange); }

.alert { border-radius: var(--app-radius-sm) !important; border: none !important; }
.empty-state-icon {
    font-size: 3rem !important;
    background: var(--app-gradient-soft);
    width: 88px; height: 88px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 1 !important;
    color: var(--app-primary) !important;
}

.login-wrapper { background: var(--app-gradient) !important; }
.login-card { border-radius: var(--app-radius-xl) !important; border: none !important; box-shadow: var(--app-shadow-lg) !important; }

.page-link { border-radius: var(--app-radius-sm) !important; border-color: var(--app-border) !important; color: var(--app-primary) !important; }
.page-item.active .page-link { background: var(--app-primary) !important; border-color: var(--app-primary) !important; }

@media (max-width: 991.98px) {
    .app-main { margin-right: 0 !important; }
    .app-page { padding: 0.75rem !important; }
    .desktop-only { display: none !important; }
}
