/* KiKi 工作台 · 叶绿 + 骨白 */
:root {
  --bg: #f4f6f1;
  --card: #fbfcfa;
  --ink: #333a34;
  --muted: #8a938b;
  --leaf: #6f9e5e;
  --leaf-soft: #edf2ea;
  --warm: #d9a35e;
  --line: #e5e9e3;
  --shadow: 0 8px 28px rgba(55, 65, 55, .07);
  --radius: 14px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Noto Sans SC", "Microsoft YaHei", -apple-system, "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ---------- 登录 ---------- */
.login-view {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); padding: 40px 32px; width: 100%; max-width: 340px;
  text-align: center;
}
.login-logo { font-size: 44px; }
.login-card h1 { font-size: 22px; margin: 10px 0 6px; }
.login-sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.login-card input {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 15px; margin-bottom: 12px; background: #fff; outline: none;
}
.login-card input:focus { border-color: var(--leaf); }
.login-err { color: #d0654f; font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 54px; background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 14px;
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 600; font-size: 15px; flex: 1; white-space: nowrap; }
.clock { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.menu-btn { display: none; background: none; border: none; font-size: 20px; color: var(--ink); }
.logout-btn { font-size: 13px; padding: 6px 12px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: calc(100dvh - 54px); }
.sidebar {
  width: 190px; flex-shrink: 0; background: var(--card); border-right: 1px solid var(--line);
  padding: 18px 12px; display: flex; flex-direction: column; justify-content: space-between;
}
.nav-title { font-size: 11px; color: var(--muted); letter-spacing: 2px; padding: 0 10px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 10px 10px; margin-bottom: 4px; border: none; background: none; border-radius: 10px;
  font-size: 14px; color: var(--ink);
}
.nav-item:hover { background: var(--leaf-soft); }
.nav-item.active { background: var(--leaf-soft); color: #5b8a4a; font-weight: 600; }
.tag {
  font-size: 9px; background: var(--line); color: var(--muted); border-radius: 8px; padding: 2px 6px;
  letter-spacing: .5px;
}
.nav-foot { font-size: 11px; color: var(--muted); padding: 0 10px; }
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 25; }

/* ---------- 内容 ---------- */
.content { flex: 1; padding: 22px; min-width: 0; }
.module { max-width: 860px; margin: 0 auto; }
.crumb {
  font-size: 13px; color: var(--muted); background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 14px; margin-bottom: 12px;
  overflow-x: auto; white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
}
.crumb a { color: var(--leaf); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }

.filebox { display: flex; gap: 12px; align-items: flex-start; }
.file-list {
  flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; min-height: 200px;
}
.file-row {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  border-bottom: 1px solid var(--line); min-height: 44px; cursor: pointer;
  user-select: none;
}
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: var(--leaf-soft); }
.file-row .ico { font-size: 17px; width: 24px; text-align: center; }
.file-row .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.empty-tip { padding: 40px; text-align: center; color: var(--muted); }

.preview {
  width: 46%; max-width: 420px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; position: sticky; top: 68px;
}
.preview-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-bottom: 1px solid var(--line);
  font-size: 13px; font-weight: 600;
}
.preview-body { padding: 14px; font-size: 13px; line-height: 1.8; overflow: auto; max-height: 62vh; white-space: normal; word-break: break-word; }
.preview-body.nowrap { white-space: pre; }
.preview-tools { display: flex; align-items: center; gap: 8px; }
.toggle { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); cursor: pointer; user-select: none; }
.toggle input { accent-color: var(--leaf); }
.preview-edit {
  width: 100%; border: none; padding: 14px; font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 12.5px; line-height: 1.7; min-height: 52vh; resize: vertical; outline: none; background: #fcfbf7;
}

