/* ============================================
   云笔记 - Style Sheet
   Notion 暖色设计系统
   ============================================ */

:root {
  /* 颜色系统 */
  --canvas-bg: #F7F6F3;
  --card-bg: #FFFFFF;
  --text-primary: #37352F;
  --text-secondary: #787774;
  --text-muted: #B4B4B0;
  --brand-purple: #9B5DE5;
  --brand-purple-light: #F3EDFF;
  --brand-orange: #F26430;
  --brand-orange-light: #FFF0E8;
  --border-color: #E9E9E7;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* 布局 */
  --sidebar-width: 240px;
  --mobile-nav-height: 64px;
  --header-height: 56px;

  /* 动画 */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;
}

/* ===== 全局 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 15px;
  color: var(--text-primary);
  background: var(--canvas-bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.screen { position: fixed; inset: 0; z-index: 100; }
.screen:not(.active) { display: none; }

/* 解决 ID 选择器优先级覆盖 screen active 状态的问题 */
#main-app.screen:not(.active),
#lock-screen.screen:not(.active) { display: none !important; }

/* ===== 锁屏 ===== */
#lock-screen {
  background: var(--canvas-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lock-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 32px;
  max-width: 360px;
  width: 100%;
}

.lock-icon-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--brand-purple-light);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-normal);
}

.lock-icon-circle.locked-auto {
  background: var(--brand-orange-light);
}

.lock-icon-circle svg {
  width: 32px;
  height: 32px;
  color: var(--brand-purple);
  transition: color var(--transition-normal);
}

.lock-icon-circle.locked-auto svg {
  color: var(--brand-orange);
}

.lock-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.lock-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
}

.lock-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lock-form input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 15px;
  background: var(--card-bg);
  outline: none;
  transition: border-color var(--transition-fast);
}

.lock-form input[type="password"]:focus {
  border-color: var(--brand-purple);
}

.password-input-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
}

.password-input-wrap input {
  padding-right: 44px;
}

.toggle-eye {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-eye svg {
  width: 20px;
  height: 20px;
}

.lock-btn {
  width: 100%;
  padding: 12px;
  background: var(--brand-purple);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.lock-btn:active { opacity: 0.85; }

.lock-hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ===== 主应用 ===== */
#main-app {
  display: flex;
  height: 100vh;
  background: var(--canvas-bg);
}

/* ===== 侧边栏 (PC) ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--card-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo svg {
  width: 28px;
  height: 28px;
}

.sidebar-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.sidebar-nav {
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.sidebar-item:hover {
  background: var(--brand-purple-light);
  color: var(--brand-purple);
}

.sidebar-item.active {
  background: var(--brand-purple-light);
  color: var(--brand-purple);
  font-weight: 600;
}

.sidebar-item svg {
  width: 20px;
  height: 20px;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.sidebar-lock-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  width: 100%;
  transition: all var(--transition-fast);
}

.sidebar-lock-btn:hover {
  background: var(--brand-orange-light);
  color: var(--brand-orange);
}

.sidebar-lock-btn svg {
  width: 18px;
  height: 18px;
}

/* ===== 主内容区 ===== */
.main-content {
  flex: 1;
  overflow-y: auto;
  position: relative;
  padding-bottom: 0;
}

.view {
  display: none;
  min-height: 100%;
}

.view.active {
  display: flex;
  flex-direction: column;
}

/* ===== 视图头部 ===== */
.view-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: var(--canvas-bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.view-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.view-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: var(--brand-purple-light);
  color: var(--brand-purple);
}

.icon-btn svg { width: 20px; height: 20px; }

/* ===== 搜索栏 ===== */
.search-bar {
  padding: 12px 20px;
  background: var(--canvas-bg);
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
}

.search-bar input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: var(--card-bg);
  outline: none;
  transition: border-color var(--transition-fast);
}

.search-bar input:focus {
  border-color: var(--brand-purple);
}

.search-clear-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.search-clear-btn svg { width: 16px; height: 16px; }

