/* 法助AI H5 —— 移动优先的咨询落地页样式 */
:root {
  --navy: #0b2545;
  --navy-2: #143a67;
  --brand: #1857a4;
  --brand-2: #2b7bd6;
  --gold: #c8a45c;
  --gold-2: #e3c07a;
  --ink: #132033;
  --ink-2: #5b6b82;
  --line: #e6eaf1;
  --bg: #f3f5f9;
  --white: #fff;
  --danger: #c0392b;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(11, 37, 69, .08);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.6;
  overscroll-behavior-y: none;
}

button { font-family: inherit; cursor: pointer; }

#app {
  display: flex;
  height: 100dvh;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ================= sidebar / 抽屉 ================= */
#drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(6, 18, 34, .48);
  z-index: 60;
  opacity: 0;
  transition: opacity .2s ease;
}
#drawer-mask.show { opacity: 1; }
#drawer-mask[hidden] { display: none; }

#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 76vw;
  max-width: 300px;
  background: var(--navy);
  color: #dbe4f0;
  display: flex;
  flex-direction: column;
  padding: 14px 12px calc(14px + var(--safe-b));
  z-index: 70;
  transform: translateX(-102%);
  transition: transform .24s cubic-bezier(.32, .72, 0, 1);
}
#sidebar.open { transform: translateX(0); }

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 12px;
}
.sidebar-logo {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--gold-2);
}
#drawer-close {
  background: transparent;
  border: none;
  color: #9fb0c6;
  font-size: 15px;
  padding: 6px;
}

#new-chat {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  border: none;
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

#thread-list { list-style: none; flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

#thread-list li {
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: #c3d0e0;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
}
#thread-list li.active { background: rgba(43, 123, 214, .28); color: #fff; }
#thread-list li .del-btn {
  background: transparent;
  border: none;
  color: #7f8ea3;
  font-size: 12px;
  padding: 2px 4px;
  flex-shrink: 0;
}

#context-panel {
  border-top: 1px solid rgba(255, 255, 255, .1);
  padding: 12px 4px 0;
  margin-top: 8px;
  color: #b3c1d3;
}
.context-row { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; }
#context-bar { height: 5px; border-radius: 999px; background: rgba(255, 255, 255, .12); overflow: hidden; }
#context-bar span { display: block; width: 0; height: 100%; background: #26c281; transition: width .16s ease, background .16s ease; }
#context-bar.warn span { background: #e6a23c; }
#context-bar.full span { background: #e05252; }
#context-meta { font-size: 11px; color: #7f8ea3; margin-top: 6px; }
#compact-context {
  width: 100%;
  height: 30px;
  margin-top: 8px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 8px;
  background: rgba(255, 255, 255, .06);
  color: #dbe4f0;
  font-size: 12px;
}
#compact-context:disabled { color: #6b7b91; }
#provider-tag {
  font-size: 11px;
  color: #6b7b91;
  text-align: center;
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

/* ================= chat area ================= */
#chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
  position: relative;
  height: 100%;
}

#chat-area header {
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#drawer-toggle {
  width: 30px;
  height: 30px;
  border: none;
  background: rgba(255, 255, 255, .12);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
}
#drawer-toggle span { display: block; width: 14px; height: 1.5px; background: #fff; border-radius: 2px; }

.brand { flex: 1; min-width: 0; }
.brand h1 {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-sub {
  font-size: 11px;
  color: #a9bdd6;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3ddc84;
  box-shadow: 0 0 0 0 rgba(61, 220, 132, .6);
  animation: pulse 1.8s infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(61, 220, 132, .5); }
  70% { box-shadow: 0 0 0 6px rgba(61, 220, 132, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0); }
}

#lead-entry {
  flex-shrink: 0;
  border: none;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #3a2a08;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 13px;
  border-radius: 999px;
}

#doc-chip,
#evidence-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  background: rgba(255, 255, 255, .14);
  border-radius: 999px;
  font-size: 11px;
  color: #fff;
  max-width: 100%;
}
/* hidden 属性必须真正隐藏：作者样式的 display 会覆盖 UA 默认值 */
#doc-chip[hidden],
#evidence-chip[hidden] { display: none; }
#doc-chip .doc-name,
#evidence-chip .evidence-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 42vw; }
#doc-chip .doc-meta,
#evidence-chip .evidence-meta { color: #b8c9de; }
#doc-chip .doc-remove,
#evidence-chip .evidence-remove {
  border: none;
  background: transparent;
  color: #cbd8e8;
  font-size: 11px;
  padding: 0 1px;
}

