/* ==========================================================================
   HULK FITNESS — GYM DESK
   Ultra-clean, Minimalist SaaS Admin Design System
   ========================================================================== */

:root {
  --bg-primary: #FAFAFA;
  --bg-card: #FFFFFF;
  --bg-subtle: #F3F3F3;
  --bg-hover: #F7F7F7;
  --text-primary: #171717;
  --text-secondary: #888888;
  --text-muted: #666666;
  --accent-red: #D71920;
  --accent-red-hover: #B8141A;
  --accent-red-soft: rgba(215, 25, 32, 0.08);
  --border-color: #E8E8E8;
  --border-strong: #D4D4D4;

  /* Status tokens (muted, clean SaaS pills) */
  --status-active-bg: #ECFDF3;
  --status-active-text: #067647;
  --status-active-border: #ABEFC6;

  --status-warn-bg: #FFFAEB;
  --status-warn-text: #B54708;
  --status-warn-border: #FEDF89;

  --status-expired-bg: #FEF3F2;
  --status-expired-text: #B42318;
  --status-expired-border: #FECDCA;

  --status-neutral-bg: #F4F4F5;
  --status-neutral-text: #52525B;
  --status-neutral-border: #E4E4E7;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-modal: 0 12px 32px rgba(0, 0, 0, 0.12);

  --sidebar-width: 232px;
  --topbar-height: 60px;
  --bottom-nav-height: 64px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg-primary: #0D0D0D;
  --bg-card: #151515;
  --bg-subtle: #1E1E1E;
  --bg-hover: #1C1C1C;
  --text-primary: #F5F5F5;
  --text-secondary: #888888;
  --text-muted: #A3A3A3;
  --accent-red: #D71920;
  --accent-red-hover: #E52229;
  --accent-red-soft: rgba(215, 25, 32, 0.16);
  --border-color: #262626;
  --border-strong: #363636;

  --status-active-bg: rgba(6, 118, 71, 0.18);
  --status-active-text: #6CE9A6;
  --status-active-border: rgba(108, 233, 166, 0.25);

  --status-warn-bg: rgba(181, 71, 8, 0.2);
  --status-warn-text: #FEC84B;
  --status-warn-border: rgba(254, 200, 75, 0.28);

  --status-expired-bg: rgba(180, 35, 24, 0.2);
  --status-expired-text: #FDA29B;
  --status-expired-border: rgba(253, 162, 155, 0.28);

  --status-neutral-bg: #222222;
  --status-neutral-text: #A1A1AA;
  --status-neutral-border: #333333;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-modal: 0 16px 40px rgba(0, 0, 0, 0.6);
}

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

html, body {
  height: 100%;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   LOGIN SCREEN
   ========================================================================== */
.auth-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background-color: var(--bg-primary);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-card);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--text-primary);
  color: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.03em;
  position: relative;
  flex-shrink: 0;
}

.brand-mark::after {
  content: "";
  position: absolute;
  bottom: 4px;
  width: 16px;
  height: 2.5px;
  background: var(--accent-red);
  border-radius: 2px;
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-sub {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent-red);
  margin-top: 2px;
}

.auth-heading {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.auth-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 22px;
}

.auth-mode-notice {
  margin-top: 18px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
}

.auth-mode-notice strong {
  color: var(--text-primary);
}

/* ==========================================================================
   APP SHELL LAYOUT
   ========================================================================== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* Sidebar (Desktop) */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  padding: 20px 14px;
}

.sidebar .brand-lockup {
  padding: 0 8px 18px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13.5px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.8;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-red-soft);
  color: var(--accent-red);
  font-weight: 600;
}

.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.sidebar-footer {
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-cta {
  width: 100%;
  justify-content: center;
}

/* Main Area */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-brand {
  display: none;
}

.page-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ist-clock {
  font-size: 12.5px;
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.mode-banner {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
}

.mode-banner-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #F59E0B;
  flex-shrink: 0;
}

.mode-dot.live {
  background: #10B981;
}

/* Content Container */
.content-wrap {
  padding: 28px;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}

/* ==========================================================================
   CARDS, METRICS & TABLES
   ========================================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 96px;
}

.metric-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.metric-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.metric-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.metric-card.highlight-alert .metric-value {
  color: var(--accent-red);
}

/* Section Card */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
  overflow: hidden;
}

.section-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.section-subtitle {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.section-body {
  padding: 20px;
}

/* Filter Pills */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
}

.filter-pill:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.filter-pill.active {
  background: var(--text-primary);
  color: var(--bg-card);
  border-color: var(--text-primary);
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 11px 16px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13.5px;
  color: var(--text-primary);
  vertical-align: middle;
}

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

.data-table tbody tr:hover {
  background: var(--bg-hover);
}

/* Member cell */
.entity-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

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

