Files
TaskPool/web/src/index.css
T
2026-07-26 20:14:42 +08:00

494 lines
10 KiB
CSS

@import "tailwindcss";
@theme {
--color-bg-primary: var(--bg-primary);
--color-bg-secondary: var(--bg-secondary);
--color-bg-tertiary: var(--bg-tertiary);
--color-bg-hover: var(--bg-hover);
--color-bg-selected: var(--bg-selected);
--color-bg-accent: var(--bg-accent);
--color-bg-accent-hover: var(--bg-accent-hover);
--color-text-primary: var(--text-primary);
--color-text-secondary: var(--text-secondary);
--color-text-muted: var(--text-muted);
--color-text-accent: var(--text-accent);
--color-border: var(--border);
--color-border-hover: var(--border-hover);
--radius-xs: 4px;
--radius-sm: 6px;
--radius-md: 8px;
--radius-lg: 12px;
--radius-xl: 16px;
--font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
--font-mono: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
}
/* MoonShadow Minimal — Dark */
:root,
[data-theme='dark'] {
color-scheme: dark;
--bg-primary: #0d0d0d;
--bg-secondary: #1a1a1a;
--bg-tertiary: #262626;
--bg-hover: #333333;
--bg-selected: #404040;
--bg-accent: #c0c0c0;
--bg-accent-hover: #d4d4d4;
--text-primary: #ffffff;
--text-secondary: #a3a3a3;
--text-muted: #737373;
--text-accent: #e5e5e5;
--text-on-accent: #0d0d0d;
--border: rgba(255, 255, 255, 0.08);
--border-hover: rgba(255, 255, 255, 0.15);
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
--shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
--shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
--focus-ring: rgba(192, 192, 192, 0.35);
--success: #34d399;
--warning: #fbbf24;
--danger: #f87171;
--info: #60a5fa;
}
/* MoonShadow Minimal — Light */
[data-theme='light'] {
color-scheme: light;
--bg-primary: #ffffff;
--bg-secondary: #f8f9fa;
--bg-tertiary: #e9ecef;
--bg-hover: #dee2e6;
--bg-selected: #ced4da;
--bg-accent: #212529;
--bg-accent-hover: #343a40;
--text-primary: #212529;
--text-secondary: #6c757d;
--text-muted: #adb5bd;
--text-accent: #212529;
--text-on-accent: #ffffff;
--border: rgba(0, 0, 0, 0.08);
--border-hover: rgba(0, 0, 0, 0.15);
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
--shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
--shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
--focus-ring: rgba(33, 37, 41, 0.2);
--success: #059669;
--warning: #d97706;
--danger: #dc2626;
--info: #2563eb;
}
/* ---- 尺寸系统:默认 md ---- */
:root {
--ui-height-sm: 1.75rem; /* 28px */
--ui-height-md: 2.25rem; /* 36px */
--ui-height-lg: 2.75rem; /* 44px */
--ui-font-sm: 12px;
--ui-font-md: 14px;
--ui-font-lg: 15px;
--ui-px-sm: 0.5rem;
--ui-px-md: 0.75rem;
--ui-px-lg: 1rem;
--ui-gap-sm: 0.25rem;
--ui-gap-md: 0.375rem;
--ui-gap-lg: 0.5rem;
--ui-table-py-sm: 0.375rem;
--ui-table-py-md: 0.625rem;
--ui-table-py-lg: 0.75rem;
}
/* 紧凑模式 */
[data-density='compact'] {
--ui-height-sm: 1.5rem; /* 24px */
--ui-height-md: 1.875rem; /* 30px */
--ui-height-lg: 2.25rem; /* 36px */
--ui-font-sm: 11px;
--ui-font-md: 13px;
--ui-font-lg: 14px;
--ui-px-sm: 0.375rem;
--ui-px-md: 0.5rem;
--ui-px-lg: 0.75rem;
--ui-gap-sm: 0.125rem;
--ui-gap-md: 0.25rem;
--ui-gap-lg: 0.375rem;
--ui-table-py-sm: 0.25rem;
--ui-table-py-md: 0.375rem;
--ui-table-py-lg: 0.5rem;
}
*,
*::before,
*::after {
box-sizing: border-box;
}
html,
body,
#root {
min-height: 100%;
}
body {
margin: 0;
font-family: var(--font-ui);
font-size: 14px;
line-height: 1.5;
background: var(--bg-primary);
color: var(--text-primary);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
overflow-x: hidden;
}
button,
input,
select,
textarea {
font: inherit;
color: inherit;
}
button {
cursor: pointer;
}
a {
color: inherit;
text-decoration: none;
}
code,
pre,
.font-mono {
font-family: var(--font-mono);
}
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
background: var(--border);
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: var(--text-muted);
}
/* 选中态使用 accent 对比色,避免 logo/按钮上的 on-accent 白字被改成主文字色后“消失” */
::selection {
background: color-mix(in srgb, var(--bg-accent) 55%, transparent);
color: var(--text-on-accent);
}
/* 已是 on-accent 表面时,选中保持原文字色并提高背景对比 */
.ms-on-accent::selection,
.ms-on-accent *::selection {
background: color-mix(in srgb, var(--text-on-accent) 28%, transparent);
color: var(--text-on-accent);
}
/* subtle page enter */
@keyframes ms-fade-in {
from {
opacity: 0;
transform: translateY(6px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.ms-page {
animation: ms-fade-in 0.28s ease both;
}
/* progress bar */
.ms-progress {
height: 4px;
border-radius: 999px;
background: var(--bg-tertiary);
overflow: hidden;
}
.ms-progress > span {
display: block;
height: 100%;
border-radius: inherit;
transition: width 0.35s ease;
}
/* Form controls — reliable focus ring (avoid broken arbitrary Tailwind shadow) */
.ui-control {
width: 100%;
border-radius: var(--radius-md);
border: 1px solid var(--border);
background: var(--bg-secondary);
color: var(--text-primary);
font-size: 14px;
line-height: 1.4;
outline: none;
transition:
background-color 0.15s ease,
border-color 0.15s ease,
box-shadow 0.15s ease;
}
.ui-control::placeholder {
color: var(--text-muted);
}
.ui-control:hover:not(:disabled):not(:focus) {
background: var(--bg-tertiary);
border-color: var(--border-hover);
}
.ui-control:focus,
.ui-control:focus-visible {
background: var(--bg-tertiary);
border-color: var(--bg-accent);
box-shadow: 0 0 0 3px var(--focus-ring);
}
.ui-control:disabled {
opacity: 0.55;
cursor: not-allowed;
}
.ui-control-open {
border-color: var(--bg-accent) !important;
background: var(--bg-tertiary);
}
/* Primary button — solid accent, always readable */
.ui-btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: var(--ui-gap-md);
border: 1px solid transparent;
border-radius: var(--radius-md);
font-size: var(--ui-font-md);
font-weight: 500;
line-height: 1.2;
transition:
background-color 0.15s ease,
border-color 0.15s ease,
color 0.15s ease,
opacity 0.15s ease,
transform 0.1s ease;
}
.ui-btn:active:not(:disabled) {
transform: scale(0.98);
}
.ui-btn:disabled {
opacity: 0.55;
cursor: not-allowed;
}
.ui-btn-default {
background: var(--bg-accent);
color: var(--text-on-accent);
}
.ui-btn-default:hover:not(:disabled) {
background: var(--bg-accent-hover);
}
.ui-btn-secondary {
border-color: var(--border);
background: var(--bg-secondary);
color: var(--text-secondary);
}
.ui-btn-secondary:hover:not(:disabled) {
border-color: var(--border-hover);
background: var(--bg-tertiary);
color: var(--text-primary);
}
.ui-btn-outline {
border-color: var(--border);
background: transparent;
color: var(--text-secondary);
}
.ui-btn-outline:hover:not(:disabled) {
border-color: var(--border-hover);
background: var(--bg-tertiary);
color: var(--text-primary);
}
.ui-btn-ghost {
background: transparent;
color: var(--text-secondary);
}
.ui-btn-ghost:hover:not(:disabled) {
background: var(--bg-tertiary);
color: var(--text-primary);
}
.ui-btn-danger {
background: color-mix(in srgb, var(--danger) 14%, transparent);
color: var(--danger);
}
.ui-btn-danger:hover:not(:disabled) {
background: color-mix(in srgb, var(--danger) 22%, transparent);
}
.ui-btn-sm {
height: var(--ui-height-sm);
padding: 0 var(--ui-px-sm);
font-size: var(--ui-font-sm);
}
.ui-btn-md {
height: var(--ui-height-md);
padding: 0 var(--ui-px-md);
font-size: var(--ui-font-md);
}
.ui-btn-lg {
height: var(--ui-height-lg);
padding: 0 var(--ui-px-lg);
font-size: var(--ui-font-lg);
}
.ui-btn-icon {
height: var(--ui-height-md);
width: var(--ui-height-md);
padding: 0;
}
.ui-btn-icon-sm {
height: var(--ui-height-sm);
width: var(--ui-height-sm);
padding: 0;
}
.ui-btn-icon-lg {
height: var(--ui-height-lg);
width: var(--ui-height-lg);
padding: 0;
}
/* Custom select menu */
.ui-select-trigger {
display: inline-flex;
align-items: center;
gap: 0.5rem;
cursor: pointer;
}
.ui-select-menu {
display: flex;
flex-direction: column;
gap: 6px;
max-height: 280px;
overflow: auto;
border-radius: var(--radius-md);
border: 1px solid var(--border);
background: var(--bg-secondary);
box-shadow: var(--shadow-md);
padding: 8px;
}
.ui-select-item {
display: flex;
width: 100%;
align-items: center;
gap: 0.5rem;
border: 0;
border-radius: calc(var(--radius-md) - 2px);
background: transparent;
color: var(--text-primary);
cursor: pointer;
font-size: var(--ui-font-sm);
line-height: 1.35;
min-height: var(--ui-height-sm);
padding: 0.5rem 0.75rem;
text-align: left;
}
.ui-select-item + .ui-select-item {
margin-top: 0;
}
.ui-select-item:hover:not(:disabled) {
background: var(--bg-tertiary);
}
.ui-select-item.is-active {
background: var(--bg-selected);
color: var(--text-primary);
}
.ui-select-item:disabled {
color: var(--text-muted);
cursor: not-allowed;
opacity: 0.65;
}
/* xterm 终端:跟随主题,暗色保证高对比 */
.terminal-host {
background: var(--bg-secondary);
color: var(--text-primary);
}
[data-theme='dark'] .terminal-host,
:root .terminal-host {
/* 兜底:即使 xterm 单元格未着色,也用浅色字 */
color: #f0f0f0;
-webkit-font-smoothing: antialiased;
text-rendering: geometricPrecision;
}
[data-theme='light'] .terminal-host {
color: #212529;
}
.terminal-host .xterm {
height: 100%;
width: 100%;
padding: 0;
box-sizing: border-box;
}
.terminal-host .xterm-viewport {
overflow-y: auto !important;
background-color: transparent !important;
}
.terminal-host .xterm-screen {
background-color: transparent !important;
}
/* 不要强制 color:inherit,避免覆盖 xterm 单元格前景色 */
.terminal-host .xterm-helper-textarea {
opacity: 0;
}
/* 避免全局 selection 样式污染终端选区 */
.terminal-host ::selection,
.terminal-host .xterm ::selection {
background: color-mix(in srgb, var(--bg-accent) 40%, transparent);
color: #ffffff;
}
[data-theme='light'] .terminal-host ::selection,
[data-theme='light'] .terminal-host .xterm ::selection {
background: color-mix(in srgb, var(--bg-accent) 22%, transparent);
color: #212529;
}