:root {
  --ink: #16201c;
  --muted: #66716b;
  --line: #dde3df;
  --soft-line: #edf0ee;
  --paper: #ffffff;
  --canvas: #f5f7f5;
  --green: #135b43;
  --green-2: #0f6e4f;
  --green-soft: #eaf4ef;
  --amber: #9b5b0c;
  --amber-soft: #fff4df;
  --red: #a13b37;
  --red-soft: #fff0ee;
  --blue: #245b9f;
  --blue-soft: #eef5fd;
  --shadow: 0 10px 30px rgba(28, 45, 37, .06);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }

.app-shell { min-height: 100vh; }
.topbar {
  height: 72px; display: flex; align-items: center; justify-content: space-between;
  gap: 24px; padding: 0 30px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 260px; }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--green); color: white; font: 700 18px/1 serif; }
.brand h1 { margin: 0; font-size: 17px; letter-spacing: .02em; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.save-status { margin-right: 8px; color: var(--muted); font-size: 12px; }
.save-status.saving { color: var(--amber); }
.button { border: 1px solid var(--line); background: white; border-radius: 7px; padding: 9px 13px; cursor: pointer; transition: .15s ease; white-space: nowrap; }
.button:hover { border-color: #b5c0ba; transform: translateY(-1px); }
.button.primary { border-color: var(--green); background: var(--green); color: white; }
.button.ghost { background: transparent; }
.file-button { position: relative; overflow: hidden; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.workspace { display: grid; grid-template-columns: 214px minmax(0, 1fr); min-height: calc(100vh - 72px); }
.sidebar { background: #f9faf9; border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; justify-content: space-between; position: sticky; top: 72px; height: calc(100vh - 72px); }
.sidebar nav { display: grid; gap: 4px; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 11px; border: 0; background: transparent; padding: 11px 12px; border-radius: 7px; text-align: left; cursor: pointer; color: #4a5550; }
.nav-item span { color: #94a099; font: 600 10px/1 monospace; }
.nav-item:hover { background: #eef2ef; }
.nav-item.active { background: var(--green-soft); color: var(--green); font-weight: 650; }
.nav-item.active span { color: var(--green); }
.sidebar-foot { padding: 14px 11px 4px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.sidebar-foot strong { color: var(--ink); }
.sidebar-foot p { margin: 5px 0 0; }

.main-content { padding: 34px clamp(24px, 4vw, 58px) 72px; max-width: 1500px; width: 100%; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; animation: enter .18s ease; }
@keyframes enter { from { opacity: .4; transform: translateY(3px); } }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 22px; }
.page-heading.compact { align-items: center; }
.eyebrow { margin: 0 0 7px; color: var(--green); font: 700 10px/1 monospace; letter-spacing: .14em; }
.page-heading h2 { margin: 0; font-size: clamp(25px, 3vw, 34px); letter-spacing: -.03em; }
.page-heading > div > p:last-child { margin: 8px 0 0; color: var(--muted); line-height: 1.6; }
.stage-control { display: grid; gap: 6px; min-width: 210px; color: var(--muted); font-size: 11px; }
.stage-control select { color: var(--ink); font-weight: 600; }

input, select, textarea { width: 100%; color: var(--ink); border: 1px solid #cfd7d2; background: white; border-radius: 6px; padding: 10px 11px; outline: none; transition: border .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(15,110,79,.10); }
textarea { resize: vertical; line-height: 1.65; }
input::placeholder, textarea::placeholder { color: #9ca6a0; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); background: var(--paper); border-radius: 9px; margin-bottom: 18px; box-shadow: var(--shadow); }
.metric { padding: 17px 19px; border-right: 1px solid var(--soft-line); }
.metric:last-child { border-right: 0; }
.metric span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 8px; }
.metric strong { display: block; font-size: 19px; letter-spacing: -.02em; }
.metric small { display: block; color: var(--muted); margin-top: 5px; line-height: 1.4; }
.metric.risk strong { color: var(--red); }
.metric.good strong { color: var(--green); }

.two-column { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(330px, .75fr); gap: 18px; align-items: start; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 22px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 18px; }
.two-column .panel + .panel, .benefit-layout .panel + .panel, .recognition-layout .panel + .panel { margin-top: 0; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel-heading > div { display: flex; align-items: center; gap: 10px; }
.panel-heading h3 { margin: 0; font-size: 16px; }
.step { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green); font: 700 11px/1 monospace; }
.required-note, .source-count { color: var(--muted); font-size: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 15px; }
.form-grid.four { grid-template-columns: repeat(4, minmax(0,1fr)); }
.field { display: grid; gap: 7px; align-content: start; color: #4e5953; font-size: 12px; line-height: 1.4; }
.field b { color: var(--red); }
.span-2 { grid-column: span 2; }

.focus-panel { border-top: 3px solid var(--green); }
.action-list { display: grid; gap: 9px; }
.action-item { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--soft-line); }
.action-item:last-child { border-bottom: 0; }
.action-item b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: white; font-size: 11px; }
.action-item strong { display: block; font-size: 13px; }
.action-item p { margin: 4px 0 0; color: var(--muted); line-height: 1.55; font-size: 12px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.focus-panel h4 { margin: 0 0 10px; font-size: 13px; }
.issue-list { display: grid; gap: 8px; }
.issue-item { display: flex; gap: 9px; align-items: flex-start; color: #3f4944; line-height: 1.45; cursor: pointer; }
.issue-item input { width: 16px; height: 16px; margin-top: 1px; accent-color: var(--green); }
.version-panel { margin-top: 18px; }
.version-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--soft-line); border-radius: 7px; overflow: hidden; }
.version-grid > div { padding: 14px; border-right: 1px solid var(--soft-line); display: grid; gap: 5px; }
.version-grid > div:last-child { border-right: 0; }
.version-grid strong { font-size: 12px; }
.version-grid span { color: var(--muted); font-size: 11px; line-height: 1.4; }
.status { justify-self: start; font-style: normal; font-size: 10px; padding: 3px 6px; border-radius: 4px; }
.status.ok { color: var(--green); background: var(--green-soft); }
.status.warn { color: var(--amber); background: var(--amber-soft); }

.recognition-layout, .benefit-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr); gap: 18px; align-items: start; }
.question-list { display: grid; gap: 8px; }
.question { border: 1px solid var(--soft-line); border-radius: 7px; padding: 13px; display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: start; cursor: pointer; }
.question:hover { border-color: #c7d1cb; }
.question input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--green); }
.question strong { display: block; font-size: 13px; }
.question p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.question em { font-style: normal; font-size: 10px; color: var(--green); background: var(--green-soft); border-radius: 4px; padding: 4px 6px; white-space: nowrap; }
.question.exclusion em { color: var(--red); background: var(--red-soft); }
.sticky { position: sticky; top: 94px; }
.decision { border-left: 3px solid var(--amber); padding: 2px 0 2px 15px; }
.decision.positive { border-color: var(--green); }
.decision.negative { border-color: var(--red); }
.decision .decision-label { color: var(--muted); font-size: 11px; }
.decision h4 { margin: 6px 0 7px; font-size: 21px; }
.decision p { color: var(--muted); line-height: 1.65; }
.basis-list { margin: 18px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.basis-list li { padding: 10px; background: #f7f9f7; border-radius: 6px; font-size: 12px; line-height: 1.5; }
.basis-list strong { color: var(--green); }
.defense-panel { margin-top: 18px; }
.defense-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.defense-grid div { padding: 15px; background: white; }
.defense-grid strong { font-size: 13px; }
.defense-grid p { color: var(--muted); font-size: 12px; line-height: 1.65; margin: 6px 0 0; }

.deadline-inputs { margin-bottom: 18px; }
.deadline-list { display: grid; gap: 9px; }
.deadline-item { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 15px 17px; display: grid; grid-template-columns: minmax(220px, 1.1fr) minmax(130px, .6fr) minmax(180px, 1fr); gap: 18px; align-items: center; }
.deadline-item h3 { margin: 0; font-size: 14px; }
.deadline-item p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.deadline-date strong { display: block; font: 700 16px/1.3 monospace; }
.deadline-date span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.deadline-state { justify-self: end; text-align: right; }
.deadline-state b { display: inline-block; font-size: 11px; padding: 5px 8px; border-radius: 4px; background: #f0f3f1; }
.deadline-state b.danger { color: var(--red); background: var(--red-soft); }
.deadline-state b.soon { color: var(--amber); background: var(--amber-soft); }
.deadline-state b.safe { color: var(--green); background: var(--green-soft); }
.note-box { margin-top: 18px; border-left: 3px solid var(--amber); background: var(--amber-soft); padding: 14px 16px; }
.note-box strong { font-size: 12px; color: #6d4009; }
.note-box p { margin: 5px 0 0; color: #765820; line-height: 1.65; font-size: 12px; }

.calculator-inputs { min-width: 0; }
.parameter-note { margin-top: 18px; padding: 12px 14px; background: var(--blue-soft); border-left: 3px solid var(--blue); }
.parameter-note strong { font-size: 11px; color: var(--blue); }
.parameter-note p { margin: 5px 0 0; color: #4f647d; font-size: 11px; line-height: 1.6; }
.benefit-results { min-height: 300px; }
.total-box { padding: 17px; background: var(--green); color: white; border-radius: 8px; }
.total-box span { display: block; opacity: .8; font-size: 11px; }
.total-box strong { display: block; margin-top: 7px; font-size: 28px; letter-spacing: -.03em; }
.total-box small { display: block; opacity: .75; margin-top: 7px; line-height: 1.5; }
.monthly-box { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; margin-top: 10px; }
.monthly-box div { padding: 12px; border: 1px solid var(--line); border-radius: 7px; }
.monthly-box span { color: var(--muted); font-size: 10px; }
.monthly-box strong { display: block; margin-top: 6px; font-size: 16px; }
.calculation-warning { margin-top: 12px; color: var(--amber); background: var(--amber-soft); padding: 10px; border-radius: 6px; font-size: 11px; line-height: 1.55; }
.table-wrap { overflow-x: auto; }
.result-table { width: 100%; border-collapse: collapse; min-width: 840px; }
.result-table th { padding: 10px 9px; text-align: left; color: var(--muted); font-size: 10px; border-bottom: 1px solid var(--line); font-weight: 600; }
.result-table td { padding: 12px 9px; border-bottom: 1px solid var(--soft-line); font-size: 12px; vertical-align: top; line-height: 1.5; }
.result-table td:nth-child(3) { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.result-table td:nth-child(4) { color: var(--green); }
.result-table .empty-row td { text-align: center; color: var(--muted); padding: 30px; }

.progress-box { min-width: 190px; }
.progress-box strong { display: block; font-size: 20px; }
.progress-box span { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.progress-track { height: 5px; background: #e1e6e3; margin-top: 8px; overflow: hidden; border-radius: 9px; }
.progress-track i { display: block; height: 100%; background: var(--green); }
.evidence-heading-tools { display: grid; justify-items: end; gap: 10px; }
.evidence-actions { display: flex; gap: 8px; align-items: center; }
.evidence-actions select { width: 148px; padding: 9px 10px; }
.evidence-groups { display: grid; gap: 14px; }
.evidence-group { background: white; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.evidence-group h3 { margin: 0; padding: 15px 18px; border-bottom: 1px solid var(--soft-line); font-size: 14px; }
.evidence-row { display: grid; grid-template-columns: minmax(220px, 1.15fr) 150px minmax(250px, 1fr); gap: 12px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--soft-line); }
.evidence-row:last-child { border-bottom: 0; }
.evidence-name { line-height: 1.45; }
.evidence-name strong { display: block; font-size: 12px; }
.evidence-name span { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }
.evidence-row select, .evidence-row input { padding: 8px 9px; font-size: 11px; }
.evidence-row.essential .evidence-name strong::after { content: "核心"; margin-left: 7px; font-size: 9px; color: var(--red); background: var(--red-soft); padding: 2px 4px; border-radius: 3px; }

.claim-panel { padding: 0; overflow: hidden; }
.claim-document { max-width: 880px; margin: 0 auto; padding: 48px 64px 70px; font-family: "FangSong", "STFangsong", serif; font-size: 16px; line-height: 1.85; }
.claim-document h2 { text-align: center; font-family: "STSong", serif; font-size: 22px; margin: 0 0 26px; }
.claim-document .meta { border-top: 1px solid #333; border-bottom: 1px solid #333; padding: 10px 0; margin-bottom: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; font-size: 14px; }
.claim-document h3 { font-size: 16px; margin: 18px 0 8px; }
.claim-document ol { padding-left: 2em; }
.claim-document li { margin-bottom: 7px; }
.claim-document .placeholder { color: #8b4c13; background: var(--amber-soft); padding: 1px 4px; }
.claim-document .claim-note { margin-top: 28px; padding-top: 12px; border-top: 1px dashed #999; color: #666; font-size: 12px; font-family: sans-serif; line-height: 1.6; }

.law-search-bar { display: grid; grid-template-columns: minmax(250px, 1fr) 200px auto; gap: 10px; align-items: center; margin-bottom: 15px; }
.law-search-bar input { padding: 13px 14px; }
.law-search-bar span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.law-results { display: grid; gap: 9px; }
.law-card { width: 100%; text-align: left; background: white; border: 1px solid var(--line); border-radius: 8px; padding: 15px 17px; cursor: pointer; }
.law-card:hover { border-color: #aebbb4; box-shadow: var(--shadow); }
.law-card header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.law-card h3 { margin: 0; font-size: 14px; }
.law-card em { font-style: normal; color: var(--green); font-size: 10px; background: var(--green-soft); padding: 4px 6px; border-radius: 4px; }
.law-card p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.official-sources { margin-top: 24px; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); background: white; border-radius: 8px; overflow: hidden; }
.official-sources h3 { grid-column: 1 / -1; margin: 0; padding: 13px 15px; font-size: 12px; border-bottom: 1px solid var(--line); }
.official-sources a { display: grid; gap: 5px; padding: 14px 15px; color: inherit; text-decoration: none; border-right: 1px solid var(--soft-line); }
.official-sources a:last-child { border-right: 0; }
.official-sources a:hover { background: #f7f9f7; }
.official-sources strong { font-size: 11px; }
.official-sources span { color: var(--muted); font-size: 10px; }

.law-dialog { width: min(920px, calc(100vw - 40px)); height: min(780px, calc(100vh - 50px)); border: 1px solid var(--line); border-radius: 10px; padding: 0; box-shadow: 0 30px 80px rgba(0,0,0,.2); }
.law-dialog::backdrop { background: rgba(20,30,25,.45); backdrop-filter: blur(3px); }
.dialog-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 20px 24px; background: white; border-bottom: 1px solid var(--line); }
.dialog-head span { color: var(--green); font-size: 10px; }
.dialog-head h2 { margin: 5px 0 0; font-size: 20px; }
.dialog-head button { border: 0; background: #eef1ef; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 21px; }
.law-content { padding: 24px 34px 50px; line-height: 1.9; white-space: pre-wrap; font-family: "Songti SC", serif; font-size: 15px; }
.law-content mark, .law-card mark { background: #fff0a8; color: inherit; }

#toast { position: fixed; right: 22px; bottom: 22px; z-index: 50; transform: translateY(20px); opacity: 0; pointer-events: none; background: #1d2823; color: white; border-radius: 7px; padding: 10px 14px; transition: .2s ease; box-shadow: var(--shadow); }
#toast.show { opacity: 1; transform: translateY(0); }
.hidden { display: none !important; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 74px minmax(0,1fr); }
  .sidebar { padding-inline: 8px; }
  .nav-item { justify-content: center; padding: 12px 5px; font-size: 0; }
  .nav-item span { font-size: 10px; }
  .sidebar-foot { display: none; }
  .form-grid.four { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .metrics, .version-grid, .defense-grid, .official-sources { grid-template-columns: repeat(2, 1fr); }
  .version-grid > div:nth-child(2), .official-sources a:nth-of-type(2) { border-right: 0; }
  .version-grid > div { border-bottom: 1px solid var(--soft-line); }
  .recognition-layout, .benefit-layout { grid-template-columns: 1fr; }
  .sticky { position: static; }
}

@media (max-width: 760px) {
  .topbar { height: auto; min-height: 66px; padding: 12px 16px; }
  .brand { min-width: 0; }
  .brand p, .save-status, .top-actions .ghost { display: none; }
  .workspace { display: block; }
  .sidebar { position: sticky; top: 66px; z-index: 15; height: auto; padding: 7px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .sidebar nav { display: flex; min-width: max-content; }
  .nav-item { width: auto; min-width: 76px; font-size: 11px; }
  .nav-item span { display: none; }
  .main-content { padding: 24px 14px 60px; }
  .page-heading { display: block; }
  .stage-control, .evidence-heading-tools { margin-top: 16px; }
  .evidence-heading-tools { justify-items: stretch; }
  .evidence-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .evidence-actions select { width: 100%; }
  .metrics, .two-column, .form-grid, .form-grid.four, .version-grid, .defense-grid, .official-sources { grid-template-columns: 1fr; }
  .metric { border-right: 0; border-bottom: 1px solid var(--soft-line); }
  .metric:last-child { border-bottom: 0; }
  .span-2 { grid-column: auto; }
  .version-grid > div, .official-sources a { border-right: 0; border-bottom: 1px solid var(--soft-line); }
  .deadline-item { grid-template-columns: 1fr 1fr; }
  .deadline-state { grid-column: 1/-1; justify-self: start; text-align: left; }
  .evidence-row { grid-template-columns: 1fr; }
  .law-search-bar { grid-template-columns: 1fr; }
  .claim-document { padding: 32px 22px 50px; }
  .claim-document .meta { grid-template-columns: 1fr; }
}

@media print {
  .topbar, .sidebar, .page-heading .button, #toast { display: none !important; }
  .workspace { display: block; }
  .main-content { padding: 0; max-width: none; }
  .view { display: none !important; }
  #view-claims { display: block !important; }
  #view-claims .page-heading { display: none; }
  .claim-panel { border: 0; box-shadow: none; }
  .claim-document { padding: 0; max-width: none; }
}
