/* ==========================================================================
   frapp board · 墨（Ink）设计语言
   规范说明见 DESIGN.md；这里的变量就是规范里的 token，改风格先改变量。
   ========================================================================== */

:root {
  color-scheme: light dark;
  --font: ui-sans-serif, -apple-system, system-ui, "Segoe UI", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  /* 纸：表面层级，越往上越亮 */
  --canvas: #f7f7f7;
  --well: #efefef;
  --surface: #ffffff;
  --raised: #ffffff;
  --hover: rgba(0, 0, 0, .045);
  --active: rgba(0, 0, 0, .08);

  /* 墨：文字与线 */
  --ink: #0d0d0d;
  --ink-2: #5d5d5d;
  --ink-3: #8f8f8f;
  --ink-4: #b9b9b9;
  --line: rgba(0, 0, 0, .1);
  --line-soft: rgba(0, 0, 0, .06);
  --accent: #0d0d0d;
  --accent-text: #ffffff;
  --accent-hover: #2f2f2f;

  /* 语义色：彩色只用来表达含义 */
  --open: #d99a00;
  --progress: #3a83f7;
  --done: #10a37f;
  --closed: #9a9a9a;
  --danger: #e02e2a;

  /* 圆角：统一的圆角方形，越大的东西圆角越大 */
  --r-xs: 6px;
  --r-s: 9px;
  --r-m: 12px;
  --r-l: 18px;
  --r-pill: 999px;

  /* 层级：平面靠细线，浮起来才有影子 */
  --e1: 0 1px 2px rgba(0, 0, 0, .04), 0 0 0 1px var(--line-soft);
  --e2: 0 10px 30px -8px rgba(0, 0, 0, .16), 0 0 0 1px var(--line-soft);
  --e3: 0 30px 80px -16px rgba(0, 0, 0, .32), 0 0 0 1px var(--line-soft);
  --shade: rgba(12, 12, 12, .34);

  /* 动效 */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.3, .64, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --t1: 120ms;
  --t2: 200ms;
  --t3: 320ms;
  --t4: 460ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #161616;
    --well: #1e1e1e;
    --surface: #262626;
    --raised: #2a2a2a;
    --hover: rgba(255, 255, 255, .06);
    --active: rgba(255, 255, 255, .1);
    --ink: #ececec;
    --ink-2: #b4b4b4;
    --ink-3: #8f8f8f;
    --ink-4: #5e5e5e;
    --line: rgba(255, 255, 255, .12);
    --line-soft: rgba(255, 255, 255, .07);
    --accent: #ffffff;
    --accent-text: #0d0d0d;
    --accent-hover: #d9d9d9;
    --open: #f5c542;
    --progress: #5b9bfa;
    --done: #2fbf96;
    --closed: #8f8f8f;
    --danger: #ff5f57;
    --e1: 0 1px 2px rgba(0, 0, 0, .35), 0 0 0 1px var(--line-soft);
    --e2: 0 12px 32px -8px rgba(0, 0, 0, .6), 0 0 0 1px var(--line);
    --e3: 0 30px 90px -16px rgba(0, 0, 0, .75), 0 0 0 1px var(--line);
    --shade: rgba(0, 0, 0, .6);
  }
}

/* 反色区域（底部创建条、提示条）：浅色主题下是墨底白字，深色主题下是纸底黑字 */
.inverse {
  --raised: #0d0d0d;
  --surface: #1c1c1c;
  --well: #242424;
  --hover: rgba(255, 255, 255, .08);
  --active: rgba(255, 255, 255, .14);
  --ink: #f4f4f4;
  --ink-2: #bdbdbd;
  --ink-3: #8f8f8f;
  --ink-4: #6b6b6b;
  --line: rgba(255, 255, 255, .14);
  --line-soft: rgba(255, 255, 255, .08);
  --accent: #ffffff;
  --accent-text: #0d0d0d;
  --accent-hover: #e2e2e2;
  color: var(--ink);
}
@media (prefers-color-scheme: dark) {
  .inverse {
    --raised: #f4f4f4;
    --surface: #ffffff;
    --well: #e9e9e9;
    --hover: rgba(0, 0, 0, .05);
    --active: rgba(0, 0, 0, .09);
    --ink: #0d0d0d;
    --ink-2: #5d5d5d;
    --ink-3: #8f8f8f;
    --ink-4: #b5b5b5;
    --line: rgba(0, 0, 0, .12);
    --line-soft: rgba(0, 0, 0, .07);
    --accent: #0d0d0d;
    --accent-text: #ffffff;
    --accent-hover: #2f2f2f;
  }
}

