:root {
  --bg: #ffffff;
  --ink: #14171f;
  --ink-2: #4b5263;
  --ink-3: #9198a6;
  --rule: #e6e8ed;
  --bar: #cdd2dc;
  --blue: #002fa7;
  --blue-hover: #1a47c2;
  --danger: #c62828;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
main { max-width: 560px; margin: 0 auto; padding: 72px 20px 96px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }

/* Header */
.top { display: flex; align-items: center; gap: 10px; margin-bottom: 64px; }
.mark { width: 20px; height: 20px; flex: none; }
.mark-back { fill: none; stroke: var(--ink); stroke-width: 3; }
.mark-front { fill: var(--blue); }
h1 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: .04em; }
.nav { margin-left: auto; display: flex; gap: 22px; font-size: 14px; }
.nav a { color: var(--ink-3); text-decoration: none; padding: 2px 0; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--blue); }

/* Upload page: template notice, login, confirmation */
.notice { margin: 0 0 44px; padding-left: 16px; border-left: 2px solid var(--blue); }
.notice-title { margin: 0; font-size: 17px; font-weight: 600; color: var(--blue); }
.notice ul { margin: 8px 0 0; padding-left: 18px; font-size: 14px; color: var(--ink-2); }
.notice li { margin: 2px 0; }
.nowrap { white-space: nowrap; }
.notice-templates { margin: 10px 0 0 !important; }
.line-spaced { margin-top: 20px; }
.confirm {
  display: flex; align-items: center; gap: 8px; margin-top: 24px;
  font-size: 14px; color: var(--ink-2); cursor: pointer; width: fit-content;
}
.confirm input { width: 16px; height: 16px; margin: 0; accent-color: var(--blue); }
.confirm + .actions { margin-top: 14px; }
.lib-meta { display: flex; gap: 16px; margin: 18px 0 0; font-size: 13px; color: var(--ink-3); }
.login .drop-hint { margin-top: 6px; }
.login-form { display: flex; gap: 10px; margin-top: 28px; max-width: 420px; }
.login-form input {
  flex: 1; min-width: 0; height: 44px; padding: 0 14px;
  border: 1px solid var(--rule); border-radius: 3px; font: 15px var(--sans); color: var(--ink);
}
.login-form input:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: transparent; }
.login .error { margin-top: 14px; }

