/* Cost SaaS - Design System */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #252542;
    --bg-card: rgba(26, 26, 46, 0.8);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: rgba(99, 102, 241, 0.15);
    --border-color-light: rgba(99, 102, 241, 0.3);
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: var(--font-sans); background: var(--bg-primary); color: var(--text-primary); line-height: 1.6; min-height: 100vh; }
body::before { content: ''; position: fixed; inset: 0; background: radial-gradient(ellipse at top, rgba(99, 102, 241, 0.1) 0%, transparent 50%), radial-gradient(ellipse at bottom right, rgba(14, 165, 233, 0.08) 0%, transparent 50%); pointer-events: none; z-index: -1; }

a { color: var(--primary-light); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--primary); }

/* Layout */
.app-container { display: flex; min-height: 100vh; }
.main-content { flex: 1; margin-left: 260px; padding: var(--spacing-xl); transition: margin var(--transition-base); }
@media (max-width: 1024px) { .main-content { margin-left: 0; } }

.content-grid { display: grid; gap: var(--spacing-lg); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.page-header { margin-bottom: var(--spacing-xl); }
.page-header h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: var(--spacing-xs); }
.page-header p { color: var(--text-muted); }

/* Topbar */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--spacing-xl); padding: var(--spacing-md) 0; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: var(--spacing-md); }
.mobile-menu-btn { display: none; padding: var(--spacing-sm); background: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: var(--radius-md); color: var(--text-secondary); cursor: pointer; }
@media (max-width: 1024px) { .mobile-menu-btn { display: flex; } }

/* Cards */
.card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-xl); backdrop-filter: blur(10px); overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: var(--spacing-lg); border-bottom: 1px solid var(--border-color); }
.card-title { font-size: 1rem; font-weight: 600; }
.card-body { padding: var(--spacing-lg); }

.stat-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-xl); padding: var(--spacing-lg); transition: all var(--transition-base); }
.stat-card:hover { border-color: var(--border-color-light); transform: translateY(-2px); }
.stat-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--spacing-md); }
.stat-card-icon { width: 40px; height: 40px; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; }
.stat-card-icon.primary { background: rgba(99, 102, 241, 0.15); color: var(--primary); }
.stat-card-icon.success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.stat-card-icon.warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.stat-card-icon.secondary { background: rgba(14, 165, 233, 0.15); color: var(--secondary); }
.stat-card-value { font-size: 1.75rem; font-weight: 700; margin-bottom: var(--spacing-xs); }
.stat-card-label { font-size: 0.875rem; color: var(--text-muted); }
.stat-card-change { font-size: 0.75rem; margin-top: var(--spacing-sm); }
.stat-card-change.positive { color: var(--success); }
.stat-card-change.negative { color: var(--danger); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--spacing-sm); padding: 0.625rem 1.25rem; font-size: 0.875rem; font-weight: 500; border: none; border-radius: var(--radius-lg); cursor: pointer; transition: all var(--transition-fast); white-space: nowrap; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-secondary:hover:not(:disabled) { border-color: var(--border-color-light); background: rgba(99, 102, 241, 0.1); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.btn-block { width: 100%; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.875rem 1.75rem; font-size: 1rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; }

/* Forms */
.form-group { margin-bottom: var(--spacing-md); }
.form-label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: var(--spacing-xs); color: var(--text-secondary); }
.form-input, .form-select, .form-textarea { width: 100%; padding: 0.75rem 1rem; font-size: 0.875rem; background: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: var(--radius-lg); color: var(--text-primary); transition: all var(--transition-fast); }
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); }
.form-input::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: var(--spacing-xs); }
.form-checkbox { display: flex; align-items: center; gap: var(--spacing-sm); font-size: 0.875rem; color: var(--text-secondary); cursor: pointer; }
.form-checkbox input { width: 16px; height: 16px; accent-color: var(--primary); }
.input-group { display: flex; gap: var(--spacing-sm); }
.input-group .form-input { flex: 1; }

/* Tables */
.table-container { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: var(--spacing-md); text-align: left; border-bottom: 1px solid var(--border-color); }
.table th { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; color: var(--text-muted); background: var(--bg-tertiary); }
.table tr:hover { background: rgba(99, 102, 241, 0.05); }

