:root {
  --bg: #f6f7f9; --card: #ffffff; --ink: #1d2129; --ink2: #4e5969; --muted: #86909c; --line: #e5e6eb;
  --red: #d4380d; --red-bg: #fff2ee;      /* 最高优先: 反方/警示/涨 */
  --gold: #b7791f; --gold-bg: #fffaf0;    /* 待办/结论/待拍板 */
  --green: #2f8f4e; --green-bg: #f0faf3;  /* 正面/已确认/跌 */
  --blue: #1f6feb; --blue-bg: #f0f6ff;    /* 信息/入口 */
  --gray-bg: #f2f3f5;
  --r: 12px; --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --tabh: 58px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 16px/1.65 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; }
main { max-width: 760px; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 16px calc(var(--tabh) + 24px + env(safe-area-inset-bottom)); min-height: 100vh; }
a { color: var(--blue); text-decoration: none; }
button { font: inherit; white-space: nowrap; flex: none; cursor: pointer; border: 0; border-radius: 10px; padding: 9px 14px; background: var(--gray-bg); color: var(--ink); }
button.primary { background: var(--ink); color: #fff; font-weight: 600; }
button.gold { background: var(--gold); color: #fff; font-weight: 600; }
button.ghost { background: transparent; color: var(--ink2); padding: 6px 8px; }
button.sm { padding: 5px 10px; font-size: 14px; border-radius: 8px; }
button:disabled { opacity: .45; }
textarea, input, select { font: inherit; color: var(--ink); width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
textarea:focus, input:focus { outline: 2px solid var(--blue-bg); border-color: var(--blue); }
h1 { font-size: 22px; margin: 6px 0 14px; letter-spacing: .5px; }
h2 { font-size: 17px; margin: 18px 0 8px; }
.muted { color: var(--muted); font-size: 14px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 16px; margin: 10px 0; border-left: 4px solid transparent; }
.card.red { border-left-color: var(--red); } .card.gold { border-left-color: var(--gold); }
.card.green { border-left-color: var(--green); } .card.blue { border-left-color: var(--blue); }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--gray-bg); color: var(--ink2); line-height: 20px; }
.tag.red { background: var(--red-bg); color: var(--red); } .tag.gold { background: var(--gold-bg); color: var(--gold); }
.tag.green { background: var(--green-bg); color: var(--green); } .tag.blue { background: var(--blue-bg); color: var(--blue); }
.empty { text-align: center; color: var(--muted); padding: 32px 0; }
.err { color: var(--red); font-size: 14px; }

/* 底部导航 */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tabh) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-top: 1px solid var(--line); z-index: 20; }
#tabs a { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 15px; position: relative; }
#tabs a.on { color: var(--ink); font-weight: 600; }
.badge { position: absolute; top: 9px; margin-left: 34px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-style: normal; line-height: 18px; text-align: center; }

/* 发问框 */
.composer { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 12px; }
.composer textarea { border: 0; padding: 4px 2px; resize: none; min-height: 84px; max-height: 40vh; }
.composer textarea:focus { outline: none; }
.seg { display: inline-flex; background: var(--gray-bg); border-radius: 10px; padding: 3px; }
.seg button { background: transparent; padding: 5px 12px; border-radius: 8px; font-size: 14px; color: var(--ink2); }
.seg button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.dock { position: fixed; left: 0; right: 0; bottom: calc(var(--tabh) + env(safe-area-inset-bottom)); z-index: 15; padding: 8px 12px; background: linear-gradient(transparent, var(--bg) 30%); }
.dock .composer { max-width: 736px; margin: 0 auto; padding: 8px 10px; }
.dock textarea { min-height: 44px; }
main.thread { padding-bottom: calc(var(--tabh) + 150px + env(safe-area-inset-bottom)); }

