/* ==========================================================================
   DESIGN SYSTEM: FAMILIENGILDE (NIGHT-BLUE PLAYFUL MODE)
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-main: #07090e;
    --bg-card: #0e111d;
    --bg-card-hover: #141829;
    --bg-sidebar: #0a0c14;
    --border-color: rgba(255, 255, 255, 0.06);
    --border-color-glow: rgba(138, 92, 245, 0.3);
    
    /* Neon Accents */
    --accent-purple: #8b5cf6;
    --accent-purple-glow: rgba(139, 92, 246, 0.4);
    --accent-cyan: #06b6d4;
    --accent-cyan-glow: rgba(6, 182, 212, 0.4);
    --accent-gold: #fbbf24;
    --accent-gold-glow: rgba(251, 191, 36, 0.4);
    --accent-green: #10b981;
    --accent-green-glow: rgba(16, 185, 129, 0.3);
    --accent-rose: #f43f5e;
    --accent-rose-glow: rgba(244, 63, 94, 0.3);
    
    /* Typography & Spacing */
    --font-heading: 'Outfit', 'Inter', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
    --text-primary: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dark: #0f172a;
    
    --sidebar-width: 280px;
    --border-radius-sm: 8px;
    --border-radius-md: 16px;
    --border-radius-lg: 24px;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.15);
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Global Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

body {
    overflow-x: hidden;
    min-height: 100vh;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: #1e2235;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-purple);
}

/* ==========================================================================
   TYPOGRAPHY & UTILITIES
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

h1 { font-size: 2.2rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.4rem; }

p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-muted);
}

a {
    color: var(--accent-purple);
    text-decoration: none;
    transition: var(--transition-smooth);
}
a:hover {
    color: var(--accent-cyan);
}

.text-center { text-align: center; }
.hidden { display: none !important; }

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    color: #fff;
    animation: slideInRight 0.25s ease;
}
.toast-error { background: #e74c3c; }
.toast-success { background: var(--accent-green, #2ecc71); }

/* Grid Layouts */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }

/* ==========================================================================
   BUTTONS & INPUTS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--border-radius-md);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: var(--transition-bounce);
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-purple), #7c3aed);
    color: #fff;
    box-shadow: 0 4px 15px var(--accent-purple-glow);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}
.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #1a1d2e;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background: #252942;
    border-color: var(--accent-purple);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-green), #059669);
    color: #fff;
    box-shadow: 0 4px 12px var(--accent-green-glow);
}
.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.5);
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-rose), #e11d48);
    color: #fff;
    box-shadow: 0 4px 12px var(--accent-rose-glow);
}
.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(244, 63, 94, 0.5);
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #161827;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}
.btn-icon:hover {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: #fff;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
}
.btn-text:hover {
    color: var(--accent-rose);
}

/* Form Controls */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.input-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    background: #111424;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-smooth);
}
.input-control:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.25);
    background: #15192e;
}

/* ==========================================================================
   APP SHELL LAYOUT
   ========================================================================== */
#app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
#sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    flex-shrink: 0;
    z-index: 10;
    transition: var(--transition-smooth);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}
.logo-icon {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 8px var(--accent-purple-glow));
}
.sidebar-header h2 {
    font-size: 1.3rem;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    margin-bottom: 16px;
}
.user-badge .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
}
.user-badge .user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.user-badge .username {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-badge .user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.wallet-badge {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: radial-gradient(circle at top right, rgba(251, 191, 36, 0.08), rgba(251, 191, 36, 0.01));
    border: 1px solid rgba(251, 191, 36, 0.15);
    border-radius: var(--border-radius-md);
    margin-bottom: 24px;
    cursor: pointer;
    transition: var(--transition-bounce);
}
.wallet-badge:hover {
    transform: scale(1.03);
    border-color: var(--accent-gold);
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.1);
}
.wallet-badge .coin-icon {
    font-size: 1.6rem;
    color: var(--accent-gold);
    animation: rotate-coin 8s linear infinite;
}
.wallet-badge .wallet-info {
    display: flex;
    flex-direction: column;
}
.wallet-badge .balance {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--accent-gold);
}
.wallet-badge .label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition-smooth);
}
.nav-item i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}
.nav-item:hover, .nav-item.active {
    background: rgba(138, 92, 245, 0.08);
    color: var(--text-primary);
}
.nav-item.active i {
    color: var(--accent-purple);
}

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

/* Main Content Area */
#main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Prevents flex items from breaking grid widths */
}

/* App Header */
#app-header {
    height: 72px;
    border-bottom: 1px solid var(--border-color);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(7, 9, 14, 0.8);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 5;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
#menu-toggle-btn {
    display: none;
}
#view-title {
    font-size: 1.5rem;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.space-selector-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #111424;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    font-size: 0.9rem;
}
.space-selector-container i {
    color: var(--accent-cyan);
}

