/* ═══════════════════════════════════════════════════════════
   LABYRINTH BJJ — CRM STYLES
   Dark theme: #0A0A0A | Gold accent: #C8A24C
   Fonts: Clash Display (headings) + General Sans (body)
   ═══════════════════════════════════════════════════════════ */

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

:root {
  --bg: #0A0A0A;
  --surface: #111111;
  --surface-2: #161616;
  --surface-3: #1A1A1A;
  --border: #222222;
  --border-hover: #333333;
  --gold: #C8A24C;
  --gold-dim: #9E7D33;
  --gold-glow: rgba(200, 162, 76, 0.15);
  --gold-glow-strong: rgba(200, 162, 76, 0.25);
  --text: #E8E8E8;
  --text-muted: #888888;
  --text-faint: #777777;
  --success: #34D399;
  --success-bg: rgba(52, 211, 153, 0.1);
  --error: #F87171;
  --error-bg: rgba(248, 113, 113, 0.1);
  --warning: #FBBF24;
  --warning-bg: rgba(251, 191, 36, 0.1);
  --info: #60A5FA;
  --info-bg: rgba(96, 165, 250, 0.1);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --font-display: 'Clash Display', 'Arial Black', sans-serif;
  --font-body: 'General Sans', 'Inter', -apple-system, sans-serif;
  --sidebar-width: 240px;
  --header-height: 56px;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: #DDB655; }

::selection {
  background: var(--gold-glow-strong);
  color: var(--text);
}

/* ── LOGIN ────────────────────────────────────────────── */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-logo {
  margin-bottom: 24px;
  opacity: 0.9;
}

.login-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 4px;
  margin-bottom: 4px;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 32px;
}

.login-error {
  color: var(--error);
  font-size: 13px;
  margin-top: 12px;
}

/* ── FORMS ────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

input, select, textarea {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

input::placeholder, textarea::placeholder {
  color: var(--text-faint);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* ── BUTTONS ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--gold);
  color: #0A0A0A;
}
.btn-primary:hover {
  background: #DDB655;
  box-shadow: 0 4px 12px rgba(200,162,76,0.3);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--surface-3);
  border-color: var(--border-hover);
}

.btn-danger {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(248,113,113,0.2);
}
.btn-danger:hover {
  background: rgba(248,113,113,0.15);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 12px;
}
.btn-ghost:hover {
  color: var(--text);
  background: var(--surface-2);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-full { width: 100%; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── APP SHELL ────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: 1fr;
  height: 100dvh;
  overflow: hidden;
}

/* ── SIDEBAR ──────────────────────────────────────────── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 100;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 3px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav-item.active {
  color: var(--gold);
  background: var(--gold-glow);
}

.nav-item.active svg { stroke: var(--gold); }

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}

.logout-btn:hover {
  color: var(--error) !important;
}

/* ── MOBILE HEADER ────────────────────────────────────── */
.mobile-header {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.hamburger {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
}

.mobile-brand {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 3px;
}

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

/* ── MAIN CONTENT ─────────────────────────────────────── */
.main-content {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px;
}

/* ── PAGE HEADER ──────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── STAT CARDS ───────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--transition);
}

.stat-card:hover {
  border-color: rgba(200,162,76,0.3);
  transform: translateY(-2px);
  transition: all 0.2s ease;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums lining-nums;
}

.stat-value.gold { color: var(--gold); }

.stat-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
}

.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--error); }

/* ── TABLES ───────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}

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

tr:hover td {
  background: var(--surface-2);
}

/* ── BADGES ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-active {
  background: var(--success-bg);
  color: var(--success);
}

.badge-trial {
  background: var(--info-bg);
  color: var(--info);
}

.badge-paused {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-cancelled, .badge-failed {
  background: var(--error-bg);
  color: var(--error);
}

.badge-frozen {
  background: rgba(147,197,253,0.1);
  color: #93C5FD;
}

/* ── SEARCH BAR ───────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.search-input {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-input input {
  padding-left: 40px;
}

.search-input svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.filter-select {
  min-width: 140px;
}

/* ── FEED LIST ────────────────────────────────────────── */
.feed-list {
  display: flex;
  flex-direction: column;
}

.feed-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.feed-item:last-child { border-bottom: none; }

.feed-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.feed-icon.payment { background: var(--success-bg); color: var(--success); }
.feed-icon.booking { background: var(--info-bg); color: var(--info); }
.feed-icon.failed { background: var(--error-bg); color: var(--error); }

.feed-info {
  flex: 1;
  min-width: 0;
}

.feed-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.feed-detail {
  font-size: 12px;
  color: var(--text-muted);
}

.feed-amount {
  font-size: 14px;
  font-weight: 700;
  color: var(--success);
  font-variant-numeric: tabular-nums;
}

.feed-date {
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
}

/* ── DASHBOARD GRID ───────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── EMAIL / SMS COMPOSER ─────────────────────────────── */
.composer {
  max-width: 720px;
}

.composer-toolbar {
  display: flex;
  gap: 4px;
  padding: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.toolbar-btn {
  padding: 6px 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  font-size: 13px;
  transition: all var(--transition);
}

.toolbar-btn:hover {
  color: var(--text);
  background: var(--surface-3);
}

.composer-body {
  min-height: 200px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  outline: none;
}

.composer-body:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.char-counter {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

.char-counter.warn { color: var(--warning); }
.char-counter.over { color: var(--error); }

/* ── RECIPIENT PICKER ─────────────────────────────────── */
.recipient-options {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.recipient-chip {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-muted);
}

.recipient-chip:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.recipient-chip.selected {
  background: var(--gold-glow);
  border-color: var(--gold);
  color: var(--gold);
}

/* ── SETTINGS ─────────────────────────────────────────── */
.settings-section {
  margin-bottom: 32px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.api-key-field {
  position: relative;
}

.api-key-field .status-dot {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.connected { background: var(--success); }
.status-dot.disconnected { background: var(--error); }

.plan-row {
  display: grid;
  grid-template-columns: 1fr 100px 120px 40px;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
}

/* ── TOAST ────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: slideIn 200ms ease-out;
  max-width: 360px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
.toast.info { border-left: 3px solid var(--info); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── MODAL ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color var(--transition);
}

.modal-close:hover { color: var(--text); }

.modal-body { padding: 24px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ── LOADING SPINNER ──────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

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

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  color: var(--text-faint);
  font-size: 13px;
}

/* ── EMPTY STATE ──────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  margin: 0 auto 16px;
  opacity: 0.3;
}

.empty-state p {
  font-size: 14px;
}

/* ── SKELETON ─────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: var(--header-height) 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform 250ms cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .mobile-header {
    display: flex;
  }

  .main-content {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-bar {
    flex-direction: column;
  }

  .search-input {
    min-width: 100%;
  }

  .plan-row {
    grid-template-columns: 1fr 80px 80px 40px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ══════════════════════════════════════════════════════════
   NEW UX — Checkout Modal, Member Enhancements, etc.
   ══════════════════════════════════════════════════════════ */

/* ── SEGMENTED TAB SWITCHER ───────────────────────────── */
.tab-switcher {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: calc(var(--radius) - 3px);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text);
  background: var(--surface-3);
}

.tab-btn.active {
  background: var(--surface-3);
  color: var(--gold);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── MEMBER TYPEAHEAD SEARCH ──────────────────────────── */
.member-search-wrap {
  position: relative;
}

.member-search-wrap input {
  width: 100%;
}

.typeahead-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius);
  max-height: 220px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  display: none;
}

.typeahead-dropdown.open {
  display: block;
}

.typeahead-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}

.typeahead-item:last-child {
  border-bottom: none;
}

.typeahead-item:hover,
.typeahead-item.focused {
  background: var(--surface-3);
}

.typeahead-item-name {
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.typeahead-item-meta {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── SELECTED MEMBER CARD ─────────────────────────────── */
.member-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--gold-glow);
  border: 1px solid rgba(200,162,76,0.3);
  border-radius: var(--radius);
  margin-top: 10px;
}

.member-card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold-glow-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
}

.member-card-info {
  flex: 1;
  min-width: 0;
}

.member-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.member-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.member-card-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color var(--transition);
  flex-shrink: 0;
}

