/* NetFlux Dark Glassmorphic Design System */
:root {
  --bg-main: #090d16;
  --bg-card: rgba(18, 26, 43, 0.75);
  --bg-card-hover: rgba(28, 40, 65, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(56, 189, 248, 0.3);

  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-glow: rgba(2, 132, 199, 0.35);

  --accent: #8b5cf6;
  --accent-glow: rgba(139, 92, 246, 0.35);

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-main: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(2, 132, 199, 0.25);

  --font-fa: 'Vazirmatn', -apple-system, BlinkMacSystemFont, sans-serif;
  --visual-viewport-height: 100vh;
  --visual-viewport-offset-top: 0px;
}

@supports (height: 100dvh) {
  :root {
    --visual-viewport-height: 100dvh;
  }
}

/* Custom Dark Glassmorphic Scrollbar for Project */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(11, 19, 41, 0.7);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.4), rgba(2, 132, 199, 0.6));
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 10px;
  transition: all 0.25s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #38bdf8, #2563eb);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Firefox Scrollbar Standard */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.5) rgba(11, 19, 41, 0.7);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-fa);
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button,
a,
select,
input[type="button"],
input[type="submit"] {
  touch-action: manipulation;
}

body {
  background: var(--bg-main);
  background-image:
    radial-gradient(circle at 15% 15%, rgba(2, 132, 199, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(139, 92, 246, 0.12) 0%, transparent 45%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  direction: rtl;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

/* App Header & Navigation */
.navbar {
  position: relative;
  width: 100%;
  margin: 0;
  border-radius: 0;
  z-index: 10000;
  background: rgba(9, 13, 22, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: padding 0.3s ease, background 0.3s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 800;
  font-size: 1.35rem;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
  transition: transform 0.25s ease;
}

.brand:hover .brand-icon {
  transform: scale(1.05) rotate(-3deg);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* System State Rule: When navbar is in logged-out / login mode, hide all nav actions and hamburger cleanly */
.navbar.is-logged-out .nav-actions,
.navbar.is-logged-out .hamburger {
  display: none !important;
}

.wallet-badge {
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-md);
  padding: 6px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.wallet-amount {
  color: #38bdf8;
  font-weight: bold;
}

/* Container */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 30px 20px 80px 20px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 18px;
  line-height: 1.35;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.92rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
  width: max-content;
  width: fit-content;
  max-width: 100%;
}

.btn-block {
  width: 100% !important;
  display: flex !important;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #2563eb);
  color: white;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.6);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: white;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.4);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-highlight);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.82rem;
  line-height: 1.3;
  border-radius: var(--radius-sm);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.4);
}

.btn-success {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.btn-success:hover {
  background: rgba(16, 185, 129, 0.4);
}

/* Glass Cards */
.card {
  background: rgba(30, 41, 59, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 12px 40px 0 rgba(56, 189, 248, 0.12);
}

/* Grid System */
.grid {
  display: grid;
  gap: 20px;
}

.grid-cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.grid-cols-2 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

.grid-cols-4 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
}

/* Subscription Card Styling */
.sub-card {
  position: relative;
  overflow: visible;
}

.sub-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.sub-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.sub-email {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: monospace;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  line-height: 1.25;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-expired {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-depleted {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-reseller {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.35);
}

/* Custom Usage Progress Bar */
.progress-container {
  margin: 16px 0;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.progress-bar-bg {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: var(--radius-full);
}

/* Action Menus: Clean Wrap-Content Button Layout */
.sub-actions,
.action-grid {
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  margin-top: 16px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.btn-action-trigger {
  width: max-content !important;
  width: fit-content !important;
  max-width: 100% !important;
}

/* Plan Card */
.plan-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  padding: 30px 24px;
  border-radius: var(--radius-lg);
  position: relative;
}

.plan-card.featured {
  border-color: var(--border-highlight);
  background: linear-gradient(180deg, rgba(2, 132, 199, 0.15) 0%, var(--bg-card) 100%);
  box-shadow: var(--shadow-glow);
}

.plan-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.plan-price {
  font-size: 1.8rem;
  font-weight: 900;
  color: #38bdf8;
  margin: 15px 0;
}

.plan-price span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.plan-features {
  list-style: none;
  margin: 20px 0;
  text-align: right;
}

.plan-features li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Auth Form / Modals */
.auth-box {
  max-width: 420px;
  margin: 60px auto;
}

.form-group {
  margin-bottom: 18px;
  text-align: right;
}

html[dir="ltr"] .form-group {
  text-align: left;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-align: inherit;
}

html[dir="ltr"] .form-label {
  text-align: left;
}

.form-input,
select.form-input,
input.form-input {
  width: 100%;
  height: 42px;
  min-height: 42px;
  padding: 8px 14px;
  line-height: 1.45;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.92rem;
  outline: none;
  box-sizing: border-box;
}

select.form-input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 32px;
}

html[dir="ltr"] select.form-input {
  background-position: right 12px center;
  padding-right: 32px;
  padding-left: 14px;
}

textarea.form-input {
  height: auto;
  min-height: 85px;
}

.form-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

/* Branded date and time controls used by admin expiry editors. */
.custom-datetime-picker {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(120px, 0.65fr);
  gap: 10px;
}

.datetime-picker-part {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 0.78rem;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.94), rgba(30, 41, 59, 0.76));
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-md);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.datetime-picker-part:focus-within {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.13), 0 8px 24px rgba(2, 132, 199, 0.12);
  transform: translateY(-1px);
}

.datetime-picker-part > span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.datetime-picker-part i {
  color: #38bdf8;
}

.custom-picker-input {
  width: 100%;
  min-width: 0;
  padding: 0;
  color: var(--text-main);
  background: transparent;
  border: 0;
  outline: 0;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 650;
  direction: ltr;
  color-scheme: dark;
}

.custom-picker-input::-webkit-calendar-picker-indicator {
  padding: 5px;
  border-radius: 7px;
  cursor: pointer;
  filter: invert(78%) sepia(38%) saturate(1058%) hue-rotate(166deg) brightness(99%) contrast(91%);
  transition: background 0.2s ease;
}

