:root {
  --admin-sidebar: #1e3a5f;
  --admin-accent: #3b82f6;
  --admin-accent-dark: #2563eb;
  --admin-bg: #eef2f7;
  --admin-surface: #ffffff;
  --admin-text: #0f172a;
  --admin-muted: #64748b;
  --admin-border: #e2e8f0;
  --admin-radius: 14px;
  --admin-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  --admin-shadow-hover: 0 12px 32px rgba(15, 23, 42, 0.1);
}

* { box-sizing: border-box; }

body.admin-body {
  font-family: "Be Vietnam Pro", system-ui, sans-serif;
  background: var(--admin-bg);
  color: var(--admin-text);
  min-height: 100vh;
  margin: 0;
}

/* ── Sidebar ── */
.admin-sidebar {
  width: 268px;
  background: linear-gradient(180deg, #152a45 0%, #1e3a5f 40%, #2a5280 100%);
  color: #fff;
  min-height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
}

.admin-brand {
  padding: 1.35rem 1.5rem;
  font-weight: 700;
  font-size: 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  letter-spacing: -0.02em;
}

.admin-brand i {
  color: #fbbf24;
}

.admin-nav .nav-link {
  color: rgba(255, 255, 255, 0.78);
  padding: 0.7rem 1.25rem;
  margin: 0.15rem 0.75rem;
  font-weight: 500;
  font-size: 0.92rem;
  border-radius: 10px;
  border-left: none;
  text-decoration: none;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
}

.admin-nav .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.admin-nav .nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.admin-user {
  margin-top: auto;
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}

.admin-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.25);
  color: #fbbf24;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

/* ── Main area ── */
.admin-main {
  margin-left: 268px;
  min-height: 100vh;
  padding: 0;
}

.admin-main-inner {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 1.75rem 2rem 2.5rem;
}

/* ── Page header ── */
.page-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

.page-hero-text h1 {
  font-size: clamp(1.4rem, 2.5vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.35rem;
  color: var(--admin-text);
}

.page-hero-text p {
  margin: 0;
  color: var(--admin-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.page-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--admin-muted);
  margin-bottom: 0.5rem;
}

.page-breadcrumb a {
  color: var(--admin-accent);
  text-decoration: none;
}

.page-breadcrumb a:hover {
  text-decoration: underline;
}

.btn-admin-primary {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border: none;
  color: #fff;
  font-weight: 600;
  padding: 0.55rem 1.15rem;
  border-radius: 10px;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-admin-primary:hover {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-admin-ghost {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  color: var(--admin-text);
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-size: 0.88rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s;
}

.btn-admin-ghost:hover {
  border-color: var(--admin-accent);
  color: var(--admin-accent);
}

/* ── Stat cards ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--admin-surface);
  border-radius: var(--admin-radius);
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--admin-border);
  box-shadow: var(--admin-shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: box-shadow 0.2s, transform 0.2s;
}

.stat-card:hover {
  box-shadow: var(--admin-shadow-hover);
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.stat-icon.blue   { background: #dbeafe; color: #2563eb; }
.stat-icon.green  { background: #d1fae5; color: #059669; }
.stat-icon.amber  { background: #fef3c7; color: #d97706; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--admin-muted);
  font-weight: 500;
}

/* ── Content card ── */
.content-card {
  background: var(--admin-surface);
  border-radius: var(--admin-radius);
  border: 1px solid var(--admin-border);
  box-shadow: var(--admin-shadow);
  overflow: hidden;
}

.content-card-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
}

.content-card-header h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.content-card-body {
  padding: 0;
}

.content-card-body.padded {
  padding: 1.5rem;
}

/* ── Project list (cards) ── */
.project-list {
  display: flex;
  flex-direction: column;
}

.project-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1rem 1.5rem;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--admin-border);
  transition: background 0.15s;
}

.project-item:last-child {
  border-bottom: none;
}

.project-item:hover {
  background: #f8fafc;
}

.project-item-main {
  min-width: 0;
}

.project-item-title {
  font-weight: 600;
  font-size: 0.98rem;
  margin: 0 0 0.35rem;
  color: var(--admin-text);
}

.project-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--admin-muted);
}

.project-item-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.project-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.badge-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
}

.badge-progress { background: #dbeafe; color: #1d4ed8; }
.badge-members  { background: #f1f5f9; color: #475569; }

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--admin-accent);
  background: #eff6ff;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  text-decoration: none;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-link:hover {
  background: #dbeafe;
  color: var(--admin-accent-dark);
}