.member-card-clear:hover { color: var(--error); }

/* ── CHECKOUT LINK RESULT ─────────────────────────────── */
.checkout-result {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}

.checkout-result-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.checkout-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.checkout-link-row input {
  flex: 1;
  font-size: 12px;
  font-family: monospace;
  background: var(--surface-3);
}

.checkout-send-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-send-email {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid rgba(96,165,250,0.2);
}
.btn-send-email:hover {
  background: rgba(96,165,250,0.15);
}

.btn-send-sms {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(52,211,153,0.2);
}
.btn-send-sms:hover {
  background: rgba(52,211,153,0.15);
}

/* ── BELT COLOR DOT ───────────────────────────────────── */
.belt-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.12);
  vertical-align: middle;
  margin-right: 4px;
}

/* ── TYPE BADGE ───────────────────────────────────────── */
.badge-type {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin-left: 4px;
  vertical-align: middle;
}

.badge-type-adult {
  background: rgba(200,162,76,0.1);
  color: var(--gold-dim);
}

.badge-type-kid {
  background: rgba(96,165,250,0.1);
  color: var(--info);
}

/* ── STAT BREAKDOWN ───────────────────────────────────── */
.stat-breakdown {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.stat-breakdown-item {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-breakdown-item .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}

.stat-breakdown-item.adult .dot { background: var(--gold-dim); }
.stat-breakdown-item.kid .dot { background: var(--info); }

/* ── CONFIRMATION DIALOG ──────────────────────────────── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 24px;
  animation: fadeIn 150ms ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.confirm-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  animation: slideUp 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.confirm-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--warning-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.confirm-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.confirm-message {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── RECURRING TOGGLE ─────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}

.toggle-label {
  font-size: 13px;
  color: var(--text);
}

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle-switch input {
  width: 0;
  height: 0;
  opacity: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--transition);
}

.toggle-track::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform var(--transition), background var(--transition);
}

.toggle-switch input:checked + .toggle-track {
  background: var(--gold-glow-strong);
  border: 1px solid var(--gold-dim);
}

.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(18px);
  background: var(--gold);
}

/* ── UTILITY ──────────────────────────────────────────── */
.flex { display: flex; }
.flex-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-right { text-align: right; }
.font-mono { font-variant-numeric: tabular-nums lining-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ══════════════════════════════════════════════════════════
   UNIFIED PAYMENT FLOW — POS-style modal
   ══════════════════════════════════════════════════════════ */

/* ── Payment Modal (wider) ────────────────────────────── */
.modal.payment-modal {
  max-width: 640px;
}

/* ── Flow Section ─────────────────────────────────────── */
.pay-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.pay-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.pay-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.pay-section-label .pay-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.pay-section.active .pay-step-num {
  background: var(--gold-glow);
  border-color: var(--gold-dim);
  color: var(--gold);
}

/* ── Manual entry toggle ──────────────────────────────── */
.manual-entry-link {
  display: inline-block;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  margin-top: 8px;
  transition: color var(--transition);
}

.manual-entry-link:hover {
  color: var(--gold);
}

.manual-entry-fields {
  display: none;
  margin-top: 12px;
}

.manual-entry-fields.visible {
  display: block;
  animation: fadeIn 150ms ease-out;
}

/* ── Plan Selector Cards ──────────────────────────────── */
.plan-type-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.plan-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 12px;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.plan-type-card:hover {
  border-color: var(--border-hover);
  background: var(--surface-3);
}

.plan-type-card.selected {
  border-color: var(--gold);
  background: var(--gold-glow);
}

.plan-type-card .plan-type-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
}

.plan-type-card.selected .plan-type-icon {
  background: var(--gold-glow-strong);
  color: var(--gold);
}

.plan-type-card .plan-type-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.plan-type-card .plan-type-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Plan Selector Expandable ─────────────────────────── */
.plan-expand-area {
  display: none;
  margin-top: 12px;
  animation: fadeIn 150ms ease-out;
}

.plan-expand-area.visible {
  display: block;
}

/* ── Selected plan display ────────────────────────────── */
.selected-plan-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

.selected-plan-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.selected-plan-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

/* ── Tax Row ──────────────────────────────────────────── */
.tax-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
}

