/** * shared/styles/components-ds.css * 设计系统组件样式(按钮、表格、表单等)。 */ /** * L2 Design System components — token-driven, no dark: color pairs. */ @layer components { .page-shell { min-height: 100vh; background-color: var(--bg-page); color: var(--text-secondary); } .page-title { font-size: 1.5rem; line-height: 2rem; font-weight: 700; color: var(--text-primary); } .section-title { font-size: 1.125rem; line-height: 1.75rem; font-weight: 600; color: var(--text-primary); } .section-desc { font-size: 0.875rem; line-height: 1.25rem; color: var(--text-muted); } .input-field-ds { @apply input-field; } .select-field-ds { @apply select-field; } /* 顶栏语言图标 — 无圆圈,与 theme-toggle-btn--inline 同占位对齐 */ .header-locale-btn { @apply flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border-0 bg-transparent p-0 text-muted shadow-none transition-colors hover:text-primary; } .header-locale-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--focus-ring); border-radius: 0.5rem; } @media (min-width: 768px) { .header-locale-btn { @apply h-9 w-9; } } .header-locale-btn--floating { @apply fixed bottom-5 right-5 z-[70] h-11 w-11 rounded-full; } /* 顶栏语言图标 — 下拉菜单 */ .header-locale-menu { @apply absolute right-0 top-full z-[60] mt-1.5 min-w-[9.5rem] overflow-hidden rounded-xl border border-default py-1 shadow-elevated; background-color: var(--bg-surface); } .header-locale-menu--sidebar { @apply bottom-full top-auto right-0 left-auto mb-1.5 mt-0; } .header-locale-menu__item { @apply flex w-full items-center justify-between gap-2 px-3 py-2 text-left text-sm font-medium text-secondary transition-colors; } .header-locale-menu__item:hover { @apply bg-surface-soft text-primary; } .header-locale-menu__item--active { @apply bg-brand-50 text-brand-700; } html.dark .header-locale-menu__item--active { @apply bg-brand-950/40 text-brand-300; } .card-ds { @apply card; } .card-ds-interactive { @apply card; } .card-ds-interactive:hover { box-shadow: var(--shadow-elevated); border-color: rgba(14, 165, 233, 0.35); } .card-padding { padding: 1rem; } @media (min-width: 640px) { .card-padding { padding: 1.5rem; } } .surface-panel { background-color: var(--bg-surface); border: 1px solid var(--border-default); border-radius: 1rem; } /* Aliases — prefer .btn-secondary / .btn-ghost in style.css */ .btn-secondary-ds { @apply btn-secondary; } .btn-ghost-ds { @apply btn-ghost; } .btn-icon-ds { display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; border-radius: 0.75rem; color: var(--text-muted); transition: background-color 0.2s, color 0.2s; } .btn-icon-ds:hover { background-color: var(--bg-surface-strong); color: var(--text-primary); } .alert-ds { display: flex; gap: 0.75rem; padding: 1rem 1.25rem; border-radius: 0.75rem; border: 1px solid; font-size: 0.875rem; } .alert-success { background-color: var(--status-success-bg); border-color: var(--status-success-border); color: var(--status-success-fg); } .alert-info { background-color: var(--status-info-bg); border-color: var(--status-info-border); color: var(--status-info-fg); } .alert-warning { background-color: var(--status-warning-bg); border-color: var(--status-warning-border); color: var(--status-warning-fg); } .alert-error { background-color: var(--status-error-bg); border-color: var(--status-error-border); color: var(--status-error-fg); } .app-header { display: flex; align-items: center; justify-content: space-between; height: var(--header-height); padding-left: 1rem; padding-right: 1rem; border-bottom: 1px solid var(--border-default); background-color: color-mix(in srgb, var(--bg-surface) 88%, transparent); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 30; } .app-sidebar { width: var(--sidebar-width); flex-shrink: 0; border-right: 1px solid var(--border-default); background-color: var(--bg-surface); overflow-y: auto; } .app-sidebar--collapsed { width: var(--sidebar-collapsed-width); } .sidebar-nav-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 1rem; margin: 0 0.5rem; border-radius: 0.75rem; font-size: 0.875rem; font-weight: 500; color: var(--text-muted); transition: background-color 0.15s, color 0.15s; } .sidebar-nav-item:hover { background-color: var(--bg-surface-soft); color: var(--text-secondary); } .sidebar-nav-item--active { background-color: color-mix(in srgb, #0ea5e9 12%, var(--bg-surface-soft)); color: #0284c7; } html.dark .sidebar-nav-item--active { color: #7dd3fc; } .token-swatch { border-radius: 0.75rem; border: 1px solid var(--border-default); overflow: hidden; } .token-swatch__color { height: 3.5rem; } .token-swatch__meta { padding: 0.5rem 0.75rem; background-color: var(--bg-surface); border-top: 1px solid var(--border-subtle); } .shell-preview { border: 1px dashed var(--border-default); border-radius: 1rem; overflow: hidden; background-color: var(--bg-page); } .shell-preview__chrome { height: 2rem; background-color: var(--bg-surface-strong); border-bottom: 1px solid var(--border-default); display: flex; align-items: center; padding: 0 0.5rem; gap: 0.25rem; } .shell-preview__dot { width: 0.5rem; height: 0.5rem; border-radius: 9999px; background-color: var(--border-default); } /* Admin — data tables (token-driven, no dark: pairs) */ .admin-table-section { background-color: var(--bg-surface); border: 1px solid var(--border-default); @apply rounded-2xl shadow-sm overflow-hidden animate-fade-in; } .admin-table-wrap { @apply overflow-x-auto; } .admin-table-header { @apply px-8 py-6 border-b border-default flex justify-between items-center; background-color: var(--bg-surface); } .admin-table-header--stacked { @apply flex-col md:flex-row items-start md:items-center gap-4; } .admin-table-filters { @apply px-8 py-4 border-b border-subtle gap-4; background-color: var(--bg-surface-soft); } .admin-table-filters--inline { @apply flex flex-wrap p-4 rounded-xl border border-default shadow-sm; background-color: var(--bg-surface); } .admin-table { @apply w-full text-left; } .admin-table thead { background-color: var(--bg-surface-soft); border-bottom: 1px solid var(--border-subtle); } .admin-table thead th { @apply font-semibold text-muted uppercase tracking-wider; } .admin-table tbody tr { border-top: 1px solid var(--border-subtle); transition: background-color 0.15s ease; } .admin-table tbody tr:hover { background-color: var(--bg-surface-soft); } .admin-table-empty { @apply py-12 text-center text-sm text-muted; } .admin-table-filter-input { @apply px-3 py-2 rounded-lg border text-sm outline-none transition; border-color: var(--border-default); background-color: var(--bg-surface); color: var(--text-primary); } .admin-table-filter-input:focus { border-color: #0ea5e9; box-shadow: 0 0 0 2px var(--focus-ring); } .admin-table-sticky-head { background-color: var(--bg-surface-soft); } .admin-table-sticky-cell { background-color: var(--bg-surface); } .admin-report-table-wrap { @apply overflow-x-auto rounded-2xl border border-default shadow-elevated; background-color: var(--bg-surface); } .admin-report-table thead { @apply sticky top-0 text-xs uppercase tracking-wider; background: linear-gradient( to right, var(--bg-surface-strong), color-mix(in srgb, var(--bg-surface-soft) 75%, #0ea5e9 25%) ); color: var(--text-secondary); } .admin-report-table thead th { @apply font-semibold border-b border-default align-top; } .admin-report-table tbody tr { border-top: 1px solid var(--border-subtle); transition: background-color 0.15s ease; } .admin-report-table tbody tr:nth-child(odd) { background-color: var(--bg-surface); } .admin-report-table tbody tr:nth-child(even) { background-color: color-mix(in srgb, var(--bg-surface-soft) 65%, transparent); } .admin-report-table tbody tr:hover { background-color: color-mix(in srgb, #0ea5e9 8%, var(--bg-surface-soft)); } .admin-report-table tbody td { @apply text-sm border-b border-subtle align-top; color: var(--text-secondary); } .admin-report-filter-input { @apply w-full px-2 py-1 text-xs border rounded outline-none font-normal normal-case; border-color: var(--border-default); background-color: var(--bg-surface); color: var(--text-primary); } .admin-report-filter-input:focus { border-color: #0ea5e9; box-shadow: 0 0 0 1px var(--focus-ring); } /* Admin — reports module shell */ .admin-report-section { @apply relative rounded-3xl border border-default shadow-elevated overflow-hidden animate-fade-in; background-color: var(--bg-surface); background-image: linear-gradient( 145deg, var(--bg-surface) 0%, var(--bg-surface-soft) 55%, color-mix(in srgb, var(--bg-surface-soft) 88%, #0ea5e9 12%) 100% ); } .admin-report-toolbar { @apply px-6 md:px-8 py-5 border-b border-default flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between sticky top-0 z-10; background-color: color-mix(in srgb, var(--bg-surface) 92%, transparent); backdrop-filter: blur(12px); } .admin-report-badge { @apply inline-flex items-center rounded-full border border-default px-3 py-1 text-xs font-medium; background-color: var(--bg-surface-soft); color: var(--text-secondary); } .admin-report-badge--info { border-color: color-mix(in srgb, #0ea5e9 30%, var(--border-default)); background-color: color-mix(in srgb, #0ea5e9 10%, var(--bg-surface-soft)); color: var(--text-secondary); } .admin-report-badge--indigo { border-color: color-mix(in srgb, #6366f1 30%, var(--border-default)); background-color: color-mix(in srgb, #6366f1 10%, var(--bg-surface-soft)); color: var(--text-secondary); } .admin-report-panel { @apply p-4 md:p-5 rounded-2xl border border-default shadow-sm; background-color: var(--bg-surface); } .admin-report-setting-chip { @apply flex items-center gap-2 px-3 py-2 rounded-lg border border-default text-xs; background-color: var(--bg-surface-soft); color: var(--text-secondary); } .admin-report-sort-row { @apply grid grid-cols-12 items-center gap-2 text-xs p-2 border border-default rounded-lg; background-color: var(--bg-surface); } .admin-report-col-chip { @apply flex items-center justify-between gap-2 px-2 py-1.5 rounded-lg border border-default; background-color: var(--bg-surface-soft); } .admin-report-header-btn { @apply text-left transition-colors text-secondary hover:text-brand-600; } .admin-report-page-btn { @apply rounded-lg border border-default px-2.5 py-1.5 text-xs text-secondary transition-colors; } .admin-report-page-btn:hover:not(:disabled) { background-color: var(--bg-surface-soft); } .admin-report-page-btn--active { @apply border-brand-600 bg-brand-600 text-white; } .admin-report-page-btn--active:hover { background-color: #0284c7; } .admin-report-page-btn:disabled { @apply opacity-40 cursor-not-allowed; } .admin-nav-btn { @apply px-4 py-3 text-left text-sm font-medium rounded-xl transition-all flex items-center gap-3 relative overflow-hidden whitespace-nowrap flex-shrink-0; color: var(--text-muted); } .admin-nav-btn:hover:not(.admin-nav-btn--active) { background-color: var(--bg-surface-soft); color: var(--text-primary); } .admin-nav-btn--active { background-color: color-mix(in srgb, #0ea5e9 12%, var(--bg-surface-soft)); color: #0284c7; box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); } html.dark .admin-nav-btn--active { color: #7dd3fc; box-shadow: none; outline: 1px solid color-mix(in srgb, #0ea5e9 25%, transparent); outline-offset: -1px; } .admin-nav-subitem { @apply w-full text-left px-4 py-2 text-xs font-medium rounded-lg transition-colors flex items-center gap-2; color: var(--text-muted); } .admin-nav-subitem:hover:not(.admin-nav-subitem--active) { background-color: var(--bg-surface-soft); color: var(--text-secondary); } .admin-nav-subitem--active { background-color: color-mix(in srgb, #0ea5e9 12%, var(--bg-surface-soft)); color: #0284c7; } html.dark .admin-nav-subitem--active { color: #7dd3fc; } .admin-form-panel { @apply px-8 py-8 border-b border-default bg-surface; } .admin-side-card { @apply card p-6 h-fit; } .admin-panel { @apply rounded-2xl border border-default bg-surface shadow-sm; } .admin-panel-lg { @apply rounded-3xl border border-default bg-surface shadow-sm; } .admin-panel-padding { @apply p-6; } .admin-stat-tile { @apply rounded-2xl bg-surface-soft px-4 py-3; } .admin-modal-overlay { @apply fixed inset-0 z-50 flex items-start sm:items-center justify-center p-3 sm:p-4 overflow-y-auto bg-overlay backdrop-blur-sm; } .admin-modal-panel { @apply card w-full shadow-elevated flex flex-col; } .admin-modal-header { @apply px-5 sm:px-8 pt-5 sm:pt-7 pb-4 border-b border-default flex justify-between items-start shrink-0; } .admin-modal-body { @apply px-5 sm:px-8 py-5 space-y-5 overflow-y-auto flex-1; } .admin-modal-footer { @apply px-5 sm:px-8 py-4 border-t border-default flex justify-end gap-3 bg-surface rounded-b-2xl shrink-0; } .admin-modal-footer--muted { background-color: var(--bg-surface-soft); } .admin-dropdown { @apply absolute z-20 mt-2 max-h-64 overflow-auto rounded-xl border border-default bg-surface shadow-elevated; } .admin-code-block { @apply p-3 rounded-lg border border-default text-sm font-mono break-all; background-color: var(--bg-surface-soft); color: var(--text-secondary); } .admin-pre-block { @apply mt-1 max-h-[200px] overflow-auto whitespace-pre-wrap rounded-lg border border-default p-2 font-mono text-[10px]; background-color: var(--bg-surface-strong); color: var(--text-secondary); } .admin-pre-block--sql { @apply mt-1 max-h-none overflow-auto whitespace-pre-wrap rounded-lg border border-default p-3 font-mono text-xs text-emerald-600; background-color: var(--bg-surface-strong); } html.dark .admin-pre-block--sql { color: #6ee7b7; } .admin-checkbox { @apply w-4 h-4 cursor-pointer rounded border-default text-brand-600 focus:ring-brand-500; } .admin-checkbox-lg { @apply w-5 h-5 cursor-pointer rounded border-default text-blue-600 focus:ring-blue-500; } /* Segment control — 与个人中心「主题」切换同款(细边框 + brand 选中态) */ .segment-control { @apply grid w-full gap-2; } .segment-control--cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .segment-control--cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .segment-control--cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } @media (min-width: 640px) { .segment-control--cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } } /* 工具栏内 2 个短标签(如 数据库直联 | 外部 API) */ .segment-control--fit { @apply inline-grid w-auto; grid-template-columns: repeat(2, max-content); } .segment-control--fit .segment-item { @apply w-auto; } .segment-item { @apply w-full cursor-pointer whitespace-nowrap rounded-xl border border-default bg-surface px-3 py-3 text-center text-sm font-medium text-secondary transition-colors; } .segment-item:hover:not(:disabled):not(.segment-item--active) { @apply bg-surface-soft text-primary; } .segment-item--active { @apply border-brand-500 bg-brand-50 text-brand-700; } html.dark .segment-item--active { @apply border-brand-400 bg-brand-950/50 text-brand-300; } .segment-item:disabled { @apply cursor-not-allowed opacity-60; } .segment-control--sm .segment-item { @apply px-3 py-2 text-xs; } .segment-control--md .segment-item { @apply px-3 py-3 text-sm; } /* @deprecated — use .segment-control + .segment-item */ .btn-segment-group { @apply segment-control segment-control--cols-2 segment-control--sm; } .btn-segment-group .btn-segment { @apply segment-item; border: none; border-radius: 0.5rem; box-shadow: none; } .btn-segment-group .btn-segment.btn-segment--active { @apply segment-item--active; } /* KB admin panel (embedded in AdminView) */ .kb-admin-header { @apply flex flex-col gap-4 border-b border-default bg-surface px-8 py-6 lg:flex-row lg:items-start lg:justify-between; } .kb-admin-toolbar { @apply inline-flex w-full items-stretch divide-x divide-subtle overflow-hidden rounded-xl border border-default sm:w-auto; background-color: var(--bg-surface-soft); } .kb-admin-toolbar-btn { @apply inline-flex flex-1 items-center justify-center gap-1.5 px-3 py-2.5 text-sm font-medium transition-colors sm:flex-none sm:px-4; color: var(--text-secondary); } .kb-admin-toolbar-btn:hover { background-color: var(--bg-surface); color: var(--text-primary); } .kb-admin-body { @apply grid grid-cols-1 gap-6 bg-surface p-8 xl:grid-cols-[420px_minmax(0,1fr)]; } .kb-admin-section { @apply admin-panel p-6; } .kb-admin-card { @apply admin-panel px-4 py-4; } .kb-admin-empty { @apply rounded-2xl border border-dashed px-4 py-10 text-center text-sm text-muted; border-color: var(--border-default); background-color: var(--bg-surface-soft); } .kb-admin-badge { @apply rounded-full bg-surface-soft px-2.5 py-1 text-xs font-medium text-secondary shrink-0; } /* Chat — L2 */ .chat-sidebar-btn { @apply flex w-full items-center justify-center gap-2 rounded-xl border border-default bg-surface-soft py-3 text-sm font-medium text-secondary shadow-sm transition-colors hover-surface-strong; } .chat-sidebar-btn-icon { @apply flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-surface-soft text-secondary shadow-sm transition-colors hover-surface-strong; } .chat-history-item { @apply relative flex w-full items-center justify-between rounded-lg transition-colors hover-surface-soft; } .chat-history-item--active { background-color: color-mix(in srgb, #0ea5e9 12%, var(--bg-surface-soft)); } .chat-history-link { @apply flex-1 truncate px-3 py-2.5 text-left text-sm pr-8 text-secondary; } .chat-history-link--active { @apply font-medium text-brand-700; } html.dark .chat-history-link--active { color: #7dd3fc; } .chat-dropdown { @apply absolute z-50 rounded-xl border border-default bg-surface py-1 shadow-elevated; } .chat-msg-assistant { @apply w-full rounded-2xl border border-default bg-surface px-6 py-4 text-[15px] leading-relaxed text-primary shadow-sm; } .chat-agent-panel { @apply mb-4 rounded-2xl border border-default p-3; background-color: color-mix(in srgb, var(--bg-surface-soft) 85%, transparent); } .chat-icon-muted { @apply text-muted transition-colors hover:text-secondary; } /* Workspace logged-in — L3 main + L2 nav (reuse admin-nav rhythm) */ .ws-main { @apply min-w-0 section-gap bg-page page-shell-mobile md:py-8 lg:px-8; } .ws-nav-btn { @apply flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all; color: var(--text-secondary); } .ws-nav-btn:hover:not(.ws-nav-btn--active) { background-color: var(--bg-surface-soft); color: var(--text-primary); } .ws-nav-btn--active { background-color: color-mix(in srgb, #0ea5e9 12%, var(--bg-surface-soft)); color: #0284c7; box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); } html.dark .ws-nav-btn--active { color: #7dd3fc; outline: 1px solid color-mix(in srgb, #0ea5e9 25%, transparent); outline-offset: -1px; } .ws-nav-btn--danger { @apply text-red-500 hover:bg-red-50 hover:text-red-600; } html.dark .ws-nav-btn--danger { @apply text-red-400 hover:bg-red-950/40 hover:text-red-300; } .ws-card { @apply admin-panel-lg px-6 py-6 shadow-sm md:px-8; } .ws-history-card { @apply w-full admin-panel p-3 text-left transition-colors hover:border-brand-300; background-color: var(--bg-surface); } .ws-history-card:hover { background-color: color-mix(in srgb, #0ea5e9 8%, var(--bg-surface)); } /* Shared dialogs — app-wide (Dify, delete confirm, feedback, file preview) */ .dialog-overlay { @apply fixed inset-0 flex items-start sm:items-center justify-center p-3 sm:p-4 overflow-y-auto bg-overlay backdrop-blur-sm; z-index: 100; } .dialog-overlay--z80 { z-index: 80; } .dialog-overlay--z110 { z-index: 110; } .dialog-panel { @apply card w-full shadow-elevated flex flex-col; } .dialog-header { @apply flex items-center justify-between gap-4 border-b border-default shrink-0 px-5 py-4 sm:px-8 sm:pt-7 sm:pb-4; } .dialog-header--compact { @apply px-6 py-4; } .dialog-body { @apply overflow-y-auto flex-1 px-5 py-5 sm:px-8 form-stack; } .dialog-body--flush { @apply px-0 py-0; } .dialog-footer { @apply flex justify-end gap-3 border-t border-default shrink-0 px-5 py-4 sm:px-8 rounded-b-2xl; background-color: var(--bg-surface); } .dialog-stat-card { @apply admin-panel px-4 py-4; } .dialog-preview-body { @apply flex-1 overflow-auto p-4 bg-page; } .dialog-preview-frame { @apply bg-surface border border-default rounded-lg; } .dialog-icon-warning { @apply inline-flex h-[22px] w-[22px] shrink-0 items-center justify-center rounded-full text-sm font-semibold leading-none mt-0.5; background-color: var(--status-warning-bg); color: var(--status-warning-fg); border: 1px solid var(--status-warning-border); } .theme-toggle-btn { @apply flex items-center justify-center rounded-full border border-default backdrop-blur-md transition-all text-muted hover:text-primary hover:shadow-md; background-color: color-mix(in srgb, var(--bg-surface) 88%, transparent); } .theme-toggle-btn--inline { @apply h-8 w-8 md:h-9 md:w-9 shadow-sm; } .theme-toggle-btn--floating { @apply fixed bottom-5 right-5 z-[70] h-11 w-11 shadow-lg hover:shadow-xl; } /* KB Workspace */ .kb-ws-section { @apply admin-panel-lg p-6; } .kb-ws-card { @apply admin-panel p-4 transition-colors h-full min-h-[260px] flex flex-col; } .kb-ws-card--interactive { @apply kb-ws-card cursor-pointer hover:border-brand-300; } .kb-ws-stat-grid { @apply mb-6 grid grid-cols-2 gap-3 admin-panel-lg p-4 md:grid-cols-4 xl:grid-cols-7; } .kb-ws-stat-tile { @apply admin-stat-tile text-center transition-colors; } .kb-ws-group-list-btn { @apply w-full admin-panel px-4 py-4 text-left transition-all; } .kb-ws-group-list-btn--active { border-color: color-mix(in srgb, #0ea5e9 40%, var(--border-default)); background-color: color-mix(in srgb, #0ea5e9 10%, var(--bg-surface-soft)); color: #0284c7; } html.dark .kb-ws-group-list-btn--active { color: #7dd3fc; } .kb-ws-badge-count { @apply kb-admin-badge; } .kb-ws-icon-btn { @apply btn-icon-ds rounded-2xl border border-default; } .kb-ws-tooltip { @apply pointer-events-none absolute left-0 top-8 z-10 hidden w-80 admin-panel px-4 py-3 text-sm text-muted shadow-elevated group-hover:block; } }