/* Badge */
.badge { display: inline-flex; align-items: center; padding: 0.25rem 0.625rem; font-size: 0.75rem; font-weight: 500; border-radius: var(--radius-full); }
.badge-primary { background: rgba(99, 102, 241, 0.15); color: var(--primary-light); }
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; visibility: hidden; transition: all var(--transition-base); }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-xl); width: 90%; max-width: 500px; max-height: 90vh; overflow: auto; transform: scale(0.9); transition: transform var(--transition-base); }
.modal-overlay.active .modal { transform: scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: var(--spacing-lg); border-bottom: 1px solid var(--border-color); }
.modal-title { font-size: 1.125rem; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: var(--spacing-xs); }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: var(--spacing-lg); }
.modal-footer { display: flex; justify-content: flex-end; gap: var(--spacing-sm); padding: var(--spacing-lg); border-top: 1px solid var(--border-color); }

/* Empty State */
.empty-state { text-align: center; padding: var(--spacing-xl) * 2; }
.empty-state-icon { width: 64px; height: 64px; margin: 0 auto var(--spacing-lg); background: var(--bg-tertiary); border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.empty-state h3 { font-size: 1.125rem; margin-bottom: var(--spacing-sm); }
.empty-state p { color: var(--text-muted); margin-bottom: var(--spacing-lg); }

/* Toast */
.toast-container { position: fixed; bottom: var(--spacing-lg); right: var(--spacing-lg); z-index: 1100; display: flex; flex-direction: column; gap: var(--spacing-sm); }
.toast { padding: var(--spacing-md) var(--spacing-lg); background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-lg); color: var(--text-primary); animation: slideUp 0.3s ease; }
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

/* Loader */
.loader { width: 20px; height: 20px; border: 2px solid var(--border-color); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Utilities */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.875rem; }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.stagger-item { animation: slideUp 0.4s ease backwards; }
.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }

/* Project Grid */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.project-card {
    background: var(--card-bg, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.project-card:hover {
    border-color: var(--primary, #6366f1);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.15);
}

.project-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.project-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary, #6366f1), #8b5cf6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.project-header .btn-icon {
    margin-left: auto;
}

.project-header .btn-icon:first-of-type {
    margin-left: auto;
}

.project-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary, #f1f5f9);
    margin: 0 0 0.25rem 0;
}

.project-code {
    font-size: 0.75rem;
    color: var(--text-muted, #64748b);
    font-family: monospace;
    background: var(--bg-secondary, #0f172a);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 0.75rem;
}

.project-description {
    font-size: 0.875rem;
    color: var(--text-secondary, #94a3b8);
    margin: 0 0 1rem 0;
    line-height: 1.5;
    min-height: 2.5rem;
}

.project-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.project-meta-item {
    font-size: 0.75rem;
    color: var(--text-muted, #64748b);
    background: var(--bg-secondary, #0f172a);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

/* Badge */
.badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-weight: 500;
}

.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

/* Modal */
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--card-bg, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color, #334155);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary, #f1f5f9);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary, #f1f5f9);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color, #334155);
}

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

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary, #94a3b8);
    margin-bottom: 0.5rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary, #0f172a);
    border: 1px solid var(--border-color, #334155);
    border-radius: 8px;
    color: var(--text-primary, #f1f5f9);
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary, #6366f1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted, #64748b);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    background: var(--bg-secondary, #0f172a);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: var(--text-muted, #64748b);
}

.empty-state h3 {
    font-size: 1.25rem;
    color: var(--text-primary, #f1f5f9);
    margin: 0 0 0.5rem 0;
}

.empty-state p {
    color: var(--text-secondary, #94a3b8);
    margin: 0 0 1.5rem 0;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    color: white;
    font-size: 0.875rem;
    animation: slideIn 0.3s ease;
}

.toast-success {
    background: #22c55e;
}

.toast-error {
    background: #ef4444;
}

.toast-info {
    background: #3b82f6;
}

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

/* Utility */
.mt-md {
    margin-top: 1rem;
}

.btn-icon {
    padding: 0.5rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Project Action Buttons */
.project-actions .btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--text-muted, #64748b);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}
.project-actions .btn-icon:hover {
    color: var(--text-primary, #f1f5f9);
    background: var(--bg-tertiary, #0f172a);
}
.project-actions .btn-icon svg {
    width: 16px;
    height: 16px;
}

/* Table Action Buttons */
.btn-ghost svg {
    display: block;
    width: 16px;
    height: 16px;
}
.flex.gap-sm {
    display: flex;
    gap: 8px;
}

/* Global icon button styles */
.btn-icon svg, .btn.btn-icon svg {
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
}
.btn-ghost.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