.tax-row-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tax-rate-display {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ── Amount Breakdown ─────────────────────────────────── */
.amount-breakdown {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: none;
}

.amount-breakdown.visible {
  display: block;
  animation: fadeIn 150ms ease-out;
}

.amount-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.amount-row.total {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 8px;
  font-weight: 700;
  color: var(--text);
  font-size: 14px;
}

/* ── Summary Bar (sticky bottom) ──────────────────────── */
.pay-summary {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pay-summary-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.pay-summary-who {
  font-size: 13px;
  color: var(--text-muted);
}

.pay-summary-who strong {
  color: var(--text);
}

.pay-summary-total {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.pay-summary-actions {
  display: flex;
  gap: 8px;
}

.pay-summary-actions .btn {
  flex: 1;
}

.btn-cash {
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-cash:hover {
  background: var(--border);
}

/* ── Cash payment confirmation ────────────────────────── */
.cash-logged-confirm {
  text-align: center;
  padding: 24px;
}

.cash-logged-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--success-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--success);
}

.cash-logged-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.cash-logged-detail {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Payment method select cards ──────────────────────── */
.payment-method-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.payment-method-chip {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-muted);
}

.payment-method-chip:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.payment-method-chip.selected {
  background: var(--gold-glow);
  border-color: var(--gold);
  color: var(--gold);
}

/* ── Responsive adjustments for payment modal ─────────── */
@media (max-width: 480px) {
  .plan-type-cards {
    grid-template-columns: 1fr;
  }

  .pay-summary-actions {
    flex-direction: column;
  }

  .pay-summary-info {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ══════════════════════════════════════════════════════════
   EMBEDDED CHECKOUT + CARD ON FILE + TOAST WARNING
   ══════════════════════════════════════════════════════════ */

/* ── Stripe Embedded Checkout Container ──────────────── */
#stripeEmbedContainer {
  padding: 0;
}

.embed-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.embed-header-info {
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
  text-align: right;
}

.embed-header-info strong {
  color: var(--text);
}

.stripe-embed-mount {
  min-height: 400px;
  background: var(--surface);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.stripe-embed-mount iframe {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── "Generate Link" outline/secondary button ────────── */
.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  color: var(--text);
  border-color: var(--border-hover);
  background: var(--surface-2);
}

/* ── "Charge Card on File" button ────────────────────── */
.btn-charge-card {
  background: rgba(96, 165, 250, 0.08);
  color: var(--info);
  border: 1px solid rgba(96, 165, 250, 0.2);
  flex: 1;
}

.btn-charge-card:hover {
  background: rgba(96, 165, 250, 0.14);
  border-color: rgba(96, 165, 250, 0.35);
}

/* ── Payment Success State ───────────────────────────── */
.payment-success {
  text-align: center;
  padding: 32px 24px;
}

.payment-success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--success-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: var(--success);
  animation: scaleIn 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleIn {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.payment-success-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.payment-success-detail {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ── Warning Toast ───────────────────────────────────── */
.toast.warning {
  border-left: 3px solid var(--warning);
}

/* ══════════════════════════════════════════════════════════
   FEATURE 1 — CARD STATUS INDICATOR
   ══════════════════════════════════════════════════════════ */

.card-status {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}

.card-status.has-card {
  color: #22c55e;
}

.card-status.no-card {
  color: #777;
}

/* ══════════════════════════════════════════════════════════
   FEATURE 2 — FAMILY GROUPING
   ══════════════════════════════════════════════════════════ */

.family-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
  margin-left: 5px;
  vertical-align: middle;
  background: rgba(200, 162, 76, 0.08);
  border: 1px solid rgba(200, 162, 76, 0.2);
  color: var(--gold-dim);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.family-badge:hover {
  background: rgba(200, 162, 76, 0.15);
  border-color: var(--gold);
  color: var(--gold);
}

/* ══════════════════════════════════════════════════════════
   FEATURE 3 — UPCOMING TRIALS / TRIAL CARDS
   ══════════════════════════════════════════════════════════ */

.trial-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.trial-card:last-child {
  border-bottom: none;
}

.trial-date-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 8px 6px;
  background: rgba(200, 162, 76, 0.08);
  border-radius: 8px;
  border: 1px solid rgba(200, 162, 76, 0.18);
  flex-shrink: 0;
}

.trial-day {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1;
  margin-bottom: 2px;
}

.trial-date-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
}

.trial-month {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  line-height: 1;
  margin-top: 2px;
}

.trial-info {
  flex: 1;
  min-width: 0;
}

.trial-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trial-class {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trial-contact {
  font-size: 11px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Trial card — soon/today/tomorrow highlighting */
.trial-card.trial-soon {
  border-left: 2px solid var(--gold);
  padding-left: 12px;
}

.trial-date-block.trial-today {
  background: rgba(200, 162, 76, 0.2);
  border-color: var(--gold);
}

.trial-date-block.trial-tomorrow {
  background: rgba(200, 162, 76, 0.12);
}

/* Trial card actions column */
.trial-actions-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.trial-quick-actions {
  display: flex;
  gap: 4px;
}

.trial-action-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  color: var(--text-muted);
  transition: background var(--transition);
  padding: 0;
  line-height: 1;
}

.trial-action-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.trial-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 36px 24px;
  color: var(--text-faint);
  text-align: center;
}

.trial-empty svg {
  opacity: 0.25;
}

.trial-empty p {
  font-size: 13px;
}

/* Trial card — new redesigned elements */
.trial-name-link {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--transition);
}

.trial-name-link:hover {
  color: var(--gold);
  text-decoration: underline;
}

.trial-details {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 3px;
  flex-wrap: wrap;
}

.trial-class-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.trial-time {
  font-size: 12px;
  color: var(--gold);
  white-space: nowrap;
  font-weight: 500;
}

.trial-contact-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 1px;
}

.trial-phone,
.trial-email {
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

@media (max-width: 480px) {
  .trial-contact-row {
    display: none;
  }
  .trial-contact {
    display: none;
  }
}

/* ── Responsive: 3-button layout ─────────────────────── */
@media (max-width: 480px) {
  .pay-summary-actions {
    flex-direction: column;
  }

  .pay-summary-actions .btn {
    flex: none;
    width: 100%;
  }

  .embed-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .embed-header-info {
    text-align: left;
  }
}

/* ══════════════════════════════════════════════════
   MEMBER PROFILE VIEW
   ══════════════════════════════════════════════════ */

/* Clickable member name in table */
.member-name-link {
  color: var(--text);
  text-decoration: none;
  transition: color var(--transition);
}
.member-name-link:hover {
  color: var(--gold);
  text-decoration: none;
}

/* Profile page container */
.profile-container {
  padding: 0;
  max-width: 900px;
}

/* Top bar: back link + action buttons */
.profile-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.profile-topbar-actions {
  display: flex;
  gap: 8px;
}

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
  transition: color var(--transition);
}
.back-link:hover {
  color: var(--gold);
}

/* Profile header card */
.profile-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
}

.profile-header-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.profile-belt-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.1);
}

