/* ========================================================
   SmartGym Pro - Compact Executive Theme
   Dark Sidebar • Crisp Light Content • High-Density Compact Layout
   ======================================================== */

:root {
  /* LIGHT CONTENT PALETTE */
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-sub: #f8fafc;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --border-subtle: #f1f5f9;
  --border-focus: #10b981;
  --border-input: #cbd5e1;

  /* TEXT PALETTE */
  --text-main: #0f172a;       /* Slate 900 - High Contrast */
  --text-muted: #475569;      /* Slate 600 */
  --text-dim: #64748b;        /* Slate 500 */
  --text-light: #94a3b8;

  /* DARK SIDEBAR PALETTE */
  --sidebar-bg: #0f172a;       /* Slate 900 */
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-text: #94a3b8;
  --sidebar-active-bg: rgba(16, 185, 129, 0.15);
  --sidebar-active-text: #ffffff;

  /* ACCENT TOKENS */
  --accent-primary: #10b981;      /* Emerald Green */
  --accent-cyan: #0284c7;         /* Deep Sky Cyan */
  --accent-orange: #d97706;       /* Amber */
  --accent-red: #dc2626;          /* Crimson Alert */
  --accent-purple: #7c3aed;       /* Royal Purple */

  /* COMPACT GEOMETRY */
  --sidebar-width: 198px;
  --header-height: 50px;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.03);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.45;
  font-size: 0.86rem;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ---------------- LAYOUT WRAPPERS & HIDE/COLLAPSE ---------------- */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg-body);
  transition: margin-left 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* SIDEBAR HIDE STATE */
body.sidebar-hidden .sidebar {
  transform: translateX(-100%);
  box-shadow: none;
}

body.sidebar-hidden .main-content {
  margin-left: 0;
}

.page-body {
  flex: 1;
  padding: 1.15rem 1.35rem 2.5rem;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

/* ---------------- ULTRA-PRO DARK COMPACT SIDEBAR ---------------- */
.sidebar {
  width: var(--sidebar-width);
  background: #090d16;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 3px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

.sidebar-brand {
  padding: 0.65rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(0, 0, 0, 0.25);
}

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  color: #fff;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.35);
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1.1;
}

.brand-text span {
  font-size: 0.58rem;
  color: #38bdf8;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 3px;
}

.sidebar-collapse-pin {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #64748b;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.68rem;
  transition: var(--transition);
}

.sidebar-collapse-pin:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.pulse-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--accent-primary);
  box-shadow: 0 0 6px var(--accent-primary);
  animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.sidebar-menu {
  list-style: none;
  padding: 0.4rem 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  flex: 1;
}

.menu-category {
  font-size: 0.56rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #475569;
  padding: 0.4rem 0.45rem 0.1rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.32rem 0.5rem;
  border-radius: var(--radius-xs);
  color: var(--sidebar-text);
  font-size: 0.75rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.sidebar-link i {
  font-size: 0.82rem;
  width: 16px;
  text-align: center;
  color: #64748b;
  transition: var(--transition);
  flex-shrink: 0;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #f8fafc;
  transform: translateX(1px);
}

.sidebar-link:hover i {
  color: #34d399;
}

.sidebar-link.active {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.16) 0%, rgba(16, 185, 129, 0.03) 100%);
  color: #ffffff;
  font-weight: 600;
  border-left: 3px solid #10b981;
}

.sidebar-link.active i {
  color: var(--accent-primary);
  filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.6));
}

.sidebar-badge {
  margin-left: auto;
  font-size: 0.58rem;
  font-weight: 700;
  padding: 0.12rem 0.4rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
}

.sidebar-badge.badge-alert {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.sidebar-badge.badge-success {
  background: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

/* ---------------- ACCORDION SUBMENUS FOR GYM SIDEBAR ---------------- */
.nav-group {
  display: flex;
  flex-direction: column;
}

.nav-group-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-xs);
  color: var(--sidebar-text);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.nav-group-header i.menu-icon {
  font-size: 0.82rem;
  width: 16px;
  text-align: center;
  color: #64748b;
  transition: var(--transition);
  flex-shrink: 0;
}

.nav-group-header:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #f8fafc;
  transform: translateX(1px);
}

.nav-group-header:hover i.menu-icon {
  color: #34d399;
}

