/* RhyPic 韵图 - 通用样式 */
:root {
  --border: #d9d9d9;
  --bg-elev: #fff;
  --text: #1f2329;
  --text-muted: #86909c;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f6f8;
  color: #1f2329;
  font-size: 14px;
  line-height: 1.6;
}
a { color: #3370ff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* 顶栏 */
.topbar {
  background: #fff;
  border-bottom: 1px solid #e5e6eb;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar .logo { font-size: 18px; font-weight: 700; color: #1f2329; }
.topbar .logo span { color: #3370ff; }
.topbar nav a { margin-left: 20px; color: #4e5969; }
.topbar nav a.active { color: #3370ff; font-weight: 600; }
.topbar .user-info { display: flex; align-items: center; gap: 12px; }
.topbar .avatar { width: 32px; height: 32px; border-radius: 50%; background: #3370ff; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; }

/* 容器 */
.container { max-width: 1200px; margin: 24px auto; padding: 0 24px; }

/* 卡片 */
.card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 { font-size: 16px; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  background: #fff;
  color: #1f2329;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}
.btn:hover { border-color: #3370ff; color: #3370ff; }
.btn-primary { background: #3370ff; color: #fff; border-color: #3370ff; }
.btn-primary:hover { background: #2860e0; color: #fff; }
.btn-danger { color: #f53f3f; border-color: #f53f3f; }
.btn-danger:hover { background: #f53f3f; color: #fff; }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 表格 */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #f0f1f5; font-size: 13px; }
th { background: #f7f8fa; color: #86909c; font-weight: 600; }
tr:hover td { background: #f7f8fa; }

/* 状态标签 */
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.tag-available { background: #e8ffea; color: #00b42a; }
.tag-pending { background: #fff7e8; color: #ff7d00; }
.tag-rejected { background: #ffece8; color: #f53f3f; }
.tag-deleted { background: #f2f3f5; color: #86909c; }
.tag-admin { background: #e8f3ff; color: #3370ff; }

/* 表单 */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; margin-bottom: 4px; color: #4e5969; font-size: 13px; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
.form-row input:focus, .form-row select:focus { outline: none; border-color: #3370ff; }
.form-inline { display: flex; gap: 12px; align-items: flex-end; }
/* 同行字段与按钮等高（38px），底部对齐 */
.form-inline .form-row { margin-bottom: 0; }
.form-inline .form-row input, .form-inline .form-row select { height: 38px; padding: 0 12px; }
.form-inline .btn { height: 38px; flex-shrink: 0; }

/* 策略表单：等宽网格，字段对齐 */
.policy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px 16px; }
.policy-grid .form-row { margin-bottom: 0; }
.policy-grid .form-row input, .policy-grid .form-row select { height: 38px; padding: 0 12px; }

/* 表单操作行：按钮单独一行右对齐 */
.form-actions { display: flex; justify-content: flex-end; margin-top: 14px; }

/* 提示框 */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 6px;
  color: #fff;
  z-index: 1000;
  animation: slideDown 0.2s;
}
.toast-success { background: #00b42a; }
.toast-error { background: #f53f3f; }
.toast-info { background: #3370ff; }
@keyframes slideDown { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* 统计卡片 */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat-card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: #1f2329; }
.stat-card .stat-label { color: #86909c; font-size: 13px; margin-top: 4px; }

/* 上传区域 */
.upload-zone {
  border: 2px dashed #d9d9d9;
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  color: #86909c;
  cursor: pointer;
  transition: all 0.15s;
}
.upload-zone:hover, .upload-zone.dragover { border-color: #3370ff; background: #f0f7ff; }

/* Pages 拖拽 ZIP 部署遮罩 */
.pages-drop-overlay {
  position: fixed; inset: 0; z-index: 999; display: none;
  align-items: center; justify-content: center;
  background: rgba(51,112,255,0.08);
}
.pages-drop-overlay.show { display: flex; }
.pages-drop-box {
  border: 3px dashed #3370ff; background: #fff; border-radius: 12px;
  padding: 48px 72px; color: #3370ff; font-size: 18px; font-weight: 600;
  box-shadow: 0 8px 30px rgba(51,112,255,0.18); pointer-events: none;
}
.pages-drop-overlay.warn { background: rgba(245,63,63,0.08); }
.pages-drop-overlay.warn .pages-drop-box {
  border-color: #f53f3f; color: #f53f3f; box-shadow: 0 8px 30px rgba(245,63,63,0.18);
}
tr.drag-target td { background: #e8f3ff !important; }

/* Pages 文件多选批量操作条 */
.batch-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; margin-bottom: 10px;
  background: #f0f7ff; border: 1px solid #bedaff; border-radius: 6px;
  font-size: 13px; color: #1f2329;
}
.batch-bar span { font-weight: 600; margin-right: 4px; }
.col-check { width: 40px; text-align: center; }
.col-check input[type="checkbox"] { cursor: pointer; }

/* 加载 */
.loading { display: inline-block; width: 16px; height: 16px; border: 2px solid #d9d9d9; border-top-color: #3370ff; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 空状态 */
.empty { text-align: center; padding: 40px; color: #86909c; }

/* 分页 */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.pagination button { padding: 6px 12px; border: 1px solid #d9d9d9; background: #fff; border-radius: 4px; cursor: pointer; }
.pagination button.active { background: #3370ff; color: #fff; border-color: #3370ff; }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* 模态框 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal { background: #fff; border-radius: 8px; padding: 24px; min-width: 400px; max-width: 90vw; }
.modal h3 { margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* 登录页 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #3370ff 0%, #5b8def 100%); }
.login-card { background: #fff; border-radius: 12px; padding: 48px; text-align: center; box-shadow: 0 8px 32px rgba(0,0,0,0.15); }
.login-card h1 { font-size: 28px; margin-bottom: 8px; }
.login-card h1 span { color: #3370ff; }
.login-card p { color: #86909c; margin-bottom: 32px; }

/* ===== Finder 文件管理器 ===== */
.finder-layout { display: flex; gap: 16px; align-items: flex-start; }
.finder-side { width: 240px; flex-shrink: 0; background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); padding: 12px 0; max-height: calc(100vh - 120px); overflow-y: auto; position: sticky; top: 80px; }
.finder-side h3 { font-size: 13px; color: #86909c; padding: 0 16px 8px; display: flex; justify-content: space-between; align-items: center; }
.finder-side h3 .icon-btn { font-size: 14px; }
.finder-tree { list-style: none; }
.finder-tree .tree-item { padding: 6px 16px; cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 6px; color: #4e5969; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.finder-tree .tree-item:hover { background: #f7f8fa; }
.finder-tree .tree-item.active { background: #e8f3ff; color: #3370ff; font-weight: 600; }
.finder-tree .tree-item .tree-count { margin-left: auto; font-size: 11px; color: #86909c; }
.finder-tree .tree-children { list-style: none; padding-left: 16px; }
.finder-main { flex: 1; min-width: 0; }
.finder-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.finder-breadcrumb { display: flex; align-items: center; gap: 4px; font-size: 13px; color: #4e5969; margin-bottom: 12px; flex-wrap: wrap; }
.finder-breadcrumb a { color: #3370ff; cursor: pointer; }
.finder-breadcrumb .sep { color: #c9cdd4; }
.finder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.finder-cell { background: #fff; border: 2px solid transparent; border-radius: 8px; padding: 10px 8px; text-align: center; cursor: pointer; position: relative; transition: border-color .12s; }
.finder-cell:hover { border-color: #c9cdd4; }
.finder-cell.selected { border-color: #3370ff; background: #f0f7ff; }
.finder-cell .cell-icon { height: 64px; display: flex; align-items: center; justify-content: center; font-size: 32px; color: #86909c; margin-bottom: 6px; }
.finder-cell .cell-icon img { max-width: 64px; max-height: 64px; border-radius: 4px; object-fit: cover; }
.finder-cell .cell-name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finder-cell .cell-meta { font-size: 11px; color: #86909c; margin-top: 2px; }
.finder-cell .cell-check { position: absolute; top: 6px; left: 6px; display: none; }
.finder-cell:hover .cell-check, .finder-cell.selected .cell-check { display: block; }
.finder-list-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #fff; border-bottom: 1px solid #f0f1f5; cursor: pointer; font-size: 13px; }
.finder-list-row:hover { background: #f7f8fa; }
.finder-list-row.selected { background: #f0f7ff; }
.finder-list-row .row-icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; color: #86909c; flex-shrink: 0; }
.finder-list-row .row-icon img { max-width: 32px; max-height: 32px; border-radius: 4px; object-fit: cover; }
.finder-list-row .row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finder-list-row .row-meta { color: #86909c; font-size: 12px; width: 90px; text-align: right; flex-shrink: 0; }
.finder-list-row .row-time { color: #86909c; font-size: 12px; width: 130px; flex-shrink: 0; }
.icon-btn { background: none; border: none; cursor: pointer; color: #86909c; padding: 2px 4px; font-size: 12px; border-radius: 4px; }
.icon-btn:hover { color: #3370ff; background: #f0f7ff; }
.finder-drop-tip { border: 2px dashed #3370ff !important; background: #f0f7ff !important; }
.ctx-menu { position: fixed; background: #fff; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); padding: 6px 0; z-index: 300; min-width: 140px; }
.ctx-menu .ctx-item { padding: 7px 16px; font-size: 13px; cursor: pointer; color: #1f2329; }
.ctx-menu .ctx-item:hover { background: #f0f7ff; color: #3370ff; }
.ctx-menu .ctx-item.danger { color: #f53f3f; }
.ctx-menu .ctx-item.danger:hover { background: #ffece8; }

/* ===== 内嵌 API 文档（api-keys 页） ===== */
.doc-lead { color: #4e5969; margin-bottom: 14px; }
.doc-h3 { font-size: 14px; margin: 20px 0 10px; color: #1f2329; }
.doc-h3:first-of-type { margin-top: 4px; }
.doc-lead code, .card p code, .doc-list code, .doc-more code {
  font-family: Consolas, Menlo, "Courier New", monospace;
  background: #f2f3f5; padding: 1px 6px; border-radius: 4px; font-size: 12.5px; color: #1f2329;
}
.doc-table code {
  font-family: Consolas, Menlo, "Courier New", monospace;
  background: #f2f3f5; padding: 1px 6px; border-radius: 4px; font-size: 12.5px; white-space: nowrap;
}
.doc-table { margin-bottom: 4px; }
.doc-more { color: #86909c; font-size: 12.5px; background: #fafbfc; }
.doc-list { margin: 0 0 4px 20px; color: #4e5969; }
.doc-list li { margin-bottom: 6px; }

/* 代码块 */
pre {
  background: #f7f8fa; border: 1px solid #e5e6eb; border-radius: 6px;
  padding: 12px 14px; margin: 8px 0 12px; overflow-x: auto;
}
pre code {
  font-family: Consolas, Menlo, "Courier New", monospace;
  background: none; padding: 0; font-size: 12.5px; color: #1f2329; line-height: 1.7;
  white-space: pre;
}

/* HTTP 方法标签 */
.m {
  display: inline-block; min-width: 52px; text-align: center;
  padding: 2px 8px; border-radius: 4px; font-size: 11.5px; font-weight: 700;
  font-family: Consolas, Menlo, monospace;
}
.m-get { background: #e8ffea; color: #009a29; }
.m-post { background: #e8f3ff; color: #165dff; }
.m-put { background: #fff7e8; color: #d25f00; }
.m-del { background: #ffece8; color: #cb2634; }
.m-patch { background: #f3e8ff; color: #722ed1; }

/* 接口小标题 / 子标题 */
.doc-h4 { font-size: 13.5px; margin: 16px 0 8px; color: #1f2329; }
.doc-ep {
  font-size: 13px; margin: 18px 0 8px; color: #1f2329;
  font-family: Consolas, Menlo, "Courier New", monospace;
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
}

/* scope 权限标签 */
.sc {
  display: inline-block; padding: 1px 7px; border-radius: 4px;
  font-size: 11px; font-weight: 600; font-family: Consolas, Menlo, monospace;
}
.sc-up { background: #e8f3ff; color: #165dff; }
.sc-read { background: #e8ffea; color: #009a29; }
.sc-any { background: #f2f3f5; color: #4e5969; }
