* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #0f1115; color: #e6e8ee; font-size: 14px;
}
[hidden] { display: none !important; }
a { color: #6aa8ff; }

/* ============ 登录 ============ */
.login-wrap { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(1200px 600px at 50% -10%, #1c2c4d 0%, #0f1115 60%); }
.login-card { width: 380px; max-width: calc(100vw - 40px); background: #171a21; border: 1px solid #262b36; border-radius: 14px; padding: 32px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.login-card h1 { font-size: 22px; letter-spacing: 2px; text-align: center; }
.login-sub { text-align: center; color: #8b93a5; margin: 6px 0 22px; font-size: 13px; }
.login-card label { display: block; margin-bottom: 14px; color: #aab2c2; font-size: 13px; }
.login-card input { width: 100%; margin-top: 6px; }

/* ============ 表单元素 ============ */
input, select, textarea {
  background: #10131a; border: 1px solid #2c3342; color: #e6e8ee; border-radius: 8px;
  padding: 8px 10px; font-size: 14px; outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: #4a7dff; }
textarea { resize: vertical; font-family: inherit; }
label.radio, label.radio-line { display: inline-flex; align-items: center; gap: 6px; color: #aab2c2; font-size: 13px; }
label.radio input, label.radio-line input { width: auto; margin: 0; }

/* ============ 布局 ============ */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 210px; background: #12151c; border-right: 1px solid #20242e; padding: 18px 12px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { font-size: 17px; font-weight: 600; padding: 4px 10px 18px; letter-spacing: 1px; }
.brand span { display: block; font-size: 11px; color: #7f8798; font-weight: 400; letter-spacing: 2px; margin-top: 4px; }
#nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
#nav a { color: #aab2c2; text-decoration: none; padding: 9px 12px; border-radius: 8px; font-size: 14px; }
#nav a:hover { background: #1a1f29; color: #e6e8ee; }
#nav a.active { background: #223257; color: #cfdcff; }
.sidebar-foot { border-top: 1px solid #20242e; padding: 12px 6px 0; display: flex; align-items: center; justify-content: space-between; color: #8b93a5; font-size: 12px; }

.content { flex: 1; padding: 26px 34px 60px; max-width: 1200px; }
.content h2 { font-size: 20px; margin-bottom: 8px; }
.content h3 { font-size: 15px; margin: 22px 0 10px; color: #cfd5e2; }
.hint { color: #7f8798; font-size: 13px; margin-bottom: 14px; line-height: 1.7; }

/* ============ 卡片 ============ */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 14px 0 8px; }
.card { background: #171a21; border: 1px solid #242a36; border-radius: 12px; padding: 16px; color: #9aa3b5; }
.card-num { font-size: 28px; font-weight: 700; color: #e6e8ee; margin-bottom: 4px; }
@media (max-width: 900px) { .cards { grid-template-columns: repeat(2, 1fr); } }

.trend { display: flex; align-items: flex-end; gap: 14px; height: 130px; padding: 12px 16px; background: #171a21; border: 1px solid #242a36; border-radius: 12px; }
.bar-wrap { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; flex: 1; height: 100%; }
.bar { width: 60%; max-width: 46px; background: linear-gradient(180deg, #4a7dff, #2d5be3); border-radius: 6px 6px 2px 2px; min-width: 10px; }
.bar-wrap span { font-size: 11px; color: #7f8798; }

/* ============ 面板 / 表单行 ============ */
.panel { background: #171a21; border: 1px solid #242a36; border-radius: 12px; padding: 18px; margin-bottom: 8px; }
.form-row { display: flex; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.form-row label { flex: 0 1 260px; font-size: 13px; color: #aab2c2; display: flex; flex-direction: column; gap: 6px; }
.form-row label.grow { flex: 1 1 420px; }
.form-row label.mode span { display: flex; gap: 16px; padding: 8px 0; }
.btn-row { display: flex; gap: 10px; margin-top: 6px; }

/* ============ 按钮 ============ */
.btn { background: #232936; color: #dfe5f1; border: 1px solid #2e3646; border-radius: 8px; padding: 8px 16px; font-size: 14px; cursor: pointer; }
.btn:hover { background: #2a3242; }
.btn.primary { background: #2f62ea; border-color: #2f62ea; color: #fff; }
.btn.primary:hover { background: #3d70f5; }
.btn.danger { color: #ff9a9a; border-color: #5b2a2a; }
.btn.danger:hover { background: #3a1f1f; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.block { width: 100%; margin-top: 6px; padding: 10px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ============ 表格 ============ */
.table { width: 100%; border-collapse: collapse; background: #171a21; border: 1px solid #242a36; border-radius: 12px; overflow: hidden; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #20242e; font-size: 13px; vertical-align: top; }
.table th { background: #1b1f27; color: #8b93a5; font-weight: 500; white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table td.preview { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #9aa3b5; }
.table td.ops { white-space: nowrap; display: flex; gap: 6px; flex-wrap: wrap; }
.empty { text-align: center; color: #6f7788; padding: 22px 0 !important; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; background: #232936; color: #aab2c2; }
.tag.ok { background: #1c3a2a; color: #7fe0a8; }
.tag.vip { background: #3a2f14; color: #ffd479; }
.tag.err { background: #3a1c1c; color: #ff9a9a; }

/* 可排序表头 */
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: #e6e8ee; }
.table th.sort-active { color: #6aa8ff; }

/* ============ 分页 ============ */
.pager { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: #8b93a5; font-size: 13px; flex-wrap: wrap; }
.pager select, .pager input { width: auto; padding: 4px 8px; font-size: 12px; }
.pager .page-jump { width: 64px; text-align: center; }
.pager .page-total { color: #7f8798; }

/* ============ 二级验证（TOTP） ============ */
.fa-qr { width: 220px; min-height: 220px; background: #fff; border-radius: 10px; padding: 10px; display: flex; align-items: center; justify-content: center; }
.fa-qr svg { width: 200px; height: 200px; display: block; }
.fa-info { flex: 1 1 360px; color: #aab2c2; font-size: 13px; line-height: 1.9; }
.fa-info code { background: #10131a; border: 1px solid #2c3342; border-radius: 6px; padding: 2px 8px; color: #ffd479; word-break: break-all; }
#login-2fa label { display: block; margin-bottom: 14px; color: #aab2c2; font-size: 13px; }
#login-2fa input { width: 100%; margin-top: 6px; letter-spacing: 4px; text-align: center; font-size: 18px; }

/* ============ 通用弹窗 ============ */
.modal-mask { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal { width: 420px; max-width: calc(100vw - 40px); background: #171a21; border: 1px solid #2a3140; border-radius: 14px; padding: 22px 22px 18px; box-shadow: 0 24px 70px rgba(0, 0, 0, .55); }
.modal h3 { margin: 0 0 8px; font-size: 16px; color: #e6e8ee; }
.modal .hint { white-space: pre-wrap; margin: 0 0 4px; }
.modal-field { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #aab2c2; }
.modal-field input { width: 100%; }
.modal-btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ============ 上传进度条 ============ */
.progress-bar { height: 8px; background: #10131a; border: 1px solid #2c3342; border-radius: 6px; overflow: hidden; margin-top: 10px; }
.progress-bar > div { height: 100%; width: 0; background: linear-gradient(90deg, #2f62ea, #4a7dff); transition: width .2s ease; }

/* ============ toast ============ */
.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px); background: #23304a; color: #dfe5f1; padding: 10px 22px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 99; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #4a2323; color: #ffc9c9; }
