/* =============================================
   TURFBOOK SAAS — SHARED STYLES
   ============================================= */

/* =============================================
   SECTION 1: CSS VARIABLES & RESET
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=DM+Sans:wght@400;500;600&display=swap');

:root {
  /* -- Primary Colors -- */
  --color-primary: #0D9488;
  --color-primary-dark: #0F766E;
  --color-primary-light: #14B8A6;
  --color-primary-bg: #F0FDFA;

  /* -- Neutral Colors -- */
  --color-bg: #F8FAFC;
  --color-surface: #FFFFFF;
  --color-border: #E2E8F0;
  --color-border-light: #F1F5F9;
  --color-text: #1E293B;
  --color-text-secondary: #64748B;
  --color-text-muted: #94A3B8;

  /* -- Status Colors -- */
  --color-success: #059669;
  --color-success-bg: #ECFDF5;
  --color-warning: #D97706;
  --color-warning-bg: #FFFBEB;
  --color-error: #DC2626;
  --color-error-bg: #FEF2F2;
  --color-info: #2563EB;
  --color-info-bg: #EFF6FF;

  /* -- Sidebar -- */
  --color-sidebar: #0F172A;
  --color-sidebar-hover: #1E293B;
  --color-sidebar-text: #CBD5E1;
  --color-sidebar-active: var(--color-primary);

  /* -- Typography -- */
  --font-heading: 'Plus Jakarta Sans', sans-serif;
  --font-body: 'DM Sans', sans-serif;

  /* -- Spacing -- */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* -- Border Radius -- */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 50%;

  /* -- Shadows -- */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);

  /* -- Layout -- */
  --sidebar-width: 260px;
  --header-height: 64px;

  /* -- Short Aliases (used by admin.html) -- */
  --primary: var(--color-primary);
  --primary-dark: var(--color-primary-dark);
  --bg: var(--color-bg);
  --card-bg: var(--color-surface);
  --border: var(--color-border);
  --border-light: var(--color-border-light);
  --text: var(--color-text);
  --text-light: var(--color-text-secondary);
  --text-muted: var(--color-text-muted);
  --success: var(--color-success);
  --success-bg: var(--color-success-bg);
  --warning: var(--color-warning);
  --warning-bg: var(--color-warning-bg);
  --danger: var(--color-error);
  --danger-bg: var(--color-error-bg);
  --sidebar-bg: var(--color-sidebar);
  --sidebar-hover: var(--color-sidebar-hover);
  --transition: all 0.2s ease;
  --radius: var(--radius-md);
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, h5 { font-family: var(--font-heading); font-weight: 700; line-height: 1.3; }

input, select, textarea, button { font-family: var(--font-body); font-size: 0.95rem; }


/* =============================================
   SECTION 2: LOGIN PAGE
   ============================================= */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #0F766E 100%);
  padding: var(--space-md);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(13,148,136,0.15) 0%, transparent 70%);
  top: -100px; right: -100px;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(13,148,136,0.1) 0%, transparent 70%);
  bottom: -80px; left: -80px;
}

.login-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--space-2xl) var(--space-xl);
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  animation: loginSlideUp 0.5s ease-out;
}

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

.login-brand {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.login-brand__logo {
  width: 56px; height: 56px;
  background: var(--color-primary);
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
  font-size: 1.6rem;
  color: white;
  font-weight: 800;
  font-family: var(--font-heading);
}

.login-brand__name {
  font-size: 1.75rem;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--color-text);
}

.login-brand__tagline {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  margin-top: var(--space-xs);
}

.login-error {
  background: var(--color-error-bg);
  color: var(--color-error);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: var(--space-md);
  display: none;
  border-left: 3px solid var(--color-error);
}

.login-error.visible { display: block; }


/* =============================================
   SECTION 3: FORM ELEMENTS
   ============================================= */

.tb-form-group {
  margin-bottom: var(--space-lg);
}

.tb-form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
  font-family: var(--font-heading);
}

.tb-form-group label .required {
  color: var(--color-error);
}

/* ----- Field validation hints ----- */
.tb-field-hint {
  font-size: 0.78rem;
  margin-top: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 500;
}
.tb-field-hint.hint-error {
  color: #991B1B;
  background: #FEF2F2;
  border-left: 3px solid #EF4444;
}
.tb-field-hint.hint-success {
  color: #166534;
  background: #F0FDF4;
  border-left: 3px solid #22C55E;
}
.tb-field-hint.hint-loading {
  color: #6B7280;
  background: #F9FAFB;
}
.tb-input.input-error {
  border-color: #EF4444 !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.1) !important;
}
.tb-input.input-success {
  border-color: #22C55E !important;
}

.tb-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.tb-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.1);
}

.tb-input::placeholder {
  color: var(--color-text-muted);
}

.tb-input--error {
  border-color: var(--color-error);
}

select.tb-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748B' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.tb-input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.tb-color-input-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.tb-color-input-wrapper input[type="color"] {
  width: 42px; height: 42px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 2px;
}

.tb-color-input-wrapper input[type="text"] {
  flex: 1;
}

textarea.tb-input {
  resize: vertical;
  min-height: 80px;
}


/* =============================================
   SECTION 4: BUTTONS
   ============================================= */

.tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-heading);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.tb-btn:hover { text-decoration: none; }

.tb-btn--primary {
  background: var(--color-primary);
  color: white;
}
.tb-btn--primary:hover { background: var(--color-primary-dark); }

.tb-btn--secondary {
  background: var(--color-border-light);
  color: var(--color-text);
}
.tb-btn--secondary:hover { background: var(--color-border); }

