/* Local Bootstrap-style utilities used by this page only. No framework dependency. */
:root {
  color-scheme: light;
  --bg: #fff;
  --surface: #fff;
  --text: #202020;
  --muted: #686868;
  --border: #c3c3c3;
  --hover: #f5f5f5;
  --selected: #ededed;
  --focus: #555;
  --overlay: #0006;
  --danger: #b42318;
  --bg-secondary: #e1e1de;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #171717;
    --surface: #202020;
    --text: #ededed;
    --muted: #b1b1b1;
    --border: #393939;
    --hover: #292929;
    --selected: #353535;
    --focus: #ccc;
    --overlay: #0009;
    --danger: #ff9b94;
    --bg-secondary: #292929;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171717;
  --surface: #202020;
  --text: #ededed;
  --muted: #b1b1b1;
  --border: #393939;
  --hover: #292929;
  --selected: #353535;
  --focus: #ccc;
  --overlay: #0009;
  --danger: #ff9b94;
  --bg-secondary: #292929;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
*::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.container-fluid,
main,
.editor-panels,
.editor-panel {
  min-width: 0;
  max-width: 100%;
}

html,
body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;

  min-height: 100%;
  font:
    400 14px/1.5 "Poppins",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
}
button,
select,
input,
textarea {
  font: inherit;
  resize: none;
}
button {
  cursor: pointer;
}
h1,
h2,
p {
  margin-top: 0;
}
h1,
h2 {
  font-weight: 500;
  line-height: 1.3;
}
a {
  color: inherit;
}
/* Layout */
.container-fluid {
  width: 100%;
  padding-inline: 12px;
  margin-inline: auto;
}
.container {
  width: 100%;
  max-width: 1000px;
  padding-inline: 12px;
  margin-inline: auto;
}
.container-fluid .container {
  padding-inline: 0px;
}

.d-flex {
  display: flex;
}
.d-inline-flex {
  display: inline-flex;
}
.flex-column {
  flex-direction: column;
}
.flex-grow-1 {
  flex-grow: 1;
}
.flex-shrink-0 {
  flex-shrink: 0;
}
.align-items-center {
  align-items: center;
}
.justify-content-between {
  justify-content: space-between;
}
.min-h-0 {
  min-height: 0;
}
.vh-100 {
  height: 100vh;
  height: 100dvh;
}
/* Spacing: Bootstrap's 4px-based scale */
.gap-2 {
  gap: 8px;
}
.px-3 {
  padding-inline: 16px;
}
.py-2 {
  padding-block: 8px;
}
.py-3 {
  padding-block: 16px;
}
.py-4 {
  padding-block: 24px;
}
.py-5 {
  padding-block: 48px;
}
.pb-3 {
  padding-bottom: 16px;
}
.mb-0 {
  margin-bottom: 0;
}
.mb-1 {
  margin-bottom: 4px;
}
.mb-3 {
  margin-bottom: 16px;
}
.mb-5 {
  margin-bottom: 32px;
}

/* Typography, borders and backgrounds */
.h4 {
  font-size: 22px;
}
.h5 {
  font-size: 20px;
}
.fw-medium {
  font-weight: 500;
}
.text-decoration-none {
  text-decoration: none;
}
.text-body {
  color: var(--text);
}
.text-body-secondary {
  color: var(--muted);
}
.text-center {
  text-align: center;
}
.border-top {
  border-top: 1px solid var(--border);
}
.border-bottom {
  border-bottom: 1px solid var(--border);
}
.bg-body-secondary {
  background: var(--bg-secondary);
}
/* Form control */
.form-label {
  display: inline-block;
}
.form-select {
  display: block;
  min-width: 90px;
  padding: 7px 28px 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
}
.form-select-sm {
  min-height: 36px;
}
.form-select:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}
@media (min-width: 768px) {
  .px-md-4 {
    padding-inline: 24px;
  }
}

