:root{
  --navy:#0b1f3a;
  --navy2:#112d50;
  --gold:#b58b4a;
  --paper:#f4f6f9;
  --ink:#1b2636;
  --muted:#687487;
  --line:#dde3ea;
  --white:#fff;
  --green:#1f8064;
  --red:#a94b4b;
  --shadow:0 8px 28px rgba(11,31,58,.08);
}

*{
  box-sizing:border-box;
}

body{
  margin:0;
  font-family:"Microsoft YaHei","PingFang SC",Arial,sans-serif;
  color:var(--ink);
  background:var(--paper);
}

a{
  color:inherit;
  text-decoration:none;
}

button,
input,
textarea{
  font:inherit;
}

.layout{
  min-height:100vh;
  display:grid;
  grid-template-columns:238px 1fr;
}

.sidebar{
  position:sticky;
  top:0;
  height:100vh;
  background:linear-gradient(180deg,var(--navy),#071425);
  color:#fff;
  padding:28px 18px;
  display:flex;
  flex-direction:column;
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
  padding:0 8px 25px;
  border-bottom:1px solid rgba(255,255,255,.13);
}

.brand-mark{
  width:38px;
  height:38px;
  display:grid;
  place-items:center;
  border:1px solid rgba(255,255,255,.35);
  border-radius:10px;
  background:rgba(181,139,74,.18);
  color:#ead4ad;
  font-size:20px;
  font-weight:700;
}

.brand-mark.big{
  width:58px;
  height:58px;
  font-size:28px;
  background:var(--navy);
  color:#f5e5c9;
}

.brand b,
.brand span{
  display:block;
}

.brand span{
  font-size:12px;
  color:#aebbd0;
  margin-top:3px;
}

.sidebar nav{
  display:grid;
  gap:8px;
  margin-top:26px;
}

.sidebar nav a{
  padding:12px 14px;
  border-radius:9px;
  color:#c9d4e3;
}

.sidebar nav a:hover{
  background:rgba(255,255,255,.08);
  color:white;
}

.sidebar-foot{
  margin-top:auto;
  padding:18px 8px 0;
  border-top:1px solid rgba(255,255,255,.13);
  display:grid;
  gap:6px;
}

.sidebar-foot small{
  color:#9eabc0;
}

.main{
  padding:0 34px 48px;
  min-width:0;
}

.topbar{
  height:92px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.topbar h1{
  font-size:24px;
  margin:0;
}

.topbar p{
  margin:6px 0 0;
  color:var(--muted);
  font-size:12px;
  letter-spacing:.08em;
}

.mode-pill{
  font-size:12px;
  font-weight:700;
  letter-spacing:.08em;
  padding:8px 12px;
  background:#e8edf4;
  color:var(--navy);
  border-radius:999px;
}

.notice{
  background:#fff7e8;
  border:1px solid #ead8b3;
  color:#73572d;
  padding:10px 14px;
  border-radius:9px;
  font-size:13px;
  margin-bottom:20px;
}

.hero{
  background:linear-gradient(125deg,var(--navy),#173e68);
  color:white;
  border-radius:18px;
  padding:36px;
  display:flex;
  justify-content:space-between;
  gap:30px;
  box-shadow:var(--shadow);
}

.hero h2{
  font-size:30px;
  margin:8px 0 12px;
}

.hero p{
  color:#ccdae9;
  max-width:650px;
  line-height:1.8;
}

.eyebrow{
  font-size:11px;
  letter-spacing:.16em;
  color:#d8b87f;
}

.hero-flow{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:560px;
  justify-content:center;
}

.hero-flow div{
  padding:18px 16px;
  border:1px solid rgba(255,255,255,.2);
  border-radius:12px;
  background:rgba(255,255,255,.06);
  font-size:12px;
  color:#bfccda;
  text-align:center;
}

.hero-flow b{
  color:white;
  font-size:14px;
}

.hero-flow i{
  font-style:normal;
  color:#caa86b;
}

.btn,
button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:0;
  cursor:pointer;
  border-radius:8px;
  padding:10px 16px;
}

.primary{
  background:var(--gold);
  color:white;
  font-weight:700;
}

.secondary{
  background:#e9eef5;
  color:var(--navy);
  font-weight:700;
}

.ghost{
  background:transparent;
  border:1px solid rgba(255,255,255,.25);
  color:#d8e2ee;
  margin-top:8px;
}

.small{
  padding:8px 12px;
  font-size:13px;
}

.full{
  width:100%;
  padding:12px;
}

.stats{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:15px;
  margin:20px 0;
}

.stat{
  background:white;
  padding:20px;
  border-radius:12px;
  border:1px solid var(--line);
  box-shadow:0 3px 14px rgba(11,31,58,.04);
}

.stat span{
  display:block;
  color:var(--muted);
  font-size:13px;
}

.stat b{
  display:block;
  font-size:28px;
  margin-top:8px;
  color:var(--navy);
}

.panel{
  background:white;
  border:1px solid var(--line);
  border-radius:14px;
  padding:22px;
  margin-bottom:20px;
  box-shadow:0 3px 18px rgba(11,31,58,.035);
}

.panel.narrow{
  max-width:900px;
}

.panel-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:15px;
  margin-bottom:16px;
}

.panel-head h3{
  margin:0;
  font-size:17px;
}

.panel-head p{
  margin:5px 0 0;
  color:var(--muted);
  font-size:13px;
}

.panel-head a{
  color:#315f91;
  font-size:13px;
}

.case-list{
  display:grid;
}

.case-row{
  display:grid;
  grid-template-columns:1fr 170px 110px 100px;
  gap:18px;
  align-items:center;
  padding:15px 6px;
  border-top:1px solid #edf0f4;
}

.case-row:first-child{
  border-top:0;
}

.case-row strong{
  display:block;
}

.case-row small,
.muted{
  color:var(--muted);
}

.status{
  display:inline-flex;
  padding:5px 8px;
  border-radius:999px;
  background:#eef3f8;
  color:#506176;
  font-size:12px;
}

.status.completed{
  background:#e5f4ef;
  color:var(--green);
}

.feature-grid{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:15px;
}

.feature-grid article{
  background:white;
  border:1px solid var(--line);
  padding:22px;
  border-radius:13px;
}

.feature-grid article>span{
  font-family:Georgia,serif;
  color:var(--gold);
  font-size:25px;
}

.feature-grid h3{
  margin:12px 0 8px;
}

.feature-grid p{
  color:var(--muted);
  line-height:1.7;
  font-size:13px;
}

.case-form{
  display:grid;
  gap:18px;
}

.case-form label,
.auth-card label{
  display:grid;
  gap:8px;
  font-size:13px;
  color:#465267;
}

.case-form input,
.case-form textarea,
.auth-card input,
.json-editor{
  border:1px solid #d8dfe7;
  border-radius:9px;
  padding:12px;
  background:#fbfcfd;
  outline:none;
}

.case-form textarea,
.json-editor{
  resize:vertical;
  line-height:1.65;
}

.case-form input:focus,
.case-form textarea:focus,
.auth-card input:focus,
.json-editor:focus{
  border-color:#7f9fbe;
  box-shadow:0 0 0 3px #edf3f9;
}

.upload input{
  padding:10px;
}

.form-msg{
  min-height:18px;
  color:var(--red);
  font-size:13px;
}

.analysis-grid{
  display:grid;
  grid-template-columns:1.08fr .92fr;
  gap:20px;
}

.source-text{
  white-space:pre-wrap;
  word-break:break-word;
  max-height:420px;
  overflow:auto;
  background:#f8fafc;
  padding:16px;
  border-radius:9px;
  color:#415065;
  line-height:1.75;
  font-family:inherit;
  font-size:13px;
}

.workflow .flow-step{
  border:1px solid #dce3eb;
  padding:15px;
  border-radius:10px;
  display:flex;
  justify-content:space-between;
}

.flow-step span{
  font-size:12px;
  color:var(--muted);
}

.flow-step.done{
  border-color:#9bd0bf;
  background:#f0faf6;
}

.flow-step.active{
  border-color:#c4a268;
  background:#fffaf1;
}

.flow-line{
  height:18px;
  border-left:2px solid #cfd7e2;
  margin-left:22px;
}

.action-row{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:18px;
}

.task-box{
  margin-top:15px;
  padding:12px;
  background:#f7f9fb;
  border-radius:9px;
}

.task-box>div:first-child{
  display:flex;
  justify-content:space-between;
  font-size:12px;
}

.progress{
  height:8px;
  background:#e3e8ef;
  border-radius:99px;
  overflow:hidden;
  margin-top:8px;
}

.progress i{
  display:block;
  height:100%;
  width:0;
  background:var(--gold);
  transition:width .3s;
}

.hidden{
  display:none!important;
}

.json-editor{
  width:100%;
  font-family:Consolas,monospace;
  font-size:12px;
}

.dual-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:20px;
}