/* 底部创建条：淡灰底，和页面同色系，不抢眼 */
.dock {
  --raised: #ececec;
  --surface: #ffffff;
  --well: #e3e3e3;
  --hover: rgba(0, 0, 0, .05);
  --active: rgba(0, 0, 0, .09);
  color: var(--ink);
}
@media (prefers-color-scheme: dark) {
  .dock { --raised: #2e2e2e; --surface: #383838; --well: #353535; }
}

/* 状态色调：给元素加 tone-xxx，内部用 var(--c) */
.tone-open { --c: var(--open); }
.tone-in_progress { --c: var(--progress); }
.tone-resolved { --c: var(--done); }
.tone-closed { --c: var(--closed); }
.tone-danger { --c: var(--danger); }

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100dvh;
  background: var(--canvas);
  color: var(--ink);
  font: 14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.modal-open { overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
::selection { background: color-mix(in srgb, var(--progress) 28%, transparent); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }

.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 14px; height: 14px; }
.i.lg { width: 18px; height: 18px; }
.mark { flex: none; fill: currentColor; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.muted { color: var(--ink-3); }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 16px; border-radius: var(--r-s);
  font-weight: 600; font-size: 13.5px; white-space: nowrap;
  transition: background-color var(--t2), color var(--t2), transform var(--t1) var(--ease-out), box-shadow var(--t2);
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .5; }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.ghost { color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.btn.quiet { color: var(--ink-2); padding: 0 10px; }
.btn.quiet:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.btn.block { width: 100%; height: 42px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none;
  border-radius: var(--r-s); color: var(--ink-3);
  transition: background-color var(--t2), color var(--t2), transform var(--t1) var(--ease-out);
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn:active { transform: scale(.92); }

/* ---------- 输入 ---------- */
.input {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--surface); border: 0; border-radius: var(--r-s); outline: none;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow var(--t2);
}
.input::placeholder, .bare::placeholder { color: var(--ink-4); }
.input:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 22%, transparent); }
.input:focus { box-shadow: inset 0 0 0 1.5px var(--ink), 0 0 0 4px color-mix(in srgb, var(--ink) 7%, transparent); }
.input.sm { height: 34px; font-size: 13px; }
.bare { width: 100%; border: 0; outline: none; background: transparent; resize: none; padding: 0; }
.field { display: grid; gap: 6px; margin-top: 14px; }
.field > span { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.err { min-height: 18px; color: var(--danger); font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 8px; }

/* ---------- 头像：圆角方形 ---------- */
.av {
  --s: 22px;
  display: inline-grid; place-items: center; flex: none;
  width: var(--s); height: var(--s); border-radius: calc(var(--s) * .3);
  background: var(--c, #6f7782); color: #fff;
  font-size: calc(var(--s) * .48); font-weight: 600; line-height: 1;
  user-select: none;
}
.stack { display: inline-flex; align-items: center; }
.stack .av { position: relative; box-shadow: 0 0 0 2px var(--surface); }
.stack .av + .av { margin-left: -4px; }
.stack .more { margin-left: 5px; font-size: 11.5px; color: var(--ink-3); }

/* ---------- 标签 ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px;
  border-radius: var(--r-pill); font-size: 12px; font-weight: 500; white-space: nowrap;
  background: color-mix(in srgb, var(--c, var(--ink-3)) 13%, transparent);
  color: color-mix(in srgb, var(--c, var(--ink-3)) 72%, var(--ink));
}
/* 状态标记：小圆角方块 */
.sq { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 2.5px; background: var(--c); }
.tag { flex: none; padding: 1px 7px; border-radius: var(--r-xs); background: var(--hover); color: var(--ink-3); font-size: 11.5px; font-weight: 500; }

.due {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px;
  border-radius: var(--r-pill); font-size: 11.5px; font-weight: 500; white-space: nowrap;
  color: var(--ink-2); background: var(--hover);
}
.due .i { width: 12px; height: 12px; }
.due.over { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.due.soon { color: color-mix(in srgb, var(--open) 70%, var(--ink)); background: color-mix(in srgb, var(--open) 15%, transparent); }
.due.done { color: var(--ink-3); background: none; padding: 0; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  height: 64px; padding: 0 24px;
  background: color-mix(in srgb, var(--canvas) 92%, transparent);
}
.brand { display: flex; align-items: center; gap: 9px; font-size: 16px; letter-spacing: -.02em; white-space: nowrap; }
.brand b { font-weight: 700; }
.views { display: flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--well); }
.views button {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px;
  border-radius: 8px; color: var(--ink-2); font-size: 13px; font-weight: 500;
  transition: background-color var(--t2), color var(--t2), box-shadow var(--t2);
}
.views button:hover { color: var(--ink); }
.views button.on { background: var(--surface); color: var(--ink); box-shadow: var(--e1); }
.views .count { font-size: 11.5px; color: var(--ink-3); }
.search { position: relative; width: 260px; }
.search .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search .input { height: 36px; padding: 0 12px 0 34px; }
.me-btn { display: inline-flex; border-radius: 10px; padding: 3px; transition: background-color var(--t2); }
.me-btn:hover { background: var(--hover); }

/* ---------- 看板 ---------- */
.col-tabs { display: none; }
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(276px, 1fr);
  gap: 16px; align-items: start;
  padding: 4px 24px 140px; overflow-x: auto;
}
.col {
  border-radius: 16px; background: var(--well); padding: 6px 6px 8px;
  transition: background-color var(--t2), box-shadow var(--t2);
}
.col-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px 10px; font-size: 13px; font-weight: 600; }
.col-head .count { color: var(--ink-3); font-size: 12px; font-weight: 500; }
.col-body { display: grid; gap: 8px; min-height: 64px; }
body.dragging .col { box-shadow: inset 0 0 0 1px var(--line); }
.col.drop { background: color-mix(in srgb, var(--c) 9%, var(--well)); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 55%, transparent); }
.col-empty {
  display: grid; place-items: center; gap: 4px; min-height: 64px; padding: 14px;
  border-radius: var(--r-m); border: 1px dashed var(--line);
  color: var(--ink-4); font-size: 12.5px; text-align: center;
}
.col-empty b { color: var(--ink-2); font-weight: 600; font-size: 13px; }

