/* ════════════════════════════════════════════════════════════════════
   AIAudit 设计系统（朱红印章风）
   v1.0 公共样式 — index + dashboard / login / register / members 共用

   变量约定与 index 保持一致：朱红主色、米色背景、衬线/无衬线/等宽三栈
   ════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700&family=JetBrains+Mono:wght@400;500;600&family=Noto+Sans+SC:wght@300;400;500;600&display=swap');

:root {
  --bg:       #f5f3ef;
  --bg2:      #edeae4;
  --panel:    #faf9f7;
  --white:    #ffffff;
  --ink:      #1c1a17;
  --ink2:     #4a4640;
  --ink3:     #8c8680;
  --ink4:     #b8b3ac;
  --border:   #ddd9d3;
  --border2:  #c8c3bb;

  --red:      #c0392b;
  --red-d:    #a03020;
  --red-bg:   rgba(192,57,43,.07);
  --red-brd:  rgba(192,57,43,.25);

  --green:    #2a7d4f;
  --green-bg: rgba(42,125,79,.08);
  --green-brd:rgba(42,125,79,.25);
  --amber:    #b45309;
  --amber-bg: rgba(180,83,9,.08);
  --amber-brd:rgba(180,83,9,.25);

  --f-serif:  'Noto Serif SC', 'SimSun', serif;
  --f-sans:   'Noto Sans SC', 'PingFang SC', sans-serif;
  --f-mono:   'JetBrains Mono', 'Consolas', monospace;
  --r: 4px;
  --shadow: 0 1px 3px rgba(28,26,23,.07), 0 4px 16px rgba(28,26,23,.05);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--f-sans);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  font-size: 13.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ── 顶栏（黑底朱印） ──────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: 54px; background: var(--ink);
  border-bottom: 2px solid var(--red);
  display: flex; align-items: center; padding: 0 28px;
}
.topbar a.logo-link {
  display: flex; align-items: center; text-decoration: none;
  color: inherit; cursor: pointer;
}
.topbar a.logo-link:hover .logo-name { color: rgba(255,255,255,.9); }
.logo-seal {
  width: 32px; height: 32px; background: var(--red); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-serif); font-size: 15px; font-weight: 700;
  color: #fff; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(192,57,43,.4);
}
.logo-name {
  font-family: var(--f-serif); font-size: 18px; font-weight: 700;
  color: #fff; margin-left: 10px; letter-spacing: .5px;
  transition: color .15s;
}
.logo-ver {
  font-family: var(--f-mono); font-size: 10px;
  color: rgba(255,255,255,.3); margin-left: 6px;
  border: 1px solid rgba(255,255,255,.15);
  padding: 1px 6px; border-radius: 3px;
}
.topbar-spacer { flex: 1; }
.topbar-info {
  font-size: 12px; color: rgba(255,255,255,.55);
  display: flex; align-items: center; gap: 14px;
}
.topbar-info .org-name { color: rgba(255,255,255,.85); font-weight: 500; }
.topbar-info .role-tag {
  font-family: var(--f-mono); font-size: 10px; padding: 2px 7px;
  border-radius: 3px; background: rgba(192,57,43,.18); color: #ff8d7a;
  border: 1px solid rgba(192,57,43,.4); letter-spacing: .3px;
}
.topbar-info .role-tag.staff {
  background: rgba(255,255,255,.1); color: rgba(255,255,255,.7);
  border-color: rgba(255,255,255,.2);
}
.topbar-info .trial-tag {
  font-size: 11px; padding: 3px 9px; border-radius: 3px;
  background: rgba(180,83,9,.18); color: #ffb86b;
  border: 1px solid rgba(180,83,9,.4);
}
.topbar-info .trial-tag.expired {
  background: rgba(192,57,43,.18); color: #ff8d7a;
  border-color: rgba(192,57,43,.4);
}
.topbar-info a, .topbar-info button.link-btn {
  color: rgba(255,255,255,.6); text-decoration: none;
  background: none; border: none; font-size: 12px; cursor: pointer;
  font-family: inherit; padding: 0;
}
.topbar-info a:hover, .topbar-info button.link-btn:hover { color: #fff; }
.status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #3dba7e; box-shadow: 0 0 6px rgba(61,186,126,.6);
  display: inline-block;
}

/* ── 主区域 ──────────────────────────────────── */
.layout { margin-top: 54px; padding: 36px 28px 80px; }
.container {
  max-width: 1100px; margin: 0 auto;
}

