:root {
    /* Color Palette */
    --bg-base: #f4f6f8;
    --bg-surface: #ffffff;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #e2e8f0;

    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);

    /* Spacing & Layout */
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    
    /* Typography */
    --font-family: 'Inter', sans-serif;
}

/* Dark Mode Support (System Preference) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-base: #0f172a;
        --bg-surface: #1e293b;
        --text-primary: #f8fafc;
        --text-secondary: #cbd5e1;
        --border: #334155;
        --glass-bg: rgba(30, 41, 59, 0.7);
        --glass-border: rgba(255, 255, 255, 0.1);
        --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    }
}

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

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

/* App Container */
.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--spacing-md);
    min-height: 100vh;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Typography */
h2, h3 {
    color: var(--text-primary);
    font-weight: 600;
}
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-secondary { color: var(--text-secondary); }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }

/* Flex Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: var(--spacing-sm); }
.gap-4 { gap: var(--spacing-md); }

/* Spacing Utilities */
.mt-2 { margin-top: var(--spacing-sm); }
.mt-4 { margin-top: var(--spacing-md); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-4 { margin-bottom: var(--spacing-md); }
.p-4 { padding: var(--spacing-md); }

/* Card Style (Glassmorphism) */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.15);
}

@media (prefers-color-scheme: dark) {
    .card:hover {
        box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

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

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

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

.btn-outline:hover {
    background-color: var(--bg-surface);
}

.btn-danger {
    background-color: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}
.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

.btn-block {
    width: 100%;
}

.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}
.icon-btn:hover {
    background: var(--bg-base);
    color: var(--text-primary);
}
.icon-btn.danger:hover {
    color: var(--danger);
}

/* Inputs */
.input {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-warning { background-color: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-success { background-color: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-primary { background-color: rgba(59, 130, 246, 0.15); color: var(--primary); }

/* Tabs */
.tabs {
    display: flex;
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 4px;
    margin-bottom: var(--spacing-md);
    border: 1px solid var(--border);
}

.tab {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab.active {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

/* Line Items */
.line-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.line-item:last-child {
    border-bottom: none;
}
.line-item-desc {
    flex: 1;
    font-weight: 500;
}
.line-item-amount {
    font-weight: 600;
    margin: 0 12px;
}

/* Photo Gallery */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1));
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.photo-card {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 1;
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-tag {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 500;
}

.photo-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(239, 68, 68, 0.8);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* File Input Wrapper */
.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}

.file-input-wrapper input[type=file] {
    font-size: 100px;
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    cursor: pointer;
    height: 100%;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Layout helpers for specific views */
.project-header {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.summary-card {
    background: linear-gradient(135deg, var(--bg-surface), var(--bg-base));
}