.profile-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 1px;
  text-transform: uppercase;
  line-height: 1.2;
}

.profile-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  margin-left: 26px;
}

/* Info grid */
.profile-info-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-left: 26px;
}

.profile-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
}

.profile-info-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  color: var(--text-muted);
}

/* Card info display */
.profile-card-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

/* Quick action buttons row */
.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.profile-actions .btn {
  font-size: 12px;
  padding: 6px 14px;
}

/* Payment history section */
.profile-payments {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.profile-payments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.profile-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Refund button */
.refund-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--error);
  background: transparent;
  border: 1px solid var(--error);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.refund-btn:hover {
  background: var(--error-bg);
  color: var(--error);
}

/* Receipt link */
.receipt-link {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.receipt-link:hover {
  color: var(--gold);
  border-color: var(--gold-dim);
}

/* Badge for refunded status */
.badge-refunded {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(251,191,36,0.2);
}

/* btn-error for confirm dialogs */
.btn-error {
  background: var(--error);
  color: #fff;
  border: none;
}
.btn-error:hover {
  background: #ef4444;
}

/* Responsive: mobile profile adjustments */
@media (max-width: 600px) {
  .profile-topbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .profile-topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .profile-sub,
  .profile-info-grid {
    margin-left: 0;
  }
  .profile-actions {
    gap: 6px;
  }
}

/* ── Communication History ─────────────────────────────── */
.comm-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.comm-item:last-child {
  border-bottom: none;
}

.comm-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 14px;
  flex-shrink: 0;
}

.comm-icon.comm-email {
  background: rgba(200, 162, 76, 0.1);
}

.comm-icon.comm-sms {
  background: rgba(100, 180, 120, 0.1);
}

.comm-info {
  flex: 1;
  min-width: 0;
}

.comm-subject {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comm-preview {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comm-meta {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 4px;
}

/* ── WAIVER SYSTEM ──────────────────────────────────────── */

/* Wider modal for waiver */
.waiver-modal {
  max-width: 700px;
  width: 95%;
}

/* Waiver legal text block */
.waiver-text {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-muted);
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 16px;
  white-space: pre-line;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.waiver-text::-webkit-scrollbar { width: 5px; }
.waiver-text::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Signer info fields — horizontal row */
.waiver-fields {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.waiver-fields .form-group {
  margin-bottom: 0;
}

/* Signature canvas container */
.waiver-canvas-wrap {
  margin-bottom: 16px;
}

/* The canvas itself */
.waiver-canvas {
  display: block;
  width: 100%;
  height: 130px;
  background: #0f0f0f;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: crosshair;
  touch-action: none;
}
.waiver-canvas:hover {
  border-color: var(--gold-dim);
}

/* Clear button above canvas */
.waiver-clear-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.waiver-clear-btn:hover {
  border-color: var(--error);
  color: var(--error);
}

/* "I Agree & Sign" button — gold, prominent */
.waiver-agree-btn {
  background: var(--gold);
  color: #000;
  font-weight: 700;
  border: none;
  padding: 10px 28px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: opacity var(--transition);
}
.waiver-agree-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.waiver-agree-btn:not(:disabled):hover {
  opacity: 0.88;
}

/* Waiver status badges — used in profiles and inline */
.waiver-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  padding: 3px 8px;
  border-radius: 4px;
}
.waiver-signed {
  color: var(--success);
  background: var(--success-bg);
}
.waiver-unsigned {
  color: var(--warning);
  background: var(--warning-bg);
}

/* Inline waiver status bar inside modals */
.waiver-status-inline {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--success-bg);
  font-size: 13px;
}

/* Profile waiver row — flex so buttons align right */
#profileWaiverStatus {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════
   DASHBOARD — PAYMENT PROGRESS BAR
   ═══════════════════════════════════════════════════════════ */
.payment-progress-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.payment-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.payment-bar-container { padding: 0 4px; }
.payment-bar { 
  height: 24px; 
  background: var(--surface-2); 
  border-radius: 12px; 
  overflow: hidden; 
  display: flex;
  margin: 16px 0;
}
.payment-bar-collected { 
  background: linear-gradient(90deg, #22c55e, #16a34a); 
  border-radius: 12px 0 0 12px;
  transition: width 0.8s ease;
  min-width: 0;
}
.payment-bar-overdue { 
  background: linear-gradient(90deg, #ef4444, #dc2626);
  transition: width 0.8s ease;
  min-width: 0;
}

.payment-bar-stats {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
}

.payment-bar-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.payment-bar-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.payment-bar-value {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.payment-bar-value.gold { color: var(--gold); }
.payment-bar-value.green { color: var(--success); }
.payment-bar-value.red { color: var(--error); }

.stats-grid-compact {
  grid-template-columns: repeat(3, 1fr) !important;
}

/* ═══════════════════════════════════════════════════════════
   DASHBOARD — OVERDUE PAYMENTS
   ═══════════════════════════════════════════════════════════ */
.overdue-card {
  border-color: rgba(248, 113, 113, 0.2) !important;
  background: var(--surface) !important;
  margin-bottom: 16px;
}

.overdue-card .card-header {
  border-bottom: 1px solid rgba(248, 113, 113, 0.15);
}

.overdue-card .card-title {
  color: var(--error);
}

.overdue-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--error);
  color: #000;
  font-size: 11px;
  font-weight: 700;
}

.overdue-list {
  padding: 8px 16px;
}

.overdue-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.overdue-item:last-child {
  border-bottom: none;
}

.overdue-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(248, 113, 113, 0.15);
  color: var(--error);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.overdue-info {
  flex: 1;
  min-width: 0;
}

.overdue-info .member-name-link {
  font-weight: 600;
  font-size: 14px;
}

.overdue-desc {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.overdue-amount-block {
  text-align: right;
  flex-shrink: 0;
}

.overdue-amount {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--error);
  background: rgba(248, 113, 113, 0.08);
  padding: 2px 10px;
  border-radius: 12px;
}

.overdue-date {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════
   POINT OF SALE
   ═══════════════════════════════════════════════════════════ */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  align-items: start;
}

/* ── Left: Product Catalog ── */
.pos-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.pos-tab {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-body);
}

.pos-tab:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.pos-tab.active {
  background: var(--gold);
  border-color: var(--gold);
  color: #000;
  font-weight: 600;
}

.pos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.pos-product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
}

