/* ================== ACCOUNT LIST ================== */
/* ================== ACCOUNT LIST (Responsive Grid) ================== */
.account-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

/* Mobile: Single column */
@media (max-width: 639px) {
  .account-list {
    grid-template-columns: 1fr;
  }
}

/* Tablet: Two columns */
@media (min-width: 640px) and (max-width: 1023px) {
  .account-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Desktop: Auto-fill based on container */
@media (min-width: 1024px) {
  .account-list {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

.account-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  /* ⭐ 4. Touchable Feel - Heavy Shadow */
  box-shadow: 0 8px 18px rgba(0,0,0,0.06);
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.18s ease;
  /* mobile-opt: will-change removed to save GPU memory */
  /* will-change: transform, box-shadow, border-color; */
  /* Text overflow handling */
  min-width: 0;
  /* Ensure card is clickable */
  position: relative;
  /* Prevent scroll from canceling tap - CRITICAL for mobile */
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  z-index: 1;
  /* ⭐ 8. Entry Animation with stagger support */
  animation: cardEnter 0.32s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  animation-delay: calc(var(--card-index, 0) * 40ms);
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.account-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 32px rgba(0,0,0,0.12);
  border-color: var(--border-light);
}

.account-card:active {
  transform: scale(0.96);
}

/* Selection mode styles */
body.selection-mode .account-card:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* ⭐ Selected State - Powerful */
.account-card.selected {
  border: 2px solid var(--accent-primary);
  background: linear-gradient(180deg, var(--bg-secondary), rgba(99,102,241,0.1));
  box-shadow: 0 0 0 4px rgba(99,102,241,0.15);
  /* Tap feedback animation - feels native like Telegram multi-select */
  transform: scale(0.98);
  transition: transform 120ms ease, border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.account-card:not(.selected) {
  transform: scale(1);
  transition: transform 120ms ease, border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

/* ⭐ SELECTION CHECKBOX - Clean UX */
.selection-checkbox {
  position: relative;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10; /* Ensure above pseudo-elements */
  pointer-events: auto; /* Ensure clicks register */
}

.selection-checkbox input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  cursor: pointer;
}

.selection-checkbox .checkmark {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-tertiary);
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.selection-checkbox:hover .checkmark {
  border-color: var(--accent-primary);
}

.selection-checkbox input:checked + .checkmark {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.selection-checkbox input:checked + .checkmark::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

/* Selected card enhanced styling with checkbox */
.account-card.selected .selection-checkbox .checkmark {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.account-card.selected .selection-checkbox .checkmark::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

/* Selection mode styles */
body.selection-mode .account-card {
  cursor: pointer;
  user-select: none;
}

body.selection-mode.is-dragging .account-card {
  cursor: grabbing;
}

/* HIDE CSS-generated checkbox - using HTML checkbox instead */
body.selection-mode .account-card::before {
  display: none; /* HTML .selection-checkbox handles this */
}

body.selection-mode .account-card.selected::before {
  display: none;
}

body.selection-mode .account-card {
  /* No padding-left needed - checkbox is in HTML */
}

.account-checkbox {
  width: 22px;
  height: 22px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.account-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.account-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  min-width: 0;
}

.account-id {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 80px;
}

@media (max-width: 480px) {
  .account-label { display: none; }
  .account-id { font-size: 13px; }
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.status-pill.online {
  background: rgba(34, 197, 94, 0.15);
  color: var(--online);
}

.status-pill.offline {
  background: rgba(239, 68, 68, 0.15);
  color: var(--offline);
}

.account-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.balance {
  font-weight: 500;
  color: var(--text-primary);
}

.balance.low {
  color: var(--accent-danger);
}

.config-badges {
  display: flex;
  gap: 6px;
}

.config-badge {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.config-badge.active {
  background: rgba(34, 197, 94, 0.2);
  color: var(--accent-success);
}

.chevron-right {
  color: var(--text-muted);
}

/* ================== ACTION GRID ================== */
.action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.action-card {
  background: linear-gradient(180deg, var(--bg-secondary), var(--bg-tertiary));
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.15s ease;
  color: var(--text-primary);
  font-size: 12px;
  box-shadow:
    0 6px 14px rgba(0,0,0,0.08),
    inset 0 1px 0 rgba(255,255,255,0.06);
  position: relative;
  overflow: hidden;
}

.action-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 12px 24px rgba(0,0,0,0.12),
    inset 0 1px 0 rgba(255,255,255,0.06);
}

.action-card:active {
  transform: scale(0.94);
  box-shadow:
    inset 0 4px 10px rgba(0,0,0,0.12);
}

.action-card.danger {
  color: var(--accent-danger);
  border-color: rgba(239, 68, 68, 0.3);
}

.action-icon {
  width: 24px;
  height: 24px;
  color: var(--accent-primary);
}

.action-card.danger .action-icon {
  color: var(--accent-danger);
}

.detail-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
}

.detail-section h3 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Live Cashout Section */
.live-cashout-section {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-elevated) 100%);
  border: 2px solid var(--accent-success);
  border-radius: var(--radius-md);
  padding: 20px;
  margin: 16px 0;
  animation: pulse-border 1s ease-in-out infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: var(--accent-success); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50% { border-color: #4ade80; box-shadow: 0 0 20px 5px rgba(34, 197, 94, 0.2); }
}

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

.cashout-multiplier {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-success);
}

.cashout-amount {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 16px;
}

.cashout-progress {
  height: 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-success), #4ade80);
  border-radius: 3px;
  transition: width 0.1s linear;
  width: 0%;
}

.btn-cashout {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--accent-success), #16a34a);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.2s;
  animation: pulse-btn 0.5s ease-in-out infinite;
}

@keyframes pulse-btn {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.btn-cashout:hover {
  background: linear-gradient(135deg, #4ade80, #22c55e);
}

.btn-cashout:active {
  transform: scale(0.98);
}

/* Floating Cashout Widget - Minimal */
.floating-cashout {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 180px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-floating-widget); /* 90 - below modal layer */
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.2s ease;
}

.floating-cashout.minimized {
  width: auto;
  min-width: 80px;
}

.floating-cashout.minimized .cashout-widget-body,
.floating-cashout.minimized .cashout-widget-body * {
  display: none !important;
}

/* ── Header ── */
.cashout-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.floating-cashout.minimized .cashout-widget-header {
  border-bottom: none;
  border-radius: var(--radius-md);
}

/* Live dot + account name row */
.cashout-widget-status {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-danger);
  box-shadow: 0 0 4px var(--accent-danger);
  animation: widgetLivePulse 1.2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes widgetLivePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.cashout-widget-live {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-danger);
  letter-spacing: 0.05em;
}

.cashout-widget-sep {
  font-size: 10px;
  color: var(--text-muted);
}

.cashout-widget-account {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Balance block in header (top-right) */
.cashout-widget-balance {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  margin-right: 6px;
}

.cashout-widget-balance-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#floating-balance {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.cashout-widget-multiplier {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.cashout-widget-minimize {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Body ── */
.cashout-widget-body {
  padding: 12px;
}

/* Two-column metrics */
.cashout-widget-metrics {
  display: flex;
  align-items: stretch;
  margin-bottom: 10px;
}

.cashout-metric-divider {
  width: 1px;
  background: var(--border-color);
  margin: 0 10px;
  align-self: stretch;
}

.cashout-widget-amount {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.cashout-widget-profit {
  font-size: 11px;
  font-weight: 500;
  margin-top: 2px;
}

/* Trend arrow */
.cashout-widget-trend {
  font-size: 11px;
  font-weight: 600;
  margin-left: 4px;
}

.cashout-widget-trend.up   { color: var(--accent-success); }
.cashout-widget-trend.down { color: var(--accent-danger); }

/* Progress bar */
.cashout-widget-progress {
  height: 3px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}

.cashout-widget-bar {
  height: 100%;
  background: #ffffff;
  border-radius: 2px;
  transition: width 0.1s linear;
  width: 0%;
}

/* ── Cashout button — black/white ── */
.btn-cashout-floating {
  width: 100%;
  padding: 11px;
  background: #ffffff;
  color: #0a0a0a;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.2s ease;
  animation: floatingBtnPulse 2s ease-in-out infinite;
  box-shadow: 0 2px 10px rgba(255, 255, 255, 0.12);
}

@keyframes floatingBtnPulse {
  0%, 100% { box-shadow: 0 2px 10px rgba(255,255,255,0.12); }
  50%       { box-shadow: 0 2px 18px rgba(255,255,255,0.28); }
}

.btn-cashout-floating:hover {
  background: #f0f0f0;
  transform: translateY(-1px);
  animation: none;
}

.btn-cashout-floating:active {
  transform: scale(0.98);
  animation: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.stat-item {
  text-align: center;
}

.stat-item .stat-label {
  display: block;
  margin-bottom: 4px;
}

.stat-item .stat-value {
  font-size: 16px;
  color: var(--text-primary);
}

.settings-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.setting-row-simple {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
}

.setting-row-simple:last-child {
  border-bottom: none;
}

.setting-row-simple span:first-child {
  color: var(--text-secondary);
}

.setting-row-simple span:last-child {
  font-weight: 500;
  color: var(--accent-success);
}

.setting-row-simple span:last-child.inactive {
  color: var(--text-muted);
}

/* ================== TAB DISPLACED OVERLAY ================== */
#tab-displaced-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
}

#tab-displaced-overlay.visible {
  display: flex;
}

.tdo-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 40px 36px;
  max-width: 360px;
  width: 90%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}

.tdo-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: rgba(79, 140, 255, 0.1);
  border: 1px solid rgba(79, 140, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
}

.tdo-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.tdo-msg {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

.tdo-btn {
  width: 100%;
  padding: 11px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--accent-primary);
  background: var(--accent-primary);
  color: #fff;
  transition: filter 0.15s;
}

.tdo-btn:hover { filter: brightness(1.1); }

.tdo-btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-color);
}

