/* ============================================================
   ops-hub 控制台 · 样式
   ============================================================ */

:root {
  --bg: #0e1015;
  --surface: #151922;
  --surface-2: #1b2029;
  --surface-3: #222833;
  --border: #262c38;
  --border-2: #303748;
  --text: #e7eaf0;
  --text-2: #9aa3b2;
  --text-3: #6b7484;
  --accent: #6d7cff;
  --accent-soft: rgba(109, 124, 255, .14);
  --ok: #22c55e;
  --ok-soft: rgba(34, 197, 94, .13);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, .13);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, .13);
  --info: #3b82f6;
  --info-soft: rgba(59, 130, 246, .13);
  --shadow: 0 8px 28px rgba(0, 0, 0, .32);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .22);
  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

html[data-theme="light"] {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f3f5f9;
  --surface-3: #e9edf4;
  --border: #e2e7ef;
  --border-2: #d2d9e4;
  --text: #141821;
  --text-2: #5b6472;
  --text-3: #8b94a3;
  --accent: #4f5bd5;
  --accent-soft: rgba(79, 91, 213, .1);
  --ok: #15a34a;
  --ok-soft: rgba(21, 163, 74, .1);
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, .1);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, .09);
  --info: #2563eb;
  --info-soft: rgba(37, 99, 235, .09);
  --shadow: 0 10px 30px rgba(23, 32, 55, .1);
  --shadow-sm: 0 2px 8px rgba(23, 32, 55, .06);
}

* { box-sizing: border-box; }

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

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; font-size: inherit; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
code, pre { font-family: var(--mono); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 布局 ---------- */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 236px; flex: 0 0 236px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 16px 12px 12px;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, #6d7cff, #a06dff);
  color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .5px;
  display: grid; place-items: center; flex: 0 0 34px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; }
.brand-text span { font-size: 11px; color: var(--text-3); }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
  transition: background .14s, color .14s; text-align: left;
}
.nav-item svg { width: 17px; height: 17px; fill: currentColor; flex: 0 0 17px; opacity: .85; }
.nav-item svg path[fill="none"], .nav-item svg[fill="none"] { stroke: currentColor; fill: none; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-badge {
  margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700;
  background: var(--danger); color: #fff; border-radius: 20px;
  padding: 1px 7px; min-width: 20px; text-align: center; line-height: 1.5;
}
.nav-badge:empty { display: none; }

.sidebar-foot { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.legend { display: flex; flex-direction: column; gap: 5px; padding: 0 4px 4px; }
.legend-row { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-3); }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }
.dot.lv1 { background: var(--ok); }
.dot.lv2 { background: var(--info); }
.dot.lv3 { background: var(--danger); }

.ghost-btn {
  width: 100%; padding: 7px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  font-size: 12.5px; color: var(--text-2); transition: .14s;
}
.ghost-btn:hover { border-color: var(--border-2); color: var(--text); }
.ghost-btn.on { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }

/* ---------- 主区 ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 24px; border-bottom: 1px solid var(--border);
  background: var(--surface); flex: 0 0 auto;
}
.topbar-title h1 { font-size: 17px; }
.topbar-title p { margin: 1px 0 0; font-size: 12px; color: var(--text-3); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.hub-path {
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 3px 8px; border-radius: 6px; max-width: 260px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  color: var(--text-2); transition: .14s;
}
.icon-btn svg { width: 16px; height: 16px; fill: currentColor; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.primary-btn {
  padding: 7px 15px; border-radius: 8px; font-weight: 600; font-size: 13px;
  background: var(--accent); color: #fff; transition: .14s;
}
.primary-btn:hover { filter: brightness(1.12); }
.primary-btn:disabled { opacity: .5; cursor: not-allowed; }

.content { flex: 1; overflow-y: auto; padding: 22px 24px 40px; }
.muted { color: var(--text-3); }

/* ---------- 通用块 ---------- */
.section { margin-bottom: 26px; }
.section-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.section-head h2 { font-size: 14.5px; }
.section-head .muted { font-size: 12px; margin-left: auto; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; } }

