* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

input,
textarea,
select,
[contenteditable] {
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
}

.hidden {
  display: none !important;
}

body {
  font-family: 'Inter', sans-serif;
  display: flex;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  height: 100vh; overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  box-shadow: 4px 0 30px rgba(0, 0, 0, 0.1);
  padding: 30px 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 2px solid rgba(59, 130, 246, 0.2);
  z-index: 100;
}

.sidebar h2 {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  padding: 0 30px 30px;
  font-size: 24px;
  text-shadow: none;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #64748b;
  padding: 12px 20px 12px 26px;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  margin: 2px 12px 2px 0;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.sidebar a:hover {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.08) 0%, rgba(59, 130, 246, 0.04) 100%);
  border-left-color: #93c5fd;
  color: #2563eb;
  transform: translateX(4px);
}

.sidebar a.active-link {
  background: linear-gradient(90deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.06) 100%);
  border-left-color: #667eea;
  color: #667eea;
  font-weight: 700;
}

.sidebar a.active-link:hover {
  background: linear-gradient(90deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.1) 100%);
  color: #764ba2;
  transform: translateX(4px);
}

.sidebar a.nav-link-divider {
      /* margin-top: 16px !important; */
      border-top: 1px solid #e2e8f0 !important;
      padding-top: 16px !important;
    }

.sidebar a.nav-link-logout {
  color: #ef4444;
  display: none;
}

.sidebar a.nav-link-logout:hover {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.08) 0%, rgba(239, 68, 68, 0.03) 100%);
  border-left-color: #ef4444;
  color: #dc2626;
}

/* ── Main ── */
.main {
  flex: 1;
  padding: 40px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  margin-left: 260px;
  height: 100vh; overflow-y: auto;
}

/* ── Sidebar user section ── */
.sidebar-user {
  margin-top: auto;
  padding: 20px;
  border-top: 2px solid #e2e8f0;
  background: #ffffff;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e2e8f0;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  font-weight: 700;
}

.user-details {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-weight: 600;
  color: #1e293b;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 15px;
  color: #dc2626;
  background: white;
  border: 2px solid #ef4444;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  margin-top: 10px;
  transition: all 0.3s;
  text-decoration: none;
  cursor: pointer;
}

.logout-link:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #dc2626;
  transform: translateY(-2px);
}

/* ── Mobile toggle ── */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 1001;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
  width: 44px;
  height: 44px;
  justify-content: center;
  align-items: center;
}

.hamburger {
  width: 22px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: 0.3s;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 999;
}

.sidebar-overlay.active {
  display: block;
}

body.sidebar-open {
  overflow: hidden;
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
  }

  .sidebar {
    position: fixed;
    left: calc(-1 * 260px);
    top: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.active {
    transform: translateX(260px);
  }

  .main {
    padding: 20px 15px;
    padding-top: 70px;
    margin-left: 0 !important;
    width: 100%;
  }
}


/* ══════════════════════════════════════════
   WITHDRAWAL — DARK MODE OVERRIDES
   ══════════════════════════════════════════ */

/* Flash fix: html.dark-mode is set before body renders */
html.dark-mode,
html.dark-mode body {
  background: #0d1117 !important;
  color: #e6edf3 !important;
}
html.dark-mode .sidebar {
  background: linear-gradient(180deg, #161b22 0%, #0d1117 100%) !important;
  border-right-color: #30363d !important;
}
html.dark-mode .main {
  background: #0d1117 !important;
}

/* w-card — main flash fix */
html.dark-mode .w-card {
  background: #161b22 !important;
  border: 1px solid rgba(124,106,247,0.25) !important;
  box-shadow: 0 0 0 1px rgba(124,106,247,0.15), 0 4px 24px rgba(0,0,0,0.4) !important;
}
html.dark-mode .w-card-title {
  color: #e6edf3 !important;
  border-bottom: 2px solid rgba(124,106,247,0.25) !important;
}
html.dark-mode .shimmer-card-header {
  border-bottom-color: rgba(124,106,247,0.25) !important;
}

/* Hero banner */
html.dark-mode .hero-banner {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%)
}