/* ---------- 按钮 ---------- */
.btn {
  border: none; border-radius: 10px; padding: 11px 18px; font-size: 14px; font-weight: 600;
}
.btn.primary { background: var(--leaf); color: #fff; width: 100%; }
.btn.primary:hover { background: #6d9d5c; }
.btn.ghost { background: none; border: 1px solid var(--line); color: var(--muted); }
.btn.ghost:hover { background: var(--leaf-soft); color: var(--ink); }
.btn.small { padding: 4px 10px; font-size: 12px; }

/* ---------- 占位 ---------- */
.placeholder {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 80px 24px; text-align: center; color: var(--ink); font-size: 17px; line-height: 2;
}
.placeholder span { color: var(--muted); font-size: 13px; }

/* ---------- 手机适配 ---------- */
@media (max-width: 768px) {
  .menu-btn { display: block; }
  .clock { display: none; }
  .sidebar {
    position: fixed; top: 54px; bottom: 0; left: 0; z-index: 30;
    transform: translateX(-100%); transition: transform .25s ease;
    width: 220px; box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 12px; }
  .filebox { flex-direction: column; }
  .preview { width: 100%; max-width: none; position: static; }
  .file-row .meta { display: none; }
  .topbar { padding: 0 10px; }
  .login-card { padding: 32px 24px; }
}
@media (max-width: 420px) {
  .brand { font-size: 14px; }
}

/* ===== v2 互动空间 ===== */
.welcome {
  padding: 18px 20px; font-size: 15px; line-height: 1.8;
  background: var(--card);
  border-radius: 12px; margin-bottom: 14px; border: 1px solid var(--line);
}
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 760px) { .home-grid { grid-template-columns: 1fr; } }
.card {
  background: #fff; border: 1px solid #eee; border-radius: 12px; padding: 14px 16px; margin-bottom: 14px;
}
.card-title { font-weight: 600; font-size: 13px; color: var(--leaf); margin-bottom: 10px; }
.kv { display: flex; gap: 8px; padding: 4px 0; font-size: 13px; }
.kv-k { color: var(--muted); flex: 0 0 64px; }
.status-note { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #eee; color: var(--muted); font-size: 12px; line-height: 1.7;  white-space: pre-wrap; }
.status-note.clamped { max-height: 122px; overflow: hidden; position: relative; }
.status-note.clamped::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 30px; background: linear-gradient(to bottom, rgba(251,252,250,0), var(--card)); pointer-events: none; }
.note-toggle { display: block; margin: 10px auto 0; padding: 5px 16px; font: inherit; font-size: 12px; color: var(--leaf); background: var(--card); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.note-toggle:active { transform: scale(0.97); }
.msg-title { font-weight: 600; font-size: 13px; }
.msg-preview { margin-top: 6px; color: #555; font-size: 12.5px; line-height: 1.7; }
.more-link { display: inline-block; margin-top: 8px; color: var(--leaf); text-decoration: none; font-size: 12px; }
.progress { height: 8px; background: #f0ede6; border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--leaf), #a8d8a8); border-radius: 4px; transition: width .4s; }
.progress-text { margin-top: 6px; font-size: 12px; color: var(--muted); }
.feed-item { cursor: pointer; }
.feed-body { margin: 0; padding: 0; font-size: 12.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.muted { color: var(--muted); font-weight: 400; font-size: 12px; }
/* 评论区 */
.comments { margin-top: 12px; padding-top: 10px; border-top: 1px dashed #eee; }
.comments-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.comment-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.comment { background: #faf8f4; border-radius: 8px; padding: 8px 10px; }
.c-head { font-size: 11px; color: var(--muted); }
.c-body { font-size: 12.5px; margin-top: 2px; line-height: 1.6; }
.comment-empty { font-size: 12px; color: var(--muted); padding: 4px 0; }
.comment-form { display: flex; gap: 8px; }
.comment-input { flex: 1; border: 1px solid #e5e0d6; border-radius: 8px; padding: 8px 10px; font-size: 12.5px; outline: none; background: #fff; }
.comment-input:focus { border-color: var(--leaf); }
.nav-foot a { color: var(--muted); text-decoration: none; }

/* ===== 铃铛通知 ===== */
.bell-btn { position: relative; background: none; border: none; font-size: 18px; cursor: pointer; padding: 4px 6px; margin: 0 2px; }
.bell-dot { position: absolute; top: -3px; right: -5px; background: #e05c5c; color: #fff; font-size: 10px; border-radius: 8px; padding: 0 4px; min-width: 15px; text-align: center; line-height: 15px; }
.bell-panel {
  position: absolute; top: 52px; right: 12px; width: 320px; max-width: calc(100vw - 24px);
  max-height: 60vh; overflow-y: auto; background: #fff; border: 1px solid #eee;
  border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.10); z-index: 60; padding: 12px;
}
.bell-title { font-weight: 600; font-size: 13px; color: var(--leaf); margin-bottom: 8px; }
.bell-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.bell-item:hover { background: #faf8f4; }
.bell-item.new { background: #fdf6e9; }
.bell-item.new:hover { background: #f9ecd8; }
.bell-group { margin-top: 4px; }
.bell-group-title { font-weight: 600; font-size: 12px; color: var(--leaf); opacity: .85; padding: 6px 4px 2px; border-bottom: 1px dashed #eee; }
.bell-all { display: block; width: 100%; margin-top: 10px; text-align: center; }
.flash { animation: flashbg 1.2s ease 2; border-radius: 12px; }
@keyframes flashbg { 0%,100% { background: #fff; } 50% { background: #fdf0c8; } }

/* ===== 笔记板块 ===== */
.note-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.note-tab {
  background: #fff; border: 1px solid #e5e0d6; border-radius: 999px;
  padding: 7px 16px; font-size: 12.5px; cursor: pointer; color: #666;
  transition: all .2s;
}
.note-tab:hover { border-color: var(--leaf); color: var(--leaf); }
.note-tab.active { background: var(--leaf); border-color: var(--leaf); color: #fff; font-weight: 600; }

/* ===== Markdown 渲染（足迹阅读区）===== */
.preview-body h1 { font-size: 20px; font-weight: 700; margin: 18px 0 10px; line-height: 1.4; }
.preview-body h2 { font-size: 17px; font-weight: 700; margin: 18px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); line-height: 1.4; }
.preview-body h3 { font-size: 15px; font-weight: 600; margin: 14px 0 6px; line-height: 1.4; }
.preview-body p { margin: 0 0 10px; line-height: 1.85; }
.preview-body blockquote { margin: 12px 0; padding: 8px 14px; border-left: 3px solid var(--leaf); background: var(--leaf-soft); border-radius: 0 8px 8px 0; color: #55604a; }
.preview-body blockquote p { margin: 4px 0; }
.preview-body ul, .preview-body ol { margin: 0 0 10px; padding-left: 22px; }
.preview-body li { margin: 4px 0; line-height: 1.75; }
.preview-body code { background: #f0ede6; padding: 1px 6px; border-radius: 5px; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.9em; color: #b05a38; }
.preview-body strong { font-weight: 700; }
.preview-body em { font-style: italic; }
.preview-body hr.md-hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.preview-body .md-sep { margin: 20px 0 12px; text-align: center; }
.preview-body .md-sep span { display: inline-block; font-size: 12px; color: var(--muted); background: var(--leaf-soft); padding: 4px 14px; border-radius: 20px; }
.preview-body .md-empty { color: var(--muted); font-size: 13px; }

/* ===== 紧凑列表（日记/笔记/留言入口）===== */
.feed { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.feed-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--card); border-bottom: 1px solid var(--line); cursor: pointer; }
.feed-row:hover { background: var(--leaf-soft); }
.feed-row .feed-ico { font-size: 16px; width: 24px; text-align: center; flex-shrink: 0; }
.feed-row .feed-date { color: var(--muted); font-size: 12px; white-space: nowrap; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.feed-row .feed-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-row .feed-arrow { color: var(--muted); font-size: 13px; flex-shrink: 0; }
.feed-row.mini { cursor: default; padding: 7px 4px; border-bottom: none; background: none; }
.feed-row.mini:hover { background: none; }
.feed-row.mini .feed-ico { width: 20px; font-size: 14px; }
.feed-row.mini .feed-title { color: #555; }
.feed-detail { background: var(--card); border-bottom: 1px solid var(--line); padding: 4px 14px 14px; }

/* 留言板输入（2026.08.31 KiKi 加） */
#board-input {
  width: 100%; min-height: 72px; box-sizing: border-box;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink); font: inherit; resize: vertical;
  margin-bottom: 8px;
}
#board-input:focus { outline: none; border-color: var(--leaf); }