/* 指标卡 */
.stat { position: relative; overflow: hidden; }
.stat::after {
  content: ""; position: absolute; right: -30px; top: -30px;
  width: 90px; height: 90px; border-radius: 50%; background: var(--accent-soft); opacity: .5;
}
.stat .k { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.stat .sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.stat.alert .v { color: var(--danger); }
.stat.alert::after { background: var(--danger-soft); }
.stat.good .v { color: var(--ok); }
.stat.good::after { background: var(--ok-soft); }
.stat.warn .v { color: var(--warn); }
.stat.warn::after { background: var(--warn-soft); }

/* 徽标 */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 2px 7px;
  border-radius: 5px; white-space: nowrap; line-height: 1.6;
}
.tag.l1 { background: var(--ok-soft); color: var(--ok); }
.tag.l2 { background: var(--info-soft); color: var(--info); }
.tag.l3 { background: var(--danger-soft); color: var(--danger); }
.tag.risk-outbound, .tag.risk-spend { background: var(--danger-soft); color: var(--danger); }
.tag.risk-delete { background: var(--warn-soft); color: var(--warn); }
.tag.risk-write { background: var(--info-soft); color: var(--info); }
.tag.risk-none { background: var(--surface-3); color: var(--text-2); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.no { background: var(--danger-soft); color: var(--danger); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.plain { background: var(--surface-3); color: var(--text-2); }
.tag.line { background: transparent; border: 1px solid var(--border-2); color: var(--text-2); }

/* 时间轴 */
.windows { display: flex; flex-direction: column; gap: 0; }
.win-row {
  display: grid; grid-template-columns: 54px 42px 1fr auto;
  align-items: center; gap: 12px; padding: 10px 4px;
  border-bottom: 1px solid var(--border); position: relative;
}
.win-row:last-child { border-bottom: none; }
.win-row.human { background: linear-gradient(90deg, var(--warn-soft), transparent 60%); border-radius: 8px; }
.win-time { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.win-id { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.win-label { font-size: 13px; }
.win-row.past { opacity: .48; }
.win-row.next .win-label { color: var(--accent); font-weight: 600; }
.win-state { font-size: 11px; color: var(--text-3); }

/* 验收卡 */
.rv-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 12px; overflow: hidden;
  transition: border-color .15s;
}
.rv-card:hover { border-color: var(--border-2); }
.rv-card.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.rv-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; }
.rv-check { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--accent); flex: 0 0 16px; cursor: pointer; }
.rv-main { flex: 1; min-width: 0; }
.rv-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rv-title strong { font-size: 14px; }
.rv-summary { color: var(--text-2); font-size: 12.5px; margin-top: 5px; }
.rv-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 11.5px; color: var(--text-3); }
.rv-meta b { color: var(--text-2); font-weight: 600; }
.rv-actions { display: flex; gap: 7px; flex: 0 0 auto; }