.nav-group.active > .nav-group-header {
  color: #34d399;
  background: rgba(16, 185, 129, 0.08);
}
.nav-group.active > .nav-group-header i.menu-icon {
  color: var(--accent-primary);
}

.nav-caret {
  margin-left: auto;
  font-size: 0.62rem;
  color: #64748b;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-group.open > .nav-group-header .nav-caret {
  transform: rotate(90deg);
  color: #34d399;
}

.nav-submenu {
  display: none;
  flex-direction: column;
  gap: 0.08rem;
  margin-left: 10px;
  padding-left: 6px;
  border-left: 1.5px solid rgba(16, 185, 129, 0.2);
  margin-top: 1px;
  margin-bottom: 3px;
}

.nav-group.open > .nav-submenu {
  display: flex;
}

.nav-sublink {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.45rem;
  border-radius: var(--radius-xs);
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.73rem;
  font-weight: 500;
  transition: var(--transition);
}

.nav-sublink:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
  padding-left: 0.6rem;
}

.nav-sublink.active {
  color: #34d399;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.14);
  border-left: 2px solid #10b981;
  margin-left: -1.5px;
}

.nav-sublink-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.65;
  flex-shrink: 0;
}

.nav-sublink.active .nav-sublink-dot {
  opacity: 1;
  box-shadow: 0 0 5px #10b981;
}

.sidebar-footer {
  padding: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(0, 0, 0, 0.2);
}

.kiosk-quick-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.55rem;
  border-radius: var(--radius-xs);
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  transition: var(--transition);
  border: none;
  cursor: pointer;
}

.kiosk-quick-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.45);
}

/* ---------------- HEADER / TOPBAR (LIGHT & COMPACT) ---------------- */
.header {
  height: var(--header-height);
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  box-shadow: var(--shadow-sm);
}

.sidebar-toggle-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.86rem;
  transition: var(--transition);
  margin-right: 0.75rem;
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #cbd5e1;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  z-index: 95;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

body.sidebar-mobile-open .sidebar-backdrop {
  opacity: 1;
  visibility: visible;
}

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

.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.page-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.live-clock-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', monospace;
  color: #0369a1;
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.28rem 0.65rem;
  border-radius: var(--radius-full);
  background: #f8fafc;
  border: 1px solid var(--border-color);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: #fff;
}

.user-meta {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--text-main);
}

.user-role {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: capitalize;
}

/* ---------------- CARDS & METRICS (LIGHT) ---------------- */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.15rem;
  margin-bottom: 1.25rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  position: relative;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.06);
}

.stat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.15rem;
}

.stat-info .stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 0.2rem;
}

.stat-info .stat-value {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text-main);
}

