:root {
  --bg: #f0f4ff;
  --bg-mesh: radial-gradient(ellipse 80% 60% at 10% 0%, rgba(124,58,237,.12) 0%, transparent 55%),
             radial-gradient(ellipse 60% 50% at 90% 10%, rgba(6,182,212,.14) 0%, transparent 50%),
             radial-gradient(ellipse 50% 40% at 50% 100%, rgba(99,102,241,.08) 0%, transparent 50%),
             #eef2ff;
  --surface: #ffffff;
  --sidebar: linear-gradient(175deg, #0a0f1e 0%, #121a35 45%, #0f172a 100%);
  --sidebar-glow: rgba(6,182,212,.35);
  --text: #0c1222;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-light: #ede9fe;
  --primary-glow: rgba(124,58,237,.25);
  --accent: #06b6d4;
  --accent-light: #ecfeff;
  --accent-glow: rgba(6,182,212,.25);
  --success: #10b981;
  --success-light: #ecfdf5;
  --danger: #f43f5e;
  --danger-light: #fff1f2;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --purple: #8b5cf6;
  --shadow-sm: 0 1px 3px rgba(12,18,34,.06);
  --shadow: 0 4px 16px rgba(12,18,34,.08), 0 1px 3px rgba(12,18,34,.04);
  --shadow-lg: 0 24px 48px -12px rgba(12,18,34,.18);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-w: 260px;
  --transition: .22s cubic-bezier(.4,0,.2,1);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

#app { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  color: #94a3b8;
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  border-right: 1px solid rgba(6,182,212,.12);
  box-shadow: 4px 0 32px rgba(0,0,0,.25);
}

.sidebar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--sidebar-glow), transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 26px 22px 22px;
}

.brand-logo {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, #06b6d4, #7c3aed);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 6px 20px rgba(124,58,237,.45), 0 0 0 1px rgba(255,255,255,.1) inset;
  flex-shrink: 0;
}

.brand-title {
  font-size: 18px; font-weight: 800; color: #fff;
  letter-spacing: -.4px;
}

.brand-sub {
  font-size: 11px; color: #64748b; margin-top: 2px;
  font-weight: 600;
  letter-spacing: .3px;
}

.nav {
  padding: 10px 14px;
  flex: 1;
  overflow-y: auto;
}

.nav-group { margin-bottom: 10px; }

.nav-group-title {
  padding: 14px 14px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #475569;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
  margin-bottom: 3px;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,.07);
  color: #e2e8f0;
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(124,58,237,.28), rgba(6,182,212,.15));
  color: #fff;
  box-shadow: 0 2px 12px rgba(124,58,237,.2);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 22px;
  background: linear-gradient(180deg, #06b6d4, #7c3aed);
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 10px var(--sidebar-glow);
}

.nav-item .icon {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.nav-sub { padding-left: 6px; }

.sidebar-footer {
  padding: 18px 22px 22px;
  border-top: 1px solid rgba(255,255,255,.06);
}

.status-pill {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; color: #64748b;
}

.status-pill .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #22d3ee;
  box-shadow: 0 0 10px rgba(34,211,238,.7);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .6; transform: scale(.9); }
}

.sidebar-user {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #94a3b8;
  font-weight: 600;
}

.sidebar-user .btn {
  color: #cbd5e1;
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  padding: 5px 12px;
}

.balance-tag {
  display: inline-block;
  background: linear-gradient(135deg, rgba(6,182,212,.25), rgba(124,58,237,.25));
  color: #67e8f9;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
}

/* ── Layout ── */
.layout {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg-mesh);
}

