:root {
  --bg: #f0f4f8;
  --ink: #1a2332;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #dbeafe;
  --card: #ffffff;
  --line: #e2e8f0;
  --success: #059669;
  --success-soft: #d1fae5;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #0284c7;
  --info-soft: #e0f2fe;
  --sidebar: #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #2563eb;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
}

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

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
}

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

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #2563eb 100%);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255,255,255,0.97);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.3);
}

.login-card h1 { font-size: 1.5rem; margin-bottom: 6px; }
.login-card .subtitle { color: var(--muted); font-size: 0.9rem; margin-bottom: 28px; }
.login-links { margin-top: 20px; text-align: center; font-size: 0.85rem; color: var(--muted); }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 24px 16px;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 0 12px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 20px;
}

.sidebar-brand h1 { color: #fff; font-size: 1.1rem; font-weight: 700; }
.sidebar-brand span { font-size: 0.75rem; color: var(--sidebar-text); opacity: 0.7; }

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 4px;
  transition: background 0.15s;
}

.sidebar nav a:hover,
.sidebar nav a.active { background: rgba(37, 99, 235, 0.2); color: #fff; }
.sidebar nav a.active { background: var(--sidebar-active); }

.sidebar-footer {
  margin-top: 32px;
  padding: 16px 12px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.8rem;
}

.sidebar-footer a { color: #94a3b8; text-decoration: none; }

.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 32px;
  max-width: calc(100vw - 260px);
}

.page-header { margin-bottom: 28px; }
.page-header h2 { font-size: 1.6rem; font-weight: 700; }
.page-header p { color: var(--muted); margin-top: 4px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.stat-card .label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.stat-card .value { font-size: 1.6rem; font-weight: 700; margin-top: 6px; }
.stat-card.success .value { color: var(--success); }
.stat-card.warning .value { color: var(--warning); }
.stat-card.info .value { color: var(--accent); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card h3 { font-size: 1.1rem; margin-bottom: 16px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 0.85rem; font-weight: 600; color: var(--ink); }
.form-group small { font-size: 0.75rem; color: var(--muted); }

input, select, textarea {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea { resize: vertical; min-height: 80px; }

.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
}

.btn:hover { opacity: 0.9; text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-secondary { background: #f1f5f9; color: var(--ink); border: 1px solid var(--line); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }

thead th {
  text-align: left;
  padding: 12px 14px;
  background: #f8fafc;
  border-bottom: 2px solid var(--line);
  font-weight: 600;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

tbody tr:hover { background: #f8fafc; }

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-success { color: var(--success); font-weight: 600; }
.text-warning { color: var(--warning); font-weight: 600; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: #f1f5f9; color: var(--muted); }

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.alert-success { background: var(--success-soft); color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: var(--danger-soft); color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: var(--info-soft); color: #075985; border: 1px solid #bae6fd; }

.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: flex-end;
}

.filters .form-group { min-width: 160px; }

.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-state p { margin-top: 8px; }

@media (max-width: 768px) {
  .sidebar { position: static; width: 100%; }
  .main-content { margin-left: 0; max-width: 100%; padding: 20px; }
  .app-shell { flex-direction: column; }
}
