/* ===== GYMFI DESIGN SYSTEM ===== */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  /* Colors */
  --black: #0a0a0a;
  --surface-1: #111111;
  --surface-2: #1a1a1a;
  --surface-3: #222222;
  --surface-4: #2a2a2a;
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.15);

  --primary: #ff5a1f;
  --primary-dim: rgba(255,90,31,0.15);
  --primary-hover: #ff6f38;
  --success: #22c55e;
  --success-dim: rgba(34,197,94,0.12);
  --warning: #f59e0b;
  --warning-dim: rgba(245,158,11,0.12);
  --danger: #ef4444;
  --danger-dim: rgba(239,68,68,0.12);
  --info: #3b82f6;
  --info-dim: rgba(59,130,246,0.12);

  --text-1: #f8f8f8;
  --text-2: #a0a0a0;
  --text-3: #555555;

  /* Sidebar */
  --sidebar-w: 260px;
  --sidebar-collapsed: 72px;

  /* Typography */
  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Shadow */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
  --glow: 0 0 20px rgba(255,90,31,0.25);
}

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

html, body {
  font-family: var(--font-body);
  background: var(--black);
  color: var(--text-1);
  height: 100%;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== LAYOUT ===== */
.gf-layout {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.gf-sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: width 0.3s ease;
}

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

.gf-sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: var(--glow);
}

.gf-sidebar-logo .logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--text-1);
  letter-spacing: 0.5px;
}

.gf-sidebar-logo .logo-sub {
  font-size: 10px;
  color: var(--text-3);
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.gf-sidebar-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.gf-sidebar-section {
  padding: 8px 16px 4px;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
  margin-top: 8px;
}

.gf-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin: 2px 8px;
  border-radius: var(--r-md);
  color: var(--text-2);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 400;
  transition: all 0.15s ease;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
}

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

.gf-nav-item.active {
  background: var(--primary-dim);
  color: var(--primary);
  font-weight: 500;
}

.gf-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
  margin-left: -8px;
}

.gf-nav-item .nav-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.gf-nav-item .nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}

.gf-nav-group .gf-nav-children {
  display: none;
  padding-left: 8px;
}

.gf-nav-group.open .gf-nav-children { display: block; }

.gf-nav-toggle {
  margin-left: auto;
  font-size: 12px;
  transition: transform 0.2s;
}

.gf-nav-group.open .gf-nav-toggle { transform: rotate(180deg); }

.gf-nav-child {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 30px;
  margin: 1px 8px;
  border-radius: var(--r-md);
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
  transition: all 0.15s;
}

.gf-nav-child:hover { background: var(--surface-3); color: var(--text-1); }
.gf-nav-child.active { color: var(--primary); background: var(--primary-dim); }

/* Sidebar footer */
.gf-sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.gf-user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-3);
  border-radius: var(--r-lg);
  text-decoration: none;
  transition: background 0.15s;
}

.gf-user-pill:hover { background: var(--surface-4); }

.gf-avatar {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.gf-user-info .name { font-size: 13px; font-weight: 500; color: var(--text-1); }
.gf-user-info .role { font-size: 11px; color: var(--text-3); }

/* ===== MAIN CONTENT ===== */
.gf-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
}

/* ===== TOPBAR ===== */
.gf-topbar {
  height: 60px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.gf-topbar-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
  flex: 1;
}

.gf-topbar-search {
  display: flex;
  align-items: center;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 0 14px;
  gap: 8px;
  height: 36px;
  width: 240px;
  transition: border-color 0.15s;
}

.gf-topbar-search:focus-within { border-color: var(--primary); }

.gf-topbar-search input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 13px;
  width: 100%;
}

.gf-topbar-search input::placeholder { color: var(--text-3); }
.gf-topbar-search .search-icon { color: var(--text-3); font-size: 16px; }

.gf-topbar-actions { display: flex; align-items: center; gap: 8px; }

.gf-topbar-btn {
  width: 36px; height: 36px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  font-size: 18px;
  position: relative;
}

.gf-topbar-btn:hover { background: var(--surface-4); color: var(--text-1); }

.gf-notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--primary);
  border-radius: 50%;
  border: 2px solid var(--surface-1);
}

