/* CTF-SecIDE 管理端 — Apple Design Language */
:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --border: rgba(0, 0, 0, 0.08);
  --hairline: rgba(0, 0, 0, 0.06);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-active: #0060c9;
  --green: #34c759;
  --orange: #ff9500;
  --red: #ff3b30;
  --purple: #af52de;
  --teal: #5ac8fa;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 2px rgba(0,0,0,.04), 0 8px 28px rgba(0,0,0,.05);
  --shadow-pop: 0 12px 48px rgba(0,0,0,.16), 0 2px 8px rgba(0,0,0,.06);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "PingFang SC", "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 15px; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(0,113,227,.06), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(175,82,222,.05), transparent 60%),
    var(--bg);
  color: var(--text);
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.hidden { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: rgba(0,113,227,.18); }

/* ---------- 按钮（Apple 胶囊） ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 980px; padding: 8px 18px;
  font-size: 14px; font-weight: 500; letter-spacing: -.01em; font-family: var(--font);
  cursor: pointer; transition: background .18s ease, transform .06s ease, opacity .15s, box-shadow .18s;
  white-space: nowrap; user-select: none;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(0,113,227,.35); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent-active); }
.btn-ghost { background: rgba(0,0,0,.045); color: var(--text); }
.btn-ghost:hover { background: rgba(0,0,0,.08); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #ff453a; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #30d158; }
.btn-warn { background: var(--orange); color: #fff; }
.btn-warn:hover { background: #ffa11f; }
.btn-sm { padding: 5px 13px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- 登录页 ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1000px 500px at 50% -20%, rgba(0,113,227,.10), transparent 65%),
    radial-gradient(800px 400px at 80% 120%, rgba(90,200,250,.08), transparent 60%);
}
.auth-card {
  width: 100%; max-width: 380px; background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 28px; box-shadow: var(--shadow-pop); padding: 44px 36px;
  text-align: center;
  animation: card-in .45s cubic-bezier(.2,.8,.25,1);
}
@keyframes card-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; } }
.auth-logo {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 18px;
  background: linear-gradient(145deg, #0a84ff, #0060c9);
  display: flex; align-items: center; justify-content: center; font-size: 32px;
  box-shadow: 0 8px 20px rgba(0,96,201,.35), inset 0 1px 0 rgba(255,255,255,.35);
}
.auth-card h1 { font-size: 22px; font-weight: 700; letter-spacing: -.03em; }
.auth-sub { color: var(--text-2); margin: 7px 0 24px; font-size: 14px; }
#auth-form { text-align: left; display: flex; flex-direction: column; gap: 13px; }
#auth-form label { font-size: 13px; font-weight: 500; color: var(--text-2); display: flex; flex-direction: column; gap: 6px; }
#auth-form input {
  border: 1px solid transparent; border-radius: 12px;
  padding: 12px 15px; font-size: 15px; font-family: var(--font); color: var(--text);
  outline: none; background: rgba(0,0,0,.045);
  transition: background .15s, border-color .15s, box-shadow .15s;
}
#auth-form input:hover { background: rgba(0,0,0,.06); }
#auth-form input:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0,113,227,.16); }
.auth-msg { min-height: 20px; margin-top: 13px; font-size: 13px; color: var(--red); }
.auth-msg.ok { color: #1f8a3d; }
.auth-tip { margin-top: 13px; font-size: 12px; color: var(--text-3); line-height: 1.7; }
.seg {
  display: flex; background: rgba(0,0,0,.06); border-radius: 11px;
  padding: 3px; margin-bottom: 20px;
}
.seg-btn {
  flex: 1; border: none; background: transparent; padding: 7px 0;
  border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--text-2);
  cursor: pointer; font-family: var(--font); transition: all .16s ease;
}
.seg-btn.active { background: #fff; color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.14), 0 0 0 .5px rgba(0,0,0,.04); }

/* ---------- 主框架（毛玻璃侧栏） ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0;
  background: rgba(255,255,255,.72);
  backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-right: 1px solid var(--hairline);
  display: flex; flex-direction: column; padding: 22px 14px;
  position: sticky; top: 0; height: 100vh; z-index: 10;
}
.brand {
  display: flex; align-items: center; gap: 10px; font-weight: 700;
  font-size: 17px; letter-spacing: -.02em; padding: 4px 10px 22px;
}
.brand-icon {
  width: 30px; height: 30px; border-radius: 9px; font-size: 16px;
  background: linear-gradient(145deg, #0a84ff, #0060c9);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 8px rgba(0,96,201,.3), inset 0 1px 0 rgba(255,255,255,.35);
}
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px;
  border-radius: 10px; color: var(--text); font-size: 14px;
  font-weight: 500; transition: background .14s ease, color .14s;
}
.nav-item:hover { background: rgba(0,0,0,.05); text-decoration: none; }
.nav-item.active { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(0,113,227,.35); }
.sidebar-foot { border-top: 1px solid var(--hairline); padding-top: 14px; }
.me-box { padding: 0 10px 12px; font-size: 13px; }
.me-box .me-email { font-weight: 600; word-break: break-all; }
.me-box .me-role { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.main { flex: 1; padding: 32px 36px 64px; max-width: 1180px; }

/* ---------- 页面通用 ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 27px; font-weight: 700; letter-spacing: -.03em; }
.page-desc { color: var(--text-2); font-size: 14px; margin-top: 5px; }
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-card); border: 1px solid rgba(0,0,0,.03);
  padding: 22px; margin-bottom: 20px;
  animation: card-in .35s cubic-bezier(.2,.8,.25,1);
}
.card-title { font-size: 16px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 14px; }

/* ---------- 统计卡片 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-card);
  border: 1px solid rgba(0,0,0,.03); padding: 18px 20px;
  transition: transform .18s ease, box-shadow .18s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0,0,0,.05), 0 14px 34px rgba(0,0,0,.08); }
.stat-label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.stat-value { font-size: 31px; font-weight: 700; letter-spacing: -.04em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-value.blue { color: var(--accent); } .stat-value.green { color: #1f8a3d; }
.stat-value.orange { color: #b36a00; } .stat-value.red { color: var(--red); }
.stat-value.purple { color: var(--purple); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .05em; padding: 8px 12px;
  border-bottom: 1px solid var(--hairline);
}
.tbl td { padding: 12px; border-bottom: 1px solid rgba(0,0,0,.045); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr.clickable { cursor: pointer; transition: background .12s; }
.tbl tr.clickable:hover td { background: rgba(0,113,227,.045); }
.tbl .muted { color: var(--text-3); font-size: 13px; }

/* ---------- 徽章（iOS 柔和胶囊） ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 980px;
  font-size: 12px; font-weight: 600; letter-spacing: 0;
}
.badge-pending  { background: rgba(255,149,0,.15);  color: #b36a00; }
.badge-approved { background: rgba(52,199,89,.16);  color: #1f8a3d; }
.badge-rejected { background: rgba(255,59,48,.13);  color: #d70015; }
.badge-banned   { background: rgba(0,0,0,.08);      color: #555; }
.badge-admin, .badge-super_admin { background: rgba(175,82,222,.15); color: #8944ab; }
.badge-user     { background: rgba(0,113,227,.11);  color: var(--accent); }
.badge-normal   { background: rgba(0,0,0,.06);      color: var(--text-2); }
.badge-important{ background: rgba(255,149,0,.15);  color: #b36a00; }
.badge-urgent   { background: rgba(255,59,48,.13);  color: #d70015; }
.badge-draft    { background: rgba(0,0,0,.06);      color: var(--text-2); }
.badge-published{ background: rgba(52,199,89,.16);  color: #1f8a3d; }
.badge-archived { background: rgba(0,0,0,.06);      color: var(--text-3); }

/* ---------- 筛选/工具条 ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input[type="text"], .toolbar select, .toolbar input[type="date"] {
  border: 1px solid transparent; border-radius: 10px;
  padding: 8px 13px; font-size: 14px; font-family: var(--font);
  background: rgba(0,0,0,.045); outline: none; color: var(--text);
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.toolbar input:hover, .toolbar select:hover { background: rgba(0,0,0,.06); }
.toolbar input:focus, .toolbar select:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0,113,227,.14); }
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  border: none; background: rgba(0,0,0,.05); border-radius: 980px;
  padding: 6px 14px; font-size: 13px; font-weight: 500; cursor: pointer;
  color: var(--text-2); font-family: var(--font); transition: all .14s ease;
}
.pill:hover { background: rgba(0,0,0,.09); }
.pill.active { background: var(--text); color: #fff; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 18px; }
.f-label { font-size: 13px; font-weight: 500; color: var(--text-2); display: flex; flex-direction: column; gap: 6px; }
.f-input, .f-select, .f-textarea {
  border: 1px solid transparent; border-radius: 10px;
  padding: 9px 13px; font-size: 14px; font-family: var(--font);
  background: rgba(0,0,0,.045); outline: none; color: var(--text); width: 100%;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.f-input:hover, .f-select:hover, .f-textarea:hover { background: rgba(0,0,0,.06); }
.f-input:focus, .f-select:focus, .f-textarea:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0,113,227,.14); }
.f-textarea { min-height: 90px; resize: vertical; line-height: 1.65; }

/* ---------- 开关（iOS） ---------- */
.switch { position: relative; width: 46px; height: 28px; display: inline-block; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 980px; background: rgba(120,120,128,.28);
  transition: background .2s ease; cursor: pointer;
}
.switch .slider::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.22), 0 0 1px rgba(0,0,0,.1);
  transition: transform .2s cubic-bezier(.2,.8,.25,1);
}
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::after { transform: translateX(18px); }
.perm-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid rgba(0,0,0,.05); font-size: 14px; }
.perm-row:last-child { border-bottom: none; }
.perm-row .perm-name { font-weight: 500; }
.perm-row .perm-desc { color: var(--text-3); font-size: 12px; margin-top: 2px; }

