/* Scarlett Notes —— 暖纸底色 + 绯红点缀 */
:root {
  --bg-side: #F1ECE4;
  --bg-list: #F8F5EF;
  --paper: #FFFEFB;
  --ink: #2B2623;
  --ink2: #6F665E;
  --ink3: #A69D94;
  --line: #E6DFD5;
  --line2: #EFE9E0;
  --hover: rgba(70, 45, 25, .06);
  --press: rgba(70, 45, 25, .11);
  --sel: #F7DFDA;
  --accent: #C8372D;
  --accent-2: #AE2B22;
  --accent-soft: #FBEBE8;
  --on-accent: #fff;
  --ok: #3C8D5A;
  --warn: #C98A1B;
  --hl: #FFE58A;
  --code-bg: #F4EFE8;
  --shadow: 0 10px 34px rgba(60, 35, 20, .16), 0 1px 3px rgba(60, 35, 20, .08);
  --shadow-s: 0 2px 10px rgba(60, 35, 20, .10);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --side-w: 288px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-side: #1B1816; --bg-list: #201D1B; --paper: #262220; --ink: #EDE6DF; --ink2: #ABA29A; --ink3: #7A716A;
    --line: #37312D; --line2: #2E2926; --hover: rgba(255, 235, 215, .06); --press: rgba(255, 235, 215, .11);
    --sel: #4A2A25; --accent: #E8604F; --accent-2: #F07462; --accent-soft: #3A2420; --on-accent: #fff;
    --ok: #62B783; --warn: #E0A93D; --hl: #F4D35E; --code-bg: #1E1B19;
    --shadow: 0 12px 40px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4); --shadow-s: 0 2px 10px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg-side: #1B1816; --bg-list: #201D1B; --paper: #262220; --ink: #EDE6DF; --ink2: #ABA29A; --ink3: #7A716A;
  --line: #37312D; --line2: #2E2926; --hover: rgba(255, 235, 215, .06); --press: rgba(255, 235, 215, .11);
  --sel: #4A2A25; --accent: #E8604F; --accent-2: #F07462; --accent-soft: #3A2420; --on-accent: #fff;
  --ok: #62B783; --warn: #E0A93D; --hl: #F4D35E; --code-bg: #1E1B19;
  --shadow: 0 12px 40px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4); --shadow-s: 0 2px 10px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg-list);
  -webkit-font-smoothing: antialiased; overflow: hidden; overscroll-behavior: none;
}
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
svg.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 1px; }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

/* ───────── 按钮 ───────── */
.ib {
  width: 34px; height: 34px; border-radius: 9px; display: inline-grid; place-items: center; color: var(--ink2); flex: none;
  transition: background .12s, color .12s;
}
.ib:hover { background: var(--hover); color: var(--ink); }
.ib:active { background: var(--press); }
.ib.accent { color: var(--accent); }
.ib.on { color: var(--accent); background: var(--accent-soft); }
.btn {
  height: 36px; padding: 0 16px; border-radius: 9px; background: var(--hover); color: var(--ink); font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; transition: background .12s, opacity .12s;
}
.btn:hover { background: var(--press); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--accent); }
.btn.ghost { background: none; }
.btn.ghost:hover { background: var(--hover); }
.btn.big { height: 44px; width: 100%; font-size: 16px; border-radius: 11px; }
.btn:disabled { opacity: .5; cursor: default; }

/* ───────── 启动 / 登录 ───────── */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg-side); }
.boot img { border-radius: 18px; animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .55; transform: scale(.96); } }
.auth {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; overflow: auto;
  background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg-side);
}
.auth-card {
  width: min(380px, 100%); background: var(--paper); border: 1px solid var(--line); border-radius: 22px; padding: 36px 30px 26px;
  box-shadow: var(--shadow); text-align: center;
}
.auth-card img { border-radius: 19px; box-shadow: var(--shadow-s); }
.wordmark { font-family: var(--font); font-weight: 800; letter-spacing: -.015em; color: var(--accent); white-space: nowrap; }
.wordmark span { font-weight: 600; color: color-mix(in srgb, var(--accent) 62%, var(--paper)); }
.auth-card h1 { font-size: 30px; line-height: 1.2; margin: 18px 0 6px; }
.auth-tag { color: var(--ink2); margin: 0 0 20px; letter-spacing: .08em; }
.auth-sub { color: var(--ink3); margin: 0 0 12px; font-size: 13.5px; }
.auth-sub:empty { display: none; }
.auth-fields { display: grid; gap: 10px; margin-bottom: 6px; }
.auth-err { color: var(--accent); min-height: 21px; margin: 4px 0 8px; font-size: 14px; }
.auth-foot { color: var(--ink3); font-size: 12.5px; margin: 16px 0 0; line-height: 1.6; }

