:root {
  --navy: #0f2440;
  --navy-2: #16314f;
  --primary: #1d4ed8;
  --primary-soft: #e8efff;
  --teal: #0e7490;
  --bg: #f4f6fb;
  --panel: #ffffff;
  --border: #e4e8f0;
  --text: #1f2937;
  --text-2: #5b6675;
  --text-3: #8a94a6;

  --green: #16a34a;
  --green-bg: #e7f6ec;
  --blue: #2563eb;
  --blue-bg: #e8efff;
  --amber: #d97706;
  --amber-bg: #fdf1e0;
  --slate: #64748b;
  --slate-bg: #eef1f6;
  --red: #dc2626;
  --red-bg: #fdeaea;

  --radius: 12px;
  --shadow: 0 1px 3px rgba(16,36,64,.06), 0 8px 24px rgba(16,36,64,.05);
}

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

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

/* ---------- Sidebar ---------- */
.sidebar {
  width: 248px;
  flex: 0 0 248px;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #cdd6e4;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 10px;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; padding: 3px; box-sizing: border-box;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-title { font-size: 17px; font-weight: 800; color: #fff; letter-spacing: .5px; }
.brand-sub { font-size: 12px; color: #8ba0c0; margin-top: 1px; }

.nav { flex: 1; padding: 8px 12px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; margin: 3px 0;
  border-radius: 9px; cursor: pointer;
  color: #b7c2d6; font-weight: 500; font-size: 13.5px;
  transition: background .15s, color .15s;
  user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(29,78,216,.35); }
.nav-icon { width: 18px; height: 18px; flex: 0 0 18px; }
.nav-badge {
  margin-left: auto; background: rgba(255,255,255,.14);
  color: #fff; font-size: 11px; padding: 1px 8px; border-radius: 10px; font-weight: 600;
}
.nav-item.active .nav-badge { background: rgba(255,255,255,.22); }
.nav-ext { margin-left: auto; color: #7dd3fc; font-size: 13px; font-weight: 700; padding-right: 2px; }
.nav-item.active .nav-ext { color: #e0f2fe; }

.sidebar-foot { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08); font-size: 11.5px; color: #8ba0c0; }
.sidebar-foot .owner span, .sidebar-foot .updated span { color: #cdd6e4; }

/* ---------- Main ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 64px; flex: 0 0 64px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-size: 18px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.topbar-hint { font-size: 11.5px; color: var(--text-3); }
.search-input {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; width: 220px; font-size: 13px; outline: none;
  transition: border-color .15s, box-shadow .15s; background: #fbfcfe;
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.content { padding: 26px 28px 72px; flex: 1; }

/* ---------- Country bar (bottom) ---------- */
.country-bar {
  position: fixed; left: 0; right: 0; bottom: 0; height: 54px;
  background: linear-gradient(180deg, var(--navy-2) 0%, var(--navy) 100%);
  color: #cdd6e4; display: flex; align-items: center; gap: 14px;
  padding: 0 28px; z-index: 30;
  box-shadow: 0 -3px 12px rgba(16,36,64,.18);
}
.cb-label { font-size: 13px; font-weight: 700; color: #fff; white-space: nowrap; }
.cb-select {
  border: 1px solid rgba(255,255,255,.22); border-radius: 8px;
  padding: 7px 12px; font-size: 13px; min-width: 230px;
  background: #1c3a5e; color: #fff; outline: none; cursor: pointer;
}
.cb-select:focus { border-color: var(--primary); }
.cb-current { font-size: 12.5px; color: #cdd6e4; }
.cb-current b { color: #fff; }
.cb-hint { font-size: 12px; color: #8ba0c0; margin-left: auto; white-space: nowrap; }
@media (max-width: 720px) {
  .cb-hint { display: none; }
  .cb-current { display: none; }
}

/* ---------- Dashboard ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.stat-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat-card .stat-label { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.stat-card .stat-value { font-size: 30px; font-weight: 800; margin-top: 6px; letter-spacing: .5px; }
.stat-card .stat-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.stat-card .stat-accent { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.accent-blue { background: var(--blue); }
.accent-green { background: var(--green); }
.accent-amber { background: var(--amber); }
.accent-teal { background: var(--teal); }
.accent-red { background: var(--red); }
.accent-slate { background: var(--slate); }

.panel-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; margin-bottom: 18px; }
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.panel-title { font-size: 15px; font-weight: 700; margin: 0 0 16px; display: flex; align-items: center; gap: 8px; }
.panel-title .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }

/* progress bar */
.pbar { height: 10px; background: var(--slate-bg); border-radius: 6px; overflow: hidden; display: flex; }
.pbar > span { height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; }

.donut-wrap { display: flex; align-items: center; gap: 24px; }
.donut { flex: 0 0 150px; }
.donut-center { font-size: 13px; }

/* recent list */
.recent-item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid #f0f2f7; }
.recent-item:last-child { border-bottom: none; }
.recent-ico { flex: 0 0 32px; height: 32px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.recent-body { min-width: 0; }
.recent-title { font-weight: 600; font-size: 13.5px; }
.recent-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ---------- Table ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.filter-select {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
  font-size: 13px; background: #fff; outline: none; color: var(--text); cursor: pointer;
}
.filter-select:focus { border-color: var(--primary); }
.edit-select {
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px;
  font-size: 12px; background: #fff; outline: none; color: var(--text); cursor: pointer;
  max-width: 96px;
}
.edit-select:focus { border-color: var(--primary); }
.td-edit-select { white-space: nowrap; }
.table-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid thead th {
  background: #f7f9fc; text-align: left; padding: 12px 14px;
  font-weight: 700; color: var(--text-2); border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0;
}
table.grid tbody td { padding: 11px 14px; border-bottom: 1px solid #f0f2f7; vertical-align: top; color: var(--text); }
table.grid tbody tr:hover { background: #f9fbff; }
table.grid tbody tr:last-child td { border-bottom: none; }
.cell-text { max-width: 360px; }
.cell-text.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; font-size: 12px; }

/* 表头内嵌筛选 */
.th-filterable { position: relative; }
.th-inner { display: inline-flex; align-items: center; gap: 6px; }
.th-label { white-space: nowrap; }
.th-filter-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border: none; border-radius: 5px;
  background: transparent; color: var(--text-3); cursor: pointer;
  transition: background .15s, color .15s; flex: none;
}
.th-filter-btn:hover { background: var(--primary-soft); color: var(--primary); }
.th-filter-btn.active { background: var(--primary); color: #fff; }
/* 浮层弹窗（追加到 body，避开 table-wrap 裁切） */
.th-float {
  position: fixed; z-index: 1000;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, .14);
  padding: 6px; min-width: 200px;
}
.th-pop-opts { display: flex; flex-direction: column; gap: 2px; }
.th-opt {
  padding: 7px 10px; border-radius: 7px; font-size: 13px; color: var(--text);
  cursor: pointer; white-space: nowrap; transition: background .12s;
}
.th-opt:hover { background: #f1f5ff; }
.th-opt.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.th-pop-input {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.th-pop-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-green { background: var(--green-bg); color: var(--green); }
.b-blue { background: var(--blue-bg); color: var(--blue); }
.b-amber { background: var(--amber-bg); color: var(--amber); }
.b-slate { background: var(--slate-bg); color: var(--slate); }
.b-red { background: var(--red-bg); color: var(--red); }
.b-teal { background: #e0f2f5; color: var(--teal); }

/* status dropdown filter (retrofit page) */
.rf-filterbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.rf-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rf-actions { display: flex; gap: 8px; }
.rf-filterbar.hidden { display: none; }
.rf-label { font-size: 13px; font-weight: 700; color: var(--text-2); white-space: nowrap; }
.rf-select {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 34px 8px 12px; font-size: 13px; min-width: 180px;
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3'><path d='M6 9l6 6 6-6'/></svg>") no-repeat right 12px center;
  color: var(--text); outline: none; cursor: pointer; appearance: none; -webkit-appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
.rf-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.empty { padding: 40px; text-align: center; color: var(--text-3); }

/* expandable detail */
.detail-row td { background: #fafcff; padding: 0 !important; }
.detail-box { padding: 14px 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 10px 24px; }
.detail-field .k { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.detail-field .v { font-size: 13px; color: var(--text); margin-top: 2px; white-space: pre-wrap; }

/* 备忘录「待唤醒」横幅（基于遗忘 skill 的唤醒/复盘理念） */
.wake-bar { margin: 0 0 14px; padding: 12px 16px; border-radius: 12px; background: #fff7ed; border: 1px solid #fed7aa; font-size: 13.5px; color: #9a3412; }
.wake-bar.wake-ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.wake-bar b { font-size: 15px; }
.wake-list { margin: 8px 0 0; padding-left: 4px; list-style: none; display: grid; gap: 8px; }
.wake-list li { padding: 8px 12px; background: #fff; border: 1px solid #fde4cf; border-radius: 9px; }
.wake-sub { color: var(--text-3); font-size: 12.5px; margin-left: 2px; }
.wake-next { color: #7c2d12; font-size: 12.5px; margin-top: 4px; }
.btn-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-active:hover { filter: brightness(1.05); }

/* section title */
.section-title { font-size: 15px; font-weight: 700; margin: 4px 0 14px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.region-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 4px 10px; border-radius: 8px; margin-bottom: 10px; }

.count-pill { font-size: 12px; color: var(--text-3); margin-left: 8px; font-weight: 500; }

/* ---------- Data maintenance center ---------- */
.port-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.port-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.port-card.wide { grid-column: 1 / -1; }
.port-head { font-size: 14.5px; font-weight: 800; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.port-no { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 7px; background: var(--primary); color: #fff; font-size: 13px; font-weight: 800; }
.port-desc { font-size: 12.5px; color: var(--text-3); line-height: 1.6; margin-bottom: 12px; }
.port-sub { font-size: 12.5px; color: var(--text-2); font-weight: 600; margin: 10px 0 6px; }
.file-input { display: block; width: 100%; font-size: 13px; margin-bottom: 8px; }
.text-area { width: 100%; min-height: 92px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; font-family: var(--mono); resize: vertical; outline: none; }
.text-area:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.import-box { margin-top: 12px; border-top: 1px dashed var(--border); padding-top: 12px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn { border: 1px solid var(--border); background: #fff; color: var(--text); padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); color: #fff; }
.btn-danger { color: #d33; border-color: #f0c2c2; }
.btn-danger:hover { background: #fff0f0; color: #d33; border-color: #e79a9a; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.hint { font-size: 12px; color: var(--text-3); min-height: 16px; }
.hint:empty { display: none; }
/* AI 设置弹窗 */
.ai-modal { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 9999; padding: 20px; }
.ai-modal-box { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 22px 24px; width: min(460px, 94vw); box-shadow: 0 18px 50px rgba(0,0,0,.25); }
.ai-modal-title { font-size: 15px; font-weight: 800; margin-bottom: 14px; }
.ai-lbl { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin: 12px 0 5px; }
.ai-in { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 13px; outline: none; box-sizing: border-box; }
.ai-in:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.ai-note { font-size: 11.5px; color: var(--text-3); line-height: 1.6; margin-top: 14px; }
/* editors */
.editor-block { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; background: #fbfcfe; }
.editor-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.editor-title { font-size: 13.5px; font-weight: 700; }
.editor-scroll { overflow-x: auto; }
.edit-grid { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.edit-grid th { background: #eef2f8; color: var(--text-2); font-weight: 700; padding: 7px 9px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); }
.edit-grid td { padding: 4px 6px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
.edit-grid .rownum { color: var(--text-3); text-align: center; width: 34px; }
.cell-input { width: 100%; min-width: 84px; border: 1px solid var(--border); border-radius: 6px; padding: 5px 7px; font-size: 12.5px; outline: none; background: #fff; }
.cell-input:focus { border-color: var(--primary); }
.row-del { border: none; background: #ffe9e9; color: #d33; width: 24px; height: 24px; border-radius: 6px; cursor: pointer; font-size: 15px; line-height: 1; }
.row-del:hover { background: #ffd2d2; }

/* 改造方案：多文件上传 + 链接样式 */
.plan-link { color: var(--primary); text-decoration: none; font-weight: 600; }
.plan-link:hover { text-decoration: underline; }
.plan-cell { max-width: 400px; min-width: 260px; }

/* 改造台账编辑态：列宽拖拽 + 行高调整（仅 retrofit）*/
.edit-grid.retrofit-resizable { table-layout: fixed; }
.edit-grid.retrofit-resizable thead th { position: relative; }
.edit-grid.retrofit-resizable thead th,
.edit-grid.retrofit-resizable tbody td { height: var(--rh, 42px); box-sizing: border-box; vertical-align: middle; }
.edit-grid.retrofit-resizable .cell-input,
.edit-grid.retrofit-resizable select.cell-input { width: 100%; box-sizing: border-box; }
.edit-grid.retrofit-resizable .plan-cell { max-width: none; } /* 固定布局下列宽由 col 控制，去掉之前 400px 上限避免冲突 */
.col-resize { position: absolute; top: 0; right: 0; width: 6px; height: 100%; cursor: col-resize; z-index: 3; }
.col-resize:hover { background: rgba(37,99,235,.35); }
.rf-layout-bar { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 13px; color: #475569; }
.rf-layout-bar input[type=range] { vertical-align: middle; }
.plan-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
.plan-item { display: flex; align-items: center; gap: 4px; font-size: 12.5px; }
.plan-item a { word-break: break-all; }
.plan-rm { border: none; background: #ffe9e9; color: #d33; width: 18px; height: 18px; border-radius: 5px; cursor: pointer; font-size: 12px; line-height: 1; padding: 0; }
.plan-rm:hover { background: #ffd2d2; }
.plan-empty { color: var(--text-3); font-size: 12px; }
.plan-add { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.plan-add .plan-file { font-size: 12px; max-width: 160px; }
.plan-up { background: var(--primary, #2563eb); color: #fff; border: none; border-radius: 6px; padding: 4px 12px; cursor: pointer; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.plan-up:hover { filter: brightness(1.08); }
.plan-up:disabled { opacity: .6; cursor: default; }
.plan-manage { margin-left: 6px; border: 1px solid var(--primary, #2563eb); color: var(--primary, #2563eb); background: #fff; border-radius: 6px; padding: 2px 9px; cursor: pointer; font-size: 12px; white-space: nowrap; }
.plan-manage:hover { background: var(--primary, #2563eb); color: #fff; }
.btn-xs { padding: 3px 8px; font-size: 12px; }
.rf-fleet-hint { background: #f0f6ff; border: 1px solid #d6e6ff; color: #235; border-radius: 8px; padding: 7px 11px; font-size: 12.5px; margin: 8px 0; }
.rf-fleet-hint b { color: #1d4ed8; }
/* history */
.history-list { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.history-item { border-left: 3px solid var(--primary); background: #f7f9fc; border-radius: 0 8px 8px 0; padding: 7px 10px; }
.h-action { font-size: 13px; font-weight: 700; color: var(--text); }
.h-detail { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.h-time { font-size: 11px; color: var(--text-3); margin-top: 3px; font-family: var(--mono); }
@media (max-width: 1100px) { .port-grid { grid-template-columns: 1fr; } }

/* =========================================================
   内容层（T1~T4）：全局搜索 / 项目档案 / 时间线 / 故障工单
   优先复用现有 .badge / .section-title / .filter-select / .empty / .grid 等
   ========================================================= */
/* 轻量 toast */
.qms-toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: #1f2937; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 9999;
}
.qms-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* T1 全局搜索 */
.gs-q { color: var(--primary); }
.gs-summary { font-size: 13px; color: var(--text-2); margin-bottom: 12px; }
.gs-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 14px; }
.gs-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.gs-mod { font-weight: 800; font-size: 14px; }
.gs-count { background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 12px; padding: 2px 10px; border-radius: 20px; }
.gs-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.gs-item { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; transition: all .12s; }
.gs-item:hover { border-color: var(--primary); background: var(--primary-soft); }
.gs-item-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.gs-item-snip { font-size: 12px; color: var(--text-3); margin-top: 3px; }

/* T2 项目档案 */
.archive-countries { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.arc-country {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s;
}
.arc-country:hover { border-color: var(--primary); color: var(--primary); }
.arc-country.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.archive-zone { margin-bottom: 22px; }
.archive-sub { margin-top: 10px; }
.archive-sub-title { font-size: 13.5px; font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.arc-uncat { font-size: 12px; color: var(--text-3); }
.arc-row { cursor: pointer; }
.arc-row:hover { background: var(--primary-soft) !important; }

/* T3 时间线 */
.tl-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.tl-lbl { font-size: 13px; font-weight: 700; color: var(--text-2); }
.tl-list { position: relative; }
.tl-day { margin-bottom: 18px; }
.tl-date { font-size: 13px; font-weight: 800; color: var(--text-2); margin-bottom: 8px; position: relative; padding-left: 18px; }
.tl-date::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.tl-events { border-left: 2px solid var(--border); margin-left: 7px; padding-left: 14px; display: grid; gap: 8px; }
.tl-event { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; cursor: pointer; transition: all .12s; }
.tl-event:hover { border-color: var(--primary); background: var(--primary-soft); }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; }
.tl-src-memo { background: #22c55e; }
.tl-src-retrofit { background: #14b8a6; }
.tl-src-material { background: #f59e0b; }
.tl-src { font-size: 12px; font-weight: 700; color: var(--text-2); min-width: 42px; }
.tl-label { font-size: 13px; color: var(--text); }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-grid, .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .sidebar { display: none; }
  .stat-grid { grid-template-columns: 1fr; }
  .topbar-hint { display: none; }
}

/* ===== 手册资料：文件夹筛选 + 在线预览层 ===== */
.folder-chip { padding: 5px 13px; border-radius: 999px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-size: 13px; color: var(--text-2); transition: .12s; }
.folder-chip:hover { border-color: var(--primary); color: var(--primary); }
.folder-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.manual-open { color: var(--primary); cursor: pointer; font-weight: 600; text-decoration: none; }
.manual-open:hover { text-decoration: underline; }

/* ===== 项目备忘录：两层视图（递进式重构） ===== */
.memo-grid { border-collapse: collapse; width: 100%; font-size: 13px; }
.memo-grid th { background: #eef2f8; color: var(--text-2); font-weight: 700; padding: 9px 11px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); }
.memo-grid td { padding: 8px 11px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
.memo-grid td.desc { max-width: 380px; white-space: normal; color: var(--text); }
.memo-grid .col-expand { width: 34px; text-align: center; padding: 8px 6px; }
.exp-btn { border: 1px solid var(--border); background: #fff; color: var(--text-2); width: 24px; height: 24px; border-radius: 6px; cursor: pointer; font-size: 11px; line-height: 1; transition: .12s; }
.exp-btn:hover { border-color: var(--primary); color: var(--primary); }
.exp-btn.open { background: var(--primary); color: #fff; border-color: var(--primary); }
.memo-row:hover { background: #f8fafc; }
.memo-sub-row > td { background: #f8fafc; padding: 0 !important; }

/* 第二层：更新时间轴 */
.memo-sub { padding: 14px 18px; }
.sub-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.sub-title { font-weight: 700; font-size: 13.5px; color: #334155; }
.sub-empty { color: var(--text-3); font-size: 13px; padding: 8px 2px; }
.update-list { display: grid; gap: 10px; }
.update-item { border: 1px solid #e6ecf3; border-radius: 10px; padding: 10px 12px; background: #fff; }
.update-head { display: flex; align-items: center; gap: 10px; }
.update-date { font-weight: 600; font-size: 12.5px; color: #475569; white-space: nowrap; }
.update-content { flex: 1; font-size: 13px; color: var(--text); white-space: pre-wrap; }
.up-del { margin-left: auto; border: none; background: #ffe9e9; color: #d33; width: 22px; height: 22px; border-radius: 6px; cursor: pointer; font-size: 14px; line-height: 1; }
.up-del:hover { background: #ffd2d2; }
.update-fields { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 8px; }
.update-fields .detail-field { min-width: 120px; }

/* 第二层：添加更新表单 */
.update-edit { border: 1px dashed #cbd5e1; border-radius: 10px; padding: 12px 14px; background: #fffdf7; }
.ef-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 14px; }
.ef-row { display: flex; flex-direction: column; gap: 4px; }
.ef-row label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.update-edit .btn-row { margin-top: 12px; display: flex; gap: 8px; }

/* ---------- 顶栏用户菜单（鉴权 v2 注入） ---------- */
.user-menu {
  position: relative;
  display: flex;
  align-items: center;
}
.user-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fbfcfe;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.user-menu-toggle:hover {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}
.user-menu-avatar { font-size: 14px; line-height: 1; }
.user-menu-name { font-weight: 600; }
.user-menu-caret { font-size: 9px; color: var(--text-3); margin-left: 2px; }
.user-menu.open .user-menu-caret { transform: rotate(180deg); }
.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15, 30, 60, 0.12), 0 2px 6px rgba(0,0,0,0.06);
  padding: 8px;
  z-index: 20;
}
.user-menu-dropdown[hidden] { display: none; }
.user-menu-info {
  padding: 8px 10px 10px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 6px;
}
.user-menu-info-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  word-break: break-all;
}
.user-menu-info-role {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 6px;
  padding: 1px 8px;
  font-weight: 600;
}
.user-menu-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 4px 0;
}
.user-menu-logout {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: #b91c1c;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s;
}
.user-menu-logout:hover { background: #fef2f2; }

/* ---------- 顶栏下拉菜单项（钉钉测试 / 后续可复用） ---------- */
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: background .12s;
}
.user-menu-item:hover { background: #f1f5f9; }
.user-menu-item-icon { font-size: 14px; line-height: 1; }
.user-menu-item-label { flex: 1; }

/* ---------- 通用 QMS Modal（钉钉测试等） ---------- */
.qms-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}
.qms-modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 24px 18px;
  width: min(520px, 94vw);
  max-width: 600px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
}
.qms-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.qms-modal h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}
.qms-modal-close {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--text-3);
  cursor: pointer;
  padding: 0 6px;
  border-radius: 4px;
}
.qms-modal-close:hover { background: #f1f5f9; color: var(--text); }
.qms-modal-desc {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.6;
}
.qms-modal .qms-form-row { margin-bottom: 12px; }
.qms-modal label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 5px;
}
.qms-modal input,
.qms-modal textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  box-sizing: border-box;
  background: #fff;
  outline: none;
  resize: vertical;
}
.qms-modal textarea { min-height: 80px; }
.qms-modal input:focus,
.qms-modal textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.qms-modal-status {
  margin: 6px 0 0;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  line-height: 1.5;
}
.qms-modal-status:empty { display: none; }
.qms-modal-status[hidden] { display: none; }
.qms-modal-status.success {
  background: #e7f6ec;
  color: #166534;
  border: 1px solid #bfe5cc;
}
.qms-modal-status.error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.qms-modal-actions {
  text-align: right;
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.qms-modal-actions button {
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  background: #f0f0f0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  transition: background .12s, border-color .12s, opacity .12s;
}
.qms-modal-actions button:hover { background: #e6e9ee; }
.qms-modal-actions button:disabled { opacity: 0.6; cursor: not-allowed; }
.qms-modal-actions .primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.qms-modal-actions .primary:hover { background: var(--primary-d); border-color: var(--primary-d); }

