.admin-body {
  background: #f3f4f6;
  min-height: 100vh;
}

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

.admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #1a1f2e;
  color: #c9d0e0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.admin-brand img {
  height: 36px;
}

.admin-brand span {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.3;
  color: #e8ecf4;
}

.admin-nav {
  flex: 1;
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.85rem;
  border-radius: 7px;
  text-decoration: none;
  color: #8892a4;
  font-size: 0.9rem;
  font-weight: 500;
  transition:
    background 0.15s,
    color 0.15s;
}

.admin-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #d1d9e8;
}
.admin-nav-item.active {
  background: rgba(75, 166, 89, 0.18);
  color: #6dd97a;
}

.admin-sidebar-footer {
  padding: 0.75rem 0.5rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  border-radius: 7px;
  text-decoration: none;
  color: #6b7687;
  font-size: 0.85rem;
  transition:
    background 0.15s,
    color 0.15s;
}
.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #aab;
}
.sidebar-link--logout:hover {
  color: #f87171;
}

.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.admin-page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111;
  margin: 0;
}

.admin-user-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: #444;
}

.admin-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.admin-avatar-initial {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-green, #4ba659);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.admin-username {
  font-weight: 600;
}

.admin-content {
  padding: 1.5rem;
  flex: 1;
  max-width: 1200px;
  width: 100%;
}

.admin-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 1.1rem 1.5rem;
  border: 1px solid #e5e7eb;
  min-width: 140px;
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: #111;
  line-height: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

.stat-card--green .stat-number {
  color: #16a34a;
}
.stat-card--orange .stat-number {
  color: #ea580c;
}

.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.admin-section-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: #111;
}

.posts-table-wrap {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  overflow: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th {
  background: #f9fafb;
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.admin-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.post-link {
  font-weight: 600;
  color: #111;
  text-decoration: none;
}
.post-link:hover {
  color: var(--primary-green, #4ba659);
}

.view-link {
  color: #9ca3af;
  text-decoration: none;
  font-size: 0.85rem;
  margin-left: 0.4rem;
}
.view-link:hover {
  color: var(--primary-green);
}

.actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.table-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.table-avatar-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e5e7eb;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.user-name {
  font-weight: 600;
  color: #111;
  font-size: 0.9rem;
}
.user-username {
  font-size: 0.8rem;
  color: #9ca3af;
}

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

.badge--green {
  background: #dcfce7;
  color: #16a34a;
}
.badge--gray {
  background: #f3f4f6;
  color: #6b7280;
}
.badge--blue {
  background: #dbeafe;
  color: #2563eb;
}
.badge--orange {
  background: #ffedd5;
  color: #ea580c;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1.1rem;
  border-radius: 7px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  border: 2px solid transparent;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary-green, #4ba659);
  color: #fff;
  border-color: var(--primary-green, #4ba659);
}
.btn-primary:hover {
  background: #3b8a4f;
  border-color: #3b8a4f;
}

.btn-outline {
  background: transparent;
  color: #374151;
  border-color: #d1d5db;
}
.btn-outline:hover {
  background: #f9fafb;
}

.btn-danger {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}
.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.btn-green {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
}
.btn-green:hover {
  background: #15803d;
}

.btn-orange {
  background: #ea580c;
  color: #fff;
  border-color: #ea580c;
}
.btn-orange:hover {
  background: #c2410c;
}

.btn-link {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 0.85rem;
  padding: 0.4rem 0.5rem;
}
.btn-link:hover {
  color: #111;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
}
.btn-full {
  width: 100%;
}

.form-group {
  margin-bottom: 1.1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.4rem;
}

.label-hint {
  font-weight: 400;
  color: #9ca3af;
  font-size: 0.8rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.55rem 0.8rem;
  border: 1.5px solid #d1d5db;
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.9rem;
  color: #111;
  background: #fff;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-green, #4ba659);
}

.input-disabled {
  background: #f9fafb !important;
  color: #6b7280 !important;
}

.input-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.input-group input {
  flex: 1;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  align-items: center;
}

.form-divider {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 1.25rem 0;
}

.form-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #374151;
  margin: 0 0 0.75rem;
}

.form-card {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  padding: 1.5rem;
  max-width: 640px;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 1.25rem;
  color: #111;
}

.role-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.25rem;
}

.role-checkboxes .checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  font-weight: 400;
  color: #374151;
}

.role-checkboxes .checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--primary-green, #4ba659);
}

