/* ========== RESET & BASE ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); transition: background .2s, color .2s; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
ul { list-style: none; }

/* ========== CSS VARIABLES ========== */
:root {
  --primary: #1a4f72;
  --primary-light: #2471a3;
  --accent: #e85d2f;
  --accent-hover: #c94e26;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --info: #2980b9;

  --bg: #f0f4f8;
  --card: #ffffff;
  --sidebar-bg: #0f2d45;
  --sidebar-text: #b8cdd9;
  --sidebar-active: #1a4f72;
  --sidebar-hover: rgba(255,255,255,.07);
  --header-bg: #ffffff;

  --text: #1e2d3d;
  --text-muted: #6b7a8d;
  --border: #dde3eb;
  --input-bg: #f8fafc;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
  --shadow-lg: 0 4px 20px rgba(0,0,0,.12);
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-w: 240px;
  --header-h: 60px;
}

[data-theme="dark"] {
  --bg: #111820;
  --card: #1c2535;
  --sidebar-bg: #0d1825;
  --sidebar-text: #8fa3b8;
  --sidebar-active: #1a4f72;
  --header-bg: #1c2535;
  --text: #e2eaf4;
  --text-muted: #5f7a93;
  --border: #2a3a4e;
  --input-bg: #162030;
  --shadow: 0 2px 8px rgba(0,0,0,.3);
}

