/* 公众号写作工作台 · PWA 样式（移动端优先） */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
  --primary: #2f54eb; --primary-dark: #1d3fc4;
  --bg: #f7f8fa; --card: #ffffff; --text: #222; --muted: #8a8f99;
  --border: #e6e8ec; --ok: #22a06b; --warn: #d97a00; --danger: #d64545;
  --radius: 14px;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  display: flex; flex-direction: column;
  overscroll-behavior: none;
}

/* 头部 */
#app-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--primary); color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px;
  display: flex; align-items: center; justify-content: space-between;
  min-height: 52px;
}
#app-header h1 { font-size: 17px; font-weight: 600; }
#header-actions { display: flex; gap: 8px; }
#header-actions button {
  background: rgba(255,255,255,.18); color: #fff; border: none;
  padding: 6px 12px; border-radius: 8px; font-size: 13px;
}

/* 主内容 */
#app-main { flex: 1; overflow-y: auto; padding: 12px 12px calc(76px + env(safe-area-inset-bottom)); }
.view { display: none; }
.view.active { display: block; }
.panel { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.panel h3 { font-size: 14px; margin: 14px 0 8px; }
.panel h3:first-child { margin-top: 0; }

label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input[type=text], textarea, select {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 15px; font-family: inherit;
  background: #fff; color: var(--text); outline: none;
}
input:focus, textarea:focus { border-color: var(--primary); }
.row { display: flex; gap: 8px; }
.row input { flex: 1; }

button {
  border: none; border-radius: 10px; padding: 10px 16px;
  font-size: 15px; cursor: pointer; background: #eef0f4; color: var(--text);
}
button.primary { background: var(--primary); color: #fff; }
button.ghost { background: transparent; border: 1px solid var(--border); color: var(--primary); }
button:disabled { opacity: .5; }

/* 卡片列表 */
.card-list { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--card); border-radius: var(--radius); padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05); cursor: pointer;
}
.card .card-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.card .card-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.card .card-excerpt { font-size: 13px; color: #555; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tag {
  display: inline-block; background: #eef1ff; color: var(--primary);
  font-size: 11px; border-radius: 6px; padding: 2px 6px;
}
.badge { font-size: 11px; border-radius: 6px; padding: 2px 6px; }
.badge.todo { background: #fff3e0; color: var(--warn); }
.badge.done { background: #e6f7ef; color: var(--ok); }
.badge.drop { background: #fdecec; color: var(--danger); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }

/* 浮动按钮 */
.fab {
  position: fixed; right: 18px; bottom: calc(84px + env(safe-area-inset-bottom));
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 26px; line-height: 1;
  box-shadow: 0 4px 12px rgba(47,84,235,.4); z-index: 20;
}

/* 底部导航 */
#tab-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  background: #fff; border-top: 1px solid var(--border);
  display: flex; padding-bottom: env(safe-area-inset-bottom);
}
#tab-bar button {
  flex: 1; background: none; border: none; padding: 8px 0 6px;
  font-size: 12px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px;
}
#tab-bar button.active { color: var(--primary); font-weight: 600; }
#tab-bar button span { font-size: 11px; }

/* 筛选 chip */
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; }
.chip {
  white-space: nowrap; background: #fff; border: 1px solid var(--border);
  border-radius: 16px; padding: 6px 12px; font-size: 13px; color: var(--muted);
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 状态提示 */
.status { font-size: 13px; color: var(--muted); margin-top: 8px; min-height: 18px; }
.status.error { color: var(--danger); }

/* 结果区 */
#hot-result, #ai-result { margin-top: 4px; }
.result-box {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  font-size: 13px; line-height: 1.7; overflow-x: auto;
  margin-bottom: 10px; white-space: pre-wrap; word-break: break-word;
}
.result-box table { border-collapse: collapse; width: 100%; font-size: 12px; }
.result-box th, .result-box td { border: 1px solid var(--border); padding: 6px; text-align: left; }
.result-box h1, .result-box h2, .result-box h3 { margin: 10px 0 6px; font-size: 15px; }
.result-box h1 { font-size: 17px; }
.result-box ul, .result-box ol { padding-left: 20px; margin: 6px 0; }
.result-box a { color: var(--primary); }
.result-box blockquote { border-left: 3px solid var(--border); padding-left: 10px; color: var(--muted); margin: 6px 0; }

/* 编辑浮层 */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.4);
  display: flex; align-items: flex-end; justify-content: center;
}
.overlay.hidden { display: none; }
.editor-sheet {
  background: var(--bg); width: 100%; max-width: 640px;
  border-radius: 18px 18px 0 0; max-height: 92vh;
  display: flex; flex-direction: column;
}
.editor-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: #fff; border-radius: 18px 18px 0 0;
  border-bottom: 1px solid var(--border);
}
.editor-title { font-size: 15px; font-weight: 600; }
.editor-close { font-size: 18px; color: var(--muted); padding: 4px 8px; cursor: pointer; }
.editor-body { padding: 14px 16px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; }
.editor-body h3 { font-size: 14px; margin: 12px 0 6px; }
.editor-body h3:first-child { margin-top: 0; }
.editor-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.editor-actions button { flex: 1; min-width: 90px; }

/* 表格（编辑）小输入 */
.inline-row { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-row input { flex: 1; min-width: 70px; }

/* 检查清单 */
.check-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; }
.check-item .mark { font-size: 15px; }