#view-container {
    position: relative;
    padding: 32px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Loading Spinner */
#loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
}
.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(138, 92, 245, 0.1);
    border-top-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

/* ==========================================================================
   AUTHENTICATION VIEW (WELCOME)
   ========================================================================== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 10% 20%, rgba(138, 92, 245, 0.15) 0%, rgba(7, 9, 14, 0) 40%),
                radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.15) 0%, rgba(7, 9, 14, 0) 40%);
    padding: 24px;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    background: rgba(14, 17, 29, 0.65);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md), var(--shadow-glow);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    animation: slide-up 0.5s ease-out;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}
.auth-logo {
    font-size: 3rem;
    margin-bottom: 16px;
    display: inline-block;
    animation: float 4s ease-in-out infinite;
}
.auth-header h2 {
    font-size: 1.8rem;
    margin-bottom: 8px;
}
.auth-header p {
    font-size: 0.9rem;
}

.auth-tabs {
    display: flex;
    background: #090b12;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 4px;
    margin-bottom: 24px;
}
.auth-tab {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
}
.auth-tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.error-banner {
    padding: 12px 16px;
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.45);
    border-radius: var(--border-radius-md);
    color: #fda4af;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ==========================================================================
   SPACE CREATION VIEW (DASHBOARD)
   ========================================================================== */
.space-setup-card {
    max-width: 500px;
    margin: 40px auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-md);
    text-align: center;
}
.space-setup-card i {
    font-size: 3rem;
    color: var(--accent-cyan);
    margin-bottom: 24px;
}
.space-setup-card h2 {
    margin-bottom: 12px;
}
.space-setup-card p {
    margin-bottom: 32px;
}

/* ==========================================================================
   TASK BOARD (GILDENBOARD)
   ========================================================================== */
.board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.board-columns {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    flex-grow: 1;
}

.board-column {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    display: flex;
    flex-direction: column;
    padding: 16px;
    min-height: 500px;
}

.column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}
.column-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.column-title .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.column-title.open .dot { background: var(--accent-cyan); }
.column-title.claimed .dot { background: var(--accent-purple); }
.column-title.submitted .dot { background: var(--accent-gold); }
.column-title.completed .dot { background: var(--accent-green); }

.column-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.04);
    padding: 2px 8px;
    border-radius: 12px;
}

.column-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex-grow: 1;
    overflow-y: auto;
    max-height: calc(100vh - 280px);
}

/* Task Cards */
.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-bounce);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.task-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    transition: var(--transition-smooth);
}
.task-card.open-state::before { background: var(--accent-cyan); }
.task-card.claimed-state::before { background: var(--accent-purple); }
.task-card.submitted-state::before { background: var(--accent-gold); }
.task-card.completed-state::before { background: var(--accent-green); }

.task-card.open-state { border-color: rgba(6, 182, 212, 0.15); }
.task-card.claimed-state { border-color: rgba(139, 92, 246, 0.15); }
.task-card.submitted-state { border-color: rgba(251, 191, 36, 0.15); }
.task-card.completed-state {
    border-color: rgba(16, 185, 129, 0.15);
    opacity: 0.85;
}

.task-card:hover {
    transform: translateY(-4px) scale(1.02);
    background: var(--bg-card-hover);
    border-color: var(--border-color-glow);
    box-shadow: var(--shadow-md), 0 4px 15px rgba(138, 92, 245, 0.15);
}

.task-title {
    font-size: 1.05rem;
    font-weight: 600;
}
.task-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.task-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    margin-top: 4px;
}

.reward-tags {
    display: flex;
    gap: 8px;
}
.reward-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
}
.reward-tag.base {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-cyan);
}
.reward-tag.bounty {
    background: rgba(251, 191, 36, 0.15);
    color: var(--accent-gold);
    border: 1px solid rgba(251, 191, 36, 0.2);
    animation: pulse-border 2s infinite alternate;
}

.assignee-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.assignee-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-purple);
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.task-card-footer {
    display: flex;
    gap: 8px;
    width: 100%;
}
.task-card-footer .btn {
    flex-grow: 1;
    padding: 8px 12px;
    font-size: 0.85rem;
}

/* ==========================================================================
   ROUTINES VIEW
   ========================================================================== */
.routines-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.date-navigation {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #111424;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 6px 12px;
}
.date-label {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
}

.routine-row-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 24px;
    margin-bottom: 16px;
    transition: var(--transition-smooth);
}
.routine-row-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color-glow);
}
.routine-row-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-grow: 1;
}

.routine-checkbox {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-bounce);
    color: transparent;
    flex-shrink: 0;
}
.routine-checkbox:hover {
    border-color: var(--accent-purple);
    color: var(--accent-purple-glow);
}
.routine-row-item.completed .routine-checkbox {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: #fff;
}
.routine-row-item.completed {
    border-color: rgba(16, 185, 129, 0.2);
    background: rgba(16, 185, 129, 0.02);
}
.routine-row-item.completed .routine-checkbox::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.85rem;
}

