:root {
  --blue: #163E86;
  --blue2: #2552AA;
  --brand-soft: #EAF1FB;
  --price: #E66027;
  --bg: #F0F5FC;
  --card: #ffffff;
  --text: #1D2129;
  --muted: #6E7681;
  --line: #E6ECF5;
  --radius: 12px;
  --radius-btn: 10px;
  --radius-sm: 8px;
  --shadow-card: 0 2px 8px rgba(22, 62, 134, 0.04);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 17px; line-height: 1.6;
}
#app { display: flex; flex-direction: column; height: 100vh; }

/* 视图切换 */
.view { display: none; flex: 1; flex-direction: column; overflow-y: auto; padding-bottom: 110px; }
.view.active { display: flex; }

/* 顶栏 */
.brand-head { padding: 22px 22px 8px; }
.brand-name { font-size: 22px; font-weight: 700; color: var(--blue); }
.brand-sub { font-size: 14px; color: var(--muted); margin-top: 4px; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 22px 22px 14px; background: var(--card); }
.topbar.center { justify-content: center; font-weight: 600; font-size: 20px; }
.city { font-weight: 600; white-space: nowrap; font-size: 18px; }
.search-input { flex: 1; background: var(--bg); border: none; border-radius: var(--radius); padding: 0 18px; font-size: 17px; height: 46px; line-height: 46px; }
.search-input:focus { outline: none; }

/* 区块标题 */
.section-title { font-size: 20px; font-weight: 600; margin: 18px 22px 14px; }

