/* ===== Web Login ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #E8F8F0 0%, #F0EBFF 100%);
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 24px;
  padding: 48px 40px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.1);
  text-align: center;
  max-width: 400px;
  width: 100%;
}
.login-logo {
  width: 64px; height: 64px;
  background: var(--primary-light);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 32px;
}
.login-title { font-size: 24px; font-weight: 600; margin-bottom: 8px; }
.login-subtitle { color: var(--text-secondary); font-size: 14px; margin-bottom: 32px; }
.qr-container {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}
.qr-box {
  width: 240px; height: 240px;
  border: 2px solid var(--border);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.qr-box img { width: 220px; height: 220px; }
.qr-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.qr-overlay .icon { font-size: 48px; }
.qr-status {
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.3s;
}
.qr-status.waiting { background: var(--bg-hover); color: var(--text-secondary); }
.qr-status.scanned { background: var(--primary-light); color: var(--primary); }
.qr-status.confirmed { background: var(--primary); color: #fff; }
.qr-refresh {
  margin-top: 16px;
  color: var(--primary);
  cursor: pointer;
  font-size: 14px;
}
.qr-hint {
  margin-top: 24px;
  padding: 12px 16px;
  background: var(--bg-hover);
  border-radius: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: left;
}
.qr-hint-title { font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }

/* Login Mode Tabs */
.login-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  background: var(--bg-hover);
  border-radius: 12px;
  padding: 4px;
}
.login-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
}
.login-tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Auth Sub Tabs (Login/Register) */
.auth-sub-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
}
.auth-sub-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.auth-sub-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Auth Form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: #FAFAFA;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.auth-input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}
.auth-submit-btn {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  margin-top: 4px;
}
.auth-submit-btn:active { opacity: 0.8; }
.auth-submit-btn:disabled { opacity: 0.5; }
.auth-hint {
  font-size: 13px;
  color: var(--danger);
  margin-top: 8px;
  min-height: 18px;
  text-align: center;
}

/* ===== Web Dashboard ===== */
.dashboard {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-header .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-header .avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
}
.sidebar-header .user-name { font-weight: 600; font-size: 16px; }
.sidebar-header .user-status { font-size: 12px; color: var(--primary); }