.custom-picker-input::-webkit-calendar-picker-indicator:hover {
  background: rgba(56, 189, 248, 0.16);
}

@media (max-width: 520px) {
  .custom-datetime-picker {
    grid-template-columns: 1fr;
  }
}

/* Keep the native time segments clear of the picker icon in RTL layouts. */
#set-cloud-backup-time {
  direction: ltr;
  text-align: center;
  padding-inline: 14px;
  color-scheme: dark;
}

#set-cloud-backup-time::-webkit-date-and-time-value {
  min-width: 0;
  margin: 0;
  text-align: center;
}

#set-cloud-backup-time::-webkit-datetime-edit {
  padding: 0;
}

@media (max-width: 768px),
  (orientation: landscape) and (min-width: 769px) and (max-width: 1024px) and (max-height: 600px) {
  #set-cloud-backup-time {
    max-width: 140px;
    height: 48px;
    min-height: 48px;
    padding: 8px 12px !important;
  }

  #set-cloud-backup-time::-webkit-calendar-picker-indicator {
    flex: 0 0 auto;
    margin: 0;
    padding: 4px;
  }
}

/* Custom Panel-Styled Date & Time Picker Popover */
.custom-panel-picker-popover {
  position: fixed;
  z-index: 100000;
  display: none;
  opacity: 0;
  transform: translateY(6px) scale(0.97);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.custom-panel-picker-popover.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.panel-picker-card {
  width: 310px;
  background: linear-gradient(145deg, rgba(13, 20, 36, 0.97), rgba(24, 35, 58, 0.97));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 18px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.75), 0 0 30px rgba(2, 132, 199, 0.25);
  padding: 16px;
  color: var(--text-main);
  font-family: var(--font-fa);
  user-select: none;
}

.panel-picker-card.time-picker-mode {
  width: 290px;
}

/* Header */
.panel-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.picker-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.picker-close-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

.picker-title-group {
  font-size: 0.98rem;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 0.2px;
}

.picker-nav-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s ease;
}

.picker-nav-btn:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  transform: scale(1.05);
}

/* Weekdays */
.picker-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 8px;
}

/* Days Grid */
.picker-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.picker-day-cell {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: #f8fafc;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s ease;
}

.picker-day-cell:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.16);
  color: #38bdf8;
  transform: scale(1.06);
}

.picker-day-cell.selected {
  background: linear-gradient(135deg, #0284c7, #8b5cf6) !important;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.45);
  transform: scale(1.06);
}

.picker-day-cell.today {
  border: 1px solid rgba(56, 189, 248, 0.6);
  color: #38bdf8;
}

.picker-day-cell.day-other-month {
  opacity: 0.25;
  cursor: default;
}

/* Time Picker Specifics */
.panel-picker-time-preview {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.time-preview-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 12px;
  padding: 8px 20px;
  font-weight: 700;
  color: #38bdf8;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.preview-num {
  font-size: 1.35rem;
  letter-spacing: 1px;
}

.preview-period {
  font-size: 0.9rem;
  background: rgba(139, 92, 246, 0.3);
  padding: 2px 8px;
  border-radius: 6px;
  color: #c084fc;
}

.panel-picker-time-columns {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.time-col-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.time-col-header {
  font-size: 0.72rem;
  font-weight: 650;
  color: #94a3b8;
  text-align: center;
  margin-bottom: 6px;
}

.time-scroll-col {
  height: 170px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.3) transparent;
  background: rgba(10, 16, 28, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.time-scroll-col::-webkit-scrollbar {
  width: 4px;
}
.time-scroll-col::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.3);
  border-radius: 4px;
}

.time-cell {
  height: 34px;
  min-height: 34px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.time-cell:hover {
  background: rgba(56, 189, 248, 0.14);
  color: #38bdf8;
}

.time-cell.selected {
  background: linear-gradient(135deg, #0284c7, #8b5cf6) !important;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

/* Footer Buttons */
.panel-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.picker-footer-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 650;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.btn-picker-clear {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

.btn-picker-clear:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.btn-picker-today,
.btn-picker-done {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.8), rgba(139, 92, 246, 0.8));
  border-color: rgba(56, 189, 248, 0.4);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.btn-picker-today:hover,
.btn-picker-done:hover {
  background: linear-gradient(135deg, #0284c7, #8b5cf6);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.45);
  transform: translateY(-1px);
}

/* Mobile Popover Overlay */
@media (max-width: 540px) {
  .custom-panel-picker-popover {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.7) !important;
    backdrop-filter: blur(8px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px !important;
    transform: none !important;
  }
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: var(--visual-viewport-height);
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Hide top navbar when any modal is open. Keep the class fallback separate so
   older Android WebViews do not discard it when :has() is unsupported. */
body.modal-open .navbar {
  display: none !important;
}

@supports selector(body:has(*)) {
  body:has(.modal-overlay.active) .navbar {
    display: none !important;
  }
}

.modal-content {
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: calc(var(--visual-viewport-height) - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.85);
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}

.modal-content::-webkit-scrollbar {
  width: 6px;
}

.modal-content::-webkit-scrollbar-thumb {
  background-color: var(--primary);
  border-radius: var(--radius-full);
}

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

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Tables & Responsiveness */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  touch-action: pan-x pan-y;
  border-radius: 12px;
}

/* Table Search Header & Controls */
.table-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
}

/* Panel Clients Modal Toolbar (Responsive for Desktop & Mobile) */
.panel-clients-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.panel-clients-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: wrap;
}

.panel-clients-search-box {
  flex: 1 1 240px;
  min-width: 0;
}

.panel-clients-search-box #panel-clients-search {
  width: 100%;
}

.panel-clients-selects {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
}

.panel-clients-selects select {
  flex: 1;
  min-width: 130px;
}

.panel-clients-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .panel-clients-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .panel-clients-filters {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .panel-clients-search-box {
    width: 100%;
    flex: 1 1 100%;
  }

  .panel-clients-selects {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 8px;
  }

  .panel-clients-selects select {
    width: 100%;
    min-width: 0;
  }

  .panel-clients-meta {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
  }
}

.table-header-flex h3,
.table-header-flex h4 {
  margin: 0;
}

.table-header-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1;
}

.user-filter-selectors select.table-control-select,
.sub-filter-selectors select.table-control-select,
.rcpt-filter-selectors select.table-control-select {
  width: auto;
  min-width: 0;
  height: 36px;
  min-height: 36px;
  padding-block: 5px;
  font-size: 0.78rem;
}

.user-filter-selectors,
.sub-filter-selectors,
.rcpt-filter-selectors {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex: 0 1 auto;
}

.user-filter-selectors #admin-users-balance-filter {
  width: 190px;
}