.pos-product-card:hover {
  border-color: var(--gold-dim);
  background: var(--surface-2);
}

.pos-product-card.in-cart {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold-glow);
}

.pos-product-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}

.pos-product-price {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 4px;
}

.pos-product-cat {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pos-product-qty {
  font-size: 11px;
  color: var(--gold);
  margin-top: 4px;
  font-weight: 600;
}

.pos-add-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}

.pos-add-btn:hover {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
}

/* ── Right: Cart Sidebar ── */
.pos-cart {
  position: sticky;
  top: 0;
}

.pos-cart-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.pos-cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.pos-cart-title {
  font-weight: 700;
  font-size: 14px;
}

.pos-cart-clear {
  font-size: 12px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
}

.pos-cart-clear:hover {
  color: var(--error);
}

.pos-cart-items {
  padding: 8px 16px;
  max-height: 260px;
  overflow-y: auto;
}

.pos-cart-empty {
  padding: 24px 0;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

.pos-cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.pos-cart-item:last-child {
  border-bottom: none;
}

.pos-cart-item-info {
  flex: 1;
  min-width: 0;
}

.pos-cart-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pos-cart-item-price {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'General Sans', monospace;
}

.pos-cart-item-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
}

.pos-qty {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.pos-qty-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  font-family: var(--font-body);
}

.pos-qty-btn:hover {
  background: var(--surface-3);
  color: var(--gold);
}

.pos-qty-num {
  width: 28px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface);
}

.pos-remove-btn {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
}

.pos-remove-btn:hover {
  color: var(--error);
}

/* ── Cart Totals ── */
.pos-totals {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.pos-tax-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.toggle-sm .toggle-track {
  width: 34px !important;
  height: 18px !important;
}

.toggle-sm .toggle-track::before {
  width: 14px !important;
  height: 14px !important;
}

.toggle-sm input:checked + .toggle-track::before {
  transform: translateX(16px) !important;
}

.pos-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
  padding: 3px 0;
}

.pos-total-final {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
}

/* ── Customer Selection ── */
.pos-customer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.pos-customer-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.pos-customer-search {
  position: relative;
  margin-bottom: 8px;
}

.pos-customer-search input {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

.pos-customer-search input:focus {
  outline: none;
  border-color: var(--gold);
}

.pos-walkin-field input {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

.pos-walkin-field input:focus {
  outline: none;
  border-color: var(--gold-dim);
}

.pos-selected-customer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--gold-glow);
  border: 1px solid rgba(200,162,76,0.2);
  border-radius: var(--radius-sm);
}

.pos-cust-name {
  font-weight: 600;
  font-size: 13px;
  flex: 1;
}

.pos-cust-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.pos-cust-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
}

.pos-cust-clear:hover {
  color: var(--error);
}

/* ── Cart Actions ── */
.pos-actions {
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* ── Mobile Cart Footer ── */
.pos-mobile-footer {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 2px solid var(--gold);
  padding: 14px 20px;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  z-index: 100;
  cursor: pointer;
}

.pos-mobile-footer:not(.has-items) {
  opacity: 0.5;
}

#posMobileTotal {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--gold);
}

/* ── Responsive ── */
@media (max-width: 1100px) {
  .pos-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .pos-cart {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99;
    max-height: 70vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -4px 30px rgba(0,0,0,0.5);
  }

  .pos-cart.mobile-open {
    transform: translateY(0);
  }

  .pos-mobile-footer {
    display: flex;
  }

  .stats-grid-compact {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  .payment-bar-stats {
    gap: 16px;
  }

  .payment-bar-value {
    font-size: 17px;
  }
}

@media (max-width: 600px) {
  .pos-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid-compact {
    grid-template-columns: 1fr !important;
  }

  .payment-bar-stats {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
}

/* ═══════════════════════════════════════════════════════════
   LOCATION SWITCHER
   ═══════════════════════════════════════════════════════════ */
.location-switcher {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.location-switcher select {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

.location-switcher select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

/* ═══════════════════════════════════════════════════════════
   FRANCHISE MODE
   ═══════════════════════════════════════════════════════════ */
.franchise-grid {
  display: grid;
  gap: 16px;
}

.franchise-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  border-left: 4px solid var(--loc-color, var(--border));
  transition: all var(--transition);
}

.franchise-card:hover:not(.coming-soon) {
  border-color: var(--border-hover);
  background: var(--surface-2);
}

.franchise-card.coming-soon {
  opacity: 0.5;
}

.franchise-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.franchise-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
}

.franchise-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.franchise-hq {
  font-size: 10px;
  font-weight: 700;
  color: var(--gold);
  background: var(--gold-glow);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.franchise-stats {
  display: flex;
  gap: 24px;
  margin: 12px 0;
  flex-wrap: wrap;
}

.franchise-stats span {
  font-size: 13px;
  color: var(--text-muted);
}

.franchise-stats strong {
  color: var(--text);
  font-weight: 600;
}

.franchise-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.badge-coming-soon {
  background: var(--surface-2);
  color: var(--text-faint);
  border: 1px solid var(--border);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
}

/* Franchise Settings */
.franchise-settings-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.franchise-settings-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.franchise-settings-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 260px;
  font-size: 13px;
}

.badge-sm {
  font-size: 10px;
  padding: 1px 6px;
}

@media (max-width: 768px) {
  .franchise-settings-row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .franchise-settings-info {
    min-width: auto;
  }
}


/* ═══════════════════════════════════════════════════════════
   MOBILE OPTIMIZATIONS  (iPhone 14 Pro — 390 × 844)
   All fixes for 12 identified issues. Edits: style.css only
   (app.js: added .members-table, .payments-table classes +
    togglePosCart() alias)
   ═══════════════════════════════════════════════════════════ */


/* ─── ISSUE 1 — Members table: hide low-priority columns ── */
/* Columns: 1=Name, 2=Email, 3=Phone, 4=Plan, 5=Status,
             6=Start Date, 7=Actions                         */
@media (max-width: 768px) {
  /* Hide Email, Phone, Start Date, Actions */
  .members-table th:nth-child(2),
  .members-table td:nth-child(2),
  .members-table th:nth-child(3),
  .members-table td:nth-child(3),
  .members-table th:nth-child(6),
  .members-table td:nth-child(6),
  .members-table th:nth-child(7),
  .members-table td:nth-child(7) {
    display: none;
  }

  /* Tighten remaining columns */
  .members-table th,
  .members-table td {
    padding: 8px 6px;
    font-size: 12px;
  }

  .members-table td:first-child {
    font-size: 13px;
  }
}


/* ─── ISSUE 2 — Payments table: hide Type & Date columns ── */
/* Columns: 1=Member, 2=Amount, 3=Status, 4=Type, 5=Date    */
@media (max-width: 768px) {
  .payments-table th:nth-child(4),
  .payments-table td:nth-child(4),
  .payments-table th:nth-child(5),
  .payments-table td:nth-child(5) {
    display: none;
  }

  .payments-table th,
  .payments-table td {
    padding: 8px 6px;
    font-size: 12px;
  }
}


/* ─── ISSUE 3 — Dashboard stat cards 2-col on mobile ────── */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-value {
    font-size: 24px;
  }
}

@media (max-width: 380px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}


/* ─── ISSUE 4 — Dashboard two-column grid → single col ──── */
/* Already handled in existing responsive block; reinforce: */
@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}