/* ---------- 卡片 ---------- */
.card {
  position: relative; display: block; width: 100%;
  padding: 12px 14px 11px; border-radius: var(--r-m);
  background: var(--surface); box-shadow: var(--e1);
  cursor: pointer; user-select: none;
  transition: transform var(--t2) var(--ease-out), box-shadow var(--t2) var(--ease-out), opacity var(--t2);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--e2); }
.card:active { transform: scale(.985); }
.card.lifted { opacity: .35; transform: none; box-shadow: var(--e1); }
.card.ghosted { visibility: hidden; }
.card.fresh { animation: fresh 1.6s var(--ease-out); }
@keyframes fresh {
  0% { transform: translateY(10px) scale(.96); opacity: 0; box-shadow: 0 0 0 2px var(--ink), var(--e2); }
  25% { transform: none; opacity: 1; box-shadow: 0 0 0 2px var(--ink), var(--e2); }
  100% { box-shadow: var(--e1); }
}
.col[data-status=closed] .card:not(:hover) { opacity: .66; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 20px; }
.card-id { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-3); }
.card-id .lock { display: inline-flex; color: var(--ink-3); }
.card-title {
  margin-top: 3px; font-size: 14.5px; font-weight: 600; line-height: 1.45; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-excerpt {
  margin-top: 4px; font-size: 13px; line-height: 1.55; color: var(--ink-2); word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 12px; color: var(--ink-3); }
.card-foot .meta { display: inline-flex; align-items: center; gap: 4px; min-width: 0; white-space: nowrap; }
.card-foot .meta.who { overflow: hidden; }
.card-foot .meta.who span { overflow: hidden; text-overflow: ellipsis; }

/* ---------- 浮层：弹出卡片 ---------- */
.layer { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 28px; }
.layer.full { padding: 0; }
.shade { position: absolute; inset: 0; background: var(--shade); }
.sheet {
  position: relative; display: flex; flex-direction: column;
  width: min(1040px, 100%); height: min(88vh, 900px);
  border-radius: var(--r-l); background: var(--raised); box-shadow: var(--e3);
  overflow: hidden; transform-origin: 0 0; outline: none;
}
.sheet.small { width: min(440px, 100%); height: auto; max-height: 90vh; }
.sheet.expanded { width: 100%; height: 100%; border-radius: 0; }
.sheet-inner { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.sheet-head {
  display: flex; align-items: center; gap: 12px; flex: none;
  height: 56px; padding: 0 14px 0 26px; border-bottom: 1px solid var(--line-soft);
}
.head-info { display: flex; align-items: center; gap: 10px; }
.head-info .num { font-size: 13px; color: var(--ink-3); }
.save-state { font-size: 12px; color: var(--ink-3); }
.sheet-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: minmax(0, 1fr); }
.sheet-main { min-height: 0; overflow-y: auto; padding: 24px 34px 64px; }
.sheet-side { min-height: 0; overflow-y: auto; padding: 20px 20px 40px; border-left: 1px solid var(--line-soft); background: color-mix(in srgb, var(--well) 40%, var(--raised)); }
.sheet.expanded .sheet-body { grid-template-columns: minmax(0, 1fr); }
.sheet.expanded .sheet-side { display: none; }
.sheet.expanded .sheet-main { padding: 48px max(34px, calc((100% - 780px) / 2)) 96px; }
.sheet.small .sheet-body { display: block; padding: 4px 26px 26px; overflow-y: auto; }

.sheet-notice {
  display: flex; align-items: center; gap: 10px; margin: -4px 0 18px; padding: 10px 12px;
  border-radius: var(--r-m); background: var(--hover); color: var(--ink-2); font-size: 13px;
}
.sheet-notice.warn { background: color-mix(in srgb, var(--open) 14%, transparent); color: var(--ink); }
.sheet-notice .btn { height: 30px; font-size: 12.5px; }

.title-input {
  display: block; width: calc(100% + 16px); margin: 0 -8px; padding: 4px 8px;
  font-size: 24px; font-weight: 700; line-height: 1.38; letter-spacing: -.01em;
  border-radius: 10px; transition: background-color var(--t2), box-shadow var(--t2);
}
.title-input:not([readonly]):hover { background: var(--hover); }
.title-input:not([readonly]):focus { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--ink); }
.byline { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--ink-3); }
.ed-wrap { margin-top: 22px; }

