:root {
  --bg: #f4f6f4;
  --panel: #ffffff;
  --ink: #131a16;
  --ink-2: #3f4a44;
  --muted: #74807a;
  --line: #e3e8e3;
  --line-2: #d3dad4;
  --green: #16a34a;
  --green-2: #0f7a38;
  --green-wash: #eaf7ef;
  --amber: #b45309;
  --amber-wash: #fef4e6;
  --red: #b42318;
  --red-wash: #fef0ee;
  --blue: #1d4ed8;
  --blue-wash: #eef3ff;
  --sidebar: #0c1511;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 20, .05), 0 10px 24px -18px rgba(16, 24, 20, .3);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green-2); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: #eef2ee; padding: 1px 5px; border-radius: 4px; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
ul { margin: 0; padding-left: 18px; }
.muted { color: var(--muted); }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px;
  background: var(--sidebar);
  color: #d7e3db;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex: 0 0 236px;
  overflow-y: auto;
}
.brand-block { padding: 20px 20px 14px; border-bottom: 1px solid rgba(255,255,255,.07); }
.logo { font-size: 19px; font-weight: 700; color: #fff; letter-spacing: -.01em; }
.logo span { color: var(--green); margin-left: 5px; }
.brand-sub { font-size: 11.5px; color: #7f938a; margin-top: 3px; }
.side-nav { padding: 12px 10px; flex: 1; }
.nav-group { margin-bottom: 14px; }
.nav-title { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #6c7f76; margin: 10px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 8px;
  color: #c3d0c8; font-size: 13px; text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(22,163,74,.16); color: #fff; box-shadow: inset 2px 0 0 var(--green); }
.nav-icon { width: 16px; text-align: center; opacity: .75; font-size: 13px; }
.side-foot { padding: 14px 18px 18px; border-top: 1px solid rgba(255,255,255,.07); font-size: 11.5px; color: #8ea097; }
.env-row { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: #6b7a72; }
.dot-ok { background: #22c55e; }
.dot-warn { background: #f59e0b; }
.dot-mute { background: #55635b; }
.side-version { margin-top: 10px; color: #5f7268; font-size: 10.5px; line-height: 1.5; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 18px; padding: 0 26px; position: sticky; top: 0; z-index: 20;
}
.crumbs { display: flex; gap: 7px; color: var(--muted); font-size: 12.5px; flex: 1; min-width: 0; }
.crumbs a { color: var(--muted); }
.site-switcher { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.site-switcher select { width: 190px; }
.site-switcher label { white-space: nowrap; }
.user-box { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.user-name { font-weight: 600; }
.user-roles { color: var(--muted); font-size: 11.5px; }
.logout-form { display: inline; }
.link-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12.5px; padding: 2px 4px; }
.link-btn:hover { color: var(--red); }
.menu-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; cursor: pointer; }

.content { padding: 24px 26px 60px; max-width: 1500px; width: 100%; margin: 0 auto; }
.content-wide { max-width: none; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.page-head h1 { font-size: 23px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- flash / notice ---------- */
.flash { border-radius: 9px; padding: 11px 14px; margin-bottom: 16px; font-size: 13.5px; border: 1px solid; }
.flash-ok { background: var(--green-wash); border-color: #bfe6cd; color: #14532d; }
.flash-err { background: var(--red-wash); border-color: #f3c8c2; color: #7a1c12; }
.notice { display: flex; flex-direction: column; gap: 5px; background: #fbfaf3; border: 1px solid #ece4c8; border-radius: 9px; padding: 10px 14px; font-size: 12.5px; color: #6b5a22; margin-bottom: 16px; }

/* ---------- cards ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 15px; }
.card-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.card-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.card-body { padding: 16px 18px; }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.split-main { min-width: 0; }
.split-side { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow); }
.stat-label { font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 3px; }
.stat-note { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.stat-warn .stat-value { color: var(--amber); }
.stat-err .stat-value { color: var(--red); }
.stat-ok .stat-value { color: var(--green-2); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfa; white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid #eef1ee; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fbfcfb; }
.table .cell-title { font-weight: 600; color: var(--ink); }
.table .cell-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.ta-right { text-align: right; } .ta-center { text-align: center; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- badges ---------- */
.badge { display: inline-block; border-radius: 999px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.badge-ok { background: var(--green-wash); color: #14532d; }
.badge-warn { background: var(--amber-wash); color: #7c4106; }
.badge-err { background: var(--red-wash); color: #8a1c13; }
.badge-info { background: var(--blue-wash); color: #1e40af; }
.badge-muted { background: #eef1ee; color: #55605a; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  border: 1px solid var(--line-2); background: #fff; color: var(--ink-2);
  border-radius: 8px; padding: 6px 12px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; text-decoration: none; line-height: 1.5; white-space: nowrap;
}
.btn:hover { background: #f7f9f7; text-decoration: none; color: var(--ink); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #24322a; color: #fff; }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-green:hover { background: var(--green-2); color: #fff; }
.btn-danger { color: var(--red); border-color: #f0c9c4; background: #fff; }
.btn-danger:hover { background: var(--red-wash); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 3px 8px; font-size: 11.5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; }
.field > span { font-weight: 600; color: var(--ink-2); }
.input {
  width: 100%; border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 10px;
  font-size: 13px; font-family: inherit; background: #fff; color: var(--ink);
}
.input:focus { outline: 2px solid rgba(22,163,74,.25); border-color: var(--green); }
textarea.input { resize: vertical; line-height: 1.6; }
textarea.mono { font-family: var(--mono); font-size: 12px; }
.hint { color: var(--muted); font-size: 11.5px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form-grid .span-2 { grid-column: span 2; }
.inline-form { display: inline-flex; align-items: center; gap: 6px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar form { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.toolbar .input { width: auto; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 8px 12px; color: var(--muted); font-size: 13px; border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.active { color: var(--ink); border-bottom-color: var(--green); font-weight: 600; }
.tab-count { background: #eef1ee; border-radius: 999px; padding: 0 6px; font-size: 11px; }

/* ---------- pager ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12.5px; }
.pages { display: flex; gap: 4px; }
.page { border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; color: var(--ink-2); }
.page.current { background: var(--ink); color: #fff; border-color: var(--ink); }
.page-gap { padding: 2px 4px; color: var(--muted); }

/* ---------- workspace ---------- */
.article-header { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.article-header h1 { font-size: 22px; line-height: 1.35; margin-bottom: 8px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; color: var(--muted); font-size: 12.5px; }
.meta-row strong { color: var(--ink); }
.editor-body { font-family: var(--mono); font-size: 12.5px; line-height: 1.7; min-height: 380px; }
.preview-frame { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 24px; max-height: 640px; overflow-y: auto; }
.preview-frame h1 { font-size: 26px; margin-bottom: 10px; }
.preview-frame h2 { font-size: 20px; margin: 24px 0 8px; padding-left: 10px; border-left: 3px solid var(--green); }
.preview-frame img { max-width: 100%; height: auto; border-radius: 8px; }
.preview-frame figure { margin: 18px 0; }
.preview-frame figcaption { color: var(--muted); font-size: 12px; }

/* ---------- QA list ---------- */
.qa-item { display: flex; gap: 10px; padding: 9px 12px; border-bottom: 1px solid #eef1ee; align-items: flex-start; }
.qa-item:last-child { border-bottom: 0; }
.qa-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; }
.qa-pass { background: var(--green); } .qa-fail { background: var(--red); } .qa-review { background: var(--amber); }
.qa-main { flex: 1; min-width: 0; }
.qa-title { font-weight: 600; font-size: 12.5px; }
.qa-msg { font-size: 12px; color: var(--ink-2); margin-top: 1px; }
.qa-evidence { font-size: 11.5px; color: var(--muted); margin-top: 3px; word-break: break-word; }
.qa-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---------- misc ---------- */
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 7px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: grid; grid-template-columns: 150px minmax(0,1fr); gap: 14px; padding: 9px 0; border-bottom: 1px solid #eef1ee; font-size: 12.5px; }
.timeline-item:last-child { border-bottom: 0; }
.timeline-time { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.diff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.diff-col { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.diff-col h3 { font-size: 12px; padding: 8px 12px; background: #fafbfa; border-bottom: 1px solid var(--line); }
.diff-col .diff-body { padding: 12px; font-size: 12.5px; max-height: 520px; overflow-y: auto; }
.diff-add { background: #eaf7ef; }
.diff-del { background: #fef0ee; text-decoration: line-through; }
.diff-chg { background: #fef4e6; }
.chip { display: inline-block; background: #f1f4f1; border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.progress { height: 6px; background: #e9ede9; border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--green); }
.banner-amber { background: var(--amber-wash); border: 1px solid #f0d9b8; color: #7c4106; border-radius: 9px; padding: 10px 13px; font-size: 12.5px; }
.banner-red { background: var(--red-wash); border: 1px solid #f3c8c2; color: #7a1c12; border-radius: 9px; padding: 10px 13px; font-size: 12.5px; }
.banner-green { background: var(--green-wash); border: 1px solid #bfe6cd; color: #14532d; border-radius: 9px; padding: 10px 13px; font-size: 12.5px; }
.banner-blue { background: var(--blue-wash); border: 1px solid #cfdcfb; color: #1e3a8a; border-radius: 9px; padding: 10px 13px; font-size: 12.5px; }
.code-block { background: #0f1713; color: #d7e3db; border-radius: 9px; padding: 12px 14px; font-family: var(--mono); font-size: 11.5px; overflow-x: auto; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 8px; padding: 5px 0; font-size: 12.5px; border-bottom: 1px dashed #eef1ee; }
.checklist li:last-child { border-bottom: 0; }
.notice-list { padding-left: 18px; color: var(--ink-2); font-size: 12.5px; }
.notice-list li { margin-bottom: 5px; }
.health-bars { display: flex; gap: 3px; }
.health-bar { width: 26px; height: 5px; border-radius: 2px; background: #e5eae5; }
.health-bar-ok { background: var(--green); } .health-bar-warn { background: #f59e0b; } .health-bar-err { background: var(--red); } .health-bar-skip { background: #c2cbc4; }

/* ---------- login ---------- */
.login-body { min-height: 100vh; background: radial-gradient(1200px 600px at 60% -10%, #17301f 0%, #0c1511 55%, #0a120e 100%); display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 410px; background: #fff; border-radius: 16px; padding: 30px 30px 26px; box-shadow: 0 30px 70px -30px rgba(0,0,0,.6); }
.login-brand { text-align: center; margin-bottom: 20px; }
.logo-mark { display: block; width: 34px; height: 34px; border-radius: 10px; background: var(--ink); margin: 0 auto 12px; position: relative; }
.logo-mark:after { content: ""; position: absolute; inset: 11px; border-radius: 50%; border: 2px solid var(--green); }
.login-brand h1 { font-size: 19px; }
.login-brand p { color: var(--muted); font-size: 12px; margin-top: 5px; }
.login-hint { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; font-size: 12px; color: var(--ink-2); }
.login-hint ul { margin: 6px 0; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: -250px; z-index: 40; transition: left .2s ease; }
  .sidebar.open { left: 0; }
  .menu-toggle { display: inline-block; }
  .topbar { gap: 10px; padding: 0 14px; }
  .crumbs { display: none; }
  .site-switcher label { display: none; }
  .site-switcher select { width: 140px; }
  .content { padding: 16px 14px 50px; }
  .grid-3, .grid-2, .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .diff-grid { grid-template-columns: 1fr; }
  .user-roles { display: none; }
}
