:root {
  --bg: #faf9f7;
  --card: #fff;
  --ink: #1c1b19;
  --muted: #6b675f;
  --line: #e3e0da;
  --line2: #efece7;
  --accent: #8a5a2b;
  --soft: #f5efe7;
  --ok: #2f6f4e;
  --err: #a33131;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614;
    --card: #211f1d;
    --ink: #f0ede8;
    --muted: #a39e95;
    --line: #35322e;
    --line2: #2a2724;
    --accent: #d9a066;
    --soft: #2b2620;
    --ok: #6cc196;
    --err: #e58484;
    color-scheme: dark;
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    15px/1.6 -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    'PingFang SC',
    'Hiragino Sans GB',
    'Microsoft YaHei',
    sans-serif;
}
.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}
.top {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
h1 {
  font-size: 21px;
  margin: 0;
  letter-spacing: -0.01em;
}
.sub {
  color: var(--muted);
  font-size: 13px;
  margin: 6px 0 0;
}
.pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--soft);
  color: var(--accent);
  margin-top: 4px;
  white-space: nowrap;
}
.task {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px 20px;
  margin-bottom: 18px;
}
.task-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
h2 {
  font-size: 16px;
  font-weight: 650;
  margin: 0;
}
.task-head > span {
  color: var(--muted);
  font-size: 12.5px;
}
.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.zone {
  border: 1.5px dashed var(--line);
  border-radius: 11px;
  background: var(--bg);
  overflow: hidden;
  transition: 0.15s;
}
.zone:has(.drag),
.zone:has(.drop:hover) {
  border-color: var(--accent);
  background: var(--soft);
}
.zone:has(li) {
  border-style: solid;
  background: var(--card);
}
.drop {
  display: block;
  position: relative;
  padding: 16px;
  min-height: 154px;
  cursor: pointer;
}
.drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.drop:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: -4px;
  border-radius: 11px;
}
.drop strong {
  display: block;
  font-size: 13.5px;
  font-weight: 650;
}
.hint {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}
.choose {
  display: inline-block;
  margin-top: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 7px;
  padding: 5px 11px;
  font-size: 12.5px;
  font-weight: 500;
}
.drop-hint {
  font-size: 12px;
  color: var(--muted);
  margin-left: 9px;
}
.file-list {
  list-style: none;
  padding: 0 16px;
  margin: 0;
  font-size: 13px;
}
.file-list li {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-top: 1px solid var(--line2);
}
.file-list li:last-child {
  margin-bottom: 10px;
}
.name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.file-list small {
  color: var(--muted);
  white-space: nowrap;
}
.remove {
  background: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  padding: 2px 4px;
}
.remove:hover {
  color: var(--err);
}
button {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 9px;
  padding: 10px 18px;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font-weight: 500;
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.date-setting {
  display: flex;
  gap: 8px 16px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 16px;
  color: var(--muted);
  font-size: 12.5px;
}
.date-setting label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.date-setting input {
  font: inherit;
  font-size: 13px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
}
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 16px;
}
.actions > span {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
}
#status {
  padding: 10px 13px;
  border-radius: 9px;
  font-size: 13px;
  margin-top: 16px;
  background: var(--soft);
  color: var(--ok);
  overflow-wrap: anywhere;
}
#status[hidden] {
  display: none;
}
#status.error {
  color: var(--err);
}
.download-button {
  display: block;
  width: fit-content;
  background: var(--accent);
  color: #fff;
  padding: 9px 16px;
  border-radius: 9px;
  text-decoration: none;
  margin-top: 12px;
  font-weight: 600;
}
.notes {
  padding: 0 2px;
}
.notes h2 {
  font-size: 13.5px;
  margin: 0 0 6px;
}
.notes p {
  color: var(--muted);
  font-size: 12.5px;
  margin: 0;
  line-height: 1.8;
}
.legend {
  display: flex;
  gap: 10px 24px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}
.swatch {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  vertical-align: -1px;
  margin-right: 5px;
  border: 1px solid #0002;
}
.yellow {
  background: #fff2cc;
}
.red {
  background: #ffc7ce;
}
footer {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}
@media (max-width: 720px) {
  .upload-grid {
    grid-template-columns: 1fr;
  }
  .wrap {
    padding: 22px 16px 48px;
  }
  .task {
    padding: 16px;
  }
  .actions > span {
    width: 100%;
    margin: 2px 0 0;
  }
  .top {
    gap: 8px;
  }
  .date-setting {
    align-items: flex-start;
    flex-direction: column;
  }
}

.receipt-box {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.receipt-box[hidden] {
  display: none;
}
.receipt-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: 13.5px;
}
.receipt-head span,
.receipt-all,
#mapping-message {
  font-size: 12px;
  color: var(--muted);
}
.receipt-all {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.receipt-box input {
  font: inherit;
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  min-width: 0;
}
.receipt-all input {
  width: 220px;
}
.receipt-grid {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(150px, 1fr) minmax(180px, 1.4fr) minmax(150px, 0.8fr);
  gap: 8px 12px;
  align-items: center;
  font-size: 13px;
}
.receipt-grid input {
  width: 100%;
}
.receipt-grid .rh {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.receipt-po {
  overflow-wrap: anywhere;
}
#mapping-message {
  margin: 8px 0;
}
#mapping-message:empty {
  display: none;
}
.receipt-grid:not(:empty) {
  margin-top: 12px;
}
@media (max-width: 720px) {
  .receipt-grid {
    grid-template-columns: 1fr;
  }
  .receipt-grid .rh {
    display: none;
  }
  .receipt-row-label {
    margin-top: 8px;
    font-weight: 600;
  }
}

.brand-setting {
  display: flex;
  align-items: center;
  gap: 10px 16px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.brand-setting label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
}
.brand-setting select {
  min-width: 190px;
  font: inherit;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
}
.brand-setting span {
  color: var(--muted);
  font-size: 12px;
}

.receipt-bulk {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 24px;
}
.receipt-all input[type="date"] {
  width: 160px;
}

.brand-setting[hidden], #brand-setting[hidden], .agent-setting[hidden], .notes[hidden] {
  display: none;
}
.agent-setting {
  margin: 16px 0;
  font-size: 13px;
}
.agent-setting label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}
.agent-setting textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}
.agent-setting p {
  color: var(--muted);
  line-height: 1.6;
}
