:root {
  color-scheme: light;
  --blue: #2563eb;
  --blue-strong: #1d4ed8;
  --ink: #0f172a;
  --text: #374151;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e6e8eb;
  --soft-line: #eef1f5;
  --shell: #f8fafc;
  --card: #ffffff;
  --hover: #f4f7ff;
  --active: #e7f0ff;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --radius: 12px;
  --topbar-height: 64px;
  --font-ui: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1120px;
  min-height: 100vh;
  background: var(--shell);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: var(--font-ui);
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.app-shell {
  height: 100vh;
  height: 100svh;
  min-height: 100vh;
  padding: 0 3px 24px;
  background:
    radial-gradient(circle at 18% 0, rgba(255, 255, 255, 0.95), transparent 32%),
    linear-gradient(180deg, #ffffff 0, #f8fafd 64px, var(--shell) 100%);
}

.topbar {
  height: var(--topbar-height);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 40%);
  gap: 16px;
  align-items: center;
}

.brand,
.top-actions,
.profile,
.search {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  align-items: center;
}

.logo {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 8px 18px rgba(18, 104, 244, 0.18);
}

.brand-copy {
  display: grid;
  gap: 4px;
}

.brand-name {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.1;
  font-weight: 750;
  letter-spacing: 0;
}

.search {
  width: 100%;
  height: 40px;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.7),
    0 4px 14px rgba(28, 44, 77, 0.04);
}

.search-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  display: grid;
  place-items: center;
  color: #516382;
}

.search-icon svg,
#settingsBtn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

.search input::placeholder {
  color: #667490;
}

/* 搜索框下拉结果 */
.search {
  position: relative;
}

.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  margin-top: 4px;
  background: #ffffff;
  border: 1px solid #dfe6f2;
  border-radius: 9px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(148, 163, 184, 0.1);
  max-height: 400px;
  overflow-y: auto;
  display: none;
}

.search-dropdown.open {
  display: block;
}

.search-dropdown .search-result-card {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.12s;
}

.search-dropdown .search-result-card:hover {
  background: #f4f8ff;
}

.search-dropdown .search-card-icon {
  flex-shrink: 0;
  font-size: 18px;
  margin-top: 1px;
  line-height: 1;
}

.search-dropdown .search-card-body {
  flex: 1;
  min-width: 0;
}

.search-dropdown .search-card-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  color: #0a1628;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-dropdown .search-card-title mark,
.search-dropdown .search-card-snippet mark {
  padding: 0 2px;
  border-radius: 3px;
  background: #fef08a;
  color: inherit;
}

.search-dropdown .search-card-snippet {
  font-size: 13px;
  line-height: 1.4;
  color: #61708d;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-dropdown .search-card-time {
  flex-shrink: 0;
  font-size: 12px;
  color: #94a3b8;
  white-space: nowrap;
  margin-top: 2px;
}

.search-dropdown .search-source {
  font-size: 12px;
  font-style: italic;
  color: #94a3b8;
  margin-top: 3px;
}

.search-dropdown .search-empty {
  padding: 32px 16px;
  text-align: center;
  color: #8a96ae;
  font-size: 14px;
}

.search-dropdown .search-stats {
  padding: 10px 12px 4px;
  font-size: 13px;
  color: #61708d;
  font-weight: 500;
  border-bottom: 1px solid #edf1f7;
}

.search-dropdown .search-group-title {
  padding: 8px 12px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--blue);
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 0;
}

.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #405172;
}

.new-note:hover {
  background: #eef4ff;
}

.profile {
  gap: 6px;
  height: 40px;
  padding: 0 4px;
  border-radius: 9px;
  color: #405172;
  font-size: 13px;
  font-weight: 600;
}