.dl-list { list-style: none; margin: 36px 0 0; padding: 0; border-top: 1px solid var(--rule); font-size: 14px; }
.dl-list li {
  display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; column-gap: 20px;
  padding: 12px 0; border-bottom: 1px solid var(--rule);
}
.dl-count { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.dl-list a { color: var(--blue); font-weight: 500; text-decoration: underline; text-underline-offset: 4px; }
.dl-list a:hover { text-decoration-thickness: 2px; }
.dl-list a.empty { color: var(--ink-3); text-decoration: none; pointer-events: none; font-weight: 400; }

/* Category picker: a segmented control */
.cats { border: 0; margin: 0 0 36px; padding: 0; min-width: 0; }
.cats legend { padding: 0; margin-bottom: 10px; font-size: 13px; color: var(--ink-3); }
.seg { display: inline-flex; flex-wrap: wrap; }
.seg-item {
  position: relative; display: inline-flex; align-items: baseline; gap: 8px; cursor: pointer;
  padding: 9px 20px; margin-right: -1px;
  border: 1px solid var(--rule); color: var(--ink-2); font-size: 15px;
  transition: background-color .15s, color .15s, border-color .15s;
}
.seg-item input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-item:first-child { border-radius: 3px 0 0 3px; }
.seg-item:last-child { border-radius: 0 3px 3px 0; margin-right: 0; }
.seg-item small { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.seg-item:hover { color: var(--ink); }
.seg-item:has(input:checked) { background: var(--blue); border-color: var(--blue); color: #fff; z-index: 1; }
.seg-item:has(input:checked) small { color: rgba(255, 255, 255, .75); }
.seg-item:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.result-head b { font-weight: 600; color: var(--ink); }

/* Upload: a line of type and a hairline, nothing boxed */
.drop { display: block; cursor: pointer; }
.drop-title {
  display: block; font-size: 28px; font-weight: 500; line-height: 1.35;
  letter-spacing: .01em; word-break: break-all;
}
.drop-title em {
  font-style: normal; color: var(--blue); margin-left: .15em;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 7px;
}
.drop:hover .drop-title em { text-decoration-thickness: 2px; }
.drop-hint { display: block; margin-top: 10px; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.drop.has-file .drop-hint { color: var(--ink-2); }

.templates { margin: 6px 0 20px; font-size: 13px; color: var(--ink-3); }
.templates a {
  margin-left: 12px; color: var(--blue); text-decoration: underline;
  text-decoration-thickness: 1px; text-underline-offset: 4px;
}
.templates a:hover { text-decoration-thickness: 2px; }

.line { position: relative; height: 1px; background: var(--rule); }
.line-fill { position: absolute; left: 0; top: -1px; height: 2px; width: 0; background: var(--blue); transition: width .2s; }
.line-fill.busy { width: 100% !important; animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.actions { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 14px;
  height: 44px; padding: 0 22px; border: 0; border-radius: 3px;
  background: var(--blue); color: #fff;
  font: 600 15px var(--sans); text-decoration: none; cursor: pointer;
  transition: background-color .15s;
}
.btn:hover:not(:disabled) { background: var(--blue-hover); }
.btn:disabled { background: #eef0f4; color: #a4aab6; cursor: not-allowed; }
.arrow { font-weight: 400; transition: transform .15s; }
.btn:hover:not(:disabled) .arrow { transform: translateX(3px); }
.btn:hover .arrow.down { transform: translateY(2px); }
#submit-text { font-variant-numeric: tabular-nums; }
.error { margin: 0; color: var(--danger); font-size: 14px; }

/* Whole-page drop target while dragging */
.overlay {
  position: fixed; inset: 0; z-index: 10; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  background: rgba(244, 246, 253, .94); color: var(--blue);
  font-size: 24px; font-weight: 500; letter-spacing: .02em;
}

/* Result: a subtraction ledger */
.result { margin-top: 80px; }
.result-head { display: flex; justify-content: space-between; gap: 16px; font-size: 13px; color: var(--ink-2); }
.result-file { color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hero {
  margin: 10px 0 36px; color: var(--blue);
  font: 600 72px/1 var(--sans); letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.hero .unit { font: 500 15px var(--sans); letter-spacing: 0; color: var(--ink-2); margin-left: 12px; }

.ledger { list-style: none; margin: 0; padding: 0; font-size: 14px; border-top: 1px solid var(--rule); }
.ledger li {
  display: grid; grid-template-columns: 18px 1fr 96px 88px 52px; align-items: center; column-gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--rule);
}
.sign { color: var(--ink-3); }
.l-label { color: var(--ink-2); }
.l-bar { height: 4px; display: flex; }
.l-bar i { display: block; height: 100%; width: 0; background: var(--bar); }
.l-num { text-align: right; font-variant-numeric: tabular-nums; }
.l-pct { font-size: 12px; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.ledger-start .l-label { color: var(--ink); }
.ledger-total { border-bottom: 0 !important; }
.ledger-total .sign, .ledger-total .l-label { color: var(--ink); font-weight: 600; }
.ledger-total .l-num { color: var(--blue); font-weight: 600; }
.ledger-total .l-bar i { background: var(--blue); }

.downloads { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; margin-top: 36px; }
.text-link {
  color: var(--blue); font-weight: 500; text-decoration: underline;
  text-decoration-thickness: 1px; text-underline-offset: 6px;
}
.text-link:hover { text-decoration-thickness: 2px; }

.result-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 32px; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.link { border: 0; background: none; padding: 0; cursor: pointer; font: 13px var(--sans); color: var(--ink-2); }
.link:hover { color: var(--blue); }

@media (max-width: 480px) {
  main { padding-top: 40px; }
  .top { margin-bottom: 44px; }
  .drop-title { font-size: 23px; }
  .hero { font-size: 56px; }
  .ledger li { grid-template-columns: 14px 1fr 44px auto 48px; column-gap: 8px; }
}
