@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #6366f1; --primary-dark: #4f46e5; --primary-light: #818cf8; --primary-glow: rgba(99,102,241,.15);
  --success: #10b981; --success-dark: #059669; --success-glow: rgba(16,185,129,.15);
  --danger: #ef4444; --danger-dark: #dc2626;
  --warning: #f59e0b; --warning-dark: #d97706;
  --gray-50: #f8fafc; --gray-100: #f1f5f9; --gray-200: #e2e8f0;
  --gray-300: #cbd5e1; --gray-400: #94a3b8; --gray-500: #64748b;
  --gray-600: #475569; --gray-700: #334155; --gray-800: #1e293b; --gray-900: #0f172a;
  --radius: 16px; --radius-sm: 10px; --radius-xs: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 2px 8px rgba(0,0,0,.06), 0 0 1px rgba(0,0,0,.1);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08), 0 0 1px rgba(0,0,0,.1);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.1), 0 0 1px rgba(0,0,0,.1);
  --shadow-xl: 0 24px 48px rgba(0,0,0,.12);
  --transition: all .25s cubic-bezier(.4,0,.2,1);
}
html { overflow-x: hidden; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #eef2f7; color: var(--gray-900); min-height: 100vh; overflow-x: hidden; -webkit-overflow-scrolling: touch; width: 100%; }
body::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 300px; background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%); z-index: -1; pointer-events: none; }
a { color: var(--primary); text-decoration: none; }

/* ===== LOGIN ===== */
.login-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%); position: relative; overflow: hidden; }
.login-container::before { content: ''; position: absolute; width: 500px; height: 500px; border-radius: 50%; background: radial-gradient(circle, rgba(99,102,241,.2) 0%, transparent 70%); top: -100px; right: -100px; }
.login-container::after { content: ''; position: absolute; width: 400px; height: 400px; border-radius: 50%; background: radial-gradient(circle, rgba(139,92,246,.15) 0%, transparent 70%); bottom: -80px; left: -80px; }
.login-box { background: rgba(255,255,255,.97); backdrop-filter: blur(20px); padding: 2.75rem; border-radius: var(--radius); box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,.1); width: 100%; max-width: 400px; margin: 0 1rem; position: relative; z-index: 1; }
.login-box h1 { font-size: 1.5rem; margin-bottom: 1.5rem; text-align: center; color: var(--primary); }

