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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #ca8a04;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-600: #4b5563;
  --gray-800: #1f2937;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.12);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--gray-50); color: var(--gray-800); font-size: 14px; line-height: 1.5; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--gray-800); color: #fff; padding: 0; flex-shrink: 0; }
.sidebar-logo { padding: 20px 16px; font-weight: 700; font-size: 16px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar nav a { display: block; padding: 10px 16px; color: rgba(255,255,255,.8); text-decoration: none; font-size: 13px; }
.sidebar nav a:hover, .sidebar nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.main { flex: 1; padding: 24px; overflow-y: auto; }

/* Cards */
.card { background: #fff; border-radius: var(--radius); border: 1px solid var(--gray-200); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 16px; font-weight: 600; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius); font-size: 13px; font-weight: 500; cursor: pointer; border: none; text-decoration: none; transition: opacity .15s; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { opacity: .85; }
.btn-ghost { background: transparent; color: var(--gray-600); border: 1px solid var(--gray-200); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--gray-600); margin-bottom: 4px; }
.form-control { width: 100%; padding: 8px 10px; border: 1px solid var(--gray-200); border-radius: var(--radius); font-size: 13px; background: #fff; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 8px 12px; background: var(--gray-50); border-bottom: 2px solid var(--gray-200); font-weight: 600; color: var(--gray-600); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-blue { background: #dbeafe; color: #1e40af; }

/* Alerts */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 12px; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 100; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: 8px; padding: 24px; width: 100%; max-width: 480px; box-shadow: 0 8px 32px rgba(0,0,0,.15); }
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

/* Progress bar */
.progress { background: var(--gray-200); border-radius: 999px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 999px; transition: width .3s ease; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--gray-50); }
.login-card { background: #fff; border: 1px solid var(--gray-200); border-radius: 8px; padding: 32px; width: 360px; box-shadow: var(--shadow); }
.login-logo { text-align: center; font-size: 20px; font-weight: 700; color: var(--primary); margin-bottom: 24px; }
.login-subtitle { text-align: center; font-size: 12px; color: var(--gray-400); margin-top: 16px; }

/* Drag & drop */
.dropzone { border: 2px dashed var(--gray-200); border-radius: var(--radius); padding: 32px; text-align: center; color: var(--gray-600); cursor: pointer; transition: border-color .2s, background .2s; }
.dropzone:hover, .dropzone.drag-over { border-color: var(--primary); background: #eff6ff; }
.dropzone input { display: none; }

/* Spinner */
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Pagination */
.pagination { display: flex; gap: 4px; margin-top: 12px; }
.pagination button { padding: 4px 10px; border: 1px solid var(--gray-200); background: #fff; border-radius: var(--radius); cursor: pointer; font-size: 12px; }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: .4; cursor: default; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 14px; text-align: center; }
.stat-number { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 11px; color: var(--gray-600); margin-top: 2px; }

@media (max-width: 640px) {
  .sidebar { display: none; }
  .main { padding: 16px; }
}