.tb-btn--danger {
  background: var(--color-error);
  color: white;
}
.tb-btn--danger:hover { background: #B91C1C; }

.tb-btn--outline {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
}
.tb-btn--outline:hover { background: var(--color-primary-bg); }

.tb-btn--ghost {
  background: transparent;
  color: var(--color-text-secondary);
}
.tb-btn--ghost:hover { background: var(--color-border-light); color: var(--color-text); }

.tb-btn--full { width: 100%; }

.tb-btn--sm { padding: 7px 14px; font-size: 0.8rem; }

.tb-btn--lg { padding: 14px 28px; font-size: 1rem; }

.tb-btn--loading { opacity: 0.7; pointer-events: none; }

.tb-btn--icon {
  width: 38px; height: 38px; padding: 0;
  border-radius: var(--radius-sm);
}


/* =============================================
   SECTION 5: DASHBOARD LAYOUT (SIDEBAR + MAIN)
   ============================================= */

.tb-layout {
  display: flex;
  min-height: 100vh;
}

/* -- Sidebar -- */
.tb-sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar);
  color: var(--color-sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s;
}

.tb-sidebar__brand {
  padding: var(--space-lg);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.tb-sidebar__brand-icon {
  width: 40px; height: 40px;
  background: var(--color-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: white;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.tb-sidebar__brand-text {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  color: white;
}

.tb-sidebar__brand-sub {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

.tb-sidebar__nav {
  flex: 1;
  padding: var(--space-md) 0;
  overflow-y: auto;
}

.tb-sidebar__section-label {
  padding: var(--space-sm) var(--space-lg);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-top: var(--space-md);
}

.tb-sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 10px var(--space-lg);
  color: var(--color-sidebar-text);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}

.tb-sidebar__link:hover {
  background: var(--color-sidebar-hover);
  color: white;
  text-decoration: none;
}

.tb-sidebar__link.active {
  background: rgba(13,148,136,0.15);
  color: var(--color-sidebar-active);
  border-right: 3px solid var(--color-sidebar-active);
}

.tb-sidebar__link-icon {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.tb-sidebar__link-badge {
  margin-left: auto;
  background: var(--color-primary);
  color: white;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.tb-sidebar__link--disabled {
  opacity: 0.4;
  pointer-events: none;
}

.tb-sidebar__footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* Sign Out button in sidebar footer */
.tb-sidebar__footer .tb-btn--ghost {
  background: rgba(239, 68, 68, 0.15) !important;
  border: 1px solid rgba(239, 68, 68, 0.4) !important;
  color: #f87171 !important;
  padding: .6rem 1rem !important;
  font-size: .9rem !important;
}
.tb-sidebar__footer .tb-btn--ghost:hover {
  background: rgba(239, 68, 68, 0.25) !important;
  color: #fca5a5 !important;
}

.tb-sidebar__user {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.tb-sidebar__avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  font-family: var(--font-heading);
  flex-shrink: 0;
}

.tb-sidebar__user-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: white;
}

.tb-sidebar__user-role {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

/* -- Mobile Menu Toggle -- */
.tb-menu-toggle {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 200;
  width: 48px; height: 48px;
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius);
  color: white;
  font-size: 1.6rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 1.4rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

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

/* -- Main Content Area -- */
.tb-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.tb-header {
  height: var(--header-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  position: sticky;
  top: 0;
  z-index: 50;
}

.tb-header__title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
}

.tb-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.tb-content {
  padding: var(--space-xl);
  max-width: 1400px;
}


/* =============================================
   SECTION 6: STAT CARDS
   ============================================= */

.tb-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.tb-stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  transition: box-shadow 0.2s;
}

.tb-stat-card:hover { box-shadow: var(--shadow-md); }

.tb-stat-card__label {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-sm);
}

.tb-stat-card__value {
  font-size: 1.75rem;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--color-text);
}

.tb-stat-card__value--primary { color: var(--color-primary); }
.tb-stat-card__value--success { color: var(--color-success); }
.tb-stat-card__value--warning { color: var(--color-warning); }
.tb-stat-card__value--error { color: var(--color-error); }


/* =============================================
   SECTION 7: DATA TABLE
   ============================================= */

.tb-table-wrapper {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.tb-table-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.tb-table-toolbar__search {
  flex: 1;
  min-width: 200px;
}

.tb-table-toolbar__search .tb-input {
  padding: 9px 14px;
  font-size: 0.85rem;
}

.tb-table-scroll { overflow-x: auto; }

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

.tb-table th {
  background: var(--color-bg);
  padding: 12px var(--space-lg);
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
  font-family: var(--font-heading);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.tb-table td {
  padding: 14px var(--space-lg);
  font-size: 0.88rem;
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text);
}

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

.tb-table tr:hover td { background: var(--color-primary-bg); }

.tb-table__actions {
  display: flex;
  gap: var(--space-sm);
}

.tb-table__empty {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--color-text-muted);
}

.tb-table__empty-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}


/* =============================================
   SECTION 8: BADGES
   ============================================= */

.tb-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-heading);
  white-space: nowrap;
}

.tb-badge--active { background: var(--color-success-bg); color: var(--color-success); }
.tb-badge--expiring { background: #FEF3C7; color: #92400E; }
.tb-badge--warning { background: var(--color-warning-bg); color: var(--color-warning); }
.tb-badge--expired { background: var(--color-error-bg); color: var(--color-error); }
.tb-badge--locked { background: #1E293B; color: #F8FAFC; }
.tb-badge--inactive { background: var(--color-border-light); color: var(--color-text-muted); }
.tb-badge--info { background: var(--color-info-bg); color: var(--color-info); }


/* =============================================
   SECTION 9: MODAL
   ============================================= */

.tb-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.tb-modal.active { display: flex; }

.tb-modal__content {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlide 0.25s ease-out;
}

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

.tb-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--color-border);
}

