/* ============================================
   Mobile App Platform - Main Stylesheet
   ============================================ */

:root {
  --primary: #4F46E5;
  --primary-dark: #4338CA;
  --primary-light: #EEF2FF;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --text: #1E293B;
  --text-secondary: #64748B;
  --border: #E2E8F0;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --tab-height: 64px;
  --header-height: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
}

/* ============================================
   Auth Pages (Login / Register)
   ============================================ */
.auth-page {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-page.active {
  display: flex;
}

.auth-card {
  width: 100%;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo .logo-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary), #7C3AED);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: white;
  margin-bottom: 12px;
  overflow: hidden; /* 防止图片溢出圆角 */
}

.auth-logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.auth-logo p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Lang select */
.lang-select select {
  font-family: inherit;
}

.lang-select select:hover {
  border-color: var(--primary);
}

/* Form */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  transition: border-color 0.2s;
  background: #F9FAFB;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.btn {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(0.98); }

.btn-success {
  background: var(--success);
  color: white;
}

.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}

.auth-switch {
  text-align: center;
  margin-top: 18px;
  font-size: 14px;
  color: var(--text-secondary);
}

.auth-switch a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}

/* ============================================
   Main App Layout (Logged in)
   ============================================ */
.app-page {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--tab-height) + var(--safe-bottom) + 16px);
}

.app-page.active {
  display: block;
}

/* Header */
.app-header {
  background: var(--card);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header h2 {
  font-size: 18px;
  font-weight: 700;
}

/* Account Bar (Profile page, below header) */
.account-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 10px 16px;
  margin: 0;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

.account-bar-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.account-bar-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.account-bar-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-bar-id {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-bar .btn {
  flex-shrink: 0;
  white-space: nowrap;
  margin-left: auto;
}

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin: 16px 20px;
  box-shadow: var(--shadow);
}

/* Balance Card */
.balance-card {
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  color: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 16px 20px;
  box-shadow: 0 4px 15px rgba(79,70,229,0.3);
}

.balance-label {
  font-size: 13px;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.balance-amount {
  font-size: 36px;
  font-weight: 800;
  margin: 4px 0;
}

.balance-amount small {
  font-size: 20px;
  font-weight: 600;
}

.balance-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 13px;
  opacity: 0.85;
}

.balance-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.balance-actions .btn {
  flex: 1;
  padding: 10px;
  font-size: 14px;
}

/* Check-in Card */
.checkin-card {
  text-align: center;
}

.checkin-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.checkin-icon {
  font-size: 40px;
}

.checkin-streak {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 12px 0;
}

.streak-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.streak-dot.active {
  background: var(--success);
  color: white;
}

.streak-dot.today {
  background: var(--primary);
  color: white;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.2);
}

.checkin-btn {
  margin-top: 16px;
}

/* Transactions */
.tx-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.tx-item:last-child { border-bottom: none; }

.tx-info {
  flex: 1;
}

.tx-type {
  font-size: 14px;
  font-weight: 600;
}

.tx-date {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.tx-amount {
  font-weight: 700;
  font-size: 15px;
}

.tx-amount.positive { color: var(--success); }
.tx-amount.negative { color: var(--danger); }

/* ============================================
   Bottom Tab Bar
   ============================================ */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--tab-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  box-shadow: 0 -1px 10px rgba(0,0,0,0.05);
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  transition: color 0.2s;
  border: none;
  background: none;
  gap: 4px;
}

.tab-item .tab-icon {
  font-size: 22px;
  line-height: 1;
}

.tab-item.active {
  color: var(--primary);
  font-weight: 600;
}

/* ============================================
   Homepage Content
   ============================================ */
.home-section {
  margin: 16px 20px;
}

.section-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.section-card h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
}

.section-card p {
  font-size: 14px;
  color: var(--text-secondary);
  white-space: pre-line;
}

.section-card img {
  width: 100%;
  border-radius: var(--radius-sm);
  margin-top: 10px;
}

/* ============================================
   Toast / Modal
   ============================================ */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: white;
  box-shadow: var(--shadow-lg);
  animation: slideDown 0.3s ease;
  max-width: 90%;
  text-align: center;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }

