/* ===== 全局变量与重置 ===== */
:root {
  --bg-paper: #FAF8F5;
  --bg-sidebar: #F0EDE8;
  --bg-card: #FFFFFF;
  --text-primary: #2C3E50;
  --text-secondary: #7F8C8D;
  --text-muted: #BDC3C7;
  --accent: #E67E22;
  --accent-light: #FDF2E9;
  --border: #E0DCD5;
  --border-light: #EDEAE5;
  --shadow-sm: 0 1px 3px rgba(44, 62, 80, 0.06);
  --shadow-md: 0 4px 12px rgba(44, 62, 80, 0.08);
  --shadow-lg: 0 8px 24px rgba(44, 62, 80, 0.12);
  --q1-color: #E74C3C;
  --q1-bg: #FDEDEC;
  --q2-color: #2980B9;
  --q2-bg: #EBF5FB;
  --q3-color: #F39C12;
  --q3-bg: #FEF9E7;
  --q4-color: #95A5A6;
  --q4-bg: #F4F6F6;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --font-serif: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
  --font-sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-paper);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea {
  font-family: inherit;
  outline: none;
  border: none;
  background: none;
  color: inherit;
}

/* ===== 顶部导航栏 ===== */
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-logo {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  color: var(--accent);
}

.app-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 1px;
}

.view-switcher {
  display: flex;
  gap: 4px;
  background: var(--bg-sidebar);
  padding: 4px;
  border-radius: var(--radius-md);
}

.view-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.view-btn:hover {
  color: var(--text-primary);
}

.view-btn.active {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.topbar-right {
  display: flex;
  align-items: center;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-sidebar);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  width: 240px;
  transition: all 0.2s ease;
}

.search-box:focus-within {
  background: var(--bg-card);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.search-box svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-box input {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

/* ===== 视图切换 ===== */
.view {
  display: none;
  height: calc(100vh - 56px);
}

.view.active {
  display: flex;
}

/* ===== 笔记视图 ===== */
.notes-view {
  width: 100%;
}

.sidebar {
  width: 280px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
  flex-shrink: 0;
}

/* 螺旋装订线签名元素 */
.sidebar::before {
  content: '';
  position: absolute;
  right: -1px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: repeating-linear-gradient(
    to bottom,
    var(--border) 0px,
    var(--border) 8px,
    transparent 8px,
    transparent 16px
  );
}

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

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: #D35400;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  padding: 9px 20px;
  background: var(--bg-sidebar);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--border);
  color: var(--text-primary);
}

.note-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.note-list::-webkit-scrollbar {
  width: 4px;
}

.note-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.note-item {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 2px;
  position: relative;
}

.note-item:hover {
  background: rgba(255, 255, 255, 0.6);
}

.note-item.active {
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.note-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.note-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.note-item-preview {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-item-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

.note-item-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* 编辑区 */
.editor-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-paper);
  position: relative;
  overflow: hidden;
}

/* 纸张纹理 */
.editor-area::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--border-light) 1px, transparent 1px);
  background-size: 100% 28px;
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

.editor-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 16px;
  position: relative;
  z-index: 1;
}

.editor-empty svg {
  opacity: 0.5;
}

.editor-empty p {
  font-size: 14px;
}

.editor-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px 12px;
  border-bottom: 1px solid var(--border-light);
  gap: 16px;
}

.note-title-input {
  flex: 1;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

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

.editor-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: var(--bg-sidebar);
  color: var(--text-primary);
}

.icon-btn.danger:hover {
  background: var(--q1-bg);
  color: var(--q1-color);
}

.editor-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.note-content-input {
  flex: 1;
  padding: 20px 32px;
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-primary);
  resize: none;
  font-family: var(--font-sans);
}

.note-content-input::placeholder {
  color: var(--text-muted);
}

.note-preview {
  flex: 1;
  padding: 20px 32px;
  overflow-y: auto;
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-primary);
}

.note-preview h1, .note-preview h2, .note-preview h3 {
  font-family: var(--font-serif);
  margin: 20px 0 12px;
  color: var(--text-primary);
}

.note-preview h1 { font-size: 24px; }
.note-preview h2 { font-size: 20px; }
.note-preview h3 { font-size: 17px; }

.note-preview p {
  margin-bottom: 12px;
}

.note-preview ul, .note-preview ol {
  margin: 12px 0;
  padding-left: 24px;
}

