/* =====================================================
   AGOGE — Dark Concrete Cellar Gym Theme
   ===================================================== */

:root {
  /* ── Dark mode palette (overridable by owner via --custom-dark-* props set in JS) ── */
  --bg-base:      var(--custom-dark-bg,   #0b0a08);
  --bg-surface:   var(--custom-dark-surf, #111009);
  --bg-elevated:  var(--custom-dark-elev, #191714);
  --bg-card:      var(--custom-dark-card, #1c1a16);
  --bg-input:     var(--custom-dark-inp,  #0e0d0b);

  /* Borders */
  --border:       var(--custom-dark-bord, #242018);
  --border-mid:   var(--custom-dark-brdm, #302c22);
  --border-gold:  #3e3418;

  /* Gold / accent (owner-overridable via applyAccentColor in JS) */
  --gold:         #c9a227;
  --gold-bright:  #e8c040;
  --gold-dim:     rgba(201, 162, 39, 0.4);
  --gold-glow:    rgba(201, 162, 39, 0.07);

  /* Text */
  --text:         var(--custom-dark-text, #ddd4c0);
  --text-sec:     var(--custom-dark-ts,   #8a8070);
  --text-muted:   #4e4840;

  /* Status */
  --success:      #3a6b46;
  --success-text: #5eb878;
  --danger:       #7a2828;
  --danger-text:  #c05050;
  --info:         #1f4060;

  /* Shape (owner-overridable via --custom-radius props set in JS) */
  --radius:       var(--custom-radius,    2px);
  --radius-lg:    var(--custom-radius-lg, 4px);

  /* Font */
  --font-heading: 'Oswald', sans-serif;
  --font-body:    'Inter', sans-serif;
}

/* =====================================================
   Light Mode — "Concrete Daylight"
   Overrides the dark concrete palette above. Activated via
   <html data-theme="light">, which is the application default
   (see the bootstrap script in index.html / js/theme.js).
   The gold/accent family can be further overridden at runtime
   by the owner's chosen brand color (Settings → Branding & Theme).
   ===================================================== */
/* ── Theme-aware logo swap (see Shared/Logo.razor) ──
   The cream "light" mark reads well on the dark "Concrete Cellar" surfaces; the near-black
   "dark" mark reads well on the light "Concrete Daylight" surfaces — so each theme shows
   the opposite-named asset. Pure CSS keyed off html[data-theme] — no JS/render-order issues. */
.logo-for-light-theme { display: none; }
.logo-for-dark-theme { display: inline-block; }
html[data-theme="light"] .logo-for-dark-theme { display: none; }
html[data-theme="light"] .logo-for-light-theme { display: inline-block; }

html[data-theme="light"] {
  /* ── Light mode palette (overridable by owner via --custom-light-* props set in JS) ── */
  --bg-base:      var(--custom-light-bg,   #f2efe8);
  --bg-surface:   var(--custom-light-surf, #ffffff);
  --bg-elevated:  var(--custom-light-elev, #ffffff);
  --bg-card:      var(--custom-light-card, #ffffff);
  --bg-input:     var(--custom-light-inp,  #ffffff);

  /* Borders */
  --border:       var(--custom-light-bord, #e3ddd0);
  --border-mid:   var(--custom-light-brdm, #d3cabb);
  --border-gold:  #e9dcb3;

  /* Gold (deepened slightly for AA contrast on light surfaces) */
  --gold:         #a9821f;
  --gold-bright:  #c9a227;
  --gold-dim:     rgba(169, 130, 31, 0.35);
  --gold-glow:    rgba(169, 130, 31, 0.10);

  /* Text */
  --text:         var(--custom-light-text, #2a2620);
  --text-sec:     var(--custom-light-ts,   #6b6256);
  --text-muted:   #9c9486;

  /* Status text — deepened for contrast on light backgrounds */
  --success-text: #1f7a3d;
  --danger-text:  #b33a3a;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Concrete grain overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9000;
}

/* Concrete block lines */
body {
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.006) 0px,
      rgba(255,255,255,0.006) 1px,
      transparent 1px,
      transparent 96px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(255,255,255,0.004) 0px,
      rgba(255,255,255,0.004) 1px,
      transparent 1px,
      transparent 120px
    );
}

/* ── App Layout ── */
.layout-wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: 228px;
  min-width: 228px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 1px; height: 100%;
  background: linear-gradient(to bottom, transparent, var(--gold-dim) 15%, var(--gold-dim) 85%, transparent);
  pointer-events: none;
}

/* ── Brand ── */
.brand {
  padding: 26px 20px 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo {
  width: 140px;
  height: auto;
  opacity: 0.9;
}
.brand-tagline {
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 5px;
}

/* ── Navigation ── */
.nav-section { padding: 12px 0; border-bottom: 1px solid var(--border); }
.nav-section:last-child { border-bottom: none; }

.nav-section-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  color: var(--text-sec);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-left: 2px solid transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  cursor: pointer;
}
.nav-item:hover {
  color: var(--text);
  background: var(--bg-elevated);
  border-left-color: var(--gold-dim);
}
.nav-item.active {
  color: var(--gold);
  background: var(--gold-glow);
  border-left-color: var(--gold);
  font-weight: 600;
}

/* ── Sidebar footer ── */
.sidebar-footer {
  margin-top: auto;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.sidebar-footer strong { color: var(--text-sec); font-weight: 500; }

/* ── Theme toggle (dark/light mode) ── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--border-mid);
  background: var(--bg-elevated);
  color: var(--text-sec);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.theme-toggle:hover {
  border-color: var(--gold-dim);
  background: var(--gold-glow);
  transform: scale(1.06);
}
.theme-toggle:active { transform: scale(0.94); }

.theme-toggle--floating {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  width: 38px;
  height: 38px;
  font-size: 17px;
  background: var(--bg-card);
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}

.sidebar-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* ── Mobile top bar (hamburger + logo) — hidden on desktop, shown via media query below ── */
.mobile-topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 60;
  /* Respect the iPhone notch / status bar */
  padding-top: max(10px, env(safe-area-inset-top));
  padding-left: max(14px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
}
.mobile-topbar-logo {
  height: 28px;
  width: auto;
  flex: 1;
  opacity: 0.92;
}

.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s, background 0.15s;
}
.hamburger-btn:hover { border-color: var(--gold-dim); background: var(--gold-glow); }
.hamburger-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* ── Mobile sidebar backdrop (tap to close the drawer) ── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 70;
  animation: sidebar-backdrop-fade 0.18s ease;
}
@keyframes sidebar-backdrop-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Main content ── */
.main-content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
}

.page-header {
  padding: 22px 30px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.page-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
}
.page-title-gold { color: var(--gold); }

.page-body {
  padding: 26px 30px;
  flex: 1;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 2px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-top-color 0.15s;
}
.stat-card:hover { border-top-color: var(--gold); }

.stat-value {
  font-family: var(--font-heading);
  font-size: 34px;
  font-weight: 600;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 5px;
}
.stat-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Grid ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }

label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-sec);
  margin-bottom: 7px;
}

input[type="text"],
input:not([type]),
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="tel"],
input[type="search"],
input[type="url"],
select,
textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
input::placeholder { color: var(--text-muted); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-gold {
  background: var(--gold);
  color: #0b0a08;
  border-color: var(--gold);
}
.btn-gold:hover:not(:disabled) {
  background: var(--gold-bright);
  border-color: var(--gold-bright);
}

.btn-outline {
  background: transparent;
  color: var(--gold);
  border-color: var(--border-gold);
}
.btn-outline:hover:not(:disabled) {
  background: var(--gold-glow);
  border-color: var(--gold-dim);
}

.btn-ghost {
  background: transparent;
  color: var(--text-sec);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-elevated);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: var(--danger-text);
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { opacity: 0.85; }

.w-full { width: 100%; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead tr { border-bottom: 1px solid var(--border-gold); }
th {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-dim);
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tr:hover td { background: var(--bg-elevated); }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid;
}
.badge-gold    { background: rgba(201,162,39,0.12); color: var(--gold);         border-color: rgba(201,162,39,0.22); }

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(201,162,39,0.4); }
  50%       { opacity: 0.8; box-shadow: 0 0 0 4px rgba(201,162,39,0); }
}
.badge-success { background: rgba(58,107,70,0.15);  color: var(--success-text); border-color: rgba(58,107,70,0.3); }
.badge-danger  { background: rgba(122,40,40,0.15);  color: var(--danger-text);  border-color: rgba(122,40,40,0.3); }
.badge-muted   { background: rgba(78,72,64,0.2);    color: var(--text-sec);     border-color: var(--border); }

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.divider-gold { height: 1px; background: linear-gradient(to right, transparent, var(--border-gold), transparent); margin: 20px 0; }

/* ── Login Page ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 700px; height: 700px;
  background: radial-gradient(ellipse, rgba(201,162,39,0.05) 0%, transparent 65%);
  pointer-events: none;
}

.login-box {
  width: 100%;
  max-width: 370px;
  padding: 42px 38px;
  background: var(--bg-surface);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  box-shadow:
    0 24px 80px rgba(0,0,0,0.7),
    0 0 0 1px rgba(201,162,39,0.04),
    inset 0 1px 0 rgba(201,162,39,0.06);
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 30px;
}
.login-logo-img {
  width: 260px;
  height: auto;
  filter: drop-shadow(0 0 24px rgba(201,162,39,0.12));
}

.login-error {
  background: rgba(122,40,40,0.2);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  color: var(--danger-text);
  font-size: 12px;
  padding: 9px 12px;
  margin-bottom: 14px;
}

/* ── Spacing utilities ── */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.mt-4 { margin-top: 22px; }
.mt-5 { margin-top: 32px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 14px; }
.mb-4 { margin-bottom: 22px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 14px; }
.gap-4 { gap: 22px; }
.text-gold { color: var(--gold); }
.text-muted { color: var(--text-muted); }
.text-sec { color: var(--text-sec); }
.font-heading { font-family: var(--font-heading); }
.uppercase { text-transform: uppercase; letter-spacing: 0.08em; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

/* ── Blazor loading & error ── */
.loading-progress {
  position: absolute;
  display: block;
  width: 7rem;
  height: 7rem;
  inset: 20vh 0 auto 0;
  margin: 0 auto;
}
.loading-progress circle {
  fill: none;
  stroke: var(--border-mid);
  stroke-width: 0.6rem;
  transform-origin: 50% 50%;
  transform: rotate(-90deg);
}
.loading-progress circle:last-child {
  stroke: var(--gold);
  stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
  transition: stroke-dasharray 0.05s ease-in-out;
}
.loading-progress-text {
  position: absolute;
  text-align: center;
  inset: calc(20vh + 2.8rem) 0 auto 0;
}
.loading-progress-text::after {
  content: var(--blazor-load-percentage-text, "Loading");
  font-family: var(--font-heading);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

#blazor-error-ui {
  display: none;
  background: var(--danger);
  border-top: 1px solid rgba(192,80,80,0.4);
  color: #ddd4c0; /* fixed light text — independent of theme so it stays legible on the dark-red banner in both modes */
  font-size: 13px;
  padding: 10px 16px;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 10000;
}
#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* ── Validation ── */
.valid.modified:not([type=checkbox]) { border-color: var(--success) !important; }
.invalid { border-color: var(--danger-text) !important; }
.validation-message { color: var(--danger-text); font-size: 11px; margin-top: 4px; }

/* ── Table ── */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  padding: 10px 14px;
  text-align: left;
  font-family: var(--font-heading);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-sec);
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.15);
}
.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(201,162,39,0.04); }

/* ── Badge extra ── */
.badge-green { background: rgba(58,107,70,0.15); color: var(--success-text); border-color: rgba(58,107,70,0.3); }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-family: var(--font-heading);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}
.modal-body { padding: 20px; }

/* ── Swish payment pulse ── */
.swish-pulse {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(91, 194, 167, 0.18);
  border: 2px solid #5BC2A7;
  position: relative;
  animation: swish-pulse-anim 1.6s ease-out infinite;
}
.swish-pulse::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: #5BC2A7;
}
@keyframes swish-pulse-anim {
  0%   { box-shadow: 0 0 0 0 rgba(91, 194, 167, 0.35); }
  70%  { box-shadow: 0 0 0 16px rgba(91, 194, 167, 0); }
  100% { box-shadow: 0 0 0 0 rgba(91, 194, 167, 0); }
}

/* ── Tabs ── */
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 16px 10px;
  font-family: var(--font-heading);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-sec);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text-pri); }