.tdo-btn-ghost:hover { color: var(--text-primary); border-color: var(--text-muted); filter: none; }

/* ================== TOASTS ================== */
.toast-container {
  position: fixed;
  top: calc(var(--header-height) + 12px + var(--safe-top));
  left: 16px;
  right: 16px;
  z-index: var(--z-toast);
  pointer-events: none;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  pointer-events: auto;
}

.toast.success { border-left: 3px solid var(--accent-success); }
.toast.error { border-left: 3px solid var(--accent-danger); }
.toast.warning { border-left: 3px solid var(--accent-warning); }
.toast.info { border-left: 3px solid var(--accent-primary); }

.toast span { flex: 1; }

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.toast-close:hover { opacity: 1; }

@keyframes slideIn {
  from { 
    opacity: 0; 
    transform: translateY(-20px);
  }
  to { 
    opacity: 1; 
    transform: translateY(0);
  }
}

.amount-input-lg {
  width: 100%;
  height: 60px;
  padding: 0 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 16px;
}

.quick-amounts {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.chip {
  height: 40px;
  padding: 0 20px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.2s;
}

.chip:active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  font-size: 13px;
}

.activity-action {
  font-weight: 500;
  margin-bottom: 4px;
}

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

/* ================== NOTIFICATIONS ================== */
.notifications-container {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 320px;
  z-index: var(--z-toast); /* 600 - above modal */
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.notifications-container .notification {
  pointer-events: auto;
}

.notification {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.notification.success {
  border-left: 4px solid var(--accent-success);
}

.notification.error {
  border-left: 4px solid var(--accent-danger);
}

.notification.warning {
  border-left: 4px solid var(--accent-warning);
}

.notification.info {
  border-left: 4px solid var(--accent-primary);
}

.notification-icon {
  flex-shrink: 0;
}

.notification-content {
  flex: 1;
}

.notification-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.notification-message {
  font-size: 14px;
  color: var(--text-secondary);
}

.notification-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

.notification.hiding {
  animation: slideOutRight 0.3s ease forwards;
}

.notifications-container {
  z-index: var(--z-toast);
}

/* ================== LOADING SKELETON ================== */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 25%,
    var(--border-light) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  height: 80px;
  margin-bottom: 12px;
}

/* ================== PAGINATION ================== */
.pagination-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  gap: 16px;
  flex-wrap: wrap;
  flex-shrink: 0;
  /* Sticky positioning at bottom of content */
  position: sticky;
  bottom: 0;
  z-index: var(--z-pagination);
  /* Shadow for separation */
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}

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