.stat-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.stat-sub.positive { color: #16a34a; font-weight: 600; }
.stat-sub.warning { color: #d97706; font-weight: 600; }
.stat-sub.danger { color: #dc2626; font-weight: 600; }

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.icon-lime {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.icon-cyan {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.icon-orange {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.icon-purple {
  background: #f3e8ff;
  color: #7e22ce;
  border: 1px solid #e9d5ff;
}

.icon-red {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* Card Header & Content */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ---------------- TABLES (LIGHT & COMPACT) ---------------- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table-custom,
.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.84rem;
}

.table-custom th,
.table th {
  padding: 0.75rem 0.95rem;
  background: #f8fafc;
  color: #475569;
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border-color);
  text-align: left;
  vertical-align: middle;
}

.table-custom td,
.table td {
  padding: 0.75rem 0.95rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  color: var(--text-main);
  text-align: left;
}

.table-custom tr:hover td,
.table tr:hover td {
  background: #f8fafc;
}

/* Responsive Table Column Utilities */
.col-hide-mobile {
  display: table-cell;
}
.mobile-only-detail {
  display: none;
}

/* WhatsApp Message Bubble in Table */
.bot-msg-bubble {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #10b981;
  border-radius: 6px;
  padding: 0.55rem 0.85rem;
  font-size: 0.83rem;
  color: #1e293b;
  line-height: 1.45;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.bot-msg-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: #10b981;
  font-weight: 700;
}

/* Member avatar in table */
.member-cell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.member-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
}

.member-avatar.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #0369a1;
  background: #e0f2fe;
}

.member-info-col h4 {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-main);
}

.member-info-col span {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

/* ---------------- STATUS BADGES (PASTEL LIGHT) ---------------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
}

.status-active {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.status-expiring {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.status-expired {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.status-frozen {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

/* ---------------- BUTTONS ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.35);
}

.btn-secondary {
  background: #f1f5f9;
  color: #1e293b;
  border: 1px solid var(--border-input);
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-cyan {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #fff;
}

.btn-whatsapp {
  background: #25d366;
  color: #fff;
  font-weight: 600;
}

.btn-whatsapp:hover {
  background: #1eb857;
}

.btn-danger {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.btn-danger:hover {
  background: #dc2626;
  color: #fff;
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.76rem;
  border-radius: var(--radius-xs);
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-xs);
}

/* ---------------- COMPACT MODALS (LIGHT) ---------------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99999 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.active {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.modal-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  display: flex !important;
  flex-direction: column !important;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.25);
  transform: scale(0.97) translateY(10px);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden !important;
  position: relative;
  z-index: 100000 !important;
}

.modal-card.modal-lg {
  max-width: 780px;
}

/* Ensure any form inside .modal-card fills the card and participates in flex */
.modal-card > form,
.modal-card form {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: 100% !important;
  overflow: hidden !important;
  margin: 0 !important;
}

.modal-overlay.active .modal-card {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 0.95rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: #f8fafc;
  flex-shrink: 0 !important;
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close-btn:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.modal-body {
  padding: 1.15rem 1.25rem;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
}

.modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 0.65rem;
  flex-shrink: 0 !important;
  position: relative;
  z-index: 30;
}

/* Compact Form Grid */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

.form-group {
  margin-bottom: 0.85rem;
}

.form-group.col-span-2 {
  grid-column: span 2;
}

.form-group.col-span-3 {
  grid-column: span 3;
}

.form-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.form-label span.req {
  color: var(--accent-red);
}

.form-control {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  padding: 0.48rem 0.75rem;
  color: var(--text-main);
  font-size: 0.84rem;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

textarea.form-control {
  resize: vertical;
  min-height: 75px;
}

/* ---------------- RETICLE SCANNER MODAL ---------------- */
.reticle-container {
  position: relative;
  width: 260px;
  height: 260px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #10b981;
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.25);
  background: #000;
}

.reticle-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.reticle-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px dashed rgba(16, 185, 129, 0.7);
  animation: rotate-ring 12s linear infinite;
  pointer-events: none;
}

@keyframes rotate-ring {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.scan-laser {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #10b981, transparent);
  box-shadow: 0 0 10px #10b981;
  animation: scan-vertical 2.2s infinite ease-in-out;
  pointer-events: none;
}

@keyframes scan-vertical {
  0% { top: 5%; opacity: 0.2; }
  50% { top: 95%; opacity: 1; }
  100% { top: 5%; opacity: 0.2; }
}

/* Entrance Barrier State Card */
.entrance-card {
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  text-align: center;
  transition: var(--transition);
}

.entrance-card.granted {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.22) 0%, rgba(6, 78, 59, 0.6) 100%) !important;
  border: 2px solid #10b981 !important;
  box-shadow: 0 0 35px rgba(16, 185, 129, 0.35) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.entrance-card.warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22) 0%, rgba(120, 53, 15, 0.6) 100%) !important;
  border: 2px solid #f59e0b !important;
  box-shadow: 0 0 35px rgba(245, 158, 11, 0.35) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.entrance-card.denied {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.22) 0%, rgba(127, 29, 29, 0.6) 100%) !important;
  border: 2px solid #ef4444 !important;
  box-shadow: 0 0 35px rgba(239, 68, 68, 0.4) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: shake 0.4s ease-in-out;
}

.entrance-card .status-badge.status-active {
  background: rgba(16, 185, 129, 0.3) !important;
  color: #34d399 !important;
  border: 1px solid #10b981 !important;
}

.entrance-card .status-badge.status-expiring {
  background: rgba(245, 158, 11, 0.3) !important;
  color: #fbbf24 !important;
  border: 1px solid #f59e0b !important;
}