/* 侧栏属性 */
.prop { margin-bottom: 22px; }
.prop-label { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.prop-hint { margin: 6px 2px 0; font-size: 12px; color: var(--ink-4); }
.status-list { display: grid; gap: 2px; }
.status-opt {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--r-s);
  color: var(--ink-2); font-size: 13.5px;
  transition: background-color var(--t2), color var(--t2), box-shadow var(--t2);
}
.status-opt:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.status-opt.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--e1); }
.status-opt:disabled:not(.on) { opacity: .55; }
.status-opt .i { margin-left: auto; color: var(--ink); }
.field-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 6px 10px;
  border-radius: var(--r-s); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
  font-size: 13.5px; transition: box-shadow var(--t2), background-color var(--t2);
}
.field-btn:hover:not(:disabled) { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 25%, transparent); }
.field-btn:disabled { background: transparent; }
.field-btn .placeholder { color: var(--ink-4); }
.field-btn.over { color: var(--danger); }
.person { display: flex; align-items: center; gap: 9px; height: 34px; padding: 0 6px 0 8px; border-radius: var(--r-s); font-size: 13.5px; }
.person:hover { background: var(--hover); }
.person .x { opacity: 0; width: 24px; height: 24px; transition: opacity var(--t1); }
.person:hover .x, .person .x:focus-visible { opacity: 1; }
.add-link { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px; border-radius: var(--r-s); color: var(--ink-3); font-size: 13px; }
.add-link:hover { background: var(--hover); color: var(--ink); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; border-radius: 11px; background: var(--well); }
.seg button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px;
  border-radius: 8px; color: var(--ink-2); font-size: 12.5px; white-space: nowrap;
  transition: background-color var(--t2), color var(--t2), box-shadow var(--t2);
}
.seg button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--e1); }
.seg button:disabled:not(.on) { opacity: .55; }
.who-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }

/* 动态（在侧栏里，紧凑） */
.feed-sec { padding-top: 6px; border-top: 1px solid var(--line-soft); }
.feed-sec .prop-label { margin-top: 16px; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { position: relative; display: flex; gap: 10px; padding-bottom: 14px; font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }
.feed li:not(:last-child)::before { content: ""; position: absolute; left: 10.5px; top: 26px; bottom: 4px; width: 1px; background: var(--line); }
.feed .what { flex: 1; min-width: 0; padding-top: 1px; word-break: break-word; }
.feed .what b { color: var(--ink); font-weight: 600; }
.feed .what .i { vertical-align: -2px; }
.feed .what .pill { margin: 0 3px; height: 19px; font-size: 11.5px; vertical-align: 1px; }
.feed .when { color: var(--ink-3); font-size: 11.5px; }
.feed .quote { color: var(--ink); }
.feed .change { display: inline-flex; align-items: center; gap: 2px; vertical-align: 1px; }
.feed .change .pill { margin: 0; }
.feed .arrow { color: var(--ink-3); margin: 0 3px; }

/* 骨架屏 */
.sk { display: block; height: 12px; margin: 10px 0; border-radius: 6px; background: linear-gradient(90deg, var(--well) 25%, var(--hover) 50%, var(--well) 75%); background-size: 300% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -200% 0; } }