.entity-primary {
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.entity-secondary {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-active {
  background: var(--status-active-bg);
  color: var(--status-active-text);
  border-color: var(--status-active-border);
}

.badge-expiring {
  background: var(--status-warn-bg);
  color: var(--status-warn-text);
  border-color: var(--status-warn-border);
}

.badge-expired {
  background: var(--status-expired-bg);
  color: var(--status-expired-text);
  border-color: var(--status-expired-border);
}

.badge-neutral {
  background: var(--status-neutral-bg);
  color: var(--status-neutral-text);
  border-color: var(--status-neutral-border);
}

.badge-new {
  background: #EFF8FF;
  color: #175CD3;
  border-color: #B2DDFF;
}

[data-theme="dark"] .badge-new {
  background: #102A43;
  color: #82C9FF;
  border-color: #1E3A8A;
}

.badge-interested {
  background: #F9F5FF;
  color: #6941C6;
  border-color: #E9D7FE;
}

[data-theme="dark"] .badge-interested {
  background: #2E1B4E;
  color: #D6BBFB;
  border-color: #4A1D96;
}

.badge-contacted {
  background: #F0F9FF;
  color: #026AA2;
  border-color: #B9E6FE;
}

[data-theme="dark"] .badge-contacted {
  background: #0B2942;
  color: #7CD4FD;
  border-color: #034870;
}

.badge-success {
  background: #ECFDF5;
  color: #065F46;
  border-color: #A7F3D0;
}
[data-theme="dark"] .badge-success {
  background: #064E3B;
  color: #6EE7B7;
  border-color: #047857;
}

.badge-danger {
  background: #FEF2F2;
  color: #991B1B;
  border-color: #FECACA;
}
[data-theme="dark"] .badge-danger {
  background: #450A0A;
  color: #FCA5A5;
  border-color: #7F1D1D;
}

.btn-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.14s ease;
}

.btn-icon-link svg {
  width: 15px;
  height: 15px;
}

.btn-icon-link:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-whatsapp-link {
  color: #128C7E;
}

.btn-whatsapp-link:hover {
  background: rgba(37, 211, 102, 0.1);
  border-color: #25D366;
  color: #25D366;
}

.btn-call-link {
  color: #175CD3;
}

.btn-call-link:hover {
  background: rgba(23, 92, 211, 0.1);
  border-color: #175CD3;
}

/* ==========================================================================
   BUTTONS & INPUT CONTROLS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.14s ease, border-color 0.14s ease, opacity 0.14s ease;
  white-space: nowrap;
  text-decoration: none;
}

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

.btn svg {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: var(--accent-red);
  color: #FFFFFF;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-red-hover);
}

.btn-dark {
  background: var(--text-primary);
  color: var(--bg-card);
}

.btn-dark:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

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

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.form-hint {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  transition: border-color 0.14s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--text-primary);
}

.form-control[readonly] {
  background: var(--bg-subtle);
  color: var(--text-muted);
}

.search-input-wrap {
  position: relative;
  min-width: 240px;
}

.search-input-wrap svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-secondary);
}

.search-input-wrap .form-control {
  padding-left: 34px;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--accent-red);
  width: 16px;
  height: 16px;
}

/* Summary Preview Box inside Admission / Renewal */
.calc-summary-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.calc-item-label {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.calc-item-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

/* ==========================================================================
   MODALS & DRAWERS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
}

.modal-card {
  width: 100%;
  max-width: 620px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
}

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

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

.modal-title {
  font-size: 16px;
  font-weight: 600;
}

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

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

.modal-body {
  padding: 22px;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-primary);
}

/* ==========================================================================
   DIGITAL RECEIPT CARD (Print & PDF Ready)
   ========================================================================== */
.receipt-paper {
  background: #FFFFFF;
  color: #171717;
  border: 1px solid #E0E0E0;
  border-radius: var(--radius-md);
  padding: 28px;
  max-width: 520px;
  margin: 0 auto;
}

.receipt-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 18px;
  border-bottom: 2px solid #171717;
  margin-bottom: 18px;
}

.receipt-gym-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #171717;
}

.receipt-gym-address {
  font-size: 12px;
  color: #555555;
  margin-top: 4px;
  line-height: 1.4;
}

.receipt-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  background: #171717;
  color: #FFFFFF;
  border-radius: 4px;
}

.receipt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
  font-size: 13px;
}

.receipt-field-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #777777;
}

.receipt-field-val {
  font-weight: 600;
  color: #171717;
  margin-top: 2px;
}

.receipt-line-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 18px;
}

.receipt-line-table th {
  font-size: 11px;
  text-transform: uppercase;
  color: #666666;
  border-top: 1px solid #E0E0E0;
  border-bottom: 1px solid #E0E0E0;
  padding: 8px 0;
  text-align: left;
}

.receipt-line-table td {
  padding: 12px 0;
  border-bottom: 1px solid #EEEEEE;
  font-size: 13.5px;
  color: #171717;
}

.receipt-totals {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid #171717;
  padding-top: 12px;
}

.receipt-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
}

.receipt-total-row.grand {
  font-size: 16px;
  font-weight: 800;
  color: #171717;
}

.receipt-footer-note {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px dashed #D0D0D0;
  font-size: 11.5px;
  color: #666666;
  text-align: center;
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--text-primary);
  color: var(--bg-card);
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-modal);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================================
   MOBILE BOTTOM NAVIGATION & RESPONSIVE BREAKPOINTS
   ========================================================================== */
