:root {
  --blue: #1b6bff;
  --blue-bg: #e9f1ff;
  --text: #1f2329;
  --text-2: #4e5969;
  --text-3: #8f959e;
  --line: #eef0f3;
  --bg: #f4f5f7;
  --card: #fff;
  --dark: #1f2633;
  --safe-b: env(safe-area-inset-bottom);
  --tabbar-h: 56px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  color: var(--text); font-size: 15px; -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
a { color: var(--blue); text-decoration: none; }

#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-width: 640px; margin: 0 auto; background: var(--bg); position: relative; overflow: hidden; }
.page { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

/* 顶栏 */
.topbar { background: #fff; padding: calc(env(safe-area-inset-top) + 10px) 16px 0; flex-shrink: 0; }
.brand-row { display: flex; align-items: center; height: 44px; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 600; }
.brand .logo { width: 30px; height: 30px; }
.brand .word { letter-spacing: .5px; }
.brand .sep { width: 1px; height: 18px; background: #c9cdd4; margin: 0 2px; }
.brand .sub { font-weight: 500; }
.top-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.round-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; background: #fff; }
.round-btn svg { width: 18px; height: 18px; }

.tabs { display: flex; gap: 24px; overflow-x: auto; scrollbar-width: none; margin-top: 8px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex-shrink: 0; padding: 10px 0 12px; font-size: 17px; color: var(--text); position: relative; white-space: nowrap; }
.tab.active { color: var(--blue); font-weight: 600; }
.tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 2px; background: var(--blue); }

/* 筛选条 */
.filters { display: flex; align-items: center; gap: 8px; padding: 12px 16px; overflow-x: auto; scrollbar-width: none; flex-shrink: 0; background: var(--bg); }
.filters::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; height: 36px; padding: 0 16px; border-radius: 18px; background: #fff; display: inline-flex; align-items: center; gap: 6px; font-size: 15px; color: var(--text); white-space: nowrap; }
.chip .n { color: var(--text-2); }
.chip.active { background: var(--dark); color: #fff; }
.chip.active .n { color: #fff; }
.chip.project { padding-left: 10px; gap: 6px; }
.chip.project img { width: 20px; height: 20px; border-radius: 4px; }
.chip.project .caret { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--text-2); }
.vsep { width: 1px; height: 20px; background: #d9dce1; flex-shrink: 0; }

/* 事项列表 */
.list { background: #fff; }
.item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.item:active { background: #f7f8fa; }
.item .main { flex: 1; min-width: 0; }
.item .code { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 14px; }
.item .title { margin: 6px 0 10px; font-size: 17px; line-height: 1.5; color: var(--text); word-break: break-all; }
.meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status { height: 24px; padding: 0 7px; border-radius: 3px; font-size: 14px; display: inline-flex; align-items: center; background: var(--blue-bg); color: var(--blue); }
.status.PROCESSING { background: #fff4e6; color: #e8890c; }
.status.COMPLETED { background: #e8f7ee; color: #1f9d55; }
.status.closed { background: #f0f1f3; color: var(--text-3); }
.due { height: 24px; padding: 0 7px; border-radius: 3px; font-size: 13px; display: inline-flex; align-items: center; background: #f0f1f3; color: var(--text-2); }
.due.overdue { background: #fdecec; color: #e5484d; }
.due.soon { background: #fff4e6; color: #d97706; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #f2f3f5; flex-shrink: 0; object-fit: cover; border: 1px solid var(--line); }
.avatar.sm { width: 22px; height: 22px; }
.tico { width: 16px; height: 16px; flex-shrink: 0; }
.prio { width: 18px; height: 18px; flex-shrink: 0; }
.label { height: 20px; padding: 0 6px; border-radius: 3px; font-size: 12px; display: inline-flex; align-items: center; border: 1px solid; }

.empty { padding: 72px 24px; text-align: center; color: var(--text-3); font-size: 14px; }
.empty svg { width: 96px; height: 96px; display: block; margin: 0 auto 12px; opacity: .9; }
.section-title { padding: 18px 16px 8px; font-size: 13px; color: var(--text-3); }
.foot-note { padding: 16px; text-align: center; font-size: 12px; color: var(--text-3); }

/* 底部导航 */
.tabbar { flex-shrink: 0; height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: #f7f8fa; border-top: 1px solid var(--line); display: flex; }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; color: var(--text-2); }
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button.active { color: var(--blue); }

/* 二级页 */
.navbar { flex-shrink: 0; background: #fff; padding-top: env(safe-area-inset-top); border-bottom: 1px solid var(--line); }
.navbar .row { height: 48px; display: flex; align-items: center; padding: 0 8px; }
.navbar .back { width: 40px; height: 40px; display: grid; place-items: center; }
.navbar .back svg { width: 22px; height: 22px; }
.navbar .ttl { flex: 1; text-align: center; font-size: 17px; font-weight: 600; margin-right: 40px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 详情 */
.detail-head { background: #fff; padding: 16px; }
.detail-head h1 { font-size: 20px; line-height: 1.5; margin: 8px 0 12px; font-weight: 600; word-break: break-all; }
.fields { background: #fff; margin-top: 8px; }
.field { display: flex; align-items: center; min-height: 48px; padding: 0 16px; border-bottom: 1px solid var(--line); gap: 12px; }
.field .k { width: 76px; color: var(--text-3); font-size: 14px; flex-shrink: 0; }
.field .v { flex: 1; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px 0; font-size: 15px; }
.block { background: #fff; margin-top: 8px; padding: 16px; }
.block h3 { margin: 0 0 12px; font-size: 16px; }
.md { font-size: 15px; line-height: 1.75; color: var(--text); word-break: break-word; }
.md h1, .md h2, .md h3 { font-size: 16px; margin: 16px 0 8px; }
.md p { margin: 8px 0; }
.md ul, .md ol { padding-left: 20px; margin: 8px 0; }
.md code { background: #f2f3f5; padding: 1px 5px; border-radius: 3px; font-size: 13px; font-family: Menlo, monospace; }
.md pre { background: #f6f7f9; padding: 12px; border-radius: 6px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; font-size: 13px; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 8px; }
.md blockquote { margin: 8px 0; padding: 4px 12px; border-left: 3px solid #dfe1e5; color: var(--text-2); }
.md .img-ph { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; margin: 4px 0; border: 1px dashed #c9cdd4; border-radius: 6px; color: var(--text-3); font-size: 13px; }
.md .md-img { display: block; max-width: 100%; height: auto; margin: 8px 0; border-radius: 6px; border: 1px solid var(--line); }
.comment .body.md p { margin: 0 0 6px; }
.attach { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.att { display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; color: inherit; min-width: 0; }
.att img { width: 100%; height: 96px; object-fit: cover; border-radius: 4px; background: #f2f3f5; }
.att .nm { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .sz { font-size: 12px; color: var(--text-3); }
.wiki-doc { margin-top: 8px; }
.wiki-meta { font-size: 12px; color: var(--text-3); margin-bottom: 10px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 8px 0; font-size: 14px; color: var(--text-2); }
.timeline .t { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.comment { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: 0; }
.comment .who { font-size: 14px; font-weight: 500; }
.comment .when { font-size: 12px; color: var(--text-3); margin-left: 6px; font-weight: 400; }
.comment .body { margin-top: 4px; font-size: 15px; line-height: 1.6; }

/* 迭代卡片 */
.iter { background: #fff; margin: 0 12px 12px; border-radius: 10px; padding: 16px; }
.iter .hd { display: flex; align-items: center; gap: 8px; }
.iter .nm { font-size: 17px; font-weight: 600; flex: 1; }
.iter .st { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--blue-bg); color: var(--blue); }
.iter .st.COMPLETED { background: #e8f7ee; color: #1f9d55; }
.iter .dates { font-size: 13px; color: var(--text-3); margin-top: 6px; }
.iter .goal { font-size: 14px; color: var(--text-2); margin-top: 10px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bar { height: 6px; border-radius: 3px; background: #eef0f3; margin-top: 14px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue); border-radius: 3px; }
.iter .nums { display: flex; gap: 16px; margin-top: 10px; font-size: 13px; color: var(--text-2); }
.iter .nums b { color: var(--text); font-weight: 600; margin-left: 4px; }

/* 提交 / 我 */
.row-card { background: #fff; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.row-card .l1 { font-size: 15px; line-height: 1.5; }
.row-card .l2 { font-size: 12px; color: var(--text-3); margin-top: 4px; display: flex; gap: 8px; }
.sha { font-family: Menlo, monospace; color: var(--blue); }
.me-card { background: #fff; padding: 24px 16px; display: flex; align-items: center; gap: 14px; }
.me-card .avatar { width: 56px; height: 56px; }
.me-card .nm { font-size: 19px; font-weight: 600; }
.me-card .sub { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.cells { background: #fff; margin-top: 8px; }
.cell { display: flex; align-items: center; min-height: 52px; padding: 0 16px; border-bottom: 1px solid var(--line); gap: 12px; }
.cell .k { flex: 1; font-size: 15px; display: flex; align-items: center; gap: 10px; }
.cell .v { color: var(--text-3); font-size: 14px; }
.cell .arr { width: 8px; height: 8px; border-top: 1.5px solid #c9cdd4; border-right: 1.5px solid #c9cdd4; transform: rotate(45deg); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); background: #fff; margin-top: 8px; }
.stats div { padding: 16px 0; text-align: center; }
.stats b { display: block; font-size: 22px; font-weight: 600; }
.stats span { font-size: 12px; color: var(--text-3); }

/* 搜索 */
.search-bar { display: flex; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top) + 10px) 12px 10px; background: #fff; flex-shrink: 0; }
.search-bar .box { flex: 1; height: 38px; border-radius: 19px; background: #f2f3f5; display: flex; align-items: center; padding: 0 12px; gap: 8px; }
.search-bar input { flex: 1; border: 0; background: none; font-size: 15px; outline: none; color: var(--text); }
.search-bar .cancel { color: var(--blue); font-size: 15px; }

/* 底部弹层 */
.sheet-mask { position: absolute; inset: 0; background: rgba(0,0,0,.4); z-index: 20; display: flex; align-items: flex-end; }
.sheet { width: 100%; background: #fff; border-radius: 14px 14px 0 0; padding: 8px 0 calc(8px + var(--safe-b)); max-height: 70%; overflow-y: auto; }
.sheet .opt { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 20px; font-size: 16px; }
.sheet .opt.on { color: var(--blue); font-weight: 600; }
.sheet .hd { padding: 10px 20px; font-size: 13px; color: var(--text-3); }

.toast { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); background: rgba(0,0,0,.78); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; z-index: 30; max-width: 80%; text-align: center; }