/* ========== LOGIN PAGE ========== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f2d45 0%, #1a4f72 60%, #e85d2f 100%);
}
.login-card {
  background: var(--card);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 { font-size: 28px; font-weight: 800; color: var(--primary); letter-spacing: -1px; }
.login-logo p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.login-card h2 { font-size: 20px; margin-bottom: 24px; color: var(--text); }

/* ========== FORM ELEMENTS ========== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  font-size: 15px;
  transition: border-color .2s;
  outline: none;
}
.form-control:focus { border-color: var(--primary-light); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7a8d' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: none;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); background: var(--bg); }
.btn-ghost { background: transparent; color: var(--text-muted); border: none; padding: 8px 12px; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 13px 28px; font-size: 16px; width: 100%; justify-content: center; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); background: var(--bg); border: 1.5px solid var(--border); color: var(--text-muted); }
.btn-icon:hover { color: var(--primary); border-color: var(--primary); }

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

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
}
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo h1 { font-size: 22px; font-weight: 800; color: #fff; letter-spacing: -1px; }
.sidebar-logo span { font-size: 11px; color: var(--sidebar-text); letter-spacing: 1px; text-transform: uppercase; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section { padding: 8px 16px 4px; font-size: 10px; font-weight: 700; color: rgba(255,255,255,.3); text-transform: uppercase; letter-spacing: 1.2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 14px;
  color: var(--sidebar-text);
  border-radius: 0;
  transition: all .15s;
  position: relative;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); border-radius: 0 3px 3px 0; }
.nav-item .icon { font-size: 18px; width: 22px; text-align: center; }
.nav-badge { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 10px; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08); }
.user-info { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; }
.user-role { font-size: 11px; color: var(--sidebar-text); }

/* MAIN AREA */
.main-area { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-width: 0; }
.header {
  height: var(--header-h);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.header-title { flex: 1; }
.header-title h2 { font-size: 18px; font-weight: 700; color: var(--text); }
.header-title p { font-size: 12px; color: var(--text-muted); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.hamburger { display: none; background: none; border: none; font-size: 22px; color: var(--text); cursor: pointer; }

.page-content { padding: 24px; flex: 1; }

/* ========== CARDS ========== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.card-header h3 { font-size: 15px; font-weight: 700; flex: 1; }
.card-body { padding: 20px; }

/* ========== STATS GRID ========== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.stat-icon.blue { background: #e8f4fd; }
.stat-icon.orange { background: #fdeee8; }
.stat-icon.green { background: #e8f8ef; }
.stat-icon.purple { background: #f0eaff; }
.stat-icon.red { background: #fde8e8; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.stat-delta { font-size: 12px; margin-top: 6px; font-weight: 600; }
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--danger); }

/* ========== TABLE ========== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead tr { border-bottom: 2px solid var(--border); }
th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:hover { background: var(--bg); }
tbody tr:last-child { border-bottom: none; }
td { padding: 12px 14px; vertical-align: middle; }

/* ========== BADGES ========== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-success { background: #e8f8ef; color: #1e8449; }
.badge-warning { background: #fef9e7; color: #b7770d; }
.badge-danger { background: #fde8e8; color: #c0392b; }
.badge-info { background: #e8f4fd; color: #1a6fa0; }
.badge-muted { background: var(--bg); color: var(--text-muted); }
.badge-orange { background: #fdeee8; color: #c94e26; }
.badge-purple { background: #f0eaff; color: #6c3fc5; }

/* ========== SEARCH BAR ========== */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.search-input-wrap { position: relative; flex: 1; min-width: 200px; }
.search-input-wrap .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 15px; }
.search-input-wrap input { padding-left: 36px; }

/* ========== KANBAN ========== */
.kanban-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px; }
.kanban-col { min-width: 240px; width: 240px; flex-shrink: 0; }
.kanban-col-header { background: var(--card); border-radius: var(--radius) var(--radius) 0 0; padding: 12px 16px; border: 1px solid var(--border); border-bottom: none; display: flex; align-items: center; gap: 8px; }
.kanban-col-header h4 { font-size: 13px; font-weight: 700; flex: 1; }
.kanban-count { background: var(--bg); border-radius: 20px; padding: 2px 8px; font-size: 12px; font-weight: 700; color: var(--text-muted); }
.kanban-cards { background: var(--bg); border-radius: 0 0 var(--radius) var(--radius); border: 1px solid var(--border); border-top: none; padding: 8px; min-height: 200px; display: flex; flex-direction: column; gap: 8px; }
.kanban-card { background: var(--card); border-radius: var(--radius-sm); padding: 12px; border: 1px solid var(--border); box-shadow: var(--shadow); cursor: pointer; transition: all .15s; }
.kanban-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); border-color: var(--primary-light); }
.kanban-card h5 { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.kanban-card .kc-meta { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.kanban-card .kc-source { font-size: 11px; font-weight: 600; }

/* ========== CHECKIN FEED ========== */
.checkin-feed { display: flex; flex-direction: column; gap: 10px; }
.checkin-item { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); padding: 14px 18px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow); }
.checkin-item.low-balance { border-left: 4px solid var(--warning); }
.checkin-item.expired { border-left: 4px solid var(--danger); }
.checkin-item.ok { border-left: 4px solid var(--success); }
.checkin-time { font-size: 13px; font-weight: 700; color: var(--text-muted); min-width: 50px; }
.checkin-info { flex: 1; }
.checkin-name { font-size: 15px; font-weight: 700; }
.checkin-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.checkin-badge { margin-left: auto; }
.checkin-qr-zone { background: var(--card); border-radius: var(--radius); border: 2px dashed var(--border); padding: 40px; text-align: center; margin-bottom: 24px; cursor: pointer; transition: border-color .2s; }
.checkin-qr-zone:hover { border-color: var(--primary); }
.checkin-qr-zone .qr-icon { font-size: 64px; color: var(--primary); }
.checkin-qr-zone p { color: var(--text-muted); margin-top: 12px; font-size: 15px; }

