:root {
  --brand-primary: #0d9488;
  --brand-primary-hover: #0f766e;
  --surface: #ffffff;
  --surface-muted: #f1f5f4;
  --border: #d9e2e0;
  --text: #0f1f1c;
  --text-muted: #5b6f6a;
  --radius: 0.5rem;
  --shadow-sm: 0 1px 3px rgba(15, 31, 28, 0.08);
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --font-body: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-display: "Oswald", "Plus Jakarta Sans", sans-serif;
}

body {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text);
  background-color: var(--surface-muted);
  background-image:
    radial-gradient(ellipse at top left, rgba(13, 148, 136, 0.06), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(15, 31, 28, 0.04), transparent 45%);
  background-attachment: fixed;
}

.app-main .form-label {
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
  color: var(--text-muted);
}

.app-main .form-control,
.app-main .form-select {
  font-size: 0.8125rem;
  padding: 0.35rem 0.6rem;
  min-height: calc(1.5em + 0.7rem + 2px);
}

.app-main .form-control-sm {
  font-size: 0.75rem;
  padding: 0.25rem 0.45rem;
}

.app-main textarea.form-control {
  min-height: auto;
}

.app-main .btn {
  font-size: 0.8125rem;
}

.app-main .btn-sm,
.app-main .btn-group-sm > .btn {
  font-size: 0.75rem;
}

.brand-display {
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.table-fs { font-size: 0.875rem; }
.btn-xs {
  padding: 0.25rem 0.4rem;
  font-size: 0.75rem;
  line-height: 1;
  border-radius: 0.25rem;
}

.btn-brand {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}
.btn-brand:hover,
.btn-brand:focus {
  background-color: var(--brand-primary-hover);
  border-color: var(--brand-primary-hover);
  color: #fff;
}
.btn-outline-brand {
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}
.btn-outline-brand:hover {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

.app-shell { min-height: 100vh; }
.app-main {
  flex: 1;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  font-size: 0.8125rem;
}

.page-fade {
  animation: pageFade 0.28s ease-out;
}
@keyframes pageFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.app-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  max-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  transition: width 0.2s ease, min-width 0.2s ease;
  overflow-y: auto;
  overflow-x: hidden;
}
.app-sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
  min-width: var(--sidebar-collapsed-width);
}
.app-sidebar .sidebar-brand img {
  max-height: 56px;
  object-fit: contain;
}
.app-sidebar.collapsed .sidebar-brand-text,
.app-sidebar.collapsed .nav-label,
.app-sidebar.collapsed .nav-group-label,
.app-sidebar.collapsed .sidebar-user-info,
.app-sidebar.collapsed .sidebar-footer-text {
  display: none !important;
}
.app-sidebar.collapsed .nav-link-app {
  justify-content: center;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}
.app-sidebar.collapsed .nav-link-app i { margin-right: 0 !important; }

.nav-group-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.75rem 0.75rem 0.25rem;
}
.nav-link-app {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  margin: 0.125rem 0.5rem;
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  border-left: 3px solid transparent;
}
.nav-link-app:hover {
  background: var(--surface-muted);
  color: var(--brand-primary);
}
.nav-link-app.active {
  background: rgba(var(--bs-primary-rgb), 0.1);
  color: var(--brand-primary);
  border-left-color: var(--brand-primary);
  font-weight: 600;
}

.sidebar-user {
  padding: 0.75rem;
  margin: 0.5rem;
  border-radius: var(--radius);
  background: var(--surface-muted);
}
.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}
.sidebar-toggle {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 0.25rem;
  border-radius: var(--radius);
}
.sidebar-toggle:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.app-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}
.app-header-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}
.app-header-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0;
}

.page-header { margin-bottom: 1.25rem; }
.page-header__title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  color: var(--text);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.page-header__subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0;
}

