/* ================================================
   ClientFlow Pro — Premium Corporate Design System
   ================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

:root {
  --bg: #F1F5F9;
  --bg-white: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-sidebar: #0F172A;
  --bg-sidebar-hover: #1E293B;
  --fg: #1E293B;
  --fg-secondary: #64748B;
  --fg-muted: #94A3B8;
  --fg-light: #CBD5E1;
  --primary: #0EA5E9;
  --primary-dark: #0284C7;
  --primary-light: #E0F2FE;
  --primary-glow: rgba(14,165,233,0.15);
  --accent: #6366F1;
  --accent-light: #EEF2FF;
  --success: #10B981;
  --success-light: #D1FAE5;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --sidebar-width: 260px;
  --header-height: 70px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--bg); color: var(--fg); min-height: 100vh; line-height: 1.6; -webkit-font-smoothing: antialiased; }

/* ---- LOGIN PAGE ---- */
.login-wrapper { display: flex; min-height: 100vh; }
.login-brand { flex: 1; background: linear-gradient(135deg, #0F172A 0%, #1E3A5F 50%, #0EA5E9 100%); display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 60px; color: white; position: relative; overflow: hidden; }
.login-brand::before { content: ''; position: absolute; width: 500px; height: 500px; border-radius: 50%; background: rgba(14,165,233,0.1); top: -100px; right: -100px; }
.login-brand::after { content: ''; position: absolute; width: 300px; height: 300px; border-radius: 50%; background: rgba(99,102,241,0.08); bottom: -50px; left: -50px; }
.login-brand h1 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 42px; font-weight: 800; letter-spacing: -1px; margin-bottom: 16px; position: relative; z-index: 1; }
.login-brand p { font-size: 18px; opacity: 0.8; max-width: 400px; text-align: center; line-height: 1.7; position: relative; z-index: 1; }
.login-brand .brand-icon { width: 80px; height: 80px; background: rgba(255,255,255,0.1); border-radius: 20px; display: flex; align-items: center; justify-content: center; font-size: 36px; margin-bottom: 30px; backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.1); position: relative; z-index: 1; }
.login-form-side { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--bg-white); }
.login-box { width: 100%; max-width: 420px; }
.login-box h2 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 28px; font-weight: 700; color: var(--fg); margin-bottom: 8px; }
.login-box .login-sub { color: var(--fg-secondary); font-size: 15px; margin-bottom: 32px; }
.login-box .form-group { margin-bottom: 20px; }
.login-box label { display: block; font-size: 13px; font-weight: 600; color: var(--fg); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.login-box input[type="text"], .login-box input[type="password"] { width: 100%; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 15px; font-family: inherit; background: var(--bg); color: var(--fg); transition: all 0.2s; }
.login-box input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); background: white; }
.login-box .btn-login { width: 100%; padding: 14px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; border: none; border-radius: var(--radius); font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.3s; font-family: inherit; }
.login-box .btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(14,165,233,0.35); }
.error-msg { background: var(--danger-light); color: var(--danger); padding: 12px 16px; border-radius: var(--radius); font-size: 14px; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; border: 1px solid rgba(239,68,68,0.2); }

/* ---- LAYOUT ---- */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); background: var(--bg-sidebar); color: white; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; display: flex; flex-direction: column; transition: transform 0.3s ease; }
.sidebar-brand { padding: 24px 24px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-brand h2 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 20px; font-weight: 700; letter-spacing: -0.5px; display: flex; align-items: center; gap: 12px; }
.sidebar-brand .brand-dot { width: 32px; height: 32px; background: linear-gradient(135deg, var(--primary), var(--accent)); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.sidebar-brand small { display: block; font-size: 12px; color: var(--fg-muted); margin-top: 4px; }
.sidebar-nav { flex: 1; padding: 16px 12px; }
.nav-item { display: flex; align-items: center; gap: 14px; padding: 12px 16px; color: var(--fg-light); text-decoration: none; font-size: 14px; font-weight: 500; border-radius: 10px; margin-bottom: 4px; transition: all 0.2s; }
.nav-item i { width: 20px; text-align: center; font-size: 16px; }
.nav-item:hover { color: white; background: var(--bg-sidebar-hover); }
.nav-item.active { color: white; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); box-shadow: 0 4px 12px rgba(14,165,233,0.3); }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-footer .user-info { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.sidebar-footer .user-avatar { width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary), var(--accent)); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.sidebar-footer .user-name { font-size: 14px; font-weight: 600; }
.sidebar-footer .user-role { font-size: 11px; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.sidebar-footer .btn-logout { display: flex; align-items: center; gap: 8px; padding: 10px 14px; color: var(--fg-muted); text-decoration: none; font-size: 13px; border-radius: 8px; transition: all 0.2s; width: 100%; }
.sidebar-footer .btn-logout:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

.main-content { flex: 1; margin-left: var(--sidebar-width); min-height: 100vh; }
.topbar { height: var(--header-height); background: var(--bg-white); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 32px; position: sticky; top: 0; z-index: 50; }
.topbar h1 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 22px; font-weight: 700; color: var(--fg); }
.topbar .breadcrumb { font-size: 13px; color: var(--fg-muted); }
.hamburger { display: none; background: none; border: none; font-size: 22px; color: var(--fg); cursor: pointer; }
.content-area { padding: 32px; }