/* ===== PAGE CONTENT ===== */
.gf-content {
  padding: 28px;
  flex: 1;
}

.gf-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

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

.gf-page-subtitle {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
}

/* ===== CARDS ===== */
.gf-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px;
}

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

.gf-card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
}

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

.gf-stat-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}

.gf-stat-card:hover { border-color: var(--border-hover); }

.gf-stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent, var(--primary));
}

.gf-stat-card .stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: var(--accent-dim, var(--primary-dim));
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
}

.gf-stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1;
  margin-bottom: 4px;
}

.gf-stat-card .stat-label {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gf-stat-card .stat-change {
  margin-top: 10px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

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

/* ===== BUTTONS ===== */
.gf-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.gf-btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(255,90,31,0.35);
}

.gf-btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255,90,31,0.45);
}

.gf-btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}

.gf-btn-ghost:hover { background: var(--surface-3); color: var(--text-1); border-color: var(--border-hover); }

.gf-btn-danger { background: var(--danger); color: #fff; }
.gf-btn-danger:hover { background: #dc2626; }

.gf-btn-success { background: var(--success); color: #fff; }
.gf-btn-sm { padding: 6px 12px; font-size: 12px; }
.gf-btn-icon { padding: 8px; width: 34px; height: 34px; justify-content: center; }

/* ===== TABLES ===== */
.gf-table-wrap {
  overflow-x: auto;
  border-radius: var(--r-lg);
}

.gf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.gf-table thead {
  background: var(--surface-3);
}

.gf-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-2);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.gf-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.gf-table tbody tr:hover { background: var(--surface-3); }
.gf-table tbody tr:last-child { border-bottom: none; }

.gf-table tbody td {
  padding: 12px 16px;
  color: var(--text-1);
  vertical-align: middle;
}

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

.badge-success { background: var(--success-dim); color: var(--success); }
.badge-danger  { background: var(--danger-dim);  color: var(--danger);  }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-info    { background: var(--info-dim);    color: var(--info);    }
.badge-primary { background: var(--primary-dim); color: var(--primary); }

/* ===== FORMS ===== */
.gf-form-group { margin-bottom: 18px; }

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

.gf-input, .gf-select, .gf-textarea {
  width: 100%;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 14px;
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  -webkit-appearance: none;
}

.gf-input:focus, .gf-select:focus, .gf-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,90,31,0.12);
}

.gf-input::placeholder, .gf-textarea::placeholder { color: var(--text-3); }

.gf-select option { background: var(--surface-2); color: var(--text-1); }
.gf-textarea { resize: vertical; min-height: 100px; }

.gf-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.gf-form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ===== ALERTS ===== */
.gf-alert {
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-success { background: var(--success-dim); border: 1px solid var(--success); color: var(--success); }
.alert-danger  { background: var(--danger-dim);  border: 1px solid var(--danger);  color: var(--danger);  }
.alert-warning { background: var(--warning-dim); border: 1px solid var(--warning); color: var(--warning); }

/* ===== AVATAR ===== */
.gf-client-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface-4);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--primary);
  border: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
}

.gf-client-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ===== LOADER ===== */
.gf-loader {
  position: fixed;
  inset: 0;
  background: var(--black);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s;
}

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

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

/* ===== MODAL ===== */
.gf-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

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

.gf-modal {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 28px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);   }
}

.gf-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

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

