:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e2e4e9;
  --text: #1c1e21;
  --text-muted: #6b7280;
  --primary: #6a3fe0;
  --primary-dark: #5730c4;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--primary); }

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

.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar .brand {
  font-weight: 700;
  font-size: 1.05rem;
  padding: 8px 10px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar .brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af, #515bd4);
  display: inline-block;
}

.sidebar nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
  margin-bottom: 2px;
}

.sidebar nav a:hover { background: var(--bg); }
.sidebar nav a.active { background: var(--primary); color: #fff; }

.sidebar .footer {
  margin-top: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 10px;
}

.sidebar .logout-btn {
  margin-top: 6px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.92rem;
  color: var(--danger);
  cursor: pointer;
}
.sidebar .logout-btn:hover { background: var(--bg); }

.main {
  flex: 1;
  padding: 28px 34px;
  max-width: 1100px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 10px;
}

.page-header h1 {
  font-size: 1.4rem;
  margin: 0;
}

.page-header p.subtitle {
  color: var(--text-muted);
  margin: 4px 0 0;
  font-size: 0.9rem;
}

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

.card h2 {
  font-size: 1.02rem;
  margin: 0 0 12px;
}

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

@media (max-width: 800px) {
  .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .sidebar { width: 70px; }
  .sidebar .brand span.label, .sidebar nav a span.label { display: none; }
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat .value { font-size: 1.7rem; font-weight: 700; }
.stat .label { color: var(--text-muted); font-size: 0.85rem; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge.success { background: #dcfce7; color: #15803d; }
.badge.danger { background: #fee2e2; color: #b91c1c; }
.badge.muted { background: #eef0f3; color: var(--text-muted); }
.badge.warning { background: #fef3c7; color: #92400e; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
th, td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th { color: var(--text-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: .02em; }
tr:last-child td { border-bottom: none; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

input[type=text], input[type=password], textarea, select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
textarea { resize: vertical; min-height: 80px; }
label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.field .hint { font-size: 0.76rem; color: var(--text-muted); margin-top: 4px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.86rem;
  margin-bottom: 16px;
}
.alert.info { background: #eef2ff; color: #3730a3; }
.alert.warning { background: #fef3c7; color: #92400e; }
.alert.danger { background: #fee2e2; color: #b91c1c; }
.alert.success { background: #dcfce7; color: #15803d; }

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

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 22px;
  width: 460px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
}
.modal h3 { margin-top: 0; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
.hidden { display: none !important; }

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f58529 0%, #dd2a7b 40%, #8134af 70%, #515bd4 100%);
}
.login-card {
  background: #fff;
  border-radius: 14px;
  padding: 34px 30px;
  width: 340px;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
.login-card h1 { font-size: 1.2rem; margin: 0 0 4px; }
.login-card p { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 20px; }

code.pill {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.82em;
}