/* ---------- 编辑器（所见即所得 Markdown，移植自 frapp 笔记） ---------- */
.ed { position: relative; min-height: 180px; outline: none; font-size: 15px; line-height: 1.75; overflow-wrap: anywhere; caret-color: var(--ink); }
.ed.is-empty::before { position: absolute; inset: 0 0 auto 0; color: var(--ink-4); content: attr(data-placeholder); pointer-events: none; }
.ed.drop { box-shadow: 0 0 0 2px var(--ink); border-radius: var(--r-s); }
.ed > p, .ed > [data-b] { margin: 2px 0; }
.ed > h1, .ed > h2, .ed > h3, .ed > h4, .ed > h5, .ed > h6 { margin: 20px 0 4px; font-weight: 700; line-height: 1.4; }
.ed > :first-child { margin-top: 0; }
.ed > h1 { font-size: 1.5em; }
.ed > h2 { font-size: 1.3em; }
.ed > h3 { font-size: 1.15em; }
.ed > h4, .ed > h5, .ed > h6 { font-size: 1em; }
.ed > blockquote { margin: 6px 0; padding: 0 0 0 14px; border-left: 3px solid var(--line); color: var(--ink-2); }
.ed > hr { height: 1px; margin: 16px 0; border: 0; background: var(--line); cursor: default; }
.ed > pre { margin: 8px 0; padding: 12px 14px; border-radius: var(--r-m); background: var(--well); font: 13px/1.6 var(--mono); white-space: pre-wrap; tab-size: 2; }
.ed > pre[data-lang]:not([data-lang=""])::before { display: block; margin-bottom: 4px; color: var(--ink-3); content: attr(data-lang); font: 11px var(--font); user-select: none; }
.ed > [data-b] { position: relative; padding-left: calc(var(--indent, 0) * 24px + 26px); }
.ed > [data-indent="1"] { --indent: 1; } .ed > [data-indent="2"] { --indent: 2; } .ed > [data-indent="3"] { --indent: 3; }
.ed > [data-indent="4"] { --indent: 4; } .ed > [data-indent="5"] { --indent: 5; } .ed > [data-indent="6"] { --indent: 6; }
.ed > [data-b]::before { position: absolute; left: calc(var(--indent, 0) * 24px); width: 22px; color: var(--ink-2); text-align: center; user-select: none; }
.ed > [data-b="ul"]::before { content: "•"; font-size: 1.1em; }
.ed > [data-b="ol"]::before { content: attr(data-n) "."; font-variant-numeric: tabular-nums; }
.ed > [data-b="todo"]::before { top: .42em; left: calc(var(--indent, 0) * 24px + 3px); width: 16px; height: 16px; box-sizing: border-box; border: 1.5px solid var(--ink-3); border-radius: 4px; content: ""; cursor: pointer; }
.ed > [data-b="todo"][data-checked]::before { border-color: var(--ink); background: var(--ink); color: var(--canvas); content: "✓"; font-size: 12px; font-weight: 700; line-height: 13px; }
.ed > [data-b="todo"][data-checked] { color: var(--ink-3); text-decoration: line-through; }
.ed[data-readonly] > [data-b="todo"]::before { cursor: default; }
.ed a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--ink-3); text-underline-offset: 3px; }
.ed:not([data-readonly]) a { cursor: text; }
.ed code { padding: .15em .35em; border-radius: 6px; background: var(--well); font: 500 .875em var(--mono); }
.ed strong { font-weight: 700; }

/* 附件：图片块、行内缩略图、文件卡片 */
.att { position: relative; user-select: none; }
.ed > figure.att {
  display: block; width: fit-content; max-width: 100%; min-width: 120px; min-height: 72px; margin: 12px 0;
  border-radius: var(--r-m); overflow: hidden; background: var(--well); box-shadow: var(--e1); cursor: zoom-in;
}
.ed > figure.att img { display: block; max-width: 100%; max-height: 520px; opacity: 0; transition: opacity var(--t3); }
.ed > figure.att.ok img { opacity: 1; }
.ed > figure.att.broken::after { content: "图片无法显示"; display: grid; place-items: center; height: 72px; padding: 0 16px; color: var(--ink-3); font-size: 13px; }
.att-thumb { display: inline-block; vertical-align: middle; margin: 0 2px; border-radius: var(--r-xs); overflow: hidden; cursor: zoom-in; }
.att-thumb img { display: block; height: 64px; }
.att-file {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 28px; margin: 0 2px; padding: 0 10px;
  border-radius: var(--r-s); background: var(--well); box-shadow: inset 0 0 0 1px var(--line-soft);
  vertical-align: middle; font-size: 13px; line-height: 1; cursor: pointer;
  transition: background-color var(--t2);
}
.att-file:hover { background: var(--active); }
.att-file .att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-file .att-size { color: var(--ink-3); font-size: 12px; }
.att-x {
  position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 24px; height: 24px;
  border-radius: 7px; background: rgba(0, 0, 0, .55); color: #fff; opacity: 0; transition: opacity var(--t1);
}
.att-file .att-x { position: static; width: 18px; height: 18px; margin-right: -4px; background: none; color: var(--ink-3); }
.att:hover .att-x { opacity: 1; }
.att-pending { cursor: progress; }
.ed > figure.att-pending { display: grid; place-items: center; width: 240px; height: 120px; color: var(--ink-3); font-size: 12.5px; }
.att-pending .att-name { padding: 0 14px; text-align: center; }
.att-bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--ink); transition: width var(--t2); }