.page-size-select {
  /* Remove native browser styling */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  
  /* Layout */
  padding: 8px 36px 8px 12px;
  min-width: 70px;
  height: 36px;
  
  /* Visual */
  background: var(--bg-elevated);
  background-image: url("data:image/svg+xml;utf8,<svg fill='%236b7280' height='20' viewBox='0 0 20 20' width='20' xmlns='http://www.w3.org/2000/svg'><path d='M5.5 7l4.5 5 4.5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  
  /* Typography */
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  
  /* Interaction */
  cursor: pointer;
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.18s ease;
}

.page-size-select:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.page-size-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.pagination-info {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.pagination-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  /* mobile-opt: will-change removed to save GPU memory */
  /* will-change: transform, box-shadow; */
}

.pagination-btn:hover:not(:disabled) {
  background: var(--border-light);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.pagination-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.95);
}

.pagination-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.pagination-btn:disabled,
.pagination-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.pagination-ellipsis {
  padding: 0 8px;
  color: var(--text-muted);
  font-size: 13px;
  user-select: none;
}

/* Mobile pagination adjustments */
@media (max-width: 640px) {
  .pagination-container {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px;
  }
  
  .pagination-left {
    justify-content: center;
    order: 2; /* Move below page numbers */
  }
  
  .pagination-controls {
    justify-content: center;
    order: 1;
  }
  
  .pagination-btn {
    min-width: 44px;
    height: 44px;
    font-size: 14px;
  }
  
  .pagination-ellipsis {
    display: none; /* Hide ellipsis on small screens */
  }
}