/* ── 页头 ───────────────────────────────────── */
.pg-head { margin-bottom: 28px; }
.pg-eyebrow {
  font-family: var(--f-mono); font-size: 10.5px; color: var(--red);
  letter-spacing: 1.5px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px;
}
.pg-eyebrow::after { content:''; flex: 0 0 36px; height: 1.5px; background: var(--red-brd); }
.pg-title {
  font-family: var(--f-serif); font-size: 26px; font-weight: 700;
  color: var(--ink); letter-spacing: -.2px; line-height: 1.2;
}
.pg-desc { font-size: 13px; color: var(--ink3); margin-top: 6px; }

/* ── 卡片 ───────────────────────────────────── */
.card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 6px; padding: 22px 24px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 10.5px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: var(--ink3);
  margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}

/* ── 统计卡（admin dashboard 顶部）─────────── */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; margin-bottom: 22px;
}
.stat-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 6px; padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(28,26,23,.04);
}
.stat-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: var(--ink3); margin-bottom: 6px;
}
.stat-value {
  font-family: var(--f-serif); font-size: 26px; font-weight: 700;
  color: var(--ink); line-height: 1.1;
}
.stat-value.danger { color: var(--red); }
.stat-value.warn   { color: var(--amber); }
.stat-value.ok     { color: var(--green); }
.stat-sub { font-size: 11px; color: var(--ink4); margin-top: 4px; }

/* ── 表单 ───────────────────────────────────── */
.fg { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.lbl {
  font-size: 10.5px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; color: var(--ink3);
}
.lbl .req { color: var(--red); margin-left: 2px; }
.inp {
  background: var(--bg); border: 1px solid var(--border2);
  border-radius: var(--r); padding: 9px 12px; color: var(--ink);
  font-family: var(--f-sans); font-size: 13.5px;
  outline: none; width: 100%; transition: border-color .15s, box-shadow .15s;
}
.inp:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-bg);
  background: var(--white);
}
.inp::placeholder { color: var(--ink4); }
.hint { font-size: 11px; color: var(--ink4); margin-top: 4px; }

/* ── 按钮 ───────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--r); border: none;
  font-family: var(--f-sans); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s; text-decoration: none;
}
.btn-primary {
  background: var(--red); color: #fff;
  box-shadow: 0 1px 2px rgba(192,57,43,.3);
}
.btn-primary:hover { background: var(--red-d); }
.btn-primary:disabled { background: var(--ink4); cursor: not-allowed; box-shadow: none; }
.btn-secondary {
  background: var(--white); color: var(--ink2);
  border: 1px solid var(--border2);
}
.btn-secondary:hover { border-color: var(--red); color: var(--red); }
.btn-text {
  background: none; padding: 6px 8px; color: var(--red);
  font-size: 12px; font-weight: 500;
}
.btn-text:hover { color: var(--red-d); text-decoration: underline; }
.btn-text.danger { color: #c0392b; }
.btn-text.muted  { color: var(--ink3); }

.btn-sm {
  padding: 5px 11px; font-size: 11px;
  border-radius: var(--r);
  border: 1px solid var(--border2); background: var(--bg); color: var(--ink3);
  cursor: pointer; transition: all .15s; font-family: inherit;
}
.btn-sm:hover { border-color: var(--red); color: var(--red); }
.btn-sm.danger:hover { border-color: #e53e3e; color: #e53e3e; }

/* ── 表格 ───────────────────────────────────── */
.tbl {
  width: 100%; border-collapse: collapse; background: var(--white);
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
.tbl thead {
  background: var(--bg2);
}
.tbl th {
  font-size: 10.5px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: var(--ink3);
  text-align: left; padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.tbl td {
  padding: 12px 14px; font-size: 13px; color: var(--ink2);
  border-bottom: 1px solid var(--border);
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .15s; cursor: pointer; }
.tbl tbody tr:hover { background: var(--bg); }
.tbl .col-name { font-weight: 600; color: var(--ink); }
.tbl .col-mono { font-family: var(--f-mono); font-size: 12px; color: var(--ink3); }
.tbl .col-actions { text-align: right; white-space: nowrap; }
.tbl .col-actions .btn-sm { padding: 4px 9px; }

.status-tag {
  display: inline-block; font-size: 11px; padding: 2px 8px;
  border-radius: 10px; font-weight: 500;
}
.status-tag.active   { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-brd); }
.status-tag.archived { background: var(--bg2); color: var(--ink3); border: 1px solid var(--border); }
.status-tag.failed   { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-brd); }
.status-tag.warn     { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-brd); }

