:root {
  --green: #07c160;
  --green-dark: #06ad56;
  --green-soft: #e8f8ef;
  --ink: #1a1a1a;
  --ink-2: #5a5f66;
  --ink-3: #8b9199;
  --line: #e5e6eb;
  --bg: #f5f6f7;
  --card: #ffffff;
  --amber: #ff9f0a;
  --amber-soft: #fff4e0;
  --blue: #1677ff;
  --blue-soft: #e8f1ff;
  --red: #fa5151;
  --red-soft: #ffeded;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; }

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

/* ------------------------------------------------------------- sidebar */
.sidebar {
  position: relative;
  transition: width .18s ease, flex-basis .18s ease;
  width: 208px;
  flex: 0 0 208px;
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-toggle {
  width: 30px; height: 30px; padding: 0; margin-right: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--ink-3); cursor: pointer;
}
.sidebar-toggle svg { width: 18px; height: 18px; display: block; }
.sidebar-toggle:hover { background: #eef0f3; color: var(--ink); }

/* 折叠态：只留图标 */
.app.sidebar-collapsed .sidebar { width: 64px; flex: 0 0 64px; }
.app.sidebar-collapsed .brand { justify-content: center; padding: 18px 6px 14px; }
.app.sidebar-collapsed .brand-name,
.app.sidebar-collapsed .nav-label,
.app.sidebar-collapsed .nav-group-title,
.app.sidebar-collapsed .who,
.app.sidebar-collapsed .link-btn { display: none; }
.app.sidebar-collapsed .nav { padding: 6px 6px; }
.app.sidebar-collapsed .nav-item { justify-content: center; padding: 9px 4px; }
.app.sidebar-collapsed .nav-group + .nav-group { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 6px; }
.app.sidebar-collapsed .sidebar-foot { justify-content: center; padding: 14px 6px; }

.brand { display: flex; align-items: center; gap: 8px; padding: 18px 16px 14px; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--green); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .5px;
}
.brand-name { font-weight: 600; font-size: 15px; }
.nav { padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  color: var(--ink-2); font-size: 14px;
}
.nav-item:hover { background: #f3f4f5; text-decoration: none; color: var(--ink); }
.nav-item.active { background: var(--green-soft); color: var(--green-dark); font-weight: 600; }
.nav-ico {
  width: 22px; height: 22px; border-radius: 6px;
  background: #f1f2f4; color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
}
.nav-ico svg { width: 15px; height: 15px; display: block; }
.nav-item.active .nav-ico { background: var(--green); color: #fff; }
.nav-group-title {
  padding: 14px 16px 4px; font-size: 11px; letter-spacing: 1px;
  color: var(--ink-3); font-weight: 500;
}
.sidebar-foot {
  margin-top: auto; padding: 14px 16px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.who-name { font-weight: 600; }
.who-role { font-size: 12px; color: var(--ink-3); }
.link-btn { background: none; border: 0; color: var(--ink-3); cursor: pointer; font-size: 13px; padding: 0; }
.link-btn:hover { color: var(--red); }

/* ---------------------------------------------------------------- main */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 28px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 18px; }
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-left h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back-btn {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  height: 30px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  font-size: 13px; line-height: 1;
}
.back-btn:hover { border-color: var(--green); color: var(--green-dark); text-decoration: none; }
.crumb { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb a { color: var(--ink-3); }
.crumb a:hover { color: var(--green-dark); }
.crumb span { margin: 0 4px; color: #c3c7cd; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
/* 宽屏铺满：列表 / 表格 / 看板默认占满可用宽度（2K、4K 屏不留大片空白）；
   正文与表单页（模板里加 content-narrow 块）限制在阅读宽度并居中，避免一行太长。 */
.content { padding: 20px 28px 48px; max-width: none; width: 100%; }
.content.content-narrow { max-width: 1200px; margin-left: auto; margin-right: auto; }
/* 正文/表单页（.content-narrow）时，顶栏左右内边距跟着内容区走，
   右上角的操作按钮不会孤零零贴在屏幕最右边。浏览器不支持 :has() 时自动退化为原样。 */
.main:has(> .content.content-narrow) .topbar {
  padding-left: max(28px, calc((100% - 1200px) / 2 + 28px));
  padding-right: max(28px, calc((100% - 1200px) / 2 + 28px));
}

/* -------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: #f7f8f9; text-decoration: none; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--green-dark); }
.btn-ghost:hover { background: var(--green-soft); }
.btn-danger { color: var(--red); border-color: #ffd4d4; background: #fff; }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* --------------------------------------------------------------- cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.card-head h2 { font-size: 15px; }
.card-body { padding: 18px; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* -------------------------------------------------------------- stats */
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.stat {
  flex: 1 1 130px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; color: var(--ink-3); }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.3; }
.stat.hl .stat-value { color: var(--green-dark); }

/* ------------------------------------------------------------- filters */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; width: 100%; }
.filters .field { min-width: 120px; margin: 0; }
.filters .field.grow { flex: 1 1 220px; }
.filters input { height: 34px; }
.filters select { min-width: 132px; }

/* --------------------------------------------------------------- forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--ink-2); }
.field input[type="text"], .field input[type="password"], .field input[type="number"],
.field input[type="date"], .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; font: inherit; color: var(--ink); background: #fff;
}
/* 下拉单独处理：原生箭头会给文字留错位置，统一自绘箭头 + 小一档字号，避免文字被切 */
.field select {
  width: 100%; height: 34px; border: 1px solid var(--line); border-radius: 8px;
  padding: 0 28px 0 10px; font: inherit; font-size: 13px; line-height: 32px;
  color: var(--ink); background-color: #fff;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b9199' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
  text-overflow: ellipsis;
}
.field textarea { resize: vertical; }
.field input[type="checkbox"] { width: 16px; height: 16px; align-self: flex-start; margin: 2px 0 0; accent-color: var(--green); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(7, 193, 96, .12);
}
.form-error { color: var(--red); background: var(--red-soft); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.field-error { color: var(--red); font-size: 12px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form-actions { display: flex; gap: 8px; align-items: center; padding-top: 4px; }
.help { font-size: 12px; color: var(--ink-3); }

/* --------------------------------------------------------------- table */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 12px; font-weight: 600; color: var(--ink-3); background: #fafbfb; white-space: nowrap; }
.table tbody tr:hover { background: #fbfcfc; }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .ticket-no { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.table .col-actions { text-align: right; white-space: nowrap; }

/* -------------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 999px; font-size: 12px; line-height: 20px; white-space: nowrap;
}
.badge-pending { background: var(--amber-soft); color: #a86400; }
.badge-processing { background: var(--blue-soft); color: #0b57c2; }
.badge-done { background: var(--green-soft); color: var(--green-dark); }
.badge-closed { background: #f0f1f3; color: #6b7178; }
.badge-sync { background: #f0f1f3; color: #6b7178; }
.badge-sync.ok { background: var(--green-soft); color: var(--green-dark); }
.badge-sync.warn { background: var(--amber-soft); color: #a86400; }
.badge-sync.fail { background: var(--red-soft); color: var(--red); }

/* --------------------------------------------------------------- layout */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 1080px) { .grid-2 { grid-template-columns: 1fr; } }
.detail-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 18px; }
.detail-meta dt { font-size: 12px; color: var(--ink-3); }
.detail-meta dd { margin: 2px 0 0; font-size: 14px; }
.section-title { font-size: 13px; color: var(--ink-3); margin: 0 0 8px; }

/* -------------------------------------------------------------- timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 18px; border-left: 2px solid var(--line); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -5px; top: 5px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--green);
}
.timeline .tl-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.timeline .tl-field { font-weight: 600; }
.timeline .tl-time { font-size: 12px; color: var(--ink-3); }
.timeline .tl-body { color: var(--ink-2); font-size: 13px; word-break: break-word; }
.timeline .old { color: var(--ink-3); text-decoration: line-through; }
.timeline .arrow { color: var(--ink-3); margin: 0 4px; }

/* ---------------------------------------------------------------- chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: 13px; cursor: pointer;
}
.chip.active { background: var(--green-soft); border-color: var(--green); color: var(--green-dark); font-weight: 600; }

/* --------------------------------------------------------------- toast */
.toast-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.toast { padding: 9px 12px; border-radius: 8px; font-size: 13px; border: 1px solid transparent; }
.toast-success { background: var(--green-soft); color: var(--green-dark); border-color: #bcebd0; }
.toast-error { background: var(--red-soft); color: var(--red); border-color: #ffd4d4; }
.toast-warning { background: var(--amber-soft); color: #a86400; border-color: #ffe0b0; }
.toast-info { background: var(--blue-soft); color: #0b57c2; border-color: #cfe0ff; }

/* --------------------------------------------------------------- misc */
.empty { padding: 40px 16px; text-align: center; color: var(--ink-3); }
.empty strong { display: block; color: var(--ink-2); margin-bottom: 4px; }
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 12px 18px; }
.pager .btn { height: 28px; padding: 0 10px; font-size: 13px; }
.pager .page {
  min-width: 28px; height: 28px; padding: 0 7px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 6px;
  color: var(--ink-2); font-size: 13px; text-decoration: none;
}
.pager .page:hover { color: var(--green-dark); border-color: var(--green); text-decoration: none; }
.pager .page.active { background: var(--green); border-color: var(--green); color: #fff; }
.pager .page.ellipsis { border-color: transparent; color: var(--ink-3); }

/* 卡片内查询条 + 底部合计/分页（ui-kit 布局） */
.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.table-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-top: 1px solid var(--line); flex-wrap: wrap;
}
.table-footer .pager { padding: 0; }
.table-footer .total { color: var(--ink-3); font-size: 13px; }
.conflict-banner {
  background: var(--amber-soft); color: #8a5200; border: 1px solid #ffdca8;
  border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: 13px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.stale-banner {
  background: var(--blue-soft); color: #0b57c2; border-radius: 8px;
  padding: 8px 12px; font-size: 13px; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.save-hint { color: var(--green-dark); font-size: 13px; }
.kv { display: flex; flex-direction: column; gap: 10px; }
.kv .k { font-size: 12px; color: var(--ink-3); }
.prose { word-break: break-word; line-height: 1.75; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.sidebar-search input { width: 100%; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font: inherit; }
.search-hit { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.search-hit:last-child { border-bottom: 0; padding-bottom: 0; }
.search-hit .hit-title { font-weight: 600; font-size: 13px; }
.search-hit .hit-body { font-size: 12px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hit-divider { font-size: 12px; color: var(--ink-3); margin: 12px 0 2px; }
.text-danger { color: var(--danger, #d92d20); }
.code-block {
  background: #f7f8fa; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; white-space: pre-wrap; word-break: break-all;
}


/* --------------------------------------------------------------- login */
.login-body {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(180deg, #f0fbf5 0%, #f5f6f7 60%);
}
.login-shell {
  display: grid; grid-template-columns: 1.05fr 1fr;
  width: 860px; max-width: 100%; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 50px rgba(16, 24, 40, .12);
}
.login-brand-panel {
  position: relative; overflow: hidden;
  padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; gap: 12px;
  color: #fff; background: linear-gradient(150deg, #047857 0%, #07c160 62%, #34d07f 100%);
}
.login-brand-panel h1 { font-size: 24px; margin: 0; color: #fff; letter-spacing: .5px; }
.login-brand-panel .brand-mark { background: rgba(255, 255, 255, .18); color: #fff; border: 1px solid rgba(255, 255, 255, .22); }
.login-brand-panel .tagline { margin: 0; font-size: 13px; color: rgba(255, 255, 255, .82); }
.login-brand-panel ul {
  list-style: none; margin: 10px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 9px;
  font-size: 13px; color: rgba(255, 255, 255, .92);
}
.login-brand-panel li { display: flex; align-items: center; gap: 8px; }
.login-brand-panel li::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: rgba(255, 255, 255, .9); flex: none;
}
.login-rings { position: absolute; right: -90px; bottom: -110px; width: 340px; height: 340px; pointer-events: none; }
.login-rings span {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, .24); border-radius: 50%;
}
.login-rings span:nth-child(1) { width: 130px; height: 130px; }
.login-rings span:nth-child(2) { width: 220px; height: 220px; }
.login-rings span:nth-child(3) { width: 320px; height: 320px; }
.login-form-panel { padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; }
.login-form-panel h2 { margin: 0 0 4px; font-size: 19px; }
.login-form-panel .sub { margin: 0 0 22px; color: var(--ink-3); font-size: 13px; }
.login-mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 18px; }
.login-hint { margin: 16px 0 0; font-size: 12px; color: var(--ink-3); text-align: center; }

@media (max-width: 820px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand-panel { display: none; }
  .login-mobile-brand { display: flex; }
  .login-form-panel { padding: 28px 22px; }
}

/* ---------------------------------------------------------------- Markdown 正文 */
.prose h1, .prose h2, .prose h3, .prose h4 { margin: 20px 0 10px; line-height: 1.35; font-weight: 600; color: var(--ink); }
.prose h1 { font-size: 22px; }
.prose h2 { font-size: 18px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.prose h3 { font-size: 16px; }
.prose h4 { font-size: 14px; }
.prose p { margin: 10px 0; }
.prose ul, .prose ol { margin: 10px 0; padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose li > p { margin: 4px 0; }
.prose blockquote { margin: 12px 0; padding: 8px 14px; border-left: 3px solid var(--blue); background: #f7f9fc; color: var(--ink-2); }
.prose code { padding: 1px 5px; border-radius: 4px; background: #f2f4f7; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.prose pre { margin: 12px 0; padding: 12px 14px; overflow-x: auto; border-radius: var(--radius); background: #1f2937; color: #e5e7eb; }
.prose pre code { padding: 0; background: none; color: inherit; font-size: 13px; }
.prose table { margin: 12px 0; border-collapse: collapse; width: 100%; font-size: 13px; }
.prose th, .prose td { padding: 7px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { background: #f7f9fc; font-weight: 600; }
.prose th:first-child, .prose td:first-child { white-space: nowrap; }
.prose hr { margin: 20px 0; border: 0; border-top: 1px solid var(--line); }
.prose a { color: var(--blue); text-decoration: none; }
.prose a:hover { text-decoration: underline; }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); }

/* ---------------------------------------------------------------- 附件面板 */
.attach-card { margin-top: 16px; }
.attach-form { display: flex; align-items: center; gap: 8px; }
.attach-form input[type=file] { font: inherit; font-size: 12px; max-width: 240px; color: var(--ink-2); }
.attach-form input[type=file]::file-selector-button { margin-right: 8px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink-2); font: inherit; font-size: 12px; cursor: pointer; }
.attach-form input[type=file]::file-selector-button:hover { border-color: var(--blue); color: var(--blue); }
.attach-list { display: flex; flex-direction: column; gap: 10px; }
.attach-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.attach-thumb { display: block; width: 64px; height: 64px; flex: none; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: #f7f9fc; }
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-file-icon { display: flex; width: 44px; height: 56px; flex: none; align-items: center; justify-content: center; border-radius: 4px; background: #fdecec; color: #c0392b; font-size: 11px; font-weight: 700; letter-spacing: .5px; }
.attach-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.attach-name { color: var(--ink); font-weight: 500; text-decoration: none; overflow-wrap: anywhere; }
.attach-name:hover { color: var(--blue); }
.attach-ops { display: flex; align-items: center; gap: 12px; margin-top: 2px; }
.attach-ops form { display: inline; }
.link-btn { padding: 0; border: 0; background: none; color: var(--blue); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--red); }

/* ---------------------------------------------------------------- 视频库 */
.toolbar-spacer { flex: 1; }
.add-panel { border-top: 1px solid var(--line); }
.add-panel > summary { list-style: none; padding: 10px 14px; cursor: pointer; }
.add-panel > summary::-webkit-details-marker { display: none; }
.add-panel-body { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; padding: 0 14px 14px; }
.add-form { display: flex; flex-direction: column; gap: 10px; }
.add-form-sub { border-left: 1px dashed var(--line); padding-left: 18px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.add-panel .hint { margin: 4px 0 0; color: var(--ink-3); font-size: 12px; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 14px; }
.video-card { display: block; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s; }
.video-card:hover { box-shadow: 0 6px 18px rgba(15, 33, 60, .08); transform: translateY(-1px); }
.video-cover { position: relative; aspect-ratio: 16 / 9; background: #eef2f7; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.video-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-cover-fallback { color: var(--ink-3); font-size: 12px; letter-spacing: 1px; }
.video-cover-fallback.big { aspect-ratio: 16 / 9; width: 100%; }
.video-duration { position: absolute; right: 6px; bottom: 6px; padding: 1px 6px; border-radius: 4px; background: rgba(0, 0, 0, .68); color: #fff; font-size: 12px; }

/* 视频库列表卡片：封面左下角「复制链接」（复制 B 站原视频地址，点了不会进详情页） */
.video-cover .copy-link {
  position: absolute; left: 8px; bottom: 8px; z-index: 3;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 5px;
  background: rgba(10, 22, 40, .82); color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(255, 255, 255, .28);
  font-size: 12px; font-weight: 600; line-height: 1.4; letter-spacing: .3px;
  cursor: pointer; opacity: .96; user-select: none;
  transition: background .15s, opacity .15s, transform .15s;
}
.video-cover .copy-link:hover { background: var(--blue); opacity: 1; transform: translateY(-1px); }
.video-cover .copy-link:active { transform: translateY(0); }
.video-body { padding: 10px 12px 12px; }
.video-title { font-size: 14px; font-weight: 600; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.video-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--ink-3); }
.video-meta .chip { cursor: default; padding: 2px 10px; font-size: 12px; }
.video-watch { display: grid; gap: 14px; }
.video-player { position: relative; aspect-ratio: 16 / 9; background: #000; }
.video-player iframe, .video-player video { width: 100%; height: 100%; border: 0; display: block; }
.video-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.video-actions form { display: inline; }
.doc-title { margin: 0; font-size: 20px; }

/* ---------------------------------------------- 置顶（资料库 / 案例库 / 知识库） */
.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-item { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.doc-item:last-child { border-bottom: 0; }
.doc-item.is-pinned { background: var(--amber-soft); box-shadow: inset 3px 0 0 var(--amber); }
.doc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.doc-head .doc-title { font-size: 16px; font-weight: 600; }
.doc-head .pin-form { margin-left: auto; }
.pin-form { display: inline-flex; margin: 0; }
.chip-pin { background: var(--amber-soft); color: #a86400; border: 1px solid #ffd7a0; font-weight: 600; }
.col-actions .pin-form { margin-left: 6px; }
.empty-state { padding: 40px 20px; text-align: center; margin-top: 14px; color: var(--ink-2); }
@media (max-width: 860px) {
  .add-panel-body { grid-template-columns: 1fr; }
  .add-form-sub { border-left: 0; padding-left: 0; border-top: 1px dashed var(--line); padding-top: 14px; }
}

/* 视频库：封面 + 播放键（点击才加载播放器） */
.video-play { position: relative; display: block; width: 100%; height: 100%; padding: 0; border: 0; cursor: pointer; background: #000; overflow: hidden; }
.video-play img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .92; }
.video-play:hover img { opacity: 1; }
.video-play .play-btn {
  position: absolute; left: 50%; top: 50%; width: 68px; height: 68px; margin: -34px 0 0 -34px;
  border-radius: 50%; background: rgba(0, 0, 0, .55); box-shadow: 0 0 0 2px rgba(255, 255, 255, .85);
  transition: background .15s, transform .15s;
}
.video-play .play-btn::after {
  content: ""; position: absolute; left: 26px; top: 20px;
  border-style: solid; border-width: 14px 0 14px 22px; border-color: transparent transparent transparent #fff;
}
.video-play:hover .play-btn { background: rgba(0, 0, 0, .72); transform: scale(1.04); }

/* 绩效 DSR：店铺行内的保存/移除按钮 */
.row-actions { display: flex; gap: 6px; margin-top: 8px; }

/* DSR 明细：考核店铺勾选 + 团队值行 */
.checkline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
}
.checkline input { margin: 0; }
.row-actions { flex-wrap: wrap; }
.team-row td {
  background: #f8fafc;
  border-top: 2px solid var(--line);
}
.team-row strong { font-size: 14px; }

/* 批量给分 */
.fill-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.fill-row label { font-size: 13px; color: var(--ink-2); }
.fill-row input { width: 110px; height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 4px; font-size: 13px; }
.inline-input { width: 130px; height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 4px; font-size: 13px; }
.inline-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px rgba(64, 158, 255, .12); }

/* 顶栏同步状态 */
.sync-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px; border-radius: 15px;
  background: #f4f6f9; color: var(--ink-2); font-size: 12px; white-space: nowrap;
}
.sync-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; }
.sync-chip.is-fresh { background: #f0f9eb; color: #4e7a2f; }
.sync-chip.is-fresh .dot { background: #67c23a; }
.sync-chip.is-busy { background: #ecf5ff; color: #2f6ba8; }
.sync-chip.is-busy .dot { background: #409eff; animation: pulse 1.2s infinite; }
.sync-chip.is-error { background: #fef0f0; color: #b93b3b; }
.sync-chip.is-error .dot { background: #f56c6c; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* 顶栏「更多操作」下拉 */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; user-select: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { border-color: var(--blue); color: var(--blue); }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  min-width: 190px; padding: 6px; background: #fff;
  border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
  display: flex; flex-direction: column; gap: 2px;
}
.menu-list form { margin: 0; }
.menu-item {
  display: block; width: 100%; text-align: left; padding: 8px 10px;
  border: 0; background: transparent; border-radius: 4px;
  font-size: 13px; color: var(--ink); cursor: pointer; text-decoration: none;
}
.menu-item:hover { background: #f4f6f9; color: var(--blue); }
.menu-sep { height: 1px; margin: 4px 6px; background: var(--line); }

/* PDF 附件内嵌预览 */
.attach-item { flex-wrap: wrap; }
.pdf-preview {
  flex: 0 0 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}
.pdf-preview > summary {
  cursor: pointer;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--ink-3);
  background: #f8fafc;
  list-style: none;
}
.pdf-preview > summary::-webkit-details-marker { display: none; }
.pdf-preview > summary::before { content: "▸ "; }
.pdf-preview[open] > summary::before { content: "▾ "; }
.pdf-frame {
  display: block;
  width: 100%;
  height: min(70vh, 760px);
  border: 0;
  border-top: 1px solid var(--line);
  background: #fff;
}
.pdf-tip { padding: 6px 10px; margin: 0; }

.pdf-page { display: block; background: #fff; border-top: 1px solid var(--line); }
.pdf-page img { display: block; width: 100%; height: auto; }

.pdf-thumb {
  display: inline-block;
  margin: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
  line-height: 0;
}
.pdf-thumb img { display: block; width: 220px; height: auto; border-radius: var(--radius); }

/* 图片灯箱：点缩略图看大图 */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, .82);
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 48px);
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
}
.lightbox-close {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .28); }

/* ---- 平面图库 / 说明书库 ---- */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; padding: 4px 0 8px; }
.lib-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s; }
.lib-card:hover { box-shadow: 0 6px 18px rgba(15, 23, 42, .10); transform: translateY(-1px); }
.lib-thumb { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; background: #f8fafc; border-bottom: 1px solid var(--line); overflow: hidden; }
.lib-thumb img { width: 100%; height: 100%; object-fit: contain; }
.lib-file-icon { font-size: 20px; font-weight: 600; color: #94a3b8; letter-spacing: .08em; }
.lib-body { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 12px; }
.lib-name { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lib-meta { font-size: 12px; color: var(--ink-3); }
.lib-view { display: flex; flex-direction: column; gap: 12px; }
.lib-view .pdf-page img { max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius); }


/* 配置项：平台店铺与行内删除按钮 */
.inline-form { display: inline; }
.add-shop { margin-bottom: 14px; }
.shop-group { margin-top: 14px; }
.shop-group h3 { font-size: 13px; margin: 0 0 6px; color: var(--ink-2); font-weight: 600; }

/* 权限模板 */
.perm-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 10px; background: #eef2f7; color: var(--ink-2); font-size: 12px; }
.chip-strong { background: #e6f4ff; color: #1d63b8; font-weight: 600; }
.perm-fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; display: grid; gap: 6px; }
.perm-fieldset legend { padding: 0 4px; font-size: 13px; color: var(--ink-2); }
.checkline { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }

.btn-ghost.danger { color: var(--red); }
.btn-ghost.danger:hover { color: var(--red); background: #fef2f2; }

/* 知识库富文本编辑器 */
.rte { border: 1px solid var(--line); border-radius: 6px; background: #fff; overflow: hidden; }
.rte-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px 8px; background: #f8fafc; border-bottom: 1px solid var(--line); }
.rte-toolbar button, .rte-file { padding: 4px 9px; border: 0; background: transparent; border-radius: 4px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.rte-toolbar button:hover, .rte-file:hover { background: #e8eef6; color: var(--ink); }
.rte-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.rte-editor { min-height: 340px; padding: 14px 16px; outline: none; }
.rte-editor:focus { background: #fff; }
.rte-editor img { max-width: 100%; height: auto; border-radius: 4px; }
.kb-body img { max-width: 100%; height: auto; border-radius: 4px; }

/* 多页 PDF 翻阅 */
.pdf-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.pdf-pager { font-size: 13px; color: var(--ink-2); }
.pdf-page-input { width: 56px; text-align: center; padding: 4px 6px; }
.pdf-hint { font-size: 12px; }
.pdf-stage { background: #f1f5f9; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; display: flex; justify-content: center; overflow: auto; }
.pdf-stage img { max-width: 100%; height: auto; display: block; background: #fff;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .12); cursor: zoom-in; }
.pdf-stage.is-zoom { justify-content: flex-start; }
.pdf-stage.is-zoom img { max-width: none; width: auto; cursor: zoom-out; }

.log-list{list-style:none;margin:0;padding:0}
.log-list li{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:7px 0;border-bottom:1px dashed var(--line)}
.log-list li:last-child{border-bottom:0}
.log-list .chip-log{background:#eef2f7;color:#4a5a6a;font-weight:600}
