:root {
  --ink: #17201d;
  --muted: #68726d;
  --paper: #f5f3ed;
  --surface: #fffef9;
  --line: #d8d7cf;
  --green: #1f664b;
  --green-dark: #154735;
  --green-soft: #dfe9df;
  --sand: #eee7d7;
  --warning: #fff2c8;
  --danger: #a4362a;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; }
button, input { font: inherit; }
button { cursor: pointer; }

.site-header {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand { color: var(--ink); text-decoration: none; font-weight: 800; letter-spacing: -.04em; font-size: 20px; }
.brand span { color: var(--green); }
.privacy-pill { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 8px 12px; background: rgba(255,255,255,.45); }
.privacy-dot { width: 7px; height: 7px; border-radius: 50%; background: #47a277; display: inline-block; margin-right: 7px; }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.hero { padding: 92px 0 58px; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, .6fr); gap: 52px; align-items: end; }
.hero .eyebrow { grid-column: 1 / -1; margin: 0 0 -30px; }
.eyebrow, .section-kicker { color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .16em; margin: 0 0 12px; }
.hero h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(48px, 7vw, 90px); line-height: .96; letter-spacing: -.055em; font-weight: 500; }
.hero h1 em { color: var(--green); font-weight: 400; }
.hero-copy { margin: 0 0 7px; color: var(--muted); font-size: 17px; line-height: 1.8; }

.upload-card, .method-section { border-top: 1px solid var(--ink); display: grid; grid-template-columns: 72px 1fr; padding: 34px 0 84px; }
.step-marker { font-family: Georgia, serif; color: var(--green); font-size: 19px; }
.section-heading, .review-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 30px; }
.section-heading h2, .review-header h2, .method-section h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-weight: 500; font-size: clamp(32px, 4vw, 48px); letter-spacing: -.03em; }
.section-heading > p { color: var(--muted); max-width: 340px; margin: 14px 0 0; line-height: 1.6; }

.source-mode { display: inline-flex; gap: 4px; margin: 0 0 34px; padding: 4px; border: 1px solid var(--line); background: rgba(255,255,255,.45); }
.source-mode-button { border: 0; padding: 11px 16px; background: transparent; color: var(--muted); font-weight: 700; }
.source-mode-button.active { background: var(--ink); color: white; }

