/* ==========================================================================
   任务秘书 · H5 样式
   深蓝商务基调（沿用原小程序主题色 #1e3a5f），移动端优先。
   目标：干净、克制、信息密度够，但不像企业 OA 那样冷。
   ========================================================================== */

:root {
  --navy: #1e3a5f;
  --navy-deep: #16293f;
  --navy-soft: #2d5480;
  --accent: #e8913a;
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1c2b3a;
  --text-sub: #6b7c8f;
  --text-faint: #9aa8b8;
  --line: #e6ebf1;
  --danger: #d9534f;
  --ok: #3aa76d;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(30, 58, 95, .06), 0 6px 20px rgba(30, 58, 95, .05);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; font-size: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; font-size: inherit; }

/* ---------------------------------------------------------------- 页面骨架 */

#app { min-height: 100vh; }

.page {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px calc(84px + env(safe-area-inset-bottom, 0px));
}

.hero {
  padding: 28px 4px 18px;
}
.hero-greet { font-size: 24px; font-weight: 600; letter-spacing: -.3px; }
.hero-sub { margin-top: 6px; color: var(--text-sub); font-size: 13.5px; }
.hero-sub b { color: var(--navy); }
.hero-sub b.warn { color: var(--danger); }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.section { margin-bottom: 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-title { font-size: 13px; font-weight: 600; color: var(--text-sub); letter-spacing: .4px; }

.link-btn { color: var(--navy-soft); font-size: 13.5px; }

/* ---------------------------------------------------------------- 进度 */

.prog-bar { height: 6px; background: #eef2f7; border-radius: 3px; overflow: hidden; }
.prog-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--navy-soft), var(--navy)); border-radius: 3px; transition: width .35s ease; }
.prog-text { margin-top: 8px; font-size: 12.5px; color: var(--text-faint); }

/* ---------------------------------------------------------------- 任务列表 */

.task {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: transform .12s ease;
}
.task:active { transform: scale(.985); }
.task-overdue { border-left: 3px solid var(--danger); }

.check {
  flex: 0 0 auto;
  width: 21px; height: 21px; margin-top: 2px;
  border: 1.8px solid #c8d3e0;
  border-radius: 50%;
  transition: all .15s ease;
}
.check:active { background: var(--navy-soft); border-color: var(--navy-soft); }
.check-sm { width: 17px; height: 17px; }

.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 15.5px; line-height: 1.45; word-break: break-word; }
.task-meta { margin-top: 5px; font-size: 12.5px; color: var(--text-faint); display: flex; gap: 10px; flex-wrap: wrap; }
.meta-overdue { color: var(--danger); }
.meta-sub { color: var(--navy-soft); }

/* ---------------------------------------------------------------- 空状态 */

