Files
sproutclaw-cron/webui/frontend/styles.css
shumengya c10cacd5c6 feat: 多语言任务、WebUI 增强与 Agent MCP 集成
重构 lib 为扁平模块并支持 Windows schtasks;新增 JS/Bash/PowerShell 模板、WebUI 调度编辑,以及 Cursor Skill 与 MCP 工具供 Agent 管理定时任务。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-24 21:45:25 +08:00

995 lines
20 KiB
CSS

/* SproutClaw Cron · 管理面板 */
:root {
--paper: #f4f6f5;
--paper-raised: #ffffff;
--ink: #1a1f1c;
--ink-soft: #5c6560;
--ink-faint: #8a938d;
--rule: #e4e8e6;
--rule-strong: #d0d6d2;
--accent: #2d6a4f;
--accent-hover: #245a42;
--accent-soft: #e8f3ed;
--accent-line: #40916c;
--status-on: #1b6b4a;
--status-on-bg: #e8f3ed;
--status-off: #6b7280;
--status-off-bg: #f1f3f2;
--status-run: #b45309;
--status-run-bg: #fef3e2;
--danger: #b42318;
--danger-bg: #fef3f2;
--danger-line: #fecdca;
--shadow-sm: 0 1px 2px rgba(26, 31, 28, 0.05);
--shadow-md: 0 4px 16px rgba(26, 31, 28, 0.07);
--radius: 10px;
--radius-sm: 6px;
--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
--font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html, body {
margin: 0;
padding: 0;
min-height: 100%;
font-family: var(--font-sans);
font-size: 14px;
color: var(--ink);
background: var(--paper);
-webkit-font-smoothing: antialiased;
}
body { overflow-x: hidden; }
button, input, select, textarea, dialog {
font: inherit;
color: inherit;
}
button { cursor: pointer; }
table, caption, th, td { font: inherit; }
code, pre, kbd, samp { font-family: var(--font-mono); }
.layout::before {
content: "";
position: fixed;
top: 0; left: 0; right: 0;
height: 3px;
background: linear-gradient(90deg, var(--accent), var(--accent-line));
z-index: 40;
}
.layout { min-height: 100vh; padding-top: 3px; }
/* ===== 主区 ===== */
.main { min-width: 0; display: flex; flex-direction: column; min-height: calc(100vh - 3px); }
.topbar {
display: flex;
align-items: center;
gap: 1rem;
padding: 1.125rem 1.75rem;
background: var(--paper-raised);
border-bottom: 1px solid var(--rule);
box-shadow: var(--shadow-sm);
}
.masthead { flex: 1; min-width: 0; }
.brand-kicker {
margin: 0 0 0.125rem;
font-size: 0.6875rem;
font-weight: 600;
letter-spacing: 0.1em;
text-transform: uppercase;
color: var(--accent);
}
.masthead h1 {
margin: 0;
font-size: 1.375rem;
font-weight: 700;
line-height: 1.25;
letter-spacing: -0.02em;
}
.masthead-meta {
margin: 0.25rem 0 0;
font-size: 0.8125rem;
color: var(--ink-soft);
}
.kicker {
display: block;
font-size: 0.6875rem;
letter-spacing: 0.12em;
text-transform: uppercase;
color: var(--accent);
font-weight: 600;
margin-bottom: 0.25rem;
}
/* ===== 内容区 ===== */
.document {
flex: 1;
padding: 1.5rem 1.75rem 2.5rem;
}
/* 本机运行时 */
.runtime-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 0.875rem;
margin-bottom: 1rem;
}
.runtime-card {
background: var(--paper-raised);
border: 1px solid var(--rule);
border-radius: var(--radius);
padding: 0.75rem 1rem;
box-shadow: var(--shadow-sm);
display: flex;
flex-direction: column;
gap: 0.25rem;
min-width: 0;
}
.runtime-card.is-ok { border-color: #c5dfd0; }
.runtime-card.is-missing { border-color: #e8dcd8; background: #fdfbfb; }
.runtime-name {
font-size: 0.8125rem;
font-weight: 600;
color: var(--ink-soft);
}
.runtime-version {
font-size: 0.9375rem;
font-weight: 600;
color: var(--ink);
word-break: break-all;
line-height: 1.35;
}
.runtime-card.is-ok .runtime-version { color: var(--accent); }
.runtime-missing {
color: var(--ink-faint);
font-weight: 500;
}
/* 统计卡片 */
.stats-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 0.875rem;
margin-bottom: 1.25rem;
}
.stat-card {
background: var(--paper-raised);
border: 1px solid var(--rule);
border-radius: var(--radius);
padding: 0.875rem 1rem;
box-shadow: var(--shadow-sm);
}
.stat-label {
display: block;
font-size: 0.6875rem;
font-weight: 600;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--ink-faint);
margin-bottom: 0.375rem;
}
.stat-value {
display: block;
font-size: 1.625rem;
font-weight: 700;
line-height: 1;
letter-spacing: -0.03em;
color: var(--ink);
}
.stat-card.stat-accent .stat-value { color: var(--accent); }
.stat-card.stat-run .stat-value { color: var(--status-run); }
/* 工具栏 */
.toolbar {
display: flex;
align-items: center;
gap: 1rem;
margin-bottom: 1rem;
}
.search {
flex: 1;
max-width: 420px;
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 0.75rem;
background: var(--paper-raised);
border: 1px solid var(--rule);
border-radius: var(--radius-sm);
transition: border-color 0.15s, box-shadow 0.15s;
}
.search:focus-within {
border-color: var(--accent-line);
box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-icon { color: var(--ink-faint); flex-shrink: 0; }
.search input {
flex: 1;
border: none;
outline: none;
background: transparent;
font: inherit;
font-size: 0.875rem;
min-width: 0;
}
.search input::placeholder { color: var(--ink-faint); }
.last-refresh {
margin-left: auto;
font-size: 0.75rem;
color: var(--ink-faint);
white-space: nowrap;
}
/* ===== 表格卡片 ===== */
.doc-section { margin-top: 0; }
.table-card {
background: var(--paper-raised);
border: 1px solid var(--rule);
border-radius: var(--radius);
box-shadow: var(--shadow-sm);
overflow: hidden;
}
.task-table {
width: 100%;
border-collapse: collapse;
table-layout: fixed;
font-size: 0.875rem;
}
.task-table th {
padding: 0.625rem 1rem;
text-align: left;
font-size: 0.6875rem;
font-weight: 600;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--ink-faint);
background: #fafbfa;
border-bottom: 1px solid var(--rule);
white-space: nowrap;
}
.task-table td {
padding: 0.875rem 1rem;
border-bottom: 1px solid var(--rule);
vertical-align: middle;
}
.task-table tbody tr:last-child td { border-bottom: none; }
.task-table tbody tr { transition: background 0.12s; }
.task-table tbody tr:hover { background: #fafcfb; }
.col-status { width: 96px; }
.col-name { width: auto; }
.col-schedule { width: 148px; }
.col-log { width: 140px; }
.col-actions { width: 340px; }
.task-name {
font-weight: 600;
font-size: 0.9375rem;
word-break: break-word;
line-height: 1.35;
}
.task-name-row {
display: flex;
align-items: center;
gap: 0.5rem;
flex-wrap: wrap;
}
.runtime-badge {
display: inline-flex;
align-items: center;
padding: 0.15rem 0.45rem;
border-radius: 4px;
font-size: 0.75rem;
font-weight: 600;
color: var(--accent);
background: var(--accent-soft);
border: 1px solid #c5dfd0;
flex-shrink: 0;
white-space: nowrap;
}
.task-tag {
display: inline-flex;
align-items: center;
gap: 0.25rem;
padding: 0.15rem 0.45rem;
border-radius: 4px;
font-size: 0.75rem;
font-weight: 600;
color: var(--accent);
background: var(--accent-soft);
border: 1px solid #c5dfd0;
flex-shrink: 0;
white-space: nowrap;
}
.task-tag.is-editable {
padding-right: 0.25rem;
}
.tag-remove {
display: inline-flex;
align-items: center;
justify-content: center;
width: 1.125rem;
height: 1.125rem;
padding: 0;
border: none;
border-radius: 999px;
background: transparent;
color: #64748b;
font-size: 0.875rem;
line-height: 1;
cursor: pointer;
}
.tag-remove:hover {
background: #e2e8f0;
color: #334155;
}
.tag-editor {
border: none;
padding: 0;
margin: 0 0 1rem;
}
.tag-list {
display: flex;
flex-wrap: wrap;
gap: 0.375rem;
min-height: 1.75rem;
margin-bottom: 0.5rem;
}
.tag-add-row {
display: flex;
gap: 0.5rem;
align-items: center;
}
.tag-add-row input {
flex: 1;
min-width: 0;
}
.task-desc {
margin-top: 0.2rem;
font-size: 0.8125rem;
color: var(--ink-soft);
line-height: 1.4;
word-break: break-word;
}
/* 状态徽章 */
.badge {
display: inline-flex;
align-items: center;
gap: 0.375rem;
padding: 0.25rem 0.625rem;
border-radius: 999px;
font-size: 0.75rem;
font-weight: 600;
white-space: nowrap;
}
.badge .dot {
width: 6px; height: 6px;
border-radius: 50%;
flex-shrink: 0;
}
.badge-on {
color: var(--status-on);
background: var(--status-on-bg);
}
.badge-on .dot { background: var(--status-on); }
.badge-off {
color: var(--status-off);
background: var(--status-off-bg);
}
.badge-off .dot { background: var(--status-off); }
.badge-run {
color: var(--status-run);
background: var(--status-run-bg);
}
.badge-run .dot {
background: var(--status-run);
animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.4; }
}
.mono { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--ink-soft); }
.schedule-code {
display: inline-block;
font-family: var(--font-mono);
font-size: 0.75rem;
color: var(--ink);
background: var(--paper);
border: 1px solid var(--rule);
border-radius: 4px;
padding: 0.2rem 0.45rem;
white-space: nowrap;
}
.log-meta { font-size: 0.8125rem; color: var(--ink-soft); line-height: 1.45; }
.log-meta .muted { display: block; font-size: 0.75rem; color: var(--ink-faint); margin-top: 0.125rem; }
/* 操作按钮组 — 横向排列 */
.actions {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.375rem;
}
.actions .btn {
padding: 0.35rem 0.625rem;
font-size: 0.75rem;
white-space: nowrap;
}
/* ===== 按钮 ===== */
.btn {
border: 1px solid var(--rule);
background: var(--paper-raised);
color: var(--ink);
border-radius: var(--radius-sm);
padding: 0.4375rem 0.875rem;
font-size: 0.8125rem;
font-weight: 500;
line-height: 1.2;
transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
}
.btn:hover { background: var(--paper); border-color: var(--rule-strong); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 1px; }
.btn-primary {
background: var(--accent);
border-color: var(--accent);
color: #fff;
}
.btn-primary:hover {
background: var(--accent-hover);
border-color: var(--accent-hover);
}
.btn-success {
color: var(--accent);
border-color: #b7d4c4;
background: var(--accent-soft);
}
.btn-success:hover { background: #dceee4; }
.btn-danger {
color: var(--danger);
border-color: var(--danger-line);
background: var(--danger-bg);
}
.btn-danger:hover { background: #fde8e6; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--paper); border-color: var(--rule); }
.empty {
text-align: center;
color: var(--ink-faint);
padding: 2.5rem 1rem !important;
font-size: 0.875rem;
}
/* ===== 移动端卡片 ===== */
.task-cards {
display: none;
flex-direction: column;
gap: 0.75rem;
}
.task-card {
background: var(--paper-raised);
border: 1px solid var(--rule);
border-radius: var(--radius);
padding: 1rem;
box-shadow: var(--shadow-sm);
}
.task-card-head {
display: flex;
justify-content: space-between;
gap: 0.625rem;
align-items: flex-start;
}
.task-card-head > .name { min-width: 0; flex: 1; }
.task-card-head .badge { flex-shrink: 0; }
.task-card-meta {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 0.625rem;
margin-top: 0.875rem;
padding-top: 0.875rem;
border-top: 1px solid var(--rule);
}
.meta-block {
flex: 1 1 calc(50% - 0.375rem);
min-width: 0;
font-size: 0.8125rem;
}
.field-label {
display: block;
font-size: 0.6875rem;
font-weight: 600;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--ink-faint);
margin-bottom: 0.25rem;
}
.task-card-actions {
margin-top: 0.625rem;
padding-top: 0.625rem;
border-top: 1px solid var(--rule);
}
.task-card-actions .actions {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 0.375rem;
}
.task-card-actions .btn {
min-height: 34px;
padding: 0.3rem 0.25rem;
font-size: 0.75rem;
font-weight: 500;
text-align: center;
border-radius: 6px;
}
/* ===== 弹层 / 表单 ===== */
.panel-dialog,
.log-dialog {
border: 1px solid var(--rule-strong);
border-radius: var(--radius);
padding: 0;
background: var(--paper-raised);
box-shadow: var(--shadow-md);
color: var(--ink);
}
.panel-dialog::backdrop,
.log-dialog::backdrop { background: rgba(26, 31, 28, 0.45); }
.panel-dialog {
width: min(600px, calc(100vw - 2rem));
max-height: calc(100vh - 2rem);
}
.panel-dialog-head,
.log-dialog-head {
display: flex;
justify-content: space-between;
gap: 1rem;
align-items: flex-start;
padding: 1rem 1.25rem;
border-bottom: 1px solid var(--rule);
}
.panel-dialog-title .kicker,
.log-dialog-title .kicker { margin-bottom: 0.2rem; }
.panel-dialog-title h3 {
margin: 0;
font-size: 1rem;
font-weight: 700;
word-break: break-all;
}
.panel-dialog-body {
padding: 1rem 1.25rem 0.25rem;
display: flex;
flex-direction: column;
gap: 1rem;
}
.panel-dialog-foot {
display: flex;
justify-content: flex-end;
gap: 0.5rem;
padding: 1rem 1.25rem 1.25rem;
}
.edit-form { margin: 0; }
.form-field {
display: flex;
flex-direction: column;
gap: 0.375rem;
}
.form-label {
font-size: 0.8125rem;
font-weight: 600;
}
.form-field input[type="text"],
.form-field input[type="time"],
.form-field textarea {
width: 100%;
border: 1px solid var(--rule);
border-radius: var(--radius-sm);
padding: 0.5625rem 0.75rem;
font: inherit;
font-size: 0.875rem;
background: var(--paper-raised);
}
.form-field textarea {
resize: vertical;
min-height: 72px;
line-height: 1.45;
}
.form-field input:focus,
.form-field textarea:focus {
outline: none;
border-color: var(--accent-line);
box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-hint {
font-size: 0.75rem;
color: var(--ink-faint);
}
.form-preview {
margin: 0;
font-size: 0.8125rem;
color: var(--ink-soft);
}
.form-preview code {
font-family: var(--font-mono);
background: var(--paper);
border: 1px solid var(--rule);
border-radius: 4px;
padding: 0.1rem 0.35rem;
}
.cron-editor {
margin: 0;
padding: 0;
border: none;
min-width: 0;
}
.cron-editor .form-label {
padding: 0;
margin-bottom: 0.5rem;
}
.cron-grid {
display: grid;
grid-template-columns: repeat(5, minmax(0, 1fr));
gap: 0.5rem;
}
.cron-field {
display: flex;
flex-direction: column;
gap: 0.25rem;
min-width: 0;
}
.cron-field-label {
font-size: 0.75rem;
font-weight: 600;
color: var(--ink-faint);
text-align: center;
}
.cron-field input,
.cron-field select {
width: 100%;
border: 1px solid var(--rule);
border-radius: var(--radius-sm);
padding: 0.5rem 0.375rem;
font: inherit;
font-size: 0.875rem;
text-align: center;
background: var(--paper-raised);
}
.cron-field select { text-align-last: center; cursor: pointer; }
.cron-field input:focus,
.cron-field select:focus {
outline: none;
border-color: var(--accent-line);
box-shadow: 0 0 0 3px var(--accent-soft);
}
.cron-presets {
display: flex;
flex-wrap: wrap;
gap: 0.375rem;
margin-top: 0.75rem;
}
.btn-preset {
padding: 0.3rem 0.55rem !important;
font-size: 0.75rem !important;
}
.cron-examples {
margin: 0.625rem 0 0;
padding: 0.625rem 0.75rem;
list-style: none;
background: var(--paper);
border: 1px solid var(--rule);
border-radius: var(--radius-sm);
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 0.35rem 0.75rem;
font-size: 0.75rem;
color: var(--ink-soft);
}
.cron-examples li {
margin: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.cron-examples code {
font-family: var(--font-mono);
font-size: 0.75rem;
color: var(--ink);
margin-right: 0.25rem;
}
.form-hint code {
font-family: var(--font-mono);
font-size: 0.75rem;
background: var(--paper);
border: 1px solid var(--rule);
border-radius: 3px;
padding: 0 0.2rem;
}
.log-dialog {
width: min(960px, calc(100vw - 2rem));
max-height: calc(100vh - 2rem);
}
.log-dialog-title h3 {
margin: 0;
font-family: var(--font-mono);
font-size: 0.9375rem;
font-weight: 600;
}
.log-dialog-title p { margin: 0.25rem 0 0; font-size: 0.8125rem; color: var(--ink-soft); }
.log-dialog-actions { display: flex; gap: 0.375rem; flex-shrink: 0; }
.log-content {
margin: 0;
padding: 1rem 1.25rem;
max-height: 62vh;
overflow: auto;
font-family: var(--font-mono);
font-size: 0.8125rem;
line-height: 1.6;
white-space: pre-wrap;
word-break: break-word;
background: #141816;
color: #e2e8e4;
border-radius: 0 0 var(--radius) var(--radius);
}
.log-content:empty::before { content: "(暂无日志)"; color: #6b7280; }
/* ===== Toast ===== */
.toast {
position: fixed;
left: 50%;
bottom: 1.5rem;
transform: translateX(-50%);
background: var(--ink);
color: #fff;
padding: 0.625rem 1.125rem;
border-radius: 999px;
font-size: 0.8125rem;
z-index: 60;
box-shadow: var(--shadow-md);
}
.toast.is-error { background: var(--danger); }
/* ===== 响应式 ===== */
@media (max-width: 960px) {
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.col-actions { width: 240px; }
}
@media (max-width: 820px) {
.topbar { padding: 1rem 1.25rem; }
.document { padding: 1.25rem 1.25rem 2rem; }
.table-card { display: none; }
.task-cards { display: flex; }
.search { max-width: none; }
}
@media (max-width: 720px) {
.topbar {
padding: 0.875rem 1rem;
gap: 0.75rem;
align-items: flex-start;
}
.masthead h1 {
font-size: 1.125rem;
}
.masthead-meta {
font-size: 0.75rem;
}
#btn-refresh-top {
flex-shrink: 0;
min-height: 40px;
padding-inline: 0.875rem;
}
.document {
padding: 0.875rem 1rem 1.5rem;
}
/* 统计:单行四列紧凑 */
.stats-grid {
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 0.5rem;
margin-bottom: 1rem;
}
.runtime-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 0.5rem;
margin-bottom: 0.875rem;
}
.runtime-version { font-size: 0.8125rem; }
.stat-card {
padding: 0.625rem 0.5rem;
text-align: center;
border-radius: var(--radius-sm);
}
.stat-label {
font-size: 0.625rem;
margin-bottom: 0.25rem;
letter-spacing: 0.04em;
}
.stat-value {
font-size: 1.25rem;
}
.toolbar {
flex-direction: column;
align-items: stretch;
gap: 0.5rem;
margin-bottom: 0.875rem;
}
.search {
padding: 0.625rem 0.75rem;
}
.search input { font-size: 16px; /* 防止 iOS 缩放 */ }
.last-refresh {
margin-left: 0;
text-align: right;
font-size: 0.6875rem;
}
.task-card {
padding: 0.875rem;
border-radius: var(--radius-sm);
}
.task-card .task-name { font-size: 0.9375rem; }
.task-card .task-desc {
font-size: 0.8125rem;
margin-top: 0.25rem;
line-height: 1.45;
}
.task-card-meta {
grid-template-columns: 1fr 1fr;
gap: 0.625rem;
}
.task-card-actions .actions {
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 0.375rem;
}
.task-card-actions .btn {
min-height: 32px;
padding: 0.25rem 0.2rem;
font-size: 0.6875rem;
}
.cron-grid {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.cron-examples {
grid-template-columns: 1fr;
}
.panel-dialog,
.log-dialog {
width: 100vw;
max-width: 100vw;
height: 100dvh;
max-height: 100dvh;
margin: 0;
border: none;
border-radius: 0;
display: flex;
flex-direction: column;
}
.log-dialog-head {
flex-direction: row;
align-items: center;
padding: 0.875rem 1rem;
position: sticky;
top: 0;
background: var(--paper-raised);
z-index: 1;
}
.log-dialog-title h3 {
font-size: 0.875rem;
word-break: break-all;
}
.log-dialog-title p { font-size: 0.75rem; }
.log-dialog-actions { width: auto; }
.log-dialog-actions .btn {
flex: none;
min-height: 36px;
padding-inline: 0.75rem;
}
.log-content {
max-height: none;
flex: 1;
border-radius: 0;
font-size: 0.75rem;
}
.toast {
left: 1rem;
right: 1rem;
bottom: 1rem;
transform: none;
text-align: center;
border-radius: var(--radius-sm);
}
}
@media (max-width: 400px) {
.stats-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.stat-card { padding: 0.75rem; text-align: left; }
.stat-value { font-size: 1.375rem; }
.cron-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.task-card-meta {
grid-template-columns: 1fr;
}
}
@media (min-width: 821px) {
.task-cards { display: none; }
}
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after { transition: none !important; animation: none !important; }
}