.user-filter-selectors #admin-users-sort {
  width: 155px;
}

.table-search-box {
  position: relative;
  min-width: 240px;
  max-width: 380px;
  flex: 1;
}

.table-search-box .search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
  transition: color 0.25s ease;
}

.table-search-box .table-search-input {
  width: 100%;
  padding: 8px 38px 8px 34px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.86rem;
  outline: none;
  transition: all 0.25s ease;
}

.table-search-box .table-search-input:focus {
  border-color: #38bdf8;
  background: rgba(15, 23, 42, 0.9);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

.table-search-box .table-search-input:focus+.search-icon {
  color: #38bdf8;
}

.table-search-box .search-clear-btn {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.2s, background-color 0.2s;
}

.table-search-box .search-clear-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
  .table-header-controls,
  .table-header-controls .table-search-box {
    width: 100%;
    max-width: none;
  }

  .user-filter-selectors {
    width: 100%;
  }

  .user-filter-selectors .table-control-select,
  .user-filter-selectors #admin-users-balance-filter,
  .user-filter-selectors #admin-users-sort {
    width: 50%;
    flex: 1 1 0;
  }

  .sub-filter-selectors {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
  }

  .sub-filter-selectors select.table-control-select {
    width: 100%;
    max-width: 100%;
  }

  .fin-record-form {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .fin-record-form .form-group {
    grid-column: span 1 !important;
  }

  .fin-ledger-controls {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px !important;
  }

  .fin-ledger-controls select,
  .fin-ledger-controls button {
    flex: 1 1 auto;
    justify-content: center;
  }
}


table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  text-align: right;
}

html[dir="ltr"] table {
  text-align: left;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.9rem;
  white-space: nowrap;
  text-align: inherit;
}

html[dir="ltr"] th,
html[dir="ltr"] td {
  text-align: left;
}

th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-weight: 700;
  white-space: nowrap;
}

td code {
  max-width: 220px;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  padding: 10px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
}

.tab-btn.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #1e293b;
  border: 1px solid var(--border-highlight);
  color: var(--text-main);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* QR Canvas Container */
#qr-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 16px auto;
  background: white;
  padding: 12px;
  border-radius: var(--radius-md);
  width: fit-content;
  max-width: 100%;
}

#qr-canvas,
#qr-img {
  width: 200px !important;
  height: 200px !important;
  display: block;
}

/* Profile Card */
.profile-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  margin-bottom: 30px;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.profile-name {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-email {
  font-size: 0.88rem;
  color: var(--text-muted);
  word-break: break-all;
}

.profile-meta {
  display: flex;
  gap: 20px;
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.profile-meta strong {
  color: #38bdf8;
}

.profile-actions {
  flex-shrink: 0;
}

/* Hamburger Menu Button (Mobile Only) */
.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 1.6rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.hamburger:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Mobile Navigation Header (Hidden on Desktop) */
.mobile-menu-header {
  display: none;
}

.mobile-menu-backdrop {
  display: none;
}

/* ==================================
   RESPONSIVE DESIGN (Mobile First)
   ================================== */

/* Navbar Header Actions & Notification Bell (Always on Navbar) */
.navbar-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.notification-bell-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.bell-btn {
  background: rgba(56, 189, 248, 0.12) !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
  color: #38bdf8 !important;
  width: 40px !important;
  height: 40px !important;
  border-radius: 10px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.1rem !important;
  cursor: pointer !important;
  position: relative !important;
  transition: all 0.2s ease !important;
}

.bell-btn:hover {
  background: rgba(56, 189, 248, 0.25) !important;
  border-color: rgba(56, 189, 248, 0.6) !important;
  color: #ffffff !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4) !important;
}

.bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger, #ef4444);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
}

.notification-popover {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 0 !important;
  right: auto !important;
  width: 310px;
  max-width: calc(100vw - 28px);
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 14px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.9);
  z-index: 100010;
  padding: 14px;
}

html[dir="ltr"] .notification-popover {
  left: auto !important;
  right: 0 !important;
}