.role-badge {
  display: inline-block; font-family: var(--f-mono);
  font-size: 10.5px; padding: 2px 7px; border-radius: 3px;
  letter-spacing: .3px;
}
.role-badge.admin { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-brd); }
.role-badge.staff { background: var(--bg2); color: var(--ink3); border: 1px solid var(--border); }

/* ── 工具栏（搜索/筛选）───────────────────── */
.toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 14px 16px; background: var(--white);
  border: 1px solid var(--border); border-radius: 6px;
  margin-bottom: 14px; box-shadow: 0 1px 2px rgba(28,26,23,.04);
}
.toolbar .inp { width: auto; flex: 0 0 auto; }
.toolbar .grow { flex: 1; }
.toolbar .right { margin-left: auto; }

/* ── 空状态 ─────────────────────────────────── */
.empty {
  background: var(--white); border-radius: 6px; padding: 60px 30px;
  text-align: center; border: 1px dashed var(--border2);
}
.empty-title {
  font-family: var(--f-serif); font-size: 20px; color: var(--ink);
  margin-bottom: 6px;
}
.empty-desc {
  color: var(--ink3); font-size: 13px; margin-bottom: 22px;
}
.empty .ctas { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── 错误/提示信息 ──────────────────────────── */
.msg-err { color: var(--red); font-size: 12.5px; margin-top: 8px; min-height: 18px; }
.msg-ok  { color: var(--green); font-size: 12.5px; margin-top: 8px; }

/* ── 弹窗 ───────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(28,26,23,.45); z-index: 9000;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--white); border-radius: 8px; width: 480px; max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.18); overflow: hidden;
  border: 1px solid var(--border);
}
.modal-head {
  padding: 18px 22px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { font-family: var(--f-serif); font-size: 16px; font-weight: 700; }
.modal-close {
  width: 28px; height: 28px; border-radius: 50%; border: none;
  background: var(--bg2); color: var(--ink3); font-size: 16px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--border); }
.modal-body { padding: 18px 22px; max-height: 68vh; overflow-y: auto; }
.modal-foot {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ── 登录/注册卡片（窄页面）────────────────── */
.auth-wrap {
  min-height: calc(100vh - 54px); display: flex;
  align-items: center; justify-content: center;
  padding: 40px 20px; margin-top: 54px;
}
.auth-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 8px; padding: 36px 36px 30px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow);
}
.auth-title {
  font-family: var(--f-serif); font-size: 22px; font-weight: 700;
  color: var(--ink); text-align: center; margin-bottom: 4px;
}
.auth-sub {
  font-size: 12.5px; color: var(--ink3);
  text-align: center; margin-bottom: 24px;
}
.auth-links { margin-top: 18px; font-size: 12.5px; text-align: center; color: var(--ink3); }
.auth-links a, .auth-links button.link-btn {
  color: var(--red); text-decoration: none; margin: 0 6px;
  background: none; border: none; cursor: pointer; font-size: inherit;
}
.auth-links a:hover, .auth-links button.link-btn:hover { color: var(--red-d); text-decoration: underline; }

/* 验证码行（输入框 + 发送按钮）*/
.code-row { display: flex; gap: 8px; }
.code-row .inp { flex: 1; }
.code-row button {
  flex: 0 0 102px; padding: 9px 12px; font-size: 12px;
  background: var(--bg); border: 1px solid var(--border2);
  border-radius: var(--r); color: var(--ink2); cursor: pointer;
  transition: all .15s; font-family: inherit;
}
.code-row button:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.code-row button:disabled { color: var(--ink4); cursor: not-allowed; }

/* 邀请码识别条 */
.invite-banner {
  background: var(--amber-bg); border: 1px solid var(--amber-brd);
  padding: 9px 12px; border-radius: var(--r);
  font-size: 12.5px; color: var(--amber); margin-bottom: 14px;
}
.invite-banner code { font-family: var(--f-mono); font-weight: 600; }