.tab-btn--active { color: var(--gold); border-bottom-color: var(--gold); }
.tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--border); color: var(--text-sec);
  border-radius: 10px; font-size: 10px; padding: 1px 6px;
  margin-left: 6px;
}
.tab-count--gold { background: rgba(201,162,39,0.2); color: var(--gold); }

/* ── Plan option (register page) ── */
.plan-option {
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 4px;
  transition: border-color 0.15s;
}
.plan-option:hover { border-color: rgba(201,162,39,0.5); }
.plan-option--selected { border-color: var(--gold); background: rgba(201,162,39,0.06); }
.plan-radio {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border); flex-shrink: 0; transition: border-color 0.15s;
}
.plan-radio--selected { border-color: var(--gold); background: var(--gold); }

/* ── Form section title ── */
.form-section-title {
  font-family: var(--font-heading);
  font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-sec);
  margin: 0 0 14px 0;
}

/* ── mb-4 ── */
.mb-4 { margin-bottom: 20px; }

/* ── Calendar ── */
.calendar-grid {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  font-size: 12px;
  background: var(--surface);
}
.cal-time-col { background: var(--surface); border-right: 1px solid var(--border); }
.cal-day-header {
  padding: 10px 6px;
  text-align: center;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.15);
  color: var(--text-sec);
}
.cal-day-header--today { background: rgba(201,162,39,0.08); color: var(--text-pri); }
.cal-time-label {
  padding: 4px 6px 4px 4px;
  color: var(--text-sec);
  font-size: 10px;
  text-align: right;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.08);
  line-height: 42px;
}
.cal-cell {
  min-height: 44px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 2px;
  vertical-align: top;
}
.cal-cell--today { background: rgba(201,162,39,0.04); }
.cal-event {
  background: rgba(201,162,39,0.18);
  border-left: 2px solid var(--gold);
  border-radius: 2px;
  padding: 2px 4px;
  margin-bottom: 2px;
  cursor: default;
}
.cal-event--completed { background: rgba(58,107,70,0.15); border-left-color: var(--success-text); }
.cal-event--cancelled { background: rgba(122,40,40,0.15); border-left-color: var(--danger-text); opacity: 0.6; }