/* 「/」菜单 */
.slash-menu {
  position: fixed; z-index: 90; display: grid; grid-template-columns: repeat(6, 40px); gap: 4px; padding: 8px;
  border-radius: 14px; background: var(--raised); box-shadow: var(--e2);
  animation: pop-in var(--t2) var(--ease-out);
}
.slash-item { display: grid; place-items: center; width: 40px; height: 36px; border-radius: 8px; color: var(--ink-2); font: 500 16px var(--font); }
.slash-item:hover, .slash-item.active { background: var(--hover); color: var(--ink); }
.slash-item svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.slash-item sub { font-size: 10px; }
.slash-link { display: flex; grid-column: 1 / -1; flex-direction: column; gap: 6px; width: 260px; }
.slash-link .btn { align-self: flex-end; height: 32px; }

/* ---------- 弹出菜单 ---------- */
.pop {
  position: fixed; z-index: 80; min-width: 230px; max-width: calc(100vw - 16px); padding: 6px;
  border-radius: 14px; background: var(--raised); box-shadow: var(--e2);
  animation: pop-in var(--t2) var(--ease-out);
}
.pop.up { transform-origin: bottom left; }
.pop-shade { position: fixed; inset: 0; z-index: 79; background: var(--shade); animation: fade var(--t2); }
.pop.as-sheet {
  top: auto; left: 0; right: 0; bottom: 0; width: auto; min-width: 0; max-width: none; max-height: 78dvh; overflow-y: auto;
  padding: 18px 12px calc(16px + env(safe-area-inset-bottom)); border-radius: var(--r-l) var(--r-l) 0 0;
  animation: sheet-up var(--t3) var(--ease-out);
}
.pop.as-sheet::before { content: ""; position: absolute; top: 7px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--line); }
.pop.as-sheet .pop-item { min-height: 46px; font-size: 15px; }
.pop.as-sheet .pop-list { max-height: none; }
.pop.as-sheet .share-pop { width: auto; }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.pop-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 10px;
  border-radius: var(--r-s); font-size: 13.5px; color: var(--ink);
}
.pop-item:hover:not(:disabled), .pop-item:focus-visible { background: var(--hover); outline: none; }
.pop-item .hint { margin-left: auto; color: var(--ink-3); font-size: 12px; }
.pop-item.on .i { color: var(--ink); }
.pop-item.danger { color: var(--danger); }
.pop-sep { height: 1px; margin: 6px 4px; background: var(--line-soft); }
.pop-list { max-height: 280px; overflow-y: auto; margin-top: 6px; }
.pop-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; }
.pop .input.sm { margin-bottom: 2px; }
.pop .date-row { display: flex; gap: 6px; padding: 4px 4px 2px; }
.share-pop { width: 340px; padding: 8px 8px 4px; }
.pop-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.pop-desc { margin: 6px 0 12px; color: var(--ink-3); font-size: 12.5px; line-height: 1.6; }
.share-row { display: flex; gap: 6px; margin-bottom: 6px; }
.share-row .input { font-family: var(--mono); font-size: 12px; }
.share-pop .btn.block { height: 38px; margin-bottom: 6px; }
.share-pop .pop-item { margin-top: 2px; }