/* ---------- 描述列表 ---------- */
.dl { display: grid; grid-template-columns: 120px 1fr; row-gap: 11px; column-gap: 16px; font-size: 14px; }
.dl dt { color: var(--text-3); font-weight: 500; }
.dl dd { word-break: break-all; }

/* ---------- 模态框 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.3);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
  animation: fade-in .18s ease;
}
@keyframes fade-in { from { opacity: 0; } }
.modal {
  background: #fff; border-radius: 22px; padding: 26px; width: 100%;
  max-width: 560px; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-pop);
  animation: card-in .3s cubic-bezier(.2,.8,.25,1);
}
.modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 16px; letter-spacing: -.02em; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; top: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: rgba(28,28,30,.92); color: #fff; padding: 11px 22px;
  border-radius: 980px; font-size: 14px; font-weight: 500; letter-spacing: -.01em;
  box-shadow: 0 10px 34px rgba(0,0,0,.28);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: toast-in .3s cubic-bezier(.2,.8,.25,1);
  max-width: 80vw;
}
.toast.success { background: rgba(38,142,62,.94); }
.toast.error { background: rgba(215,0,21,.94); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.96); } to { opacity: 1; } }

/* ---------- 图表 ---------- */
.chart-box { width: 100%; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); margin-top: 10px; flex-wrap: wrap; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3.5px; margin-right: 5px; }

