*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  --trn-editor-max-width: 1280px;
  background: #cfd5dd;
  color: #121820;
  font: 13px/1.35 "Segoe UI", Tahoma, system-ui, sans-serif;
}

#app {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

.trn-shell {
  height: 100%;
  min-height: 0;
}

.trn-shell::part(shell) {
  height: 100vh;
  min-height: 0;
  gap: 0;
  padding: 0;
  background: #e9edf2;
  overflow: hidden;
}

.trn-shell::part(header) {
  display: block;
  border-bottom: 0;
  padding: 0;
}

.trn-shell::part(heading),
.trn-shell::part(title) {
  display: block;
}

.trn-shell::part(actions) {
  display: none;
}

.trn-shell::part(status) {
  border-bottom: 1px solid #767f8b;
  background: linear-gradient(#f8fafc, #dde3ea);
  padding: 6px 8px;
}

.trn-shell::part(body) {
  min-height: 0;
  overflow: hidden;
  padding: 8px;
}

.trn-shell::part(footer) {
  border-top: 0;
  padding: 0;
}

.trn-actions,
.trn-block-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.trn-commandbar {
  --awwbookmarklet-surface-gap: 6px;
  display: grid;
  grid-template-columns: auto minmax(240px, 520px) auto;
  align-items: center;
  gap: 12px;
}

.trn-main {
  display: block;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.trn-layout-split {
  height: 100%;
}

.trn-layout-split::part(splitter) {
  margin: 0 4px;
}

.trn-sidebar,
.trn-editor-panel {
  min-height: 0;
  overflow: hidden;
}

.trn-sidebar {
  background: #dfe4ea;
}

.trn-editor-panel {
  background: #f3f5f7;
}

.trn-editor-panel::part(panel),
.trn-sidebar::part(panel),
.trn-sidebar::part(body) {
  height: 100%;
  min-height: 0;
}

.trn-editor-panel::part(panel),
.trn-editor-panel::part(body) {
  height: 100%;
  min-height: 0;
  overflow: auto;
}

.trn-commandbar-primary,
.trn-commandbar-search,
.trn-commandbar-secondary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.trn-commandbar-search {
  justify-self: end;
  width: min(100%, 520px);
  border-inline: 1px solid #a8b0ba;
  padding-inline: 8px;
}

.trn-commandbar-search .trn-input {
  min-width: 0;
  flex: 1;
}

.trn-commandbar-secondary {
  justify-self: end;
}

button.trn-button,
button.trn-icon-button,
button.trn-page-button {
  min-height: 28px;
  border: 1px solid #767f8b;
  background: #edf1f5;
  color: #121820;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #a5adb8;
  cursor: pointer;
}

button.trn-button {
  padding: 3px 10px;
}

button.trn-button.primary {
  background: #315f99;
  color: #fff;
}

awwbookmarklet-button.trn-button {
  --awwbookmarklet-size-control-h: 28px;
  --awwbookmarklet-button-padding-x: 10px;
}

.trn-icon-button {
  --awwbookmarklet-size-control-h: 26px;
  --awwbookmarklet-button-min-width: 26px;
  width: 26px;
}

button.trn-icon-button {
  padding: 0;
}

.trn-icon-button.danger {
  color: #9b1c1c;
}

.trn-page-row {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-bottom: 4px;
  min-width: 0;
}

.trn-page-actions {
  display: none;
  flex: 0 0 auto;
  gap: 2px;
}

.trn-page-row:hover .trn-page-actions,
.trn-page-row:focus-within .trn-page-actions {
  display: flex;
}

.trn-page-row.selected .trn-page-button {
  --awwbookmarklet-button-bg: #dce9fb;
  --awwbookmarklet-border-strong: #315f99;
  background: #dce9fb;
  border-color: #315f99;
}

.trn-page-button {
  --awwbookmarklet-button-min-width: 0;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  width: 100%;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.trn-page-button {
  padding: 4px 6px;
}

.trn-input,
.trn-page-title-input,
.trn-heading-input,
.trn-textarea,
.trn-table input {
  width: 100%;
  border: 1px solid #767f8b;
  background: #fff;
  color: #121820;
  box-shadow: inset 1px 1px 0 #c7cdd5;
}

.trn-input,
.trn-page-title-input,
.trn-heading-input,
.trn-table input {
  min-height: 30px;
  padding: 4px 6px;
}

.trn-input:focus-visible,
.trn-page-title-input:focus-visible,
.trn-heading-input:focus-visible,
.trn-textarea:focus-visible,
.trn-table input:focus-visible,
.trn-search-result:focus-visible {
  outline: 2px solid #174f9c;
  outline-offset: 1px;
}

.trn-page-head {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
  width: min(100%, var(--trn-editor-max-width));
}

.trn-block-add {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  opacity: 0.78;
}

.trn-page-title-input {
  font-size: 20px;
  font-weight: 700;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  padding: 2px 0;
}

.trn-blocks {
  display: grid;
  gap: 12px;
  width: min(100%, var(--trn-editor-max-width));
  padding: 24px 12px 0 0;
}

.trn-block {
  position: relative;
  border: 1px solid transparent;
  background: transparent;
  box-shadow: none;
  padding: 6px 8px;
}

.trn-block:hover,
.trn-block:focus-within,
.trn-block.is-focused {
  border-color: #b5c0cd;
  background: rgba(251, 252, 253, 0.68);
  box-shadow: inset 1px 1px 0 #fff;
}

.trn-block-toolbar {
  position: absolute;
  top: -25px;
  right: 8px;
  justify-content: flex-end;
  gap: 0;
  min-height: 24px;
  padding: 2px;
  border: 1px solid #a8b0ba;
  border-bottom: 0;
  background: #e9edf2;
  box-shadow: inset 1px 1px 0 #fff;
  color: #44505f;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  z-index: 2;
}

.trn-block:hover .trn-block-toolbar,
.trn-block:focus-within .trn-block-toolbar,
.trn-block.is-focused .trn-block-toolbar {
  opacity: 1;
  pointer-events: auto;
}

.trn-block-type-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.trn-block-toolbar span {
  margin-right: auto;
  font-weight: 700;
}

.trn-block-toolbar .trn-icon-button,
.trn-del-button {
  --awwbookmarklet-size-control-h: 20px;
  --awwbookmarklet-button-min-width: 24px;
  width: auto;
  min-width: 24px;
  height: 20px;
}

.trn-del-button {
  color: #711f1a;
}

.trn-del-button:hover,
.trn-del-button:focus-visible {
  --awwbookmarklet-border-strong: #9b1c1c;
  color: #9b1c1c;
}

.trn-transform-menu {
  position: relative;
  display: inline-grid;
  align-items: center;
}

.trn-transform-menu summary {
  display: block;
  min-height: 20px;
  padding: 1px 7px;
  border: 1px solid #767f8b;
  background: #edf1f5;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #a5adb8;
  cursor: pointer;
  list-style: none;
}

.trn-transform-menu summary::-webkit-details-marker {
  display: none;
}

.trn-transform-options {
  position: absolute;
  top: 22px;
  right: 0;
  z-index: 30;
  display: grid;
  min-width: 130px;
  border: 1px solid #767f8b;
  background: #f8fafc;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.18), inset 1px 1px 0 #fff;
  padding: 3px;
}

.trn-transform-options button {
  border: 0;
  background: transparent;
  padding: 5px 7px;
  text-align: left;
}

.trn-transform-options button:hover,
.trn-transform-options button:focus-visible {
  background: #dce9fb;
  outline: none;
}

.trn-rich-text {
  min-height: 1.55em;
  color: #121820;
  line-height: 1.58;
  outline: none;
  overflow-wrap: anywhere;
  padding: 3px 6px;
  white-space: pre-wrap;
}

.trn-rich-text:empty::before {
  content: attr(data-placeholder);
  color: #7a8490;
}

.trn-rich-text:focus-visible {
  box-shadow: -3px 0 0 #174f9c;
}

.trn-block:focus-within .trn-rich-text {
  padding: 5px 9px;
}

.trn-rich-text--paragraph {
  font-size: 15px;
}

.trn-rich-text--heading {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  padding-top: 8px;
}

.trn-rich-text a {
  color: #174f9c;
}

.trn-textarea {
  min-height: 86px;
  padding: 6px;
  resize: vertical;
}

.trn-textarea.quote {
  border-left: 4px solid #315f99;
  background: #fbfcfd;
  font-size: 15px;
  line-height: 1.55;
}

.trn-textarea.code {
  min-height: 140px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  white-space: pre;
}

.trn-source-grid {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.trn-source-details {
  border-left: 3px solid #8492a3;
  padding-left: 10px;
}

.trn-source-details summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.trn-source-title {
  font-weight: 700;
}

.trn-source-domain,
.trn-source-note {
  color: #586272;
}

.trn-source-note {
  margin: 6px 0 0;
}

.trn-source-link {
  color: #174f9c;
  margin-left: auto;
}

.trn-list-items {
  display: grid;
  gap: 2px;
}

.trn-list-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: baseline;
  position: relative;
}

.trn-list-item::before {
  content: "-";
  color: #44505f;
}

.trn-list-input {
  width: 100%;
  min-height: 28px;
  border: 1px solid transparent;
  background: transparent;
  color: #121820;
  box-shadow: none;
  padding: 2px 4px;
}

.trn-list-input:focus-visible {
  border-color: #b5c0cd;
  background: #fff;
  outline: 2px solid #174f9c;
  outline-offset: 1px;
}

.trn-add-list-item {
  justify-self: start;
  margin-left: 18px;
  opacity: 0.72;
}

.trn-block:not(:hover):not(:focus-within) .trn-add-list-item {
  display: none;
}

.trn-table-wrap {
  max-width: 100%;
  overflow: auto;
}

.trn-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.trn-table th,
.trn-table td {
  border: 1px solid #a8b0ba;
  padding: 3px;
  vertical-align: top;
}

.trn-table-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.trn-search-results {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
  border: 1px solid #8db4e8;
  background: #e8f2ff;
  padding: 6px;
}

.trn-search-result {
  display: grid;
  gap: 2px;
  border: 1px solid #a8b0ba;
  background: #fff;
  padding: 5px;
  text-align: left;
}

.trn-search-result:hover {
  background: #f3f8ff;
}

.trn-error,
.trn-unsupported {
  border: 1px solid #da7b73;
  background: #fff0ee;
  color: #711f1a;
  margin-bottom: 8px;
  padding: 8px;
}

.trn-empty {
  border: 1px solid #aeb6c0;
  background: #eef1f4;
  padding: 12px;
}

.trn-statusbar {
  color: #26313d;
}

.trn-statusbar [data-state="failed"] {
  color: #8a1f17;
  font-weight: 700;
}

.trn-statusbar [data-state="dirty"],
.trn-statusbar [data-state="saving"] {
  color: #6d4b00;
}

.trn-document-end-insert {
  width: min(100%, var(--trn-editor-max-width));
  margin-top: 14px;
  border: 1px dashed #a8b0ba;
  background: transparent;
  color: #586272;
  padding: 8px;
  text-align: left;
  cursor: pointer;
}

.trn-document-end-insert:hover,
.trn-document-end-insert:focus-visible {
  border-style: solid;
  background: #fbfcfd;
  color: #121820;
  outline: 2px solid #174f9c;
  outline-offset: 1px;
}

.trn-pastebin {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0.01;
  overflow: hidden;
}

.trn-slash-menu {
  position: absolute;
  z-index: 20;
  width: min(280px, calc(100vw - 24px));
  border: 1px solid #767f8b;
  background: #f8fafc;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.18), inset 1px 1px 0 #fff;
  padding: 4px;
}

.trn-slash-item {
  display: grid;
  gap: 1px;
  width: 100%;
  border: 0;
  background: transparent;
  color: #121820;
  padding: 6px;
  text-align: left;
}

.trn-slash-item span {
  color: #586272;
}

.trn-slash-item.selected,
.trn-slash-item:hover {
  background: #dce9fb;
}

@media (max-width: 760px) {
  html,
  body,
  #app {
    overflow: auto;
  }

  .trn-main {
    height: auto;
  }

  .trn-commandbar {
    grid-template-columns: 1fr;
  }

  .trn-commandbar-search,
  .trn-commandbar-secondary {
    justify-self: stretch;
  }

  .trn-layout-split {
    display: grid;
    gap: 8px;
  }

  .trn-sidebar {
    max-height: 180px;
  }

  .trn-block-add {
    flex-wrap: wrap;
  }
}