.sidebar-nav {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
}
.sidebar-nav .nav-section {
  font-size: 12px;
  color: var(--text-tertiary);
  padding: 12px 12px 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 15px;
  color: var(--text-primary);
}
.nav-item:hover { background: var(--bg-hover); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 500; }
.nav-item .icon { font-size: 20px; width: 24px; text-align: center; }
.nav-item .count {
  margin-left: auto;
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
}
.nav-item.active .count { background: var(--primary); color: #fff; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}
.logout-btn {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.2s;
}
.logout-btn:hover { background: #FFF0F0; color: var(--danger); }

/* ICP Footer */
.icp-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: 6px 0;
  background: rgba(242, 242, 247, 0.9);
  font-size: 12px;
  z-index: 100;
}
.icp-footer a {
  color: #8E8E93;
  text-decoration: none;
}
.icp-footer a:hover {
  color: #07C160;
}

/* Main Chat Area */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

/* Drag-and-drop file overlay for chat area */
.drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7,193,96,0.12);
  border: 2px dashed #07C160;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  pointer-events: none;
}
.drop-overlay.hidden { display: none; }
.drop-inner {
  background: #fff;
  padding: 16px 28px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: #07C160;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.drop-inner .drop-icon { font-size: 32px; }
.chat-header {
  height: 60px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.chat-header .title { font-size: 17px; font-weight: 600; }
.chat-header .subtitle { font-size: 12px; color: var(--text-secondary); }
.chat-header .actions { display: flex; gap: 8px; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message-item {
  display: flex;
  gap: 12px;
  max-width: 70%;
  animation: slideUp 0.3s ease;
}
.message-item.self { align-self: flex-end; flex-direction: row-reverse; }
.message-avatar {
  width: 40px; height: 40px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.message-item.self .message-avatar { background: #6236FF; }
.message-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.message-item.self .message-content { align-items: flex-end; }
.message-sender { font-size: 12px; color: var(--text-secondary); padding: 0 4px; }
.message-bubble {
  background: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  word-break: break-word;
  position: relative;
  max-width: 100%;
}
.message-item.self .message-bubble { background: var(--primary); color: #fff; }
.message-time { font-size: 11px; color: var(--text-tertiary); padding: 0 4px; }
.message-foot { display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.msg-share-btn {
  border: none;
  background: var(--bg-tertiary, #F2F2F7);
  color: var(--primary, #07C160);
  border-radius: 10px;
  padding: 2px 10px;
  font-size: 11px;
  cursor: pointer;
}
.msg-share-btn:active { opacity: 0.7; }

/* Message types */
.msg-text { white-space: pre-wrap; }
.msg-image img { max-width: 300px; border-radius: 8px; cursor: pointer; }
.msg-video video { max-width: 300px; border-radius: 8px; }
.msg-file {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 200px;
  cursor: pointer;
}
.msg-file .file-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.message-item.self .msg-file .file-icon { background: rgba(255,255,255,0.2); }
.msg-file .file-info { min-width: 0; }
.msg-file .file-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.msg-file .file-size { font-size: 12px; opacity: 0.7; }
.msg-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 240px;
  max-width: 320px;
  cursor: pointer;
}
.msg-link .link-title { font-weight: 500; }
.msg-link .link-desc { font-size: 13px; opacity: 0.8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-link .link-url { font-size: 12px; opacity: 0.6; }
.msg-link .link-thumb {
  width: 100%; height: 120px;
  background: var(--bg-hover);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}
.message-item.self .msg-link .link-thumb { background: rgba(255,255,255,0.2); }
.msg-note {
  background: #FFFDEB;
  border-left: 3px solid #FA9D3B;
  padding: 12px 16px;
  border-radius: 8px;
  min-width: 200px;
}
.msg-note .note-label { font-size: 12px; color: #FA9D3B; margin-bottom: 4px; }

/* Chat Input */
.chat-input {
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 16px 24px;
}
.input-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.tool-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
}
.tool-btn:hover { background: var(--bg-hover); border-color: var(--primary); }
.tool-btn.active { background: var(--primary-light); border-color: var(--primary); }
.input-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.input-row textarea {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  border-radius: 12px;
}
.send-btn {
  padding: 10px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}
.send-btn:hover { background: var(--primary-dark); }
.send-btn:disabled { background: var(--text-tertiary); cursor: not-allowed; }

/* Link/Note input panels */
.input-panel {
  background: var(--bg-hover);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: slideDown 0.2s ease;
}
.input-panel input, .input-panel textarea {
  background: #fff;
}

/* Empty state */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  gap: 12px;
}
.empty-state .icon { font-size: 64px; opacity: 0.5; }

/* ===== Search Panel ===== */
.search-panel {
  position: absolute;
  top: 0;
  left: 260px;
  right: 0;
  bottom: 0;
  background: #fff;
  z-index: 50;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.2s ease;
}
.search-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.search-input {
  flex: 1;
  padding: 10px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: #FAFAFA;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.search-input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}
.search-filters {
  display: flex;
  gap: 8px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-wrap: wrap;
}
.search-filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--bg-hover);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.search-filter-chip:hover { background: var(--primary-light); }
.search-filter-chip.active {
  background: var(--primary);
  color: #fff;
}
.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}
.search-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
  font-size: 15px;
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid var(--border);
}
.search-result-item:hover { background: var(--bg-hover); }
.search-result-icon { font-size: 24px; flex-shrink: 0; }
.search-result-info { flex: 1; min-width: 0; }
.search-result-preview {
  font-size: 14px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-time { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.search-result-preview mark {
  background: #FFF3B0;
  color: inherit;
  border-radius: 2px;
  padding: 0 2px;
}

/* Message highlight when located from search */
.message-highlight {
  animation: highlightPulse 2s ease;
}
@keyframes highlightPulse {
  0% { background: var(--primary-light); }
  100% { background: transparent; }
}

/* ===== View Panels (Notes / Favorites) ===== */
.view-panel {
  position: absolute;
  top: 0;
  left: 260px;
  right: 0;
  bottom: 0;
  background: #F7F8FA;
  display: flex;
  flex-direction: column;
  z-index: 40;
  animation: fadeIn 0.2s ease;
}
.view-header {
  height: 60px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.view-header .title { font-size: 17px; font-weight: 600; }
.view-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-content: flex-start;
}

/* Notes cards */
.note-card-web {
  background: #fff;
  border-radius: 12px;
  padding: 16px 20px;
  width: 320px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
  border-left: 3px solid var(--primary);
}
.note-card-web:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); transform: translateY(-2px); }
.note-card-web-title { font-weight: 600; font-size: 15px; margin-bottom: 8px; color: var(--text-primary); }
.note-card-web-content { font-size: 13px; color: var(--text-secondary); line-height: 1.6; white-space: pre-wrap; word-break: break-word; max-height: 120px; overflow: hidden; }
.note-card-web-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.note-card-web-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.note-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--primary-light);
  color: var(--primary);
}
.note-card-web-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-tertiary); }
.note-card-web-del {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.2s;
}
.note-card-web-del:hover { background: #FFF0F0; }

/* Notes View Header Actions */
.view-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-btn {
  padding: 6px 12px;
  border: 1.5px solid #E5E5EA;
  background: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #1c1c1e;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.header-btn:hover {
  border-color: #07C160;
  color: #07C160;
}
.fav-group-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1px solid #E5E5EA;
  border-radius: 8px;
  margin-bottom: 8px;
}
.fav-group-item-name {
  font-size: 14px;
  font-weight: 600;
}
.fav-group-item-count {
  font-size: 12px;
  color: #8E8E93;
  margin-left: 8px;
}
.fav-group-item-actions {
  display: flex;
  gap: 6px;
}
.fav-group-item-actions button {
  padding: 4px 10px;
  border: 1px solid #E5E5EA;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  background: #fff;
  color: #1c1c1e;
}
.fav-group-item-actions button:hover {
  border-color: #07C160;
  color: #07C160;
}
.fav-group-item-actions button.danger:hover {
  border-color: #FF3B30;
  color: #FF3B30;
}
.move-fav-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid #E5E5EA;
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}
.move-fav-option:hover {
  border-color: #07C160;
  background: #F0FBF4;
}
.move-fav-option.selected {
  border-color: #07C160;
  background: #E8F5E9;
}
.note-layout-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg-hover);
  border-radius: 8px;
  padding: 3px;
}
.layout-btn {
  width: 30px; height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  font-size: 15px;
  color: var(--text-secondary);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.layout-btn.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.note-columns-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-hover);
  border-radius: 8px;
  padding: 3px 6px;
}
.note-columns-toggle.hidden { display: none; }
.columns-label { font-size: 12px; color: var(--text-secondary); margin-right: 2px; }
.col-btn {
  width: 24px; height: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.col-btn.active {
  background: var(--primary);
  color: #fff;
}

/* Notes Tags Bar */
.note-tags-bar {
  display: flex;
  gap: 8px;
  padding: 10px 24px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-wrap: wrap;
  min-height: 0;
}
.note-tags-bar:empty { display: none; }
.note-tag-chip {
  padding: 5px 14px;
  border-radius: 20px;
  background: var(--bg-hover);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.note-tag-chip:hover { background: var(--primary-light); color: var(--primary); }
.note-tag-chip.active {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
}
.note-tag-chip .tag-count { font-size: 11px; opacity: 0.7; margin-left: 4px; }

/* Notes List Mode */
.note-card-web.list-mode {
  padding: 12px 16px;
  border-radius: 10px;
}
.note-card-web.list-mode.cols-2 { width: calc(50% - 8px); }
.note-card-web.list-mode.cols-3 { width: calc(33.333% - 11px); }
.note-card-web.list-mode .note-card-web-title {
  font-size: 14px;
  margin-bottom: 4px;
  overflow: visible;
  white-space: normal;
  word-break: break-word;
}
.note-card-web.list-mode .note-card-web-content {
  font-size: 12px;
  line-height: 1.4;
  max-height: 20px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.note-card-web.list-mode .note-card-web-footer {
  margin-top: 8px;
}
.note-card-web.list-mode .note-card-web-tags { gap: 4px; }
.note-card-web.list-mode .note-tag { font-size: 10px; padding: 1px 6px; }

/* ===== Full Note Editor ===== */
.note-full-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #F7F8FA;
  gap: 0;
}
.note-full-editor.hidden { display: none; }
.note-fe-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.note-fe-title-input {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  caret-color: #1c1c1e;
  transition: border-color 0.2s;
}
.note-fe-title-input:focus { outline: none; border-color: var(--primary); }
.note-fe-tags-input {
  width: 200px;
  flex-shrink: 0;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  transition: border-color 0.2s;
}
.note-fe-tags-input:focus { outline: none; border-color: var(--primary); }
.note-fe-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px 10px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  flex-shrink: 0;
}
.note-fe-toolbar.hidden { display: none; }

/* View mode — readonly inputs look like plain text */
.note-fe-title-input[readonly], .note-fe-tags-input[readonly] {
  background: transparent;
  border-color: transparent;
  cursor: default;
  font-weight: 700;
}
.note-fe-tags-input[readonly] {
  font-weight: 400;
  font-size: 13px;
  color: var(--text-secondary);
}
/* View mode — content area allows text selection but not editing */
.note-fe-content.view-mode {
  /* 查看模式同样用自定义黑色鼠标光标，避免白底上系统白色指针看不见 */
  cursor: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%3E%3Cpath%20d='M5%203%20L5%2023%20L10%2018%20L13%2025%20L16%2024%20L13%2017%20L20%2017%20Z'%20fill='black'%20stroke='white'%20stroke-width='1.5'/%3E%3C/svg%3E") 5 3, text;
  -webkit-user-select: text;
  user-select: text;
}
.fe-tool-btn {
  width: 30px; height: 30px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  color: var(--text-primary);
}
.fe-tool-btn:hover { background: var(--bg-hover); }
.fe-divider { width: 1px; height: 18px; background: var(--border); margin: 0 3px; flex-shrink: 0; }
.fe-font-select, .fe-size-select {
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  background: #fff;
  cursor: pointer;
  color: var(--text-primary);
}
.fe-color-input {
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  background: #fff;
  padding: 2px;
}
.note-fe-content {
  flex: 1;
  min-height: 0;
  padding: 20px 28px;
  background: #fff;
  font-size: 15px;
  line-height: 1.8;
  outline: none;
  overflow-y: auto;
  color: var(--text-primary);
  caret-color: #1c1c1e; /* 强制文本光标为深色，避免白底时看不见 */
  /* 自定义黑色鼠标光标（带白描边），解决白底上系统白色指针看不见的问题 */
  cursor: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%3E%3Cpath%20d='M5%203%20L5%2023%20L10%2018%20L13%2025%20L16%2024%20L13%2017%20L20%2017%20Z'%20fill='black'%20stroke='white'%20stroke-width='1.5'/%3E%3C/svg%3E") 5 3, text;
  word-break: break-word;
}
/* 笔记内容区所有子元素统一使用黑色鼠标光标（图片/链接等 pointer 手型在白底会变白看不见） */
.note-fe-content * { cursor: inherit; }
.note-fe-content:empty::before {
  content: attr(data-placeholder);
  color: var(--text-tertiary);
  pointer-events: none;
}
.note-fe-content:focus { border-color: var(--primary); }
.note-fe-content blockquote {
  border-left: 3px solid var(--primary);
  margin: 8px 0;
  padding: 4px 16px;
  color: var(--text-secondary);
  background: var(--bg-hover);
  border-radius: 0 6px 6px 0;
}
.note-fe-content ul, .note-fe-content ol {
  padding-left: 24px;
  margin: 8px 0;
}

/* Favorites cards */
.fav-card-web {
  background: #fff;
  border-radius: 12px;
  padding: 16px 20px;
  width: 340px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fav-card-web-type { font-size: 13px; color: var(--text-secondary); }
.fav-type-label { color: var(--text-tertiary); margin-left: 4px; text-transform: uppercase; font-size: 11px; }
.fav-card-web-body { font-size: 14px; color: var(--text-primary); word-break: break-word; }
.fav-card-web-body img { display: block; margin-top: 4px; }
.fav-file { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.fav-link-info { display: flex; flex-direction: column; gap: 4px; }
.fav-link-title { font-weight: 500; }
.fav-link-url { font-size: 12px; color: var(--text-tertiary); }
.fav-card-web-footer { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); padding-top: 10px; }
.fav-time { font-size: 12px; color: var(--text-tertiary); }
.fav-actions { display: flex; gap: 8px; align-items: center; }
.fav-open-link { font-size: 13px; color: var(--primary); text-decoration: none; }
.fav-open-link:hover { text-decoration: underline; }
.fav-link-card { cursor: pointer; }
.fav-link-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.12); }
.fav-link-card:hover .fav-text-link { text-decoration: underline; }
/* 文本收藏内容本身就是网址时，用主题色提示"可点击打开" */
.fav-text-link { color: var(--primary); word-break: break-all; }
/* 收藏卡片自定义标题（重命名后显示，便于快速识别） */
.fav-card-web-title { font-weight: 600; font-size: 14px; color: var(--text-primary); margin: 6px 0 4px; word-break: break-all; line-height: 1.4; }
.fav-renamed-tag { font-size: 11px; color: var(--text-tertiary); font-weight: normal; margin-left: 4px; }
.fav-unstar-btn {
  font-size: 13px;
  color: var(--danger);
  background: transparent;
  border: 1px solid var(--danger);
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.fav-unstar-btn:hover { background: var(--danger); color: #fff; }

/* Favorites List Mode */
.fav-card-web.list-mode {
  padding: 12px 14px;
  border-radius: 10px;
}
.fav-card-web.list-mode.cols-2 { width: calc(50% - 8px); }
.fav-card-web.list-mode.cols-3 { width: calc(33.333% - 11px); }
.fav-card-web.list-mode .fav-card-web-type { font-size: 12px; }
.fav-card-web.list-mode .fav-card-web-body { font-size: 13px; }
.fav-card-web.list-mode .fav-card-web-body img { max-width: 100px; }
.fav-card-web.list-mode .fav-card-web-body video { max-width: 160px; }
.fav-card-web.list-mode .fav-card-web-footer { padding-top: 6px; }
.fav-card-web.list-mode .fav-time { font-size: 11px; }
.fav-card-web.list-mode .fav-unstar-btn { font-size: 12px; padding: 2px 8px; }

/* ===== Modal Overlay ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal-card {
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  width: 560px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal-card-sm { width: 400px; }
.modal-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.modal-desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 20px; line-height: 1.6; }
.modal-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: #FAFAFA;
  box-sizing: border-box;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}
.modal-input:focus { outline: none; border-color: var(--primary); background: #fff; }
.modal-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: #FAFAFA;
  box-sizing: border-box;
  resize: vertical;
  font-family: inherit;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}
.modal-textarea:focus { outline: none; border-color: var(--primary); background: #fff; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* Btn danger */
.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-danger:hover { opacity: 0.85; }

/* ===== Todo Cards (Web) ===== */
.todo-card-web {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: box-shadow 0.2s;
}
.todo-card-web:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.todo-card-web.done .todo-card-web-text { text-decoration: line-through; color: var(--text-tertiary); }
.todo-card-web-check {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}
.todo-card-web-check.done {
  background: var(--primary);
  border-color: var(--primary);
}
.todo-card-web-check.done::after { content: '✓'; color: #fff; font-size: 14px; }
.todo-card-web-body { flex: 1; min-width: 0; cursor: pointer; }
.todo-card-web-text { font-size: 15px; word-break: break-word; }
.todo-card-web-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 12px; color: var(--text-tertiary); }
.todo-card-web-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.todo-card-web-reminder { color: var(--warning); }
.todo-card-web-del {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s;
  flex-shrink: 0;
}
.todo-card-web-del:hover { background: #FFF0F0; }
.todo-card-web.dragging { opacity: 0.45; }
.todo-card-web.drag-over { border: 2px dashed var(--primary); }

/* Todo List Mode */
.todo-card-web.list-mode {
  padding: 10px 12px;
  border-radius: 10px;
  max-width: none;
}
.todo-card-web.list-mode.cols-2 { width: calc(50% - 8px); }
.todo-card-web.list-mode.cols-3 { width: calc(33.333% - 11px); }
.todo-card-web.list-mode .todo-card-web-text {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.todo-card-web.list-mode .todo-card-web-meta {
  margin-top: 2px;
  font-size: 11px;
}
.todo-card-web.list-mode .todo-card-web-check {
  width: 18px; height: 18px;
}
.todo-card-web.list-mode .todo-card-web-del {
  font-size: 14px;
  padding: 2px 4px;
}

/* Color picker dots (Web todo editor) */
.todo-color-picker-web {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.color-dot-web {
  width: 24px; height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border 0.2s;
}
.color-dot-web.selected { border-color: var(--text-primary); }
.color-dot-web.cd-default { background: #ccc; }
.color-dot-web.cd-red { background: #e74c3c; }
.color-dot-web.cd-orange { background: #f39c12; }
.color-dot-web.cd-blue { background: #3498db; }
.color-dot-web.cd-green { background: #07C160; }
.color-dot-web.cd-purple { background: #9b59b6; }

/* ===== Context Menu (Right-Click) ===== */
.context-menu {
  position: fixed;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  z-index: 2000;
  min-width: 140px;
  overflow: hidden;
  animation: fadeIn 0.15s ease;
}
.context-menu-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border-light);
}
.context-menu-item:last-child { border-bottom: none; }
.context-menu-item:hover { background: var(--bg-hover); }
.context-menu-item.danger { color: var(--danger); }
.context-menu-item.danger:hover { background: #FFF0F0; }