.tb-modal__title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
}

.tb-modal__close {
  width: 36px; height: 36px;
  border: none;
  background: var(--color-border-light);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: all 0.15s;
}

.tb-modal__close:hover { background: var(--color-border); color: var(--color-text); }

.tb-modal__body { padding: var(--space-xl); }

.tb-modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-xl);
  border-top: 1px solid var(--color-border);
}


/* =============================================
   SECTION 10: TOAST NOTIFICATIONS
   ============================================= */

/* =============================================
   SECTION 9B: ADMIN MODALS (flat-naming convention)
   tb-modal-overlay, tb-modal-header, etc.
   ============================================= */

.tb-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.tb-modal-overlay.active {
  display: flex;
}

/* The inner .tb-modal inside overlay acts as content box */
.tb-modal-overlay > .tb-modal {
  display: block;
  position: relative;
  inset: auto;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlide 0.25s ease-out;
  padding: 0;
  backdrop-filter: none;
}

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

.tb-modal-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
}

.tb-modal-close {
  width: 36px; height: 36px;
  border: none;
  background: var(--color-border-light);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: all 0.15s;
}
.tb-modal-close:hover { background: var(--color-border); color: var(--color-text); }

.tb-modal-body {
  padding: var(--space-xl);
}

.tb-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-xl);
  border-top: 1px solid var(--color-border);
}

/* ----- Admin button variations (flat-naming) ----- */
.tb-btn-primary {
  background: var(--color-primary);
  color: white;
  border: none;
}
.tb-btn-primary:hover { background: var(--color-primary-dark); }

.tb-btn-outline {
  background: transparent;
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
}
.tb-btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); }

.tb-btn-success {
  background: var(--color-success);
  color: white;
  border: none;
}
.tb-btn-success:hover { filter: brightness(0.9); }

.tb-btn-danger {
  background: var(--color-error);
  color: white;
  border: none;
}
.tb-btn-danger:hover { filter: brightness(0.9); }

.tb-btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.tb-btn-full {
  width: 100%;
}

/* ----- Admin card header (flat-naming) ----- */
.tb-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.tb-card-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
}
.tb-card-subtitle {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

@media (max-width: 768px) {
  .tb-modal-overlay > .tb-modal {
    max-width: 100% !important;
    margin: 8px;
    max-height: 95vh;
  }
}

.tb-btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border: none;
}
.tb-btn-ghost:hover { background: var(--color-border-light); color: var(--color-text); }

.tb-btn-accent {
  background: var(--color-warning);
  color: #1a1a1a;
  border: none;
}
.tb-btn-accent:hover { filter: brightness(0.9); }

.tb-btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
}

.tb-toast {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  max-width: 420px;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s;
  font-size: 0.88rem;
}

.tb-toast--visible { transform: translateY(0); opacity: 1; }

.tb-toast--success { background: var(--color-success); color: white; }
.tb-toast--error { background: var(--color-error); color: white; }
.tb-toast--warning { background: var(--color-warning); color: white; }
.tb-toast--info { background: var(--color-info); color: white; }

.tb-toast__icon { font-size: 1.1rem; flex-shrink: 0; }
.tb-toast__message { flex: 1; }

.tb-toast__close {
  background: none; border: none; color: white; cursor: pointer;
  font-size: 1.2rem; opacity: 0.8; padding: 0;
}
.tb-toast__close:hover { opacity: 1; }


/* =============================================
   SECTION 11: PAGE LOADER
   ============================================= */

#tb-page-loader {
  position: fixed;
  inset: 0;
  background: rgba(248,250,252,0.9);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  gap: var(--space-md);
}

.tb-loader__spinner {
  width: 42px; height: 42px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.tb-loader__text {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  font-weight: 500;
}


/* =============================================
   SECTION 12: ADMIN WELCOME / INFO CARDS
   ============================================= */

.tb-welcome-card {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  border-radius: var(--radius-lg);
  padding: var(--space-xl) var(--space-2xl);
  color: white;
  margin-bottom: var(--space-xl);
}

.tb-welcome-card__greeting {
  font-size: 0.9rem;
  opacity: 0.85;
  margin-bottom: var(--space-xs);
}

.tb-welcome-card__title {
  font-size: 1.6rem;
  font-weight: 800;
  font-family: var(--font-heading);
  margin-bottom: var(--space-sm);
}

.tb-welcome-card__sub { opacity: 0.8; font-size: 0.9rem; }

.tb-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.tb-info-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}

.tb-info-card__title {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border-light);
}

.tb-info-card__row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  font-size: 0.88rem;
}

.tb-info-card__label { color: var(--color-text-secondary); }
.tb-info-card__value { font-weight: 600; color: var(--color-text); }


/* =============================================
   SECTION 13: FEATURE COMING SOON CARD
   ============================================= */

.tb-coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  text-align: center;
  min-height: 300px;
}

.tb-coming-soon__icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.3;
}

.tb-coming-soon__title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

.tb-coming-soon__text {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}


/* =============================================
   SECTION 14: RESPONSIVE (MOBILE)
   ============================================= */