/* ---------- 空状态/加载 ---------- */
.empty { text-align: center; color: var(--text-3); padding: 46px 0; font-size: 14px; }
.spinner {
  width: 26px; height: 26px; border: 3px solid rgba(0,0,0,.08);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .7s linear infinite; margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pager { display: flex; align-items: center; gap: 12px; justify-content: flex-end; margin-top: 14px; font-size: 13px; color: var(--text-2); }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* ---------- 图标 ---------- */
.icon { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -3px; }
.icon-sm { width: 15px; height: 15px; }
.nav-item .icon { opacity: .78; }
.nav-item.active .icon { opacity: 1; }
.btn .icon { vertical-align: -2px; }
.auth-logo .icon { color: #fff; }
.brand-icon .icon { color: #fff; }
.foot-btns { display: flex; flex-direction: column; gap: 8px; }

/* ---------- API 文档页 ---------- */
.doc { line-height: 1.7; font-size: 14px; }
.doc h2 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; margin: 22px 0 10px; padding-top: 4px; }
.doc h2:first-child { margin-top: 0; }
.doc h3 { font-size: 14.5px; font-weight: 600; margin: 16px 0 8px; }
.doc p { color: var(--text-2); margin: 6px 0; }
.doc ul { color: var(--text-2); padding-left: 20px; margin: 6px 0; }
.doc li { margin: 3px 0; }
.doc table.doc-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.doc .doc-table th { text-align: left; padding: 7px 10px; background: rgba(0,0,0,.03); font-weight: 600; border: 1px solid rgba(0,0,0,.06); }
.doc .doc-table td { padding: 7px 10px; border: 1px solid rgba(0,0,0,.06); vertical-align: top; }
.doc code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  background: rgba(0,0,0,.05); border-radius: 6px; padding: 2px 6px;
}
.doc-code {
  position: relative; background: #1d1d1f; color: #e8e8ed; border-radius: 12px;
  padding: 14px 16px; margin: 8px 0; overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; line-height: 1.65; white-space: pre;
}
.doc-code .cmt { color: #7d7aff; }
.kv-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(0,0,0,.05); font-size: 14px; flex-wrap: wrap; }
.kv-row:last-child { border-bottom: none; }
.kv-row .kv-k { width: 110px; color: var(--text-3); font-weight: 500; flex-shrink: 0; }
.kv-row .kv-v { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; word-break: break-all; flex: 1; min-width: 200px; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static; flex-direction: row;
    align-items: center; padding: 10px 14px; gap: 8px; overflow-x: auto;
  }
  .brand { padding: 4px 6px; font-size: 15px; }
  .brand-icon { width: 26px; height: 26px; font-size: 14px; }
  .nav { flex-direction: row; }
  .nav-item { white-space: nowrap; padding: 7px 10px; font-size: 13px; }
  .sidebar-foot { border-top: none; padding-top: 0; display: flex; align-items: center; gap: 8px; margin-left: auto; }
  .me-box { display: none; }
  .sidebar-foot .btn { white-space: nowrap; }
  .main { padding: 20px 16px 64px; }
  .dl { grid-template-columns: 96px 1fr; }
  .page-title { font-size: 23px; }
}