.btn-sm {
  padding: 5px 11px; border-radius: 7px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-2); transition: .14s;
}
.btn-sm:hover { color: var(--text); border-color: var(--text-3); }
.btn-sm.go { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.btn-sm.no { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn-sm:disabled { opacity: .45; cursor: not-allowed; }

.rv-body { border-top: 1px solid var(--border); padding: 14px 16px; background: var(--surface-2); }
.rv-body h4 { font-size: 12.5px; color: var(--text-3); margin: 12px 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.rv-body h4:first-child { margin-top: 0; }

.bulk-bar {
  position: sticky; top: -22px; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; margin: -22px -24px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.bulk-bar .muted { font-size: 12.5px; }

/* 表格 */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-3); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border);
}
table.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl td.mono { font-family: var(--mono); font-size: 12px; }

/* 资料库 */
.lib { display: flex; gap: 14px; align-items: flex-start; }
.tree {
  flex: 0 0 250px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px; max-height: calc(100vh - 190px); overflow-y: auto;
}
.tree-node {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 7px;
  font-size: 13px; color: var(--text-2); cursor: pointer; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.tree-node:hover { background: var(--surface-2); color: var(--text); }
.tree-node.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tree-node .caret { width: 12px; flex: 0 0 12px; font-size: 9px; color: var(--text-3); transition: transform .15s; }
.tree-node .caret.open { transform: rotate(90deg); }
.tree-node .fico { font-size: 12px; }
.tree-children { margin-left: 12px; border-left: 1px dashed var(--border); padding-left: 2px; }

.lib-main { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.lib-bar {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.crumbs { display: flex; align-items: center; gap: 4px; font-size: 12.5px; font-family: var(--mono); flex: 1; min-width: 0; overflow: hidden; }
.crumbs button { color: var(--text-2); padding: 2px 5px; border-radius: 5px; font-family: inherit; font-size: 12.5px; }
.crumbs button:hover { background: var(--surface-2); color: var(--accent); }
.crumbs .sep { color: var(--text-3); }

.file-list { max-height: calc(100vh - 250px); overflow-y: auto; }
.file-row {
  display: grid; grid-template-columns: 26px 1fr 92px 92px 150px 74px;
  align-items: center; gap: 8px; padding: 9px 14px;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.file-row:hover { background: var(--surface-2); }
.file-row.head { font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; background: var(--surface-2); position: sticky; top: 0; z-index: 1; }
.file-row .fname { display: flex; align-items: center; gap: 7px; min-width: 0; }
.file-row .fname span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row.clickable { cursor: pointer; }
.fdel { opacity: 0; color: var(--text-3); }
.file-row:hover .fdel { opacity: 1; }
.fdel:hover { color: var(--danger); }
.dropzone { outline: 2px dashed var(--accent); outline-offset: -8px; background: var(--accent-soft); }

.empty { padding: 52px 20px; text-align: center; color: var(--text-3); font-size: 13px; }
.empty strong { display: block; color: var(--text-2); font-size: 14px; margin-bottom: 4px; }

/* 流水线 */
.pipe-head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.pipe-id {
  font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); padding: 2px 7px; border-radius: 6px;
}
.bar { height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin: 10px 0 8px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #a06dff); }
.bar.low i { background: var(--danger); }
.bar.mid i { background: var(--warn); }
.io-line { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); padding: 3px 0; }
.io-line .mono { font-size: 11.5px; }
.io-bad { color: var(--danger); }

/* Markdown */
.md { font-size: 13.5px; line-height: 1.75; color: var(--text-2); }
.md h1, .md h2, .md h3, .md h4 { color: var(--text); margin: 20px 0 8px; }
.md h1 { font-size: 19px; } .md h2 { font-size: 16px; } .md h3 { font-size: 14.5px; } .md h4 { font-size: 13.5px; }
.md h1:first-child, .md h2:first-child { margin-top: 0; }
.md p { margin: 8px 0; }
.md ul, .md ol { margin: 8px 0; padding-left: 20px; }
.md li { margin: 3px 0; }
.md code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; font-size: 12px; color: var(--text); }
.md pre { background: var(--surface-2); border: 1px solid var(--border); padding: 12px; border-radius: 8px; overflow-x: auto; font-size: 12px; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 10px 0; padding: 6px 14px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 6px 6px 0; color: var(--text-2); }
.md table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 12.5px; }
.md th, .md td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.md th { background: var(--surface-2); color: var(--text); font-weight: 600; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.md strong { color: var(--text); }
.md a { border-bottom: 1px solid var(--accent-soft); }
.md input[type=checkbox] { margin-right: 6px; }

/* 表单 */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field .hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }
input[type=text], input[type=date], textarea, select {
  width: 100%; padding: 9px 11px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-size: 13.5px; font-family: inherit; transition: .14s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); background: var(--surface); }
textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.chk input { accent-color: var(--accent); width: 15px; height: 15px; }

/* 提示条 */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius); font-size: 13px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  margin-bottom: 16px;
}
.notice.warn { border-color: var(--warn); background: var(--warn-soft); color: var(--text); }
.notice.danger { border-color: var(--danger); background: var(--danger-soft); color: var(--text); }
.notice.ok { border-color: var(--ok); background: var(--ok-soft); color: var(--text); }

