:root {
  color-scheme: dark;
  --base: #181b22;
  --surface: #222630;
  --raised: #2b303c;
  --edge: #3c4351;
  --text: #edf0f8;
  --muted: #b2bacb;
  --accent: #aec7ff;
  --danger: #ffb4ab;
  font-family: "Noto Sans", "Segoe UI", sans-serif;
  font-size: 14px;
  background: var(--base);
  color: var(--text);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
header {
  min-height: 68px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--edge);
}
#connection {
  margin-right: auto;
  font-size: 12px;
  color: var(--muted);
}
#input-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
#input-controls label {
  flex-wrap: wrap;
}
h1 {
  font-size: 23px;
  font-weight: 500;
  line-height: 1.3;
  margin: 0;
}
h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}
p {
  line-height: 1.6;
}
button,
.button {
  border: 1px solid var(--edge);
  border-radius: 20px;
  padding: 9px 15px;
  background: var(--raised);
  color: var(--text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
button:hover,
.button:hover {
  background: #394150;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.primary {
  background: var(--accent);
  color: #142b52;
  border-color: var(--accent);
}
.primary:hover {
  background: #c6d7ff;
}
.danger {
  color: var(--danger);
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
input,
textarea,
select {
  font: inherit;
  background: var(--base);
  color: var(--text);
  border: 1px solid #657087;
  border-radius: 7px;
  padding: 11px;
  width: 100%;
  min-width: 0;
}
textarea {
  resize: vertical;
}
label {
  display: block;
  line-height: 1.5;
  margin: 14px 0 7px;
}
label > input,
label > textarea,
label > select {
  margin-top: 6px;
}
input[type="color"] {
  height: 45px;
}
input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
}
.inline {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.inline select {
  width: auto;
  margin: 0;
}
.hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.65;
}
.gate {
  max-width: 460px;
  padding: 60px 28px;
  margin: 4vh auto;
}
.gate h1 {
  font-family: "Noto Serif", Georgia, serif;
  font-size: 35px;
}
.gate p {
  color: var(--muted);
}
.gate button {
  width: 100%;
  margin-top: 18px;
}
#desk {
  display: grid;
  grid-template-columns: 260px minmax(330px, 1fr) minmax(320px, 1.1fr);
  min-height: calc(100vh - 68px);
}
.library {
  border-right: 1px solid var(--edge);
  padding: 20px 16px;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
  flex-wrap: wrap;
  overflow-wrap: anywhere;
}
.library .section-title:not(:first-child) {
  margin-top: 28px;
}
.library .section-title button {
  font-size: 12px;
  padding: 7px 10px;
}
.library nav,
.library #templates,
.library #documents {
  display: grid;
  gap: 5px;
}
.entry {
  border: 0;
  border-radius: 8px;
  padding: 10px;
  text-align: left;
  justify-content: flex-start;
  width: 100%;
  background: transparent;
  overflow-wrap: anywhere;
  min-width: 0;
}
.entry[aria-current="true"] {
  background: #35435d;
}
.folder-label {
  font-weight: 700;
  min-width: 40px;
  border-bottom: 3px solid var(--folder-color);
  padding-bottom: 3px;
  color: var(--text);
}
.folder-depth {
  margin-left: var(--depth);
}
.editor {
  padding: 24px;
  overflow: auto;
  max-height: calc(100vh - 68px);
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 14px 0;
}
.toolbar .button,
.toolbar button {
  font-size: 12px;
}
#command-form {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--edge);
}
.field {
  padding: 12px 0;
  border-bottom: 1px solid var(--edge);
}
.field .hint {
  margin: 5px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.field-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.field-header input {
  flex: 1;
}
.preview {
  padding: 24px 16px;
  background: #20242d;
  border-left: 1px solid var(--edge);
}
#preview {
  width: 100%;
  height: calc(100vh - 150px);
  border: 0;
  background: #363b46;
}
#notice,
#draft-storage-status,
#input-preference-status {
  background: #363e51;
  padding: 12px 24px;
  margin: 0;
  white-space: pre-wrap;
}
#conflict {
  padding: 16px;
  background: #4a3034;
  border-radius: 8px;
  margin-top: 20px;
}
dialog {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 20px;
  padding: 26px;
  max-width: min(620px, 94vw);
  width: 520px;
}
dialog::backdrop {
  background: #080b12b8;
}
#costs {
  width: 1000px;
  max-width: 96vw;
}
#usage {
  overflow: auto;
  max-height: 65vh;
  margin-top: 20px;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}
th,
td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid var(--edge);
  white-space: nowrap;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
#save-status {
  font-size: 12px;
  color: var(--muted);
}
[hidden] {
  display: none !important;
}
@media (max-width: 1150px) {
  #desk {
    grid-template-columns: 220px minmax(300px, 1fr);
  }
  .preview {
    grid-column: 2;
    border-top: 1px solid var(--edge);
  }
  .editor {
    max-height: none;
  }
  .library {
    grid-row: span 2;
  }
}
@media (max-width: 680px) {
  header {
    padding: 0 12px;
    gap: 10px;
  }
  header button {
    padding: 8px;
    font-size: 12px;
  }
  #connection {
    font-size: 10px;
  }
  #desk {
    display: block;
  }
  .library {
    border-right: 0;
    border-bottom: 1px solid var(--edge);
    max-height: 340px;
    overflow: auto;
  }
  .editor,
  .preview {
    padding: 20px 16px;
  }
  #preview {
    height: 70vh;
  }
  h1 {
    font-size: 21px;
  }
}
@media (max-width: 680px) {
  header {
    height: auto;
    min-height: 68px;
    flex-wrap: wrap;
    padding: 12px;
  }
  #connection {
    order: 5;
    flex-basis: 100%;
    margin: 0;
  }
  .gate {
    margin-top: 20px;
  }
  .library .entry {
    max-width: 100%;
  }
  .toolbar > * {
    max-width: 100%;
  }
  #preprocessing-report {
    padding-left: 20px;
    font-size: 12px;
    line-height: 1.7;
  }
  #downloads .entry {
    margin-top: 10px;
    overflow-wrap: anywhere;
    white-space: normal;
  }
}
#preprocessing {
  margin: 24px 0;
  padding: 18px 0;
  border-top: 1px solid var(--edge);
  border-bottom: 1px solid var(--edge);
}
#preprocessing-report {
  line-height: 1.7;
  color: var(--muted);
}