.topbar {
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid rgba(226,232,240,.8);
  padding: 22px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.6px;
  color: var(--text);
  background: linear-gradient(135deg, #0c1222 30%, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 500;
}

.topbar-balance { display: flex; align-items: center; gap: 12px; }

.balance-pill {
  background: linear-gradient(135deg, #7c3aed, #06b6d4);
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 16px var(--accent-glow);
  letter-spacing: -.2px;
}

.banner-area { padding: 0 36px; }
.banner-area:not(:empty) { padding-top: 20px; }

.content {
  padding: 28px 36px 52px;
  flex: 1;
}

/* Member mode accent shift */
body.member-mode .topbar h1 {
  background: linear-gradient(135deg, #0c1222 30%, #06b6d4);
  -webkit-background-clip: text;
  background-clip: text;
}

body.member-mode .nav-item.active {
  background: linear-gradient(135deg, rgba(6,182,212,.25), rgba(124,58,237,.12));
}

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

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

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px 26px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.stat-card.blue::before { background: linear-gradient(90deg, #6366f1, #818cf8); }
.stat-card.green::before { background: linear-gradient(90deg, #10b981, #34d399); }
.stat-card.purple::before { background: linear-gradient(90deg, #7c3aed, #a78bfa); }
.stat-card.orange::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.stat-info { flex: 1; }

.stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .8px;
}

.stat-value {
  font-size: 38px;
  font-weight: 800;
  margin-top: 8px;
  line-height: 1;
  letter-spacing: -1.5px;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 600;
}

.stat-card.blue .stat-value { color: #6366f1; }
.stat-card.green .stat-value { color: #10b981; }
.stat-card.purple .stat-value { color: #7c3aed; }
.stat-card.orange .stat-value { color: #f59e0b; }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.stat-card.blue .stat-icon { background: linear-gradient(135deg, #eef2ff, #e0e7ff); }
.stat-card.green .stat-icon { background: linear-gradient(135deg, #ecfdf5, #d1fae5); }
.stat-card.purple .stat-icon { background: linear-gradient(135deg, #f5f3ff, #ede9fe); }
.stat-card.orange .stat-icon { background: linear-gradient(135deg, #fffbeb, #fef3c7); }

/* ── Cards ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 30px;
  margin-bottom: 22px;
  border: 1px solid var(--border);
  position: relative;
}

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

.card-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -.4px;
}

.card-title .emoji { font-size: 20px; }

.claim-card {
  max-width: 640px;
  border: 2px solid transparent;
  background: linear-gradient(#fff, #fff) padding-box,
              linear-gradient(135deg, rgba(124,58,237,.3), rgba(6,182,212,.3)) border-box;
}

.claim-result-box {
  background: linear-gradient(135deg, #f5f3ff, #ecfeff);
  border: 1px solid #ddd6fe;
  border-radius: var(--radius-sm);
  padding: 18px 20px;
}

.price-preview {
  background: var(--accent-light);
  border: 1px solid #a5f3fc;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.balance-highlight {
  color: #7c3aed;
  font-size: 18px;
  font-weight: 800;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}

.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #6d28d9, #4f46e5);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 4px 14px rgba(16,185,129,.25);
}
.btn-success:hover:not(:disabled) { transform: translateY(-2px); }

.btn-danger {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #fff;
  box-shadow: 0 4px 14px rgba(244,63,94,.25);
}
.btn-danger:hover:not(:disabled) { transform: translateY(-2px); }

.btn-warning {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff;
  box-shadow: 0 4px 14px rgba(245,158,11,.25);
}
.btn-warning:hover:not(:disabled) { transform: translateY(-2px); }

.btn-ghost {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { background: var(--border-light); border-color: #cbd5e1; color: var(--text); }

.btn-sm { padding: 6px 13px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 14px 28px; font-size: 15px; border-radius: 12px; width: 100%; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Forms ── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group.full { grid-column: 1 / -1; }

label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: .3px;
}

input, select, textarea {
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-weight: 500;
}

input:hover, select:hover, textarea:hover { border-color: #cbd5e1; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

textarea {
  min-height: 120px;
  resize: vertical;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.65;
}

/* ── Table ── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 13px;
}

thead {
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
}

th {
  padding: 14px 18px;
  text-align: left;
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .9px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text-secondary);
  font-weight: 500;
}

td strong { color: var(--text); font-weight: 700; }

tr:last-child td { border-bottom: none; }
tr { transition: background var(--transition); }
tr:hover td { background: #fafbff; }
tr.abnormal td { background: #fffbeb; }
tr.abnormal:hover td { background: #fef3c7; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  margin: 2px;
  letter-spacing: .2px;
}

.badge.clickable { cursor: pointer; transition: transform var(--transition), opacity var(--transition); }
.badge.clickable:hover { transform: scale(1.06); opacity: .92; }

.badge-new { background: linear-gradient(135deg, #10b981, #059669); }
.badge-ok { background: linear-gradient(135deg, #10b981, #059669); }
.badge-err { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.badge-warn { background: linear-gradient(135deg, #f59e0b, #d97706); }
.badge-gray { background: #94a3b8; }
.badge-cyan { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.badge-purple { background: linear-gradient(135deg, #7c3aed, #6366f1); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-badge.success { background: var(--success-light); color: var(--success); }
.status-badge.failed { background: var(--danger-light); color: var(--danger); }

.status-badge .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
}

.status-badge.success .dot { background: var(--success); }
.status-badge.failed .dot { background: var(--danger); }

.proxy-cell code { display: block; }
.proxy-region {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 600;
  line-height: 1.3;
}

/* ── Toolbar & Chips ── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.toolbar .search {
  flex: 1;
  min-width: 220px;
  max-width: 400px;
}

.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.chip {
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: all var(--transition);
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
}

.chip.active {
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px var(--primary-glow);
}

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
  justify-content: flex-end;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

/* ── Alerts ── */
.alert {
  padding: 15px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideDown .28s ease;
}

.alert-ok {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  color: #047857;
  border: 1px solid #6ee7b7;
}

.alert-err {
  background: linear-gradient(135deg, #fff1f2, #ffe4e6);
  color: #be123c;
  border: 1px solid #fda4af;
}

.alert-info {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #1d4ed8;
  border: 1px solid #93c5fd;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: none; }
}

/* ── Loading ── */
.loading-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 56px 20px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
}

.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .65s linear infinite;
  flex-shrink: 0;
}

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

/* ── Modal ── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12,18,34,.55);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  width: min(680px, 94vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: modalIn .28s ease;
  border: 1px solid var(--border);
}

.modal-sm { width: min(420px, 94vw); }

.modal-wide {
  width: min(1180px, 96vw);
  max-height: 90vh;
}

.modal-wide .modal-body {
  overflow-y: auto;
}

.modal-wide .mail-list-wrap {
  overflow-x: visible;
  overflow-y: auto;
  max-height: min(68vh, 720px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.modal-wide .mail-list-table {
  table-layout: fixed;
  width: 100%;
}

.modal-wide .mail-list-table th,
.modal-wide .mail-list-table td {
  white-space: normal;
  word-break: break-word;
  vertical-align: top;
}

.modal-wide .mail-list-table .col-sender { width: 28%; }
.modal-wide .mail-list-table .col-subject { width: 36%; }
.modal-wide .mail-list-table .col-folder { width: 10%; white-space: nowrap; }
.modal-wide .mail-list-table .col-time { width: 18%; white-space: nowrap; }
.modal-wide .mail-list-table .col-action { width: 8%; white-space: nowrap; text-align: right; }

.modal-mail {
  width: min(960px, 96vw);
  max-height: 92vh;
}

.modal-mail .modal-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.modal-mail .mail-content-wrap {
  flex: 1;
  min-height: 520px;
}

.modal-mail .mail-frame {
  min-height: 520px;
  height: min(68vh, 820px);
}

.modal-mail .mail-body {
  max-height: min(68vh, 820px);
  min-height: 520px;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.94) translateY(16px); }
  to { opacity: 1; transform: none; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 30px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 18px; font-weight: 800; letter-spacing: -.4px; }

.modal-close {
  background: var(--border-light);
  border: none;
  width: 36px; height: 36px;
  border-radius: 11px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover { background: var(--border); color: var(--text); }

.modal-body { padding: 26px 30px; overflow-y: auto; flex: 1; }

.modal-footer {
  padding: 18px 30px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Login ── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-mesh);
  position: relative;
  overflow: hidden;
}

.login-screen::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(124,58,237,.15) 0%, transparent 70%);
  top: -200px; right: -100px;
  pointer-events: none;
}

.login-screen::after {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(6,182,212,.12) 0%, transparent 70%);
  bottom: -150px; left: -100px;
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: rgba(255,255,255,.95);
  border: 1px solid rgba(226,232,240,.8);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  position: relative;
  backdrop-filter: blur(12px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.login-brand .brand-logo {
  width: 48px; height: 48px;
}

.login-brand .brand-title { color: var(--text); font-size: 20px; font-weight: 800; }
.login-brand .brand-sub { color: var(--text-muted); font-size: 13px; font-weight: 600; }

.login-title {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 24px;
  color: var(--text);
  letter-spacing: -.5px;
}

.login-btn {
  width: 100%;
  margin-top: 10px;
  padding: 14px;
  font-size: 15px;
  border-radius: 12px;
}

.login-error {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--danger-light);
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

/* ── Fetch progress ── */
.fetch-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding: 2px 0;
}

.fetch-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 11px;
  background: #f8fafc;
  border: 1px solid var(--border);
  font-size: 13px;
}

.fetch-step-running {
  border-color: #c4b5fd;
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
}

.fetch-step-running .fetch-step-icon {
  color: var(--primary);
  animation: spin 1s linear infinite;
  display: inline-block;
}

.fetch-step-done {
  border-color: #6ee7b7;
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
}

.fetch-step-done .fetch-step-icon { color: var(--success); font-weight: 800; }

.fetch-step-error {
  border-color: #fda4af;
  background: linear-gradient(135deg, #fff1f2, #ffe4e6);
}

.fetch-step-error .fetch-step-icon { color: var(--danger); font-weight: 800; }

.fetch-step-icon {
  width: 20px;
  flex-shrink: 0;
  text-align: center;
  line-height: 1.5;
}

.fetch-step-body { flex: 1; min-width: 0; }
.fetch-step-msg { color: var(--text); font-weight: 600; }

.fetch-step-detail {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  word-break: break-all;
}

/* ── Account cells ── */
.pwd-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 200px;
}

.pwd-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--text-secondary);
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.email-cell { max-width: 280px; }

.email-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-copy {
  flex-shrink: 0;
  padding: 3px 9px !important;
  font-size: 11px !important;
}

.hidden { display: none !important; }

.meta-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
}

.meta-label {
  color: var(--text-muted);
  min-width: 56px;
  font-weight: 700;
  flex-shrink: 0;
}

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-icon {
  width: 72px; height: 72px;
  margin: 0 auto 18px;
  background: linear-gradient(135deg, #ede9fe, #ecfeff);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  box-shadow: var(--shadow-sm);
}

.empty-state p { font-size: 15px; font-weight: 600; color: var(--text-secondary); }

.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #06b6d4);
  border-radius: 3px;
  transition: width .4s ease;
}

.rate-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 120px;
}

.rate-cell span { font-size: 12px; font-weight: 700; color: var(--text-muted); min-width: 32px; }

.upload-zone {
  border: 2px dashed #c4b5fd;
  border-radius: var(--radius);
  padding: 52px 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-muted);
  background: linear-gradient(135deg, #fafbff, #f5f3ff);
}

.upload-zone:hover, .upload-zone.drag {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  transform: scale(1.01);
}

.upload-icon {
  width: 60px; height: 60px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}

.small { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.text-err { color: var(--danger); font-size: 12px; font-weight: 600; }
.text-ok { color: var(--success); font-size: 12px; font-weight: 700; }

code {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  padding: 3px 10px;
  border-radius: 7px;
  font-size: 12px;
  color: #7c3aed;
  font-family: 'SF Mono', monospace;
  font-weight: 600;
}

.card-flush { padding: 0; overflow: hidden; }
.card-flush .card-header { padding: 22px 30px 0; margin-bottom: 0; }
.card-flush .table-wrap { border: none; border-radius: 0; }

.mail-body {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  font-size: 13px;
  line-height: 1.75;
  max-height: 640px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-secondary);
}

.mail-content-wrap { margin-top: 12px; }

.mail-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #f5f3ff, #ecfeff);
  border: 1px solid #ddd6fe;
  border-radius: var(--radius-sm);
}

.mail-translated {
  background: #fffbeb;
  border-color: #fde68a;
  line-height: 1.85;
}

.mail-frame {
  width: 100%;
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}

@media (max-width: 768px) {
  .sidebar { width: 72px; }
  .brand-title, .brand-sub, .nav-item span, .nav-group-title, .sidebar-footer, .sidebar-user span { display: none; }
  .brand { justify-content: center; padding: 18px 10px; }
  .layout { margin-left: 72px; }
  .content, .topbar { padding-left: 20px; padding-right: 20px; }
  .topbar h1 { font-size: 20px; }
}