.card-app {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow-sm);
}
.card-app .card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.875rem 1rem;
}
.card-app .card-body { padding: 1rem; }

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 991px) {
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 575px) {
  .kpi-strip { grid-template-columns: 1fr; }
}
.kpi-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.kpi-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(15, 31, 28, 0.08);
}
.kpi-item__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.kpi-item__value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--text);
}
.kpi-item--accent .kpi-item__value { color: var(--brand-primary); }
.kpi-item--warn .kpi-item__value { color: #b45309; }
.kpi-item--danger .kpi-item__value { color: #b91c1c; }

.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.table-app {
  font-size: 0.8125rem;
  margin-bottom: 0;
}
.table-app thead th {
  background: var(--surface-muted);
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
}
.table-app tbody tr {
  transition: background-color 0.12s ease;
}
.table-app tbody tr:hover {
  background-color: rgba(var(--bs-primary-rgb), 0.06);
}
.table-responsive-app {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.15);
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
}
.empty-state i {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
  color: var(--brand-primary);
}

/* Sign-in: full-bleed athletic hero */
.signin-page {
  min-height: 100vh;
  display: flex;
}
.signin-hero {
  position: relative;
  min-height: 100vh;
  background:
    linear-gradient(160deg, rgba(15, 31, 28, 0.55), rgba(13, 148, 136, 0.45)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='800' height='1200' viewBox='0 0 800 1200'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop stop-color='%230f1f1c'/%3E%3Cstop offset='1' stop-color='%230d9488'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect fill='url(%23g)' width='800' height='1200'/%3E%3Cpath d='M0 900 Q200 800 400 920 T800 880 V1200 H0Z' fill='%230a1614' opacity='.45'/%3E%3Ccircle cx='620' cy='280' r='140' fill='%23fff' opacity='.05'/%3E%3Ccircle cx='180' cy='420' r='90' fill='%23fff' opacity='.04'/%3E%3C/svg%3E") center/cover no-repeat;
  color: #fff;
  padding: 3rem;
}
.signin-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10, 22, 20, 0.75), transparent 55%);
  pointer-events: none;
}
.signin-hero__content {
  position: relative;
  z-index: 1;
  max-width: 420px;
}
.signin-hero__logo {
  max-height: 72px;
  width: auto;
  object-fit: contain;
  display: block;
}
.signin-hero__brand {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 0.5rem;
  line-height: 1.05;
}
.signin-hero__tagline {
  font-size: 1.05rem;
  opacity: 0.85;
  margin: 0;
  max-width: 28ch;
}
.signin-card {
  max-width: 420px;
  width: 100%;
  padding: 2rem;
}
.password-toggle-btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.btn.is-loading {
  pointer-events: none;
  opacity: 0.75;
}

.badge-membership-active {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}
.badge-membership-expired {
  background: rgba(185, 28, 28, 0.12);
  color: #b91c1c;
}
.badge-membership-expiring {
  background: rgba(180, 83, 9, 0.12);
  color: #b45309;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  height: 160px;
  padding-top: 0.5rem;
}
.dashboard-layout {
  min-height: 0;
}
.dashboard-charts-grid > [class*="col-"] {
  display: flex;
}
.dashboard-chart-card {
  width: 100%;
}
.dashboard-chart-card .card-body {
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.dashboard-chart-card .chart-donut-wrap {
  flex: 1;
  justify-content: center;
}
.chart-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}
.chart-bar {
  width: 100%;
  max-width: 40px;
  background: linear-gradient(180deg, var(--brand-primary), var(--brand-primary-hover));
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.35s ease;
}
.chart-bar-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}
.chart-bar--alt {
  background: linear-gradient(180deg, #0891b2, #0e7490);
}
.chart-bar--members {
  background: linear-gradient(180deg, #6366f1, #4f46e5);
}

.chart-donut-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  min-height: 160px;
  padding: 0.5rem 0;
}
.chart-donut {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}
.chart-donut::after {
  content: "";
  position: absolute;
  inset: 22%;
  background: var(--surface-card, #fff);
  border-radius: 50%;
}
.chart-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 1;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
}
.chart-donut-center strong {
  display: block;
  font-size: 1.25rem;
  color: var(--text-primary, #0f1f1c);
}
.chart-donut-legend {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.8125rem;
}
.chart-donut-legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
}
.chart-donut-legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.activity-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.activity-list li:last-child { border-bottom: none; }

.app-sidebar,
.app-main,
.offcanvas-body {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.select2-container--default .select2-selection--single {
  border-radius: var(--radius) !important;
  border-color: var(--border) !important;
  min-height: 32px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 30px !important;
  font-size: 0.8125rem;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 30px !important;
}
.select2-results__option {
  font-size: 0.8125rem;
}

.app-header-title { font-size: 1.125rem; }
.app-header-subtitle { font-size: 0.8125rem; }

/* 1 & 2: same outer gap (top = sides). 3: tighter column gutter */
.app-content {
  padding: 0.75rem 0.75rem 1.25rem;
}
.app-content > .row {
  --bs-gutter-x: 0.5rem;
  --bs-gutter-y: 0.75rem;
}

.kpi-strip { gap: 0.75rem; margin-bottom: 1.25rem; }
.kpi-item { padding: 1.25rem; }
.kpi-item__value { font-size: 1.5rem; }
.kpi-item__label { font-size: 0.75rem; margin-bottom: 0.25rem; }

.activity-list li {
  padding: 0.65rem 0;
  font-size: 0.8125rem;
}

@media (max-width: 767px) {
  .table-stack thead { display: none; }
  .table-stack tbody tr {
    display: block;
    border-bottom: 1px solid var(--border);
    padding: 0.75rem;
  }
  .table-stack tbody td {
    display: flex;
    justify-content: space-between;
    border: none;
    padding: 0.25rem 0;
  }
  .table-stack tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 1rem;
  }
}
