.admin-body {
  background: #eef2f0;
}

.admin-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.admin-sidebar {
  background: linear-gradient(180deg, #0f6b5c 0%, #0a4f44 100%);
  color: white;
  padding: 1.4rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.admin-brand {
  margin-bottom: 1.5rem;
  padding: 0.4rem 0.5rem;
}

.admin-brand .brand-text small,
.admin-brand .brand-text strong {
  color: white;
}

.admin-brand .brand-logo {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  padding: 2px;
}

.admin-nav {
  display: grid;
  gap: 0.35rem;
}

.admin-nav a {
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 600;
}

.admin-nav a:hover,
.admin-nav a.active {
  background: rgba(255, 255, 255, 0.14);
  color: white;
}

.admin-main {
  min-width: 0;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 1.5rem;
  background: rgba(255, 255, 255, 0.8);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.admin-topbar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.8rem;
}

.admin-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.admin-user {
  color: var(--muted);
  font-weight: 600;
}

.admin-user-menu {
  position: relative;
}

.admin-avatar-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid var(--border);
  background: white;
  border-radius: 999px;
  padding: 0.25rem 0.7rem 0.25rem 0.25rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.admin-avatar-btn:hover,
.admin-user-menu.is-open .admin-avatar-btn {
  border-color: rgba(15, 107, 92, 0.35);
  box-shadow: 0 6px 16px rgba(15, 107, 92, 0.08);
}

.admin-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #0f6b5c, #0a4f44);
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.admin-avatar-sm {
  width: 36px;
  height: 36px;
  font-size: 0.78rem;
}

.admin-user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  text-align: left;
  min-width: 0;
}

.admin-user-meta strong {
  font-size: 0.88rem;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-meta small {
  color: var(--muted);
  font-size: 0.72rem;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-avatar-caret {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #5b6a64;
  margin-left: 0.15rem;
}

.admin-user-dropdown {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  width: 240px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 34px rgba(23, 34, 31, 0.14);
  padding: 0.45rem;
  z-index: 40;
}

.admin-user-dropdown[hidden] {
  display: none !important;
}

.admin-user-dropdown-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.55rem 0.75rem;
  border-bottom: 1px solid #edf1ef;
  margin-bottom: 0.35rem;
}

.admin-user-dropdown-head strong,
.admin-user-dropdown-head small {
  display: block;
}

.admin-user-dropdown-head small {
  color: var(--muted);
  font-size: 0.75rem;
  word-break: break-all;
}

.admin-user-dropdown a,
.admin-user-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.7rem 0.7rem;
  border-radius: 10px;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.admin-user-dropdown a:hover,
.admin-user-dropdown button:hover {
  background: #eef4f1;
  color: #0a4f44;
}

.admin-user-dropdown form {
  margin: 0;
}

@media (max-width: 720px) {
  .admin-user-meta {
    display: none;
  }

  .admin-avatar-btn {
    padding-right: 0.45rem;
  }
}

.admin-content {
  padding: 1.5rem;
}

.admin-stats {
  margin-bottom: 1.2rem;
}

.admin-stats .stat-item {
  background: white;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}

.panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.2rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.2rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.report-summary-head {
  margin-bottom: 0.8rem;
}

.report-summary-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
}

.panel-head h2,
.panel h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.filter-form,
.report-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: end;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid #edf1ef;
  vertical-align: middle;
  font-size: 0.94rem;
}

.data-table th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.inline {
  display: inline;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 1rem 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: capitalize;
}

.badge-success {
  background: #e8f7ee;
  color: var(--success);
}

.badge-warning {
  background: #fff4d6;
  color: var(--warning);
}

.badge-danger {
  background: #fdecec;
  color: var(--danger);
}

.badge-info {
  background: #e8f1ff;
  color: var(--info);
}

.badge-muted {
  background: #eef1ef;
  color: var(--muted);
}

.form-panel,
.form-hint {
  max-width: 860px;
}

.form-hint {
  color: var(--muted);
  margin-top: 0;
}

.field-hint {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.82rem;
  line-height: 1.4;
}

.detail-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: grid;
  gap: 0.55rem;
}