.note-preview li {
  margin-bottom: 6px;
}

.note-preview blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  margin: 16px 0;
  color: var(--text-secondary);
  font-style: italic;
}

.note-preview code {
  background: var(--bg-sidebar);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: 'Consolas', 'Monaco', monospace;
}

.note-preview pre {
  background: var(--text-primary);
  color: #ECF0F1;
  padding: 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 16px 0;
}

.note-preview pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.note-preview a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
}

.note-preview strong {
  font-weight: 700;
}

.note-preview em {
  font-style: italic;
}

.note-preview hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

.editor-status {
  display: flex;
  justify-content: space-between;
  padding: 8px 32px;
  border-top: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== 四象限待办视图 ===== */
.todos-view {
  flex-direction: column;
  padding: 24px 32px;
  overflow-y: auto;
  width: 100%;
}

.todos-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  flex-shrink: 0;
}

.todos-title-group h2 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.todos-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

.todos-stats {
  display: flex;
  gap: 32px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-num {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.quadrant-wrapper {
  flex: 1;
  position: relative;
  padding: 24px 0 0 24px;
  min-height: 0;
}

.axis-label {
  position: absolute;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 2px;
}

.axis-top {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.axis-left {
  left: 0;
  top: 50%;
  transform: translateY(-50%) rotate(180deg);
}

.quadrant-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 16px;
  height: 100%;
  min-height: 500px;
}

.quadrant {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: all 0.2s ease;
  overflow: hidden;
}

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

.quadrant-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.q-badge {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.q1-badge { background: var(--q1-bg); color: var(--q1-color); }
.q2-badge { background: var(--q2-bg); color: var(--q2-color); }
.q3-badge { background: var(--q3-bg); color: var(--q3-color); }
.q4-badge { background: var(--q4-bg); color: var(--q4-color); }

.q-info {
  flex: 1;
}

.q-info h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.q-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.q-add-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.q-add-btn:hover {
  background: var(--bg-sidebar);
  color: var(--text-primary);
}

.task-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-list::-webkit-scrollbar {
  width: 4px;
}

.task-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.task-card {
  background: var(--bg-paper);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  position: relative;
}

.task-card:hover {
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.q1 .task-card { border-left-color: var(--q1-color); }
.q2 .task-card { border-left-color: var(--q2-color); }
.q3 .task-card { border-left-color: var(--q3-color); }
.q4 .task-card { border-left-color: var(--q4-color); }

.task-card.done {
  opacity: 0.5;
}

.task-card.done .task-title {
  text-decoration: line-through;
}

.task-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.task-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.task-checkbox:hover {
  border-color: var(--accent);
}

.task-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.task-checkbox.checked svg {
  display: block;
}

.task-checkbox svg {
  display: none;
  color: #fff;
}

.task-content {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.5;
  word-break: break-word;
}

.task-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.5;
  word-break: break-word;
}

.task-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}

.task-card:hover .task-actions {
  opacity: 1;
}

.task-action-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.task-action-btn:hover {
  background: var(--bg-sidebar);
  color: var(--text-primary);
}

.task-action-btn.delete:hover {
  background: var(--q1-bg);
  color: var(--q1-color);
}

.task-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

/* 象限移动菜单 */
.task-move-menu {
  position: absolute;
  right: 0;
  top: 100%;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  padding: 4px;
  z-index: 100;
  min-width: 140px;
}

.task-move-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 4px;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.task-move-menu button:hover {
  background: var(--bg-sidebar);
  color: var(--text-primary);
}

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 62, 80, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 440px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.modal-close:hover {
  background: var(--bg-sidebar);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 24px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  transition: all 0.2s ease;
  background: var(--bg-paper);
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-group textarea {
  resize: vertical;
  min-height: 70px;
}

.quadrant-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.q-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

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

.q-option input {
  display: none;
}

.q-option span {
  flex: 1;
  text-align: center;
}

.q1-opt.selected {
  border-color: var(--q1-color);
  background: var(--q1-bg);
  color: var(--q1-color);
  font-weight: 500;
}

.q2-opt.selected {
  border-color: var(--q2-color);
  background: var(--q2-bg);
  color: var(--q2-color);
  font-weight: 500;
}

.q3-opt.selected {
  border-color: var(--q3-color);
  background: var(--q3-bg);
  color: var(--q3-color);
  font-weight: 500;
}

.q4-opt.selected {
  border-color: var(--q4-color);
  background: var(--q4-bg);
  color: var(--q4-color);
  font-weight: 500;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text-primary);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 2000;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .sidebar {
    width: 220px;
  }
  
  .search-box {
    width: 160px;
  }
  
  .quadrant-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  
  .todos-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 0 12px;
  }
  
  .app-title {
    display: none;
  }
  
  .search-box {
    width: 120px;
  }
  
  .sidebar {
    width: 180px;
  }
  
  .editor-toolbar,
  .editor-body textarea,
  .editor-body .note-preview,
  .editor-status {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* ===== 登录页面 ===== */
.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-paper);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  background-image: 
    radial-gradient(circle at 20% 30%, rgba(230, 126, 34, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(41, 128, 185, 0.05) 0%, transparent 50%);
}

.login-overlay.hidden {
  display: none;
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 360px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  text-align: center;
}

.login-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-light);
  border-radius: 50%;
  color: var(--accent);
}