@media (max-width: 768px) {
  .tb-menu-toggle { display: flex; }

  .tb-sidebar {
    transform: translateX(-100%);
  }
  .tb-sidebar.open { transform: translateX(0); }

  .tb-sidebar-overlay.active { display: block; }

  .tb-main { margin-left: 0; }

  .tb-header {
    padding: 0 var(--space-md);
    padding-left: 64px;
  }

  .tb-content { padding: var(--space-md); }

  .tb-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }

  .tb-stat-card { padding: var(--space-md); }
  .tb-stat-card__value { font-size: 1.35rem; }

  .tb-table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .tb-table-toolbar__search { min-width: auto; }

  .tb-modal__content { max-width: 100%; margin: var(--space-md); }

  .tb-input-row { grid-template-columns: 1fr; }

  .tb-welcome-card { padding: var(--space-lg); }
  .tb-welcome-card__title { font-size: 1.25rem; }

  .tb-toast {
    left: var(--space-md);
    right: var(--space-md);
    bottom: var(--space-md);
    max-width: none;
  }

  .login-card {
    padding: var(--space-xl) var(--space-lg);
  }
}

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


/* =============================================
   SECTION 15: SCROLLBAR STYLING
   ============================================= */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

/* Sidebar scrollbar */
.tb-sidebar__nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); }


/* =============================================
   SECTION 16: ADMIN PAGE — SECTIONS & NAV
   ============================================= */

/* -- Section show/hide (BUG 1) -- */
.tb-section { display: none; }
.tb-section.active { display: block; }

/* -- Sidebar nav items for admin.html (BUG 3) -- */
.tb-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  color: var(--color-sidebar-text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.tb-nav-item:hover { background: var(--color-sidebar-hover); color: #fff; }
.tb-nav-item.active { background: rgba(13,148,136,0.15); color: var(--color-primary); border-right: 3px solid var(--color-primary); }
.tb-nav-item .tb-nav-icon { width: 20px; text-align: center; flex-shrink: 0; }

/* -- Page loading overlay (BUG 4) -- */
.tb-page-loading {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  gap: 16px;
}
.tb-spinner {
  width: 42px; height: 42px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.tb-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  gap: 12px;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* -- Badge color variants (BUG 5) -- */
.tb-badge-success { background: var(--color-success-bg); color: var(--color-success); }
.tb-badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.tb-badge-danger  { background: var(--color-error-bg); color: var(--color-error); }
.tb-badge-neutral { background: var(--color-border-light); color: var(--color-text-muted); }
.tb-badge-info    { background: var(--color-info-bg); color: var(--color-info); }

/* -- Empty state -- */
.tb-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  text-align: center;
  color: var(--color-text-muted);
}
.tb-empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.5; }

/* -- Simple card -- */
.tb-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.tb-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border-light);
}
.tb-card-title { font-family: var(--font-heading); font-weight: 700; font-size: 0.95rem; }
.tb-card-subtitle { font-size: 0.78rem; color: var(--color-text-muted); margin-top: 2px; }
.tb-card-body { padding: 16px 20px; }

