:root {
  --bg: #14110d;
  --bg-soft: #1e1a15;
  --card: #262119;
  --line: #3a3226;
  --gold: #f0c04a;
  --gold-dim: #b8912f;
  --text: #f3ece0;
  --muted: #a1958a;
  --red: #d9534f;
  --green: #5cb85c;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: #ffd76a; }

.topbar {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  font-size: 17px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 1px;
  white-space: nowrap;
}

.nav { display: flex; gap: 4px; flex: 1; }

.nav a {
  color: var(--muted);
  padding: 7px 13px;
  border-radius: 6px;
  font-size: 14px;
}
.nav a:hover { background: #2b251c; color: var(--text); }
.nav a.active { color: var(--gold); background: #2b251c; }

.userbox { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.userbox .email { color: var(--muted); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }

h1 { font-size: 22px; font-weight: 600; margin-bottom: 6px; }
h2 { font-size: 17px; font-weight: 600; margin: 26px 0 12px; }
.sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--gold-dim); transform: translateY(-2px); }

.cover {
  height: 130px;
  background: linear-gradient(135deg, #3a2f1c, #211a12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: var(--gold-dim);
  letter-spacing: 3px;
}

.card-body { padding: 14px; flex: 1; display: flex; flex-direction: column; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.card-desc { color: var(--muted); font-size: 12.5px; flex: 1; margin-bottom: 12px; }

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  background: #3a2f1c;
  color: var(--gold);
  margin-bottom: 8px;
}

.btn {
  display: inline-block;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 6px;
  background: var(--gold);
  color: #221c10;
  font-weight: 600;
  text-align: center;
  transition: opacity .15s;
  width: 100%;
}
.btn:hover { opacity: .88; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 400; }
.btn.ghost:hover { color: var(--text); border-color: var(--gold-dim); }
.btn.sm { width: auto; padding: 6px 12px; font-size: 13px; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
  max-width: 420px;
  margin: 30px auto;
}

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

input, select, textarea {
  width: 100%;
  background: #1a1611;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold-dim); }

.msg {
  padding: 10px 13px;
  border-radius: 6px;
  font-size: 13px;
  margin-top: 14px;
  display: none;
}
.msg.err { background: #3a1f1f; color: #f0a09c; border: 1px solid #5c2c2c; display: block; }
.msg.ok  { background: #1f3320; color: #98d998; border: 1px solid #2c5c2e; display: block; }

.tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.tab {
  flex: 1;
  padding: 9px;
  text-align: center;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}
.tab.on { background: var(--gold); color: #221c10; border-color: var(--gold); font-weight: 600; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.code { font-family: ui-monospace, Consolas, monospace; letter-spacing: .5px; }
.used { color: var(--muted); }
.fresh { color: var(--green); }

.statrow { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 20px;
  min-width: 120px;
}
.stat .n { font-size: 24px; font-weight: 600; color: var(--gold); }
.stat .l { font-size: 12px; color: var(--muted); }

.codebox {
  background: #1a1611;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  max-height: 260px;
  overflow: auto;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.9;
  margin-top: 14px;
  white-space: pre-wrap;
  word-break: break-all;
}

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row .field { flex: 1; min-width: 120px; margin-bottom: 0; }

.empty { color: var(--muted); text-align: center; padding: 40px 0; font-size: 13px; }
.hidden { display: none !important; }
.flash { animation: flash .5s; }
@keyframes flash { 0% { background: #3a2f1c; } 100% { background: transparent; } }

@media (max-width: 640px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .nav a { padding: 6px 9px; font-size: 13px; }
  .brand { font-size: 15px; }
  .userbox .email { display: none; }
}