/* ---------- 底部创建条：小条 → 悬停变长 → 点击展开 ---------- */
.dock {
  --w-closed: 126px;
  --w-hover: 300px;
  --w-open: min(680px, calc(100vw - 24px));
  position: fixed; left: 50%; bottom: 24px; z-index: 40;
  width: var(--w-closed); height: 48px;
  transform: translateX(-50%);
  border-radius: 14px; background: var(--raised); box-shadow: 0 8px 24px -10px rgba(0, 0, 0, .2), 0 0 0 1px var(--line-soft);
  overflow: hidden;
  transition:
    width var(--t4) var(--ease-spring),
    height var(--t3) var(--ease-out),
    border-radius var(--t3) var(--ease-out),
    box-shadow var(--t3),
    opacity var(--t2),
    transform var(--t3) var(--ease-out);
}
.dock.has-draft { --w-closed: 158px; }
.dock.big { --w-open: min(920px, calc(100vw - 24px)); }
.dock:not(.open):hover, .dock:not(.open):focus-within { width: var(--w-hover); }
.dock.open { width: var(--w-open); border-radius: var(--r-l); box-shadow: var(--e3); }
body.modal-open .dock { opacity: 0; pointer-events: none; transform: translate(-50%, 16px); }
.dock-pill {
  position: absolute; inset: 0 auto auto 0; display: flex; align-items: center; gap: 10px;
  width: var(--w-hover); height: 48px; padding: 0 18px; color: var(--ink);
  font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: opacity var(--t2), transform var(--t3) var(--ease-out);
}
.dock-plus { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: var(--accent); color: var(--accent-text); transition: transform var(--t3) var(--ease-spring); }
.dock:hover .dock-plus { transform: rotate(90deg); }
.dock-hint { color: var(--ink-3); font-weight: 400; font-size: 13px; opacity: 0; transform: translateX(-6px); transition: opacity var(--t2), transform var(--t3) var(--ease-out); }
.dock:not(.open):hover .dock-hint, .dock:not(.open):focus-within .dock-hint { opacity: 1; transform: none; transition-delay: 90ms; }
.dock-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--open); }
.dock.open .dock-pill { opacity: 0; pointer-events: none; transform: translateY(-6px); }
.dock-form {
  position: absolute; inset: 0 auto auto 0; width: var(--w-open);
  padding: 16px 20px 14px; opacity: 0; pointer-events: none;
  transition: opacity var(--t2);
}
.dock.open .dock-form { opacity: 1; pointer-events: auto; transition-delay: 110ms; }
.dock-top { display: flex; align-items: center; gap: 8px; }
.dock-title { font-size: 18px; font-weight: 700; line-height: 1.4; }
.dock-ed { margin-top: 8px; max-height: 40vh; overflow-y: auto; border-radius: var(--r-s); transition: max-height var(--t3) var(--ease-out); }
.dock-ed .ed { min-height: 26px; font-size: 14px; color: var(--ink-2); transition: min-height var(--t3) var(--ease-out); }
.dock.writing .dock-ed .ed { min-height: 150px; color: var(--ink); }
.dock.big .dock-ed { max-height: calc(100dvh - 250px); }
.dock.big .dock-ed .ed { min-height: min(52vh, 520px); }
.dock-attrs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.attr {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border-radius: var(--r-pill); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-2); font-size: 12.5px;
  transition: background-color var(--t2), color var(--t2), box-shadow var(--t2);
}
.attr:hover { background: var(--hover); color: var(--ink); }
.attr.set { color: var(--ink); background: var(--hover); box-shadow: none; }
.attr .stack .av { box-shadow: 0 0 0 2px var(--raised); }
.dock-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.dock .err { margin-top: 6px; min-height: 0; }
.shake { animation: shake .36s var(--ease-out); }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* ---------- 提示条 ---------- */
.toast {
  position: fixed; left: 50%; top: 72px; z-index: 95;
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
  padding: 10px 12px 10px 16px; border-radius: var(--r-m);
  background: var(--raised); box-shadow: var(--e2); font-size: 13px;
  transform: translateX(-50%);
  animation: toast-in var(--t3) var(--ease-spring);
}
.toast.out { opacity: 0; transform: translate(-50%, -8px); transition: opacity var(--t2), transform var(--t2) var(--ease-in); }
.toast .btn { height: 28px; padding: 0 10px; font-size: 12.5px; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -14px) scale(.96); } }

/* ---------- 大图预览 ---------- */
.lightbox { position: fixed; inset: 0; z-index: 85; display: grid; place-items: center; padding: 48px 24px; background: rgba(0, 0, 0, .82); animation: fade var(--t2); cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 140px); border-radius: var(--r-m); box-shadow: var(--e3); animation: zoom-in var(--t3) var(--ease-out); }
.lightbox .cap { position: absolute; left: 0; right: 0; bottom: 18px; display: flex; justify-content: center; align-items: center; gap: 12px; color: #fff; font-size: 13px; }
.lightbox .cap .btn { color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3); }
@keyframes fade { from { opacity: 0; } }
@keyframes zoom-in { from { opacity: 0; transform: scale(.94); } }

/* ---------- 分享页（只读） ---------- */
.share-page { min-height: 100dvh; }
.share-top { display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 24px; }
.share-top .pill { --c: var(--ink-3); }
.share-doc { max-width: 780px; margin: 24px auto 96px; padding: 40px 48px 32px; border-radius: var(--r-l); background: var(--raised); box-shadow: var(--e1); animation: rise var(--t4) var(--ease-out); }
.share-meta { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.share-title { margin: 14px 0 12px; font-size: 28px; font-weight: 700; line-height: 1.35; letter-spacing: -.01em; }
.share-people { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.person-chip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px 0 4px; border-radius: var(--r-s); background: var(--hover); font-size: 13px; }
.share-doc .ed { min-height: 0; }
.share-foot { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line-soft); color: var(--ink-3); font-size: 12.5px; }
.share-gone { display: grid; justify-items: center; gap: 14px; margin-top: 18vh; text-align: center; color: var(--ink-2); }
.share-gone h1 { margin: 0; font-size: 18px; font-weight: 600; }