.field {
  width: 100%; height: 44px; border-radius: 11px; border: 1px solid var(--line); background: var(--bg-list); padding: 0 14px; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
textarea.field { height: auto; padding: 10px 14px; resize: vertical; min-height: 76px; line-height: 1.55; }
select.field { appearance: none; -webkit-appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.field::placeholder { color: var(--ink3); }

/* ───────── 整体布局：左栏 + 正文 ───────── */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); height: 100dvh; position: relative; }
.app.nav-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.app.nav-collapsed .side { visibility: hidden; }
.app[data-main="rems"] .edit, .app[data-main="note"] .rem { display: none; }
.side, .edit, .rem { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.side { background: var(--bg-side); border-right: 1px solid var(--line); padding-top: var(--sat); }
.edit, .rem { background: var(--paper); }
.only-mobile { display: none; }
.side-open { position: absolute; left: 10px; top: 9px; z-index: 5; display: none; }
.app.nav-collapsed .side-open { display: inline-grid; }
.app.nav-collapsed .toolbar, .app.nav-collapsed .rem .pane-head { padding-left: 52px; }

/* ───────── 侧栏 ───────── */
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 16px 10px 8px 16px; flex: none; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { border-radius: 9px; box-shadow: var(--shadow-s); }
.brand > div { min-width: 0; }
.brand b { display: block; font-size: 17.5px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; }
.brand #brandSub { display: block; font-size: 11.5px; color: var(--ink3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; letter-spacing: .06em; }
.search { display: flex; align-items: center; gap: 8px; margin: 4px 12px 6px; padding: 0 11px; height: 34px; border-radius: 10px; background: var(--hover); flex: none; }
.search svg.ic { width: 16px; height: 16px; color: var(--ink3); }
.search-ic { display: grid; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; height: 100%; }
.search input::placeholder { color: var(--ink3); }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search:focus-within { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); background: var(--paper); }

/* 上下两半各占一半高度，各自滚动 */
.half { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.half + .half { border-top: 1px solid var(--line); }
.half-h { display: flex; align-items: center; gap: 2px; min-height: 38px; padding: 6px 8px 2px 18px; font-size: 12px; font-weight: 600; color: var(--ink3); letter-spacing: .06em; flex: none; }
.half-h > span:first-child { flex: 1; }
.half-h .ib { width: 28px; height: 28px; }
.half-h .ib svg.ic { width: 16px; height: 16px; }
.linkbtn { font-size: 12.5px; font-weight: 500; letter-spacing: 0; color: var(--accent); padding: 4px 9px; border-radius: 7px; }
.linkbtn:hover, .linkbtn.on { background: var(--accent-soft); }
.half-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 10px; }