/* ── Card inactive ── */
.card--inactive { opacity: 0.55; }

/* ── Grid-3 ── */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-3 { grid-template-columns: 1fr; } }

/* ── Session cards ── */
.session-card { transition: border-color 0.15s; }
.session-card--group { border-left: 3px solid var(--gold); }

/* ── Time input (opening hours editor) ── */
.time-input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-pri);
  padding: 7px 10px;
  font-size: 13px;
  font-family: var(--font-body);
}
.time-input:focus { outline: none; border-color: var(--gold); }
.time-input:disabled { opacity: 0.4; cursor: not-allowed; }
.time-input::-webkit-calendar-picker-indicator { filter: invert(0.6); cursor: pointer; }

/* ── Settings section title ── */
.settings-section-title {
  font-family: var(--font-heading);
  font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-sec);
  margin-bottom: 14px;
}

/* ── Package cards ── */
.package-card { transition: border-color 0.15s, transform 0.15s; }
.package-card:hover { border-color: var(--gold); transform: translateY(-1px); }

/* ── Filter chips ── */
.filter-chip {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 12px;
  font-family: var(--font-body);
  color: var(--text-sec);
  cursor: pointer;
  transition: all 0.15s;
}
.filter-chip:hover { border-color: var(--gold); color: var(--text-pri); }
.filter-chip--active { background: rgba(201,162,39,0.12); border-color: var(--gold); color: var(--gold); }

