﻿*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #1a237e;
  --primary-light: #3949ab;
  --primary-dark: #0d1452;
  --accent: #ff6f00;
  --accent-light: #ff8f00;
  --accent-dark: #e65100;
  --success: #2e7d32;
  --warning: #f57f17;
  --danger: #c62828;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #5a5a7a;
  --text-muted: #9e9eb0;
  --border: #e0e0e8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --nav-height: 64px;
  --bottom-nav-height: 64px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition: 0.25s ease;
  --loading-bg: rgba(255,255,255,0.85);
  --toast-bg: #1a1a2e;
  --toast-color: #fff;
  --input-bg: #f0f0f5;
    --hero-from: #4f46e5;
  --hero-mid: #7c3aed;
  --hero-to: #9333ea;
  /* Checkout reuses --primary so Pay Now is the same colour as Buy Now.
     The summary card is a faint wash of the same hue rather than a separate
     accent, so the two buttons read as one action. */
  --checkout-price: var(--primary);
  --checkout-tint: rgba(26, 35, 126, 0.05);
  --checkout-tint-border: rgba(26, 35, 126, 0.16);
  --checkout-faint: #65657f;
  --checkout-caution: #d84315;
  --checkout-ok: #2e7d32;
  --checkout-danger: #c62828;
  /* #2e7d32 is 4.49:1 as text on a 10% green wash, a hair under 4.5, so the
     success banner steps up to a darker green than the inline field error. */
  --checkout-ok-banner: #1b5e20;
  --checkout-danger-banner: #c62828;
}

