Files
RawMark/web/src/app/app.css
T
eezd eb63b14c8e Add settings page with synced appearance and password change
- Store app settings as one JSON document on the server, merged per key and
  pushed to other devices; cache locally to avoid a flash on load
- Settings page groups appearance, account, shortcuts, shares, API tokens and
  trash; full screen with a section list on phones
- Font size and content width settings
- Change the login password, signing out other sessions
- Settings writes and password changes only accept a login session
2026-10-17 16:23:39 +08:00

485 lines
18 KiB
CSS

/* 应用外壳样式,颜色与字体沿用 themes/base.css 中的 --rm-* 变量 */
:root {
--rm-sidebar-bg: #f9f9f9;
--rm-sidebar-width: 260px;
--rm-hover: rgba(0, 0, 0, 0.045);
--rm-active: rgba(66, 184, 131, 0.14);
--rm-danger: #e5484d;
--rm-warn-bg: #fff8e6;
--rm-warn-text: #8a5a00;
--rm-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
@media (prefers-color-scheme: dark) {
:root {
--rm-sidebar-bg: #161618;
--rm-hover: rgba(255, 255, 255, 0.06);
--rm-active: rgba(66, 211, 146, 0.16);
--rm-warn-bg: #2f2716;
--rm-warn-text: #f0c060;
--rm-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
}
html,
body,
#app {
height: 100%;
}
body {
overflow: hidden;
-webkit-tap-highlight-color: transparent;
}
button {
font: inherit;
color: inherit;
}
/* ---- 通用控件 ---- */
.rm-btn {
display: inline-flex;
align-items: center;
gap: 6px;
height: 30px;
padding: 0 12px;
border: 1px solid var(--rm-divider);
border-radius: 6px;
background: var(--rm-bg);
font-size: 13px;
cursor: pointer;
white-space: nowrap;
}
.rm-btn:hover { border-color: var(--rm-accent); color: var(--rm-accent-strong); }
.rm-btn:disabled { opacity: 0.6; cursor: default; }
.rm-btn-primary { background: var(--rm-accent); border-color: var(--rm-accent); color: #fff; }
.rm-btn-primary:hover { background: var(--rm-accent-strong); color: #fff; }
.rm-btn-danger:hover { border-color: var(--rm-danger); color: var(--rm-danger); }
.rm-icon-btn {
display: inline-flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
padding: 0;
border: 0;
border-radius: 6px;
background: transparent;
color: var(--rm-text-muted);
cursor: pointer;
flex: none;
}
.rm-icon-btn:hover { background: var(--rm-hover); color: var(--rm-text); }
.rm-splash,
.rm-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 12px;
height: 100%;
color: var(--rm-text-muted);
}
/* ---- 登录 ---- */
.rm-auth { display: flex; align-items: center; justify-content: center; min-height: 100%; padding: 24px; box-sizing: border-box; }
.rm-auth-card { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 14px; }
.rm-auth-card h1 { margin: 0 0 8px; font-size: 26px; color: var(--rm-accent-strong); }
.rm-auth-hint { margin: 0; font-size: 13px; color: var(--rm-text-muted); line-height: 1.6; }
.rm-auth-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--rm-text-muted); }
.rm-auth-card input {
height: 40px;
padding: 0 12px;
border: 1px solid var(--rm-divider);
border-radius: 8px;
background: var(--rm-bg);
color: var(--rm-text);
font-size: 15px;
outline: none;
}
.rm-auth-card input:focus { border-color: var(--rm-accent); box-shadow: 0 0 0 3px var(--rm-selection); }
.rm-auth-card .rm-btn { height: 40px; justify-content: center; font-size: 15px; }
.rm-auth-error { margin: 0; color: var(--rm-danger); font-size: 13px; }
/* ---- 布局 ---- */
.rm-shell { display: flex; height: 100%; }
.rm-sidebar {
width: var(--rm-sidebar-width);
flex: none;
background: var(--rm-sidebar-bg);
border-right: 1px solid var(--rm-divider);
}
.rm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rm-backdrop,
.rm-mobile-bar { display: none; }
/* ---- 侧栏 ---- */
.rm-sidebar-inner { display: flex; flex-direction: column; height: 100%; }
.rm-sidebar-head { display: flex; align-items: center; gap: 2px; padding: 12px 10px 8px 16px; }
.rm-brand { flex: 1; font-weight: 600; font-size: 15px; color: var(--rm-accent-strong); }
.rm-tree { flex: 1; overflow: auto; padding: 0 6px 12px; }
.rm-tree.drop { background: var(--rm-active); }
.rm-tree-list { list-style: none; margin: 0; padding: 0; }
.rm-tree-row {
position: relative;
display: flex;
align-items: center;
gap: 4px;
height: 30px;
padding-right: 4px;
border-radius: 6px;
font-size: 14px;
cursor: pointer;
user-select: none;
}
.rm-tree-row:hover { background: var(--rm-hover); }
.rm-tree-row.active { background: var(--rm-active); color: var(--rm-accent-strong); }
.rm-tree-row.drop { outline: 2px solid var(--rm-accent); outline-offset: -2px; }
.rm-tree-chevron { display: inline-flex; width: 14px; color: var(--rm-text-muted); transition: transform 0.15s; }
.rm-tree-chevron.open { transform: rotate(90deg); }
.rm-tree-chevron.hidden { visibility: hidden; }
.rm-tree-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-tree-input {
flex: 1;
min-width: 0;
height: 24px;
padding: 0 6px;
border: 1px solid var(--rm-accent);
border-radius: 4px;
background: var(--rm-bg);
color: var(--rm-text);
font: inherit;
outline: none;
}
.rm-tree-more { width: 24px; height: 24px; opacity: 0; }
.rm-tree-row:hover .rm-tree-more,
.rm-tree-row.menu-open .rm-tree-more { opacity: 1; }
.rm-tree-empty { padding: 16px; color: var(--rm-text-muted); font-size: 13px; text-align: center; }
/* ---- 搜索 ---- */
.rm-sidebar-head .rm-icon-btn.on { background: var(--rm-active); color: var(--rm-accent-strong); }
.rm-search { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.rm-search-box {
display: flex;
align-items: center;
gap: 6px;
margin: 0 10px 8px;
padding: 0 4px 0 8px;
border: 1px solid var(--rm-divider);
border-radius: 6px;
background: var(--rm-bg);
color: var(--rm-text-muted);
}
.rm-search-box:focus-within { border-color: var(--rm-accent); }
.rm-search-input {
flex: 1;
min-width: 0;
height: 30px;
border: 0;
background: none;
color: var(--rm-text);
font: inherit;
font-size: 14px;
outline: none;
}
.rm-search-input::-webkit-search-cancel-button { display: none; }
.rm-search-results { flex: 1; overflow: auto; list-style: none; margin: 0; padding: 0 6px 12px; }
.rm-search-item { padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.rm-search-item.active { background: var(--rm-hover); }
.rm-search-item.current .rm-search-title { color: var(--rm-accent-strong); }
.rm-search-title { display: flex; align-items: baseline; gap: 6px; font-size: 14px; overflow: hidden; white-space: nowrap; }
.rm-search-dir { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--rm-text-muted); font-size: 12px; }
.rm-search-snippet {
margin-top: 2px;
color: var(--rm-text-muted);
font-size: 12px;
line-height: 1.5;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
word-break: break-all;
}
.rm-search-hit { background: rgba(66, 184, 131, 0.28); color: var(--rm-text); border-radius: 2px; }
/* ---- 快速切换 ---- */
.rm-switcher-backdrop { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; background: rgba(0, 0, 0, 0.18); }
.rm-switcher {
display: flex;
flex-direction: column;
width: min(560px, calc(100vw - 24px));
max-height: 60vh;
padding-top: 10px;
border-radius: 10px;
background: var(--rm-bg);
box-shadow: var(--rm-shadow);
overflow: hidden;
}
.rm-switcher-list { flex: 1; overflow: auto; list-style: none; margin: 0; padding: 0 6px 6px; }
.rm-switcher-item { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border-radius: 6px; font-size: 14px; color: var(--rm-text-muted); cursor: pointer; }
.rm-switcher-item.active { background: var(--rm-active); }
.rm-switcher-title { color: var(--rm-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-switcher-dir { flex: 1; min-width: 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.rm-switcher-keys span { padding: 1px 6px; border: 1px solid var(--rm-divider); border-radius: 4px; font-family: inherit; }
.rm-sidebar-foot { display: flex; gap: 4px; padding: 8px; border-top: 1px solid var(--rm-divider); }
.rm-foot-btn {
flex: 1;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
height: 32px;
border: 0;
border-radius: 6px;
background: transparent;
color: var(--rm-text-muted);
font-size: 13px;
cursor: pointer;
}
.rm-foot-btn:hover { background: var(--rm-hover); color: var(--rm-text); }
/* ---- 菜单 ---- */
.rm-menu {
position: absolute;
top: 100%;
right: 4px;
z-index: 20;
display: flex;
flex-direction: column;
min-width: 150px;
padding: 4px;
border: 1px solid var(--rm-divider);
border-radius: 8px;
background: var(--rm-bg);
box-shadow: var(--rm-shadow);
cursor: default;
}
.rm-menu button {
display: flex;
align-items: center;
gap: 8px;
height: 32px;
padding: 0 10px;
border: 0;
border-radius: 6px;
background: transparent;
font-size: 13px;
text-align: left;
cursor: pointer;
}
.rm-menu button:hover { background: var(--rm-hover); }
.rm-menu button.danger:hover { color: var(--rm-danger); background: rgba(229, 72, 77, 0.1); }
.rm-menu-backdrop { position: fixed; inset: 0; z-index: 19; cursor: default; }
/* ---- 标签页 ---- */
.rm-tabs {
display: flex;
gap: 2px;
height: 38px;
padding: 4px 8px 0;
overflow-x: auto;
border-bottom: 1px solid var(--rm-divider);
scrollbar-width: none;
flex: none;
}
.rm-tabs:empty { display: none; }
.rm-tab {
display: flex;
align-items: center;
gap: 4px;
max-width: 200px;
height: 34px;
padding: 0 4px 0 12px;
border-radius: 8px 8px 0 0;
font-size: 13px;
color: var(--rm-text-muted);
cursor: pointer;
flex: none;
}
.rm-tab:hover { background: var(--rm-hover); }
.rm-tab.active { background: var(--rm-active); color: var(--rm-text); }
.rm-tab-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-tab-close {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
width: 20px;
height: 20px;
padding: 0;
border: 0;
border-radius: 4px;
background: transparent;
color: var(--rm-text-muted);
cursor: pointer;
}
.rm-tab-close:hover { background: var(--rm-hover); }
.rm-tab-close svg { opacity: 0; }
.rm-tab:hover .rm-tab-close svg,
.rm-tab.active .rm-tab-close svg { opacity: 1; }
.rm-dirty-dot { display: none; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--rm-accent); }
/* 有未保存修改时显示圆点,悬停时换回关闭图标 */
.rm-tab-close.dirty .rm-dirty-dot { display: block; }
.rm-tab-close.dirty svg { opacity: 0 !important; }
.rm-tab-close.dirty:hover .rm-dirty-dot { display: none; }
.rm-tab-close.dirty:hover svg { opacity: 1 !important; }
/* ---- 提示条 ---- */
.rm-banner {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
padding: 8px 16px;
font-size: 13px;
flex: none;
}
.rm-banner span { flex: 1; min-width: 200px; }
.rm-banner.warn,
.rm-banner.error { background: var(--rm-warn-bg); color: var(--rm-warn-text); }
/* ---- 编辑区 ---- */
.rm-editor-pane { flex: 1; min-height: 0; position: relative; }
.rm-editor-host { height: 100%; }
.rm-editor-host .cm-editor { height: 100%; }
/* ---- 对话框 ---- */
.rm-dialog-backdrop { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.3); padding: 16px; }
.rm-dialog {
width: 100%;
max-width: 560px;
max-height: 80vh;
display: flex;
flex-direction: column;
border-radius: 12px;
background: var(--rm-bg);
box-shadow: var(--rm-shadow);
}
.rm-dialog-head { display: flex; align-items: center; padding: 14px 16px 8px 20px; }
.rm-dialog-head h2 { flex: 1; margin: 0; font-size: 16px; }
.rm-share-dialog { max-width: 640px; }
.rm-share-form { display: flex; gap: 8px; padding: 4px 20px 0; }
.rm-share-form input,
.rm-share-form select {
height: 34px;
padding: 0 10px;
border: 1px solid var(--rm-divider);
border-radius: 6px;
background: var(--rm-bg);
color: var(--rm-text);
font-size: 14px;
outline: none;
}
.rm-share-form input { flex: 1; min-width: 0; }
.rm-share-form input:focus,
.rm-share-form select:focus { border-color: var(--rm-accent); }
.rm-share-note { margin: 10px 20px 4px; font-size: 12px; color: var(--rm-text-muted); line-height: 1.6; }
.rm-share-note a { color: var(--rm-accent-strong); }
.rm-share-link { font-family: var(--rm-font-mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-share-bad { color: var(--rm-danger); }
.rm-token-created { margin: 12px 20px 0; padding: 10px 12px; border-radius: 8px; background: var(--rm-selection); font-size: 13px; }
.rm-token-created p { margin: 0 0 6px; }
.rm-token-value { display: flex; align-items: center; gap: 8px; }
.rm-token-value code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-family: var(--rm-font-mono); font-size: 12px; user-select: all; }
/* ---- 设置 ---- */
.rm-settings { flex-direction: row; max-width: 820px; height: min(640px, 85vh); max-height: none; overflow: hidden; }
.rm-settings-nav { flex: none; width: 190px; display: flex; flex-direction: column; gap: 2px; padding: 0 8px 12px; border-right: 1px solid var(--rm-divider); overflow-y: auto; }
.rm-settings-nav .rm-dialog-head { padding-left: 12px; }
.rm-settings-close-list,
.rm-settings-back { display: none; }
.rm-settings-tab { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--rm-text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.rm-settings-tab:hover { background: var(--rm-hover); }
.rm-settings-tab.on { background: var(--rm-selection); color: var(--rm-accent-strong); font-weight: 600; }
.rm-settings-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rm-settings-content { flex: 1; overflow-y: auto; padding-bottom: 16px; }
.rm-setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; padding: 6px 20px; }
.rm-setting-label { font-size: 14px; }
.rm-setting select { height: 34px; padding: 0 8px; border: 1px solid var(--rm-divider); border-radius: 6px; background: var(--rm-bg); color: var(--rm-text); font-size: 14px; }
.rm-segmented { display: inline-flex; border: 1px solid var(--rm-divider); border-radius: 8px; overflow: hidden; }
.rm-segmented button { height: 32px; padding: 0 14px; border: 0; border-left: 1px solid var(--rm-divider); background: none; color: var(--rm-text); font: inherit; font-size: 13px; cursor: pointer; }
.rm-segmented button:first-child { border-left: 0; }
.rm-segmented button.on { background: var(--rm-accent); color: #fff; }
.rm-settings-form { max-width: 360px; padding: 4px 20px 16px; }
.rm-settings-form h3 { margin: 0; font-size: 15px; }
.rm-shortcuts { width: calc(100% - 40px); margin: 0 20px; border-collapse: collapse; font-size: 14px; }
.rm-shortcuts td { padding: 8px 0; border-bottom: 1px solid var(--rm-divider); }
.rm-shortcuts td:last-child { text-align: right; }
.rm-shortcuts kbd { font-family: var(--rm-font-mono); font-size: 12px; padding: 2px 6px; border: 1px solid var(--rm-divider); border-radius: 4px; background: var(--rm-inline-code-bg); }
.flip { transform: rotate(180deg); }
.rm-trash-list { list-style: none; margin: 0; padding: 0 12px 12px; overflow: auto; }
.rm-trash-list li { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; color: var(--rm-text-muted); }
.rm-trash-list li:hover { background: var(--rm-hover); }
.rm-trash-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rm-trash-path { color: var(--rm-text); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-trash-time { font-size: 12px; }
/* ---- 通知 ---- */
.rm-toasts { position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.rm-toast {
display: flex;
align-items: center;
gap: 12px;
padding: 10px 16px;
border-radius: 8px;
background: #1f2328;
color: #fff;
font-size: 13px;
box-shadow: var(--rm-shadow);
pointer-events: auto;
}
.rm-toast-action { border: 0; background: none; color: #42d392; font-weight: 600; cursor: pointer; padding: 0; }
/* ---- 移动端 ---- */
@media (max-width: 768px) {
/* 设置在手机上全屏,一次只显示分组列表或分组内容 */
.rm-dialog-backdrop:has(.rm-settings) { padding: 0; }
.rm-settings { max-width: none; height: 100%; border-radius: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); box-sizing: border-box; }
.rm-settings-nav { width: auto; flex: 1; border-right: 0; display: none; }
.rm-settings.show-list .rm-settings-nav { display: flex; }
.rm-settings.show-list .rm-settings-body { display: none; }
.rm-settings-tab { height: 48px; font-size: 16px; }
.rm-settings-close-list,
.rm-settings-back { display: inline-flex; width: 40px; height: 40px; }
.rm-setting { flex-wrap: wrap; }
.rm-sidebar {
position: fixed;
inset: 0 auto 0 0;
z-index: 40;
width: min(84vw, 320px);
transform: translateX(-100%);
transition: transform 0.22s ease;
padding-top: env(safe-area-inset-top);
}
.sidebar-open .rm-sidebar { transform: none; box-shadow: var(--rm-shadow); }
.rm-backdrop { position: fixed; inset: 0; z-index: 39; background: rgba(0, 0, 0, 0.3); opacity: 0; pointer-events: none; transition: opacity 0.22s; display: block; }
.sidebar-open .rm-backdrop { opacity: 1; pointer-events: auto; }
.rm-tabs { display: none; }
.rm-mobile-bar {
display: flex;
align-items: center;
gap: 8px;
height: 48px;
padding: env(safe-area-inset-top) 8px 0;
border-bottom: 1px solid var(--rm-divider);
flex: none;
}
.rm-mobile-bar .rm-icon-btn { width: 40px; height: 40px; }
.rm-mobile-title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-save-state { width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: transparent; }
.rm-save-state.on { background: var(--rm-accent); }
.rm-tree-row { height: 40px; font-size: 15px; }
.rm-tree-more { opacity: 1; width: 36px; height: 36px; }
.rm-sidebar-head .rm-icon-btn { width: 40px; height: 40px; }
/* 小于 16px 时 iOS Safari 聚焦输入框会自动放大页面 */
.rm-search-input { height: 40px; font-size: 16px; }
.rm-auth-card input,
.rm-share-form input,
.rm-share-form select,
.rm-setting select { font-size: 16px; }
.rm-share-form { flex-wrap: wrap; }
.rm-search-item { padding: 10px 8px; }
/* 手机上从顶部弹出,给软键盘留出空间 */
.rm-switcher-backdrop { padding-top: calc(8px + env(safe-area-inset-top)); }
.rm-switcher { max-height: 50vh; }
.rm-switcher-item { height: 44px; font-size: 15px; }
.rm-trash-list li { flex-wrap: wrap; }
}