.notification-popover.active {
  display: block !important;
  animation: popoverFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.push-popover-banner {
  padding: 10px 12px;
  margin-bottom: 12px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 10px;
  font-size: 0.82rem;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.push-popover-banner .btn-push-banner {
  padding: 4px 10px;
  font-size: 0.78rem;
  border-radius: 6px;
  white-space: nowrap;
}

/* Keep the full desktop row for widths where every authenticated action fits. */
@media (min-width: 1025px) {
  .navbar-header-actions {
    order: 1;
  }

  .nav-actions {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    order: 2;
  }

  .nav-utility-row {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: auto !important;
  }

  .nav-utility-row .lang-select {
    width: auto !important;
    padding: 6px 10px !important;
  }

  .nav-utility-row .live-refresh-badge {
    width: auto !important;
    padding: 6px 10px !important;
  }

  .nav-actions .nav-item-btn {
    width: auto !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f8fafc;
    transition: all 0.2s ease;
  }

  .nav-actions .nav-item-btn:hover {
    background: rgba(56, 189, 248, 0.18);
    border-color: rgba(56, 189, 248, 0.4);
    color: #38bdf8;
  }

  .nav-item-arrow {
    display: none !important;
  }

  #user-controls {
    width: auto !important;
  }

  .nav-actions .btn-danger.nav-item-btn,
  #user-controls button,
  .btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    border: 1px solid #ef4444 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.35) !important;
  }

  .nav-actions .btn-danger.nav-item-btn:hover,
  #user-controls button:hover,
  .btn-danger:hover {
    background: linear-gradient(135deg, #f87171, #ef4444) !important;
    border-color: #f87171 !important;
    color: #ffffff !important;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5) !important;
  }

  .wallet-badge {
    width: auto !important;
    padding: 5px 12px !important;
    gap: 8px !important;
  }
}

/* Compact navigation for phones and tablets, including iPad portrait widths. */
@media (max-width: 1024px) {

  /* Mobile browsers zoom focused form fields when their text is smaller than 16px. */
  input,
  select,
  textarea,
  [contenteditable="true"] {
    font-size: 16px !important;
  }

  .navbar {
    padding: 12px 16px;
    position: relative;
    z-index: 10000;
  }

  .hamburger {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-main);
    font-size: 1.3rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .hamburger:active {
    transform: scale(0.92);
  }

  .mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    font-weight: 700;
    color: #38bdf8;
    font-size: 0.95rem;
  }

  .btn-close-menu {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: var(--text-main);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
  }

  /* Popup Drawer styling on Mobile */
  .nav-actions {
    display: none !important;
    position: fixed;
    top: 68px;
    left: 14px;
    right: 14px;
    width: calc(100% - 28px);
    background: #0f172a !important;
    border: 1px solid rgba(56, 189, 248, 0.4) !important;
    border-radius: var(--radius-lg, 16px);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.95), 0 0 35px rgba(56, 189, 248, 0.25);
    padding: 20px;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    z-index: 100002;
    transform: translateY(-15px) scale(0.95);
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: calc(var(--visual-viewport-height) - 82px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .nav-actions.mobile-open {
    display: flex !important;
    transform: translateY(0) scale(1);
    opacity: 1;
  }

  .wallet-badge {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95)) !important;
    border: 1px solid rgba(56, 189, 248, 0.35) !important;
    border-radius: 14px !important;
    padding: 10px 16px !important;
    display: flex;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
  }

  #user-controls {
    width: 100% !important;
  }

  .nav-actions .nav-item-btn {
    width: 100% !important;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 600;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f8fafc;
    transition: all 0.2s ease;
  }

  .nav-item-arrow {
    display: inline-block !important;
    font-size: 0.8rem;
    opacity: 0.6;
  }

  .nav-utility-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    width: 100% !important;
  }

  .nav-utility-row .lang-select {
    flex: 1 !important;
    padding: 9px 12px !important;
    background: rgba(30, 41, 59, 0.8) !important;
    border: 1px solid rgba(56, 189, 248, 0.3) !important;
    border-radius: 10px !important;
    color: var(--text-main) !important;
    font-weight: 600 !important;
  }

  .nav-utility-row .live-refresh-badge {
    flex: 1 !important;
    justify-content: center !important;
    padding: 8px 12px !important;
    background: rgba(30, 41, 59, 0.8) !important;
    border: 1px solid rgba(52, 211, 153, 0.35) !important;
    border-radius: 10px !important;
  }

  .brand span {
    font-size: 1.1rem;
  }

}

/* Content layout changes remain limited to narrow portrait/mobile widths. */
@media (max-width: 768px) {

  .container {
    padding: 18px 14px 60px 14px;
  }

  /* Plans and Subscriptions display in full-width single column cards on Mobile */
  #subs-grid,
  #plans-grid,
  .grid-cols-2,
  .grid-cols-3 {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* Stat cards grid 2x2 on Mobile */
  .grid-cols-4 {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  /* Section headers stack vertically */
  .section-header {
    align-items: flex-start;
    gap: 10px;
  }

  .section-title {
    font-size: 1.1rem;
  }

  /* Tabs become scrollable horizontally */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    gap: 4px;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    white-space: nowrap;
    padding: 10px 14px;
    font-size: 0.82rem;
    flex-shrink: 0;
  }

  /* Plan card adjustments */
  .plan-card {
    padding: 24px 18px;
  }

  .plan-price {
    font-size: 1.5rem;
  }

  /* Auth box full width on mobile */
  .auth-box {
    max-width: 100%;
    margin: 30px auto;
  }

  /* Sub card actions wrap */
  .sub-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  .sub-actions .btn {
    flex: 1;
    min-width: 90px;
    justify-content: center;
    font-size: 0.78rem;
    padding: 8px 10px;
  }

  /* Tables: reduce cell padding */
  th,
  td {
    padding: 10px 10px;
    font-size: 0.82rem;
  }

  body {
    padding: 0 !important;
    margin: 0 !important;
  }

  .container {
    padding: 16px 14px 75px 14px !important;
  }

  /* Modal full-width on mobile */
  .modal-content {
    max-width: 100%;
    padding: 22px 16px;
    border-radius: var(--radius-md);
  }

  /* Toast position for mobile */
  #toast-container {
    bottom: 16px;
    right: 12px;
    left: 12px;
  }

  .toast {
    font-size: 0.85rem;
    padding: 10px 14px;
  }

  /* Profile Card mobile */
  .profile-card {
    flex-direction: column;
    text-align: center;
    gap: 14px;
  }

  .profile-meta {
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
  }

  .profile-actions {
    width: 100%;
  }

  .profile-actions .btn {
    width: 100%;
  }

  .sub-actions {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin-top: 14px !important;
    width: 100% !important;
  }

  .sub-actions .btn-action-trigger {
    width: max-content !important;
    width: fit-content !important;
    max-width: 100% !important;
  }
}

/* A shorter navbar and drawer leave usable vertical room on landscape phones. */
@media (orientation: landscape) and (min-width: 769px) and (max-width: 1024px) and (max-height: 600px) {
  .navbar {
    min-height: 54px;
    padding: 8px 14px;
  }

  .brand {
    gap: 8px;
  }

  .brand-icon,
  .hamburger,
  .bell-btn {
    width: 36px !important;
    height: 36px !important;
  }

  .brand span {
    max-width: 46vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1rem;
  }

  .navbar-header-actions {
    gap: 6px;
  }

  .nav-actions {
    top: 58px;
    left: 10px;
    right: 10px;
    width: calc(100% - 20px);
    max-height: calc(var(--visual-viewport-height) - 66px);
    padding: 12px 16px;
    gap: 8px;
  }

  .mobile-menu-header {
    padding-bottom: 8px;
  }

  .nav-actions .nav-item-btn {
    padding: 9px 14px;
  }

  .wallet-badge {
    padding: 7px 12px !important;
  }
}