[data-theme="dark"] {
  --primary: #7c6aff;
  --primary-light: #9b8aff;
  --primary-dark: #533afd;
  --accent: #ff9900;
  --accent-light: #ffb84d;
  --accent-dark: #e68a00;
  --success: #22c578;
  --warning: #ff9900;
  --danger: #f43f5e;
  --bg: #061b31;
  --card-bg: #0d2440;
  --text: #ffffff;
  --text-secondary: #c8d6e5;
  --text-muted: #8ba4be;
  --border: #1e3a5f;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
  --loading-bg: rgba(6,27,49,0.9);
  --toast-bg: #e8ecf4;
  --toast-color: #061b31;
  --input-bg: rgba(255,255,255,0.06);
  --hero-from: #4338ca;
  --hero-mid: #6d28d9;
  --hero-to: #8b2be0;
  /* Dark mode already has enough contrast, so the checkout reuses the theme's
     own accent and success values rather than the light-mode overrides. */
  /* --primary-light, not --primary: the dark theme's #7c6aff only reaches
     3.55:1 as 20px text on the tinted card. */
  --checkout-price: var(--primary-light);
  --checkout-tint: rgba(124, 106, 255, 0.1);
  --checkout-tint-border: rgba(124, 106, 255, 0.26);
  --checkout-faint: #8ba4be;
  --checkout-caution: #ff9900;
  --checkout-ok: #22c578;
  /* The theme's --danger (#f43f5e) only reaches 4.26:1 on the dark card, so
     checkout errors step up to a lighter pink instead. */
  --checkout-danger: #fb7185;
  --checkout-ok-banner: #22c578;
  --checkout-danger-banner: #fb7185;
}
[data-theme="dark"] .login-error { background: #2d1520 !important; }
[data-theme="dark"] .sidebar-nav a:hover { background: #15305a !important; }
[data-theme="dark"] .sidebar-nav a.active { background: #15305a !important; }
[data-theme="dark"] .package-card .pkg-badge.quota { background: #0d2a1a !important; color: #6fc !important; }
[data-theme="dark"] .package-card .pkg-badge.retention { background: #2a1e0a !important; }
[data-theme="dark"] .package-card .pkg-badge.non-expiry { background: #0f1a2d !important; }
[data-theme="dark"] .voucher-status.active { background: #0d2a1a !important; }
[data-theme="dark"] .voucher-status.expired { background: #2d1520 !important; }
[data-theme="dark"] .elec-meter-badge { background: #0d2a1a !important; }
[data-theme="dark"] .elec-h-icon { background: #2a1e0a !important; color: var(--accent) !important; }

html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { color: var(--primary); }

/* ============ UTILITY ============ */
.container { max-width: 480px; margin: 0 auto; padding: 0 16px; }
.container-wide { max-width: 800px; margin: 0 auto; padding: 0 16px; }
.text-center { text-align: center; }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.938rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  line-height: 1.3;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-block { width: 100%; }
.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-light); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: 0.813rem; }
.btn-lg { padding: 16px 32px; font-size: 1.063rem; }
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.btn-icon:hover { background: var(--border); }
.btn-icon svg { width: 20px; height: 20px; }

/* ============ LOGIN SCREEN ============ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  padding: 20px;
}
.login-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 40px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  text-align: center;
  margin-bottom: 8px;
}
.login-logo .brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: var(--primary);
  color: #fff;
  border-radius: 14px;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 12px;
}
.login-logo h1 { font-size: 1.5rem; font-weight: 600; color: var(--text); }
.login-logo p { font-size: 0.875rem; color: var(--text-secondary); margin-top: 4px; }
.login-error {
  background: #fef2f2;
  color: var(--danger);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.813rem;
  margin-bottom: 16px;
  display: none;
}
.login-error.show { display: block; }

.login-success {
  background: #ecfdf3;
  color: var(--success);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.813rem;
  margin-bottom: 16px;
}
.login-hint {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 18px;
  line-height: 1.5;
}
.login-hint p { margin: 0; }
.otp-intro {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 4px 0 18px;
}
.otp-intro strong { color: var(--text); word-break: break-all; }
.login-otp-debug {
  background: #fff7e6;
  color: var(--accent-dark);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.813rem;
  margin-bottom: 16px;
  text-align: center;
}
.login-otp-debug strong { letter-spacing: 2px; }
.otp-timeout {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: -8px 0 16px;
}
.otp-actions {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.otp-actions-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 10px;
}
.otp-actions form {
  margin: 0;
  display: inline-flex;
}
.otp-actions-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.otp-inline-form {
  margin: 0;
  display: inline-flex;
}
.otp-link {
  background: none;
  border: 0;
  font-family: inherit;
  font-size: 0.813rem;
  font-weight: 500;
  color: var(--primary-light);
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
}
.otp-link:hover {
  color: var(--primary);
  text-decoration: underline;
}
.otp-link.disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  text-decoration: none;
}
.otp-separator {
  width: 1px;
  height: 16px;
  background: var(--border);
}

[data-theme="dark"] .login-success { background: #0d2a1a !important; }
[data-theme="dark"] .login-otp-debug { background: #2a1e0a !important; color: var(--accent-light) !important; }

.login-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--input-bg);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
  margin-bottom: 18px;
}
.login-toggle button {
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.813rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}
.login-toggle button:hover:not(.active) {
  color: var(--text-secondary);
  background: rgba(57, 73, 171, 0.06);
}
.login-toggle button.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 3px 10px rgba(26, 35, 126, 0.3);
}

.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-size: 0.813rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group .input-wrap {
  position: relative;
}
.form-group .input-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.938rem;
  color: var(--text);
  background: var(--card-bg);
  transition: var(--transition);
  outline: none;
}
.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(57, 73, 171, 0.12);
}
.form-group input::placeholder { color: var(--text-muted); }
.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  font-size: 0.813rem;
}
.form-options label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  cursor: pointer;
}
.form-options a { color: var(--primary-light); font-weight: 500; }
.login-divider {
  text-align: center;
  margin: 20px 0;
  position: relative;
}
.login-divider::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 1px;
  background: var(--border);
}
.login-divider span {
  background: var(--card-bg);
  padding: 0 16px;
  font-size: 0.813rem;
  color: var(--text-muted);
  position: relative;
}
.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.813rem;
  color: var(--text-secondary);
}
.login-footer a { font-weight: 500; }


/* ============ APP LAYOUT ============ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-header .brand-mark {
  width: 40px;
  height: 40px;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.125rem;
  flex-shrink: 0;
}
.sidebar-header .brand-text { font-weight: 600; font-size: 1rem; color: var(--text); }
.sidebar-header .brand-text small { display: block; font-weight: 400; font-size: 0.75rem; color: var(--text-muted); }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
  border-left: 3px solid transparent;
  text-decoration: none;
}
.sidebar-nav a:hover { background: #f5f5fc; color: var(--text); }
.sidebar-nav a.active {
  background: #eef0ff;
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}
.sidebar-nav a svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.sidebar-footer .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-footer .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  flex-shrink: 0;
}
.sidebar-footer .user-name { font-size: 0.813rem; font-weight: 500; }
.sidebar-footer .user-role { font-size: 0.75rem; color: var(--text-muted); }

/* Main content */
.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 24px 32px;
  padding-bottom: calc(var(--bottom-nav-height) + 40px);
  min-height: 100vh;
}

/* Top bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}
.top-bar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.top-bar-left h2 { font-size: 1.25rem; font-weight: 600; }
.top-bar-left .menu-toggle { display: none; }
.top-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.top-bar-right .notification-btn { position: relative; }
.top-bar-right .notification-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--card-bg);
}

/* ============ PAGE CONTENT ============ */
.page { display: none; }
.page.active { display: block; }

/* ============ DASHBOARD ============ */
.welcome-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 24px;
}
.welcome-banner h2 { font-size: 1.25rem; font-weight: 600; }
.welcome-banner p { font-size: 0.875rem; opacity: 0.85; margin-top: 4px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.stat-card .stat-icon svg { width: 20px; height: 20px; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.stat-card .stat-label { font-size: 0.813rem; color: var(--text-muted); margin-top: 2px; }

/* Data usage ring */
.data-usage-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  text-align: center;
}
.data-ring-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.data-ring-wrap svg { transform: rotate(-90deg); }
.data-ring-bg { fill: none; stroke: #eef0ff; stroke-width: 8; }
.data-ring-fg { fill: none; stroke: var(--primary); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.data-ring-center {
  position: absolute;
  text-align: center;
}
.data-ring-center .data-used { font-size: 1.75rem; font-weight: 700; color: var(--text); }
.data-ring-center .data-total { font-size: 0.75rem; color: var(--text-muted); }
.data-details { display: flex; justify-content: center; gap: 32px; margin-top: 4px; }
.data-details div { text-align: center; }
.data-details .label { font-size: 0.75rem; color: var(--text-muted); }
.data-details .value { font-size: 0.938rem; font-weight: 600; }

/* Active package */
.active-package {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.active-package-info h3 { font-size: 0.938rem; font-weight: 600; }
.active-package-info p { font-size: 0.813rem; color: var(--text-secondary); margin-top: 2px; }
.active-package-info .plan-name { color: var(--primary); font-weight: 500; }
.active-package .days-left {
  text-align: right;
}
.active-package .days-left .count { font-size: 1.5rem; font-weight: 700; color: var(--accent); display: block; }
.active-package .days-left .label { font-size: 0.75rem; color: var(--text-muted); }

/* Quick actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.quick-action-btn {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80px;
}
.quick-action-btn:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow);
}
.quick-action-btn svg { width: 22px; height: 22px; color: var(--primary-light); margin-bottom: 6px; flex-shrink: 0; }
.quick-action-btn span { display: block; font-size: 0.813rem; font-weight: 500; line-height: 1.2; }

/* ============ BUY PACKAGES ============ */
.buy-filter {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.buy-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.813rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}
.buy-filter-label svg { width: 18px; height: 18px; color: var(--primary); }
.hostel-select {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}
.hostel-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(57, 73, 171, 0.12);
}
@media (max-width: 480px) {
  .buy-filter { flex-wrap: wrap; gap: 8px; }
  .buy-filter-label { font-size: 0.75rem; }
  .hostel-select { flex-basis: 100%; }
}
.package-tabs {
  display: flex;
  gap: 6px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 5px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.package-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-family: var(--font);
  font-size: 0.813rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}
.package-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  box-shadow: 0 4px 12px rgba(26, 35, 126, 0.3);
}
.package-tab:hover:not(.active) { color: var(--text); background: var(--bg); }
.package-tab .tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 20px;
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 0.688rem;
  font-weight: 700;
}
.package-tab.active .tab-count {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
[data-theme="dark"] .package-tab.active {
  box-shadow: 0 4px 12px rgba(124, 106, 255, 0.35);
}
.package-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.package-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1.5px solid var(--border);
  transition: var(--transition);
  position: relative;
}
.package-card:hover { border-color: var(--primary-light); }
.package-card.featured {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(255, 111, 0, 0.15);
}
.package-card.featured::before {
  content: 'BEST VALUE';
  position: absolute;
  top: -10px;
  right: 16px;
  background: var(--accent);
  color: #fff;
  font-size: 0.688rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}
.package-card .pkg-name { font-size: 1.125rem; font-weight: 600; color: var(--text); }
.package-card .pkg-price { font-size: 1.75rem; font-weight: 700; color: var(--primary); margin: 8px 0 4px; }
.package-card .pkg-price small { font-size: 0.875rem; font-weight: 400; color: var(--text-muted); }
.package-card .pkg-detail { font-size: 0.813rem; color: var(--text-secondary); margin-bottom: 4px; }
.package-card .pkg-detail svg { width: 14px; height: 14px; margin-right: 6px; vertical-align: middle; }
.package-card .pkg-badge {
  display: inline-block;
  font-size: 0.688rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.package-card .pkg-badge.quota { background: #e8f5e9; color: var(--success); }
.package-card .pkg-badge.retention { background: #fff3e0; color: var(--accent-dark); }
.package-card .pkg-badge.non-expiry { background: #e3f2fd; color: var(--primary); }
.package-card .btn { margin-top: 14px; }

/* ============ TRANSACTIONS ============ */
.transaction-list { display: flex; flex-direction: column; gap: 8px; }
.transaction-item {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.transaction-item .tx-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.transaction-item .tx-icon svg { width: 18px; height: 18px; }
.transaction-item .tx-info { flex: 1; min-width: 0; }
.transaction-item .tx-info .tx-name { font-size: 0.875rem; font-weight: 500; }
.transaction-item .tx-info .tx-date { font-size: 0.75rem; color: var(--text-muted); }
.transaction-item .tx-amount { text-align: right; }
.transaction-item .tx-amount .amount { font-size: 0.938rem; font-weight: 600; }
.transaction-item .tx-amount .status { font-size: 0.688rem; font-weight: 500; }
.transaction-item .tx-amount .status.success { color: var(--success); }
.transaction-item .tx-amount .status.pending { color: var(--warning); }
.transaction-item.is-clickable { cursor: pointer; transition: var(--transition); }
.transaction-item.is-clickable:hover { box-shadow: var(--shadow-lg); }
.transaction-item.is-clickable:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.transaction-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}
.transaction-empty svg { width: 48px; height: 48px; margin-bottom: 12px; }
.transaction-empty p { font-size: 0.875rem; }

/* ============ VOUCHER DETAILS MODAL ============ */
.voucher-modal { display: none; }
.voucher-modal.show {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.voucher-modal .modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 20, 38, 0.6);
  backdrop-filter: blur(3px);
  animation: vm-fade 0.22s ease;
}
.voucher-modal .modal-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--card-bg);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
  animation: vm-pop 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes vm-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes vm-pop {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

.voucher-modal .modal-hero {
  position: relative;
  padding: 20px 22px 22px;
  background: linear-gradient(135deg, var(--hero-from) 0%, var(--hero-mid) 55%, var(--hero-to) 100%);
  color: #fff;
  border-radius: 18px 18px 0 0;
  overflow: hidden;
}
.voucher-modal .modal-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(110% 90% at 100% 0%, rgba(255, 255, 255, 0.28), transparent 62%),
    radial-gradient(80% 70% at 0% 100%, rgba(255, 255, 255, 0.12), transparent 60%);
  pointer-events: none;
}
.voucher-modal .modal-hero-top,
.voucher-modal .modal-code-row,
.voucher-modal .modal-pill { position: relative; }
.voucher-modal .modal-hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.voucher-modal .modal-eyebrow {
  font-size: 0.688rem;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  opacity: 1;
}
.voucher-modal .modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  /* Buttons keep the UA padding otherwise, which squeezes the icon inside
     the fixed circle and knocks it off centre. */
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}
.voucher-modal .modal-close svg { width: 16px; height: 16px; }
.voucher-modal .modal-close:hover { background: var(--input-bg); color: var(--text); }
.voucher-modal .modal-hero .modal-close {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}
.voucher-modal .modal-hero .modal-close svg { width: 15px; height: 15px; }
.voucher-modal .modal-hero .modal-close:hover { background: rgba(255, 255, 255, 0.3); color: #fff; }

.voucher-modal .modal-code-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.voucher-modal .modal-code {
  flex: 1;
  min-width: 0;
  font-family: 'Courier New', monospace;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: 2px;
  word-break: break-all;
}
.voucher-modal .modal-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  color: #fff;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.voucher-modal .modal-copy svg { width: 13px; height: 13px; }
.voucher-modal .modal-copy:hover { background: rgba(255, 255, 255, 0.3); }
.voucher-modal .modal-copy.is-copied { background: #fff; color: var(--primary-dark); border-color: #fff; }

.voucher-modal .modal-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  font-size: 0.75rem;
  font-weight: 600;
}
.voucher-modal .modal-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25);
}
.voucher-modal .modal-pill[data-state="expired"] { background: rgba(24, 8, 20, 0.34); }
.voucher-modal .modal-pill[data-state="expired"] .modal-pill-dot { background: #ffc4c4; box-shadow: 0 0 0 3px rgba(255, 196, 196, 0.25); }

.voucher-modal .modal-body { padding: 20px 22px 4px; }
.voucher-modal .modal-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.voucher-modal .modal-stat {
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.voucher-modal .modal-stat-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.688rem;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.voucher-modal .modal-stat-label svg { width: 12px; height: 12px; }
.voucher-modal .modal-stat-value {
  display: block;
  margin-top: 5px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  word-break: break-word;
}

.voucher-modal .modal-foot-meta { padding: 16px 2px 4px; border-top: 1px solid var(--border); margin-top: 18px; }
.voucher-modal .modal-name { margin: 0; font-size: 0.875rem; font-weight: 500; color: var(--text); }
.voucher-modal .modal-date { margin: 4px 0 0; font-size: 0.75rem; color: var(--text-muted); }
.voucher-modal .modal-foot { padding: 16px 22px 20px; display: flex; gap: 10px; }
.voucher-modal .modal-foot .btn { flex: 1; }

/* Plain header for the checkout modal. The voucher details modal uses a
   gradient .modal-hero instead; this one keeps the card surface so it does not
   compete with the price card below it. */
.voucher-modal .modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.voucher-modal .modal-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

/* Narrow cards: drop the title to the app's small size so it never wraps
   against the close button. */
@media (max-width: 400px) {
  .voucher-modal .modal-head { padding: 16px 18px; }
  .voucher-modal .modal-head h3 { font-size: 0.938rem; }
}

/* ============ CHECKOUT ============ */
/* Money is the whole point of this screen, so the summary is a tinted card
   rather than a grey one: it separates the amount from the form fields. */
/* Payment outcome banner. The red inline field error alone was easy to miss
   with the popup just closed, so success and failure both get a full row.
   Success uses --checkout-ok, failure --checkout-danger, pending the brand
   colour so it never reads as an error. */
.checkout-vouchers-link[hidden] { display: none; }
.checkout-vouchers-link { text-decoration: none; }
.checkout-vouchers-link:hover { text-decoration: none; }

/* After a payment the form is hidden, so the banner is the only thing left in
   the body. It then owns the space instead of hanging off the top edge. */
.checkout-body.checkout-body-paid .checkout-status {
  margin: 2px 0 0;
  padding: 18px 16px;
}
.checkout-body.checkout-body-paid { min-height: 96px; }

.checkout-status {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.45;
  border: 1px solid transparent;
}
.checkout-status[hidden] { display: none; }
.checkout-status-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}
.checkout-status-body { min-width: 0; }
.checkout-status-text { display: block; }
.checkout-status-code {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px dashed var(--checkout-tint-border);
}
.checkout-status-code[hidden] { display: none; }
.checkout-status-code-value {
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 0.938rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text);
  word-break: break-all;
  min-width: 0;
}
.checkout-status-copy {
  flex-shrink: 0;
  border: 1px solid var(--checkout-tint-border);
  background: var(--bg);
  color: var(--primary-light);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 8px;
  cursor: pointer;
}
.checkout-status-copy:hover { background: var(--checkout-tint); }
.checkout-status-copy.is-copied { color: var(--checkout-ok-banner); }
.checkout-status-success {
  color: var(--checkout-ok-banner);
  background: color-mix(in srgb, var(--checkout-ok) 10%, transparent);
  border-color: color-mix(in srgb, var(--checkout-ok) 34%, transparent);
}
.checkout-status-failure {
  color: var(--checkout-danger-banner);
  background: color-mix(in srgb, var(--checkout-danger) 8%, transparent);
  border-color: color-mix(in srgb, var(--checkout-danger) 34%, transparent);
}
.checkout-status-pending {
  color: var(--primary-light);
  background: var(--checkout-tint);
  border-color: var(--checkout-tint-border);
}
.checkout-status-pending .checkout-status-icon { animation: checkout-spin 1.4s linear infinite; }
@keyframes checkout-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .checkout-status-pending .checkout-status-icon { animation: none; }
}

.checkout-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--checkout-tint);
  border: 1px solid var(--checkout-tint-border);
  border-radius: 14px;
}
.checkout-summary-main { min-width: 0; }
.checkout-summary-name {
  font-size: 0.938rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}
.checkout-summary-meta {
  margin-top: 3px;
  font-size: 0.75rem;
  color: var(--checkout-faint);
}
.checkout-summary-meta span + span::before {
  content: 'Â·';
  margin: 0 6px;
  opacity: 0.6;
}
.checkout-summary-price {
  flex-shrink: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--checkout-price);
  font-variant-numeric: tabular-nums;
}
.checkout-summary-price small {
  font-size: 0.688rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  opacity: 0.75;
}

.checkout-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 12px 0 4px;
  padding: 10px 12px;
  background: rgba(216, 67, 21, 0.07);
  border-left: 3px solid var(--checkout-caution);
  border-radius: 0 8px 8px 0;
  font-size: 0.813rem;
  line-height: 1.5;
  color: var(--text-secondary);
}
.checkout-warning svg {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: var(--checkout-caution);
}
.checkout-warning strong { color: var(--text); font-weight: 600; }

.voucher-modal .form-group { margin-top: 14px; }
.voucher-modal .form-group label { font-size: 0.813rem; }
.voucher-modal .form-group input { width: 100%; }
.voucher-modal .form-group .input-wrap svg { color: var(--text-muted); }
.voucher-modal .form-group .input-wrap input:focus ~ svg { color: var(--primary-light); }

/* Reserve room for the message so the footer does not jump when it appears. */
.form-error {
  margin: 6px 0 0;
  font-size: 0.75rem;
  color: var(--danger);
  min-height: 0;
}
.form-error:empty { display: none; }
.form-error-block:not(:empty) {
  margin-top: 12px;
  padding: 9px 11px;
  background: rgba(198, 40, 40, 0.08);
  border-radius: 8px;
  line-height: 1.5;
  color: var(--checkout-danger);
}

/* Scoped to the checkout modal: the voucher details modal shares these
   classes and keeps its own single-row footer. */
#checkout-modal .modal-foot {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  border-top: 1px solid var(--border);
}
.checkout-secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--checkout-faint);
}
.checkout-secure svg { width: 13px; height: 13px; color: var(--checkout-ok); }
.checkout-actions { display: flex; gap: 10px; }
.checkout-actions .btn { flex: 1; }