/* ================== QUICK SELECT PANEL ================== */
.quick-select-panel {
  transition: opacity 0.2s, transform 0.2s;
}

.quick-select-btn {
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.15s;
  font-weight: 500;
}

.quick-select-btn:hover {
  transform: translateX(2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.quick-select-btn:active {
  transform: translateX(1px);
}


/* ================== FREEBET UI COMPONENTS ================== */

/* Stat card loading state */
.stat-card.checking {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Freebet filter banner */
.freebet-filter-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-success);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.freebet-filter-banner span {
  color: var(--text-secondary);
}

.freebet-filter-banner span strong {
  color: var(--accent-success);
  font-weight: 600;
}

.freebet-filter-banner .btn-text {
  color: var(--accent-success);
  font-size: 13px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.15s;
}

.freebet-filter-banner .btn-text:hover {
  background: rgba(34, 197, 94, 0.1);
}

/* Freebet action modal */
.freebet-action-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
}

.freebet-modal-content {
  position: relative;
  width: 90%;
  max-width: 360px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.freebet-summary {
  text-align: center;
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.freebet-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.freebet-actions button {
  justify-content: center;
  gap: 8px;
}

/* Freebet quick menu */
.freebet-quick-menu {
  position: fixed;
  z-index: var(--z-modal);
}

.freebet-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.freebet-menu-content {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  min-width: 280px;
  max-width: 320px;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.2s ease;
}

@keyframes popIn {
  from { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

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

.freebet-menu-header h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-success);
}

.freebet-menu-body {
  padding: 16px;
}

.freebet-total {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.freebet-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.freebet-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.freebet-amount {
  font-weight: 600;
  color: var(--text-primary);
}

.freebet-count {
  font-size: 13px;
  color: var(--accent-success);
  font-weight: 500;
}

.freebet-menu-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px 16px;
}

.freebet-menu-actions button {
  justify-content: center;
  gap: 8px;
}


/* ================== OFFLINE DISABLED STATE ================== */
.account-card.offline-disabled {
  opacity: 0.6;
  filter: grayscale(40%);
  background: var(--bg-tertiary);
}

/* Disable click navigation on account info but keep card interactive for swipe */
.account-card.offline-disabled .account-info {
  pointer-events: none;
}

/* Ensure swipeable offline cards can still receive touch events */
.account-card.offline-disabled.swipeable {
  pointer-events: auto;
  cursor: grab;
}

.account-card.offline-disabled.swipeable:active {
  cursor: grabbing;
}

/* Remove hover effects for offline cards */
.account-card.offline-disabled:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border-color);
}

/* Selection mode cursor feedback - show selection cursor */
body.selection-mode .account-card {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

body.selection-mode .account-card:not(.offline-disabled):hover {
  cursor: pointer;
}

/* In selection mode, still show disabled state but allow swipe */
body.selection-mode .account-card.offline-disabled {
  border-color: var(--border-color);
  box-shadow: none;
}

body.selection-mode .account-card.offline-disabled.swipeable {
  cursor: grab;
}

body.selection-mode .account-card.offline-disabled:hover {
  border-color: var(--border-color);
  box-shadow: none;
}

/* Selection checkbox is hidden for offline cards in selection mode */
body.selection-mode .account-card.offline-disabled::before {
  display: none;
}

/* Remove left padding for offline cards in selection mode (no checkbox) */
body.selection-mode .account-card.offline-disabled {
  padding-left: 16px;
}

/* Freebet indicator on account card */
.freebet-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-success);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

/* Mobile adjustments */
@media (max-width: 639px) {
  .freebet-menu-content {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    transform: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-width: none;
    animation: slideUp 0.3s ease;
  }
  
  @keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  
  .freebet-quick-menu {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: flex-end;
  }
}

/* ================== OFFLINE DELETE MODAL ================== */
#offline-delete-modal .delete-account-info {
  margin-bottom: 20px;
}

#offline-delete-modal .delete-account-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

#offline-delete-modal .delete-account-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

#offline-delete-modal .delete-account-avatar-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-tertiary);
}

#offline-delete-modal .delete-account-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#offline-delete-modal .delete-account-name {
  font-weight: 600;
  color: var(--text-primary);
}

#offline-delete-modal .delete-account-id {
  font-size: 12px;
  color: var(--text-secondary);
}

#offline-delete-modal .offline-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid var(--accent-danger);
  border-radius: 4px;
  color: var(--accent-danger);
  font-size: 11px;
  font-weight: 600;
  width: fit-content;
}

#offline-delete-modal .delete-warning {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 12px;
}

