:root {
  --sidebar-width: 240px;
  --sidebar-bg: #1e1b4b;
  --sidebar-hover: #312e81;
  --accent: #6366f1;
  --topbar-h: 56px;
  --content-bg: #f3f4f6;
}

html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--content-bg);
  color: #374151;
  -webkit-font-smoothing: antialiased;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: fixed;
  left: 0; top: 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
}
.sidebar-brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  text-decoration: none;
}
.sidebar-brand:hover { color: #fff; }
.sidebar-nav { padding: 0.75rem 0; }
.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1.25rem;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .12s ease;
  margin: 0 0.5rem;
  border-radius: 0 6px 6px 0;
}
.sidebar-nav .nav-link:hover {
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.04);
}
.sidebar-nav .nav-link.active {
  color: #fff;
  background: var(--sidebar-hover);
  border-left-color: var(--accent);
}
.sidebar-footer {
  margin-top: auto;
  padding: 0.75rem 1.25rem;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.25);
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* Main wrapper */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

/* Topbar */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}
.topbar-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #111827;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: #4b5563;
}

/* Content */
.content-area { padding: 1.5rem; flex: 1; }

/* Cards */
.card {
  border: 0;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
  background: #fff;
}
.card-header {
  background: transparent;
  border-bottom: 1px solid #f3f4f6;
  font-weight: 600;
  padding: 1rem 1.25rem;
  color: #111827;
}
.card-body { padding: 1.25rem; }

/* Tables */
.table { margin-bottom: 0; font-size: 0.875rem; }
.table thead th {
  font-weight: 600;
  color: #6b7280;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom-width: 1px;
  background: #fafafa;
  padding: 0.65rem 1.25rem;
  white-space: nowrap;
}
.table tbody td {
  padding: 0.75rem 1.25rem;
  color: #374151;
  vertical-align: middle;
  border-color: #f3f4f6;
}
.table tbody tr:hover td { background: #f9fafb; }
.table tbody tr:last-child td { border-bottom: 0; }

/* Badges */
.badge { font-weight: 500; font-size: 0.7rem; padding: 0.35em 0.6em; border-radius: 999px; }

/* Buttons */
.btn-sm { font-size: 0.8rem; padding: 0.3rem 0.65rem; border-radius: 0.4rem; }

/* Forms */
.form-control, .form-select {
  border-radius: 0.5rem;
  border-color: #e5e7eb;
  font-size: 0.875rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

/* Alerts */
.alert { border-radius: 0.6rem; border: 0; font-size: 0.875rem; }
.alert-success { background: #ecfdf5; color: #065f46; }
.alert-danger  { background: #fef2f2; color: #991b1b; }

/* Stats */
.stat-card { padding: 1.25rem; }
.stat-label {
  font-size: 0.7rem;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
  margin-top: 0.25rem;
}
.stat-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

/* Login */
.login-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4f46e5 100%);
  padding: 1rem;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  padding: 2.5rem;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #9ca3af;
}
.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

/* Feedback content */
.fb-content {
  background: #fafafa;
  border-radius: 0.5rem;
  padding: 1rem;
  border: 1px solid #f3f4f6;
  font-size: 0.875rem;
  line-height: 1.7;
}
.fb-content img { max-width: 100%; height: auto; border-radius: 0.4rem; }
.fb-content pre { background: #f3f4f6; padding: 0.75rem; border-radius: 0.4rem; font-size: 0.8rem; }

/* Utility */
.text-truncate-custom {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
