:root {
    --bg: #f0f2f5; --card: #fff; --line: #e5e7eb; --line-2: #d1d5db;
    --text: #1f2937; --muted: #6b7280; --faint: #9ca3af;
    --brand: #2563eb; --brand-d: #1d4ed8; --brand-bg: #eff6ff;
    --ok: #16a34a; --warn: #d97706; --err: #dc2626;
    --sidebar: #111827; --sidebar-text: #9ca3af;
  }
  * { box-sizing: border-box; margin: 0; }
  body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
  b { font-weight: 600; }
  ::selection { background: var(--brand-bg); }

  /* 布局骨架 */
  .topbar { height: 52px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; position: sticky; top: 0; z-index: 50; }
  .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
  .brand .logo { width: 24px; height: 24px; border-radius: 6px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; }
  .shell { display: flex; min-height: calc(100vh - 52px); }
  .sidebar { width: 208px; background: var(--sidebar); padding: 12px 0; flex: none; display: none; }
  .sidebar.show { display: block; }
  .sidebar .grp { font-size: 11px; color: var(--faint); padding: 14px 20px 6px; letter-spacing: 1px; }
  .sidebar a { display: flex; align-items: center; gap: 8px; padding: 9px 20px; color: var(--sidebar-text); cursor: pointer; font-size: 13px; border-left: 2px solid transparent; }
  .sidebar a:hover { color: #fff; background: rgba(255,255,255,.04); }
  .sidebar a.active { color: #fff; border-left-color: var(--brand); background: rgba(37,99,235,.18); }
  .content { flex: 1; padding: 20px 24px; min-width: 0; max-width: 1280px; }
  .pagehead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
  .pagehead h2 { font-size: 17px; font-weight: 600; }
  .pagehead .desc { color: var(--muted); font-size: 12px; margin-top: 3px; }
  .card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; }

  /* 按钮/表单 */
  .btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 32px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--line-2); background: #fff; color: var(--text); font-size: 13px; cursor: pointer; white-space: nowrap; }
  .btn:hover { border-color: var(--brand); color: var(--brand); }
  .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
  .btn.primary:hover { background: var(--brand-d); }
  .btn.danger { color: var(--err); border-color: #f3c1c1; background: #fff; }
  .btn.danger:hover { background: #fef2f2; border-color: var(--err); }
  .btn.sm { height: 26px; padding: 0 10px; font-size: 12px; border-radius: 5px; }
  .btn:disabled { opacity: .45; cursor: not-allowed; }
  input[type=text], input[type=password], input[type=number], select {
    height: 32px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 6px; background: #fff; color: var(--text); font-size: 13px; outline: none; width: 100%; }
  input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-bg); }
  label.fl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
  label.fl .req { color: var(--err); margin-left: 2px; }

  /* 表格 */
  table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
  table.tb th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 10px 14px; background: #f9fafb; border-bottom: 1px solid var(--line); white-space: nowrap; }
  table.tb td { padding: 11px 14px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
  table.tb tr:hover td { background: #fafbfc; }
  table.tb tr:last-child td { border-bottom: 0; }
  .sub { color: var(--faint); font-size: 12px; }
  .ops { display: flex; gap: 6px; flex-wrap: wrap; }

  /* 徽标 */
  .pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 1px 8px; border-radius: 999px; }
  .pill i { width: 6px; height: 6px; border-radius: 50%; }
  .pill.ok { color: var(--ok); background: #f0fdf4; } .pill.ok i { background: var(--ok); }
  .pill.off { color: var(--muted); background: #f3f4f6; } .pill.off i { background: var(--faint); }
  .pill.warn { color: var(--warn); background: #fffbeb; } .pill.warn i { background: var(--warn); }
  .pill.run { color: var(--brand); background: var(--brand-bg); } .pill.run i { background: var(--brand); }
  .pill.err { color: var(--err); background: #fef2f2; } .pill.err i { background: var(--err); }

  /* 统计卡 */
  .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
  .stat { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
  .stat .num { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
  .stat .lbl { color: var(--muted); font-size: 12px; }

  /* 弹窗 */
  .modal-mask { position: fixed; inset: 0; background: rgba(17,24,39,.45); z-index: 300; display: none; align-items: flex-start; justify-content: center; padding-top: 10vh; }
  .modal-mask.show { display: flex; }
  .modal { background: #fff; border-radius: 10px; width: 520px; max-width: 94vw; max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
  .modal .m-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
  .modal .m-head b { font-size: 15px; }
  .modal .m-close { cursor: pointer; color: var(--faint); font-size: 18px; line-height: 1; }
  .modal .m-body { padding: 18px 20px; overflow-y: auto; }
  .modal .m-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
  .frow { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .frow1 { margin-bottom: 14px; }
  .hint { color: var(--muted); font-size: 12px; margin-top: 8px; line-height: 1.5; }

  /* 登录 */
  #view-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg,#f8fafc,#eef2f7); }
  .login-card { width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 36px 32px 28px; box-shadow: 0 10px 40px rgba(15,23,42,.06); }
  .login-card .brand { justify-content: center; margin-bottom: 6px; font-size: 17px; }
  .login-card .sub { text-align: center; color: var(--muted); font-size: 12px; margin-bottom: 26px; }

  /* 员工桌面卡片 */
  .desk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
  .desk { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
  .desk .name { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
  .desk .meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin-bottom: 14px; }

  /* 会话 */
  #view-session { position: fixed; inset: 0; background: #000; z-index: 200; display: none; flex-direction: column; }
  #view-session.show { display: flex; }
  .sess-bar { height: 44px; background: #111827; color: #e5e7eb; display: flex; justify-content: space-between; align-items: center; padding: 0 14px; flex: none; }
  .sess-bar .st { color: #9ca3af; font-size: 12px; margin-left: 10px; }
  .qlamp { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: #9ca3af; margin-left: 12px; }
  .qlamp i { width: 8px; height: 8px; border-radius: 50%; background: #6b7280; }
  .qlamp.g i { background: #22c55e; box-shadow: 0 0 6px #22c55e88; }
  .qlamp.y i { background: #f59e0b; box-shadow: 0 0 6px #f59e0b88; }
  .qlamp.r i { background: #ef4444; box-shadow: 0 0 6px #ef444488; }
  .sess-actions { display: flex; gap: 8px; flex: none; }
  .sess-bar > div:first-child { overflow: hidden; }
  #sess-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #session-frame { display: block; flex: 1 1 0; width: 100%; min-width: 0; min-height: 0; border: 0; }
  @media (max-width: 620px) {
    .sess-bar { padding: 0 8px; gap: 8px; }
    .sess-actions { gap: 4px; }
    .sess-actions .btn { padding: 0 6px; }
    .sess-bar .st { display: none !important; }
  }
  /* 工具箱抽屉 */
  #toolbox { position: fixed; top: 44px; right: 0; bottom: 0; width: 304px; background: #fff; border-left: 1px solid var(--line); z-index: 210; transform: translateX(105%); transition: transform .18s; display: flex; flex-direction: column; color: var(--text); }
  #toolbox.show { transform: translateX(0); }
  .tbx-head { padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
  .tbx-body { flex: 1; overflow-y: auto; padding: 4px 16px 20px; }
  .tbx-g { border-bottom: 1px solid #f3f4f6; padding: 10px 0; }
  .tbx-g h4 { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
  .tbx-r { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; font-size: 13px; }
  .tbx-r select { width: auto; flex: 1; max-width: 170px; }
  .sw { position: relative; width: 34px; height: 19px; flex: none; }
  .sw input { opacity: 0; width: 0; height: 0; }
  .sw i { position: absolute; inset: 0; background: #d1d5db; border-radius: 999px; cursor: pointer; transition: .15s; }
  .sw i::after { content: ''; position: absolute; width: 15px; height: 15px; left: 2px; top: 2px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
  .sw input:checked + i { background: var(--brand); }
  .sw input:checked + i::after { transform: translateX(15px); }
  .net6 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
  .net6 b { color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
  #tbx-log { font-family: ui-monospace, Menlo, monospace; font-size: 11px; line-height: 1.6; color: var(--muted); max-height: 170px; overflow-y: auto; background: #f9fafb; border: 1px solid var(--line); border-radius: 6px; padding: 8px; margin-top: 6px; }
  #tbx-log .t { color: var(--brand); } #tbx-log .e { color: var(--err); }

  /* Toast */
  #toasts { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: 8px; align-items: center; }
  .toast { background: #111827; color: #fff; border-radius: 6px; padding: 9px 16px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 80vw; }
  .toast.err { background: var(--err); }
  .toast.ok { background: var(--ok); }
  .empty { text-align: center; color: var(--faint); padding: 48px 0; font-size: 13px; }
  [hidden] { display: none !important; }

/* 控制台：克制的层级、紧凑的数据区。 */
:root { --bg:#f7f8fa; --card:#fff; --line:#e5e7eb; --line-2:#d3d7dd; --text:#20252b; --muted:#68717c; --faint:#77818d; --brand:#235c49; --brand-d:#194735; --brand-bg:#edf4f0; --ok:#28724d; --err:#b33737; --sidebar:#f8f9fa; --sidebar-text:#59616b; }
body { line-height:1.5; -webkit-font-smoothing:antialiased; }
.topbar { height:60px; padding:0 28px; }
.brand { font-size:16px; font-weight:650; letter-spacing:-.3px; }
.brand .logo { background:#263b33; border-radius:4px; width:27px; height:27px; font-size:16px; font-weight:500; }
.shell { min-height:calc(100vh - 60px); }
.sidebar { width:196px; border-right:1px solid var(--line); padding:22px 10px; }
.sidebar .grp { padding:18px 14px 8px; color:#8a919a; letter-spacing:0; font-size:11px; }
.sidebar a { margin:2px 0; padding:9px 14px; border:0; border-radius:4px; font-size:13px; }
.sidebar a:hover { color:var(--text); background:#eceff1; }
.sidebar a.active { color:#234d3c; background:#e8eeea; font-weight:600; }
.content { max-width:1600px; padding:32px 36px 48px; }
.pagehead { margin-bottom:24px; gap:12px; }
.pagehead > div:first-child { flex:1; }
.pagehead h2 { font-size:23px; font-weight:600; letter-spacing:-.6px; line-height:1.4; }
.pagehead .desc { font-size:13px; margin-top:6px; }
.card { border-radius:5px; overflow:auto; }
.btn { height:34px; border-radius:4px; font-family:inherit; font-weight:500; box-shadow:0 1px 1px #00000003; }
.btn.sm { height:29px; border-radius:4px; }
.btn.danger { border-color:transparent; background:transparent; }
.btn:focus-visible,a:focus-visible { outline:2px solid var(--brand); outline-offset:3px; }
input[type=text],input[type=password],input[type=number],input[type=search],select { height:36px; border-radius:4px; font-family:inherit; }
input[type=search] { width:240px; max-width:100%; border:1px solid var(--line-2); padding:0 11px; outline:none; background:white; }
label.fl { font-size:13px; color:#444e58; }
table.tb { min-width:620px; font-size:13px; }
table.tb th { background:#fafbfc; color:#626b76; padding:12px 16px; }
table.tb td { padding:14px 16px; border-color:#edf0f2; }
table.tb tr:hover td { background:#fafcfb; }
table.tb td:last-child { width:1%; white-space:nowrap; }
.sub { font-size:12px; color:#7b8590; }
.pill { padding:2px 0; border-radius:0; font-size:12px; gap:6px; }
.pill.ok,.pill.off,.pill.warn,.pill.run,.pill.err { background:transparent; }
.stats { display:flex; gap:0; background:white; border:1px solid var(--line); border-radius:5px; margin-bottom:22px; }
.stat { border:0; border-radius:0; background:transparent; padding:18px 24px; flex:1; }
.stat + .stat { border-left:1px solid var(--line); }
.stat .num { font-size:25px; font-weight:550; letter-spacing:-.6px; }
.table-controls { padding:14px 16px; border-bottom:1px solid var(--line); display:flex; align-items:center; gap:16px; justify-content:space-between; }
.table-count,.table-footer { color:var(--muted); font-size:12px; }
.table-footer { display:flex; align-items:center; justify-content:space-between; padding:12px 16px; border-top:1px solid var(--line); }
.loading,.error-panel { padding:48px 24px; background:white; border:1px solid var(--line); border-radius:5px; color:var(--muted); }
.error-panel b { color:var(--text); font-size:15px; }
.error-panel p { margin:8px 0 20px; }
.notice { border-left:3px solid #a8792d; background:#fcf8ef; padding:12px 16px; margin-bottom:20px; font-size:13px; color:#75571e; }
#view-login { background:#f7f8fa; }
.login-card { width:390px; border-radius:6px; box-shadow:none; padding:36px; }
.login-card .brand { justify-content:flex-start; font-size:22px; margin-bottom:10px; }
.login-card .sub { text-align:left; margin-bottom:30px; font-size:13px; }
.desk-grid { gap:18px; }
.desk { border-radius:5px; padding:22px; }
.desk .name { font-size:16px; margin-bottom:12px; }
.desk .meta { flex-wrap:wrap; gap:8px 12px; margin-bottom:20px; }
.desk .meta .sub { flex-basis:100%; font-family:ui-monospace,monospace; font-size:11px; }
.modal-mask { background:#16211d66; }
.modal { border-radius:6px; box-shadow:0 16px 60px #0002; }
.modal .m-head { padding:18px 22px; } .modal .m-body { padding:22px; } .modal .m-foot { background:#fbfcfc; }
.m-close { border:0; background:none; }
.toast { background:#263b33; border-radius:4px; box-shadow:0 3px 12px #0002; } .toast.ok { background:#263b33; }
.sess-bar { background:#202923; } .sess-bar .btn { background:#29362e; color:#e6ece8; border-color:#465349; } .sess-bar .btn.danger { color:#ecc2bc; }
.qlamp.g i,.qlamp.y i,.qlamp.r i { box-shadow:none; }
.empty { color:var(--muted); padding:44px 20px; }
@media (max-width:900px) { .topbar { padding:0 16px; } .topbar .brand .sub { display:none; } .sidebar { width:155px; } .content { padding:24px 20px; } .pagehead { flex-wrap:wrap; } .pagehead h2 { font-size:21px; } }
@media (max-width:620px) { .shell { display:block; } .sidebar.show { display:flex; width:100%; overflow:auto; border-right:0; border-bottom:1px solid var(--line); padding:8px; } .sidebar .grp { display:none; } .sidebar a { flex:none; padding:8px 12px; } .topbar { height:auto; min-height:60px; flex-wrap:wrap; gap:10px; padding:12px 16px; } .content { padding:24px 16px; } .stat { padding:14px; } .stat .num { font-size:22px; } .frow { grid-template-columns:1fr; gap:0; } .table-controls { gap:10px; } .table-controls input { width:180px; } #whoami { max-width:110px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } .sess-bar .st { max-width:180px; display:inline-block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; vertical-align:middle; } .qlamp { display:none; } }
@media (prefers-reduced-motion:reduce) { * { transition:none!important; } }

table.tb td:last-child { width:auto; }
table.tb td:last-child .ops { flex-wrap:nowrap; }
table.tb td:last-child .btn { background:transparent; border:0; color:var(--brand); padding:0 6px; box-shadow:none; }
table.tb td:last-child .btn.danger { color:var(--err); }

details summary { cursor:pointer; color:var(--muted); }
details pre { white-space:pre-wrap; overflow-wrap:anywhere; max-width:300px; margin:10px 0; font-size:11px; }
.pill { white-space:nowrap; }
table.tb { min-width:860px; }
table.tb td:first-child { min-width:150px; }
@media (max-width:620px) { .pagehead > div:first-child { flex-basis:100%; } }
.audit-filters { display:flex; align-items:flex-end; flex-wrap:wrap; gap:14px; margin-bottom:20px; }
.audit-filters label { display:flex; flex-direction:column; gap:6px; color:#444e58; font-size:12px; }
.audit-filters input[type=date] { height:36px; padding:0 10px; border:1px solid var(--line-2); border-radius:4px; background:white; color:var(--text); font:inherit; }
.audit-filters select { min-width:150px; }
.audit-filters .ops { padding-bottom:1px; }
.table-scroll { overflow:auto; }
table[aria-busy=true] tbody { opacity:.5; }
@media (max-width:620px) { .audit-filters { gap:12px; } .audit-filters label { flex:1 1 140px; min-width:0; } .audit-filters input[type=search] { width:100%; } }
