:root {
  color-scheme: light;
  --paper: #fff; --sidebar: #f3f5f7; --ink: #161c22; --muted: #747b82;
  --line: #e5e8eb; --green: #42754a; --green-hover: #345e3b; --selected: #e5eee4;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px; color: var(--ink); background: var(--paper);
  font-synthesis: none; -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
button, input { -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .5; cursor: wait; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
button { transition: background .15s, color .15s; }
[hidden] { display: none !important; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 22px; height: 22px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.primary { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 48px; padding: 10px 22px; border-radius: 8px; background: var(--green); color: white; font-size: 1.0625rem; font-weight: 600; }
.primary:hover { background: var(--green-hover); }
.secondary { border: 1px solid var(--line); border-radius: 8px; padding: 10px 20px; }
.secondary:hover { background: var(--sidebar); }
.text-button { color: var(--green); font-size: .875rem; font-weight: 600; padding: 8px 0; }
.text-button:hover { text-decoration: underline; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 6px; flex-shrink: 0; }
.icon-button:hover { background: var(--sidebar); }
.workspace { display: grid; grid-template-columns: 252px 320px minmax(0, 1fr); height: 100dvh; overflow: hidden; }
.sidebar { display: flex; flex-direction: column; background: var(--sidebar); padding: 20px 18px 24px; }
.brand { display: flex; align-items: center; gap: 15px; padding: 0 7px; margin-bottom: 26px; }
.brand > .icon { width: 36px; height: 36px; stroke-width: 1.5; color: #414b53; }
.brand strong { font-size: 1.625rem; letter-spacing: -.04em; display: block; line-height: 1.3; }
.brand span { font-size: 1rem; color: var(--muted); display: block; margin-top: 2px; }
.new-note { width: 100%; margin-bottom: 22px; }
.search-box { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid #d6dce1; padding: 0 12px; border-radius: 8px; min-height: 44px; color: #626b74; box-shadow: 0 1px 2px #15202b08; }
.search-box:focus-within { border-color: var(--green); box-shadow: 0 0 0 2px #42754a15; }
.search-box input { min-width: 0; width: 100%; border: 0; outline: none; font-size: 1rem; padding: 10px 0; background: transparent; }
.search-box input:focus-visible { outline: none; }
.search-box input::placeholder { color: #737c83; }
.filters { display: flex; flex-direction: column; gap: 4px; margin: 28px -6px 0; }
.nav-item { display: flex; align-items: center; gap: 16px; min-height: 50px; padding: 11px 16px; width: 100%; text-align: left; border-radius: 7px; font-size: 1.125rem; }
.nav-item:hover { background: #e8ecef; }
.nav-item.active { background: #dce7dd; color: #1e3223; font-weight: 600; }
.nav-count { margin-left: auto; color: var(--muted); font-size: .8125rem; font-weight: 400; }
.sidebar-bottom { margin-top: auto; padding-top: 12px; border-top: 1px solid #dce1e5; }
.notes-panel { border-right: 1px solid var(--line); min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.list-heading { display: flex; align-items: center; gap: 8px; min-height: 100px; padding: 23px 24px 18px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.list-heading h1 { font-size: 1.625rem; line-height: 1.25; margin: 0 0 8px; letter-spacing: -.04em; }
.list-heading p { margin: 0; color: var(--muted); font-size: .9375rem; }
.note-list { overflow-y: auto; padding: 6px; }
.note-row { position: relative; width: 100%; display: block; text-align: left; padding: 12px 18px 14px; border-radius: 7px; }
.note-row::after { content: ""; position: absolute; left: 18px; right: 18px; bottom: 0; height: 1px; background: var(--line); }
.note-row:hover { background: #f5f7f5; }
.note-row.selected { background: var(--selected); }
.note-row.selected::after { display: none; }
.note-row-title { display: flex; align-items: center; gap: 7px; font-size: 1.1875rem; font-weight: 600; line-height: 1.5; margin-bottom: 6px; }
.note-row-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-row-title .icon { width: 14px; height: 14px; color: var(--green); }
.note-preview { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.0625rem; color: #71777b; line-height: 1.6; }
.note-time { display: block; font-size: .9375rem; color: var(--muted); margin-top: 7px; line-height: 1.4; }
.list-empty { text-align: center; padding: 64px 22px; color: var(--muted); }
.list-empty > .icon { width: 28px; height: 28px; opacity: .65; }
.list-empty p { color: #414b53; margin: 18px 0 10px; }
.list-empty span { display: block; font-size: .875rem; line-height: 1.7; }
.list-empty button { margin-top: 12px; }
.editor-panel { min-width: 0; height: 100%; }
.editor { height: 100%; display: flex; flex-direction: column; }
.editor-toolbar { display: flex; align-items: center; gap: 16px; padding: 0 24px; min-height: 64px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.breadcrumb { display: flex; align-items: center; gap: 11px; min-width: 0; font-size: 1.0625rem; }
.breadcrumb > span:first-child, .separator { color: #697078; flex-shrink: 0; }
#breadcrumb-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-status { margin-left: auto; padding: 8px 0; color: var(--green); white-space: nowrap; font-size: 1rem; }
.save-status.pending { color: #8b7953; }
.save-status.error { color: #b34338; }
.editor-actions { display: flex; align-items: center; gap: 12px; border-left: 1px solid var(--line); padding-left: 14px; }
.tool-button { display: flex; align-items: center; gap: 7px; padding: 8px 4px; border-radius: 5px; font-size: 1.0625rem; white-space: nowrap; }
.tool-button:hover { background: var(--sidebar); }
.tool-button.is-pinned { color: var(--green); }
.danger-hover:hover { color: #b34338; background: #fcf0ee; }
.writing-scroll { flex: 1; overflow: auto; min-height: 0; }
.writing-area { padding: 88px 72px 48px; max-width: 1000px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
.note-title { border: 0; background: transparent; font-size: 2.5rem; font-weight: 700; letter-spacing: -.045em; padding: 0; width: 100%; line-height: 1.5; border-radius: 2px; }
.note-title::placeholder { color: #acb2b7; }
.note-date { margin: 9px 0 30px; color: var(--muted); font-size: 1.125rem; }
.note-content { flex: 1; width: 100%; min-height: 360px; resize: none; border: 0; border-radius: 2px; background: transparent; padding: 0; font-size: 1.5rem; line-height: 1.85; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-content::placeholder { color: #a1a8ac; }
.note-title:focus-visible, .note-content:focus-visible { outline: none; }
.note-title:read-only, .note-content:read-only { color: #6b7176; }
.editor-footer { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; padding: 12px 24px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: .9375rem; }
.shortcuts > span { margin: 0 7px; }
.editor-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; padding: 32px; text-align: center; }
.editor-empty > .icon { color: #9daa9d; width: 48px; height: 48px; stroke-width: 1.2; }
.editor-empty h2 { font-size: 1.625rem; font-weight: 600; letter-spacing: -.04em; margin: 25px 0 12px; }
.editor-empty p { color: var(--muted); line-height: 1.7; margin: 0 0 26px; }
.editor-empty > span { font-size: .8125rem; color: #92999f; margin-top: 18px; }
.notice { background: #f6f5ea; color: #786326; font-size: .875rem; padding: 12px 24px; line-height: 1.7; flex-shrink: 0; }
.notice.conflict { background: #fff2e6; color: #855b33; }
.notice .text-button { margin-right: 20px; }
.mobile-only { display: none; }
.login-screen { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 32px 24px; background: var(--sidebar); }
.login-form { width: 100%; max-width: 380px; }
.login-brand { display: flex; align-items: center; gap: 12px; color: var(--green); font-size: 1.75rem; font-weight: 700; margin-bottom: 44px; }
.login-brand .icon { width: 34px; height: 34px; }
.login-form h1 { font-size: 1.875rem; letter-spacing: -.05em; margin: 0 0 12px; }
.login-description { color: var(--muted); margin: 0 0 38px; line-height: 1.7; }
.login-form label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: 10px; }
.login-form input { display: block; width: 100%; padding: 14px; border: 1px solid #d6dce1; border-radius: 8px; background: #fff; }
.login-form input + label { margin-top: 20px; }
.login-form .primary { width: 100%; }
.form-error { font-size: .875rem; color: #b34338; min-height: 22px; margin: 10px 0 12px; }
.login-footnote { color: var(--muted); font-size: .8125rem; text-align: center; margin-top: 26px; }
.loading-screen { display: grid; place-items: center; height: 100dvh; color: var(--muted); }
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); max-width: min(90vw, 560px); padding: 12px 22px; border: 1px solid #dde5dc; border-radius: 9px; background: #f5f9f3; color: #345e3b; box-shadow: 0 6px 24px #1d382215; font-size: .9375rem; z-index: 100; line-height: 1.6; }
dialog { max-width: min(440px, calc(100vw - 40px)); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: 0 20px 80px #0002; }
dialog::backdrop { background: #1c242752; }
dialog h2 { font-size: 1.25rem; margin: 0 0 12px; }
dialog p { color: var(--muted); line-height: 1.75; margin: 0 0 26px; font-size: .9375rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 12px; }
@media (min-width: 1800px) { .workspace { grid-template-columns: 260px 340px minmax(0, 1fr); } }
@media (max-width: 1200px) {
  .workspace { grid-template-columns: 220px 280px minmax(0, 1fr); }
  .sidebar { padding-left: 14px; padding-right: 14px; }
  .writing-area { padding: 60px 36px 36px; }
  .editor-toolbar { gap: 10px; padding: 0 18px; }
  .tool-button span { display: none; }
  .editor-actions { gap: 8px; padding-left: 10px; }
}
@media (max-width: 960px) {
  .workspace { grid-template-columns: 280px minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 30; width: 260px; height: 100dvh; inset: 0 auto 0 0; transform: translateX(-100%); visibility: hidden; transition: transform .2s, visibility .2s; }
  .nav-open .sidebar { transform: translateX(0); visibility: visible; }
  .nav-overlay { position: fixed; inset: 0; background: #1c242752; z-index: 25; }
  .mobile-only { display: inline-flex; }
  #close-nav { margin-left: auto; }
  #back-to-list { display: none; }
  .list-heading { padding: 20px 12px; }
  .list-heading h1 { font-size: 1.25rem; }
  #mobile-new { margin-left: auto; color: var(--green); }
  .writing-area { padding: 52px 30px 32px; }
  .shortcuts { display: none; }
}
@media (max-width: 640px) {
  .workspace { display: block; }
  .notes-panel { width: 100%; height: 100%; border: 0; }
  .editor-panel { display: none; }
  .writing-mode .notes-panel { display: none; }
  .writing-mode .editor-panel { display: block; }
  #back-to-list { display: inline-flex; }
  .list-heading { padding: 20px 18px; min-height: 96px; }
  .note-list { padding: 10px; }
  .note-row { padding: 19px; }
  .note-row-title { font-size: 1.125rem; }
  .note-preview { font-size: 1rem; }
  .note-time { font-size: .875rem; }
  .editor-toolbar { min-height: 60px; padding: 0 10px; gap: 6px; }
  .breadcrumb > span:first-child, .separator { display: none; }
  .breadcrumb { font-size: .875rem; }
  .save-status { font-size: .8125rem; }
  .editor-actions { gap: 3px; padding-left: 6px; }
  .tool-button { padding: 8px 6px; }
  .tool-button .icon { width: 20px; height: 20px; }
  .writing-area { padding: 36px 24px 24px; }
  .note-title { font-size: 1.75rem; }
  .note-date { font-size: .875rem; margin-bottom: 24px; }
  .note-content { font-size: 1.0625rem; line-height: 1.9; }
  .editor-footer { padding-left: 24px; padding-right: 24px; min-height: 48px; }
  #trash-hint { font-size: .75rem; }
  .notice { padding: 12px 24px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