/* ── Select input (native, styled to match) ── */
.select-input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-pri);
  padding: 7px 10px;
  font-size: 13px;
  font-family: var(--font-body);
}
.select-input:focus { outline: none; border-color: var(--gold); }

/* ── Pinned announcement card ── */
.card--pinned {
  border-color: rgba(201,162,39,0.4);
  background: rgba(201,162,39,0.04);
}

/* ── Member Card ── */
.member-card {
  width: 340px;
  border-radius: 12px;
  background: linear-gradient(145deg, #1a1814 0%, #0e0d0b 60%, #1c1812 100%);
  border: 1px solid var(--border-gold);
  box-shadow: 0 20px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(201,162,39,0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.member-card__header {
  padding: 20px 24px 12px;
  border-bottom: 1px solid rgba(201,162,39,0.1);
}
.member-card__logo { width: 120px; height: auto; }
.member-card__body {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.avatar-circle {
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-weight: 700;
  color: #111; flex-shrink: 0; overflow: hidden;
}
.avatar-circle img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.avatar-upload {
  display: flex; align-items: center; gap: 14px;
}
.avatar-upload input[type="file"] { display: none; }
.member-card__avatar {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-size: 22px; font-weight: 700;
  color: #111; margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.member-card__name {
  font-family: var(--font-heading);
  font-size: 20px; letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.member-card__plan { margin-bottom: 16px; }
.member-card__meta {
  width: 100%;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 4px;
}
.member-card__meta-row {
  display: flex; justify-content: space-between;
  font-size: 12px; padding: 4px 0;
}
.member-card__meta-label { color: var(--text-sec); }
.member-card__qr-section {
  padding: 20px;
  text-align: center;
  border-top: 1px solid rgba(201,162,39,0.1);
  background: rgba(0,0,0,0.2);
}
.member-card__qr {
  background: #fff; border-radius: 8px;
  display: inline-block; padding: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.member-card__footer {
  padding: 10px 24px;
  font-size: 9px; letter-spacing: 0.2em;
  color: var(--text-muted); text-align: center;
  border-top: 1px solid var(--border);
}

/* =====================================================
   Hero Carousel — rotating, animated landing-page imagery
   ===================================================== */
.hero-carousel {
  position: relative;
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-base);
}
.hero-slide {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 1.6s ease-in-out, transform 9s ease-out;
  will-change: opacity, transform;
}
.hero-slide.is-active {
  opacity: 1;
  transform: scale(1);
  z-index: 1;
}
.hero-carousel-overlay {
  position: absolute; inset: 0;
  z-index: 2;
  background:
    linear-gradient(180deg, rgba(11,10,8,0.15) 0%, rgba(11,10,8,0.55) 65%, rgba(11,10,8,0.92) 100%),
    linear-gradient(90deg, rgba(11,10,8,0.55) 0%, rgba(11,10,8,0.05) 40%);
}
.hero-carousel-caption {
  position: absolute;
  left: 32px; bottom: 64px;
  z-index: 3;
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 15px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
  animation: hero-caption-fade-in 1s ease-out;
}
@keyframes hero-caption-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 0.85; transform: translateY(0); }
}
.hero-carousel-dots {
  position: absolute;
  right: 28px; bottom: 28px;
  z-index: 3;
  display: flex; gap: 8px;
}
.hero-carousel-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 1px solid var(--gold-dim);
  background: rgba(255,255,255,0.12);
  cursor: pointer;
  padding: 0;
  transition: all 0.3s ease;
}
.hero-carousel-dot:hover { background: var(--gold-dim); }
.hero-carousel-dot.is-active {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 10px var(--gold-dim);
  width: 22px; border-radius: 5px;
}

/* =====================================================
   Public Landing Page
   ===================================================== */
.landing-page {
  background: var(--bg-base);
  color: var(--text);
  min-height: 100vh;
}
/* ── Ken Burns zoom on hero background images ── */
@keyframes ken-burns {
  0%   { transform: scale(1)     translateX(0)    translateY(0); }
  100% { transform: scale(1.08)  translateX(-1%)  translateY(-0.5%); }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes stagger-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.landing-hero {
  position: relative;
  height: min(640px, 86vh);
  width: 100%;
  display: flex; align-items: flex-end;
  background: radial-gradient(circle at 30% 20%, var(--bg-elevated), var(--bg-base) 70%);
  overflow: hidden;
}
/* Hero background img with Ken Burns zoom */
.landing-hero-bg {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  animation: ken-burns 14s ease-out forwards;
  transform-origin: center center;
}
.landing-hero-overlay {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to top, rgba(11,10,8,0.85) 0%, rgba(11,10,8,0.45) 50%, rgba(11,10,8,0.2) 100%);
}
.landing-hero-content {
  position: relative; z-index: 4;
  padding: 0 48px 84px;
  max-width: 720px;
  animation: fade-up 0.9s ease-out both;
}

/* ── Banner section — full-bleed image, caption overlay ── */
.landing-banner {
  position: relative;
  height: clamp(260px, 38vw, 480px);
  overflow: hidden;
  border-top: 1px solid var(--border);
}
.landing-banner-img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 12s ease;
}
.landing-banner:hover .landing-banner-img { transform: scale(1.04); }
.landing-banner-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to right, rgba(11,10,8,0.82) 0%, rgba(11,10,8,0.35) 60%, transparent 100%);
}
.landing-banner-content {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 clamp(24px, 6vw, 80px);
  max-width: 640px;
}
.landing-banner-label {
  font-size: 11px; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--gold);
  margin-bottom: 10px;
}
.landing-banner-title {
  font-family: var(--font-heading);
  font-size: clamp(24px, 4vw, 44px);
  letter-spacing: 0.06em; line-height: 1.1;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.landing-banner-sub {
  color: var(--text-sec); font-size: 15px;
  line-height: 1.6; max-width: 440px;
}

/* ── Feature section — asymmetric split ── */
.landing-feature {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--border);
  min-height: clamp(260px, 38vw, 420px);
}
.landing-feature-image {
  position: relative; overflow: hidden;
}
.landing-feature-image img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.7s ease;
}
.landing-feature-image:hover img { transform: scale(1.04); }
.landing-feature-body {
  padding: clamp(32px, 6vw, 72px);
  display: flex; flex-direction: column; justify-content: center;
  background: var(--bg-card);
}
.landing-feature-eyebrow {
  font-size: 11px; letter-spacing: 0.26em;
  text-transform: uppercase; color: var(--gold);
  margin-bottom: 12px;
}
.landing-feature-title {
  font-family: var(--font-heading);
  font-size: clamp(22px, 3.5vw, 38px);
  letter-spacing: 0.06em; line-height: 1.1;
  margin-bottom: 18px; text-transform: uppercase;
}
.landing-feature-text {
  color: var(--text-sec); font-size: 15px;
  line-height: 1.75; max-width: 420px;
}
.landing-feature-cta {
  margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap;
}
.landing-hero-eyebrow {
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.landing-hero-title {
  font-family: var(--font-heading);
  font-size: clamp(36px, 6vw, 64px);
  letter-spacing: 0.05em;
  line-height: 1.05;
  margin-bottom: 18px;
  text-transform: uppercase;
}
.landing-hero-subtitle {
  color: var(--text-sec);
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 28px;
  max-width: 560px;
}
.landing-hero-actions {
  display: flex; gap: 14px; flex-wrap: wrap;
}
.landing-section {
  padding: 56px 48px;
  border-top: 1px solid var(--border);
}
.landing-section-title {
  font-family: var(--font-heading);
  font-size: 26px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 28px;
}
.landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.landing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  animation: stagger-in 0.5s ease both;
}
.landing-card:nth-child(1) { animation-delay: 0.05s; }
.landing-card:nth-child(2) { animation-delay: 0.12s; }
.landing-card:nth-child(3) { animation-delay: 0.19s; }
.landing-card:hover {
  border-color: var(--gold-dim);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(201,162,39,0.12);
}
.landing-card-title {
  font-family: var(--font-heading);
  letter-spacing: 0.06em;
  font-size: 16px;
  color: var(--gold-bright);
  margin-bottom: 10px;
}
.landing-card-row {
  display: flex; justify-content: space-between;
  font-size: 13px; padding: 5px 0;
  color: var(--text-sec);
  border-bottom: 1px dashed var(--border);
}
.landing-card-row:last-child { border-bottom: none; }
.landing-card-row span:last-child { color: var(--text); }
.landing-empty {
  color: var(--text-muted);
  font-size: 14px;
  font-style: italic;
}
.landing-footer {
  padding: 32px 48px;
  text-align: center;
  font-size: 11px; letter-spacing: 0.2em;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.landing-footer a { color: var(--gold-dim); }

/* ── Luxury stats band — gold numerals on near-black, framed by double rules ── */
.landing-stats-band {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(18px, 5vw, 64px);
  padding: 36px 24px;
  margin: 0 48px;
  border-top: 3px double var(--gold-dim);
  border-bottom: 3px double var(--gold-dim);
}
.landing-stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.landing-stat-value {
  font-family: var(--font-heading);
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}
.landing-stat-label {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-sec);
}
.landing-stat-divider { width: 1px; height: 42px; background: var(--border); }