/* Small mobile (480px and below) */
@media (max-width: 480px) {
  .brand-icon {
    width: 34px;
    height: 34px;
    font-size: 0.9rem;
  }

  .brand span {
    font-size: 1rem;
  }

  .container {
    padding: 14px 10px 50px 10px;
  }

  .card {
    padding: 18px 14px;
    border-radius: var(--radius-md);
  }

  .sub-filter-selectors {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sub-filter-selectors select.table-control-select:last-child {
    grid-column: 1 / -1;
  }

  .sub-header {
    flex-direction: column;
    gap: 8px;
  }

  .sub-title {
    font-size: 1rem;
  }

  .btn {
    font-size: 0.85rem;
    padding: 10px 16px;
  }

  .btn-sm {
    font-size: 0.78rem;
    padding: 7px 10px;
  }

  .plan-title {
    font-size: 1.05rem;
  }

  .plan-price {
    font-size: 1.35rem;
  }

  h2 {
    font-size: 1.2rem;
  }

  h3 {
    font-size: 1rem;
  }

  h4 {
    font-size: 0.95rem;
  }

  /* Admin forms: single column always */
  form.grid {
    grid-template-columns: 1fr !important;
  }
}

/* Container & Table Overflow Fix */
.table-responsive {
  width: 100%;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  border-radius: 12px;
}

@media (max-width: 768px) {
  .table-responsive {
    padding-bottom: 20px !important;
  }
}

/* Elevate Parent Stacking Context & Prevent Overflow Clipping When Dropdown Open */
.card.dropdown-active-parent,
.sub-card.dropdown-active-parent,
.sub-actions.dropdown-active-parent,
.table-responsive.dropdown-active-parent,
table.dropdown-active-parent,
tr.dropdown-active-parent,
td.dropdown-active-parent {
  z-index: 99999 !important;
  position: relative !important;
}

.card.dropdown-active-parent,
.sub-card.dropdown-active-parent,
.sub-actions.dropdown-active-parent {
  overflow: visible !important;
}

@supports selector(.card:has(*)) {

  .card:has(.action-dropdown.active),
  .sub-card:has(.action-dropdown.active),
  .sub-actions:has(.action-dropdown.active),
  .table-responsive:has(.action-dropdown.active),
  table:has(.action-dropdown.active),
  tr:has(.action-dropdown.active),
  td:has(.action-dropdown.active) {
    z-index: 99999 !important;
    position: relative !important;
  }

  .card:has(.action-dropdown.active),
  .sub-card:has(.action-dropdown.active),
  .sub-actions:has(.action-dropdown.active) {
    overflow: visible !important;
  }
}

/* Universal Action Dropdown Menu & Openable Grid System */
.action-dropdown {
  position: relative !important;
  display: inline-block !important;
  width: auto !important;
}

.action-dropdown-menu {
  display: none;
  position: absolute !important;
  left: 0 !important;
  right: auto !important;
  top: 100% !important;
  margin-top: 6px !important;
  background: #0b1329 !important;
  border: 1px solid rgba(56, 189, 248, 0.5) !important;
  border-radius: 12px !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.95), 0 0 30px rgba(56, 189, 248, 0.3) !important;
  z-index: 100005 !important;
  min-width: 200px !important;
  max-width: calc(100vw - 28px) !important;
  padding: 8px !important;
  box-sizing: border-box !important;
}

html[dir="ltr"] .action-dropdown-menu {
  right: 0 !important;
  left: auto !important;
}

.sub-actions .action-dropdown-menu {
  right: 0 !important;
  left: auto !important;
}

html[dir="ltr"] .sub-actions .action-dropdown-menu {
  left: 0 !important;
  right: auto !important;
}

/* Openable Action Menu -> Displays as 2-Row x 2-Col Grid Layout */
.action-dropdown.active .action-dropdown-menu {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 6px !important;
  animation: actionPopupFade 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes actionPopupFade {
  from {
    opacity: 0;
    margin-top: 0px;
  }

  to {
    opacity: 1;
    margin-top: 6px;
  }
}

.action-dropdown-menu button,
.sub-actions .action-dropdown-menu button {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  width: 100% !important;
  padding: 9px 8px !important;
  background: rgba(30, 41, 59, 0.9) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 8px !important;
  color: #f8fafc !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  text-align: center !important;
  box-shadow: none !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
}

.action-dropdown-menu button:hover,
.sub-actions .action-dropdown-menu button:hover {
  background: rgba(56, 189, 248, 0.25) !important;
  border-color: rgba(56, 189, 248, 0.5) !important;
  color: #38bdf8 !important;
}

.action-dropdown-menu button.danger,
.sub-actions .action-dropdown-menu button.danger {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: #f87171 !important;
}

.action-dropdown-menu button.danger:hover,
.sub-actions .action-dropdown-menu button.danger:hover {
  background: rgba(239, 68, 68, 0.3) !important;
  color: #ffffff !important;
}

@media (max-width: 768px) {
  .action-dropdown {
    width: auto !important;
    display: inline-block !important;
  }
}

/* Language Selector & LTR Overrides */
.lang-select {
  background: rgba(30, 41, 59, 0.9);
  color: var(--text-main);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 0.82rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.lang-select:hover,
.lang-select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

html[dir="ltr"] body {
  direction: ltr;
}

html[dir="ltr"] table {
  text-align: left;
}

html[dir="ltr"] .table-search-box .search-icon {
  right: auto;
  left: 14px;
}

html[dir="ltr"] .table-search-box .table-search-input {
  padding: 8px 34px 8px 38px;
}

html[dir="ltr"] .table-search-box .search-clear-btn {
  left: auto;
  right: 10px;
}

html[dir="ltr"] .action-dropdown-menu {
  right: auto;
  left: 0;
}


/* Custom Confirmation Modal Styles */
.modal-confirm-content {
  text-align: center;
  max-width: 440px;
  border-color: rgba(139, 92, 246, 0.4);
}

.confirm-icon-box {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  margin: 0 auto 16px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.confirm-icon-box.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

.confirm-icon-box.info {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Live Auto-Refresh Badge Styles */
.live-refresh-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  user-select: none;
}

.refresh-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #34d399;
  box-shadow: 0 0 8px #34d399;
  animation: pulseGreen 1.8s infinite ease-in-out;
}

@keyframes pulseGreen {
  0% {
    transform: scale(0.9);
    opacity: 0.7;
  }

  50% {
    transform: scale(1.3);
    opacity: 1;
    box-shadow: 0 0 12px #34d399;
  }

  100% {
    transform: scale(0.9);
    opacity: 0.7;
  }
}

/* --- Initial Auth Loading Screen (Prevents refresh flicker) --- */
.initial-auth-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: var(--visual-viewport-height);
  background: var(--bg-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.initial-auth-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.initial-auth-loader .spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(56, 189, 248, 0.2);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

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

/* --- Notification Bell & Popover Styles --- */
.notification-bell-wrapper {
  position: relative;
  display: inline-block;
}

.bell-btn {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  color: #38bdf8;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  position: relative;
  transition: all 0.25s ease;
}

.bell-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  transform: scale(1.05);
}

.bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-dark);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
  animation: pulseRed 2s infinite;
}