.role-checkboxes .checkbox-label span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.role-badges {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 7px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.flash-success {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.flash-error {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  color: #6b7280;
}

.editor-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
  align-items: start;
}

.editor-main {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.editor-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-card {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  padding: 1.1rem 1.25rem;
}

.sidebar-card h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: #374151;
  margin: 0 0 0.75rem;
}

.sidebar-card--meta p {
  font-size: 0.82rem;
  color: #6b7280;
  margin: 0.2rem 0;
}

.publish-status {
  margin-bottom: 0.75rem;
  font-size: 0.87rem;
  color: #374151;
}

.publish-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

/* Quill editor styling */
#quill-editor {
  min-height: 380px;
  background: #fff;
  border: 1.5px solid #d1d5db;
  border-radius: 0 0 7px 7px;
  font-size: 0.95rem;
  color: #111;
}

.ql-toolbar {
  border: 1.5px solid #d1d5db !important;
  border-bottom: none !important;
  border-radius: 7px 7px 0 0 !important;
  background: #f9fafb;
}

.banner-preview img {
  width: 100%;
  border-radius: 6px;
  object-fit: cover;
  max-height: 120px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: #ef4444;
  cursor: pointer;
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
  max-width: 900px;
}

.avatar-upload-group {
}

.avatar-wrap {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.profile-avatar-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--primary-green, #4ba659);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* TOTP */
.totp-status {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.totp-status p {
  margin: 0;
  color: #374151;
  font-size: 0.9rem;
}
.totp-status--active .badge {
  margin-bottom: 0.25rem;
}

.admin-login-page {
  background: #f3f4f6;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-wrap {
  width: 100%;
  max-width: 400px;
  padding: 1rem;
}

.login-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  padding: 2rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.login-brand img {
  height: 44px;
}

.login-brand span {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
  color: #111;
}

.login-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0 0 1.25rem;
  color: #111;
  text-align: center;
}

.admin-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: #374151;
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
  line-height: 1;
  margin-right: 0.5rem;
  flex-shrink: 0;
}
.admin-menu-toggle:hover {
  background: #f3f4f6;
}

.admin-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 99;
}

@media (max-width: 900px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }
  .profile-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .admin-sidebar {
    position: fixed;
    left: -240px;
    top: 0;
    height: 100vh;
    z-index: 100;
    transition: left 0.25s ease;
    width: 220px;
  }

  .admin-layout.menu-open .admin-sidebar {
    left: 0;
  }

  .admin-layout.menu-open .admin-sidebar-overlay {
    display: block;
  }

  .admin-menu-toggle {
    display: flex;
    align-items: center;
  }

  .admin-stats {
    flex-direction: column;
  }

  .admin-content {
    padding: 1rem;
  }

  .admin-header {
    padding: 0.7rem 1rem;
  }

  .admin-page-title {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .admin-content {
    padding: 0.75rem;
  }

  .stat-card {
    min-width: 0;
    flex: 1 1 120px;
  }

  .form-actions {
    flex-wrap: wrap;
  }

  .actions {
    flex-wrap: wrap;
  }
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.media-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.media-thumb {
  height: 110px;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-info {
  padding: 0.5rem 0.6rem 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
}

.media-name {
  font-size: 0.78rem;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-size {
  font-size: 0.75rem;
  color: #9ca3af;
}

.media-delete-btn {
  width: 100%;
  border-radius: 0;
  border-top: 1px solid #e5e7eb;
}

.dev-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