/* Multiple editor tabs; isolated document panels, no editor JS changes. */
.document-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  flex: 0 1 auto;
  max-width: 100%;
  padding-block: 2px;
}
.document-tab-list {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.document-tab {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  max-width: 240px;
  font-size: 0.8rem;
}
.document-tab.active {
  background: var(--selected);
  color: var(--text);
  border-color: var(--focus);
}
.document-tab-select,
.document-tab-close,
.tab-add {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.8rem;

  cursor: pointer;
}
.document-tab-select {
  padding: 7px 5px 7px 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 185px;
  font-weight: 500;
}
.document-tab-close {
  width: 30px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 0.8rem;
  margin-right: 1px;
}
.document-tab-close:hover,
.tab-add:hover {
  background: var(--hover);
  color: var(--text);
}
.document-tab-select:focus-visible,
.document-tab-close:focus-visible,
.tab-add:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.tab-add {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  line-height: 1;
}
.editor-panels {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.editor-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.editor-panel[hidden] {
  display: none !important;
}
.editor-panel .je {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  border-radius: 40px;
  corner-shape: superellipse(2);
}
.editor-panel [data-je-body] {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.editor-panel .je-layout {
  height: 100%;
  flex: 1;
  min-height: 0;
}
.editor-panel .je-raw {
  flex: 1;
  min-height: 0;
  height: auto;
  color: var(--text);
}
.editor-panel .je-top,
.editor-panel .je-tree,
.editor-panel .je-search-wrap {
  border-color: var(--border);
}
.editor-panel .je-search-wrap {
  background: var(--surface);
}
.editor-panel .je-btn,
.editor-panel .je-input,
.editor-panel .je-dialog,
.editor-panel .je-raw {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.editor-panel .je-primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.editor-panel .je-btn:hover {
  background: var(--hover);
}
.editor-panel .je-primary:hover {
  background: var(--muted);
  color: var(--bg);
}
.editor-panel .je-node:hover {
  background: var(--hover);
}
.editor-panel .je-node.je-selected {
  background: var(--selected);
}
.editor-panel .je-node:focus-visible {
  outline-color: var(--focus);
}
.editor-panel .je-section,
.editor-panel .je-kind,
.editor-panel .je-preview,
.editor-panel .je-toggle,
.editor-panel .je-icon,
.editor-panel .je-field > span,
.editor-panel .je-help {
  color: var(--muted);
}
.editor-panel .je-error {
  color: var(--danger);
}
.editor-panel .je-modal {
  background: var(--overlay);
}
.editor-panel .je-dialog {
  border: 1px solid var(--border);
}
@media (max-width: 700px) {
  .editor-panel .je-layout {
    height: 100%;
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  }
  .editor-panel .je {
    border-radius: 20px;
  }

  h1,
  p {
    overflow-wrap: break-word;
  }
}

.document-tab-close svg {
  display: block;
  width: 10px;
  height: 10px;
  fill: currentColor;
}

.tab-add {
  display: grid;
  place-items: center;
}
.tab-add svg {
  display: block;
  width: 12px;
  height: 12px;
  fill: currentColor;
}

/* Responsive page header: center heading on desktop, stack on narrow screens. */
.page-header {
  width: 100%;
  min-width: 0;
  gap: 12px;
}
.page-header-spacer,
.page-header-actions {
  flex: 1 1 0;
  min-width: 0;
}
.page-header-heading {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
}
.page-header-heading h1,
.page-header-heading p {
  overflow-wrap: anywhere;
}
.page-header-actions {
  justify-content: flex-end;
}
@media (max-width: 767px) {
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 16px;
  }
  .page-header-spacer {
    display: none;
  }
  .page-header-actions {
    order: -1;
    flex: 0 0 auto;
    justify-content: flex-end;
  }
  .page-header-heading {
    flex: 0 0 auto;
    padding-block: 4px;
  }
  .page-header-heading h1 {
    font-size: clamp(24px, 6vw, 32px);
  }
}