.retrieval-item{
  border-top:1px solid #edf0f4;
  padding:13px 0;
}

.retrieval-item:first-child{
  border-top:0;
}

.retrieval-item h4{
  margin:0 0 6px;
  font-size:14px;
}

.retrieval-item p{
  margin:5px 0;
  color:#5f6c7e;
  font-size:12px;
  line-height:1.65;
}

.score{
  font-family:Consolas;
  color:var(--green);
  font-weight:700;
}

.report-empty{
  padding:30px;
  text-align:center;
  color:var(--muted);
  background:#f8fafc;
  border-radius:9px;
}

.risk-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:10px;
}

.risk-card{
  background:#f8fafc;
  border-radius:9px;
  padding:14px;
}

.risk-card span{
  font-size:12px;
  color:var(--muted);
}

.risk-card b{
  display:block;
  margin-top:7px;
}

.trace-item{
  padding:14px;
  border-left:3px solid var(--gold);
  background:#faf8f4;
  margin:10px 0;
}

.audit-grid{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:12px;
  margin:12px 0;
}

.audit-card{
  background:#f8fafc;
  border-radius:9px;
  padding:14px;
  border:1px solid var(--line);
}

.audit-head{
  display:flex;
  align-items:center;
  gap:8px;
  margin-bottom:8px;
}