/* Pay Now is deliberately just .btn-primary, the same class Buy Now uses, so
   the two never drift apart. Only the lift is local. */
#checkout-pay {
  font-weight: 600;
  box-shadow: 0 3px 10px rgba(26, 35, 126, 0.28);
}
#checkout-pay:disabled { box-shadow: none; }

[data-theme="dark"] .checkout-warning { background: rgba(255, 153, 0, 0.1); }
[data-theme="dark"] .checkout-warning strong { color: var(--text); }
/* Kept faint: the lightening is handled by --checkout-danger, so a stronger
   tint would only work against it. */
[data-theme="dark"] .form-error-block:not(:empty) { background: rgba(244, 63, 94, 0.07); }

/* Small screens: stack the actions and keep the amount on one line. */
@media (max-width: 400px) {
  #checkout-modal .modal-card { max-width: 100%; }
  .checkout-summary { flex-direction: column; align-items: flex-start; gap: 6px; }
  .checkout-summary-price { align-self: flex-end; margin-top: -26px; }
  .checkout-actions .btn { padding-left: 10px; padding-right: 10px; }
}

/* ============ NOTICE ============ */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--card-bg);
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.notice svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; color: var(--primary); }

/* ============ PROFILE ============ */
.profile-header {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  text-align: center;
  margin-bottom: 24px;
}
.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.profile-header h2 { font-size: 1.25rem; font-weight: 600; }
.profile-header p { font-size: 0.813rem; color: var(--text-secondary); margin-top: 4px; }
.profile-details {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.profile-row:last-child { border-bottom: none; }
.profile-row .label { font-size: 0.813rem; color: var(--text-secondary); }
.profile-row .value { font-size: 0.875rem; font-weight: 500; text-align: right; }

/* ============ BOTTOM NAV (mobile) ============ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 6px 0;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
}
.bottom-nav-inner {
  display: flex;
  align-items: stretch;
  max-width: 480px;
  margin: 0 auto;
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.625rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.bottom-nav-item svg { width: 22px; height: 22px; }
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item.active svg { color: var(--primary); }
.bottom-nav-item span { line-height: 1.2; }

/* ============ OVERLAY ============ */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 90;
}

