:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #66727c;
  --line: #dbe2e8;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --warn: #a15c00;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.app {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar,
.workspace,
.section-head,
.actions,
.record-tools {
  display: flex;
  gap: 16px;
}

.topbar {
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  font-weight: 720;
}

h2 {
  font-size: 16px;
  font-weight: 700;
}

p,
small,
.section-head span,
.log {
  color: var(--muted);
}

button {
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: white;
  height: 36px;
  padding: 0 14px;
  font-weight: 650;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

.actions {
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.date-export {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

select,
input[type="date"] {
  height: 36px;
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  padding: 0 10px;
  font: inherit;
}

.record-tools {
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.danger-button {
  border-color: #b42318;
  background: #b42318;
}

.danger-button:hover {
  background: #8f1d15;
}

button:disabled,
button:disabled:hover {
  border-color: var(--line);
  background: #e9eef2;
  color: #8b98a3;
  cursor: not-allowed;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.workspace {
  align-items: stretch;
}

.upload-panel {
  flex: 1 1 0;
}

.dropzone {
  display: flex;
  min-height: 132px;
  margin-top: 12px;
  border: 1px dashed #8aa2b2;
  border-radius: 8px;
  background: #f8fbfc;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
}

input[type="file"] {
  margin-top: 12px;
  width: 100%;
}

.log {
  min-height: 44px;
  margin-top: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.section-head {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  color: #40505c;
  font-weight: 700;
  background: #f8fafb;
  position: sticky;
  top: 0;
}

.select-col {
  width: 44px;
  min-width: 44px;
  text-align: center;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

td.remark {
  min-width: 360px;
  line-height: 1.45;
}

.amount {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.empty {
  color: var(--muted);
  text-align: center;
  height: 72px;
}

.link-button {
  border-color: var(--line);
  background: white;
  color: #51616d;
  height: 28px;
  padding: 0 10px;
}

.link-button:hover {
  background: #f6f8fa;
  color: #111827;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.summary-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.summary-card strong {
  display: block;
  font-size: 15px;
  margin-bottom: 8px;
}

.summary-card span {
  display: block;
  color: var(--muted);
  line-height: 1.6;
}

.summary-card button {
  margin-top: 10px;
}

.needs-xml {
  color: var(--warn);
  font-weight: 650;
}

@media (max-width: 860px) {
  .topbar,
  .workspace {
    flex-direction: column;
    align-items: stretch;
  }
}