.extraction-settings { display: grid; grid-template-columns: minmax(220px, .6fr) minmax(300px, 1.4fr); gap: 14px; margin: 30px 0 14px; }
.ai-settings, .stock-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 18px; border: 1px solid var(--line); background: rgba(255,255,255,.48); }
.field-control { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field-control > span { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.field-control input, .field-control select { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #bfc2bd; border-radius: 0; background: var(--surface); color: var(--ink); outline: none; }
.field-control input:focus, .field-control select:focus { border-color: var(--green); box-shadow: 0 0 0 2px rgba(31,102,75,.12); }
.toggle-control { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.toggle-control input { width: 18px; height: 18px; accent-color: var(--green); }
.toggle-control span { display: flex; flex-direction: column; gap: 2px; }
.toggle-control small, .settings-note { color: var(--muted); }
.settings-note { grid-column: 1 / -1; margin: 0; font-size: 12px; line-height: 1.6; }
.stock-form { margin-top: 30px; }

.dropzone { position: relative; margin-top: 34px; min-height: 220px; border: 1.5px dashed #9da49f; background: rgba(255,255,255,.45); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; transition: .2s ease; cursor: pointer; overflow: hidden; }
.dropzone:hover, .dropzone.dragover { border-color: var(--green); background: var(--green-soft); }
.dropzone input { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone strong { font-size: 20px; }
.dropzone > span:last-child { color: var(--muted); font-size: 13px; }
.upload-icon { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--ink); border-radius: 50%; font-size: 24px; margin-bottom: 8px; }

.file-list { margin-top: 16px; display: grid; gap: 8px; }
.file-row { display: grid; grid-template-columns: 1fr auto auto; gap: 18px; align-items: center; padding: 13px 16px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; }
.file-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row span { color: var(--muted); }
.file-row button { border: 0; background: transparent; color: var(--danger); }
.action-row { display: flex; align-items: center; gap: 20px; margin-top: 22px; }
.primary-button { border: 0; border-radius: 0; color: white; background: var(--green); padding: 14px 22px; font-weight: 700; transition: .2s ease; }
.primary-button:hover { background: var(--green-dark); transform: translateY(-1px); }
.primary-button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.text-button { border: 0; background: transparent; color: var(--muted); text-decoration: underline; }

.progress { margin-top: 24px; }
.progress-track { height: 3px; background: var(--line); overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 0; background: var(--green); transition: width .3s ease; }
.progress p { color: var(--muted); font-size: 13px; }
.error-box { margin-top: 18px; padding: 15px; border-left: 3px solid var(--danger); background: #f7e6df; color: #72291f; line-height: 1.5; }

.review-section { padding: 82px 0; border-top: 1px solid var(--ink); }
.review-stats { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.stat-chip { border: 1px solid var(--line); background: var(--surface); padding: 10px 13px; font-size: 12px; }
.stat-chip strong { display: block; font-size: 18px; color: var(--green); }
.notice { margin: 28px 0; padding: 16px 18px; background: var(--warning); border-left: 3px solid #c9941a; font-size: 13px; line-height: 1.6; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.tab-list { display: flex; gap: 3px; }
.tab { border: 1px solid var(--line); background: transparent; padding: 10px 14px; color: var(--muted); }
.tab.active { background: var(--ink); color: white; border-color: var(--ink); }
.search-box { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); padding: 8px 2px; }
.search-box input { border: 0; outline: 0; background: transparent; width: 150px; }

.table-shell { overflow: auto; background: var(--surface); border: 1px solid var(--line); max-height: 650px; }
.review-table { border-collapse: collapse; width: 100%; min-width: 760px; font-size: 13px; }
.review-table thead { position: sticky; top: 0; z-index: 2; }
.review-table th { background: var(--ink); color: white; padding: 13px 12px; text-align: right; font-weight: 600; }
.review-table th:first-child, .review-table th:nth-child(2) { text-align: left; }
.review-table td { border-bottom: 1px solid #e6e4dc; padding: 7px 11px; }
.review-table td:first-child { width: 38px; color: var(--muted); text-align: center; }
.review-table td.label { min-width: 300px; }
.review-table tr.total-row td.label { font-weight: 800; }
.review-table tr.total-row td { border-top: 1px solid #8e938f; background: #faf9f3; }
.review-table tr.sub-row td.label { padding-left: 28px; color: #4f5954; }
.value-input { width: 140px; border: 1px solid transparent; background: transparent; text-align: right; padding: 6px 7px; font-variant-numeric: tabular-nums; }
.value-input:hover, .value-input:focus { border-color: #aeb3af; outline: none; background: white; }
.value-input.low-confidence { background: var(--warning); }
.value-input.formula { color: #111; font-weight: 700; pointer-events: none; }
.source-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 7px; background: #85a08f; }
.source-dot.low { background: #d2a22d; }

.download-panel { margin-top: 24px; background: var(--green); color: white; padding: 32px; display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.download-panel .section-kicker { color: #bcd7c9; }
.download-panel h3 { font-family: Georgia, serif; font-weight: 500; font-size: 28px; margin: 0 0 8px; }
.download-panel p { margin: 0; color: #d4e4dc; }
.download-button { background: white; color: var(--green-dark); white-space: nowrap; }
.download-button:hover { background: var(--sand); }

.method-section { padding-bottom: 90px; }
.method-grid { margin-top: 38px; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.method-grid article { padding: 22px 22px 10px 0; border-right: 1px solid var(--line); }
.method-grid article:not(:first-child) { padding-left: 22px; }
.method-grid article:last-child { border-right: 0; }
.method-grid span { font-family: Georgia, serif; color: var(--green); }
.method-grid h3 { margin: 34px 0 10px; font-size: 17px; }
.method-grid p { color: var(--muted); margin: 0; font-size: 13px; line-height: 1.65; }

footer { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 24px 0 36px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
footer span { color: var(--ink); font-weight: 800; }
footer p { margin: 0; }

@media (max-width: 800px) {
  .hero { grid-template-columns: 1fr; padding-top: 65px; gap: 28px; }
  .hero .eyebrow { margin: 0; }
  .upload-card, .method-section { grid-template-columns: 42px 1fr; }
  .section-heading, .review-header { flex-direction: column; }
  .method-grid { grid-template-columns: 1fr 1fr; }
  .method-grid article:nth-child(2) { border-right: 0; }
  .download-panel { align-items: flex-start; flex-direction: column; }
  .extraction-settings, .ai-settings, .stock-form { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .site-header, main, footer { width: min(100% - 24px, 1180px); }
  .privacy-pill { display: none; }
  .hero h1 { font-size: 45px; }
  .upload-card, .method-section { grid-template-columns: 1fr; gap: 18px; }
  .method-grid { grid-template-columns: 1fr; }
  .method-grid article { border-right: 0; border-bottom: 1px solid var(--line); padding-left: 0 !important; }
  .toolbar { align-items: stretch; flex-direction: column; gap: 12px; }
  .source-mode { display: grid; grid-template-columns: 1fr 1fr; }
  footer { flex-direction: column; gap: 10px; }
}