@keyframes slideDown {
  from { opacity: 0; transform: translate(-50%, -20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-content {
  background: white;
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px 20px calc(24px + var(--safe-bottom));
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-content h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}

.modal-content p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

.modal-content .btn-close {
  width: 100%;
  padding: 13px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* Loading */
.loading-spinner {
  display: flex;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ============================================
   Admin Panel - Sidebar Layout
   ============================================ */
.admin-page {
  display: none;
  min-height: 100vh;
  background: #F0F2F5;
}

.admin-page.active {
  display: flex;
}

/* Sidebar */
.admin-sidebar {
  width: 220px;
  min-width: 220px;
  background: #1E293B;
  color: #CBD5E1;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
  box-shadow: 2px 0 12px rgba(0,0,0,0.08);
}

.admin-sidebar .sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.admin-sidebar .sidebar-brand h2 {
  font-size: 16px;
  font-weight: 700;
  color: #F1F5F9;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-sidebar .sidebar-brand .version {
  font-size: 11px;
  color: #64748B;
  margin-top: 4px;
}

.admin-sidebar nav {
  padding: 12px 0;
  flex: 1;
}

.admin-sidebar nav .nav-label {
  padding: 8px 20px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #475569;
}

.admin-sidebar nav .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  font-size: 14px;
  color: #94A3B8;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  font-family: inherit;
}

.admin-sidebar nav .nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: #E2E8F0;
}

.admin-sidebar nav .nav-item.active {
  background: rgba(79,70,229,0.15);
  color: #A5B4FC;
  border-left-color: #818CF8;
  font-weight: 600;
}

.admin-sidebar nav .nav-item .nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.admin-sidebar .sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: #64748B;
}

.admin-sidebar .sidebar-footer .user-info {
  margin-bottom: 10px;
}

.admin-sidebar .sidebar-footer .user-info .name {
  color: #E2E8F0;
  font-weight: 600;
  font-size: 13px;
}

.admin-sidebar .sidebar-footer .logout-btn {
  background: rgba(239,68,68,0.15);
  color: #FCA5A5;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  font-family: inherit;
  transition: all 0.15s;
}

.admin-sidebar .sidebar-footer .logout-btn:hover {
  background: rgba(239,68,68,0.25);
  color: #FECACA;
}

/* Main Content Area */
.admin-main {
  margin-left: 220px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  background: #FFF;
  border-bottom: 1px solid #E2E8F0;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.admin-topbar h1 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: #1E293B;
}

.admin-topbar .topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.admin-topbar .topbar-actions .btn,
.admin-topbar .topbar-actions a {
  white-space: nowrap;
}

.admin-content {
  padding: 24px 28px;
  flex: 1;
  overflow-y: auto;
}

.admin-content .card-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #F1F5F9;
}

.admin-content .card-header h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  color: #1E293B;
  flex-shrink: 1;
  min-width: 0;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: #FFF;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid #E2E8F0;
  transition: all 0.2s;
}

.stat-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.stat-card .stat-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 26px;
  font-weight: 800;
  color: #1E293B;
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 13px;
  color: #64748B;
  margin-top: 4px;
  font-weight: 500;
}

