:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #667085;
  --line: #d7dee8;
  --panel: #ffffff;
  --accent: #126a5b;
  --accent-2: #315a9b;
  --warn: #a15c00;
  --loss: #b42318;
  --gain: #067647;
}

* {
  box-sizing: border-box;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  font-weight: 750;
}

.topbar p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.topActions,
.toolbar,
.dialogFoot {
  display: flex;
  align-items: center;
  gap: 10px;
}

button,
.uploadButton,
select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

button,
.uploadButton {
  height: 38px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.uploadButton {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 650;
}

.uploadButton input {
  display: none;
}

#exportButton,
.primary {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
  font-weight: 650;
}

main {
  padding: 20px 28px 36px;
}

.summaryGrid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-height: 86px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  line-height: 1.1;
}

.toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  padding: 10px;
}

.toolbar input {
  flex: 1;
  min-width: 220px;
}

.toolbar input,
.toolbar select {
  height: 36px;
  padding: 0 10px;
}

.tableShell {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 0;
  max-height: calc(100vh - 270px);
}

table {
  width: 100%;
  min-width: 1680px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  background: #f0f4f8;
  color: #344054;
  text-align: left;
  padding: 10px 9px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  z-index: 2;
}

td {
  padding: 9px;
  border-bottom: 1px solid #edf1f5;
  white-space: nowrap;
  vertical-align: middle;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: #f8fbff;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cellNote {
  display: inline-block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.gain {
  color: var(--gain);
  font-weight: 650;
}

.loss {
  color: var(--loss);
  font-weight: 650;
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: #315a9b;
  font-size: 12px;
}

.expired {
  background: #f2f4f7;
  color: #667085;
}

.urgent {
  background: #fff4e5;
  color: var(--warn);
}

dialog {
  width: min(860px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(16, 24, 40, 0.24);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.38);
}

.dialogHead,
.dialogFoot {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dialogFoot {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}

.iconButton {
  width: 34px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.formGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 18px;
}

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 12px;
  font-weight: 650;
}

label input,
label textarea {
  width: 100%;
  padding: 9px 10px;
  font-size: 14px;
}

.wide {
  grid-column: 1 / -1;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 420px;
  background: #18212f;
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 14px 40px rgba(16, 24, 40, 0.22);
}

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

  .topActions,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .summaryGrid {
    grid-template-columns: repeat(2, 1fr);
  }

  .formGrid {
    grid-template-columns: 1fr;
  }
}