/* ============ PAGINATION ============ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
  margin-bottom: 8px;
}
.pagination-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  font-family: var(--font);
  font-size: 0.813rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}
.pagination-btn svg { width: 16px; height: 16px; }
.pagination-btn:hover:not(.disabled) {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.pagination-btn.disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}
.pagination-pages { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.pagination-page {
  min-width: 38px;
  height: 38px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  font-family: var(--font);
  font-size: 0.813rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}
.pagination-page:hover:not(.active) {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}
.pagination-page.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(26, 35, 126, 0.3);
}
[data-theme="dark"] .pagination-page.active {
  box-shadow: 0 4px 12px rgba(124, 106, 255, 0.35);
}
.pagination-ellipsis {
  color: var(--text-muted);
  font-size: 0.813rem;
  padding: 0 2px;
  user-select: none;
}

@media (max-width: 400px) {
  .pagination { gap: 6px; }
  .pagination-btn { padding: 7px 12px; font-size: 0.75rem; }
  .pagination-page { min-width: 34px; height: 34px; font-size: 0.75rem; }
}

/* ============ LOYALTY ============ */
.loyalty-header {
  text-align: center;
  margin-bottom: 24px;
  padding: 32px 16px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.loyalty-header-icon svg { width: 48px; height: 48px; color: var(--accent); margin-bottom: 8px; }
.loyalty-header h2 { font-size: 1.25rem; font-weight: 600; }
.loyalty-header p { font-size: 0.875rem; color: var(--text-secondary); margin-top: 4px; }

.loyalty-punch-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.loyalty-punch-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.loyalty-punch-card > p { font-size: 0.813rem; color: var(--text-secondary); margin-bottom: 16px; }

.punch-track {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 16px;
}
.punch-hole {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.813rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--card-bg);
  transition: var(--transition);
}
.punch-hole.filled {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.punch-hole.filled svg { width: 20px; height: 20px; }

.punch-progress-wrap { display: flex; align-items: center; gap: 12px; }
.punch-progress-bar {
  flex: 1;
  height: 10px;
  background: var(--bg);
  border-radius: 10px;
  overflow: hidden;
}
.punch-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-light), var(--accent));
  border-radius: 10px;
  transition: width 0.6s ease;
}
.punch-progress-label { font-size: 0.75rem; color: var(--text-secondary); font-weight: 500; white-space: nowrap; }

