/* ============================================================
   案例大师 · 样式表
   零依赖、可离线运行、专业法律风格
   ============================================================ */

:root {
  --bg: #f6f7f9;
  --bg-deep: #eef0f4;
  --surface: #ffffff;
  --surface-2: #fbfbfc;
  --ink: #17202e;
  --ink-2: #3c4757;
  --muted: #6b7684;
  --muted-2: #9aa3af;
  --line: #e4e7ec;
  --line-2: #d3d8e0;

  --navy: #1b3a6b;
  --navy-600: #17325c;
  --navy-100: #e8eef7;
  --brass: #b08d4f;
  --brass-100: #f6efe2;

  --warn: #b45309;
  --warn-bg: #fff7e6;
  --danger: #b3261e;
  --danger-bg: #fdeceb;
  --ok: #16704a;
  --ok-bg: #e8f5ef;
  --info: #1b5e8f;
  --info-bg: #e7f1f8;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(23, 32, 46, .06), 0 1px 3px rgba(23, 32, 46, .04);
  --shadow: 0 2px 4px rgba(23, 32, 46, .04), 0 8px 24px rgba(23, 32, 46, .07);
  --shadow-lg: 0 12px 48px rgba(23, 32, 46, .12);

  --serif: "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", "SimSun", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 860px; }

.hidden { display: none !important; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  height: 62px; display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(145deg, var(--navy) 0%, #2a5490 100%);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 15px; letter-spacing: -.5px;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.2);
}
.brand-name { font-size: 17px; font-weight: 650; letter-spacing: .5px; }
.brand-sub {
  font-size: 12px; color: var(--muted); border-left: 1px solid var(--line-2);
  padding-left: 12px; margin-left: 2px;
}
.topbar-spacer { flex: 1; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
  background: var(--ok-bg); color: var(--ok);
}
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 18px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-2);
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: all .16s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted-2); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--navy); border-color: var(--navy); color: #fff;
  box-shadow: 0 1px 2px rgba(27, 58, 107, .3);
}
.btn-primary:hover { background: var(--navy-600); border-color: var(--navy-600); }

.btn-lg { height: 48px; padding: 0 28px; font-size: 15.5px; border-radius: 10px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 6px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg-deep); border-color: transparent; color: var(--ink-2); }

/* ---------- 首页 Hero ---------- */
.hero { padding: 76px 0 56px; text-align: center; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 14px; border-radius: 999px;
  background: var(--brass-100); color: #8a6d33;
  font-size: 12.5px; font-weight: 500; letter-spacing: .3px;
  margin-bottom: 22px;
}
.hero h1 {
  margin: 0 0 18px; font-size: 44px; line-height: 1.25; letter-spacing: -.5px;
  font-weight: 700; color: var(--ink);
}
.hero h1 em { font-style: normal; color: var(--navy); }
.hero-lead {
  margin: 0 auto 32px; max-width: 620px;
  font-size: 17px; color: var(--muted); line-height: 1.75;
}
.hero-cta { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; }
.hero-note { margin-top: 18px; font-size: 13px; color: var(--muted-2); }

.feature-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  margin: 56px 0 0;
}
.feature-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 20px; text-align: left;
  box-shadow: var(--shadow-sm);
}
.feature-ico {
  width: 34px; height: 34px; border-radius: 9px; background: var(--navy-100);
  display: grid; place-items: center; margin-bottom: 12px; font-size: 17px;
}
.feature-card h3 { margin: 0 0 6px; font-size: 15.5px; font-weight: 620; }
.feature-card p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.65; }

/* ---------- 通用区块 ---------- */
.section { padding: 52px 0; }
.section-head { text-align: center; margin-bottom: 32px; }
.section-head h2 { margin: 0 0 8px; font-size: 26px; font-weight: 680; letter-spacing: -.3px; }
.section-head p { margin: 0; color: var(--muted); font-size: 14.5px; }