.gf-modal-close {
  width: 30px; height: 30px;
  background: var(--surface-4);
  border: none;
  border-radius: var(--r-sm);
  color: var(--text-2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: all 0.15s;
}

.gf-modal-close:hover { background: var(--danger-dim); color: var(--danger); }

/* ===== RESPONSIVE ===== */

/* ── Desktop: sidebar collapse animation ── */
.gf-sidebar {
  transition: width 0.28s ease, transform 0.28s ease;
}

.gf-sidebar.collapsed {
  width: 72px !important;
}

.gf-sidebar.collapsed .logo-text,
.gf-sidebar.collapsed .logo-sub,
.gf-sidebar.collapsed .gf-nav-item span:not(.nav-icon):not(.gf-nav-toggle),
.gf-sidebar.collapsed .gf-sidebar-section,
.gf-sidebar.collapsed .gf-user-info,
.gf-sidebar.collapsed .gf-nav-toggle,
.gf-sidebar.collapsed .gf-nav-children {
  display: none !important;
}

.gf-sidebar.collapsed .gf-nav-item {
  justify-content: center;
  padding: 10px 0;
}

.gf-sidebar.collapsed .gf-nav-item .nav-icon {
  width: 72px;
  text-align: center;
}

.gf-sidebar.collapsed .gf-user-pill {
  justify-content: center;
  padding: 10px 0;
}

.gf-sidebar.collapsed .gf-avatar {
  margin: 0 auto;
}

.gf-main {
  transition: margin-left 0.28s ease;
}

.gf-main.expanded {
  margin-left: 72px !important;
}

/* ── Tablet ── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 240px; }
}

/* ── Mobile ── */
@media (max-width: 991px) {
  /* Sidebar slides off screen on mobile */
  .gf-sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
    box-shadow: none;
    transition: transform 0.28s ease, box-shadow 0.28s ease;
  }

  .gf-sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  /* Main always full width on mobile */
  .gf-main {
    margin-left: 0 !important;
    transition: none;
  }

  .gf-main.expanded {
    margin-left: 0 !important;
  }

  /* Sidebar never collapses on mobile */
  .gf-sidebar.collapsed {
    width: var(--sidebar-w) !important;
  }
  .gf-sidebar.collapsed .logo-text,
  .gf-sidebar.collapsed .logo-sub,
  .gf-sidebar.collapsed .gf-nav-item span:not(.nav-icon):not(.gf-nav-toggle),
  .gf-sidebar.collapsed .gf-sidebar-section,
  .gf-sidebar.collapsed .gf-user-info,
  .gf-sidebar.collapsed .gf-nav-toggle {
    display: revert !important;
  }
  .gf-sidebar.collapsed .gf-nav-children {
    display: none;
  }
  .gf-sidebar.collapsed .gf-nav-item {
    justify-content: flex-start;
    padding: 10px 16px;
  }
  .gf-sidebar.collapsed .gf-nav-item .nav-icon {
    width: 20px;
    text-align: center;
  }
  .gf-sidebar.collapsed .gf-user-pill {
    justify-content: flex-start;
    padding: 10px 12px;
  }

  /* Page content */
  .gf-content { padding: 14px; }

  /* Forms stack on mobile */
  .gf-form-row,
  .gf-form-row-3 { grid-template-columns: 1fr; }

  /* Stats grid */
  .gf-stats-grid { grid-template-columns: 1fr 1fr; }

  /* Topbar */
  .gf-topbar-search { width: 180px; }
  .gf-topbar-title   { font-size: 14px; }

  /* Tables scroll on mobile */
  .gf-table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  /* Cards full width */
  .gf-card { border-radius: var(--r-lg); }

  /* Hide non-essential topbar items on small mobile */
}

@media (max-width: 540px) {
  .gf-stats-grid { grid-template-columns: 1fr 1fr; }
  .gf-topbar-search { display: none; }
  .gf-page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .gf-page-header > * { margin-left: 0 !important; }
  .gf-content { padding: 10px; }
}

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

/* ===== EMPTY STATE ===== */
.gf-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}

.gf-empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.gf-empty-title { font-size: 16px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.gf-empty-text { font-size: 13px; }

/* ===== DROPDOWN ===== */
.gf-dropdown { position: relative; }

.gf-dropdown-menu {
  position: absolute;
  right: 0; top: calc(100% + 6px);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  min-width: 180px;
  box-shadow: var(--shadow-md);
  display: none;
  z-index: 100;
  overflow: hidden;
}

.gf-dropdown.open .gf-dropdown-menu { display: block; }

.gf-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
  transition: background 0.1s;
  cursor: pointer;
}

.gf-dropdown-item:hover { background: var(--surface-3); color: var(--text-1); }
.gf-dropdown-item.danger { color: var(--danger); }
.gf-dropdown-item.danger:hover { background: var(--danger-dim); }

/* ===== PROGRESS BAR ===== */
.gf-progress {
  height: 6px;
  background: var(--surface-4);
  border-radius: 3px;
  overflow: hidden;
}

.gf-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* ===== TABS ===== */
.gf-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-3);
  padding: 4px;
  border-radius: var(--r-lg);
  margin-bottom: 24px;
  width: fit-content;
}

