Files
ssh-e2e/ui/style.css
T
leefer 27a3b4c6a8 SSH 隧道管理器:pywebview+paramiko 桌面应用
- 本地端口转发隧道管理(密码/私钥认证,自动重连,随应用启动)
- 主机与隧道可视化配置,DPAPI 加密存储机密,known_hosts 校验
- 自定义无边框窗口,深色界面,托盘驻留(最小化/关闭到托盘)
- 内置本地测试 SSH 服务端与端到端自测脚本
2026-09-24 17:14:59 +08:00

631 lines
16 KiB
CSS

/* SSH 隧道管理器 — 界面样式
原则:石墨深色底、单一点缀色、无渐变无发光、系统字体 */
:root {
--bg: #111418;
--surface: #171b21;
--surface-2: #1d232b;
--surface-3: #242b34;
--border: #28303a;
--border-strong: #384250;
--text: #e2e7ee;
--dim: #97a1ad;
--faint: #5f6a76;
--accent: #2fbfa1;
--accent-strong: #43d6b5;
--accent-dim: rgba(47, 191, 161, 0.13);
--on-accent: #07130f;
--green: #46c46e;
--green-dim: rgba(70, 196, 110, 0.12);
--amber: #d9a23c;
--amber-dim: rgba(217, 162, 60, 0.12);
--red: #e2564d;
--red-dim: rgba(226, 86, 77, 0.12);
--r-lg: 10px;
--r-md: 8px;
--r-sm: 6px;
--mono: "Cascadia Mono", "JetBrains Mono", "Consolas", ui-monospace, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
font: 13px/1.55 "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI",
system-ui, sans-serif;
background: var(--bg);
color: var(--text);
overflow: hidden;
user-select: none;
cursor: default;
}
::selection { background: var(--accent-dim); color: var(--text); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
background: var(--surface-3);
border: 3px solid transparent;
border-radius: 6px;
background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--border-strong); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select { font: inherit; color: var(--text); }
svg.ic { flex: none; vertical-align: -2px; }
.mono { font-family: var(--mono); }
/* ---------- 标题栏 ---------- */
.titlebar {
height: 42px;
display: flex;
align-items: center;
-webkit-app-region: no-drag;
}
.titlebar .drag-zone {
display: flex;
align-items: center;
gap: 9px;
flex: 1;
height: 100%;
padding-left: 14px;
}
.titlebar .logo {
width: 24px;
height: 24px;
border-radius: 7px;
overflow: hidden;
flex: none;
}
.titlebar .logo img { width: 100%; height: 100%; display: block; }
.titlebar .title {
font-size: 12.5px;
font-weight: 600;
letter-spacing: 0.2px;
color: var(--dim);
}
.win-controls { display: flex; height: 100%; }
.wbtn {
width: 44px;
height: 100%;
display: grid;
place-items: center;
color: var(--dim);
transition: background 0.12s, color 0.12s;
}
.wbtn:hover { background: var(--surface-2); color: var(--text); }
.wbtn.close:hover { background: #d0342c; color: #fff; }
/* ---------- 布局 ---------- */
#app { display: flex; height: calc(100% - 42px); }
nav#nav {
width: 172px;
flex: none;
display: flex;
flex-direction: column;
padding: 10px 10px 12px;
border-right: 1px solid var(--border);
}
.nav-item {
display: flex;
align-items: center;
gap: 9px;
padding: 8px 10px;
border-radius: var(--r-md);
color: var(--dim);
font-size: 13px;
margin-bottom: 2px;
transition: background 0.12s, color 0.12s;
text-align: left;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.on {
background: var(--surface-2);
color: var(--text);
font-weight: 500;
}
.nav-item.on .ic { color: var(--accent); }
.nav-item .nav-badge {
margin-left: auto;
font-size: 11px;
font-family: var(--mono);
color: var(--faint);
}
.nav-item .nav-badge.live { color: var(--green); }
.nav-foot { margin-top: auto; padding: 0 6px; }
.conn-summary {
display: flex;
align-items: center;
gap: 7px;
font-size: 11.5px;
color: var(--faint);
border-top: 1px solid var(--border);
padding-top: 12px;
}
main#main { flex: 1; min-width: 0; overflow-y: auto; }
.view { display: none; padding: 22px 26px 30px; }
.view.on { display: block; }
.view-head {
display: flex;
align-items: center;
margin-bottom: 16px;
gap: 12px;
}
.view-head h1 { font-size: 16px; font-weight: 600; }
.view-head .count {
font-family: var(--mono);
font-size: 12px;
color: var(--faint);
margin-top: 1px;
}
.view-head .spacer { flex: 1; }
/* ---------- 通用控件 ---------- */
.btn {
display: inline-flex;
align-items: center;
gap: 6px;
height: 32px;
padding: 0 14px;
border-radius: var(--r-md);
background: var(--surface-2);
border: 1px solid var(--border-strong);
font-size: 12.5px;
font-weight: 500;
color: var(--text);
transition: background 0.12s, border-color 0.12s, color 0.12s;
white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn.primary {
background: var(--accent);
border-color: var(--accent);
color: var(--on-accent);
font-weight: 600;
}
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.sm { height: 28px; padding: 0 11px; font-size: 12px; border-radius: var(--r-sm); }
.btn.subtle { background: transparent; border-color: var(--border); color: var(--dim); }
.btn.subtle:hover { color: var(--text); background: var(--surface-2); }
.btn.danger { color: var(--red); border-color: rgba(226, 86, 77, 0.4); }
.btn.danger:hover { background: var(--red-dim); border-color: var(--red); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.ibtn {
width: 28px;
height: 28px;
border-radius: var(--r-sm);
display: inline-grid;
place-items: center;
color: var(--faint);
transition: background 0.12s, color 0.12s;
flex: none;
}
.ibtn:hover { background: var(--surface-3); color: var(--text); }
.ibtn.red:hover { background: var(--red-dim); color: var(--red); }
.field { margin-bottom: 13px; }
.field > label {
display: block;
font-size: 12px;
font-weight: 500;
color: var(--dim);
margin-bottom: 6px;
}
.field .hint {
font-size: 11.5px;
color: var(--faint);
margin-top: 5px;
line-height: 1.45;
}
.ipt {
width: 100%;
height: 34px;
padding: 0 10px;
background: var(--surface-2);
border: 1px solid var(--border);
border-radius: var(--r-md);
outline: none;
transition: border-color 0.12s, box-shadow 0.12s;
}
textarea.ipt { height: auto; padding: 8px 10px; resize: vertical; }
.ipt:hover { border-color: var(--border-strong); }
.ipt:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.ipt::placeholder { color: var(--faint); }
.ipt.err { border-color: var(--red); }
select.ipt { appearance: none; padding-right: 28px; cursor: pointer; }
.sel-wrap { position: relative; }
.sel-wrap::after {
content: "";
position: absolute;
right: 11px; top: 13px;
width: 7px; height: 7px;
border-right: 1.6px solid var(--faint);
border-bottom: 1.6px solid var(--faint);
transform: rotate(45deg);
pointer-events: none;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.row2-uneven { display: grid; grid-template-columns: 1fr 110px; gap: 0 12px; }
.seg {
display: flex;
background: var(--surface-2);
border: 1px solid var(--border);
border-radius: var(--r-md);
padding: 2px;
gap: 2px;
}
.seg button {
flex: 1;
height: 28px;
border-radius: var(--r-sm);
color: var(--dim);
font-size: 12.5px;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
transition: background 0.12s, color 0.12s;
}
.seg button:hover { color: var(--text); }
.seg button.on {
background: var(--surface-3);
color: var(--text);
box-shadow: inset 0 0 0 1px var(--border-strong);
}
.switch-row {
display: flex;
align-items: center;
gap: 10px;
padding: 7px 0;
}
.switch-row .sw-text { flex: 1; }
.switch-row .sw-title { font-size: 12.5px; }
.switch-row .sw-desc { font-size: 11.5px; color: var(--faint); }
.switch {
position: relative;
width: 34px; height: 20px;
flex: none;
appearance: none;
background: var(--surface-3);
border: 1px solid var(--border-strong);
border-radius: 20px;
cursor: pointer;
transition: background 0.15s, border-color 0.15s;
}
.switch::after {
content: "";
position: absolute;
top: 2px; left: 2px;
width: 14px; height: 14px;
border-radius: 50%;
background: var(--dim);
transition: left 0.15s, background 0.15s;
}
.switch:checked { background: var(--accent-dim); border-color: var(--accent); }
.switch:checked::after { left: 16px; background: var(--accent); }
/* ---------- 隧道卡片 ---------- */
.card-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(430px, 1fr));
gap: 14px;
}
.tcard {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--r-lg);
padding: 14px 16px 13px;
display: flex;
flex-direction: column;
gap: 10px;
transition: border-color 0.15s;
}
.tcard:hover { border-color: var(--border-strong); }
.tcard.live { border-color: rgba(70, 196, 110, 0.25); }
.tcard .head { display: flex; align-items: center; gap: 8px; }
.tcard .name {
font-size: 13.5px;
font-weight: 600;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.tcard .head .grow { flex: 1; min-width: 0; }
.dot {
width: 8px; height: 8px;
border-radius: 50%;
flex: none;
background: var(--faint);
}
.dot.green { background: var(--green); box-shadow: 0 0 0 3px var(--green-dim); }
.dot.amber { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-dim); }
.dot.red { background: var(--red); box-shadow: 0 0 0 3px var(--red-dim); }
.dot.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.status-text { font-size: 12px; color: var(--dim); white-space: nowrap; }
.status-text.green { color: var(--green); }
.status-text.amber { color: var(--amber); }
.status-text.red { color: var(--red); }
.err-line {
font-size: 11.5px;
color: var(--red);
background: var(--red-dim);
border: 1px solid rgba(226, 86, 77, 0.25);
border-radius: var(--r-sm);
padding: 6px 9px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.mapline {
display: flex;
align-items: center;
gap: 8px;
font-family: var(--mono);
font-size: 12px;
color: var(--dim);
background: var(--surface-2);
border: 1px solid var(--border);
border-radius: var(--r-md);
padding: 7px 8px 7px 11px;
}
.mapline .addr { color: var(--text); }
.mapline .arrow { color: var(--accent); flex: none; }
.mapline .grow { flex: 1; }
.meta-row {
display: flex;
align-items: center;
gap: 5px;
font-size: 11.5px;
color: var(--faint);
}
.meta-row .ic { color: var(--faint); }
.meta-row .sep { margin: 0 4px; color: var(--border-strong); }
.meta-row .grow { flex: 1; }
.meta-row button {
color: var(--faint);
display: inline-flex;
align-items: center;
gap: 4px;
font-size: 11.5px;
padding: 2px 6px;
border-radius: var(--r-sm);
transition: color 0.12s, background 0.12s;
}
.meta-row button:hover { color: var(--text); background: var(--surface-2); }
.meta-row button .ic { transition: transform 0.15s; }
.meta-row button.open .ic { transform: rotate(180deg); }
.acts { display: flex; align-items: center; gap: 8px; }
.acts .grow { flex: 1; }
.logbox {
font-family: var(--mono);
font-size: 11px;
line-height: 1.7;
color: var(--dim);
background: #0d1013;
border: 1px solid var(--border);
border-radius: var(--r-md);
padding: 8px 11px;
max-height: 130px;
overflow-y: auto;
user-select: text;
}
.logbox .lt { color: var(--faint); margin-right: 8px; }
.logbox .l-warn { color: var(--amber); }
.logbox .l-error { color: var(--red); }
/* ---------- 主机列表 ---------- */
.host-list { display: flex; flex-direction: column; gap: 10px; max-width: 860px; }
.hcard {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--r-lg);
padding: 12px 16px;
display: flex;
align-items: center;
gap: 12px;
transition: border-color 0.15s;
}
.hcard:hover { border-color: var(--border-strong); }
.hcard .icon-box {
width: 34px; height: 34px;
border-radius: var(--r-md);
background: var(--surface-2);
border: 1px solid var(--border);
display: grid;
place-items: center;
color: var(--dim);
flex: none;
}
.hcard .info { flex: 1; min-width: 0; }
.hcard .hname { font-weight: 600; font-size: 13px; }
.hcard .haddr {
font-family: var(--mono);
font-size: 11.5px;
color: var(--dim);
margin-top: 2px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.hcard .tags { display: flex; gap: 6px; margin-top: 5px; }
.hcard .used-by { font-size: 11.5px; color: var(--faint); margin-top: 5px; }
.tag {
display: inline-flex;
align-items: center;
gap: 4px;
font-size: 10.5px;
padding: 1px 7px;
border-radius: 20px;
border: 1px solid var(--border-strong);
color: var(--dim);
background: var(--surface-2);
}
/* ---------- 日志视图 ---------- */
.log-feed {
background: #0d1013;
border: 1px solid var(--border);
border-radius: var(--r-lg);
padding: 12px 16px;
font-family: var(--mono);
font-size: 11.5px;
line-height: 1.85;
height: calc(100vh - 175px);
overflow-y: auto;
user-select: text;
}
.log-feed .row { display: flex; gap: 12px; }
.log-feed .t { color: var(--faint); flex: none; width: 62px; }
.log-feed .src { color: var(--dim); flex: none; width: 130px; overflow: hidden; text-overflow: ellipsis; }
.log-feed .m { color: var(--dim); word-break: break-all; }
.log-feed .l-info .m { color: var(--dim); }
.log-feed .l-success .m { color: var(--green); }
.log-feed .l-warn .m { color: var(--amber); }
.log-feed .l-error .m { color: var(--red); }
.log-feed .empty-feed { color: var(--faint); text-align: center; padding-top: 60px; }
/* ---------- 空状态 ---------- */
.empty {
border: 1px dashed var(--border-strong);
border-radius: var(--r-lg);
padding: 56px 20px;
text-align: center;
color: var(--faint);
}
.empty .glyph { color: var(--faint); opacity: 0.75; margin-bottom: 12px; }
.empty h2 { font-size: 13.5px; font-weight: 600; color: var(--dim); margin-bottom: 5px; }
.empty p { font-size: 12px; margin-bottom: 16px; }
/* ---------- 弹窗 ---------- */
.overlay {
position: fixed;
inset: 0;
background: rgba(5, 7, 9, 0.62);
display: grid;
place-items: center;
z-index: 50;
animation: fadein 0.14s ease;
}
@keyframes fadein { from { opacity: 0; } }
.modal {
width: 480px;
max-width: calc(100vw - 48px);
max-height: calc(100vh - 80px);
overflow-y: auto;
background: var(--surface);
border: 1px solid var(--border-strong);
border-radius: 12px;
box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
animation: rise 0.16s ease;
}
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
.modal .m-head {
display: flex;
align-items: center;
padding: 15px 18px 13px;
border-bottom: 1px solid var(--border);
}
.modal .m-head h2 { font-size: 14px; font-weight: 600; flex: 1; }
.modal .m-body { padding: 16px 18px 4px; }
.modal .m-foot {
display: flex;
align-items: center;
gap: 8px;
padding: 14px 18px 16px;
}
.modal .m-foot .grow { flex: 1; }
.probe-result {
display: flex;
gap: 7px;
align-items: flex-start;
font-size: 12px;
border-radius: var(--r-md);
padding: 8px 10px;
margin-bottom: 13px;
line-height: 1.5;
word-break: break-all;
}
.probe-result.ok { background: var(--green-dim); color: var(--green); }
.probe-result.bad { background: var(--red-dim); color: var(--red); }
.confirm-text { font-size: 13px; color: var(--dim); line-height: 1.6; padding-bottom: 10px; }
.confirm-text b { color: var(--text); }
/* ---------- Toast ---------- */
#toastRoot {
position: fixed;
right: 16px;
bottom: 16px;
display: flex;
flex-direction: column;
gap: 8px;
z-index: 100;
}
.toast {
display: flex;
align-items: flex-start;
gap: 8px;
min-width: 220px;
max-width: 380px;
background: var(--surface-2);
border: 1px solid var(--border-strong);
border-left: 3px solid var(--accent);
border-radius: var(--r-md);
padding: 10px 13px;
font-size: 12.5px;
box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35);
animation: rise 0.18s ease;
}
.toast.error { border-left-color: var(--red); }
.toast .t-msg { flex: 1; word-break: break-all; }
.toast .t-ic { margin-top: 1px; }
.toast.ok .t-ic { color: var(--accent); }
.toast.error .t-ic { color: var(--red); }
.toast.out { transition: opacity 0.25s, transform 0.25s; opacity: 0; transform: translateX(12px); }