/* toast */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  background: var(--surface); border: 1px solid var(--border-2); border-left: 3px solid var(--accent);
  padding: 10px 16px; border-radius: 9px; box-shadow: var(--shadow); font-size: 13px;
  min-width: 210px; animation: slideIn .22s ease;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }
@keyframes slideIn { from { transform: translateX(16px); opacity: 0; } }

/* modal / drawer */
.modal-backdrop, .drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 150;
  display: flex; align-items: center; justify-content: center; padding: 30px;
  backdrop-filter: blur(2px);
}
.modal-backdrop[hidden], .drawer-backdrop[hidden] { display: none; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  width: min(620px, 100%); max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow); animation: pop .2s ease;
}
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.modal-head, .drawer-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 18px; border-bottom: 1px solid var(--border); flex: 0 0 auto;
}
.modal-head h3, .drawer-head h3 { font-size: 15px; flex: 1; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 13px 18px; border-top: 1px solid var(--border); display: flex; gap: 9px; justify-content: flex-end; }

.drawer-backdrop { justify-content: flex-end; padding: 0; }
.drawer {
  background: var(--surface); border-left: 1px solid var(--border);
  width: min(760px, 92vw); height: 100%; display: flex; flex-direction: column;
  box-shadow: var(--shadow); animation: slideLeft .22s ease;
}
@keyframes slideLeft { from { transform: translateX(40px); opacity: .6; } }
.drawer-head-actions { display: flex; gap: 7px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 40px; }