/* Form inputs */
html.dark-mode .form-group label { color: #8b949e !important; }
html.dark-mode .form-group input,
html.dark-mode .form-group select,
html.dark-mode .form-group textarea {
  background: #1c2333 !important;
  border-color: #30363d !important;
  color: #e6edf3 !important;
}
html.dark-mode .form-group input:focus,
html.dark-mode .form-group select:focus,
html.dark-mode .form-group textarea:focus {
  border-color: #7c6af7 !important;
  background: #21293d !important;
}
html.dark-mode #amountPreview {
  background: #1c2333 !important;
  border-color: #30363d !important;
  color: #e6edf3 !important;
}

/* Method pills */
html.dark-mode .method-pill {
  background: #1c2333 !important;
  border-color: #30363d !important;
  color: #8b949e !important;
}
html.dark-mode .method-pill.active {
  background: linear-gradient(135deg, #7c6af7, #5b4fcf) !important;
  color: #fff !important;
  border-color: transparent !important;
}
html.dark-mode .method-pill:hover:not(.active) {
  border-color: #7c6af7 !important;
  color: #a78bfa !important;
}

/* History table — main flash fix */
html.dark-mode .history-table {
  background: #161b22 !important;
}
html.dark-mode .history-table td {
  color: #8b949e !important;
  border-bottom-color: #21293d !important;
  border-right-color: #30363d !important;
}
html.dark-mode .history-table th {
  border-right-color: rgba(255,255,255,0.1) !important;
}
html.dark-mode .history-table tbody tr:hover {
  background: #1c2333 !important;
}
html.dark-mode .amount-cell { color: #e6edf3 !important; }
html.dark-mode .method-chip {
  background: #1c2333 !important;
  color: #8b949e !important;
}

/* Badges */
html.dark-mode .badge-pending {
  background: rgba(180,83,9,0.15) !important;
  color: #fcd34d !important;
  border-color: rgba(180,83,9,0.3) !important;
}
html.dark-mode .badge-approved {
  background: rgba(6,95,70,0.15) !important;
  color: #86efac !important;
  border-color: rgba(6,95,70,0.3) !important;
}
html.dark-mode .badge-rejected {
  background: rgba(153,27,27,0.15) !important;
  color: #fca5a5 !important;
  border-color: rgba(153,27,27,0.3) !important;
}

/* View button */
html.dark-mode .view-btn {
  background: #1c2333 !important;
  border-color: #7c6af7 !important;
}

/* Reason popup */
html.dark-mode .reason-box { background: #161b22 !important; }
html.dark-mode .reason-box-header { border-bottom-color: #30363d !important; }
html.dark-mode .reason-box-close {
  background: #1c2333 !important;
  color: #8b949e !important;
}
html.dark-mode .reason-box-body {
  background: #1c2333 !important;
  border-color: #30363d !important;
  color: #e6edf3 !important;
}

/* Withdrawal detail sheet */
html.dark-mode .wd-sheet { background: #161b22 !important; }
html.dark-mode .wd-handle { background: #30363d !important; }
html.dark-mode .wd-sheet h3 { color: #e6edf3 !important; }
html.dark-mode .wd-row { border-bottom-color: #30363d !important; }
html.dark-mode .wd-label { color: #484f58 !important; }
html.dark-mode .wd-value { color: #e6edf3 !important; }

/* Confirm overlay */
html.dark-mode #confirmOverlay > div { background: #161b22 !important; }
html.dark-mode #confirmDetails {
  background: #1c2333 !important;
  border-color: #30363d !important;
}

/* Shimmer */
html.dark-mode .shimmer-dark {
  background: linear-gradient(90deg, #1c2333 25%, #21293d 50%, #1c2333 75%) !important;
  background-size: 600px 100% !important;
}

/* Sidebar elements */
html.dark-mode .sidebar h2 { -webkit-text-fill-color: #a78bfa !important; }
html.dark-mode .sidebar a { color: #8b949e !important; }
html.dark-mode .sidebar a:hover {
  background: rgba(124,106,247,0.08) !important;
  color: #a78bfa !important;
}
html.dark-mode .sidebar a.active-link {
  background: rgba(124,106,247,0.12) !important;
  color: #a78bfa !important;
}
html.dark-mode .sidebar-header { border-bottom-color: #30363d !important; }
html.dark-mode .sidebar-user {
  background: #161b22 !important;
  border-top-color: #30363d !important;
}
html.dark-mode .user-name { color: #e6edf3 !important; }
html.dark-mode .user-email { color: #8b949e !important; }
html.dark-mode .user-info { border-bottom-color: #30363d !important; }
html.dark-mode .logout-link {
  background: #161b22 !important;
  color: #f87171 !important;
  border-color: #f87171 !important;
}

/* Toggle */
html.dark-mode .sb-nm-toggle { background: #1e2535 !important; }
html.dark-mode .sb-nm-knob { left: 52px !important; background: #2d3748 !important; }
html.dark-mode .sb-nm-label-light { opacity: 0 !important; }
html.dark-mode .sb-nm-label-dark  { opacity: 1 !important; }
html.dark-mode .sb-nm-wrap { border-top-color: #30363d !important; }
html.dark-mode .sb-nm-wrap-label { color: #8b949e !important; }

body.dark-mode {
  background: #0d1117 !important;
  color: #e6edf3 !important;
}

body.dark-mode .main {
  background: #0d1117 !important;
}

body.dark-mode .sidebar {
  background: linear-gradient(180deg, #161b22 0%, #0d1117 100%) !important;
  border-right-color: #30363d !important;
}

body.dark-mode .sidebar h2 {
  -webkit-text-fill-color: #a78bfa !important;
}

body.dark-mode .sidebar a {
  color: #8b949e !important;
}

body.dark-mode .sidebar a:hover {
  background: rgba(124, 106, 247, 0.08) !important;
  color: #a78bfa !important;
  /* border-left-color: #7c6af7 !important; */
}

body.dark-mode .sidebar a.active-link {
  background: rgba(124, 106, 247, 0.12) !important;
  color: #a78bfa !important;
  /* border-left-color: #7c6af7 !important; */
}

body.dark-mode .sidebar-user {
  background: #161b22 !important;
  border-top-color: #30363d !important;
}

body.dark-mode .user-info {
  border-bottom-color: #30363d !important;
}

body.dark-mode .user-name {
  color: #e6edf3 !important;
}

body.dark-mode .user-email {
  color: #8b949e !important;
}

body.dark-mode .logout-link {
  background: #161b22 !important;
  color: #f87171 !important;
  border-color: #f87171 !important;
}

body.dark-mode .logout-link:hover {
  background: rgba(248, 113, 113, 0.1) !important;
}

body.dark-mode .w-card {
  background: #161b22 !important;
  border: 1px solid rgba(124,106,247,0.25) !important;
  box-shadow: 0 0 0 1px rgba(124,106,247,0.15), 0 4px 24px rgba(0,0,0,0.4) !important;
}

body.dark-mode .w-card-title {
  color: #e6edf3 !important;
  border-bottom: 2px solid rgba(124,106,247,0.25) !important;
}

body.dark-mode .shimmer-card-header {
  border-bottom-color: rgba(124,106,247,0.25) !important;
}

body.dark-mode .form-group label {
  color: #8b949e !important;
}

body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode .form-group textarea {
  background: #1c2333 !important;
  border-color: #30363d !important;
  color: #e6edf3 !important;
}

body.dark-mode .form-group input:focus,
body.dark-mode .form-group select:focus,
body.dark-mode .form-group textarea:focus {
  border-color: #7c6af7 !important;
  background: #21293d !important;
}

body.dark-mode .method-pill {
  background: #1c2333 !important;
  border-color: #30363d !important;
  color: #8b949e !important;
}

body.dark-mode .method-pill.active {
  background: linear-gradient(135deg, #7c6af7, #5b4fcf) !important;
  color: #fff !important;
  border-color: transparent !important;
}

body.dark-mode .method-pill:hover:not(.active) {
  border-color: #7c6af7 !important;
  color: #a78bfa !important;
}

body.dark-mode #amountPreview {
  background: #1c2333 !important;
  border-color: #30363d !important;
  color: #e6edf3 !important;
}

body.dark-mode #amountError {
  color: #f87171 !important;
}

body.dark-mode .history-table {
  background: #161b22 !important;
}

body.dark-mode .history-table td {
  color: #8b949e !important;
  border-bottom-color: #21293d !important;
  border-right-color: #30363d !important;
}

body.dark-mode .history-table tbody tr:hover {
  background: #1c2333 !important;
}

body.dark-mode .amount-cell {
  color: #e6edf3 !important;
}

body.dark-mode .method-chip {
  background: #1c2333 !important;
  color: #8b949e !important;
}

body.dark-mode .badge-pending {
  background: rgba(180, 83, 9, 0.15) !important;
  color: #fcd34d !important;
  border-color: rgba(180, 83, 9, 0.3) !important;
}

body.dark-mode .badge-approved {
  background: rgba(6, 95, 70, 0.15) !important;
  color: #86efac !important;
  border-color: rgba(6, 95, 70, 0.3) !important;
}

body.dark-mode .badge-rejected {
  background: rgba(153, 27, 27, 0.15) !important;
  color: #fca5a5 !important;
  border-color: rgba(153, 27, 27, 0.3) !important;
}

body.dark-mode .view-btn {
  background: #1c2333 !important;
  border-color: #7c6af7 !important;
}

body.dark-mode .reason-box {
  background: #161b22 !important;
}

body.dark-mode .reason-box-header {
  border-bottom-color: #30363d !important;
}

body.dark-mode .reason-box-close {
  background: #1c2333 !important;
  color: #8b949e !important;
}

body.dark-mode .reason-box-body {
  background: #1c2333 !important;
  border-color: #30363d !important;
  color: #e6edf3 !important;
}

body.dark-mode .wd-sheet {
  background: #161b22 !important;
}

body.dark-mode .wd-handle {
  background: #30363d !important;
}

body.dark-mode .wd-sheet h3 {
  color: #e6edf3 !important;
}

body.dark-mode .wd-row {
  border-bottom-color: #30363d !important;
}

body.dark-mode .wd-label {
  color: #484f58 !important;
}

body.dark-mode .wd-value {
  color: #e6edf3 !important;
}

body.dark-mode #confirmOverlay>div {
  background: #161b22 !important;
}

body.dark-mode #confirmDetails {
  background: #1c2333 !important;
  border-color: #30363d !important;
}

body.dark-mode .shimmer-dark,
html.dark-mode body .shimmer-dark {
  background: linear-gradient(90deg, #1c2333 25%, #21293d 50%, #1c2333 75%) !important;
  background-size: 600px 100% !important;
  animation: shimmerSlide 1.4s infinite linear !important;
}

body.dark-mode .empty-state {
  background: transparent !important;
  border-color: #30363d !important;
}

body.dark-mode .empty-state h3 {
  color: #e6edf3 !important;
}

body.dark-mode .empty-state p {
  color: #8b949e !important;
}

body.dark-mode .historyShimmer .shimmer-dark,
html.dark-mode body .historyShimmer .shimmer-dark {
  background: linear-gradient(90deg, #1c2333 25%, #21293d 50%, #1c2333 75%) !important;
  background-size: 600px 100% !important;
  animation: shimmerSlide 1.4s infinite linear !important;
}