.empty { text-align: center; padding: 46px 20px; }
.empty-icon { font-size: 34px; color: #cdd8e4; margin-bottom: 10px; }
.empty-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.empty-sub { font-size: 13.5px; color: var(--text-faint); margin-bottom: 20px; }
.empty-sm { padding: 26px 20px; }
.empty-sm .empty-sub { margin-bottom: 0; }

/* ---------------------------------------------------------------- 按钮 */

.btn-primary {
  background: var(--navy); color: #fff;
  padding: 11px 22px; border-radius: 10px;
  font-size: 14.5px; font-weight: 500;
  transition: opacity .15s;
}
.btn-primary:active { opacity: .82; }
.btn-primary:disabled { opacity: .5; }
.btn-block { display: block; width: 100%; margin-top: 14px; }

.btn-danger { background: #fdecec; color: var(--danger); padding: 12px; border-radius: 10px; font-size: 14.5px; }

.foot-note { text-align: center; font-size: 12px; color: var(--text-faint); padding: 26px 0 10px; line-height: 1.9; }

/* ---------------------------------------------------------------- 底部标签 */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 100;
}
.tab-item {
  flex: 1; text-align: center;
  padding: 11px 0 9px;
  color: var(--text-faint); text-decoration: none;
  font-size: 12.5px;
  transition: color .15s;
}
.tab-item.active { color: var(--navy); font-weight: 600; }
.tab-dot { display: block; width: 5px; height: 5px; border-radius: 50%; background: currentColor; margin: 0 auto 5px; opacity: .35; }
.tab-item.active .tab-dot { opacity: 1; }

/* ---------------------------------------------------------------- 对话页 */

/* 对话页：占满剩余屏幕，但底部必须给 fixed 定位的 tabbar 让位。
   否则输入框和「发送」会被 tabbar 盖住 —— 用户点不到发送键（冒烟测试实测复现）。 */
.page-chat {
  display: flex; flex-direction: column;
  height: calc(100vh - 62px);
  height: calc(100dvh - 62px - env(safe-area-inset-bottom, 0px));
  padding-bottom: 0;
}

.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 4px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.chat-role { font-size: 16px; font-weight: 600; }

.chat-thread { flex: 1; overflow-y: auto; padding: 16px 0; -webkit-overflow-scrolling: touch; }

.chat-hint { text-align: center; padding: 30px 20px; }
.hint-avatar {
  display: inline-block; padding: 6px 14px; border-radius: 20px;
  background: var(--navy); color: #fff; font-size: 13px; margin-bottom: 14px;
}
.hint-text { font-size: 14.5px; color: var(--text-sub); margin-bottom: 10px; }
.hint-example { font-size: 13px; color: var(--text-faint); font-style: italic; }

.bubble-row { display: flex; margin-bottom: 12px; }
.row-user { justify-content: flex-end; }
.row-ai { justify-content: flex-start; }

.bubble {
  max-width: 82%;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble-user { background: var(--navy); color: #fff; border-bottom-right-radius: 4px; }
.bubble-ai { background: var(--card); box-shadow: var(--shadow); border-bottom-left-radius: 4px; }
.bubble-wide { max-width: 94%; }

.dots i {
  display: inline-block; width: 4px; height: 4px; margin-left: 4px;
  background: var(--text-faint); border-radius: 50%;
  animation: blink 1.2s infinite;
}
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

/* 计划卡 */
.plan-card { margin-top: 4px; }
.plan-summary { font-weight: 600; margin-bottom: 8px; }
.plan-analysis { color: var(--text-sub); font-size: 14px; margin-bottom: 12px; }
.plan-block { margin-bottom: 12px; }
.plan-block-title { font-size: 12.5px; font-weight: 600; color: var(--text-sub); margin-bottom: 6px; }
.plan-questions { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--text-sub); }
.plan-questions li { margin-bottom: 3px; }

.task-preview {
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}
.tp-title { font-weight: 600; font-size: 14.5px; }
.tp-meta { font-size: 12.5px; color: var(--text-faint); margin-top: 4px; }
.tp-subs { margin: 8px 0 0; padding-left: 18px; font-size: 13.5px; color: var(--text-sub); }
.tp-subs li { margin-bottom: 2px; }

/* 输入区 */
.chat-quick { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0; scrollbar-width: none; }
.chat-quick::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 6px 13px; border-radius: 16px;
  background: #eef3f9; color: var(--navy-soft);
  font-size: 13px; white-space: nowrap;
}
.chip:active { background: #e0e9f3; }

.chat-input-bar {
  display: flex; gap: 9px; align-items: center;
  padding: 9px 0 calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.chat-input {
  flex: 1;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  outline: none;
  transition: border-color .15s;
}
.chat-input:focus { border-color: var(--navy-soft); }
.btn-send {
  padding: 11px 18px; border-radius: 22px;
  background: var(--navy); color: #fff; font-size: 14px;
}
.btn-send:disabled { opacity: .5; }

/* 气泡下方的小动作按钮（记成任务 / 加入今日 的轻量形态） */
.btn-mini {
  margin: 2px 0 0 2px;
  padding: 7px 16px; border-radius: 16px;
  background: var(--card); color: var(--navy);
  border: 1px solid var(--line);
  font-size: 13px;
  box-shadow: var(--shadow);
}
.btn-mini:active { background: #eef3f9; }

/* ---------------------------------------------------------------- 详情页 */

.detail-head { display: flex; align-items: center; gap: 10px; padding: 18px 0 14px; }
.back-btn { font-size: 21px; color: var(--navy); line-height: 1; padding: 4px 8px 4px 0; }
.detail-kicker { font-size: 13px; color: var(--text-sub); letter-spacing: .5px; }

.detail-title { font-size: 19px; font-weight: 600; line-height: 1.45; }
.detail-title.done { text-decoration: line-through; color: var(--text-faint); }
.detail-desc { margin-top: 8px; color: var(--text-sub); font-size: 14px; }

.detail-meta { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.meta-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13.5px; }
.meta-k { color: var(--text-faint); }
.meta-v.warn { color: var(--danger); }

.subs { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.sub { display: flex; align-items: center; gap: 11px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.sub:last-child { border-bottom: none; }
.sub-title { font-size: 14.5px; }
.sub-done .sub-title { text-decoration: line-through; color: var(--text-faint); }

.detail-actions { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }

/* ---------------------------------------------------------------- 我的 */

.stat-card { display: flex; text-align: center; padding: 18px 8px; }
.stat { flex: 1; }
.stat b { display: block; font-size: 24px; font-weight: 600; color: var(--navy); }
.stat span { font-size: 12.5px; color: var(--text-faint); }

.row {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card);
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
.section .row:first-of-type { border-radius: var(--radius) var(--radius) 0 0; }
.section .row:last-child { border-radius: 0 0 var(--radius) var(--radius); border-bottom: none; }
.row-k { font-size: 14.5px; color: var(--text-sub); }
.row-v { font-size: 14px; color: var(--text); }
.row-v.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--text-faint); }
.row-v.warn { color: var(--danger); }

/* ---------------------------------------------------------------- Toast / Loading */

.ms-toast {
  position: fixed; left: 50%; bottom: 96px;
  transform: translate(-50%, 12px);
  background: rgba(28, 43, 58, .93);
  color: #fff; font-size: 14px;
  padding: 10px 20px; border-radius: 22px;
  opacity: 0; pointer-events: none;
  transition: all .22s ease;
  z-index: 3000; max-width: 82vw; text-align: center;
}
.ms-toast.show { opacity: 1; transform: translate(-50%, 0); }

.ms-loading {
  position: fixed; inset: 0; display: none;
  align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .22); z-index: 2900;
}
.ms-loading.show { display: flex; }
.ms-loading-box {
  background: rgba(28, 43, 58, .92); color: #fff;
  padding: 20px 26px; border-radius: 14px; text-align: center;
}
.ms-spinner {
  width: 24px; height: 24px; margin: 0 auto 10px;
  border: 2.5px solid rgba(255, 255, 255, .28);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ms-loading-text { font-size: 13.5px; }

/* ---------------------------------------------------------------- 弹层 */

.ms-mask {
  position: fixed; inset: 0;
  background: rgba(16, 26, 38, .42);
  display: none; align-items: center; justify-content: center;
  z-index: 3100;
}
.ms-mask.show { display: flex; }

.ms-dialog {
  background: #fff; border-radius: 16px;
  width: min(320px, 84vw); padding: 22px 20px 16px;
  text-align: center;
}
.ms-dialog-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.ms-dialog-body { font-size: 14px; color: var(--text-sub); margin-bottom: 18px; line-height: 1.6; }
.ms-dialog-actions { display: flex; gap: 10px; }
.ms-dialog-actions button { flex: 1; padding: 11px; border-radius: 10px; font-size: 14.5px; }
.ms-btn-plain { background: #f0f3f7; color: var(--text-sub); }
.ms-btn-primary { background: var(--navy); color: #fff; }

.ms-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px));
  max-height: 70vh; overflow-y: auto;
  animation: slideUp .22s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.ms-sheet { margin-top: auto; }
.ms-mask.show { align-items: flex-end; }
.ms-mask.show:has(.ms-dialog) { align-items: center; }
.ms-sheet-title { text-align: center; font-size: 13px; color: var(--text-faint); padding: 10px 0 12px; }
.ms-sheet-item {
  display: block; width: 100%; text-align: left;
  padding: 14px 22px; font-size: 15px;
  border-bottom: 1px solid var(--line);
}
.ms-sheet-item:active { background: #f5f8fb; }
.ms-sheet-cancel { text-align: center; color: var(--text-sub); border-bottom: none; margin-top: 6px; }