/* ================= hero ================= */
#hero {
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px 14px 6px;
  overflow-y: auto;
}
#hero[hidden] { display: none; }
#hero:not([hidden]) + #messages:empty { flex: 0 0 0; padding: 0; }
.case-city-entry { display:flex; flex:none; align-items:center; gap:8px; padding:6px 14px; background:#fff; color:#52667d; font-size:12px; }
.case-city-actions { display:flex; flex:none; align-items:center; gap:8px; }
#case-search-status:empty, #case-fees-status:empty { display:none; }
.case-city-entry label { white-space:nowrap; }
.case-city-entry input { width:120px; min-width:0; border:1px solid #dbe3ed; border-radius:6px; padding:5px 8px; font:inherit; }
.case-city-entry span { color:#52667d; }
.case-city-entry button { border:0; border-radius:6px; padding:6px 12px; background:#1857a4; color:white; white-space:nowrap; }
.case-city-entry button:disabled { opacity:.6; cursor:wait; }
.case-info-dialog {
  width: min(420px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  margin: auto;
  padding: 20px;
  border: 1px solid #c8d9df;
  border-radius: 16px;
  background: #fff;
  color: #253d51;
  box-shadow: 0 16px 44px #15344938;
}
.case-info-dialog::backdrop { background: #101f38a6; }
.case-info-dialog h3 { margin: 0 30px 8px 0; }
.case-info-dialog p, .case-info-dialog dd { color: #52667d; font-size: 13px; line-height: 1.6; }
.case-info-dialog dl { display: grid; gap: 4px; margin: 14px 0; }
.case-info-dialog dt { font-weight: 650; }
.case-info-dialog dd { margin: 0 0 6px; }
.case-info-dialog a { color: #195f54; }
.consult-dialog {
  --consult-padding: clamp(14px, 4vw, 24px);
  --consult-line: #d9e7f3;
  --consult-ink: #19456f;
  --consult-accent: #2263aa;
  width: min(620px, calc(100% - 24px));
  max-height: min(840px, calc(100dvh - 24px));
  padding: 0;
  border-color: var(--consult-line);
  border-radius: 18px;
  overflow: hidden;
}
.consult-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.consult-dialog::backdrop { background: rgb(45 78 112 / 36%); }
.consult-dialog [hidden] { display: none; }
.consult-dialog :focus-visible { outline: 2px solid var(--consult-accent); outline-offset: 2px; }
.consult-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px var(--consult-padding);
  border-bottom: 1px solid var(--consult-line);
  background: #edf5fd;
}
.consult-dialog .consult-dialog-title { margin: 0; color: var(--consult-ink); font-size: 19px; font-weight: 700; }
.consult-dialog-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid #cddff0;
  border-radius: 10px;
  background: #fff;
  color: var(--consult-ink);
  font-size: 16px;
}
.consult-dialog-close:hover { background: #e1eefb; }
.consult-dialog-body {
  display: grid;
  align-content: start;
  gap: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px var(--consult-padding);
  background: #f5f9fd;
}
.consult-dialog-card {
  padding: 14px;
  border: 1px solid var(--consult-line);
  border-radius: 12px;
  background: #fff;
}
.consult-dialog-body h4 { margin: 0 0 4px; color: var(--consult-ink); font-size: 15px; }
.consult-dialog-body p { margin: 0; }
.consult-dialog-footer {
  padding: 10px var(--consult-padding);
  border-top: 1px solid var(--consult-line);
  background: #fff;
}
.consult-dialog .consult-dialog-primary {
  min-height: 44px;
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--consult-accent);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}
.consult-dialog .consult-dialog-primary:hover { background: #195590; }
.consult-dialog .consult-dialog-primary:disabled { background: #e7eff7; color: #49647f; cursor: default; }
.aid-scope p { font-size: 14px; line-height: 1.7; }
.aid-scope p + p { margin-top: 7px; }
.aid-dialog-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-top: 6px;
}
.aid-dialog-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 13px;
}
.judgment-cards { max-width:88%; background:#fff; border:1px solid #dce6f0; border-radius:12px; padding:12px 14px; color:#263d56; font-size:13px; overflow-wrap:anywhere; }
.judgment-cards p { margin:6px 0; }
.judgment-cards small { display:block; color:#64748b; line-height:1.5; }
.judgment-item { border-top:1px solid #e6edf5; padding:10px 0; margin-top:8px; }
.judgment-item summary { cursor:pointer; color:#173f69; line-height:1.5; }
.judgment-item summary:hover { color:#1857a4; }
.judgment-meta { display:block; margin:5px 0 0 18px; color:#64748b; font-size:12px; font-weight:400; }
.judgment-details { display:grid; grid-template-columns:88px minmax(0,1fr); gap:8px 12px; margin:14px 0; }
.judgment-details dt { color:#64748b; }
.judgment-details dd { margin:0; white-space:pre-wrap; overflow-wrap:anywhere; }
.judgment-body-button { border:1px solid #b9cde0; border-radius:7px; padding:7px 11px; background:#f3f8fd; color:#174c7c; font:inherit; }
.judgment-body-button:disabled { opacity:.6; }
.judgment-body:not(:empty) { margin-top:12px; }
.judgment-body pre { max-height:50vh; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere; padding:12px; border:1px solid #e1e8ef; border-radius:8px; background:#f8fafc; font:inherit; line-height:1.7; }

@media(max-width:899px) { .judgment-cards { max-width:96%; } }
@media (max-width: 700px) {
  .intake-view .case-city-entry {
    display: grid;
    min-width: 0;
    gap: 4px;
    padding-inline: 10px;
  }
  .case-city-actions {
    gap: 4px;
    min-width: 0;
    overflow-x: auto;
  }
  .case-city-actions > button, .case-city-actions #case-btn {
    flex: 1 0 auto;
    min-height: 36px;
    padding: 5px 3px;
    font-size: clamp(11px, 3.1vw, 14px);
  }
  .case-city-actions #case-strip { flex: 1 0 auto; }
}

.hero-card {
  background: linear-gradient(135deg, #0f2e55 0%, #1b4b82 100%);
  border-radius: 16px;
  padding: 16px;
  color: #fff;
  box-shadow: 0 10px 26px rgba(11, 37, 69, .18);
  position: relative;
  overflow: hidden;
}
.hero-card::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -30px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200, 164, 92, .34), transparent 70%);
}
.hero-kicker {
  display: inline-block;
  font-size: 11px;
  color: #f0d9a8;
  border: 1px solid rgba(240, 217, 168, .45);
  border-radius: 999px;
  padding: 1px 9px;
  margin-bottom: 8px;
}
.hero-card h2 { font-size: 19px; line-height: 1.35; letter-spacing: .3px; }
.hero-desc { font-size: 12.5px; color: #c2d3e6; margin-top: 6px; line-height: 1.55; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.hero-tags span {
  font-size: 11px;
  color: #dbe8f6;
  background: rgba(255, 255, 255, .12);
  padding: 2px 8px;
  border-radius: 6px;
}

.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.quick-grid button {
  text-align: left;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 2px 8px rgba(11, 37, 69, .04);
}
.quick-grid button:active { background: #eef3fa; transform: scale(.985); }
.quick-grid b { font-size: 13.5px; color: var(--navy); font-weight: 600; }
.quick-grid span { font-size: 11px; color: var(--ink-2); }

.hero-foot {
  text-align: center;
  font-size: 11.5px;
  color: #93a1b5;
  margin: 10px 0 2px;
}

/* ================= messages ================= */
.citation-cards { background:#fff; border:1px solid #dbe4ee; color:#183552; }
.citation-card { border-top:1px solid #e7edf3; margin-top:8px; padding-top:8px; }
.citation-card summary { cursor:pointer; color:#1857a4; }
.citation-card small { display:block; margin-top:6px; color:#697b8d; }
.citation-card p { white-space:pre-wrap; margin:8px 0 0; }
#messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.68;
  word-break: break-word;
  position: relative;
}
.msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  border-bottom-right-radius: 5px;
  white-space: pre-wrap;
}
.msg.assistant {
  align-self: flex-start;
  background: var(--white);
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
  box-shadow: 0 2px 10px rgba(11, 37, 69, .05);
  white-space: pre-wrap;
}
.msg.assistant strong { color: var(--navy); font-weight: 600; }
.msg.assistant.streaming::after {
  content: "▍";
  animation: blink 1s steps(2) infinite;
  color: #9aa8bb;
}
@keyframes blink { 50% { opacity: 0; } }
.msg .pending { color: #93a1b5; }
.msg.error {
  align-self: flex-start;
  background: #fdeceb;
  color: var(--danger);
  border: 1px solid #f7d3cf;
  font-size: 13px;
}

.thought-card {
  align-self: flex-start;
  max-width: 88%;
  padding: 6px 11px;
  background: #eaf2fb;
  border-radius: 10px;
  font-size: 11.5px;
  color: #34618f;
  line-height: 1.5;
}
.tool-card {
  align-self: flex-start;
  max-width: 92%;
  padding: 8px 11px;
  background: #fffaf0;
  border: 1px solid #f4e3c2;
  border-radius: 10px;
  font-size: 12px;
  color: #7a5a1e;
}
.tool-card details { cursor: pointer; }
.tool-card summary { font-weight: 600; }
.tool-card .law-item {
  margin-top: 8px;
  padding: 8px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #f4e3c2;
  font-size: 12px;
  line-height: 1.6;
  max-height: 220px;
  overflow-y: auto;
}
.tool-card .law-title { font-weight: 600; color: #8a5f11; margin-bottom: 3px; }

/* ================= 案情入口条 ================= */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#case-strip { display:inline-flex; flex:none; }
#case-strip[hidden] { display:none; }

/* ================= composer ================= */
#composer {
  flex-shrink: 0;
  background: var(--white);
  border-top: 1px solid var(--line);
  padding: 9px 12px calc(9px + var(--safe-b));
  display: flex;
  gap: 8px;
  align-items: flex-end;
  position: relative;
}

#slash-menu {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(100% - 4px);
  padding: 6px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 2px;
  z-index: 20;
}
#slash-menu[hidden] { display: none; }
#slash-menu button {
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: 9px 10px;
  text-align: left;
  font-size: 13px;
  color: var(--ink);
}
#slash-menu button:active { background: #f1f5fa; }

.upload-btn {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #f1f5fa;
  color: #4a6280;
  font-size: 20px;
  line-height: 1;
}

#input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: #f7f9fc;
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 16px;
  line-height: 1.45;
  resize: none;
  max-height: 108px;
  font-family: inherit;
  color: var(--ink);
}
#input:focus { outline: none; border-color: #b7cee8; background: #fff; }
@media (max-width: 899px) { #input::placeholder { font-size: 14px; } }

#send {
  flex-shrink: 0;
  height: 38px;
  padding: 0 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}
#send:disabled { background: #b9cbe0; }
#send:active:not(:disabled) { transform: scale(.97); }

/* ================= 留资弹窗 ================= */
#lead-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(7, 20, 36, .55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade .2s ease;
}
#lead-modal[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.lead-sheet {
  width: 100%;
  max-width: 520px;
  background: var(--white);
  border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(18px + var(--safe-b));
  position: relative;
  max-height: 92dvh;
  overflow-y: auto;
  animation: sheet .26s cubic-bezier(.32, .72, 0, 1);
}
@keyframes sheet { from { transform: translateY(100%); } to { transform: none; } }

.lead-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: #f1f5fa;
  color: #6b7b91;
  font-size: 13px;
}
.lead-sheet h3 { font-size: 18px; color: var(--navy); letter-spacing: .3px; }
.lead-desc { font-size: 12.5px; color: var(--ink-2); margin: 5px 0 14px; }
/* 精简留资：从「让律师看这份材料」进来时只保留手机号 */
#lead-form.compact .lead-extra { display: none; }
#lead-form.compact { gap: 10px; }

.field { display: block; margin-bottom: 11px; }
.field > span { display: block; font-size: 12.5px; color: #44546b; margin-bottom: 5px; }
.field > span i { color: var(--danger); font-style: normal; }
.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  resize: none;
}
.field input:focus,
.field textarea:focus { outline: none; border-color: #b7cee8; background: #fff; }
.field.invalid input { border-color: #e0837a; background: #fdf3f2; }
.field-err { display: block; font-size: 11.5px; color: var(--danger); font-style: normal; min-height: 0; margin-top: 3px; }
.field-err:empty { display: none; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; min-width: 0; }

.chip-select { display: flex; flex-wrap: wrap; gap: 7px; }
.chip-select button {
  border: 1px solid var(--line);
  background: #f8fafc;
  color: #44546b;
  font-size: 12.5px;
  padding: 6px 11px;
  border-radius: 999px;
}
.chip-select button.on {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
}

.lead-submit {
  width: 100%;
  height: 46px;
  margin-top: 6px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #3a2a08;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: .5px;
}
.lead-submit:disabled { opacity: .65; }
.lead-call {
  display: block;
  text-align: center;
  font-size: 13px;
  color: var(--brand);
  text-decoration: none;
  padding: 10px 0 0;
  font-weight: 600;
}
.lead-call[hidden] { display: none; }
.lead-tip { font-size: 11px; color: #93a1b5; text-align: center; margin-top: 8px; }

.lead-done { text-align: center; padding: 14px 4px 6px; }
.lead-done[hidden] { display: none; }
.done-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: #e8f7ee;
  color: #1f9d55;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lead-done h4 { font-size: 16px; color: var(--navy); }
.lead-done p { font-size: 12.5px; color: var(--ink-2); margin: 6px 0 16px; line-height: 1.6; }
#lead-done-close {
  width: 100%;
  height: 42px;
  border: none;
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

/* ================= 矮屏压缩（iPhone SE 等 667 高度） ================= */
@media (max-height: 720px) and (max-width: 899px) {
  #chat-area header { padding-top: 8px; padding-bottom: 8px; }
  #hero { padding: 10px 12px 2px; }
  .hero-card { padding: 12px 14px; }
  .hero-card h2 { font-size: 17px; }
  .hero-desc { display: none; }
  .hero-tags { margin-top: 8px; }
  .quick-grid { margin-top: 9px; gap: 7px; }
  .quick-grid button { padding: 8px 10px; }
  .hero-foot { display: none; }
}

/* ================= 桌面适配 ================= */
@media (min-width: 900px) {
  #sidebar {
    position: static;
    transform: none;
    width: 260px;
    max-width: none;
  }
  #drawer-mask, #drawer-toggle, #drawer-close { display: none; }
  #chat-area header { padding: 14px 24px; }
  .brand h1 { font-size: 17px; }
  #hero { padding: 20px 24px 8px; }
  .hero-card { padding: 22px 24px; }
  .hero-card h2 { font-size: 24px; }
  .quick-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  #messages { padding: 18px 24px; }
  .msg { max-width: 72%; font-size: 14px; }
  .thought-card, .tool-card { max-width: 72%; }
  #composer { padding: 12px 24px; }
  #lead-modal { align-items: center; }
  .lead-sheet { border-radius: 18px; max-width: 480px; }
}

/* ================= 案情 / 时间轴 ================= */
#case-btn {
  flex-shrink: 0;
  border: none;
  background: var(--navy);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
}
#case-btn.has-case {
  background: var(--gold-2);
  color: #3a2a08;
  font-weight: 700;
}

#case-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(7, 20, 36, .55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade .2s ease;
}
#case-modal[hidden] { display: none; }

.case-sheet {
  width: 100%;
  max-width: 560px;
  background: var(--white);
  border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(14px + var(--safe-b));
  position: relative;
  height: 88dvh;
  display: flex;
  flex-direction: column;
  animation: sheet .26s cubic-bezier(.32, .72, 0, 1);
}
.case-sheet > h3 { font-size: 17px; color: var(--navy); }
.case-sub {
  font-size: 11.5px;
  color: var(--ink-2);
  margin: 3px 0 12px;
  line-height: 1.5;
  padding-right: 28px;
}
.case-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}
.case-hint {
  font-size: 12.5px;
  color: var(--ink-2);
  background: #f5f8fc;
  border: 1px dashed #d5e0ee;
  border-radius: 10px;
  padding: 14px;
  line-height: 1.65;
}
.case-loading {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: var(--ink-2);
  padding: 18px 4px;
}
.case-loading i {
  width: 14px;
  height: 14px;
  border: 2px solid #d5e0ee;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.case-meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-bottom: 12px; }
.case-type {
  font-size: 11.5px;
  background: #eaf2fb;
  color: #2b5f96;
  padding: 3px 9px;
  border-radius: 999px;
}
.case-brief { font-size: 12.5px; color: #33465e; }
.case-stamp { font-size: 11px; color: #8fa0b4; margin: -6px 0 10px; }

.tl { list-style: none; position: relative; padding-left: 16px; margin: 4px 0 4px 2px; }
.tl::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, #cfe0f2, #e8eff7);
  border-radius: 2px;
}
.tl-item { position: relative; padding: 0 0 14px 8px; }
.tl-dot {
  position: absolute;
  left: -16px;
  top: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #9db9d6;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1.5px #9db9d6;
}
.tl-dot.risk { background: #e05252; box-shadow: 0 0 0 1.5px #e05252; }
.tl-dot.action { background: #26a15b; box-shadow: 0 0 0 1.5px #26a15b; }
.tl-date { font-size: 12px; color: var(--brand); font-weight: 600; }
.tl-event { font-size: 13.5px; color: var(--ink); line-height: 1.55; margin-top: 1px; }
.tl-tags { display: flex; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.tl-kind {
  font-size: 10.5px;
  color: #5b6b82;
  background: #f1f4f9;
  padding: 1px 7px;
  border-radius: 5px;
}
.tl-ev { font-size: 10.5px; padding: 1px 7px; border-radius: 5px; }
.tl-ev.ok { background: #e8f7ee; color: #1f7a46; }
.tl-ev.warn { background: #fff5e2; color: #8a5f11; }
.tl-ev.bad { background: #fdeceb; color: #a3392e; }

.case-block { margin-top: 14px; }
.confirmable-summary {
  padding: 10px 12px;
  border: 1px solid #dbe5ed;
  background: #f7fafc;
  border-radius: 10px;
  color: #243c50;
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.confirmable-summary .summary-preview {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin-top: 4px;
  font-weight: 400;
}
.confirmable-summary[open] .summary-preview { display: none; }
.summary-full { margin-top: 8px; }
.summary-full ul { padding-left: 1.25em; margin: 6px 0; }
.summary-check-status { margin-top: 8px; color: #52667d; }
.summary-check-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.summary-check-actions button {
  padding: 5px 9px;
  color: #184a41;
  border: 1px solid #bad0cb;
  background: #fff;
  border-radius: 7px;
}
.summary-check-actions button:disabled { opacity: .65; cursor: default; }
.case-block h4 {
  font-size: 12.5px;
  color: var(--navy);
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.case-block h4::before {
  content: "";
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: var(--gold);
}
.ev-list, .risk-list, .q-list {
  list-style: none;
  display: grid;
  gap: 6px;
}
.ev-list li, .risk-list li, .q-list li {
  font-size: 12.5px;
  line-height: 1.55;
  color: #33465e;
  background: #f7f9fc;
  border-radius: 8px;
  padding: 8px 10px 8px 24px;
  position: relative;
}
.ev-list li { padding-left: 10px; }

/* 缺失证据：原始凭证自报 */
.ev-tip {
  font-size: 11.5px;
  line-height: 1.6;
  color: #6b7c92;
  background: #f2f6fc;
  border-left: 2px solid #cbd9ea;
  border-radius: 0 6px 6px 0;
  padding: 6px 9px;
  margin-bottom: 8px;
}
.ev-list li.ev-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-right: 10px;
}
.ev-row .ev-text { flex: 1 1 100%; }
.ev-own { display: inline-flex; gap: 6px; }
.ev-opt {
  font-size: 11px;
  line-height: 1.6;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid #d7e0ec;
  background: #fff;
  color: #4a5c74;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.ev-opt:hover { border-color: #b9c9dd; }
.ev-opt[aria-pressed="true"].yes {
  background: #e8f7ee;
  border-color: #9ad3b0;
  color: #1f7a46;
  font-weight: 600;
}
.ev-opt[aria-pressed="true"].no {
  background: #fdeceb;
  border-color: #e7b0aa;
  color: #a3392e;
  font-weight: 600;
}
.ev-upload {
  font-size: 11px;
  line-height: 1.6;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}
.ev-note { font-size: 11px; color: #93a2b5; }
.ev-next {
  margin-top: 8px;
  width: 100%;
  font-size: 12px;
  line-height: 1.9;
  border-radius: 8px;
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #fff;
  cursor: pointer;
}
.ev-next:hover { opacity: .9; }
.ev-tally {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
  font-size: 11px;
  color: #6b7c92;
}
.ev-hint { color: #93a2b5; }
.risk-list li::before {
  content: "!";
  position: absolute;
  left: 10px;
  color: #d98324;
  font-weight: 700;
}
.q-list li::before {
  content: "?";
  position: absolute;
  left: 10px;
  color: var(--brand);
  font-weight: 700;
}

/* 律师追问：是 / 否 自答 */
.q-tip {
  font-size: 11.5px;
  line-height: 1.6;
  color: #6b7c92;
  background: #f2f6fc;
  border-left: 2px solid #cbd9ea;
  border-radius: 0 6px 6px 0;
  padding: 6px 9px;
  margin-bottom: 8px;
}
.q-list li.q-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 24px;
}
.q-row .q-text { flex: 1 1 100%; }
.q-own { display: inline-flex; gap: 6px; }
.q-opt {
  font-size: 11px;
  line-height: 1.6;
  padding: 2px 12px;
  border-radius: 999px;
  border: 1px solid #d7e0ec;
  background: #fff;
  color: #4a5c74;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.q-opt:hover { border-color: #b9c9dd; }
.q-opt[aria-pressed="true"].yes {
  background: #e8f7ee;
  border-color: #9ad3b0;
  color: #1f7a46;
  font-weight: 600;
}
.q-opt[aria-pressed="true"].no {
  background: #fdf3e6;
  border-color: #e7c39a;
  color: #8a5410;
  font-weight: 600;
}
.q-tally {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
  font-size: 11px;
  color: #6b7c92;
}
.q-hint { color: #93a2b5; }
.q-next {
  margin-top: 8px;
  width: 100%;
  font-size: 12px;
  line-height: 1.9;
  border-radius: 8px;
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #fff;
  cursor: pointer;
}
.q-next:hover { opacity: .9; }

.case-actions {
  display: flex;
  gap: 9px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  margin-top: 10px;
}
#case-refresh {
  flex: 0 0 34%;
  height: 44px;
  border: 1px solid #cfdcec;
  background: #f7f9fc;
  color: #2b5f96;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 600;
}
#case-refresh:disabled { opacity: .6; }
#case-cta {
  flex: 1;
  height: 44px;
  border: none;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #3a2a08;
  font-size: 14px;
  font-weight: 700;
}

/* 法条溯源标签 */
.law-validity {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  font-weight: 400;
  color: #1f7a46;
  background: #e8f7ee;
  border-radius: 4px;
  padding: 0 5px;
  vertical-align: 1px;
}

/* Strict RAG 校验提示卡 */
.stream-verify {
  align-self: flex-start;
  max-width: 92%;
  margin: 6px 0 2px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.5;
  background: #fef3c7;
  color: #78350f;
  border-left: 3px solid #d97706;
}
.stream-verify.block {
  background: #fee2e2;
  color: #7f1d1d;
  border-left-color: #b91c1c;
}

#demo-entry { width:100%; margin-top:8px; padding:9px 12px; border:1px solid #526a85; border-radius:8px; background:transparent; color:#e8eff7; text-align:left; }
#demo-dialog { width:min(720px,calc(100% - 24px)); max-height:min(90dvh,900px); margin:auto; border:0; border-radius:16px; padding:0; color:var(--ink); box-shadow:0 18px 60px #0f172a55; }
#demo-dialog::backdrop { background:#0f172a99; }
.demo-heading { display:flex; align-items:start; justify-content:space-between; gap:12px; padding:18px; border-bottom:1px solid var(--line); }
.demo-heading h2 { font-size:18px; color:var(--navy); }
.demo-heading p { color:var(--ink-2); font-size:12px; }
.demo-heading button { border:0; background:transparent; color:var(--ink-2); font-size:18px; }
.demo-content { display:flex; flex-direction:column; gap:10px; overflow-y:auto; max-height:calc(min(90dvh,900px) - 145px); padding:18px; background:#f3f5f9; }
.demo-content .msg { max-width:95%; }
.demo-content .msg.user { align-self:flex-end; }
.demo-content .tool-card,.demo-content .judgment-cards { max-width:100%; }
.demo-intake { background:white; border:1px solid var(--line); border-radius:12px; padding:16px; overflow-wrap:anywhere; }
.demo-intake h3 { color:var(--navy); font-size:16px; }
.demo-intake h4 { margin-top:12px; font-size:14px; }
.demo-intake ol,.demo-intake ul { padding-left:20px; margin-top:8px; }
.demo-actions { display:flex; justify-content:flex-end; padding:12px 18px; border-top:1px solid var(--line); }
.demo-actions button { border:0; border-radius:8px; background:var(--brand); color:white; padding:9px 18px; }

#local-law-dialog {
  --local-law-edge: clamp(12px, 4vw, 22px);
  width: min(560px, calc(100% - 32px));
  height: fit-content;
  max-height: calc(100dvh - 32px);
  border-radius: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
#local-law-dialog[open] { display: block; }
#local-law-dialog .consult-dialog-header {
  padding: 8px var(--local-law-edge);
  border-color: #e8e5df;
  background: #fff;
}
#local-law-title {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #222324;
  font-family: "Noto Serif SC", "Songti SC", SimSun, serif;
  font-size: clamp(19px, 4vw, 24px);
}
.local-law-pin {
  position: relative;
  display: inline-block;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  margin: 0 3px 4px;
  transform: rotate(-45deg);
  border: 2px solid #1b365c;
  border-radius: 50% 50% 50% 3px;
}
.local-law-pin::after {
  position: absolute;
  inset: 3px;
  border: 1.5px solid #1b365c;
  border-radius: 50%;
  content: "";
}
#local-law-dialog .consult-dialog-close { border-color: transparent; color: #646765; }
#local-law-dialog .consult-dialog-close:hover { background: #f2f2ef; }
#local-law-dialog .consult-dialog-body { display: block; overflow: visible; padding: 0; background: #fff; }
.local-law-controls {
  padding: 12px var(--local-law-edge) 14px;
}
#local-law-form {
  display: grid;
  grid-template-columns: minmax(84px, 19%) minmax(0, 1fr) auto;
  gap: clamp(6px, 2vw, 12px);
}
#local-law-form select {
  min-width: 0;
  min-height: 44px;
  padding: 8px clamp(5px, 2vw, 18px);
  border-radius: 11px;
  font: inherit;
  font-size: clamp(16px, 3vw, 21px);
  border: 1px solid #d3d1c9;
  background: #f7f7f4;
  color: #232624;
}
#local-law-province:not(:disabled) { border-color: #1b365c; }
#local-law-form .consult-dialog-primary {
  min-width: clamp(54px, 12vw, 90px);
  padding-inline: clamp(8px, 2vw, 16px);
  border-radius: 11px;
  font-size: clamp(15px, 3vw, 20px);
  background: #1b365c;
}
#local-law-form .consult-dialog-primary:hover { background: #284a78; }
#local-law-form .consult-dialog-primary:disabled { background: #e8edf3; color: #566b83; }
#local-law-note { margin: 10px 0 0; }
#local-law-note strong { font-weight: 600; }
#local-law-status { margin: 8px 0 0; }
#local-law-status:empty { display: none; }
#local-law-status[data-state="error"] { color: #9b252a; }
.local-law-result-body {
  margin-top: 8px;
}
.local-law-result-body p { margin: 4px 0 0; }
.citation-cards, .local-law-chat.tool-card {
  align-self: flex-start;
  width: 72%;
  max-width: none;
  margin: 8px 0;
  padding: 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
@media (max-width: 899px) {
  .citation-cards, .local-law-chat.tool-card { width: 95%; }
}
.citation-cards > strong, .local-law-chat > summary { font-weight: 700; }
.local-law-chat.tool-card {
  border: 1px solid #d9e7f3;
  background: #f4f9fe;
  color: #19456f;
}
.local-law-chat > summary { cursor: pointer; }
.local-law-chat[data-state="error"] { color: #9b252a; }
.local-law-result-body .consult-dialog-card {
  margin-top: 8px;
  padding: 8px 0 0;
  border: 0;
  border-top: 1px solid #d9e7f3;
  border-radius: 0;
  background: transparent;
}
.local-law-item summary { font-weight: 600; color: #173f69; cursor: pointer; }
.local-law-item pre {
  margin: 8px 0 0;
  font: inherit;
  white-space: pre-wrap;
}
.local-law-item a { display: inline-block; margin-top: 6px; }
.local-law-item .local-law-impact { color: #253d51; }
.local-law-item .local-law-condition { padding-left: 8px; border-left: 2px solid #dce6f0; }