#offline-delete-modal .delete-warning-highlight {
  color: var(--accent-danger);
  font-weight: 600;
  font-size: 14px;
}

#offline-delete-modal .modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

#offline-delete-modal .btn-danger {
  background: var(--accent-danger);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.2s;
}

#offline-delete-modal .btn-danger:hover {
  background: #dc2626;
}

/* Account card deleting state */
.account-card.deleting {
  position: relative;
}

.account-card.deleting::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.account-card.deleting::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-light);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  z-index: 10;
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ================== MODAL OVERLAY SYSTEM ================== */

/* Modal Root Container - Global mount point for all modals */
/* Placed at end of body to avoid stacking context issues */
#modal-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-modal);
}

#modal-root:has(.modal-overlay) {
  pointer-events: auto;
}

/* Body class when modal is open - prevents background scroll */
body.modal-open {
  overflow: hidden;
}

/* Modal Overlay Backdrop */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  overflow-y: auto;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Modal Card */
.modal-card {
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 
    0 25px 50px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  transform: scale(0.95) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

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

/* Modal Header */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-secondary);
  color: var(--text-primary);
  transform: rotate(90deg);
}

/* Modal Body */
.modal-body {
  padding: 24px;
  overflow-y: auto;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
  flex: 1;
  min-height: 0;
}

/* Modal Footer */
.modal-footer {
  display: flex;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.modal-footer .btn {
  flex: 1;
}

/* Modal Stacking Support */
.modal-overlay[data-stack="0"] { z-index: var(--z-modal); }
.modal-overlay[data-stack="1"] { z-index: calc(var(--z-modal) + 10); }
.modal-overlay[data-stack="2"] { z-index: calc(var(--z-modal) + 20); }
.modal-overlay[data-stack="3"] { z-index: calc(var(--z-modal) + 30); }

/* Ensure ModalSystem modals appear above everything */
#modal-root .modal-overlay {
  z-index: var(--z-modal);
}

/* ================== AVATAR MODAL SPECIFIC ================== */

/* Avatar grid with better scrolling */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  padding: 4px;
  max-height: 60vh;
  overflow-y: auto;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}

/* Custom scrollbar for avatar grid */
.avatar-grid::-webkit-scrollbar {
  width: 6px;
}

.avatar-grid::-webkit-scrollbar-track {
  background: transparent;
}

.avatar-grid::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

.avatar-grid::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.avatar-item {
  aspect-ratio: 1;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  min-height: 60px;
}

.avatar-item:hover {
  border-color: var(--accent-primary);
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.avatar-item.selected {
  border-color: var(--accent-success);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.1);
}

.avatar-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  transition: transform 0.2s ease;
}

.avatar-item:hover img {
  transform: scale(1.1);
}

/* Avatar Loading Skeleton */
.avatar-skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--border-color) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Avatar Loading State */
.avatar-grid.loading .avatar-item {
  pointer-events: none;
}

/* ================== PROFILE MODAL ================== */

.profile-options {
  display: flex;
  gap: 16px;
  padding: 8px;
}

.profile-option-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 24px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.2s ease;
}

.profile-option-btn:hover {
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.1);
  transform: translateY(-2px);
}

.profile-option-btn i {
  width: 48px;
  height: 48px;
  color: var(--accent-primary);
}

.profile-option-btn span {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ================== FREEBET MODAL ================== */

.freebet-amount-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.freebet-amount-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.2s ease;
}

.freebet-amount-btn:hover {
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.1);
}

.freebet-amount-btn .amount {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-success);
}

.freebet-amount-btn .count {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ================== MOBILE MODAL ADJUSTMENTS ================== */

@media (max-width: 640px) {
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  
  .modal-card {
    max-width: 100%;
    max-height: 85vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(100%);
    animation: modal-slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }
  
  @keyframes modal-slide-up {
    to { transform: translateY(0); }
  }
  
  .modal-header {
    padding: 16px 20px;
  }
  
  .modal-body {
    padding: 20px;
  }
  
  .modal-footer {
    padding: 16px 20px;
  }
  
  .avatar-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-height: 50vh;
  }
  
  .avatar-item {
    padding: 4px;
    min-height: 50px;
  }
  
  .profile-options {
    flex-direction: column;
    gap: 12px;
  }
  
  .profile-option-btn {
    padding: 24px;
    flex-direction: row;
    justify-content: center;
  }
}

/* ================== REDESIGNED SETTINGS PAGE ================== */

/* Settings Page Layout */
#page-settings {
  padding-bottom: 100px;
}

@media (max-width: 768px) {
  #page-settings {
    padding-bottom: 70px;
  }
}