/* ─── ISSUE 6 — Modals full-screen on mobile ────────────── */
@media (max-width: 768px) {
  .modal-overlay {
    padding: 0;
    align-items: flex-end;   /* sheet slides from bottom */
  }

  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    margin: 0;
  }

  .modal-body {
    max-height: calc(92vh - 120px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}


/* ─── ISSUE 7 — Mobile header: sticky + solid background ── */
@media (max-width: 768px) {
  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }
}


/* ─── ISSUE 8 — Touch targets: 44px minimum ─────────────── */
@media (max-width: 768px) {
  .btn {
    min-height: 44px;
    padding: 10px 16px;
  }

  .btn-sm {
    min-height: 36px;
    padding: 6px 12px;
  }

  .nav-item {
    min-height: 44px;
    padding: 10px 16px;
  }

  /* Prevent iOS font-size zoom on input focus */
  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
  }

  /* Re-apply original select padding so arrow stays visible */
  select {
    padding-right: 36px;
  }

  /* Hamburger gets easier tap area */
  .hamburger {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}


/* ─── ISSUE 9 — Search/filter bar: horizontal scroll ────── */
/* Filters already stack vertically (flex-direction:column)
   per existing 768px rule. Convert to horizontal scroll row */
@media (max-width: 768px) {
  .search-bar {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
    /* Prevent scrollbar from taking space */
    scrollbar-width: none;
  }

  .search-bar::-webkit-scrollbar {
    display: none;
  }

  /* Search field: allow shrink but keep reasonable min */
  .search-input {
    min-width: 160px;
    flex-shrink: 1;
  }

  /* Filter dropdowns: don't shrink below readable width */
  .filter-select {
    min-width: 120px;
    flex-shrink: 0;
  }
}


/* ─── ISSUE 10 — Sidebar overlay backdrop ───────────────── */
/* Existing CSS uses transform approach (works correctly).
   Reinforce z-index layering and backdrop color:           */
@media (max-width: 768px) {
  #sidebar {
    z-index: 200;
  }

  .sidebar-overlay {
    z-index: 199;
    background: rgba(0, 0, 0, 0.6);
    /* Always rendered but hidden; .open class reveals it */
    display: none;
  }

  .sidebar-overlay.open {
    display: block;
  }
}


/* ─── ISSUE 11 — Payment progress bar stats ─────────────── */
/* Already handled in @media 600px block.
   Add 768px rule so it kicks in earlier on phone:          */
@media (max-width: 768px) {
  .payment-bar-stats {
    flex-wrap: wrap;
    gap: 12px;
  }

  .payment-bar-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }
}


/* ─── ISSUE 12 — Member profile: single-column grid ─────── */
@media (max-width: 768px) {
  .profile-info-grid {
    grid-template-columns: 1fr;
  }

  .profile-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  .profile-actions .btn {
    flex: 1 1 auto;
    min-width: calc(50% - 4px);
    text-align: center;
    justify-content: center;
  }
}


/* ── FRANCHISE COMBINED STATS ─────────────────────────── */
.franchise-combined-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.franchise-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.franchise-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.franchise-stat-value {
  font-size: 24px;
  font-weight: 700;
  margin-top: 4px;
}
.franchise-stat-value.gold { color: var(--gold); }

@media (max-width: 768px) {
  .franchise-combined-stats { grid-template-columns: 1fr 1fr; }
}

/* ── DASHBOARD FEED CARDS — HALF HEIGHT ───────────────── */
.dashboard-feed-card { max-height: 320px; overflow: hidden; }
.dashboard-feed-card .feed-list,
.dashboard-feed-card .trial-feed-list { max-height: 260px; overflow-y: auto; }

/* ── SIDEBAR FRANCHISE DIVIDER & GOLD NAV ─────────────── */
.sidebar-divider { height: 1px; background: var(--border); margin: 8px 16px; }

.nav-franchise { color: var(--gold-dim) !important; }
.nav-franchise svg { stroke: var(--gold-dim); }
.nav-franchise:hover { color: var(--gold) !important; background: var(--gold-glow) !important; }
.nav-franchise:hover svg { stroke: var(--gold); }
.nav-franchise.active { color: var(--gold) !important; background: var(--gold-glow) !important; }
.nav-franchise.active svg { stroke: var(--gold); }

