:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #15213b;
  --muted: #667085;
  --line: #e5e9f2;
  --primary: #155eef;
  --primary-soft: #edf4ff;
  --success: #07883f;
  --danger: #d92d20;
  --shadow: 0 18px 50px rgba(16, 24, 40, 0.08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at top left, #eaf2ff 0, transparent 32%), var(--bg); color: var(--text); }
button, input, textarea { font: inherit; }
.app-shell { max-width: 1440px; margin: 0 auto; padding: 28px 24px 40px; }
.hero { display: flex; justify-content: space-between; gap: 24px; align-items: center; padding: 34px 38px; border-radius: 26px; background: linear-gradient(135deg, #0b3aa4, #155eef 52%, #5d8cff); color: white; box-shadow: var(--shadow); }
.eyebrow { margin: 0 0 8px; font-size: 12px; font-weight: 800; letter-spacing: 0.18em; opacity: .8; }
h1 { margin: 0; font-size: clamp(30px, 4vw, 48px); letter-spacing: -.03em; }
.subtitle { max-width: 760px; margin: 12px 0 0; line-height: 1.7; opacity: .9; }
.hero-badge { flex: 0 0 auto; padding: 10px 16px; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; background: rgba(255,255,255,.12); font-weight: 700; }
main { display: grid; gap: 20px; margin-top: 22px; }
.panel { background: var(--panel); border: 1px solid rgba(229,233,242,.9); border-radius: 22px; padding: 24px; box-shadow: 0 10px 35px rgba(16,24,40,.05); }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.section-title h2 { margin: 0; font-size: 20px; }
.section-title p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.button-group { display: flex; gap: 10px; flex-wrap: wrap; }
.button { border: 0; border-radius: 10px; padding: 10px 15px; cursor: pointer; font-weight: 700; transition: .2s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: white; background: var(--primary); }
.button.success { color: white; background: var(--success); }
.button.ghost { color: #344054; background: #f2f4f7; }
.drop-zone { min-height: 190px; border: 2px dashed #b8c6e6; border-radius: 18px; background: #f8fbff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; cursor: pointer; transition: .2s; }
.drop-zone.dragover { border-color: var(--primary); background: var(--primary-soft); }
.drop-zone strong { font-size: 17px; }
.drop-zone span { color: var(--muted); font-size: 13px; }
.drop-icon { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: white; color: var(--primary); font-size: 28px; box-shadow: 0 8px 24px rgba(21,94,239,.14); }
.preview-wrap { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: start; }
.preview-wrap img { width: 100%; max-height: 440px; object-fit: contain; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.preview-actions { display: flex; flex-direction: column; gap: 10px; }
.progress-wrap { margin-top: 18px; }
.progress-meta { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 8px; }
.progress-track { height: 10px; border-radius: 999px; background: #e9eef8; overflow: hidden; }
.progress-bar { width: 0; height: 100%; background: linear-gradient(90deg, #155eef, #69a0ff); transition: width .2s; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.6; }
.hidden { display: none !important; }
.rule-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.rule-card { display: grid; grid-template-columns: 1fr auto 1fr auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfe; }
.rule-card input { width: 100%; min-width: 0; border: 1px solid #d0d5dd; border-radius: 9px; padding: 10px; text-align: center; }
.rule-card .arrow { color: var(--muted); font-weight: 800; }
.icon-button { border: 0; background: transparent; color: var(--danger); cursor: pointer; font-size: 18px; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 1050px; }
th { background: #f7f9fc; color: #475467; font-size: 13px; text-align: right; padding: 12px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child { text-align: left; }
td { padding: 8px 10px; border-bottom: 1px solid #eef1f6; text-align: right; }
td:first-child { text-align: left; }
td input { width: 100%; border: 1px solid transparent; border-radius: 8px; padding: 8px; background: transparent; text-align: right; }
td:first-child input { text-align: left; min-width: 150px; }
td input:focus { outline: 0; border-color: #84adff; background: white; box-shadow: 0 0 0 3px #edf4ff; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.diff-positive { color: var(--success); font-weight: 800; }
.empty-state { padding: 28px; text-align: center; color: var(--muted); }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 18px; }
.summary-grid article { padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: #fbfcfe; }
.summary-grid span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.summary-grid strong { font-size: 22px; }
.summary-grid .difference { background: #effaf4; border-color: #b7e3c8; }
.summary-grid .difference strong { color: var(--success); }
details summary { cursor: pointer; font-weight: 800; }
textarea { width: 100%; resize: vertical; border: 1px solid #d0d5dd; border-radius: 12px; padding: 14px; margin: 8px 0 12px; line-height: 1.6; }
footer { text-align: center; color: var(--muted); padding: 28px 0 0; font-size: 13px; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 360px; padding: 13px 18px; border-radius: 12px; background: #101828; color: white; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(15px); transition: .25s; z-index: 50; }
.toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 800px) {
  .app-shell { padding: 14px; }
  .hero { padding: 26px 22px; align-items: flex-start; }
  .hero-badge { display: none; }
  .section-title, .preview-wrap { grid-template-columns: 1fr; display: grid; }
  .preview-actions { flex-direction: row; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .summary-grid { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
}