.bottom-nav {
  display: none;
}

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

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .main-area {
    margin-left: 0;
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 16px);
  }

  .auth-screen {
    min-height: 100dvh;
    padding: 16px;
    padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
    justify-content: flex-start;
    padding-top: max(28px, env(safe-area-inset-top, 0px));
  }

  .auth-card {
    padding: 24px 20px;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .topbar {
    padding: 0 12px;
    gap: 8px;
    height: auto;
    min-height: 56px;
    padding-top: env(safe-area-inset-top, 0px);
  }

  .topbar-left {
    gap: 8px;
    min-width: 0;
  }

  .page-title {
    font-size: 14.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-right {
    gap: 6px;
    flex-shrink: 0;
  }

  .topbar-right .btn-sm {
    padding: 8px 10px;
    min-height: 40px;
    font-size: 12px;
  }

  #adminProfileBtn span {
    display: none;
  }

  .ist-clock {
    display: none;
  }

  .mode-banner {
    padding: 10px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .content-wrap {
    padding: 12px;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .metric-card {
    padding: 13px;
    min-height: 84px;
  }

  .metric-value {
    font-size: 19px;
  }

  /* Single-column forms, readable labels & large 44px+ touch targets on phones (prevents iOS 16px zoom) */
  .form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .form-label {
    font-size: 13.5px;
    line-height: 1.35;
  }

  .form-hint {
    font-size: 12.5px;
    line-height: 1.45;
  }

  .form-control {
    min-height: 46px;
    padding: 11px 13px;
    font-size: 16px;
    scroll-margin-top: 84px;
    scroll-margin-bottom: 180px;
  }

  .btn {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 14px;
  }

  .btn-sm {
    min-height: 44px;
    padding: 8px 12px;
    font-size: 13px;
  }

  .badge {
    white-space: normal;
    text-align: left;
    max-width: 100%;
    word-break: break-word;
  }

  .checkbox-row {
    padding: 14px 12px;
    gap: 12px;
    min-height: 48px;
    scroll-margin-bottom: 180px;
  }

  .checkbox-row input[type="checkbox"] {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
  }

  /* Full-height mobile modal sheet with scrollable body & sticky reachable Save footer */
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .modal-card,
  .modal-card.modal-lg {
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
    overflow: hidden;
  }

  .modal-card > form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  .modal-header {
    padding: 14px 16px;
    padding-top: max(14px, env(safe-area-inset-top, 0px));
    flex-shrink: 0;
  }

  .modal-close {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
  }

  .modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    padding-bottom: 120px;
  }

  .modal-footer {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
    z-index: 5;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
  }

  .modal-footer .btn {
    width: 100%;
    min-height: 46px;
    font-size: 14.5px;
    white-space: normal;
    text-align: center;
  }

  /* Compact horizontal row for 3-button receipt footer so Print/PDF/Share don't crowd the screen */
  .modal-footer.receipt-footer-actions {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .modal-footer.receipt-footer-actions .btn {
    flex: 1 1 calc(50% - 4px);
    min-height: 44px;
    padding: 8px 10px;
    font-size: 13.5px;
  }

  .modal-footer.receipt-footer-actions .btn-primary {
    flex: 1 1 100%;
    order: -1;
  }

  /* Member Search & Filters */
  .section-header {
    padding: 14px;
    gap: 10px;
  }

  .section-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

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

  .filter-bar {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding-bottom: 4px;
  }

  .filter-pill {
    flex-shrink: 0;
    min-height: 38px;
    padding: 7px 12px;
    font-size: 13px;
  }

  /* Receipt Card readability on 360px / 390px screens */
  .receipt-paper {
    padding: 16px;
    max-width: 100%;
  }

  .receipt-header {
    flex-direction: column;
    gap: 8px;
    padding-bottom: 12px;
    margin-bottom: 14px;
  }

  .receipt-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .receipt-field-val {
    word-break: break-word;
  }

  .receipt-delivery-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
  }

  .receipt-delivery-actions .btn {
    width: 100%;
  }

  /* Scrollable bottom navigation so all 8 items fit cleanly at 360px/390px */
  .bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 40;
  }

  .bottom-nav-item {
    flex: 0 0 72px;
    min-height: 54px;
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-secondary);
    font-size: 10.5px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 2px;
  }

  .bottom-nav-item svg {
    width: 19px;
    height: 19px;
  }

  .bottom-nav-item.active {
    color: var(--accent-red);
    font-weight: 600;
  }

  .toast-container {
    top: max(12px, env(safe-area-inset-top, 0px));
    bottom: auto;
    left: 12px;
    right: 12px;
    pointer-events: none;
  }

  .toast {
    pointer-events: auto;
  }
}

/* ==========================================================================
   PRINT MEDIA (For Clean Receipt Printing / Save as PDF)
   ========================================================================== */
@media print {
  body * {
    visibility: hidden;
  }
  #printableReceiptArea,
  #printableReceiptArea * {
    visibility: visible;
  }
  #printableReceiptArea {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    max-width: 100%;
    border: none;
    box-shadow: none;
    padding: 0;
  }
}