/* ---------- 登录页 ---------- */
.auth-page { position: relative; min-height: 100dvh; display: grid; place-items: center; padding: 24px; overflow: hidden; }
.auth-page .watermark { position: absolute; right: -140px; bottom: -170px; width: 640px; height: 640px; color: var(--ink); opacity: .03; pointer-events: none; }
.auth-card { position: relative; width: min(400px, 100%); padding: 32px 30px 26px; border-radius: var(--r-l); background: var(--raised); box-shadow: var(--e2); animation: rise var(--t4) var(--ease-out); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.auth-card h1 { margin: 26px 0 4px; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.auth-card p.sub { margin: 0 0 6px; color: var(--ink-3); font-size: 13.5px; }
.auth-card .btn.block { margin-top: 22px; }
.auth-switch { margin-top: 16px; text-align: center; font-size: 13px; color: var(--ink-3); }
.auth-switch button { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }

.splash { min-height: 100dvh; display: grid; place-items: center; color: var(--ink); }
.splash .mark { width: 36px; height: 36px; animation: breathe 1.4s var(--ease-out) infinite alternate; }
@keyframes breathe { from { opacity: .25; transform: scale(.94); } to { opacity: .9; transform: none; } }

/* ---------- 小屏 ---------- */
@media (max-width: 760px) {
  .topbar { gap: 10px; height: 58px; padding: 0 14px; }
  .views .label { display: none; }
  .search { width: auto; flex: 1; }
  /* 搜索框点进去时铺满顶栏 */
  .search:focus-within { position: absolute; left: 14px; right: 14px; z-index: 2; }
  /* iOS 上字号小于 16px 的输入框获得焦点会自动放大页面 */
  .input, .ed, .dock-ed .ed { font-size: 16px; }
  .col-tabs {
    position: sticky; top: 58px; z-index: 15; display: flex; gap: 6px; padding: 2px 14px 10px; overflow-x: auto;
    background: color-mix(in srgb, var(--canvas) 92%, transparent); scrollbar-width: none;
  }
  .col-tabs::-webkit-scrollbar { display: none; }
  .col-tabs button {
    flex: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
    border-radius: var(--r-s); background: var(--well); color: var(--ink-2); font-size: 13.5px; font-weight: 500;
    transition: background-color var(--t2), color var(--t2), box-shadow var(--t2);
  }
  .col-tabs button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--e1); }
  .col-tabs .count { color: var(--ink-3); font-size: 12px; }
  .board { grid-auto-columns: calc(100vw - 40px); gap: 12px; padding: 0 14px calc(120px + env(safe-area-inset-bottom)); scroll-snap-type: x mandatory; scroll-padding: 14px; overscroll-behavior-x: contain; }
  .col { scroll-snap-align: start; scroll-snap-stop: always; padding-top: 8px; }
  .col-head { display: none; }
  .expand-btn { display: none; }
  .sheet-head { position: relative; }
  .sheet-head::before { content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--line); }
  .sheet-main { padding-bottom: calc(48px + env(safe-area-inset-bottom)); }
  .layer { padding: 0; place-items: end stretch; }
  .sheet { width: 100%; height: 94dvh; border-radius: var(--r-l) var(--r-l) 0 0; }
  .sheet.small { height: auto; }
  .sheet.expanded { height: 100dvh; border-radius: 0; }
  .sheet-body { display: block; overflow-y: auto; }
  .sheet-main { overflow: visible; padding: 18px 20px 48px; }
  .sheet-main > .props { display: flow-root; margin-top: 18px; padding: 14px 14px 0; border-radius: var(--r-m); background: color-mix(in srgb, var(--well) 55%, var(--raised)); }
  .sheet-main > .props .status-list { grid-template-columns: 1fr 1fr; }
  .sheet-main > .feed-sec { margin-top: 32px; }
  /* 手机：创建条不做伸缩动画，点开直接是放大的编辑模式 */
  .dock { --w-hover: var(--w-closed); bottom: calc(16px + env(safe-area-inset-bottom)); }
  .dock, .dock * { transition: none !important; }
  .dock:hover .dock-plus { transform: none; }
  .dock-top .icon-btn { display: none; }
  /* 横向滑动看板时不显示滚动条 */
  .board { scrollbar-width: none; }
  .board::-webkit-scrollbar { display: none; }
  .dock-hint { display: none; }
  .toast { top: 64px; }
  .share-top { padding: 0 16px; }
  .share-doc { margin: 8px 12px 48px; padding: 24px 20px; }
  .share-title { font-size: 23px; }
}

/* 触屏：没有悬停，原本悬停才出现的按钮一直显示，卡片也不做悬停上浮 */
@media (hover: none) {
  .att-x, .person .x { opacity: 1; }
  .card:hover { transform: none; box-shadow: var(--e1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; transition-delay: 0ms !important; }
}