/* 案由网格 */
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; padding: 0 22px; }
.cat { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 4px; background: var(--card); border-radius: var(--radius); cursor: pointer; }
.cat:active { background: var(--brand-soft); }
.cat-ico { font-size: 30px; }
.cat-name { font-size: 14px; color: #4a4f57; text-align: center; }

/* 律师列表 */
.lawyer-list { padding: 8px 22px 24px; display: flex; flex-direction: column; gap: 18px; }
.lawyer-card { display: flex; gap: 16px; background: var(--card); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-card); }
.lawyer-ava { width: 64px; height: 64px; border-radius: 50%; background: #eef3ff; display: flex; align-items: center; justify-content: center; font-size: 34px; overflow: hidden; flex-shrink: 0; }
.lawyer-ava img { width: 100%; height: 100%; object-fit: cover; }
.lawyer-main { flex: 1; min-width: 0; }
.lawyer-name { font-weight: 600; font-size: 19px; display: flex; align-items: center; gap: 10px; }
.lawyer-rating { color: #ff9f1c; font-size: 16px; font-weight: 500; }
.lawyer-tags { margin: 10px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tag { background: var(--brand-soft); color: var(--blue); font-size: 13px; padding: 4px 12px; border-radius: var(--radius-sm); }
.lawyer-desc { color: var(--muted); font-size: 15px; margin-bottom: 16px; line-height: 1.6; }
.lawyer-btn { background: var(--blue); color: #fff; border: none; border-radius: var(--radius-btn); padding: 12px 26px; font-size: 16px; font-weight: 600; cursor: pointer; box-shadow: none; }
.lawyer-btn:active { opacity: .85; }

.empty { color: var(--muted); text-align: center; padding: 40px 0; font-size: 15px; }

/* AI 问答 */
#view-ai { padding-bottom: 0; }
.chat-box { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 20px 8px; display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; }
.row.right { justify-content: flex-end; }
.row.left { justify-content: flex-start; }
.bubble { max-width: 76%; padding: 16px 20px; border-radius: var(--radius); font-size: 17px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.bubble.user { background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.bubble.ai { background: var(--card); color: var(--text); border-bottom-left-radius: 4px; box-shadow: var(--shadow-card); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 18px; background: var(--card); }
.chip { background: var(--brand-soft); color: var(--blue); font-size: 15px; padding: 10px 18px; border-radius: var(--radius-sm); cursor: pointer; }
.input-bar { display: flex; gap: 12px; padding: 16px 18px calc(16px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
.input { flex: 1; background: var(--bg); border: none; border-radius: var(--radius); padding: 14px 22px; font-size: 17px; }
.input:focus { outline: none; }
.send-btn { background: var(--blue); color: #fff; border: none; border-radius: var(--radius-btn); padding: 0 28px; font-size: 17px; font-weight: 600; cursor: pointer; }

/* 我的 */
.profile-banner { display: flex; align-items: center; gap: 18px; padding: 40px 22px 32px; background: var(--blue); color: #fff; }
.avatar { width: 72px; height: 72px; border-radius: 50%; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-size: 40px; }
.nickname { font-size: 22px; font-weight: 600; }
.muted-light { color: rgba(255,255,255,.82); font-size: 15px; margin-top: 4px; }
.cta { display: flex; align-items: center; justify-content: space-between; margin: 18px 22px; padding: 22px; background: var(--brand-soft); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.cta-title { font-size: 19px; font-weight: 600; color: var(--blue); }
.cta-sub { font-size: 14px; color: var(--muted); margin-top: 4px; }
.cta-arrow { color: var(--blue); font-size: 30px; }
.consult-list { padding: 0 22px 10px; display: flex; flex-direction: column; gap: 12px; }
.consult-item { display: flex; align-items: center; justify-content: space-between; background: var(--card); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-card); }
.ci-name { font-size: 17px; font-weight: 500; }
.ci-status { color: var(--blue); font-size: 14px; }
.menu { padding: 0 22px 30px; display: flex; flex-direction: column; background: var(--card); border-radius: var(--radius); margin: 10px 22px 24px; overflow: hidden; }
.menu-item { display: flex; align-items: center; padding: 20px 18px; border-bottom: 1px solid var(--line); cursor: pointer; }
.menu-item:last-child { border-bottom: none; }
.menu-ico { font-size: 22px; margin-right: 18px; }
.menu-name { flex: 1; font-size: 18px; }
.menu-arrow { color: #c4c8d0; font-size: 24px; }

/* 底部 tab */
.tabbar { display: flex; background: var(--card); border-top: 1px solid var(--line); padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; cursor: pointer; color: #9aa0ab; }
.tab-ico { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; background: #f0f2f5; transition: all .15s; }
.tab-txt { font-size: 13px; }
.tab.active { color: var(--blue); font-weight: 600; }
.tab.active .tab-ico { background: var(--blue); color: #fff; }
.tab.active .tab-txt { font-size: 14px; }

/* 模态 */
.modal-mask { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); align-items: center; justify-content: center; z-index: 50; }
.modal-mask.show { display: flex; }
.modal { width: 86%; max-width: 420px; background: #fff; border-radius: var(--radius); padding: 28px; }
.modal-title { font-size: 19px; font-weight: 600; margin-bottom: 18px; }
.modal-input, .modal-textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; font-size: 16px; margin-bottom: 14px; font-family: inherit; }
.modal-textarea { height: 120px; resize: none; }
.modal-input:focus, .modal-textarea:focus { outline: none; border-color: var(--blue); }
.modal-actions { display: flex; gap: 12px; margin-top: 6px; }
.btn-ghost, .btn-primary { flex: 1; border: none; border-radius: var(--radius-btn); padding: 14px 0; font-size: 16px; font-weight: 600; cursor: pointer; }
.btn-ghost { background: #f0f2f5; color: #555; }
.btn-primary { background: var(--blue); color: #fff; }

/* 登录弹窗（H5 真登录） */
.modal-sub { font-size: 14px; color: var(--muted); margin: -8px 0 18px; line-height: 1.5; }
.code-row { display: flex; gap: 12px; }
.code-row .code-input { flex: 1; margin-bottom: 14px; }
.btn-code { flex-shrink: 0; width: 130px; border: 1px solid var(--blue); background: #fff; color: var(--blue); border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn-code:disabled { border-color: #c4c8d0; color: #9aa0ab; cursor: default; }
.profile-banner.tappable { cursor: pointer; }
.profile-banner.tappable .avatar { background: rgba(255,255,255,.32); }

/* toast */
.toast { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,.82); color: #fff; padding: 14px 24px; border-radius: 12px; font-size: 16px; z-index: 99; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 80%; text-align: center; }
.toast.show { opacity: 1; }