.project-actions {
  display: flex;
  gap: 0.35rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--admin-border);
  background: #fff;
  color: var(--admin-muted);
  text-decoration: none;
  transition: all 0.15s;
  cursor: pointer;
}

.btn-icon:hover {
  border-color: var(--admin-accent);
  color: var(--admin-accent);
  background: #eff6ff;
}

.btn-icon.primary:hover {
  border-color: #2563eb;
  color: #2563eb;
  background: #dbeafe;
}

.btn-icon.danger:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: #fef2f2;
}

/* ── Member grid ── */
.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  padding: 1.25rem;
}

.member-card {
  background: #fff;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.2s;
}

.member-card:hover {
  border-color: #bfdbfe;
  box-shadow: var(--admin-shadow);
  transform: translateY(-2px);
}

.member-avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.member-info {
  flex: 1;
  min-width: 0;
}

.member-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0 0 0.2rem;
}

.member-initials {
  font-size: 0.78rem;
  color: var(--admin-muted);
}

.member-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.25rem;
}

.member-card-actions {
  display: flex;
  gap: 0.3rem;
}

/* ── Forms ── */
.form-card {
  background: var(--admin-surface);
  border-radius: var(--admin-radius);
  border: 1px solid var(--admin-border);
  box-shadow: var(--admin-shadow);
  overflow: hidden;
}

.form-section {
  padding: 1.5rem;
  border-bottom: 1px solid var(--admin-border);
}

.form-section:last-of-type {
  border-bottom: none;
}

.form-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--admin-muted);
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.form-section-title i {
  color: var(--admin-accent);
}

.form-label {
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--admin-text);
  margin-bottom: 0.4rem;
}

.form-control,
.form-select {
  border-radius: 10px;
  border-color: var(--admin-border);
  padding: 0.55rem 0.85rem;
  font-size: 0.9rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--admin-accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-footer {
  padding: 1.15rem 1.5rem;
  background: #f8fafc;
  border-top: 1px solid var(--admin-border);
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.member-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.65rem;
}

.member-picker-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border: 2px solid var(--admin-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.member-picker-item:hover {
  border-color: #bfdbfe;
  background: #f8fafc;
}

.member-picker-item:has(input:checked) {
  border-color: var(--admin-accent);
  background: #eff6ff;
}

.member-picker-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--admin-accent);
}

.member-picker-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}

.color-picker-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.color-picker-wrap input[type="color"] {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  border: 2px solid var(--admin-border);
  padding: 4px;
  cursor: pointer;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
}

.empty-state-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1rem;
  background: #f1f5f9;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--admin-muted);
}

.empty-state h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.empty-state p {
  color: var(--admin-muted);
  font-size: 0.88rem;
  margin: 0 0 1.25rem;
}

/* ── Alerts ── */
.admin-alert {
  border-radius: 12px;
  border: none;
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-alert-success {
  background: #ecfdf5;
  color: #047857;
}

.admin-alert-danger {
  background: #fef2f2;
  color: #b91c1c;
}

/* ── Login ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #152a45 0%, #1e3a5f 50%, #3d7ab5 100%);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: "";
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
  top: -150px;
  right: -100px;
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 420px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  background: #fff;
  position: relative;
  z-index: 1;
}

.login-card .card-body {
  padding: 2.25rem;
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.5rem;
}

.login-card .input-group-text {
  border-radius: 10px 0 0 10px;
  border-color: var(--admin-border);
}

.login-card .input-group .form-control {
  border-radius: 0 10px 10px 0;
}

.login-card .input-group:focus-within .input-group-text,
.login-card .input-group:focus-within .form-control {
  border-color: var(--admin-accent);
}

.login-card .input-group:focus-within {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  border-radius: 10px;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border: none;
  font-weight: 600;
  border-radius: 10px;
  padding: 0.6rem 1rem;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
}

@media (max-width: 991px) {
  .admin-sidebar {
    width: 100%;
    position: relative;
    min-height: auto;
  }
  .admin-main { margin-left: 0; }
  .admin-main-inner { padding: 1.25rem; }
  .project-item {
    grid-template-columns: 1fr;
  }
  .project-actions { justify-content: flex-start; }
}

@media (max-width: 576px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
}