/* ── Mid-page carousel — framed, cinematic ── */
.landing-mid-carousel {
  position: relative;
  height: clamp(260px, 44vw, 420px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--gold-dim);
  box-shadow: 0 24px 80px rgba(0,0,0,0.45);
}

/* ── Bottom gallery strip ── */
.landing-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.landing-gallery-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--border);
}
.landing-gallery-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.landing-gallery-item:hover img { transform: scale(1.05); }
.landing-gallery-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 18px 12px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  color: #fff;
  font-size: 12px;
  letter-spacing: 0.04em;
}

@media (max-width: 720px) {
  .landing-hero-content, .landing-section, .landing-footer { padding-left: 24px; padding-right: 24px; }
  .landing-stats-band { margin: 0 16px; flex-wrap: wrap; gap: 20px; }
  .landing-stat-divider { display: none; }
  .landing-feature { grid-template-columns: 1fr; }
  .landing-feature-image { height: 220px; }
  .landing-banner { height: clamp(200px, 50vw, 320px); }
  .landing-banner-overlay {
    background: linear-gradient(to bottom, rgba(11,10,8,0.55) 0%, rgba(11,10,8,0.88) 100%);
  }
}

/* =====================================================
   Mobile / Responsive
   Members, trainers, and even owners frequently use Agoge from a
   phone (iPhone-class ~375–430px viewports). Below ~880px the fixed
   sidebar becomes a slide-in drawer behind a hamburger button, grids
   collapse to fewer columns, tables scroll horizontally, and modals/
   inputs are tuned for touch (16px inputs avoid iOS Safari auto-zoom).
   ===================================================== */