/* ── STAT CARD CLICKABLE ──────────────────────────────── */
.stat-card.clickable { cursor: pointer; transition: border-color var(--transition), transform var(--transition); }
.stat-card.clickable:hover { border-color: var(--gold); transform: translateY(-1px); }

/* ── TRIAL LEADS POPUP ────────────────────────────────── */
.modal-wide { max-width: 560px !important; width: 100% !important; }

.lead-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.lead-item:last-child { border-bottom: none; }
.lead-checkbox { margin-top: 4px; accent-color: var(--gold); }
.lead-info { flex: 1; min-width: 0; }
.lead-name { font-size: 14px; font-weight: 600; }
.lead-detail { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.lead-contact { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.lead-actions { display: flex; gap: 4px; margin-top: 6px; }

.leads-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 11px;
  height: auto;
  min-height: unset;
}


/* ══════════════════════════════════════════════════════════
   UX OVERHAUL — NEW STYLES
   ══════════════════════════════════════════════════════════ */

/* ── ITEM 1: MORNING BRIEFING CARD ───────────────────── */
.briefing-card {
  background: linear-gradient(135deg, rgba(200,162,76,0.08), rgba(200,162,76,0.02));
  border: 1px solid rgba(200,162,76,0.15);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.briefing-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.briefing-day { font-size: 18px; font-weight: 700; color: var(--text); font-family: var(--font-display); }
.briefing-greeting { font-size: 13px; color: var(--text-muted); }
.briefing-items { display: flex; flex-direction: column; gap: 8px; }
.briefing-item { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-muted); padding: 6px 0; }
.briefing-item.highlight { color: var(--gold); font-weight: 500; }
.briefing-item.alert { color: var(--error); font-weight: 500; }
.briefing-icon { font-size: 16px; width: 24px; text-align: center; }

/* ── ITEM 3: ONBOARDING WIZARD ───────────────────────── */
.onboarding-wizard {
  width: 100%; max-width: 600px; height: 90vh;
  display: flex; flex-direction: column;
}
.wizard-steps {
  display: flex; padding: 16px 24px; border-bottom: 1px solid var(--border);
  gap: 4px; overflow-x: auto;
}
.wizard-step {
  display: flex; align-items: center; gap: 6px; font-size: 12px;
  color: var(--text-faint); white-space: nowrap;
}
.wizard-step.active { color: var(--gold); font-weight: 600; }
.wizard-step.completed { color: var(--success); }
.wizard-step-num {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); font-size: 11px; font-weight: 700;
}
.wizard-step.active .wizard-step-num { background: var(--gold); color: #000; }
.wizard-step.completed .wizard-step-num { background: var(--success); color: #fff; }
.wizard-step-arrow { color: var(--text-faint); font-size: 10px; margin: 0 2px; }
.wizard-body { flex: 1; overflow-y: auto; padding: 24px; }
.wizard-footer {
  display: flex; justify-content: space-between; padding: 16px 24px;
  border-top: 1px solid var(--border);
}
.wizard-body .form-group { margin-bottom: 16px; }
.wizard-body .waiver-text { max-height: 200px; overflow-y: auto; font-size: 12px; color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 16px; line-height: 1.6; }
.wizard-body .waiver-canvas { width: 100%; height: 120px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); cursor: crosshair; touch-action: none; }
.wizard-plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wizard-plan-card {
  padding: 14px; border: 2px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: all var(--transition); text-align: center;
}
.wizard-plan-card:hover { border-color: var(--border-hover); background: var(--surface-2); }
.wizard-plan-card.selected { border-color: var(--gold); background: var(--gold-glow); }
.wizard-plan-name { font-size: 13px; font-weight: 600; color: var(--text); }
.wizard-plan-price { font-size: 16px; font-weight: 700; color: var(--gold); margin-top: 4px; font-family: var(--font-display); }
.wizard-plan-interval { font-size: 11px; color: var(--text-muted); }
.wizard-done { text-align: center; padding: 32px 0; }
.wizard-done-icon { font-size: 48px; margin-bottom: 16px; }
.wizard-done-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--gold); margin-bottom: 8px; }
.wizard-done-sub { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; line-height: 1.6; }
.wizard-setup-option {
  display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; transition: all var(--transition); margin-bottom: 8px;
}
.wizard-setup-option:hover { border-color: var(--gold); background: var(--gold-glow); }
.wizard-setup-option .setup-icon { font-size: 20px; }
.wizard-setup-option .setup-label { font-size: 14px; font-weight: 600; color: var(--text); }
.wizard-setup-option .setup-desc { font-size: 12px; color: var(--text-muted); }

@media (max-width: 768px) {
  .onboarding-wizard { height: 100vh; max-width: 100%; }
  .wizard-plan-grid { grid-template-columns: 1fr; }
}

/* ── ITEM 4: GROUPED MEMBERS TABLE ───────────────────── */
.group-header td {
  background: var(--surface-2);
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
}
.group-header:hover td { background: var(--surface-3); }
.group-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.group-count { font-size: 11px; color: var(--text-faint); margin-left: 4px; }
.group-toggle { font-size: 10px; color: var(--text-faint); margin-right: 8px; transition: transform 0.2s; display: inline-block; }
.group-header.collapsed .group-toggle { transform: rotate(-90deg); }
.group-header.collapsed ~ tr.group-row { display: none; }

/* ── ITEM 5: GLOBAL SEARCH ───────────────────────────── */
.global-search-trigger {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px; cursor: pointer;
  font-size: 13px; color: var(--text-faint);
  transition: border-color var(--transition);
}
.global-search-trigger:hover { border-color: var(--gold); }
.global-search-trigger kbd {
  font-size: 10px; background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px; font-family: monospace;
}
.search-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: none; align-items: flex-start; justify-content: center;
  padding-top: 120px; z-index: 500;
}
.search-overlay.active { display: flex; }
.search-modal {
  width: 560px; max-width: 90%; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; box-shadow: 0 16px 48px rgba(0,0,0,0.4);
  animation: slideUp 180ms cubic-bezier(0.16, 1, 0.3, 1);
}
.search-modal input {
  width: 100%; padding: 16px 20px; background: transparent;
  border: none; border-bottom: 1px solid var(--border);
  color: var(--text); font-size: 16px; outline: none;
}
.search-results { max-height: 400px; overflow-y: auto; }
.search-result-group { padding: 8px 16px; font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.5px; }
.search-result-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; cursor: pointer; transition: background var(--transition);
}
.search-result-item:hover, .search-result-item.focused { background: var(--surface-2); }
.search-result-name { font-size: 14px; font-weight: 500; color: var(--text); }
.search-result-sub { font-size: 12px; color: var(--text-muted); }
.search-result-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 12px; font-weight: 700; color: var(--text-muted); flex-shrink: 0;
}
.search-empty { padding: 24px; text-align: center; color: var(--text-faint); font-size: 14px; }