/* -- Button short-name aliases used in admin.html -- */
.tb-btn-primary { background: var(--color-primary); color: #fff; border: none; border-radius: 6px; padding: 8px 16px; font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: all 0.2s; font-family: var(--font-heading); }
.tb-btn-primary:hover { background: var(--color-primary-dark); }
.tb-btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.tb-btn-danger { background: var(--color-error); color: #fff; border: none; border-radius: 6px; padding: 8px 16px; font-weight: 600; font-size: 0.85rem; cursor: pointer; }
.tb-btn-secondary { background: var(--color-border-light); color: var(--color-text); border: none; border-radius: 6px; padding: 8px 16px; font-weight: 600; font-size: 0.85rem; cursor: pointer; }

/* -- Stats grid used in admin dashboard -- */
.tb-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* -- Subscription alert bar -- */
.tb-sub-alert {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 16px;
}
.tb-sub-alert-warning { background: var(--color-warning-bg); color: var(--color-warning); border: 1px solid var(--color-warning); }
.tb-sub-alert-danger  { background: var(--color-error-bg); color: var(--color-error); border: 1px solid var(--color-error); }


/* ============================================================
   SECTION 17: PRICING MATRIX (Phase 3)
   ============================================================ */

.pricing-matrix-wrap { display: flex; flex-direction: column; gap: 1.5rem; }

.pricing-fac-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.pricing-fac-header {
  padding: .75rem 1rem;
  font-weight: 700;
  font-size: .9rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.pricing-grid { overflow-x: auto; }
.pricing-grid-header, .pricing-grid-row {
  display: grid;
  grid-template-columns: 120px repeat(4, 1fr);
  min-width: 500px;
}
.pricing-grid-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.pricing-cell-header {
  padding: .6rem .5rem;
  font-size: .72rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.pricing-cell-label {
  padding: .6rem .75rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-light);
  border-right: 1px solid var(--border-light);
  display: flex;
  align-items: center;
}
.pricing-grid-row { border-bottom: 1px solid var(--border-light); }
.pricing-grid-row:last-child { border-bottom: none; }

.pricing-cell {
  display: flex;
  align-items: center;
  padding: .4rem .5rem;
  gap: .2rem;
  border-right: 1px solid var(--border-light);
}
.pricing-cell:last-child { border-right: none; }

.pricing-currency { font-size: .8rem; color: var(--text-muted); font-weight: 600; }
.pricing-unit { font-size: .65rem; color: var(--text-muted); white-space: nowrap; }
.pricing-input {
  width: 70px;
  padding: .35rem .4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 600;
  text-align: center;
  background: var(--card-bg);
  color: var(--text);
  transition: border-color .3s;
}
.pricing-input:focus { outline: none; border-color: var(--primary); }

@media (max-width: 600px) {
  .pricing-grid-header, .pricing-grid-row { grid-template-columns: 90px repeat(4, 1fr); }
  .pricing-input { width: 55px; font-size: .8rem; }
}


/* ============================================================
   SECTION 18: SUB-USER PERMISSIONS GRID (Phase 4)
   ============================================================ */

.perm-grid {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.perm-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .2s;
}
.perm-item:hover { border-color: var(--primary); background: rgba(13,148,136,.03); }
.perm-item:has(input:checked) { border-color: var(--primary); background: rgba(13,148,136,.06); }
.perm-item input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; accent-color: var(--primary); flex-shrink: 0; }
.perm-item-info { display: flex; align-items: center; gap: .5rem; }
.perm-item-icon { font-size: 1.1rem; }
.perm-item-label { font-size: .85rem; font-weight: 600; color: var(--text); }
.perm-item-desc { font-size: .72rem; color: var(--text-muted); }


/* ============================================================
   SECTION 19: REPORT STATS (Phase 5)
   ============================================================ */

.rpt-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .75rem;
}
.rpt-stat-card {
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  border: 1px solid var(--border-light);
}
.rpt-stat-blue  { background: #EFF6FF; border-color: #BFDBFE; }
.rpt-stat-green { background: #F0FDF4; border-color: #BBF7D0; }
.rpt-stat-teal  { background: #F0FDFA; border-color: #99F6E4; }
.rpt-stat-red   { background: #FEF2F2; border-color: #FECACA; }
.rpt-stat-amber { background: #FFFBEB; border-color: #FDE68A; }
.rpt-stat-purple { background: #F5F3FF; border-color: #DDD6FE; }

/* ---- MIS View Toggle ---- */
.mis-view-btn { background: var(--bg); color: var(--text-light); border: 1px solid var(--border); }
.mis-view-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.rpt-stat-icon { font-size: 1.5rem; margin-bottom: .25rem; }
.rpt-stat-value { font-size: 1.3rem; font-weight: 800; color: var(--text); font-family: var(--font-heading); }
.rpt-stat-label { font-size: .72rem; color: var(--text-light); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-top: .15rem; }

/* ---- Payment bar chart ---- */
.rpt-bar-wrap { padding: .5rem 0; }
.rpt-bar { display: flex; height: 28px; border-radius: 14px; overflow: hidden; background: var(--bg); }
.rpt-bar-seg { transition: width .5s ease; min-width: 2px; }
.rpt-bar-paid    { background: var(--success); }
.rpt-bar-partial { background: var(--warning); }
.rpt-bar-pending { background: var(--danger); }
.rpt-bar-legend { display: flex; gap: 1.25rem; margin-top: .5rem; font-size: .78rem; color: var(--text-light); font-weight: 500; }

/* ---- Report date range buttons ---- */
.rpt-range-btns { display: flex; gap: .35rem; flex-wrap: wrap; }

@media (max-width: 600px) {
  .rpt-stats { grid-template-columns: repeat(2, 1fr); }
  .rpt-stat-value { font-size: 1.1rem; }
}


/* ============================================================
   SECTION 20: MOBILE RESPONSIVE — SUPER ADMIN & TABLES
   ============================================================ */

/* ----- Table horizontal scroll on mobile ----- */
.tb-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tb-table__actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  /* Super admin stats grid */
  .sa-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: .5rem !important;
  }

  /* Table minimum width for scroll */
  .tb-table { min-width: 700px; }

  /* Compact action buttons on mobile */
  .tb-table__actions .tb-btn--sm {
    padding: 4px 8px;
    font-size: .75rem;
  }

  /* Modal full screen on mobile */
  .tb-modal__content,
  .tb-modal {
    max-width: 100% !important;
    margin: 8px !important;
    max-height: 95vh;
    overflow-y: auto;
  }

  /* Stack color pickers */
  .tb-color-input-wrapper {
    flex-direction: column;
    gap: 4px;
  }

  /* Info grid single column */
  .tb-info-grid {
    grid-template-columns: 1fr !important;
  }

  /* Login card padding */
  .login-card {
    margin: 1rem;
    padding: 1.5rem !important;
  }

  .login-brand__name {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  /* Single column stats */
  .sa-stats-grid {
    grid-template-columns: 1fr !important;
  }

  /* Smaller headings */
  .tb-header h1,
  .tb-page-title {
    font-size: 1rem;
  }

  /* Full width buttons */
  .tb-table__actions {
    flex-direction: column;
    gap: 3px;
  }
  .tb-table__actions .tb-btn--sm {
    width: 100%;
    text-align: center;
  }
}


/* ============================================================
   SUPER ADMIN VIEW-MODE BANNER & READ-ONLY STYLES
   ============================================================ */

.sa-view-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: linear-gradient(135deg, #7C3AED 0%, #4F46E5 50%, #2563EB 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(79, 70, 229, 0.4);
}

.sa-view-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem 1.25rem;
  max-width: 100%;
  gap: 1rem;
}

.sa-view-banner-left {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .85rem;
  flex-shrink: 0;
}

.sa-view-banner-icon {
  font-size: 1.1rem;
}

.sa-view-banner-turf {
  background: rgba(255,255,255,.18);
  padding: .15rem .6rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: .82rem;
  letter-spacing: .02em;
}

.sa-view-banner-right {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}

.sa-view-turf-select {
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 6px;
  padding: .3rem .6rem;
  font-size: .78rem;
  cursor: pointer;
  max-width: 220px;
  outline: none;
}
.sa-view-turf-select option {
  background: #1E1B4B;
  color: #fff;
}

.sa-view-exit-btn {
  background: rgba(255,255,255,.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 6px;
  padding: .3rem .8rem;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.sa-view-exit-btn:hover {
  background: rgba(255,255,255,.35);
}

/* ---- Push page content down when banner is visible ---- */
body.sa-readonly-mode .tb-layout {
  margin-top: 44px;
}
body.sa-readonly-mode .tb-sidebar {
  top: 44px;
  height: calc(100vh - 44px);
}

/* ---- Calendar empty slots: change cursor in readonly ---- */
body.sa-readonly-mode .cal-slot-empty {
  cursor: default !important;
  opacity: 0.5;
}

/* ---- Responsive banner ---- */
@media (max-width: 768px) {
  .sa-view-banner-inner {
    flex-direction: column;
    padding: .5rem .75rem;
    gap: .4rem;
  }
  .sa-view-banner-left,
  .sa-view-banner-right {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
  .sa-view-turf-select {
    max-width: 160px;
  }
  body.sa-readonly-mode .tb-layout {
    margin-top: 82px;
  }
  body.sa-readonly-mode .tb-sidebar {
    top: 82px;
    height: calc(100vh - 82px);
  }
}


/* ============================================================
   SECTION 22: ADMIN PAGE — MISSING BASE STYLES
   (topbar, hamburger, sidebar-header/footer, nav-labels)
   ============================================================ */

/* -- Topbar (admin.html) -- */
.tb-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem 1.25rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.tb-topbar-left {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.tb-topbar-right {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.tb-topbar-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
}

/* -- Hamburger (mobile menu toggle) -- */
.tb-hamburger {
  display: none;
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius-sm);
  padding: .5rem .85rem;
  font-size: 1.5rem;
  color: #fff;
  cursor: pointer;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

/* -- Sidebar header, brand, subtitle (admin.html) -- */
.tb-sidebar-header {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.tb-sidebar-brand {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  font-family: var(--font-heading);
}
.tb-sidebar-subtitle {
  font-size: .72rem;
  color: rgba(255,255,255,.5);
  margin-top: .15rem;
}

/* -- Nav section labels (Main / Management / Settings) -- */
.tb-nav-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.3);
  padding: 1rem 1.25rem .4rem;
}

/* -- Sidebar footer & user block (admin.html) -- */
.tb-sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,.08);
  padding: .75rem 1rem;
}
.tb-sidebar-user {
  display: flex;
  align-items: center;
  gap: .6rem;
}
.tb-sidebar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
}
.tb-sidebar-user-info { flex: 1; min-width: 0; }
.tb-sidebar-username {
  font-size: .85rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tb-sidebar-userrole {
  font-size: .68rem;
  color: rgba(255,255,255,.5);
}

/* -- Logout button (bigger & more visible) -- */
.tb-logout-btn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: var(--radius-sm);
  color: #f87171;
  cursor: pointer;
  padding: .5rem .75rem;
  font-size: 1.1rem;
  transition: all .2s;
  flex-shrink: 0;
  min-width: 42px;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tb-logout-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

/* -- Admin stat card inline styles (rendered via JS) -- */
.tb-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.tb-stat-icon.teal  { background: var(--color-primary-bg, #F0FDFA); }
.tb-stat-icon.green { background: #F0FDF4; }
.tb-stat-icon.amber { background: #FFFBEB; }
.tb-stat-icon.blue  { background: #EFF6FF; }

.tb-stat-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--color-text);
  font-family: var(--font-heading);
  line-height: 1.2;
}
.tb-stat-label {
  font-size: .72rem;
  color: var(--color-text-muted);
  font-weight: 500;
}


/* ============================================================
   SECTION 23: COMPREHENSIVE RESPONSIVE — TABLET (≤ 1024px)
   ============================================================ */

@media (max-width: 1024px) {
  .tb-content { padding: var(--space-lg); }
  .tb-stats-grid { gap: 12px; }
  .tb-stat-card { padding: var(--space-md); }
  .rpt-stats { gap: .5rem; }
}


/* ============================================================
   SECTION 24: COMPREHENSIVE RESPONSIVE — MOBILE (≤ 768px)
   ============================================================ */

@media (max-width: 768px) {

  /* ---- Hamburger visible, sidebar collapses ---- */
  .tb-hamburger { display: block; }
  .tb-sidebar { transform: translateX(-100%); }
  .tb-sidebar.open { transform: translateX(0); z-index: 200; }
  .tb-sidebar-overlay.active { display: block; z-index: 190; }
  .tb-main { margin-left: 0; }

  /* ---- Topbar compact ---- */
  .tb-topbar { padding: .5rem .75rem; }
  .tb-topbar-title { font-size: .95rem; }

  /* ---- Content padding reduced ---- */
  .tb-content { padding: var(--space-md); }

  /* ---- Dashboard stat cards: 2 columns ---- */
  .tb-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
  }
  .tb-stat-card {
    padding: .75rem !important;
    flex-direction: column;
    align-items: flex-start;
  }
  .tb-stat-icon { width: 32px; height: 32px; font-size: 1rem; }
  .tb-stat-value { font-size: 1.1rem !important; }
  .tb-stat-label { font-size: .68rem !important; }

  /* ---- Super admin stats ---- */
  .tb-stats { grid-template-columns: repeat(2, 1fr) !important; gap: .5rem; }

  /* ---- Welcome card compact ---- */
  .tb-card[style*="linear-gradient"] h2 { font-size: 1.15rem !important; }
  .tb-card[style*="linear-gradient"] p { font-size: .82rem !important; }
  .tb-card[style*="linear-gradient"] div[style*="font-size:3rem"] { font-size: 2rem !important; }

  /* ---- Card headers: stack title & button vertically ---- */
  .tb-card-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: .5rem;
  }

  /* ---- Tables: wrap in scrollable container ---- */
  .tb-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tb-table { min-width: 600px; }

  /* ---- Calendar controls: stack ---- */
  .cal-controls { flex-direction: column; align-items: stretch; gap: .5rem; }
  .cal-controls-left,
  .cal-controls-right { justify-content: center; flex-wrap: wrap; }
  .cal-date-display { font-size: .88rem; min-width: auto; }
  .cal-date-picker { width: 100%; }
  .cal-view-toggle { justify-content: center; }

  /* ---- Calendar day view: horizontal scroll ---- */
  .cal-day-grid { max-height: 65vh; }
  .cal-time-col { width: 58px; min-width: 58px; }
  .cal-fac-col { min-width: 100px; }
  .cal-slot-name { font-size: .72rem; }
  .cal-slot-amount { font-size: .65rem; }
  .cal-header-cell { font-size: .65rem; padding: .5rem .3rem; }

  /* ---- Calendar week view: scroll ---- */
  .cal-week-header { grid-template-columns: repeat(7, minmax(80px, 1fr)); overflow-x: auto; }
  .cal-week-body { grid-template-columns: repeat(7, minmax(80px, 1fr)); overflow-x: auto; }
  .cal-week-day-header { padding: .5rem .3rem; }
  .cal-week-day-name { font-size: .6rem; }
  .cal-week-day-num { font-size: .9rem; }
  .cal-week-booking-name { font-size: .7rem; }
  .cal-week-booking-time { font-size: .6rem; }

  /* ---- Calendar month view: compact ---- */
  .cal-month-cell { min-height: 55px; padding: .25rem; }
  .cal-month-cell-date { font-size: .75rem; }
  .cal-month-cell-count { font-size: .65rem; }
  .cal-month-cell-revenue { font-size: .6rem; }

  /* ---- Calendar legend: wrap compact ---- */
  .cal-legend { gap: .5rem; }
  .cal-legend-item { font-size: .7rem; }

  /* ---- Booking modal: full-width ---- */
  .tb-modal-overlay > .tb-modal,
  .tb-modal__content {
    max-width: 100% !important;
    margin: 6px !important;
    max-height: 95vh;
    border-radius: var(--radius) !important;
  }
  .tb-modal-body { padding: 1rem !important; }
  .tb-modal-footer { padding: .75rem 1rem !important; flex-wrap: wrap; gap: .35rem; }
  .tb-modal-footer .tb-btn { font-size: .8rem; padding: .45rem .75rem; }
  .tb-modal-header { padding: .75rem 1rem !important; }

  /* ---- Form input rows: single column on mobile ---- */
  .tb-input-row { grid-template-columns: 1fr !important; gap: .75rem !important; }

  /* ---- Booking facility checkboxes: smaller ---- */
  .booking-fac-checkboxes { gap: .35rem; }
  .booking-fac-check { padding: .3rem .6rem; font-size: .8rem; }

  /* ---- View booking detail rows: compact ---- */
  .booking-detail-row { font-size: .82rem; padding: .5rem 0; }

  /* ---- Pricing matrix: horizontal scroll ---- */
  .pricing-grid-header,
  .pricing-grid-row { grid-template-columns: 80px repeat(4, 1fr); }
  .pricing-input { width: 50px; font-size: .78rem; padding: .3rem; }
  .pricing-fac-card { font-size: .8rem; }

  /* ---- Report stats: 2 columns ---- */
  .rpt-stats { grid-template-columns: repeat(2, 1fr) !important; gap: .5rem; }
  .rpt-stat-card { padding: .75rem .5rem; }
  .rpt-stat-value { font-size: 1.05rem; }
  .rpt-stat-label { font-size: .65rem; }
  .rpt-stat-icon { font-size: 1.2rem; }

  /* ---- Report date range buttons: scroll ---- */
  .rpt-range-btns { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .rpt-range-btns .tb-btn { flex-shrink: 0; font-size: .72rem; padding: .3rem .55rem; }

  /* ---- MIS view toggle buttons ---- */
  .mis-view-btn { font-size: .75rem !important; padding: .35rem .6rem !important; }

  /* ---- Payment bar legend: compact ---- */
  .rpt-bar-legend { gap: .6rem; font-size: .7rem; flex-wrap: wrap; }

  /* ---- Permission grid: compact ---- */
  .perm-item { padding: .45rem .6rem; }
  .perm-item-label { font-size: .8rem; }
  .perm-item-desc { font-size: .65rem; }
  .perm-item-icon { font-size: .95rem; }

  /* ---- Sub info cards (subscription/profile): stack ---- */
  .tb-sub-info { padding: .5rem; }

  /* ---- Empty state: compact ---- */
  .tb-empty-state { padding: 1.5rem 1rem; }
  .tb-empty-state-icon { font-size: 2rem; }

  /* ---- Toast: full width on mobile ---- */
  .tb-toast {
    left: var(--space-sm) !important;
    right: var(--space-sm) !important;
    bottom: var(--space-sm) !important;
    max-width: none !important;
    font-size: .82rem;
  }

  /* ---- Super admin header & actions ---- */
  .tb-header {
    flex-direction: column;
    align-items: flex-start;
    padding: .75rem var(--space-md) !important;
    padding-left: 56px !important;
    gap: .5rem;
  }
  .tb-header__title { font-size: 1rem; }
  .tb-header__actions { width: 100%; }
  .tb-header__actions .tb-btn { width: 100%; text-align: center; }

  /* ---- Super admin table toolbar ---- */
  .tb-table-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: .5rem;
  }
  .tb-table-toolbar__search { min-width: auto !important; }
  .tb-table-toolbar__search .tb-input { width: 100%; }

  /* ---- Super admin onboard modal ---- */
  .tb-modal__content {
    max-width: 100% !important;
    margin: 6px;
    max-height: 95vh;
  }
  .tb-modal__body { padding: var(--space-md) !important; }
  .tb-modal__header { padding: var(--space-md) !important; }
  .tb-modal__footer { padding: var(--space-md) !important; flex-wrap: wrap; }

  /* ---- Login card mobile ---- */
  .login-card { margin: 1rem; padding: 1.5rem !important; }
  .login-brand__name { font-size: 1.4rem; }

  /* ---- Info grid (super admin view turf) ---- */
  .tb-info-grid { grid-template-columns: 1fr !important; }
  .tb-info-card__row { font-size: .85rem; }
}


/* ============================================================
   SECTION 25: COMPREHENSIVE RESPONSIVE — SMALL PHONE (≤ 480px)
   ============================================================ */

@media (max-width: 480px) {

  /* ---- Stat cards: single column ---- */
  .tb-stats-grid { grid-template-columns: 1fr !important; }
  .tb-stats { grid-template-columns: 1fr !important; }

  /* ---- Report stats: single column ---- */
  .rpt-stats { grid-template-columns: 1fr !important; }

  /* ---- Topbar ultra-compact ---- */
  .tb-topbar { padding: .4rem .5rem; }
  .tb-topbar-title { font-size: .88rem; }
  .tb-topbar-right span { font-size: .7rem !important; }

  /* ---- Content ultra-tight padding ---- */
  .tb-content { padding: .5rem; }

  /* ---- Card padding reduced ---- */
  .tb-card { padding: .75rem; border-radius: var(--radius-sm); }
  .tb-card-header { gap: .4rem; }
  .tb-card-title { font-size: .88rem; }
  .tb-card-subtitle { font-size: .7rem; }

  /* ---- Calendar month cells smaller ---- */
  .cal-month-cell { min-height: 45px; }
  .cal-month-day-name { font-size: .6rem; padding: .4rem; }

  /* ---- Tables: narrower min-width for small screens ---- */
  .tb-table { min-width: 500px; font-size: .8rem; }
  .tb-table th, .tb-table td { padding: .4rem .5rem; }

  /* ---- Booking modal form: ultra compact ---- */
  .tb-form-group label { font-size: .8rem; }
  .tb-input { font-size: .85rem; padding: .5rem .6rem; }
  .tb-btn-lg { padding: .6rem 1rem; font-size: .88rem; }

  /* ---- Welcome card: hide large emoji on tiny screens ---- */
  .tb-card[style*="linear-gradient"] div[style*="font-size:3rem"] { display: none !important; }
  .tb-card[style*="linear-gradient"] h2 { font-size: 1.05rem !important; }

  /* ---- View booking footer: stack buttons ---- */
  .tb-modal-footer {
    flex-direction: column !important;
    gap: .3rem !important;
  }
  .tb-modal-footer .tb-btn { width: 100%; text-align: center; }

  /* ---- Pricing: even smaller ---- */
  .pricing-grid-header,
  .pricing-grid-row { grid-template-columns: 70px repeat(4, 1fr); }
  .pricing-input { width: 42px; font-size: .72rem; }

  /* ---- SA View banner: compact ---- */
  .sa-view-banner-inner { padding: .4rem .6rem !important; }
  .sa-view-banner-left { font-size: .75rem !important; }
  .sa-view-turf-select { max-width: 140px !important; font-size: .72rem !important; }
  .sa-view-exit-btn { padding: .25rem .5rem !important; font-size: .72rem !important; }

  /* ---- Login page: tighter ---- */
  .login-card { margin: .5rem; padding: 1.25rem !important; }
  .login-brand__name { font-size: 1.2rem; }
  .login-brand__sub { font-size: .75rem; }
}


/* ============================================================
   SECTION 26: WHATSAPP CHOOSER POPUP
   ============================================================ */

.wa-chooser-options {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.wa-chooser-btn {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  cursor: pointer;
  transition: all .2s;
  width: 100%;
  text-align: left;
}

.wa-chooser-btn:hover {
  border-color: #25D366;
  background: rgba(37, 211, 102, 0.05);
}

.wa-chooser-btn:active {
  transform: scale(0.98);
}

.wa-chooser-btn-business:hover {
  border-color: #128C7E;
  background: rgba(18, 140, 126, 0.05);
}

.wa-chooser-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.wa-chooser-label {
  font-size: .95rem;
  font-weight: 600;
  color: var(--color-text);
}


/* ============================================================
   SECTION 27: MOBILE FIX — SHARE BUTTON VISIBILITY
   ============================================================ */

/* Ensure modal footer doesn't get cut off */
.tb-modal-overlay > .tb-modal,
.tb-modal__content {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.tb-modal-body {
  flex: 1;
  overflow-y: auto;
}

.tb-modal-footer {
  flex-shrink: 0;
}

/* Make Share button more visible (not completely ghost) */
.tb-modal-footer .tb-btn-ghost {
  background: var(--color-border-light);
  border: 1px solid var(--color-border);
}

.tb-modal-footer .tb-btn-ghost:hover {
  background: var(--color-border);
}

@media (max-width: 768px) {
  /* Ensure all footer buttons wrap and stay visible */
  .tb-modal-footer {
    justify-content: center !important;
    flex-wrap: wrap !important;
  }
  
  /* Give ghost buttons more presence on mobile */
  .tb-modal-footer .tb-btn-ghost {
    background: #f0f9f4;
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
  }

  /* ---- Hamburger: bigger tap target on mobile ---- */
  .tb-hamburger {
    padding: .6rem 1rem;
    font-size: 1.6rem;
    min-width: 50px;
    min-height: 50px;
  }

  /* ---- Logout button: more prominent on mobile ---- */
  .tb-logout-btn {
    padding: .6rem .9rem;
    font-size: 1.2rem;
    min-width: 46px;
    min-height: 46px;
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
  }

  /* ---- Super admin menu toggle: bigger on mobile ---- */
  .tb-menu-toggle {
    width: 52px;
    height: 52px;
    font-size: 1.8rem;
  }
}
