/* Personal Finance Manager */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 0 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-brand .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.sidebar-brand h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.sidebar-brand small {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 0.25rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    color: var(--primary-light);
    background: rgba(99, 102, 241, 0.1);
    border-right: 3px solid var(--primary);
}

.sidebar-nav a i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.sidebar-logout:hover {
    color: var(--danger);
}

/* Main content */
.main-content {
    margin-left: 240px;
    padding: 2rem;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.page-header p {
    color: var(--text-muted);
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.stat-card {
    position: relative;
    overflow: hidden;
}

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

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.stat-card.income .stat-icon { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.stat-card.expense .stat-icon { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.stat-card.balance .stat-icon { background: rgba(99, 102, 241, 0.15); color: var(--primary); }
.stat-card.savings .stat-icon { background: rgba(245, 158, 11, 0.15); color: var(--warning); }

/* Grid layouts */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 10px;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
}

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

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 8px;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.875rem 1.125rem;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 0.95rem;
    transition: all 0.2s;
    line-height: 1.5;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
    background: rgba(99, 102, 241, 0.03);
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: rgba(99, 102, 241, 0.08);
}

th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

td {
    padding: 0.875rem 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
}

tr:hover td {
    background: var(--bg-card-hover);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-income {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

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

/* Amount colors */
.amount-positive { color: var(--success); }
.amount-negative { color: var(--danger); }

/* Progress bars */
.progress-bar {
    height: 8px;
    background: var(--bg);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 0.75rem;
}

.progress-bar .fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s;
}

.progress-bar .fill.safe { background: var(--success); }
.progress-bar .fill.warning { background: var(--warning); }
.progress-bar .fill.danger { background: var(--danger); }

/* Budget card */
.budget-card {
    margin-bottom: 1.25rem;
    padding: 1.25rem;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.budget-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.budget-category {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.budget-icon {
    width: 36px;
    height: 36px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-light);
}

/* Alert messages */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: #86efac;
}

/* Flex helpers */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* Account sidebar card */
.account-sidebar-card {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.account-sidebar-card .acc-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.account-sidebar-card .acc-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.account-sidebar-card .acc-balance {
    font-weight: 600;
}

/* Charts */
.chart-container {
    position: relative;
    height: 280px;
    padding: 1rem 0;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .main-content {
        margin-left: 0;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== Members & Invite Styles ========== */
.invite-card {
    background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(139,92,246,0.08));
    border: 1px dashed rgba(59,130,246,0.3);
    border-radius: var(--radius, 12px);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.member-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary, #162032);
    border-radius: var(--radius, 8px);
    margin-bottom: 0.5rem;
    transition: background 0.2s;
}

.member-row:hover {
    background: #1c2d47;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-primary { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-success { background: rgba(34,197,94,0.15); color: #4ade80; }
.badge-warning { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-danger  { background: rgba(239,68,68,0.15); color: #f87171; }

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border, #2d3a4f);
    color: var(--text, #c8d6e5);
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-ghost:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--text-muted, #6b7c93);
}

.stat-card {
    background: var(--bg-card, #1e293b);
    border-radius: var(--radius, 12px);
    padding: 1.25rem;
    border: 1px solid var(--border, #2d3a4f);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .form-row { flex-wrap: wrap; }
    .form-group { flex: 1 1 100% !important; }
    .header { flex-direction: column; gap: 1rem; }
}