.mic { background: var(--gray-bg); padding: 8px 12px; font-size: 14px; color: var(--ink2); }
.mic.rec { background: var(--red); color: #fff; font-size: 14px; }
.code { font-size: 32px; letter-spacing: 8px; font-weight: 700; text-align: center; margin: 8px 0; }

/* 提醒条 */
.alerts { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.alerts a { flex: 1; min-width: 30%; text-align: center; padding: 10px 6px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.alerts .red { background: var(--red-bg); color: var(--red); } .alerts .gold { background: var(--gold-bg); color: var(--gold); }

/* 问题列表 */
.thread-item { display: block; color: inherit; }
.thread-item .t { font-weight: 600; }
.thread-item .q { color: var(--ink2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 对话 */
.qbubble { overflow-wrap: anywhere; background: var(--blue-bg); border-radius: 14px 14px 4px 14px; padding: 10px 14px; margin: 18px 0 8px 15%; white-space: pre-wrap; }
.answer { margin: 6px 0 14px; }
.md { overflow-wrap: anywhere; }
.md p { margin: .5em 0; } .md ul, .md ol { padding-left: 1.3em; margin: .4em 0; } .md li { margin: .15em 0; }
.md blockquote { margin: .6em 0; padding: 4px 12px; border-left: 3px solid var(--line); color: var(--ink2); }
.md table { border-collapse: collapse; width: 100%; font-size: 14px; } .md td, .md th { border: 1px solid var(--line); padding: 4px 6px; }
.md code { background: var(--gray-bg); padding: 1px 4px; border-radius: 4px; font-size: .9em; }
.md h2, .md h3 { font-size: 16px; margin: .8em 0 .3em; }
.verdict { background: var(--gold-bg); border: 1px solid #f3dfb5; border-left: 4px solid var(--gold); border-radius: var(--r); padding: 10px 14px; margin: 8px 0; }
.verdict p { margin: .3em 0; }
details.sec { background: var(--card); border-radius: 10px; box-shadow: var(--shadow); margin: 8px 0; }
details.sec > summary { list-style: none; padding: 10px 14px; font-weight: 600; display: flex; align-items: center; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::after { content: '展开'; margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 400; }
details.sec[open] > summary::after { content: '收起'; }
details.sec > .md { padding: 0 14px 10px; }
.thinking { color: var(--muted); font-size: 13px; padding: 6px 2px; display: flex; gap: 8px; align-items: center; }
.thinking .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); animation: pulse 1.2s infinite; flex: none; }
@keyframes pulse { 50% { opacity: .25; } }
.thinking .txt { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.phase { font-size: 13px; color: var(--muted); margin: 14px 0 6px; letter-spacing: 1px; }
.council { display: grid; gap: 8px; }
.persona > summary .name { font-weight: 700; }
.persona .angle { font-size: 13px; color: var(--muted); padding: 0 14px 6px; }
.persona .fb { padding: 0 14px 10px; display: flex; gap: 8px; }
.fb button.on.useful { background: var(--green-bg); color: var(--green); }
.fb button.on.useless { background: var(--red-bg); color: var(--red); }

/* 决策卡 */
.decision .opt { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; }
.decision .opt input { width: auto; margin-top: 6px; }
.decision .rec { color: var(--gold); font-weight: 600; }
.score button { min-width: 44px; }
.score button.on { background: var(--ink); color: #fff; }

/* 画像 */
.tabs2 { display: flex; gap: 4px; margin: 8px 0 12px; overflow-x: auto; scrollbar-width: none; }
.tabs2::-webkit-scrollbar { display: none; }
.tabs2 button { white-space: nowrap; background: transparent; color: var(--ink2); padding: 6px 12px; position: relative; }
.tabs2 button.on { background: var(--ink); color: #fff; }
.fact { padding: 10px 0; border-bottom: 1px solid var(--line); }
.fact:last-child { border-bottom: 0; }
.fact .k { font-weight: 600; }
.fact .c { color: var(--ink2); font-size: 15px; white-space: pre-wrap; }
.fact .acts { display: flex; gap: 6px; margin-top: 6px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.kv b { color: var(--ink2); font-weight: 500; }

/* 登录 */
.login { max-width: 360px; margin: 18vh auto 0; text-align: center; }
.login .logo { font-size: 56px; font-weight: 200; letter-spacing: 6px; margin-bottom: 4px; }
.login p { color: var(--muted); }
.login button { width: 100%; padding: 13px; margin-top: 12px; }
.login input { text-align: center; margin-top: 16px; }
details.sec.redteam { border-left: 4px solid var(--red); }
details.sec.redteam > summary { color: var(--red); }