/* ===== 分类筛选标签 ===== */
.filter-tabs {
  padding: 12px 20px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.filter-tabs::-webkit-scrollbar { display: none; }

.filter-tab {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.filter-tab.active {
  background: var(--brand-purple);
  color: white;
  border-color: var(--brand-purple);
}

.filter-tab:hover:not(.active) {
  border-color: var(--brand-purple);
  color: var(--brand-purple);
}

.category-filter-chips {
  padding: 8px 20px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-filter-chips::-webkit-scrollbar { display: none; }

.category-chip {
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  border: 1.5px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.category-chip.active {
  background: var(--brand-purple-light);
  color: var(--brand-purple);
  border-color: var(--brand-purple);
}

/* ===== 笔记列表 ===== */
.notes-list {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state p {
  font-size: 16px;
  font-weight: 500;
}

.empty-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.note-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: box-shadow var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.note-card:hover {
  box-shadow: var(--shadow-md);
}

.note-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.note-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.note-card-type {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--brand-purple-light);
  color: var(--brand-purple);
  white-space: nowrap;
}

.note-card-type.type-image { background: #E8F5E9; color: #34D399; }
.note-card-type.type-video { background: #FFF0E8; color: var(--brand-orange); }
.note-card-type.type-document { background: #E3F2FD; color: #00BBF9; }

.note-card-preview {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-card-thumb {
  width: 100%;
  height: 120px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--brand-purple-light);
}

.note-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.note-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.note-card-category {
  display: flex;
  align-items: center;
  gap: 6px;
}

.category-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.note-card-date {
  color: var(--text-muted);
}

/* ===== FAB ===== */
.fab {
  position: fixed;
  bottom: 84px;
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--brand-purple);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-fast);
  z-index: 20;
}

.fab:hover { transform: scale(1.05); }
.fab:active { transform: scale(0.95); }

.fab svg { width: 24px; height: 24px; }

/* ===== 编辑器 ===== */
.editor-header {
  background: var(--canvas-bg);
}

.editor-header .view-header-actions {
  gap: 4px;
}

.back-btn {
  width: 40px;
  height: 40px;
}

.copy-btn {
  color: var(--text-muted);
}

.save-btn {
  padding: 8px 16px;
  background: var(--brand-purple);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.save-btn:active { opacity: 0.85; }

.editor-body {
  padding: 16px 20px 80px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.editor-note-title {
  font-size: 22px;
  font-weight: 700;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  width: 100%;
}

.editor-note-title::placeholder {
  color: var(--text-muted);
}

.editor-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.editor-category-select {
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  font-size: 13px;
  color: var(--text-secondary);
  outline: none;
}

.editor-content {
  flex: 1;
  min-height: 200px;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-primary);
  resize: none;
  font-family: inherit;
  padding: 8px 0;
}

/* 附件 */
.attachments-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.attachments-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.attachments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.attachment-item {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.attachment-thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.attachment-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-thumb.type-video {
  background: #1A1A2E;
}

.attachment-thumb.type-video svg {
  width: 24px;
  height: 24px;
  color: white;
}

.attachment-thumb.type-document {
  background: #E3F2FD;
}

.attachment-thumb.type-document svg {
  width: 24px;
  height: 24px;
  color: #00BBF9;
}

.attachment-thumb.type-link {
  background: var(--brand-purple-light);
}

.attachment-thumb.type-link svg {
  width: 24px;
  height: 24px;
  color: var(--brand-purple);
}

.attachment-info {
  flex: 1;
  min-width: 0;
}

.attachment-name {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-size {
  font-size: 12px;
  color: var(--text-muted);
}

.attachment-remove {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.attachment-remove:hover {
  background: #FEE2E2;
  color: #E85D75;
}

.attachment-remove svg { width: 16px; height: 16px; }

/* 编辑器工具栏 */
.editor-toolbar {
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
}

.toolbar-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  position: relative;
}

.toolbar-btn:hover {
  background: var(--brand-purple-light);
  color: var(--brand-purple);
}

.toolbar-btn svg { width: 24px; height: 24px; }

.file-input {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  top: 0;
  left: 0;
  cursor: pointer;
}

/* ===== 分类管理 ===== */
.categories-list {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.category-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast);
}

.category-card:hover {
  box-shadow: var(--shadow-md);
}

.category-card-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.category-card-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.category-card-name {
  font-size: 15px;
  font-weight: 600;
}

.category-card-count {
  font-size: 13px;
  color: var(--text-muted);
}

.category-card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.category-card-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.category-card-btn:hover {
  background: #FEE2E2;
  color: #E85D75;
}

.category-card-btn svg { width: 16px; height: 16px; }

.new-category-btn {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  border: 2px dashed var(--border-color);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.new-category-btn:hover {
  border-color: var(--brand-purple);
  color: var(--brand-purple);
  background: var(--brand-purple-light);
}

.new-category-btn svg { width: 18px; height: 18px; }

/* ===== 设置 ===== */
.settings-sections {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.settings-section {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.settings-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 14px 16px;
  background: var(--canvas-bg);
  border-bottom: 1px solid var(--border-color);
}

.settings-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

.settings-item:last-child { border-bottom: none; }

.settings-label {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.settings-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.danger-text { color: #E85D75; }

.settings-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.settings-input-group input {
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--canvas-bg);
  outline: none;
}

.settings-input-group input:focus {
  border-color: var(--brand-purple);
}

.settings-input-group select {
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--canvas-bg);
  outline: none;
}

.settings-action-btn {
  padding: 10px 20px;
  background: var(--brand-purple);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.settings-action-btn:active { opacity: 0.85; }

.settings-action-btn.danger {
  background: #E85D75;
}

/* ===== 移动端底部导航 ===== */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-height);
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  padding: 8px 0;
  z-index: 30;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  transition: color var(--transition-fast);
  flex: 1;
}

.mobile-nav-item.active {
  color: var(--brand-purple);
}

.mobile-nav-item svg {
  width: 22px;
  height: 22px;
}

/* ===== 模态框 ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.3);
}

.modal-content {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 380px;
  width: 90%;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.modal-content input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
}

.modal-content input:focus {
  border-color: var(--brand-purple);
}

.color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-option {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.color-option.selected {
  border-color: var(--text-primary);
  transform: scale(1.1);
}

.color-option:hover:not(.selected) {
  border-color: var(--text-muted);
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity var(--transition-fast);
}

.modal-btn.cancel {
  background: var(--canvas-bg);
  color: var(--text-secondary);
}

.modal-btn.primary {
  background: var(--brand-purple);
  color: white;
}

.modal-btn.danger {
  background: #E85D75;
  color: white;
}

.modal-btn:active { opacity: 0.85; }

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  background: var(--text-primary);
  color: white;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s ease, toast-out 0.3s ease 2.2s forwards;
  pointer-events: auto;
}

.toast.toast-success { background: #34D399; color: #064E3B; }
.toast.toast-error { background: #E85D75; }
.toast.toast-warning { background: var(--brand-orange); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-10px); }
}

/* ===== 响应式：移动端 ===== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .mobile-nav { display: flex; }

  .main-content {
    padding-bottom: var(--mobile-nav-height);
  }

  .fab {
    bottom: calc(var(--mobile-nav-height) + 20px);
  }

  .view-header {
    padding: 14px 16px;
  }

  .filter-tabs {
    padding: 10px 16px;
  }

  .notes-list {
    padding: 12px 16px;
  }

  .editor-body {
    padding: 12px 16px;
  }

  .settings-sections {
    padding: 12px 16px;
  }

  .categories-list {
    padding: 12px 16px;
  }

  .toast-container {
    bottom: calc(var(--mobile-nav-height) + 16px);
  }
}

/* ===== 响应式：平板 ===== */
@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar {
    width: 200px;
  }

  :root {
    --sidebar-width: 200px;
  }
}

/* ===== 响应式：大屏 ===== */
@media (min-width: 1200px) {
  .main-content {
    max-width: 900px;
    margin: 0 auto;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
  }
}

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== 选择区域 ===== */
::selection {
  background: var(--brand-purple-light);
  color: var(--brand-purple);
}

/* ===== 禁用状态 ===== */
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== 加载动画 ===== */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--brand-purple);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ===== 自动锁定动画 ===== */
@keyframes pulse-orange {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242, 100, 48, 0.3); }
  50% { box-shadow: 0 0 0 12px rgba(242, 100, 48, 0); }
}

.lock-icon-circle.locked-auto {
  animation: pulse-orange 2s ease infinite;
}

/* ===== 笔记卡片长按/右键菜单 ===== */
.note-card-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  opacity: 0;
  transition: all var(--transition-fast);
}

.note-card:hover .note-card-delete { opacity: 1; }

.note-card-delete:hover {
  background: #FEE2E2;
  color: #E85D75;
}

.note-card-delete svg { width: 14px; height: 14px; }

/* ===== 附件预览模态 ===== */
.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-modal img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.preview-modal video {
  max-width: 90%;
  max-height: 90%;
}

.preview-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.2);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-close:hover { background: rgba(255,255,255,0.3); }
.preview-close svg { width: 24px; height: 24px; }

/* ===== 无障碍 ===== */
:focus-visible {
  outline: 2px solid var(--brand-purple);
  outline-offset: 2px;
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