.thumb,
.preview {
  width: 84px;
  height: 56px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.preview {
  width: min(100%, 360px);
  height: auto;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.8rem;
}

.checkbox-label input {
  width: auto;
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at top right, rgba(217, 195, 161, 0.4), transparent 30%),
    linear-gradient(160deg, #0f6b5c, #0a4f44 55%, #17352f);
}

.auth-panel {
  width: min(420px, 100%);
}

.auth-card {
  background: white;
  border-radius: 22px;
  padding: 1.8rem;
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.4rem;
}

.auth-brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2rem;
}

.auth-brand p {
  margin: 0;
  color: var(--muted);
}

.auth-org-name {
  font-size: 0.82rem !important;
  font-weight: 700;
  color: var(--ink) !important;
  margin: 0.15rem 0 0.25rem !important;
  line-height: 1.3;
}

.back-link {
  display: inline-block;
  margin-top: 1rem;
  color: var(--muted);
  font-weight: 600;
}

@media (max-width: 980px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: relative;
    height: auto;
  }

  .admin-nav {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .admin-nav {
    grid-template-columns: 1fr;
  }

  .admin-content,
  .admin-topbar {
    padding: 1rem;
  }

  .data-table {
    display: block;
    overflow-x: auto;
  }
}

/* Loader overlay */
.admin-loader {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  background: rgba(15, 28, 24, 0.42);
  backdrop-filter: blur(2px);
}

.admin-loader[hidden] {
  display: none !important;
}

.admin-loader-card {
  background: white;
  border-radius: 18px;
  padding: 1.4rem 1.6rem;
  min-width: 220px;
  display: grid;
  justify-items: center;
  gap: 0.85rem;
  box-shadow: 0 18px 40px rgba(23, 34, 31, 0.18);
}

.admin-spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid #d9e5e1;
  border-top-color: #0f6b5c;
  animation: adminSpin 0.75s linear infinite;
}

.admin-loader-text {
  margin: 0;
  color: #17221f;
  font-weight: 700;
  font-size: 0.95rem;
}

body.admin-loading,
body.admin-modal-open {
  overflow: hidden;
}

@keyframes adminSpin {
  to {
    transform: rotate(360deg);
  }
}

/* Custom modal popup */
.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.admin-modal[hidden] {
  display: none !important;
}

.admin-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 28, 24, 0.45);
}

.admin-modal-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: white;
  border-radius: 18px;
  padding: 1.4rem 1.35rem 1.2rem;
  box-shadow: 0 22px 48px rgba(23, 34, 31, 0.22);
  text-align: center;
}

.admin-modal-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 0.7rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  font-weight: 700;
}

.admin-modal-icon::before {
  content: '!';
}

.admin-modal.is-confirm .admin-modal-icon,
.admin-modal.is-info .admin-modal-icon {
  background: #e8f1ff;
  color: #175cd3;
}

.admin-modal.is-success .admin-modal-icon {
  background: #e8f7ee;
  color: #147a45;
}

.admin-modal.is-success .admin-modal-icon::before {
  content: '✓';
}

.admin-modal.is-error .admin-modal-icon {
  background: #fdecec;
  color: #b42318;
}

.admin-modal.is-error .admin-modal-icon::before {
  content: '!';
}

.admin-modal-card h3 {
  margin: 0 0 0.45rem;
  font-family: var(--font-display);
  font-size: 1.55rem;
}

.admin-modal-card p {
  margin: 0 0 1.1rem;
  color: #5b6a64;
  line-height: 1.5;
}

.admin-modal-actions {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* Toast popups */
.admin-toast-stack {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2200;
  display: grid;
  gap: 0.65rem;
  width: min(360px, calc(100vw - 2rem));
}

.admin-toast {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  background: white;
  border-radius: 14px;
  padding: 0.85rem 0.9rem;
  box-shadow: 0 14px 30px rgba(23, 34, 31, 0.16);
  border-left: 4px solid #175cd3;
  animation: toastIn 0.25s ease;
}

.admin-toast-success {
  border-left-color: #147a45;
}

.admin-toast-error {
  border-left-color: #b42318;
}

.admin-toast-body {
  flex: 1;
}

.admin-toast-body strong {
  display: block;
  margin-bottom: 0.15rem;
}

.admin-toast-body p {
  margin: 0;
  color: #5b6a64;
  font-size: 0.92rem;
  line-height: 1.4;
}

.admin-toast-close {
  border: 0;
  background: transparent;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  color: #5b6a64;
  padding: 0;
}

.admin-toast.is-leaving {
  opacity: 0;
  transform: translateY(-8px);
  transition: 0.2s ease;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