@keyframes pulseRed {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.15);
  }
}

.notification-popover {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  width: 330px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: none;
  overflow: hidden;
}

.notification-popover.active {
  display: block;
  animation: fadeInDown 0.25s ease-out;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(30, 41, 59, 0.8);
  border-bottom: 1px solid var(--border-color);
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88rem;
  color: #38bdf8;
}

.popover-header button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.popover-content {
  max-height: 320px;
  overflow-y: auto;
}

.popover-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.popover-item {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.popover-item:hover {
  background: rgba(56, 189, 248, 0.1);
}

.popover-item .item-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.popover-item .item-icon.receipt {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.popover-item .item-icon.message {
  background: rgba(167, 139, 250, 0.2);
  color: #a78bfa;
}

.popover-item .item-details {
  flex: 1;
  font-size: 0.82rem;
}

.popover-item .item-title {
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 3px;
}

.popover-item .item-sub {
  color: var(--text-muted);
}

/* --- Table Pagination Controls Styles --- */
.pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.pagination-info {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.pagination-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-btn {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 5px 11px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.page-btn:hover:not(:disabled) {
  border-color: #38bdf8;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
}

.page-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border-color: transparent;
  font-weight: 700;
}

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

/* --- Receipt Upload & Lightbox Styles --- */
.receipt-upload-box {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.5);
  transition: all 0.25s ease;
  margin-bottom: 16px;
}

.receipt-upload-box:hover {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
}

.receipt-preview-img {
  max-width: 100%;
  max-height: 180px;
  border-radius: 8px;
  margin-top: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.receipt-thumbnail {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  transition: transform 0.2s ease;
}

.receipt-thumbnail:hover {
  transform: scale(1.1);
  border-color: #38bdf8;
}

/* --- Messaging Chat Interface Styles --- */
.messages-split-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  min-height: 480px;
}

@media (max-width: 768px) {
  .messages-split-layout {
    grid-template-columns: 1fr;
  }
}

.threads-sidebar {
  background: rgba(15, 23, 42, 0.7);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow-y: auto;
  max-height: 540px;
}

.threads-sidebar-header {
  padding: 14px;
  background: rgba(30, 41, 59, 0.8);
  border-bottom: 1px solid var(--border-color);
  font-weight: 700;
  font-size: 0.9rem;
  color: #38bdf8;
}

.thread-item {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: background 0.2s ease;
  position: relative;
}

.thread-item:hover,
.thread-item.active {
  background: rgba(56, 189, 248, 0.15);
}

.thread-user-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.thread-last-msg {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-unread-badge {
  background: #ef4444;
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
}

.chat-viewport {
  background: rgba(15, 23, 42, 0.7);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 540px;
}

.chat-viewport-header {
  padding: 14px 18px;
  background: rgba(30, 41, 59, 0.8);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
}

.chat-messages-body {
  flex: 1;
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-bubble-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 75%;
}

.chat-bubble-wrapper.sent {
  align-self: flex-end;
}

.chat-bubble-wrapper.received {
  align-self: flex-start;
}

.chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  word-break: break-word;
}

.chat-bubble-wrapper.sent .chat-bubble {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: white;
  border-bottom-left-radius: 2px;
}

.chat-bubble-wrapper.received .chat-bubble {
  background: rgba(30, 41, 59, 0.9);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-bottom-right-radius: 2px;
}

.chat-bubble-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
  align-self: flex-end;
}

.chat-bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-height: 22px;
}

.chat-delete-message {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px 4px;
  border-radius: 5px;
  font-size: 0.68rem;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.chat-bubble-wrapper:hover .chat-delete-message,
.chat-delete-message:focus-visible {
  opacity: 1;
}

.chat-delete-message:hover,
.chat-delete-message:focus-visible {
  color: #f87171;
  background: rgba(239, 68, 68, 0.12);
  outline: none;
}

@media (hover: none) {
  .chat-delete-message {
    opacity: 1;
  }
}

.chat-attachment-img {
  max-width: 220px;
  border-radius: 8px;
  margin-top: 8px;
  cursor: pointer;
}

.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  background: rgba(30, 41, 59, 0.6);
  display: flex;
  gap: 10px;
  align-items: center;
}

.chat-input-area textarea {
  flex: 1;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  padding: 8px 12px;
  font-size: 0.88rem;
  resize: none;
  height: 40px;
  outline: none;
}

.chat-input-area textarea:focus {
  border-color: #38bdf8;
}

/* ==========================================================================
   PWA Installation Banner & Offline Status Components
   ========================================================================== */