/* 文件夹 → 笔记 */
.tf { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 4px 0 6px; border-radius: 8px; cursor: pointer; user-select: none; -webkit-user-select: none; font-weight: 600; font-size: 14px; }
.tf:hover { background: var(--hover); }
.tf .chev { width: 14px; height: 14px; color: var(--ink3); transition: transform .12s; }
.tf.open .chev { transform: rotate(90deg); }
.tf-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-count { font-size: 12px; color: var(--ink3); font-weight: 400; padding-right: 7px; font-variant-numeric: tabular-nums; }
.tf .lk { width: 14px; height: 14px; color: var(--ink3); margin-right: 5px; }
.tf-acts { display: none; }
.tf-acts .ib { width: 26px; height: 26px; }
.tf-acts .ib svg.ic { width: 15px; height: 15px; }
.tf:hover .tf-acts { display: flex; }
.tf:hover .tf-count, .tf:hover .lk { display: none; }
.tf.drop { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.tn { display: flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 8px 4px 26px; border-radius: 8px; cursor: pointer; user-select: none; -webkit-user-select: none; font-size: 14px; }
.tn:hover { background: var(--hover); }
.tn.sel { background: var(--sel); font-weight: 600; }
.tn-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tn svg.ic { width: 12px; height: 12px; color: var(--accent); }
.tn time { font-size: 11.5px; color: var(--ink3); flex: none; display: none; font-weight: 400; }
.tn:hover time { display: inline; }
.tn.flat { padding-left: 10px; }
.tn-empty { padding: 2px 8px 6px 26px; font-size: 12.5px; color: var(--ink3); }
.tn.rich { display: block; padding: 7px 10px; }
.tn.rich .tn-title { display: block; font-weight: 600; }
.tn.rich small { display: block; font-size: 12px; color: var(--ink3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; font-weight: 400; }
.tn mark { background: var(--hl); color: #2B2623; border-radius: 2px; padding: 0 1px; }
.empty { text-align: center; color: var(--ink3); padding: 30px 16px; line-height: 1.8; font-size: 13.5px; }
.empty svg.ic { width: 30px; height: 30px; stroke-width: 1.3; margin-bottom: 4px; }

/* 侧栏下半：提醒与待办 */
.mini-add { margin: 2px 12px 4px; height: 32px; display: flex; align-items: center; gap: 7px; padding: 0 10px; border-radius: 9px; background: var(--hover); flex: none; }
.mini-add span { display: grid; color: var(--accent); }
.mini-add svg.ic { width: 15px; height: 15px; }
.mini-add input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 13.5px; height: 100%; }
.mini-add input::placeholder { color: var(--ink3); }
.mini-add:focus-within { background: var(--paper); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.mini-h { display: flex; align-items: baseline; gap: 6px; padding: 9px 10px 2px; font-size: 12px; font-weight: 600; color: var(--ink2); }
.mini-h small { font-weight: 400; color: var(--ink3); }
.mr { display: flex; align-items: center; gap: 9px; min-height: 30px; padding: 3px 8px 3px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.mr:hover { background: var(--hover); }
.mr .ck { width: 17px; height: 17px; margin: 0; }
.mr .ck svg { width: 10px; height: 10px; }
.mr-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr time { font-size: 11.5px; color: var(--ink3); flex: none; font-variant-numeric: tabular-nums; }
.mr.late time { color: var(--accent); font-weight: 600; }
.mini-more { padding: 3px 10px 4px 36px; font-size: 12px; color: var(--ink3); cursor: pointer; }
.mini-more:hover { color: var(--accent); }
.mini-none { padding: 2px 10px 6px; font-size: 12.5px; color: var(--ink3); }

.side-foot { display: flex; align-items: center; gap: 2px; padding: 6px 8px calc(8px + var(--sab)) 18px; border-top: 1px solid var(--line2); flex: none; }
.sync { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink3); flex: 1; min-width: 0; }
.sync em { font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.sync[data-state="syncing"] i { background: var(--warn); animation: breathe 1s infinite; }
.sync[data-state="offline"] i { background: var(--ink3); }
.foot-btn { position: relative; }
.foot-btn .cnt { position: absolute; right: 1px; top: 1px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px; background: var(--ink3); color: var(--bg-side); font: 600 10px/15px var(--font); font-style: normal; text-align: center; }

/* ───────── 面板标题栏 ───────── */
.pane-head { display: flex; align-items: center; gap: 4px; padding: calc(14px + var(--sat)) 10px 6px 16px; min-height: 54px; flex: none; }
.pane-head h2 { flex: 1; min-width: 0; margin: 0; font: 700 21px/1.25 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ───────── 编辑器 ───────── */
.edit-empty { flex: 1; position: relative; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--ink3); }
.edit-empty img { border-radius: 16px; opacity: .5; filter: grayscale(.35); }
.edit-empty p { margin: 4px 0 0; }
.edit-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.toolbar {
  display: flex; align-items: center; gap: 2px; padding: calc(8px + var(--sat)) 10px 8px; border-bottom: 1px solid var(--line2); flex: none; min-height: 51px;
}
.tb-scroll { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 1px; }
.tb-scroll::-webkit-scrollbar { display: none; }
.tb-right { display: flex; align-items: center; gap: 2px; flex: none; padding-left: 6px; }
.tb { height: 32px; min-width: 32px; padding: 0 6px; border-radius: 8px; display: inline-grid; place-items: center; color: var(--ink2); flex: none; font-size: 15px; }
.tb:hover { background: var(--hover); color: var(--ink); }
.tb.on { background: var(--accent-soft); color: var(--accent); }
.tb.dim { opacity: .32; }
.tb-fixed { display: flex; align-items: center; gap: 2px; flex: none; padding-right: 4px; margin-right: 4px; border-right: 1px solid var(--line); }
.tb svg.ic { width: 18px; height: 18px; }
.tb b, .tb i, .tb u, .tb s { font-family: Georgia, "Times New Roman", serif; font-size: 16px; line-height: 1; }
.tb.style { padding: 0 8px 0 10px; display: inline-flex; gap: 3px; align-items: center; font-size: 13.5px; min-width: 74px; justify-content: space-between; border: 1px solid var(--line); }
.tb.style svg { width: 13px; height: 13px; }
.tb .hl-a { background: var(--hl); color: #2B2623; border-radius: 3px; padding: 1px 5px; font-weight: 600; font-size: 13.5px; }
.tb .col-a { border-bottom: 3px solid var(--accent); padding: 0 3px; font-weight: 600; font-size: 13.5px; line-height: 1.15; }
.tb-sep { width: 1px; height: 18px; background: var(--line); margin: 0 5px; flex: none; }
.banner { padding: 9px 18px; background: var(--accent-soft); color: var(--accent); font-size: 13.5px; display: flex; align-items: center; gap: 10px; flex: none; }
.banner span { flex: 1; }
.banner .btn { height: 30px; padding: 0 12px; background: var(--paper); font-size: 13.5px; }
.doc-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; scroll-padding-bottom: 80px; }
.page { max-width: 780px; margin: 0 auto; padding: 34px 48px calc(40vh + var(--sab)); min-height: 100%; }
.doc-title {
  display: block; width: 100%; border: 0; outline: 0; background: none; resize: none; overflow: hidden; padding: 0;
  font: 700 31px/1.35 var(--serif); color: var(--ink); letter-spacing: .01em;
}
.doc-title::placeholder { color: var(--ink3); opacity: .7; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; color: var(--ink3); font-size: 12.5px; margin: 8px 0 22px; padding-bottom: 14px; border-bottom: 1px solid var(--line2); }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 12px; background: var(--hover); color: var(--ink2); font-size: 12.5px; }
button.chip:hover { background: var(--press); }
.chip svg.ic { width: 12px; height: 12px; }
.chip.due { background: var(--accent-soft); color: var(--accent); }

.doc { outline: 0; font-size: 16px; line-height: 1.8; position: relative; word-break: break-word; overflow-wrap: anywhere; min-height: 40vh; caret-color: var(--accent); }
.doc.is-empty::before { content: attr(data-placeholder); position: absolute; left: 0; top: 0; color: var(--ink3); pointer-events: none; }
.doc > :first-child { margin-top: 0; }
.doc p { margin: 0 0 .55em; }
.doc h1, .doc h2, .doc h3 { font-family: var(--serif); line-height: 1.4; margin: 1.3em 0 .5em; }
.doc h1 { font-size: 1.65em; }
.doc h2 { font-size: 1.36em; }
.doc h3 { font-size: 1.14em; }
.doc ul, .doc ol { margin: 0 0 .55em; padding-left: 1.6em; }
.doc li { margin: .12em 0; }
.doc li > ul, .doc li > ol { margin-bottom: 0; }
.doc ul.todo { list-style: none; padding-left: 0; }
.doc ul.todo > li { position: relative; padding-left: 30px; }
.doc ul.todo > li::before {
  content: ''; position: absolute; left: 1px; top: .36em; width: 19px; height: 19px; border: 1.6px solid var(--ink3); border-radius: 50%; cursor: pointer;
  transition: background-color .12s, border-color .12s;
}
.doc ul.todo > li[data-checked="true"]::before {
  border-color: var(--accent);
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.4l2.6 2.6L12 5.6' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 13px no-repeat;
}
.doc ul.todo > li[data-checked="true"] { color: var(--ink3); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink3) 60%, transparent); }
.doc blockquote { margin: 0 0 .55em; padding: 2px 0 2px 16px; border-left: 3px solid var(--accent); color: var(--ink2); }
.doc blockquote + blockquote { margin-top: -.55em; }
.doc blockquote p { margin: 0; }
.doc pre { margin: 0 0 .7em; padding: 13px 16px; border-radius: 10px; background: var(--code-bg); border: 1px solid var(--line2); font: 13.5px/1.65 var(--mono); white-space: pre-wrap; tab-size: 2; }
.doc pre + pre { margin-top: -.7em; border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; padding-top: 0; }
.doc pre:has(+ pre) { border-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; padding-bottom: 0; margin-bottom: .7em; }
.doc code { font: .9em var(--mono); background: var(--code-bg); border-radius: 4px; padding: 1px 5px; }
.doc pre code { background: none; padding: 0; font-size: inherit; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 1.4em 0; }
.doc a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 3px; cursor: pointer; }
.doc a.attach { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px 3px 9px; border-radius: 9px; background: var(--hover); color: var(--ink); text-decoration: none; font-size: 14.5px; margin: 2px 0; max-width: 100%; }
.doc a.attach::before { content: '📎'; font-size: 13px; }
.doc img { max-width: 100%; height: auto; border-radius: 8px; vertical-align: bottom; cursor: pointer; }
.doc img.picked { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.doc table { border-collapse: collapse; width: 100%; margin: 0 0 .8em; table-layout: fixed; font-size: 15px; }
.doc td, .doc th { border: 1px solid var(--line); padding: 7px 10px; vertical-align: top; min-width: 40px; line-height: 1.6; }
.doc th, .doc tr:first-child td { background: var(--bg-list); font-weight: 600; }
.doc span[style*="background-color"] { color: #2B2623; border-radius: 2px; padding: 1px 0; }
.doc mark { background: var(--hl); color: #2B2623; }

/* 斜杠菜单 / 表格工具 */
.slash {
  position: fixed; z-index: 60; width: 236px; max-height: 300px; overflow-y: auto; padding: 6px; border-radius: 13px; background: var(--paper);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.slash-h { font-size: 11.5px; color: var(--ink3); padding: 5px 9px 4px; letter-spacing: .05em; }
.slash-i { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 9px; border-radius: 8px; text-align: left; }
.slash-i.on { background: var(--hover); }
.slash-i .k { width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink2); font: 600 12.5px var(--serif); flex: none; background: var(--bg-list); }
.slash-i .k svg { width: 15px; height: 15px; }
.slash-i em { font-style: normal; display: block; font-size: 14px; line-height: 1.25; }
.slash-i small { color: var(--ink3); font-size: 11.5px; }
.slash-none { padding: 10px; color: var(--ink3); font-size: 13px; text-align: center; }
.ttools { position: fixed; z-index: 40; display: flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-s); }
.ttools button { height: 26px; padding: 0 8px; border-radius: 6px; font-size: 12.5px; color: var(--ink2); white-space: nowrap; }
.ttools button:hover { background: var(--hover); color: var(--ink); }
.ttools button.danger { color: var(--accent); }

/* ───────── 提醒与待办（合并成一个页面）───────── */
.rem-scroll { flex: 1; overflow-y: auto; }
.rem-inner { max-width: 940px; margin: 0 auto; padding: 4px 36px calc(60px + var(--sab)); }
.rem .pane-head { padding-left: 36px; padding-right: 36px; max-width: 940px; width: 100%; margin: 0 auto; }
.rem .pane-head h2 { font-size: 26px; color: var(--accent); }
.rem-add { display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 14px; border-radius: 13px; background: var(--bg-list); border: 1px solid var(--line2); margin: 8px 0 6px; }
.rem-add:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.rem-add-ic { display: grid; color: var(--accent); }
.rem-add input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; height: 100%; font-size: 15.5px; }
.rem-add input::placeholder { color: var(--ink3); }
.rem-hint { flex: none; font-size: 12.5px; color: var(--accent); background: var(--accent-soft); border-radius: 10px; padding: 2px 9px; white-space: nowrap; }
.rem-hint:empty { display: none; }
.rem-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 44px; align-items: start; }
.rem-col h3 { margin: 22px 0 0; padding: 0 4px 9px; border-bottom: 1px solid var(--line); font: 700 17px var(--serif); display: flex; align-items: baseline; gap: 9px; }
.rem-col h3 small { font: 400 12.5px var(--font); color: var(--ink3); }
.rem-sec { padding: 14px 4px 3px; font-size: 12.5px; font-weight: 600; color: var(--ink3); letter-spacing: .03em; }
.rem-sec.late { color: var(--accent); }
.rem-none { color: var(--ink3); font-size: 13.5px; padding: 18px 4px; line-height: 1.7; }
.ri { display: flex; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line2); align-items: flex-start; cursor: pointer; border-radius: 6px; }
.ri:hover { background: var(--hover); }
.ck { width: 22px; height: 22px; border-radius: 50%; border: 1.7px solid var(--ink3); flex: none; margin-top: 1px; display: grid; place-items: center; color: transparent; transition: all .12s; }
.ck:hover { border-color: var(--accent); background: var(--accent-soft); }
.ck svg { width: 13px; height: 13px; stroke-width: 2.6; }
.ri.done .ck { background: var(--accent); border-color: var(--accent); color: #fff; }
.ri.p1 .ck, .ri.p2 .ck, .ri.p3 .ck { border-color: var(--accent); }
.ri.p3 .ck { border-width: 2.4px; }
.ri-main { flex: 1; min-width: 0; }
.ri-title { line-height: 1.45; word-break: break-word; }
.ri-title .pri { color: var(--accent); font-weight: 700; margin-right: 4px; }
.ri.done .ri-title { color: var(--ink3); text-decoration: line-through; }
.ri-sub { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 12.5px; color: var(--ink3); margin-top: 2px; align-items: center; }
.ri-sub span { display: inline-flex; align-items: center; gap: 3px; }
.ri-sub svg.ic { width: 12px; height: 12px; }
.ri-sub .late { color: var(--accent); }
.ri-sub .lnk { color: var(--ink2); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
.ri-sub .memo { display: block; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ri .flag { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; color: var(--line); flex: none; margin: -3px 0; }
.ri .flag svg { width: 16px; height: 16px; }
.ri:hover .flag { color: var(--ink3); }
.ri .flag.on { color: var(--warn); }
.ri .flag.on svg { fill: currentColor; }
.rem-done { margin-top: 34px; border-top: 1px solid var(--line); }
.rem-done-h { display: flex; align-items: center; gap: 6px; padding: 12px 4px; color: var(--ink2); font-size: 14px; }
.rem-done-h button:first-child { display: flex; align-items: center; gap: 6px; flex: 1; text-align: left; }
.rem-done-h .chev { width: 14px; height: 14px; transition: transform .12s; }
.rem-done-h.open .chev { transform: rotate(90deg); }

/* ───────── 弹出菜单 / 对话框 ───────── */
.veil { position: fixed; inset: 0; z-index: 80; }
.veil.dim { background: rgba(30, 20, 14, .32); display: grid; place-items: center; padding: 20px; animation: fade .14s; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
.menu { position: fixed; z-index: 81; min-width: 200px; max-width: 290px; max-height: 70vh; overflow-y: auto; padding: 6px; border-radius: 13px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); animation: pop .12s; }
.menu-t { padding: 6px 10px 4px; font-size: 12px; color: var(--ink3); }
.mi { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 5px 10px; border-radius: 8px; text-align: left; }
.mi:hover { background: var(--hover); }
.mi svg.ic { width: 17px; height: 17px; color: var(--ink2); }
.mi span { flex: 1; }
.mi .tick { color: var(--accent); width: 15px; height: 15px; }
.mi.danger, .mi.danger svg.ic { color: var(--accent); }
.mi-sep { height: 1px; background: var(--line2); margin: 5px 8px; }
.swatches { display: flex; gap: 7px; padding: 8px 10px; flex-wrap: wrap; }
.swatches button { width: 24px; height: 24px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .1); }
.swatches button.none { background: var(--paper); position: relative; overflow: hidden; }
.swatches button.none::after { content: ''; position: absolute; left: -2px; right: -2px; top: 50%; border-top: 1.5px solid var(--accent); transform: rotate(-45deg); }

.modal { width: min(440px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto; background: var(--paper); border-radius: 18px; border: 1px solid var(--line); box-shadow: var(--shadow); padding: 22px 22px 18px; animation: pop .16s; }
.modal.wide { width: min(540px, 100%); }
.modal h3 { margin: 0 0 6px; font: 700 19px/1.3 var(--serif); }
.modal .msg { color: var(--ink2); margin: 0 0 14px; font-size: 14.5px; line-height: 1.65; }
.modal .fields { display: grid; gap: 10px; margin: 12px 0 4px; }
.modal .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal label.lb { display: grid; gap: 5px; font-size: 12.5px; color: var(--ink2); }
.modal .err { color: var(--accent); font-size: 13.5px; min-height: 20px; margin: 6px 0 0; }
.modal .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.modal .acts .left { margin-right: auto; }
.pick { display: grid; gap: 2px; margin: 10px -8px 0; max-height: 46vh; overflow-y: auto; }
.set-sec { padding: 14px 0; border-top: 1px solid var(--line2); }
.set-sec:first-of-type { border-top: 0; padding-top: 6px; }
.set-sec h4 { margin: 0 0 8px; font-size: 13px; color: var(--ink3); font-weight: 600; letter-spacing: .05em; }
.set-row { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.set-row > div { flex: 1; min-width: 0; }
.set-row + .set-row { margin-top: 10px; }
.set-row small { display: block; color: var(--ink3); font-size: 12.5px; line-height: 1.5; }
.seg { display: inline-flex; background: var(--hover); border-radius: 9px; padding: 2px; }
.seg button { height: 30px; padding: 0 12px; border-radius: 7px; font-size: 13.5px; color: var(--ink2); }
.seg button.on { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-s); font-weight: 600; }
.set-note { font-size: 13px; color: var(--ink2); line-height: 1.65; margin: 0 0 10px; }
.set-note .linkbtn { margin-left: 4px; }
ol.help { margin-top: 10px; }
.help { font-size: 13px; color: var(--ink2); line-height: 1.75; margin: 6px 0 0; padding-left: 1.2em; }
.help li { margin: 2px 0; }
.help code { font: 12px var(--mono); background: var(--hover); padding: 1px 5px; border-radius: 4px; word-break: break-all; }

/* ───────── 轻提示 / 到期提醒 ───────── */
.toasts { position: fixed; left: 50%; bottom: calc(26px + var(--sab)); transform: translateX(-50%); z-index: 95; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; background: #2B2623; color: #F6F1EA; padding: 9px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; animation: pop .16s; max-width: 100%; }
.toast button { color: #FF9C8C; font-weight: 600; flex: none; }
.alerts { position: fixed; right: 16px; top: calc(14px + var(--sat)); z-index: 90; display: grid; gap: 10px; width: min(340px, calc(100vw - 32px)); }
.alert { background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 13px; box-shadow: var(--shadow); padding: 12px 14px 10px; animation: pop .2s; }
.alert small { color: var(--accent); font-size: 12px; display: flex; align-items: center; gap: 5px; }
.alert small svg { width: 13px; height: 13px; }
.alert b { display: block; margin: 3px 0 8px; font-size: 15.5px; line-height: 1.4; word-break: break-word; }
.alert div { display: flex; gap: 6px; }
.alert .btn { height: 30px; padding: 0 12px; font-size: 13px; }

/* ───────── 中等宽度 ───────── */
@media (max-width: 1100px) {
  :root { --side-w: 252px; }
  .page { padding: 28px 32px calc(40vh + var(--sab)); }
  .rem-cols { gap: 0 28px; }
}

/* ───────── 手机：两层 —— 侧栏（笔记 + 提醒）与正文 ───────── */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .only-mobile { display: inline-grid; }
  .only-desktop { display: none !important; }
  .app, .app.nav-collapsed { display: block; position: fixed; inset: 0; height: auto; }
  .app.nav-collapsed .side { visibility: visible; }
  .app.nav-collapsed .toolbar, .app.nav-collapsed .rem .pane-head { padding-left: 6px; }
  .side, .edit, .rem { position: absolute; inset: 0; border: 0; display: none; }
  .app[data-pane="nav"] .side { display: flex; }
  .app[data-pane="main"][data-main="note"] .edit { display: flex; }
  .app[data-pane="main"][data-main="rems"] .rem { display: flex; }
  .side-head { padding: 18px 14px 10px 20px; }
  .brand img { width: 40px; height: 40px; }
  .brand b { font-size: 23px; }
  .brand #brandSub { font-size: 13px; }
  .search { height: 40px; margin: 4px 14px 6px; }
  .search input, .mini-add input { font-size: 16px; }
  .half-h { padding-left: 22px; font-size: 13px; min-height: 42px; }
  .half-h .ib { width: 36px; height: 36px; }
  .half-h .ib svg.ic { width: 20px; height: 20px; }
  .linkbtn { font-size: 14px; padding: 6px 10px; }
  .half-body { padding: 0 12px 12px; }
  .tf { height: 42px; font-size: 16px; }
  .tf-acts { display: flex; }
  .tf-acts .ib { width: 34px; height: 34px; }
  .tf:hover .tf-count, .tf:hover .lk { display: inline; }
  .tn { min-height: 40px; font-size: 16px; padding-left: 28px; }
  .tn time { display: inline; }
  .mini-add { height: 40px; margin: 2px 14px 4px; }
  .mr { min-height: 40px; font-size: 16px; }
  .mr .ck { width: 21px; height: 21px; }
  .mr time { font-size: 12.5px; }
  .mini-h { font-size: 13px; }
  .side-foot { padding-left: 22px; }
  .ib { width: 40px; height: 40px; }
  .ib svg.ic { width: 22px; height: 22px; }
  .pane-head { padding: calc(8px + var(--sat)) 8px 4px 6px; }
  .edit-empty-back { position: absolute; left: 6px; top: calc(8px + var(--sat)); }
  .toolbar { padding: calc(6px + var(--sat)) 6px 6px; gap: 0; }
  .tb { height: 36px; min-width: 36px; }
  .page { padding: 20px 20px calc(45vh + var(--sab)); }
  .doc-title { font-size: 26px; }
  .doc { font-size: 16.5px; }
  .rem .pane-head { padding-left: 6px; padding-right: 8px; }
  .rem .pane-head h2 { font-size: 24px; padding-left: 4px; }
  .rem-inner { padding: 4px 16px calc(60px + var(--sab)); }
  .rem-cols { grid-template-columns: minmax(0, 1fr); }
  .rem-add input { font-size: 16px; }
  .ri { padding: 13px 2px; }
  .ck { width: 24px; height: 24px; }
  .ri .flag { color: var(--ink3); opacity: .55; }
  .ri .flag.on { opacity: 1; }
  .menu { left: 8px !important; right: 8px; top: auto !important; bottom: calc(8px + var(--sab)); max-width: none; border-radius: 18px; padding: 8px; animation: sheet .18s; max-height: 72vh; }
  .menu-veil { background: rgba(30, 20, 14, .32); }
  .mi { min-height: 46px; font-size: 16.5px; padding: 6px 14px; gap: 14px; }
  .mi svg.ic { width: 20px; height: 20px; }
  .veil.dim { align-items: end; padding: 0; }
  .modal, .modal.wide { width: 100%; border-radius: 20px 20px 0 0; padding: 22px 20px calc(18px + var(--sab)); animation: sheet .2s; max-height: 92dvh; border-bottom: 0; }
  .field { font-size: 16px; }
  .slash { width: 250px; }
  .alerts { left: 12px; right: 12px; width: auto; }
}

/* ───────── 打印 / 导出 PDF ───────── */
@media print {
  @page { margin: 18mm 16mm; }
  html, body { height: auto; overflow: visible; background: #fff; }
  .side, .side-open, .toolbar, .banner, .toasts, .alerts, #overlays, .ttools, .slash, .rem { display: none !important; }
  .app { display: block !important; position: static; height: auto; }
  .edit, .edit-wrap, .doc-scroll { display: block !important; position: static; overflow: visible; height: auto; background: #fff; }
  .page { max-width: none; padding: 0; }
  .doc, .doc-title { color: #000; }
  .doc-meta { border: 0; }
  .doc-meta .chip { display: none; }
}
