:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #dc2626;
  --accent-soft: #fef2f2;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --radius: 14px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

.page-shell {
  max-width: 880px;
  margin: 0 auto;
  padding: 12px 12px 28px;
}

/* 顶部红白温馨提示横幅 */
.notice-banner {
  background: linear-gradient(135deg, #fff5f5 0%, #ffffff 65%);
  border: 1px solid #fecaca;
  border-left: 5px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.06);
}

.notice-badge {
  flex-shrink: 0;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  margin-top: 2px;
}

.site-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: #991b1b;
}

.banner-text {
  margin: 0;
  font-size: 13px;
  color: #475569;
  white-space: pre-line;
}

/* 客服状态栏 */
.kf-bar {
  background: #0f172a;
  color: #f8fafc;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.kf-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.kf-pill {
  background: #22c55e;
  color: #052e16;
  font-weight: 700;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
}

.kf-sync-info {
  color: #cbd5e1;
  font-size: 12px;
}

.kf-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* 主卡片 */
.catalog-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.search-panel {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 42px;
  padding: 0 36px 0 38px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease;
}

.search-box input:focus {
  border-color: var(--blue);
}

.search-clear {
  position: absolute;
  right: 8px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.scope-chips {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.chip {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: #fff;
  color: #475569;
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.chip.active {
  background: var(--blue-soft);
  border-color: #93c5fd;
  color: #1d4ed8;
  font-weight: 600;
}

/* 面包屑栏 */
.nav-toolbar {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #fff;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 13.5px;
  min-width: 0;
}

.crumb-btn {
  border: none;
  background: transparent;
  color: var(--blue);
  padding: 3px 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13.5px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crumb-btn:hover {
  background: var(--blue-soft);
}

.crumb-btn.current {
  color: var(--text);
  font-weight: 600;
  cursor: default;
  background: transparent;
}

.crumb-sep {
  color: #94a3b8;
  font-size: 12px;
}

.dir-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.list-meta {
  padding: 7px 14px;
  font-size: 12px;
  color: var(--muted);
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
}

/* 目录/文件列表 */
.item-list {
  min-height: 220px;
}

.node-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.12s ease;
}

.node-row:last-child {
  border-bottom: none;
}

.node-row:hover {
  background: #f8fafc;
}

.node-row.highlight {
  background: #fefce8;
}

.node-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  cursor: pointer;
}

.node-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.node-text {
  min-width: 0;
  flex: 1;
}

.node-name {
  font-size: 14.5px;
  color: var(--text);
  word-break: break-word;
}

.node-subpath {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  word-break: break-all;
}

.node-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: #334155;
  font-size: 12px;
  padding: 5px 9px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}

.icon-btn:hover {
  background: #f1f5f9;
}

.icon-btn.accent {
  border-color: #fecaca;
  color: #b91c1c;
  background: var(--accent-soft);
}

.icon-btn.kf {
  border-color: #bfdbfe;
  color: #1d4ed8;
  background: var(--blue-soft);
}

.empty-state {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* 按钮与表单 */
.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
}

.btn-secondary {
  background: #f1f5f9;
  color: #1e293b;
  border-color: var(--border);
}

.btn-ghost {
  background: transparent;
  color: #cbd5e1;
  border-color: #334155;
}

/* 页脚 */
.site-footer {
  margin-top: 14px;
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
}

.footer-sep {
  margin: 0 6px;
}

.kf-entry-btn {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
}

/* 模态框 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 100;
}

.modal-card {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.modal-preview {
  max-width: 720px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.modal-compact {
  max-width: 400px;
}

.modal-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
}

.modal-subtitle {
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

.modal-close {
  border: none;
  background: #f1f5f9;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.preview-stage {
  padding: 12px;
  background: #f8fafc;
  overflow: auto;
  text-align: center;
  flex: 1;
}

.preview-stage img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  user-select: none;
  -webkit-user-drag: none;
}

.preview-loading,
.preview-error {
  padding: 40px 16px;
  font-size: 13.5px;
  color: var(--muted);
}

.preview-error {
  color: var(--accent);
}

.modal-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.preview-tip {
  font-size: 12px;
  color: var(--muted);
}

.modal-form {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
}

.form-input,
.form-textarea {
  width: 100%;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 14px;
  font-family: inherit;
}

.form-error {
  font-size: 12.5px;
  color: var(--accent);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 200;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

@media (max-width: 600px) {
  .page-shell {
    padding: 8px 8px 24px;
  }
  .notice-banner {
    padding: 12px;
  }
  .node-row {
    padding: 10px 10px;
  }
  .icon-btn {
    padding: 4px 7px;
  }
}
