:root {
  --ink: #1c1915;
  --mute: #6b6258;
  --paper: #f3eee4;
  --sheet: #fbf7ef;
  --rule: #d7ccbc;
  --seal: #8c2f1d;
  --ok: #2f5d3a;
  --warn: #8a5a12;
  --err: #8c2f1d;
  --preview: #e4dfd4;
  --mono: "IBM Plex Mono", "Source Code Pro", ui-monospace, monospace;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
}

body {
  display: grid;
  grid-template-rows: 64px 1fr 140px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  border-bottom: 1px solid var(--rule);
  background: var(--sheet);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}

.mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.brand .sub {
  display: block;
  color: var(--mute);
  font-size: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}

select,
input,
button {
  font: inherit;
}

select,
input[type="password"] {
  margin-top: 4px;
  min-width: 160px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
}

button {
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

button.primary {
  background: var(--seal);
  color: #fbf7ef;
  border-color: var(--seal);
}

.status {
  margin-left: auto;
  color: var(--mute);
  font-size: 14px;
}

.workspace {
  display: grid;
  grid-template-columns: 220px minmax(0, 1.1fr) minmax(0, 0.9fr);
  min-height: 0;
}

.files,
.editor-pane,
.preview,
.diag {
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--rule);
}

.preview,
.diag {
  border-right: 0;
}

.pane-label {
  padding: 8px 12px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute);
  border-bottom: 1px solid var(--rule);
}

#file-tree {
  list-style: none;
  margin: 0;
  padding: 8px;
}

#file-tree button {
  width: 100%;
  height: auto;
  padding: 6px 8px;
  border: 0;
  text-align: left;
  background: transparent;
}

#file-tree button.active {
  background: #eadfcb;
}

.editor-pane .CodeMirror {
  height: calc(100% - 33px);
  background: var(--sheet);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
}

.CodeMirror-gutters {
  background: var(--paper);
  border-right: 1px solid var(--rule);
}

.preview {
  background: var(--preview);
  position: relative;
  overflow: auto;
}

#pdf-canvas {
  display: block;
  margin: 16px auto;
  max-width: calc(100% - 32px);
  box-shadow: none;
  background: white;
}

#preview-empty {
  position: absolute;
  inset: 48px 16px auto;
  text-align: center;
  color: var(--mute);
}

.diag {
  border-top: 1px solid var(--rule);
  background: var(--sheet);
  overflow: auto;
}

#diag-list {
  list-style: none;
  margin: 0;
  padding: 8px 12px 16px;
  font-family: var(--mono);
  font-size: 12px;
}

#diag-list li {
  padding: 4px 0;
}

#diag-list .error {
  color: var(--err);
}

#diag-list .warning {
  color: var(--warn);
}

dialog {
  border: 1px solid var(--ink);
  background: var(--sheet);
  padding: 20px;
  max-width: 420px;
}

dialog::backdrop {
  background: rgb(28 25 21 / 0.35);
}

dialog menu {
  display: flex;
  justify-content: flex-end;
  padding: 0;
  margin: 16px 0 0;
}