@media (max-width: 768px) {
  .search-overlay { padding-top: 20px; }
  .search-modal { max-width: 96%; }
  .global-search-trigger kbd { display: none; }
}

/* ── ITEM 6: POS FAVORITES ───────────────────────────── */
.pos-product-card.favorite {
  border-color: rgba(200,162,76,0.3);
  background: rgba(200,162,76,0.05);
}
.pos-product-card.favorite:hover {
  border-color: rgba(200,162,76,0.5);
  background: rgba(200,162,76,0.08);
}
.pos-fav-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ── ITEM 7: UNIFIED COMMUNICATION TIMELINE ──────────── */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 1px; background: var(--border); }
.timeline-item { position: relative; padding: 8px 0; }
.timeline-dot {
  position: absolute; left: -20px; top: 12px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--border);
}
.timeline-dot.email { background: var(--gold); }
.timeline-dot.sms { background: #22c55e; }
.timeline-dot.note { background: #3B82F6; }
.timeline-title { font-size: 13px; color: var(--text); }
.timeline-meta { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.timeline-preview { font-size: 12px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }
.quick-note { display: flex; gap: 8px; margin-bottom: 16px; }
.quick-note input { flex: 1; }

/* ── ITEM 8: POLISH ──────────────────────────────────── */
.stat-card.clickable { cursor: pointer; }
.stat-card.clickable::after {
  content: 'View \2192';
  display: block;
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 4px;
}
.stat-card.clickable:hover::after { color: var(--gold); }
.stat-card.clickable:hover {
  border-color: var(--gold-dim);
  box-shadow: 0 0 12px var(--gold-glow);
}

/* Contrast fix: ensure small text minimum #AAA */
.feed-date, .lead-contact, .timeline-meta,
.comm-meta, .search-result-group {
  color: #AAAAAA;
}

/* ── SIDEBAR SEARCH TRIGGER ──────────────────────────── */
.sidebar-search-wrap {
  padding: 8px 8px 0;
}

/* ── PAGE TRANSITIONS ────────────────────────────────── */
#mainContent > * {
  animation: fadeIn 0.15s ease;
}

/* ── CARD HOVER EFFECTS ──────────────────────────────── */
.franchise-card:hover, .pos-product-card:hover {
  border-color: rgba(200,162,76,0.3);
  transform: translateY(-2px);
  transition: all 0.2s ease;
}

/* ── ROLE TOGGLE ─────────────────────────────────────── */
.dashboard-role-toggle {
  display: flex; gap: 4px; background: var(--surface-2);
  border-radius: 10px; padding: 4px; margin-bottom: 16px;
  width: fit-content;
}
.role-btn {
  background: transparent; border: none; color: var(--text-muted);
  padding: 8px 16px; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 500; transition: all 0.2s;
  font-family: var(--font-body);
}
.role-btn.active {
  background: var(--surface); color: var(--gold);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.role-btn:hover:not(.active) { color: var(--text); }

/* ── DASHBOARD VIEW TOGGLE ───────────────────────────── */
.dashboard-view-toggle {
  display: flex; gap: 4px; background: var(--surface-2);
  border-radius: 10px; padding: 4px;
  width: fit-content;
}
.view-btn {
  background: transparent; border: none; color: var(--text-muted);
  padding: 6px 14px; border-radius: 8px; cursor: pointer;
  font-size: 12px; font-weight: 600; transition: all 0.2s;
  text-transform: uppercase; letter-spacing: 0.5px;
  font-family: var(--font-body);
}
.view-btn.active {
  background: var(--surface); color: var(--gold);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.view-btn:hover:not(.active) { color: var(--text); }

/* ── RETENTION VIEW ──────────────────────────────────── */
.retention-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-bottom: 20px;
}
.retention-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px;
}
.retention-value {
  font-size: 28px; font-weight: 700; margin-top: 4px;
}
.retention-label {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.at-risk-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.at-risk-item:last-child { border-bottom: none; }
.at-risk-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface-2); display: flex;
  align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; flex-shrink: 0;
}
.at-risk-info { flex: 1; min-width: 0; }
.at-risk-name { font-weight: 600; font-size: 14px; }
.at-risk-meta { font-size: 12px; color: var(--text-muted); }
.at-risk-action {
  flex-shrink: 0;
}
.month-comparison {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px; margin-top: 16px;
}
.month-comparison-title {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;
}
.month-comparison-value {
  font-size: 18px; font-weight: 600;
}
.month-comparison-value.positive { color: var(--success); }
.month-comparison-value.negative { color: var(--error); }
.month-comparison-value.neutral { color: var(--text-muted); }

/* ── FRONT DESK VIEW ─────────────────────────────────── */
.quick-actions-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 10px; margin-bottom: 20px;
}
.quick-action-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px; text-align: center;
  cursor: pointer; transition: all 0.2s;
}
.quick-action-card:hover {
  border-color: rgba(200,162,76,0.3);
  transform: translateY(-2px);
}
.quick-action-icon { font-size: 24px; margin-bottom: 6px; }
.quick-action-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }

/* ── INSTRUCTOR VIEW ─────────────────────────────────── */
.belt-overview-grid {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.belt-overview-item {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-2); border-radius: 8px;
  padding: 8px 14px; font-size: 13px; font-weight: 500;
}
.belt-overview-dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
}
.belt-overview-count { font-weight: 700; }

/* ── MOBILE RESPONSIVE: ROLE TOGGLE + RETENTION ─────── */
@media (max-width: 768px) {
  .dashboard-role-toggle {
    overflow-x: auto; width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  .role-btn { white-space: nowrap; }
  .retention-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
