:root {
    --sidebar-bg: #0f2347;
    --sidebar-w: 250px;
    --sidebar-w-collapsed: 60px;
    --topbar-h: 60px;
    --primary: #2563eb;
    --primary-light: #dbeafe;
    --danger: #dc2626;
    --warning: #d97706;
    --success: #16a34a;
    --muted: #64748b;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: #f8fafc; color: #1e293b; font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ──────────────────────────────────────── */
.app-wrapper { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
    width: var(--sidebar-w); min-height: 100vh; background: var(--sidebar-bg);
    display: flex; flex-direction: column; flex-shrink: 0; transition: width 0.2s;
    overflow-y: auto; overflow-x: hidden; z-index: 100;
}

.sidebar-header {
    display: flex; align-items: center; padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1); min-height: var(--topbar-h);
}
.sidebar-logo { background: var(--primary); width: 32px; height: 32px; min-width: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: white; }
.sidebar-brand { margin-left: 12px; white-space: nowrap; overflow: hidden; }
.sidebar-brand h1 { margin: 0; font-size: 15px; color: white; font-weight: 700; }
.sidebar-brand small { color: #93c5fd; font-size: 11px; }

.sidebar-nav { flex: 1; padding: 4px 0; }
.nav-separator { margin: 4px 12px; border-top: 1px solid rgba(255,255,255,0.08); }
.nav-item {
    display: flex; align-items: center; padding: 8px 16px; color: #bfdbfe;
    border-left: 3px solid transparent; transition: all 0.15s; white-space: nowrap; font-size: 13px;
}
.nav-item:hover { background: rgba(255,255,255,0.1); text-decoration: none; color: white; }
.nav-item.active { background: rgba(37,99,235,0.25); border-left-color: var(--primary); color: white; }
.nav-item i { width: 18px; font-size: 14px; flex-shrink: 0; }
.nav-item span { margin-left: 12px; }

.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; background: white; border-bottom: 1px solid #e2e8f0;
    min-height: var(--topbar-h); flex-shrink: 0; z-index: 200;
}
.topbar-date { color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-btn {
    border: none; background: none; border-radius: 8px; padding: 8px;
    cursor: pointer; color: #475569; display: flex; align-items: center; gap: 6px;
}
.topbar-btn:hover { background: #f1f5f9; }
.avatar {
    width: 32px; height: 32px; min-width: 32px; border-radius: 50%;
    background: var(--primary); color: white; display: flex; align-items: center;
    justify-content: center; font-size: 12px; font-weight: 700;
}

.page-content { flex: 1; overflow-y: auto; padding: 20px; }

/* ── Cards & Stat Cards ──────────────────────────── */
.card { background: white; border-radius: 10px; border: 1px solid #e2e8f0; padding: 20px; margin-bottom: 16px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-header h2 { margin: 0; font-size: 16px; font-weight: 600; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: white; border-radius: 10px; border: 1px solid #e2e8f0; padding: 16px; display: flex; align-items: center; gap: 14px; }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.stat-info h3 { margin: 0; font-size: 22px; font-weight: 700; }
.stat-info p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

/* ── Tables ──────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { padding: 10px 12px; text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid #e2e8f0; white-space: nowrap; }
tbody td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tbody tr:hover { background: #f8fafc; }

/* ── Badges ──────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-purple { background: #ede9fe; color: #6d28d9; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-cyan { background: #cffafe; color: #0e7490; }

/* ── Buttons ─────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; border: 1px solid transparent; cursor: pointer; transition: all 0.15s; text-decoration: none; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: #1d4ed8; color: white; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; color: white; }
.btn-outline { background: white; color: #374151; border-color: #d1d5db; }
.btn-outline:hover { background: #f9fafb; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 6px; width: 32px; height: 32px; justify-content: center; }
.btn-light { background: rgba(255,255,255,0.1); color: white; border-color: rgba(255,255,255,0.4); }
.btn-light:hover { background: rgba(255,255,255,0.2); color: white; }

/* ── Forms ────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 4px; font-weight: 500; font-size: 13px; color: #374151; }
.form-control { width: 100%; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 13px; outline: none; transition: border 0.15s; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-text { font-size: 11px; color: var(--muted); margin-top: 2px; }
.text-danger { color: var(--danger); font-size: 12px; }
.field-validation-error { color: var(--danger); font-size: 12px; }

/* ── Page Headers ────────────────────────────────── */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.page-header h1 { margin: 0; font-size: 22px; font-weight: 700; }
.breadcrumb { display: flex; gap: 6px; font-size: 12px; color: var(--muted); margin: 0; padding: 0; list-style: none; }
.breadcrumb a { color: var(--primary); }
.breadcrumb li + li::before { content: '/'; margin-right: 6px; color: #cbd5e1; }

/* ── Filters ─────────────────────────────────────── */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; align-items: end; }
.filter-bar .form-group { margin-bottom: 0; }
.filter-bar .form-control { min-width: 160px; }

/* ── Pagination ──────────────────────────────────── */
.pagination { display: flex; gap: 4px; list-style: none; padding: 0; margin: 16px 0 0; justify-content: center; }
.pagination li a, .pagination li span { display: block; padding: 6px 12px; border-radius: 6px; font-size: 13px; border: 1px solid #e2e8f0; color: #374151; }
.pagination li a:hover { background: #f1f5f9; text-decoration: none; }
.pagination li.active span { background: var(--primary); color: white; border-color: var(--primary); }
.pagination li.disabled span { color: #cbd5e1; cursor: default; }

/* ── Detail sections ─────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-item label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; display: block; }
.detail-item p { margin: 0; font-size: 14px; font-weight: 500; }

.tab-nav { display: flex; border-bottom: 2px solid #e2e8f0; margin-bottom: 16px; gap: 0; }
.tab-nav a { padding: 10px 20px; font-size: 13px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab-nav a:hover { color: #1e293b; text-decoration: none; }
.tab-nav a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Kanban ──────────────────────────────────────── */
.kanban-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px; min-height: 400px; }
.kanban-column { min-width: 280px; max-width: 320px; flex-shrink: 0; background: #f8fafc; border-radius: 10px; padding: 12px; }
.kanban-column-header { font-weight: 600; font-size: 13px; padding: 8px; border-radius: 6px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.kanban-card { background: white; border-radius: 8px; padding: 12px; margin-bottom: 8px; border: 1px solid #e2e8f0; cursor: pointer; }
.kanban-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

/* ── Utilities ───────────────────────────────────── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }
.hidden { display: none; }
.currency::before { content: '₹'; }

/* ── Login ───────────────────────────────────────── */
.login-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f2347, #1e40af); }
.login-card { background: white; border-radius: 16px; padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-card h1 { text-align: center; margin: 0 0 8px; font-size: 22px; }
.login-card p.subtitle { text-align: center; color: var(--muted); margin: 0 0 24px; font-size: 13px; }
.login-card .logo { text-align: center; margin-bottom: 24px; }
.login-card .logo .icon { background: var(--primary); color: white; width: 56px; height: 56px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 24px; }
.login-error { background: #fee2e2; color: #b91c1c; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 768px) {
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .sidebar { display: none; }
}
