/* ============ Dama 打码平台 —— 基础样式（用户端 + 管理端共用） ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --bg: #0b0e14;
  --bg-2: #11151f;
  --panel: #161b28;
  --panel-2: #1c2232;
  --border: #232a3b;
  --border-2: #2e3648;
  --text: #e6e9f0;
  --text-2: #9aa3b5;
  --text-3: #6b7488;
  --accent: #5b7cfa;
  --accent-2: #7c5bfa;
  --green: #2fbf71;
  --yellow: #f5b942;
  --red: #f2564b;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0,0,0,.35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
}
[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-2: #eef1f8;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --border: #e4e8f0;
  --border-2: #d4dae6;
  --text: #1a2233;
  --text-2: #5a6478;
  --text-3: #98a1b3;
  --shadow: 0 4px 20px rgba(30,40,70,.08);
}

html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 侧边栏布局（用户端） ---------- */
.app-shell { display: flex; flex-direction: row; min-height: 100vh; }
.app-side {
  width: 230px; flex-shrink: 0;
  background: var(--bg-2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.app-brand { padding: 20px 18px; font-size: 17px; font-weight: 700; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.app-brand .logo { font-size: 22px; }
.app-nav { flex: 1; padding: 14px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.app-nav button {
  display: flex; align-items: center; gap: 11px;
  background: none; border: none; color: var(--text-2); cursor: pointer;
  padding: 11px 13px; border-radius: 9px; font-size: 14px; text-align: left; transition: all .15s; width: 100%;
}
.app-nav button .ico { font-size: 17px; width: 22px; text-align: center; flex-shrink: 0; }
.app-nav button:hover { color: var(--text); background: var(--panel); }
.app-nav button.active { color: var(--accent); background: var(--panel); font-weight: 600; }

.app-user {
  padding: 14px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px;
}
.app-user-info { flex: 1; min-width: 0; }
.app-user-info .name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-user-info .bal { font-size: 12px; color: var(--text-3); }
.app-user-info .bal b { color: var(--accent); font-weight: 700; }
.icon-btn {
  background: none; border: 1px solid var(--border); color: var(--text-2);
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 15px; transition: all .15s; flex-shrink: 0;
}
.icon-btn:hover { color: var(--red); border-color: var(--red); }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px; border-bottom: 1px solid var(--border); background: var(--bg-2);
  position: sticky; top: 0; z-index: 50;
}
.app-top-title { font-size: 18px; font-weight: 700; }
.app-top-right { display: flex; gap: 8px; }
.app-content { padding: 24px 26px 60px; max-width: 1120px; width: 100%; }

.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; white-space: nowrap; }
.brand .logo { font-size: 22px; }
.brand .sub { font-size: 11px; color: var(--text-3); font-weight: 500; }

/* ---------- 布局 ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 26px 22px 60px; }
.page-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.page-desc { color: var(--text-2); margin-bottom: 22px; font-size: 13px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- 卡片 ---------- */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.card h3 .hint { font-size: 12px; color: var(--text-3); font-weight: 400; }

/* ---------- 统计卡 ---------- */
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat-ic { font-size: 22px; margin-bottom: 2px; }
.stat .v { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.stat .k { color: var(--text-2); font-size: 13px; }
.stat .d { font-size: 12px; color: var(--text-3); }

/* ---------- 信息行（账户页） ---------- */
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; gap: 12px; }
.info-row:last-child { border-bottom: none; }
.info-row .k { color: var(--text-2); flex-shrink: 0; }
.info-row .v { font-weight: 500; text-align: right; word-break: break-all; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--text-3); font-weight: 500; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--border); }
tbody tr:hover { background: var(--panel-2); }
.mono { font-family: "SF Mono", "JetBrains Mono", Consolas, monospace; font-size: 12.5px; }

/* ---------- 徽章 ---------- */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge.green { background: rgba(47,191,113,.15); color: var(--green); }
.badge.red { background: rgba(242,86,75,.15); color: var(--red); }
.badge.yellow { background: rgba(245,185,66,.15); color: var(--yellow); }
.badge.blue { background: rgba(91,124,250,.15); color: var(--accent); }
.badge.gray { background: rgba(107,116,136,.15); color: var(--text-2); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  padding: 9px 18px; border-radius: 9px; font-size: 14px; font-weight: 600;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.danger { background: var(--red); }
.btn.sm { padding: 5px 12px; font-size: 13px; border-radius: 7px; }
.btn.green { background: var(--green); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.input, select, textarea {
  width: 100%; background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px; padding: 10px 13px;
  font-size: 14px; font-family: inherit; outline: none; transition: border .15s;
}
.input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }
.input-row { display: flex; gap: 10px; }
.input-row .input { flex: 1; }

/* ---------- 公告条 ---------- */
.announce {
  background: rgba(245,185,66,.12); border: 1px solid rgba(245,185,66,.3);
  color: var(--yellow); padding: 10px 16px; border-radius: 10px; margin-bottom: 18px;
  display: flex; align-items: flex-start; gap: 8px; font-size: 13px;
}
.announce .x { margin-left: auto; cursor: pointer; color: var(--text-3); font-weight: 700; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  max-width: 560px; width: 100%; max-height: 88vh; overflow-y: auto; padding: 24px;
}
.modal h3 { margin-bottom: 16px; font-size: 17px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ---------- 提示 toast ---------- */
#toast-wrap { position: fixed; top: 72px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow);
  font-size: 13px; max-width: 340px; animation: slideIn .25s ease;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 46px 20px; color: var(--text-3); }
.empty .ic { font-size: 40px; margin-bottom: 10px; opacity: .6; }

/* ---------- 代码块 ---------- */
pre.code {
  background: #0a0d14; border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; overflow-x: auto; font-family: "SF Mono", Consolas, monospace;
  font-size: 12.5px; line-height: 1.7; color: #cdd6e4; margin: 10px 0;
}
code.inline { background: var(--panel-2); padding: 1px 6px; border-radius: 5px; font-family: Consolas, monospace; font-size: 12.5px; }

/* ---------- 认证页 ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .tabs { display: flex; gap: 6px; margin-bottom: 20px; }
.auth-card .tabs button { flex: 1; background: var(--panel-2); border: 1px solid var(--border); color: var(--text-2); padding: 10px; border-radius: 9px; cursor: pointer; font-weight: 600; }
.auth-card .tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- 文档 ---------- */
.doc-block { margin-bottom: 26px; }
.doc-block h4 { font-size: 16px; margin-bottom: 8px; }
.endpoint {
  display: flex; align-items: center; gap: 10px; margin: 8px 0 4px;
  font-family: Consolas, monospace; font-size: 13px; flex-wrap: wrap;
}
.method { padding: 2px 10px; border-radius: 6px; font-weight: 700; font-size: 12px; color: #fff; }
.method.get { background: #2fbf71; }
.method.post { background: #5b7cfa; }
.method.delete { background: #f2564b; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { border: 1px solid var(--border); padding: 8px 11px; text-align: left; }
.tbl th { background: var(--panel-2); }

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .app-side { width: 64px; }
  .app-brand span, .app-nav button span:not(.ico), .app-user-info { display: none; }
  .app-nav button { justify-content: center; padding: 11px 0; }
  .app-brand { justify-content: center; padding: 20px 0; }
  .app-user { justify-content: center; }
  .app-top { padding: 12px 14px; }
  .app-top-right .btn span { display: none; }
  .app-content { padding: 18px 14px 50px; }
  .container { padding: 20px 14px 50px; }
}
