:root {
  --bg: #0b1220; --bg2: #131d33; --ink: #e9eef7; --muted: #93a2bd;
  --rule: #24334f; --accent: #e3b34f; --accent2: #4f8fe0;
}
/* 关键：隐藏类（弹窗、昵称行等依赖它）。此前缺失导致两个弹窗常驻盖满全屏、关不掉 */
.hidden { display: none !important; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg); color: var(--ink); height: 100vh;
  display: flex; flex-direction: column;
}
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--rule);
  background: rgba(11,18,32,0.9); position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; color: var(--accent); }
.quota { font-size: 13px; color: var(--muted); }
.top-right { display: flex; align-items: center; gap: 14px; }
.navlink {
  color: var(--accent2); text-decoration: none; font-size: 13px; font-weight: 600;
  border: 1px solid var(--accent2); border-radius: 999px; padding: 5px 12px;
}
.navlink:hover { background: rgba(79,143,224,0.15); }
.authbtn {
  color: var(--accent2); background: transparent; border: 1px solid var(--accent2);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.authbtn:hover { background: rgba(79,143,224,0.15); }
.authname { color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer; }
.subbtn {
  color: #0b1220; background: linear-gradient(135deg, var(--accent), #d9a83c);
  border: 1px solid transparent; border-radius: 999px; padding: 5px 14px;
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.subbtn:hover { filter: brightness(1.06); }
.sub-body { display: flex; flex-direction: column; gap: 14px; }
.sub-plan { font-size: 14px; color: var(--muted); }
.sub-plan b { color: var(--accent); font-size: 26px; margin: 0 2px; }
.sub-feats { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 9px; font-size: 13px; color: var(--ink); line-height: 1.6; }
.sub-feats li::before { content: "✓ "; color: var(--accent); font-weight: 700; }
.sub-body .primary, .auth-form .primary { width: 100%; }

/* —— 弹窗 / 卡片 —— */
.modal {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: rgba(6,10,20,.62); backdrop-filter: blur(6px); padding: 16px;
}
.modal-box {
  width: 340px; max-width: 94vw; border-radius: 18px; padding: 22px;
  color: var(--ink);
  background:
    radial-gradient(130% 90% at 0% 0%, rgba(227,179,79,.10), transparent 55%),
    #141e35;
  border: 1px solid rgba(146,163,189,.22);
  box-shadow: 0 26px 64px -20px rgba(0,0,0,.75), inset 0 1px 0 rgba(255,255,255,.05);
  position: relative;
}
.modal-tabs { display: flex; gap: 6px; margin-bottom: 16px; align-items: center; }
.modal-tabs button {
  flex: 1; padding: 8px 10px; border-radius: 10px; background: transparent; color: var(--muted);
  border: 1px solid transparent; cursor: pointer; font-weight: 600; font-size: 13.5px;
  transition: color .2s, background .2s, border-color .2s, box-shadow .2s, transform .2s;
}
.modal-tabs button:hover { color: var(--ink); }
.modal-tabs button.active {
  color: #0b1220; border-color: #e8c56a;
  background: linear-gradient(135deg, var(--accent), #dda93f);
  box-shadow: 0 8px 20px -8px rgba(227,179,79,.6);
}
.modal-tabs .close {
  flex: 0 0 auto; width: 32px; height: 32px; margin-left: 2px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 12px;
  font-size: 18px; line-height: 1; cursor: pointer; transition: all .2s;
}
.modal-tabs .close:hover { color: #ff8380; background: rgba(255,131,128,.10); border-color: rgba(255,131,128,.35); transform: rotate(90deg); }

/* —— 表单 —— */
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form label { font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; letter-spacing: .2px; }
.auth-form input {
  background: rgba(11,18,32,.6); color: var(--ink); border: 1px solid var(--rule);
  border-radius: 10px; padding: 10px 12px; font-size: 14px; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.auth-form input::placeholder { color: #5a6b88; }
.auth-form input:focus { border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(79,143,224,.18); background: #0b1220; }
.auth-err {
  color: #ff8380; font-size: 12.5px; line-height: 1.5;
  background: rgba(255,131,128,.08); border: 1px solid rgba(255,131,128,.25);
  border-radius: 9px; padding: 7px 10px;
}

/* —— 主按钮 —— */
button.primary {
  cursor: pointer; border: 1px solid transparent; border-radius: 12px;
  color: #0b1220; font-weight: 700; font-size: 14px; padding: 11px 0;
  background: linear-gradient(135deg, var(--accent), #dda93f);
  box-shadow: 0 10px 24px -10px rgba(227,179,79,.55);
  transition: transform .18s cubic-bezier(.2,.9,.3,1.3), box-shadow .18s, filter .18s;
}
button.primary:hover { transform: translateY(-1px); filter: brightness(1.05); box-shadow: 0 14px 28px -10px rgba(227,179,79,.62); }
button.primary:active { transform: translateY(0) scale(.98); }
button.primary:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

/* —— 弹窗开启动效 —— */
.modal { opacity: 0; }
.modal:not(.hidden) { opacity: 1; transition: opacity .22s ease; }
.modal .modal-box { scale: .96; translate: 0 14px; }
.modal:not(.hidden) .modal-box {
  scale: 1; translate: 0 0;
  transition: scale .3s cubic-bezier(.22,1,.32,1), translate .3s cubic-bezier(.22,1,.32,1);
}
@starting-style {
  .modal:not(.hidden) { opacity: 1; }
  .modal:not(.hidden) .modal-box { scale: 1; translate: 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .modal, .modal .modal-box { transition: none !important; }
  .modal .modal-box { scale: 1; translate: 0 0; }
}
.chat-wrap { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.chat-list { flex: 1; padding: 18px; max-width: 720px; width: 100%; margin: 0 auto; }
.welcome { text-align: center; padding: 30px 0; }
.welcome h1 { font-size: 22px; margin-bottom: 8px; }
.welcome p { color: var(--muted); font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.chips button {
  background: var(--bg2); color: var(--ink); border: 1px solid var(--rule);
  border-radius: 999px; padding: 8px 14px; font-size: 13px; cursor: pointer;
}
.chips button:hover { border-color: var(--accent); color: var(--accent); }
.hot { margin-top: 22px; }
.hot-title { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.msg .related { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--rule); }
.msg .related > div { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.msg .related button {
  display: block; width: 100%; text-align: left; margin-bottom: 6px;
  background: transparent; color: var(--accent2); border: 1px solid var(--rule);
  border-radius: 8px; padding: 7px 10px; font-size: 13px; cursor: pointer;
}
.msg .related button:hover { border-color: var(--accent); color: var(--accent); }
.msg { max-width: 85%; padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; font-size: 14.5px; line-height: 1.7; white-space: pre-wrap; }
.msg.user { margin-left: auto; background: linear-gradient(135deg, var(--accent), #d9a83c); color: #0b1220; }
.msg.bot { background: var(--bg2); border: 1px solid var(--rule); }
.msg .src { display: block; margin-top: 8px; font-size: 12px; color: var(--accent2); }
.msg .src a { color: var(--accent2); text-decoration: none; word-break: break-all; }
.msg p:first-child { white-space: pre-wrap; }
/* ---- 证据链卡片 ---- */
.evi { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--rule); }
.evi-block { margin-bottom: 10px; }
.evi-h { font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 6px; letter-spacing: .5px; }
.evi-basis { display: block; font-size: 12.5px; color: var(--accent2); padding: 4px 0; text-decoration: none; }
.evi-basis:hover { color: var(--accent); }
/* 政策时效徽标 */
.evi-valid {
  display: inline-block; margin-left: 6px; padding: 1px 7px; font-style: normal;
  font-size: 10.5px; color: var(--accent); border: 1px solid rgba(227,179,79,.45);
  border-radius: 999px; background: rgba(227,179,79,.08); vertical-align: 1px;
}
.evi-valid.expired {
  color: #ff8380; border-color: rgba(255,131,128,.45); background: rgba(255,131,128,.08);
}
.evi-basis .need { font-style: normal; color: #ff7b7b; border: 1px solid #ff7b7b; border-radius: 4px; padding: 0 5px; margin-left: 6px; font-size: 10px; }
ol.actions { margin: 0; padding-left: 18px; }
ol.actions li { font-size: 13px; color: var(--muted); margin-bottom: 6px; line-height: 1.6; }
/* ---- 决策树引导 ---- */
.decision { background: rgba(79,143,224,.08); border: 1px solid rgba(79,143,224,.35); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.d-q { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
.d-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.branch-btn { background: var(--bg); color: var(--accent2); border: 1px solid rgba(79,143,224,.5); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; cursor: pointer; transition: .18s; }
.branch-btn:hover { background: rgba(79,143,224,.18); color: var(--ink); border-color: var(--accent); }
.decision.d-done .d-btns { opacity: .45; pointer-events: none; }
.d-src { font-size: 11px; color: var(--muted); margin-top: 8px; }
.input-bar {
  display: flex; gap: 10px; padding: 12px 18px;
  border-top: 1px solid var(--rule); background: rgba(11,18,32,0.95);
  max-width: 720px; width: 100%; margin: 0 auto;
}
.input-bar textarea {
  flex: 1; resize: none; border: 1px solid var(--rule); border-radius: 10px;
  background: var(--bg2); color: var(--ink); padding: 10px 12px; font-size: 14.5px;
  font-family: inherit; min-height: 44px;
}
.input-bar button {
  border: none; border-radius: 10px; padding: 0 20px; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #0b1220;
  font-weight: 700;
}
.disclaimer { text-align: center; font-size: 12px; color: var(--muted); padding: 8px; border-top: 1px solid var(--rule); }
@media (max-width: 480px) { .welcome h1 { font-size: 18px; } }
