:root { --bg:#0b1220; --panel:#16233a; --panel2:#0f1a2c; --text:#e6edf7; --muted:#8b98ad; --accent:#4cc2ff; --good:#34d399; --bad:#f87171; --warn:#fbbf24; --line:rgba(255,255,255,0.08); }
    * { margin:0; padding:0; box-sizing:border-box; }
    body { font-family:-apple-system,"PingFang SC","Microsoft YaHei",sans-serif; background:var(--bg); color:var(--text); padding:14px; }
    .header { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; gap:10px; flex-wrap:wrap; }
    .header h1 { font-size:17px; }
    .dot { width:10px; height:10px; border-radius:50%; background:var(--good); flex:none; }
    .dot.off { background:var(--bad); }
    .card { background:var(--panel); border-radius:12px; padding:14px; margin-bottom:12px; }
    .label { font-size:12px; color:var(--muted); }
    .val { font-size:22px; font-weight:700; margin-top:4px; }
    .list { display:flex; flex-direction:column; gap:8px; }
    .item { display:flex; justify-content:space-between; gap:8px; padding:8px 0; border-bottom:1px solid var(--line); }
    .item:last-child { border-bottom:none; }
    .item .k { color:var(--muted); font-size:13px; }
    .alarm-item { padding:10px; border-radius:8px; background:rgba(248,113,113,0.12); margin-bottom:8px; }
    .alarm-item.warn { background:rgba(251,191,36,0.12); }
    .alarm-item .msg { font-size:14px; }
    .alarm-item .meta { font-size:11px; color:var(--muted); margin-top:3px; }
    input, select { width:100%; padding:9px 10px; margin-top:6px; border-radius:8px; border:1px solid rgba(255,255,255,0.12); background:var(--panel2); color:var(--text); font-size:14px; }
    input[type=checkbox], input[type=radio] { width:auto; padding:0; margin:0; flex:none; accent-color:var(--accent); }
    button { border:none; border-radius:8px; padding:9px 13px; font-size:13px; cursor:pointer; background:var(--accent); color:#04121f; font-weight:600; }
    button.sm { padding:5px 9px; font-size:12px; }
    button.ghost { background:transparent; color:var(--accent); border:1px solid rgba(76,194,255,0.4); }
    button.danger { background:var(--bad); color:#1a0505; }
    button:disabled { opacity:.45; cursor:not-allowed; }
    a.link-btn, button.link-btn { display:inline-block; border-radius:8px; padding:8px 12px; font-size:13px; font-weight:600; color:var(--accent); border:1px solid rgba(76,194,255,0.4); text-decoration:none; background:transparent; cursor:pointer; }
    a.link-btn:hover, button.link-btn:hover { background:rgba(76,194,255,0.12); }
    .row > .link-btn { flex:0 0 auto; min-width:0; max-width:100%; white-space:normal; word-break:break-word; overflow-wrap:anywhere; }
    .err { color:var(--bad); font-size:12px; margin-top:8px; min-height:16px; }
    .topbar { display:flex; flex-direction:column; gap:8px; margin-bottom:12px; }
    .topbar-row { display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; }
    .topbar-left { display:flex; align-items:center; gap:8px; }
    .crumb { color:var(--text); font-size:13px; font-weight:600; white-space:nowrap; }
    .crumb-back { cursor:pointer; user-select:none; text-decoration:underline; text-decoration-color:var(--good); text-underline-offset:3px; margin-right:4px; }
    .crumb-back:hover, .crumb-back:focus { color:var(--accent); }
    .topbar-actions { display:flex; align-items:center; gap:6px; margin-left:auto; }
    .topbar-actions .tab { display:inline-flex; align-items:center; justify-content:center; background:transparent; color:var(--accent); border:1px solid rgba(76,194,255,0.4); border-radius:8px; padding:5px 7px; font-size:12px; line-height:1; }
    .topbar-actions .tab.active { background:transparent; color:var(--accent); font-weight:600; }
    /* 右上角图标按钮：按下时与第二行菜单选中态同色，松开/失焦后立即恢复 */
    .topbar-actions button, .topbar-actions .tab { -webkit-tap-highlight-color:transparent; transition:background-color .12s ease, color .12s ease, border-color .12s ease; }
    .topbar-actions button:focus, .topbar-actions .tab:focus { outline:none; }
    .topbar-actions .tab:active { background:var(--accent); color:#04121f; border-color:var(--accent); }
    .topbar-actions button:active { background:var(--accent); color:#04121f; border-color:var(--accent); }
    button.icon-btn { padding:5px 8px; font-size:14px; line-height:1; display:inline-flex; align-items:center; justify-content:center; }
    .btn-bar { display:flex; align-items:stretch; gap:8px; }
    .btn-bar > button { height:34px; padding:0 12px; font-size:13px; display:inline-flex; align-items:center; justify-content:center; line-height:1; }
    .btn-bar > button.icon-btn { width:34px; padding:0; font-size:15px; }
    .tabs { display:flex; gap:6px; flex-wrap:wrap; }
    #tabs-right { margin-left:auto; }
    .tab { padding:7px 12px; border-radius:999px; background:var(--panel); color:var(--muted); cursor:pointer; font-size:13px; }
    .tab.active { background:var(--accent); color:#04121f; font-weight:600; }
    .subtabs { display:flex; gap:6px; margin-bottom:10px; flex-wrap:wrap; }
    .subtab { padding:6px 12px; border-radius:999px; background:var(--panel2); color:var(--muted); cursor:pointer; font-size:13px; }
    .subtab.active { background:var(--accent); color:#04121f; font-weight:600; }
    .node-row { display:flex; align-items:center; gap:8px; padding:8px 0; border-bottom:1px solid var(--line); flex-wrap:wrap; }
    .node-row:last-child { border-bottom:none; }
    .node-row .nm { flex:1; min-width:140px; }
    .node-row .meta { color:var(--muted); font-size:12px; }
    .dev-row { display:flex; flex-wrap:wrap; align-items:center; gap:8px; padding:6px 0; border-bottom:1px dashed var(--line); font-size:13px; }
    .dev-row .dev-name { flex:1 1 160px; min-width:120px; word-break:break-word; overflow-wrap:anywhere; }
    .dev-row .dev-actions { display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
    .dev-row:last-child { border-bottom:none; }
    .cfg-hint { color:var(--muted); font-size:12px; }
    .cfg-form { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; margin-top:8px; }
    @media (max-width:720px) { .cfg-form { grid-template-columns:1fr 1fr; } }
    .filter-panel { display:none; }
    .filter-panel.open { display:block; }
    .filter-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
    .filter-tags { display:flex; gap:6px; flex-wrap:wrap; margin-top:8px; }
    .tag { font-size:12px; padding:4px 8px; border-radius:999px; background:rgba(76,194,255,0.12); color:var(--accent); }
    .chip { cursor:pointer; user-select:none; border:1px solid transparent; }
    .chip:hover { background:rgba(76,194,255,0.2); }
    .chip.active { background:var(--accent); color:#04121f; font-weight:600; }
    tbody tr.clickable { cursor:pointer; }
    .toast { position:fixed; left:50%; bottom:32px; transform:translate(-50%,20px); background:rgba(22,35,58,0.96); color:var(--text); border:1px solid rgba(76,194,255,0.3); border-radius:10px; padding:10px 16px; font-size:13px; opacity:0; pointer-events:none; transition:opacity .2s ease, transform .2s ease; z-index:200; max-width:86vw; text-align:center; }
    .toast.show { opacity:1; transform:translate(-50%,0); }
    .term { cursor:help; }
    .agent-mask { position:fixed; inset:0; background:rgba(0,0,0,0.45); z-index:120; display:none; }
    .agent-mask.open { display:block; }
    .agent-panel { position:fixed; top:0; right:0; bottom:0; width:min(430px,100vw); background:var(--panel); z-index:121; display:flex; flex-direction:column; transform:translateX(100%); transition:transform .2s ease; box-shadow:-8px 0 30px rgba(0,0,0,.35); }
    .agent-panel.open { transform:translateX(0); }
    .agent-head { display:flex; justify-content:space-between; align-items:center; padding:12px 14px; border-bottom:1px solid var(--line); }
    .agent-head b { font-size:14px; }
    .agent-panel, .agent-body, .agent-msg { -webkit-user-select:text; user-select:text; }
    .agent-body { flex:1; overflow:auto; padding:14px; display:flex; flex-direction:column; gap:10px; }
    .agent-msg { max-width:92%; padding:10px 12px; border-radius:10px; font-size:14px; line-height:1.65; white-space:pre-wrap; word-break:break-word; }
    .agent-msg.user { align-self:flex-end; background:var(--accent); color:#04121f; }
    .agent-msg.bot { align-self:flex-start; background:var(--panel2); }
    .agent-user-row { display:flex; align-items:flex-end; justify-content:flex-end; gap:6px; max-width:100%; }
    .agent-user-row .agent-msg { max-width:92%; }
    .agent-answer { display:flex; flex-direction:column; align-items:flex-start; gap:4px; max-width:92%; }
    .agent-answer .agent-msg { max-width:100%; }
    .agent-feedback { display:flex; gap:6px; justify-content:flex-start; align-items:center; width:100%; }
    .agent-feedback .agent-copy-icon { margin-left:auto; }
    .agent-copy-icon { flex:none; display:inline-flex; align-items:center; justify-content:center; width:24px; height:24px; padding:0; border:1px solid var(--line); border-radius:6px; background:transparent; color:var(--muted); cursor:pointer; }
    .agent-copy-icon:hover { color:var(--accent); border-color:var(--accent); }
    .agent-feedback button { font-size:11px; padding:2px 8px; border-radius:6px; }
    .agent-status { align-self:flex-start; color:var(--muted); font-size:12px; }
    .agent-chips { display:flex; gap:6px; flex-wrap:wrap; }
    .agent-input { display:flex; gap:8px; padding:12px; border-top:1px solid var(--line); }
    .agent-input input { flex:1; margin:0; }
    .agent-hint { color:var(--muted); font-size:11px; padding:0 14px 10px; }
    .ack-yes { color:var(--good); font-size:12px; }
    .ack-no { color:var(--warn); font-size:12px; }
    .row { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
    .row > * { flex:1; min-width:120px; }
    .row > .dot { flex:none; min-width:0; }
    .grid2 { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
    .grid3 { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
    .kpi { background:var(--panel2); border-radius:10px; padding:12px; }
    .kpi-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
    .kpi-link { cursor:pointer; transition:background-color .15s ease; }
    .kpi-link:hover { background:rgba(76,194,255,0.10); }
    .kpi .v { font-size:20px; font-weight:700; margin-top:4px; }
    .state-current { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-top:8px; font-size:15px; }
    .state-legend { display:flex; gap:14px; flex-wrap:wrap; margin-top:10px; font-size:12px; color:var(--muted); }
    .state-legend-item { display:inline-flex; align-items:center; gap:4px; }
    .state-emoji { font-size:15px; line-height:1; }
    .state-run { color:var(--good); }
    .state-idle { color:var(--warn); }
    .state-down { color:var(--bad); }
    .state-setup { color:#a78bfa; }
    .state-maintenance { color:#60a5fa; }
    .state-offline { color:#94a3b8; }
    .state-unknown { color:var(--muted); }
    .state-reason { font-size:12px; color:var(--muted); }
    .reason-code { font-size:11px; opacity:.6; margin-left:4px; }
    .state-event { padding:8px 0; border-bottom:1px solid var(--line); }
    .state-event:last-child { border-bottom:none; }
    .state-event-main { display:flex; align-items:center; gap:6px; flex-wrap:wrap; font-size:14px; }
    .state-event-time { font-size:11px; color:var(--muted); margin-top:4px; }
    table { width:100%; border-collapse:collapse; font-size:13px; border:1px solid rgba(255,255,255,0.18); }
    th, td { text-align:left; padding:9px 8px; border:1px solid rgba(255,255,255,0.14); vertical-align:middle; }
    th { color:var(--muted); font-weight:600; font-size:12px; background:var(--panel2); white-space:nowrap; }
    tbody tr:nth-child(even) { background:rgba(255,255,255,0.025); }
    tbody tr:hover { background:rgba(76,194,255,0.07); }
    canvas { width:100%; height:220px; background:var(--panel2); border-radius:10px; }
    .muted { color:var(--muted); font-size:12px; }
    .view { display:none; }
    .view.active { display:block; }
    @media (max-width:720px) {
      .filter-grid, .grid3, .kpi-grid { grid-template-columns:1fr 1fr; }
      .grid2 { grid-template-columns:1fr; }
    }
    .sheet-mask { position:fixed; inset:0; background:rgba(0,0,0,0.5); z-index:100; display:none; }
    .sheet-mask.open { display:block; }
    .sheet { position:fixed; left:0; right:0; bottom:0; background:var(--panel); border-radius:16px 16px 0 0; padding:16px; z-index:101; transform:translateY(100%); transition:transform .25s ease; max-height:82vh; overflow:auto; box-shadow:0 -8px 30px rgba(0,0,0,0.4); }
    .sheet.open { transform:translateY(0); }
    .sheet .sheet-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:14px; }
    .pw-wrap { position:relative; margin-top:6px; }
    .pw-wrap input { margin-top:0; padding-right:42px; }
    .pw-eye { position:absolute; right:6px; top:50%; transform:translateY(-50%); background:transparent; border:none; padding:4px; border-radius:6px; color:var(--muted); cursor:pointer; display:inline-flex; align-items:center; justify-content:center; }
    .pw-eye:hover { color:var(--accent); background:rgba(76,194,255,0.10); }
      /* Standard close button: large X */
    .close-x { background:transparent; border:0; padding:0; width:38px; height:38px; display:inline-flex; align-items:center; justify-content:center; color:var(--muted); font-size:26px; line-height:1; cursor:pointer; border-radius:8px; flex:none; }
    .close-x:hover { color:var(--text); background:rgba(255,255,255,.06); }