.spinner { width: 16px; height: 16px; border: 2px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 登录浮层 ---------- */
.login-backdrop {
  position: fixed; inset: 0; z-index: 300;
  background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-backdrop[hidden] { display: none; }
.login-card {
  width: min(360px, 100%); background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 28px 26px; box-shadow: var(--shadow); text-align: center;
}
.login-card h2 { font-size: 17px; margin: 14px 0 6px; }
.login-card .muted { font-size: 12.5px; margin: 0 0 18px; }
.brand-mark.lg { width: 46px; height: 46px; font-size: 16px; border-radius: 12px; margin: 0 auto; }
.login-input {
  width: 100%; padding: 10px 12px; border-radius: 9px; font-size: 13.5px; font-family: inherit;
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); outline: none;
  text-align: center; letter-spacing: .04em;
}
.login-input:focus { border-color: var(--accent); }
.primary-btn.full { width: 100%; margin-top: 12px; justify-content: center; }
.login-err { min-height: 17px; margin: 10px 0 0; font-size: 12.5px; color: var(--danger); }

/* ── 凭证配置表单（/api/admin/settings） ────────────────────────── */
.cfg-group { margin-bottom: 18px; }
.cfg-group:last-child { margin-bottom: 4px; }
/* 「申请入口」外链行：提示该组凭证去哪申请/去哪填 */
.cfg-links { margin: -4px 0 10px; font-size: 11.5px; line-height: 1.9; color: var(--text-2); }
.cfg-links > a { color: var(--accent); text-decoration: none; border-bottom: 1px dashed currentColor; }
.cfg-links > a:hover { opacity: .8; }
.cfg-link-sep { margin: 0 6px; opacity: .45; }
.cfg-group > h4 {
  margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--text-1);
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.cfg-row { margin-bottom: 11px; }
.cfg-row > label {
  display: block; font-size: 12px; color: var(--text-2); margin-bottom: 4px;
}
.cfg-row > input {
  width: 100%; box-sizing: border-box; padding: 7px 10px; font-size: 13px;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--bg-2); color: var(--text-1); font-family: inherit;
}
.cfg-row > input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.cfg-row > input.is-set { border-color: var(--ok, #2f9e63); }
.cfg-hint { font-size: 11.5px; color: var(--text-3, var(--text-2)); margin-top: 3px; line-height: 1.5; }
.cfg-note {
  font-size: 12px; color: var(--text-2); line-height: 1.7; margin: 0 0 14px;
  padding: 9px 11px; border-radius: 7px; background: var(--bg-2); border: 1px solid var(--border);
}
.cfg-note code { font-size: 11.5px; }
.cfg-store { font-size: 12px; margin: 10px 0 0; }

/* ---------- 登录方式切换（2026-10-25 账号体系） ---------- */
.login-tabs { display: flex; gap: 6px; margin: 4px 0 12px; flex-wrap: wrap; }
.login-tab {
  flex: 1 1 auto; min-width: 70px; padding: 7px 10px; font-size: 12.5px; font-family: inherit;
  border: 1px solid var(--border-2); border-radius: 9px; background: var(--surface-2);
  color: var(--text-2); cursor: pointer; transition: .15s;
}
.login-tab:hover { border-color: var(--accent); color: var(--text); }
.login-tab.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.login-pane { display: flex; flex-direction: column; gap: 8px; }
.login-pane[hidden] { display: none; }
.login-row { display: flex; gap: 8px; align-items: stretch; }
.login-row .login-input { flex: 1 1 auto; }
.login-row .ghost-btn { flex: 0 0 auto; margin-top: 0; }
.login-card .muted.sm { font-size: 11.5px; margin: 2px 0 0; line-height: 1.6; }
.ghost-btn.full { width: 100%; justify-content: center; }

/* ============================================================
   Agent 编排（agent-fabric）
   ============================================================ */

/* 顶部状态条：一眼看清「现在该不该干活、下次什么时候干」 */
.fb-strip {
  display: flex; flex-wrap: wrap; gap: 22px; padding: 14px 18px; margin-bottom: 16px;
}
.fb-st { display: flex; align-items: center; gap: 8px; }
.fb-st > div { display: flex; flex-direction: column; line-height: 1.35; }
.fb-st b { font-size: 14.5px; font-weight: 650; }
.fb-st em, .fb-be em { font-style: normal; font-size: 11.5px; color: var(--text-3); }

.fb-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.fb-dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.fb-dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.fb-dot.off { background: var(--text-3); }
.fb-dot.pulse.on { animation: fb-pulse 2.2s ease-in-out infinite; }
@keyframes fb-pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

/* 拓扑图 */
.fb-topo-wrap { overflow-x: auto; padding: 6px 2px 2px; }
.fb-topo { display: block; width: 100%; height: auto; min-height: 120px; }
.fb-topo text { font-family: inherit; }
.fb-blink { animation: fb-blink 1.3s ease-in-out infinite; }
@keyframes fb-blink { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
.fb-legend {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-2);
}
.fb-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.fb-sq { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.fb-sq.done { background: var(--ok-soft); border: 1.5px solid var(--ok); }
.fb-sq.running { background: var(--info-soft); border: 1.5px solid var(--info); }
.fb-sq.gate { background: var(--warn-soft); border: 1.5px solid var(--warn); }
.fb-sq.fail { background: var(--danger-soft); border: 1.5px solid var(--danger); }
.fb-sq.idle { background: transparent; border: 1.5px dashed var(--border-2); }

/* 后端健康 */
.fb-be-row { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 12px; }
.fb-be { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }

/* 两栏：队列 / 运行记录 */
.fab-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; }
@media (max-width: 1100px) { .fab-grid { grid-template-columns: minmax(0, 1fr); } }

.fb-select, .fb-input {
  padding: 7px 10px; font-size: 13px; font-family: inherit; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
}
.fb-select:focus, .fb-input:focus, .fb-textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.fb-textarea {
  width: 100%; box-sizing: border-box; margin-top: 10px; padding: 9px 11px;
  font-family: inherit; font-size: 13px; line-height: 1.6; resize: vertical;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px;
}
.fb-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.fb-form-row { display: flex; gap: 10px; }
.fb-form-row .fb-input { flex: 1; }
.fb-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }

/* 运行记录 */
.fb-runs { display: flex; flex-direction: column; gap: 8px; max-height: 560px; overflow-y: auto; }
.fb-run { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.fb-run.open { border-color: var(--border-2); }
.fb-run-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 9px 12px; cursor: pointer; font-size: 12.5px;
}
.fb-run-head:hover { background: var(--surface-3); }
.fb-run-head code { font-size: 12px; color: var(--text); }
.fb-run-body { padding: 4px 12px 12px; border-top: 1px dashed var(--border); }
.fb-run-body .tbl { margin-top: 8px; }
.fb-gate-actions {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; padding: 9px 12px; font-size: 12.5px;
  background: var(--warn-soft); border: 1px solid var(--warn); border-radius: 8px;
}

/* ============================================================
   目标循环（GOAL）
   ============================================================ */

.gl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}
.gl-card {
  display: flex; flex-direction: column; gap: 10px;
  border-left: 3px solid var(--ok);
}
.gl-card.paused { border-left-color: var(--text-3); }
.gl-card.stalled { border-left-color: var(--warn); }
.gl-card.done { border-left-color: var(--info); }
.gl-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.gl-card-head code { font-size: 12.5px; font-weight: 700; }
.gl-card-title { font-size: 14.5px; font-weight: 650; line-height: 1.45; }

