:root {
  --panel-radius: 0.95rem;
  --panel-border: rgba(15, 23, 42, 0.08);
  --panel-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  --table-head-bg: #f8fafc;
  --table-row-hover: rgba(13, 110, 253, 0.04);
}

html,
body,
.app-header,
.app-sidebar,
.card,
.small-box,
.dropdown-menu,
.modal-content,
.table-responsive,
.pagination .page-link,
.form-control,
.form-select {
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

body {
  background: linear-gradient(180deg, #f4f6f9 0%, #eef2f7 100%);
}

.app-header.navbar {
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
}

.theme-toggle {
  color: inherit;
  text-decoration: none;
}

.theme-toggle:hover,
.theme-toggle:focus {
  color: var(--bs-primary);
  box-shadow: none;
}

.theme-toggle-light {
  display: none;
}

[data-bs-theme="dark"] .theme-toggle-dark {
  display: none;
}

[data-bs-theme="dark"] .theme-toggle-light {
  display: inline-block;
}

[data-bs-theme="light"] .theme-toggle-dark,
html:not([data-bs-theme="dark"]) .theme-toggle-dark {
  display: inline-block;
}

[data-bs-theme="light"] .theme-toggle-light,
html:not([data-bs-theme="dark"]) .theme-toggle-light {
  display: none;
}

.card,
.small-box,
.dropdown-menu,
.modal-content {
  border: 1px solid var(--panel-border);
  border-radius: var(--panel-radius);
  box-shadow: var(--panel-shadow);
}

.card-header,
.card-footer {
  border-color: rgba(15, 23, 42, 0.06);
}

.card.collapsed-card .card-body,
.card.collapsed-card .card-footer {
  display: none;
}

.card-tools .btn-tool {
  border-radius: 0.65rem;
}

.table-responsive {
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.85);
}

.table {
  margin-bottom: 0;
  --bs-table-striped-bg: rgba(15, 23, 42, 0.018);
}

.table > :not(caption) > * > * {
  padding: 0.85rem 0.9rem;
  vertical-align: middle;
}

.table > thead {
  vertical-align: middle;
}

.table-nowrap > :not(caption) > * > * {
  white-space: nowrap;
}

.table-sticky thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.table > thead.table-light > tr > th,
.table > :not(caption) > thead > tr.table-light > th,
.table thead.table-light th {
  background: var(--table-head-bg);
}

.table tbody tr {
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.table-hover > tbody > tr:hover {
  background: var(--table-row-hover);
}

.card-footer nav,
.card-body nav {
  width: 100%;
}

.pagination {
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pagination .page-link {
  min-width: 2.2rem;
  min-height: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.7rem;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
  color: #334155;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.pagination .page-link:hover {
  color: var(--bs-primary);
  border-color: rgba(13, 110, 253, 0.3);
  background: rgba(13, 110, 253, 0.08);
}

.pagination .page-item.active .page-link {
  background: var(--bs-primary);
  border-color: var(--bs-primary);
  color: #fff;
}

.pagination .page-item.disabled .page-link {
  opacity: 0.55;
  box-shadow: none;
}

.latest-members-card .card-body {
  padding: 0.75rem;
}

.latest-members-grid .member-card {
  padding: 0.75rem 0.5rem;
  border-radius: 0.9rem;
  background: rgba(15, 23, 42, 0.03);
}

.latest-members-grid .member-avatar {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.latest-members-grid .member-name {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.92rem;
  line-height: 1.25;
}

.latest-members-grid .member-date {
  font-size: 0.78rem;
}

[data-bs-theme="dark"] body {
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  color: #e5e7eb;
}

[data-bs-theme="dark"] .app-header.navbar,
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .dropdown-menu,
[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .table-responsive {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(148, 163, 184, 0.18);
  box-shadow: 0 18px 44px rgba(2, 6, 23, 0.42);
}

[data-bs-theme="dark"] .card-header,
[data-bs-theme="dark"] .card-footer {
  background: rgba(255, 255, 255, 0.015);
  border-color: rgba(148, 163, 184, 0.18);
}

[data-bs-theme="dark"] .table {
  --bs-table-color: #e5e7eb;
  --bs-table-bg: transparent;
  --bs-table-border-color: rgba(148, 163, 184, 0.18);
  --bs-table-striped-bg: rgba(148, 163, 184, 0.06);
  --bs-table-hover-bg: rgba(96, 165, 250, 0.08);
  --bs-table-hover-color: #f8fafc;
}

[data-bs-theme="dark"] .table > thead.table-light > tr > th,
[data-bs-theme="dark"] .table > :not(caption) > thead > tr.table-light > th,
[data-bs-theme="dark"] .table thead.table-light th {
  background: rgba(30, 41, 59, 0.95);
  color: #f8fafc;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
  background: rgba(15, 23, 42, 0.88);
  color: #e5e7eb;
  border-color: rgba(148, 163, 184, 0.24);
}

[data-bs-theme="dark"] .form-control::placeholder {
  color: #94a3b8;
}

[data-bs-theme="dark"] .pagination .page-link {
  background: rgba(15, 23, 42, 0.88);
  color: #e5e7eb;
  border-color: rgba(148, 163, 184, 0.2);
  box-shadow: none;
}

[data-bs-theme="dark"] .pagination .page-link:hover {
  background: rgba(59, 130, 246, 0.14);
  color: #bfdbfe;
}

[data-bs-theme="dark"] .latest-members-grid .member-card {
  background: rgba(148, 163, 184, 0.08);
}

[data-bs-theme="dark"] .small.text-muted,
[data-bs-theme="dark"] .text-muted {
  color: #94a3b8 !important;
}

@media (max-width: 991.98px) {
  .card-footer.d-flex,
  .card-body.d-flex {
    align-items: stretch !important;
  }

  .card-footer nav,
  .card-body nav {
    margin-top: 0.5rem;
  }
}

@media (max-width: 767.98px) {
  .table > :not(caption) > * > * {
    padding: 0.7rem 0.65rem;
  }

  .pagination {
    justify-content: center;
  }

  .pagination .page-link {
    min-width: 2rem;
    min-height: 2rem;
    padding: 0.35rem 0.6rem;
  }
}