/* ---- STATS ---- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-bottom: 32px; }
.stat-card { background: var(--bg-card); border-radius: var(--radius-lg); padding: 24px; border: 1px solid var(--border); box-shadow: var(--shadow); transition: all 0.3s; position: relative; overflow: hidden; }
.stat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.stat-card .stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 16px; }
.stat-card .stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-card .stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-card .stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-card .stat-icon.purple { background: var(--accent-light); color: var(--accent); }
.stat-card .stat-number { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 32px; font-weight: 800; color: var(--fg); line-height: 1; margin-bottom: 4px; }
.stat-card .stat-label { font-size: 13px; color: var(--fg-secondary); font-weight: 500; }

/* ---- CARDS ---- */
.card { background: var(--bg-card); border-radius: var(--radius-lg); padding: 28px; margin-bottom: 28px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.card-header h3 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 18px; font-weight: 700; color: var(--fg); display: flex; align-items: center; gap: 10px; }
.card-header h3 i { color: var(--primary); }

/* ---- FORMS ---- */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--fg); margin-bottom: 6px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 20px; }
input, select, textarea { width: 100%; padding: 12px 16px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 14px; font-family: 'Inter', sans-serif; color: var(--fg); background: var(--bg); transition: all 0.2s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); background: white; }
select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }

/* ---- BUTTONS ---- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; border-radius: var(--radius); font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer; border: none; transition: all 0.2s; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; }
.btn-primary:hover { box-shadow: 0 8px 25px rgba(14,165,233,0.3); transform: translateY(-1px); }
.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: 8px; }
.btn-outline { background: white; color: var(--fg); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: white; }
button { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; padding: 12px 24px; border: none; border-radius: var(--radius); cursor: pointer; font-weight: 600; font-size: 14px; font-family: inherit; transition: all 0.2s; display: inline-flex; align-items: center; gap: 8px; }
button:hover { box-shadow: 0 6px 20px rgba(14,165,233,0.3); transform: translateY(-1px); }

/* ---- TABLES ---- */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead th { background: var(--bg); color: var(--fg-secondary); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; padding: 14px 20px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 14px 20px; font-size: 14px; border-bottom: 1px solid var(--border-light); color: var(--fg); }
tbody tr:hover td { background: var(--primary-light); }
tbody tr:last-child td { border-bottom: none; }

/* ---- BADGES ---- */
.badge { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--primary-light); color: var(--primary); }
.badge-purple { background: var(--accent-light); color: var(--accent); }
.branch-badge { background: var(--accent-light); color: var(--accent); padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }

/* ---- FILTER BAR ---- */
.filter-bar { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; background: var(--bg); padding: 20px; border-radius: var(--radius); margin-bottom: 24px; border: 1px solid var(--border-light); }
.filter-bar > div { flex: 1; min-width: 150px; }
.filter-bar label { display: block; font-size: 12px; font-weight: 600; color: var(--fg-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ---- ALERTS ---- */
.msg-success { background: var(--success-light); color: #065F46; padding: 14px 18px; border-radius: var(--radius); margin-bottom: 20px; display: flex; align-items: center; gap: 10px; border: 1px solid rgba(16,185,129,0.2); font-size: 14px; }
.msg-warning { background: var(--warning-light); color: #92400E; padding: 14px 18px; border-radius: var(--radius); margin-bottom: 20px; display: flex; align-items: center; gap: 10px; border: 1px solid rgba(245,158,11,0.2); font-size: 14px; }
.msg-error { background: var(--danger-light); color: #991B1B; padding: 14px 18px; border-radius: var(--radius); margin-bottom: 20px; display: flex; align-items: center; gap: 10px; border: 1px solid rgba(239,68,68,0.2); font-size: 14px; }

/* ---- MODAL ---- */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,0.6); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 1000; }
.modal.active { display: flex; }
.modal-content { background: var(--bg-white); border-radius: var(--radius-xl); padding: 32px; width: 90%; max-width: 500px; box-shadow: var(--shadow-xl); animation: modalIn 0.3s ease; }
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-content h3 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 20px; font-weight: 700; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.close-modal { float: right; font-size: 24px; cursor: pointer; color: var(--fg-muted); background: none; border: none; padding: 0; box-shadow: none; }
.close-modal:hover { color: var(--fg); transform: none; box-shadow: none; }

/* ---- USER CARDS ---- */
.user-card { background: var(--bg); padding: 20px; border-radius: var(--radius); margin-bottom: 12px; border: 1px solid var(--border-light); transition: all 0.2s; }
.user-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }

/* ---- RESPONSIVE ---- */
.sidebar-overlay { display: none; }
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99; }
  .sidebar-overlay.active { display: block; }
  .main-content { margin-left: 0; }
  .hamburger { display: block; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .login-brand { display: none; }
  .login-form-side { padding: 24px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 16px; }
  .content-area { padding: 20px; }
  .topbar { padding: 0 20px; }
  .filter-bar { flex-direction: column; }
  .filter-bar > div { min-width: 100%; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card .stat-number { font-size: 28px; }
}
