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

:root {
  --primary: #1677ff;
  --primary-hover: #0958d9;
  --danger: #ff4d4f;
  --success: #52c41a;
  --bg: #f5f7fa;
  --card-bg: #fff;
  --border: #e8e8e8;
  --text: #1a1a1a;
  --muted: #666;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* Nav */
.nav {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.nav-logo { font-size: 18px; font-weight: 700; color: var(--primary); text-decoration: none; margin-right: auto; }
.nav a { color: var(--text); text-decoration: none; font-size: 14px; }
.nav a:hover { color: var(--primary); }
.nav-btn {
  background: var(--primary); color: #fff; border: none; border-radius: var(--radius);
  padding: 6px 16px; cursor: pointer; font-size: 14px; text-decoration: none;
}
.nav-btn:hover { background: var(--primary-hover); }

/* Layout */
.container { max-width: 960px; margin: 0 auto; padding: 32px 16px; }
.page-title { font-size: 24px; font-weight: 700; margin-bottom: 24px; }

/* Card */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 20px; border-radius: var(--radius); border: none;
  cursor: pointer; font-size: 14px; font-weight: 500; transition: .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: #e6f0ff; }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: #fff1f0; }
.btn-sm { padding: 4px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; }
.form-group input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px; outline: none; transition: .15s;
}
.form-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(22,119,255,.2); }
.form-error { color: var(--danger); font-size: 13px; margin-top: 4px; min-height: 18px; }
.form-actions { display: flex; gap: 12px; margin-top: 20px; }

/* Tabs */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.tab {
  padding: 10px 20px; cursor: pointer; font-size: 15px; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: .15s;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--muted); background: #fafafa; font-size: 13px; }
tr:last-child td { border-bottom: none; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 500;
}
.badge-green { background: #f6ffed; color: var(--success); border: 1px solid #b7eb8f; }
.badge-red { background: #fff1f0; color: var(--danger); border: 1px solid #ffa39e; }
.badge-gray { background: #f5f5f5; color: #888; border: 1px solid #d9d9d9; }

/* Balance card */
.balance-hero {
  background: linear-gradient(135deg, #1677ff 0%, #0958d9 100%);
  color: #fff; border-radius: var(--radius); padding: 32px;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.balance-amount { font-size: 42px; font-weight: 700; }
.balance-label { font-size: 14px; opacity: .85; margin-bottom: 8px; }
.balance-note { font-size: 13px; opacity: .7; margin-top: 8px; }
.btn-white { background: #fff; color: var(--primary); border: none; }
.btn-white:hover { background: #f0f7ff; }

/* Code block */
.code-block {
  background: #1e1e2e; color: #cdd6f4; border-radius: var(--radius);
  padding: 16px 20px; font-family: "Courier New", monospace; font-size: 13px;
  overflow-x: auto; position: relative;
}
.code-block .copy-btn {
  position: absolute; right: 10px; top: 10px;
  background: rgba(255,255,255,.1); color: #cdd6f4; border: none;
  border-radius: 4px; padding: 3px 10px; cursor: pointer; font-size: 12px;
}
.code-block .copy-btn:hover { background: rgba(255,255,255,.2); }

/* Key row */
.key-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.key-row:last-child { border-bottom: none; }
.key-info { flex: 1; min-width: 0; }
.key-id { font-family: monospace; font-size: 13px; font-weight: 600; }
.key-secret { font-family: monospace; font-size: 12px; color: var(--muted); word-break: break-all; }
.key-date { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal { background: #fff; border-radius: var(--radius); padding: 28px; width: 380px; max-width: 95vw; box-shadow: 0 8px 32px rgba(0,0,0,.18); }
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.amount-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.amount-btn {
  border: 2px solid var(--border); background: #fff; border-radius: var(--radius);
  padding: 14px; text-align: center; cursor: pointer; font-size: 16px; font-weight: 600; transition: .15s;
}
.amount-btn.selected { border-color: var(--primary); color: var(--primary); background: #e6f0ff; }
.amount-btn:hover { border-color: var(--primary); }

/* Alert */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.alert-info { background: #e6f4ff; color: #0958d9; border: 1px solid #91caff; }
.alert-success { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }

/* Login page */
.login-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-box { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 40px; width: 400px; max-width: 95vw; }
.login-logo { text-align: center; font-size: 22px; font-weight: 700; color: var(--primary); margin-bottom: 28px; }

/* Hero section */
.hero { text-align: center; padding: 64px 0 48px; }
.hero h1 { font-size: 36px; font-weight: 700; margin-bottom: 12px; }
.hero p { font-size: 16px; color: var(--muted); max-width: 520px; margin: 0 auto 28px; }

/* Section */
.section-title { font-size: 20px; font-weight: 700; margin-bottom: 16px; }

/* Inline copy */
.copy-inline {
  background: none; border: none; cursor: pointer; color: var(--primary); font-size: 13px; padding: 2px 6px;
}
.copy-inline:hover { text-decoration: underline; }

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

/* Responsive */
@media (max-width: 600px) {
  .nav { padding: 0 16px; }
  .balance-hero { flex-direction: column; gap: 20px; text-align: center; }
  .hero h1 { font-size: 26px; }
}