/* PWA Bottom Glassmorphic Install Banner */
.pwa-install-banner {
  position: fixed;
  bottom: 24px;
  left: 24px;
  right: 24px;
  max-width: 520px;
  margin: 0 auto;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.3);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 20px rgba(56, 189, 248, 0.15);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: pwaSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pwaSlideUp {
  from {
    transform: translateY(100px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pwa-banner-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.pwa-banner-text {
  flex: 1;
}

.pwa-banner-text h4 {
  margin: 0 0 4px 0;
  font-size: 0.96rem;
  font-weight: 700;
  color: #f8fafc;
}

.pwa-banner-text p {
  margin: 0;
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.4;
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.pwa-dismiss-btn {
  color: #94a3b8 !important;
  border-color: rgba(148, 163, 184, 0.3) !important;
}

.pwa-dismiss-btn:hover {
  background: rgba(148, 163, 184, 0.1) !important;
  color: #f8fafc !important;
}

/* Offline Banner */
.offline-banner {
  position: fixed;
  top: 75px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;
  background: rgba(239, 68, 68, 0.95);
  backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: offlinePulse 2s infinite ease-in-out;
}

@keyframes offlinePulse {

  0%,
  100% {
    opacity: 0.95;
  }

  50% {
    opacity: 0.75;
  }
}

@media (max-width: 640px) {
  .pwa-install-banner {
    bottom: 16px;
    left: 14px;
    right: 14px;
    padding: 14px 16px;
  }
}

/* Support Chat Typing Indicator */
.chat-typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px dashed rgba(56, 189, 248, 0.4);
  border-radius: var(--radius-md);
  margin: 8px 0;
  width: fit-content;
  max-width: 80%;
  animation: pwaSlideUp 0.3s ease-out;
}

.chat-typing-text {
  font-size: 0.78rem;
  color: #38bdf8;
  font-weight: 500;
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background-color: #38bdf8;
  border-radius: 50%;
  display: inline-block;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0s;
}

@keyframes typingBounce {

  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.4;
  }

  40% {
    transform: scale(1.1);
    opacity: 1;
  }
}

/* ==========================================================================
   LOW-END DEVICE & RENDERING PERFORMANCE OPTIMIZATIONS
   ========================================================================== */

/* Off-Screen Render Bypass for Large Grids and Data Tables */
#plans-grid {
  content-visibility: auto;
  contain-intrinsic-size: 100px 300px;
}

/* Android Chrome/WebView rendering fixes. Live blur, fixed backgrounds and many
   promoted layers are common sources of checkerboarding and scroll jank there. */
html.is-android body {
  background-attachment: scroll;
  min-height: var(--visual-viewport-height);
  overscroll-behavior-y: none;
}

html.is-android .navbar,
html.is-android .card,
html.is-android .modal-overlay,
html.is-android .modal-content,
html.is-android .notification-popover,
html.is-android .pwa-install-banner,
html.is-android .offline-banner {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

html.is-android .navbar {
  background: #0c111d;
}

html.is-android .card {
  background: rgba(30, 41, 59, 0.96);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32);
}

html.is-android .modal-overlay {
  top: var(--visual-viewport-offset-top);
  bottom: auto;
  background: rgba(0, 0, 0, 0.84);
}

html.is-android .modal-content {
  background: #111827;
}

html.is-android .notification-popover,
html.is-android .pwa-install-banner {
  background: #0f172a;
}

html.is-android #plans-grid {
  content-visibility: visible;
  contain-intrinsic-size: none;
}

html.is-android .refresh-pulse-dot,
html.is-android .bell-badge,
html.is-android .offline-banner,
html.is-android .typing-dots span {
  animation: none;
}

@media (max-width: 768px) {

  html.is-android input:not([type="checkbox"]):not([type="radio"]),
  html.is-android select,
  html.is-android textarea {
    font-size: 16px;
  }

  html.is-android .nav-actions {
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.72);
    transition: transform 0.18s ease, opacity 0.18s ease;
  }

  html.is-android .card:hover,
  html.is-android .btn:hover,
  html.is-android .bell-btn:hover,
  html.is-android .receipt-thumbnail:hover {
    transform: none;
  }
}

/* Low-Power & Reduced Motion Optimizations */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .refresh-pulse-dot,
  .offline-banner,
  .typing-dots span {
    animation: none !important;
  }
}

/* ==========================================================================
   STORE FRONT FOOTER STYLES
   ========================================================================== */
.storefront-footer {
  margin-top: 40px;
  padding: 32px 24px 20px 24px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg, 16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.footer-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-brand-section {
  flex: 1 1 300px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
}

.footer-brand .brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.footer-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 420px;
}

.footer-links-section {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  flex: 1 1 320px;
  justify-content: flex-end;
}

.footer-column {
  min-width: 140px;
}

.footer-col-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #38bdf8;
  margin-bottom: 14px;
  letter-spacing: 0.3px;
}

.footer-nav-list,
.footer-feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-nav-list li,
.footer-feature-list li {
  margin-bottom: 10px;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.footer-nav-list a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease, transform 0.2s ease;
  display: inline-block;
}

.footer-nav-list a:hover {
  color: #38bdf8;
  transform: translateX(-4px);
}

html[dir="ltr"] .footer-nav-list a:hover {
  transform: translateX(4px);
}

.footer-bottom {
  padding-top: 16px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-copyright {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ==========================================================================
   CUSTOM FILE SELECTOR / UPLOAD STYLES
   ========================================================================== */
input[type="file"] {
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
}

input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 6px;
  padding: 6px 14px;
  margin-inline-end: 12px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

input[type="file"]:hover::file-selector-button,
input[type="file"]:hover::-webkit-file-upload-button {
  background: linear-gradient(135deg, #0369a1, #075985);
  border-color: #38bdf8;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
}

.custom-file-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 220px;
}

.custom-file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.custom-file-label {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 4px 10px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px dashed rgba(56, 189, 248, 0.4);
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  box-sizing: border-box;
  transition: all 0.2s ease-in-out;
  overflow: hidden;
}

.custom-file-wrapper:hover .custom-file-label {
  border-color: #38bdf8;
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.custom-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
  margin-inline-end: 8px;
  flex-shrink: 0;
}

.custom-file-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 120px;
}

.custom-file-text.has-file {
  color: #34d399;
  font-weight: 500;
}

@media (max-width: 540px) {
  .custom-file-wrapper {
    min-width: 0;
  }
  .custom-file-btn {
    padding: 5px 8px;
    font-size: 0.75rem;
    gap: 4px;
    margin-inline-end: 6px;
  }
  .custom-file-text {
    font-size: 0.75rem;
    min-width: 0;
  }
}

/* ==========================================================================
   LANDING PAGE STYLES (NetFlux Storefront & Showcase)
   ========================================================================== */
#sec-landing.landing-wrapper,
.landing-wrapper {
  display: block;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding-bottom: 48px;
  box-sizing: border-box;
}

#sec-landing > * + * {
  margin-top: 48px;
}