.login-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.login-hint {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.login-input-group {
  margin-bottom: 16px;
}

.login-input-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  text-align: center;
  letter-spacing: 4px;
  background: var(--bg-paper);
  transition: all 0.2s ease;
}

.login-input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
  outline: none;
}

.login-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.login-btn:hover {
  background: #D35400;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.login-btn:active {
  transform: translateY(0);
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.login-error {
  color: var(--q1-color);
  font-size: 13px;
  margin-top: 12px;
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.login-tip {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 16px;
}

/* 加载状态 */
.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== 深色模式 ===== */
body.dark {
  --bg-paper: #1a1a2e;
  --bg-sidebar: #16213e;
  --bg-card: #0f3460;
  --text-primary: #e8e8e8;
  --text-secondary: #a0a0b0;
  --text-muted: #6c6c80;
  --accent: #f39c12;
  --accent-light: rgba(243, 156, 18, 0.15);
  --border: #2a2a4a;
  --border-light: #1f1f3a;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --q1-bg: rgba(231, 76, 60, 0.15);
  --q2-bg: rgba(41, 128, 185, 0.15);
  --q3-bg: rgba(243, 156, 18, 0.15);
  --q4-bg: rgba(149, 165, 166, 0.15);
}

body.dark .editor-area::before {
  background-image: linear-gradient(var(--border-light) 1px, transparent 1px);
  opacity: 0.3;
}

body.dark .login-overlay {
  background: var(--bg-paper);
}

body.dark .task-card {
  background: var(--bg-sidebar);
}

body.dark .form-group input[type="text"],
body.dark .form-group textarea {
  background: var(--bg-paper);
  color: var(--text-primary);
}

body.dark .q-option {
  background: var(--bg-paper);
}

/* ===== 图片预览样式 ===== */
.note-preview img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 12px 0;
  box-shadow: var(--shadow-sm);
}

.note-content-input {
  line-height: 1.8;
}

.mobile-section-heading,
.mobile-back-btn {
  display: none;
}

/* 手机端：底部导航、卡片列表和独立编辑页 */
@media (max-width: 640px) {
  html, body {
    height: 100dvh;
  }

  .topbar {
    height: 104px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    grid-template-rows: 44px 40px;
    align-content: center;
    gap: 4px 8px;
    padding: 8px 16px;
  }

  .topbar-left {
    grid-column: 1;
    grid-row: 1;
  }

  .app-title {
    display: block;
    font-family: var(--font-sans);
    font-size: 18px;
    letter-spacing: 0;
  }

  .topbar-right {
    display: contents;
  }

  #themeToggle {
    grid-column: 2;
    grid-row: 1;
    width: 44px;
    height: 44px;
  }

  .search-box {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    height: 40px;
    border-radius: 12px;
  }

  .search-box input {
    min-width: 0;
    font-size: 16px;
  }

  .view-switcher {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    height: calc(66px + env(safe-area-inset-bottom));
    padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border-light);
    border-radius: 0;
    background: var(--bg-card);
    box-shadow: 0 -4px 16px rgba(44, 62, 80, 0.06);
  }

  .view-btn {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 4px;
    border-radius: 12px;
    font-size: 11px;
    line-height: 1.2;
  }

  .view-btn svg {
    width: 21px;
    height: 21px;
  }

  .view-btn.active {
    background: var(--accent-light);
    box-shadow: none;
  }

  .view.active {
    height: calc(100vh - 170px - env(safe-area-inset-bottom));
    height: calc(100dvh - 170px - env(safe-area-inset-bottom));
  }

  body.mobile-editor-open .topbar {
    height: 60px;
    grid-template-rows: 44px;
  }

  body.mobile-editor-open .search-box {
    display: none;
  }

  body.mobile-editor-open .view.active {
    height: calc(100vh - 126px - env(safe-area-inset-bottom));
    height: calc(100dvh - 126px - env(safe-area-inset-bottom));
  }

  .notes-view {
    overflow: hidden;
  }

  .sidebar {
    width: 100%;
    border-right: 0;
    background: var(--bg-paper);
  }

  .sidebar::before {
    display: none;
  }

  .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 6px;
    border: 0;
  }

  .mobile-section-heading {
    display: block;
    font-size: 21px;
    font-weight: 700;
    color: var(--text-primary);
  }

  .sidebar-header .btn-primary {
    width: auto;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 14px;
  }

  .note-list {
    padding: 8px 16px 20px;
  }

  .note-item {
    min-height: 88px;
    margin-bottom: 10px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
  }

  .note-item.active {
    border-color: var(--accent);
  }

  .note-item.active::before {
    display: none;
  }

  .note-item-title {
    font-size: 16px;
  }

  .note-item-preview {
    font-size: 13px;
  }

  .sidebar-footer {
    border: 0;
    padding: 8px 16px 12px;
  }

  .notes-view .editor-area {
    display: none;
  }

  .notes-view.mobile-editor-open .sidebar {
    display: none;
  }

  .notes-view.mobile-editor-open .editor-area {
    display: flex;
    width: 100%;
  }

  .editor-area::before {
    display: none;
  }

  .editor-container {
    min-height: 0;
  }

  .editor-toolbar {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 8px;
    padding: 10px 16px;
  }

  .mobile-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    color: var(--accent);
    background: var(--accent-light);
  }

  .note-title-input {
    min-width: 0;
    width: 100%;
    font-size: 20px;
  }

  .editor-actions {
    grid-column: 1 / -1;
    justify-content: space-around;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background: var(--bg-card);
  }

  .editor-actions .icon-btn {
    width: 44px;
    height: 42px;
  }

  .editor-body .note-content-input,
  .editor-body .note-preview {
    padding: 18px;
    font-size: 16px;
  }

  .editor-status {
    padding: 10px 16px;
  }

  .todos-view {
    padding: 16px 16px 24px;
  }

  .todos-header {
    gap: 16px;
    margin-bottom: 16px;
  }

  .todos-title-group h2 {
    font-size: 21px;
  }

  .todos-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .stat-item {
    padding: 10px 4px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background: var(--bg-card);
  }

  .stat-num {
    font-size: 22px;
  }

  .quadrant-wrapper {
    flex: none;
    min-height: 0;
    padding: 0;
  }

  .axis-label {
    display: none;
  }

  .quadrant-grid {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    height: auto;
    min-height: 0;
    gap: 12px;
  }

  .quadrant {
    min-height: 170px;
    overflow: visible;
    padding: 14px;
  }

  .task-list {
    overflow: visible;
  }

  .q-add-btn,
  .task-action-btn {
    width: 44px;
    height: 44px;
  }

  .task-actions {
    opacity: 1;
  }

  .task-top {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    column-gap: 10px;
    align-items: start;
  }

  .task-content {
    grid-column: 2;
  }

  .task-actions {
    grid-column: 2;
    justify-content: flex-end;
    margin-top: 4px;
  }

  .task-checkbox {
    width: 26px;
    height: 26px;
  }

  .task-card {
    padding: 12px;
  }

  .modal-overlay {
    align-items: flex-end;
  }

  .modal {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom);
    border-radius: 22px 22px 0 0;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .modal-footer {
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
  }

  .modal-footer .btn-primary {
    width: auto;
    min-height: 44px;
  }

  .form-group input[type="text"],
  .form-group textarea {
    font-size: 16px;
  }

  .login-card {
    width: calc(100% - 32px);
    max-width: 420px;
    padding: 32px 24px;
  }

  .login-input-group input {
    min-height: 48px;
    font-size: 16px;
  }

  .login-btn {
    min-height: 48px;
  }

  .toast {
    bottom: calc(78px + env(safe-area-inset-bottom));
    max-width: calc(100% - 32px);
    text-align: center;
  }
}
