:root {
  --primary: #00c853;
  --primary-dark: #00a844;
  --primary-light: #66ffa1;
  --secondary: #1a237e;
  --secondary-light: #534bae;
  --bg: #f4f6f9;
  --bg-card: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #00c853;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --sidebar-width: 260px;
  --header-height: 64px;
  --glass-bg: rgba(255,255,255,0.06);
  --glass-border: rgba(255,255,255,0.1);
  --glow-accent: 0 0 20px rgba(0,200,83,0.15);
  --glow-blue: 0 0 20px rgba(59,130,246,0.15);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes slideUnderline {
  from { width: 0; }
  to   { width: 100%; }
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-weight: 500;
  transition: all 0.2s;
  font-size: 14px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--secondary);
  color: #fff;
}

.btn-secondary:hover {
  background: var(--secondary-light);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--text);
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s;
  font-size: 14px;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 200, 83, 0.15);
}

textarea.form-input {
  resize: vertical;
  min-height: 100px;
}

select.form-input {
  appearance: auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success { background: #e6ffed; color: #008a3e; }
.badge-warning { background: #fff8e6; color: #92400e; }
.badge-danger { background: #ffe6e6; color: #b91c1c; }
.badge-info { background: #e6f0ff; color: #1a56db; }
.badge-neutral { background: #f3f4f6; color: #4b5563; }

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 8px;
}

.table-responsive::-webkit-scrollbar {
  height: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: max-content;
}

.table th, .table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table th {
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--bg);
}

.table tr:hover td {
  background: #f9fafb;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state p {
  font-size: 16px;
  margin-top: 8px;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 90%;
  max-width: 540px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}

.modal h2 {
  margin-bottom: 20px;
  font-size: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 24px;
  border-radius: var(--radius);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  z-index: 2000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-success { background: var(--success); }
.toast-danger { background: var(--danger); }
.toast-warning { background: var(--warning); color: #1a1a2e; }
.toast-info { background: var(--secondary); }

@media (max-width: 768px) {
  .toast {
    left: 16px;
    right: 16px;
    max-width: none;
    bottom: 16px;
    text-align: center;
  }

  .modal {
    width: 95%;
    padding: 20px;
  }

  .table td, .table th {
    padding: 10px 12px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .modal {
    padding: 16px;
    width: 98%;
  }

  .modal h2 {
    font-size: 17px;
  }

  html {
    font-size: 14px;
  }
}

html.dark-mode {
  --bg: #0f1117;
  --bg-card: #1a1b26;
  --text: #e4e4e7;
  --text-muted: #9ca3af;
  --border: #2d2d3d;
  --secondary: #0d1b4a;
  --secondary-light: #1a3a7a;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
}

html.dark-mode .table th {
  background: #151621;
}

html.dark-mode .table tr:hover td {
  background: #151621;
}

html.dark-mode .badge-success {
  background: #064e2f;
  color: #6ee7a0;
}

html.dark-mode .badge-warning {
  background: #5c3e00;
  color: #fbbf24;
}

html.dark-mode .badge-danger {
  background: #5c1010;
  color: #fca5a5;
}

html.dark-mode .badge-info {
  background: #0a2463;
  color: #93c5fd;
}

html.dark-mode .badge-neutral {
  background: #1f2937;
  color: #d1d5db;
}

html.dark-mode .btn-outline {
  border-color: var(--border);
  color: var(--text);
}

html.dark-mode .btn-outline:hover {
  border-color: var(--primary);
}

html.dark-mode .form-input {
  background: #0f1117;
  border-color: var(--border);
  color: var(--text);
}

html.dark-mode .form-input:focus {
  border-color: var(--primary);
}

html.dark-mode input, html.dark-mode textarea, html.dark-mode select {
  background: #0f1117;
  color: var(--text);
}

html.dark-mode .modal-overlay {
  background: rgba(0,0,0,0.7);
}

html.dark-mode .toast {
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