.rewards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.reward-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1.5px solid var(--border);
  text-align: center;
  transition: var(--transition);
}
.reward-card:hover { border-color: var(--accent-light); }
.reward-icon svg { width: 32px; height: 32px; color: var(--accent); margin-bottom: 8px; }
.reward-name { font-size: 0.938rem; font-weight: 600; }
.reward-desc { font-size: 0.75rem; color: var(--text-muted); margin: 2px 0 6px; }
.reward-cost { font-size: 0.813rem; font-weight: 500; color: var(--accent); margin-bottom: 10px; }
.reward-card .btn:disabled { opacity: 0.5; cursor: not-allowed; }

.loyalty-history { display: flex; flex-direction: column; gap: 6px; }
.loyalty-history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow);
}
.lh-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lh-icon svg { width: 18px; height: 18px; }
.lh-info { flex: 1; min-width: 0; }
.lh-desc { font-size: 0.813rem; font-weight: 500; }
.lh-date { font-size: 0.688rem; color: var(--text-muted); }
.lh-points { font-size: 0.875rem; font-weight: 700; white-space: nowrap; }

@media (max-width: 600px) {
  .rewards-grid { grid-template-columns: repeat(2, 1fr); }
  .punch-hole { width: 36px; height: 36px; font-size: 0.75rem; }
  .loyalty-header { padding: 24px 16px; }
}