.routine-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.routine-title {
    font-size: 1.1rem;
    font-weight: 600;
}
.routine-row-item.completed .routine-title {
    text-decoration: line-through;
    color: var(--text-muted);
}
.routine-category-badge {
    align-self: flex-start;
    font-size: 0.75rem;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    color: var(--text-muted);
}

.routine-row-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ==========================================================================
   WALLET & LEDGER VIEW
   ========================================================================== */
.wallet-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 32px;
}

.wallet-balance-card {
    background: radial-gradient(circle at top right, rgba(251, 191, 36, 0.12), rgba(14, 17, 29, 0));
    border: 1px solid rgba(251, 191, 36, 0.2);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    border-radius: var(--border-radius-lg);
    padding: 32px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: fit-content;
}
.wallet-balance-card i {
    font-size: 3.5rem;
    color: var(--accent-gold);
    margin-bottom: 20px;
    animation: rotate-coin 6s linear infinite;
}
.wallet-balance-card h3 {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.wallet-balance-card .balance-amount {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 3rem;
    color: var(--accent-gold);
    text-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
}

.ledger-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 32px;
    display: flex;
    flex-direction: column;
}
.ledger-card h3 {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ledger-card h3 i {
    color: var(--accent-purple);
}

.ledger-table-container {
    overflow-x: auto;
}

.ledger-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ledger-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    transition: var(--transition-smooth);
}
.ledger-row:hover {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.1);
}
.ledger-row-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ledger-row-desc {
    font-weight: 600;
    font-size: 0.95rem;
}
.ledger-row-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.ledger-row-amount {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.15rem;
}
.ledger-row-amount.positive {
    color: var(--accent-green);
}
.ledger-row-amount.negative {
    color: var(--accent-rose);
}

/* ==========================================================================
   MEMBERS VIEW
   ========================================================================== */
.members-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 32px;
}
.members-list-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 32px;
}
.members-list-card h3 {
    margin-bottom: 24px;
}
.member-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-smooth);
}
.member-list-item:last-child {
    border-bottom: none;
}
.member-list-item:hover {
    background: rgba(255, 255, 255, 0.02);
}
.member-item-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.member-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 1.1rem;
}
.member-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.member-name {
    font-weight: 600;
    font-size: 1rem;
}
.member-role-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.member-status {
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(138, 92, 245, 0.1);
    color: var(--accent-purple);
    font-weight: 600;
}

.invite-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 32px;
    height: fit-content;
}
.invite-card h3 {
    margin-bottom: 12px;
}
.invite-card p {
    margin-bottom: 24px;
}

/* ==========================================================================
   MODAL WINDOWS
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-smooth);
}
.modal-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    width: 100%;
    max-width: 500px;
    background: var(--bg-card);
    border: 1px solid var(--border-color-glow);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md), var(--shadow-glow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    transition: var(--transition-bounce);
}
.modal-overlay:not(.hidden) .modal-card {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-color);
}
.modal-body {
    padding: 32px;
}

/* ==========================================================================
   COIN SHOWER / PARTICLE EFFECTS
   ========================================================================== */
#coin-shower-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.coin-particle {
    position: absolute;
    width: 24px;
    height: 24px;
    background: radial-gradient(circle at 35% 35%, #ffe066, var(--accent-gold));
    border-radius: 50%;
    border: 1px solid #d97706;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3), inset 0 2px 2px rgba(255,255,255,0.4);
    animation: fall linear forwards;
}

/* ==========================================================================
   KEYFRAME ANIMATIONS
   ========================================================================== */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes rotate-coin {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

@keyframes fall {
    0% {
        transform: translateY(-50px) rotate(0deg);
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(105vh) rotate(720deg);
        opacity: 0;
    }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes slide-up {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

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

@keyframes pulse-border {
    0% { border-color: rgba(251, 191, 36, 0.15); box-shadow: 0 0 0 rgba(251, 191, 36, 0); }
    100% { border-color: var(--accent-gold); box-shadow: 0 0 10px rgba(251, 191, 36, 0.2); }
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 1024px) {
    .board-columns {
        grid-template-columns: repeat(2, 1fr);
    }
    .wallet-grid {
        grid-template-columns: 1fr;
    }
    .members-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        left: calc(-1 * var(--sidebar-width));
        top: 0;
        bottom: 0;
        z-index: 200;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }
    #sidebar.open {
        left: 0;
    }
    #app:has(#sidebar.open)::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 150;
    }
    #app-header {
        z-index: 201;
        padding: 0 16px;
    }
    #menu-toggle-btn {
        display: flex;
    }
    .board-columns {
        grid-template-columns: 1fr;
    }
    #view-container {
        padding: 16px;
    }
}