.entrance-card .status-badge.status-expired {
  background: rgba(239, 68, 68, 0.3) !important;
  color: #f87171 !important;
  border: 1px solid #ef4444 !important;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ---------------- RESPONSIVE & 100% NATIVE MOBILE APP ENGINE ---------------- */

/* Mobile Bottom Navigation Bar (Hidden by default on Desktop) */
.mobile-bottom-nav {
  display: none;
}

/* Mobile Drawer Backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* Mobile Drawer Close Button */
.sidebar-mobile-close {
  display: none;
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: none;
  font-size: 0.95rem;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.15s ease;
}
.sidebar-mobile-close:active {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(0.92);
}

.dashboard-hero-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  gap: 1rem;
}
.dashboard-hero-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin: 0 0 2px 0;
}
.dashboard-hero-sub {
  color: var(--text-dim);
  font-size: 0.82rem;
  margin: 0;
}
.dashboard-hero-btns {
  display: flex;
  gap: 0.5rem;
}

/* Notice Board & Announcement Cards */
.notice-board-card {
  margin-top: 1.25rem;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.06) 0%, rgba(16, 185, 129, 0.03) 100%);
  border: 1px solid rgba(6, 182, 212, 0.15);
}
.notice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.85rem;
}
.notice-card-item {
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between;
  background: #ffffff;
  padding: 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  min-width: 0;
}
.notice-card-header {
  display: flex !important;
  flex-direction: row !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}
