:root {
  --ink: #171811;
  --muted: #6f7169;
  --paper: #f4f2eb;
  --panel: #fffef9;
  --line: #dcd9ce;
  --acid: #dfff45;
  --acid-dark: #b8d916;
  --blue: #2354e8;
  --danger: #b42318;
  --radius: 20px;
  --shadow: 0 16px 50px rgba(26, 28, 19, .08);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; min-height: 74px; padding: 12px clamp(20px, 4vw, 64px); border-bottom: 1px solid rgba(23,24,17,.12); background: rgba(244,242,235,.88); backdrop-filter: blur(18px); }
.brand { display: inline-flex; gap: 12px; align-items: center; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--ink); color: var(--acid); font-size: 22px; font-weight: 700; }
.brand strong { display: block; font-size: 20px; line-height: 1; }
.brand small { display: block; margin-top: 5px; font-size: 9px; letter-spacing: .16em; color: var(--muted); }
.top-actions, .heading-actions { display: flex; align-items: center; gap: 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.65); font-size: 12px; }
.status-pill i { width: 8px; height: 8px; border-radius: 50%; background: #e6a23c; }
.status-pill.ok i { background: #20a464; box-shadow: 0 0 0 4px rgba(32,164,100,.12); }
.status-pill.error i { background: var(--danger); }
.btn { border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 600; transition: .2s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-dark { background: var(--ink); color: white; }
.btn-ghost { background: transparent; }
.btn-outline { background: transparent; border: 1px solid var(--line); }
.btn-accent { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; background: var(--acid); border: 1px solid #c4dd33; }
.btn-accent b { font-size: 22px; }
.workspace { width: min(1440px, calc(100% - 40px)); margin: 0 auto; padding-bottom: 80px; }
.hero { display: grid; grid-template-columns: 1.4fr .6fr; align-items: end; gap: 50px; min-height: 330px; padding: 70px 0 45px; }
.eyebrow { margin: 0 0 14px; font-size: 11px; font-weight: 700; letter-spacing: .18em; color: var(--muted); }
.hero h1 { margin: 0; font-size: clamp(45px, 6.2vw, 90px); line-height: .96; letter-spacing: -.055em; }
.hero h1 em { color: var(--blue); font-style: normal; }
.hero-note { max-width: 440px; padding: 24px; border-left: 4px solid var(--acid-dark); background: rgba(255,255,255,.48); }
.hero-note strong { font-size: 17px; }
.hero-note p { margin: 10px 0 0; color: var(--muted); line-height: 1.7; font-size: 14px; }
.stepper { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; overflow: hidden; background: #eceae2; }
.step { display: flex; gap: 14px; align-items: center; padding: 18px 22px; border-right: 1px solid var(--line); color: #8e9088; }
.step:last-child { border-right: 0; }
.step.active { background: var(--ink); color: white; }
.step.done { background: #e8f4bd; color: var(--ink); }
.step span { font-size: 12px; letter-spacing: .12em; }
.step b { font-size: 14px; }
.panel { margin-bottom: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); overflow: hidden; }
.upload-panel { border-top-left-radius: 0; border-top-right-radius: 0; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 25px 30px; border-bottom: 1px solid var(--line); }
.panel-heading > div:first-child { display: flex; align-items: center; gap: 14px; }
.panel-heading h2 { margin: 0; font-size: 23px; letter-spacing: -.02em; }
.panel-heading > p { max-width: 600px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; text-align: right; }
.section-number { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--ink); border-radius: 50%; font-size: 11px; font-weight: 700; }
.upload-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 0; }
.dropzone { min-height: 390px; padding: 45px 35px; border-right: 1px dashed #c4c0b3; background: repeating-linear-gradient(45deg, #fbfaf4, #fbfaf4 12px, #f7f5ee 12px, #f7f5ee 24px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.dropzone.dragover { background: #f0f8c8; outline: 2px solid var(--acid-dark); outline-offset: -10px; }
.upload-icon { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 18px; border-radius: 18px; background: var(--ink); color: var(--acid); font-size: 30px; }
.dropzone strong { font-size: 19px; }
.dropzone small { margin-top: 8px; color: var(--muted); }
.preview-grid { display: grid; grid-template-columns: repeat(4, minmax(70px, 100px)); gap: 10px; margin-top: 24px; }
.preview { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 2px solid white; box-shadow: 0 5px 18px rgba(0,0,0,.12); }
.preview img { width: 100%; height: 100%; object-fit: cover; }
.preview button { position: absolute; top: 4px; right: 4px; width: 23px; height: 23px; padding: 0; border: 0; border-radius: 50%; background: rgba(0,0,0,.72); color: white; }
.context-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-content: center; padding: 36px; }
label { display: grid; gap: 8px; color: #45473f; font-size: 12px; font-weight: 600; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 12px 13px; background: white; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(35,84,232,.1); }
textarea { resize: vertical; }
.input-suffix { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: white; overflow: hidden; }
.input-suffix input { border: 0; border-radius: 0; }
.input-suffix span { flex: 0 0 auto; padding: 0 12px; color: var(--muted); font-size: 11px; }
.wide { grid-column: 1 / -1; }
.manual-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.analysis-summary { display: grid; grid-template-columns: 1.1fr .9fr; gap: 24px; padding: 28px; }
.identity-card { padding: 28px; border-radius: 18px; background: var(--ink); color: white; }
.identity-card .confidence { color: var(--acid); font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.identity-card h3 { margin: 14px 0 8px; font-size: 36px; letter-spacing: -.04em; }
.identity-card p { margin: 0; color: #bbbdb6; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.tag { padding: 7px 10px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; font-size: 11px; }
.analysis-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mini-card { padding: 18px; border: 1px solid var(--line); border-radius: 14px; }
.mini-card small { color: var(--muted); }
.mini-card strong { display: block; margin-top: 8px; font-size: 16px; }
.confirm-card { grid-column: 1 / -1; padding: 18px; border-radius: 14px; background: #fff4d8; border: 1px solid #f1d894; }
.confirm-card ul { margin: 10px 0 0; padding-left: 18px; color: #6e5721; font-size: 13px; line-height: 1.6; }
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding: 26px; background: #f6f4ed; }
.editor-card { border: 1px solid var(--line); border-radius: 16px; background: white; overflow: hidden; }
.editor-card.full { grid-column: 1 / -1; }
.editor-card h3 { display: flex; align-items: center; justify-content: space-between; margin: 0; padding: 17px 20px; border-bottom: 1px solid var(--line); font-size: 16px; }
.editor-card h3 small { color: var(--muted); font-weight: 400; }
.field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; padding: 20px; }
.field-note { grid-column: 1 / -1; margin: -2px 0 0; padding: 11px 12px; border-radius: 9px; background: #f4f2eb; color: var(--muted); font-size: 11px; line-height: 1.5; }
.check-field { display: flex; align-items: center; gap: 8px; min-height: 43px; }
.check-field input { width: 18px; height: 18px; }
.line-table { width: 100%; border-collapse: collapse; }
.line-table th, .line-table td { padding: 10px 8px; border-bottom: 1px solid #ece9df; text-align: left; font-size: 12px; }
.line-table th { color: var(--muted); font-weight: 500; }
.line-table input { min-width: 75px; padding: 9px; }
.line-table td:first-child input { min-width: 170px; }
.table-wrap { padding: 12px 18px 18px; overflow-x: auto; }
.icon-btn { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: #f1efe8; }
.add-row { margin-top: 12px; padding: 9px 12px; border: 1px dashed #bdb9ab; border-radius: 9px; background: transparent; font-size: 12px; }
.save-hint { color: var(--muted); font-size: 12px; }
.result-content { padding: 28px; }
.price-hero { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 16px; }
.price-card { min-height: 155px; padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.price-card.primary { background: var(--acid); border-color: var(--acid-dark); }
.price-card small { color: var(--muted); font-weight: 600; }
.price-card strong { display: block; margin: 20px 0 5px; font-size: clamp(28px, 3vw, 44px); line-height: 1; letter-spacing: -.045em; }
.price-card span { color: var(--muted); font-size: 11px; }
.grade-card { display: flex; align-items: center; gap: 18px; background: var(--ink); color: white; }
.grade-badge { display: grid; place-items: center; flex: 0 0 72px; width: 72px; height: 72px; border: 2px solid var(--acid); border-radius: 50%; color: var(--acid); font-size: 34px; font-weight: 700; }
.grade-card p { margin: 7px 0 0; color: #bfc0bb; font-size: 12px; line-height: 1.5; }
.result-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 18px; margin-top: 18px; }
.breakdown, .audit-box { padding: 22px; border: 1px solid var(--line); border-radius: 16px; }
.breakdown h3, .audit-box h3 { margin: 0 0 18px; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 72px; gap: 12px; align-items: center; margin: 11px 0; font-size: 12px; }
.bar-track { height: 9px; border-radius: 99px; background: #eceae2; overflow: hidden; }
.bar-fill { height: 100%; border-radius: inherit; background: var(--blue); }
.bar-row b { text-align: right; }
.audit-box { background: #f7f5ee; }
.audit-box ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.warning-box { margin-top: 18px; padding: 17px 20px; border: 1px solid #f0c5bd; border-radius: 14px; background: #fff1ef; color: #7c2d22; }
.warning-box strong { display: block; margin-bottom: 7px; }
.warning-box ul { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.6; }
.methodology, .sources-panel { display: grid; grid-template-columns: .7fr 1.3fr; gap: 50px; padding: 50px 36px; margin-top: 60px; border-top: 1px solid var(--ink); }
.methodology h2, .sources-panel h2 { margin: 0; font-size: 32px; letter-spacing: -.035em; }
.grade-list { display: grid; gap: 12px; }
.grade-list article { display: flex; gap: 18px; align-items: center; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.5); }
.grade-list article > b { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--ink); color: var(--acid); font-size: 20px; }
.grade-list p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.sources-panel { margin-top: 0; border-top-color: var(--line); }
.source-link { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.source-link span { color: var(--blue); font-weight: 700; }
.source-link strong { font-size: 14px; }
.source-link p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.drawer { position: fixed; top: 0; right: 0; z-index: 60; width: min(430px, 92vw); height: 100vh; padding: 24px; background: var(--panel); box-shadow: -20px 0 60px rgba(0,0,0,.16); transform: translateX(110%); transition: .25s ease; overflow-y: auto; }
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.drawer-head small { color: var(--muted); letter-spacing: .12em; }
.drawer-head h2 { margin: 5px 0 0; }
.drawer-head button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: #eeece4; font-size: 24px; }
.history-item { padding: 17px 0; border-bottom: 1px solid var(--line); }
.history-item strong { display: block; }
.history-item p { margin: 6px 0; color: var(--muted); font-size: 12px; }
.history-item b { color: var(--blue); }
.backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.35); backdrop-filter: blur(3px); }
.loading-overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(244,242,235,.83); backdrop-filter: blur(8px); }
.loader-card { width: min(420px, 90vw); padding: 40px; border: 1px solid var(--line); border-radius: 22px; background: white; text-align: center; box-shadow: var(--shadow); }
.loader { display: block; width: 42px; height: 42px; margin: 0 auto 20px; border: 4px solid #e8e6dd; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
.loader-card p { color: var(--muted); font-size: 13px; line-height: 1.6; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 30px; z-index: 100; padding: 12px 18px; border-radius: 12px; background: var(--ink); color: white; opacity: 0; transform: translate(-50%, 20px); pointer-events: none; transition: .2s ease; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 900px) {
  .workspace { width: min(100% - 24px, 760px); }
  .hero, .upload-grid, .analysis-summary, .methodology, .sources-panel, .result-grid { grid-template-columns: 1fr; }
  .hero { min-height: auto; padding-top: 55px; }
  .hero-note { max-width: none; }
  .dropzone { border-right: 0; border-bottom: 1px dashed var(--line); }
  .editor-grid { grid-template-columns: 1fr; }
  .editor-card.full { grid-column: auto; }
  .price-hero { grid-template-columns: 1fr 1fr; }
  .grade-card { grid-column: 1 / -1; }
  .panel-heading { align-items: flex-start; }
  .panel-heading > p { display: none; }
}
@media (max-width: 620px) {
  .topbar { padding: 10px 14px; }
  .status-pill, #historyBtn { display: none; }
  .workspace { width: calc(100% - 16px); }
  .hero h1 { font-size: 45px; }
  .step { padding: 14px 10px; gap: 6px; }
  .step b { font-size: 11px; }
  .context-form, .field-grid { grid-template-columns: 1fr; padding: 20px; }
  .wide, .field-note { grid-column: auto; }
  .manual-row, .analysis-detail, .price-hero { grid-template-columns: 1fr; }
  .panel-heading { padding: 20px; }
  .panel-heading h2 { font-size: 19px; }
  .editor-grid, .result-content, .analysis-summary { padding: 16px; }
  .methodology, .sources-panel { padding: 35px 16px; }
}
@media print {
  body { background: white; }
  .topbar, .hero, .stepper, .upload-panel, #analysisSection, #editorSection, .methodology, .sources-panel, .heading-actions, .drawer, .toast { display: none !important; }
  .workspace { width: 100%; }
  #resultSection { display: block !important; border: 0; box-shadow: none; }
  .result-content { padding: 12px; }
}
