:root {
  --bg: #0f1117;
  --panel: #181b25;
  --panel2: #1f2430;
  --border: #2a2f3d;
  --text: #e6e8ee;
  --muted: #8b91a5;
  --accent: #4f8cff;
  --accent2: #3ddc84;
  --danger: #ff5d6c;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; margin-top: 8px; }
.danger { color: var(--danger); }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; padding: 28px; }
.login-card h1 { margin: 0 0 2px; font-size: 26px; }
.login-card .sub { margin: 0 0 20px; color: var(--muted); }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card h2 { margin: 0 0 14px; font-size: 18px; }

label { display: block; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 15px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; font-family: inherit; }

.btn { padding: 10px 16px; border: 1px solid var(--border); background: var(--panel2); color: var(--text); border-radius: 8px; cursor: pointer; font-size: 14px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { padding: 6px 10px; font-size: 13px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* 顶栏 */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; gap: 12px; align-items: center; padding: 12px 16px; background: rgba(15,17,23,.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.brand { font-size: 18px; white-space: nowrap; }
.search { flex: 1; max-width: 420px; margin: 0; }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: 110%; min-width: 160px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; z-index: 30; }
.menu button { display: block; width: 100%; text-align: left; padding: 10px 14px; background: none; border: none; color: var(--text); cursor: pointer; font-size: 14px; }
.menu button:hover { background: var(--panel2); }

/* tabs */
.tabs { display: flex; gap: 4px; padding: 10px 16px 0; overflow-x: auto; border-bottom: 1px solid var(--border); }
.tab { padding: 8px 14px; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; border-bottom: 2px solid transparent; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

main { padding: 16px; max-width: 1200px; margin: 0 auto; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--panel); color: var(--muted); cursor: pointer; font-size: 13px; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* codes grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.code-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; position: relative; transition: border-color .15s; }
.code-card:hover { border-color: var(--accent); }
.code-card .issuer { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.code-card .name { font-size: 15px; margin: 2px 0 10px; word-break: break-all; }
.code-card .code { font-size: 30px; font-weight: 700; letter-spacing: 4px; font-variant-numeric: tabular-nums; }
.code-card .code.copied { color: var(--accent2); }
.code-card .bar { height: 4px; background: var(--panel2); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.code-card .bar i { display: block; height: 100%; background: var(--accent2); transition: width 1s linear; }
.code-card .bar i.low { background: var(--danger); }
.code-card .menu-dots { position: absolute; top: 10px; right: 12px; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 18px; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: none; }
.list .grow { flex: 1; }
.list .tag { padding: 2px 8px; border-radius: 6px; font-size: 12px; background: var(--panel2); border: 1px solid var(--border); }
.list .tag.admin { color: var(--accent); border-color: var(--accent); }
.list .tag.editor { color: var(--accent2); border-color: var(--accent2); }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal-box { width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal-box h3 { margin: 0 0 16px; }

/* toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--accent2); color: #062; font-weight: 600; padding: 10px 18px; border-radius: 8px; z-index: 60; }

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .code-card .code { font-size: 24px; letter-spacing: 2px; }
  .brand { display: none; }
  .search { max-width: none; }
}
