:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #1f2430;
  --muted: #8a90a0;
  --line: #edf0f5;
  --primary: #5b5bd6;
  --primary-dark: #4a4ac4;
  --primary-soft: #f0f0ff;
  --danger: #e05a5a;
  --danger-soft: #fff1f1;
  --shadow: 0 2px 6px rgba(31, 36, 48, .03), 0 12px 32px rgba(31, 36, 48, .04);
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 18px; height: 18px; fill: currentColor; flex: none; }

.app { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 236px;
  flex: none;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 26px 16px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 30px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, #6d6de8, #4a4ac4);
  color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 14px rgba(91, 91, 214, .28);
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-text { display: flex; flex-direction: column; gap: 2px; }
.brand-text strong { font-size: 16px; letter-spacing: .3px; }
.brand-text span { font-size: 10px; color: var(--muted); letter-spacing: .6px; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 11px 13px;
  border: 0; border-radius: 10px;
  background: transparent; color: #666d7d;
  text-align: left; transition: .18s;
}
.nav-item svg { width: 19px; height: 19px; }
.nav-item:hover { background: #f7f7fc; color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.sidebar-foot { margin-top: auto; }
.foot-card { background: #f8f8fc; border: 1px solid var(--line); border-radius: 12px; padding: 13px; }
.foot-title { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.foot-title svg { width: 15px; height: 15px; }
.foot-path { margin: 9px 0 7px; font-size: 13px; font-weight: 600; word-break: break-all; line-height: 1.5; }
.foot-link {
  display: inline-flex; align-items: center; gap: 2px;
  border: 0; background: none; padding: 0;
  color: var(--primary); font-size: 12px;
}
.foot-link svg { width: 13px; height: 13px; }
.foot-note { text-align: center; color: #b0b4c0; font-size: 11px; margin: 16px 0 0; }

/* ---------- 主区域 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 88px; padding: 0 36px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: .2px; }
.topbar p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.topbar-right { display: flex; gap: 10px; }
.content { padding: 28px 36px 48px; max-width: 1500px; flex: 1; width: 100%; }
.view { display: none; animation: fade .25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 15px; border-radius: 9px;
  border: 1px solid transparent; font-size: 13px; font-weight: 500;
  transition: .18s; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(91, 91, 214, .22); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; border-color: #e5e8ef; color: #5d6472; }
.btn-ghost:hover { background: #f8f8fc; border-color: #d8dce7; }
.btn-ghost.danger { color: var(--danger); }
.btn-ghost.danger:hover { background: var(--danger-soft); border-color: #f5cccc; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 统计卡片 ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow);
}
.stat-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.blue { background: #eef2ff; color: #5b6ee8; }
.stat-icon.purple { background: #f4efff; color: #8b5bd6; }
.stat-icon.green { background: #eaf8f1; color: #2fa46a; }
.stat-icon.orange { background: #fff4e8; color: #e08a3c; }
.stat-card > div:last-child { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 21px; line-height: 1.1; letter-spacing: .3px; }
.stat-text { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 拖拽上传 ---------- */
.dropzone {
  border: 1.5px dashed #cfd3e4; border-radius: var(--radius);
  background: #fff; padding: 26px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  cursor: pointer; transition: .2s; margin-bottom: 20px;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: #fafaff; }
.dropzone.dragover { transform: scale(1.005); }
.drop-icon {
  width: 46px; height: 46px; border-radius: 13px; background: var(--primary-soft);
  color: var(--primary); display: grid; place-items: center; margin-bottom: 3px;
}
.drop-icon svg { width: 23px; height: 23px; }
.drop-text { font-size: 14px; font-weight: 500; }
.drop-text span { color: var(--primary); }
.drop-hint { font-size: 12px; color: var(--muted); }

/* ---------- 面板 ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.panel-head h2 { margin: 0; font-size: 15px; }
.panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.count-badge {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 20px;
  background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 600;
}
.filters { display: flex; gap: 9px; flex-wrap: wrap; }
.search-box {
  display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px;
  border: 1px solid #e5e8ef; border-radius: 8px; background: #fff; color: var(--muted);
}
.search-box svg { width: 15px; height: 15px; }
.search-box input { border: 0; outline: 0; width: 160px; font-size: 13px; color: var(--text); background: transparent; }
.select {
  height: 34px; padding: 0 26px 0 11px; border: 1px solid #e5e8ef; border-radius: 8px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%238a90a0'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center;
  appearance: none; color: #5d6472; font-size: 13px; outline: 0;
}

/* ---------- 文件表格 ---------- */
.table-wrap { overflow-x: auto; }
.file-table { width: 100%; border-collapse: collapse; min-width: 820px; }
.file-table th {
  text-align: left; padding: 12px 22px; font-size: 12px; font-weight: 500;
  color: var(--muted); background: #fbfbfd; border-bottom: 1px solid var(--line);
}
.file-table td { padding: 13px 22px; border-bottom: 1px solid #f3f4f8; font-size: 13px; vertical-align: middle; }
.file-table tbody tr:last-child td { border-bottom: 0; }
.file-table tbody tr:hover { background: #fcfcff; }
.file-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.file-ico {
  width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: #eef2ff; color: #5b6ee8;
}
.file-ico.svg-image { background: #eaf8f1; color: #2fa46a; }
.file-ico.svg-code { background: #f4efff; color: #8b5bd6; }
.file-ico.svg-archive { background: #fff4e8; color: #e08a3c; }
.file-meta { min-width: 0; }
.file-name { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.file-type { color: var(--muted); font-size: 11px; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 6px; background: #f4f5f9; color: #687083; font-size: 12px; }
.tag.none { color: #a8adba; }
.cell-muted { color: var(--muted); }
.align-right { text-align: right; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn {
  display: grid; place-items: center; width: 30px; height: 30px;
  border: 1px solid transparent; border-radius: 8px; background: transparent; color: #7b8292; transition: .15s;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); }
.icon-btn.delete:hover { background: var(--danger-soft); color: var(--danger); }
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 52px 20px; color: var(--muted); }
.empty svg { width: 38px; height: 38px; color: #c9cdd9; }
.empty strong { color: #656c7b; font-size: 14px; }
.empty span { font-size: 12px; }

/* ---------- 业务信息 ---------- */
.notice {
  display: flex; gap: 11px; align-items: flex-start;
  background: #f0f2ff; border: 1px solid #e0e3ff; color: #5a6080;
  padding: 14px 17px; border-radius: 12px; line-height: 1.7; font-size: 13px; margin-bottom: 20px;
}
.notice svg { color: var(--primary); margin-top: 2px; }
.notice strong { color: #3f4470; }
code { background: #e5e8ff; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.head-actions { display: flex; gap: 8px; }
.form-panel { padding-bottom: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; padding: 22px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-full { grid-column: 1 / -1; }
.field > span { font-size: 12px; color: #656c7b; font-weight: 500; }
.field input, .field textarea {
  width: 100%; border: 1px solid #e5e8ef; border-radius: 9px; padding: 9px 12px;
  outline: 0; color: var(--text); background: #fff; font-size: 13px; resize: vertical; transition: .15s;
}
.field input:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,91,214,.09); }
.form-actions { display: flex; gap: 10px; padding-top: 4px; }
.json-panel pre {
  margin: 0; padding: 20px 22px; overflow: auto; max-height: 280px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.7; color: #55607a; background: #fcfcfe;
}

/* ---------- 设置 ---------- */
.setting-block { padding: 20px 22px; }
.setting-row { display: flex; align-items: center; gap: 14px; }
.setting-icon {
  width: 42px; height: 42px; border-radius: 11px; background: var(--primary-soft);
  color: var(--primary); display: grid; place-items: center; flex: none;
}
.setting-icon svg { width: 20px; height: 20px; }
.setting-info { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.setting-info strong { font-size: 14px; word-break: break-all; }
.setting-info span { color: var(--muted); font-size: 12px; line-height: 1.5; }
.setting-actions { display: flex; gap: 8px; margin-top: 16px; padding-left: 56px; }
.tips { border-top: 1px solid var(--line); padding: 18px 22px 22px; }
.tips h3 { margin: 0 0 10px; font-size: 13px; }
.tips ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 2; }
.danger-panel .setting-row { padding: 20px 22px; }

/* ---------- 页脚 ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 18px 36px;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  color: var(--muted); font-size: 12px; background: var(--panel);
}
.footer a { color: var(--muted); text-decoration: none; transition: color .15s; }
.footer a:hover { color: var(--primary); }
.footer span::after { content: "·"; margin-left: 14px; color: #c9cdd9; }

/* ---------- 弹窗 / 提示 ---------- */
.toast-wrap { position: fixed; top: 20px; right: 22px; z-index: 90; display: flex; flex-direction: column; gap: 9px; }
.toast {
  min-width: 220px; max-width: 360px; padding: 12px 15px; border-radius: 10px;
  background: #fff; border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(31,36,48,.13);
  display: flex; align-items: center; gap: 9px; font-size: 13px;
  animation: toastIn .22s ease;
}
.toast svg { width: 17px; height: 17px; color: var(--primary); }
.toast.error svg { color: var(--danger); }
.toast.out { animation: toastOut .2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(18px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(18px); } }

.modal-mask {
  position: fixed; inset: 0; background: rgba(24, 28, 40, .38); z-index: 100;
  display: grid; place-items: center; padding: 20px; backdrop-filter: blur(2px);
}
.modal-mask[hidden] { display: none; }
.modal {
  width: 380px; max-width: 100%; background: #fff; border-radius: 16px;
  padding: 26px; text-align: center; box-shadow: 0 20px 60px rgba(20,24,40,.2);
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-icon {
  width: 46px; height: 46px; margin: 0 auto 14px; border-radius: 13px;
  background: var(--danger-soft); color: var(--danger); display: grid; place-items: center;
}
.modal-icon svg { width: 22px; height: 22px; }
.modal h3 { margin: 0 0 8px; font-size: 16px; }
.modal p { margin: 0 0 22px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }
.modal-actions .btn { min-width: 100px; }

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .sidebar { width: 68px; padding: 20px 10px; align-items: center; }
  .brand-text, .nav-item span, .sidebar-foot { display: none; }
  .brand { padding-bottom: 24px; }
  .nav-item { justify-content: center; padding: 12px; }
  .topbar { height: auto; padding: 18px 18px; flex-wrap: wrap; }
  .content { padding: 20px 18px 40px; }
  .footer { padding: 16px 18px; flex-wrap: wrap; }
  .form-grid { grid-template-columns: 1fr; }
  .filters { width: 100%; }
  .search-box { flex: 1; }
  .search-box input { width: 100%; }
}
