:root {
  color-scheme: light;
  --ink: #16231e;
  --muted: #68766f;
  --green: #147d57;
  --green-dark: #0d6747;
  --green-soft: #e9f6f0;
  --line: #dce5e0;
  --danger: #c2413b;
  --danger-soft: #fff0ee;
  --warning: #9a630d;
  --warning-soft: #fff7e5;
  --bg: #f3f6f4;
  --white: #fff;
  --shadow: 0 10px 35px rgba(28, 56, 43, .07);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; color: var(--ink); font: 14px/1.6 Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
.page-shell { width: min(1120px, calc(100% - 64px)); margin: 0 auto; padding: 54px 0 34px; }
.back-link { display: inline-flex; margin-bottom: 22px; color: var(--muted); font-size: 13px; text-decoration: none; }
.back-link:hover { color: var(--green); }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; margin-bottom: 30px; }
.hero-copy { max-width: 680px; }
.eyebrow { display: inline-flex; align-items: center; gap: 9px; color: var(--green); font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.eyebrow-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px var(--green-soft); }
h1 { margin: 9px 0 7px; font-size: 37px; line-height: 1.25; letter-spacing: -.04em; }
.hero p { margin: 0; color: var(--muted); font-size: 16px; }
.privacy-card { flex: 0 0 320px; display: flex; align-items: center; gap: 13px; padding: 15px 18px; border: 1px solid #cfe4da; border-radius: 14px; background: rgba(255,255,255,.75); }
.privacy-card svg { width: 29px; fill: var(--green); }
.privacy-card div { display: flex; flex-direction: column; }
.privacy-card strong { font-size: 14px; }
.privacy-card span { color: var(--muted); font-size: 12px; }
.panel { margin: 18px 0; padding: 25px 28px; border: 1px solid #e0e7e3; border-radius: 18px; background: var(--white); box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-heading > div { display: flex; align-items: center; gap: 10px; }
.section-heading h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.step { color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.section-hint { color: var(--muted); font-size: 13px; }
.count-badge { padding: 2px 9px; border-radius: 20px; color: var(--green); background: var(--green-soft); font-size: 12px; font-weight: 700; }
.drop-zone { width: 100%; min-height: 188px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; border: 1.5px dashed #9ebcaf; border-radius: 14px; color: var(--ink); background: #fbfdfc; transition: .18s ease; }
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--green); background: var(--green-soft); transform: translateY(-1px); }
.drop-zone.is-invalid { border-color: var(--danger); background: var(--danger-soft); }
.drop-zone strong { font-size: 16px; }
.drop-zone > span:last-child { color: var(--muted); font-size: 13px; }
.upload-icon { width: 47px; height: 47px; display: grid; place-items: center; border-radius: 50%; color: var(--green); background: var(--green-soft); }
.upload-icon svg { width: 24px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.inline-alert { margin-top: 13px; padding: 10px 13px; border-radius: 9px; color: var(--danger); background: var(--danger-soft); font-size: 13px; }
.text-button { border: 0; padding: 5px 0; background: transparent; color: var(--muted); }
.text-button.danger:not(:disabled) { color: var(--danger); }
.text-button:disabled { opacity: .45; }
.empty-state { display: flex; align-items: center; justify-content: center; flex-direction: column; min-height: 150px; color: var(--muted); border: 1px solid #edf1ef; border-radius: 12px; background: #fafcfb; }
.empty-state svg { width: 33px; fill: none; stroke: #9ca9a2; stroke-width: 1.5; }
.empty-state p { margin: 7px 0 0; color: #536159; font-weight: 700; }
.empty-state span { font-size: 12px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 14px; color: #718078; background: #f7f9f8; font-size: 12px; text-align: left; font-weight: 600; }
td { padding: 13px 14px; border-top: 1px solid #edf1ef; vertical-align: middle; }
.file-cell { display: flex; align-items: center; gap: 10px; min-width: 280px; }
.file-icon { width: 34px; height: 38px; display: grid; place-items: center; border-radius: 7px; color: var(--green); background: var(--green-soft); font-size: 10px; font-weight: 800; }
.file-meta { min-width: 0; display: flex; flex-direction: column; }
.file-name { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.file-size { color: var(--muted); font-size: 11px; }
.sheet-select { max-width: 190px; padding: 7px 28px 7px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: white; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border: 0; border-radius: 20px; font-size: 12px; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.loading { color: #4f6d9d; background: #edf3fb; }
.status.success { color: var(--green); background: var(--green-soft); }
.status.warning { color: var(--warning); background: var(--warning-soft); }
.status.error { color: var(--danger); background: var(--danger-soft); }
.remove-button { min-width: 48px; height: 30px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 7px; color: #77857d; background: transparent; font-size: 12px; font-weight: 650; }
.remove-button:hover { color: var(--danger); background: var(--danger-soft); }
.merge-options { display: flex; align-items: center; justify-content: space-between; gap: 25px; margin-bottom: 22px; padding: 16px 18px; border-radius: 11px; background: #f7f9f8; }
.switch-row { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch-row > span:last-child { display: flex; flex-direction: column; }
.switch-row small { color: var(--muted); }
.switch { position: relative; width: 40px; height: 23px; }
.switch input { position: absolute; opacity: 0; }
.switch > span { position: absolute; inset: 0; border-radius: 20px; background: #bdc8c2; transition: .2s; }
.switch > span::after { content: ""; position: absolute; width: 17px; height: 17px; left: 3px; top: 3px; border-radius: 50%; background: white; box-shadow: 0 1px 4px #73807866; transition: .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(17px); }
.field-wrap { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.field-wrap select { min-width: 180px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.field-wrap.is-disabled { opacity: .5; }
.progress-area { margin: 6px 0 20px; }
.progress-copy { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: 13px; }
.progress-copy strong { color: var(--green); }
.progress-track { height: 8px; overflow: hidden; border-radius: 10px; background: #e6ece9; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #159261, #52bb8e); transition: width .2s ease; }
.error-summary { margin: 0 0 18px; padding: 13px 15px; border: 1px solid #f0c8c4; border-radius: 9px; color: #933b36; background: var(--danger-soft); }
.error-summary strong { display: block; margin-bottom: 3px; }
.button-row { display: flex; gap: 12px; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 9px; padding: 0 20px; font-weight: 700; transition: .16s; }
.button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button.primary { color: white; background: var(--green); }
.button.primary:hover:not(:disabled) { background: var(--green-dark); transform: translateY(-1px); }
.button.secondary { color: var(--green); border-color: #b8d7c8; background: white; }
.button.secondary:hover:not(:disabled) { background: var(--green-soft); }
.button:disabled { color: #97a39d; border-color: #e0e5e2; background: #edf0ee; }
.stats-panel { border-color: #cce4d8; }
.result-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.success-mark { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--green); font-size: 20px; }
.result-heading h2 { margin: 0; font-size: 19px; }
.result-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid var(--line); border-radius: 11px; }
.stats-grid > div { padding: 18px 19px; border-left: 1px solid var(--line); }
.stats-grid > div:first-child { border-left: 0; }
.stats-grid span { display: block; color: var(--muted); font-size: 12px; }
.stats-grid strong { margin-right: 4px; font-size: 25px; letter-spacing: -.03em; }
.stats-grid small { color: var(--muted); }
.per-file-stats { margin-top: 15px; color: var(--muted); font-size: 12px; }
.per-file-stats details { border: 1px solid #edf1ef; border-radius: 8px; padding: 8px 12px; }
.per-file-stats summary { cursor: pointer; color: #526159; font-weight: 650; }
.per-file-stats ul { margin: 8px 0 2px; padding-left: 20px; }
footer { display: flex; flex-direction: column; gap: 7px; padding: 20px 0 0; color: #8a9690; font-size: 12px; text-align: center; }
footer .filing { font-size: 11px; }
footer a { color: inherit; text-decoration: none; }
footer a:hover { color: var(--green); text-decoration: underline; }
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(18, 31, 25, .45); backdrop-filter: blur(2px); }
.modal-card { position: relative; width: min(520px, calc(100vw - 40px)); max-height: min(680px, calc(100vh - 50px)); overflow: auto; padding: 29px; border-radius: 16px; background: white; box-shadow: 0 25px 70px rgba(15, 35, 25, .25); text-align: center; }
.modal-icon { width: 44px; height: 44px; display: grid; place-items: center; margin: 0 auto 11px; border-radius: 50%; color: var(--danger); background: var(--danger-soft); font-size: 22px; font-weight: 800; }
.modal-card h2 { margin: 0 0 9px; font-size: 20px; }
.modal-content { max-height: 390px; overflow: auto; margin-bottom: 20px; color: var(--muted); text-align: left; }
.modal-content p { margin: 5px 0; }
.modal-content ul { margin: 8px 0; padding-left: 21px; }
.modal-content code { padding: 1px 4px; border-radius: 4px; color: #8f352f; background: var(--danger-soft); font-family: inherit; }
.modal-card .button { min-width: 110px; }
.noscript { position: fixed; bottom: 20px; left: 20px; right: 20px; padding: 13px; color: white; background: var(--danger); text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

@media (max-width: 1000px) {
  .page-shell { width: calc(100% - 40px); }
  .privacy-card { flex-basis: 285px; }
  .file-name { max-width: 260px; }
}

@media (max-width: 680px) {
  body { font-size: 14px; }
  .page-shell { width: calc(100% - 28px); padding: 27px 0 25px; }
  .back-link { margin-bottom: 16px; }
  .hero { display: block; margin-bottom: 20px; }
  .hero h1 { font-size: 30px; }
  .hero p { font-size: 14px; }
  .privacy-card { margin-top: 17px; padding: 13px 14px; }
  .panel { margin: 13px 0; padding: 19px 16px; border-radius: 14px; }
  .section-heading { align-items: flex-start; gap: 10px; margin-bottom: 16px; }
  .section-heading > div { flex-wrap: wrap; gap: 6px 9px; }
  .section-hint { max-width: 120px; text-align: right; font-size: 11px; }
  .drop-zone { min-height: 158px; padding: 18px; text-align: center; }
  .drop-zone strong { font-size: 15px; }
  .table-wrap table { min-width: 720px; }
  .file-name { max-width: 190px; }
  .merge-options { display: block; margin-bottom: 17px; padding: 14px; }
  .field-wrap { margin-top: 14px; align-items: flex-start; flex-direction: column; gap: 5px; }
  .field-wrap select { width: 100%; min-width: 0; }
  .button-row { flex-direction: column; }
  .button-row .button, .action-panel > .button { width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid > div { padding: 14px; border-top: 1px solid var(--line); }
  .stats-grid > div:nth-child(odd) { border-left: 0; }
  .stats-grid > div:nth-child(-n+2) { border-top: 0; }
  .stats-grid > div:last-child { grid-column: 1 / -1; }
  .stats-grid strong { font-size: 22px; }
  .modal-card { width: calc(100vw - 28px); max-height: calc(100vh - 28px); padding: 23px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