/* Context Bar - Account Selector */
.settings-context-bar {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.context-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.context-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.context-dropdown-wrapper {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.context-dropdown {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  height: 42px;
  appearance: none;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 12px 40px 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.context-dropdown:hover {
  border-color: var(--border-hover);
}

.context-dropdown:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.context-dropdown option {
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 8px;
}

.override-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-radius: 20px;
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

.default-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  border-radius: 20px;
}

.bulk-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 13px;
}

.bulk-banner i {
  color: var(--accent-primary);
}

.bulk-banner strong {
  color: var(--accent-primary);
  font-weight: 600;
}

/* Settings Grid */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

@media (max-width: 480px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

/* Settings Card */
.settings-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.settings-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

.settings-card.highlighted {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px;
  background: linear-gradient(180deg, var(--bg-tertiary), var(--bg-secondary));
  border-bottom: 1px solid var(--border-default);
}

.card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: var(--radius-lg);
  color: white;
  flex-shrink: 0;
}

.card-icon i {
  width: 20px;
  height: 20px;
}

.card-title-group {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}

.card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.global-badge {
  padding: 3px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
}

.card-body {
  padding: 16px 20px;
}

/* Setting Row */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-default);
}

.setting-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.setting-row:first-child {
  padding-top: 0;
}

.setting-row.compact {
  padding: 8px 0;
}

.setting-row.stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.setting-label-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.setting-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.setting-hint {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* Input Fields */
.input-field {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  min-width: 120px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-field:hover {
  border-color: var(--border-hover);
}

.input-field:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.input-field.narrow {
  width: 100px;
  text-align: right;
}

.input-field.select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

/* Input Pair */
.input-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
}

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

.input-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-secondary);
}

.input-group .input-field {
  width: 100%;
}

/* Modern Switch */
.switch.modern {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.switch.modern input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch.modern .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  transition: .3s;
  border-radius: 28px;
}

.switch.modern .slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: .3s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.switch.modern input:checked + .slider {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-color: transparent;
}

.switch.modern input:checked + .slider:before {
  transform: translateX(24px);
}

.switch.modern input:focus + .slider {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

/* Sticky Action Bar — hidden by default, shown only on settings page */
.settings-action-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-default);
  padding: 16px 20px;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.sidebar-visible ~ #main-content .settings-action-bar,
.sidebar-visible .settings-action-bar {
  left: var(--sidebar-width);
}

/* Short/full button labels */
.btn-label-short { display: none; }
.btn-label-full  { display: inline; }

@media (max-width: 768px) {
  .settings-action-bar {
    left: 0 !important;
    padding: 10px 12px;
  }

  .action-bar-content {
    gap: 8px;
  }

  .action-status .status-text {
    display: none;
  }

  .btn-label-full  { display: none; }
  .btn-label-short { display: inline; }

  .action-buttons {
    gap: 6px;
  }

  .action-buttons .btn {
    padding: 8px 12px;
    font-size: 13px;
  }
}

.action-bar-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.action-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-dot.dirty {
  background: var(--warning);
  animation: none;
}

.status-dot.saved {
  background: var(--success);
  animation: none;
}

