:root {
    /* Brand Palette - Deep Space & Vibrancy */
    --primary: #6366f1; /* Indigo 500 */
    --primary-hover: #4f46e5; /* Indigo 600 */
    --primary-light: #e0e7ff; /* Indigo 100 */
    
    --secondary: #ec4899; /* Pink 500 */
    
    --bg-body: #f8fafc; /* Slate 50 */
    --bg-surface: #ffffff;
    
    --text-main: #1e293b; /* Slate 800 */
    --text-muted: #64748b; /* Slate 500 */
    --text-light: #94a3b8; /* Slate 400 */
    
    --border-color: #e2e8f0; /* Slate 200 */
    
    /* Functional */
    --success: #10b981; /* Emerald 500 */
    --success-bg: #d1fae5;
    --danger: #ef4444; /* Red 500 */
    --danger-bg: #fee2e2;
    --warning: #f59e0b; /* Amber 500 */
    --warning-bg: #fef3c7;
    
    /* Design Tokens */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    --header-height: 70px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

#root {
    min-height: 100vh;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5em;
    letter-spacing: -0.025em;
}

p {
    margin-bottom: 1em;
}

/* --- Layout --- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Prevent overflow */
    background: var(--bg-body);
}

.content-wrapper {
    padding: 32px;
    flex: 1;
    overflow-y: auto;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* --- Navbar --- */
.navbar {
    height: var(--header-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    height: 36px;
    border-radius: var(--radius-sm);
}

.brand-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 24px;
}

.user-info {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* --- Sidebar --- */
.sidebar {
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-normal);
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 20;
    padding: 24px 16px;
}

.sidebar.expanded {
    width: var(--sidebar-width);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    margin-bottom: 32px;
    margin-left: auto;
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--bg-body);
    color: var(--primary);
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
}

.menu-item:hover {
    background-color: var(--bg-body);
    color: var(--text-main);
}

.menu-item.active {
    background-color: var(--primary-light);
    color: var(--primary);
}

.menu-icon {
    font-size: 1.1rem;
    min-width: 24px;
    display: flex;
    justify-content: center;
    margin-right: 12px;
}

.collapsed .menu-icon {
    margin-right: 0;
}

.menu-label {
    opacity: 1;
    transition: opacity var(--transition-fast);
}

.collapsed .menu-label {
    opacity: 0;
    width: 0;
    display: none;
}

/* --- Components --- */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
    transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    gap: 8px;
}

.btn:focus {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(99, 102, 241, 0.5);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.btn-danger:hover {
    background: #fee2e2; /* slightly darker tint if needed */
    filter: brightness(0.95);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--bg-body);
    border-color: var(--text-muted);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    transition: all var(--transition-fast);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

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

/* Tables */
.table-container {
    overflow-x: auto;
}

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

.table th {
    text-align: left;
    padding: 16px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

.table tr:last-child td {
    border-bottom: none;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-neutral { background: var(--bg-body); color: var(--text-muted); }

/* Login Page */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, #e0e7ff, #f8fafc 40%);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 48px;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.error-message {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    font-size: 0.9rem;
    text-align: center;
}

/* Widgets specialized */
.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.widget-balance {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: var(--shadow-md);
}

.list-item {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

.list-item:hover {
    background: var(--bg-body);
}

.list-item:last-child {
    border-bottom: none;
}