/* ============ LOADING ============ */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--loading-bg);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  transition: opacity 0.2s ease;
}
.loading-overlay.show { display: flex; }
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.loading-spinner span {
  font-size: 0.813rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--toast-bg);
  color: var(--toast-color);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.813rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: var(--transition);
  z-index: 200;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .main-content { margin-left: 0; padding: 16px; padding-bottom: calc(var(--bottom-nav-height) + 32px); }
  .top-bar-left .menu-toggle { display: flex; }
  .bottom-nav { display: block; }

  /* Pin the top bar; negative margins cancel the parent padding so it runs edge to edge. */
  .top-bar {
    position: sticky;
    top: 0;
    z-index: 80;
    margin: -16px -16px 28px;
    padding: 10px 16px;
    padding-top: calc(10px + env(safe-area-inset-top));
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 600px) {
  .login-card { padding: 32px 24px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .stat-value { font-size: 1.25rem; }
  .package-grid { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .welcome-banner { padding: 20px; }
  .welcome-banner h2 { font-size: 1.063rem; }
  .top-bar-left h2 { font-size: 1.063rem; }
  .main-content { padding: 12px; padding-bottom: calc(var(--bottom-nav-height) + 32px); }
  .top-bar {
    margin: -12px -12px 28px;
    padding: 8px 12px;
    padding-top: calc(8px + env(safe-area-inset-top));
  }
  .profile-header { padding: 20px; }
  .active-package { flex-direction: column; text-align: center; }
  .active-package .days-left { text-align: center; }
  .data-details { gap: 16px; }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-card .stat-value { font-size: 1.125rem; }
  .quick-actions { gap: 6px; }
  .quick-action-btn { padding: 10px 6px; min-height: 64px; }
  .quick-action-btn svg { width: 18px; height: 18px; }
  .quick-action-btn span { font-size: 0.688rem; }
  .package-card { padding: 18px; }
  .transaction-item { padding: 10px 14px; flex-wrap: wrap; }
  .pagination { margin-top: 12px; }
}

/* ============ VOUCHERS ============ */
.voucher-list { display: flex; flex-direction: column; gap: 12px; }
.voucher-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1.5px solid var(--border);
  overflow: hidden;
  transition: var(--transition);
}
.voucher-card.expired { opacity: 0.75; }
.voucher-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.voucher-code-label { font-size: 0.688rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; display: block; }
.voucher-code-value { font-size: 0.875rem; font-weight: 600; font-family: 'Courier New', monospace; color: var(--text); letter-spacing: 0.5px; }
.voucher-status {
  font-size: 0.688rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 12px;
  border-radius: 20px;
}
.voucher-status.active { background: #e8f5e9; color: var(--success); }
.voucher-status.expired { background: #fef2f2; color: var(--danger); }
.voucher-body { padding: 12px 20px 16px; }
.voucher-plan { font-size: 0.938rem; font-weight: 600; margin-bottom: 6px; }
.voucher-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.voucher-meta span { display: inline-flex; align-items: center; gap: 4px; }
.voucher-meta svg { width: 14px; height: 14px; }
.voucher-usage { display: flex; align-items: center; gap: 10px; }
.voucher-usage-bar {
  flex: 1;
  height: 8px;
  background: var(--bg);
  border-radius: 8px;
  overflow: hidden;
}
.voucher-usage-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
  border-radius: 8px;
  transition: width 0.5s ease;
}
.voucher-usage-fill.used { background: var(--text-muted); }
.voucher-usage-label { font-size: 0.688rem; color: var(--text-secondary); white-space: nowrap; font-weight: 500; }

/* ============ TUTORIALS ============ */
.tutorial-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius);
  padding: 28px 32px;
  color: #fff;
  margin-bottom: 24px;
}
.tutorial-header-icon { width: 48px; height: 48px; background: rgba(255,255,255,0.2); border-radius: 12px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.tutorial-header-icon svg { width: 24px; height: 24px; }
.tutorial-header h2 { margin: 0 0 6px; font-size: 1.4rem; }
.tutorial-header p { margin: 0; color: rgba(255,255,255,0.8); font-size: 0.875rem; }
.tutorial-section { margin-bottom: 28px; }
.tutorial-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}
.tutorial-section-title svg { width: 20px; height: 20px; color: var(--primary); }
.tutorial-section-intro { margin: -8px 0 18px; color: var(--text-secondary); font-size: 0.875rem; line-height: 1.5; }
.tut-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.tut-switch-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text-secondary);
  text-decoration: none;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition), transform var(--transition);
}
.tut-switch-option:hover { border-color: var(--primary-light); color: var(--text); transform: translateY(-1px); }
.tut-switch-option.is-active {
  border-color: var(--primary);
  background: rgba(26, 35, 126, 0.05);
  box-shadow: 0 4px 14px rgba(26, 35, 126, 0.18);
  color: var(--text);
}
.tut-switch-option:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tut-switch-icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
.tut-switch-icon svg { width: 19px; height: 19px; }
.tut-switch-option.is-active .tut-switch-icon {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
}
.tut-switch-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tut-switch-text strong { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.tut-switch-text small { font-size: 0.75rem; color: var(--text-secondary); }
[data-theme="dark"] .tut-switch-option.is-active { background: #15305a; }
.tutorial-steps { display: flex; flex-direction: column; gap: 10px; }
.tutorial-step {
  display: flex;
  gap: 14px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  border-left: 3px solid var(--primary);
}
.tutorial-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.813rem;
  font-weight: 700;
}
.tutorial-step-body { flex: 1; min-width: 0; }
.tutorial-step-body strong { font-size: 0.875rem; display: block; margin-bottom: 2px; }
.tutorial-step-body p { font-size: 0.813rem; color: var(--text-secondary); margin: 0; }
.compare-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.compare-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.compare-card.time-limited { border: 1.5px solid var(--primary); }
.compare-card.non-expiry { border: 1.5px solid var(--accent); }
.compare-card-label {
  padding: 14px 20px;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.compare-card.time-limited .compare-card-label { background: var(--primary); color: #fff; }
.compare-card.non-expiry .compare-card-label { background: var(--accent); color: #fff; }
.compare-card-body { padding: 14px 20px 18px; display: flex; flex-direction: column; gap: 10px; }
.compare-item { display: flex; align-items: flex-start; gap: 10px; font-size: 0.813rem; color: var(--text-secondary); }
.compare-icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.compare-icon svg { width: 18px; height: 18px; }
.compare-item span { flex: 1; }
.compare-item strong { color: var(--text); }
.tips-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tip-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tip-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.tip-icon svg { width: 18px; height: 18px; }
.tip-card p { font-size: 0.813rem; color: var(--text-secondary); margin: 0; line-height: 1.5; }
.tip-card p strong { color: var(--text); }

@media (max-width: 720px) {
  .compare-cards { grid-template-columns: 1fr; }
  .tips-grid { grid-template-columns: 1fr; }
  .tutorial-header { padding: 20px 22px; }
  .tutorial-step { padding: 14px 16px; gap: 12px; }
  .tutorial-step-num { width: 28px; height: 28px; font-size: 0.75rem; }
  .elec-presets { grid-template-columns: repeat(3, 1fr); }
  .elec-history-item { flex-direction: column; gap: 6px; }
  .elec-h-right { width: 100%; justify-content: space-between; }
}

@media (max-width: 600px) {
  .tut-switch { gap: 8px; }
  .tut-switch-option { flex-direction: column; align-items: center; text-align: center; gap: 9px; padding: 14px 10px; }
  .tut-switch-text { align-items: center; }
  .tut-switch-text small { display: none; }
}

/* ============ ELECTRICITY ============ */
.elec-header {
  background: linear-gradient(135deg, var(--accent-dark) 0%, var(--accent) 100%);
  border-radius: var(--radius);
  padding: 24px 28px;
  color: #fff;
  margin-bottom: 20px;
}
.elec-header-icon { width: 44px; height: 44px; background: rgba(255,255,255,0.2); border-radius: 12px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.elec-header-icon svg { width: 22px; height: 22px; }
.elec-header h2 { margin: 0 0 4px; font-size: 1.3rem; }
.elec-header p { margin: 0; color: rgba(255,255,255,0.85); font-size: 0.813rem; }

.elec-meter-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-bottom: 16px;
  border: 1.5px solid var(--accent);
}
.elec-meter-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.elec-meter-info { display: flex; flex-direction: column; gap: 2px; }
.elec-meter-label { font-size: 0.688rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.elec-meter-value { font-size: 0.938rem; font-weight: 700; font-family: 'Courier New', monospace; color: var(--text); }
.elec-meter-badge { font-size: 0.688rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; background: #e8f5e9; color: var(--success); padding: 4px 12px; border-radius: 20px; }
.elec-meter-balance { text-align: center; padding: 16px 0 8px; }
.elec-balance-label { display: block; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.elec-balance-value { font-size: 2rem; font-weight: 700; color: var(--accent); }
.elec-balance-value small { font-size: 1rem; font-weight: 400; color: var(--text-secondary); }
.elec-balance-units { display: block; font-size: 0.813rem; color: var(--text-secondary); margin-top: 4px; }

.elec-details {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 4px 20px;
  margin-bottom: 16px;
}
.elec-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.elec-detail-row:last-child { border-bottom: none; }
.elec-detail-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.elec-detail-value { font-size: 0.813rem; color: var(--text); font-weight: 500; text-align: right; }

.elec-topup-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 16px;
}
.elec-topup-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.938rem;
  font-weight: 600;
  margin: 0 0 14px;
}
.elec-topup-title svg { width: 18px; height: 18px; color: var(--accent); }
.elec-presets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 14px; }
.elec-preset {
  padding: 10px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.813rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}
.elec-preset:hover { border-color: var(--accent); color: var(--accent); }
.elec-preset.custom { border-style: dashed; color: var(--text-secondary); }
.elec-input-group { margin-bottom: 12px; }
.elec-input-group label { display: block; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 6px; }
.elec-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  background: var(--card-bg);
  transition: var(--transition);
  box-sizing: border-box;
}
.elec-input:focus { outline: none; border-color: var(--accent); }
.elec-summary { font-size: 0.813rem; color: var(--text-secondary); margin-bottom: 14px; text-align: center; }
.elec-summary strong { color: var(--accent); }

.elec-history { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.elec-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow);
}
.elec-h-left { display: flex; align-items: center; gap: 12px; }
.elec-h-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #fff3e0;
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.elec-h-icon svg { width: 18px; height: 18px; }
.elec-h-amount { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.elec-h-meta { font-size: 0.688rem; color: var(--text-muted); margin-top: 1px; }
.elec-h-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.elec-h-method { font-size: 0.688rem; color: var(--text-secondary); font-weight: 500; }
.elec-h-ref { font-size: 0.625rem; color: var(--text-muted); font-family: 'Courier New', monospace; }

/* ============ LEARNING ============ */
.learn-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: linear-gradient(135deg, #1a1a3e 0%, #2d2d6b 100%);
  border-radius: var(--radius);
  padding: 22px 24px;
  color: #fff;
  margin-bottom: 16px;
}
.learn-header-icon { width: 44px; height: 44px; background: rgba(255,255,255,0.15); border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.learn-header-icon svg { width: 22px; height: 22px; }
.learn-header h2 { margin: 0 0 2px; font-size: 1.25rem; }
.learn-header p { margin: 0; color: rgba(255,255,255,0.7); font-size: 0.813rem; }
.learn-settings-btn { color: rgba(255,255,255,0.7); flex-shrink: 0; }
.learn-settings-btn:hover { color: #fff; background: rgba(255,255,255,0.12); }
.learn-settings-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.learn-settings-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.learn-settings-row strong { font-size: 0.813rem; }
.learn-categories {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}
.learn-cat-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}
.learn-cat-btn svg { width: 14px; height: 14px; }
.learn-cat-btn:hover { border-color: var(--cat-color, var(--primary)); color: var(--cat-color, var(--primary)); }
.learn-cat-btn.active { background: var(--cat-color, var(--primary)); border-color: var(--cat-color, var(--primary)); color: #fff; }
.learn-search { margin-bottom: 16px; }
.learn-search-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 4px 4px 14px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.learn-search-inner:focus-within { border-color: var(--primary); }
.learn-search-inner svg { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }
.learn-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 0.875rem;
  color: var(--text);
  padding: 10px 0;
  outline: none;
}
.learn-search-inner .btn { flex-shrink: 0; }
.learn-video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.learn-video-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
}
.learn-video-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.learn-video-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}
.learn-video-thumb iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.learn-video-body { padding: 12px 14px 14px; }
.learn-video-title {
  font-size: 0.813rem;
  font-weight: 600;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
  margin-bottom: 4px;
}
.learn-video-meta { display: flex; align-items: center; gap: 6px; font-size: 0.688rem; color: var(--text-muted); }
.learn-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

@media (max-width: 960px) {
  .learn-video-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .learn-video-grid { grid-template-columns: 1fr; }
  .learn-header { flex-wrap: wrap; }
  .learn-settings-row { flex-direction: column; }
  .learn-settings-row input { width: 100% !important; }
}

/* ============ LIVE CHAT ============ */
.chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.chat-bubble {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(83,58,253,0.35);
  transition: var(--transition);
  position: relative;
}
.chat-bubble:hover { transform: scale(1.08); background: var(--primary-dark); }
.chat-bubble svg { width: 26px; height: 26px; }
.chat-bubble-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--success);
  border: 2.5px solid var(--card-bg);
}
.chat-panel {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 500px;
  max-height: calc(100vh - 160px);
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.chat-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: var(--primary);
  color: #fff;
  flex-shrink: 0;
}
.chat-header-left { display: flex; align-items: center; gap: 10px; }
.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-avatar svg { width: 20px; height: 20px; }
.chat-agent-name { font-size: 0.875rem; font-weight: 600; }
.chat-agent-status { font-size: 0.688rem; color: rgba(255,255,255,0.75); display: flex; align-items: center; gap: 4px; }
.chat-agent-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.chat-close-btn {
  width: 32px; height: 32px;
  border: none;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.chat-close-btn:hover { background: rgba(255,255,255,0.25); }
.chat-close-btn svg { width: 18px; height: 18px; }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
}
.chat-msg { display: flex; gap: 8px; max-width: 85%; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(83,58,253,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: flex-end;
}
.chat-msg-avatar svg { width: 14px; height: 14px; color: var(--primary); }
.chat-msg-content { display: flex; flex-direction: column; gap: 3px; }
.chat-msg-text {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.813rem;
  line-height: 1.45;
  word-wrap: break-word;
}
.chat-msg.agent .chat-msg-text {
  background: var(--card-bg);
  color: var(--text);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow);
}
.chat-msg.user .chat-msg-text {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg-time { font-size: 0.625rem; color: var(--text-muted); padding: 0 4px; }
.chat-msg.user .chat-msg-time { text-align: right; }
.chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--card-bg);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow);
}
.chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: chatTyping 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatTyping {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}
.chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 0.813rem;
  color: var(--text);
  padding: 8px 0;
  outline: none;
}
.chat-input::placeholder { color: var(--text-muted); }
.chat-send-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}
.chat-send-btn:hover { background: var(--primary-dark); transform: scale(1.06); }
.chat-send-btn svg { width: 16px; height: 16px; }

@media (max-width: 600px) {
  .chat-panel {
    right: 8px;
    left: 8px;
    bottom: 76px;
    width: auto;
    height: calc(100vh - 100px);
    max-height: none;
  }
  .chat-widget { bottom: 80px; right: 12px; }
}
