:root {
  color-scheme: light;
  --primary: #3569ed;
  --primary-dark: #2758d7;
  --primary-soft: #eaf1ff;
  --bg: #f4f6fa;
  --card: #FFFFFF;
  --text: #172641;
  --muted: #758198;
  --border: #e8edf5;
  --border-2: #dfe6f0;
  --success: #38D290;
  --danger: #E94242;
  --warning: #F0B92F;
  --radius: 6px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
}
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: none; }

/* 顶部导航栏 */
.topbar { background: var(--card); box-shadow: 0 0 10px rgba(0,0,0,.1); position: sticky; top: 0; z-index: 50; }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: 0 20px; height: 64px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; min-width: 0; }
.brand-logo { height: 30px; width: 30px; align-self: center; object-fit: contain; flex-shrink: 0; }
.brand-name { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: .3px; line-height: 1.2; }
.brand-sub { font-size: 13px; color: var(--muted); line-height: 1.2; }
.topbar-right { position: relative; display: flex; align-items: center; gap: 12px; }
.user-btn {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--border-2); border-radius: 50%;
  cursor: pointer; color: #666; flex-shrink: 0;
}
.user-btn:hover { color: var(--primary); border-color: var(--primary); }
.user-btn svg { width: 17px; height: 17px; }
.user-panel {
  position: absolute; top: 48px; right: 0; z-index: 60;
  width: 200px; background: #fff; border: 1px solid var(--border-2); border-radius: 6px;
  box-shadow: 0 10px 30px rgba(23,38,65,.14); overflow: hidden; display: none;
}
.user-panel.open { display: block; }
.user-panel-head { padding: 14px 16px; border-bottom: 1px solid var(--border-2); }
.user-panel-name { font-size: 14px; font-weight: 600; color: var(--text); }
.user-panel-role { font-size: 12px; color: var(--muted); margin-top: 2px; }
.user-panel-item { display: flex; align-items: center; height: 44px; padding: 0 16px; font-size: 14px; color: var(--text); }
.user-panel-item:hover { background: var(--bg); color: var(--primary); }
.user-panel-item + .user-panel-item { border-top: 1px solid var(--border-2); }

/* Tab 菜单 */
.page-head { background: var(--card); box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.page-head-inner { max-width: 1280px; margin: 0 auto; padding: 14px 20px 0; }
.page-title { font-size: 20px; font-weight: 600; color: var(--text); line-height: 1.4; }
.tabbar { display: flex; align-items: flex-start; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-top: 8px; }
.tabbar::-webkit-scrollbar { display: none; }
.tabbar a {
  position: relative; display: inline-flex; align-items: center;
  height: 40px; padding: 0 16px; white-space: nowrap; flex-shrink: 0;
  font-size: 15px; color: #666; transition: color .2s;
}
.tabbar a::before { content: ''; position: absolute; left: 16px; right: 16px; top: 0; height: 3px; background: transparent; }
.tabbar a:hover { color: var(--primary); }
.tabbar a.active { color: var(--primary); font-weight: 500; }
.tabbar a.active::before { background: var(--primary); }

/* 内容区 */
.container { max-width: 1280px; margin: 20px auto; padding: 0 20px; }
.container-narrow { max-width: 720px; margin: 20px auto; padding: 0 20px; }
.flash { background: var(--primary-soft); color: var(--primary-dark); border: 1px solid #d6e4fb; padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.flash.error { background: #fdeaea; color: #c0392b; border-color: #f5c6c6; }

/* 卡片 */
.panel { background: var(--card); border: 1px solid var(--border-2); border-radius: 8px; padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(23,38,65,.04); }
.panel h2 { margin: 0 0 16px; font-size: 15px; font-weight: 500; color: var(--text); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

/* 表格 */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 13px; }
th { color: var(--muted); font-weight: 500; white-space: nowrap; background: #f8fafd; border-top: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; }

/* 状态标签 */
.badge { display: inline-block; padding: 0 8px; height: 20px; line-height: 20px; border-radius: 4px; font-size: 12px; white-space: nowrap; color: #fff; }
.badge.gray { background: #BFBFBF; }
.badge.green { background: var(--success); }
.badge.red { background: var(--danger); }
.badge.blue { background: var(--primary); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 36px; padding: 0 18px;
  background: var(--primary); color: #fff;
  border: 1px solid var(--primary); border-radius: 6px;
  cursor: pointer; font-family: inherit; font-size: 14px; line-height: 1;
  white-space: nowrap; transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.ghost { background: #fff; color: var(--primary); border-color: var(--border-2); }
.btn.ghost:hover { border-color: var(--primary); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn:disabled { background: #9CA3AF; border-color: #9CA3AF; cursor: not-allowed; }

/* 表单 */
.form-group { margin-bottom: 14px; }
.form-label { display: block; color: #374151; font-size: 13px; margin-bottom: 6px; }
.form-input, input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%; border: 1px solid #cbd5e1; border-radius: 6px; padding: 8px 10px;
  font-family: inherit; font-size: 14px; color: #111827; background: #fff;
}
.form-input:focus, input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[readonly], textarea[readonly] { background: #f3f4f6; color: #475467; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* 登录页 */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; background: linear-gradient(160deg, #3569ed 0%, #2758d7 100%); }
.login-card { width: 380px; margin: auto 0; background: #fff; border-radius: 10px; padding: 36px 32px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.login-card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; text-align: center; }
.login-card .login-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-card .btn { width: 100%; height: 42px; margin-top: 6px; }

/* 页脚备案信息 */
.site-footer {
  width: 100%;
  padding: 14px 20px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  white-space: nowrap;
}
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer img { display: inline-block; height: 16px; width: auto; vertical-align: middle; margin-right: 4px; }
.site-footer .sep { margin: 0 8px; opacity: .55; }
.site-footer--login { color: rgba(255, 255, 255, .75); }
.site-footer--login a { color: rgba(255, 255, 255, .85); }

/* 分栏主界面 */
.workspace { display: flex; gap: 16px; align-items: flex-start; padding: 16px 20px; max-width: 1500px; margin: 0 auto; }
.side { width: 360px; flex-shrink: 0; }
.preview-col { flex: 1; min-width: 0; }
.side-panel { background: #fff; border: 1px solid var(--border-2); border-radius: 8px; padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(23,38,65,.04); }
.side-panel h2 { margin: 0 0 12px; font-size: 16px; font-weight: 700; color: #1f2937; }
.form-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.form-row label { width: 96px; flex-shrink: 0; color: #374151; font-size: 13px; text-align: right; }
.form-row input, .form-row textarea { flex: 1; }
.form-row textarea { min-height: 60px; }
.btn-row { display: flex; gap: 10px; }
.meta-text { color: #667085; font-size: 12px; line-height: 1.6; white-space: pre-line; }

/* 日志 */
.log-box { background: #0f172a; color: #cbd5e1; border-radius: 6px; padding: 14px; font-family: Consolas, monospace; font-size: 12px; line-height: 1.7; max-height: 420px; overflow: auto; white-space: pre-wrap; }

/* 响应式 */
@media (max-width: 960px) {
  .workspace { flex-direction: column; }
  .side { width: 100%; }
}