@media (max-width: 880px) {

  /* ── App shell: sidebar becomes an off-canvas drawer ── */
  .layout-wrapper {
    flex-direction: column;
    height: 100dvh;
    height: 100vh; /* fallback for browsers without dvh support */
  }

  .mobile-topbar { display: flex; }

  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    height: 100dvh;
    height: 100vh;
    z-index: 80;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 0 0 40px rgba(0,0,0,0.4);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sidebar.is-open { transform: translateX(0); }

  .sidebar-backdrop { display: block; }

  .main-content {
    flex: 1;
    min-height: 0; /* allow inner scroll areas to size correctly in a flex column */
  }

  /* ── Tighter page chrome on small screens ── */
  .page-header {
    padding: 16px 16px 12px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .page-title { font-size: 17px; letter-spacing: 0.07em; }
  .page-body { padding: 16px; }

  /* ── Grids collapse to fewer columns, then one ── */
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* ── Cards / stat tiles get a little tighter ── */
  .card, .stat-card { padding: 16px; }
  .stat-value { font-size: 28px; }

  /* ── Tables: scroll horizontally instead of squashing columns ── */
  table, .table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  table thead, .table thead { display: table-header-group; }
  table tbody, .table tbody { display: table-row-group; }

  /* ── Week calendar: scroll horizontally instead of clipping the last day column ──
     Force each day column to a sane minimum width so content stays readable, then
     let the grid itself become a horizontal scroll area (it's wider than the screen). */
  .calendar-grid {
    grid-template-columns: 44px repeat(7, minmax(84px, 1fr));
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }

  /* ── Modals: near-fullscreen sheets on mobile ── */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%;
    width: 100%;
    max-height: 92dvh;
    max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* ── Forms: 16px input font-size prevents iOS Safari from zooming in on focus ── */
  input[type="text"],
  input:not([type]),
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  input[type="time"],
  input[type="tel"],
  input[type="search"],
  input[type="url"],
  select,
  textarea {
    font-size: 16px;
  }

  /* ── Comfortable touch targets ── */
  .btn { padding: 11px 18px; min-height: 42px; }
  .nav-item { padding: 11px 20px; font-size: 14px; }
  .tab-btn { padding: 10px 14px; }

  /* ── Landing page hero/sections breathe a bit less on phones ── */
  .landing-hero-title { font-size: 30px; }
  .landing-hero-eyebrow { font-size: 11px; }
  .landing-section-title { font-size: 18px; }
}

/* =====================================================
   Quick-action tiles (dashboards) — large thumb-friendly shortcuts
   ===================================================== */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: border-color 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}