.gf-tab {
  padding: 7px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.gf-tab:hover { color: var(--text-1); }
.gf-tab.active { background: var(--surface-1); color: var(--text-1); box-shadow: var(--shadow-sm); }

/* ===== SEARCH BOX ===== */
.gf-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 0 14px;
  height: 38px;
  transition: border-color 0.15s;
}

.gf-search-box:focus-within { border-color: var(--primary); }
.gf-search-box input { background: transparent; border: none; outline: none; color: var(--text-1); font-size: 13px; width: 100%; font-family: var(--font-body); }
.gf-search-box input::placeholder { color: var(--text-3); }

/* ===== PAGINATION ===== */
.gf-pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 16px;
}

.gf-page-btn {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: all 0.1s;
}

.gf-page-btn:hover { background: var(--surface-3); color: var(--text-1); }
.gf-page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== TOOLTIP ===== */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-4);
  color: var(--text-1);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  border: 1px solid var(--border);
  z-index: 10;
}

[data-tooltip]:hover::after { opacity: 1; }

/* ===== OVERLAY for mobile sidebar ===== */
.gf-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

.gf-overlay.active { display: block; }

/* ===== MOBILE TOUCH & FORM IMPROVEMENTS ===== */

/* Ensure tap targets are large enough (min 44px) */
.gf-btn         { min-height: 40px; }
.gf-btn.gf-btn-sm { min-height: 34px; }
.gf-nav-item    { min-height: 44px; }
.gf-nav-child   { min-height: 40px; }
.gf-input, .gf-select, .gf-textarea { font-size: 16px !important; } /* Prevents iOS zoom */

/* Form grids responsive */
@media (max-width: 991px) {
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    /* Can't override inline styles directly, but our form-row class handles it */
  }

  /* Dashboard charts grid */
  .gf-stats-grid {
    gap: 10px;
  }

  /* Card titles */
  .gf-page-title { font-size: 20px; }

  /* Modal full-screen on mobile */
  .gf-modal {
    width: 95vw;
    max-width: 95vw;
    margin: 10px;
    max-height: 90vh;
  }

  /* Action buttons in tables */
  .gf-table tbody td { padding: 10px 10px; }
  .gf-table thead th { padding: 10px 10px; }

  /* Hide some table columns on mobile */
  .gf-table .hide-mobile { display: none; }

  /* Pagination wrap */
  .gf-pagination { flex-wrap: wrap; gap: 4px; }

  /* Topbar hamburger always visible */
  #gf-sidebar.open ~ * + .gf-main .gf-topbar-btn:first-child {
    color: var(--primary);
  }
}

/* Prevent text selection on nav items */
.gf-nav-item, .gf-nav-child {
  user-select: none;
  -webkit-user-select: none;
}

/* Better touch feedback */
.gf-nav-item:active { background: var(--surface-4) !important; }
.gf-btn:active { transform: scale(0.97); }

/* Venta/Compra product grid on mobile */
@media (max-width: 600px) {
  #prodGrid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}
@media (max-width: 360px) {
  #prodGrid {
    grid-template-columns: 1fr !important;
  }
}

/* ===== TOPBAR Z-INDEX & HAMBURGER FIX ===== */
.gf-topbar {
  z-index: 101; /* above sidebar (100) so hamburger always clickable */
  position: sticky;
  top: 0;
}

/* Hamburger always accessible */
#gf-hamburger {
  position: relative;
  z-index: 102;
  flex-shrink: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* On mobile, sidebar is z-index 100, overlay is 99, topbar is 101 */
@media (max-width: 991px) {
  .gf-sidebar { z-index: 100; }
  .gf-overlay { z-index:  99; }
  .gf-topbar  { z-index: 101; }
  #gf-hamburger { z-index: 102; }

  /* Topbar layout on mobile */
  .gf-topbar { gap: 8px; }
  .gf-topbar-title { flex: 1; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* Make all action buttons bigger on touch */
  .gf-topbar-btn { width: 40px; height: 40px; }
}

/* Active state for hamburger when sidebar is open */
.gf-sidebar.open ~ * #gf-hamburger,
body:has(.gf-sidebar.open) #gf-hamburger {
  color: var(--primary);
}