/* Landing Hero Section */
.landing-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 36px;
  align-items: center;
  padding: 36px 24px;
  background: radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.1) 0%, rgba(99, 102, 241, 0.05) 50%, transparent 80%),
              rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 28px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 20px 45px -15px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  position: relative;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.landing-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.25) 0%, transparent 70%);
  filter: blur(50px);
  pointer-events: none;
}

@media (min-width: 992px) {
  .landing-hero {
    grid-template-columns: 1.25fr 0.95fr;
    padding: 56px 48px;
    gap: 48px;
  }
}

.landing-hero-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 2;
}

.landing-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 8px 16px;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-full);
  color: #38bdf8;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.2);
}

.landing-badge-pill i {
  font-size: 0.85rem;
  color: #38bdf8;
}

.landing-hero-title {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.4;
  background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 40%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
}

@media (min-width: 768px) {
  .landing-hero-title {
    font-size: 2.5rem;
  }
}

.landing-hero-subtitle {
  font-size: 1rem;
  color: #94a3b8;
  line-height: 1.75;
  margin: 0;
}

.landing-cta-group {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.landing-cta-group .btn {
  padding: 12px 26px;
  font-weight: 700;
  border-radius: 16px;
  font-size: 0.95rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.landing-cta-group .btn:hover {
  transform: translateY(-2px);
}

.landing-hero-auth-card {
  z-index: 2;
}

.landing-hero-auth-card .card {
  border-radius: 28px !important;
}

/* Landing Stats Row */
.landing-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .landing-stats-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
  }
}

.landing-stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 20px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  backdrop-filter: blur(8px);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.landing-stat-card:hover {
  transform: translateY(-4px);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 12px 28px -10px rgba(56, 189, 248, 0.22);
}

.landing-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 12px;
}

.landing-stat-value {
  font-size: 1.45rem;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 4px;
}

.landing-stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Landing Section Header */
.landing-section-header {
  text-align: center;
  margin-bottom: 28px;
}

.landing-section-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 8px;
}

.landing-section-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* Landing Features Grid */
.landing-features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 640px) {
  .landing-features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .landing-features-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.landing-feature-card {
  padding: 28px 24px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
}

.landing-feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 12px 30px -10px rgba(56, 189, 248, 0.18);
}

.landing-feature-icon-box {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.landing-feature-icon-box.cyan {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.landing-feature-icon-box.indigo {
  background: rgba(99, 102, 241, 0.12);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.landing-feature-icon-box.emerald {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.landing-feature-icon-box.amber {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.landing-feature-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
}

.landing-feature-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin: 0;
}

/* Landing Showcase Plans Grid */
.landing-plans-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 640px) {
  .landing-plans-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .landing-plans-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.landing-plan-card {
  padding: 28px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-color);
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.landing-plan-card:hover {
  transform: translateY(-5px);
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 15px 35px -10px rgba(56, 189, 248, 0.25);
}

.landing-plan-badge {
  position: absolute;
  top: 20px;
  left: 20px;
  padding: 4px 12px;
  background: linear-gradient(135deg, #0284c7, #6366f1);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: var(--radius-full);
}

[dir="ltr"] .landing-plan-badge {
  left: auto;
  right: 20px;
}

.landing-plan-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #f8fafc;
  margin: 0 0 8px 0;
}

.landing-plan-price {
  font-size: 1.6rem;
  font-weight: 800;
  color: #38bdf8;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.landing-plan-price span.unit {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
}

.landing-plan-specs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.landing-plan-spec-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: #cbd5e1;
}

.landing-plan-spec-item i {
  color: #34d399;
  font-size: 0.95rem;
}

.landing-plan-card .btn {
  border-radius: 16px;
}

/* Landing Client Apps Section */
.landing-apps-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .landing-apps-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.landing-app-card {
  padding: 24px 20px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  transition: all 0.25s ease;
}

.landing-app-card:hover {
  transform: translateY(-4px);
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(15, 23, 42, 0.85);
}

.landing-app-card .btn {
  border-radius: 14px;
}

.landing-app-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: rgba(56, 189, 248, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #38bdf8;
}

.landing-app-name {
  font-weight: 700;
  font-size: 1rem;
  color: #f8fafc;
}

.landing-app-os {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.08);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

/* Landing FAQ Section */
.landing-faq-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.landing-faq-item {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.landing-faq-item:hover {
  border-color: rgba(56, 189, 248, 0.35);
}

.landing-faq-question {
  padding: 18px 24px;
  font-weight: 700;
  font-size: 1rem;
  color: #f8fafc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.landing-faq-question i {
  color: #38bdf8;
  transition: transform 0.3s ease;
}

.landing-faq-answer {
  padding: 0 24px 20px 24px;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* Landing trust badges */
.landing-trust-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: 20px;
}

.landing-trust-badges[hidden] {
  display: none;
}

.landing-trust-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 104px;
  min-height: 84px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.landing-trust-badge:hover {
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-2px);
}

.landing-trust-badge img {
  display: block;
  width: auto;
  max-width: 120px;
  max-height: 72px;
  object-fit: contain;
}

/* Landing Bottom CTA Banner */
.landing-cta-banner {
  text-align: center;
  padding: 48px 32px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.15) 0%, rgba(99, 102, 241, 0.15) 100%), rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  box-shadow: 0 18px 40px -10px rgba(56, 189, 248, 0.22);
  width: 100%;
  box-sizing: border-box;
}

.landing-cta-banner h3 {
  font-size: 1.7rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
}

.landing-cta-banner p {
  font-size: 1rem;
  color: #cbd5e1;
  margin: 0;
  max-width: 540px;
}

.landing-cta-banner .btn {
  border-radius: 16px;
  padding: 12px 28px;
}