.quick-action:hover { border-color: var(--gold); }
.quick-action:active { transform: scale(0.97); }
.quick-action-icon { font-size: 26px; line-height: 1; }
@media (max-width: 880px) {
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
  /* Client/trainer stat tiles: 2-up instead of stacked — denser, app-like */
  .client-stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* =====================================================
   Mobile bottom tab bar — iOS-style fixed nav for Client + Trainer.
   Hidden on desktop; on phones the main content gets bottom padding
   so nothing hides behind the bar (incl. iPhone home-indicator inset).
   ===================================================== */
.mobile-tabbar { display: none; }

@media (max-width: 880px) {
  .mobile-tabbar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 70;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -6px 24px rgba(0,0,0,0.25);
  }
  .tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 9px 4px 7px;
    min-height: 56px;
    background: none;
    border: none;
    color: var(--text-sec);
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
  }
  .tab-item.is-active { color: var(--gold); }
  .tab-icon { font-size: 20px; line-height: 1; }
  .tab-label { font-size: 10px; font-weight: 600; letter-spacing: 0.04em; }
  /* Center "primary" action — raised gold circle, app-launcher feel */
  .tab-icon-primary {
    font-size: 20px;
    line-height: 1;
    background: var(--gold);
    border-radius: 50%;
    width: 42px; height: 42px;
    display: flex; align-items: center; justify-content: center;
    margin-top: -18px;
    box-shadow: 0 4px 14px rgba(201,162,39,0.45);
    border: 3px solid var(--bg-dark);
  }
  .tab-item-primary .tab-label { color: var(--gold); }

  /* Reserve space for the bar at the bottom of every scrollable page */
  body:has(.mobile-tabbar) .main-content {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }
  /* :has() fallback — harmless extra padding when the bar isn't rendered (owner) */
  @supports not selector(body:has(a)) {
    .main-content { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  }

  /* Theme toggle + small icon buttons: comfortable 40px tap target on touch */
  .theme-toggle, .mobile-topbar button { min-width: 40px; min-height: 40px; }

  /* Horizontally scrolling tables: gradient cue on the right edge so users
     know there's more content off-screen */
  table, .table {
    background:
      linear-gradient(to left, color-mix(in srgb, var(--gold) 14%, transparent), transparent 18px)
      right / 18px 100% no-repeat;
    background-attachment: scroll;
  }
}

@media (min-width: 881px) {
  /* Never show the mobile chrome on larger viewports */
  .mobile-topbar, .sidebar-backdrop, .mobile-tabbar { display: none; }
}

/* Smaller phones (e.g. iPhone SE / mini, ~375px and narrower) */
@media (max-width: 400px) {
  .grid-2, .grid-3, .grid-4 { gap: 10px; }
  .page-title { font-size: 15px; }
  .stat-value { font-size: 24px; }
  .landing-hero-title { font-size: 24px; }
  .sidebar { width: 84vw; min-width: 0; max-width: 320px; }
}
