:root {
  --brand: #0f3d3e;
  --brand-2: #16595a;
  --gold: #e9c46a;
  --bg: #f5f6f4;
  --panel: #ffffff;
  --ink: #1d2626;
  --muted: #6b7777;
  --line: #e3e7e5;
  --user: #0f3d3e;
  --bot: #ffffff;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
}
button { font: inherit; cursor: pointer; color: inherit; }
.hidden { display: none !important; }
.fine { font-size: 12px; color: var(--muted); line-height: 1.5; }
.center { text-align: center; }
.muted { color: var(--muted); }
@media (min-width: 821px) { .mobile-only { display: none !important; } }

#app { display: flex; height: 100vh; height: 100dvh; }

/* ---------- sidebar ---------- */
.sidebar {
  width: 290px; flex-shrink: 0; background: var(--brand); color: #fff;
  display: flex; flex-direction: column; padding: 22px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; margin: 0 6px 26px; }
.brand b { display: block; font-size: 18px; letter-spacing: .3px; }
.brand small { display: block; font-size: 12px; opacity: .7; }
.logo {
  width: 36px; height: 36px; border-radius: 10px; background: var(--gold); color: var(--brand);
  display: grid; place-items: center; font-weight: 800; font-size: 19px;
}
.advisor-nav { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.nav-item {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; background: transparent; border: 1px solid transparent;
  border-radius: 12px; padding: 12px; color: #fff; transition: background .15s;
}
.nav-item:hover { background: rgba(255,255,255,.07); }
.nav-item.active { background: rgba(255,255,255,.12); border-color: rgba(233,196,106,.5); }
.nav-item b { display: block; font-size: 15px; }
.nav-item small { display: block; font-size: 12px; opacity: .7; line-height: 1.45; margin-top: 2px; }
.nav-ico { font-size: 20px; line-height: 1.2; }
.side-foot .fine { color: rgba(255,255,255,.55); margin-top: 12px; }
.btn-ghost {
  background: transparent; border: 1px solid var(--gold); color: var(--gold); border-radius: 10px; padding: 10px 14px; font-weight: 600;
}
.btn-ghost:hover { background: rgba(233,196,106,.1); }
.full { width: 100%; }

/* ---------- main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.landing { flex: 1; overflow-y: auto; display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.landing-inner { max-width: 960px; width: 100%; }
.landing h1 { font-size: 34px; line-height: 1.3; margin: 0 0 12px; color: var(--brand); }
.lead { font-size: 16px; color: var(--muted); margin: 0 0 32px; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.card {
  text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px;
  display: flex; flex-direction: column; gap: 6px; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(15,61,62,.08); border-color: var(--brand-2); }
.card-ico { font-size: 28px; }
.card-tag { font-size: 12px; color: var(--brand-2); background: #e6f0ee; align-self: flex-start; padding: 2px 8px; border-radius: 99px; }
.card b { font-size: 18px; margin-top: 4px; }
.card small { color: var(--muted); font-size: 13px; line-height: 1.5; }
.card-go { margin-top: 10px; color: var(--brand-2); font-weight: 600; font-size: 14px; }

/* ---------- chat ---------- */
.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 24px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.head-title { flex: 1; min-width: 0; }
.head-title b { display: block; font-size: 16px; }
.head-title small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-text { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font-size: 13px; color: var(--muted); }
.btn-text:hover { border-color: var(--brand-2); color: var(--brand-2); }
.btn-text.accent { border-color: var(--brand); color: var(--brand); font-weight: 600; }
.icon-btn { background: none; border: 0; font-size: 28px; line-height: 1; padding: 0 6px 4px 0; color: var(--brand); }

.messages { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 18px; -webkit-overflow-scrolling: touch; }
.messages > * { width: 100%; max-width: 820px; margin-left: auto; margin-right: auto; }
.msg { display: flex; gap: 10px; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble {
  background: var(--user); color: #fff; border-radius: var(--radius) var(--radius) 4px var(--radius);
  padding: 10px 14px; max-width: 78%; white-space: pre-wrap; word-break: break-word;
}
.avatar { width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; background: #e6f0ee; display: grid; place-items: center; font-size: 16px; }
.bot-col { flex: 1; min-width: 0; max-width: calc(100% - 42px); }
.msg.bot .bubble {
  background: var(--bot); border: 1px solid var(--line); border-radius: 4px var(--radius) var(--radius) var(--radius);
  padding: 12px 16px; word-break: break-word;
}
.msg.err .bubble { border-color: #f0c2c2; background: #fff6f6; }

.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md h3, .md h4, .md h5, .md h6 { margin: 14px 0 6px; font-size: 15px; color: var(--brand); }
.md ul, .md ol { margin: 4px 0 10px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md li > ul, .md li > ol { margin: 2px 0; }
.md strong { color: #0c2f30; }
.md a { color: var(--brand-2); }
.md code { background: #f0f3f2; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.md pre { background: #f0f3f2; padding: 10px; border-radius: 8px; overflow-x: auto; }
.md blockquote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--gold); background: #fbf8ef; color: #4a4a3a; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.tbl { overflow-x: auto; margin: 6px 0 12px; }
.md table { border-collapse: collapse; font-size: 13.5px; min-width: 100%; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.md th { background: #f3f6f5; white-space: nowrap; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip { border: 1px solid var(--brand-2); background: #fff; color: var(--brand-2); border-radius: 99px; padding: 6px 14px; font-size: 13.5px; font-weight: 600; }
.chip.advisor { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip:hover { filter: brightness(1.05); }
.tools { display: flex; gap: 4px; margin-top: 4px; opacity: .55; transition: opacity .15s; }
.msg.bot:hover .tools, .tools:focus-within { opacity: 1; }
.tool { background: none; border: 0; padding: 2px 6px; font-size: 12.5px; border-radius: 6px; color: var(--muted); }
.tool:hover { background: #e9eeec; }
.tool.on { background: #e6f0ee; opacity: 1; }

.starters { display: flex; flex-wrap: wrap; gap: 8px; padding-left: 42px; }
.starter {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font-size: 13.5px; text-align: left;
  color: var(--ink);
}
.starter:hover { border-color: var(--brand-2); color: var(--brand-2); }

.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: #9fb3b1; animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.composer {
  display: flex; gap: 10px; align-items: flex-end; padding: 12px 24px calc(14px + var(--safe-b)); background: var(--panel); border-top: 1px solid var(--line);
}
.composer textarea {
  flex: 1; resize: none; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font: inherit; font-size: 15px;
  max-height: 160px; outline: none; background: #fafbfa; max-width: 100%;
}
.composer textarea:focus { border-color: var(--brand-2); background: #fff; }
.composer button {
  width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; flex-shrink: 0;
}
.composer button:disabled { opacity: .45; cursor: default; }
@media (min-width: 821px) {
  .composer { justify-content: center; }
  .composer textarea { max-width: 766px; }
}

/* ---------- modal & toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(10,30,30,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-card { background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 420px; position: relative; }
.modal-card h3 { margin: 0 0 6px; color: var(--brand); }
.modal-card .muted { font-size: 13.5px; margin: 0 0 16px; }
.modal-card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.modal-card input, .modal-card textarea {
  display: block; width: 100%; margin-top: 4px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 15px; color: var(--ink);
}
.modal-x { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 24px; color: var(--muted); }
.btn-primary { background: var(--brand); color: #fff; border: 0; border-radius: 10px; padding: 12px; font-weight: 600; font-size: 15px; }
.btn-primary:disabled { opacity: .6; }
.lead-ok { text-align: center; padding: 10px 0; }
.ok-icon { width: 52px; height: 52px; border-radius: 50%; background: #e6f0ee; color: var(--brand); display: grid; place-items: center; font-size: 26px; margin: 0 auto 10px; }
.lead-ok .btn-ghost { color: var(--brand); border-color: var(--brand); }
.toast {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); background: rgba(20,35,35,.92); color: #fff;
  padding: 8px 16px; border-radius: 99px; font-size: 13.5px; z-index: 60; max-width: 90vw;
}

/* ---------- mobile H5 ---------- */
@media (max-width: 820px) {
  .sidebar { display: none; }
  .landing { align-items: flex-start; padding: 28px 16px calc(24px + var(--safe-b)); }
  .landing .brand { display: flex; margin: 0 0 28px; }
  .landing .brand small { color: var(--muted); }
  .landing h1 { font-size: 26px; }
  .lead { font-size: 14.5px; margin-bottom: 22px; }
  .cards { grid-template-columns: 1fr; gap: 12px; }
  .card { padding: 16px 18px; display: grid; grid-template-columns: auto 1fr; column-gap: 14px; row-gap: 2px; align-items: center; }
  .card-ico { grid-row: span 3; font-size: 30px; }
  .card-tag { grid-column: 2; justify-self: start; }
  .card b { margin: 0; font-size: 17px; }
  .card small { grid-column: 2; }
  .card-go { display: none; }
  .chat-head { padding: 10px 12px; gap: 8px; }
  .chat-head .icon-btn { display: block; }
  .btn-text { padding: 5px 9px; font-size: 12.5px; }
  .tabs { display: flex; gap: 6px; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; }
  .tab { flex: 1; white-space: nowrap; border: 1px solid var(--line); background: #fafbfa; border-radius: 99px; padding: 5px 10px; font-size: 13px; }
  .tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
  .messages { padding: 14px 12px; gap: 14px; }
  .avatar { display: none; }
  .bot-col { max-width: 100%; }
  .msg.user .bubble { max-width: 88%; }
  .msg.bot .bubble { padding: 11px 13px; }
  .starters { padding-left: 0; }
  .tools { opacity: .8; }
  .composer { padding: 8px 10px calc(8px + var(--safe-b)); }
  .composer textarea { font-size: 16px; } /* prevents iOS zoom */
}

.verify { font-size: 12px; color: var(--muted); margin: 4px 2px 0; display: flex; align-items: center; gap: 6px; }
.verify:not(.ok)::before { content: ''; width: 10px; height: 10px; border: 2px solid #b9c7c5; border-top-color: var(--brand-2); border-radius: 50%; animation: spin .8s linear infinite; }
.verify.ok { color: var(--brand-2); }
@keyframes spin { to { transform: rotate(360deg); } }

.msg.user.queued .bubble { opacity: .6; }
.msg.user.queued .bubble::after { content: ' · 上一条回答完成后自动发送'; font-size: 11px; opacity: .8; }

.err { color: #b3261e; font-size: 12.5px; margin-top: 4px; }

/* ---------- quick assessment ---------- */
.assess-cta { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; text-align: left; border: 0; border-radius: 16px; padding: 18px 20px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 8px 24px rgba(15,61,62,.18); }
.assess-cta .ac-ico { font-size: 30px; }
.assess-cta .ac-txt { flex: 1; } .assess-cta b { display: block; font-size: 17px; } .assess-cta small { display: block; opacity: .85; font-size: 13px; line-height: 1.5; margin-top: 2px; }
.assess-cta .ac-go { font-weight: 700; color: var(--gold); white-space: nowrap; }
.starter.assess-chip { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }
body.no-scroll { overflow: hidden; }
.assess { position: fixed; inset: 0; background: rgba(10,30,30,.5); z-index: 40; display: grid; place-items: center; }
.assess-card { background: #fff; width: 100%; max-width: 640px; height: 100%; max-height: 100dvh; display: flex; flex-direction: column; }
@media (min-width: 821px) { .assess-card { height: auto; max-height: 92vh; border-radius: 18px; } }
.assess-top { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.assess-back, .assess-x { border: 0; background: none; font-size: 26px; line-height: 1; color: var(--brand); width: 32px; }
.assess-x { color: var(--muted); }
.assess-progress { flex: 1; } .assess-progress small { color: var(--muted); font-size: 12px; }
.assess-bar { height: 6px; background: #e8efed; border-radius: 99px; overflow: hidden; margin-bottom: 3px; }
.assess-bar i { display: block; height: 100%; background: var(--brand-2); width: 0; transition: width .25s; }
.assess-body { padding: 20px 18px calc(24px + var(--safe-b)); overflow-y: auto; flex: 1; }
.assess-body h2 { margin: 4px 0 6px; font-size: 21px; color: var(--brand); line-height: 1.35; }
.assess-body h3 { margin: 20px 0 8px; font-size: 15px; color: var(--ink); }
.assess-body .muted { margin: 0 0 14px; font-size: 13.5px; }
.opts { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.opt { text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 13px 14px; font-size: 15px; line-height: 1.5; }
.opt:hover { border-color: var(--brand-2); } .opt.on { border-color: var(--brand); background: #eaf3f1; }
.opt.chk.on::before { content: '✓ '; color: var(--brand); font-weight: 700; }
.opt.sm { padding: 9px 12px; font-size: 14px; }
.grp { margin: 16px 0; } .grp b { display: block; font-size: 14.5px; margin-bottom: 8px; line-height: 1.5; } .grp .row { display: flex; flex-wrap: wrap; gap: 8px; }
.next { width: 100%; margin-top: 14px; border: 0; border-radius: 12px; padding: 14px; background: var(--brand); color: #fff; font-size: 16px; font-weight: 600; }
.next:disabled { opacity: .4; } .next.ghost { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); }
.linkbtn { display: block; margin: 12px auto 0; background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 13.5px; }
.school input { width: 100%; box-sizing: border-box; border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px; font: inherit; font-size: 15px; margin-top: 4px; }
.hit { display: block; width: 100%; text-align: left; background: #eaf3f1; border: 1px solid #b9d6d0; border-radius: 10px; padding: 9px 12px; margin-top: 8px; font-size: 14px; }
.hit small { color: var(--muted); } .nohit { margin-top: 8px; font-size: 13px; color: #8a5a00; background: #fff7e6; border-radius: 10px; padding: 9px 12px; line-height: 1.55; }
.summary { background: #eaf3f1; border-radius: 12px; padding: 14px; font-size: 15.5px; font-weight: 600; color: var(--brand); line-height: 1.6; }
.warn { background: #fff7e6; border: 1px solid #f0d9a5; border-radius: 12px; padding: 11px 13px; margin-top: 10px; font-size: 13.5px; line-height: 1.6; color: #6b4a00; }
.route { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; background: #fff; }
.route summary { padding: 12px 14px; cursor: pointer; display: flex; gap: 8px; align-items: center; font-weight: 600; }
.route.ok { border-color: #9ccfc4; } .route.no summary { color: var(--muted); font-weight: 500; }
.route > div { padding: 0 14px 12px; font-size: 14px; line-height: 1.65; }
.route .note { color: #6b4a00; background: #fff7e6; border-radius: 8px; padding: 8px 10px; margin-top: 8px; }
.route ul { margin: 4px 0 8px; padding-left: 20px; } .route .src { color: var(--muted); font-size: 12px; margin-top: 6px; }
.also { margin-top: 18px; font-size: 13.5px; color: #444; line-height: 1.65; }
.disc { margin-top: 14px; font-size: 12px; color: var(--muted); line-height: 1.6; border-top: 1px dashed var(--line); padding-top: 12px; }
.cta { margin-top: 14px; }
@media (max-width: 820px) { .assess-cta { padding: 15px 16px; } .assess-cta .ac-go { display: none; } }

.assess-body .purpose { margin: 0 0 8px; font-size: 13.5px; color: #35605b; background: #eef6f4; border-radius: 10px; padding: 8px 11px; line-height: 1.55; }
.opt .ohint { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); font-weight: 400; }