.stat-card.primary .stat-value { color: #4F46E5; }
.stat-card.success .stat-value { color: #10B981; }
.stat-card.warning .stat-value { color: #F59E0B; }
.stat-card.danger .stat-value { color: #EF4444; }

/* Data Table */
.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #E2E8F0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead {
  background: #F8FAFC;
}

.data-table th {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 2px solid #E2E8F0;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #F1F5F9;
  color: #334155;
}

.data-table tbody tr:hover {
  background: #F8FAFC;
}

.data-table .user-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.data-table .avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #EEF2FF;
  color: #4F46E5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-active { background: #D1FAE5; color: #065F46; }
.badge-disabled { background: #FEE2E2; color: #991B1B; }
.badge-admin { background: #EDE9FE; color: #5B21B6; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  text-decoration: none;
}

.btn-primary {
  background: #4F46E5;
  color: #FFF;
}

.btn-primary:hover {
  background: #4338CA;
  box-shadow: 0 2px 8px rgba(79,70,229,0.3);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
}

.btn-sm-primary { background: #4F46E5; color: #FFF; }
.btn-sm-primary:hover { background: #4338CA; }
.btn-sm-danger { background: #FEE2E2; color: #DC2626; }
.btn-sm-danger:hover { background: #FECACA; }
.btn-sm-warning { background: #FEF3C7; color: #D97706; }
.btn-sm-warning:hover { background: #FDE68A; }
.btn-sm-success { background: #D1FAE5; color: #065F46; }
.btn-sm-success:hover { background: #A7F3D0; }
.btn-sm-ghost { background: transparent; color: #64748B; }
.btn-sm-ghost:hover { background: #F1F5F9; color: #334155; }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.pagination .page-info {
  font-size: 13px;
  color: #64748B;
  white-space: nowrap;
}

/* Admin Form */
.admin-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  margin-top: 16px;
  color: #374151;
}

.admin-form label:first-child {
  margin-top: 0;
}

.admin-form input,
.admin-form textarea,
.admin-form select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #D1D5DB;
  border-radius: 8px;
  font-size: 14px;
  background: #F9FAFB;
  transition: all 0.15s;
  font-family: inherit;
  color: #1F2937;
}

.admin-form textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.6;
}

.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus {
  outline: none;
  border-color: #4F46E5;
  background: #FFF;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.08);
}

.admin-form input::placeholder,
.admin-form textarea::placeholder {
  color: #9CA3AF;
}

.admin-form .btn {
  margin-top: 20px;
}

.admin-form .form-hint {
  font-size: 12px;
  color: #9CA3AF;
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-row .admin-form label {
  margin-top: 0;
}

/* Inline Form */
.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-form input,
.inline-form select {
  width: auto;
  flex: 1;
  min-width: 100px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: #94A3B8;
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 14px;
  margin: 0;
}

/* Loading */
.loading-spinner {
  display: flex;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #E2E8F0;
  border-top-color: #4F46E5;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Toast */
.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  animation: slideInRight 0.25s ease;
  max-width: 360px;
}

.toast.success { background: #065F46; color: #D1FAE5; }
.toast.error { background: #991B1B; color: #FEE2E2; }
.toast.info { background: #1E40AF; color: #DBEAFE; }

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

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

/* Admin Login Page */
.admin-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1E293B 0%, #312E81 100%);
}

.admin-login {
  width: 380px;
  background: #FFF;
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.admin-login .login-icon {
  text-align: center;
  font-size: 40px;
  margin-bottom: 8px;
}

.admin-login h2 {
  text-align: center;
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 700;
  color: #1E293B;
}

.admin-login .login-sub {
  text-align: center;
  font-size: 13px;
  color: #64748B;
  margin-bottom: 28px;
}

.admin-login .admin-form input {
  background: #F8FAFC;
  padding: 12px 14px;
  font-size: 14px;
}

.admin-login .login-error {
  background: #FEF2F2;
  color: #DC2626;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}

.admin-login .login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
  color: #94A3B8;
}

.admin-login .login-footer a {
  color: #4F46E5;
  text-decoration: none;
  font-weight: 600;
}

.admin-login .login-footer a:hover {
  color: #4338CA;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s;
}

.modal-box {
  background: #FFF;
  border-radius: 12px;
  padding: 28px;
  width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: scaleIn 0.15s;
}

.modal-box h3 {
  margin: 0 0 20px;
  font-size: 17px;
  font-weight: 700;
}

.modal-box .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* Section Card in homepage editor */
.section-edit-card {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 14px;
}

.section-edit-card h4 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.image-upload-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.image-upload-row input[type="file"] {
  flex: 1;
  font-size: 12px;
  padding: 6px 8px;
  border: 1.5px solid #D1D5DB;
  border-radius: 6px;
  background: #FFF;
}

.image-upload-row .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

/* ===== Admin Dashboard Stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: #FFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.stat-card .stat-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #1E293B;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: #64748B;
  font-weight: 500;
}

.stat-card.primary .stat-value { color: #4F46E5; }
.stat-card.success .stat-value { color: #065F46; }
.stat-card.warning .stat-value { color: #D97706; }
.stat-card.danger .stat-value { color: #DC2626; }

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Admin Cards ===== */
.admin-content .card {
  background: #FFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  overflow: hidden;
  min-width: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 18px;
  gap: 16px;
  flex-wrap: nowrap;
}

.card-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #1E293B;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
}
}

/* ===== Data Table ===== */
.table-wrap {
  overflow-x: auto;
  margin: 0 -24px;
  padding: 0 24px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead {
  background: #F8FAFC;
}

.data-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: #64748B;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #E2E8F0;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #F1F5F9;
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: #F8FAFC;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ===== User Cell ===== */
.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #E0E7FF;
  color: #4F46E5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-active { background: #D1FAE5; color: #065F46; }
.badge-disabled { background: #FEE2E2; color: #DC2626; }
.badge-admin { background: #DBEAFE; color: #1E40AF; }

/* ===== Search / Filter Row ===== */
.filter-row {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: nowrap;
  min-width: 0;
  flex-shrink: 0;
}

.filter-row input {
  padding: 5px 8px;
  border: 1.5px solid #D1D5DB;
  border-radius: 6px;
  font-size: 12px;
  background: #F9FAFB;
  width: 120px;
  min-width: 60px;
  max-width: 180px;
  flex-shrink: 1;
  font-family: inherit;
}

.filter-row .btn {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 5px 8px;
  font-size: 11px;
}

.filter-row input:focus {
  outline: none;
  border-color: #4F46E5;
  background: #FFF;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.08);
}

/* Admin image grid — 2 columns */
.universal-img-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.universal-img-row .section-edit-card {
  margin-bottom: 0;
}

/* ===== Radio Button Row ===== */
.radio-row {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-top: 6px;
  flex-wrap: wrap;
}
.radio-row label { display: inline-flex !important; align-items: center; gap: 6px; font-weight: 400 !important; cursor: pointer; font-size: 14px; color: #374151; padding: 4px 0; line-height: 1; margin: 0 !important; }
.radio-row input[type="radio"] { margin: 0; width: 16px; height: 16px; accent-color: #4F46E5; flex-shrink: 0; }

/* ===== Config Cards ===== */
.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

/* ===== File Input Row ===== */
.file-input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 640px) {
  .file-input-row { grid-template-columns: 1fr; }
}

.file-upload-cell {
  background: #F8FAFC;
  border: 1.5px dashed #D1D5DB;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.file-upload-cell:hover {
  border-color: #4F46E5;
  background: #EEF2FF;
}

.file-upload-cell label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
  display: block;
}

.file-upload-cell input[type="file"] {
  display: block;
  margin: 8px auto;
  font-size: 12px;
  max-width: 100%;
}

.file-upload-cell .btn {
  margin-top: 8px;
}

.file-preview {
  margin-top: 8px;
  min-height: 24px;
}

.file-preview img {
  border-radius: 10px;
  border: 1px solid #E2E8F0;
}

.file-preview .file-info {
  font-size: 12px;
  color: #64748B;
  padding: 4px 0;
}

/* ===== Upload Progress Bar ===== */
.upload-progress {
  margin-top: 8px;
}

.upload-progress-bar {
  width: 100%;
  height: 6px;
  background: #E8EAED;
  border-radius: 3px;
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4F46E5, #818CF8);
  border-radius: 3px;
  transition: width 0.2s ease;
}

.upload-progress-text {
  font-size: 11px;
  color: #64748B;
  margin-top: 4px;
  text-align: center;
  font-weight: 600;
}

/* ============================================
   Tab Pages
   ============================================ */
.tab-page { display: none; }
.tab-page.active { display: block; }

/* ============================================
   Hidden by default
   ============================================ */
.hidden { display: none !important; }

/* ============================================
   Phone Input with Country Code
   ============================================ */
.phone-row {
  display: flex;
  gap: 8px;
}

.phone-cc {
  width: 110px;
  min-width: 110px;
  flex-shrink: 0;
  padding: 12px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: white;
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
}

.phone-input {
  flex: 1;
}

/* ============================================
   Form Section Label & 2-Column Row
   ============================================ */
.form-section-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 16px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.form-row-2 {
  display: flex;
  gap: 10px;
}

.form-row-2 .form-group {
  flex: 1;
}

/* ============================================
   Card Binding
   ============================================ */
.card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-radius: 10px;
  border: 1.5px solid #E2E8F0;
  margin-bottom: 8px;
  background: #F8FAFC;
  transition: all 0.15s;
}

.card-item:hover {
  border-color: #CBD5E1;
  background: #FFF;
}

.card-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-type-icon {
  font-size: 28px;
  line-height: 1;
}

.card-type-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}

.card-number-display {
  font-size: 13px;
  color: var(--text-secondary);
  font-family: monospace;
  letter-spacing: 1px;
}

.card-expiry {
  font-size: 11px;
  color: #94A3B8;
  margin-top: 2px;
}

.badge-default {
  background: #DBEAFE;
  color: #1E40AF;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}

.empty-state-small {
  text-align: center;
  padding: 20px;
  color: #94A3B8;
  font-size: 13px;
}

/* ============================================
   Balance Address
   ============================================ */
.balance-address {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.2);
}

/* ============================================
   Modal Wide
   ============================================ */
.modal-wide {
  max-width: 420px;
}

/* ============================================
   Utility Classes
   ============================================ */
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }

/* ============================================
   Universal Page
   ============================================ */
.universal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
}

.universal-card {
  background: #FFF;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  overflow: hidden;
}

.universal-card img {
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
  display: block;
}

.universal-card-desc {
  padding: 10px 12px;
  font-size: 13px;
  color: #475569;
  line-height: 1.4;
}

.universal-download-bar {
  padding: 12px 16px 24px;
}

.universal-download-bar .btn {
  width: 100%;
  padding: 14px;
  font-size: 16px;
}

/* Blur mode — overlay text */
.universal-blur {
  position: relative;
}

.universal-blur::after {
  content: '';
  position: absolute;
  inset: 0;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  z-index: 2;
  pointer-events: none;
}
