* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background: #e6e0d4;
  color: #1c1916;
  font-family: Inter, "Noto Sans", "Liberation Sans", sans-serif;
  font-synthesis: none;
  color-scheme: light;
}

main {
  display: grid;
  grid-template-columns: minmax(300px, 440px) minmax(320px, 1fr);
  gap: 36px;
  align-items: start;
  min-height: 100vh;
  padding: 32px 40px 48px;
}

.mark {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5e574e;
}

h1 {
  margin: 0;
  font-family: "Noto Serif", "Liberation Serif", Georgia, serif;
  font-size: 42px;
  font-weight: 400;
  line-height: 1.1;
}

.lede {
  margin: 12px 0 22px;
  max-width: 38em;
  font-size: 16px;
  line-height: 1.45;
  color: #3f3a34;
}

.files {
  display: grid;
  gap: 14px;
}

.file-pick {
  display: grid;
  gap: 6px;
}

.hint, .fine, .empty {
  margin: 0;
  max-width: 46em;
  font-size: 13px;
  line-height: 1.4;
  color: #5e574e;
}

.fine {
  margin-top: 2px;
}

.empty {
  margin-top: 18px;
  font-size: 15px;
  line-height: 1.45;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-top: 14px;
}

button, .file-button {
  justify-self: start;
  border: 1px solid #1c1916;
  border-radius: 6px;
  background: transparent;
  color: #1c1916;
  font: inherit;
  font-size: 15px;
  padding: 10px 16px;
  cursor: pointer;
}

.file-button {
  position: relative;
  display: inline-flex;
  width: fit-content;
  padding: 8px 12px;
  font-size: 14px;
}

.file-button input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  padding: 0;
  border: 0;
  cursor: pointer;
}

.file-button input:focus {
  outline: none;
}

.file-button:focus-within {
  outline: 2px solid #1c1916;
  outline-offset: 2px;
}

button:hover:not(:disabled):not(.linkish):not([aria-pressed="true"]),
.file-button:hover {
  background: #f3ece1;
}

button.linkish {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 14px;
  text-decoration: underline;
}

button.linkish:hover:not(:disabled) {
  background: transparent;
  color: #34302b;
}

button:disabled {
  cursor: default;
  opacity: 0.5;
}

button[aria-pressed="true"] {
  background: #1c1916;
  color: #fffcf7;
}

button[aria-pressed="true"]:hover {
  background: #1c1916;
  color: #fffcf7;
}

:focus-visible {
  outline: 2px solid #1c1916;
  outline-offset: 2px;
}

.hint.error, #status.error {
  color: #8a2e24;
}

#status {
  min-height: 1.2em;
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
}

.stage {
  display: flex;
  justify-content: center;
}

.sheet {
  width: min(100%, 920px);
  min-height: 280px;
  padding: 22px 22px 26px;
  background: #fffcf7;
  box-shadow: 0 12px 32px rgba(48, 38, 22, 0.12);
}

.sheet-label {
  margin: 0 0 16px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6a6258;
}

.summary dl {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 12px;
}

.summary dl div {
  flex: 1 1 120px;
  padding: 10px 12px;
  background: #f4f0e6;
  border-radius: 6px;
}

.summary dt {
  margin: 0;
  font-size: 12px;
  color: #5e574e;
}

.summary dd {
  margin: 4px 0 0;
  font-family: "Noto Serif", "Liberation Serif", Georgia, serif;
  font-size: 28px;
  line-height: 1;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.tabs button {
  padding: 8px 12px;
  font-size: 14px;
}

#sheet-note {
  margin-bottom: 10px;
}

.grid-wrap {
  overflow: auto;
  max-height: min(70vh, 720px);
  border: 1px solid #e4dcd0;
  background: #fffcf7;
}

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

caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

th, td {
  border-right: 1px solid #e4dcd0;
  border-bottom: 1px solid #e4dcd0;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-width: 4.5em;
  font-weight: 400;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f4f0e6;
  color: #5e574e;
  font-size: 12px;
}

thead th.old-row,
thead th.new-row,
tbody th {
  background: #f4f0e6;
  color: #5e574e;
  text-align: right;
}

tbody th,
thead th.old-row,
thead th.new-row {
  position: sticky;
  z-index: 1;
}

th.old-row {
  left: 0;
  min-width: 3.4em;
}

th.new-row {
  left: 3.4em;
  min-width: 4.2em;
}

thead th.old-row,
thead th.new-row {
  z-index: 3;
}

td.changed {
  background: #f3e0b5;
}

tr.added td,
tr.added th {
  background: #e5efe4;
}

tr.removed td,
tr.removed th {
  background: #f6e4df;
}

.was {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.3;
  color: #5e574e;
  white-space: pre-wrap;
}

#clip-note {
  margin-top: 8px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 14px 0 0;
  font-size: 13px;
  color: #5e574e;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 14px;
  height: 14px;
  border: 1px solid #c9c0b2;
  border-radius: 3px;
}

.swatch.changed { background: #f3e0b5; }
.swatch.added { background: #e5efe4; }
.swatch.removed { background: #f6e4df; }

[hidden] {
  display: none !important;
}

noscript {
  display: block;
  padding: 16px 20px;
  background: #fff4e8;
}

@media (min-width: 861px) {
  .stage {
    position: sticky;
    top: 24px;
  }
}

@media (max-width: 860px) {
  main {
    grid-template-columns: 1fr;
    padding: 24px 18px 40px;
  }

  h1 {
    font-size: 34px;
  }
}
