:root {
  --primary: #1a365d; --gold: #c7a02a; --gold-light: #e8c84a; --gold-dark: #a68520;
  --green: #38a169; --red: #e53e3e; --bg: #0b1121; --card: #111b2e; --card-2: #162440;
  --text: #edf2f7; --muted: #94a3b8; --text-2: #bcc7d8; --border: rgba(255,255,255,.1);
  --radius: 14px; --rail-w: 68px; --top-h: 52px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --bar: rgba(11,17,33,.92); --sheet: #0e172b; --inset: rgba(0,0,0,.28);
  --rail: color-mix(in srgb, var(--bg) 72%, #000 28%);
  --font: var(--font-stack, "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f7f8fb; --card: #fff; --card-2: #f1f5f9; --text: #142033; --muted: #64748b; --text-2: #334155;
  --border: rgba(15,23,42,.12); --gold-light: #8a6b12; --bar: rgba(247,248,251,.94); --sheet: #fff; --inset: #f4f6fa; --rail: #eef1f6;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: var(--page-font-size, 16px)/1.6 var(--font); -webkit-text-size-adjust: 100%; }
body { overscroll-behavior-y: none; }
a { color: var(--gold-light); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 600; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gold { color: var(--gold-light); }
.red { color: #fc8181; }
.green { color: #68d391; }

/* 按钮 / 表单：热区 >= 44px */
.btn { min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255,255,255,.05); display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); border: 0; color: #111; font-weight: 600; }
.btn.danger { color: #fc8181; border-color: rgba(229,62,62,.4); }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .5; pointer-events: none; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input, select.input, textarea.input { width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--inset); outline: none; font-size: 16px; }
.input:focus { border-color: var(--gold); }
textarea.input { resize: vertical; min-height: 96px; }
.seg { display: flex; background: rgba(255,255,255,.05); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; min-height: 38px; border: 0; background: none; border-radius: 9px; color: var(--muted); }
.seg button.on { background: var(--card-2); color: var(--gold-light); font-weight: 600; }
.chip { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: none; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.chip.on { border-color: var(--gold); color: var(--gold-light); background: rgba(199,160,42,.12); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: rgba(199,160,42,.15); color: var(--gold-light); }
.tag.gray { background: rgba(255,255,255,.08); color: var(--muted); }
.tag.green { background: rgba(56,161,105,.18); color: #68d391; }
.tag.red { background: rgba(229,62,62,.18); color: #fc8181; }

/* 卡片 / 列表 */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 12px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: block; color: inherit; }
.item:active { background: var(--card-2); }
.item.row { display: flex; }
.item h3 { font-size: 16px; margin-bottom: 4px; }
.item p { margin: 4px 0 0; color: var(--text-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price { color: var(--gold-light); font-weight: 600; }
.jn-board { display: flex; flex-wrap: wrap; gap: 0.35rem 1.6rem; margin: 0.15rem 0 1rem; }
.jn-stat { position: relative; border: 0; border-radius: 12px; background: transparent; min-width: 2.75rem; padding: 0.5rem 0.72rem 0.7rem; text-align: left; color: inherit; }
.jn-stat-n { display: block; font-size: 1.85rem; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -0.04em; line-height: 1; color: var(--muted); }
.jn-stat-l { display: block; margin-top: 0.4rem; font-size: 0.72rem; letter-spacing: 0.04em; color: var(--muted); }
.jn-stat:hover:not(.is-on) { background: color-mix(in srgb, var(--text) 7%, var(--bg)); }
.jn-stat:hover:not(.is-on) .jn-stat-n, .jn-stat.is-on .jn-stat-n { color: var(--text); }
.jn-stat.is-on .jn-stat-l { color: color-mix(in srgb, var(--text) 74%, transparent); }
.jn-stat.is-on::after { content: ""; position: absolute; left: 0.72rem; bottom: 0.42rem; width: 1.15rem; height: 1.5px; border-radius: 1px; background: var(--gold); }
.jn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.35rem 0.9rem; padding-top: 14px; }
.jn-grid > .empty { grid-column: 1 / -1; }
.jn-card { --jn-ink: #8e1c22; --jn-band: linear-gradient(#f8e4e2, #f3d0cd); --jn-roll: linear-gradient(90deg, #e7b4b0, #f6ddd9 40%, #e8b8b4 70%, #d9a09c); --jn-tail: linear-gradient(#e8b8b4, #d7a6a2); position: relative; display: flex; flex-direction: column; min-height: 248px; border-radius: 16px; background: color-mix(in srgb, var(--jn-ink) 7%, #fffdfb); border: 1px solid color-mix(in srgb, var(--jn-ink) 18%, #efe6da); color: #2c261c; }
a.jn-card { color: #2c261c; text-decoration: none; }
.jn-card-app { --jn-ink: #a68520; --jn-band: linear-gradient(#fbf3dc, #f6e7c0); --jn-roll: linear-gradient(90deg, #e6d3a0, #fbf6e6 40%, #edd9a4 70%, #dcc48a); --jn-tail: linear-gradient(#ead7a6, #d4bc82); }
.jn-card-mcp { --jn-ink: #1b628c; --jn-band: linear-gradient(#e5f3fa, #d3e8f4); --jn-roll: linear-gradient(90deg, #b9d7e8, #eef7fb 40%, #c5e0ee 70%, #a9cfe2); --jn-tail: linear-gradient(#c5e0ee, #a8cde3); }
.jn-card-report { --jn-ink: #2f6b4f; --jn-band: linear-gradient(#e3f3ea, #cfe6d8); --jn-roll: linear-gradient(90deg, #b7d8c4, #eef8f2 40%, #c5e4d2 70%, #a9d0bb); --jn-tail: linear-gradient(#c5e4d2, #a8cfba); }
.jn-card-in { flex: 1; display: flex; flex-direction: column; gap: 0.5rem; min-height: 0; padding: 1.35rem 1rem 0.7rem; }
.jn-ribbon { position: absolute; left: 8px; top: -12px; z-index: 2; display: flex; align-items: center; rotate: -7deg; filter: drop-shadow(0 1px 2px rgba(20, 16, 12, 0.12)); }
.jn-ribbon b { padding: 4px 12px 5px; font-size: 13px; font-weight: 700; letter-spacing: 0.14em; color: var(--jn-ink); background: var(--jn-band); }
.jn-ribbon i { width: 9px; height: 26px; border-radius: 5px; background: var(--jn-roll); }
.jn-ribbon s { position: absolute; left: 3px; top: 18px; width: 16px; height: 14px; background: var(--jn-tail); clip-path: polygon(0 0, 100% 0, 100% 68%, 50% 100%, 0 68%); text-decoration: none; }
.jn-badges { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.jn-card-top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.5rem; }
.jn-badge { font-size: 0.72rem; padding: 0.12rem 0.5rem; border-radius: 999px; border: 1px solid color-mix(in srgb, #2c261c 16%, #efe6da); color: color-mix(in srgb, #2c261c 62%, transparent); }
.jn-card .jn-badge-skill, .jn-card .jn-badge-app, .jn-card .jn-badge-mcp, .jn-card .jn-badge-report { border-color: color-mix(in srgb, var(--jn-ink) 40%, #efe6da); color: var(--jn-ink); }
.jn-card .jn-uses { font-size: 0.75rem; color: color-mix(in srgb, #2c261c 52%, transparent); white-space: nowrap; }
.jn-card .jn-go, .jn-card .jn-ok, .jn-card .jn-buy { font-size: 0.92rem; font-weight: 800; letter-spacing: 0.06em; padding: 0.2rem 0.62rem; border-radius: 999px; line-height: 1.25; }
.jn-card .jn-go { color: #8a6208; background: #fff6d4; box-shadow: inset 0 0 0 1px #e4c56a; }
.jn-card .jn-ok { color: #1f7a45; background: #e8f7ee; box-shadow: inset 0 0 0 1px #9ed4b4; }
.jn-card .jn-buy { color: #2d6294; background: #f3f8fd; box-shadow: inset 0 0 0 1px #b7d4ee; }
.jn-card h3 { margin: 0; font-size: 1rem; line-height: 1.35; color: #2c261c; }
.jn-summary { margin: 0; font-size: 0.85rem; line-height: 1.5; color: color-mix(in srgb, #2c261c 70%, transparent); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.jn-foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 0.75rem; }
.jn-owner { min-width: 0; font-size: 0.76rem; color: color-mix(in srgb, #2c261c 55%, transparent); }
.jn-price { margin-left: auto; display: inline-flex; align-items: baseline; color: #9a6708; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1; }
.jn-price i { font-style: normal; font-size: 0.78rem; font-weight: 700; }
.jn-price b { font-size: 1.28rem; font-weight: 800; letter-spacing: -0.03em; }
.jn-price s { margin-left: 0.18rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-decoration: none; color: color-mix(in srgb, #9a6708 72%, #2c261c); }
.jn-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; min-height: 46px; margin-top: auto; padding: 0.55rem 0.75rem; border-top: 1px solid color-mix(in srgb, var(--jn-ink) 14%, #efe6da); }
.jn-ent { flex: 1; min-width: 0; font-size: 0.76rem; color: color-mix(in srgb, #2c261c 62%, transparent); }
.jn-actions .btn { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; background: color-mix(in srgb, #fff 82%, var(--jn-ink)); color: #3a3226; border-color: color-mix(in srgb, var(--jn-ink) 20%, #e6dcc8); }
.jn-actions .btn.primary { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); border: 0; color: #111; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv > :nth-child(odd) { color: var(--muted); }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th, table.t td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.t th { color: var(--muted); font-weight: 500; white-space: nowrap; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* 应用框架：左侧菜单 + 顶栏 + 内容。窄屏左侧菜单收成抽屉。 */
.shell { height: 100vh; height: 100dvh; display: flex; background: var(--bg); }
.stage { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; background: var(--bg); }
.topbar { flex: none; z-index: 20; height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) 12px 0; display: flex; align-items: center; gap: 8px; background: var(--bg); border-bottom: 1px solid var(--border); }
html[data-theme="light"] .topbar, html[data-theme="light"] .composer { background: #f7f8fb; color: #142033; }
.topbar h1 { font-size: 17px; flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.topbar .icon { width: 44px; height: 44px; border: 0; background: none; display: grid; place-items: center; font-size: 20px; color: var(--text-2); border-radius: 12px; }
#menu { display: none; }
.view { flex: 1; align-self: center; overflow: auto; -webkit-overflow-scrolling: touch; padding: 14px 14px calc(20px + var(--safe-b)); width: min(880px, 100%); }
body.chat-mode .stage > .topbar, body.chat-mode .view { display: none; }
body.home .topbar h1 { visibility: hidden; }
@media (min-width: 900px) { body.home .stage > .topbar { display: none; } }
.rail { width: var(--rail-w); flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px 16px; background: var(--rail); border-right: 1px solid var(--border); z-index: 6; }
.rail-logo { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 8px; border-radius: 12px; background: #fff; overflow: hidden; }
.rail-logo img { width: 100%; height: 100%; object-fit: cover; }
.rail-grow { flex: 1; }
.rail-item { position: relative; width: 44px; height: 44px; border: 0; border-radius: 13px; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.rail-item svg, .rail-item img { width: 22px; height: 22px; display: block; object-fit: contain; }
.rail-item img { border-radius: 6px; }
.rail-item.on, .rail-item:hover { color: var(--gold-light); background: rgba(199,160,42,.14); }
.rail-item .tip { position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); padding: 5px 9px; border-radius: 8px; background: var(--card); border: 1px solid var(--border); color: var(--text); font-size: 12px; font-weight: 650; white-space: nowrap; opacity: 0; pointer-events: none; box-shadow: 0 10px 28px rgba(0,0,0,.28); z-index: 8; }
.rail-item:hover .tip, .rail-item:focus-visible .tip { opacity: 1; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(160deg, var(--primary), #0b1121); color: #fff; font-size: 13px; font-weight: 700; }

/* 首页 */
.hero { border-radius: 18px; padding: 22px 18px; background: radial-gradient(120% 140% at 100% 0%, rgba(199,160,42,.28), transparent 60%), linear-gradient(160deg, #13244a, #0e1830); border: 1px solid rgba(199,160,42,.25); color: #f7fafc; }
.hero h2 { font-size: 22px; letter-spacing: 2px; color: #f7fafc; }
.hero p, .hero .muted, .hero .small { margin: 6px 0 0; color: #d6e0ee; font-size: 14px; }
html[data-theme="light"] .hero { background: radial-gradient(120% 140% at 100% 0%, rgba(199,160,42,.2), transparent 58%), linear-gradient(160deg, #fff, #f3f6fb); border-color: rgba(15,23,42,.08); color: #142033; }
html[data-theme="light"] .hero h2 { color: #142033; }
html[data-theme="light"] .hero p, html[data-theme="light"] .hero .muted, html[data-theme="light"] .hero .small { color: #475569; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.grid4 a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 4px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); color: var(--text); font-size: 13px; }
.grid4 a b { font-size: 24px; font-weight: 400; }
.grid4 img { width: 28px; height: 28px; object-fit: contain; border-radius: 8px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 20px 2px 10px; font-size: 16px; font-weight: 600; }
.section-title a { font-size: 13px; font-weight: 400; }

/* 辉小智 */
.chat { position: absolute; inset: 0; display: flex; background: var(--bg); z-index: 5; }
.chat-side { width: 260px; flex: none; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--card); min-height: 0; }
.chat-side .hd { display: flex; align-items: center; gap: 8px; padding: calc(10px + var(--safe-t)) 12px 10px; border-bottom: 1px solid var(--border); }
.chat-side .hd .icon { width: 32px; height: 32px; padding: 0; border: 0; background: none; color: var(--text-2); display: grid; place-items: center; border-radius: 8px; }
.chat-side .hd .icon:hover { color: var(--gold-light); background: rgba(199,160,42,.14); }
.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.chat .topbar { position: relative; }
.msgs { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 12px 8px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.msg { max-width: 760px; margin: 0 auto 14px; display: flex; }
.msg.user { justify-content: flex-end; }
.bubble { max-width: 88%; padding: 10px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--border); word-break: break-word; overflow-wrap: anywhere; }
.msg.user .bubble { background: linear-gradient(135deg, #2a4a7f, #1f3a66); border-color: transparent; color: #fff; white-space: pre-wrap; border-bottom-right-radius: 4px; }
.msg.assistant .bubble { border-bottom-left-radius: 4px; width: 100%; max-width: 100%; }
.msg.assistant .bubble .md > :first-child { margin-top: 0; }
.msg.assistant .bubble .md > :last-child { margin-bottom: 0; }
.msg.assistant .bubble .md .kb-table-wrap { overflow-x: auto; margin: 8px 0; }
.msg.assistant .bubble .md table { border-collapse: collapse; font-size: 14px; min-width: 100%; }
.msg.assistant .bubble .md th, .msg.assistant .bubble .md td { border: 1px solid var(--border); padding: 6px 10px; white-space: nowrap; }
.msg.assistant .bubble .md th { background: rgba(255,255,255,.05); color: var(--gold-light); }
.msg .tools { display: flex; gap: 6px; margin-top: 6px; }
.msg .tools button { border: 0; background: none; color: var(--muted); font-size: 12px; min-height: 30px; padding: 0 6px; }
.thinking { font-size: 12px; color: var(--muted); border-left: 2px solid var(--border); padding-left: 8px; margin-bottom: 6px; max-height: 88px; overflow: hidden; white-space: pre-wrap; }
.typing::after { content: "▍"; animation: blink 1s steps(1) infinite; color: var(--gold); }
@keyframes blink { 50% { opacity: 0; } }
.composer { flex: 0 0 auto; padding: 8px 10px calc(8px + var(--safe-b)); border-top: 1px solid var(--border); background: var(--bar); }
.composer .usage { max-width: 760px; margin: 0 auto 6px; font-size: 12px; color: var(--muted); display: flex; justify-content: flex-end; }
.chat .topbar { overflow: visible; }
.model-wrap { position: relative; flex: none; }
.model-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: var(--card); color: var(--gold-light); font-weight: 800; display: grid; place-items: center; overflow: hidden; }
.model-btn img, .mopt img { width: 22px; height: 22px; object-fit: contain; }
.model-btn[aria-expanded="true"] { border-color: var(--gold); }
.plus-wrap, .mode-wrap { position: relative; flex: none; align-self: flex-end; }
.plus, .mode-btn { height: 36px; border: 0; background: transparent; color: var(--text-2); display: grid; place-items: center; border-radius: 50%; }
.mode-btn { width: auto; min-width: 52px; padding: 0 8px; border-radius: 999px; font-size: 13px; font-weight: 650; color: var(--text); }
.plus.on, .plus:hover, .mode-btn:hover, .model-btn:hover { color: var(--gold-light); background: rgba(199,160,42,.14); }
.pop { position: absolute; z-index: 40; min-width: 168px; padding: 6px; border: 1px solid var(--border); border-radius: 14px; background: var(--sheet); box-shadow: 0 12px 32px rgba(0,0,0,.28); }
.pop[hidden] { display: none !important; }
.pop.up { bottom: calc(100% + 8px); left: 0; }
.model-wrap > .pop:not(.sub) { top: calc(100% + 6px); left: 0; right: auto; min-width: 248px; }
.pop button { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; padding: 6px 10px; border: 0; border-radius: 10px; background: transparent; color: inherit; font-size: 14px; text-align: left; }
.pop button.on, .pop button:hover:not(:disabled) { background: rgba(199,160,42,.12); color: var(--gold-light); }
#c-mode-menu button { flex-direction: column; align-items: flex-start; }
.pop button span { font-size: 12px; color: var(--muted); font-weight: 400; }
.pop button.mopt { justify-content: flex-start; gap: 8px; }
.mopt span { font-size: 14px; color: inherit; font-weight: 650; }
.efforts { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 8px 8px 40px; }
.efforts button { width: auto; min-height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border); font-size: 13px; font-weight: 650; }
.efforts button.on { background: var(--gold); color: #111; border-color: var(--gold); }
.pop .caret { color: var(--muted); padding: 4px 2px 4px 10px; }
.pop .muted { padding: 6px 10px; }
.thread-tools { padding: 8px 10px 0; display: flex; flex-direction: column; gap: 6px; }
.thread-tools .filters { display: flex; gap: 6px; }
.thread-tools .chip.on { background: var(--gold); color: #111; }
.th { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.th .arch { border: 0; background: none; color: var(--muted); font-size: 12px; flex: none; }
.jump { position: absolute; right: 16px; bottom: 92px; border: 1px solid var(--border); background: var(--card); color: inherit; border-radius: 999px; padding: 4px 10px; font-size: 12px; z-index: 2; }
.group { max-width: 760px; margin: 0 auto 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); overflow: hidden; }
.group-hd { width: 100%; text-align: left; border: 0; background: transparent; color: var(--gold-light); padding: 8px 12px; font-weight: 600; }
.group-card, .group-row { padding: 0 12px 8px; font-size: 13px; }
.group-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; border-top: 1px solid var(--border); padding-top: 8px; }
.group-row.on b { color: var(--gold-light); }
.group-row p { flex: 1 0 100%; margin: 0; color: var(--muted); }
.composer .queue, .composer .tools, .composer .pins, .composer .mention { max-width: 760px; margin: 0 auto 6px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.composer .tools .chip.on { background: var(--gold); color: #111; }
.composer .mention { display: block; border: 1px solid var(--border); border-radius: 12px; background: var(--bar); overflow: hidden; }
.composer .mention[hidden], .composer .pins[hidden] { display: none; }
.composer .mention button { display: block; width: 100%; text-align: left; padding: 8px 12px; border: 0; background: transparent; color: inherit; }
.composer .mention button:hover { background: var(--inset); }
.composer .box { max-width: 760px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px; }
.composer .box.shell { height: auto; flex: none; gap: 2px; padding: 6px 6px 6px 4px; border: 1px solid var(--border); border-radius: 28px; background: var(--card); box-shadow: 0 8px 24px rgba(0,0,0,.1); }
.composer textarea { flex: 1; min-height: 44px; max-height: 160px; resize: none; padding: 11px 14px; border-radius: 22px; border: 1px solid var(--border); background: var(--inset); outline: none; font-size: 16px; line-height: 1.4; }
.composer .box.shell textarea { border: 0; background: transparent; border-radius: 0; min-height: 36px; padding: 8px 6px; }
.composer .send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--gold), var(--gold-dark)); color: #111; font-size: 18px; flex: none; }
.composer .send.stop { background: #4a5568; color: #fff; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 24px; }
.welcome { text-align: center; padding: 40px 12px 0; }
.welcome .logo { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 18px; }

/* 抽屉 / 弹层 */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 60; opacity: 0; transition: opacity .2s; }
.mask.on { opacity: 1; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(84vw, 340px); z-index: 61; background: var(--sheet); border-right: 1px solid var(--border); transform: translateX(-100%); transition: transform .22s; display: flex; flex-direction: column; padding-top: var(--safe-t); }
.drawer.on { transform: none; }
.drawer .list { padding: 10px; overflow-y: auto; flex: 1; gap: 4px; }
.chat-side .th, .drawer .th { display: flex; align-items: center; gap: 8px; padding: 0 12px; min-height: 46px; border-radius: 10px; color: var(--text-2); }
.chat-side .th.on, .drawer .th.on { background: var(--card-2); color: var(--gold-light); }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; max-height: 88vh; overflow-y: auto; background: var(--sheet); border-radius: 18px 18px 0 0; border-top: 1px solid var(--border); padding: 8px 16px calc(20px + var(--safe-b)); transform: translateY(100%); transition: transform .22s; }
.sheet.on { transform: none; }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.2); margin: 4px auto 14px; }
.sheet h2 { font-size: 18px; margin-bottom: 12px; }
.toast { position: fixed; left: 50%; top: calc(var(--safe-t) + 70px); transform: translateX(-50%); z-index: 99; max-width: 86vw; padding: 10px 18px; border-radius: 12px; background: var(--sheet); border: 1px solid var(--border); font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.28); }
.toast.err { border-color: rgba(229,62,62,.5); color: #feb2b2; }
html[data-theme="light"] .toast.err { color: #c53030; background: #fff5f5; }

/* 阅读器 */
.reader { white-space: pre-wrap; line-height: 1.85; font-size: 16px; color: var(--text); word-break: break-word; }

/* 登录 */
.auth { min-height: 100%; display: flex; flex-direction: column; justify-content: center; padding: calc(24px + var(--safe-t)) 20px calc(24px + var(--safe-b)); max-width: 420px; margin: 0 auto; }
.brand { text-align: center; margin-bottom: 26px; }
.brand img { width: 72px; height: 72px; border-radius: 20px; }
.brand h1 { font-size: 26px; letter-spacing: 4px; margin-top: 10px; }
.brand p { color: var(--muted); margin: 6px 0 0; font-size: 13px; letter-spacing: 1px; }
.code-row { display: flex; gap: 8px; }
.code-row .btn { flex: none; min-width: 110px; }
.links { display: flex; justify-content: space-between; margin-top: 14px; font-size: 14px; }

.prefs { display: flex; flex-wrap: wrap; gap: 10px; }
.prefs .field { flex: 1; min-width: 140px; margin-bottom: 0; }
.meter { height: 8px; border-radius: 99px; background: rgba(127,127,127,.18); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--gold); }
.meter i.warn { background: #dd6b20; }
.meter i.full { background: var(--red); }
.days { display: flex; align-items: flex-end; gap: 6px; height: 108px; }
.daybar { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; }
.daybar i { width: 100%; margin-top: auto; background: var(--gold); border-radius: 4px 4px 0 0; min-height: 2px; }
.daybar span { font-size: 10px; color: var(--muted); margin-top: 4px; }
.skill-body { white-space: pre-wrap; line-height: 1.75; }
.src-code { margin: 0; padding: 12px; max-height: 64vh; overflow: auto; background: rgba(127,127,127,.08); border: 1px solid var(--border); border-radius: 10px;
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; tab-size: 4; color: var(--text); }
@media (max-width: 899px) {
  #menu { display: grid; }
  .rail { position: fixed; top: 0; bottom: 0; left: 0; width: min(78vw, 280px); transform: translateX(-105%); transition: transform .22s; z-index: 70; align-items: stretch; padding: calc(12px + var(--safe-t)) 10px calc(12px + var(--safe-b)); overflow-y: auto; }
  .shell.nav-open .rail { transform: none; }
  .rail-item { width: auto; justify-content: flex-start; gap: 10px; padding: 0 10px; }
  .rail-item .tip { position: static; opacity: 1; transform: none; background: none; border: 0; box-shadow: none; padding: 0; color: inherit; font-size: 15px; font-weight: 500; }
  .rail-logo { margin-left: 6px; }
  .chat-side { position: absolute; inset: 0 auto 0 0; width: min(84vw, 320px); transform: translateX(-105%); transition: transform .22s; z-index: 6; }
  .chat-side.on { transform: none; }
}
@media (min-width: 900px) {
  .chat [data-a="drawer"], .chat-mask { display: none !important; }
  #nav-mask { display: none !important; }
}
@media (min-width: 768px) {
  .view { padding-top: 24px; }
  .grid4 { gap: 14px; }
  .list.cols { display: grid; grid-template-columns: 1fr 1fr; }
  .sheet { left: 50%; width: 520px; transform: translate(-50%, 110%); border-radius: 18px; bottom: 24px; }
  .sheet.on { transform: translate(-50%, 0); }
  .sheet.wide { width: min(960px, calc(100vw - 48px)); }
}
.sheet.center { left: 50%; right: auto; top: 50%; bottom: auto; width: min(520px, calc(100vw - 32px)); border-radius: 18px; padding: 18px 16px 20px; transform: translate(-50%, -42%); opacity: 0; transition: transform .22s, opacity .2s; }
.sheet.center.on { transform: translate(-50%, -50%); opacity: 1; }
.sheet.center .grab { display: none; }