.steps-flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.flow-item {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; position: relative;
}
.flow-num {
  font-family: var(--mono); font-size: 12px; color: var(--brass);
  font-weight: 600; letter-spacing: 1px; margin-bottom: 8px;
}
.flow-item h4 { margin: 0 0 5px; font-size: 14.5px; font-weight: 620; }
.flow-item p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.6; }

.faq { max-width: 760px; margin: 0 auto; }
.faq-item { border-bottom: 1px solid var(--line); padding: 18px 0; }
.faq-item h4 { margin: 0 0 6px; font-size: 15px; font-weight: 620; }
.faq-item p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.7; }

/* ---------- 应用主体 ---------- */
.app { padding: 32px 0 80px; }

.stepper {
  display: flex; align-items: center; gap: 0;
  margin-bottom: 28px; padding: 14px 20px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.step-node { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.step-idx {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  background: var(--bg-deep); color: var(--muted-2);
  transition: all .2s;
}
.step-label { font-size: 13.5px; color: var(--muted-2); transition: color .2s; }
.step-node.active .step-idx { background: var(--navy); color: #fff; }
.step-node.active .step-label { color: var(--ink); font-weight: 550; }
.step-node.done .step-idx { background: var(--ok-bg); color: var(--ok); }
.step-node.done .step-label { color: var(--ink-2); }
.step-bar { flex: 1; height: 1px; background: var(--line-2); margin: 0 12px; min-width: 20px; }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 32px;
}
.panel-head { margin-bottom: 24px; }
.panel-head h2 { margin: 0 0 6px; font-size: 21px; font-weight: 660; letter-spacing: -.2px; }
.panel-head p { margin: 0; color: var(--muted); font-size: 14px; }

/* 输入方式选择 */
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.choice {
  border: 1.5px solid var(--line-2); border-radius: var(--radius);
  padding: 22px; cursor: pointer; background: var(--surface);
  transition: all .16s; position: relative;
}
.choice:hover { border-color: var(--navy); background: var(--navy-100); }
.choice.selected { border-color: var(--navy); background: var(--navy-100); box-shadow: 0 0 0 3px rgba(27,58,107,.08); }
.choice-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.radio {
  width: 17px; height: 17px; border-radius: 50%; flex: none;
  border: 1.5px solid var(--line-2); background: #fff; position: relative;
}
.choice.selected .radio { border-color: var(--navy); border-width: 5px; }
.choice h3 { margin: 0; font-size: 15.5px; font-weight: 620; }
.tag {
  font-size: 11px; padding: 2px 7px; border-radius: 4px;
  background: var(--brass-100); color: #8a6d33; font-weight: 550;
}
.tag-blue { background: var(--info-bg); color: var(--info); }
.choice p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.65; }
.choice ul { margin: 10px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.choice li { margin-bottom: 3px; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13.5px; font-weight: 550; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.req { color: var(--danger); font-size: 12px; }
.hint { font-size: 12px; color: var(--muted-2); font-weight: 400; }

.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: 14px; line-height: 1.6;
  padding: 9px 12px; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(27, 58, 107, .09);
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.textarea { resize: vertical; min-height: 88px; }
.textarea-lg { min-height: 300px; font-size: 13.5px; line-height: 1.75; }
.select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7684' d='M6 8.5L2 4.5h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}

.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-chip {
  padding: 7px 14px; border: 1px solid var(--line-2); border-radius: 999px;
  font-size: 13.5px; cursor: pointer; background: var(--surface); color: var(--ink-2);
  transition: all .15s; user-select: none;
}
.radio-chip:hover { border-color: var(--navy); }
.radio-chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }

.input-suffix { position: relative; }
.input-suffix .suffix {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: 13px; color: var(--muted); pointer-events: none;
}
.input-suffix .input { padding-right: 46px; }

.divider-label {
  grid-column: 1/-1; display: flex; align-items: center; gap: 12px;
  margin-top: 8px; font-size: 12.5px; color: var(--muted-2);
  font-weight: 600; letter-spacing: 1px;
}
.divider-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.callout {
  display: flex; gap: 11px; padding: 13px 15px; border-radius: var(--radius-sm);
  font-size: 13.5px; line-height: 1.65;
}
.callout-ico { flex: none; font-size: 15px; line-height: 1.4; }
.callout-amber { background: var(--warn-bg); color: #7c4a12; border: 1px solid #f2dfbe; }
.callout-blue { background: var(--info-bg); color: #14496e; border: 1px solid #cfe3f0; }
.callout-gray { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.callout b { font-weight: 620; }

.panel-actions {
  display: flex; gap: 12px; align-items: center;
  margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line);
}
.panel-actions .spacer { flex: 1; }

/* 生成中 */
.loading-panel { text-align: center; padding: 58px 32px; }
.spinner {
  width: 40px; height: 40px; margin: 0 auto 26px;
  border: 3px solid var(--line); border-top-color: var(--navy);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-list { max-width: 330px; margin: 0 auto; text-align: left; }
.progress-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 0; font-size: 14px; color: var(--muted-2);
  transition: color .3s;
}
.progress-item .p-ico { width: 18px; flex: none; text-align: center; font-size: 13px; }
.progress-item.doing { color: var(--ink); }
.progress-item.done { color: var(--ok); }

/* 结果页 */
.result-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }

.doc-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden;
}
.doc-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.seg { display: inline-flex; background: var(--bg-deep); border-radius: 8px; padding: 3px; }
.seg button {
  border: none; background: transparent; cursor: pointer;
  padding: 6px 14px; border-radius: 6px; font-size: 13px; color: var(--muted);
  font-weight: 500; transition: all .15s;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.doc-toolbar .spacer { flex: 1; }

.doc-body { padding: 34px 40px 40px; }
.article { font-family: var(--serif); font-size: 16px; line-height: 1.95; color: var(--ink); }
.article h1 {
  font-family: var(--sans); font-size: 25px; line-height: 1.45; font-weight: 700;
  margin: 0 0 14px; letter-spacing: -.2px;
}
.article .byline {
  font-family: var(--sans); font-size: 13px; color: var(--muted);
  padding-bottom: 18px; margin-bottom: 22px; border-bottom: 1px solid var(--line);
  letter-spacing: .2px;
}
.article h2 {
  font-family: var(--sans); font-size: 16px; font-weight: 650; color: var(--navy);
  margin: 26px 0 10px; display: flex; align-items: center; gap: 8px;
}
.article h2::before { content: ""; width: 3px; height: 15px; background: var(--brass); border-radius: 2px; }
.article p { margin: 0 0 12px; }
.article ol, .article ul { margin: 0 0 12px; padding-left: 24px; }
.article li { margin-bottom: 8px; }
.article .kicker {
  font-family: var(--sans); background: var(--surface-2); border-left: 3px solid var(--navy);
  padding: 12px 16px; font-size: 14.5px; color: var(--ink-2); margin: 0 0 20px; line-height: 1.75;
}

mark.mk {
  padding: 1px 2px; border-radius: 3px; cursor: help;
  border-bottom: 1.5px solid currentColor;
}
mark.mk-desens { background: var(--info-bg); color: var(--info); }
mark.mk-warn { background: var(--warn-bg); color: var(--warn); }
mark.mk-danger { background: var(--danger-bg); color: var(--danger); }

/* 侧栏 */
.side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 82px; }
.side-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden;
}
.side-head {
  display: flex; align-items: center; gap: 8px;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
  font-size: 13.5px; font-weight: 620;
}
.side-head .count {
  margin-left: auto; font-size: 11.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; background: var(--bg-deep); color: var(--muted);
}
.side-body { padding: 6px 16px 14px; max-height: 340px; overflow-y: auto; }