.status-dot.error {
  background: var(--danger);
  animation: none;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-bulk {
  background: linear-gradient(135deg, #8b5cf6, #6366f1) !important;
}

.btn-bulk:hover {
  background: linear-gradient(135deg, #7c3aed, #4f46e5) !important;
}

.btn-all {
  background: linear-gradient(135deg, #059669, #10b981) !important;
  color: #fff !important;
  border: none;
}

.btn-all:hover {
  background: linear-gradient(135deg, #047857, #059669) !important;
}

.btn-secondary {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
}

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

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

.btn-sm i {
  width: 14px;
  height: 14px;
}

/* Icon Sizes */
.icon-xs {
  width: 14px;
  height: 14px;
}

.icon-sm {
  width: 18px;
  height: 18px;
}

/* Hidden state */
.hidden {
  display: none !important;
}

/* Hide Global-Only Cards When Editing Account */
.editing-account .global-only {
  opacity: 0.5;
  pointer-events: none;
}

.editing-account .global-only .card-header::after {
  content: 'Global';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-muted);
}

/* Compact mode for many cards */
.settings-grid.compact .settings-card {
  border-radius: var(--radius-lg);
}

.settings-grid.compact .card-header {
  padding: 14px 16px;
}

.settings-grid.compact .card-body {
  padding: 12px 16px;
}

.settings-grid.compact .setting-row {
  padding: 10px 0;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .settings-context-bar {
    padding: 14px 16px;
    border-radius: var(--radius-lg);
  }
  
  .context-dropdown-wrapper {
    grid-template-columns: 1fr;
  }
  
  .action-bar-content {
    flex-direction: column;
    align-items: stretch;
  }
  
  .action-buttons {
    justify-content: stretch;
  }
  
  .action-buttons .btn {
    flex: 1;
    justify-content: center;
  }
  
  .input-pair {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}

/* Card Focus Animation */
@keyframes card-highlight {
  0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
  100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.settings-card.flash {
  animation: card-highlight 0.6s ease-out;
}

/* Dirty State Indicator */
.setting-row.dirty .setting-name::after {
  content: ' •';
  color: var(--warning);
}

/* Save Animation */
@keyframes save-success {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.settings-card.saving {
  animation: save-success 0.3s ease-out;
}


/* ================== SETTINGS LIST ITEM BUTTONS ================== */
/* ================== PROFILE MODAL ================== */

.profile-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.profile-option-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.2s ease;
}

.profile-option-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.profile-option-btn i {
  width: 24px;
  height: 24px;
  color: var(--accent-primary);
}

/* ================== AVATAR MODAL ================== */

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 12px;
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
}

.avatar-grid.loading {
  opacity: 0.6;
  pointer-events: none;
}

.avatar-item {
  aspect-ratio: 1;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform, opacity, background-color, background, border-color, box-shadow 0.2s ease;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-item:hover {
  border-color: var(--accent-primary);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.avatar-item.selected {
  border-color: var(--accent-success);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3);
}

.avatar-item img {
  width: 80%;
  height: 80%;
  object-fit: contain;
  pointer-events: none;
}

.avatar-skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-elevated) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Mobile responsive */
@media (max-width: 640px) {
  .avatar-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 12px;
  }
  
  .profile-option-btn {
    padding: 16px 20px;
    font-size: 15px;
  }
}


/* ================== ADDITIONAL RESPONSIVE MODAL IMPROVEMENTS ================== */

/* Small mobile modal optimizations */
@media (max-width: 480px) {
  .modal-card {
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
  }
  
  .modal-header {
    padding: 14px 16px;
  }
  
  .modal-title {
    font-size: 15px;
  }
  
  .modal-body {
    padding: 16px;
  }
  
  .modal-footer {
    padding: 14px 16px;
    gap: 8px;
  }
  
  .modal-footer .btn {
    padding: 12px 16px;
    font-size: 14px;
  }
  
  .modal-close {
    width: 28px;
    height: 28px;
  }
  
  /* Avatar grid smaller on mobile */
  .avatar-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 2px;
  }
  
  .avatar-item {
    padding: 6px;
  }
  
  /* Profile options more compact */
  .profile-options {
    gap: 10px;
    padding: 4px;
  }
  
  .profile-option-btn {
    padding: 18px 16px;
    gap: 10px;
  }
  
  .profile-option-btn i {
    width: 36px;
    height: 36px;
  }
  
  .profile-option-btn span {
    font-size: 13px;
  }
  
  /* Freebet amount grid */
  .freebet-amount-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .freebet-amount-btn {
    padding: 16px 12px;
  }
  
  .freebet-amount-btn .amount {
    font-size: 20px;
  }
  
  /* Freebet menu content full width on small screens */
  .freebet-menu-content {
    min-width: auto;
    max-width: none;
    width: calc(100% - 32px);
    margin: 0 16px;
  }
  
  .freebet-total {
    font-size: 20px;
  }
}

/* Extra small mobile */
@media (max-width: 360px) {
  .modal-card {
    max-height: 95vh;
  }
  
  .modal-header {
    padding: 12px 14px;
  }
  
  .modal-title {
    font-size: 14px;
  }
  
  .modal-body {
    padding: 14px;
  }
  
  .modal-footer {
    padding: 12px 14px;
    flex-direction: column;
  }
  
  .modal-footer .btn {
    width: 100%;
  }
  
  .avatar-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  
  .freebet-amount-grid {
    grid-template-columns: 1fr;
  }
}

/* Landscape mobile - side sheet style */
@media (max-height: 500px) and (orientation: landscape) {
  .modal-overlay {
    padding: 16px;
    align-items: center;
  }
  
  .modal-card {
    max-width: 100%;
    max-height: 95vh;
    border-radius: var(--radius-lg);
  }
  
  .modal-body {
    max-height: 60vh;
  }
  
  .avatar-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* ================== RESPONSIVE ACCOUNT LIST IMPROVEMENTS ================== */

/* Extra small mobile - single column tighter */
@media (max-width: 360px) {
  .account-list {
    gap: 8px;
  }
  
  .account-card {
    padding: 12px;
    border-radius: 14px;
    margin-bottom: 8px;
  }
}

/* ================== RESPONSIVE PAGINATION IMPROVEMENTS ================== */

@media (max-width: 480px) {
  .pagination-container {
    padding: 10px;
    gap: 10px;
  }
  
  .pagination-btn {
    min-width: 36px;
    height: 36px;
    font-size: 13px;
  }
  
  .pagination-info {
    font-size: 12px;
  }
}

@media (max-width: 360px) {
  .pagination-controls {
    gap: 2px;
  }
  
  .pagination-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    font-size: 12px;
  }
}

/* ================== RESPONSIVE SETTINGS IMPROVEMENTS ================== */

@media (max-width: 480px) {
  .settings-context-bar {
    padding: 12px 14px;
    margin-bottom: 16px;
  }
  
  .context-dropdown-wrapper {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .context-dropdown {
    min-width: auto;
    width: 100%;
  }
  
  .override-badge,
  .default-badge {
    align-self: flex-start;
  }
  
  .bulk-banner {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
  
  .card-header {
    padding: 16px;
  }
  
  .card-title {
    font-size: 14px;
  }
  
  .card-desc {
    font-size: 11px;
  }
  
  .card-body {
    padding: 14px 16px;
  }
  
  .setting-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 0;
  }

  .setting-row.compact {
    flex-direction: row;
    align-items: center;
  }

  .setting-row .switch.modern {
    align-self: flex-end;
  }

  .input-field {
    min-width: 0;
  }

  .input-field.narrow {
    width: 100%;
    text-align: left;
  }

  .input-pair {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .input-group .input-field {
    font-size: 13px;
    padding: 8px 10px;
  }
  
  .action-bar-content {
    flex-direction: column;
    gap: 10px;
  }
  
  .action-status {
    font-size: 12px;
  }
  
  .action-buttons {
    width: 100%;
  }
  
  .action-buttons .btn {
    flex: 1;
    padding: 12px 16px;
    font-size: 14px;
  }
}

@media (max-width: 360px) {
  .settings-context-bar {
    padding: 10px 12px;
  }
  
  .card-icon {
    width: 32px;
    height: 32px;
  }
  
  .card-icon i {
    width: 16px;
    height: 16px;
  }
}

/* Extra small mobile - avatar grid */
@media (max-width: 360px) {
  .avatar-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  
  .avatar-item {
    padding: 3px;
    min-height: 45px;
    border-radius: 8px;
  }
}

/* ================== SPIN ODDS WIDGET ================== */

.spin-odds-widget {
  margin: 0 0 12px;
  border-radius: 12px;
  background: #0f1115;
  border: 1px solid #1f2228;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.spin-odds-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  gap: 8px;
  color: #9aa0a6;
  transition: background 0.12s;
}
.spin-odds-toggle:hover { background: rgba(255,255,255,0.02); }
.spin-odds-toggle:active { background: rgba(255,255,255,0.04); }

.spin-odds-toggle-left {
  display: flex;
  align-items: center;
  gap: 7px;
}

.spin-odds-toggle-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spin-odds-label {
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.1px;
}

.spin-odds-count {
  font-size: 10px;
  font-weight: 600;
  color: #6b7280;
  background: #181b21;
  padding: 2px 7px;
  border-radius: 20px;
  line-height: 1.4;
}

.spin-odds-mini-stats {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.mini-stat-avg  { color: #9aa0a6; }
.mini-stat-high { color: #4ade80; }
.mini-stat-crash { color: #f87171; }
.mini-stat-sep  { color: #2a2d35; font-size: 9px; }

.spin-odds-chevron {
  transition: transform 0.22s ease;
  flex-shrink: 0;
  color: #6b7280;
}

.spin-odds-widget.open .spin-odds-chevron {
  transform: rotate(180deg);
}

.spin-odds-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.spin-odds-widget.open .spin-odds-body {
  max-height: 180px;
  overflow-y: auto;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
}

.spin-odds-widget.open .spin-odds-body::-webkit-scrollbar {
  width: 3px;
}
.spin-odds-widget.open .spin-odds-body::-webkit-scrollbar-track {
  background: transparent;
}
.spin-odds-widget.open .spin-odds-body::-webkit-scrollbar-thumb {
  background: #2a2d35;
  border-radius: 2px;
}

.spin-odds-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 12px 12px;
}

.spin-odd-chip {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  line-height: 1.4;
  white-space: nowrap;
  letter-spacing: -0.1px;
}

.spin-odd-chip.odd-low {
  background: rgba(239,68,68,0.08);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.14);
}
.spin-odd-chip.odd-mid {
  background: rgba(251,191,36,0.07);
  color: #fbbf24;
  border: 1px solid rgba(251,191,36,0.14);
}
.spin-odd-chip.odd-high {
  background: rgba(34,197,94,0.09);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,0.15);
}

.spin-odds-empty {
  font-size: 12px;
  color: #6b7280;
  padding: 4px 0 2px;
  font-style: italic;
}