.notice-card-title {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.88rem;
  line-height: 1.3;
}
.notice-badge {
  text-transform: uppercase;
  font-size: 0.62rem;
  font-weight: 800;
  flex-shrink: 0;
  padding: 0.18rem 0.45rem;
  border-radius: 4px;
}
.notice-card-body {
  font-size: 0.78rem;
  color: #475569;
  line-height: 1.45;
  margin-bottom: 0.6rem;
  flex-grow: 1;
  word-break: break-word;
}
.notice-card-footer {
  display: flex !important;
  flex-direction: row !important;
  justify-content: space-between !important;
  align-items: center !important;
  font-size: 0.7rem;
  color: #94a3b8;
  border-top: 1px dashed var(--border-color);
  padding-top: 0.45rem;
  margin-top: auto;
}

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  /* Prevent horizontal screen wobbles */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
  }

  .app-wrapper {
    overflow-x: hidden;
    max-width: 100vw;
  }

  /* Main content mobile padding & bottom dock clearance */
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 6px)) !important;
    min-height: 100vh;
  }

  .page-body {
    padding: 0.5rem 0.55rem 0.85rem 0.55rem;
    max-width: 100%;
  }

  /* Ultra-Compact Native Mobile Top App Bar (Header) */
  .header {
    height: 46px;
    padding: 0 0.6rem;
    position: sticky;
    top: 0;
    z-index: 999;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
  }

  .header-left {
    gap: 0.4rem;
    align-items: center;
  }

  .sidebar-toggle-btn {
    width: 32px;
    height: 32px;
    font-size: 0.92rem;
    border-radius: 7px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .page-title {
    font-size: 0.84rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.35rem;
  }
  .page-title span {
    max-width: 110px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
  }

  /* Hide desktop clock chip */
  .live-clock-chip {
    display: none !important;
  }

  .header-right {
    gap: 0.35rem;
    align-items: center;
  }

  /* Hide duplicate camera punch button on mobile (center FAB dock handles it!) */
  .header-punch-btn {
    display: none !important;
  }

  /* Floor pill: single line, compact, no wrapping */
  .floor-pill {
    padding: 0.15rem 0.45rem !important;
    height: 24px !important;
    display: inline-flex !important;
    align-items: center !important;
    white-space: nowrap !important;
    border-radius: 99px !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
  }
  .floor-pill .counter-desktop {
    display: none !important;
  }
  .floor-pill .counter-mobile {
    display: inline !important;
    font-size: 0.68rem !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  .header-right .user-pill {
    padding: 0.15rem 0.35rem;
    gap: 0.25rem;
    height: 26px;
  }
  .header-right .user-avatar {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
  }
  .header-right .user-meta {
    display: none !important;
  }

  /* Native Mobile Off-Canvas Drawer (Dark Sidebar) */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    max-width: 82vw;
    z-index: 9999;
    transform: translateX(-100%);
    transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
  }

  .sidebar.mobile-open,
  body.sidebar-mobile-active .sidebar,
  body.sidebar-mobile-open .sidebar {
    transform: translateX(0) !important;
    box-shadow: 14px 0 40px rgba(0, 0, 0, 0.55);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .sidebar-backdrop.active,
  body.sidebar-mobile-active .sidebar-backdrop,
  body.sidebar-mobile-open .sidebar-backdrop {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .sidebar-mobile-close {
    display: flex;
  }

  .sidebar-collapse-pin {
    display: none;
  }

  /* Universal Page Title & Actions across ALL pages (members, attendance, classes, etc.) */
  .page-body > div[style*="justify-content: space-between"]:first-of-type,
  .dashboard-hero-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    margin-bottom: 0.65rem !important;
    gap: 0.45rem !important;
  }
  .page-body > div[style*="justify-content: space-between"]:first-of-type > div:first-child,
  .dashboard-hero-title-area {
    width: 100% !important;
  }
  .page-body > div[style*="justify-content: space-between"]:first-of-type > div:last-child,
  .dashboard-hero-btns {
    width: 100% !important;
    display: flex !important;
    gap: 0.4rem !important;
    overflow-x: auto !important;
  }
  .page-body > div[style*="justify-content: space-between"]:first-of-type > div:last-child .btn,
  .dashboard-hero-btns .btn {
    flex: 1 !important;
    justify-content: center !important;
    white-space: nowrap !important;
  }

  .dashboard-hero-title,
  .page-body h2 {
    font-size: 1.05rem !important;
    font-weight: 800 !important;
    margin-bottom: 2px !important;
    line-height: 1.25 !important;
    letter-spacing: -0.01em;
  }
  .dashboard-hero-sub,
  .page-body p {
    font-size: 0.72rem !important;
    color: #64748b !important;
    line-height: 1.35 !important;
    margin-bottom: 0.25rem !important;
  }

  /* 2x2 Ultra-Compact Grid for KPI Metrics on Mobile */
  .grid-4 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.45rem !important;
    margin-bottom: 0.65rem !important;
  }

  /* 1-Column Stack for 3-item Cards (Prevents text clipping on mobile) */
  .grid-3 {
    grid-template-columns: 1fr !important;
    gap: 0.45rem !important;
    margin-bottom: 0.65rem !important;
  }

  .grid-2 {
    grid-template-columns: 1fr !important;
    gap: 0.55rem !important;
    margin-bottom: 0.65rem !important;
  }

  /* Mobile Responsive Table Columns */
  .col-hide-mobile {
    display: none !important;
  }
  .mobile-only-detail {
    display: block !important;
  }

  /* Filter Toolbar & Search Bars across all pages (members.php, attendance.php, etc.) */
  .card form[method="GET"],
  .filter-form {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.45rem !important;
  }
  .card form[method="GET"] > div[style*="flex: 1"],
  .card form[method="GET"] > div:first-child {
    min-width: 100% !important;
    width: 100% !important;
  }
  .card form[method="GET"] > div[style*="display: flex; gap: 0.5rem"] {
    display: flex !important;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    gap: 0.35rem !important;
    padding-bottom: 3px !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .card form[method="GET"] > div[style*="display: flex; gap: 0.5rem"]::-webkit-scrollbar {
    display: none;
  }
  .card form[method="GET"] > div[style*="display: flex; gap: 0.5rem"] .btn {
    flex-shrink: 0 !important;
    padding: 0.25rem 0.55rem !important;
    font-size: 0.72rem !important;
    border-radius: 99px !important;
  }

  /* POS Interface Mobile (pos.php) */
  .pos-grid-layout {
    grid-template-columns: 1fr !important;
    gap: 0.65rem !important;
  }
  .pos-grid-layout > div:first-child > div[style*="grid-template-columns"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem !important;
  }
  .product-box {
    padding: 0.65rem !important;
    border-radius: 8px !important;
  }
  .cart-box {
    position: static !important;
    padding: 0.75rem !important;
    border-radius: 10px !important;
  }

  /* Macro Calculator (macro_calculator.php) */
  div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 0.65rem !important;
  }
  div[style*="grid-template-columns: repeat(3, 1fr)"] {
    gap: 0.45rem !important;
  }
  div[style*="grid-template-columns: repeat(3, 1fr)"] .card {
    padding: 0.55rem 0.4rem !important;
  }
  div[style*="grid-template-columns: repeat(3, 1fr)"] [id$="Display"] {
    font-size: 1.25rem !important;
  }

  /* Bot & Cron Tabs (bot_cron.php) */
  .bot-tab,
  div[style*="display: flex; gap: 0.5rem; flex-wrap: wrap"] {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .bot-tab {
    flex-shrink: 0 !important;
    padding: 0.4rem 0.65rem !important;
    font-size: 0.72rem !important;
  }

  /* Reports Charts & Spans (reports.php) */
  .grid-2 > div[style*="grid-column: span 2"] {
    grid-column: span 1 !important;
  }
  .card div[style*="height: 280px"] {
    height: 200px !important;
  }

  /* Member Profile Hero Banner (member_view.php) */
  .member-hero-banner {
    padding: 0.75rem !important;
  }
  .member-hero-banner img,
  .member-hero-banner div[style*="width: 84px"] {
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    font-size: 1.4rem !important;
    border-radius: 8px !important;
  }
  .member-hero-banner h2 {
    font-size: 1.05rem !important;
  }
  .member-hero-banner > div {
    gap: 0.75rem !important;
  }
  .member-hero-banner > div > div:last-child {
    width: 100% !important;
    display: flex !important;
    gap: 0.35rem !important;
  }
  .member-hero-banner > div > div:last-child .btn {
    flex: 1 !important;
    justify-content: center !important;
    font-size: 0.72rem !important;
    padding: 0.3rem 0.4rem !important;
  }

  /* Notice Board Mobile Overrides */
  .notice-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.6rem !important;
    width: 100% !important;
  }
  .notice-card-item {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 10px !important;
    padding: 0.75rem 0.85rem !important;
    margin: 0 !important;
  }
  .notice-card-header {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    gap: 0.5rem !important;
    margin-bottom: 0.4rem !important;
  }
  .notice-card-title {
    font-size: 0.84rem !important;
    font-weight: 700 !important;
    color: var(--text-main) !important;
    line-height: 1.3 !important;
  }
  .notice-card-body {
    font-size: 0.74rem !important;
    color: #475569 !important;
    line-height: 1.45 !important;
    width: 100% !important;
    display: block !important;
    margin-bottom: 0.5rem !important;
  }
  .notice-card-footer {
    font-size: 0.68rem !important;
    color: #94a3b8 !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-top: 1px dashed var(--border-color) !important;
    padding-top: 0.4rem !important;
  }

  /* WhatsApp Broadcast Layout Mobile */
  .broadcast-layout {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  .form-grid-2, .form-grid-3 {
    grid-template-columns: 1fr !important;
    gap: 0.5rem;
  }
  .form-group.col-span-2, .form-group.col-span-3 {
    grid-column: span 1 !important;
  }

  /* Stat & Metric Cards (Compact & Chhota-chhota) */
  .stat-card,
  .metric-card {
    padding: 0.55rem 0.65rem !important;
    border-radius: 9px !important;
    margin-bottom: 0 !important;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
  }

  .stat-label,
  .metric-label {
    font-size: 0.62rem !important;
    text-transform: uppercase;
    font-weight: 700 !important;
    letter-spacing: 0.3px;
    color: #64748b;
    margin-bottom: 2px !important;
  }

  .stat-value,
  .metric-value {
    font-size: 1.15rem !important;
    font-weight: 900 !important;
    line-height: 1.1 !important;
    margin: 2px 0 3px 0 !important;
    color: #0f172a;
  }

  .stat-sub {
    font-size: 0.62rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
  }

  .stat-icon,
  .metric-icon {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    font-size: 0.85rem !important;
    border-radius: 6px !important;
  }

  /* Compact Cards Mobile Look */
  .card {
    border-radius: 10px !important;
    padding: 0.65rem 0.75rem !important;
    margin-bottom: 0.55rem !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  }

  .card-header {
    margin-bottom: 0.5rem !important;
    padding-bottom: 0.35rem !important;
  }
  .card-title {
    font-size: 0.82rem !important;
    font-weight: 800 !important;
  }

  /* Touch-friendly Form Controls */
  .form-control, input, select, textarea {
    font-size: 16px !important;
    min-height: 38px;
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
  }

  /* Compact Mobile App Touch Buttons */
  .btn {
    min-height: 32px !important;
    padding: 0.3rem 0.6rem !important;
    border-radius: 6px !important;
    font-size: 0.75rem !important;
    font-weight: 700;
  }
  .btn-sm {
    min-height: 28px !important;
    padding: 0.25rem 0.5rem !important;
    font-size: 0.72rem !important;
  }
  .btn:active {
    transform: scale(0.97);
  }

  /* Compact Tables */
  .table-custom th,
  .table th {
    padding: 0.4rem 0.5rem !important;
    font-size: 0.67rem !important;
  }
  .table-custom td,
  .table td {
    padding: 0.4rem 0.5rem !important;
    font-size: 0.74rem !important;
  }
  .member-cell {
    gap: 0.45rem;
  }
  .member-avatar {
    width: 28px !important;
    height: 28px !important;
  }

  /* Native Mobile Bottom Navigation Bar (Dock) */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.05);
    z-index: 9990;
    justify-content: space-around;
    align-items: center;
  }

  .mobile-bottom-nav .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #64748b;
    text-decoration: none;
    font-size: 0.62rem;
    font-weight: 700;
    gap: 2px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-bottom-nav .nav-item i {
    font-size: 1.05rem;
    transition: transform 0.15s ease;
  }

  .mobile-bottom-nav .nav-item:active i {
    transform: scale(0.88);
  }

  .mobile-bottom-nav .nav-item.active {
    color: var(--accent-primary);
  }
  .mobile-bottom-nav .nav-item.active i {
    transform: scale(1.08);
  }

  /* Center Floating Punch Action Button (Compact) */
  .mobile-bottom-nav .nav-fab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    position: relative;
    top: -9px;
    color: #0f172a;
    font-size: 0.62rem;
    font-weight: 800;
  }

  .mobile-bottom-nav .nav-fab-inner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.4);
    border: 2px solid #ffffff;
    transition: transform 0.15s ease;
    margin-bottom: 2px;
  }

  .mobile-bottom-nav .nav-fab-btn:active .nav-fab-inner {
    transform: scale(0.92);
  }

  /* Native Mobile Bottom-Sheet Modals (100% Pinned Visible Buttons) */
  .modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    height: 100vh !important;
    align-items: flex-end !important;
    justify-content: center !important;
    padding: 0 !important;
    z-index: 999999 !important;
  }

  .modal-card {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border-radius: 18px 18px 0 0 !important;
    max-height: 82dvh !important;
    max-height: 82vh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    animation: slideUpBottom 0.24s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.45) !important;
    z-index: 1000000 !important;
  }

  @keyframes slideUpBottom {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .modal-card::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 4px;
    margin: 8px auto 4px auto;
    flex-shrink: 0 !important;
  }

  .modal-header {
    padding: 0.6rem 0.95rem !important;
    flex-shrink: 0 !important;
    background: #ffffff !important;
  }

  .modal-title {
    font-size: 0.88rem !important;
  }

  .modal-card > form,
  .modal-card form {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: 100% !important;
    overflow: hidden !important;
    margin: 0 !important;
  }

  .modal-body {
    padding: 0.75rem 0.95rem !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
  }

  /* Docked Mobile Footer: Buttons are ALWAYS pinned, visible, side-by-side! */
  .modal-footer {
    flex-shrink: 0 !important;
    padding: 0.65rem 0.85rem calc(0.65rem + env(safe-area-inset-bottom, 12px)) 0.85rem !important;
    background: #ffffff !important;
    border-top: 1px solid var(--border-color) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: stretch !important;
    gap: 0.5rem !important;
    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.08) !important;
    position: sticky !important;
    bottom: 0 !important;
    z-index: 100 !important;
  }

  .modal-footer .btn {
    flex: 1 !important;
    justify-content: center !important;
    min-height: 38px !important;
    font-size: 0.82rem !important;
  }

  /* Hide bottom nav bar completely when any modal is open */
  body:has(.modal-overlay.active) .mobile-bottom-nav,
  body.modal-open .mobile-bottom-nav {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    opacity: 0 !important;
  }

  .table-responsive {
    border-radius: 7px;
    border: 1px solid var(--border-color);
    -webkit-overflow-scrolling: touch;
  }
}

/* ---------------- PRINT RULES ---------------- */
@media print {
  .sidebar, .header, .btn, .no-print, .modal-overlay {
    display: none !important;
  }
  .main-content { margin-left: 0 !important; background: #fff !important; }
  body { background: #fff !important; color: #000 !important; }
  .card { border: 1px solid #ddd !important; box-shadow: none !important; }
}