.avatar {
  flex: 0 0 45px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 35%, #2563eb 0 18%, transparent 19%),
    radial-gradient(circle at 50% 82%, #2563eb 0 31%, transparent 32%),
    linear-gradient(145deg, #edf5ff, #d7e8ff);
  display: grid;
  place-items: center;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  background-position: center;
  background-size: cover;
}

.avatar.has-image { color: transparent; background-color: #edf5ff; }

.profile-menu {
  position: fixed;
  z-index: 950;
  top: 58px;
  right: 10px;
  width: 218px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  box-shadow: 0 16px 38px rgba(30, 48, 80, .16);
}

.profile-menu-user { display: flex; flex-direction: column; gap: 4px; padding: 15px 16px 13px; border-bottom: 1px solid var(--soft-line); }
.profile-menu-user strong { color: var(--ink); }
.profile-menu-user span { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; }
.profile-menu button { width: 100%; padding: 10px 16px; text-align: left; }
.profile-menu button:hover { background: var(--hover); }
.profile-menu button.danger { color: #d94848; }

.workspace {
  height: calc(100vh - var(--topbar-height) - 24px);
  height: calc(100svh - var(--topbar-height) - 24px);
  min-height: 620px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 4px;
}

.capture-card,
.recent-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.capture-card {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.editor-header {
  min-width: 0;
  padding: 38px 44px 0;
  display: grid;
  gap: 3px;
}

.editor-title {
  width: min(620px, 100%);
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-size: 28px;
  line-height: 40px;
  font-weight: 700;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.editor-title.loaded {
  opacity: 1;
}

.editor-header-divider {
  width: 100%;
  height: 1px;
  background: var(--soft-line);
}

.editor-created-at {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 68px;
  color: #7d89a1;
  font-size: 14px;
  line-height: 68px;
  font-weight: 450;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.editor-created-at::before {
  content: "";
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 6.5A2.5 2.5 0 0 1 5.5 4h4.17c.66 0 1.3.27 1.77.73L13.7 7H18.5A2.5 2.5 0 0 1 21 9.5v7A2.5 2.5 0 0 1 18.5 19h-13A2.5 2.5 0 0 1 3 16.5v-10Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.editor-created-at.loaded {
  opacity: 1;
}

.capture-editor {
  min-height: 0;
  padding: 0px 44px 132px;
  outline: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
  color: var(--ink);
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  white-space: pre-wrap;
  word-break: break-word;
}

.capture-editor > .tiptap-editor-content {
  min-height: 100%;
  outline: none;
}

.capture-editor .tiptap-editor-content p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  color: #7d8bad;
  float: left;
  height: 0;
  pointer-events: none;
}



.capture-editor:focus {
  caret-color: #244063;
}

body.modal-open { overflow: hidden; }

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 24px max(24px, calc((100vw - 820px) / 2));
  background: rgba(24, 39, 65, 0.3);
  backdrop-filter: blur(4px);
}

.settings-overlay[hidden] { display: none; }

.settings-modal {
  width: min(820px, 100%);
  height: min(720px, calc(100vh - 48px));
  transform: translateY(-30px);
  overflow: hidden;
  border: 1px solid #dce5f3;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(33, 98, 255, 0.08);
}

.settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 30px 34px 24px;
  border-bottom: 1px solid #edf1f7;
}

.settings-header h2, .settings-section h3 { margin: 0; color: #18243a; }
.settings-header h2 { font-size: 26px; }
.settings-header p { margin: 5px 0 0; color: #7b879d; font-size: 13px; }
.settings-close { border: 0; background: transparent; color: #71809a; font-size: 28px; line-height: 1; }

.settings-layout { display: grid; grid-template-columns: 25% 75%; height: calc(100% - 104px); }
.settings-nav { padding: 24px 18px; display: flex; flex-direction: column; gap: 10px; background: #fbfcff; border-right: 1px solid #edf1f7; }
.settings-tab { position: relative; isolation: isolate; width: 100%; height: 60px; flex: 0 0 60px; padding: 0 22px; display: flex; align-items: center; gap: 14px; border: 0; border-radius: 12px; background: transparent; color: #26344b; text-align: left; font-size: 17px; transition: color .15s ease; }
.settings-tab::before { content: ""; position: absolute; inset: 2px; z-index: -1; border-radius: 10px; background: transparent; transition: background-color .15s ease; }
.settings-tab span { width: 22px; text-align: center; font-size: 22px; }
.settings-tab:hover:not(.active) { color: #1268ef; }
.settings-tab:hover:not(.active)::before { background: #f1f6ff; }
.settings-tab.active { color: #1268ef; font-weight: 600; }
.settings-tab.active::before { background: #e8f1ff; }
.settings-content { min-width: 0; overflow: auto; display: grid; grid-template-columns: minmax(0, 520px); justify-content: center; align-content: start; padding: 28px 36px 34px; }
.settings-content > .settings-section { width: 100%; }
.settings-section h3 { font-size: 22px; }
.settings-description { margin: 9px 0 22px; color: #7c899f; font-size: 14px; }
[data-settings-section="profile"] > .settings-description { font-size: 13px; }

.profile-form { display: grid; grid-template-columns: 1fr; gap: 14px; }
.profile-form label { display: grid; gap: 8px; color: #44516a; font-size: 13px; font-weight: 600; }
.profile-form input { width: 100%; height: 44px; box-sizing: border-box; padding: 0 13px; border: 1px solid #dbe3ef; border-radius: 9px; outline: 0; color: #1d293d; font: inherit; font-weight: 400; }
.profile-form input:focus { border-color: #2e76ef; box-shadow: 0 0 0 3px rgba(46,118,239,.1); }
.settings-message { grid-column: 1 / -1; min-height: 18px; margin: 0; font-size: 13px; }
.settings-message.success { color: #0c9d55; }
.settings-message.error, .trash-empty.error { color: #d64242; }
.settings-primary { grid-column: 1 / -1; justify-self: end; min-width: 112px; height: 42px; border: 0; border-radius: 9px; background: #1972f5; color: #fff; font-weight: 600; }
.profile-avatar-row { display: flex; align-items: center; gap: 18px; min-height: 96px; }
.profile-avatar-preview { flex: 0 0 92px; width: 92px; height: 92px; display: grid; place-items: center; border: 2px dashed transparent; border-radius: 50%; color: #fff; background: radial-gradient(circle at 50% 35%, #2563eb 0 18%, transparent 19%), radial-gradient(circle at 50% 82%, #2563eb 0 31%, transparent 32%), linear-gradient(145deg, #edf5ff, #d7e8ff); background-position: center; background-size: cover; font-size: 32px; font-weight: 700; overflow: hidden; }
.profile-avatar-preview.dragging { border-color: #176ff2; box-shadow: 0 0 0 5px rgba(23,111,242,.12); }
.profile-avatar-row > div { display: grid; gap: 8px; }
.profile-avatar-row p { margin: 0; color: #8a96a9; font-size: 13px; }
.avatar-upload-button { justify-self: start; height: 30px; padding: 0 12.5px; border: 1px solid #dce4ef; border-radius: 8px; background: #fff; color: #26344b; font-weight: 600; }
.profile-name-field { max-width: 520px; }
.profile-name-field > span { display: inline-flex; align-items: baseline; gap: 3px; }
.profile-name-field b { color: #ef4444; }
.binding-card { min-height: 72px; display: grid; grid-template-columns: 44px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 12px 18px; border: 1px solid #e0e6ef; border-radius: 11px; }
.binding-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: #26344b; background: #f0f5fd; font-size: 18px; }
.binding-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.binding-card > div { display: grid; gap: 5px; }
.binding-card strong { color: #26344b; font-size: 14px; }
.binding-card > div > span { color: #53617a; font-size: 14px; }
.binding-input { max-width: 420px; }
.binding-edit { min-width: 69px; height: 32px; border: 1px solid #dce4ef; border-radius: 9px; background: #f8faff; color: #26344b; font-weight: 600; }
.binding-code-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; max-width: 420px; }
.binding-code-row:not([hidden]) { display: grid; }
.binding-code-row button { min-width: 96px; border: 1px solid #cbd9ee; border-radius: 9px; background: #f3f7ff; color: #176ff2; font-weight: 600; }
.binding-code-row button:disabled { color: #8b98ac; cursor: not-allowed; }

.trash-list { display: grid; gap: 10px; }
.trash-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 16px; border: 1px solid #e4eaf3; border-radius: 11px; background: #fff; }
.trash-item > div:first-child { display: grid; min-width: 0; gap: 5px; }
.trash-item strong { overflow: hidden; color: #26344b; text-overflow: ellipsis; white-space: nowrap; }
.trash-item span { color: #8a96a9; font-size: 12px; }
.trash-actions { display: flex; gap: 8px; flex: none; }
.trash-actions button { padding: 7px 11px; border: 1px solid #cfdcef; border-radius: 7px; background: #f6f9ff; color: #216be1; }
.trash-actions button.danger { border-color: #f0d0d0; background: #fff7f7; color: #d34040; }
.trash-empty { padding: 56px 12px; color: #929db0; text-align: center; }

@media (max-width: 900px), (max-height: 640px) {
  .settings-overlay { padding: 12px; }
  .settings-modal {
    height: min(720px, calc(100dvh - 24px));
    transform: none;
  }
}

@media (max-width: 760px) {
  .settings-overlay { padding: 12px; }
  .settings-modal {
    height: min(720px, calc(100dvh - 24px));
    transform: none;
  }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid #edf1f7;
  }
  .settings-tab {
    height: 46px;
    min-width: 0;
    flex-basis: auto;
    justify-content: center;
    padding: 0 10px;
    text-align: center;
  }
  .settings-content { padding: 22px 18px; }
  .profile-form { grid-template-columns: 1fr; }
  .binding-card { padding-inline: 12px; }
  .trash-item { align-items: flex-start; flex-direction: column; }
}

.save-status {
  color: #7b879f;
  font-weight: 450;
}

.save-status.saving {
  color: var(--blue);
}

.save-status.error {
  color: #d84a35;
}

.recent-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 56px;
  overflow: hidden;
}

.recent-scroll {
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: 16px 12px;
  scrollbar-color: #c4cdda transparent;
  scrollbar-width: thin;
}

.recent-scroll::-webkit-scrollbar {
  width: 6px;
}

.recent-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #c4cdda;
}

.note-group {
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--soft-line);
}

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

.group-title {
  height: 30px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--blue);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
}

.group-toggle {
  margin-left: auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #6b7280;
}

.group-toggle:hover {
  background: #eef4ff;
  color: #374151;
}

.group-title .count {
  color: #667696;
  font-weight: 500;
}

.group-title .chevron {
  margin-left: auto;
  color: #637391;
}

.group-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.note-item {
  width: 100%;
  min-height: 48px;
  padding: 0 12px 0 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  border-radius: 7px;
  color: var(--ink);
  text-align: left;
  position: relative;
  transition:
    background 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.note-item:hover {
  background: var(--hover);
  box-shadow: 0 8px 18px rgba(37, 56, 91, 0.08);
  transform: translateY(-1px);
}

.note-item.active {
  background: var(--active);
}

.note-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 3px;
  background: var(--blue);
}



.note-summary {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  cursor: pointer;
}

.note-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.note-title mark {
  padding: 0 2px;
  border-radius: 3px;
  background: #fff0a8;
  color: inherit;
  pointer-events: none;
}

.note-dot {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  display: none;
  border-radius: 50%;
  background: var(--blue);
}

.note-item.active .note-dot {
  display: block;
}

.note-time {
  color: #7583a0;
  font-size: 12px;
  line-height: 18px;
  font-weight: 450;
}

.note-delete {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: #667696;
  background: transparent;
}

.note-delete svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.note-delete:hover,
.note-delete:focus-visible {
  color: #d64242;
  background: #fff0f0;
  outline: none;
}

.title-edit-input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 0;
  margin: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  line-height: inherit;
}

.record-action-menu {
  position: fixed;
  min-width: 112px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(28, 44, 77, 0.14);
  z-index: 10;
}

.record-action-menu button {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--text);
  text-align: left;
  font-size: 14px;
}

.record-action-menu button:hover {
  background: var(--hover);
}

.record-action-menu button.disabled {
  color: #9ca3af;
  cursor: not-allowed;
}

.record-action-menu button.disabled:hover {
  background: transparent;
}

.unnamed-divider {
  height: 1px;
  margin: 6px 0 2px;
  background: var(--soft-line);
}

.list-status {
  padding: 10px 0;
  color: #8b96ad;
  text-align: center;
  font-size: 13px;
}

.export-menu {
  position: fixed;
  min-width: 144px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(28, 44, 77, 0.14);
  z-index: 10;
}

.export-menu button {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--text);
  text-align: left;
}

.export-menu button:hover {
  background: var(--hover);
}

.empty-state {
  padding: 48px 12px;
  color: #8b96ad;
  text-align: center;
  line-height: 1.7;
}

.new-note {
  height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border-top: 1px solid var(--soft-line);
  color: var(--blue);
  background: rgba(255, 255, 255, 0.96);
  font-size: 14px;
  font-weight: 600;
}

@media (max-width: 1119px) {
  body {
    min-width: 0;
    overflow: auto;
  }

  .app-shell {
    height: auto;
    padding: 0 3px 18px;
  }

  .topbar {
    height: auto;
    min-height: var(--topbar-height);
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 10px 0;
  }

  .top-search {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .top-actions {
    gap: 8px;
  }

  .workspace {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .capture-card {
    min-height: min(620px, calc(100svh - 132px));
  }

  .capture-editor {
    overflow-y: visible;
  }

  .recent-panel {
    min-height: min(420px, 55svh);
  }
}

@media (max-width: 760px) {
  .logo {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }
  .avatar {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }
  .editor-header { padding: 26px 24px 0; }
  .capture-editor { padding: 22px 24px 132px; }
}


/* ==================== 搜索面板样式 ====================
 * 已通过 index.html <link> 标签引入 ../search/search-panel.css
 * 此处不再 @import 避免重复加载导致样式异常
 */

/* 强制确保搜索遮罩层默认隐藏（防 CSS 加载失败时泄漏到文档流） */
.search-overlay {
  display: none;
}

/* 图片可调整大小包装器 */
.image-resizable {
  position: relative;
  display: inline-block;
  max-width: calc(100% - 18px);
  margin: 10px 4px 0;
  border-radius: 0;
  line-height: 0;
  vertical-align: baseline;
  outline: none;
  transition: box-shadow 0.15s ease;
}

.image-resizable.active {
  box-shadow: 0 0 0 2px #7aa8ff;
}

.image-resizable img.editor-image,
.image-resizable img {
  display: block;
  max-width: 100%;
  height: auto !important;
  border-radius: 0;
  cursor: default;
  user-select: none;
}

/* 右下角拖拽热区 */
.resize-corner {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  background: transparent;
  opacity: 0;
  transform: scale(0.86);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 10;
}

/* 悬停图片时显示拖拽角标 */
.image-resizable:hover .resize-corner,
.image-resizable.active .resize-corner {
  opacity: 1;
  transform: scale(1);
}

.tiptap-image-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  display: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff;
  background: rgba(15, 23, 42, 0.72);
  font-size: 20px;
  line-height: 1;
}

.tiptap-image.active .tiptap-image-delete,
.tiptap-image:hover .tiptap-image-delete { display: grid; place-items: center; }

.tiptap-image.load-error {
  min-width: 180px;
  min-height: 96px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
}

.tiptap-image.load-error::after {
  content: "图片加载失败";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #7d89a1;
  font-size: 13px;
  line-height: 1;
}

/* 旧版本写入正文的透明手柄不再参与布局或点击。 */
.resize-handle {
  display: none !important;
}

.image-caret {
  display: inline-block;
  width: 1px;
  min-width: 1px;
  color: transparent;
  user-select: none;
  pointer-events: none;
  line-height: inherit;
  vertical-align: baseline;
}

.capture-editor table {
  width: 100%;
  margin: 14px 0;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.capture-editor .tableWrapper { overflow-x: auto; }
.capture-editor .selectedCell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: rgba(91, 146, 255, 0.12);
}

.capture-editor td,
.capture-editor th {
  min-width: 72px;
  padding: 3px 10px;
  border: 1px solid #dce3ef;
  vertical-align: top;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
}

.capture-editor td > p,
.capture-editor th > p {
  margin: 0;
}

.table-cell-content {
  display: block;
  width: 100%;
  outline: none;
  cursor: text;
  white-space: pre-wrap;
  word-break: break-word;
}

.capture-editor td:hover,
.capture-editor th:hover {
  background: #f7f9fc;
}

.capture-editor font[size="1"] { font-size: 12px; }
.capture-editor font[size="2"] { font-size: 14px; }
.capture-editor font[size="3"] { font-size: 16px; }
.capture-editor font[size="4"] { font-size: 18px; }
.capture-editor font[size="5"] { font-size: 24px; }
.capture-editor font[size="6"] { font-size: 32px; }
.capture-editor font[size="7"] { font-size: 48px; }
.capture-editor .editor-emoji-fixed { font-size: 16px; font-family: Apple Color Emoji, Segoe UI Emoji, sans-serif; }

.table-add-column,
.table-add-row {
  position: relative;
}

.table-add-col-btn {
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: #5b92ff;
  color: white;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 20;
  box-shadow: 0 2px 6px rgba(91, 146, 255, 0.4);
}

.table-add-row-btn {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: #5b92ff;
  color: white;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 20;
  box-shadow: 0 2px 6px rgba(91, 146, 255, 0.4);
}

.table-add-col-btn:hover,
.table-add-row-btn:hover {
  background: #2563eb;
  transform: translateY(-50%) scale(1.1);
}

.table-add-row-btn:hover {
  transform: translateX(-50%) scale(1.1);
}

.capture-editor td:hover .table-add-col-btn,
.capture-editor td:hover .table-add-row-btn {
  opacity: 1;
}

.table-add-col-btn::before {
  content: '';
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 60%;
  background: #5b92ff;
}

.table-add-row-btn::before {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: #5b92ff;
}

.table-add-col-btn::after {
  content: '插入列';
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 6px;
  background: #1f2937;
  color: white;
  font-size: 11px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.table-add-row-btn::after {
  content: '插入行';
  position: absolute;
  bottom: -32px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 6px;
  background: #1f2937;
  color: white;
  font-size: 11px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.table-add-col-btn:hover::after,
.table-add-row-btn:hover::after {
  opacity: 1;
}

.image-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(15, 20, 30, 0.88);
}

.image-preview-overlay img {
  max-width: 86vw;
  max-height: 86vh;
  object-fit: contain;
}

.preview-close,
.preview-prev,
.preview-next {
  position: fixed;
  z-index: 1001;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: white;
  background: rgba(255, 255, 255, 0.16);
  font-size: 30px;
}

.preview-close { top: 24px; right: 24px; }
.preview-prev { left: 24px; top: 50%; }
.preview-next { right: 24px; top: 50%; }

.table-edit-menu {
  position: fixed;
  z-index: 900;
  display: flex;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 10px 30px rgba(24, 39, 75, 0.16);
}

.table-edit-menu button {
  padding: 6px 9px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 12px;
}

.table-edit-menu button:hover { background: #f1f6ff; }

.line-command-menu[hidden],
.line-command-submenu[hidden] { display: none; }

.capture-editor ::selection,
.capture-editor::selection { color: var(--ink); background: #bfdbfe; }

.line-command-menu,
.line-command-submenu {
  position: fixed;
  z-index: 830;
  padding: 10px;
  border: 1px solid #e0e7f1;
  border-radius: 12px;
  color: #172a45;
  background: #fff;
  box-shadow: 0 18px 44px rgba(25, 43, 73, .16);
}
.line-command-menu {
  width: max-content;
  height: 64px;
  max-width: calc(100vw - 24px);
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 16px;
  border-color: #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .08);
}
.line-command-menu button,
.line-command-submenu button {
  display: flex;
  align-items: center;
  color: inherit;
  background: transparent;
}
.line-command-menu button {
  position: relative;
  width: 70px;
  min-width: 70px;
  height: 56px;
  min-height: 56px;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 3px 4px;
  border-radius: 8px;
  text-align: center;
  font-size: 12px;
}
.line-command-menu button:not(:last-child)::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 10px;
  width: 1px;
  height: 36px;
  background: #e5e7eb;
}
.line-command-menu button:hover { color: #2563eb; background: #eff6ff; }
.line-command-menu button.active { color: #2563eb; background: #eff6ff; }
.line-command-submenu button:hover { color: #1677ff; background: #edf4ff; }

.line-command-menu button > span { flex: none; }
.line-command-menu button > b { position: absolute; right: 8px; color: #999; font-size: 20px; font-weight: 400; line-height: 1; }
.line-command-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  color: #1f2937;
  font-size: 19px;
  font-style: normal;
  font-weight: 500;
  line-height: 1;
  text-align: center;
  vertical-align: middle;
}
.line-command-menu button:hover .line-command-icon { color: #1f2937; }
.line-command-menu button.active .line-command-icon { color: #2563eb; }
.line-command-icon sup { margin-left: 1px; font-size: 11px; }
.line-command-bold { font-weight: 800; }
.line-command-strike { text-decoration: line-through; }
.line-command-list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 24px;
  line-height: 1;
}
.line-command-list > span:first-child,
.line-command-list .list-num {
  width: 7px;
  height: 18px;
  flex: 0 0 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  font-size: 6px;
  line-height: 6px;
}
.line-command-list > span:first-child span {
  height: 6px;
  font-size: 6px;
  line-height: 6px;
}
.line-command-list .list-lines {
  width: 14px;
  height: 18px;
  flex: 0 0 14px;
  font-size: 0;
  background:
    linear-gradient(#1f2937, #1f2937) 0 1px / 14px 2px no-repeat,
    linear-gradient(#1f2937, #1f2937) 0 8px / 14px 2px no-repeat,
    linear-gradient(#1f2937, #1f2937) 0 15px / 14px 2px no-repeat;
}
.line-command-color {
  position: relative;
  color: #1f2937;
  --line-color: #FF4D42;
  font-size: 0;
  font-weight: 500;
  text-decoration: none;
}
.line-command-color::before {
  content: "A";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  font-size: 19px;
  line-height: 19px;
  text-align: center;
  color: #1f2937;
}
.line-command-color::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 2px;
  height: 3px;
  border-radius: 1px;
  background: var(--line-color, currentColor);
}
.line-command-table {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 0;
  vertical-align: middle;
}
.line-command-table::before {
  content: "";
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-radius: 3px;
  box-sizing: border-box;
  background:
    linear-gradient(currentColor, currentColor) 0 8px / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) 8px 0 / 2px 100% no-repeat;
}
.line-command-submenu.line-color-menu {
  width: fit-content;
  min-width: 170px;
  padding: 10px 10px 10px;
  border-color: #b9d4ff;
  border-radius: 4px;
  box-shadow: 0 10px 26px rgba(40, 92, 170, .25);
}
.line-color-menu::after,
.line-table-menu::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -9px;
  width: 16px;
  height: 16px;
  border-right: 1px solid #dce5f2;
  border-bottom: 1px solid #dce5f2;
  background: #fff;
  transform: translateX(-50%) rotate(45deg);
}
.line-color-heading { display: flex; align-items: center; justify-content: flex-start; }
.line-color-heading strong { color: #26344b; font-size: 11px; font-weight: 600; }
.line-color-swatches {
  display: grid;
  grid-template-columns: repeat(5, 26px);
  gap: 3px;
  margin-top: 5px;
  justify-content: center;
}
.line-color-swatches .line-color-swatch {
  width: 26px;
  min-height: 26px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  border: 1px solid rgba(15, 23, 42, .06);
  border-radius: 5px;
  color: transparent;
  background: var(--line-color);
  outline: none;
  cursor: pointer;
  box-sizing: border-box;
}
.line-color-swatches .line-color-swatch:hover { color: transparent; background: var(--line-color); transform: translateY(-1px); }
.line-color-swatches .line-color-swatch.active { color: #fff; border-color: var(--line-color); box-shadow: inset 0 0 0 1px rgba(255,255,255,.3); }
.line-color-swatches .line-color-swatch span { font-size: 14px; font-weight: 700; }
.line-color-menu::after { border-color: #b9d4ff; }

.line-command-submenu.line-table-menu {
  width: fit-content;
  min-width: 225px;
  padding: 10px 10px 10px;
  border-color: #b9d4ff;
  border-radius: 4px;
  box-shadow: 0 10px 26px rgba(40, 92, 170, .25);
}

.line-table-heading { display: flex; align-items: center; justify-content: flex-start; }
.line-table-heading strong { color: #26344b; font-size: 11px; font-weight: 600; }
.line-table-grid {
  display: grid;
  grid-template-columns: repeat(8, 23px);
  gap: 3px;
  margin-top: 5px;
  justify-content: center;
}
.line-table-grid button {
  width: 23px;
  min-height: 23px;
  padding: 0;
  border: 1px solid #ccd7e7;
  border-radius: 5px;
  background: #fff;
}
.line-table-grid button.active { border-color: #5b92ff; background: #e7f0ff; box-shadow: inset 0 0 0 1px #7aa8ff; }
.line-table-menu::after { border-color: #b9d4ff; }

.line-command-submenu.line-code-menu {
  width: fit-content;
  min-width: 120px;
  padding: 12px 12px 12px;
  border-color: #b9d4ff;
  border-radius: 4px;
  box-shadow: 0 10px 26px rgba(40, 92, 170, .25);
}
.line-code-heading { display: flex; align-items: center; justify-content: flex-start; }
.line-code-heading strong { color: #26344b; font-size: 11px; font-weight: 600; }
.line-code-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 5px;
}
.line-code-options button {
  padding: 6px 10px;
  border: 1px solid rgba(15, 23, 42, .06);
  border-radius: 5px;
  background: #fff;
  font-size: 11px;
  color: #26344b;
  text-align: left;
  cursor: pointer;
}
.line-code-options button:hover { background: #eff6ff; }
.line-code-options button.active { background: #e7f0ff; border-color: #5b92ff; color: #2563eb; }
.line-code-menu::after { border-color: #b9d4ff; }

.capture-editor .line-code-block {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 360px;
  max-height: 420px;
  margin: 18px 0;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: visible;
  background: #f5f6f7;
  box-shadow: 0 8px 24px rgba(38, 56, 82, 0.06);
  font-size: 0;
  line-height: 0;
  white-space: normal;
}

.tiptap-code-block .line-code-body pre {
  flex: 1;
  min-width: 0;
  min-height: 284px;
  margin: 0;
  padding: 14px 24px 36px 0;
  overflow: visible;
  color: #24292e;
  background: #f5f6f7;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 16px;
  line-height: 28px;
  white-space: pre;
  tab-size: 2;
}

.tiptap-code-block .line-code-body code {
  display: block;
  width: max-content;
  min-width: 100%;
  min-height: 100%;
  outline: none;
  user-select: text;
}
.line-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  min-height: 64px;
  padding: 0 20px;
  background: #f5f6f7;
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  color: #24292e;
  font-size: 16px;
  line-height: normal;
  z-index: 3;
  flex: 0 0 auto;
}
.line-code-block-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}
.line-code-collapse {
  position: relative;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #263852;
  cursor: pointer;
}
.line-code-collapse::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 4px;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 6px solid #8b949e;
  transition: transform 120ms ease;
}
.line-code-collapse:hover,
.line-code-collapse:focus-visible {
  color: #1677ff;
  outline: none;
}
.line-code-block.is-collapsed {
  min-height: 64px;
  max-height: 64px;
  box-shadow:
    0 8px 24px rgba(38, 56, 82, 0.06),
    0 2px 3px rgba(38, 56, 82, 0.12);
}
.line-code-block.is-collapsed .line-code-header {
  border-radius: 12px;
}
.line-code-block.is-collapsed .line-code-body {
  display: none;
}
.line-code-block.is-collapsed .line-code-collapse::before {
  transform: rotate(-90deg);
}
.line-code-block-icon {
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -2px;
}
.line-code-language-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 2;
}
.line-code-language {
  display: block;
  appearance: none;
  min-width: 0;
  min-height: 42px;
  padding: 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: #263852;
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.line-code-language-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  right: 0;
  z-index: 100;
  display: flex;
  width: 136px;
  padding: 6px;
  flex-direction: column;
  gap: 2px;
  background: #fff;
  border: 1px solid #dfe6f0;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
}
.line-code-language-dropdown[hidden] {
  display: none;
}
.line-code-language-dropdown button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 32px;
  padding: 5px 9px;
  color: #334155;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.line-code-language-dropdown button:hover {
  background: #f4f8ff;
}
.line-code-language-dropdown button.active {
  color: #1677ff;
  background: #eaf3ff;
}
.line-code-language-dropdown button.active::after {
  content: "✓";
  margin-left: auto;
  color: #1677ff;
}
.line-code-language-wrapper::after {
  content: "";
  flex: 0 0 9px;
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  box-sizing: border-box;
  pointer-events: none;
  transform: translateY(-2px) rotate(45deg);
}
.line-code-language:hover,
.line-code-language:focus {
  color: #1677ff;
  outline: none;
}
.line-code-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}
.line-code-body {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border-radius: 0 0 12px 12px;
  background: #f5f6f7;
}
.tiptap-editor-content > p:has(+ .tiptap-code-block),
.tiptap-code-block + p {
  min-height: 28px;
  cursor: text;
}
.line-code-line-numbers {
  position: sticky;
  left: 0;
  z-index: 1;
  box-sizing: border-box;
  flex: 0 0 73px;
  padding: 14px 10px 36px 20px;
  background: #f5f6f7;
  border-right: 0;
  text-align: right;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 16px;
  line-height: 28px;
  color: #8b949e;
  pointer-events: none;
  user-select: none;
  white-space: normal;
}
.tiptap-code-block.ProseMirror-selectednode {
  outline: 2px solid rgba(22, 119, 255, .55);
  outline-offset: 2px;
}
.line-code-line-numbers span {
  display: block;
}
.tiptap-code-block .hljs-keyword,
.tiptap-code-block .hljs-selector-tag,
.tiptap-code-block .hljs-title.function_,
.tiptap-code-block .hljs-built_in { color: #0969da; }
.tiptap-code-block .hljs-string,
.tiptap-code-block .hljs-attr,
.tiptap-code-block .hljs-template-variable { color: #1a7f37; }
.tiptap-code-block .hljs-number,
.tiptap-code-block .hljs-literal,
.tiptap-code-block .hljs-variable { color: #0550ae; }
.tiptap-code-block .hljs-comment,
.tiptap-code-block .hljs-quote { color: #6e7781; font-style: italic; }
.tiptap-code-block .hljs-tag,
.tiptap-code-block .hljs-name { color: #dc2626; }