/* 完成率进度条 */
.gl-bar {
  position: relative; height: 22px; border-radius: 6px; overflow: hidden;
  background: var(--surface-3); border: 1px solid var(--border);
}
.gl-bar-fill {
  height: 100%; border-radius: 5px 0 0 5px;
  background: linear-gradient(90deg, var(--ok-soft), var(--ok));
  transition: width .4s ease;
}
.gl-bar-txt {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 700; color: var(--text);
}
.gl-bar-txt em { font-style: normal; font-weight: 600; font-size: 11px; color: var(--info); }

.gl-meta {
  display: flex; flex-wrap: wrap; gap: 6px 16px;
  font-size: 12px; color: var(--text-2);
}
.gl-meta b { color: var(--text); font-weight: 650; }
.gl-meta em { font-style: normal; }
.gl-red { color: var(--danger) !important; font-weight: 650; }
.gl-last {
  padding: 8px 10px; border-radius: 8px; line-height: 1.55;
  background: var(--surface-3); border: 1px dashed var(--border);
}
.gl-actions { display: flex; gap: 8px; margin-top: auto; }

/* 时段报告正文 */
.gl-report-body {
  margin-top: 12px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-3);
}
.gl-report-body h3 { font-size: 13px; margin-bottom: 8px; }
.gl-report-body pre {
  max-height: 420px; overflow: auto; margin: 0 0 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; line-height: 1.65; white-space: pre-wrap; word-break: break-word;
  color: var(--text-2);
}

/* 优化提案 */
.pr-files { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.pr-file {
  padding: 2px 6px; border-radius: 6px; font-size: 11px;
  background: var(--surface-3); border: 1px solid var(--border); color: var(--text-2);
}
.pr-body { font-size: 13px; line-height: 1.6; color: var(--text-2); margin: 4px 0; }
.pr-body b { color: var(--text-1); font-weight: 600; }

/* ---------- 顶栏账号菜单 ---------- */
.user-menu { position: relative; display: inline-flex; }
.user-menu > .ghost-btn { width: auto; padding: 5px 11px; }
#user-label { font-family: var(--mono); font-size: 11.5px; max-width: 120px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-drop {
  position: absolute; right: 0; top: calc(100% + 7px); min-width: 216px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 6px; animation: prFade .12s ease-out;
}
.user-drop::before {
  content: ''; position: absolute; right: 14px; top: -5px; width: 9px; height: 9px;
  background: var(--surface); border-left: 1px solid var(--border-2);
  border-top: 1px solid var(--border-2); transform: rotate(45deg);
}
.user-drop-head {
  padding: 8px 10px 9px; border-bottom: 1px solid var(--border); margin-bottom: 5px;
}
.user-drop-head b { display: block; font-size: 12.5px; color: var(--text); font-weight: 600; }
.user-drop-head span { display: block; margin-top: 2px; font-size: 11px; color: var(--text-3); line-height: 1.5; }
.user-drop-item {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--radius-sm);
  background: none; border: 0; font-size: 12.5px; color: var(--text-2); cursor: pointer; transition: .12s;
}
.user-drop-item:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.user-drop-item:disabled { opacity: .45; cursor: not-allowed; }
.user-drop-item.danger { color: var(--danger); }
.user-drop-item.danger:hover:not(:disabled) { background: var(--danger-soft); }
@keyframes prFade { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