.audit-head b{
  flex:1;
}

.audit-card ul{
  margin:0 0 8px 18px;
  font-size:12.5px;
}

.audit-card p{
  font-size:12.5px;
  margin:0;
}

.trace-list{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin:0 0 8px;
}

.trace-mini{
  font-size:12px;
  line-height:1.5;
  padding:6px 8px;
  border-left:3px solid var(--gold);
  background:#fffdf5;
  border-radius:4px;
}

.trace-mini b{
  color:#1f2937;
}

.trace-mini .badge{
  margin-right:6px;
  font-size:11px;
  padding:1px 7px;
}

.trace-mini .muted{
  font-size:11.5px;
}

.badge{
  display:inline-block;
  padding:2px 9px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  color:#fff;
}

.badge.lv-low{background:#16a34a;}
.badge.lv-mid{background:#d97706;}
.badge.lv-high{background:#dc2626;}

.tabs{
  display:flex;
  gap:8px;
  margin-bottom:14px;
}

.tab{
  background:#edf1f6;
  color:#536177;
}

.tab.active{
  background:var(--navy);
  color:white;
}

.tab-content{
  display:grid;
  gap:10px;
}

.kb-laws{
  display:grid;
  gap:12px;
}

.kb-law-item{
  display:flex;
  gap:12px;
  align-items:flex-start;
  padding:14px 16px;
  border:1px solid var(--line);
  border-left:3px solid var(--navy);
  border-radius:9px;
  background:#fff;
  box-shadow:0 1px 2px rgba(11,31,58,.04);
}

.kb-cases{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(380px,1fr));
  gap:12px;
}

.kb-case-item{
  display:flex;
  gap:12px;
  align-items:flex-start;
  padding:14px 16px;
  border:1px solid var(--line);
  border-radius:9px;
  background:#fff;
  box-shadow:0 1px 2px rgba(11,31,58,.04);
}

.kb-item-body{
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.kb-text{
  margin:0;
  color:var(--ink);
  font-size:14px;
  line-height:1.8;
}

.kb-badge{
  flex:0 0 auto;
  margin-top:3px;
  white-space:nowrap;
  font-family:ui-monospace,SFMono-Regular,Consolas,"Courier New",monospace;
  font-size:11px;
  letter-spacing:.3px;
  color:var(--navy);
  background:#eef3f8;
  border:1px solid #d7e1ec;
  border-radius:6px;
  padding:3px 8px;
}

.kb-badge.case{
  color:#7a5c14;
  background:#faf3df;
  border-color:#ead9a8;
}

.kb-source{
  font-size:12px;
  color:#315f91;
  text-decoration:none;
  align-self:flex-start;
}

.kb-source:hover{
  text-decoration:underline;
}

.auth-bg{
  min-height:100vh;
  display:grid;
  place-items:center;
  background:radial-gradient(circle at 20% 20%,#193f69,#071526 58%);
}

.auth-card{
  width:min(430px,92vw);
  background:white;
  border-radius:18px;
  padding:34px;
  box-shadow:0 25px 70px rgba(0,0,0,.25);
}

.auth-brand{
  display:flex;
  align-items:center;
  gap:15px;
  margin-bottom:26px;
}

.auth-brand h1{
  font-size:21px;
  margin:0;
}

.auth-brand p{
  font-size:12px;
  color:var(--muted);
  margin:6px 0 0;
}

.auth-card form{
  display:grid;
  gap:15px;
}

.auth-links{
  text-align:center;
  font-size:13px;
  color:var(--muted);
  margin-top:16px;
}

.auth-links a{
  color:#315f91;
}

.demo-tip{
  margin-top:18px;
  background:#f7f3eb;
  border-radius:8px;
  padding:10px;
  font-size:12px;
  color:#705a34;
  text-align:center;
}

.report-page{
  max-width:1050px;
  margin:0 auto;
}

.report-title{
  text-align:center;
  border-bottom:2px solid var(--navy);
  padding:20px 0 25px;
  margin-bottom:25px;
}

.report-title span{
  font-size:11px;
  letter-spacing:.18em;
  color:var(--gold);
}

.report-title h2{
  font-family:Georgia,"Microsoft YaHei",serif;
  font-size:30px;
  margin:10px;
}

.report-section{
  margin:26px 0;
}

.report-section h3{
  font-size:17px;
  color:var(--navy);
  border-left:4px solid var(--gold);
  padding-left:10px;
}

.report-table{
  width:100%;
  border-collapse:collapse;
  margin:10px 0;
  font-size:14px;
}

.report-table th,
.report-table td{
  border:1px solid var(--line);
  padding:8px 12px;
  text-align:left;
}

.report-table th{
  background:var(--navy);
  color:#fff;
  font-weight:600;
}

.report-table td:first-child{
  width:64px;
  text-align:center;
}

.report-table td:last-child{
  width:110px;
  text-align:right;
}

.report-section p,
.report-section li{
  line-height:1.85;
  font-size:14px;
}

.report-footer{
  border-top:1px solid var(--line);
  padding-top:18px;
  color:var(--muted);
  font-size:12px;
  text-align:center;
}

.print-actions{
  max-width:1050px;
  margin:0 auto 30px;
  display:flex;
  gap:10px;
}

.tag{
  display:inline-block;
  background:#eef2f7;
  padding:4px 7px;
  border-radius:5px;
  margin:2px;
  font-size:11px;
  color:#536177;
}

/* =========================
   Agent3 研判结果展示修复
   解决建议列表圆点与文字错位问题
   ========================= */

.report-empty ul{
  max-width:900px;
  margin:14px auto 0;
  padding-left:24px;
  list-style-position:outside;
  text-align:left;
}

.report-empty li{
  margin-bottom:10px;
  line-height:1.8;
  color:#334155;
  text-align:left;
}

.report-empty .risk-grid{
  text-align:center;
}

.report-empty .risk-card{
  text-align:center;
}

.profile-view{
  display:grid;
  gap:10px;
}

.profile-field{
  display:grid;
  grid-template-columns:110px 1fr;
  gap:14px;
  padding:12px 14px;
  border:1px solid #edf0f4;
  border-radius:9px;
  background:#fbfcfd;
}

.profile-label{
  color:var(--navy);
  font-weight:700;
  font-size:13px;
}

.profile-value{
  color:#415065;
  font-size:13px;
  line-height:1.7;
}

.profile-value ul,
.profile-value ol{
  margin:0;
  padding-left:20px;
}

.profile-value li{
  margin:3px 0;
}

.md-body{
  color:#5f6c7e;
  font-size:12px;
  line-height:1.65;
}

.md-body h1,
.md-body h2,
.md-body h3,
.md-body h4{
  margin:8px 0 5px;
  font-size:13px;
  color:var(--navy);
}

.md-body p{
  margin:5px 0;
}

.md-body ul,
.md-body ol{
  margin:5px 0;
  padding-left:20px;
}

.md-body li{
  margin:3px 0;
}

.report-empty h4,
.report-empty strong{
  color:var(--navy);
}

.report-empty .agent3-suggestions,
.report-empty .suggestions,
.report-empty .report-suggestions{
  max-width:900px;
  margin:24px auto 0;
  text-align:left;
}

.report-empty .agent3-suggestions h4,
.report-empty .suggestions h4,
.report-empty .report-suggestions h4{
  text-align:center;
  margin-bottom:14px;
}

.report-empty p{
  line-height:1.8;
}

.trace-item{
  text-align:left;
  line-height:1.8;
}

.trace-item p{
  margin:6px 0;
  color:#4b5563;
}

.trace-head{
  display:flex;
  align-items:center;
  gap:8px;
  margin-bottom:6px;
}

.trace-type{
  display:inline-block;
  padding:2px 9px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  color:#fff;
}

.trace-type.type-law{background:#b45309;}
.trace-type.type-case{background:#7c3aed;}

.trace-quality{
  font-size:12px;
  color:var(--muted);
}

.trace-score{
  margin-left:auto;
  font-weight:700;
  font-size:13px;
}

.trace-title{
  font-weight:700;
  margin:4px 0;
}

.trace-src{
  font-size:13px;
  color:#6b7280;
}

.trace-focus{
  margin:4px 0;
}

.trace-reason{
  font-size:12.5px;
  color:var(--muted);
}

.trace-item.trace-case{
  border-left-color:#7c3aed;
  background:#faf7fe;
}

.trace-item.q-low{
  opacity:.6;
}

.trace-item.q-low .trace-quality{
  color:#dc2626;
  font-weight:700;
}

.trace-item.q-high .trace-quality{
  color:#16a34a;
  font-weight:700;
}

/* =========================
   响应式布局
   ========================= */

@media(max-width:1000px){
  .layout{
    grid-template-columns:1fr;
  }

  .sidebar{
    position:relative;
    height:auto;
    flex-direction:row;
    align-items:center;
  }

  .sidebar nav{
    display:flex;
    margin:0 0 0 20px;
  }

  .sidebar-foot{
    display:none;
  }

  .main{
    padding:0 18px 35px;
  }

  .hero{
    display:block;
  }

  .hero-flow{
    min-width:0;
    margin-top:20px;
  }

  .stats,
  .feature-grid{
    grid-template-columns:repeat(2,1fr);
  }

  .analysis-grid,
  .dual-grid{
    grid-template-columns:1fr;
  }
}

@media(max-width:650px){
  .sidebar{
    display:none;
  }

  .stats,
  .feature-grid,
  .risk-grid{
    grid-template-columns:1fr;
  }

  .hero-flow{
    display:none;
  }

  .case-row{
    grid-template-columns:1fr 90px;
  }

  .case-row>*:nth-child(2),
  .case-row>*:nth-child(4){
    display:none;
  }
}

@media print{
  .sidebar,
  .topbar,
  .notice,
  .print-actions{
    display:none!important;
  }

  .layout{
    display:block;
  }

  .main{
    padding:0;
  }

  .panel{
    border:0;
    box-shadow:none;
  }

  .report-page{
    max-width:none;
  }
}

.retrieval-link{
  background:none;
  border:0;
  padding:0;
  cursor:pointer;
  color:#315f91;
  font-size:13px;
  font-weight:600;
  text-align:left;
  word-break:break-all;
}

.retrieval-link:hover{
  text-decoration:underline;
}

.modal-mask{
  position:fixed;
  inset:0;
  background:rgba(11,31,58,.45);
  display:grid;
  place-items:center;
  z-index:100;
  padding:24px;
}

.modal-box{
  background:var(--white);
  border-radius:14px;
  width:min(760px,100%);
  max-height:85vh;
  display:flex;
  flex-direction:column;
  box-shadow:0 20px 60px rgba(0,0,0,.3);
}

.modal-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:14px 20px;
  border-bottom:1px solid var(--line);
}

.modal-head h4{
  margin:0;
  font-size:15px;
  color:var(--navy);
  word-break:break-all;
}

.modal-close{
  border:0;
  background:#eef2f7;
  border-radius:8px;
  width:32px;
  height:32px;
  font-size:20px;
  line-height:1;
  cursor:pointer;
  color:#536177;
  flex-shrink:0;
}

.modal-body{
  padding:16px 22px;
  overflow:auto;
}

.retrieval-doc{
  margin-top:3px;
  font-family:Consolas,monospace;
  font-size:11px;
  color:var(--muted);
  word-break:break-all;
}

.meta-title{
  font-size:15px;
  font-weight:700;
  color:var(--navy);
  margin-bottom:12px;
  padding-bottom:8px;
  border-bottom:1px solid var(--line);
}

.meta-fields{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.meta-row{
  display:flex;
  gap:12px;
  font-size:13px;
  line-height:1.7;
}

.meta-key{
  flex:0 0 92px;
  color:var(--muted);
  font-weight:600;
}

.meta-val{
  flex:1;
  color:var(--ink);
  word-break:break-all;
}