/* ===== TOP NAVBAR ===== */
.topbar { background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 60%, #312e81 100%); padding: 0; position: sticky; top: 0; z-index: 50; width: 100%; overflow: hidden; }
.topbar::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(129,140,248,.3), transparent); }
.topbar-inner { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 2rem; height: 68px; }
.topbar .logo { font-size: 1.15rem; font-weight: 800; color: #fff; display: flex; align-items: center; gap: .7rem; letter-spacing: -.02em; }
.topbar .logo-icon { width: 36px; height: 36px; background: linear-gradient(135deg, #818cf8, #6366f1, #4f46e5); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; box-shadow: 0 2px 8px rgba(99,102,241,.4); }
.topbar-nav { display: flex; gap: 3px; background: rgba(255,255,255,.06); border-radius: 12px; padding: 4px; flex-shrink: 1; min-width: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.topbar-nav::-webkit-scrollbar { display: none; }
.topbar-nav a { color: rgba(255,255,255,.55); font-size: .83rem; font-weight: 600; padding: .5rem 1.1rem; border-radius: var(--radius-xs); transition: var(--transition); display: flex; align-items: center; gap: .5rem; position: relative; white-space: nowrap; flex-shrink: 0; }
.topbar-nav a:hover { color: rgba(255,255,255,.9); background: rgba(255,255,255,.08); }
.topbar-nav a.active { color: #fff; background: rgba(255,255,255,.14); box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.topbar-nav .nav-icon { font-size: 1.05rem; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.topbar-right .user-info { color: rgba(255,255,255,.6); font-size: .83rem; }
.topbar-right .user-info strong { color: rgba(255,255,255,.9); }
.topbar-right .btn-logout { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); color: rgba(255,255,255,.7); padding: .45rem 1rem; border-radius: var(--radius-xs); font-size: .8rem; font-weight: 600; cursor: pointer; transition: var(--transition); }
.topbar-right .btn-logout:hover { background: rgba(239,68,68,.2); border-color: rgba(239,68,68,.3); color: #fca5a5; }

/* ===== MAIN CONTENT ===== */
.main-content { max-width: 1400px; margin: 0 auto; padding: 2rem 2rem 3rem; width: 100%; }

/* ===== PAGE HEADER ===== */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.75rem; }
.page-header h1 { font-size: 1.65rem; font-weight: 800; color: var(--gray-900); letter-spacing: -.03em; }
.page-header h1 a { color: var(--gray-400); transition: var(--transition); margin-right: .25rem; }
.page-header h1 a:hover { color: var(--primary); }

/* ===== STAT CARDS ===== */
.stats { display: grid; gap: 1rem; margin-bottom: 2rem; }
.stats-6 { grid-template-columns: repeat(6, 1fr); }
.stats-4 { grid-template-columns: repeat(4, 1fr); }
.stats-3 { grid-template-columns: repeat(3, 1fr); }
.stat-card { background: #fff; border-radius: var(--radius); padding: 1.35rem 1.5rem; box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,.8); transition: var(--transition); position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; border-radius: 3px 3px 0 0; transition: var(--transition); }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card:nth-child(1)::before { background: linear-gradient(90deg, #6366f1, #818cf8); }
.stat-card:nth-child(2)::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.stat-card:nth-child(3)::before { background: linear-gradient(90deg, #06b6d4, #22d3ee); }
.stat-card:nth-child(4)::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.stat-card:nth-child(5)::before { background: linear-gradient(90deg, #ef4444, #f87171); }
.stat-card:nth-child(6)::before { background: linear-gradient(90deg, #10b981, #34d399); }
.stat-card .label { font-size: .72rem; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: .08em; margin-bottom: .4rem; }
.stat-card .value { font-size: 1.75rem; font-weight: 800; letter-spacing: -.03em; color: var(--gray-800); }
.stat-card .value.green { color: var(--success); }
.stat-card .value.blue { color: var(--primary); }
.stat-card .value.orange { color: var(--warning); }

/* ===== CARDS ===== */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(0,0,0,.04); overflow: hidden; margin-bottom: 1.5rem; transition: var(--transition); }
.card:hover { box-shadow: var(--shadow-md); }
.card-header { padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--gray-100); display: flex; justify-content: space-between; align-items: center; }
.card-header h2 { font-size: .92rem; font-weight: 700; color: var(--gray-700); letter-spacing: -.01em; display: flex; align-items: center; gap: .5rem; }
.card-header h2::before { content: ''; width: 3px; height: 18px; border-radius: 3px; background: var(--primary); }

/* ===== TABLE ===== */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: .75rem 1.25rem; font-size: .72rem; color: var(--gray-400); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; border-bottom: 1px solid var(--gray-100); }
td { padding: .85rem 1.25rem; border-top: 1px solid var(--gray-50); font-size: .875rem; color: var(--gray-600); }
tr { transition: background .15s ease; }
tr:hover td { background: var(--gray-50); }
tr[onclick], tr[style*="cursor:pointer"] { cursor: pointer; }

/* ===== BADGE ===== */
.badge { padding: .25rem .7rem; border-radius: 99px; font-size: .72rem; font-weight: 700; display: inline-flex; align-items: center; gap: .35rem; letter-spacing: .02em; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-green { background: #ecfdf5; color: #047857; } .badge-green::before { background: #10b981; box-shadow: 0 0 6px rgba(16,185,129,.4); }
.badge-red { background: #fef2f2; color: #b91c1c; } .badge-red::before { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,.4); }
.badge-yellow { background: #fffbeb; color: #92400e; } .badge-yellow::before { background: #f59e0b; box-shadow: 0 0 6px rgba(245,158,11,.4); }
.badge-blue { background: #eff6ff; color: #1d4ed8; } .badge-blue::before { background: #3b82f6; box-shadow: 0 0 6px rgba(59,130,246,.4); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); } .badge-gray::before { background: var(--gray-400); }
.badge-orange { background: #fff7ed; color: #c2410c; } .badge-orange::before { background: #f97316; box-shadow: 0 0 6px rgba(249,115,22,.4); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .4rem; color: var(--gray-600); }
input, select, textarea { width: 100%; padding: .65rem .9rem; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); font-size: .875rem; outline: none; transition: var(--transition); background: #fff; color: var(--gray-900); font-family: inherit; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-glow); }
input::placeholder { color: var(--gray-400); }
textarea { resize: vertical; min-height: 80px; }

/* ===== BUTTONS ===== */
.btn { padding: .6rem 1.35rem; border: none; border-radius: var(--radius-xs); font-size: .85rem; font-weight: 600; cursor: pointer; transition: var(--transition); display: inline-flex; align-items: center; gap: .45rem; font-family: inherit; }
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg, #6366f1, #4f46e5); color: #fff; box-shadow: 0 2px 8px rgba(99,102,241,.35); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(99,102,241,.45); transform: translateY(-1px); }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); color: #fff; box-shadow: 0 2px 8px rgba(16,185,129,.35); }
.btn-success:hover { box-shadow: 0 6px 20px rgba(16,185,129,.45); transform: translateY(-1px); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; box-shadow: 0 2px 8px rgba(239,68,68,.3); }
.btn-danger:hover { box-shadow: 0 6px 20px rgba(239,68,68,.4); transform: translateY(-1px); }
.btn-sm { padding: .35rem .8rem; font-size: .78rem; border-radius: var(--radius-xs); }
.btn-outline { background: #fff; border: 1.5px solid var(--gray-200); color: var(--gray-600); box-shadow: none; }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-300); color: var(--gray-800); }
.btn-group { display: flex; gap: .5rem; }

/* ===== MODAL ===== */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15,23,42,.55); backdrop-filter: blur(8px); display: flex; justify-content: center; align-items: flex-start; padding-top: 6vh; z-index: 100; animation: fadeIn .2s ease; }
.modal { background: #fff; border-radius: var(--radius); width: 520px; max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-xl), 0 0 0 1px rgba(0,0,0,.05); animation: modalIn .3s cubic-bezier(.4,0,.2,1); }
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--gray-100); display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--gray-100); display: flex; justify-content: flex-end; gap: .5rem; background: var(--gray-50); border-radius: 0 0 var(--radius) var(--radius); }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--gray-400); transition: var(--transition); width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--gray-100); color: var(--gray-700); }

/* ===== TOAST ===== */
.toast { position: fixed; top: 5rem; right: 1.5rem; padding: .9rem 1.5rem; border-radius: var(--radius-sm); color: #fff; font-size: .875rem; font-weight: 600; z-index: 200; animation: toastIn .4s cubic-bezier(.4,0,.2,1); box-shadow: var(--shadow-lg); }
.toast-success { background: linear-gradient(135deg, #059669, #10b981); }
.toast-error { background: linear-gradient(135deg, #dc2626, #ef4444); }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(24px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastIn { from { transform: translateX(120%) scale(.9); opacity: 0; } to { transform: translateX(0) scale(1); opacity: 1; } }

/* ===== RESPONSIVE TABLE ===== */
.card { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table { min-width: 600px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .stats-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1024px) {
  .stats-4 { grid-template-columns: repeat(2, 1fr); }
  .stats-6 { grid-template-columns: repeat(3, 1fr); }
  .topbar-nav a span:not(.nav-icon) { display: none; }
  .topbar-nav a { padding: .5rem .75rem; }
}
@media (max-width: 768px) {
  body::before { height: 200px; }
  .topbar-inner { padding: 0 .75rem; height: 56px; gap: .5rem; }
  .topbar .logo span { display: none; }
  .topbar .logo-icon { width: 32px; height: 32px; font-size: .95rem; }
  .topbar-nav a span:not(.nav-icon) { display: none; }
  .topbar-nav a { padding: .45rem .55rem; }
  .topbar-nav .nav-icon { font-size: .95rem; }
  .topbar-right .user-info { display: none; }
  .topbar-right .btn-logout { padding: .35rem .7rem; font-size: .75rem; }
  .main-content { padding: .85rem; }
  .stats, .stats-3, .stats-4, .stats-6 { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .stat-card { padding: 1rem; border-radius: 12px; }
  .stat-card .value { font-size: 1.4rem; }
  .stat-card .label { font-size: .68rem; }
  .card { border-radius: 12px; }
  .card-header { padding: .85rem 1rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; gap: .75rem; align-items: flex-start; }
  .page-header h1 { font-size: 1.2rem; }
  .modal { width: calc(100vw - 1.5rem); max-width: 520px; margin: 0 auto; }
  .modal-overlay { padding-top: 3vh; }
  .modal-body { padding: 1.25rem; }
  .btn-group { flex-wrap: wrap; }
  td, th { padding: .5rem .65rem; font-size: .78rem; }
  .toast { top: 4rem; right: .75rem; left: .75rem; text-align: center; }
  .login-box { padding: 2rem 1.5rem; }
}
@media (max-width: 480px) {
  .stats, .stats-3, .stats-4, .stats-6 { grid-template-columns: 1fr; }
  .stat-card .value { font-size: 1.3rem; }
  .topbar-nav { gap: 0; padding: 3px; }
  .topbar-nav a { padding: .4rem .5rem; }
  .topbar-inner { padding: 0 .5rem; }
  .main-content { padding: .65rem; }
  .page-header h1 { font-size: 1.1rem; }
}

/* ===== UTILS ===== */
.hidden { display: none !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; }
.mb-1 { margin-bottom: .5rem; }
.flex { display: flex; } .gap-1 { gap: .5rem; } .items-center { align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.empty-state { text-align: center; padding: 3rem; color: var(--gray-400); font-size: .9rem; font-weight: 500; }
.loading { text-align: center; padding: 2rem; color: var(--gray-400); }