/* ========== SCHEDULE ========== */
.schedule-grid { display: grid; grid-template-columns: 80px repeat(6, 1fr); gap: 2px; }
.schedule-header { background: var(--card); border-radius: var(--radius-sm); padding: 10px; text-align: center; font-size: 12px; font-weight: 700; color: var(--text-muted); border: 1px solid var(--border); }
.schedule-time { background: var(--card); border-radius: var(--radius-sm); padding: 10px; text-align: center; font-size: 12px; color: var(--text-muted); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; }
.schedule-cell { background: var(--bg); border-radius: var(--radius-sm); padding: 4px; min-height: 60px; border: 1px solid var(--border); }
.schedule-event { border-radius: var(--radius-sm); padding: 6px 8px; font-size: 11px; font-weight: 600; height: 100%; cursor: pointer; transition: opacity .15s; }
.schedule-event:hover { opacity: .85; }
.event-adult { background: #dbeafe; color: #1e40af; }
.event-kids { background: #dcfce7; color: #166534; }
.event-novice { background: #fef9c3; color: #854d0e; }
.event-free { background: #f3e8ff; color: #6b21a8; }
.event-camp { background: #ffedd5; color: #9a3412; }
.event-name { font-weight: 700; }
.event-trainer { font-size: 10px; opacity: .8; }

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px;
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(-20px);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { display: flex; align-items: center; margin-bottom: 24px; }
.modal-header h3 { flex: 1; font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-muted); cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--danger); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; border-top: 1px solid var(--border); padding-top: 20px; }

/* ========== CLIENT CARD ========== */
.client-header { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; }
.client-avatar { width: 72px; height: 72px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 28px; font-weight: 700; flex-shrink: 0; }
.client-meta h2 { font-size: 22px; font-weight: 800; }
.client-meta p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.client-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.membership-card { background: linear-gradient(135deg, var(--primary), var(--primary-light)); border-radius: var(--radius); padding: 20px 24px; color: #fff; position: relative; overflow: hidden; }
.membership-card::after { content: ''; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.08); }
.membership-card h4 { font-size: 12px; opacity: .8; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.membership-card .visits { font-size: 42px; font-weight: 900; line-height: 1; }
.membership-card .visits span { font-size: 18px; font-weight: 400; opacity: .7; }
.membership-progress { margin-top: 12px; background: rgba(255,255,255,.2); border-radius: 4px; height: 6px; }
.membership-progress-bar { height: 100%; border-radius: 4px; background: #fff; transition: width .5s; }
.membership-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; opacity: .8; }
.visit-history { display: flex; flex-direction: column; gap: 8px; }
.visit-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.visit-item:last-child { border-bottom: none; }
.visit-date { color: var(--text-muted); min-width: 100px; }

/* ========== FINANCE ========== */
.cashflow-bars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.cashflow-bar { background: var(--card); border-radius: var(--radius); padding: 20px; border: 1px solid var(--border); }
.cashflow-bar h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 12px; }
.cashflow-amount { font-size: 28px; font-weight: 800; }
.cashflow-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.bar-track { background: var(--bg); border-radius: 4px; height: 8px; margin-top: 16px; }
.bar-fill { height: 100%; border-radius: 4px; transition: width .5s; }

/* ========== CABINET (CLIENT SELF-SERVICE) ========== */
.cabinet-page { min-height: 100vh; background: var(--bg); padding: 24px 16px; }
.cabinet-card { max-width: 400px; margin: 0 auto; }
.cabinet-header { text-align: center; padding: 24px; }
.cabinet-header img { width: 60px; height: 60px; margin-bottom: 12px; }
.cabinet-passes { text-align: center; padding: 32px 24px; }
.cabinet-passes .big-num { font-size: 80px; font-weight: 900; color: var(--primary); line-height: 1; }
.cabinet-passes .passes-label { font-size: 18px; color: var(--text-muted); margin-top: 8px; }
.cabinet-info-row { display: flex; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.cabinet-info-row:last-child { border-bottom: none; }
.cabinet-info-row .label { font-size: 13px; color: var(--text-muted); }
.cabinet-info-row .value { font-size: 14px; font-weight: 700; }

/* ========== TRAINER MOBILE ========== */
.trainer-page { max-width: 480px; margin: 0 auto; padding: 16px; }
.trainer-day { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 16px; overflow: hidden; }
.trainer-day-header { background: var(--primary); color: #fff; padding: 12px 16px; font-weight: 700; }
.trainer-session { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; }
.trainer-session:last-child { border-bottom: none; }
.session-time-block { text-align: center; min-width: 48px; }
.session-time-block .time { font-size: 14px; font-weight: 700; color: var(--primary); }
.session-time-block .dur { font-size: 11px; color: var(--text-muted); }
.session-info h4 { font-size: 14px; font-weight: 700; }
.session-info p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.session-clients { margin-left: auto; text-align: right; }
.session-clients .count { font-size: 20px; font-weight: 800; color: var(--primary); }
.session-clients .label { font-size: 11px; color: var(--text-muted); }
.trainer-earnings { background: linear-gradient(135deg, var(--accent), #c94e26); border-radius: var(--radius); padding: 20px; color: #fff; margin-bottom: 20px; text-align: center; }
.trainer-earnings h3 { font-size: 12px; opacity: .8; text-transform: uppercase; letter-spacing: 1px; }
.trainer-earnings .amount { font-size: 40px; font-weight: 900; margin: 8px 0; }

/* ========== CASHIER ========== */
.cashier-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.product-btn { background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 16px 12px; text-align: center; cursor: pointer; transition: all .15s; }
.product-btn:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.product-btn.selected { border-color: var(--primary); background: #e8f4fd; }
.product-btn .prod-icon { font-size: 28px; margin-bottom: 8px; }
.product-btn .prod-name { font-size: 13px; font-weight: 700; color: var(--text); }
.product-btn .prod-price { font-size: 14px; font-weight: 800; color: var(--primary); margin-top: 4px; }
.cart { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.cart h3 { font-size: 16px; font-weight: 700; }
.cart-items { flex: 1; min-height: 200px; }
.cart-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.cart-total { display: flex; justify-content: space-between; font-size: 18px; font-weight: 800; border-top: 2px solid var(--border); padding-top: 12px; }
.payment-methods { display: flex; gap: 8px; }
.payment-btn { flex: 1; padding: 10px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--card); cursor: pointer; text-align: center; font-size: 13px; font-weight: 600; transition: all .15s; }
.payment-btn.active { border-color: var(--primary); background: #e8f4fd; color: var(--primary); }

/* ========== ALERTS / SIGNALS ========== */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.alert-warning { background: #fef9e7; border-left: 4px solid var(--warning); color: #7d6608; }
.alert-danger { background: #fde8e8; border-left: 4px solid var(--danger); color: #922b21; }
.alert-info { background: #e8f4fd; border-left: 4px solid var(--info); color: #1a5276; }
.alert-success { background: #e8f8ef; border-left: 4px solid var(--success); color: #1e6e3e; }

/* ========== TABS ========== */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab { padding: 10px 20px; font-size: 14px; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ========== FUNNEL SELECTOR ========== */
.funnel-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.funnel-tab { padding: 8px 20px; border-radius: 20px; font-size: 14px; font-weight: 600; cursor: pointer; border: 1.5px solid var(--border); color: var(--text-muted); transition: all .15s; }
.funnel-tab:hover { border-color: var(--primary); color: var(--primary); }
.funnel-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ========== THEME TOGGLE ========== */
.theme-toggle { background: none; border: 1.5px solid var(--border); border-radius: 20px; padding: 5px 12px; font-size: 16px; cursor: pointer; color: var(--text); transition: all .15s; }
.theme-toggle:hover { border-color: var(--primary); }

/* ========== ROLE SWITCHER ========== */
.role-switcher { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.role-switcher select { padding: 5px 10px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--input-bg); color: var(--text); font-size: 13px; cursor: pointer; }

/* ========== NOTIFICATION DOT ========== */
.notif-btn { position: relative; }
.notif-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; border: 2px solid var(--header-bg); }

/* ========== STATS GRID HELPERS (overridable on mobile) ========== */
.stats-5 { grid-template-columns: repeat(5, 1fr) !important; }
.stats-4 { grid-template-columns: repeat(4, 1fr) !important; }

/* ========== SCHEDULE MOBILE LIST ========== */
.schedule-list-view { display: none; flex-direction: column; gap: 10px; }
.schedule-list-item { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); padding: 14px 16px; display: flex; align-items: center; gap: 14px; }
.schedule-list-item .sli-time { min-width: 52px; text-align: center; }
.schedule-list-item .sli-time .t { font-size: 15px; font-weight: 700; color: var(--primary); }
.schedule-list-item .sli-time .d { font-size: 11px; color: var(--text-muted); }
.schedule-list-item .sli-info h4 { font-size: 14px; font-weight: 700; }
.schedule-list-item .sli-info p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.schedule-list-item .sli-badge { margin-left: auto; text-align: right; }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-240px); width: 240px; }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .hamburger { display: block; }
  .stats-grid { grid-template-columns: 1fr 1fr !important; }
  .stats-5 { grid-template-columns: 1fr 1fr !important; }
  .stats-4 { grid-template-columns: 1fr 1fr !important; }
  .cashier-layout { grid-template-columns: 1fr; }
  .cashflow-bars { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .kanban-board { flex-direction: column; }
  .kanban-col { width: 100%; min-width: 0; }
  .page-content { padding: 16px; }
  /* schedule: hide grid, show list on mobile */
  .schedule-grid-wrap { display: none !important; }
  .schedule-list-view { display: flex !important; }
  /* header: collapse role switcher */
  .role-switcher .role-label { display: none; }
  .header-actions { gap: 6px; }
  .header-actions .btn-ghost { padding: 6px 8px; font-size: 12px; }
  /* grid helpers */
  .grid-2 { grid-template-columns: 1fr !important; }
  .grid-3 { grid-template-columns: 1fr !important; }
  /* payment methods */
  .payment-btn { font-size: 12px; padding: 8px 6px; }
  /* card header wrap */
  .card-header { flex-wrap: wrap; gap: 8px; }
  /* table scroll hint */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  /* cashier suggestions */
  .client-suggestions-box { width: 100% !important; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr !important; }
  .stats-5, .stats-4 { grid-template-columns: 1fr 1fr !important; }
  .login-card { padding: 32px 24px; }
  .checkin-qr-zone { padding: 28px 16px; }
  .checkin-qr-zone .qr-icon { font-size: 48px; }
  .header-title h2 { font-size: 15px; }
  .header-title p { display: none; }
  .page-content { padding: 12px; }
  .stat-value { font-size: 20px; }
  .btn { font-size: 13px; padding: 8px 14px; }
}

/* ========== DARK THEME REFINEMENTS ========== */
[data-theme="dark"] .form-control { color-scheme: dark; }
[data-theme="dark"] .schedule-event { opacity: .9; }
[data-theme="dark"] .product-btn { background: var(--card); }
[data-theme="dark"] .product-btn.selected { background: #1a3550; }
[data-theme="dark"] tbody tr:hover { background: rgba(255,255,255,.03); }
[data-theme="dark"] .payment-btn.active { background: #1a3550; }
[data-theme="dark"] .kanban-cards { background: rgba(0,0,0,.2); }
[data-theme="dark"] .kanban-card { border-color: var(--border); }
[data-theme="dark"] .login-page { background: linear-gradient(135deg, #060e16 0%, #0f2d45 60%, #7a2d16 100%); }
[data-theme="dark"] .membership-card { background: linear-gradient(135deg, #0f2d45, #1a4f72); }
[data-theme="dark"] .trainer-earnings { background: linear-gradient(135deg, #7a2d16, #c94e26); }
[data-theme="dark"] .stat-icon.blue { background: #0f2840; }
[data-theme="dark"] .stat-icon.orange { background: #2e1a0e; }
[data-theme="dark"] .stat-icon.green { background: #0e2a1a; }
[data-theme="dark"] .stat-icon.purple { background: #1e1530; }
[data-theme="dark"] .stat-icon.red { background: #2a0e0e; }
[data-theme="dark"] .badge-success { background: #0e2a1a; color: #4ade80; }
[data-theme="dark"] .badge-warning { background: #2a1e0a; color: #fbbf24; }
[data-theme="dark"] .badge-danger { background: #2a0e0e; color: #f87171; }
[data-theme="dark"] .badge-info { background: #0a1e2e; color: #60a5fa; }
[data-theme="dark"] .badge-muted { background: #1e2535; }
[data-theme="dark"] .badge-orange { background: #2e1a0e; color: #fb923c; }
[data-theme="dark"] .badge-purple { background: #1e1530; color: #c084fc; }
[data-theme="dark"] .alert-warning { background: #2a1e0a; color: #fbbf24; border-left-color: var(--warning); }
[data-theme="dark"] .alert-danger { background: #2a0e0e; color: #f87171; border-left-color: var(--danger); }
[data-theme="dark"] .alert-info { background: #0a1e2e; color: #60a5fa; border-left-color: var(--info); }
[data-theme="dark"] .alert-success { background: #0e2a1a; color: #4ade80; border-left-color: var(--success); }
[data-theme="dark"] .cashflow-bar { background: var(--card); }
[data-theme="dark"] .trainer-day { background: var(--card); }
[data-theme="dark"] .bar-track { background: rgba(255,255,255,.08); }

/* Smooth theme transition */
html { color-scheme: light dark; }
*, *::before, *::after { transition: background-color .2s ease, border-color .15s ease, color .15s ease; }
/* Don't animate transforms (breaks sidebar animation) */
.sidebar, .modal, .kanban-card, .btn { transition: none; }
.sidebar { transition: transform .25s ease; }
.modal { transition: transform .2s ease; }
.kanban-card { transition: box-shadow .15s, transform .15s; }
.btn { transition: background-color .15s, border-color .15s, color .15s; }

/* ========== MISC ========== */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.fw-bold { font-weight: 700; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 99; }
.sidebar-overlay.open { display: block; }