.issue { padding: 11px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.issue:last-child { border-bottom: none; }
.issue-top { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.lv {
  font-size: 10.5px; font-weight: 650; padding: 1.5px 6px; border-radius: 4px; letter-spacing: .3px;
}
.lv-high { background: var(--danger-bg); color: var(--danger); }
.lv-mid { background: var(--warn-bg); color: var(--warn); }
.lv-low { background: var(--info-bg); color: var(--info); }
.issue-key { font-weight: 600; color: var(--ink); }
.issue p { margin: 0; color: var(--muted); line-height: 1.6; font-size: 12.5px; }
.issue code {
  font-family: var(--mono); font-size: 11.5px; background: var(--bg-deep);
  padding: 1px 5px; border-radius: 4px; color: var(--ink-2);
}
.empty-note { padding: 18px 0; text-align: center; font-size: 13px; color: var(--muted-2); }

.lead-card {
  background: linear-gradient(160deg, #1b3a6b 0%, #24497f 100%);
  border-radius: var(--radius); padding: 20px; color: #fff;
  box-shadow: var(--shadow);
}
.lead-card h4 { margin: 0 0 8px; font-size: 15px; font-weight: 620; }
.lead-card ul { margin: 0 0 14px; padding-left: 18px; font-size: 13px; color: rgba(255,255,255,.85); }
.lead-card li { margin-bottom: 4px; }
.lead-form { display: flex; gap: 8px; }
.lead-form .input {
  background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); color: #fff; height: 38px;
}
.lead-form .input::placeholder { color: rgba(255,255,255,.55); }
.lead-form .input:focus { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.15); }
.lead-form .btn { height: 38px; background: #fff; color: var(--navy); border-color: #fff; font-weight: 600; }
.lead-note { margin: 10px 0 0; font-size: 11.5px; color: rgba(255,255,255,.6); line-height: 1.6; }

/* 抽屉 / 弹窗 */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(23, 32, 46, .42); backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: 24px;
}
.modal {
  width: 100%; max-width: 520px; background: var(--surface);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  max-height: 88vh; display: flex; flex-direction: column;
}
.modal-head {
  padding: 20px 24px 0; display: flex; align-items: flex-start; gap: 12px;
}
.modal-head h3 { margin: 0 0 4px; font-size: 17.5px; font-weight: 660; }
.modal-head p { margin: 0; font-size: 13.5px; color: var(--muted); }
.modal-body { padding: 20px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-foot {
  padding: 16px 24px; border-top: 1px solid var(--line);
  display: flex; gap: 10px; align-items: center;
}
.modal-foot .spacer { flex: 1; }

/* Toast */
.toast-wrap {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; box-shadow: var(--shadow-lg);
  animation: toastIn .22s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* 页脚 */
.footer {
  border-top: 1px solid var(--line); background: var(--surface);
  padding: 28px 0; font-size: 12.5px; color: var(--muted-2);
}
.footer-inner { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.footer .spacer { flex: 1; }
.footer p { margin: 0; line-height: 1.7; max-width: 640px; }

/* 响应式 */
@media (max-width: 940px) {
  .result-layout { grid-template-columns: 1fr; }
  .side { position: static; }
  .feature-grid, .steps-flow { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .wrap { padding: 0 16px; }
  .hero { padding: 48px 0 36px; }
  .hero h1 { font-size: 30px; }
  .panel { padding: 22px 18px; border-radius: var(--radius); }
  .form-grid, .choice-grid, .feature-grid, .steps-flow { grid-template-columns: 1fr; }
  .doc-body { padding: 24px 20px 30px; }
  .brand-sub { display: none; }
  .step-label { display: none; }
  .step-bar { margin: 0 6px; }
}

/* 打印 */
@media print {
  .topbar, .doc-toolbar, .side, .footer, .stepper { display: none !important; }
  .doc-card { border: none; box-shadow: none; }
  body { background: #fff; }
}
